@riverbankcms/sdk 0.169.1 → 0.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/_dts/{BlocksIslandsHydrator-DEhlJEwj.d.ts → BlocksIslandsHydrator-xuFmD41p.d.ts} +1 -1
  3. package/dist/_dts/{Page-BhCfStX1.d.ts → Page-4fzXy8H9.d.ts} +13 -11
  4. package/dist/_dts/{SdkPreviewMode-DSYdsdmJ.d.ts → SdkPreviewMode-BlHgMsc8.d.ts} +4 -3
  5. package/dist/_dts/{client-BZMn4Y99.d.ts → client-BPoU758C.d.ts} +32 -1
  6. package/dist/_dts/{content-types-EMK-E_r9.d.ts → content-types-TnkhoSls.d.ts} +3 -3
  7. package/dist/_dts/{contracts-DjYsGY3B.d.ts → contracts-7wrMA79U.d.ts} +5 -3
  8. package/dist/_dts/{footerPageOutline-BtYUi-m0.d.ts → footerPageOutline-DaOsPQ_Q.d.ts} +6 -6
  9. package/dist/_dts/{generatePageMetadata-D_fNTi5r.d.ts → generatePageMetadata-D9aDEzKK.d.ts} +2 -2
  10. package/dist/_dts/{index-NaRauKDR.d.ts → index-585vn6qb.d.ts} +72 -36
  11. package/dist/_dts/{index-BR0i0c3G.d.ts → index-CZKSUcDs.d.ts} +4 -4
  12. package/dist/_dts/{index-BV-qVnt7.d.ts → index-Cbw0IiY7.d.ts} +2 -2
  13. package/dist/_dts/{index-DgEwZ5WQ.d.ts → index-ChNbrcgD.d.ts} +1 -1
  14. package/dist/_dts/{index-QIbYMeI7.d.ts → index-DDKJfaLY.d.ts} +2 -2
  15. package/dist/_dts/{index-BzguBJzR.d.ts → index-DNCDENic.d.ts} +1 -1
  16. package/dist/_dts/{index-BYYhTQ_b.d.ts → index-W9R3Bnf2.d.ts} +3 -3
  17. package/dist/_dts/{loadContent-BmGH6NKl.d.ts → loadContent-DPyNAJym.d.ts} +7 -7
  18. package/dist/_dts/{request-DssgRQSm.d.ts → request-jXTRN1Y4.d.ts} +45927 -42247
  19. package/dist/_dts/{resolveBlockData-5BqNxwL8.d.ts → resolveBlockData-BbvE-gsZ.d.ts} +5 -5
  20. package/dist/_dts/{resolvePageContent-DIuwuFA7.d.ts → resolvePageContent-BBgih00D.d.ts} +2 -2
  21. package/dist/_dts/{runtime-BY8DQBbT.d.ts → runtime-BEoNgYbd.d.ts} +2 -2
  22. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  23. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  24. package/dist/_dts/sdk/src/client.d.ts +7 -7
  25. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  26. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  27. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  28. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
  29. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  30. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  31. package/dist/_dts/sdk/src/index.d.ts +8 -8
  32. package/dist/_dts/sdk/src/manifest/index.d.ts +7 -7
  33. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  34. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  35. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  36. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  37. package/dist/_dts/sdk/src/page-converter/index.d.ts +4 -4
  38. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  39. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  40. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  41. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  42. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  43. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  44. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
  45. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
  46. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
  47. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  48. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  49. package/dist/_dts/sdk/src/rendering/server.d.ts +3 -2
  50. package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
  51. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  52. package/dist/_dts/sdk/src/server.d.ts +5 -5
  53. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  54. package/dist/_dts/sdk/src/theme/index.d.ts +4740 -3
  55. package/dist/_dts/{types-cObpvZGF.d.ts → types-BXuVxDYo.d.ts} +2 -2
  56. package/dist/_dts/{types-DrAWDtqR.d.ts → types-DEAKoDNi.d.ts} +3 -3
  57. package/dist/_dts/{types-Z388-GR1.d.ts → types-kWvBwYK6.d.ts} +7 -7
  58. package/dist/_dts/{validation-hLr8zVrc.d.ts → validation-BAO0_ntM.d.ts} +17 -17
  59. package/dist/client/{BlocksIslandsHydrator-CN2GyuuA.mjs → BlocksIslandsHydrator-DfMsMIej.mjs} +17 -17
  60. package/dist/client/{BookingMailingListNote-Br1VyHkP.mjs → BookingMailingListNote-aaSicywS.mjs} +7 -7
  61. package/dist/client/{StepIndicator-BK0GEDoP.mjs → BookingPanelArrangement-OgftZ9QC.mjs} +16 -4
  62. package/dist/client/{BookingQuestionFields-LLGCWjvU.mjs → BookingQuestionFields-BlaCItmH.mjs} +5 -5
  63. package/dist/client/{CalendarNavigationChevron-DSnSBNeq.mjs → CalendarNavigationChevron-iMWrY6Hz.mjs} +7 -7
  64. package/dist/client/{CheckboxChoice-W_uiRgDK.mjs → CheckboxChoice-B65wFjqx.mjs} +1 -1
  65. package/dist/client/{DemoBookingPortalAccess-Cilv5zdS.mjs → DemoBookingPortalAccess-BCumOTLY.mjs} +7 -7
  66. package/dist/client/{EventCalendar.client-ucgdMS35.mjs → EventCalendar.client-kh7mkYnW.mjs} +9 -9
  67. package/dist/client/{EventCombined.client-BEdfJGpx.mjs → EventCombined.client-DXD5i0Ar.mjs} +8 -8
  68. package/dist/client/{EventEmbeddedCheckoutStep-Cf-HRHtb.mjs → EventEmbeddedCheckoutStep-DKKRCuta.mjs} +1 -1
  69. package/dist/client/{EventItem-OpLehMpT.mjs → EventItem-BnwcoFQN.mjs} +13 -9
  70. package/dist/client/{EventListWeekNavigation-DTsVU6gc.mjs → EventListWeekNavigation-DuG6z02f.mjs} +2 -1
  71. package/dist/client/{EventListing.client-8MFGI9BA.mjs → EventListing.client-18yfHrcr.mjs} +3 -3
  72. package/dist/client/{EventListing.view-BCvRqU86.mjs → EventListing.view-BM7rTVSL.mjs} +42 -397
  73. package/dist/client/{EventRegistrationPayment-CqH3hE-k.mjs → EventRegistrationPayment-D5J3DR0x.mjs} +13 -13
  74. package/dist/client/{LocationMapActions-BFp2uQQQ.mjs → LocationMapActions-QahdLtdE.mjs} +2 -2
  75. package/dist/client/{MapDrawingSvg-DDWfmgpA.mjs → MapDrawingSvg-Dy6UMuIw.mjs} +1 -1
  76. package/dist/client/Page-DH2sm4Cf.mjs +30247 -0
  77. package/dist/client/{ProtectedSubmitButton-C3H26pN9.mjs → ProtectedSubmitButton-AOUzjDK9.mjs} +1 -1
  78. package/dist/client/StepIndicator-CsRlU46Y.mjs +894 -0
  79. package/dist/client/{TabBarFragment-DkVKtK5a.mjs → TabBarFragment-CsAufYwT.mjs} +1 -1
  80. package/dist/client/{ThemedButton-BdnEwA38.mjs → ThemedButton-BMDHwnM6.mjs} +1 -1
  81. package/dist/client/{accessibleSurfaces-_7jkuinl.mjs → accessibleSurfaces-Bbn1-jJ8.mjs} +52 -2
  82. package/dist/client/{accordion-DMItWylU.mjs → accordion-DT4MD3Np.mjs} +1 -1
  83. package/dist/client/{booking-form.client-wd71DG19.mjs → booking-form.client-DdqNQNCa.mjs} +79 -42
  84. package/dist/client/{bookingForm-Cyr2qeS1.mjs → bookingForm-CLN396HU.mjs} +4 -4
  85. package/dist/client/bookings.mjs +6 -6
  86. package/dist/client/boxStyleClassNames-iLF_3KX9.mjs +369 -0
  87. package/dist/client/{carousel-B5-Hzzif.mjs → carousel-DFLomCGm.mjs} +2 -2
  88. package/dist/client/{carousel.client-eSSr1oYA.mjs → carousel.client-YF4mUK5t.mjs} +1 -1
  89. package/dist/client/{cart-B-M5l__W.mjs → cart-BozMM5NK.mjs} +3 -3
  90. package/dist/client/{cart.client-COAP4CEy.mjs → cart.client-CqOOxPbW.mjs} +1 -1
  91. package/dist/client/{checkout-ZHc8GfaG.mjs → checkout-CTWF5nbB.mjs} +3 -3
  92. package/dist/client/{checkout.client-DRralR3e.mjs → checkout.client-CpqxN8e0.mjs} +1 -1
  93. package/dist/client/{checkoutUrls-CY8qywXl.mjs → checkoutUrls-Ccg6yfjq.mjs} +1 -1
  94. package/dist/client/client.mjs +640 -226
  95. package/dist/client/{context-Xhf81Q-c.mjs → context-Dzjv2CpA.mjs} +10 -1
  96. package/dist/client/{creditProducts-CMOmhWm2.mjs → creditProducts-BTRX4edc.mjs} +54 -23
  97. package/dist/client/{cta-CfuyGqXL.mjs → cta-pzQkBLgS.mjs} +2 -2
  98. package/dist/client/{dateFormatting-Bv6kjUW3.mjs → dateFormatting-BfurxGwg.mjs} +1 -1
  99. package/dist/client/{demoPortalMagicLink-DQtwf_s2.mjs → demoPortalMagicLink-D0dcPsRE.mjs} +1 -1
  100. package/dist/client/{display-DDNmyb0z.mjs → display-Cl6mgSJa.mjs} +3186 -81
  101. package/dist/client/{enhanceHeaderSection-D7gRy-pL.mjs → enhanceHeaderSection-CJCl0HJC.mjs} +4 -4
  102. package/dist/client/{event-details.client-DZZaoCUc.mjs → event-details.client-Pn9Kxh3I.mjs} +3 -2
  103. package/dist/client/{event-registration.client-CLBdHUfd.mjs → event-registration.client-BAmBdWXE.mjs} +48 -34
  104. package/dist/client/{eventCalendar-BY3AfYkK.mjs → eventCalendar-C5Bh2L8L.mjs} +4 -4
  105. package/dist/client/{eventCombined-86P2vQCb.mjs → eventCombined-dELKxxIe.mjs} +4 -4
  106. package/dist/client/{eventDetails-DIJYMzVg.mjs → eventDetails-Do9D_fJ_.mjs} +2 -2
  107. package/dist/client/{eventListing-8jS0qGGC.mjs → eventListing-B2HTUWLq.mjs} +4 -4
  108. package/dist/client/{eventRegistration-DyseP_sY.mjs → eventRegistration-ByOJnqGc.mjs} +4 -4
  109. package/dist/client/form-DX70QG-J.mjs +27 -0
  110. package/dist/client/{form.client-D3_RF29v.mjs → form.client-CJoqBrS6.mjs} +5 -5
  111. package/dist/client/{form.parts-DWLf_3PF.mjs → form.parts-DTof9pL3.mjs} +3 -3
  112. package/dist/client/formSnapshot-Cy4abc0T.mjs +73 -0
  113. package/dist/client/{formatDate-BGlhrmhF.mjs → formatDate-Cjouxh4Y.mjs} +1 -1
  114. package/dist/client/gifting/client.mjs +3 -3
  115. package/dist/client/{headerSection-CyNGt23J.mjs → headerSection-CJuPX_1K.mjs} +2 -2
  116. package/dist/client/{newsletter-form.client-IfLup4o0.mjs → newsletter-form.client-CqzNjOft.mjs} +6 -6
  117. package/dist/client/{newsletter-form.parts-DDD-LRyW.mjs → newsletter-form.parts-DjJsFms2.mjs} +2 -2
  118. package/dist/client/{newsletterForm-o5wFBVHv.mjs → newsletterForm-D1MHoPbh.mjs} +5 -26
  119. package/dist/client/{noop-B_f7RqLD.mjs → noop-poI1m2yW.mjs} +69 -2
  120. package/dist/client/portal/client.mjs +294 -48
  121. package/dist/client/{product-detail.client-5hNA8aKU.mjs → product-detail.client-DOQ7El1d.mjs} +1 -1
  122. package/dist/client/{product-list.client-c-777ohj.mjs → product-list.client-CmxOZbzL.mjs} +1 -1
  123. package/dist/client/{productDetail-hXttfQhE.mjs → productDetail-BN3zv5sa.mjs} +3 -3
  124. package/dist/client/{productList-BPsYP_jA.mjs → productList-GN_Id4bF.mjs} +3 -3
  125. package/dist/client/{propsDecoder-Dc8j5i79.mjs → propsDecoder-BdmzM3D5.mjs} +8 -4
  126. package/dist/client/{registry.server-CMrdUGGv.mjs → registry.server-BOyra8CA.mjs} +1032 -925
  127. package/dist/client/rendering/client.mjs +57 -32
  128. package/dist/client/rendering/islandDelivery.flight.mjs +43 -10
  129. package/dist/client/rendering/islands.mjs +1 -1
  130. package/dist/client/rendering.mjs +1956 -191
  131. package/dist/client/{richText-coerce-BTurYEao.mjs → richText-coerce-CtoGLZ_e.mjs} +1 -1
  132. package/dist/client/{routeIslandApiConfig-DFjRKvzM.mjs → routeIslandApiConfig-DnaJ8PQc.mjs} +1 -1
  133. package/dist/client/{runtimeResponse-D2LT--Gj.mjs → runtimeResponse-B1-cyLXt.mjs} +1 -1
  134. package/dist/client/{runtimeResponse-BGU8sMZY.mjs → runtimeResponse-BN8PoIVp.mjs} +1 -1
  135. package/dist/client/{shop-Ds47onRS.mjs → shop-LjBLDBqF.mjs} +3 -3
  136. package/dist/client/{shop-commerce-B3PyRHaN.mjs → shop-commerce-B8aZTdRJ.mjs} +13 -13
  137. package/dist/client/{shop-commerce-store-D9CHihQv.mjs → shop-commerce-store-C1FtHYl7.mjs} +1 -1
  138. package/dist/client/{shop.client-RljK0qPB.mjs → shop.client-D0qZ3KZp.mjs} +13 -13
  139. package/dist/client/{shop.interactive-BH0xDlMF.mjs → shop.interactive-DAKyWK1B.mjs} +89 -19
  140. package/dist/client/{shopShared-BEfD0e4m.mjs → shopShared-CztcSe9i.mjs} +2 -2
  141. package/dist/client/spam-protection.mjs +1 -1
  142. package/dist/client/{timetableModel-BG7Ejxdr.mjs → timetableModel-D1jDTbms.mjs} +11 -11
  143. package/dist/client/{types-5fOsPIpL.mjs → types-B0hJldSt.mjs} +2 -0
  144. package/dist/client/{useAvailableSlots-GP8tnAVW.mjs → useAvailableSlots-ByHedoBi.mjs} +4 -8
  145. package/dist/client/{useDiscountApply-Cq07nTyG.mjs → useDiscountApply-CHGYDxdM.mjs} +2 -2
  146. package/dist/client/{useDiscountCodeUi-CD82QX5i.mjs → useDiscountCodeUi-Dew9UAEy.mjs} +1 -1
  147. package/dist/client/{useEventPagination-spj7sGQP.mjs → useEventPagination-BpC7-ksE.mjs} +7 -7
  148. package/dist/client/{view-oToSpu1N.mjs → view-BxeiAL3c.mjs} +121 -28
  149. package/dist/client/{view-aAP2WbCR.mjs → view-ShYH3WXh.mjs} +3 -3
  150. package/dist/preview-next/before-render.mjs +33 -13
  151. package/dist/preview-next/chrome.css +4 -0
  152. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-8-qtHjpb.mjs → EventEmbeddedCheckoutStep-CKe4cjZ4.mjs} +1 -1
  153. package/dist/preview-next/client/{LocationPickerEnvironment-CwxRbAs2.mjs → LocationPickerEnvironment-lW2aLGWd.mjs} +1 -1
  154. package/dist/preview-next/client/{MapLibreEditMap-CKjYUp_E.mjs → MapLibreEditMap-C9InQJpd.mjs} +2 -2
  155. package/dist/preview-next/client/{ArrangementLookControls-CoWdilcI.mjs → PageSectionToolbar-DsSqwrMS.mjs} +397 -23
  156. package/dist/preview-next/client/{PreviewEditorSidebar-BNCrO6PQ.mjs → PreviewEditorSidebar-BEEWzXnU.mjs} +3266 -3215
  157. package/dist/preview-next/client/{PreviewEditorUI-inVZkLCd.mjs → PreviewEditorUI-C86Out4V.mjs} +6 -39
  158. package/dist/preview-next/client/{PreviewShell-CFQlAHTe.mjs → PreviewShell-CBWYjBvQ.mjs} +50 -41
  159. package/dist/preview-next/client/{SdkPreviewModeRuntime-Dgl7ktO4.mjs → SdkPreviewModeRuntime-o-mVqWLx.mjs} +88 -394
  160. package/dist/preview-next/client/{SiteChromeCustomizeButton-DgDYHwkG.mjs → SiteChromeCustomizeButton-H_ciMNHA.mjs} +1249 -22697
  161. package/dist/preview-next/client/{ThemedButton-BQU45t-E.mjs → ThemedButton-CKYjeU_M.mjs} +2 -0
  162. package/dist/preview-next/client/{lucide-react-DbC1o6_9.mjs → lucide-react-DygTyy7K.mjs} +1 -1
  163. package/dist/preview-next/client/{previewAssistantSlot-DRDu7Ndv.mjs → previewAssistantSlot-CuOcsG_N.mjs} +3481 -2113
  164. package/dist/preview-next/client/{previewChromeSurface-K6Q5uEMC.mjs → previewChromeRoot-DPeV7KaP.mjs} +52 -14
  165. package/dist/preview-next/client/runtime.mjs +3 -3
  166. package/dist/preview-next/client/{sdk-runtime-AGypzhcO.mjs → sdk-runtime-zTTFZ4MM.mjs} +2 -2
  167. package/dist/preview-next/client/{useAutosaveStatus-B2mn_l6c.mjs → useAutosaveStatus-DNA1Q4L1.mjs} +2 -2
  168. package/dist/preview-next/client/{useBlockCustomizeControls-CBXHo6ph.mjs → useOpenBlockForSetup-BdnMlHC6.mjs} +40 -21
  169. package/dist/preview-next/container-responsive.css +3093 -0
  170. package/dist/preview-next/editor-base.css +90 -178
  171. package/dist/preview-next/editor-chrome.css +25 -8
  172. package/dist/preview-next/keepAlive.mjs +1 -1
  173. package/dist/preview-next/middleware.mjs +1 -1
  174. package/dist/preview-next/{route-contract-jc2Bug-h.mjs → route-contract-CtSgU8UZ.mjs} +547 -196
  175. package/dist/server/{Block.shared-BHgQjX16.mjs → Block.shared-ifgaBglp.mjs} +4 -4
  176. package/dist/server/ThemeScopeCore-DGDOH6OU.mjs +1983 -0
  177. package/dist/server/{accessibleSurfaces-D0q5tLSW.mjs → accessibleSurfaces-BuPNCWAK.mjs} +52 -2
  178. package/dist/server/bindings-CiYpie1M.mjs +1802 -0
  179. package/dist/server/{block-kinds-CdI7NvAW.mjs → block-kinds-DkzOr19P.mjs} +2 -0
  180. package/dist/server/{client-C-asG6Cf.mjs → client-ngWuFsmN.mjs} +638 -224
  181. package/dist/server/config-template-validation.mjs +30 -4
  182. package/dist/server/config-validation.mjs +1 -1
  183. package/dist/server/config.mjs +3 -34
  184. package/dist/server/data/resolveBlockData.mjs +1 -1
  185. package/dist/server/index.mjs +3 -3
  186. package/dist/server/loadContent-DeLQeJAZ.mjs +2310 -0
  187. package/dist/server/{loadPage-XgtQR90Z.mjs → loadPage-D4J747FQ.mjs} +2 -2
  188. package/dist/server/manifest.mjs +1 -1
  189. package/dist/server/next.mjs +8 -6
  190. package/dist/server/{opaqueSurface-Yltv_u7r.mjs → opaqueSurface-ukEz1BaM.mjs} +2 -2
  191. package/dist/server/{overrideResolution-Z5pwH-kz.mjs → overrideResolution-DSuVkpqm.mjs} +3 -2
  192. package/dist/server/page-converter.mjs +3 -3
  193. package/dist/server/pageRegions-BaeEF2MU.mjs +30 -0
  194. package/dist/server/{pageRenderPlan-DQAo35og.mjs → pageRenderPlan-DFv3h4Ib.mjs} +309 -289
  195. package/dist/server/{pageRuntimeSupport-g-K-FCHa.mjs → pageRuntimeSupport-yHaRNWMj.mjs} +48 -35
  196. package/dist/server/{pageShared-7mPhqqXX.mjs → pageShared-CAZD0LcY.mjs} +875 -328
  197. package/dist/server/parseThemeForPersistence-Dl7LIBJq.mjs +52 -0
  198. package/dist/server/{prebuild-C0m4KOT9.mjs → prebuild-BKOCND3b.mjs} +1 -1
  199. package/dist/server/prebuild.mjs +1 -1
  200. package/dist/server/{prefetchBlockData-DcLKHfHG.mjs → prefetchBlockData-GIoExi8A.mjs} +4 -3
  201. package/dist/server/{registry-7_0_lUrh.mjs → registry-BogXzcOD.mjs} +4015 -2009
  202. package/dist/server/rendering/components/pageShared.mjs +1 -1
  203. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  204. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  205. package/dist/server/rendering/server.mjs +3 -3
  206. package/dist/server/rendering.mjs +7 -7
  207. package/dist/server/{resolveBlockData-q3WnpvyZ.mjs → resolveBlockData-CT4YSBve.mjs} +4 -3
  208. package/dist/server/{resolveButtonColourStates-Cn6j8Ee0.mjs → resolveButtonColourStates-DVISOQD9.mjs} +2 -0
  209. package/dist/server/rich-text-CRcONdyM.mjs +33 -0
  210. package/dist/server/{richTextSchema-DQ2NBP0n.mjs → richTextSchema-QLaQrbII.mjs} +31 -2
  211. package/dist/server/{parseThemeForPersistence-BebSeE17.mjs → schema-C92Q8y0-.mjs} +463 -53
  212. package/dist/server/server.mjs +3 -3
  213. package/dist/server/theme-bridge.mjs +2 -2
  214. package/dist/server/theme.mjs +2 -1
  215. package/dist/server/{three-pass-converter-CQWdnfjV.mjs → three-pass-converter-Bsfdy_ZV.mjs} +11 -8
  216. package/dist/server/{validation-CSMS6XmP.mjs → validation-vSBCWU3w.mjs} +9 -9
  217. package/dist/server/{version-DWeqmTXc.mjs → version-Cw5vFmUY.mjs} +1 -1
  218. package/dist/styles/index.css +521 -59
  219. package/package.json +1 -1
  220. package/dist/client/Page-Bu5TJU3L.mjs +0 -52239
  221. package/dist/client/StepIndicator-CR7_0yu4.mjs +0 -432
  222. package/dist/client/form-RTqunrpz.mjs +0 -85
  223. package/dist/preview-next/client/useOpenBlockForSetup-BpZnBznt.mjs +0 -28
  224. package/dist/server/ThemeScopeCore-Ck0dhZA6.mjs +0 -24236
  225. package/dist/server/bindings-CAbTvrCZ.mjs +0 -257
  226. package/dist/server/headerVariant-8O5MvxIU.mjs +0 -464
  227. package/dist/server/loadContent-DKerbSnI.mjs +0 -578
@@ -0,0 +1,2310 @@
1
+ import { $r as parseBackgroundContent, Ao as resolveRepeaterGridColumnFieldId, Ca as surfaceResolutionContextFromTheme, Ds as unsafeAsEventCategoryId, Es as unsafeAsContentEntryId, Fi as plainTextToInlineText, Hn as siteFooterManifest, Li as parseFieldDefinition, Mi as inlineTextToPlainText, Mo as resolveRepeaterGridSpanFieldId, Na as parsePageDesignIntent, Or as blockDesignCapabilityMapFromDefinitions, Pi as parseInlineTextFromUnknown, Qi as parseListLook, Qn as resolveDateRuntimeContext, Un as siteHeaderManifest, Wi as isRecord, _a as componentRuntimeRulesForSiteStyle, ao as appearancePresets, ba as requireCuratedSiteStyle, i as systemBlockDefinitions, jo as resolveRepeaterGridRowFieldId, pa as buildInitialPolicyPageDesignIntent, t as getBlockDefinition, va as designRuntimeRulesForSiteStyle, zo as EVENT_PRESET_VALUES } from "./registry-BogXzcOD.mjs";
2
+ import { P as asLayoutVariantKey, j as asDesignBlockId, k as asAppearancePresetId } from "./schema-C92Q8y0-.mjs";
3
+ import { C as normalizeRepeaterGridSpan, S as flowRepeaterGridItems, a as invalidRenderableBlock$1, d as siteLocationRenderContext, h as registeredManifestContentContract, i as collectMediaAssetSidecar, j as readPublishedBlockPlacement, l as resolveSdkBlockManifest, m as compileManifestContentContract, n as buildRenderablePageOutline, o as projectRenderablePageOutline, p as admitTransportedRenderableManifestContent, r as buildSiteRenderSupport, s as readInvalidBlockAdmission, u as sanitizeSdkRuntimeBlockContent, v as deriveFieldValidationPlan, w as resolveRepeaterGridAcceptedSpans, y as fieldPlanToZod } from "./pageRuntimeSupport-yHaRNWMj.mjs";
4
+ import { t as isCanonicalRichTextDoc } from "./rich-text-CRcONdyM.mjs";
5
+ import { i as createRichTextDoc, o as isRecord$1, r as buildRichTextSchema } from "./richTextSchema-QLaQrbII.mjs";
6
+ import { a as applyCompiledRuntimeFieldsToContent, i as buildPageDesignEditorReadModel, n as resolveRuntimeJoinFacts, o as compileEditorModelRuntime, r as blockDesignInputsForDefinition, t as applyBindingsToContent } from "./bindings-CiYpie1M.mjs";
7
+ import { r as normalizeDataLoaderSearchParams } from "./dataLoaderContext-B3fXA54R.mjs";
8
+ import { n as DEFAULT_RESOLVE_BLOCK_DATA_DEPS, o as resolveBlockDataWithDeps, r as createBlockDataLoadPolicy } from "./resolveBlockData-CT4YSBve.mjs";
9
+ import { z } from "zod";
10
+ //#region ../theme-core/src/site-styles/contentTemplateDesignIntent.ts
11
+ function asContentTemplateDesignBlockId(value) {
12
+ return asDesignBlockId(value);
13
+ }
14
+ function parseContentTemplateDesignIntent(value) {
15
+ return parsePageDesignIntent(value, {
16
+ unsupportedSchemaVersionMessage: "Unsupported Theme V2 content template design intent schemaVersion.",
17
+ invalidShapeMessage: "Invalid Theme V2 content template design intent shape."
18
+ });
19
+ }
20
+ function contentTemplateDesignIntentToJsonRecord(intent) {
21
+ return {
22
+ schemaVersion: intent.schemaVersion,
23
+ siteStyleId: intent.siteStyleId,
24
+ pageFlowPresetId: intent.pageFlowPresetId,
25
+ blockLookPins: intent.blockLookPins.map((pin) => ({
26
+ blockId: pin.blockId,
27
+ blockKind: pin.blockKind,
28
+ choice: {
29
+ kind: pin.choice.kind,
30
+ value: pin.choice.value
31
+ }
32
+ })),
33
+ boundaryPins: intent.boundaryPins.map((pin) => ({
34
+ boundaryId: pin.boundaryId,
35
+ previousBlockId: pin.previousBlockId,
36
+ nextBlockId: pin.nextBlockId,
37
+ choice: {
38
+ kind: pin.choice.kind,
39
+ value: pin.choice.value
40
+ }
41
+ }))
42
+ };
43
+ }
44
+ //#endregion
45
+ //#region ../theme-core/src/site-styles/contentTemplateRuntimeCompiler.ts
46
+ function compileContentTemplateRuntimeFields(input) {
47
+ const orderedBlocks = [...input.blocks].sort((a, b) => a.orderIndex - b.orderIndex);
48
+ const editorModel = buildPageDesignEditorReadModel({
49
+ joinResolution: {
50
+ surfaceResolutionContext: input.surfaceResolutionContext,
51
+ resolveFacts: input.resolveJoinFacts,
52
+ contentForBlock: (id) => {
53
+ const block = orderedBlocks.find((block) => block.blockId === id);
54
+ if (!block) throw new Error(`Missing materialized template content for ${id}`);
55
+ return block.content;
56
+ }
57
+ },
58
+ siteStyleId: input.intent.siteStyleId,
59
+ siteStyle: input.siteStyle,
60
+ intent: input.intent,
61
+ blocks: orderedBlocks
62
+ });
63
+ const compiled = compileEditorModelRuntime({
64
+ editorModel,
65
+ surfaceResolutionContext: input.surfaceResolutionContext,
66
+ designRules: designRuntimeRulesForSiteStyle(requireCuratedSiteStyle(input.intent.siteStyleId)),
67
+ componentRules: componentRuntimeRulesForSiteStyle(requireCuratedSiteStyle(input.intent.siteStyleId))
68
+ });
69
+ const blocks = compiled.blocks.map((block) => ({
70
+ blockId: block.blockId,
71
+ fields: block.fields
72
+ }));
73
+ return {
74
+ blocks,
75
+ joins: compiled.joins,
76
+ fieldsByBlockId: new Map(blocks.map((block) => [block.blockId, block.fields])),
77
+ issues: editorModel.issues
78
+ };
79
+ }
80
+ const PAGE_SECTIONS_ANCHOR_BLOCK_KIND = "system.page-sections";
81
+ function isSystemTemplateBlockKind(value) {
82
+ return value === "system.entry-slot" || value === "system.page-sections";
83
+ }
84
+ //#endregion
85
+ //#region ../content-model/src/entry-slots/types.ts
86
+ function ok(value) {
87
+ return {
88
+ ok: true,
89
+ value
90
+ };
91
+ }
92
+ function err(error) {
93
+ return {
94
+ ok: false,
95
+ error
96
+ };
97
+ }
98
+ const SLOT_KEY_PATTERN = /^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/;
99
+ function unsafeAsSlotKey(value) {
100
+ return value;
101
+ }
102
+ function parseSlotKey(value) {
103
+ if (typeof value !== "string") return err({ kind: "not-string" });
104
+ const normalized = value.trim();
105
+ if (!normalized) return err({ kind: "empty" });
106
+ if (!SLOT_KEY_PATTERN.test(normalized)) return err({
107
+ kind: "invalid-format",
108
+ value: normalized
109
+ });
110
+ return ok(unsafeAsSlotKey(normalized));
111
+ }
112
+ function selectBlocksForDeclaredEntrySlot(input) {
113
+ return input.entrySlots.find((slot) => slot.slotKey === input.declaredSlotKey)?.blocks ?? [];
114
+ }
115
+ //#endregion
116
+ //#region ../content-model/src/page-sections/types.ts
117
+ /**
118
+ * Page sections (#1703): owner-defined, structured sections on a subject's
119
+ * pages. A definition says what a section is (its heading, what goes in it)
120
+ * and where it applies. The values live in each page's own content.
121
+ */
122
+ const BODY_SECTION_KINDS = [
123
+ "list",
124
+ "headedLists",
125
+ "questions",
126
+ "cards",
127
+ "text",
128
+ "textWithPhoto"
129
+ ];
130
+ function unsafeAsPageSectionId(value) {
131
+ return value;
132
+ }
133
+ const uuidSchema = z.string().trim().toLowerCase().uuid();
134
+ const pageSectionIdSchema = uuidSchema.transform(unsafeAsPageSectionId);
135
+ const FACT_OPTION_MAX = 30;
136
+ const factTextSchema = z.string().trim().max(120).refine((value) => !/[\r\n\u2028\u2029]/u.test(value), { message: "Use a single line" });
137
+ const sectionLabelSchema = z.string().trim().min(1).max(120);
138
+ const sectionHintSchema = z.string().trim().max(500).nullable().transform((hint) => hint === null || hint === "" ? null : hint);
139
+ const bodySectionKindSchema = z.enum(BODY_SECTION_KINDS);
140
+ const factSectionShapeSchema = z.discriminatedUnion("kind", [z.object({
141
+ placement: z.literal("facts"),
142
+ kind: z.literal("choice"),
143
+ options: z.array(factTextSchema.pipe(z.string().min(1))).min(1).max(FACT_OPTION_MAX).refine((options) => new Set(options).size === options.length, { message: "Name each option once" })
144
+ }).strict(), z.object({
145
+ placement: z.literal("facts"),
146
+ kind: z.literal("shortText")
147
+ }).strict()]);
148
+ const sectionShapeSchema = z.union([z.object({
149
+ placement: z.literal("body"),
150
+ kind: bodySectionKindSchema
151
+ }).strict(), factSectionShapeSchema]);
152
+ /** The distinct values, in first-seen order, or null when there are none. */
153
+ function toNonEmptyUnique(values) {
154
+ const [first, ...rest] = [...new Set(values)];
155
+ return first === void 0 ? null : [first, ...rest];
156
+ }
157
+ function nonEmptyUnique(item) {
158
+ return z.array(item).transform((values, ctx) => {
159
+ const unique = toNonEmptyUnique(values);
160
+ if (unique) return unique;
161
+ ctx.addIssue({
162
+ code: "custom",
163
+ message: "Name at least one, or use \"all\""
164
+ });
165
+ return z.NEVER;
166
+ });
167
+ }
168
+ const eventCategoryIdSchema = uuidSchema.transform(unsafeAsEventCategoryId);
169
+ const applicabilitySchema = z.discriminatedUnion("subject", [z.object({ subject: z.literal("service") }).strict(), z.object({
170
+ subject: z.literal("event"),
171
+ presets: z.union([z.literal("all"), nonEmptyUnique(z.enum(EVENT_PRESET_VALUES))]),
172
+ categories: z.union([z.literal("all"), nonEmptyUnique(eventCategoryIdSchema)])
173
+ }).strict()]);
174
+ function isActiveSection(definition) {
175
+ return definition.state.kind === "active";
176
+ }
177
+ z.object({
178
+ id: pageSectionIdSchema,
179
+ label: sectionLabelSchema,
180
+ hint: sectionHintSchema,
181
+ shape: sectionShapeSchema,
182
+ applicability: applicabilitySchema,
183
+ position: z.number().int().nonnegative(),
184
+ state: z.discriminatedUnion("kind", [z.object({ kind: z.literal("active") }).strict(), z.object({
185
+ kind: z.literal("archived"),
186
+ archivedAt: z.string()
187
+ }).strict()])
188
+ }).strict();
189
+ //#endregion
190
+ //#region ../content-model/src/page-sections/values.ts
191
+ /**
192
+ * The most a section of each list-like kind can hold: how many items, and how
193
+ * long each piece of text can be. They're the one source for these limits.
194
+ * The stored-value schema enforces them when a value is saved, and the Content
195
+ * tab's fields take them as `maxLength` and `maxItems`.
196
+ *
197
+ * A headed list's `maxPoints` counts the points in all its groups together,
198
+ * the same limit as a List's, so turning Headed lists into a List always
199
+ * gives a List that can be saved, with every point kept.
200
+ */
201
+ const SECTION_VALUE_LIMITS = {
202
+ list: {
203
+ maxPoints: 100,
204
+ maxPointLength: 500
205
+ },
206
+ headedLists: {
207
+ maxGroups: 100,
208
+ maxPoints: 100,
209
+ maxHeadingLength: 500,
210
+ maxPointLength: 500
211
+ },
212
+ questions: {
213
+ maxQuestions: 30,
214
+ maxQuestionLength: 160,
215
+ maxAnswerLength: 5e3
216
+ },
217
+ cards: {
218
+ maxCards: 8,
219
+ maxTitleLength: 120,
220
+ maxTextLength: 5e3
221
+ }
222
+ };
223
+ const tooMany = (items, count, limit) => count > limit ? {
224
+ kind: "tooMany",
225
+ items,
226
+ count,
227
+ limit
228
+ } : null;
229
+ const tooLong = (text, values, limit) => values.some((value) => value.length > limit) ? {
230
+ kind: "tooLong",
231
+ text,
232
+ limit
233
+ } : null;
234
+ /** The first breach in the order given, or null. */
235
+ const firstBreach = (...breaches) => breaches.find((breach) => breach !== null) ?? null;
236
+ /**
237
+ * The first limit a value goes over, or null when it's within all of them.
238
+ * Counts come before lengths, so the message names the bigger problem first.
239
+ */
240
+ function findSectionLimitBreach(value) {
241
+ switch (value.kind) {
242
+ case "list": {
243
+ const limits = SECTION_VALUE_LIMITS.list;
244
+ return firstBreach(tooMany("points", value.items.length, limits.maxPoints), tooLong("point", value.items, limits.maxPointLength));
245
+ }
246
+ case "headedLists": {
247
+ const limits = SECTION_VALUE_LIMITS.headedLists;
248
+ const points = value.groups.flatMap((group) => group.items);
249
+ return firstBreach(tooMany("groups", value.groups.length, limits.maxGroups), tooMany("points", points.length, limits.maxPoints), tooLong("heading", value.groups.map((group) => group.heading), limits.maxHeadingLength), tooLong("point", points, limits.maxPointLength));
250
+ }
251
+ case "questions": {
252
+ const limits = SECTION_VALUE_LIMITS.questions;
253
+ return firstBreach(tooMany("questions", value.items.length, limits.maxQuestions), tooLong("question", value.items.map((item) => item.question), limits.maxQuestionLength), tooLong("answer", value.items.map((item) => item.answer), limits.maxAnswerLength));
254
+ }
255
+ case "cards": {
256
+ const limits = SECTION_VALUE_LIMITS.cards;
257
+ return firstBreach(tooMany("cards", value.cards.length, limits.maxCards), tooLong("cardTitle", value.cards.map((card) => card.title), limits.maxTitleLength), tooLong("cardText", value.cards.map((card) => card.text), limits.maxTextLength));
258
+ }
259
+ case "choice":
260
+ case "shortText":
261
+ case "text":
262
+ case "textWithPhoto": return null;
263
+ }
264
+ }
265
+ const richTextDocSchema = z.custom(isCanonicalRichTextDoc, { message: "Expected a rich text document" });
266
+ const mediaValueSchema = z.object({ identifier: z.string().trim().min(1) }).passthrough();
267
+ /** A value that can be stored: the right shape, and within `SECTION_VALUE_LIMITS`. */
268
+ const sectionValueSchema = z.discriminatedUnion("kind", [
269
+ z.object({
270
+ kind: z.literal("choice"),
271
+ value: factTextSchema
272
+ }).strict(),
273
+ z.object({
274
+ kind: z.literal("shortText"),
275
+ value: factTextSchema
276
+ }).strict(),
277
+ z.object({
278
+ kind: z.literal("list"),
279
+ items: z.array(z.string())
280
+ }).strict(),
281
+ z.object({
282
+ kind: z.literal("headedLists"),
283
+ groups: z.array(z.object({
284
+ heading: z.string(),
285
+ items: z.array(z.string())
286
+ }).strict())
287
+ }).strict(),
288
+ z.object({
289
+ kind: z.literal("questions"),
290
+ items: z.array(z.object({
291
+ question: z.string(),
292
+ answer: z.string()
293
+ }).strict())
294
+ }).strict(),
295
+ z.object({
296
+ kind: z.literal("cards"),
297
+ cards: z.array(z.object({
298
+ title: z.string(),
299
+ text: z.string()
300
+ }).strict())
301
+ }).strict(),
302
+ z.object({
303
+ kind: z.literal("text"),
304
+ body: richTextDocSchema
305
+ }).strict(),
306
+ z.object({
307
+ kind: z.literal("textWithPhoto"),
308
+ body: richTextDocSchema,
309
+ photo: z.nullable(mediaValueSchema)
310
+ }).strict()
311
+ ]).superRefine((value, ctx) => {
312
+ const breach = findSectionLimitBreach(value);
313
+ if (!breach) return;
314
+ const what = breach.kind === "tooMany" ? breach.items : breach.text;
315
+ ctx.addIssue({
316
+ code: "custom",
317
+ message: `Over the ${what} limit of ${breach.limit}`,
318
+ params: { breach }
319
+ });
320
+ });
321
+ function parseSectionValue(value) {
322
+ const parsed = z.safeParse(sectionValueSchema, value);
323
+ return parsed.success ? parsed.data : null;
324
+ }
325
+ function nodeHasVisibleText(node) {
326
+ if (typeof node.text === "string" && node.text.trim().length > 0) return true;
327
+ return (node.content ?? []).some(nodeHasVisibleText);
328
+ }
329
+ function richTextHasVisibleText(doc) {
330
+ return doc.content.some(nodeHasVisibleText);
331
+ }
332
+ const trimmedItems = (items) => items.map((item) => item.trim()).filter((item) => item.length > 0);
333
+ /** One normaliser per kind: incomplete items go, and whitespace is trimmed. */
334
+ const normalisers = {
335
+ choice: (value) => ({
336
+ kind: "choice",
337
+ value: value.value.trim()
338
+ }),
339
+ shortText: (value) => ({
340
+ kind: "shortText",
341
+ value: value.value.trim()
342
+ }),
343
+ list: (value) => ({
344
+ kind: "list",
345
+ items: trimmedItems(value.items)
346
+ }),
347
+ headedLists: (value) => ({
348
+ kind: "headedLists",
349
+ groups: value.groups.map((group) => ({
350
+ heading: group.heading.trim(),
351
+ items: trimmedItems(group.items)
352
+ })).filter((group) => group.items.length > 0)
353
+ }),
354
+ questions: (value) => ({
355
+ kind: "questions",
356
+ items: value.items.map((item) => ({
357
+ question: item.question.trim(),
358
+ answer: item.answer.trim()
359
+ })).filter((item) => item.question.length > 0 && item.answer.length > 0)
360
+ }),
361
+ cards: (value) => ({
362
+ kind: "cards",
363
+ cards: value.cards.map((card) => ({
364
+ title: card.title.trim(),
365
+ text: card.text.trim()
366
+ })).filter((card) => card.title.length > 0)
367
+ }),
368
+ text: (value) => value,
369
+ textWithPhoto: (value) => value
370
+ };
371
+ function normaliseOf(value) {
372
+ const normalise = normalisers[value.kind];
373
+ return normalise(value);
374
+ }
375
+ function normaliseSectionValue(value) {
376
+ return normaliseOf(value);
377
+ }
378
+ /** Emptiness is decided only from a normalised value. */
379
+ function isSectionValueEmpty(value) {
380
+ switch (value.kind) {
381
+ case "choice":
382
+ case "shortText": return value.value.length === 0;
383
+ case "list": return value.items.length === 0;
384
+ case "headedLists": return value.groups.length === 0;
385
+ case "questions": return value.items.length === 0;
386
+ case "cards": return value.cards.length === 0;
387
+ case "text":
388
+ case "textWithPhoto": return !richTextHasVisibleText(value.body);
389
+ }
390
+ }
391
+ /**
392
+ * Read a stored value as another kind. List/Headed lists and choice/short text
393
+ * convert within their placements. Choice membership is checked by readFactValue.
394
+ * Other pairs are incompatible, and the value is treated as
395
+ * empty but kept.
396
+ */
397
+ function convertSectionValue(value, toKind) {
398
+ if (value.kind === toKind) return {
399
+ kind: "converted",
400
+ value
401
+ };
402
+ if ((value.kind === "choice" || value.kind === "shortText") && (toKind === "choice" || toKind === "shortText")) return {
403
+ kind: "converted",
404
+ value: {
405
+ kind: toKind,
406
+ value: value.value
407
+ }
408
+ };
409
+ if (value.kind === "list" && toKind === "headedLists") return {
410
+ kind: "converted",
411
+ value: {
412
+ kind: "headedLists",
413
+ groups: [{
414
+ heading: "",
415
+ items: value.items
416
+ }]
417
+ }
418
+ };
419
+ if (value.kind === "headedLists" && toKind === "list") return {
420
+ kind: "converted",
421
+ value: {
422
+ kind: "list",
423
+ items: value.groups.flatMap((group) => group.items)
424
+ }
425
+ };
426
+ return { kind: "incompatible" };
427
+ }
428
+ function readSectionValue(stored, kind) {
429
+ if (stored === void 0 || stored === null) return {
430
+ kind: "empty",
431
+ reason: "missing"
432
+ };
433
+ const parsed = parseSectionValue(stored);
434
+ if (!parsed) return {
435
+ kind: "empty",
436
+ reason: "unreadable"
437
+ };
438
+ const converted = convertSectionValue(parsed, kind);
439
+ if (converted.kind === "incompatible") return {
440
+ kind: "empty",
441
+ reason: "incompatible"
442
+ };
443
+ const normalised = normaliseSectionValue(converted.value);
444
+ return isSectionValueEmpty(normalised) ? {
445
+ kind: "empty",
446
+ reason: "blank"
447
+ } : {
448
+ kind: "filled",
449
+ value: normalised
450
+ };
451
+ }
452
+ //#endregion
453
+ //#region ../content-model/src/page-sections/applicability.ts
454
+ /** Whether one applicability covers a subject with these facts. */
455
+ function appliesTo(applicability, facts) {
456
+ if (applicability.subject === "service" || facts.subject === "service") return applicability.subject === facts.subject;
457
+ const presetMatches = applicability.presets === "all" || applicability.presets.includes(facts.preset);
458
+ const categoryMatches = applicability.categories === "all" || facts.categoryId !== null && applicability.categories.includes(facts.categoryId);
459
+ return presetMatches && categoryMatches;
460
+ }
461
+ const applicableBrand = Symbol("applicable-sections");
462
+ function compareSectionOrder(left, right) {
463
+ return left.position - right.position || left.id.localeCompare(right.id);
464
+ }
465
+ /** The one rule for which sections a subject's page has. */
466
+ function resolveApplicableSections(definitions, facts) {
467
+ const applicable = definitions.filter((definition) => isActiveSection(definition) && appliesTo(definition.applicability, facts));
468
+ return {
469
+ [applicableBrand]: true,
470
+ sections: [...applicable].sort(compareSectionOrder)
471
+ };
472
+ }
473
+ Object.freeze({
474
+ [applicableBrand]: true,
475
+ sections: []
476
+ });
477
+ //#endregion
478
+ //#region ../content-model/src/page-sections/contentValues.ts
479
+ /**
480
+ * Section values live in a page's own content, under one key, as
481
+ * `{ sections: { [definitionId]: SectionValue } }`.
482
+ */
483
+ const SECTION_VALUES_CONTENT_KEY = "sections";
484
+ function readStoredSectionValues(content) {
485
+ if (!isRecord$1(content)) return {};
486
+ const sections = content[SECTION_VALUES_CONTENT_KEY];
487
+ return isRecord$1(sections) ? sections : {};
488
+ }
489
+ //#endregion
490
+ //#region ../content-model/src/page-sections/facts.ts
491
+ /** A removed option is hidden, never rewritten. Restoring that option restores its value. */
492
+ function readShapeValue(stored, shape) {
493
+ const read = readSectionValue(stored, shape.kind);
494
+ if (read.kind === "empty" || shape.kind !== "choice" || read.value.kind !== "choice") return read;
495
+ return shape.options.includes(read.value.value) ? read : {
496
+ kind: "empty",
497
+ reason: "removedOption"
498
+ };
499
+ }
500
+ function readFactValue(stored, shape) {
501
+ const read = readShapeValue(stored, shape);
502
+ return read.kind === "filled" && (read.value.kind === "choice" || read.value.kind === "shortText") ? read.value.value : null;
503
+ }
504
+ /** Uses the selected content version; listing callers must supply published values. */
505
+ function projectPageFacts(input) {
506
+ return resolveApplicableSections(input.definitions, input.facts).sections.flatMap((definition) => {
507
+ if (definition.shape.placement !== "facts") return [];
508
+ const value = readFactValue(input.values[definition.id], definition.shape);
509
+ return value === null ? [] : [{
510
+ label: definition.label,
511
+ value
512
+ }];
513
+ });
514
+ }
515
+ //#endregion
516
+ //#region ../block-form/src/widgets/utils/readNumericUiConfig.ts
517
+ function readNumericInputUiConfig(ui) {
518
+ if (!ui || typeof ui !== "object") return {};
519
+ const rec = ui;
520
+ return {
521
+ min: typeof rec.min === "number" ? rec.min : void 0,
522
+ max: typeof rec.max === "number" ? rec.max : void 0,
523
+ step: typeof rec.step === "number" ? rec.step : void 0
524
+ };
525
+ }
526
+ function readNumberFieldUiConfig(ui) {
527
+ return readNumericInputUiConfig(ui);
528
+ }
529
+ //#endregion
530
+ //#region ../block-form/src/manifest/utils.ts
531
+ function assertNever(value) {
532
+ throw new Error(`Unhandled manifest variant: ${JSON.stringify(value)}`);
533
+ }
534
+ function getGroupChildFields(field) {
535
+ return field.schema?.fields ?? field.fields;
536
+ }
537
+ function getRepeaterChildFields(field) {
538
+ return field.schema?.fields ?? field.fields ?? [];
539
+ }
540
+ /** Data fields of a repeater item: flattened groups contribute children at the item level. */
541
+ function getRepeaterItemDataFields(fields) {
542
+ return fields.flatMap((field) => field.type === "group" && field.ui?.flattenInRepeater ? getGroupChildFields(field) : [field]);
543
+ }
544
+ //#endregion
545
+ //#region ../block-form/src/manifest/canonicalValidation.ts
546
+ function buildCanonicalFieldSchema(field) {
547
+ return fieldPlanToZod(deriveFieldValidationPlan(normalizeFieldForCanonicalValidation(field)), { allowNull: !field.required });
548
+ }
549
+ function normalizeFieldForCanonicalValidation(field) {
550
+ return parseFieldDefinition(toManifestFieldInput(field));
551
+ }
552
+ function toManifestFieldInput(field) {
553
+ switch (field.type) {
554
+ case "number": return numberFieldToManifestInput(field);
555
+ case "group": return groupFieldToManifestInput(field);
556
+ case "modal": return modalFieldToManifestInput(field);
557
+ case "repeater": return repeaterFieldToManifestInput(field);
558
+ case "tabGroup": return {
559
+ ...field,
560
+ tabs: field.tabs.map((tab) => ({
561
+ ...tab,
562
+ fields: tab.fields.map(toManifestFieldInput)
563
+ }))
564
+ };
565
+ case "button": throw new Error("Button fields do not have canonical content validation");
566
+ case "text":
567
+ case "inlineText":
568
+ case "richText":
569
+ case "media":
570
+ case "file":
571
+ case "boolean":
572
+ case "date":
573
+ case "time":
574
+ case "datetime":
575
+ case "slug":
576
+ case "url":
577
+ case "link":
578
+ case "select":
579
+ case "reference":
580
+ case "presetOrCustom":
581
+ case "contentTypeSelect":
582
+ case "entryPicker": return field;
583
+ }
584
+ return assertNever(field);
585
+ }
586
+ function numberFieldToManifestInput(field) {
587
+ const ui = readNumberFieldUiConfig(field.ui);
588
+ return {
589
+ ...field,
590
+ min: field.min ?? ui.min,
591
+ max: field.max ?? ui.max,
592
+ step: field.step ?? ui.step
593
+ };
594
+ }
595
+ function groupFieldToManifestInput(field) {
596
+ return {
597
+ ...field,
598
+ schema: {
599
+ ...field.schema,
600
+ fields: getGroupChildFields(field).map(toManifestFieldInput)
601
+ }
602
+ };
603
+ }
604
+ function modalFieldToManifestInput(field) {
605
+ return {
606
+ ...field,
607
+ schema: {
608
+ ...field.schema,
609
+ fields: field.schema.fields.map(toManifestFieldInput)
610
+ }
611
+ };
612
+ }
613
+ function repeaterFieldToManifestInput(field) {
614
+ if (field.polymorphic) return {
615
+ ...field,
616
+ itemTypes: Object.fromEntries(Object.entries(field.itemTypes).map(([typeId, itemType]) => [typeId, {
617
+ ...itemType,
618
+ fields: itemType.fields.map(toManifestFieldInput)
619
+ }]))
620
+ };
621
+ return {
622
+ ...field,
623
+ schema: {
624
+ ...field.schema,
625
+ fields: getRepeaterChildFields(field).map(toManifestFieldInput)
626
+ }
627
+ };
628
+ }
629
+ //#endregion
630
+ //#region ../block-form/src/widgets/TextField/textFieldSchema.ts
631
+ function buildTextFieldSchema(field) {
632
+ return buildCanonicalFieldSchema(field);
633
+ }
634
+ //#endregion
635
+ //#region ../block-form/src/widgets/stringDefaultValue.ts
636
+ function readStringDefaultValue(value) {
637
+ if (typeof value === "string") return value;
638
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
639
+ return null;
640
+ }
641
+ //#endregion
642
+ //#region ../block-form/src/widgets/TextField/textFieldDefaults.ts
643
+ function getTextFieldDefault(field) {
644
+ const defaultValue = readStringDefaultValue(field.defaultValue);
645
+ if (defaultValue !== null) return defaultValue;
646
+ if (field.required) return field.label;
647
+ return "";
648
+ }
649
+ //#endregion
650
+ //#region ../block-form/src/widgets/NumberField/numberFieldSchema.ts
651
+ function buildNumberFieldSchema(field) {
652
+ return buildCanonicalFieldSchema(field);
653
+ }
654
+ //#endregion
655
+ //#region ../block-form/src/widgets/NumberField/numberFieldDefaults.ts
656
+ function getNumberFieldDefault(field) {
657
+ if (field.defaultValue !== void 0) return typeof field.defaultValue === "number" ? field.defaultValue : null;
658
+ return null;
659
+ }
660
+ //#endregion
661
+ //#region ../block-form/src/widgets/SelectField/selectFieldSchema.ts
662
+ function buildSelectFieldSchema(field) {
663
+ return buildCanonicalFieldSchema(field);
664
+ }
665
+ //#endregion
666
+ //#region ../block-form/src/widgets/SelectField/selectFieldDefaults.ts
667
+ function getSelectFieldDefault(field) {
668
+ if (field.multiple) {
669
+ if (Array.isArray(field.defaultValue)) return field.defaultValue.filter((v) => typeof v === "string");
670
+ if (typeof field.defaultValue === "string" && field.defaultValue.trim().length > 0) return [field.defaultValue];
671
+ if (field.required) {
672
+ const first = field.options?.[0]?.value;
673
+ if (typeof first === "string") return [first];
674
+ }
675
+ return [];
676
+ }
677
+ const defaultValue = readStringDefaultValue(field.defaultValue);
678
+ if (defaultValue !== null) return defaultValue;
679
+ return field.options?.[0]?.value ?? "";
680
+ }
681
+ //#endregion
682
+ //#region ../block-form/src/widgets/BooleanField/booleanFieldSchema.ts
683
+ /**
684
+ * BooleanField validation schema builder
685
+ * Server-safe - no React, no browser APIs
686
+ */
687
+ function buildBooleanFieldSchema(field) {
688
+ const base = z.boolean();
689
+ return field.required ? base : base.optional().nullable();
690
+ }
691
+ //#endregion
692
+ //#region ../block-form/src/widgets/BooleanField/booleanFieldDefaults.ts
693
+ function getBooleanFieldDefault(field) {
694
+ if (field.defaultValue !== void 0) return Boolean(field.defaultValue);
695
+ return false;
696
+ }
697
+ //#endregion
698
+ //#region ../block-form/src/widgets/GroupField/groupFieldSchema.ts
699
+ /**
700
+ * GroupField validation schema builder
701
+ * Server-safe - no React, no browser APIs
702
+ */
703
+ function buildGroupFieldSchema(field, ctx) {
704
+ const shape = {};
705
+ const fields = field.fields ?? field.schema?.fields ?? [];
706
+ for (const child of fields) shape[child.id] = ctx.getFieldSchema(child);
707
+ return z.object(shape).catchall(z.unknown()).passthrough();
708
+ }
709
+ //#endregion
710
+ //#region ../block-form/src/widgets/GroupField/groupFieldDefaults.ts
711
+ function getGroupFieldDefault(field, ctx) {
712
+ if (field.ui?.valueContract === "location") return null;
713
+ const fields = field.fields ?? field.schema?.fields ?? [];
714
+ return Object.fromEntries(fields.map((child) => [child.id, ctx.resolve(child)]));
715
+ }
716
+ //#endregion
717
+ //#region ../block-form/src/widgets/ModalGroupField/modalFieldSchema.ts
718
+ /**
719
+ * ModalGroupField validation schema builder
720
+ * Server-safe - no React, no browser APIs
721
+ *
722
+ * Modal fields are structurally identical to group fields - they just render differently in the UI.
723
+ */
724
+ function buildModalFieldSchema(field, ctx) {
725
+ const shape = {};
726
+ const fields = field.schema.fields;
727
+ for (const child of fields) shape[child.id] = ctx.getFieldSchema(child);
728
+ return z.object(shape).catchall(z.unknown()).passthrough();
729
+ }
730
+ //#endregion
731
+ //#region ../block-form/src/widgets/ModalGroupField/modalFieldDefaults.ts
732
+ function getModalFieldDefault(field, ctx) {
733
+ const obj = {};
734
+ const fields = field.schema?.fields ?? field.fields ?? [];
735
+ for (const child of fields) obj[child.id] = ctx.resolve(child);
736
+ return obj;
737
+ }
738
+ //#endregion
739
+ //#region ../block-form/src/widgets/RepeaterField/repeaterFieldSchema.ts
740
+ /**
741
+ * RepeaterField validation schema builder
742
+ * Server-safe - no React, no browser APIs
743
+ */
744
+ function hasAtLeastTwo(items) {
745
+ return items.length >= 2;
746
+ }
747
+ function buildRepeaterFieldSchema(field, ctx) {
748
+ const itemSchema = buildRepeaterItemSchema(field, ctx);
749
+ const customValidation = field.validation;
750
+ if (customValidation) {
751
+ if (field.required) return customValidation;
752
+ return z.optional(customValidation);
753
+ }
754
+ const arraySchema = z.array(itemSchema);
755
+ const minItems = field.minItems ?? 0;
756
+ const minSchema = minItems > 0 ? arraySchema.min(minItems, `Must have at least ${minItems} item(s)`) : arraySchema;
757
+ const schema = field.maxItems !== void 0 ? minSchema.max(field.maxItems, `Must have at most ${field.maxItems} item(s)`) : minSchema;
758
+ return field.required ? schema : z.optional(schema);
759
+ }
760
+ function buildItemSchema(fields, ctx, typeKey) {
761
+ return z.object({
762
+ ...typeKey !== void 0 ? { _type: z.literal(typeKey) } : {},
763
+ ...Object.fromEntries(getRepeaterItemDataFields(fields).map((child) => [child.id, ctx.getFieldSchema(child)]))
764
+ }).catchall(z.unknown()).passthrough();
765
+ }
766
+ function buildRepeaterItemSchema(field, ctx) {
767
+ if (!field.polymorphic) return buildItemSchema(getRepeaterChildFields(field), ctx);
768
+ const schemas = Object.entries(field.itemTypes).map(([typeKey, itemType]) => buildItemSchema(itemType.fields, ctx, typeKey));
769
+ return hasAtLeastTwo(schemas) ? z.discriminatedUnion("_type", schemas) : schemas[0] ?? z.object({ _type: z.string() }).passthrough();
770
+ }
771
+ //#endregion
772
+ //#region ../block-form/src/widgets/RepeaterField/repeaterFieldDefaults.ts
773
+ /**
774
+ * RepeaterField default value builder
775
+ * Server-safe - no React, no browser APIs
776
+ */
777
+ function isRecordArray(value) {
778
+ return Array.isArray(value) && value.every((item) => {
779
+ return typeof item === "object" && item !== null && !Array.isArray(item);
780
+ });
781
+ }
782
+ function getRepeaterFieldDefault(field, ctx) {
783
+ if (field.defaultValue !== void 0) return isRecordArray(field.defaultValue) ? field.defaultValue : [];
784
+ return seedFixedLayoutGridPositions(field, Array.from({ length: field.minItems ?? 0 }, () => getRepeaterItemDefault(field, ctx)));
785
+ }
786
+ /** Shared owner for newly added rows and manifest-seeded minimum rows. */
787
+ function getRepeaterItemDefault(field, ctx, itemType) {
788
+ const typeKey = field.polymorphic ? itemType ?? Object.keys(field.itemTypes)[0] ?? "" : void 0;
789
+ const fields = field.polymorphic ? field.itemTypes[typeKey ?? ""]?.fields ?? [] : getRepeaterChildFields(field);
790
+ return applyLayoutGridDefaultWidth(field, fields, {
791
+ ...typeKey !== void 0 ? { _type: typeKey } : {},
792
+ ...Object.fromEntries(getRepeaterItemDataFields(fields).map((child) => [child.id, ctx.resolve(child)]))
793
+ });
794
+ }
795
+ /** New rows get an accepted default; existing saved values are never normalized here. */
796
+ function applyLayoutGridDefaultWidth(field, fields, value) {
797
+ if (field.ui?.repeaterPreset !== "layoutGrid") return value;
798
+ const spanField = resolveRepeaterGridSpanFieldId({ id: typeof field.ui.layoutGridSpanField === "string" ? field.ui.layoutGridSpanField : void 0 });
799
+ const acceptedSpans = resolveRepeaterGridAcceptedSpans(fields, spanField);
800
+ if (!acceptedSpans) return value;
801
+ const columns = typeof field.ui.layoutGridColumns === "number" ? field.ui.layoutGridColumns : 6;
802
+ return {
803
+ ...value,
804
+ [spanField]: String(normalizeRepeaterGridSpan(value[spanField], columns, acceptedSpans))
805
+ };
806
+ }
807
+ /** Minimum rows are new content too: place them through the same planner as Add. */
808
+ function seedFixedLayoutGridPositions(field, defaults) {
809
+ const columns = field.ui?.layoutGridColumns;
810
+ if (field.ui?.repeaterPreset !== "layoutGrid" || typeof columns !== "number") return defaults;
811
+ const spanId = resolveRepeaterGridSpanFieldId({ id: typeof field.ui.layoutGridSpanField === "string" ? field.ui.layoutGridSpanField : void 0 });
812
+ const rowId = resolveRepeaterGridRowFieldId({ id: typeof field.ui.layoutGridRowField === "string" ? field.ui.layoutGridRowField : void 0 });
813
+ const columnId = resolveRepeaterGridColumnFieldId({ id: typeof field.ui.layoutGridColumnField === "string" ? field.ui.layoutGridColumnField : void 0 });
814
+ const placed = flowRepeaterGridItems(defaults.map((item, index) => ({
815
+ id: String(index),
816
+ span: Number(item[spanId]),
817
+ row: 1,
818
+ colStart: 1,
819
+ startNewRow: typeof field.ui?.layoutGridStartNewRowField === "string" && item[field.ui.layoutGridStartNewRowField] === true
820
+ })), columns);
821
+ return defaults.map((item, index) => ({
822
+ ...item,
823
+ [rowId]: placed[index]?.row,
824
+ [columnId]: placed[index]?.colStart
825
+ }));
826
+ }
827
+ //#endregion
828
+ //#region ../block-form/src/widgets/UrlField/urlFieldSchema.ts
829
+ /**
830
+ * Build Zod validation schema for URL field
831
+ */
832
+ function buildUrlFieldSchema(field) {
833
+ return buildCanonicalFieldSchema(field);
834
+ }
835
+ //#endregion
836
+ //#region ../block-form/src/widgets/UrlField/urlFieldDefaults.ts
837
+ /**
838
+ * Get default value for URL field
839
+ */
840
+ function getUrlFieldDefault(field) {
841
+ return field.defaultValue ?? "";
842
+ }
843
+ //#endregion
844
+ //#region ../block-form/src/widgets/TimeField/timeFieldSchema.ts
845
+ /**
846
+ * Build Zod validation schema for Time field
847
+ */
848
+ function buildTimeFieldSchema(field) {
849
+ return buildCanonicalFieldSchema(field);
850
+ }
851
+ //#endregion
852
+ //#region ../block-form/src/widgets/TimeField/timeFieldDefaults.ts
853
+ /**
854
+ * Get default value for Time field
855
+ */
856
+ function getTimeFieldDefault(field) {
857
+ return field.defaultValue ?? null;
858
+ }
859
+ //#endregion
860
+ //#region ../block-form/src/widgets/DateField/dateFieldSchema.ts
861
+ /**
862
+ * Build Zod validation schema for Date field
863
+ */
864
+ function buildDateFieldSchema(field) {
865
+ return buildCanonicalFieldSchema(field);
866
+ }
867
+ //#endregion
868
+ //#region ../block-form/src/widgets/DateField/dateFieldDefaults.ts
869
+ /**
870
+ * Get default value for Date field
871
+ */
872
+ function getDateFieldDefault(field) {
873
+ return field.defaultValue ?? null;
874
+ }
875
+ //#endregion
876
+ //#region ../block-form/src/widgets/DateTimeField/dateTimeFieldSchema.ts
877
+ /**
878
+ * Build Zod validation schema for DateTime field
879
+ *
880
+ * Validates ISO 8601 date-time strings
881
+ */
882
+ function buildDateTimeFieldSchema(field) {
883
+ return buildCanonicalFieldSchema(field);
884
+ }
885
+ //#endregion
886
+ //#region ../block-form/src/widgets/DateTimeField/dateTimeFieldDefaults.ts
887
+ /**
888
+ * Get default value for DateTime field
889
+ */
890
+ function getDateTimeFieldDefault(field) {
891
+ return field.defaultValue ?? null;
892
+ }
893
+ //#endregion
894
+ //#region ../block-form/src/widgets/SlugField/slugFieldSchema.ts
895
+ /**
896
+ * Build Zod validation schema for Slug field
897
+ *
898
+ * Validates:
899
+ * - Lowercase letters, numbers, and dashes only
900
+ * - Optional slashes for paths (e.g., 'parent/child')
901
+ * - Optional maxLength constraint
902
+ */
903
+ function buildSlugFieldSchema(field) {
904
+ return buildCanonicalFieldSchema(field);
905
+ }
906
+ //#endregion
907
+ //#region ../block-form/src/widgets/SlugField/slugFieldDefaults.ts
908
+ /**
909
+ * Get default value for Slug field
910
+ */
911
+ function getSlugFieldDefault(field) {
912
+ return field.defaultValue ?? "";
913
+ }
914
+ //#endregion
915
+ //#region ../block-form/src/widgets/LinkField/linkFieldSchema.ts
916
+ function buildLinkFieldSchema(field) {
917
+ return buildCanonicalFieldSchema(field);
918
+ }
919
+ //#endregion
920
+ //#region ../block-form/src/widgets/LinkField/linkFieldDefaults.ts
921
+ /**
922
+ * Get default value for LinkField
923
+ */
924
+ function getLinkFieldDefault(field) {
925
+ if (field.defaultValue !== void 0) return field.defaultValue;
926
+ if (field.required) return {
927
+ kind: "url",
928
+ href: "#"
929
+ };
930
+ }
931
+ //#endregion
932
+ //#region ../block-form/src/widgets/RichTextField/richTextFieldSchema.ts
933
+ /**
934
+ * Build Zod validation schema for rich text field
935
+ *
936
+ * Uses the shared rich text schema from @riverbankcms/blocks to ensure consistency
937
+ * between the form editor and block rendering validation.
938
+ *
939
+ * @param config - Rich text field configuration
940
+ * @returns Zod schema for rich text validation
941
+ */
942
+ function buildRichTextFieldSchema(config) {
943
+ const schema = buildRichTextSchema({
944
+ required: config.required,
945
+ label: config.label
946
+ });
947
+ return config.required ? schema : z.union([schema, z.null()]).optional();
948
+ }
949
+ //#endregion
950
+ //#region ../block-form/src/widgets/RichTextField/richTextFieldDefaults.ts
951
+ /**
952
+ * Empty TipTap document structure
953
+ */
954
+ const EMPTY_RICH_TEXT_DOC = createRichTextDoc([""]);
955
+ /**
956
+ * Get default value for rich text field
957
+ * Returns empty TipTap document structure
958
+ */
959
+ function getRichTextFieldDefaultValue(_config) {
960
+ return EMPTY_RICH_TEXT_DOC;
961
+ }
962
+ //#endregion
963
+ //#region ../block-form/src/widgets/InlineTextField/inlineTextFieldSchema.ts
964
+ function buildInlineTextFieldSchema(field) {
965
+ return buildCanonicalFieldSchema(field);
966
+ }
967
+ //#endregion
968
+ //#region ../block-form/src/widgets/InlineTextField/inlineTextFieldDefaults.ts
969
+ function getInlineTextFieldDefaultValue(field) {
970
+ if (field.defaultValue !== void 0) return field.defaultValue;
971
+ return field.required ? plainTextToInlineText(field.label) : [];
972
+ }
973
+ //#endregion
974
+ //#region ../block-form/src/widgets/MediaField/mediaFieldSchema.ts
975
+ /**
976
+ * Build Zod validation schema for media field
977
+ * Validates media object structure or null
978
+ */
979
+ function buildMediaFieldSchema(config) {
980
+ return buildCanonicalFieldSchema(config);
981
+ }
982
+ //#endregion
983
+ //#region ../block-form/src/widgets/MediaField/mediaFieldDefaults.ts
984
+ /**
985
+ * Get default value for media field
986
+ * Media fields default to null (no media selected)
987
+ */
988
+ function getMediaFieldDefaultValue(_config) {
989
+ return null;
990
+ }
991
+ //#endregion
992
+ //#region ../block-form/src/widgets/TabGroupField/tabGroupFieldSchema.ts
993
+ /**
994
+ * TabGroupField validation schema builder
995
+ * Server-safe - no React, no browser APIs
996
+ */
997
+ /**
998
+ * Build validation schema for TabGroupField
999
+ *
1000
+ * TabGroup is a UI container that organizes fields into tabs.
1001
+ * It validates all child fields across all tabs, and optionally
1002
+ * validates the activeTabField if one is specified.
1003
+ */
1004
+ function buildTabGroupFieldSchema(field, ctx) {
1005
+ const shape = {};
1006
+ for (const tab of field.tabs) for (const child of tab.fields) shape[child.id] = ctx.getFieldSchema(child);
1007
+ if (field.activeTabField) {
1008
+ const tabIds = field.tabs.map((t) => t.id);
1009
+ if (tabIds.length > 0) shape[field.activeTabField] = z.enum(tabIds);
1010
+ }
1011
+ return z.object(shape).catchall(z.unknown()).passthrough();
1012
+ }
1013
+ /**
1014
+ * Get default value for TabGroupField
1015
+ *
1016
+ * Returns an object containing default values for all child fields
1017
+ * across all tabs, plus the activeTabField if specified.
1018
+ *
1019
+ * Follows the same pattern as GroupField - includes all fields
1020
+ * even if their default value is undefined.
1021
+ */
1022
+ function getTabGroupFieldDefault(field, ctx) {
1023
+ const defaults = {};
1024
+ for (const tab of field.tabs) for (const child of tab.fields) defaults[child.id] = ctx.resolve(child);
1025
+ if (field.activeTabField && field.tabs.length > 0 && field.tabs[0]) defaults[field.activeTabField] = field.tabs[0].id;
1026
+ return defaults;
1027
+ }
1028
+ //#endregion
1029
+ //#region ../block-form/src/widgets/PresetOrCustomField/presetOrCustomFieldSchema.ts
1030
+ function buildPresetOrCustomFieldSchema(field, _ctx) {
1031
+ field.presets.map((p) => p.value);
1032
+ return z.string();
1033
+ }
1034
+ //#endregion
1035
+ //#region ../block-form/src/widgets/PresetOrCustomField/presetOrCustomFieldDefaults.ts
1036
+ function getPresetOrCustomFieldDefault(field, _ctx) {
1037
+ const defaultValue = readStringDefaultValue(field.defaultValue);
1038
+ if (defaultValue !== null) return defaultValue;
1039
+ return field.presets[0]?.value ?? "";
1040
+ }
1041
+ //#endregion
1042
+ //#region ../block-form/src/widgets/ReferenceField/referenceFieldSchema.ts
1043
+ function buildReferenceFieldSchema(field, _ctx) {
1044
+ return buildCanonicalFieldSchema(field);
1045
+ }
1046
+ //#endregion
1047
+ //#region ../block-form/src/widgets/ReferenceField/referenceFieldDefaults.ts
1048
+ function getReferenceFieldDefault(field, _ctx) {
1049
+ const defaultValue = readStringDefaultValue(field.defaultValue);
1050
+ if (defaultValue !== null) return defaultValue;
1051
+ if (field.required) return `placeholder-${field.id}`;
1052
+ return "";
1053
+ }
1054
+ //#endregion
1055
+ //#region ../block-form/src/widgets/ContentTypeSelectField/contentTypeSelectFieldSchema.ts
1056
+ function buildContentTypeSelectFieldSchema(field, _ctx) {
1057
+ const schema = z.string();
1058
+ if (field.required) return schema.min(1, "This field is required");
1059
+ return z.optional(schema).nullable().or(z.literal(""));
1060
+ }
1061
+ //#endregion
1062
+ //#region ../block-form/src/widgets/ContentTypeSelectField/contentTypeSelectFieldDefaults.ts
1063
+ function getContentTypeSelectFieldDefault(field, _ctx) {
1064
+ const defaultValue = readStringDefaultValue(field.defaultValue);
1065
+ if (defaultValue !== null) return defaultValue;
1066
+ return "";
1067
+ }
1068
+ //#endregion
1069
+ //#region ../block-form/src/widgets/EntryPickerField/entryPickerFieldSchema.ts
1070
+ function buildEntryPickerFieldSchema(field, _ctx) {
1071
+ const schema = z.string();
1072
+ if (field.required) return schema.min(1, "This field is required");
1073
+ return z.optional(schema).nullable().or(z.literal(""));
1074
+ }
1075
+ //#endregion
1076
+ //#region ../block-form/src/widgets/EntryPickerField/entryPickerFieldDefaults.ts
1077
+ function getEntryPickerFieldDefault(field, _ctx) {
1078
+ const defaultValue = readStringDefaultValue(field.defaultValue);
1079
+ if (defaultValue !== null) return defaultValue;
1080
+ if (field.required) return `placeholder-${field.id}`;
1081
+ return "";
1082
+ }
1083
+ //#endregion
1084
+ //#region ../block-form/src/registry/schemas.ts
1085
+ /**
1086
+ * Schema and Default Value Registry
1087
+ * Maps field types to validation schemas and default value builders
1088
+ *
1089
+ * Server-safe - no React, no browser APIs
1090
+ * Can be used in API routes, server components, and validation
1091
+ */
1092
+ const SCHEMA_BUILDERS = {
1093
+ text: buildTextFieldSchema,
1094
+ number: buildNumberFieldSchema,
1095
+ select: buildSelectFieldSchema,
1096
+ boolean: buildBooleanFieldSchema,
1097
+ group: buildGroupFieldSchema,
1098
+ modal: buildModalFieldSchema,
1099
+ repeater: buildRepeaterFieldSchema,
1100
+ url: buildUrlFieldSchema,
1101
+ time: buildTimeFieldSchema,
1102
+ date: buildDateFieldSchema,
1103
+ datetime: buildDateTimeFieldSchema,
1104
+ slug: buildSlugFieldSchema,
1105
+ link: buildLinkFieldSchema,
1106
+ richText: buildRichTextFieldSchema,
1107
+ inlineText: buildInlineTextFieldSchema,
1108
+ media: buildMediaFieldSchema,
1109
+ file: buildMediaFieldSchema,
1110
+ tabGroup: buildTabGroupFieldSchema,
1111
+ presetOrCustom: buildPresetOrCustomFieldSchema,
1112
+ reference: buildReferenceFieldSchema,
1113
+ contentTypeSelect: buildContentTypeSelectFieldSchema,
1114
+ entryPicker: buildEntryPickerFieldSchema
1115
+ };
1116
+ const DEFAULT_VALUE_BUILDERS = {
1117
+ text: getTextFieldDefault,
1118
+ number: getNumberFieldDefault,
1119
+ select: getSelectFieldDefault,
1120
+ boolean: getBooleanFieldDefault,
1121
+ group: getGroupFieldDefault,
1122
+ modal: getModalFieldDefault,
1123
+ repeater: getRepeaterFieldDefault,
1124
+ url: getUrlFieldDefault,
1125
+ time: getTimeFieldDefault,
1126
+ date: getDateFieldDefault,
1127
+ datetime: getDateTimeFieldDefault,
1128
+ slug: getSlugFieldDefault,
1129
+ link: getLinkFieldDefault,
1130
+ richText: getRichTextFieldDefaultValue,
1131
+ inlineText: getInlineTextFieldDefaultValue,
1132
+ media: getMediaFieldDefaultValue,
1133
+ file: getMediaFieldDefaultValue,
1134
+ tabGroup: getTabGroupFieldDefault,
1135
+ presetOrCustom: getPresetOrCustomFieldDefault,
1136
+ reference: getReferenceFieldDefault,
1137
+ contentTypeSelect: getContentTypeSelectFieldDefault,
1138
+ entryPicker: getEntryPickerFieldDefault
1139
+ };
1140
+ /**
1141
+ * Helper to build a validation schema for a single field
1142
+ * Recursively handles nested fields (group, repeater)
1143
+ */
1144
+ function buildFieldSchema(field, ctx) {
1145
+ const builder = SCHEMA_BUILDERS[field.type];
1146
+ if (!builder) {
1147
+ console.warn(`No schema builder registered for field type: ${field.type}`);
1148
+ return z.any();
1149
+ }
1150
+ return builder(field, ctx);
1151
+ }
1152
+ /**
1153
+ * Helper to get default value for a single field
1154
+ * Recursively handles nested fields (group, repeater)
1155
+ */
1156
+ function getFieldDefault(field, ctx) {
1157
+ const getDefault = DEFAULT_VALUE_BUILDERS[field.type];
1158
+ if (!getDefault) {
1159
+ console.warn(`No default value builder registered for field type: ${field.type}`);
1160
+ return field.defaultValue;
1161
+ }
1162
+ return getDefault(field, ctx);
1163
+ }
1164
+ //#endregion
1165
+ //#region ../block-form/src/manifest/manifestFormAdapter.ts
1166
+ const DEFAULT_ROLE = "author";
1167
+ const rolePriority = {
1168
+ author: 0,
1169
+ designer: 1,
1170
+ admin: 2
1171
+ };
1172
+ /**
1173
+ * Transform a BlockManifest into form fields and validation schema
1174
+ */
1175
+ function createManifestFormAdapter(manifest, options) {
1176
+ const role = options?.role ?? DEFAULT_ROLE;
1177
+ const fields = (manifest.fields ?? []).map((field) => transformField(field, role)).filter(Boolean);
1178
+ return {
1179
+ fields,
1180
+ schema: buildValidationSchema(fields)
1181
+ };
1182
+ }
1183
+ /**
1184
+ * Transform a single field, filtering by role and flattening nested structure
1185
+ */
1186
+ function transformField(field, role) {
1187
+ if (!isFieldVisible(field, role)) return;
1188
+ if (field.type !== "group" && field.type !== "repeater" && field.type !== "modal" && field.type !== "tabGroup") return field;
1189
+ if (field.type === "group") {
1190
+ const children = (field.schema?.fields ?? []).map((child) => transformField(child, role)).filter(Boolean);
1191
+ if (!children.length) return;
1192
+ const { schema: _schema, ...rest } = field;
1193
+ return {
1194
+ ...rest,
1195
+ fields: children
1196
+ };
1197
+ }
1198
+ if (field.type === "modal") {
1199
+ const children = (field.schema?.fields ?? []).map((child) => transformField(child, role)).filter(Boolean);
1200
+ if (!children.length) return;
1201
+ const { schema: _schema, ...rest } = field;
1202
+ return {
1203
+ ...rest,
1204
+ schema: { fields: children }
1205
+ };
1206
+ }
1207
+ if (field.type === "tabGroup") {
1208
+ const tabs = (field.tabs ?? []).flatMap((tab) => {
1209
+ const children = (tab.fields ?? []).map((child) => transformField(child, role)).filter(Boolean);
1210
+ return children.length ? [{
1211
+ ...tab,
1212
+ fields: children
1213
+ }] : [];
1214
+ });
1215
+ if (!tabs.length) return;
1216
+ return {
1217
+ ...field,
1218
+ tabs
1219
+ };
1220
+ }
1221
+ if (field.type === "repeater") {
1222
+ if (field.polymorphic && field.itemTypes) {
1223
+ const itemTypes = {};
1224
+ for (const [typeKey, itemType] of Object.entries(field.itemTypes)) {
1225
+ const children = (itemType.fields ?? []).map((child) => transformField(child, role)).filter(Boolean);
1226
+ if (children.length > 0) itemTypes[typeKey] = {
1227
+ label: itemType.label,
1228
+ icon: itemType.icon,
1229
+ fields: children
1230
+ };
1231
+ }
1232
+ if (Object.keys(itemTypes).length === 0) return;
1233
+ const { schema: _schema2, ...rest } = field;
1234
+ return {
1235
+ ...rest,
1236
+ polymorphic: true,
1237
+ itemTypes
1238
+ };
1239
+ }
1240
+ const children = (field.schema?.fields ?? []).map((child) => transformField(child, role)).filter(Boolean);
1241
+ if (!children.length) return;
1242
+ const { schema: _schema3, polymorphic: _polymorphic, itemTypes: _itemTypes, ...rest } = field;
1243
+ return {
1244
+ ...rest,
1245
+ fields: children
1246
+ };
1247
+ }
1248
+ }
1249
+ /**
1250
+ * Check if a field is visible to the current role
1251
+ */
1252
+ function isFieldVisible(field, role) {
1253
+ if (role === "admin") return true;
1254
+ const allowed = field.visibleRoles;
1255
+ if (!allowed || allowed.length === 0) return true;
1256
+ return allowed.some((visibility) => rolePriority[role] >= rolePriority[visibility]);
1257
+ }
1258
+ /**
1259
+ * Build a Zod validation schema from field configs using the schema registry
1260
+ */
1261
+ function buildValidationSchema(fields) {
1262
+ const shape = {};
1263
+ const ctx = { getFieldSchema: (field) => buildManifestFieldSchema(field, ctx) };
1264
+ for (const field of fields) shape[field.id] = buildManifestFieldSchema(field, ctx);
1265
+ return z.object(shape).catchall(z.unknown()).passthrough();
1266
+ }
1267
+ function buildManifestFieldSchema(field, ctx) {
1268
+ if (shouldUseCanonicalSchema(field)) return buildCanonicalFieldSchema(field);
1269
+ return buildFieldSchema(field, ctx);
1270
+ }
1271
+ function shouldUseCanonicalSchema(field) {
1272
+ switch (field.type) {
1273
+ case "text":
1274
+ case "number":
1275
+ case "select":
1276
+ case "boolean":
1277
+ case "url":
1278
+ case "slug":
1279
+ case "link":
1280
+ case "media":
1281
+ case "file":
1282
+ case "reference":
1283
+ case "inlineText": return true;
1284
+ case "group": return getGroupChildFields(field).every(shouldUseCanonicalSchema);
1285
+ case "modal": return field.schema.fields.every(shouldUseCanonicalSchema);
1286
+ case "repeater":
1287
+ if (field.polymorphic) return Object.values(field.itemTypes).every((itemType) => itemType.fields.every(shouldUseCanonicalSchema));
1288
+ return getRepeaterChildFields(field).every(shouldUseCanonicalSchema);
1289
+ case "tabGroup":
1290
+ if (field.activeTabField) return false;
1291
+ return field.tabs.every((tab) => tab.fields.every(shouldUseCanonicalSchema));
1292
+ case "richText":
1293
+ case "date":
1294
+ case "time":
1295
+ case "datetime":
1296
+ case "presetOrCustom":
1297
+ case "contentTypeSelect":
1298
+ case "entryPicker":
1299
+ case "button": return false;
1300
+ }
1301
+ return assertNever(field);
1302
+ }
1303
+ //#endregion
1304
+ //#region ../block-form/src/manifest/manifestDefaultValues.ts
1305
+ /** Construct initial field values through the same field-type default owner on server and client. */
1306
+ function createManifestDefaultValues(manifest, data = {}, options = {}) {
1307
+ const { fields } = createManifestFormAdapter(manifest, {
1308
+ role: options.role,
1309
+ ...options.adapterOptions
1310
+ });
1311
+ const ctx = { resolve: (field) => getFieldDefault(field, ctx) };
1312
+ return fields.reduce((values, field) => ({
1313
+ ...values,
1314
+ ...defaultFieldEntry(field, data, ctx)
1315
+ }), {});
1316
+ }
1317
+ /** Inline text owns both its document value and its declared plain-text mirror. */
1318
+ function defaultFieldEntry(field, data, ctx) {
1319
+ const raw = data[field.id];
1320
+ const plain = field.type === "inlineText" && field.plainTextField ? data[field.plainTextField] : void 0;
1321
+ const value = raw === void 0 && typeof plain === "string" ? plainTextToInlineText(plain) : ensureFieldValue(field, raw, ctx);
1322
+ if (field.type !== "inlineText" || !field.plainTextField) return { [field.id]: value };
1323
+ const parsed = parseInlineTextFromUnknown(value);
1324
+ return parsed.ok ? {
1325
+ [field.id]: value,
1326
+ [field.plainTextField]: inlineTextToPlainText(parsed.value)
1327
+ } : { [field.id]: value };
1328
+ }
1329
+ function ensureFieldValue(field, raw, ctx) {
1330
+ const value = raw === void 0 ? getFieldDefault(field, ctx) : raw;
1331
+ if (field.type !== "repeater") return value;
1332
+ return (Array.isArray(value) ? value : []).map((item) => ensureRepeaterItem(field, item, ctx));
1333
+ }
1334
+ function ensureRepeaterItem(field, value, ctx) {
1335
+ const itemData = isRecord$1(value) ? value : {};
1336
+ const itemType = typeof itemData._type === "string" ? itemData._type : Object.keys(field.itemTypes ?? {})[0] ?? "";
1337
+ const fields = field.polymorphic ? field.itemTypes[itemType]?.fields ?? [] : getRepeaterChildFields(field);
1338
+ return {
1339
+ ...itemData,
1340
+ ...Object.fromEntries(getRepeaterItemDataFields(fields).map((child) => [child.id, ensureFieldValue(child, itemData[child.id], ctx)]))
1341
+ };
1342
+ }
1343
+ //#endregion
1344
+ //#region ../site-renderer/dist/index.mjs
1345
+ /** Each adapter maps meaning to manifest fields; layout stays with the block and site style. */
1346
+ function sectionBlockContent(label, value) {
1347
+ switch (value.kind) {
1348
+ case "list": return {
1349
+ title: label,
1350
+ list: {
1351
+ kind: "list",
1352
+ items: value.items.map((text) => ({ text }))
1353
+ }
1354
+ };
1355
+ case "headedLists": return {
1356
+ title: label,
1357
+ list: {
1358
+ kind: "headedLists",
1359
+ groups: value.groups.map((group) => ({
1360
+ heading: group.heading,
1361
+ items: group.items.map((text) => ({ text }))
1362
+ }))
1363
+ }
1364
+ };
1365
+ case "questions": return {
1366
+ title: label,
1367
+ items: value.items.map((item) => ({
1368
+ question: item.question,
1369
+ answer: createRichTextDoc([item.answer])
1370
+ }))
1371
+ };
1372
+ case "cards": return {
1373
+ title: label,
1374
+ cards: value.cards.map((card) => ({
1375
+ title: card.title,
1376
+ ...card.text === "" ? {} : { body: createRichTextDoc([card.text]) }
1377
+ }))
1378
+ };
1379
+ case "text": return {
1380
+ heading: label,
1381
+ body: value.body
1382
+ };
1383
+ case "textWithPhoto": return {
1384
+ title: label,
1385
+ text: value.body,
1386
+ images: value.photo !== null ? [{ image: {
1387
+ ...value.photo,
1388
+ type: "image"
1389
+ } }] : []
1390
+ };
1391
+ }
1392
+ }
1393
+ /** The same kind-aware Look admission is used when writing and rendering. */
1394
+ function resolvePageSectionLook(kind, raw) {
1395
+ if (kind === "list" || kind === "headedLists") return parseListLook(kind, raw);
1396
+ const blockKind = pageSectionBlockKind(kind);
1397
+ return appearancePresets.find((preset) => preset.id === raw && preset.blockKinds.some((candidate) => candidate === blockKind))?.id ?? null;
1398
+ }
1399
+ /** The block each body section kind renders through. */
1400
+ function pageSectionBlockKind(kind) {
1401
+ switch (kind) {
1402
+ case "list":
1403
+ case "headedLists": return "block.list";
1404
+ case "questions": return "block.faq";
1405
+ case "cards": return "block.feature-cards";
1406
+ case "text": return "block.body-text";
1407
+ case "textWithPhoto": return "block.media-text";
1408
+ }
1409
+ }
1410
+ /** Section Looks stored on the template anchor. Full pages only: booking pages always use the style's default (README decision 8). */
1411
+ function pageSectionLookOverrides(blocks) {
1412
+ const looks = blocks.find((block) => block.blockKind === PAGE_SECTIONS_ANCHOR_BLOCK_KIND)?.content?.looks;
1413
+ return isRecord(looks) ? looks : {};
1414
+ }
1415
+ /** Pure, shared by public pages and preview. Empty values disappear before layout. */
1416
+ function compilePageSections(input, lookOverrides) {
1417
+ const sections = resolveApplicableSections(input.definitions, input.facts).sections.flatMap((definition) => {
1418
+ if (definition.shape.placement !== "body") return [];
1419
+ const read = readSectionValue(input.values[definition.id], definition.shape.kind);
1420
+ if (read.kind === "empty") return [];
1421
+ const block = {
1422
+ blockKind: pageSectionBlockKind(definition.shape.kind),
1423
+ content: sectionBlockContent(definition.label, read.value)
1424
+ };
1425
+ return [{
1426
+ look: resolvePageSectionLook(definition.shape.kind, lookOverrides[definition.id]),
1427
+ block: {
1428
+ id: `page-section-${definition.id}`,
1429
+ orderIndex: definition.position,
1430
+ scope: "template",
1431
+ blockKind: block.blockKind,
1432
+ content: block.content,
1433
+ bindings: null
1434
+ }
1435
+ }];
1436
+ });
1437
+ return {
1438
+ blocks: sections.map((section) => section.block),
1439
+ lookPins: sections.flatMap(({ block, look }) => look === null ? [] : [{
1440
+ blockId: asContentTemplateDesignBlockId(block.id),
1441
+ blockKind: block.blockKind,
1442
+ choice: {
1443
+ kind: "user-pinned",
1444
+ value: asAppearancePresetId(look)
1445
+ }
1446
+ }])
1447
+ };
1448
+ }
1449
+ function buildContentTemplateRuntime(template, theme, contentForBlock) {
1450
+ const parsed = parseContentTemplateDesignIntent(template.designState);
1451
+ if (parsed.kind !== "parsed" || theme === null) return {
1452
+ fieldsByBlockId: /* @__PURE__ */ new Map(),
1453
+ joins: []
1454
+ };
1455
+ const compiled = compileContentTemplateRuntimeFields({
1456
+ intent: parsed.intent,
1457
+ resolveJoinFacts: resolveRuntimeJoinFacts,
1458
+ surfaceResolutionContext: surfaceResolutionContextFromTheme(theme),
1459
+ blocks: template.blocks.map((block) => {
1460
+ const content = contentForBlock(block);
1461
+ const storedVariant = resolveTemplateBlockLayoutVariantKey({
1462
+ ...block,
1463
+ content
1464
+ });
1465
+ const definition = systemBlockDefinitions.find((definition) => definition.manifest.name === block.blockKind);
1466
+ const designInputs = blockDesignInputsForDefinition(block.blockKind, definition, content);
1467
+ return {
1468
+ blockId: asContentTemplateDesignBlockId(block.id),
1469
+ blockKind: block.blockKind,
1470
+ content,
1471
+ scope: block.scope,
1472
+ orderIndex: block.orderIndex,
1473
+ ...designInputs,
1474
+ storedVariant
1475
+ };
1476
+ })
1477
+ });
1478
+ return {
1479
+ fieldsByBlockId: new Map(compiled.blocks.map((block) => [block.blockId, block.fields])),
1480
+ joins: compiled.joins
1481
+ };
1482
+ }
1483
+ function resolveTemplateBlockLayoutVariantKey(block) {
1484
+ const key = toLayoutVariantKey(readLiteralBindingString(block.bindings?.variant)) ?? toLayoutVariantKey(readStringProperty(block.content, "variant"));
1485
+ return key !== null ? {
1486
+ kind: "explicit",
1487
+ key
1488
+ } : { kind: "absent" };
1489
+ }
1490
+ function readStringProperty(value, key) {
1491
+ const property = value?.[key];
1492
+ if (typeof property !== "string") return null;
1493
+ const trimmed = property.trim();
1494
+ return trimmed.length > 0 ? trimmed : null;
1495
+ }
1496
+ function readLiteralBindingString(value) {
1497
+ if (!isRecord(value)) return null;
1498
+ if (value.source !== "literal") return null;
1499
+ const literal = value.value;
1500
+ if (typeof literal !== "string") return null;
1501
+ const trimmed = literal.trim();
1502
+ return trimmed.length > 0 ? trimmed : null;
1503
+ }
1504
+ function toLayoutVariantKey(value) {
1505
+ if (value === null || value.length === 0) return null;
1506
+ try {
1507
+ return asLayoutVariantKey(value);
1508
+ } catch {
1509
+ return null;
1510
+ }
1511
+ }
1512
+ /** A block that renders as a diagnostic (authoring) or is omitted (public). */
1513
+ function invalidRenderableBlock(block, error) {
1514
+ return {
1515
+ ...block,
1516
+ admission: {
1517
+ kind: "invalid",
1518
+ error
1519
+ }
1520
+ };
1521
+ }
1522
+ /** The content contract of a registered system block, or null when unknown. */
1523
+ function resolveRegisteredBlockContentContract(blockKind) {
1524
+ const manifest = getBlockDefinition(blockKind)?.manifest;
1525
+ return manifest !== void 0 ? registeredManifestContentContract(manifest) : null;
1526
+ }
1527
+ const CONTENT_ENTRY_SUBJECT_BINDING_SCHEMA = {
1528
+ kind: "contentEntry",
1529
+ fieldSource: "entry.content",
1530
+ metaSource: "entry.meta.v1",
1531
+ metaKeys: [
1532
+ "id",
1533
+ "title",
1534
+ "slug",
1535
+ "path",
1536
+ "publishAt",
1537
+ "status",
1538
+ "createdAt",
1539
+ "updatedAt",
1540
+ "subject"
1541
+ ]
1542
+ };
1543
+ function buildContentEntryRenderableSurface({ entry, dateContext, subject, page }) {
1544
+ const contentEntryId = unsafeAsContentEntryId(entry.id);
1545
+ const route = buildContentEntryRouteRenderMetadata(entry, page);
1546
+ const bindingContext = buildContentEntrySubjectBindingContext(entry, contentEntryId, route, dateContext, subject);
1547
+ return {
1548
+ kind: "contentEntry",
1549
+ route,
1550
+ subject: {
1551
+ kind: "contentEntry",
1552
+ id: contentEntryId,
1553
+ entry
1554
+ },
1555
+ bindingSchema: CONTENT_ENTRY_SUBJECT_BINDING_SCHEMA,
1556
+ bindingContext,
1557
+ slotContainer: {
1558
+ kind: "entrySlots",
1559
+ owner: {
1560
+ kind: "contentEntry",
1561
+ contentEntryId
1562
+ }
1563
+ }
1564
+ };
1565
+ }
1566
+ function resolveRenderableSurfaceOutlineMetadata(surface, template) {
1567
+ return {
1568
+ name: surface.route.outlineName ?? surface.route.title,
1569
+ path: surface.route.outlinePath ?? surface.route.path ?? (surface.route.slug !== null && surface.route.slug.length > 0 ? `/${surface.route.slug}` : "/"),
1570
+ purpose: surface.route.outlinePurpose ?? template.templateKey
1571
+ };
1572
+ }
1573
+ function buildContentEntrySubjectBindingContext(entry, id, route, dateContext, subject) {
1574
+ return {
1575
+ dateContext,
1576
+ fields: isRecord(entry.content) ? entry.content : {},
1577
+ meta: {
1578
+ ...subject === void 0 ? {} : { subject },
1579
+ id,
1580
+ title: route.title,
1581
+ slug: route.slug,
1582
+ path: route.path,
1583
+ publishAt: route.publishAt,
1584
+ status: route.status,
1585
+ ...entry.createdAt === void 0 ? {} : { createdAt: entry.createdAt },
1586
+ ...entry.updatedAt === void 0 ? {} : { updatedAt: entry.updatedAt }
1587
+ }
1588
+ };
1589
+ }
1590
+ function buildContentEntryRouteRenderMetadata(entry, page) {
1591
+ return {
1592
+ title: entry.title,
1593
+ slug: entry.slug,
1594
+ path: entry.path,
1595
+ publishAt: entry.publishAt,
1596
+ status: entry.status,
1597
+ outlineName: page?.name,
1598
+ outlinePath: page?.path,
1599
+ outlinePurpose: page?.purpose
1600
+ };
1601
+ }
1602
+ function materializeTemplateBlockContent(input) {
1603
+ const rawContent = isRecord(input.block.content) ? { ...input.block.content } : {};
1604
+ return applyTemplateRuntimeFields(input.block.scope === "entry" && isRecord(input.block.bindings) ? applyBindingsToContent(rawContent, input.block.bindings, input.context) : rawContent, input.runtimeFields);
1605
+ }
1606
+ /**
1607
+ * Admits materialized template content for rendering only.
1608
+ *
1609
+ * Entry-scoped blocks bind values from an entry that the loaders have already
1610
+ * hydrated, so a bound media field legitimately carries `assetId`,
1611
+ * `storagePath` and friends. Stored admission rejects exactly those keys as
1612
+ * non-portable, which is right for persistence and wrong here: this content is
1613
+ * on its way to a renderer and can never reach a writer, because the
1614
+ * transported admitter returns `RenderableManifestContent` rather than granting
1615
+ * a stored proof. Portability stays enforced where it belongs — write admission
1616
+ * and the backup export gate, both of which see the raw stored content.
1617
+ */
1618
+ function admitMaterializedTemplateContent(materialized, contract) {
1619
+ return admitTransportedRenderableManifestContent(contract, materialized);
1620
+ }
1621
+ /**
1622
+ * Builds a renderable page outline from a content entry and its template.
1623
+ *
1624
+ * This is the single binding/runtime merge path used by both public rendering and
1625
+ * dashboard preview. Template-scoped blocks render their stored content exactly;
1626
+ * entry-scoped blocks render stored defaults with bound entry data layered on top.
1627
+ * Theme V2 runtime fields are applied after that content decision so preview and
1628
+ * public render cannot drift.
1629
+ */
1630
+ function buildTemplatePageOutline(input) {
1631
+ const { entry, resolveEntrySlotBlocks, resolveBlockContentContract = resolveRegisteredBlockContentContract } = input;
1632
+ const { template, pageSections, surface, context, runtime } = prepareTemplatePage(input);
1633
+ if (!template.blocks.length) return null;
1634
+ const outlineBlocks = withTitleFacts(template, pageSections, runtime.fieldsByBlockId).blocks.flatMap((block) => buildBlocksFromTemplateBlock({
1635
+ block,
1636
+ context,
1637
+ entry,
1638
+ template,
1639
+ runtimeFields: runtime.fieldsByBlockId.get(block.id),
1640
+ resolveEntrySlotBlocks,
1641
+ resolveBlockContentContract
1642
+ }));
1643
+ if (!outlineBlocks.length) return null;
1644
+ return {
1645
+ ...resolveRenderableSurfaceOutlineMetadata(surface, template),
1646
+ runtimeJoins: runtime.joins,
1647
+ blocks: outlineBlocks
1648
+ };
1649
+ }
1650
+ /** Public and editor outlines materialize the same subject bindings and design runtime. */
1651
+ function prepareTemplatePage({ entry, dateContext, subject, template: sourceTemplate, pageSections: sectionContext, page, theme }) {
1652
+ const pageSections = sectionContext === void 0 ? void 0 : {
1653
+ ...sectionContext,
1654
+ values: readStoredSectionValues(entry.content)
1655
+ };
1656
+ const template = expandPageSections(sourceTemplate, pageSections, theme ?? null);
1657
+ const surface = buildContentEntryRenderableSurface({
1658
+ entry,
1659
+ page,
1660
+ dateContext,
1661
+ subject
1662
+ });
1663
+ const context = surface.bindingContext;
1664
+ return {
1665
+ template,
1666
+ pageSections,
1667
+ surface,
1668
+ context,
1669
+ runtime: buildContentTemplateRuntime(template, theme ?? null, (block) => materializeTemplateBlockContent({
1670
+ block,
1671
+ context,
1672
+ runtimeFields: null
1673
+ }))
1674
+ };
1675
+ }
1676
+ function buildBlocksFromTemplateBlock({ block, context, entry, template, runtimeFields, resolveEntrySlotBlocks, resolveBlockContentContract }) {
1677
+ const slotKey = readEntrySlotKey(block);
1678
+ if (slotKey !== null) return resolveEntrySlotBlocks?.({
1679
+ entry,
1680
+ template,
1681
+ templateBlock: block,
1682
+ slotKey
1683
+ }) ?? [];
1684
+ if (isSystemTemplateBlockKind(block.blockKind)) return [];
1685
+ return [buildBlockFromTemplate(block, context, runtimeFields, resolveBlockContentContract(block.blockKind))];
1686
+ }
1687
+ function readEntrySlotKey(block) {
1688
+ if (block.blockKind !== "system.entry-slot" || block.scope !== "template") return null;
1689
+ const parsed = parseSlotKey(block.content?.slotKey);
1690
+ return parsed.ok ? parsed.value : null;
1691
+ }
1692
+ function buildBlockFromTemplate(block, context, runtimeFields, contract) {
1693
+ const base = {
1694
+ id: block.id,
1695
+ kind: block.blockKind,
1696
+ purpose: "content",
1697
+ publishedPlacement: null,
1698
+ ...isRecord(block.bindings) ? { bindings: block.bindings } : {}
1699
+ };
1700
+ if (contract === null) return invalidRenderableBlock(base, { kind: "manifest_unavailable" });
1701
+ const admission = admitMaterializedTemplateContent(materializeTemplateBlockContent({
1702
+ block,
1703
+ context,
1704
+ runtimeFields
1705
+ }), contract);
1706
+ return admission.ok ? {
1707
+ ...base,
1708
+ admission: {
1709
+ kind: "renderable",
1710
+ content: admission.value
1711
+ }
1712
+ } : invalidRenderableBlock(base, {
1713
+ kind: "invalid_manifest_content",
1714
+ error: admission.error
1715
+ });
1716
+ }
1717
+ function applyTemplateRuntimeFields(content, runtimeFields) {
1718
+ return applyMissingImageBackgroundFallback(canonicalizeSectionBackground(runtimeFields !== null && runtimeFields !== void 0 ? applyCompiledRuntimeFieldsToContent(content, runtimeFields) : content));
1719
+ }
1720
+ function canonicalizeSectionBackground(content) {
1721
+ const sectionStyles = isRecord(content._sectionStyles) ? content._sectionStyles : null;
1722
+ if (sectionStyles === null || sectionStyles.background === void 0) return content;
1723
+ const background = parseBackgroundContent(sectionStyles.background);
1724
+ return background !== null ? {
1725
+ ...content,
1726
+ _sectionStyles: {
1727
+ ...sectionStyles,
1728
+ background
1729
+ }
1730
+ } : content;
1731
+ }
1732
+ function applyMissingImageBackgroundFallback(content) {
1733
+ const sectionStyles = isRecord(content._sectionStyles) ? content._sectionStyles : null;
1734
+ const background = parseBackgroundContent(sectionStyles?.background);
1735
+ if (sectionStyles === null || background?.type !== "image" || background.image !== null && background.image !== void 0) return content;
1736
+ const fallbackColor = resolveMissingImageFallbackColor(background);
1737
+ return {
1738
+ ...content,
1739
+ _sectionStyles: {
1740
+ ...sectionStyles,
1741
+ background: {
1742
+ type: "color",
1743
+ color: fallbackColor,
1744
+ textColor: background.textColor,
1745
+ headingColor: background.headingColor,
1746
+ linkColor: background.linkColor,
1747
+ supportingColor: background.supportingColor
1748
+ }
1749
+ }
1750
+ };
1751
+ }
1752
+ function resolveMissingImageFallbackColor(background) {
1753
+ const overlayColor = background.overlay?.type === "color" ? background.overlay.color?.trim() ?? null : null;
1754
+ if (overlayColor !== null && overlayColor !== "") return overlayColor;
1755
+ return background.textColor === "primaryForeground" ? "primary" : "surface";
1756
+ }
1757
+ /** Replace the anchor before runtime joins and manifest admission see the outline. */
1758
+ function expandPageSections(template, input, theme) {
1759
+ if (!template.blocks.some((block) => block.blockKind === "system.page-sections")) return template;
1760
+ const sections = input !== void 0 ? compilePageSections(input, pageSectionLookOverrides(template.blocks)) : {
1761
+ blocks: [],
1762
+ lookPins: []
1763
+ };
1764
+ const design = parseContentTemplateDesignIntent(template.designState);
1765
+ const intent = design.kind === "parsed" ? design.intent : sections.lookPins.length > 0 && theme?.siteStyleId !== void 0 ? buildInitialPolicyPageDesignIntent(theme.siteStyleId) : null;
1766
+ const sectionIds = new Set(sections.blocks.map((block) => block.id));
1767
+ return {
1768
+ ...template,
1769
+ designState: sections.lookPins.length > 0 && intent !== null ? contentTemplateDesignIntentToJsonRecord({
1770
+ ...intent,
1771
+ blockLookPins: [...intent.blockLookPins.filter((pin) => !sectionIds.has(pin.blockId)), ...sections.lookPins]
1772
+ }) : template.designState,
1773
+ blocks: template.blocks.flatMap((block) => block.blockKind === "system.page-sections" ? sections.blocks : [block]).map((block, orderIndex) => ({
1774
+ ...block,
1775
+ orderIndex
1776
+ }))
1777
+ };
1778
+ }
1779
+ /** The title owner is selected once, after the template's Look arrangements are known. */
1780
+ function withTitleFacts(template, input, runtime) {
1781
+ const facts = input !== void 0 ? projectPageFacts(input) : [];
1782
+ const title = template.blocks.find((block) => isPageTitleBlock(block, runtime.get(block.id)));
1783
+ if (facts.length === 0 || title === void 0) return template;
1784
+ return {
1785
+ ...template,
1786
+ blocks: template.blocks.map((block) => block.id === title.id ? {
1787
+ ...block,
1788
+ content: {
1789
+ ...block.content,
1790
+ _pageFacts: facts
1791
+ }
1792
+ } : block)
1793
+ };
1794
+ }
1795
+ function isPageTitleBlock(block, runtime) {
1796
+ if (block.blockKind === "block.event-details") return runtime?._arrangementLooks?.byMode.default?.look.structure.byMode.default === "event-header";
1797
+ return block.blockKind === "block.hero" && block.scope === "entry" && (isEntryTitleBinding(block.bindings?.headlineInline) || isEntryTitleBinding(block.bindings?.headline));
1798
+ }
1799
+ function isEntryTitleBinding(binding) {
1800
+ if (!isRecord(binding)) return false;
1801
+ return binding.source === "meta" && binding.path === "title" || binding.source === "transform" && isEntryTitleBinding(binding.input);
1802
+ }
1803
+ blockDesignCapabilityMapFromDefinitions(systemBlockDefinitions);
1804
+ createManifestDefaultValues(siteHeaderManifest);
1805
+ createManifestDefaultValues(siteFooterManifest);
1806
+ //#endregion
1807
+ //#region src/rendering/helpers/templateContent.ts
1808
+ function createTemplateRenderTarget(source, templateId) {
1809
+ switch (source.kind) {
1810
+ case "entry-template": return {
1811
+ kind: source.kind,
1812
+ templateId,
1813
+ entryId: source.entryId,
1814
+ entryType: source.entryType
1815
+ };
1816
+ case "page-surface-template": return {
1817
+ kind: source.kind,
1818
+ templateId,
1819
+ pageSurfaceId: source.pageSurfaceId,
1820
+ routeId: source.routeId,
1821
+ subject: source.subject
1822
+ };
1823
+ }
1824
+ }
1825
+ function processEntryTemplate(input) {
1826
+ return processTemplatePage({
1827
+ ...input,
1828
+ slotContent: input.entrySlots,
1829
+ pageName: "Entry Template",
1830
+ pagePath: input.entry.path || "/",
1831
+ pagePurpose: "entry-template",
1832
+ renderTargetSource: {
1833
+ kind: "entry-template",
1834
+ entryId: input.entry.id,
1835
+ entryType: input.entry.type
1836
+ }
1837
+ });
1838
+ }
1839
+ async function processTemplatePage(input) {
1840
+ const template = input.templates?.[0];
1841
+ if (!template?.blocks?.length) return {
1842
+ templatePage: null,
1843
+ resolvedData: {}
1844
+ };
1845
+ const templatePage = materializeSdkTemplate(input, template);
1846
+ if (templatePage === null) return {
1847
+ templatePage: null,
1848
+ resolvedData: {}
1849
+ };
1850
+ const prefetched = await resolveBlockDataWithDeps(input.deps, {
1851
+ bookingTimeZone: input.bookingTimeZone,
1852
+ now: input.now,
1853
+ page: projectRenderablePageOutline(templatePage),
1854
+ siteId: input.siteId,
1855
+ renderTarget: createTemplateRenderTarget(input.renderTargetSource, template.id),
1856
+ previewStage: input.previewStage,
1857
+ policy: input.blockDataPolicy,
1858
+ client: input.client,
1859
+ customBlocks: input.customBlocks
1860
+ });
1861
+ return {
1862
+ templatePage,
1863
+ prefetchedBlockData: prefetched,
1864
+ ...prefetched
1865
+ };
1866
+ }
1867
+ /** Pure adapter: the shared renderer owns bindings, applicability, Looks and admission. */
1868
+ function materializeSdkTemplate(input, template) {
1869
+ return buildTemplatePageOutline({
1870
+ entry: input.entry,
1871
+ subject: templateCompilerSubject(input.renderTargetSource),
1872
+ dateContext: resolveDateRuntimeContext(input.bookingTimeZone),
1873
+ template: toContentTemplate(template),
1874
+ page: {
1875
+ name: template.name || input.pageName,
1876
+ path: input.pagePath,
1877
+ purpose: input.pagePurpose
1878
+ },
1879
+ theme: input.theme,
1880
+ pageSections: input.pageSections,
1881
+ resolveEntrySlotBlocks: ({ slotKey }) => selectBlocksForDeclaredEntrySlot({
1882
+ declaredSlotKey: slotKey,
1883
+ entrySlots: input.slotContent ?? []
1884
+ }).map((block) => admitEntrySlotBlock(block, input.customBlocks, input.previewStage)),
1885
+ resolveBlockContentContract: (kind) => {
1886
+ const manifest = resolveSdkBlockManifest(kind, input.customBlocks);
1887
+ return manifest === null ? null : compileManifestContentContract(manifest);
1888
+ }
1889
+ });
1890
+ }
1891
+ function templateCompilerSubject(source) {
1892
+ switch (source.kind) {
1893
+ case "entry-template": return;
1894
+ case "page-surface-template": return source.subject;
1895
+ }
1896
+ }
1897
+ /** Adapt the SDK transport to the shared template renderer; decisions stay there. */
1898
+ function toContentTemplate(template) {
1899
+ return {
1900
+ id: template.id,
1901
+ name: template.name,
1902
+ templateKey: template.templateKey,
1903
+ designState: template.designState,
1904
+ blocks: template.blocks.map((block, orderIndex) => ({
1905
+ ...block,
1906
+ orderIndex,
1907
+ content: sanitizeSdkRuntimeBlockContent(block.blockKind, block.content ?? {}),
1908
+ bindings: block.bindings ?? null
1909
+ }))
1910
+ };
1911
+ }
1912
+ function admitEntrySlotBlock(block, customBlocks, previewStage) {
1913
+ const base = {
1914
+ id: block.id ?? block.blockId ?? null,
1915
+ contentVersionId: block.contentVersionId,
1916
+ ...entrySlotBlockIdentity(block, previewStage),
1917
+ kind: block.kind,
1918
+ purpose: block.purpose,
1919
+ ...isRecord(block.bindings) ? { bindings: block.bindings } : {}
1920
+ };
1921
+ const transportedAdmission = readInvalidBlockAdmission(block.admission);
1922
+ if (transportedAdmission) return invalidRenderableBlock$1(base, transportedAdmission.error);
1923
+ const manifest = resolveSdkBlockManifest(block.kind, customBlocks);
1924
+ if (manifest === null) return invalidRenderableBlock$1(base, { kind: "manifest_unavailable" });
1925
+ const renderable = admitTransportedRenderableManifestContent(compileManifestContentContract(manifest), block.content ?? {});
1926
+ return renderable.ok ? {
1927
+ ...base,
1928
+ admission: {
1929
+ kind: "renderable",
1930
+ content: renderable.value
1931
+ }
1932
+ } : invalidRenderableBlock$1(base, {
1933
+ kind: "invalid_manifest_content",
1934
+ error: renderable.error
1935
+ });
1936
+ }
1937
+ function entrySlotBlockIdentity(block, previewStage) {
1938
+ return {
1939
+ draftContentId: block.draftContentId ?? null,
1940
+ publishedPlacement: previewStage === "preview" ? readPublishedBlockPlacement(block.publishedContentId, isRecord(block.publishedContent) && isRecord(block.publishedContent.data) ? block.publishedContent.data : null) : null
1941
+ };
1942
+ }
1943
+ //#endregion
1944
+ //#region src/rendering/helpers/loadContent.ts
1945
+ /**
1946
+ * Type guard to check if result is a page
1947
+ */
1948
+ function isPageContent(result) {
1949
+ return result.type === "page";
1950
+ }
1951
+ /**
1952
+ * Type guard to check if result is an entry
1953
+ */
1954
+ function isEntryContent(result) {
1955
+ return result.type === "entry";
1956
+ }
1957
+ function isPageSurfaceContent(result) {
1958
+ return result.type === "pageSurface";
1959
+ }
1960
+ function isContentLoadNotFoundError(error) {
1961
+ if (typeof error !== "object" || error === null || !("status" in error)) return false;
1962
+ return Reflect.get(error, "status") === 404;
1963
+ }
1964
+ function getRejectedReason(result) {
1965
+ return result.reason;
1966
+ }
1967
+ function toTemplateContentRenderSupport(support, siteId) {
1968
+ return {
1969
+ bookingOfferingPresets: support.bookingOfferingPresets,
1970
+ openingHours: support.openingHours,
1971
+ siteTerms: support.siteTerms,
1972
+ mailingList: support.mailingList,
1973
+ interactionContext: support.interactionContext,
1974
+ bookingTimeZone: support.bookingTimeZone,
1975
+ now: support.now,
1976
+ ...support.customBlocks ? { customBlocks: support.customBlocks } : {},
1977
+ entriesByIdentifier: support.entriesByIdentifier,
1978
+ ...support.mediaAssets ? { mediaAssets: support.mediaAssets } : {},
1979
+ pagesByIdentifier: support.pagesByIdentifier,
1980
+ routeMap: support.routeMap,
1981
+ sdkConfig: support.sdkConfig,
1982
+ site: support.site,
1983
+ siteId,
1984
+ supabaseUrl: support.supabaseUrl,
1985
+ theme: support.theme
1986
+ };
1987
+ }
1988
+ /**
1989
+ * Server-side helper to fetch content by path.
1990
+ *
1991
+ * Returns a discriminated union - either page data (ready for `<Page>` component)
1992
+ * or raw entry data (for custom rendering).
1993
+ *
1994
+ * @example Dynamic routing with both pages and entries
1995
+ * ```tsx
1996
+ * import { loadContent, Page, isPageContent } from '@riverbankcms/sdk';
1997
+ *
1998
+ * export default async function DynamicRoute({ params }) {
1999
+ * const content = await loadContent({
2000
+ * client,
2001
+ * siteId: 'site-123',
2002
+ * path: `/${params.slug?.join('/') || ''}`,
2003
+ * });
2004
+ *
2005
+ * if (isPageContent(content)) {
2006
+ * if (!content.theme) throw new MissingSdkThemeError(content.siteId, 'cms_theme_absent');
2007
+ * return <Page {...content} />;
2008
+ * }
2009
+ *
2010
+ * // Render entry with custom UI
2011
+ * return (
2012
+ * <article>
2013
+ * <h1>{content.entry.title}</h1>
2014
+ * <div>{content.entry.content.body}</div>
2015
+ * </article>
2016
+ * );
2017
+ * }
2018
+ * ```
2019
+ *
2020
+ * @example Entry-specific rendering based on content type
2021
+ * ```tsx
2022
+ * const content = await loadContent({ client, siteId, path });
2023
+ *
2024
+ * if (content.type === 'entry') {
2025
+ * switch (content.entry.type) {
2026
+ * case 'blog-post':
2027
+ * return <BlogPost entry={content.entry} theme={content.theme} />;
2028
+ * case 'product':
2029
+ * return <ProductPage entry={content.entry} theme={content.theme} />;
2030
+ * default:
2031
+ * return <GenericEntry entry={content.entry} />;
2032
+ * }
2033
+ * }
2034
+ *
2035
+ * if (!content.theme) throw new MissingSdkThemeError(content.siteId, 'cms_theme_absent');
2036
+ * return <Page {...content} />;
2037
+ * ```
2038
+ *
2039
+ * @example Preview mode for draft content
2040
+ * ```tsx
2041
+ * const content = await loadContent({
2042
+ * client,
2043
+ * siteId,
2044
+ * path,
2045
+ * preview: true, // Fetches draft content for both pages and entries
2046
+ * });
2047
+ * ```
2048
+ */
2049
+ async function loadContent(params) {
2050
+ return loadContentWithDeps(DEFAULT_RESOLVE_BLOCK_DATA_DEPS, params);
2051
+ }
2052
+ async function loadContentWithDeps(deps, params) {
2053
+ const { client, siteId, path, preview = false, forceSite, dataLoaderOverrides, searchParams } = params;
2054
+ const [siteResult, contentResult] = await Promise.allSettled([client.getSite({
2055
+ id: siteId,
2056
+ currentPath: path,
2057
+ ...forceSite ? { force: true } : {}
2058
+ }), client.getPage({
2059
+ siteId,
2060
+ path,
2061
+ preview
2062
+ })]);
2063
+ if (siteResult.status === "rejected" || contentResult.status === "rejected") {
2064
+ const failures = [siteResult, contentResult].filter((result) => result.status === "rejected").map(getRejectedReason);
2065
+ throw failures.find((error) => !isContentLoadNotFoundError(error)) ?? failures[0];
2066
+ }
2067
+ const site = siteResult.value;
2068
+ const contentResponse = contentResult.value;
2069
+ return loadContentFromContentResponseWithDeps(deps, {
2070
+ client,
2071
+ siteId,
2072
+ site,
2073
+ contentResponse,
2074
+ preview,
2075
+ dataLoaderOverrides,
2076
+ searchParams
2077
+ });
2078
+ }
2079
+ async function loadContentFromContentResponseWithDeps(deps, params) {
2080
+ const { client, siteId, site, contentResponse, preview = false, dataLoaderOverrides, searchParams } = params;
2081
+ const previewStage = preview ? "preview" : "published";
2082
+ const blockDataPolicy = createBlockDataLoadPolicy(dataLoaderOverrides, normalizeDataLoaderSearchParams(searchParams));
2083
+ const support = buildSiteRenderSupport(site, collectMediaAssetSidecar(contentResponse.mediaAssets), contentLocationSupport(contentResponse));
2084
+ const templateContentSupport = toTemplateContentRenderSupport(support, siteId);
2085
+ if (isEntryResponse(contentResponse)) {
2086
+ const entryData = contentResponse.entry;
2087
+ const draftContent = entryData.draftContent;
2088
+ const hasDraftContent = draftContent && Object.keys(draftContent).length > 0;
2089
+ const entry = {
2090
+ id: entryData.id,
2091
+ type: entryData.type,
2092
+ title: entryData.title,
2093
+ slug: entryData.slug,
2094
+ path: entryData.path,
2095
+ status: entryData.status,
2096
+ publishAt: entryData.publishAt,
2097
+ lastPublishedAt: entryData.lastPublishedAt,
2098
+ content: preview && hasDraftContent ? draftContent : entryData.content,
2099
+ metaTitle: preview ? entryData.draftMetaTitle ?? entryData.metaTitle : entryData.metaTitle,
2100
+ metaDescription: preview ? entryData.draftMetaDescription ?? entryData.metaDescription : entryData.metaDescription,
2101
+ createdAt: entryData.createdAt,
2102
+ updatedAt: entryData.updatedAt
2103
+ };
2104
+ const { templatePage, resolvedData, prefetchedBlockData, loaderSnapshot, loaderFailures } = await processEntryTemplate({
2105
+ theme: support.theme,
2106
+ bookingTimeZone: support.bookingTimeZone,
2107
+ now: support.now,
2108
+ templates: contentResponse.templates,
2109
+ entrySlots: contentResponse.entrySlots,
2110
+ entry,
2111
+ siteId,
2112
+ previewStage,
2113
+ blockDataPolicy,
2114
+ client,
2115
+ deps,
2116
+ customBlocks: support.customBlocks
2117
+ });
2118
+ return {
2119
+ type: "entry",
2120
+ entry,
2121
+ templatePage,
2122
+ resolvedData,
2123
+ dataContext: {
2124
+ ...siteLocationRenderContext(support),
2125
+ previewStage,
2126
+ prefetchedBlockData,
2127
+ loaderSnapshot,
2128
+ loaderFailures,
2129
+ contentEntry: {
2130
+ ...entry.content ?? {},
2131
+ id: entry.id,
2132
+ slug: entry.slug,
2133
+ contentTypeSlug: entry.type,
2134
+ _entryId: entry.id,
2135
+ _entrySlug: entry.slug,
2136
+ _contentTypeSlug: entry.type
2137
+ }
2138
+ },
2139
+ ...templateContentSupport
2140
+ };
2141
+ }
2142
+ if (isPageSurfaceResponse(contentResponse)) {
2143
+ const pageSurfaceData = contentResponse.pageSurface;
2144
+ const pageSurface = {
2145
+ id: pageSurfaceData.id,
2146
+ routeId: pageSurfaceData.routeId,
2147
+ readinessState: pageSurfaceData.readinessState,
2148
+ subject: pageSurfaceData.subject,
2149
+ title: pageSurfaceData.title,
2150
+ slug: pageSurfaceData.slug,
2151
+ path: pageSurfaceData.path,
2152
+ status: pageSurfaceData.status,
2153
+ publishAt: pageSurfaceData.publishAt,
2154
+ lastPublishedAt: pageSurfaceData.lastPublishedAt,
2155
+ content: pageSurfaceData.content,
2156
+ metaTitle: preview ? pageSurfaceData.draftMetaTitle ?? pageSurfaceData.metaTitle : pageSurfaceData.metaTitle,
2157
+ metaDescription: preview ? pageSurfaceData.draftMetaDescription ?? pageSurfaceData.metaDescription : pageSurfaceData.metaDescription,
2158
+ createdAt: pageSurfaceData.createdAt,
2159
+ updatedAt: pageSurfaceData.updatedAt,
2160
+ contentSource: pageSurfaceData.contentSource
2161
+ };
2162
+ const { templatePage, resolvedData, prefetchedBlockData, loaderSnapshot, loaderFailures } = await processTemplatePage({
2163
+ entry: pageSurface,
2164
+ theme: support.theme,
2165
+ pageSections: contentResponse.pageSections,
2166
+ bookingTimeZone: support.bookingTimeZone,
2167
+ now: support.now,
2168
+ templates: contentResponse.templates,
2169
+ slotContent: contentResponse.surfaceSlots,
2170
+ pageName: pageSurface.title || "Page Surface Template",
2171
+ pagePath: pageSurface.path || "/",
2172
+ pagePurpose: "page-surface-template",
2173
+ siteId,
2174
+ previewStage,
2175
+ blockDataPolicy,
2176
+ renderTargetSource: {
2177
+ kind: "page-surface-template",
2178
+ pageSurfaceId: pageSurface.id,
2179
+ routeId: pageSurface.routeId,
2180
+ subject: pageSurface.subject
2181
+ },
2182
+ client,
2183
+ deps,
2184
+ customBlocks: support.customBlocks
2185
+ });
2186
+ return {
2187
+ type: "pageSurface",
2188
+ pageSurface,
2189
+ templatePage,
2190
+ resolvedData,
2191
+ dataContext: {
2192
+ ...siteLocationRenderContext(support),
2193
+ previewStage,
2194
+ prefetchedBlockData,
2195
+ loaderSnapshot,
2196
+ loaderFailures,
2197
+ pageSurface: {
2198
+ ...pageSurface.content ?? {},
2199
+ id: pageSurface.id,
2200
+ slug: pageSurface.slug,
2201
+ subject: pageSurface.subject,
2202
+ _pageSurfaceId: pageSurface.id,
2203
+ _pageSurfaceSlug: pageSurface.slug
2204
+ },
2205
+ subject: pageSurface.subject
2206
+ },
2207
+ ...templateContentSupport
2208
+ };
2209
+ }
2210
+ const { page: pageData } = contentResponse;
2211
+ const pageRecord = pageData;
2212
+ const canonicalPagePath = pageData.path ?? pageRecord.path ?? "/";
2213
+ const pageOutline = buildRenderablePageOutline({
2214
+ name: pageData.name,
2215
+ path: canonicalPagePath,
2216
+ fallbackPath: "/",
2217
+ purpose: pageData.purpose,
2218
+ blocks: pageData.blocks,
2219
+ previewStage,
2220
+ customBlocks: support.customBlocks
2221
+ });
2222
+ const prefetched = await resolveBlockDataWithDeps(deps, {
2223
+ bookingTimeZone: support.bookingTimeZone,
2224
+ now: support.now,
2225
+ page: projectRenderablePageOutline(pageOutline),
2226
+ siteId,
2227
+ renderTarget: {
2228
+ kind: "page",
2229
+ pageId: pageData.id
2230
+ },
2231
+ previewStage,
2232
+ policy: blockDataPolicy,
2233
+ client,
2234
+ customBlocks: support.customBlocks
2235
+ });
2236
+ return {
2237
+ type: "page",
2238
+ pageId: pageRecord.id,
2239
+ routeId: pageRecord.routeId ?? null,
2240
+ pageMetadata: projectPagePreviewMetadata(pageRecord, pageData.name, canonicalPagePath),
2241
+ page: pageOutline,
2242
+ runtimeJoins: pageData.runtimeJoins,
2243
+ theme: support.theme,
2244
+ siteId,
2245
+ ...support.customBlocks ? { customBlocks: support.customBlocks } : {},
2246
+ resolvedData: prefetched.resolvedData,
2247
+ dataContext: {
2248
+ previewStage,
2249
+ ...siteLocationRenderContext(support),
2250
+ prefetchedBlockData: prefetched,
2251
+ loaderSnapshot: prefetched.loaderSnapshot,
2252
+ loaderFailures: prefetched.loaderFailures
2253
+ },
2254
+ bookingOfferingPresets: support.bookingOfferingPresets,
2255
+ openingHours: support.openingHours,
2256
+ siteTerms: support.siteTerms,
2257
+ mailingList: support.mailingList,
2258
+ interactionContext: support.interactionContext,
2259
+ bookingTimeZone: support.bookingTimeZone,
2260
+ now: support.now,
2261
+ site: support.site,
2262
+ sdkConfig: support.sdkConfig,
2263
+ supabaseUrl: support.supabaseUrl,
2264
+ routeMap: support.routeMap,
2265
+ pagesByIdentifier: support.pagesByIdentifier,
2266
+ entriesByIdentifier: support.entriesByIdentifier,
2267
+ ...support.mediaAssets ? { mediaAssets: support.mediaAssets } : {}
2268
+ };
2269
+ }
2270
+ function projectPagePreviewMetadata(page, pageName, canonicalPath) {
2271
+ return {
2272
+ ...projectDraftPageMetadata(page, pageName, canonicalPath),
2273
+ ...projectPublishedPageMetadata(page, pageName, canonicalPath)
2274
+ };
2275
+ }
2276
+ function projectDraftPageMetadata(page, pageName, canonicalPath) {
2277
+ return {
2278
+ draftTitle: page.draftTitle ?? page.name ?? pageName,
2279
+ draftPath: page.draftPath ?? page.path ?? canonicalPath,
2280
+ draftStatus: page.draftStatus ?? page.status ?? "draft",
2281
+ draftMetaTitle: page.draftMetaTitle ?? null,
2282
+ draftMetaDescription: page.draftMetaDescription ?? null
2283
+ };
2284
+ }
2285
+ function projectPublishedPageMetadata(page, pageName, canonicalPath) {
2286
+ return {
2287
+ title: page.name ?? pageName,
2288
+ path: canonicalPath,
2289
+ status: page.status ?? page.draftStatus ?? "draft",
2290
+ publishedAt: page.publishedAt ?? null,
2291
+ lastPublishedAt: page.lastPublishedAt ?? null,
2292
+ publishedMetaTitle: page.publishedMetaTitle ?? null,
2293
+ publishedMetaDescription: page.publishedMetaDescription ?? null,
2294
+ ogImageId: page.ogImageId ?? null
2295
+ };
2296
+ }
2297
+ /**
2298
+ * Type guard to check if API response is an entry
2299
+ */
2300
+ function isEntryResponse(response) {
2301
+ return "entry" in response;
2302
+ }
2303
+ function isPageSurfaceResponse(response) {
2304
+ return response.type === "pageSurface";
2305
+ }
2306
+ function contentLocationSupport(response) {
2307
+ return "page" in response ? response.locationMapSupport : void 0;
2308
+ }
2309
+ //#endregion
2310
+ export { loadContent as i, isPageContent as n, isPageSurfaceContent as r, isEntryContent as t };