@weatherboard/cms 0.3.0 → 0.5.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.
- package/README.md +31 -7
- package/dist/contracts/query.d.cts +1 -1
- package/dist/contracts/query.d.mts +1 -1
- package/dist/contracts/query.d.ts +1 -1
- package/dist/contracts/text.d.cts +5 -3
- package/dist/contracts/text.d.mts +5 -3
- package/dist/contracts/text.d.ts +5 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/dist/next.cjs +1 -1
- package/dist/next.cjs.map +2 -2
- package/dist/next.mjs +1 -1
- package/dist/next.mjs.map +2 -2
- package/dist/portable/sections.d.cts +5 -1
- package/dist/portable/sections.d.mts +5 -1
- package/dist/portable/sections.d.ts +5 -1
- package/dist/sanity.cjs.map +1 -1
- package/dist/sanity.mjs.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +2 -2
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +2 -2
- package/dist/site-content.cjs +3 -3
- package/dist/site-content.cjs.map +3 -3
- package/dist/site-content.d.cts +1 -1
- package/dist/site-content.d.mts +1 -1
- package/dist/site-content.d.ts +1 -1
- package/dist/site-content.mjs +3 -3
- package/dist/site-content.mjs.map +3 -3
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/portable/array.ts", "../src/contracts/query.ts", "../src/portable/sections.ts", "../src/portable/fallback.ts", "../src/portable/site-content.ts", "../src/contracts/text.ts"],
|
|
4
|
-
"sourcesContent": ["/** Content lists must contain an own entry at every index. */\nexport function isDenseArray(value: unknown): value is unknown[] {\n if (!Array.isArray(value)) return false;\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.hasOwn(value, index)) return false;\n }\n return true;\n}\n", "/** A-1822 S1 owns this implementation. S0 registers the public signatures. */\nexport type CmsParams = Readonly<Record<string, string | number | boolean | null>>;\nexport type CmsDependencies = {\n readonly types: readonly string[];\n readonly ids?: readonly string[];\n};\nexport type CmsResolution<T> = {\n readonly data: T;\n readonly fallbackFields: readonly string[];\n readonly warnings?: readonly \"siteHero.layout.defaulted\"[];\n};\nexport type CmsQuery<T> = {\n readonly name: string;\n readonly query: string;\n readonly params: CmsParams;\n readonly dependencies: CmsDependencies;\n readonly resolve: (raw: unknown, fallback: T) => CmsResolution<T>;\n};\n\nconst TYPE = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;\nconst ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;\nconst SCOPE = /^[a-z0-9]{6,12}\\.[a-z][a-z0-9_-]{0,63}$/;\n\nfunction dependenciesCopy(dependencies: CmsDependencies): CmsDependencies {\n if (!dependencies || !Array.isArray(dependencies.types) || dependencies.types.length === 0) {\n throw new TypeError(\"CMS dependencies require document types\");\n }\n const types = [...dependencies.types];\n for (const type of types) {\n if (typeof type !== \"string\" || !TYPE.test(type)) throw new TypeError(\"Invalid CMS document type\");\n }\n if (dependencies.ids !== undefined && !Array.isArray(dependencies.ids)) throw new TypeError(\"Invalid CMS document IDs\");\n const ids = dependencies.ids === undefined ? undefined : [...dependencies.ids];\n for (const id of ids ?? []) {\n if (typeof id !== \"string\" || !ID.test(id) || /^(drafts|versions)\\./.test(id)) {\n throw new TypeError(\"Invalid CMS document ID\");\n }\n }\n if (new Set(types).size + new Set(ids).size > 128) throw new TypeError(\"Too many CMS tags\");\n return Object.freeze({ types: Object.freeze(types), ...(ids === undefined ? {} : { ids: Object.freeze(ids) }) });\n}\n\nexport function defineCmsQuery<T>(query: CmsQuery<T>): CmsQuery<T> {\n if (!query || typeof query.name !== \"string\" || !/^[A-Za-z][A-Za-z0-9_.-]{0,127}$/.test(query.name)\n || typeof query.query !== \"string\" || query.query.trim() === \"\" || typeof query.resolve !== \"function\") {\n throw new TypeError(\"Invalid CMS query configuration\");\n }\n const params = query.params;\n if (!params || typeof params !== \"object\" || (Object.getPrototypeOf(params) !== Object.prototype && Object.getPrototypeOf(params) !== null)) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n const copied: Record<string, string | number | boolean | null> = {};\n for (const key of Reflect.ownKeys(params)) {\n const descriptor = Object.getOwnPropertyDescriptor(params, key);\n if (typeof key !== \"string\" || !descriptor || !Object.hasOwn(descriptor, \"value\") || !descriptor.enumerable) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n const value: unknown = descriptor.value;\n if (!(value === null || typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value)))) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n Object.defineProperty(copied, key, { value, enumerable: true });\n }\n return Object.freeze({ name: query.name, query: query.query, params: Object.freeze(copied), dependencies: dependenciesCopy(query.dependencies), resolve: query.resolve });\n}\n\nexport function cmsTags(scope: string, dependencies: CmsDependencies): readonly string[] {\n if (typeof scope !== \"string\" || scope.length > 77 || !SCOPE.test(scope)) throw new TypeError(\"Invalid CMS scope\");\n const copied = dependenciesCopy(dependencies);\n const tags = [\n ...[...new Set(copied.types)].sort().map((type) => `cms:${scope}:type:${type}`),\n ...[...new Set(copied.ids ?? [])].sort().map((id) => `cms:${scope}:id:${id}`),\n ];\n return Object.freeze(tags);\n}\n", "/**\n * A-1915 (A-1739 M1c). The reader's half of the shared section set that\n * `@weatherboard/sanity-schema-base` declares in `src/sections.ts` (A-1889):\n * `page.sections[]`, drawn from the four home section types plus\n * `textMediaBlock`, `faqBlock` (items `faqItem`), `galleryBlock` and\n * `contactBlock`.\n *\n * ===========================================================================\n * LAYOUTS ARE THE A-1876 VARIANT NAMES, EXACTLY\n * ===========================================================================\n *\n * The three lists below are the composition variant names, spelled as A-1876\n * spells them, so a contract test can import them and compare them with the\n * UI package's. A missing or unknown stored `layout` resolves to the\n * composition's default and records `section.layout.defaulted`, the rule cms\n * 0.2.0 set for `siteHero.layout`. It never throws and never yields an empty\n * section.\n *\n * ===========================================================================\n * WARNINGS, NOT REFUSALS, FOR THREE THINGS\n * ===========================================================================\n *\n * The rest of this reader refuses a malformed document by name. Three things\n * in a section are warnings instead, each recorded with its path:\n *\n * section.layout.defaulted missing or unknown layout: the default renders\n * section.type.unknown a section `_type` this reader does not know is\n * skipped, so a newer model never breaks a page\n * section.image.missing-alt an image without alt text is DROPPED, never\n * rendered without it\n * section.image.missing-asset an image with no uploaded asset is dropped\n * section.empty.skipped a section left with nothing to show (a gallery\n * whose every photo was dropped, a contact\n * section switched off and empty) is skipped\n */\n\nimport type { ActionInput, CompositionBlockInput, CopyInput } from \"./site-content.js\";\n\n// ---------------------------------------------------------------------------\n// The A-1876 variant names\n// ---------------------------------------------------------------------------\n\n/** `Split`: text with media. */\nexport const SPLIT_LAYOUTS = [\"media-end\", \"media-start\", \"media-below\"] as const;\n/** `HeadingList`: a heading column and a list column. */\nexport const HEADING_LIST_LAYOUTS = [\"beside\", \"stacked\"] as const;\n/** `StaggerRow`: a row of two to four items. */\nexport const STAGGER_ROW_LAYOUTS = [\"staggered\", \"aligned\"] as const;\n\nexport type SplitLayout = (typeof SPLIT_LAYOUTS)[number];\nexport type HeadingListLayout = (typeof HEADING_LIST_LAYOUTS)[number];\nexport type StaggerRowLayout = (typeof STAGGER_ROW_LAYOUTS)[number];\n\n/** What a missing or unknown `layout` resolves to, per composition. */\nexport const SECTION_LAYOUT_DEFAULTS = {\n Split: \"media-end\",\n HeadingList: \"beside\",\n StaggerRow: \"staggered\",\n} as const satisfies { readonly Split: SplitLayout; readonly HeadingList: HeadingListLayout; readonly StaggerRow: StaggerRowLayout };\n\n// ---------------------------------------------------------------------------\n// The section types and the kinds they read as\n// ---------------------------------------------------------------------------\n\n/** Sanity `_type` on the left, the reader's `kind` on the right; the same rows as schema-base's `SECTION_CONTRACTS`. */\nexport const READER_SECTION_KINDS = {\n featureStoriesBlock: \"feature_stories\",\n surfaceCardBlock: \"cta\",\n accentBandBlock: \"accent_band\",\n locationsBlock: \"locations\",\n textMediaBlock: \"text_media\",\n faqBlock: \"faq\",\n galleryBlock: \"gallery\",\n contactBlock: \"contact\",\n} as const;\n\n/** A gallery is a `StaggerRow`, which holds two to four items. */\nexport const READER_GALLERY_PHOTO_MIN = 2;\nexport const READER_GALLERY_PHOTO_LIMIT = 4;\n\n// ---------------------------------------------------------------------------\n// Warnings\n// ---------------------------------------------------------------------------\n\nexport const SECTION_WARNINGS = {\n layoutDefaulted: \"section.layout.defaulted\",\n unknownType: \"section.type.unknown\",\n imageMissingAlt: \"section.image.missing-alt\",\n imageMissingAsset: \"section.image.missing-asset\",\n emptySkipped: \"section.empty.skipped\",\n} as const;\n\nexport type SectionWarningCode = (typeof SECTION_WARNINGS)[keyof typeof SECTION_WARNINGS];\n/** A named warning and the path in the stored document it is about. Never copy. */\nexport type SectionWarning = { readonly code: SectionWarningCode; readonly where: string };\n\n// ---------------------------------------------------------------------------\n// Output types: schema-base's target shapes, every key present\n// ---------------------------------------------------------------------------\n\n/** A Sanity image as a site needs it. `asset` is the image asset's id; `alt` is never empty. */\nexport type SectionImageInput = {\n readonly asset: string;\n readonly alt: string;\n readonly caption: string | null;\n readonly hotspot: { readonly x: number; readonly y: number } | null;\n};\n\nexport type TextMediaSectionInput = {\n readonly kind: \"text_media\";\n readonly anchor: string | null;\n readonly layout: SplitLayout;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly body: CopyInput;\n readonly action: ActionInput | null;\n /** `null` only when the stored photo was dropped (no alt text or no asset); a warning names it. */\n readonly image: SectionImageInput | null;\n};\n\nexport type FaqSectionInput = {\n readonly kind: \"faq\";\n readonly anchor: string | null;\n readonly layout: HeadingListLayout;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly intro: CopyInput | null;\n readonly items: readonly { readonly question: CopyInput; readonly answer: CopyInput }[];\n};\n\nexport type GallerySectionInput = {\n readonly kind: \"gallery\";\n readonly anchor: string | null;\n readonly layout: StaggerRowLayout;\n readonly heading: CopyInput | null;\n readonly images: readonly SectionImageInput[];\n};\n\nexport type ContactSectionInput = {\n readonly kind: \"contact\";\n readonly anchor: string | null;\n readonly layout: SplitLayout;\n readonly heading: CopyInput;\n readonly body: CopyInput | null;\n /** Show the site settings' email address. */\n readonly showEmail: boolean;\n /** Show the site settings' phone number. */\n readonly showPhone: boolean;\n readonly action: ActionInput | null;\n readonly image: SectionImageInput | null;\n};\n\nexport type NewSectionInput = TextMediaSectionInput | FaqSectionInput | GallerySectionInput | ContactSectionInput;\n\n/** One entry of `PageContent.sections`: a home section kind or one of the new kinds. */\nexport type PageSectionInput = Exclude<CompositionBlockInput, { readonly kind: \"campaign\" }> | NewSectionInput;\n", "import { isDenseArray } from \"./array.js\";\nimport {\n READER_ACTION_HREF, READER_JUMP_LINK, READER_PHOTO_SLUG, READER_STORY_LAYOUTS,\n type CompositionInput, type HomeContent, type PageContent, type SiteSettingsContent,\n} from \"./site-content.js\";\nimport {\n HEADING_LIST_LAYOUTS, SECTION_WARNINGS, SPLIT_LAYOUTS, STAGGER_ROW_LAYOUTS,\n type PageSectionInput,\n} from \"./sections.js\";\n\nconst object = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === \"object\" && !Array.isArray(value);\nconst words = (value: unknown): boolean => typeof value === \"string\" && value.trim() !== \"\";\nconst nullableText = (value: unknown): boolean => value === null || typeof value === \"string\";\nconst photo = (value: unknown): boolean => value === null || (typeof value === \"string\" && READER_PHOTO_SLUG.test(value));\nconst href = (value: unknown): boolean => typeof value === \"string\" && READER_ACTION_HREF.test(value);\nconst copy = (value: unknown): boolean => words(value) || (object(value) && words(value.text) && (value.copySource === \"captured\" || value.copySource === \"proposed\"));\nconst optionalCopy = (value: unknown): boolean => value === null || copy(value);\nconst action = (value: unknown): boolean => object(value) && copy(value.label) && href(value.href);\nconst optionalAction = (value: unknown): boolean => value === null || action(value);\n\nconst anchor = (value: unknown): boolean => value === null || (typeof value === \"string\" && READER_JUMP_LINK.test(value));\nconst one = (list: readonly string[], value: unknown): boolean => list.some((name) => name === value);\nconst sectionImage = (value: unknown): boolean => object(value) && words(value.asset) && words(value.alt) && nullableText(value.caption)\n && (value.hotspot === null || (object(value.hotspot) && typeof value.hotspot.x === \"number\" && typeof value.hotspot.y === \"number\"));\n\nfunction homeBlock(block: unknown): boolean {\n if (!object(block)) return false;\n switch (block.kind) {\n case \"campaign\": return optionalAction(block.action) && isDenseArray(block.images) && block.images.every((image: unknown) => typeof image === \"string\" && photo(image));\n case \"locations\": return (block.anchor === null || (typeof block.anchor === \"string\" && READER_JUMP_LINK.test(block.anchor))) && copy(block.heading) && optionalCopy(block.tail) && photo(block.image);\n case \"feature_stories\": return copy(block.heading) && optionalCopy(block.tail) && isDenseArray(block.items) && block.items.length > 0 && block.items.every((item: unknown) => object(item) && copy(item.heading) && copy(item.body) && action(item.action) && photo(item.image) && READER_STORY_LAYOUTS.some((layout) => layout === item.shape) && typeof item.card === \"boolean\");\n case \"accent_band\": return copy(block.heading) && copy(block.body) && optionalAction(block.action) && photo(block.image);\n case \"cta\": return words(block.heading) && nullableText(block.body) && object(block.link) && words(block.link.label) && href(block.link.href);\n default: return false;\n }\n}\n\n/** A-1915: the new page section kinds, as `parseContentPage` returns them. */\nfunction section(value: unknown): boolean {\n if (!object(value)) return false;\n switch (value.kind) {\n case \"campaign\": return false;\n case \"text_media\": return anchor(value.anchor) && one(SPLIT_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.tail)\n && copy(value.body) && optionalAction(value.action) && (value.image === null || sectionImage(value.image));\n case \"faq\": return anchor(value.anchor) && one(HEADING_LIST_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.tail)\n && optionalCopy(value.intro) && isDenseArray(value.items) && value.items.length > 0\n && value.items.every((item: unknown) => object(item) && copy(item.question) && copy(item.answer));\n case \"gallery\": return anchor(value.anchor) && one(STAGGER_ROW_LAYOUTS, value.layout) && optionalCopy(value.heading)\n && isDenseArray(value.images) && value.images.length > 0 && value.images.every(sectionImage);\n case \"contact\": return anchor(value.anchor) && one(SPLIT_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.body)\n && typeof value.showEmail === \"boolean\" && typeof value.showPhone === \"boolean\" && optionalAction(value.action)\n && (value.image === null || sectionImage(value.image));\n default: return homeBlock(value);\n }\n}\n\nfunction sections(value: unknown, warnings: unknown): boolean {\n if (value === undefined) return warnings === undefined;\n if (!isDenseArray(value) || !value.every(section)) return false;\n if (!isDenseArray(warnings) || !warnings.every((warning: unknown) => object(warning)\n && one(Object.values(SECTION_WARNINGS), warning.code) && words(warning.where))) return false;\n const model = value as readonly PageSectionInput[];\n const anchors = model.flatMap((entry) => \"anchor\" in entry && entry.anchor !== null ? [entry.anchor] : []);\n if (new Set(anchors).size !== anchors.length) return false;\n const links = model.flatMap((entry) => {\n switch (entry.kind) {\n case \"text_media\": case \"contact\": case \"accent_band\": return [entry.action?.href];\n case \"feature_stories\": return entry.items.map((item) => item.action.href);\n case \"cta\": return [entry.link.href];\n default: return [];\n }\n });\n return links.every((link) => link === undefined || !link.startsWith(\"#\") || anchors.includes(link.slice(1)));\n}\n\nfunction composition(value: unknown): boolean {\n if (!object(value) || !nullableText(value.intro) || !photo(value.photo) || !isDenseArray(value.blocks)) return false;\n const hero = value.hero;\n if (hero !== null && (!object(hero) || !copy(hero.heading) || !optionalCopy(hero.subline) || !optionalCopy(hero.intro)\n || !photo(hero.image) || !photo(hero.inset) || !optionalAction(hero.cta) || !optionalAction(hero.secondaryCta))) return false;\n if (!value.blocks.every(homeBlock)) return false;\n const model = value as unknown as CompositionInput;\n const anchors = model.blocks.flatMap((block) => block.kind === \"locations\" && block.anchor !== null ? [block.anchor] : []);\n if (new Set(anchors).size !== anchors.length) return false;\n const links = [model.hero?.cta?.href, model.hero?.secondaryCta?.href, ...model.blocks.flatMap((block) => {\n switch (block.kind) {\n case \"campaign\": case \"accent_band\": return [block.action?.href];\n case \"feature_stories\": return block.items.map((item) => item.action.href);\n case \"cta\": return [block.link.href];\n default: return [];\n }\n })];\n return links.every((link) => link === undefined || !link.startsWith(\"#\") || anchors.includes(link.slice(1)));\n}\n\nfunction proposed(value: unknown): boolean {\n return isDenseArray(value) && value.every((line: unknown) => object(line) && words(line.where) && typeof line.text === \"string\");\n}\n\nexport function validHomeFallback(value: unknown): value is HomeContent | null {\n return value === null || (object(value) && composition(value.composition) && typeof value.body === \"string\" && proposed(value.proposedCopy)\n && typeof value.campaign === \"string\" && [\"shown\", \"off\", \"not-started\", \"ended\", \"none\"].includes(value.campaign));\n}\n\nexport function validPageFallback(value: unknown): value is PageContent | null {\n return value === null || (object(value) && words(value.slug) && words(value.title) && composition(value.composition)\n && typeof value.body === \"string\" && typeof value.migrated === \"boolean\" && proposed(value.proposedCopy)\n && sections(value.sections, value.warnings));\n}\n\nexport function validSettingsFallback(value: unknown): value is SiteSettingsContent | null {\n return value === null || (object(value) && words(value.name) && nullableText(value.description) && object(value.contact)\n && nullableText(value.contact.email) && nullableText(value.contact.phone) && isDenseArray(value.social)\n && value.social.every((link: unknown) => object(link) && words(link.network) && typeof link.url === \"string\" && /^https?:\\/\\//.test(link.url)));\n}\n", "/**\n * A-1713. The site content model, read: the home page, content pages and site\n * settings, validated on read and returned in the shape a site's page\n * composition consumes.\n *\n * ===========================================================================\n * READ ONLY, BY CONSTRUCTION\n * ===========================================================================\n *\n * A client site reads its content with a read-only token. All editing goes\n * through the studio's dashboard, which writes to Sanity; nothing on a client\n * site writes, and this module has no write path to call. It is handed a\n * `ContentClient` (a `query` function) and nothing else.\n *\n * ===========================================================================\n * VALIDATED ON READ, BECAUSE SANITY VALIDATION ONLY ADVISES\n * ===========================================================================\n *\n * The schema's rules warn an editor; they do not refuse a publish, and\n * anything writing over the API skips them entirely. So every document is\n * checked here again, and a malformed one is refused BY NAME\n * (`MalformedContentError`, code `malformed-content`) listing every problem\n * with its path, rather than rendered half-empty. A page that renders with a\n * missing headline and a page whose content is broken look identical to a\n * visitor; a build that fails naming `hero.headline` does not.\n *\n * Absent is not malformed: `null` from `home()` means nobody has created the\n * home page yet, and a site decides what to do about that.\n *\n * ===========================================================================\n * THE SHAPE IT RETURNS\n * ===========================================================================\n *\n * The INPUT shape of a site's composition schema (the reference build's\n * frontmatter): a copy value is a plain string for the client's own words\n * with no claim about their source, `{ text, copySource: \"captured\" }` for\n * words claimed verbatim from the capture (the site checks every such claim\n * against its capture evidence, so the claim must survive Sanity), and\n * `{ text, copySource: \"proposed\" }` for studio-written words awaiting\n * approval. All three round-trip exactly; a photo is its library slug; every key a block declares is\n * present, `null` where there is nothing. So a site validates this with the\n * same schema it validates its Markdown frontmatter with, and its components\n * never know where the content came from.\n *\n * Mapping from the generic model to the composition's names:\n *\n * hero.headline / subline / lead hero.heading / subline / intro\n * hero.photos[0], [1] hero.image, hero.inset\n * hero.primaryAction / secondary... hero.cta / secondaryCta\n * campaign (when shown) the FIRST block, kind `campaign`, and\n * the page body (`# title` + its text)\n * featureStoriesBlock kind `feature_stories`\n * surfaceCardBlock kind `cta`\n * accentBandBlock kind `accent_band`\n * locationsBlock kind `locations` (jumpLink \u2192 anchor)\n *\n * A content page's `sections[]` (A-1915) reads those four kinds plus\n * `text_media`, `faq`, `gallery` and `contact` into `PageContent.sections`,\n * with their named warnings in `PageContent.warnings`. `sections.ts` holds the\n * kinds, the A-1876 layout names and the warning codes.\n *\n * Two places the composition cannot carry a proposed marker: a `cta` block's\n * plain strings, and the campaign's title and body (which travel as Markdown).\n * There the text is returned plain and the line is still listed in\n * `proposedCopy`, which is the list a dashboard and a site both read for\n * approval. Nothing is dropped silently.\n */\n\nimport { isDenseArray } from \"./array.js\";\nimport { defineCmsQuery, type CmsQuery, type CmsResolution } from \"../contracts/query.js\";\nimport { validHomeFallback, validPageFallback, validSettingsFallback } from \"./fallback.js\";\nimport {\n HEADING_LIST_LAYOUTS, READER_GALLERY_PHOTO_LIMIT, READER_GALLERY_PHOTO_MIN, SECTION_LAYOUT_DEFAULTS, SECTION_WARNINGS,\n SPLIT_LAYOUTS, STAGGER_ROW_LAYOUTS,\n type FaqSectionInput, type PageSectionInput, type SectionImageInput, type SectionWarning,\n} from \"./sections.js\";\n\n// ---------------------------------------------------------------------------\n// Output types\n// ---------------------------------------------------------------------------\n\nexport type CopyInput = string | { readonly text: string; readonly copySource: \"captured\" | \"proposed\" };\nexport type ActionInput = { readonly label: CopyInput; readonly href: string };\n\nexport type HeroInput = {\n readonly heading: CopyInput;\n readonly subline: CopyInput | null;\n readonly intro: CopyInput | null;\n readonly image: string | null;\n readonly inset: string | null;\n readonly cta: ActionInput | null;\n readonly secondaryCta: ActionInput | null;\n};\n\nexport type StoryInput = {\n readonly heading: CopyInput;\n readonly body: CopyInput;\n readonly action: ActionInput;\n readonly image: string | null;\n readonly shape: \"wide\" | \"tall\" | \"round\" | \"free\";\n readonly card: boolean;\n};\n\nexport type CompositionBlockInput =\n | { readonly kind: \"campaign\"; readonly action: ActionInput | null; readonly images: readonly string[] }\n | {\n readonly kind: \"locations\";\n readonly anchor: string | null;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly image: string | null;\n }\n | {\n readonly kind: \"feature_stories\";\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly items: readonly StoryInput[];\n }\n | {\n readonly kind: \"accent_band\";\n readonly heading: CopyInput;\n readonly body: CopyInput;\n readonly action: ActionInput | null;\n readonly image: string | null;\n }\n | {\n readonly kind: \"cta\";\n readonly heading: string;\n readonly body: string | null;\n readonly link: { readonly label: string; readonly href: string };\n };\n\nexport type CompositionInput = {\n readonly intro: string | null;\n readonly photo: string | null;\n readonly hero: HeroInput | null;\n readonly blocks: readonly CompositionBlockInput[];\n};\n\n/** One line of studio-written copy awaiting approval, and where it is in the document. */\nexport type ProposedCopy = { readonly where: string; readonly text: string };\n\nexport type CampaignState = \"shown\" | \"off\" | \"not-started\" | \"ended\" | \"none\";\n\nexport type HomeContent = {\n readonly composition: CompositionInput;\n /** The page body as Markdown: the campaign's title and text when it is shown, otherwise empty. */\n readonly body: string;\n readonly campaign: CampaignState;\n readonly proposedCopy: readonly ProposedCopy[];\n};\n\nexport type PageContent = {\n readonly slug: string;\n readonly title: string;\n readonly composition: CompositionInput;\n readonly body: string;\n readonly migrated: boolean;\n readonly proposedCopy: readonly ProposedCopy[];\n /**\n * A-1915. Present only when the stored page has a `sections` list, so a page\n * written before sections existed reads exactly as it did in 0.2.0.\n */\n readonly sections?: readonly PageSectionInput[];\n /** A-1915. Present with `sections`: every named section warning, with its path. */\n readonly warnings?: readonly SectionWarning[];\n};\n\nexport type SiteSettingsContent = {\n readonly name: string;\n readonly description: string | null;\n readonly contact: { readonly email: string | null; readonly phone: string | null };\n readonly social: readonly { readonly network: string; readonly url: string }[];\n};\n\n// ---------------------------------------------------------------------------\n// The refusal\n// ---------------------------------------------------------------------------\n\nexport const MALFORMED_CONTENT = \"malformed-content\";\n\nexport class MalformedContentError extends Error {\n readonly code = MALFORMED_CONTENT;\n readonly documentId: string;\n readonly problems: readonly string[];\n\n constructor(documentId: string, problems: readonly string[]) {\n super(`${MALFORMED_CONTENT}: ${documentId}: ${problems.join(\"; \")}`);\n this.name = \"MalformedContentError\";\n this.documentId = documentId;\n this.problems = problems;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The rules restated\n// ---------------------------------------------------------------------------\n\n/*\n * Runtime-free rules shared with schema-base. The schema adapter imports these\n * objects; content-client compatibility tests pin the shared references.\n */\nexport const READER_PHOTO_SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\nexport const READER_ACTION_HREF =\n /^(?:\\/(?![/\\\\])[^\\s]*|#[a-z][a-z0-9]*(?:-[a-z0-9]+)*|mailto:[^\\s@]+@[^\\s@]+|tel:\\+?[0-9][0-9 ()-]*|https?:\\/\\/[^\\s/]+[^\\s]*)$/;\nexport const READER_JUMP_LINK = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nexport const READER_STORY_LAYOUTS = [\"wide\", \"tall\", \"round\", \"free\"] as const;\nexport const READER_HOME_PAGE_ID = \"homePage\";\nexport const READER_SITE_SETTINGS_ID = \"siteSettings\";\n\n// ---------------------------------------------------------------------------\n// A small path-aware reader\n// ---------------------------------------------------------------------------\n\ntype Raw = Record<string, unknown>;\n\nclass Reading {\n readonly problems: string[] = [];\n readonly proposed: ProposedCopy[] = [];\n\n fail(path: string, message: string): null {\n this.problems.push(`${path} ${message}`);\n return null;\n }\n\n object(value: unknown, path: string): Raw | null {\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) return value as Raw;\n return this.fail(path, \"is not an object\");\n }\n\n dense(value: unknown[], path: string): boolean {\n if (isDenseArray(value)) return true;\n this.fail(path, \"contains missing entries\");\n return false;\n }\n\n optionalString(value: unknown, path: string): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === \"string\") return value.trim() === \"\" ? null : value;\n return this.fail(path, \"is not text\");\n }\n\n /** A copy value, or null when absent or empty. Records a proposed line. */\n copy(value: unknown, path: string): CopyInput | null {\n if (value === undefined || value === null) return null;\n const raw = this.object(value, path);\n if (raw === null) return null;\n const text = raw[\"text\"];\n const source = raw[\"copySource\"];\n if (text !== undefined && typeof text !== \"string\") return this.fail(`${path}.text`, \"is not text\");\n if (source !== undefined && source !== \"captured\" && source !== \"proposed\") {\n return this.fail(`${path}.copySource`, `is ${JSON.stringify(source)}, not captured or proposed`);\n }\n if (typeof text !== \"string\" || text.trim() === \"\") return null;\n if (source === \"proposed\") {\n this.proposed.push({ where: path, text });\n return { text, copySource: \"proposed\" };\n }\n if (source === \"captured\") return { text, copySource: \"captured\" };\n return text;\n }\n\n requiredCopy(value: unknown, path: string): CopyInput | null {\n const copy = this.copy(value, path);\n if (copy === null && !this.problems.some((p) => p.startsWith(path))) this.fail(path, \"is missing its words\");\n return copy;\n }\n\n photo(value: unknown, path: string): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === \"string\" && READER_PHOTO_SLUG.test(value)) return value;\n return this.fail(path, `is ${JSON.stringify(value)}, not a photo library slug`);\n }\n\n photos(value: unknown, path: string, max: number): string[] {\n if (value === undefined || value === null) return [];\n if (!Array.isArray(value)) {\n this.fail(path, \"is not a list of photos\");\n return [];\n }\n if (!this.dense(value, path)) return [];\n if (value.length > max) this.fail(path, `holds ${String(value.length)} photos; at most ${String(max)}`);\n return value.map((entry, index) => this.photo(entry, `${path}[${String(index)}]`)).filter((p): p is string => p !== null);\n }\n\n action(value: unknown, path: string): ActionInput | null {\n if (value === undefined || value === null) return null;\n const raw = this.object(value, path);\n if (raw === null) return null;\n const label = this.requiredCopy(raw[\"label\"], `${path}.label`);\n const href = raw[\"href\"];\n if (typeof href !== \"string\" || !READER_ACTION_HREF.test(href)) {\n return this.fail(`${path}.href`, `is ${JSON.stringify(href)}, not a site path, #jump-link, mailto:, tel: or web address`);\n }\n return label === null ? null : { label, href };\n }\n\n requiredAction(value: unknown, path: string): ActionInput | null {\n if (value === undefined || value === null) return this.fail(path, \"is missing\");\n return this.action(value, path);\n }\n}\n\nfunction plain(copy: CopyInput): string {\n return typeof copy === \"string\" ? copy : copy.text;\n}\n\n// ---------------------------------------------------------------------------\n// Portable Text to Markdown\n// ---------------------------------------------------------------------------\n\n/**\n * The narrow Portable Text `portableText` declares, back to Markdown: normal,\n * h2, h3 and quote blocks, bullet and numbered lists, bold, italic, code and\n * links. It is the inverse of the seed package's Markdown mapper, and the\n * round-trip test holds the two to each other.\n *\n * An uploaded image inside rich text is REFUSED, not dropped: nothing can\n * upload one yet (the dashboard slice decides how), so one arriving means\n * something wrote the document by hand, and a page silently missing a picture\n * is the failure this reader exists to prevent.\n */\nexport function portableTextToMarkdown(value: unknown): string {\n const reading = new Reading();\n const markdown = richTextToMarkdown(value, \"body\", reading);\n if (reading.problems.length > 0) throw new MalformedContentError(\"body\", reading.problems);\n return markdown;\n}\n\nfunction richTextToMarkdown(value: unknown, path: string, reading: Reading): string {\n if (value === undefined || value === null) return \"\";\n if (!Array.isArray(value)) {\n reading.fail(path, \"is not rich text\");\n return \"\";\n }\n if (!reading.dense(value, path)) return \"\";\n const out: string[] = [];\n let previousWasList = false;\n value.forEach((member, index) => {\n const at = `${path}[${String(index)}]`;\n const block = reading.object(member, at);\n if (block === null) return;\n if (block[\"_type\"] !== \"block\") {\n reading.fail(at, `is a ${JSON.stringify(block[\"_type\"])}; only text is supported in rich text so far`);\n return;\n }\n const text = spansToMarkdown(block, at, reading);\n const listItem = block[\"listItem\"];\n const style = block[\"style\"] ?? \"normal\";\n let line: string;\n if (listItem === \"bullet\" || listItem === \"number\") {\n const level = typeof block[\"level\"] === \"number\" && block[\"level\"] > 1 ? block[\"level\"] : 1;\n line = `${\" \".repeat(level - 1)}${listItem === \"bullet\" ? \"-\" : \"1.\"} ${text}`;\n } else if (style === \"h2\") line = `## ${text}`;\n else if (style === \"h3\") line = `### ${text}`;\n else if (style === \"blockquote\") line = `> ${text}`;\n else if (style === \"normal\") line = text;\n else {\n reading.fail(`${at}.style`, `is ${JSON.stringify(style)}, which the schema does not offer`);\n return;\n }\n const isList = listItem === \"bullet\" || listItem === \"number\";\n if (out.length > 0) out.push(isList && previousWasList ? \"\\n\" : \"\\n\\n\");\n out.push(line);\n previousWasList = isList;\n });\n return out.join(\"\");\n}\n\nconst DECORATORS: Record<string, string> = { strong: \"**\", em: \"*\", code: \"`\" };\n\nfunction spansToMarkdown(block: Raw, path: string, reading: Reading): string {\n const links = new Map<string, string>();\n const markDefs = Array.isArray(block[\"markDefs\"]) ? (block[\"markDefs\"] as unknown[]) : [];\n if (!reading.dense(markDefs, `${path}.markDefs`)) return \"\";\n for (const def of markDefs) {\n const d = def as Raw;\n if (d[\"_type\"] === \"link\" && typeof d[\"_key\"] === \"string\" && typeof d[\"href\"] === \"string\") links.set(d[\"_key\"], d[\"href\"]);\n }\n const children = Array.isArray(block[\"children\"]) ? (block[\"children\"] as unknown[]) : [];\n if (!reading.dense(children, `${path}.children`)) return \"\";\n return children\n .map((child, index) => {\n const span = child as Raw;\n if (span[\"_type\"] !== \"span\" || typeof span[\"text\"] !== \"string\") {\n reading.fail(`${path}.children[${String(index)}]`, \"is not a text span\");\n return \"\";\n }\n let text = span[\"text\"];\n const marks = Array.isArray(span[\"marks\"]) ? (span[\"marks\"] as unknown[]) : [];\n if (!reading.dense(marks, `${path}.children[${String(index)}].marks`)) return \"\";\n let href: string | null = null;\n for (const mark of marks) {\n if (typeof mark !== \"string\") continue;\n const fence = DECORATORS[mark];\n if (fence !== undefined) text = `${fence}${text}${fence}`;\n else if (links.has(mark)) href = links.get(mark) ?? null;\n else reading.fail(`${path}.children[${String(index)}].marks`, `names ${JSON.stringify(mark)}, which is neither a style nor a link`);\n }\n return href === null ? text : `[${text}](${href})`;\n })\n .join(\"\");\n}\n\n// ---------------------------------------------------------------------------\n// The home page\n// ---------------------------------------------------------------------------\n\n/** Whether a campaign is shown at `now`, and if not, why not. */\nexport function campaignState(campaign: unknown, now: Date): CampaignState {\n if (typeof campaign !== \"object\" || campaign === null) return \"none\";\n const c = campaign as Raw;\n if (c[\"enabled\"] !== true) return \"off\";\n const starts = typeof c[\"startsAt\"] === \"string\" ? Date.parse(c[\"startsAt\"]) : null;\n const ends = typeof c[\"endsAt\"] === \"string\" ? Date.parse(c[\"endsAt\"]) : null;\n if (starts !== null && now.getTime() < starts) return \"not-started\";\n if (ends !== null && now.getTime() >= ends) return \"ended\";\n return \"shown\";\n}\n\nfunction keyed(path: string, raw: Raw, index: number): string {\n return typeof raw[\"_key\"] === \"string\" ? `${path}[_key==\"${raw[\"_key\"]}\"]` : `${path}[${String(index)}]`;\n}\n\n/**\n * A stored home page document, validated and mapped. Throws\n * `MalformedContentError` naming every problem. `now` decides whether a\n * scheduled campaign is shown, and is a parameter so a build, a preview and a\n * test each say which moment they mean.\n */\nexport function parseHomePage(document: unknown, options: { readonly now: Date }): HomeContent {\n const reading = new Reading();\n const doc = reading.object(document, \"homePage\");\n if (doc === null) throw new MalformedContentError(READER_HOME_PAGE_ID, reading.problems);\n const id = typeof doc[\"_id\"] === \"string\" ? doc[\"_id\"] : READER_HOME_PAGE_ID;\n if (doc[\"_type\"] !== \"homePage\") reading.fail(\"_type\", `is ${JSON.stringify(doc[\"_type\"])}, not homePage`);\n\n let hero: HeroInput | null = null;\n const rawHero = doc[\"hero\"] === undefined ? reading.fail(\"hero\", \"is missing\") : reading.object(doc[\"hero\"], \"hero\");\n if (rawHero !== null) {\n const photos = reading.photos(rawHero[\"photos\"], \"hero.photos\", 2);\n const heading = reading.requiredCopy(rawHero[\"headline\"], \"hero.headline\");\n const subline = reading.copy(rawHero[\"subline\"], \"hero.subline\");\n const intro = reading.copy(rawHero[\"lead\"], \"hero.lead\");\n const cta = reading.action(rawHero[\"primaryAction\"], \"hero.primaryAction\");\n const secondaryCta = reading.action(rawHero[\"secondaryAction\"], \"hero.secondaryAction\");\n if (heading !== null) {\n hero = { heading, subline, intro, image: photos[0] ?? null, inset: photos[1] ?? null, cta, secondaryCta };\n }\n }\n\n const blocks: CompositionBlockInput[] = [];\n const blockJumps: { where: string; href: string }[] = [];\n let body = \"\";\n const state = campaignState(doc[\"campaign\"], options.now);\n if (state === \"shown\") {\n const campaign = reading.object(doc[\"campaign\"], \"campaign\");\n if (campaign !== null) {\n const title = reading.requiredCopy(campaign[\"title\"], \"campaign.title\");\n const images = reading.photos(campaign[\"photos\"], \"campaign.photos\", 3);\n if (images.length === 0) reading.fail(\"campaign.photos\", \"is empty; a shown campaign needs at least one photo\");\n const text = richTextToMarkdown(campaign[\"body\"], \"campaign.body\", reading);\n if (text === \"\") reading.fail(\"campaign.body\", \"is empty; a shown campaign needs its text\");\n if (campaign[\"bodyCopySource\"] === \"proposed\") reading.proposed.push({ where: \"campaign.body\", text });\n const action = reading.action(campaign[\"action\"], \"campaign.action\");\n if (action !== null) blockJumps.push({ where: \"campaign.action.href\", href: action.href });\n if (title !== null) body = `# ${plain(title)}\\n\\n${text}`;\n blocks.push({ kind: \"campaign\", action, images });\n }\n }\n\n const anchors: string[] = [];\n const rawBlocks = doc[\"blocks\"] ?? [];\n if (!Array.isArray(rawBlocks)) reading.fail(\"blocks\", \"is not a list\");\n else if (reading.dense(rawBlocks, \"blocks\")) {\n rawBlocks.forEach((member, index) => {\n const raw = reading.object(member, `blocks[${String(index)}]`);\n if (raw === null) return;\n const at = keyed(\"blocks\", raw, index);\n const mapped = mapBlock(raw, at, reading);\n if (mapped === null) return;\n blockJumps.push(...buttonsOf(mapped, raw, at));\n if (mapped.kind === \"locations\" && mapped.anchor !== null) {\n if (anchors.includes(mapped.anchor)) reading.fail(`${at}.jumpLink`, `repeats \"${mapped.anchor}\", already used by another section`);\n anchors.push(mapped.anchor);\n }\n blocks.push(mapped);\n });\n }\n\n // A jump link on ANY button must land on a section of this page.\n const jumps: { where: string; href: string }[] = [];\n if (hero?.cta) jumps.push({ where: \"hero.primaryAction.href\", href: hero.cta.href });\n if (hero?.secondaryCta) jumps.push({ where: \"hero.secondaryAction.href\", href: hero.secondaryCta.href });\n jumps.push(...blockJumps);\n for (const { where, href } of jumps) {\n if (href.startsWith(\"#\") && !anchors.includes(href.slice(1))) {\n reading.fail(where, `jumps to ${href}, which no section on the page is named`);\n }\n }\n\n if (reading.problems.length > 0) throw new MalformedContentError(id, reading.problems);\n return {\n composition: { intro: null, photo: null, hero, blocks },\n body,\n campaign: state,\n proposedCopy: reading.proposed,\n };\n}\n\n/** Every button a mapped section carries, with its path in the stored document. */\nfunction buttonsOf(block: CompositionBlockInput, raw: Raw, at: string): { where: string; href: string }[] {\n switch (block.kind) {\n case \"feature_stories\": {\n const stories = Array.isArray(raw[\"stories\"]) ? (raw[\"stories\"] as Raw[]) : [];\n return block.items.map((item, index) => ({\n where: `${keyed(`${at}.stories`, stories[index] ?? {}, index)}.action.href`,\n href: item.action.href,\n }));\n }\n case \"accent_band\":\n return block.action === null ? [] : [{ where: `${at}.action.href`, href: block.action.href }];\n case \"cta\":\n return [{ where: `${at}.action.href`, href: block.link.href }];\n default:\n return [];\n }\n}\n\nfunction jumpLinkOf(raw: Raw, at: string, reading: Reading): string | null {\n const jump = raw[\"jumpLink\"];\n if (jump === undefined || jump === null || jump === \"\") return null;\n if (typeof jump !== \"string\" || !READER_JUMP_LINK.test(jump)) return reading.fail(`${at}.jumpLink`, `is ${JSON.stringify(jump)}, not lowercase words joined by hyphens`);\n return jump;\n}\n\nfunction mapBlock(raw: Raw, at: string, reading: Reading): CompositionBlockInput | null {\n switch (raw[\"_type\"]) {\n case \"featureStoriesBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const stories = raw[\"stories\"];\n if (!Array.isArray(stories) || stories.length === 0) return reading.fail(`${at}.stories`, \"has no stories\");\n if (!reading.dense(stories, `${at}.stories`)) return null;\n const items: StoryInput[] = [];\n stories.forEach((member, index) => {\n const story = reading.object(member, `${at}.stories[${String(index)}]`);\n if (story === null) return;\n const sat = keyed(`${at}.stories`, story, index);\n const sHeading = reading.requiredCopy(story[\"heading\"], `${sat}.heading`);\n const sBody = reading.requiredCopy(story[\"body\"], `${sat}.body`);\n const action = reading.requiredAction(story[\"action\"], `${sat}.action`);\n const image = reading.photo(story[\"photo\"], `${sat}.photo`);\n const layout = story[\"layout\"] ?? \"wide\";\n if (!(READER_STORY_LAYOUTS as readonly unknown[]).includes(layout)) {\n reading.fail(`${sat}.layout`, `is ${JSON.stringify(layout)}, not wide, tall, round or free`);\n return;\n }\n const onCard = story[\"onCard\"] ?? false;\n if (typeof onCard !== \"boolean\") {\n reading.fail(`${sat}.onCard`, \"is not on or off\");\n return;\n }\n if (sHeading === null || sBody === null || action === null) return;\n items.push({ heading: sHeading, body: sBody, action, image, shape: layout as StoryInput[\"shape\"], card: onCard });\n });\n return heading === null ? null : { kind: \"feature_stories\", heading, tail, items };\n }\n case \"surfaceCardBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.copy(raw[\"body\"], `${at}.body`);\n const action = reading.requiredAction(raw[\"action\"], `${at}.action`);\n if (heading === null || action === null) return null;\n return {\n kind: \"cta\",\n heading: plain(heading),\n body: body === null ? null : plain(body),\n link: { label: plain(action.label), href: action.href },\n };\n }\n case \"accentBandBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.requiredCopy(raw[\"body\"], `${at}.body`);\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = reading.photo(raw[\"photo\"], `${at}.photo`);\n if (heading === null || body === null) return null;\n return { kind: \"accent_band\", heading, body, action, image };\n }\n case \"locationsBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const image = reading.photo(raw[\"photo\"], `${at}.photo`);\n return heading === null ? null : { kind: \"locations\", anchor, heading, tail, image };\n }\n default:\n return reading.fail(`${at}._type`, `is ${JSON.stringify(raw[\"_type\"])}, not a section type this reader knows`);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Page sections (A-1915)\n// ---------------------------------------------------------------------------\n\n/** A stored `layout`, or the composition default with a named warning. Never throws. */\nfunction sectionLayout<T extends string>(raw: Raw, at: string, layouts: readonly T[], fallback: T, warnings: SectionWarning[]): T {\n const value = raw[\"layout\"];\n const layout = layouts.find((name) => name === value);\n if (layout !== undefined) return layout;\n warnings.push({ code: SECTION_WARNINGS.layoutDefaulted, where: `${at}.layout` });\n return fallback;\n}\n\n/** An `imageWithHotspot`, or null. Without alt text or an asset it is dropped with a named warning. */\nfunction sectionImage(value: unknown, path: string, reading: Reading, warnings: SectionWarning[]): SectionImageInput | null {\n if (value === undefined || value === null) return null;\n const raw = reading.object(value, path);\n if (raw === null) return null;\n const asset = raw[\"asset\"];\n const ref = typeof asset === \"object\" && asset !== null ? (asset as Raw)[\"_ref\"] : undefined;\n if (typeof ref !== \"string\" || ref === \"\") {\n warnings.push({ code: SECTION_WARNINGS.imageMissingAsset, where: `${path}.asset` });\n return null;\n }\n const alt = raw[\"alt\"];\n if (typeof alt !== \"string\" || alt.trim() === \"\") {\n warnings.push({ code: SECTION_WARNINGS.imageMissingAlt, where: `${path}.alt` });\n return null;\n }\n const caption = reading.optionalString(raw[\"caption\"], `${path}.caption`);\n let hotspot: SectionImageInput[\"hotspot\"] = null;\n if (raw[\"hotspot\"] !== undefined && raw[\"hotspot\"] !== null) {\n const spot = reading.object(raw[\"hotspot\"], `${path}.hotspot`);\n const x = spot?.[\"x\"];\n const y = spot?.[\"y\"];\n if (typeof x === \"number\" && typeof y === \"number\" && x >= 0 && x <= 1 && y >= 0 && y <= 1) hotspot = { x, y };\n else if (spot !== null) reading.fail(`${path}.hotspot`, \"is not a point inside the image\");\n }\n return { asset: ref, alt, caption, hotspot };\n}\n\nfunction mapSection(raw: Raw, at: string, reading: Reading, warnings: SectionWarning[]): PageSectionInput | null {\n switch (raw[\"_type\"]) {\n case \"featureStoriesBlock\":\n case \"surfaceCardBlock\":\n case \"accentBandBlock\":\n case \"locationsBlock\": {\n const block = mapBlock(raw, at, reading);\n return block === null || block.kind === \"campaign\" ? null : block;\n }\n case \"textMediaBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const body = reading.requiredCopy(raw[\"body\"], `${at}.body`);\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = sectionImage(raw[\"photo\"], `${at}.photo`, reading, warnings);\n const layout = sectionLayout(raw, at, SPLIT_LAYOUTS, SECTION_LAYOUT_DEFAULTS.Split, warnings);\n if (heading === null || body === null) return null;\n return { kind: \"text_media\", anchor, layout, heading, tail, body, action, image };\n }\n case \"faqBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const intro = reading.copy(raw[\"intro\"], `${at}.intro`);\n const layout = sectionLayout(raw, at, HEADING_LIST_LAYOUTS, SECTION_LAYOUT_DEFAULTS.HeadingList, warnings);\n const rawItems = raw[\"items\"];\n if (!Array.isArray(rawItems) || rawItems.length === 0) return reading.fail(`${at}.items`, \"has no questions\");\n if (!reading.dense(rawItems, `${at}.items`)) return null;\n const items: FaqSectionInput[\"items\"][number][] = [];\n rawItems.forEach((member, index) => {\n const item = reading.object(member, `${at}.items[${String(index)}]`);\n if (item === null) return;\n const iat = keyed(`${at}.items`, item, index);\n if (item[\"_type\"] !== undefined && item[\"_type\"] !== \"faqItem\") {\n reading.fail(`${iat}._type`, `is ${JSON.stringify(item[\"_type\"])}, not faqItem`);\n return;\n }\n const question = reading.requiredCopy(item[\"question\"], `${iat}.question`);\n const answer = reading.requiredCopy(item[\"answer\"], `${iat}.answer`);\n if (question !== null && answer !== null) items.push({ question, answer });\n });\n return heading === null ? null : { kind: \"faq\", anchor, layout, heading, tail, intro, items };\n }\n case \"galleryBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.copy(raw[\"heading\"], `${at}.heading`);\n const layout = sectionLayout(raw, at, STAGGER_ROW_LAYOUTS, SECTION_LAYOUT_DEFAULTS.StaggerRow, warnings);\n const photos = raw[\"photos\"] ?? [];\n if (!Array.isArray(photos)) return reading.fail(`${at}.photos`, \"is not a list of photos\");\n if (!reading.dense(photos, `${at}.photos`)) return null;\n if (photos.length < READER_GALLERY_PHOTO_MIN || photos.length > READER_GALLERY_PHOTO_LIMIT) {\n return reading.fail(`${at}.photos`, `holds ${String(photos.length)} photos; a gallery shows ${String(READER_GALLERY_PHOTO_MIN)} to ${String(READER_GALLERY_PHOTO_LIMIT)}`);\n }\n const images = photos.flatMap((photo, index) => {\n const image = sectionImage(photo, keyed(`${at}.photos`, typeof photo === \"object\" && photo !== null ? (photo as Raw) : {}, index), reading, warnings);\n return image === null ? [] : [image];\n });\n if (images.length === 0) {\n warnings.push({ code: SECTION_WARNINGS.emptySkipped, where: at });\n return null;\n }\n return { kind: \"gallery\", anchor, layout, heading, images };\n }\n case \"contactBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.copy(raw[\"body\"], `${at}.body`);\n const shown = (field: \"showEmail\" | \"showPhone\"): boolean => {\n const value = raw[field] ?? true;\n if (typeof value === \"boolean\") return value;\n reading.fail(`${at}.${field}`, \"is not on or off\");\n return false;\n };\n const showEmail = shown(\"showEmail\");\n const showPhone = shown(\"showPhone\");\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = sectionImage(raw[\"photo\"], `${at}.photo`, reading, warnings);\n const layout = sectionLayout(raw, at, SPLIT_LAYOUTS, SECTION_LAYOUT_DEFAULTS.Split, warnings);\n if (heading === null) return null;\n if (!showEmail && !showPhone && body === null && action === null) {\n warnings.push({ code: SECTION_WARNINGS.emptySkipped, where: at });\n return null;\n }\n return { kind: \"contact\", anchor, layout, heading, body, showEmail, showPhone, action, image };\n }\n default:\n warnings.push({ code: SECTION_WARNINGS.unknownType, where: `${at}._type` });\n return null;\n }\n}\n\n/** Every button a mapped page section carries, with its path in the stored document. */\nfunction sectionButtons(section: PageSectionInput, raw: Raw, at: string): { where: string; href: string }[] {\n switch (section.kind) {\n case \"text_media\":\n case \"contact\":\n return section.action === null ? [] : [{ where: `${at}.action.href`, href: section.action.href }];\n case \"faq\":\n case \"gallery\":\n return [];\n default:\n return buttonsOf(section, raw, at);\n }\n}\n\n/** `page.sections[]`, mapped in order. Unknown types are skipped with a warning; malformed content is a problem. */\nfunction parseSections(value: unknown, reading: Reading): { sections: PageSectionInput[]; warnings: SectionWarning[] } {\n const sections: PageSectionInput[] = [];\n const warnings: SectionWarning[] = [];\n if (!Array.isArray(value)) {\n reading.fail(\"sections\", \"is not a list\");\n return { sections, warnings };\n }\n if (!reading.dense(value, \"sections\")) return { sections, warnings };\n const anchors: string[] = [];\n const jumps: { where: string; href: string }[] = [];\n value.forEach((member, index) => {\n const raw = reading.object(member, `sections[${String(index)}]`);\n if (raw === null) return;\n const at = keyed(\"sections\", raw, index);\n const section = mapSection(raw, at, reading, warnings);\n if (section === null) return;\n jumps.push(...sectionButtons(section, raw, at));\n const anchor = \"anchor\" in section ? section.anchor : null;\n if (anchor !== null) {\n if (anchors.includes(anchor)) reading.fail(`${at}.jumpLink`, `repeats \"${anchor}\", already used by another section`);\n anchors.push(anchor);\n }\n sections.push(section);\n });\n for (const { where, href } of jumps) {\n if (href.startsWith(\"#\") && !anchors.includes(href.slice(1))) reading.fail(where, `jumps to ${href}, which no section on the page is named`);\n }\n return { sections, warnings };\n}\n\n// ---------------------------------------------------------------------------\n// Content pages and settings\n// ---------------------------------------------------------------------------\n\nexport function parseContentPage(document: unknown): PageContent {\n const reading = new Reading();\n const doc = reading.object(document, \"page\");\n if (doc === null) throw new MalformedContentError(\"page\", reading.problems);\n const id = typeof doc[\"_id\"] === \"string\" ? doc[\"_id\"] : \"page\";\n if (doc[\"_type\"] !== \"page\") reading.fail(\"_type\", `is ${JSON.stringify(doc[\"_type\"])}, not page`);\n const title = reading.optionalString(doc[\"title\"], \"title\");\n if (title === null) reading.fail(\"title\", \"is missing\");\n if (doc[\"titleCopySource\"] === \"proposed\" && title !== null) reading.proposed.push({ where: \"title\", text: title });\n const slugObject = doc[\"slug\"] as Raw | undefined;\n const slug = typeof slugObject?.[\"current\"] === \"string\" && slugObject[\"current\"] !== \"\" ? slugObject[\"current\"] : null;\n if (slug === null) reading.fail(\"slug.current\", \"is missing\");\n const lead = reading.copy(doc[\"lead\"], \"lead\");\n const photo = reading.photo(doc[\"photo\"], \"photo\");\n const body = richTextToMarkdown(doc[\"body\"], \"body\", reading);\n if (doc[\"bodyCopySource\"] === \"proposed\") reading.proposed.push({ where: \"body\", text: body });\n const sections = doc[\"sections\"] === undefined || doc[\"sections\"] === null ? null : parseSections(doc[\"sections\"], reading);\n if (reading.problems.length > 0 || title === null || slug === null) throw new MalformedContentError(id, reading.problems);\n return {\n slug,\n title,\n composition: { intro: lead === null ? null : plain(lead), photo, hero: null, blocks: [] },\n body,\n migrated: doc[\"migrated\"] === true,\n proposedCopy: reading.proposed,\n ...(sections === null ? {} : sections),\n };\n}\n\nexport function parseSiteSettings(document: unknown): SiteSettingsContent {\n const reading = new Reading();\n const doc = reading.object(document, \"siteSettings\");\n if (doc === null) throw new MalformedContentError(READER_SITE_SETTINGS_ID, reading.problems);\n const name = reading.optionalString(doc[\"title\"], \"title\");\n if (name === null) reading.fail(\"title\", \"is missing; a site needs its name\");\n const description = reading.optionalString(doc[\"description\"], \"description\");\n const contact = doc[\"contact\"] === undefined ? {} : (reading.object(doc[\"contact\"], \"contact\") ?? {});\n const email = reading.optionalString(contact[\"email\"], \"contact.email\");\n const phone = reading.optionalString(contact[\"phone\"], \"contact.phone\");\n const social: { network: string; url: string }[] = [];\n const rawSocial = doc[\"social\"] ?? [];\n if (!Array.isArray(rawSocial)) reading.fail(\"social\", \"is not a list\");\n else if (reading.dense(rawSocial, \"social\"))\n rawSocial.forEach((member, index) => {\n const link = reading.object(member, `social[${String(index)}]`);\n if (link === null) return;\n const network = reading.optionalString(link[\"network\"], `social[${String(index)}].network`);\n const url = reading.optionalString(link[\"url\"], `social[${String(index)}].url`);\n if (network === null || url === null || !/^https?:\\/\\//.test(url)) {\n reading.fail(`social[${String(index)}]`, \"needs a network and a web address\");\n return;\n }\n social.push({ network, url });\n });\n if (reading.problems.length > 0 || name === null) throw new MalformedContentError(READER_SITE_SETTINGS_ID, reading.problems);\n return { name, description, contact: { email, phone }, social };\n}\n\n// ---------------------------------------------------------------------------\n// Queries\n// ---------------------------------------------------------------------------\n\n/** By fixed id: a second home page at a random id is never read. */\nexport const HOME_PAGE_DOCUMENT_QUERY = `*[_id == $id][0]`;\nexport const CONTENT_PAGES_QUERY = `*[_type == \"page\" && defined(slug.current)]|order(slug.current asc)`;\nexport const CONTENT_PAGE_BY_SLUG_QUERY = `*[_type == \"page\" && slug.current == $slug][0]`;\n\nexport interface SiteContentReader {\n /** `null` when no home page document exists yet. */\n home: (options: { readonly now: Date }) => Promise<HomeContent | null>;\n pages: () => Promise<PageContent[]>;\n /** `null` when no page has that slug. */\n pageBySlug: (slug: string) => Promise<PageContent | null>;\n /** `null` before anyone has filled in the site's details. */\n siteSettings: () => Promise<SiteSettingsContent | null>;\n}\n\nexport function createSiteContentReader(client: { query: <T>(groq: string, options?: { params?: Record<string, unknown>; tags?: readonly string[] }) => Promise<T> }): SiteContentReader {\n return {\n home: async ({ now }) => {\n const doc = await client.query<unknown>(HOME_PAGE_DOCUMENT_QUERY, { params: { id: READER_HOME_PAGE_ID } });\n return doc === null || doc === undefined ? null : parseHomePage(doc, { now });\n },\n pages: async () => {\n const docs = await client.query<unknown>(CONTENT_PAGES_QUERY);\n if (!Array.isArray(docs)) throw new MalformedContentError(\"page\", [\"the page query did not return a list\"]);\n if (!isDenseArray(docs)) throw new MalformedContentError(\"page\", [\"the page query contains missing entries\"]);\n return docs.map((doc) => parseContentPage(doc));\n },\n pageBySlug: async (slug) => {\n const doc = await client.query<unknown>(CONTENT_PAGE_BY_SLUG_QUERY, { params: { slug } });\n return doc === null || doc === undefined ? null : parseContentPage(doc);\n },\n siteSettings: async () => {\n const doc = await client.query<unknown>(HOME_PAGE_DOCUMENT_QUERY, { params: { id: READER_SITE_SETTINGS_ID } });\n return doc === null || doc === undefined ? null : parseSiteSettings(doc);\n },\n };\n}\n\nfunction atomic<T>(raw: unknown, fallback: T, parse: (value: unknown) => T, validFallback: (value: unknown) => boolean): CmsResolution<T> {\n if (!validFallback(fallback)) throw new TypeError(\"Invalid CMS content fallback\");\n if (raw === null || raw === undefined) return { data: fallback, fallbackFields: [\"$\"] };\n // The server reader catches parser errors and classifies the whole fallback\n // as malformed. Returning fallback here would lose that diagnostic reason.\n return { data: parse(raw), fallbackFields: [] };\n}\n\nexport function homeContentQuery(now: Date): CmsQuery<HomeContent | null> {\n if (!(now instanceof Date) || !Number.isFinite(now.getTime())) throw new TypeError(\"Invalid CMS campaign date\");\n const captured = now.getTime();\n return defineCmsQuery({\n name: \"homePage.v1\", query: HOME_PAGE_DOCUMENT_QUERY, params: { id: READER_HOME_PAGE_ID },\n dependencies: { types: [\"homePage\"], ids: [READER_HOME_PAGE_ID] },\n resolve: (raw, fallback) => atomic(raw, fallback, (value) => parseHomePage(value, { now: new Date(captured) }), validHomeFallback),\n });\n}\n\nexport function contentPageQuery(slug: string): CmsQuery<PageContent | null> {\n if (typeof slug !== \"string\" || slug === \"\") throw new TypeError(\"Invalid CMS page slug\");\n return defineCmsQuery({\n name: \"page.v1\", query: CONTENT_PAGE_BY_SLUG_QUERY, params: { slug }, dependencies: { types: [\"page\"] },\n resolve: (raw, fallback) => atomic(raw, fallback, parseContentPage, validPageFallback),\n });\n}\n\nexport function contentPagesQuery(): CmsQuery<readonly PageContent[]> {\n return defineCmsQuery({\n name: \"pages.v1\", query: CONTENT_PAGES_QUERY, params: {}, dependencies: { types: [\"page\"] },\n resolve: (raw, fallback) => atomic(raw, fallback, (value) => {\n if (!Array.isArray(value)) throw new MalformedContentError(\"page\", [\"the page query did not return a list\"]);\n if (!isDenseArray(value)) throw new MalformedContentError(\"page\", [\"the page query contains missing entries\"]);\n return value.map((document: unknown) => parseContentPage(document));\n }, (value) => isDenseArray(value) && value.every((page: unknown) => page !== null && validPageFallback(page))),\n });\n}\n\nexport function siteSettingsQuery(): CmsQuery<SiteSettingsContent | null> {\n return defineCmsQuery({\n name: \"siteSettings.v1\", query: HOME_PAGE_DOCUMENT_QUERY, params: { id: READER_SITE_SETTINGS_ID },\n dependencies: { types: [\"siteSettings\"], ids: [READER_SITE_SETTINGS_ID] },\n resolve: (raw, fallback) => atomic(raw, fallback, parseSiteSettings, validSettingsFallback),\n });\n}\n", "import { defineCmsQuery, type CmsQuery, type CmsResolution } from \"./query.js\";\n\nexport const SITE_HERO_LAYOUTS = [\"columns\", \"rows\"] as const;\nexport const SITE_HERO_TAGLINE_MAX_LENGTH = 36;\nexport const SITE_HERO_LAYOUT_WARNING = \"siteHero.layout.defaulted\" as const;\nexport type SiteHeroLayout = typeof SITE_HERO_LAYOUTS[number];\nexport type SiteHeroTagline = { readonly key: string; readonly text: string };\n/** Optional additions preserve existing heading/intro-only consumer fallbacks. */\nexport type SiteHero = {\n readonly heading: string;\n readonly intro: string;\n readonly layout?: SiteHeroLayout;\n readonly taglines?: readonly SiteHeroTagline[];\n};\nexport type ParsedSiteHero = SiteHero & {\n readonly layout: SiteHeroLayout;\n readonly taglines: readonly SiteHeroTagline[];\n};\nexport type TextFieldDefinition = {\n readonly name: string;\n readonly label: string;\n readonly noun: { readonly article: \"a\" | \"an\"; readonly word: string };\n readonly kind: \"single-line\" | \"multi-line\";\n readonly required: boolean;\n readonly minLength: number;\n readonly maxLength: number;\n readonly noTrailingFullStop?: boolean;\n};\nexport type TextDocumentDefinition = {\n readonly key: string;\n readonly documentId: string;\n readonly documentType: string;\n readonly fields: readonly TextFieldDefinition[];\n readonly copy: {\n readonly currentTitle: string;\n readonly editTitle: string;\n readonly empty: string;\n };\n};\nexport type TextValidation =\n | { readonly ok: true; readonly value: Readonly<Record<string, string>> }\n | { readonly ok: false; readonly errors: Readonly<Record<string, string>> };\n\nexport const CMS_CONTRACT_VERSION = 1;\n\nexport const SITE_HERO: TextDocumentDefinition = {\n key: \"hero\",\n documentId: \"siteHero\",\n documentType: \"siteHero\",\n fields: [\n {\n name: \"heading\",\n label: \"Heading\",\n noun: { article: \"a\", word: \"heading\" },\n kind: \"single-line\",\n required: true,\n minLength: 1,\n maxLength: 80,\n noTrailingFullStop: true,\n },\n {\n name: \"intro\",\n label: \"Introduction\",\n noun: { article: \"an\", word: \"introduction\" },\n kind: \"multi-line\",\n required: true,\n minLength: 1,\n maxLength: 320,\n },\n ],\n copy: {\n currentTitle: \"On your site now\",\n editTitle: \"Edit and publish\",\n empty: \"Your site has no hero text yet. Whatever you publish below becomes its first version.\",\n },\n};\n\nfunction fieldError(field: TextFieldDefinition, text: string): string | null {\n const { article, word } = field.noun;\n if (text.length === 0) return field.required ? `Enter ${article} ${word}.` : null;\n const count = [...text].length;\n if (count < field.minLength) return `Make the ${word} at least ${String(field.minLength)} characters. It is ${String(count)} now.`;\n if (count > field.maxLength) return `Keep the ${word} to ${String(field.maxLength)} characters or fewer. It is ${String(count)} now.`;\n if (text.includes(\"\\u2014\")) return `The ${word} contains a long dash. Use a comma, a colon or a short dash instead.`;\n if (field.kind === \"single-line\" && /[\\r\\n]/.test(text)) return `The ${word} must be a single line.`;\n if (field.noTrailingFullStop === true && text.endsWith(\".\")) {\n return `${word.charAt(0).toUpperCase()}${word.slice(1)}s on your site do not end with a full stop. Remove the last full stop.`;\n }\n return null;\n}\n\nexport function validateTextDocument(\n definition: TextDocumentDefinition, raw: Readonly<Record<string, unknown>>,\n): TextValidation {\n const value: Record<string, string> = {};\n const errors: Record<string, string> = {};\n for (const field of definition.fields) {\n const submitted = Object.hasOwn(raw, field.name) ? raw[field.name] : undefined;\n const text = typeof submitted === \"string\" ? submitted.trim() : \"\";\n const error = fieldError(field, text);\n Object.defineProperty(error === null ? value : errors, field.name, { value: error ?? text, enumerable: true });\n }\n return Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true, value };\n}\n\n/** Shared with the schema adapter; no provider metadata is returned. */\nexport function validateSiteHeroTaglines(raw: unknown):\n | { readonly ok: true; readonly value: readonly SiteHeroTagline[] }\n | { readonly ok: false; readonly error: string } {\n if (!Array.isArray(raw)) return { ok: false, error: \"Enter a list of taglines.\" };\n const heading = SITE_HERO.fields[0];\n if (!heading) throw new TypeError(\"Missing siteHero heading definition\");\n const field = { ...heading, name: \"text\", noun: { article: \"a\", word: \"tagline\" } as const,\n maxLength: SITE_HERO_TAGLINE_MAX_LENGTH };\n const value: SiteHeroTagline[] = [];\n const keys = new Set<string>();\n for (const item of raw as unknown[]) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { ok: false, error: \"Enter a key and text for each tagline.\" };\n const record = item as Record<string, unknown>;\n const key = Object.hasOwn(record, \"key\") ? record.key : undefined;\n if (typeof key !== \"string\" || !/^[a-z][a-z0-9_-]{0,31}$/.test(key)) {\n return { ok: false, error: \"Use a lowercase key of 1 to 32 letters, numbers, short dashes or underscores, starting with a letter.\" };\n }\n if (keys.has(key)) return { ok: false, error: \"Use each tagline key only once.\" };\n const text = validateTextDocument({ ...SITE_HERO, fields: [field] }, record);\n if (!text.ok) return { ok: false, error: text.errors.text ?? \"Invalid tagline.\" };\n keys.add(key);\n value.push({ key, text: text.value.text ?? \"\" });\n }\n return { ok: true, value };\n}\n\nfunction isLayout(value: unknown): value is SiteHeroLayout {\n return SITE_HERO_LAYOUTS.some((layout) => value === layout);\n}\n\n/** Strict per-field resolution: an invalid list never partially changes keyed copy. */\nexport function parseSiteHero(raw: unknown, fallback: SiteHero): CmsResolution<ParsedSiteHero> {\n const local = validateTextDocument(SITE_HERO, fallback);\n const localTaglines = validateSiteHeroTaglines(fallback.taglines ?? []);\n if (!local.ok || !localTaglines.ok || (fallback.layout !== undefined && !isLayout(fallback.layout))) {\n throw new TypeError(\"Invalid siteHero fallback\");\n }\n const data: { heading: string; intro: string; layout: SiteHeroLayout; taglines: readonly SiteHeroTagline[] } = {\n heading: local.value.heading ?? \"\", intro: local.value.intro ?? \"\",\n layout: fallback.layout ?? \"columns\", taglines: localTaglines.value,\n };\n if (raw === null || typeof raw !== \"object\" || Array.isArray(raw)) return { data, fallbackFields: [\"$\"] };\n const record = raw as Readonly<Record<string, unknown>>;\n const text = validateTextDocument(SITE_HERO, record);\n const fallbackFields: string[] = text.ok ? [] : Object.keys(text.errors);\n for (const field of SITE_HERO.fields) {\n if (!fallbackFields.includes(field.name)) {\n const value = text.ok ? text.value[field.name] : record[field.name];\n if (typeof value === \"string\" && (field.name === \"heading\" || field.name === \"intro\")) data[field.name] = value.trim();\n }\n }\n const layout = Object.hasOwn(record, \"layout\") ? record.layout : undefined;\n const warnings: (typeof SITE_HERO_LAYOUT_WARNING)[] = [];\n if (isLayout(layout)) data.layout = layout;\n else {\n data.layout = \"columns\";\n fallbackFields.push(\"layout\");\n warnings.push(SITE_HERO_LAYOUT_WARNING);\n }\n const taglines = validateSiteHeroTaglines(Object.hasOwn(record, \"taglines\") ? record.taglines : undefined);\n if (taglines.ok) data.taglines = taglines.value;\n else fallbackFields.push(\"taglines\");\n return { data, fallbackFields: fallbackFields.length === SITE_HERO.fields.length + 2 ? [\"$\"] : fallbackFields,\n ...(warnings.length > 0 ? { warnings } : {}) };\n}\n\nexport function siteHeroQuery(): CmsQuery<SiteHero> {\n return defineCmsQuery<SiteHero>({\n name: \"siteHero.v1\", query: '*[_id == $id && _type == \"siteHero\"][0]{heading,intro,layout,taglines}',\n params: { id: \"siteHero\" }, dependencies: { types: [\"siteHero\"], ids: [\"siteHero\"] },\n resolve: parseSiteHero,\n });\n}\n"],
|
|
5
|
-
"mappings": "AACO,SAASA,EAAaC,EAAoC,CAC/D,GAAI,CAAC,MAAM,QAAQA,CAAK,EAAG,MAAO,GAClC,QAASC,EAAQ,EAAGA,EAAQD,EAAM,OAAQC,GAAS,EACjD,GAAI,CAAC,OAAO,OAAOD,EAAOC,CAAK,EAAG,MAAO,GAE3C,MAAO,EACT,CCYA,IAAMC,GAAO,+BACPC,GAAK,qCAGX,SAASC,GAAiBC,EAAgD,CACxE,GAAI,CAACA,GAAgB,CAAC,MAAM,QAAQA,EAAa,KAAK,GAAKA,EAAa,MAAM,SAAW,EACvF,MAAM,IAAI,UAAU,yCAAyC,EAE/D,IAAMC,EAAQ,CAAC,GAAGD,EAAa,KAAK,EACpC,QAAWE,KAAQD,EACjB,GAAI,OAAOC,GAAS,UAAY,CAACC,GAAK,KAAKD,CAAI,EAAG,MAAM,IAAI,UAAU,2BAA2B,EAEnG,GAAIF,EAAa,MAAQ,QAAa,CAAC,MAAM,QAAQA,EAAa,GAAG,EAAG,MAAM,IAAI,UAAU,0BAA0B,EACtH,IAAMI,EAAMJ,EAAa,MAAQ,OAAY,OAAY,CAAC,G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C7CU,EAA2B1B,EAAK,GAAK,CAAC,EAAI,OAAO,KAAKA,EAAK,MAAM,EACvE,QAAWD,KAASF,EAAU,OAC5B,GAAI,CAAC6B,EAAe,SAAS3B,EAAM,IAAI,EAAG,CACxC,IAAMQ,EAAQP,EAAK,GAAKA,EAAK,MAAMD,EAAM,IAAI,EAAIiB,EAAOjB,EAAM,IAAI,EAC9D,OAAOQ,GAAU,WAAaR,EAAM,OAAS,WAAaA,EAAM,OAAS,WAAU0B,EAAK1B,EAAM,IAAI,EAAIQ,EAAM,KAAK,EACvH,CAEF,IAAMa,EAAS,OAAO,OAAOJ,EAAQ,QAAQ,EAAIA,EAAO,OAAS,OAC3DW,EAAgD,CAAC,EACnDT,GAASE,CAAM,EAAGK,EAAK,OAASL,GAElCK,EAAK,OAAS,UACdC,EAAe,KAAK,QAAQ,EAC5BC,EAAS,KAAKC,EAAwB,GAExC,IAAMC,EAAWlB,GAAyB,OAAO,OAAOK,EAAQ,UAAU,EAAIA,EAAO,SAAW,MAAS,EACzG,OAAIa,EAAS,GAAIJ,EAAK,SAAWI,EAAS,MACrCH,EAAe,KAAK,UAAU,EAC5B,CAAE,KAAAD,EAAM,eAAgBC,EAAe,SAAW7B,EAAU,OAAO,OAAS,EAAI,CAAC,GAAG,EAAI6B,EAC7F,GAAIC,EAAS,OAAS,EAAI,CAAE,SAAAA,CAAS,EAAI,CAAC,CAAG,CACjD,CAEO,SAASG,IAAoC,CAClD,OAAOC,EAAyB,CAC9B,KAAM,cAAe,MAAO,yEAC5B,OAAQ,CAAE,GAAI,UAAW,EAAG,aAAc,CAAE,MAAO,CAAC,UAAU,EAAG,IAAK,CAAC,UAAU,CAAE,EACnF,QAASV,EACX,CAAC,CACH",
|
|
6
|
-
"names": ["isDenseArray", "value", "index", "TYPE", "ID", "dependenciesCopy", "dependencies", "types", "type", "TYPE", "ids", "id", "ID", "defineCmsQuery", "query", "params", "copied", "key", "descriptor", "value", "SPLIT_LAYOUTS", "HEADING_LIST_LAYOUTS", "STAGGER_ROW_LAYOUTS", "SECTION_LAYOUT_DEFAULTS", "READER_SECTION_KINDS", "READER_GALLERY_PHOTO_MIN", "READER_GALLERY_PHOTO_LIMIT", "SECTION_WARNINGS", "object", "value", "words", "nullableText", "photo", "READER_PHOTO_SLUG", "href", "READER_ACTION_HREF", "copy", "optionalCopy", "action", "optionalAction", "anchor", "READER_JUMP_LINK", "one", "list", "name", "sectionImage", "homeBlock", "block", "isDenseArray", "image", "item", "READER_STORY_LAYOUTS", "layout", "section", "SPLIT_LAYOUTS", "HEADING_LIST_LAYOUTS", "STAGGER_ROW_LAYOUTS", "sections", "warnings", "warning", "SECTION_WARNINGS", "model", "anchors", "entry", "link", "composition", "hero", "proposed", "line", "validHomeFallback", "validPageFallback", "validSettingsFallback", "MALFORMED_CONTENT", "MalformedContentError", "documentId", "problems", "READER_PHOTO_SLUG", "READER_ACTION_HREF", "READER_JUMP_LINK", "READER_STORY_LAYOUTS", "READER_HOME_PAGE_ID", "READER_SITE_SETTINGS_ID", "Reading", "path", "message", "value", "isDenseArray", "raw", "text", "source", "copy", "p", "max", "entry", "index", "label", "href", "plain", "portableTextToMarkdown", "reading", "markdown", "richTextToMarkdown", "out", "previousWasList", "member", "at", "block", "spansToMarkdown", "listItem", "style", "line", "level", "isList", "DECORATORS", "links", "markDefs", "def", "d", "children", "child", "span", "marks", "mark", "fence", "campaignState", "campaign", "now", "c", "starts", "ends", "keyed", "parseHomePage", "document", "options", "doc", "id", "hero", "rawHero", "photos", "heading", "subline", "intro", "cta", "secondaryCta", "blocks", "blockJumps", "body", "state", "title", "images", "action", "anchors", "rawBlocks", "mapped", "mapBlock", "buttonsOf", "jumps", "where", "stories", "item", "jumpLinkOf", "jump", "tail", "items", "story", "sat", "sHeading", "sBody", "image", "layout", "onCard", "anchor", "sectionLayout", "layouts", "fallback", "warnings", "name", "SECTION_WARNINGS", "sectionImage", "asset", "ref", "alt", "caption", "hotspot", "spot", "x", "y", "mapSection", "SPLIT_LAYOUTS", "SECTION_LAYOUT_DEFAULTS", "HEADING_LIST_LAYOUTS", "rawItems", "iat", "question", "answer", "STAGGER_ROW_LAYOUTS", "READER_GALLERY_PHOTO_MIN", "READER_GALLERY_PHOTO_LIMIT", "photo", "shown", "field", "showEmail", "showPhone", "sectionButtons", "section", "parseSections", "sections", "parseContentPage", "slugObject", "slug", "lead", "parseSiteSettings", "description", "contact", "email", "phone", "social", "rawSocial", "link", "network", "url", "HOME_PAGE_DOCUMENT_QUERY", "CONTENT_PAGES_QUERY", "CONTENT_PAGE_BY_SLUG_QUERY", "createSiteContentReader", "client", "docs", "atomic", "parse", "validFallback", "homeContentQuery", "captured", "defineCmsQuery", "validHomeFallback", "contentPageQuery", "validPageFallback", "contentPagesQuery", "page", "siteSettingsQuery", "validSettingsFallback", "SITE_HERO_LAYOUTS", "SITE_HERO_TAGLINE_MAX_LENGTH", "SITE_HERO_LAYOUT_WARNING", "SITE_HERO", "fieldError", "field", "text", "article", "word", "count", "validateTextDocument", "definition", "raw", "value", "errors", "submitted", "error", "
|
|
4
|
+
"sourcesContent": ["/** Content lists must contain an own entry at every index. */\nexport function isDenseArray(value: unknown): value is unknown[] {\n if (!Array.isArray(value)) return false;\n for (let index = 0; index < value.length; index += 1) {\n if (!Object.hasOwn(value, index)) return false;\n }\n return true;\n}\n", "/** A-1822 S1 owns this implementation. S0 registers the public signatures. */\nexport type CmsParams = Readonly<Record<string, string | number | boolean | null>>;\nexport type CmsDependencies = {\n readonly types: readonly string[];\n readonly ids?: readonly string[];\n};\nexport type CmsResolution<T> = {\n readonly data: T;\n readonly fallbackFields: readonly string[];\n readonly warnings?: readonly (\"siteHero.layout.defaulted\" | \"siteHero.tagline.dropped\" | \"siteHero.taglines.defaulted\")[];\n};\nexport type CmsQuery<T> = {\n readonly name: string;\n readonly query: string;\n readonly params: CmsParams;\n readonly dependencies: CmsDependencies;\n readonly resolve: (raw: unknown, fallback: T) => CmsResolution<T>;\n};\n\nconst TYPE = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;\nconst ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;\nconst SCOPE = /^[a-z0-9]{6,12}\\.[a-z][a-z0-9_-]{0,63}$/;\n\nfunction dependenciesCopy(dependencies: CmsDependencies): CmsDependencies {\n if (!dependencies || !Array.isArray(dependencies.types) || dependencies.types.length === 0) {\n throw new TypeError(\"CMS dependencies require document types\");\n }\n const types = [...dependencies.types];\n for (const type of types) {\n if (typeof type !== \"string\" || !TYPE.test(type)) throw new TypeError(\"Invalid CMS document type\");\n }\n if (dependencies.ids !== undefined && !Array.isArray(dependencies.ids)) throw new TypeError(\"Invalid CMS document IDs\");\n const ids = dependencies.ids === undefined ? undefined : [...dependencies.ids];\n for (const id of ids ?? []) {\n if (typeof id !== \"string\" || !ID.test(id) || /^(drafts|versions)\\./.test(id)) {\n throw new TypeError(\"Invalid CMS document ID\");\n }\n }\n if (new Set(types).size + new Set(ids).size > 128) throw new TypeError(\"Too many CMS tags\");\n return Object.freeze({ types: Object.freeze(types), ...(ids === undefined ? {} : { ids: Object.freeze(ids) }) });\n}\n\nexport function defineCmsQuery<T>(query: CmsQuery<T>): CmsQuery<T> {\n if (!query || typeof query.name !== \"string\" || !/^[A-Za-z][A-Za-z0-9_.-]{0,127}$/.test(query.name)\n || typeof query.query !== \"string\" || query.query.trim() === \"\" || typeof query.resolve !== \"function\") {\n throw new TypeError(\"Invalid CMS query configuration\");\n }\n const params = query.params;\n if (!params || typeof params !== \"object\" || (Object.getPrototypeOf(params) !== Object.prototype && Object.getPrototypeOf(params) !== null)) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n const copied: Record<string, string | number | boolean | null> = {};\n for (const key of Reflect.ownKeys(params)) {\n const descriptor = Object.getOwnPropertyDescriptor(params, key);\n if (typeof key !== \"string\" || !descriptor || !Object.hasOwn(descriptor, \"value\") || !descriptor.enumerable) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n const value: unknown = descriptor.value;\n if (!(value === null || typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value)))) {\n throw new TypeError(\"CMS params must be plain JSON scalars\");\n }\n Object.defineProperty(copied, key, { value, enumerable: true });\n }\n return Object.freeze({ name: query.name, query: query.query, params: Object.freeze(copied), dependencies: dependenciesCopy(query.dependencies), resolve: query.resolve });\n}\n\nexport function cmsTags(scope: string, dependencies: CmsDependencies): readonly string[] {\n if (typeof scope !== \"string\" || scope.length > 77 || !SCOPE.test(scope)) throw new TypeError(\"Invalid CMS scope\");\n const copied = dependenciesCopy(dependencies);\n const tags = [\n ...[...new Set(copied.types)].sort().map((type) => `cms:${scope}:type:${type}`),\n ...[...new Set(copied.ids ?? [])].sort().map((id) => `cms:${scope}:id:${id}`),\n ];\n return Object.freeze(tags);\n}\n", "/**\n * A-1915 (A-1739 M1c). The reader's half of the shared section set that\n * `@weatherboard/sanity-schema-base` declares in `src/sections.ts` (A-1889):\n * `page.sections[]`, drawn from the four home section types plus\n * `textMediaBlock`, `faqBlock` (items `faqItem`), `galleryBlock` and\n * `contactBlock`.\n *\n * ===========================================================================\n * LAYOUTS ARE THE A-1876 VARIANT NAMES, EXACTLY\n * ===========================================================================\n *\n * The three lists below are the composition variant names, spelled as A-1876\n * spells them, so a contract test can import them and compare them with the\n * UI package's. A missing or unknown stored `layout` resolves to the\n * composition's default and records `section.layout.defaulted`, the rule cms\n * 0.2.0 set for `siteHero.layout`. It never throws and never yields an empty\n * section.\n *\n * ===========================================================================\n * WARNINGS, NOT REFUSALS, FOR THREE THINGS\n * ===========================================================================\n *\n * The rest of this reader refuses a malformed document by name. Three things\n * in a section are warnings instead, each recorded with its path:\n *\n * section.layout.defaulted missing or unknown layout: the default renders\n * section.type.unknown a section `_type` this reader does not know is\n * skipped, so a newer model never breaks a page\n * section.image.missing-alt an image without alt text is DROPPED, never\n * rendered without it\n * section.image.missing-asset an image with no uploaded asset is dropped\n * section.empty.skipped a section left with nothing to show (a gallery\n * whose every photo was dropped, a contact\n * section switched off and empty) is skipped\n */\n\nimport type { ActionInput, CompositionBlockInput, CopyInput } from \"./site-content.js\";\n\n// ---------------------------------------------------------------------------\n// The A-1876 variant names\n// ---------------------------------------------------------------------------\n\n/** `Split`: text with media. */\nexport const SPLIT_LAYOUTS = [\"media-end\", \"media-start\", \"media-below\"] as const;\n/** `HeadingList`: a heading column and a list column. */\nexport const HEADING_LIST_LAYOUTS = [\"beside\", \"stacked\"] as const;\n/** `StaggerRow`: a row of two to four items. */\nexport const STAGGER_ROW_LAYOUTS = [\"staggered\", \"aligned\"] as const;\n\nexport type SplitLayout = (typeof SPLIT_LAYOUTS)[number];\nexport type HeadingListLayout = (typeof HEADING_LIST_LAYOUTS)[number];\nexport type StaggerRowLayout = (typeof STAGGER_ROW_LAYOUTS)[number];\n\n/** What a missing or unknown `layout` resolves to, per composition. */\nexport const SECTION_LAYOUT_DEFAULTS = {\n Split: \"media-end\",\n HeadingList: \"beside\",\n StaggerRow: \"staggered\",\n} as const satisfies { readonly Split: SplitLayout; readonly HeadingList: HeadingListLayout; readonly StaggerRow: StaggerRowLayout };\n\n// ---------------------------------------------------------------------------\n// The section types and the kinds they read as\n// ---------------------------------------------------------------------------\n\n/** Sanity `_type` on the left, the reader's `kind` on the right; the same rows as schema-base's `SECTION_CONTRACTS`. */\nexport const READER_SECTION_KINDS = {\n featureStoriesBlock: \"feature_stories\",\n surfaceCardBlock: \"cta\",\n accentBandBlock: \"accent_band\",\n locationsBlock: \"locations\",\n textMediaBlock: \"text_media\",\n faqBlock: \"faq\",\n galleryBlock: \"gallery\",\n contactBlock: \"contact\",\n} as const;\n\n/** A gallery is a `StaggerRow`, which holds two to four items. */\nexport const READER_GALLERY_PHOTO_MIN = 2;\nexport const READER_GALLERY_PHOTO_LIMIT = 4;\n\n// ---------------------------------------------------------------------------\n// Warnings\n// ---------------------------------------------------------------------------\n\nexport const SECTION_WARNINGS = {\n layoutDefaulted: \"section.layout.defaulted\",\n unknownType: \"section.type.unknown\",\n imageMissingAlt: \"section.image.missing-alt\",\n imageMissingAsset: \"section.image.missing-asset\",\n emptySkipped: \"section.empty.skipped\",\n} as const;\n\nexport type SectionWarningCode = (typeof SECTION_WARNINGS)[keyof typeof SECTION_WARNINGS];\n/** A named warning and the path in the stored document it is about. Never copy. */\nexport type SectionWarning =\n | { readonly code: typeof SECTION_WARNINGS.unknownType; readonly where: string; readonly type: string }\n | { readonly code: Exclude<SectionWarningCode, typeof SECTION_WARNINGS.unknownType>; readonly where: string };\n\n// ---------------------------------------------------------------------------\n// Output types: schema-base's target shapes, every key present\n// ---------------------------------------------------------------------------\n\n/** A Sanity image as a site needs it. `asset` is the image asset's id; `alt` is never empty. */\nexport type SectionImageInput = {\n readonly asset: string;\n readonly alt: string;\n readonly caption: string | null;\n readonly hotspot: { readonly x: number; readonly y: number } | null;\n};\n\nexport type TextMediaSectionInput = {\n readonly kind: \"text_media\";\n readonly anchor: string | null;\n readonly layout: SplitLayout;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly body: CopyInput;\n readonly action: ActionInput | null;\n /** `null` only when the stored photo was dropped (no alt text or no asset); a warning names it. */\n readonly image: SectionImageInput | null;\n};\n\nexport type FaqSectionInput = {\n readonly kind: \"faq\";\n readonly anchor: string | null;\n readonly layout: HeadingListLayout;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly intro: CopyInput | null;\n readonly items: readonly { readonly question: CopyInput; readonly answer: CopyInput }[];\n};\n\nexport type GallerySectionInput = {\n readonly kind: \"gallery\";\n readonly anchor: string | null;\n readonly layout: StaggerRowLayout;\n readonly heading: CopyInput | null;\n readonly images: readonly SectionImageInput[];\n};\n\nexport type ContactSectionInput = {\n readonly kind: \"contact\";\n readonly anchor: string | null;\n readonly layout: SplitLayout;\n readonly heading: CopyInput;\n readonly body: CopyInput | null;\n /** Show the site settings' email address. */\n readonly showEmail: boolean;\n /** Show the site settings' phone number. */\n readonly showPhone: boolean;\n readonly action: ActionInput | null;\n readonly image: SectionImageInput | null;\n};\n\nexport type NewSectionInput = TextMediaSectionInput | FaqSectionInput | GallerySectionInput | ContactSectionInput;\n\n/** One entry of `PageContent.sections`: a home section kind or one of the new kinds. */\nexport type PageSectionInput = Exclude<CompositionBlockInput, { readonly kind: \"campaign\" }> | NewSectionInput;\n", "import { isDenseArray } from \"./array.js\";\nimport {\n READER_ACTION_HREF, READER_JUMP_LINK, READER_PHOTO_SLUG, READER_STORY_LAYOUTS,\n type CompositionInput, type HomeContent, type PageContent, type SiteSettingsContent,\n} from \"./site-content.js\";\nimport {\n HEADING_LIST_LAYOUTS, SECTION_WARNINGS, SPLIT_LAYOUTS, STAGGER_ROW_LAYOUTS,\n type PageSectionInput,\n} from \"./sections.js\";\n\nconst object = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === \"object\" && !Array.isArray(value);\nconst words = (value: unknown): boolean => typeof value === \"string\" && value.trim() !== \"\";\nconst nullableText = (value: unknown): boolean => value === null || typeof value === \"string\";\nconst photo = (value: unknown): boolean => value === null || (typeof value === \"string\" && READER_PHOTO_SLUG.test(value));\nconst href = (value: unknown): boolean => typeof value === \"string\" && READER_ACTION_HREF.test(value);\nconst copy = (value: unknown): boolean => words(value) || (object(value) && words(value.text) && (value.copySource === \"captured\" || value.copySource === \"proposed\"));\nconst optionalCopy = (value: unknown): boolean => value === null || copy(value);\nconst action = (value: unknown): boolean => object(value) && copy(value.label) && href(value.href);\nconst optionalAction = (value: unknown): boolean => value === null || action(value);\n\nconst anchor = (value: unknown): boolean => value === null || (typeof value === \"string\" && READER_JUMP_LINK.test(value));\nconst one = (list: readonly string[], value: unknown): boolean => list.some((name) => name === value);\nconst sectionImage = (value: unknown): boolean => object(value) && words(value.asset) && words(value.alt) && nullableText(value.caption)\n && (value.hotspot === null || (object(value.hotspot) && typeof value.hotspot.x === \"number\" && typeof value.hotspot.y === \"number\"));\n\nfunction homeBlock(block: unknown): boolean {\n if (!object(block)) return false;\n switch (block.kind) {\n case \"campaign\": return optionalAction(block.action) && isDenseArray(block.images) && block.images.every((image: unknown) => typeof image === \"string\" && photo(image));\n case \"locations\": return (block.anchor === null || (typeof block.anchor === \"string\" && READER_JUMP_LINK.test(block.anchor))) && copy(block.heading) && optionalCopy(block.tail) && photo(block.image);\n case \"feature_stories\": return copy(block.heading) && optionalCopy(block.tail) && isDenseArray(block.items) && block.items.length > 0 && block.items.every((item: unknown) => object(item) && copy(item.heading) && copy(item.body) && action(item.action) && photo(item.image) && READER_STORY_LAYOUTS.some((layout) => layout === item.shape) && typeof item.card === \"boolean\");\n case \"accent_band\": return copy(block.heading) && copy(block.body) && optionalAction(block.action) && photo(block.image);\n case \"cta\": return words(block.heading) && nullableText(block.body) && object(block.link) && words(block.link.label) && href(block.link.href);\n default: return false;\n }\n}\n\n/** A-1915: the new page section kinds, as `parseContentPage` returns them. */\nfunction section(value: unknown): boolean {\n if (!object(value)) return false;\n switch (value.kind) {\n case \"campaign\": return false;\n case \"text_media\": return anchor(value.anchor) && one(SPLIT_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.tail)\n && copy(value.body) && optionalAction(value.action) && (value.image === null || sectionImage(value.image));\n case \"faq\": return anchor(value.anchor) && one(HEADING_LIST_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.tail)\n && optionalCopy(value.intro) && isDenseArray(value.items) && value.items.length > 0\n && value.items.every((item: unknown) => object(item) && copy(item.question) && copy(item.answer));\n case \"gallery\": return anchor(value.anchor) && one(STAGGER_ROW_LAYOUTS, value.layout) && optionalCopy(value.heading)\n && isDenseArray(value.images) && value.images.length > 0 && value.images.every(sectionImage);\n case \"contact\": return anchor(value.anchor) && one(SPLIT_LAYOUTS, value.layout) && copy(value.heading) && optionalCopy(value.body)\n && typeof value.showEmail === \"boolean\" && typeof value.showPhone === \"boolean\" && optionalAction(value.action)\n && (value.image === null || sectionImage(value.image));\n default: return homeBlock(value);\n }\n}\n\nfunction sections(value: unknown, warnings: unknown): boolean {\n if (value === undefined) return warnings === undefined;\n if (!isDenseArray(value) || !value.every(section)) return false;\n if (!isDenseArray(warnings) || !warnings.every((warning: unknown) => object(warning)\n && one(Object.values(SECTION_WARNINGS), warning.code) && words(warning.where))) return false;\n const model = value as readonly PageSectionInput[];\n const anchors = model.flatMap((entry) => \"anchor\" in entry && entry.anchor !== null ? [entry.anchor] : []);\n if (new Set(anchors).size !== anchors.length) return false;\n const links = model.flatMap((entry) => {\n switch (entry.kind) {\n case \"text_media\": case \"contact\": case \"accent_band\": return [entry.action?.href];\n case \"feature_stories\": return entry.items.map((item) => item.action.href);\n case \"cta\": return [entry.link.href];\n default: return [];\n }\n });\n return links.every((link) => link === undefined || !link.startsWith(\"#\") || anchors.includes(link.slice(1)));\n}\n\nfunction composition(value: unknown): boolean {\n if (!object(value) || !nullableText(value.intro) || !photo(value.photo) || !isDenseArray(value.blocks)) return false;\n const hero = value.hero;\n if (hero !== null && (!object(hero) || !copy(hero.heading) || !optionalCopy(hero.subline) || !optionalCopy(hero.intro)\n || !photo(hero.image) || !photo(hero.inset) || !optionalAction(hero.cta) || !optionalAction(hero.secondaryCta))) return false;\n if (!value.blocks.every(homeBlock)) return false;\n const model = value as unknown as CompositionInput;\n const anchors = model.blocks.flatMap((block) => block.kind === \"locations\" && block.anchor !== null ? [block.anchor] : []);\n if (new Set(anchors).size !== anchors.length) return false;\n const links = [model.hero?.cta?.href, model.hero?.secondaryCta?.href, ...model.blocks.flatMap((block) => {\n switch (block.kind) {\n case \"campaign\": case \"accent_band\": return [block.action?.href];\n case \"feature_stories\": return block.items.map((item) => item.action.href);\n case \"cta\": return [block.link.href];\n default: return [];\n }\n })];\n return links.every((link) => link === undefined || !link.startsWith(\"#\") || anchors.includes(link.slice(1)));\n}\n\nfunction proposed(value: unknown): boolean {\n return isDenseArray(value) && value.every((line: unknown) => object(line) && words(line.where) && typeof line.text === \"string\");\n}\n\nexport function validHomeFallback(value: unknown): value is HomeContent | null {\n return value === null || (object(value) && composition(value.composition) && typeof value.body === \"string\" && proposed(value.proposedCopy)\n && typeof value.campaign === \"string\" && [\"shown\", \"off\", \"not-started\", \"ended\", \"none\"].includes(value.campaign));\n}\n\nexport function validPageFallback(value: unknown): value is PageContent | null {\n return value === null || (object(value) && words(value.slug) && words(value.title) && composition(value.composition)\n && typeof value.body === \"string\" && typeof value.migrated === \"boolean\" && proposed(value.proposedCopy)\n && sections(value.sections, value.warnings));\n}\n\nexport function validSettingsFallback(value: unknown): value is SiteSettingsContent | null {\n return value === null || (object(value) && words(value.name) && nullableText(value.description) && object(value.contact)\n && nullableText(value.contact.email) && nullableText(value.contact.phone) && isDenseArray(value.social)\n && value.social.every((link: unknown) => object(link) && words(link.network) && typeof link.url === \"string\" && /^https?:\\/\\//.test(link.url)));\n}\n", "/**\n * A-1713. The site content model, read: the home page, content pages and site\n * settings, validated on read and returned in the shape a site's page\n * composition consumes.\n *\n * ===========================================================================\n * READ ONLY, BY CONSTRUCTION\n * ===========================================================================\n *\n * A client site reads its content with a read-only token. All editing goes\n * through the studio's dashboard, which writes to Sanity; nothing on a client\n * site writes, and this module has no write path to call. It is handed a\n * `ContentClient` (a `query` function) and nothing else.\n *\n * ===========================================================================\n * VALIDATED ON READ, BECAUSE SANITY VALIDATION ONLY ADVISES\n * ===========================================================================\n *\n * The schema's rules warn an editor; they do not refuse a publish, and\n * anything writing over the API skips them entirely. So every document is\n * checked here again, and a malformed one is refused BY NAME\n * (`MalformedContentError`, code `malformed-content`) listing every problem\n * with its path, rather than rendered half-empty. A page that renders with a\n * missing headline and a page whose content is broken look identical to a\n * visitor; a build that fails naming `hero.headline` does not.\n *\n * Absent is not malformed: `null` from `home()` means nobody has created the\n * home page yet, and a site decides what to do about that.\n *\n * ===========================================================================\n * THE SHAPE IT RETURNS\n * ===========================================================================\n *\n * The INPUT shape of a site's composition schema (the reference build's\n * frontmatter): a copy value is a plain string for the client's own words\n * with no claim about their source, `{ text, copySource: \"captured\" }` for\n * words claimed verbatim from the capture (the site checks every such claim\n * against its capture evidence, so the claim must survive Sanity), and\n * `{ text, copySource: \"proposed\" }` for studio-written words awaiting\n * approval. All three round-trip exactly; a photo is its library slug; every key a block declares is\n * present, `null` where there is nothing. So a site validates this with the\n * same schema it validates its Markdown frontmatter with, and its components\n * never know where the content came from.\n *\n * Mapping from the generic model to the composition's names:\n *\n * hero.headline / subline / lead hero.heading / subline / intro\n * hero.photos[0], [1] hero.image, hero.inset\n * hero.primaryAction / secondary... hero.cta / secondaryCta\n * campaign (when shown) the FIRST block, kind `campaign`, and\n * the page body (`# title` + its text)\n * featureStoriesBlock kind `feature_stories`\n * surfaceCardBlock kind `cta`\n * accentBandBlock kind `accent_band`\n * locationsBlock kind `locations` (jumpLink \u2192 anchor)\n *\n * A content page's `sections[]` (A-1915) reads those four kinds plus\n * `text_media`, `faq`, `gallery` and `contact` into `PageContent.sections`,\n * with their named warnings in `PageContent.warnings`. `sections.ts` holds the\n * kinds, the A-1876 layout names and the warning codes.\n *\n * Two places the composition cannot carry a proposed marker: a `cta` block's\n * plain strings, and the campaign's title and body (which travel as Markdown).\n * There the text is returned plain and the line is still listed in\n * `proposedCopy`, which is the list a dashboard and a site both read for\n * approval. Nothing is dropped silently.\n */\n\nimport { isDenseArray } from \"./array.js\";\nimport { defineCmsQuery, type CmsQuery, type CmsResolution } from \"../contracts/query.js\";\nimport { validHomeFallback, validPageFallback, validSettingsFallback } from \"./fallback.js\";\nimport {\n HEADING_LIST_LAYOUTS, READER_GALLERY_PHOTO_LIMIT, READER_GALLERY_PHOTO_MIN, SECTION_LAYOUT_DEFAULTS, SECTION_WARNINGS,\n SPLIT_LAYOUTS, STAGGER_ROW_LAYOUTS,\n type FaqSectionInput, type PageSectionInput, type SectionImageInput, type SectionWarning,\n} from \"./sections.js\";\n\n// ---------------------------------------------------------------------------\n// Output types\n// ---------------------------------------------------------------------------\n\nexport type CopyInput = string | { readonly text: string; readonly copySource: \"captured\" | \"proposed\" };\nexport type ActionInput = { readonly label: CopyInput; readonly href: string };\n\nexport type HeroInput = {\n readonly heading: CopyInput;\n readonly subline: CopyInput | null;\n readonly intro: CopyInput | null;\n readonly image: string | null;\n readonly inset: string | null;\n readonly cta: ActionInput | null;\n readonly secondaryCta: ActionInput | null;\n};\n\nexport type StoryInput = {\n readonly heading: CopyInput;\n readonly body: CopyInput;\n readonly action: ActionInput;\n readonly image: string | null;\n readonly shape: \"wide\" | \"tall\" | \"round\" | \"free\";\n readonly card: boolean;\n};\n\nexport type CompositionBlockInput =\n | { readonly kind: \"campaign\"; readonly action: ActionInput | null; readonly images: readonly string[] }\n | {\n readonly kind: \"locations\";\n readonly anchor: string | null;\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly image: string | null;\n }\n | {\n readonly kind: \"feature_stories\";\n readonly heading: CopyInput;\n readonly tail: CopyInput | null;\n readonly items: readonly StoryInput[];\n }\n | {\n readonly kind: \"accent_band\";\n readonly heading: CopyInput;\n readonly body: CopyInput;\n readonly action: ActionInput | null;\n readonly image: string | null;\n }\n | {\n readonly kind: \"cta\";\n readonly heading: string;\n readonly body: string | null;\n readonly link: { readonly label: string; readonly href: string };\n };\n\nexport type CompositionInput = {\n readonly intro: string | null;\n readonly photo: string | null;\n readonly hero: HeroInput | null;\n readonly blocks: readonly CompositionBlockInput[];\n};\n\n/** One line of studio-written copy awaiting approval, and where it is in the document. */\nexport type ProposedCopy = { readonly where: string; readonly text: string };\n\nexport type CampaignState = \"shown\" | \"off\" | \"not-started\" | \"ended\" | \"none\";\n\nexport type HomeContent = {\n readonly composition: CompositionInput;\n /** The page body as Markdown: the campaign's title and text when it is shown, otherwise empty. */\n readonly body: string;\n readonly campaign: CampaignState;\n readonly proposedCopy: readonly ProposedCopy[];\n};\n\nexport type PageContent = {\n readonly slug: string;\n readonly title: string;\n readonly composition: CompositionInput;\n readonly body: string;\n readonly migrated: boolean;\n readonly proposedCopy: readonly ProposedCopy[];\n /**\n * A-1915. Present only when the stored page has a `sections` list, so a page\n * written before sections existed reads exactly as it did in 0.2.0.\n */\n readonly sections?: readonly PageSectionInput[];\n /** A-1915. Present with `sections`: every named section warning, with its path. */\n readonly warnings?: readonly SectionWarning[];\n};\n\nexport type SiteSettingsContent = {\n readonly name: string;\n readonly description: string | null;\n readonly contact: { readonly email: string | null; readonly phone: string | null };\n readonly social: readonly { readonly network: string; readonly url: string }[];\n};\n\n// ---------------------------------------------------------------------------\n// The refusal\n// ---------------------------------------------------------------------------\n\nexport const MALFORMED_CONTENT = \"malformed-content\";\n\nexport class MalformedContentError extends Error {\n readonly code = MALFORMED_CONTENT;\n readonly documentId: string;\n readonly problems: readonly string[];\n\n constructor(documentId: string, problems: readonly string[]) {\n super(`${MALFORMED_CONTENT}: ${documentId}: ${problems.join(\"; \")}`);\n this.name = \"MalformedContentError\";\n this.documentId = documentId;\n this.problems = problems;\n }\n}\n\n// ---------------------------------------------------------------------------\n// The rules restated\n// ---------------------------------------------------------------------------\n\n/*\n * Runtime-free rules shared with schema-base. The schema adapter imports these\n * objects; content-client compatibility tests pin the shared references.\n */\nexport const READER_PHOTO_SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\nexport const READER_ACTION_HREF =\n /^(?:\\/(?![/\\\\])[^\\s]*|#[a-z][a-z0-9]*(?:-[a-z0-9]+)*|mailto:[^\\s@]+@[^\\s@]+|tel:\\+?[0-9][0-9 ()-]*|https?:\\/\\/[^\\s/]+[^\\s]*)$/;\nexport const READER_JUMP_LINK = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nexport const READER_STORY_LAYOUTS = [\"wide\", \"tall\", \"round\", \"free\"] as const;\nexport const READER_HOME_PAGE_ID = \"homePage\";\nexport const READER_SITE_SETTINGS_ID = \"siteSettings\";\n\n// ---------------------------------------------------------------------------\n// A small path-aware reader\n// ---------------------------------------------------------------------------\n\ntype Raw = Record<string, unknown>;\n\nclass Reading {\n readonly problems: string[] = [];\n readonly proposed: ProposedCopy[] = [];\n\n fail(path: string, message: string): null {\n this.problems.push(`${path} ${message}`);\n return null;\n }\n\n object(value: unknown, path: string): Raw | null {\n if (typeof value === \"object\" && value !== null && !Array.isArray(value)) return value as Raw;\n return this.fail(path, \"is not an object\");\n }\n\n dense(value: unknown[], path: string): boolean {\n if (isDenseArray(value)) return true;\n this.fail(path, \"contains missing entries\");\n return false;\n }\n\n optionalString(value: unknown, path: string): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === \"string\") return value.trim() === \"\" ? null : value;\n return this.fail(path, \"is not text\");\n }\n\n /** A copy value, or null when absent or empty. Records a proposed line. */\n copy(value: unknown, path: string): CopyInput | null {\n if (value === undefined || value === null) return null;\n const raw = this.object(value, path);\n if (raw === null) return null;\n const text = raw[\"text\"];\n const source = raw[\"copySource\"];\n if (text !== undefined && typeof text !== \"string\") return this.fail(`${path}.text`, \"is not text\");\n if (source !== undefined && source !== \"captured\" && source !== \"proposed\") {\n return this.fail(`${path}.copySource`, `is ${JSON.stringify(source)}, not captured or proposed`);\n }\n if (typeof text !== \"string\" || text.trim() === \"\") return null;\n if (source === \"proposed\") {\n this.proposed.push({ where: path, text });\n return { text, copySource: \"proposed\" };\n }\n if (source === \"captured\") return { text, copySource: \"captured\" };\n return text;\n }\n\n requiredCopy(value: unknown, path: string): CopyInput | null {\n const copy = this.copy(value, path);\n if (copy === null && !this.problems.some((p) => p.startsWith(path))) this.fail(path, \"is missing its words\");\n return copy;\n }\n\n photo(value: unknown, path: string): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === \"string\" && READER_PHOTO_SLUG.test(value)) return value;\n return this.fail(path, `is ${JSON.stringify(value)}, not a photo library slug`);\n }\n\n photos(value: unknown, path: string, max: number): string[] {\n if (value === undefined || value === null) return [];\n if (!Array.isArray(value)) {\n this.fail(path, \"is not a list of photos\");\n return [];\n }\n if (!this.dense(value, path)) return [];\n if (value.length > max) this.fail(path, `holds ${String(value.length)} photos; at most ${String(max)}`);\n return value.map((entry, index) => this.photo(entry, `${path}[${String(index)}]`)).filter((p): p is string => p !== null);\n }\n\n action(value: unknown, path: string): ActionInput | null {\n if (value === undefined || value === null) return null;\n const raw = this.object(value, path);\n if (raw === null) return null;\n const label = this.requiredCopy(raw[\"label\"], `${path}.label`);\n const href = raw[\"href\"];\n if (typeof href !== \"string\" || !READER_ACTION_HREF.test(href)) {\n return this.fail(`${path}.href`, `is ${JSON.stringify(href)}, not a site path, #jump-link, mailto:, tel: or web address`);\n }\n return label === null ? null : { label, href };\n }\n\n requiredAction(value: unknown, path: string): ActionInput | null {\n if (value === undefined || value === null) return this.fail(path, \"is missing\");\n return this.action(value, path);\n }\n}\n\nfunction plain(copy: CopyInput): string {\n return typeof copy === \"string\" ? copy : copy.text;\n}\n\n// ---------------------------------------------------------------------------\n// Portable Text to Markdown\n// ---------------------------------------------------------------------------\n\n/**\n * The narrow Portable Text `portableText` declares, back to Markdown: normal,\n * h2, h3 and quote blocks, bullet and numbered lists, bold, italic, code and\n * links. It is the inverse of the seed package's Markdown mapper, and the\n * round-trip test holds the two to each other.\n *\n * An uploaded image inside rich text is REFUSED, not dropped: nothing can\n * upload one yet (the dashboard slice decides how), so one arriving means\n * something wrote the document by hand, and a page silently missing a picture\n * is the failure this reader exists to prevent.\n */\nexport function portableTextToMarkdown(value: unknown): string {\n const reading = new Reading();\n const markdown = richTextToMarkdown(value, \"body\", reading);\n if (reading.problems.length > 0) throw new MalformedContentError(\"body\", reading.problems);\n return markdown;\n}\n\nfunction richTextToMarkdown(value: unknown, path: string, reading: Reading): string {\n if (value === undefined || value === null) return \"\";\n if (!Array.isArray(value)) {\n reading.fail(path, \"is not rich text\");\n return \"\";\n }\n if (!reading.dense(value, path)) return \"\";\n const out: string[] = [];\n let previousWasList = false;\n value.forEach((member, index) => {\n const at = `${path}[${String(index)}]`;\n const block = reading.object(member, at);\n if (block === null) return;\n if (block[\"_type\"] !== \"block\") {\n reading.fail(at, `is a ${JSON.stringify(block[\"_type\"])}; only text is supported in rich text so far`);\n return;\n }\n const text = spansToMarkdown(block, at, reading);\n const listItem = block[\"listItem\"];\n const style = block[\"style\"] ?? \"normal\";\n let line: string;\n if (listItem === \"bullet\" || listItem === \"number\") {\n const level = typeof block[\"level\"] === \"number\" && block[\"level\"] > 1 ? block[\"level\"] : 1;\n line = `${\" \".repeat(level - 1)}${listItem === \"bullet\" ? \"-\" : \"1.\"} ${text}`;\n } else if (style === \"h2\") line = `## ${text}`;\n else if (style === \"h3\") line = `### ${text}`;\n else if (style === \"blockquote\") line = `> ${text}`;\n else if (style === \"normal\") line = text;\n else {\n reading.fail(`${at}.style`, `is ${JSON.stringify(style)}, which the schema does not offer`);\n return;\n }\n const isList = listItem === \"bullet\" || listItem === \"number\";\n if (out.length > 0) out.push(isList && previousWasList ? \"\\n\" : \"\\n\\n\");\n out.push(line);\n previousWasList = isList;\n });\n return out.join(\"\");\n}\n\nconst DECORATORS: Record<string, string> = { strong: \"**\", em: \"*\", code: \"`\" };\n\nfunction spansToMarkdown(block: Raw, path: string, reading: Reading): string {\n const links = new Map<string, string>();\n const markDefs = Array.isArray(block[\"markDefs\"]) ? (block[\"markDefs\"] as unknown[]) : [];\n if (!reading.dense(markDefs, `${path}.markDefs`)) return \"\";\n for (const def of markDefs) {\n const d = def as Raw;\n if (d[\"_type\"] === \"link\" && typeof d[\"_key\"] === \"string\" && typeof d[\"href\"] === \"string\") links.set(d[\"_key\"], d[\"href\"]);\n }\n const children = Array.isArray(block[\"children\"]) ? (block[\"children\"] as unknown[]) : [];\n if (!reading.dense(children, `${path}.children`)) return \"\";\n return children\n .map((child, index) => {\n const span = child as Raw;\n if (span[\"_type\"] !== \"span\" || typeof span[\"text\"] !== \"string\") {\n reading.fail(`${path}.children[${String(index)}]`, \"is not a text span\");\n return \"\";\n }\n let text = span[\"text\"];\n const marks = Array.isArray(span[\"marks\"]) ? (span[\"marks\"] as unknown[]) : [];\n if (!reading.dense(marks, `${path}.children[${String(index)}].marks`)) return \"\";\n let href: string | null = null;\n for (const mark of marks) {\n if (typeof mark !== \"string\") continue;\n const fence = DECORATORS[mark];\n if (fence !== undefined) text = `${fence}${text}${fence}`;\n else if (links.has(mark)) href = links.get(mark) ?? null;\n else reading.fail(`${path}.children[${String(index)}].marks`, `names ${JSON.stringify(mark)}, which is neither a style nor a link`);\n }\n return href === null ? text : `[${text}](${href})`;\n })\n .join(\"\");\n}\n\n// ---------------------------------------------------------------------------\n// The home page\n// ---------------------------------------------------------------------------\n\n/** Whether a campaign is shown at `now`, and if not, why not. */\nexport function campaignState(campaign: unknown, now: Date): CampaignState {\n if (typeof campaign !== \"object\" || campaign === null) return \"none\";\n const c = campaign as Raw;\n if (c[\"enabled\"] !== true) return \"off\";\n const starts = typeof c[\"startsAt\"] === \"string\" ? Date.parse(c[\"startsAt\"]) : null;\n const ends = typeof c[\"endsAt\"] === \"string\" ? Date.parse(c[\"endsAt\"]) : null;\n if (starts !== null && now.getTime() < starts) return \"not-started\";\n if (ends !== null && now.getTime() >= ends) return \"ended\";\n return \"shown\";\n}\n\nfunction keyed(path: string, raw: Raw, index: number): string {\n return typeof raw[\"_key\"] === \"string\" ? `${path}[_key==\"${raw[\"_key\"]}\"]` : `${path}[${String(index)}]`;\n}\n\n/**\n * A stored home page document, validated and mapped. Throws\n * `MalformedContentError` naming every problem. `now` decides whether a\n * scheduled campaign is shown, and is a parameter so a build, a preview and a\n * test each say which moment they mean.\n */\nexport function parseHomePage(document: unknown, options: { readonly now: Date }): HomeContent {\n const reading = new Reading();\n const doc = reading.object(document, \"homePage\");\n if (doc === null) throw new MalformedContentError(READER_HOME_PAGE_ID, reading.problems);\n const id = typeof doc[\"_id\"] === \"string\" ? doc[\"_id\"] : READER_HOME_PAGE_ID;\n if (doc[\"_type\"] !== \"homePage\") reading.fail(\"_type\", `is ${JSON.stringify(doc[\"_type\"])}, not homePage`);\n\n let hero: HeroInput | null = null;\n const rawHero = doc[\"hero\"] === undefined ? reading.fail(\"hero\", \"is missing\") : reading.object(doc[\"hero\"], \"hero\");\n if (rawHero !== null) {\n const photos = reading.photos(rawHero[\"photos\"], \"hero.photos\", 2);\n const heading = reading.requiredCopy(rawHero[\"headline\"], \"hero.headline\");\n const subline = reading.copy(rawHero[\"subline\"], \"hero.subline\");\n const intro = reading.copy(rawHero[\"lead\"], \"hero.lead\");\n const cta = reading.action(rawHero[\"primaryAction\"], \"hero.primaryAction\");\n const secondaryCta = reading.action(rawHero[\"secondaryAction\"], \"hero.secondaryAction\");\n if (heading !== null) {\n hero = { heading, subline, intro, image: photos[0] ?? null, inset: photos[1] ?? null, cta, secondaryCta };\n }\n }\n\n const blocks: CompositionBlockInput[] = [];\n const blockJumps: { where: string; href: string }[] = [];\n let body = \"\";\n const state = campaignState(doc[\"campaign\"], options.now);\n if (state === \"shown\") {\n const campaign = reading.object(doc[\"campaign\"], \"campaign\");\n if (campaign !== null) {\n const title = reading.requiredCopy(campaign[\"title\"], \"campaign.title\");\n const images = reading.photos(campaign[\"photos\"], \"campaign.photos\", 3);\n if (images.length === 0) reading.fail(\"campaign.photos\", \"is empty; a shown campaign needs at least one photo\");\n const text = richTextToMarkdown(campaign[\"body\"], \"campaign.body\", reading);\n if (text === \"\") reading.fail(\"campaign.body\", \"is empty; a shown campaign needs its text\");\n if (campaign[\"bodyCopySource\"] === \"proposed\") reading.proposed.push({ where: \"campaign.body\", text });\n const action = reading.action(campaign[\"action\"], \"campaign.action\");\n if (action !== null) blockJumps.push({ where: \"campaign.action.href\", href: action.href });\n if (title !== null) body = `# ${plain(title)}\\n\\n${text}`;\n blocks.push({ kind: \"campaign\", action, images });\n }\n }\n\n const anchors: string[] = [];\n const rawBlocks = doc[\"blocks\"] ?? [];\n if (!Array.isArray(rawBlocks)) reading.fail(\"blocks\", \"is not a list\");\n else if (reading.dense(rawBlocks, \"blocks\")) {\n rawBlocks.forEach((member, index) => {\n const raw = reading.object(member, `blocks[${String(index)}]`);\n if (raw === null) return;\n const at = keyed(\"blocks\", raw, index);\n const mapped = mapBlock(raw, at, reading);\n if (mapped === null) return;\n blockJumps.push(...buttonsOf(mapped, raw, at));\n if (mapped.kind === \"locations\" && mapped.anchor !== null) {\n if (anchors.includes(mapped.anchor)) reading.fail(`${at}.jumpLink`, `repeats \"${mapped.anchor}\", already used by another section`);\n anchors.push(mapped.anchor);\n }\n blocks.push(mapped);\n });\n }\n\n // A jump link on ANY button must land on a section of this page.\n const jumps: { where: string; href: string }[] = [];\n if (hero?.cta) jumps.push({ where: \"hero.primaryAction.href\", href: hero.cta.href });\n if (hero?.secondaryCta) jumps.push({ where: \"hero.secondaryAction.href\", href: hero.secondaryCta.href });\n jumps.push(...blockJumps);\n for (const { where, href } of jumps) {\n if (href.startsWith(\"#\") && !anchors.includes(href.slice(1))) {\n reading.fail(where, `jumps to ${href}, which no section on the page is named`);\n }\n }\n\n if (reading.problems.length > 0) throw new MalformedContentError(id, reading.problems);\n return {\n composition: { intro: null, photo: null, hero, blocks },\n body,\n campaign: state,\n proposedCopy: reading.proposed,\n };\n}\n\n/** Every button a mapped section carries, with its path in the stored document. */\nfunction buttonsOf(block: CompositionBlockInput, raw: Raw, at: string): { where: string; href: string }[] {\n switch (block.kind) {\n case \"feature_stories\": {\n const stories = Array.isArray(raw[\"stories\"]) ? (raw[\"stories\"] as Raw[]) : [];\n return block.items.map((item, index) => ({\n where: `${keyed(`${at}.stories`, stories[index] ?? {}, index)}.action.href`,\n href: item.action.href,\n }));\n }\n case \"accent_band\":\n return block.action === null ? [] : [{ where: `${at}.action.href`, href: block.action.href }];\n case \"cta\":\n return [{ where: `${at}.action.href`, href: block.link.href }];\n default:\n return [];\n }\n}\n\nfunction jumpLinkOf(raw: Raw, at: string, reading: Reading): string | null {\n const jump = raw[\"jumpLink\"];\n if (jump === undefined || jump === null || jump === \"\") return null;\n if (typeof jump !== \"string\" || !READER_JUMP_LINK.test(jump)) return reading.fail(`${at}.jumpLink`, `is ${JSON.stringify(jump)}, not lowercase words joined by hyphens`);\n return jump;\n}\n\nfunction mapBlock(raw: Raw, at: string, reading: Reading): CompositionBlockInput | null {\n switch (raw[\"_type\"]) {\n case \"featureStoriesBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const stories = raw[\"stories\"];\n if (!Array.isArray(stories) || stories.length === 0) return reading.fail(`${at}.stories`, \"has no stories\");\n if (!reading.dense(stories, `${at}.stories`)) return null;\n const items: StoryInput[] = [];\n stories.forEach((member, index) => {\n const story = reading.object(member, `${at}.stories[${String(index)}]`);\n if (story === null) return;\n const sat = keyed(`${at}.stories`, story, index);\n const sHeading = reading.requiredCopy(story[\"heading\"], `${sat}.heading`);\n const sBody = reading.requiredCopy(story[\"body\"], `${sat}.body`);\n const action = reading.requiredAction(story[\"action\"], `${sat}.action`);\n const image = reading.photo(story[\"photo\"], `${sat}.photo`);\n const layout = story[\"layout\"] ?? \"wide\";\n if (!(READER_STORY_LAYOUTS as readonly unknown[]).includes(layout)) {\n reading.fail(`${sat}.layout`, `is ${JSON.stringify(layout)}, not wide, tall, round or free`);\n return;\n }\n const onCard = story[\"onCard\"] ?? false;\n if (typeof onCard !== \"boolean\") {\n reading.fail(`${sat}.onCard`, \"is not on or off\");\n return;\n }\n if (sHeading === null || sBody === null || action === null) return;\n items.push({ heading: sHeading, body: sBody, action, image, shape: layout as StoryInput[\"shape\"], card: onCard });\n });\n return heading === null ? null : { kind: \"feature_stories\", heading, tail, items };\n }\n case \"surfaceCardBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.copy(raw[\"body\"], `${at}.body`);\n const action = reading.requiredAction(raw[\"action\"], `${at}.action`);\n if (heading === null || action === null) return null;\n return {\n kind: \"cta\",\n heading: plain(heading),\n body: body === null ? null : plain(body),\n link: { label: plain(action.label), href: action.href },\n };\n }\n case \"accentBandBlock\": {\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.requiredCopy(raw[\"body\"], `${at}.body`);\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = reading.photo(raw[\"photo\"], `${at}.photo`);\n if (heading === null || body === null) return null;\n return { kind: \"accent_band\", heading, body, action, image };\n }\n case \"locationsBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const image = reading.photo(raw[\"photo\"], `${at}.photo`);\n return heading === null ? null : { kind: \"locations\", anchor, heading, tail, image };\n }\n default:\n return reading.fail(`${at}._type`, `is ${JSON.stringify(raw[\"_type\"])}, not a section type this reader knows`);\n }\n}\n\n// ---------------------------------------------------------------------------\n// Page sections (A-1915)\n// ---------------------------------------------------------------------------\n\n/** A stored `layout`, or the composition default with a named warning. Never throws. */\nfunction sectionLayout<T extends string>(raw: Raw, at: string, layouts: readonly T[], fallback: T, warnings: SectionWarning[]): T {\n const value = raw[\"layout\"];\n const layout = layouts.find((name) => name === value);\n if (layout !== undefined) return layout;\n warnings.push({ code: SECTION_WARNINGS.layoutDefaulted, where: `${at}.layout` });\n return fallback;\n}\n\n/** An `imageWithHotspot`, or null. Without alt text or an asset it is dropped with a named warning. */\nfunction sectionImage(value: unknown, path: string, reading: Reading, warnings: SectionWarning[]): SectionImageInput | null {\n if (value === undefined || value === null) return null;\n const raw = reading.object(value, path);\n if (raw === null) return null;\n const asset = raw[\"asset\"];\n const ref = typeof asset === \"object\" && asset !== null ? (asset as Raw)[\"_ref\"] : undefined;\n if (typeof ref !== \"string\" || ref === \"\") {\n warnings.push({ code: SECTION_WARNINGS.imageMissingAsset, where: `${path}.asset` });\n return null;\n }\n const alt = raw[\"alt\"];\n if (typeof alt !== \"string\" || alt.trim() === \"\") {\n warnings.push({ code: SECTION_WARNINGS.imageMissingAlt, where: `${path}.alt` });\n return null;\n }\n const caption = reading.optionalString(raw[\"caption\"], `${path}.caption`);\n let hotspot: SectionImageInput[\"hotspot\"] = null;\n if (raw[\"hotspot\"] !== undefined && raw[\"hotspot\"] !== null) {\n const spot = reading.object(raw[\"hotspot\"], `${path}.hotspot`);\n const x = spot?.[\"x\"];\n const y = spot?.[\"y\"];\n if (typeof x === \"number\" && typeof y === \"number\" && x >= 0 && x <= 1 && y >= 0 && y <= 1) hotspot = { x, y };\n else if (spot !== null) reading.fail(`${path}.hotspot`, \"is not a point inside the image\");\n }\n return { asset: ref, alt, caption, hotspot };\n}\n\n/** Only a bounded schema name may travel in a warning; never coerce non-text values. */\nfunction sectionTypeForWarning(value: unknown): string {\n return typeof value === \"string\" ? value.slice(0, 64).replace(/[^A-Za-z0-9_.-]/g, \"?\") : \"?\";\n}\n\nfunction mapSection(raw: Raw, at: string, reading: Reading, warnings: SectionWarning[]): PageSectionInput | null {\n switch (raw[\"_type\"]) {\n case \"featureStoriesBlock\":\n case \"surfaceCardBlock\":\n case \"accentBandBlock\":\n case \"locationsBlock\": {\n const block = mapBlock(raw, at, reading);\n return block === null || block.kind === \"campaign\" ? null : block;\n }\n case \"textMediaBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const body = reading.requiredCopy(raw[\"body\"], `${at}.body`);\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = sectionImage(raw[\"photo\"], `${at}.photo`, reading, warnings);\n const layout = sectionLayout(raw, at, SPLIT_LAYOUTS, SECTION_LAYOUT_DEFAULTS.Split, warnings);\n if (heading === null || body === null) return null;\n return { kind: \"text_media\", anchor, layout, heading, tail, body, action, image };\n }\n case \"faqBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const tail = reading.copy(raw[\"tail\"], `${at}.tail`);\n const intro = reading.copy(raw[\"intro\"], `${at}.intro`);\n const layout = sectionLayout(raw, at, HEADING_LIST_LAYOUTS, SECTION_LAYOUT_DEFAULTS.HeadingList, warnings);\n const rawItems = raw[\"items\"];\n if (!Array.isArray(rawItems) || rawItems.length === 0) return reading.fail(`${at}.items`, \"has no questions\");\n if (!reading.dense(rawItems, `${at}.items`)) return null;\n const items: FaqSectionInput[\"items\"][number][] = [];\n rawItems.forEach((member, index) => {\n const item = reading.object(member, `${at}.items[${String(index)}]`);\n if (item === null) return;\n const iat = keyed(`${at}.items`, item, index);\n if (item[\"_type\"] !== undefined && item[\"_type\"] !== \"faqItem\") {\n reading.fail(`${iat}._type`, `is ${JSON.stringify(item[\"_type\"])}, not faqItem`);\n return;\n }\n const question = reading.requiredCopy(item[\"question\"], `${iat}.question`);\n const answer = reading.requiredCopy(item[\"answer\"], `${iat}.answer`);\n if (question !== null && answer !== null) items.push({ question, answer });\n });\n return heading === null ? null : { kind: \"faq\", anchor, layout, heading, tail, intro, items };\n }\n case \"galleryBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.copy(raw[\"heading\"], `${at}.heading`);\n const layout = sectionLayout(raw, at, STAGGER_ROW_LAYOUTS, SECTION_LAYOUT_DEFAULTS.StaggerRow, warnings);\n const photos = raw[\"photos\"] ?? [];\n if (!Array.isArray(photos)) return reading.fail(`${at}.photos`, \"is not a list of photos\");\n if (!reading.dense(photos, `${at}.photos`)) return null;\n if (photos.length < READER_GALLERY_PHOTO_MIN || photos.length > READER_GALLERY_PHOTO_LIMIT) {\n return reading.fail(`${at}.photos`, `holds ${String(photos.length)} photos; a gallery shows ${String(READER_GALLERY_PHOTO_MIN)} to ${String(READER_GALLERY_PHOTO_LIMIT)}`);\n }\n const images = photos.flatMap((photo, index) => {\n const image = sectionImage(photo, keyed(`${at}.photos`, typeof photo === \"object\" && photo !== null ? (photo as Raw) : {}, index), reading, warnings);\n return image === null ? [] : [image];\n });\n if (images.length === 0) {\n warnings.push({ code: SECTION_WARNINGS.emptySkipped, where: at });\n return null;\n }\n return { kind: \"gallery\", anchor, layout, heading, images };\n }\n case \"contactBlock\": {\n const anchor = jumpLinkOf(raw, at, reading);\n const heading = reading.requiredCopy(raw[\"heading\"], `${at}.heading`);\n const body = reading.copy(raw[\"body\"], `${at}.body`);\n const shown = (field: \"showEmail\" | \"showPhone\"): boolean => {\n const value = raw[field] ?? true;\n if (typeof value === \"boolean\") return value;\n reading.fail(`${at}.${field}`, \"is not on or off\");\n return false;\n };\n const showEmail = shown(\"showEmail\");\n const showPhone = shown(\"showPhone\");\n const action = reading.action(raw[\"action\"], `${at}.action`);\n const image = sectionImage(raw[\"photo\"], `${at}.photo`, reading, warnings);\n const layout = sectionLayout(raw, at, SPLIT_LAYOUTS, SECTION_LAYOUT_DEFAULTS.Split, warnings);\n if (heading === null) return null;\n if (!showEmail && !showPhone && body === null && action === null) {\n warnings.push({ code: SECTION_WARNINGS.emptySkipped, where: at });\n return null;\n }\n return { kind: \"contact\", anchor, layout, heading, body, showEmail, showPhone, action, image };\n }\n default:\n warnings.push({ code: SECTION_WARNINGS.unknownType, where: `${at}._type`, type: sectionTypeForWarning(raw[\"_type\"]) });\n return null;\n }\n}\n\n/** Every button a mapped page section carries, with its path in the stored document. */\nfunction sectionButtons(section: PageSectionInput, raw: Raw, at: string): { where: string; href: string }[] {\n switch (section.kind) {\n case \"text_media\":\n case \"contact\":\n return section.action === null ? [] : [{ where: `${at}.action.href`, href: section.action.href }];\n case \"faq\":\n case \"gallery\":\n return [];\n default:\n return buttonsOf(section, raw, at);\n }\n}\n\n/** `page.sections[]`, mapped in order. Unknown types are skipped with a warning; malformed content is a problem. */\nfunction parseSections(value: unknown, reading: Reading): { sections: PageSectionInput[]; warnings: SectionWarning[] } {\n const sections: PageSectionInput[] = [];\n const warnings: SectionWarning[] = [];\n if (!Array.isArray(value)) {\n reading.fail(\"sections\", \"is not a list\");\n return { sections, warnings };\n }\n if (!reading.dense(value, \"sections\")) return { sections, warnings };\n const anchors: string[] = [];\n const jumps: { where: string; href: string }[] = [];\n value.forEach((member, index) => {\n const raw = reading.object(member, `sections[${String(index)}]`);\n if (raw === null) return;\n const at = keyed(\"sections\", raw, index);\n const section = mapSection(raw, at, reading, warnings);\n if (section === null) return;\n jumps.push(...sectionButtons(section, raw, at));\n const anchor = \"anchor\" in section ? section.anchor : null;\n if (anchor !== null) {\n if (anchors.includes(anchor)) reading.fail(`${at}.jumpLink`, `repeats \"${anchor}\", already used by another section`);\n anchors.push(anchor);\n }\n sections.push(section);\n });\n for (const { where, href } of jumps) {\n if (href.startsWith(\"#\") && !anchors.includes(href.slice(1))) reading.fail(where, `jumps to ${href}, which no section on the page is named`);\n }\n return { sections, warnings };\n}\n\n// ---------------------------------------------------------------------------\n// Content pages and settings\n// ---------------------------------------------------------------------------\n\nexport function parseContentPage(document: unknown): PageContent {\n const reading = new Reading();\n const doc = reading.object(document, \"page\");\n if (doc === null) throw new MalformedContentError(\"page\", reading.problems);\n const id = typeof doc[\"_id\"] === \"string\" ? doc[\"_id\"] : \"page\";\n if (doc[\"_type\"] !== \"page\") reading.fail(\"_type\", `is ${JSON.stringify(doc[\"_type\"])}, not page`);\n const title = reading.optionalString(doc[\"title\"], \"title\");\n if (title === null) reading.fail(\"title\", \"is missing\");\n if (doc[\"titleCopySource\"] === \"proposed\" && title !== null) reading.proposed.push({ where: \"title\", text: title });\n const slugObject = doc[\"slug\"] as Raw | undefined;\n const slug = typeof slugObject?.[\"current\"] === \"string\" && slugObject[\"current\"] !== \"\" ? slugObject[\"current\"] : null;\n if (slug === null) reading.fail(\"slug.current\", \"is missing\");\n const lead = reading.copy(doc[\"lead\"], \"lead\");\n const photo = reading.photo(doc[\"photo\"], \"photo\");\n const body = richTextToMarkdown(doc[\"body\"], \"body\", reading);\n if (doc[\"bodyCopySource\"] === \"proposed\") reading.proposed.push({ where: \"body\", text: body });\n const sections = doc[\"sections\"] === undefined || doc[\"sections\"] === null ? null : parseSections(doc[\"sections\"], reading);\n if (reading.problems.length > 0 || title === null || slug === null) throw new MalformedContentError(id, reading.problems);\n return {\n slug,\n title,\n composition: { intro: lead === null ? null : plain(lead), photo, hero: null, blocks: [] },\n body,\n migrated: doc[\"migrated\"] === true,\n proposedCopy: reading.proposed,\n ...(sections === null ? {} : sections),\n };\n}\n\nexport function parseSiteSettings(document: unknown): SiteSettingsContent {\n const reading = new Reading();\n const doc = reading.object(document, \"siteSettings\");\n if (doc === null) throw new MalformedContentError(READER_SITE_SETTINGS_ID, reading.problems);\n const name = reading.optionalString(doc[\"title\"], \"title\");\n if (name === null) reading.fail(\"title\", \"is missing; a site needs its name\");\n const description = reading.optionalString(doc[\"description\"], \"description\");\n const contact = doc[\"contact\"] === undefined ? {} : (reading.object(doc[\"contact\"], \"contact\") ?? {});\n const email = reading.optionalString(contact[\"email\"], \"contact.email\");\n const phone = reading.optionalString(contact[\"phone\"], \"contact.phone\");\n const social: { network: string; url: string }[] = [];\n const rawSocial = doc[\"social\"] ?? [];\n if (!Array.isArray(rawSocial)) reading.fail(\"social\", \"is not a list\");\n else if (reading.dense(rawSocial, \"social\"))\n rawSocial.forEach((member, index) => {\n const link = reading.object(member, `social[${String(index)}]`);\n if (link === null) return;\n const network = reading.optionalString(link[\"network\"], `social[${String(index)}].network`);\n const url = reading.optionalString(link[\"url\"], `social[${String(index)}].url`);\n if (network === null || url === null || !/^https?:\\/\\//.test(url)) {\n reading.fail(`social[${String(index)}]`, \"needs a network and a web address\");\n return;\n }\n social.push({ network, url });\n });\n if (reading.problems.length > 0 || name === null) throw new MalformedContentError(READER_SITE_SETTINGS_ID, reading.problems);\n return { name, description, contact: { email, phone }, social };\n}\n\n// ---------------------------------------------------------------------------\n// Queries\n// ---------------------------------------------------------------------------\n\n/** By fixed id: a second home page at a random id is never read. */\nexport const HOME_PAGE_DOCUMENT_QUERY = `*[_id == $id][0]`;\nexport const CONTENT_PAGES_QUERY = `*[_type == \"page\" && defined(slug.current)]|order(slug.current asc)`;\nexport const CONTENT_PAGE_BY_SLUG_QUERY = `*[_type == \"page\" && slug.current == $slug][0]`;\n\nexport interface SiteContentReader {\n /** `null` when no home page document exists yet. */\n home: (options: { readonly now: Date }) => Promise<HomeContent | null>;\n pages: () => Promise<PageContent[]>;\n /** `null` when no page has that slug. */\n pageBySlug: (slug: string) => Promise<PageContent | null>;\n /** `null` before anyone has filled in the site's details. */\n siteSettings: () => Promise<SiteSettingsContent | null>;\n}\n\nexport function createSiteContentReader(client: { query: <T>(groq: string, options?: { params?: Record<string, unknown>; tags?: readonly string[] }) => Promise<T> }): SiteContentReader {\n return {\n home: async ({ now }) => {\n const doc = await client.query<unknown>(HOME_PAGE_DOCUMENT_QUERY, { params: { id: READER_HOME_PAGE_ID } });\n return doc === null || doc === undefined ? null : parseHomePage(doc, { now });\n },\n pages: async () => {\n const docs = await client.query<unknown>(CONTENT_PAGES_QUERY);\n if (!Array.isArray(docs)) throw new MalformedContentError(\"page\", [\"the page query did not return a list\"]);\n if (!isDenseArray(docs)) throw new MalformedContentError(\"page\", [\"the page query contains missing entries\"]);\n return docs.map((doc) => parseContentPage(doc));\n },\n pageBySlug: async (slug) => {\n const doc = await client.query<unknown>(CONTENT_PAGE_BY_SLUG_QUERY, { params: { slug } });\n return doc === null || doc === undefined ? null : parseContentPage(doc);\n },\n siteSettings: async () => {\n const doc = await client.query<unknown>(HOME_PAGE_DOCUMENT_QUERY, { params: { id: READER_SITE_SETTINGS_ID } });\n return doc === null || doc === undefined ? null : parseSiteSettings(doc);\n },\n };\n}\n\nfunction atomic<T>(raw: unknown, fallback: T, parse: (value: unknown) => T, validFallback: (value: unknown) => boolean): CmsResolution<T> {\n if (!validFallback(fallback)) throw new TypeError(\"Invalid CMS content fallback\");\n if (raw === null || raw === undefined) return { data: fallback, fallbackFields: [\"$\"] };\n // The server reader catches parser errors and classifies the whole fallback\n // as malformed. Returning fallback here would lose that diagnostic reason.\n return { data: parse(raw), fallbackFields: [] };\n}\n\nexport function homeContentQuery(now: Date): CmsQuery<HomeContent | null> {\n if (!(now instanceof Date) || !Number.isFinite(now.getTime())) throw new TypeError(\"Invalid CMS campaign date\");\n const captured = now.getTime();\n return defineCmsQuery({\n name: \"homePage.v1\", query: HOME_PAGE_DOCUMENT_QUERY, params: { id: READER_HOME_PAGE_ID },\n dependencies: { types: [\"homePage\"], ids: [READER_HOME_PAGE_ID] },\n resolve: (raw, fallback) => atomic(raw, fallback, (value) => parseHomePage(value, { now: new Date(captured) }), validHomeFallback),\n });\n}\n\nexport function contentPageQuery(slug: string): CmsQuery<PageContent | null> {\n if (typeof slug !== \"string\" || slug === \"\") throw new TypeError(\"Invalid CMS page slug\");\n return defineCmsQuery({\n name: \"page.v1\", query: CONTENT_PAGE_BY_SLUG_QUERY, params: { slug }, dependencies: { types: [\"page\"] },\n resolve: (raw, fallback) => atomic(raw, fallback, parseContentPage, validPageFallback),\n });\n}\n\nexport function contentPagesQuery(): CmsQuery<readonly PageContent[]> {\n return defineCmsQuery({\n name: \"pages.v1\", query: CONTENT_PAGES_QUERY, params: {}, dependencies: { types: [\"page\"] },\n resolve: (raw, fallback) => atomic(raw, fallback, (value) => {\n if (!Array.isArray(value)) throw new MalformedContentError(\"page\", [\"the page query did not return a list\"]);\n if (!isDenseArray(value)) throw new MalformedContentError(\"page\", [\"the page query contains missing entries\"]);\n return value.map((document: unknown) => parseContentPage(document));\n }, (value) => isDenseArray(value) && value.every((page: unknown) => page !== null && validPageFallback(page))),\n });\n}\n\nexport function siteSettingsQuery(): CmsQuery<SiteSettingsContent | null> {\n return defineCmsQuery({\n name: \"siteSettings.v1\", query: HOME_PAGE_DOCUMENT_QUERY, params: { id: READER_SITE_SETTINGS_ID },\n dependencies: { types: [\"siteSettings\"], ids: [READER_SITE_SETTINGS_ID] },\n resolve: (raw, fallback) => atomic(raw, fallback, parseSiteSettings, validSettingsFallback),\n });\n}\n", "import { defineCmsQuery, type CmsQuery, type CmsResolution } from \"./query.js\";\n\nexport const SITE_HERO_LAYOUTS = [\"columns\", \"rows\"] as const;\nexport const SITE_HERO_TAGLINE_MAX_LENGTH = 40;\nexport const SITE_HERO_LAYOUT_WARNING = \"siteHero.layout.defaulted\" as const;\nexport const SITE_HERO_TAGLINE_DROPPED_WARNING = \"siteHero.tagline.dropped\" as const;\nexport const SITE_HERO_TAGLINES_DEFAULTED_WARNING = \"siteHero.taglines.defaulted\" as const;\nexport type SiteHeroLayout = typeof SITE_HERO_LAYOUTS[number];\nexport type SiteHeroTagline = { readonly key: string; readonly text: string };\n/** Optional additions preserve existing heading/intro-only consumer fallbacks. */\nexport type SiteHero = {\n readonly heading: string;\n readonly intro: string;\n readonly layout?: SiteHeroLayout;\n readonly taglines?: readonly SiteHeroTagline[];\n};\nexport type ParsedSiteHero = SiteHero & {\n readonly layout: SiteHeroLayout;\n readonly taglines: readonly SiteHeroTagline[];\n};\nexport type TextFieldDefinition = {\n readonly name: string;\n readonly label: string;\n readonly noun: { readonly article: \"a\" | \"an\"; readonly word: string };\n readonly kind: \"single-line\" | \"multi-line\";\n readonly required: boolean;\n readonly minLength: number;\n readonly maxLength: number;\n readonly noTrailingFullStop?: boolean;\n};\nexport type TextDocumentDefinition = {\n readonly key: string;\n readonly documentId: string;\n readonly documentType: string;\n readonly fields: readonly TextFieldDefinition[];\n readonly copy: {\n readonly currentTitle: string;\n readonly editTitle: string;\n readonly empty: string;\n };\n};\nexport type TextValidation =\n | { readonly ok: true; readonly value: Readonly<Record<string, string>> }\n | { readonly ok: false; readonly errors: Readonly<Record<string, string>> };\n\nexport const CMS_CONTRACT_VERSION = 1;\n\nexport const SITE_HERO: TextDocumentDefinition = {\n key: \"hero\",\n documentId: \"siteHero\",\n documentType: \"siteHero\",\n fields: [\n {\n name: \"heading\",\n label: \"Heading\",\n noun: { article: \"a\", word: \"heading\" },\n kind: \"single-line\",\n required: true,\n minLength: 1,\n maxLength: 80,\n noTrailingFullStop: true,\n },\n {\n name: \"intro\",\n label: \"Introduction\",\n noun: { article: \"an\", word: \"introduction\" },\n kind: \"multi-line\",\n required: true,\n minLength: 1,\n maxLength: 320,\n },\n ],\n copy: {\n currentTitle: \"On your site now\",\n editTitle: \"Edit and publish\",\n empty: \"Your site has no hero text yet. Whatever you publish below becomes its first version.\",\n },\n};\n\nfunction fieldError(field: TextFieldDefinition, text: string): string | null {\n const { article, word } = field.noun;\n if (text.length === 0) return field.required ? `Enter ${article} ${word}.` : null;\n const count = [...text].length;\n if (count < field.minLength) return `Make the ${word} at least ${String(field.minLength)} characters. It is ${String(count)} now.`;\n if (count > field.maxLength) return `Keep the ${word} to ${String(field.maxLength)} characters or fewer. It is ${String(count)} now.`;\n if (text.includes(\"\\u2014\")) return `The ${word} contains a long dash. Use a comma, a colon or a short dash instead.`;\n if (field.kind === \"single-line\" && /[\\r\\n]/.test(text)) return `The ${word} must be a single line.`;\n if (field.noTrailingFullStop === true && text.endsWith(\".\")) {\n return `${word.charAt(0).toUpperCase()}${word.slice(1)}s on your site do not end with a full stop. Remove the last full stop.`;\n }\n return null;\n}\n\nexport function validateTextDocument(\n definition: TextDocumentDefinition, raw: Readonly<Record<string, unknown>>,\n): TextValidation {\n const value: Record<string, string> = {};\n const errors: Record<string, string> = {};\n for (const field of definition.fields) {\n const submitted = Object.hasOwn(raw, field.name) ? raw[field.name] : undefined;\n const text = typeof submitted === \"string\" ? submitted.trim() : \"\";\n const error = fieldError(field, text);\n Object.defineProperty(error === null ? value : errors, field.name, { value: error ?? text, enumerable: true });\n }\n return Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true, value };\n}\n\n/** One rule set for strict authoring validation and resilient published reads. */\nfunction scanSiteHeroTaglines(raw: unknown):\n | { readonly ok: true; readonly value: readonly SiteHeroTagline[]; readonly dropped: readonly { index: number; error: string }[] }\n | { readonly ok: false; readonly error: string } {\n if (!Array.isArray(raw)) return { ok: false, error: \"Enter a list of taglines.\" };\n const heading = SITE_HERO.fields[0];\n if (!heading) throw new TypeError(\"Missing siteHero heading definition\");\n const field = { ...heading, name: \"text\", noun: { article: \"a\", word: \"tagline\" } as const,\n maxLength: SITE_HERO_TAGLINE_MAX_LENGTH };\n const value: SiteHeroTagline[] = [];\n const dropped: { index: number; error: string }[] = [];\n const keys = new Set<string>();\n for (const [index, item] of (raw as unknown[]).entries()) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) {\n dropped.push({ index, error: \"Enter a key and text for each tagline.\" });\n continue;\n }\n const record = item as Record<string, unknown>;\n const key = Object.hasOwn(record, \"key\") ? record.key : undefined;\n if (typeof key !== \"string\" || !/^[a-z][a-z0-9_-]{0,31}$/.test(key)) {\n dropped.push({ index, error: \"Use a lowercase key of 1 to 32 letters, numbers, short dashes or underscores, starting with a letter.\" });\n continue;\n }\n if (keys.has(key)) {\n dropped.push({ index, error: \"Use each tagline key only once.\" });\n continue;\n }\n const text = validateTextDocument({ ...SITE_HERO, fields: [field] }, record);\n if (!text.ok) {\n dropped.push({ index, error: text.errors.text ?? \"Invalid tagline.\" });\n continue;\n }\n const copy = text.value.text ?? \"\";\n if ((copy.match(/\\p{L}/gu)?.length ?? 0) >= 2 && !/\\p{Ll}/u.test(copy)) {\n dropped.push({ index, error: \"Use sentence case for the tagline, rather than all capitals.\" });\n continue;\n }\n keys.add(key);\n value.push({ key, text: copy });\n }\n return { ok: true, value, dropped };\n}\n\n/** Shared with the schema adapter; invalid authoring input is refused as a whole. */\nexport function validateSiteHeroTaglines(raw: unknown):\n | { readonly ok: true; readonly value: readonly SiteHeroTagline[] }\n | { readonly ok: false; readonly error: string } {\n const result = scanSiteHeroTaglines(raw);\n if (!result.ok) return result;\n const first = result.dropped[0];\n return first ? { ok: false, error: first.error } : { ok: true, value: result.value };\n}\n\nfunction isLayout(value: unknown): value is SiteHeroLayout {\n return SITE_HERO_LAYOUTS.some((layout) => value === layout);\n}\n\n/** Invalid published entries are dropped without discarding valid keyed siblings. */\nexport function parseSiteHero(raw: unknown, fallback: SiteHero): CmsResolution<ParsedSiteHero> {\n const local = validateTextDocument(SITE_HERO, fallback);\n const localTaglines = validateSiteHeroTaglines(fallback.taglines ?? []);\n if (!local.ok || !localTaglines.ok || (fallback.layout !== undefined && !isLayout(fallback.layout))) {\n throw new TypeError(\"Invalid siteHero fallback\");\n }\n const data: { heading: string; intro: string; layout: SiteHeroLayout; taglines: readonly SiteHeroTagline[] } = {\n heading: local.value.heading ?? \"\", intro: local.value.intro ?? \"\",\n layout: fallback.layout ?? \"columns\", taglines: localTaglines.value,\n };\n if (raw === null || typeof raw !== \"object\" || Array.isArray(raw)) return { data, fallbackFields: [\"$\"] };\n const record = raw as Readonly<Record<string, unknown>>;\n const text = validateTextDocument(SITE_HERO, record);\n const fallbackFields: string[] = text.ok ? [] : Object.keys(text.errors);\n for (const field of SITE_HERO.fields) {\n if (!fallbackFields.includes(field.name)) {\n const value = text.ok ? text.value[field.name] : record[field.name];\n if (typeof value === \"string\" && (field.name === \"heading\" || field.name === \"intro\")) data[field.name] = value.trim();\n }\n }\n const layout = Object.hasOwn(record, \"layout\") ? record.layout : undefined;\n const warnings: NonNullable<CmsResolution<ParsedSiteHero>[\"warnings\"]>[number][] = [];\n if (isLayout(layout)) data.layout = layout;\n else {\n data.layout = \"columns\";\n fallbackFields.push(\"layout\");\n warnings.push(SITE_HERO_LAYOUT_WARNING);\n }\n const taglines = scanSiteHeroTaglines(Object.hasOwn(record, \"taglines\") ? record.taglines : undefined);\n if (taglines.ok) {\n data.taglines = taglines.value;\n for (const { index } of taglines.dropped) fallbackFields.push(`taglines[${String(index)}]`);\n if (taglines.dropped.length > 0) warnings.push(SITE_HERO_TAGLINE_DROPPED_WARNING);\n } else {\n fallbackFields.push(\"taglines\");\n warnings.push(SITE_HERO_TAGLINES_DEFAULTED_WARNING);\n }\n const wholeFallback = [...SITE_HERO.fields.map((field) => field.name), \"layout\", \"taglines\"].every((field) => fallbackFields.includes(field));\n return { data, fallbackFields: wholeFallback ? [\"$\"] : fallbackFields,\n ...(warnings.length > 0 ? { warnings } : {}) };\n}\n\nexport function siteHeroQuery(): CmsQuery<SiteHero> {\n return defineCmsQuery<SiteHero>({\n name: \"siteHero.v1\", query: '*[_id == $id && _type == \"siteHero\"][0]{heading,intro,layout,taglines}',\n params: { id: \"siteHero\" }, dependencies: { types: [\"siteHero\"], ids: [\"siteHero\"] },\n resolve: parseSiteHero,\n });\n}\n"],
|
|
5
|
+
"mappings": "AACO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AAG,SAAU,UAAU,EAAE,MAAOA,GAAUiC,EAAe,SAASjC,CAAK,CAAC,EAC5I,MAAO,CAAE,KAAAgC,EAAM,eAAgBO,EAAgB,CAAC,GAAG,EAAIN,EACrD,GAAIC,EAAS,OAAS,EAAI,CAAE,SAAAA,CAAS,EAAI,CAAC,CAAG,CACjD,CAEO,SAASM,IAAoC,CAClD,OAAOC,EAAyB,CAC9B,KAAM,cAAe,MAAO,yEAC5B,OAAQ,CAAE,GAAI,UAAW,EAAG,aAAc,CAAE,MAAO,CAAC,UAAU,EAAG,IAAK,CAAC,UAAU,CAAE,EACnF,QAASb,EACX,CAAC,CACH",
|
|
6
|
+
"names": ["isDenseArray", "value", "index", "TYPE", "ID", "dependenciesCopy", "dependencies", "types", "type", "TYPE", "ids", "id", "ID", "defineCmsQuery", "query", "params", "copied", "key", "descriptor", "value", "SPLIT_LAYOUTS", "HEADING_LIST_LAYOUTS", "STAGGER_ROW_LAYOUTS", "SECTION_LAYOUT_DEFAULTS", "READER_SECTION_KINDS", "READER_GALLERY_PHOTO_MIN", "READER_GALLERY_PHOTO_LIMIT", "SECTION_WARNINGS", "object", "value", "words", "nullableText", "photo", "READER_PHOTO_SLUG", "href", "READER_ACTION_HREF", "copy", "optionalCopy", "action", "optionalAction", "anchor", "READER_JUMP_LINK", "one", "list", "name", "sectionImage", "homeBlock", "block", "isDenseArray", "image", "item", "READER_STORY_LAYOUTS", "layout", "section", "SPLIT_LAYOUTS", "HEADING_LIST_LAYOUTS", "STAGGER_ROW_LAYOUTS", "sections", "warnings", "warning", "SECTION_WARNINGS", "model", "anchors", "entry", "link", "composition", "hero", "proposed", "line", "validHomeFallback", "validPageFallback", "validSettingsFallback", "MALFORMED_CONTENT", "MalformedContentError", "documentId", "problems", "READER_PHOTO_SLUG", "READER_ACTION_HREF", "READER_JUMP_LINK", "READER_STORY_LAYOUTS", "READER_HOME_PAGE_ID", "READER_SITE_SETTINGS_ID", "Reading", "path", "message", "value", "isDenseArray", "raw", "text", "source", "copy", "p", "max", "entry", "index", "label", "href", "plain", "portableTextToMarkdown", "reading", "markdown", "richTextToMarkdown", "out", "previousWasList", "member", "at", "block", "spansToMarkdown", "listItem", "style", "line", "level", "isList", "DECORATORS", "links", "markDefs", "def", "d", "children", "child", "span", "marks", "mark", "fence", "campaignState", "campaign", "now", "c", "starts", "ends", "keyed", "parseHomePage", "document", "options", "doc", "id", "hero", "rawHero", "photos", "heading", "subline", "intro", "cta", "secondaryCta", "blocks", "blockJumps", "body", "state", "title", "images", "action", "anchors", "rawBlocks", "mapped", "mapBlock", "buttonsOf", "jumps", "where", "stories", "item", "jumpLinkOf", "jump", "tail", "items", "story", "sat", "sHeading", "sBody", "image", "layout", "onCard", "anchor", "sectionLayout", "layouts", "fallback", "warnings", "name", "SECTION_WARNINGS", "sectionImage", "asset", "ref", "alt", "caption", "hotspot", "spot", "x", "y", "sectionTypeForWarning", "mapSection", "SPLIT_LAYOUTS", "SECTION_LAYOUT_DEFAULTS", "HEADING_LIST_LAYOUTS", "rawItems", "iat", "question", "answer", "STAGGER_ROW_LAYOUTS", "READER_GALLERY_PHOTO_MIN", "READER_GALLERY_PHOTO_LIMIT", "photo", "shown", "field", "showEmail", "showPhone", "sectionButtons", "section", "parseSections", "sections", "parseContentPage", "slugObject", "slug", "lead", "parseSiteSettings", "description", "contact", "email", "phone", "social", "rawSocial", "link", "network", "url", "HOME_PAGE_DOCUMENT_QUERY", "CONTENT_PAGES_QUERY", "CONTENT_PAGE_BY_SLUG_QUERY", "createSiteContentReader", "client", "docs", "atomic", "parse", "validFallback", "homeContentQuery", "captured", "defineCmsQuery", "validHomeFallback", "contentPageQuery", "validPageFallback", "contentPagesQuery", "page", "siteSettingsQuery", "validSettingsFallback", "SITE_HERO_LAYOUTS", "SITE_HERO_TAGLINE_MAX_LENGTH", "SITE_HERO_LAYOUT_WARNING", "SITE_HERO_TAGLINE_DROPPED_WARNING", "SITE_HERO_TAGLINES_DEFAULTED_WARNING", "SITE_HERO", "fieldError", "field", "text", "article", "word", "count", "validateTextDocument", "definition", "raw", "value", "errors", "submitted", "error", "scanSiteHeroTaglines", "heading", "SITE_HERO_TAGLINE_MAX_LENGTH", "dropped", "keys", "index", "item", "record", "key", "copy", "validateSiteHeroTaglines", "result", "first", "isLayout", "SITE_HERO_LAYOUTS", "layout", "parseSiteHero", "fallback", "local", "localTaglines", "data", "fallbackFields", "warnings", "SITE_HERO_LAYOUT_WARNING", "taglines", "SITE_HERO_TAGLINE_DROPPED_WARNING", "SITE_HERO_TAGLINES_DEFAULTED_WARNING", "wholeFallback", "siteHeroQuery", "defineCmsQuery"]
|
|
7
7
|
}
|