@riverbankcms/sdk 0.158.0 → 0.160.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 (196) hide show
  1. package/README.md +25 -6
  2. package/dist/_dts/{BlocksIslandsHydrator-BgNBtEai.d.ts → BlocksIslandsHydrator-CoqeotCL.d.ts} +1 -1
  3. package/dist/_dts/{Page-DpCo8zXD.d.ts → Page-C0ENVLCF.d.ts} +13 -6
  4. package/dist/_dts/{SdkPreviewMode-Bv2TMscG.d.ts → SdkPreviewMode-jZK0A49V.d.ts} +54 -126
  5. package/dist/_dts/{client-B960v2gW.d.ts → client-uMMuPq9V.d.ts} +23 -1
  6. package/dist/_dts/{content-types-CN0Wy8V6.d.ts → content-types-D6nXGqdQ.d.ts} +18 -18
  7. package/dist/_dts/{contracts-BFUrby76.d.ts → contracts-Bnmj1nxu.d.ts} +6 -5
  8. package/dist/_dts/{footerPageOutline-CmoqleLS.d.ts → footerPageOutline-CeLjFX8b.d.ts} +6 -6
  9. package/dist/_dts/{generatePageMetadata-Dkvivc3R.d.ts → generatePageMetadata-nyU8q02J.d.ts} +5 -2
  10. package/dist/_dts/{index-DPfI2t5A.d.ts → index-BaaGBY1v.d.ts} +2 -2
  11. package/dist/_dts/{index-DCNu_8it.d.ts → index-Bg64CkV-.d.ts} +4 -4
  12. package/dist/_dts/index-Blwl7yl6.d.ts +13 -0
  13. package/dist/_dts/{index-DaS_z6ir.d.ts → index-C5xslEBn.d.ts} +2 -2
  14. package/dist/_dts/{index-DpgkhY-a.d.ts → index-CEaKil7G.d.ts} +2 -2
  15. package/dist/_dts/{index-Ba6RmuxX.d.ts → index-DahMwisK.d.ts} +3 -3
  16. package/dist/_dts/index-lkpjIg5i.d.ts +66 -0
  17. package/dist/_dts/{index-DfkFWUxt.d.ts → index-nVoi_74l.d.ts} +2 -2
  18. package/dist/_dts/{loadContent-DvvKF4nB.d.ts → loadContent-CYLmzvLq.d.ts} +16 -7
  19. package/dist/_dts/{resolvePageContent-D0lGwVD6.d.ts → resolvePageContent-DqnxChOs.d.ts} +2 -2
  20. package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
  21. package/dist/_dts/{hosted-booking-appearance-BIbit60h.d.ts → schema-D0bNcPWK.d.ts} +6921 -6768
  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 +12 -6
  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/index.d.ts +8 -8
  29. package/dist/_dts/sdk/src/manifest/index.d.ts +6 -6
  30. package/dist/_dts/sdk/src/metadata/index.d.ts +8 -2
  31. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  32. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  33. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  34. package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
  35. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  36. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  37. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  38. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  40. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  41. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  42. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  43. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  44. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  45. package/dist/_dts/sdk/src/server.d.ts +5 -5
  46. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  47. package/dist/_dts/{types-BJrRUaY7.d.ts → types-CFrYuXYP.d.ts} +2 -2
  48. package/dist/_dts/{navigation-n-eTVTIQ.d.ts → types-D8czmbQF.d.ts} +15430 -16836
  49. package/dist/_dts/{types-BY7PgnDi.d.ts → types-DSgmJ15W.d.ts} +7 -7
  50. package/dist/_dts/{types-maEnXL6Z.d.ts → types-Dm-KW7nj.d.ts} +10 -13
  51. package/dist/_dts/{validation-BjuVrMrs.d.ts → validation-Bmb4WnHg.d.ts} +4 -4
  52. package/dist/client/{BlocksIslandsHydrator-WRLS96Ev.mjs → BlocksIslandsHydrator-DZRKi6tT.mjs} +17 -17
  53. package/dist/client/{BookingMailingListNote-eovghMPa.mjs → BookingMailingListNote-C00sLLdL.mjs} +2 -2
  54. package/dist/client/{CalendarNavigationChevron-CIcMQRc1.mjs → CalendarNavigationChevron-CHSi9b3E.mjs} +6 -6
  55. package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-Bhm6RAUL.mjs} +1 -1
  56. package/dist/client/{DemoBookingPortalAccess-CdnFgDyQ.mjs → DemoBookingPortalAccess-CaN-7ui7.mjs} +6 -6
  57. package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-ClxN5_xZ.mjs} +1 -1
  58. package/dist/client/{EventCalendar.client-Dc-ZLxKo.mjs → EventCalendar.client-BncvSa1n.mjs} +10 -9
  59. package/dist/client/{EventCombined.client-C93XqRIv.mjs → EventCombined.client-DluBxVVu.mjs} +8 -8
  60. package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-BiJrMtfp.mjs} +1 -1
  61. package/dist/client/{EventItem-DnCTygqk.mjs → EventItem-CXhnT9pF.mjs} +11 -6
  62. package/dist/client/{EventListWeekNavigation-9h97heuQ.mjs → EventListWeekNavigation-V-dtoDlD.mjs} +1 -1
  63. package/dist/client/{EventListing.client-DFKlQvvs.mjs → EventListing.client-DPO6SZbx.mjs} +3 -3
  64. package/dist/client/{EventListing.view-pAuTDyrP.mjs → EventListing.view-B-Yi5JZS.mjs} +7 -7
  65. package/dist/client/{EventRegistrationPayment-rgKlBvhP.mjs → EventRegistrationPayment-Dc3Fnlnw.mjs} +189 -176
  66. package/dist/client/{LeafletStaticMap-3XiWSgy0.mjs → LeafletStaticMap-ClZCCzAm.mjs} +1 -1
  67. package/dist/client/{Page-BmpeAwID.mjs → Page-7PkzO04N.mjs} +1949 -2074
  68. package/dist/client/{StepIndicator-qEq6X5zP.mjs → StepIndicator-DiD6euZ8.mjs} +3 -3
  69. package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-BHd8GN8y.mjs} +1 -1
  70. package/dist/client/{ThemedButton-DVBC_pS9.mjs → ThemedButton-C22C9cCF.mjs} +174 -93
  71. package/dist/client/{accordion-DeObOasQ.mjs → accordion-2m27DsIk.mjs} +1 -1
  72. package/dist/client/{booking-form.client-DfWeF0lj.mjs → booking-form.client-BddWV5w1.mjs} +12 -12
  73. package/dist/client/{bookingForm-TnzIBHx2.mjs → bookingForm-bcdXQjmw.mjs} +4 -4
  74. package/dist/client/bookings.mjs +6 -6
  75. package/dist/client/{carousel-kkFnbr5Z.mjs → carousel-D7nj9I0y.mjs} +2 -2
  76. package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-AffDJo_s.mjs} +1 -1
  77. package/dist/client/{cart-BAXNbFux.mjs → cart-PN6yCw1H.mjs} +3 -3
  78. package/dist/client/{cart.client-BczxUF70.mjs → cart.client-D4t1f0cJ.mjs} +1 -1
  79. package/dist/client/{checkout-C5NRhPeP.mjs → checkout-CsTwXVSb.mjs} +3 -3
  80. package/dist/client/{checkout.client-BuDk3Td9.mjs → checkout.client-BhQE3zY7.mjs} +1 -1
  81. package/dist/client/client.mjs +25 -13
  82. package/dist/client/{context-CVsgML69.mjs → context-BLAvalAa.mjs} +1 -1
  83. package/dist/client/{cta-BWnUuJce.mjs → cta-CUXhX_D7.mjs} +2 -1
  84. package/dist/client/dateFormatting-BHIHxNuo.mjs +61 -0
  85. package/dist/client/{demoPortalMagicLink-CUlwvmxf.mjs → demoPortalMagicLink-R-awbk_0.mjs} +1 -1
  86. package/dist/client/{enhanceHeaderSection-Cw8nnFj-.mjs → enhanceHeaderSection-9Q93uvTo.mjs} +3 -3
  87. package/dist/client/{event-details.client-Bl0E_6Vi.mjs → event-details.client-BS1WtG-a.mjs} +2 -2
  88. package/dist/client/{event-registration.client-DmfLg_LC.mjs → event-registration.client-BXndwsET.mjs} +35 -21
  89. package/dist/client/{eventCalendar-D1Dwb9VA.mjs → eventCalendar-HyoOt1Qz.mjs} +4 -4
  90. package/dist/client/{eventCombined-DfsqY1qR.mjs → eventCombined-sdG5oEaH.mjs} +4 -4
  91. package/dist/client/{eventDetails-BmugDVoa.mjs → eventDetails-FFAknE4w.mjs} +2 -2
  92. package/dist/client/{eventListing-BPAGJi3C.mjs → eventListing-CGK6urk3.mjs} +4 -4
  93. package/dist/client/{eventRegistration-DBlz_x6u.mjs → eventRegistration-VhrvCs4l.mjs} +4 -4
  94. package/dist/client/{form-DVu3ZMjx.mjs → form-C-B5O_ko.mjs} +3 -3
  95. package/dist/client/{form.client-QZUyABIY.mjs → form.client-DoZVcl8d.mjs} +5 -5
  96. package/dist/client/{form.parts-Bs0F3v08.mjs → form.parts-mttKpgif.mjs} +3 -3
  97. package/dist/client/{formatDate-BD9D3dgo.mjs → formatDate-xUSCknEO.mjs} +1 -1
  98. package/dist/client/gifting/client.mjs +3 -3
  99. package/dist/client/{headerSection-BQwWW4Yy.mjs → headerSection-BHUEXsaI.mjs} +2 -2
  100. package/dist/client/{location-map.client-upKuwABk.mjs → location-map.client-Cylb_MHw.mjs} +2 -2
  101. package/dist/client/{location-map.view-RuBCD10O.mjs → location-map.view-Cx4Bl7ij.mjs} +69 -6
  102. package/dist/client/{locationMap-1sCbsk0V.mjs → locationMap-QnKJi-nZ.mjs} +2 -2
  103. package/dist/client/{newsletter-form.client-DBTU3oNv.mjs → newsletter-form.client-D_n0rftg.mjs} +8 -8
  104. package/dist/client/{newsletter-form.parts-C9I9JBhe.mjs → newsletter-form.parts-DKHye4IE.mjs} +2 -2
  105. package/dist/client/{newsletterForm-DTPtTxxG.mjs → newsletterForm-tEaYelzx.mjs} +3 -3
  106. package/dist/client/{noop-DMFt3KdC.mjs → noop-B610YKEx.mjs} +12 -5
  107. package/dist/client/portal/client.mjs +4562 -174
  108. package/dist/client/{product-detail.client-BX7M5o6p.mjs → product-detail.client-DUf5x5Jt.mjs} +1 -1
  109. package/dist/client/{product-list.client-i32QNY4c.mjs → product-list.client-Cqp1BPTV.mjs} +1 -1
  110. package/dist/client/{productDetail-DWjE9zm7.mjs → productDetail-B8bBiogP.mjs} +3 -3
  111. package/dist/client/{productList-DZH9_brv.mjs → productList-BKN4D-1z.mjs} +3 -3
  112. package/dist/client/{propsDecoder-CTzHkEkh.mjs → propsDecoder-2nNZh2Oe.mjs} +3 -3
  113. package/dist/client/{registry.server-vJ5FlscU.mjs → registry.server-BAm4RPNJ.mjs} +856 -872
  114. package/dist/client/rendering/client.mjs +27 -26
  115. package/dist/client/rendering/islands.mjs +1 -1
  116. package/dist/client/rendering.mjs +47 -28
  117. package/dist/client/{richText-coerce-DXAmC72p.mjs → richText-coerce-Cv-qomNB.mjs} +1 -1
  118. package/dist/client/{routeIslandApiConfig-CmC7ygin.mjs → routeIslandApiConfig-C5u8MbAA.mjs} +1 -1
  119. package/dist/client/{shop-C7eL3B37.mjs → shop-DZNC0VKk.mjs} +3 -3
  120. package/dist/client/{shop-commerce-D8oRN0QJ.mjs → shop-commerce-DdX4LSa3.mjs} +12 -12
  121. package/dist/client/{shop-commerce-store-CRnQ4M18.mjs → shop-commerce-store-BJtrZov9.mjs} +1 -1
  122. package/dist/client/{shop.client-X6d6KVmA.mjs → shop.client-DmDd-igg.mjs} +16 -15
  123. package/dist/client/{shop.interactive-DBMeM8VD.mjs → shop.interactive-5SnnDHz3.mjs} +402 -35
  124. package/dist/client/{shopShared-Y182kN_s.mjs → shopShared-CPqUlAh9.mjs} +2 -2
  125. package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
  126. package/dist/client/timetableModel-C19rcHEw.mjs +960 -0
  127. package/dist/client/{useAvailableSlots-BDV6MHgJ.mjs → useAvailableSlots-BjbJXotk.mjs} +3 -3
  128. package/dist/client/{useBookingNowIso-DgJEv3ZY.mjs → useBookingNowIso-CMgfL7YJ.mjs} +1 -1
  129. package/dist/client/{useDiscountApply-BTu9EeT7.mjs → useDiscountApply-KG8jB7WC.mjs} +2 -2
  130. package/dist/client/{useDiscountCodeUi-BfZxdxI-.mjs → useDiscountCodeUi-DK2w_i0a.mjs} +1 -1
  131. package/dist/client/{useEventPagination-pnvdHGeQ.mjs → useEventPagination-DW6MCirb.mjs} +11 -10
  132. package/dist/client/uuid-BETKW8rS.mjs +12 -0
  133. package/dist/client/{view-hJr_L4QC2.mjs → view-CkUn3Y0Y.mjs} +4 -4
  134. package/dist/client/{view-BPEa6Okm.mjs → view-CseyBW07.mjs} +15 -70
  135. package/dist/client/{wizardSteps-HdyGoIG3.mjs → wizardSteps-zgq10lN1.mjs} +262 -65
  136. package/dist/preview-next/before-render.mjs +1 -1
  137. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-lUHBrzHv.mjs} +1 -1
  138. package/dist/preview-next/client/{PreviewEditorSidebar-CXRUbqMp.mjs → PreviewEditorSidebar-DWyUGCAG.mjs} +1217 -107
  139. package/dist/preview-next/client/{PreviewEditorUI-CxjEV0Fm.mjs → PreviewEditorUI-Wq0b3Daw.mjs} +52 -79
  140. package/dist/preview-next/client/{SdkPreviewModeRuntime-XdQSGGj_.mjs → SdkPreviewModeRuntime-BtZPcwYV.mjs} +1 -1
  141. package/dist/preview-next/client/{SdkPreviewModeRuntime-BxI12BBS.mjs → SdkPreviewModeRuntime-wSI_R361.mjs} +720 -2035
  142. package/dist/preview-next/client/{SiteChromeCustomizeContext-CfRQRwpH.mjs → SiteChromeCustomizeContext-Hc4pYnNe.mjs} +14365 -8155
  143. package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-DzeycIlD.mjs} +204 -93
  144. package/dist/preview-next/client/{previewChromeSurface-CH7hd5n7.mjs → previewChromeSurface-Corq4AG7.mjs} +3 -8
  145. package/dist/preview-next/client/runtime.mjs +3 -3
  146. package/dist/preview-next/client/{sdk-runtime-C6xEU1LI.mjs → sdk-runtime-CWymRWhK.mjs} +1 -1
  147. package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +1359 -0
  148. package/dist/preview-next/client/{spinner-BTf1CZmy.mjs → spinner-C4If5Y-O.mjs} +1 -1
  149. package/dist/preview-next/editor-base.css +62 -0
  150. package/dist/preview-next/editor-chrome.css +85 -0
  151. package/dist/preview-next/keepAlive.mjs +1 -1
  152. package/dist/preview-next/middleware.mjs +1 -1
  153. package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-8csADeIT.mjs} +149 -112
  154. package/dist/server/{Block.shared-DLoilC2J.mjs → Block.shared-D1_gonwM.mjs} +6 -6
  155. package/dist/server/{bindings-C7DKLVx_.mjs → bindings-CFmJg5lm.mjs} +2 -2
  156. package/dist/server/{client-CU4wlMLE.mjs → client-DPsi0Dai.mjs} +9 -7
  157. package/dist/server/config-template-validation.mjs +50 -10
  158. package/dist/server/config-validation.mjs +1 -1
  159. package/dist/server/config.mjs +2 -2
  160. package/dist/server/{generatePageMetadata-CPvssVOp.mjs → generatePageMetadata-DB_lbrZ7.mjs} +28 -2
  161. package/dist/server/index.mjs +2 -2
  162. package/dist/server/{loadContent-DmQ4BiiQ.mjs → loadContent-RMCcuVU_.mjs} +33 -20
  163. package/dist/server/loadPage-DUPP51C-.mjs +2 -0
  164. package/dist/server/{loadPage-BBkDQA57.mjs → loadPage-DhDGzj7t.mjs} +8 -5
  165. package/dist/server/manifest.mjs +1 -1
  166. package/dist/server/metadata.mjs +2 -2
  167. package/dist/server/next.mjs +13 -12
  168. package/dist/server/{overrideResolution-ByeAbLSO.mjs → overrideResolution-OxY5FMuy.mjs} +1 -1
  169. package/dist/server/{overrides-BcA6ZPWf.mjs → overrides-Bz_A6sB9.mjs} +586 -518
  170. package/dist/server/page-converter.mjs +8 -10
  171. package/dist/server/{prebuild-8T-m7XjB.mjs → prebuild-B_1vrSru.mjs} +1 -1
  172. package/dist/server/prebuild.mjs +1 -1
  173. package/dist/server/{prefetchBlockData-Bjya-X9t.mjs → prefetchBlockData-B7ukYXXR.mjs} +841 -887
  174. package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-Djbpc81A.mjs} +166 -129
  175. package/dist/server/{blocks-jlIm0PWc.mjs → registry-eFjKtEhF.mjs} +2349 -1716
  176. package/dist/server/rendering/server.mjs +4 -4
  177. package/dist/server/rendering.mjs +7 -7
  178. package/dist/server/{resolveBlockData-D0ow8PRJ.mjs → resolveBlockData-DYvEa9c5.mjs} +6 -3
  179. package/dist/server/routing.mjs +1 -1
  180. package/dist/server/{schema-Bs735S27.mjs → schema-C3dJ5UkL.mjs} +148 -88
  181. package/dist/server/server.mjs +3 -3
  182. package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → siteChromeOverlayClearance-DALIAMwo.mjs} +108 -11
  183. package/dist/server/{src-B935_bzN.mjs → src-C5Mu-z0F.mjs} +268 -189
  184. package/dist/server/theme-bridge.mjs +1 -1
  185. package/dist/server/theme.mjs +1 -1
  186. package/dist/server/{themeAdmission-D2-BnmDO.mjs → themeAdmission-ruoyXb_0.mjs} +9 -7
  187. package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
  188. package/dist/server/{validation-Cm41pDUB.mjs → validation-B-Xar8QS.mjs} +22 -63
  189. package/dist/server/{version-Bo9C3McI.mjs → version-Bg7VHK3i.mjs} +1 -1
  190. package/dist/styles/index.css +78 -0
  191. package/package.json +8 -3
  192. package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
  193. package/dist/_dts/index-cnymEAZY.d.ts +0 -1
  194. package/dist/client/timetableModel-D7PwpaBY.mjs +0 -480
  195. package/dist/preview-next/client/siteStyleAccess-CRXaC2oL.mjs +0 -1326
  196. package/dist/server/loadPage-ZrcfjG3X.mjs +0 -2
@@ -1,15 +1,16 @@
1
1
  "use client";
2
- import { Cr as asSiteStyleId, Fr as makeBoundaryId, K as corners, On as defaultThemeTokens, U as parseThemeForPersistence, Xn as paletteColorsSchema, Zn as paletteModeSchema, Zt as resolveSurface, ar as buildRenderableMediaAssetIndex, bn as expandPalette, cr as resolveManagedMediaReference, gr as asDesignBlockId, lr as mediaIdentifierSchema$2, on as textColorStyle, or as renderableMediaAssetSchema$1, sr as indexRenderableMediaAssets, vt as stripStaleTransitionStyleGroup, wr as assertNever$1, xr as asLayoutVariantKey } from "./ThemedButton-BEOPss9H.mjs";
2
+ import { Ir as makeBoundaryId, K as corners, Qn as paletteModeSchema, Qt as resolveSurface, Tr as assertNever$1, U as parseThemeForPersistence, Zn as paletteColorsSchema, _r as asDesignBlockId, cr as indexRenderableMediaAssets, kn as defaultThemeTokens, or as buildRenderableMediaAssetIndex, sn as textColorStyle, sr as renderableMediaAssetSchema$1, vt as stripStaleTransitionStyleGroup, wr as asSiteStyleId, xn as expandPalette } from "./ThemedButton-DzeycIlD.mjs";
3
3
  import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-BC0V7iAR.mjs";
4
- import { $ as createGuardedPreviewApiClient, $i as componentRuntimeRulesForTheme, $o as Image, $r as RichText$1, Aa as resolveCompiledSectionForegroundFromContent, Ai as ctaCopyFragment, Ar as planSiteOverlayHeaderClearance, B as arrangementBlockControlsFor, Bi as arrangementHooksFromContent, Br as systemCustomizeFacetNextValue, Ca as defaultSectionTransitionVariantForFamily, Ci as faqHeadingFragment, Cn as resolveRenderedValues, Co as DialogHeader, Cr as getBlockDefinition, Ct as VIEWING_PARTICIPATION, Da as deriveSectionGround, Di as formCopyFragment, Dn as isEdited, Dr as projectRecurringSchedule, Ds as toUtcIsoDateTimeString, Dt as EditorWriteSurface, Ea as sectionTransitionVariantForBoundaryOptionId, Ei as formEmbedFragment, En as baselineRevisionOf, Er as publicRouteCandidatesSchema, Et as EditLeaseModal, Fi as getResponsiveScopeSpec, Fn as FormRenderer, Fr as resolveArrangementKnobs, G as usePreviewPageDesignEditorState, Ga as parseBlockIconValue, Gi as compileEditorModelRuntime, Gn as MediaEditorContextProvider, Gr as buildLoadedOfferingsPreviewListing, Ha as isRichTextDoc, Hi as readBlockComposition, Hn as decodePublicProductCategorySelectorQuery, Hr as escapeStyleContent, Ii as ctaButton, Io as X, Ir as systemCustomizeFacetAppliesToLayoutVariant, Ja as coerceInlineTextWithFallback, Ji as arrangementManifestFromVariants, Jn as ApiRequestError, Jr as offeringsListingFor, K as PreviewDesignHistoryOrderProvider, Ka as parseGeneratedIconAssetId, Kn as useMediaEditorOptional, Kr as buildAppointmentServicesView, Li as bodyCopyFragment, Ln as civilPickerDisplay, Lo as Upload, Lr as systemCustomizeFacetCurrentValue, Ma as readRuntimeNow, Mi as ctaRowFragment, Mr as parseStoredVariant, Na as resolveDateRuntimeContext, Ni as heroCopyFragment, Nr as compileManifestContentContract, Nt as OfferingsPreviewWidgetProvider, Oa as heroPhotoPaintsGround, Oi as testimonialsCarouselFragment, Or as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Os as assertNever$2, Pi as DEFAULT_THEME_RESPONSIVE_MODE, Pr as validateManifestDraft, Q as resolvePreviewSidebarTab, Qa as bindingSchema, Qi as resolvePublishedLook, Qo as Info, Qr as Text$1, Ri as runTransforms, Rn as MediaEditor, Rr as systemCustomizeFacetDefinitionsForBlock, Sa as sectionFactsForContent, Si as faqAccordionFragment, Sn as renderedFieldChanges, So as DialogFooter, Sr as resolveBlockVariantKey, Ss as unsafeAsEditorBlockId, St as useRetentionTicks, Ta as sectionTransitionFamilyForBoundaryOptionId, Ti as singleButtonFragment, Tn as unsafeAsLinkedContentEntryId, Tr as offeringsPreviewBlockDefinition, Tt as EditLeaseDiscardedNotice, U as nextArrangementLookPin, Ua as isObjectRecord, Ui as applyPageOpeningForegroundToTheme, Un as DEFAULT_LAUNCH_READINESS_INPUT, Uo as SlidersHorizontal, Ur as mergeContentWithBlockStyleOverrides, Vi as blockLookFromContent, Vn as blocksKeys, Vr as buildThemeRuntime, W as PreviewPageDesignEditorStateProvider, Wa as isRecord$8, Wi as applyCompiledRuntimeFieldsToContent, Wn as deriveLaunchReadiness, Wo as RotateCcw, Wr as getDefaultComponentRegistry, Xa as isInlineTextEmpty, Xi as resolveEffectiveArrangement, Xr as renderInlineText, Xt as EditorProvider, Ya as inlineTextToPlainText, Yi as readStoredMode, Yn as unwrapResponse, Za as plainTextToInlineText, Zi as resolveModeArrangement, Zr as logger, Zt as useEditor, _i as getCurrentResolveImageUrlContext, _o as TabsList, _r as ThemeScope, _s as selectedContentVersionId, _t as useEntryEditorController, aa as surfaceResolutionContextFromTheme, ai as bookingConsentCarrierSchema, an as createRoutingHelpers, ba as boundaryLayout, bi as headingFragment, bn as remoteDraftValues, bo as DialogContent, br as createCustomBlockRegistry, bt as createEditorApiClientFactory, c as PreviewThemeOverlayProvider, ca as getGradientPreset, ci as resolveRouteTarget, cr as defaultBackgroundOverrideForMode, ct as PreviewRichTextEditor, di as LINKED_CONTENT_ENTRY_META_KEY, dr as parseBackgroundOverrideFromContent, ds as buildMailingListSignupBlockSourceRef, dt as PREVIEW_EDITABLE_OUTLINE, ea as designRuntimeRulesForTheme, ei as getAtPath, es as GripVertical, et as initPreviewAuth, fi as coerceLinkedContentEntriesPayload, fr as planBackgroundOverride, fs as parseFooterModuleId, ga as resolveLookSlotSurfaces, gi as buildResolveImageUrlContext, gn as useOptionalEditorUiStoreInstance, go as TabsContent, gr as isSupportedLoaderEndpoint, gs as readEditorBlockVersionsFromPlacement, ha as resolveItemSurface, hi as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, hn as useEditorUiStoreInstance, ho as Tabs, hr as resolveBackgroundCapability, hs as NO_BLOCK_VERSIONS, ht as EntryControllerProvider, ii as publicEventsArraySchema, ir as BlockApiProvider, is as ChevronLeft, it as usePreviewToken, ja as resolveSectionBackground, ji as heroCtaRowFragment, jr as visibleHeaderClearancePx, ka as parseCanonicalRuntimeBackground, ki as testimonialsHeadingFragment, kn as canEditorWrite, kr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, l as usePreviewThemeOverlay, la as deriveSiteStyleBlockPolicy, li as planSiteChromePlacement, lr as enabledBackgroundModes, ls as cn, lt as PreviewInlineTextEditor, ma as arrangementSlotNames, mi as resolveImageUrlWithContext, mn as useEditorUiStore, mr as rankBackgroundImagePoolItems, ms as sameMailingListPlacementTargeting, mt as EditableBlockProvider, n as useSiteChromeCustomizeOptional, na as headerStyleRecipeForTheme, ni as defaultTransforms, nr as clientComponentRegistry, nt as renewPreviewSession, o as PreviewDesignCoordinatorProvider, oa as gradientToCss, oi as resolveEntryRouteTarget, on as createSnapshotFromPageRecord, or as backgroundColorTokens, ot as renderSiteChromeBlock, pi as getLinkedContentEntryMeta, pr as planBackgroundTransition, ps as parseMailingListPlacementTargeting, qa as parseGeneratedIconSetId, qn as useApiMediaUploader, qr as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, ri as calendarWindowQuerySchema, rr as ImageResolveContextProvider, rs as ChevronRight, rt as usePreviewAuth, si as resolvePageRouteTarget, sr as canCycleBackgroundOverrideValue, ss as Button, t as SiteChromeCustomizeProvider, ta as getCuratedSiteStyle, ti as siblingPath, tr as API_ENDPOINTS, tt as registerPreviewRenewalFetcher, ui as formatDate, ur as imagePoolForOverride, ut as PreviewTextEditor, vi as setContextResolveImageUrlContext, vn as activeLinkedSaveHandover, vo as TabsTrigger, vr as containerResponsiveThemeCss, vs as parseEditLeaseScope, wa as sectionTransitionFamilies, wi as blogFeaturedPostFragment, wo as DialogTitle, wr as normalizeBlockContent, xa as composeBoundary, xi as cardFragment, xn as renderSourceFor, xo as DialogDescription, xr as makeDefaultBlockComponent, xt as createPageSurfaceEditorServices, ya as formatSiteChromeBackgroundTokenLabel, yi as richTextFragment, yn as planLinkedSaveHandoverRetention, yo as Dialog, yr as resolveSdkFooterMode, z as arrangementBackgroundControlFor, zi as defineFragment, zr as systemCustomizeFacetLabelForValue } from "./SiteChromeCustomizeContext-CfRQRwpH.mjs";
5
- import { a as resolvePreviewChromeSurface, i as getPreviewChromeSurfaceDataProps, l as PREVIEW_CHROME_Z_INDEX, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as PREVIEW_KEEP_ALIVE_INTERVAL_MS, s as PREVIEW_KEEP_ALIVE_JITTER_RATIO, u as FixedBottomSurface } from "./previewChromeSurface-CH7hd5n7.mjs";
6
- import { a as sanitizeDashboardPath, d as useBlockCustomizeControls, f as PreviewBlockCustomizeSelectionProvider, h as previewWidgetOverrides, i as resolvePreviewDashboardSetupHandoff, l as PreviewSiteFontStorageProvider, n as resolveSiteStyleAccess, p as usePreviewBlockCustomizeSelectionOptional, r as buildPreviewDashboardSetupUrl, s as resolvePreviewSetupBannerModel, t as canInspectSiteStyle } from "./siteStyleAccess-CRXaC2oL.mjs";
4
+ import { $ as initPreviewAuth, $a as coerceInlineTextWithFallback, $i as compileEditorModelRuntime, $n as MediaEditorContextProvider, $r as projectRecurringSchedule, Aa as composeBoundary, Ai as faqAccordionFragment, An as resolveRenderedValues, Ao as DialogHeader, Ar as isSupportedLoaderEndpoint, At as EditorWriteSurface, Ba as resolveSectionBackground, Bi as ctaRowFragment, Br as publicRouteCandidatesSchema, Ca as arrangementSlotNames, Cn as useOptionalEditorUiStoreInstance, Co as TabsContent, Cs as readPublishedBlockPlacement, Ct as createEditorApiClientFactory, Di as richTextFragment, Dn as remoteDraftValues, Do as DialogContent, Ei as setContextResolveImageUrlContext, En as planLinkedSaveHandoverRetention, Eo as Dialog, Et as VIEWING_PARTICIPATION, Fa as sectionTransitionVariantForBoundaryOptionId, Fi as formCopyFragment, Fr as makeDefaultBlockComponent, Fs as assertNever$2, Ga as pageTemplateFromEntry, Gi as bodyCopyFragment, Gr as compileManifestContentContract, Ha as resolveDateRuntimeContext, Hi as DEFAULT_THEME_RESPONSIVE_MODE, Hr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, Ia as deriveSectionGround, Ii as testimonialsCarouselFragment, In as canEditorWrite, Ir as resolveBlockVariantKey, Ja as isObjectRecord, Ji as arrangementHooksFromContent, Jr as systemCustomizeFacetDefinitionsForBlock, Ka as unavailableReadinessFact, Ki as runTransforms, Kr as validateManifestDraft, La as heroPhotoPaintsGround, Li as testimonialsHeadingFragment, Lr as getBlockDefinition, Ma as defaultSectionTransitionVariantForFamily, Mi as blogFeaturedPostFragment, Mn as unsafeAsLinkedContentEntryId, Mr as containerResponsiveThemeCss, Na as sectionTransitionFamilies, Ni as singleButtonFragment, Nn as baselineRevisionOf, Nr as resolveSdkFooterMode, Oa as formatSiteChromeBackgroundTokenLabel, Oi as headingFragment, On as renderSourceFor, Oo as DialogDescription, Ot as EditLeaseDiscardedNotice, Pa as sectionTransitionFamilyForBoundaryOptionId, Pi as formEmbedFragment, Pn as isEdited, Pr as createCustomBlockRegistry, Ps as toUtcIsoDateTimeString, Q as createGuardedPreviewApiClient, Qa as parseGeneratedIconSetId, Qi as applyCompiledRuntimeFieldsToContent, Qn as deriveLaunchReadiness, Qr as getDefaultComponentRegistry, Ra as parseCanonicalRuntimeBackground, Ri as ctaCopyFragment, Rr as normalizeBlockContent, Sn as useEditorUiStoreInstance, So as Tabs, Ss as readEditorBlockVersionsFromPlacement, Ta as resolveLookSlotSurfaces, Ti as getCurrentResolveImageUrlContext, Tn as activeLinkedSaveHandover, To as TabsTrigger, Ts as parseEditLeaseScope, Tt as useRetentionTicks, Ua as admitReadinessFacts, Ui as getResponsiveScopeSpec, Uo as X, Ur as planSiteOverlayHeaderClearance, Va as readRuntimeNow, Vi as heroCopyFragment, Vr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Wa as loadedReadinessFact, Wi as ctaButton, Wr as parseStoredVariant, Xa as parseBlockIconValue, Xi as readBlockComposition, Xn as decodePublicProductCategorySelectorQuery, Xo as RotateCcw, Xr as escapeStyleContent, Ya as isRecord$7, Yi as blockLookFromContent, Yn as blocksKeys, Yr as buildThemeRuntime, Za as parseGeneratedIconAssetId, Zi as applyPageOpeningForegroundToTheme, Zn as DEFAULT_LAUNCH_READINESS_INPUT, Zr as mergeContentWithBlockStyleOverrides, _ as usePreviewPageDesignEditorState, _i as planSiteChromePlacement, _s as buildMailingListSignupBlockSourceRef, aa as resolveEffectiveArrangement, ao as siblingPath, at as SessionJournalHost, bi as coerceLinkedContentEntriesPayload, bs as sameMailingListPlacementTargeting, ca as componentRuntimeRulesForTheme, ci as Text$1, cr as API_ENDPOINTS, da as headerStyleRecipeForTheme, di as calendarWindowQuerySchema, dr as ImageResolveContextProvider, dt as PreviewTextEditor, ei as chosenString, en as EditorProvider, eo as inlineTextToPlainText, et as registerPreviewRenewalFetcher, fi as publicEventsArraySchema, fn as createRoutingHelpers, fr as BlockApiProvider, ft as PREVIEW_EDITABLE_OUTLINE, g as PreviewPageDesignEditorStateProvider, gi as resolveRouteTarget, go as CalloutDescription, gt as EntryControllerProvider, hi as resolvePageRouteTarget, ho as Callout, hs as cn, ht as EditableBlockProvider, i as PreviewDesignCoordinatorProvider, ia as readStoredMode, ii as offeringsListingFor, io as getAtPath, it as SiteAdmissionObserver, ja as sectionFactsForContent, ji as faqHeadingFragment, jo as DialogTitle, jr as ThemeScope, jt as editorAdmissionNotice, ka as boundaryLayout, ki as cardFragment, kn as renderedFieldChanges, ko as DialogFooter, ks as unsafeAsEditorBlockId, kt as EditLeaseModal, la as designRuntimeRulesForTheme, li as RichText$1, lr as unwrapResponse, ls as ChevronRight, lt as PreviewRichTextEditor, ma as surfaceResolutionContextFromTheme, mi as resolveEntryRouteTarget, n as useSiteChromeCustomizeOptional, ni as buildAppointmentServicesView, no as plainTextToInlineText, nr as ApiRequestError, nt as usePreviewAuth, o as PreviewThemeOverlayProvider, oa as resolveModeArrangement, oi as renderInlineText, os as GripVertical, pi as bookingConsentCarrierSchema, pn as createSnapshotFromPageRecord, ps as Button, qa as isRichTextDoc, qi as defineFragment, qr as resolveArrangementKnobs, ra as arrangementManifestFromVariants, ri as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, ro as bindingSchema, rt as usePreviewToken, s as usePreviewThemeOverlay, sa as resolvePublishedLook, si as logger, st as renderSiteChromeBlock, t as SiteChromeCustomizeProvider, ti as buildLoadedOfferingsPreviewListing, tn as useEditor, to as isInlineTextEmpty, tr as useApiMediaUploader, tt as renewPreviewSession, ui as defaultTransforms, ur as clientComponentRegistry, us as ChevronLeft, ut as PreviewInlineTextEditor, v as PreviewDesignHistoryOrderProvider, va as deriveSiteStyleBlockPolicy, vi as formatDate, vs as parseFooterModuleId, vt as useEntryEditorController, wa as resolveItemSurface, wi as buildResolveImageUrlContext, wo as TabsList, ws as selectedContentVersionId, wt as createPageSurfaceEditorServices, xi as getLinkedContentEntryMeta, xn as useEditorUiStore, xs as NO_BLOCK_VERSIONS, yi as LINKED_CONTENT_ENTRY_META_KEY, ys as parseMailingListPlacementTargeting, yt as useOptionalSessionJournal, za as resolveCompiledSectionForegroundFromContent, zi as heroCtaRowFragment, zr as offeringsPreviewBlockDefinition } from "./SiteChromeCustomizeContext-Hc4pYnNe.mjs";
5
+ import { a as resolvePreviewChromeSurface, i as getPreviewChromeSurfaceDataProps, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as PREVIEW_KEEP_ALIVE_INTERVAL_MS, s as PREVIEW_KEEP_ALIVE_JITTER_RATIO, u as FixedBottomSurface } from "./previewChromeSurface-Corq4AG7.mjs";
6
+ import { A as CustomizeBackgroundColorPicker, C as pageDesignLookPosition, M as usePreviewBlockCustomizeSelectionOptional, S as cyclePageDesignBlockLook, a as sanitizeDashboardPath, b as useArrangementToolbar, d as useBlockCustomizeControls, g as LookCyclePill, i as resolvePreviewDashboardSetupHandoff, j as PreviewBlockCustomizeSelectionProvider, l as PreviewSiteFontStorageProvider, m as ArrangementModeSwitchPill, n as resolveSiteStyleAccess, p as ArrangementLookPill, r as buildPreviewDashboardSetupUrl, s as resolvePreviewSetupBannerModel, t as canInspectSiteStyle, x as CustomizeBackgroundControlRows, y as lookPositionLabel } from "./siteStyleAccess-QZkJRHl5.mjs";
7
7
  import * as React$1 from "react";
8
8
  import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
10
  import { useQueryClient } from "@tanstack/react-query";
11
11
  import { z } from "zod";
12
12
  import { createPortal } from "react-dom";
13
+ import { useRouter } from "next/navigation.js";
13
14
  //#region ../ui/src/resizable-split-pane.tsx
14
15
  /**
15
16
  * Resizable split pane component
@@ -244,7 +245,7 @@ function getFragmentRegistry() {
244
245
  }
245
246
  //#endregion
246
247
  //#region ../blocks/src/system/icons/generatedAssets.ts
247
- function isRecord$7(value) {
248
+ function isRecord$6(value) {
248
249
  return typeof value === "object" && value !== null && !Array.isArray(value);
249
250
  }
250
251
  function generatedIconAssetRefKey(ref) {
@@ -254,11 +255,11 @@ function collectGeneratedIconAssetRefs(page) {
254
255
  const blocks = [];
255
256
  for (const block of page.blocks) {
256
257
  if (block.kind !== "block.feature-cards" || typeof block.id !== "string") continue;
257
- const content = isRecord$7(block.draftContent) ? block.draftContent : isRecord$7(block.content) ? block.content : null;
258
+ const content = isRecord$6(block.draftContent) ? block.draftContent : isRecord$6(block.content) ? block.content : null;
258
259
  const cards = Array.isArray(content?.cards) ? content.cards : [];
259
260
  const refs = /* @__PURE__ */ new Map();
260
261
  for (const card of cards) {
261
- if (!isRecord$7(card)) continue;
262
+ if (!isRecord$6(card)) continue;
262
263
  const icon = parseBlockIconValue(card.icon);
263
264
  if (icon.kind !== "generated") continue;
264
265
  const ref = {
@@ -531,7 +532,7 @@ function buildPageRendererRootRuntime(dataContext) {
531
532
  pageId,
532
533
  pathname,
533
534
  bookingTimeZone,
534
- ...pageDateRuntime(dataContext),
535
+ ...pageRuntimeContext(dataContext),
535
536
  previewStage,
536
537
  apiBaseUrl,
537
538
  portalToken,
@@ -547,10 +548,11 @@ function buildPageRendererRootRuntime(dataContext) {
547
548
  function resolveDemoEmailSuppression(dataContext) {
548
549
  return dataContext?.demoEmailSuppressed === true;
549
550
  }
550
- function pageDateRuntime(dataContext) {
551
+ function pageRuntimeContext(dataContext) {
551
552
  return {
552
553
  dateContext: pageDateRuntimeContext(dataContext),
553
- now: dataContext?.now
554
+ now: dataContext?.now,
555
+ template: dataContext?.template ?? { kind: "page" }
554
556
  };
555
557
  }
556
558
  function pageDateRuntimeContext(dataContext) {
@@ -701,6 +703,13 @@ function toEditorPresentationPage(page) {
701
703
  };
702
704
  }
703
705
  //#endregion
706
+ //#region ../blocks/src/system/data/selectBlockContent.ts
707
+ /** Canonical admitted content: legacy publishedContent never selects a version. */
708
+ function selectBlockContent(block, stage = "published") {
709
+ const source = stage === "preview" && block.draftContent ? block.draftContent : block.content;
710
+ return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
711
+ }
712
+ //#endregion
704
713
  //#region ../blocks/src/pageRenderPlan.ts
705
714
  /**
706
715
  * Decides, once per page render, which blocks can render and what happens to
@@ -856,8 +865,7 @@ function getBlockOverride(blockKind, overrides) {
856
865
  * `site-style-transition-*` styleGroup is dropped; authored values survive.
857
866
  */
858
867
  function getRenderableContent(block, previewStage = "published") {
859
- const source = previewStage === "preview" && block.draftContent ? block.draftContent : block.content ?? {};
860
- return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
868
+ return selectBlockContent(block, previewStage);
861
869
  }
862
870
  function arrangementRuntime(content) {
863
871
  const value = content._arrangementLooks;
@@ -1127,6 +1135,66 @@ function heroPhotoGround(entry) {
1127
1135
  return entry.kind === "renderable" && entry.block.kind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(entry.effectiveArrangementKey ?? void 0) } : void 0;
1128
1136
  }
1129
1137
  //#endregion
1138
+ //#region ../blocks/src/system/data/readinessFacts.ts
1139
+ const countSchema = z.array(z.unknown()).transform((entries) => entries.length);
1140
+ const formSchema = z.union([z.null(), z.object({
1141
+ id: z.string(),
1142
+ slug: z.string().optional()
1143
+ })]).transform((form) => form !== null);
1144
+ const productsSchema = z.object({ products: z.array(z.object({ slug: z.string() })) });
1145
+ /** Both producers pass raw facts through the same stage admission. */
1146
+ function readinessFactsFromLoaders(stage, input) {
1147
+ const facts = {
1148
+ mailingList: loaderFactProducers.mailingList(input),
1149
+ testimonials: loaderFactProducers.testimonials(input),
1150
+ team: loaderFactProducers.team(input),
1151
+ forms: loaderFactProducers.forms(input),
1152
+ products: loaderFactProducers.products(input),
1153
+ template: loaderFactProducers.template(input)
1154
+ };
1155
+ return admitReadinessFacts(stage, {
1156
+ stage: input.prefetched?.loaderSnapshot?.stage ?? (input.previewStage === "preview" ? "draft" : "published"),
1157
+ facts
1158
+ });
1159
+ }
1160
+ const loaderFactProducers = {
1161
+ mailingList: (input) => input.mailingList === void 0 ? unavailableReadinessFact : loadedReadinessFact(input.mailingList),
1162
+ testimonials: (input) => mapFact(firstLoaderFact(input, "testimonials", "entries", countSchema), (count) => ({
1163
+ count,
1164
+ total: "unknown"
1165
+ })),
1166
+ team: (input) => firstLoaderFact(input, "team", "members", countSchema),
1167
+ forms: (input) => new Map(projections(input, "forms").flatMap(({ id, block }) => {
1168
+ const selection = chosenString(block.requests.form?.params.formSlug ?? block.requests.form?.params.formId);
1169
+ return selection ? [[selection, loaderFact(input, id, "form", formSchema)]] : [];
1170
+ })),
1171
+ products: (input) => new Map(projections(input, "products").flatMap(({ id, block }) => {
1172
+ const selection = chosenString(block.content.productSlug);
1173
+ return selection ? [[selection, mapFact(loaderFact(input, id, "products", productsSchema), ({ products }) => products.some((product) => product.slug === selection))]] : [];
1174
+ })),
1175
+ template: (input) => loadedReadinessFact(input.template)
1176
+ };
1177
+ function projections(input, need) {
1178
+ return Object.entries(input.prefetched?.loaderSnapshot?.blocks ?? {}).flatMap(([id, block]) => getBlockDefinition(block.kind)?.readiness?.needs.includes(need) ? [{
1179
+ id,
1180
+ block
1181
+ }] : []);
1182
+ }
1183
+ function firstLoaderFact(input, need, key, schema) {
1184
+ const source = projections(input, need)[0];
1185
+ return source ? loaderFact(input, source.id, key, schema) : unavailableReadinessFact;
1186
+ }
1187
+ function loaderFact(input, id, key, schema) {
1188
+ const prefetched = input.prefetched;
1189
+ if (!prefetched) return unavailableReadinessFact;
1190
+ if (!prefetched.loaderSnapshot.blocks[id]?.requests[key] || prefetched.loaderFailures[id]?.[key]) return unavailableReadinessFact;
1191
+ const parsed = schema.safeParse(prefetched.resolvedData[id]?.[key]);
1192
+ return parsed.success ? loadedReadinessFact(parsed.data) : unavailableReadinessFact;
1193
+ }
1194
+ function mapFact(fact, project) {
1195
+ return fact.kind === "Loaded" ? loadedReadinessFact(project(fact.value)) : fact;
1196
+ }
1197
+ //#endregion
1130
1198
  //#region ../blocks/src/system/blocks/offerings-preview/photoCount.ts
1131
1199
  /** Count the selected cards, without loading or selecting again. */
1132
1200
  function offeringsPreviewPhotoCount(listing) {
@@ -1187,7 +1255,7 @@ function hydrateResolvedBookingConsentValue(value, context) {
1187
1255
  const hydratedItems = value.map((item) => hydrateResolvedBookingConsentValue(item, context));
1188
1256
  return hydratedItems.every((item, index) => item === value[index]) ? value : hydratedItems;
1189
1257
  }
1190
- if (!isRecord$8(value)) return value;
1258
+ if (!isRecord$7(value)) return value;
1191
1259
  if (isBookingConsentCarrier(value)) {
1192
1260
  const agreement = hydrateValue(value.agreement, context);
1193
1261
  return agreement === value.agreement ? value : {
@@ -1207,7 +1275,7 @@ function hydrateValue(value, context) {
1207
1275
  const resolvedItems = value.map((item) => hydrateValue(item, context));
1208
1276
  return resolvedItems.every((item, index) => item === value[index]) ? value : resolvedItems;
1209
1277
  }
1210
- if (isRecord$8(value)) {
1278
+ if (isRecord$7(value)) {
1211
1279
  if (isInternalLink(value)) return hydrateInternalLink(value, context.routes);
1212
1280
  if (isPageLink(value)) return hydratePageLink(value, context);
1213
1281
  if (isEntryLink(value)) return hydrateEntryLink(value, context);
@@ -1272,7 +1340,7 @@ function hydrateEntryLink(link, context) {
1272
1340
  //#region ../blocks/src/system/manifest/resolveBlockData.ts
1273
1341
  function resolveBlockData(blockId, dataLoaders, dataContext, routes) {
1274
1342
  const raw = blockId ? dataContext?.resolvedData?.[blockId] : void 0;
1275
- if (isRecord$8(raw)) return routes ? hydrateResolvedBookingConsentLinks(raw, routes, dataContext?.pagesByIdentifier, dataContext?.entriesByIdentifier) : raw;
1343
+ if (isRecord$7(raw)) return routes ? hydrateResolvedBookingConsentLinks(raw, routes, dataContext?.pagesByIdentifier, dataContext?.entriesByIdentifier) : raw;
1276
1344
  return dataLoaders && typeof dataLoaders === "object" && Object.keys(dataLoaders).length > 0 ? {} : void 0;
1277
1345
  }
1278
1346
  //#endregion
@@ -1333,13 +1401,14 @@ function planNewsletterPreviewSubmission(placement) {
1333
1401
  * stays at the edge (decision D3), matching `buildPageRenderPlan`.
1334
1402
  */
1335
1403
  function preparePageRender(input) {
1336
- const entries = [];
1337
- const constructionFailures = [];
1338
- for (const entry of input.plan.entries) {
1339
- const prepared = prepareEntry(entry, input);
1340
- if (prepared.kind === "render-threw") constructionFailures.push(entry);
1341
- entries.push(preparedPlanEntry(entry, prepared));
1342
- }
1404
+ const facts = readinessFactsFromLoaders("published", {
1405
+ prefetched: input.dataContext?.prefetchedBlockData,
1406
+ previewStage: input.dataContext?.previewStage,
1407
+ mailingList: input.dataContext?.mailingList,
1408
+ template: input.dataContext?.template ?? pageTemplateFromEntry(input.dataContext?.contentEntry)
1409
+ });
1410
+ const entries = input.plan.entries.filter((entry) => input.audience === "authoring" || !entryNeedsSetup(entry, facts)).map((entry) => preparedPlanEntry(entry, prepareEntry(entry, input)));
1411
+ const constructionFailures = entries.filter(({ prepared }) => prepared.kind === "render-threw").map(({ entry }) => entry);
1343
1412
  const survivors = input.audience === "authoring" ? entries : entries.filter((candidate) => candidate.prepared.kind !== "render-threw");
1344
1413
  return {
1345
1414
  entries: survivors,
@@ -1353,6 +1422,9 @@ function preparePageRender(input) {
1353
1422
  * same primitive, so `[A, B, C]` losing B still gets an A→C join. Each
1354
1423
  * survivor is then classified from its final content.
1355
1424
  */
1425
+ function entryNeedsSetup(entry, facts) {
1426
+ return entry.kind === "renderable" && entry.definition.readiness?.assess(entry.renderableContent, facts).kind === "NeedsSetup";
1427
+ }
1356
1428
  function composeSurvivorJoins(plan, survivors, themeResources) {
1357
1429
  return composePageJoins({
1358
1430
  joins: retargetJoinsAcrossOmissions({
@@ -2053,7 +2125,8 @@ function usePageDateRuntime(props) {
2053
2125
  const dateContext = React$1.useMemo(() => supplied ?? resolveDateRuntimeContext(zone), [supplied, zone]);
2054
2126
  const dataContext = React$1.useMemo(() => props.dataContext ? {
2055
2127
  ...props.dataContext,
2056
- dateContext
2128
+ dateContext,
2129
+ template: props.dataContext.template ?? pageTemplateFromEntry(props.dataContext.contentEntry)
2057
2130
  } : void 0, [props.dataContext, dateContext]);
2058
2131
  return {
2059
2132
  ...props,
@@ -2281,20 +2354,6 @@ function normalizeDataLoaders(def) {
2281
2354
  }));
2282
2355
  }
2283
2356
  /**
2284
- * Normalize block content for data loading.
2285
- * Priority: draftContent > content > publishedContent
2286
- */
2287
- function normalizeContent(block) {
2288
- const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
2289
- if (!isObjectRecord(source)) return {};
2290
- if ("data" in source) {
2291
- const data = source.data;
2292
- if (isObjectRecord(data)) return data;
2293
- if (data === null || data === void 0) return {};
2294
- }
2295
- return source;
2296
- }
2297
- /**
2298
2357
  * Normalize params for API calls.
2299
2358
  * Converts supplied values to strings, preserving absent versus explicitly empty params.
2300
2359
  */
@@ -2376,7 +2435,7 @@ async function fetchLoaderData(apiClient, endpoint, params) {
2376
2435
  }));
2377
2436
  }
2378
2437
  function planLoaderPage(data, offset, seenPages) {
2379
- if (!isUnknownArray$1(data)) return {
2438
+ if (!isUnknownArray(data)) return {
2380
2439
  kind: "invalid",
2381
2440
  message: "Expected paged loader entries"
2382
2441
  };
@@ -2413,7 +2472,7 @@ async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
2413
2472
  default: return assertNever$2(page);
2414
2473
  }
2415
2474
  }
2416
- function isUnknownArray$1(value) {
2475
+ function isUnknownArray(value) {
2417
2476
  return Array.isArray(value);
2418
2477
  }
2419
2478
  //#endregion
@@ -2560,101 +2619,109 @@ function shouldSkipResolvedLoader(input) {
2560
2619
  if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
2561
2620
  return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
2562
2621
  }
2563
- /**
2564
- * Core data prefetching logic (framework-agnostic).
2565
- *
2566
- * This function is shared between frontend and SDK implementations.
2567
- * It handles:
2568
- * - Extracting data loaders from block definitions
2569
- * - Resolving loader params with block content
2570
- * - Executing server-mode loaders in parallel
2571
- * - Organizing results by block ID and loader key
2572
- *
2573
- * @example
2574
- * ```typescript
2575
- * const resolved = await prefetchBlockData(page, context, {
2576
- * apiClient: async ({ endpoint, params }) => {
2577
- * return await myApiClient({ endpoint, params });
2578
- * },
2579
- * isValidEndpoint: (endpoint) => endpoint in API_ENDPOINTS,
2580
- * });
2581
- * ```
2582
- */
2583
- async function prefetchBlockData(page, context, options) {
2584
- return (await prefetchBlockDataWithFailures(page, context, options)).resolvedData;
2585
- }
2586
2622
  async function prefetchBlockDataWithFailures(page, context, options) {
2587
- const { apiClient, isValidEndpoint, onError, getCustomBlockLoaders, getBlockDefinition: getBlockDefinition$1 = getBlockDefinition, resolveParamsBindings: resolveParamsBindings$1 = resolveParamsBindings, shouldLoad } = options;
2588
- const { now, dateContext } = admitLoaderDateRuntime(context);
2589
- const results = {};
2590
- const loaderFailures = {};
2591
- const tasks = [];
2592
- for (const block of page.blocks) {
2593
- const blockId = block.id;
2594
- if (!blockId) continue;
2595
- let loaders;
2596
- const def = getBlockDefinition$1(block.kind);
2597
- if (def) loaders = normalizeDataLoaders(def);
2598
- else if (getCustomBlockLoaders) {
2599
- const customLoaders = getCustomBlockLoaders(block.kind);
2600
- loaders = customLoaders ? Object.entries(customLoaders).map(([key, loader]) => ({
2601
- key,
2602
- loader
2603
- })) : [];
2604
- } else loaders = [];
2605
- loaders = projectDataLoaders(loaders, shouldLoad, blockId, block.kind);
2606
- if (loaders.length === 0) continue;
2607
- const root = {
2608
- ...context.root ?? {},
2623
+ const runtime = admitLoaderDateRuntime(context);
2624
+ const blocks = page.blocks.flatMap((block) => block.id ? [planBlockRequests(block, block.id, context, options, runtime)] : []);
2625
+ return {
2626
+ ...projectLoaderOutcomes(blocks, await Promise.all(blocks.flatMap((block) => block.requests.map((request) => executeLoaderRequest(request, options))))),
2627
+ loaderSnapshot: {
2628
+ stage: context.previewStage === "preview" ? "draft" : "published",
2629
+ blocks: Object.fromEntries(blocks.map((block) => [block.id, {
2630
+ kind: block.kind,
2631
+ content: block.content,
2632
+ requests: Object.fromEntries(block.requests.map(({ key, endpoint, params }) => [key, {
2633
+ endpoint,
2634
+ params
2635
+ }]))
2636
+ }]))
2637
+ }
2638
+ };
2639
+ }
2640
+ function planBlockRequests(block, id, context, options, runtime) {
2641
+ const definition = (options.getBlockDefinition ?? getBlockDefinition)(block.kind);
2642
+ const loaders = definition ? normalizeDataLoaders(definition) : customLoaders(block.kind, options);
2643
+ const vm = {
2644
+ content: plannedLoaderContent(block, definition, context),
2645
+ $root: {
2646
+ ...context.root,
2609
2647
  siteId: context.siteId,
2610
2648
  pageId: context.pageId,
2611
2649
  previewStage: context.previewStage
2650
+ }
2651
+ };
2652
+ const requests = projectDataLoaders(loaders, options.shouldLoad, id, block.kind).flatMap((entry) => {
2653
+ const request = planLoaderRequest(entry, block, id, vm, options, runtime);
2654
+ return request ? [request] : [];
2655
+ });
2656
+ return {
2657
+ id,
2658
+ kind: block.kind,
2659
+ content: selectBlockContent(block, context.previewStage),
2660
+ requests
2661
+ };
2662
+ }
2663
+ function customLoaders(kind, options) {
2664
+ return Object.entries(options.getCustomBlockLoaders?.(kind) ?? {}).map(([key, loader]) => ({
2665
+ key,
2666
+ loader
2667
+ }));
2668
+ }
2669
+ function planLoaderRequest({ key, loader }, block, blockId, vm, options, runtime) {
2670
+ if (loader.mode === "client") return null;
2671
+ const resolve = options.resolveParamsBindings ?? resolveParamsBindings;
2672
+ const coordinates = { blockKind: block.kind };
2673
+ if (loader.when !== void 0 && resolve(loader.when, vm, coordinates, runtime.dateContext, runtime.now) !== true) return null;
2674
+ const params = normalizeParams(resolve(loader.params, vm, coordinates, runtime.dateContext, runtime.now));
2675
+ if (shouldSkipResolvedLoader({
2676
+ loader,
2677
+ endpoint: loader.endpoint,
2678
+ params,
2679
+ isValidEndpoint: options.isValidEndpoint
2680
+ })) return null;
2681
+ return {
2682
+ blockId,
2683
+ blockKind: block.kind,
2684
+ key,
2685
+ endpoint: loader.endpoint,
2686
+ params
2687
+ };
2688
+ }
2689
+ async function executeLoaderRequest(request, options) {
2690
+ try {
2691
+ return {
2692
+ kind: "loaded",
2693
+ request,
2694
+ data: await fetchLoaderData(options.apiClient, request.endpoint, request.params)
2612
2695
  };
2613
- const vm = {
2614
- content: plannedLoaderContent(block, def, context),
2615
- $root: root
2696
+ } catch (error) {
2697
+ options.onError?.(error, {
2698
+ block: request.blockKind,
2699
+ loader: request.key
2700
+ });
2701
+ return {
2702
+ kind: "failed",
2703
+ request
2616
2704
  };
2617
- for (const { key, loader } of loaders) {
2618
- if (loader.mode === "client") continue;
2619
- if (typeof loader.when !== "undefined") {
2620
- if (resolveParamsBindings$1(loader.when, vm, { blockKind: block.kind }, dateContext, now) !== true) continue;
2621
- }
2622
- const params = normalizeParams(resolveParamsBindings$1(loader.params, vm, { blockKind: block.kind }, dateContext, now));
2623
- const endpoint = loader.endpoint;
2624
- if (shouldSkipResolvedLoader({
2625
- loader,
2626
- endpoint,
2627
- params,
2628
- isValidEndpoint
2629
- })) continue;
2630
- tasks.push((async () => {
2631
- try {
2632
- const data = await fetchLoaderData(apiClient, endpoint, params);
2633
- const blockResults = results[blockId] ?? (results[blockId] = {});
2634
- blockResults[key] = data;
2635
- } catch (error) {
2636
- const blockFailures = loaderFailures[blockId] ?? (loaderFailures[blockId] = {});
2637
- blockFailures[key] = {
2638
- endpoint,
2639
- params
2640
- };
2641
- if (onError) onError(error, {
2642
- block: block.kind,
2643
- loader: key
2644
- });
2645
- }
2646
- })());
2647
- }
2648
2705
  }
2649
- if (tasks.length > 0) await Promise.all(tasks);
2706
+ }
2707
+ function projectLoaderOutcomes(blocks, outcomes) {
2650
2708
  return {
2651
- resolvedData: results,
2652
- loaderFailures
2709
+ resolvedData: Object.fromEntries(blocks.flatMap((block) => {
2710
+ const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "loaded" ? [[outcome.request.key, outcome.data]] : []);
2711
+ return values.length ? [[block.id, Object.fromEntries(values)]] : [];
2712
+ })),
2713
+ loaderFailures: Object.fromEntries(blocks.flatMap((block) => {
2714
+ const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "failed" ? [[outcome.request.key, {
2715
+ endpoint: outcome.request.endpoint,
2716
+ params: outcome.request.params
2717
+ }]] : []);
2718
+ return values.length ? [[block.id, Object.fromEntries(values)]] : [];
2719
+ }))
2653
2720
  };
2654
2721
  }
2655
2722
  /** Prefetch executes the render-plan content stage before resolving loader bindings. */
2656
2723
  function plannedLoaderContent(block, definition, context) {
2657
- const content = normalizeContent(block);
2724
+ const content = selectBlockContent(block, context.previewStage);
2658
2725
  if (!definition || content._arrangementLooks === void 0) return content;
2659
2726
  return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
2660
2727
  }
@@ -2764,7 +2831,7 @@ function ensureSiteId(params, context) {
2764
2831
  * Map the embed block's author-facing order values onto the public
2765
2832
  * `listPublishedEntries` `order` contract enum.
2766
2833
  *
2767
- * `'order'` ("Custom order field") is the MANUAL-ORDERING axis: it means "render
2834
+ * `'order'` ("Your own order") is the MANUAL-ORDERING axis: it means "render
2768
2835
  * entries in the content type's author-defined order". It intentionally maps to
2769
2836
  * `undefined` (endpoint default) here rather than a fixed `manual.asc`, because
2770
2837
  * this transform is schema-blind — it can't tell whether the embedded content
@@ -3403,7 +3470,7 @@ function parseRelativeStoragePath(value) {
3403
3470
  if (!validated.ok) return validated;
3404
3471
  return ok$1(brandRelativeStoragePath(validated.value));
3405
3472
  }
3406
- function isRecord$6(value) {
3473
+ function isRecord$5(value) {
3407
3474
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3408
3475
  }
3409
3476
  function parseFileKindJson(value) {
@@ -3624,7 +3691,7 @@ function parseEntitledCustomerAccessScopeJson(value) {
3624
3691
  }
3625
3692
  }
3626
3693
  function requireRecord(value) {
3627
- if (!isRecord$6(value)) return err("expected-object");
3694
+ if (!isRecord$5(value)) return err("expected-object");
3628
3695
  return ok(value);
3629
3696
  }
3630
3697
  function requireString(value) {
@@ -4014,7 +4081,7 @@ const DEFAULT_MESSAGES = {
4014
4081
  update: "Failed to update media asset",
4015
4082
  delete: "Failed to delete media asset"
4016
4083
  };
4017
- function isRecord$5(value) {
4084
+ function isRecord$4(value) {
4018
4085
  return typeof value === "object" && value !== null;
4019
4086
  }
4020
4087
  const normalizeLabels = (labels) => labels !== void 0 && labels.length > 0 ? labels.map((label) => label.trim()).filter((label) => label.length > 0).join(",") : void 0;
@@ -4048,7 +4115,7 @@ const filterUpdatePayload = (input) => {
4048
4115
  return payload;
4049
4116
  };
4050
4117
  const extractErrorMessage = (body) => {
4051
- if (!isRecord$5(body)) return typeof body === "string" && body.trim().length > 0 ? body : null;
4118
+ if (!isRecord$4(body)) return typeof body === "string" && body.trim().length > 0 ? body : null;
4052
4119
  for (const key of [
4053
4120
  "error",
4054
4121
  "message",
@@ -4061,11 +4128,11 @@ const extractErrorMessage = (body) => {
4061
4128
  const details = body.details;
4062
4129
  if (Array.isArray(details)) for (const entry of details) {
4063
4130
  if (typeof entry === "string" && entry.trim().length > 0) return entry;
4064
- if (isRecord$5(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
4131
+ if (isRecord$4(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
4065
4132
  }
4066
4133
  const errors = body.errors;
4067
4134
  if (Array.isArray(errors)) {
4068
- for (const entry of errors) if (isRecord$5(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
4135
+ for (const entry of errors) if (isRecord$4(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
4069
4136
  }
4070
4137
  return null;
4071
4138
  };
@@ -4529,7 +4596,7 @@ function overlayValue(value, overlays) {
4529
4596
  });
4530
4597
  return changed ? next : value;
4531
4598
  }
4532
- if (!isRecord$4(value)) return value;
4599
+ if (!isRecord$3(value)) return value;
4533
4600
  const match = matchingOverlay(value, overlays);
4534
4601
  if (match) return overlaidEntry(value, match.meta, match.overlay);
4535
4602
  let changed = false;
@@ -4588,7 +4655,7 @@ function renderedLinkedRevisions(dataContext) {
4588
4655
  }
4589
4656
  function linkedEntryOccurrences(value) {
4590
4657
  if (Array.isArray(value)) return value.flatMap(linkedEntryOccurrences);
4591
- if (!isRecord$4(value)) return [];
4658
+ if (!isRecord$3(value)) return [];
4592
4659
  const meta = parseLinkedEntryMeta(value[LINKED_CONTENT_ENTRY_META_KEY]);
4593
4660
  const nested = Object.entries(value).filter(([key]) => key !== LINKED_CONTENT_ENTRY_META_KEY).flatMap(([, child]) => linkedEntryOccurrences(child));
4594
4661
  return meta ? [meta, ...nested] : nested;
@@ -4624,7 +4691,7 @@ function resolveOverlayTitle(content, meta) {
4624
4691
  function parseLinkedEntryMeta(value) {
4625
4692
  return getLinkedContentEntryMeta({ [LINKED_CONTENT_ENTRY_META_KEY]: value });
4626
4693
  }
4627
- function isRecord$4(value) {
4694
+ function isRecord$3(value) {
4628
4695
  return typeof value === "object" && value !== null && !Array.isArray(value);
4629
4696
  }
4630
4697
  function overlayRevision(overlay, meta) {
@@ -4800,8 +4867,15 @@ function previewValues(entryData, pageMetadata) {
4800
4867
  metadataRevision: revision.metadata
4801
4868
  };
4802
4869
  }
4803
- function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pageId, pageNodeType = "page", routeId: providedRouteId, entryData, contentTypeSchema, initialStatus = "draft", initialBlocks, blockFieldExtensions, pageMetadata, apiClient, subscribeToLeaseChanges, onLeaseGranted, liveDrafts }) {
4804
- const { isEditingMode, requestedEditingMode } = useEditor();
4870
+ /** Loading may render the document, but grants neither lease participation nor shortcuts. */
4871
+ function previewAuthoringMode(mode, admitted = true) {
4872
+ return {
4873
+ requestedEditingMode: admitted && mode.requestedEditingMode,
4874
+ historyShortcutsEnabled: admitted && mode.isEditingMode
4875
+ };
4876
+ }
4877
+ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pageId, pageNodeType = "page", routeId: providedRouteId, entryData, contentTypeSchema, initialStatus = "draft", initialBlocks, blockFieldExtensions, pageMetadata, initialPageJournalState, authoringAdmitted, apiClient, subscribeToLeaseChanges, onLeaseGranted, liveDrafts }) {
4878
+ const authoring = previewAuthoringMode(useEditor(), authoringAdmitted);
4805
4879
  const previewToken = usePreviewToken();
4806
4880
  const schema = contentTypeSchema ?? PAGE_CONTENT_TYPE_SCHEMA;
4807
4881
  const initialEntry = useMemo(() => initialPreviewEntry(entryData, pageMetadata, pageId, schema), [
@@ -4812,17 +4886,14 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
4812
4886
  ]);
4813
4887
  const normalizedInitialBlocks = useMemo(() => (initialBlocks ?? []).map(toEditorInitialBlock), [initialBlocks]);
4814
4888
  const entity = previewEntity(pageId, pageNodeType, entryData, providedRouteId);
4815
- const leaseScope = requiredPreviewLeaseScope({
4816
- nodeType: previewLeaseNodeType(pageNodeType, entryData),
4817
- nodeId: entity.id
4818
- });
4889
+ const leaseScope = previewLeaseScope(entity.id, pageNodeType, entryData);
4819
4890
  const values = previewValues(entryData, pageMetadata);
4820
4891
  const rendered = /* @__PURE__ */ jsx(RefreshBaselinesForRender, {
4821
4892
  liveDrafts,
4822
4893
  children
4823
4894
  });
4824
4895
  const editLease = usePreviewLeaseParticipation({
4825
- requestedEditingMode,
4896
+ requestedEditingMode: authoring.requestedEditingMode,
4826
4897
  siteId,
4827
4898
  pageId,
4828
4899
  pageNodeType,
@@ -4849,10 +4920,11 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
4849
4920
  entityLabel: entity.label,
4850
4921
  initialEntry,
4851
4922
  initialMetadataRevision: values.metadataRevision,
4923
+ initialPageJournalState,
4852
4924
  initialBlocks: pageNodeType === "page_surface" ? void 0 : normalizedInitialBlocks,
4853
4925
  blockFieldExtensions,
4854
- historyShortcutsEnabled: isEditingMode,
4855
- liveDrafts: previewLiveDraftsConfig(liveDrafts, previewToken, siteId, leaseScope)
4926
+ historyShortcutsEnabled: authoring.historyShortcutsEnabled,
4927
+ liveDrafts: previewLiveDraftsForScope(liveDrafts, previewToken, siteId, leaseScope)
4856
4928
  };
4857
4929
  if (pageNodeType === "page_surface" && pageId && pageMetadata) {
4858
4930
  if (values.kind !== "content") throw new Error("Preview draft is missing its editor revision");
@@ -4878,10 +4950,23 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
4878
4950
  children: rendered
4879
4951
  });
4880
4952
  }
4953
+ function previewLeaseScope(id, pageNodeType, entryData) {
4954
+ return id ? requiredPreviewLeaseScope({
4955
+ nodeType: previewLeaseNodeType(pageNodeType, entryData),
4956
+ nodeId: id
4957
+ }) : null;
4958
+ }
4959
+ function previewLiveDraftsForScope(liveDrafts, token, siteId, scope) {
4960
+ return scope ? previewLiveDraftsConfig(liveDrafts, token, siteId, scope) : null;
4961
+ }
4881
4962
  /** Lease participation and its server-read invalidation share the same preview identity. */
4882
4963
  function usePreviewLeaseParticipation({ requestedEditingMode, siteId, pageId, pageNodeType, leaseScope, subscribeToLeaseChanges, onLeaseGranted }) {
4883
4964
  const queryClient = useQueryClient();
4884
- return requestedEditingMode ? {
4965
+ if (requestedEditingMode && !leaseScope) return {
4966
+ kind: "exempt",
4967
+ reason: "sdk"
4968
+ };
4969
+ return requestedEditingMode && leaseScope ? {
4885
4970
  siteId,
4886
4971
  scope: leaseScope,
4887
4972
  subscribeToLeaseChanges,
@@ -5060,7 +5145,7 @@ function PreviewEditingModePersistence({ siteId }) {
5060
5145
  const key = `riverbank:preview-mode:${siteId}`;
5061
5146
  useEffect(() => {
5062
5147
  const restore = () => setEditingMode(readMode(key));
5063
- restore();
5148
+ setEditingMode(Boolean(new URLSearchParams(window.location.search).get("preview_block")) || readMode(key));
5064
5149
  setRestored(true);
5065
5150
  window.addEventListener("pageshow", restore);
5066
5151
  return () => window.removeEventListener("pageshow", restore);
@@ -5369,25 +5454,25 @@ const INITIAL_ONBOARDING_CONFIRMATION_STATE = {
5369
5454
  resendFeedback: null,
5370
5455
  statusLoadFailed: false
5371
5456
  };
5372
- function isRecord$3(value) {
5457
+ function isRecord$2(value) {
5373
5458
  return value !== null && typeof value === "object";
5374
5459
  }
5375
5460
  function getErrorMessageFromEnvelope(payload, fallback) {
5376
- const error = isRecord$3(payload) ? payload.error : null;
5377
- const message = isRecord$3(error) ? error.message : null;
5461
+ const error = isRecord$2(payload) ? payload.error : null;
5462
+ const message = isRecord$2(error) ? error.message : null;
5378
5463
  return typeof message === "string" && message.trim().length > 0 ? message : fallback;
5379
5464
  }
5380
5465
  function isLaunchReadiness(value) {
5381
- return isRecord$3(value) && Array.isArray(value.requirements) && typeof value.pendingRequiredCount === "number" && typeof value.pendingRecommendedCount === "number" && typeof value.pendingOptionalCount === "number" && isRecord$3(value.goLiveDecision) && (value.goLiveDecision.kind === "allowed" || value.goLiveDecision.kind === "blocked");
5466
+ return isRecord$2(value) && Array.isArray(value.requirements) && typeof value.pendingRequiredCount === "number" && typeof value.pendingRecommendedCount === "number" && typeof value.pendingOptionalCount === "number" && isRecord$2(value.goLiveDecision) && (value.goLiveDecision.kind === "allowed" || value.goLiveDecision.kind === "blocked");
5382
5467
  }
5383
5468
  function isOnboardingPreviewStatusResponse(value) {
5384
- return isRecord$3(value) && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
5469
+ return isRecord$2(value) && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
5385
5470
  }
5386
5471
  function isResendOnboardingPreviewConfirmationResponse(value) {
5387
- return isRecord$3(value) && (value.result === "resent" || value.result === "already_confirmed") && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
5472
+ return isRecord$2(value) && (value.result === "resent" || value.result === "already_confirmed") && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
5388
5473
  }
5389
5474
  function getSuccessData(payload, isData) {
5390
- if (!isRecord$3(payload) || payload.success !== true || !isData(payload.data)) return null;
5475
+ if (!isRecord$2(payload) || payload.success !== true || !isData(payload.data)) return null;
5391
5476
  return payload.data;
5392
5477
  }
5393
5478
  function useOnboardingConfirmationCheck(input) {
@@ -5784,12 +5869,24 @@ function PreviewAccessBanners({ dashboardBaseUrl, surfaceId, isEntry, pageNodeTy
5784
5869
  const { requestedEditingMode, setEditingMode } = useEditor();
5785
5870
  const showDiscardedNotice = useEditorUiStore((editor) => canEditorWrite(editor.editability) && editor.leaseDiscardedChanges);
5786
5871
  const thing = previewLeaseThing(isEntry, pageNodeType);
5872
+ const admissionNotice = useEditorUiStore((editor) => editorAdmissionNotice(editor.editAdmission));
5787
5873
  const active = state === "ok";
5788
5874
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
5789
5875
  /* @__PURE__ */ jsx(PreviewAuthBanner, {
5790
5876
  dashboardBaseUrl,
5791
5877
  surfaceId
5792
5878
  }),
5879
+ active && admissionNotice ? /* @__PURE__ */ jsx(FixedBottomSurface, {
5880
+ variant: "light",
5881
+ width: "centered",
5882
+ offsetCssVar: "--builder-editor-chrome-offset",
5883
+ reserveOffsetCssVar: "--builder-preview-banner-offset",
5884
+ children: /* @__PURE__ */ jsx(Callout, {
5885
+ tone: "info",
5886
+ role: "status",
5887
+ children: /* @__PURE__ */ jsx(CalloutDescription, { children: admissionNotice })
5888
+ })
5889
+ }) : null,
5793
5890
  active && requestedEditingMode ? /* @__PURE__ */ jsx(EditLeaseModal, {
5794
5891
  thing,
5795
5892
  onKeepViewing: () => setEditingMode(false)
@@ -5804,23 +5901,6 @@ function PreviewAccessBanners({ dashboardBaseUrl, surfaceId, isEntry, pageNodeTy
5804
5901
  ] });
5805
5902
  }
5806
5903
  //#endregion
5807
- //#region ../preview-next/src/client/preview/sidebarTabPreference.ts
5808
- const STORAGE_KEY = "preview-sidebar-tab";
5809
- function getPreviewSidebarTab() {
5810
- if (typeof window === "undefined") return "editor";
5811
- try {
5812
- return resolvePreviewSidebarTab(window.localStorage.getItem(STORAGE_KEY) === "assistant" ? "assistant" : "editor");
5813
- } catch {
5814
- return "editor";
5815
- }
5816
- }
5817
- function setPreviewSidebarTab(tab) {
5818
- if (typeof window === "undefined") return;
5819
- try {
5820
- window.localStorage.setItem(STORAGE_KEY, resolvePreviewSidebarTab(tab));
5821
- } catch {}
5822
- }
5823
- //#endregion
5824
5904
  //#region ../preview-next/src/client/preview/previewThemeRoles.ts
5825
5905
  /**
5826
5906
  * Splits the preview theme inputs into their two distinct roles so the
@@ -5844,7 +5924,7 @@ z.object({
5844
5924
  const DEFAULT_PREVIEW_CHROME_FLOATING_PLACEMENT = Object.freeze({
5845
5925
  kind: "anchor-top-right",
5846
5926
  topPx: 8,
5847
- rightPx: 8
5927
+ rightPx: 16
5848
5928
  });
5849
5929
  function headerClearanceFromPx(px) {
5850
5930
  return Number.isFinite(px) && px > 0 ? {
@@ -5852,21 +5932,41 @@ function headerClearanceFromPx(px) {
5852
5932
  px: Math.ceil(px)
5853
5933
  } : { kind: "none" };
5854
5934
  }
5935
+ /** Sub-pixel rounding between a header and the banner stacked under it. */
5936
+ const SITE_CHROME_STACK_TOLERANCE_PX = 2;
5937
+ /**
5938
+ * How far down the viewport the site's top chrome reaches: the header plus any
5939
+ * announcement banner stacked against it, above or below. A banner elsewhere on
5940
+ * the page doesn't count, and nor does chrome scrolled out of view. Measured
5941
+ * live, so a normal-flow header counts only while it's on screen, when no block
5942
+ * sits under it anyway.
5943
+ */
5944
+ function siteTopChromeClearance(input) {
5945
+ if (!input.header || !isVisibleChromeBox(input.header)) return { kind: "none" };
5946
+ return headerClearanceFromPx(input.banners.filter(isVisibleChromeBox).slice().sort((left, right) => left.top - right.top).reduce((edges, banner) => banner.top <= edges.bottom + SITE_CHROME_STACK_TOLERANCE_PX && banner.bottom >= edges.top - SITE_CHROME_STACK_TOLERANCE_PX ? {
5947
+ top: Math.min(edges.top, banner.top),
5948
+ bottom: Math.max(edges.bottom, banner.bottom)
5949
+ } : edges, input.header).bottom);
5950
+ }
5951
+ function isVisibleChromeBox(box) {
5952
+ return Number.isFinite(box.top) && Number.isFinite(box.bottom) && box.bottom > box.top && box.bottom > 0;
5953
+ }
5855
5954
  /**
5856
- * Every block's controls stay below a sticky or fixed site header, so they
5857
- * never sit over the header's own buttons.
5955
+ * Every block's controls stay below the site's top chrome (its header and any
5956
+ * banner stacked with it), so they never sit over the chrome's own buttons and
5957
+ * slide down inside the block while its top is covered.
5858
5958
  */
5859
5959
  function planBlockToolbarPlacement(input) {
5860
5960
  if (input.headerClearance.kind === "overlay") return {
5861
5961
  kind: "anchor-top-right-clamped",
5862
5962
  topPx: 8,
5863
- rightPx: 8,
5963
+ rightPx: 16,
5864
5964
  minTopPx: input.headerClearance.px + 8
5865
5965
  };
5866
5966
  return {
5867
5967
  kind: "anchor-top-right",
5868
5968
  topPx: 8,
5869
- rightPx: 8
5969
+ rightPx: 16
5870
5970
  };
5871
5971
  }
5872
5972
  function planSiteChromeCustomizePlacement(input) {
@@ -5941,7 +6041,7 @@ function PreviewChromeLayerProvider({ children }) {
5941
6041
  children: [children, layerHost ? createPortal(/* @__PURE__ */ jsx("div", {
5942
6042
  ref: setPortalTarget,
5943
6043
  className: "pointer-events-none fixed inset-0",
5944
- style: { zIndex: PREVIEW_CHROME_Z_INDEX },
6044
+ style: { zIndex: 30 },
5945
6045
  "data-preview-chrome-layer": ""
5946
6046
  }), layerHost) : null]
5947
6047
  });
@@ -6480,13 +6580,6 @@ function CustomizeCycleRow({ label, valueLabel, previousLabel, nextLabel, availa
6480
6580
  })]
6481
6581
  });
6482
6582
  }
6483
- function cycleAvailability(input) {
6484
- if (input.kind === "available") return input;
6485
- return {
6486
- kind: "unavailable",
6487
- reason: input.kind
6488
- };
6489
- }
6490
6583
  function cycleUnavailableReasonLabel(reason) {
6491
6584
  if (reason === "preview-only") return "Preview-only users cannot change this control.";
6492
6585
  if (reason === "single-option") return "There are no other options to cycle to.";
@@ -6504,157 +6597,6 @@ function cycleAvailabilityFromFlags(input) {
6504
6597
  return { kind: "available" };
6505
6598
  }
6506
6599
  //#endregion
6507
- //#region ../preview-next/src/client/preview/CustomizeColorTokenPicker.tsx
6508
- function CustomizeColorTokenPicker({ title, selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", showTitle = true, labelForToken, swatchColorForToken, onChooseToken }) {
6509
- if (recommendedTokens.length === 0 && advancedTokens.length === 0) return null;
6510
- const renderGrid = (tokens) => /* @__PURE__ */ jsx("div", {
6511
- className: `grid gap-1 ${columnsClassName}`,
6512
- children: tokens.map((token) => /* @__PURE__ */ jsx(ColorTokenButton, {
6513
- token,
6514
- label: labelForToken(token),
6515
- swatchColor: swatchColorForToken(token),
6516
- selected: selectedToken === token,
6517
- disabled,
6518
- onClick: (event) => onChooseToken(token, event)
6519
- }, token))
6520
- });
6521
- return /* @__PURE__ */ jsxs("div", { children: [
6522
- showTitle ? /* @__PURE__ */ jsx("div", {
6523
- className: "mb-1 text-xs font-medium text-muted-foreground",
6524
- children: title
6525
- }) : null,
6526
- renderGrid(recommendedTokens),
6527
- advancedTokens.length > 0 ? /* @__PURE__ */ jsxs("details", {
6528
- className: "mt-1",
6529
- children: [/* @__PURE__ */ jsx("summary", {
6530
- className: "cursor-pointer text-xs text-muted-foreground",
6531
- children: "More colors"
6532
- }), /* @__PURE__ */ jsx("div", {
6533
- className: "mt-1",
6534
- children: renderGrid(advancedTokens)
6535
- })]
6536
- }) : null
6537
- ] });
6538
- }
6539
- function CustomizeBackgroundColorPicker({ title = "Colors", selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", defaultSelected = false, defaultLabel = "Default", labelForToken, swatchColorForToken, onChooseDefault, onChooseToken }) {
6540
- const hasTokens = recommendedTokens.length > 0 || advancedTokens.length > 0;
6541
- if (!onChooseDefault && !hasTokens) return null;
6542
- return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
6543
- className: "mb-2 flex items-center justify-between gap-2",
6544
- children: [/* @__PURE__ */ jsx("div", {
6545
- className: "text-xs font-medium text-muted-foreground",
6546
- children: title
6547
- }), onChooseDefault ? /* @__PURE__ */ jsx("button", {
6548
- type: "button",
6549
- className: `rounded-md border px-2 py-1 text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${defaultSelected ? "border-foreground" : "bg-background"}`,
6550
- disabled,
6551
- onClick: onChooseDefault,
6552
- children: defaultLabel
6553
- }) : null]
6554
- }), hasTokens ? /* @__PURE__ */ jsx(CustomizeColorTokenPicker, {
6555
- title,
6556
- selectedToken,
6557
- recommendedTokens,
6558
- advancedTokens,
6559
- disabled,
6560
- columnsClassName,
6561
- labelForToken,
6562
- swatchColorForToken,
6563
- onChooseToken,
6564
- showTitle: false
6565
- }) : null] });
6566
- }
6567
- function ColorTokenButton({ token, label, swatchColor, selected, disabled, onClick }) {
6568
- return /* @__PURE__ */ jsxs("button", {
6569
- type: "button",
6570
- className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${selected ? "border-foreground" : "bg-background"}`,
6571
- disabled,
6572
- "aria-label": `Choose ${label}`,
6573
- onClick,
6574
- "data-token": token,
6575
- children: [/* @__PURE__ */ jsx("span", {
6576
- className: "h-3 w-3 shrink-0 rounded-full border",
6577
- style: { backgroundColor: swatchColor }
6578
- }), /* @__PURE__ */ jsx("span", {
6579
- className: "truncate",
6580
- children: label
6581
- })]
6582
- });
6583
- }
6584
- //#endregion
6585
- //#region ../preview-next/src/client/preview/CustomizeBackgroundControlRows.tsx
6586
- function CustomizeBackgroundControlRows({ modeLabel, valueLabel, valueAriaLabel, swatch, chooserOpen, chooser, canCycleMode, canCycleValue, onCycleMode, onCycleValue, onToggleChooser }) {
6587
- return /* @__PURE__ */ jsxs("div", {
6588
- className: "space-y-2",
6589
- children: [
6590
- /* @__PURE__ */ jsxs("div", {
6591
- className: "flex items-stretch overflow-hidden rounded-full border bg-background",
6592
- children: [
6593
- /* @__PURE__ */ jsx("button", {
6594
- type: "button",
6595
- onClick: (event) => onCycleMode("prev", event),
6596
- className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
6597
- "aria-label": "Previous background mode",
6598
- disabled: !canCycleMode,
6599
- children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
6600
- }),
6601
- /* @__PURE__ */ jsxs("div", {
6602
- className: "min-w-0 flex-1 border-x px-2 py-1 text-center",
6603
- children: [/* @__PURE__ */ jsx("div", {
6604
- className: "text-xs font-medium leading-3 text-muted-foreground",
6605
- children: "Background:"
6606
- }), /* @__PURE__ */ jsx("div", {
6607
- className: "truncate text-xs font-semibold leading-4",
6608
- children: modeLabel
6609
- })]
6610
- }),
6611
- /* @__PURE__ */ jsx("button", {
6612
- type: "button",
6613
- onClick: (event) => onCycleMode("next", event),
6614
- className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
6615
- "aria-label": "Next background mode",
6616
- disabled: !canCycleMode,
6617
- children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
6618
- })
6619
- ]
6620
- }),
6621
- /* @__PURE__ */ jsxs("div", {
6622
- className: "flex items-stretch overflow-hidden rounded-full border bg-background",
6623
- children: [
6624
- /* @__PURE__ */ jsx("button", {
6625
- type: "button",
6626
- onClick: (event) => onCycleValue("prev", event),
6627
- className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
6628
- "aria-label": "Previous background value",
6629
- disabled: !canCycleValue,
6630
- children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
6631
- }),
6632
- /* @__PURE__ */ jsxs("button", {
6633
- type: "button",
6634
- className: "flex min-w-0 flex-1 items-center justify-center gap-2 border-x px-2 py-1 text-center hover:bg-muted",
6635
- "aria-expanded": chooserOpen,
6636
- "aria-label": valueAriaLabel,
6637
- onClick: onToggleChooser,
6638
- children: [swatch, /* @__PURE__ */ jsx("span", {
6639
- className: "truncate text-xs font-medium",
6640
- children: valueLabel
6641
- })]
6642
- }),
6643
- /* @__PURE__ */ jsx("button", {
6644
- type: "button",
6645
- onClick: (event) => onCycleValue("next", event),
6646
- className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
6647
- "aria-label": "Next background value",
6648
- disabled: !canCycleValue,
6649
- children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
6650
- })
6651
- ]
6652
- }),
6653
- chooserOpen ? chooser : null
6654
- ]
6655
- });
6656
- }
6657
- //#endregion
6658
6600
  //#region ../preview-next/src/client/preview/SiteChromeCustomizeButton.tsx
6659
6601
  function SiteChromeCustomizeButton({ surface, containerClassName = "pointer-events-auto absolute right-2 top-2 z-50 flex gap-1 opacity-0 transition group-focus-within/site-chrome:opacity-100 group-hover/site-chrome:opacity-100" }) {
6660
6602
  const customize = useSiteChromeCustomizeOptional();
@@ -6950,7 +6892,7 @@ function SiteChromeBackgroundControl({ background, applyAllowed, chooserOpen, on
6950
6892
  advancedTokens: background.advancedTokens,
6951
6893
  disabled: !applyAllowed,
6952
6894
  labelForToken: formatSiteChromeBackgroundTokenLabel,
6953
- swatchColorForToken: tokenSwatchCss$1,
6895
+ swatchColorForToken: tokenSwatchCss,
6954
6896
  onChooseToken: (token, event) => {
6955
6897
  choose({
6956
6898
  kind: "color",
@@ -6984,10 +6926,10 @@ function SiteChromeBackgroundSwatch({ override }) {
6984
6926
  });
6985
6927
  return /* @__PURE__ */ jsx("span", {
6986
6928
  className: baseClassName,
6987
- style: { backgroundColor: tokenSwatchCss$1(override.token) }
6929
+ style: { backgroundColor: tokenSwatchCss(override.token) }
6988
6930
  });
6989
6931
  }
6990
- function tokenSwatchCss$1(token) {
6932
+ function tokenSwatchCss(token) {
6991
6933
  return `rgb(var(--tb-${token}))`;
6992
6934
  }
6993
6935
  //#endregion
@@ -7121,11 +7063,11 @@ function joinClassNames(...values) {
7121
7063
  //#region ../preview-next/src/client/utils/path.ts
7122
7064
  const PATH_SEPARATOR_REGEX = /\./g;
7123
7065
  const BRACKET_ACCESS_REGEX = /\[([^\]]+)\]/g;
7124
- function isRecord$2(value) {
7066
+ function isRecord$1(value) {
7125
7067
  return typeof value === "object" && value !== null && !Array.isArray(value);
7126
7068
  }
7127
7069
  function isPathContainer(value) {
7128
- return Array.isArray(value) || isRecord$2(value);
7070
+ return Array.isArray(value) || isRecord$1(value);
7129
7071
  }
7130
7072
  function createPathContainer(nextIsIndex) {
7131
7073
  return nextIsIndex ? [] : {};
@@ -7297,12 +7239,12 @@ function runtimeFieldsByBlockId(blocks) {
7297
7239
  function applyRuntimeContentDecorationProjection(block, content, projection) {
7298
7240
  const blockId = designBlockIdFromBlockItem(block);
7299
7241
  const fields = blockId ? projection.fieldsByBlockId.get(blockId) : void 0;
7300
- return applyCompiledRuntimeFieldsToContent(isRecord$1(content) ? content : {}, fields);
7242
+ return applyCompiledRuntimeFieldsToContent(isRecord(content) ? content : {}, fields);
7301
7243
  }
7302
7244
  function designBlockIdFromBlockItem(block) {
7303
7245
  return typeof block.id === "string" && block.id.length > 0 ? asDesignBlockId(block.id) : null;
7304
7246
  }
7305
- function isRecord$1(value) {
7247
+ function isRecord(value) {
7306
7248
  return typeof value === "object" && value !== null && !Array.isArray(value);
7307
7249
  }
7308
7250
  //#endregion
@@ -7362,7 +7304,7 @@ function applyBindings(bindings, context) {
7362
7304
  if (value !== void 0 && value !== null) setBindingValue(result, key, value);
7363
7305
  continue;
7364
7306
  }
7365
- if (isRecord$8(bindingSpec)) {
7307
+ if (isRecord$7(bindingSpec)) {
7366
7308
  const nested = applyBindings(bindingSpec, context);
7367
7309
  if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
7368
7310
  }
@@ -7403,7 +7345,7 @@ function mergeResolvedBindings(base, resolved) {
7403
7345
  const merged = { ...base };
7404
7346
  for (const [key, resolvedValue] of Object.entries(resolved)) {
7405
7347
  const baseValue = merged[key];
7406
- merged[key] = isRecord$8(baseValue) && isRecord$8(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
7348
+ merged[key] = isRecord$7(baseValue) && isRecord$7(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
7407
7349
  }
7408
7350
  return merged;
7409
7351
  }
@@ -7428,7 +7370,7 @@ function setBindingValue(target, path, value) {
7428
7370
  current[Number(segment)] = value;
7429
7371
  return;
7430
7372
  }
7431
- if (isRecord$8(current)) current[segment] = value;
7373
+ if (isRecord$7(current)) current[segment] = value;
7432
7374
  return;
7433
7375
  }
7434
7376
  const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
@@ -7437,15 +7379,15 @@ function setBindingValue(target, path, value) {
7437
7379
  const existing = current[index];
7438
7380
  if (nextWantsArray) {
7439
7381
  if (!Array.isArray(existing)) current[index] = [];
7440
- } else if (!isRecord$8(existing)) current[index] = {};
7382
+ } else if (!isRecord$7(existing)) current[index] = {};
7441
7383
  current = current[index];
7442
7384
  continue;
7443
7385
  }
7444
- if (isRecord$8(current)) {
7386
+ if (isRecord$7(current)) {
7445
7387
  const existing = current[segment];
7446
7388
  if (nextWantsArray) {
7447
7389
  if (!Array.isArray(existing)) current[segment] = [];
7448
- } else if (!isRecord$8(existing)) current[segment] = {};
7390
+ } else if (!isRecord$7(existing)) current[segment] = {};
7449
7391
  current = current[segment];
7450
7392
  continue;
7451
7393
  }
@@ -7483,7 +7425,7 @@ function getPath(source, path) {
7483
7425
  const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
7484
7426
  let current = source;
7485
7427
  for (const segment of segments) {
7486
- if (!isRecord$8(current)) return void 0;
7428
+ if (!isRecord$7(current)) return void 0;
7487
7429
  current = current[segment];
7488
7430
  }
7489
7431
  return current;
@@ -7516,7 +7458,7 @@ function textToInlineText(value) {
7516
7458
  function extractFirstParagraph(value) {
7517
7459
  if (!isRichTextDoc(value)) return null;
7518
7460
  for (const node of value.content) {
7519
- if (!isRecord$8(node)) continue;
7461
+ if (!isRecord$7(node)) continue;
7520
7462
  if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
7521
7463
  const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
7522
7464
  if (text.length > 0) return text;
@@ -7527,7 +7469,7 @@ function extractFirstParagraph(value) {
7527
7469
  * Type guard to check if a value is a valid binding descriptor.
7528
7470
  */
7529
7471
  function isBindingDescriptor(value) {
7530
- if (!isRecord$8(value) || typeof value.source !== "string") return false;
7472
+ if (!isRecord$7(value) || typeof value.source !== "string") return false;
7531
7473
  if (!BINDING_SOURCES.includes(value.source)) return false;
7532
7474
  switch (value.source) {
7533
7475
  case "field":
@@ -7542,7 +7484,7 @@ function isBindingDescriptor(value) {
7542
7484
  * Type guard to check if a value is binding-descriptor-like (can be normalized).
7543
7485
  */
7544
7486
  function isBindingDescriptorLike(value) {
7545
- return isBindingDescriptor(value) || typeof value === "string" || isRecord$8(value) && typeof value.source === "string" && typeof value.path === "string";
7487
+ return isBindingDescriptor(value) || typeof value === "string" || isRecord$7(value) && typeof value.source === "string" && typeof value.path === "string";
7546
7488
  }
7547
7489
  /**
7548
7490
  * Normalizes a binding input to a binding descriptor.
@@ -7578,7 +7520,7 @@ function entryFieldRebindingProjection(changedFields, dateContext) {
7578
7520
  * whose source did not change resolves to nothing and leaves the content as it is.
7579
7521
  */
7580
7522
  function applyEntryFieldRebindingProjection(block, content, projection) {
7581
- if (!isRecord$8(block.bindings)) return content;
7523
+ if (!isRecord$7(block.bindings)) return content;
7582
7524
  return applyBindingsToContent(content ?? {}, block.bindings, {
7583
7525
  fields: { ...projection.changedFields },
7584
7526
  meta: {},
@@ -7973,10 +7915,10 @@ function resolveShellThemeRoles(props) {
7973
7915
  }
7974
7916
  const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
7975
7917
  const PreviewEditorSidebar = React.lazy(async () => {
7976
- return { default: (await import("./PreviewEditorSidebar-CXRUbqMp.mjs")).PreviewEditorSidebar };
7918
+ return { default: (await import("./PreviewEditorSidebar-DWyUGCAG.mjs")).PreviewEditorSidebar };
7977
7919
  });
7978
7920
  const PreviewEditorUI = React.lazy(async () => {
7979
- return { default: (await import("./PreviewEditorUI-CxjEV0Fm.mjs")).PreviewEditorUI };
7921
+ return { default: (await import("./PreviewEditorUI-Wq0b3Daw.mjs")).PreviewEditorUI };
7980
7922
  });
7981
7923
  const previewPaneContainmentStyle = {
7982
7924
  contain: "layout paint",
@@ -8053,7 +7995,7 @@ function PreviewDocumentContent(input) {
8053
7995
  }
8054
7996
  function PreviewShellLayout(props) {
8055
7997
  const themeRoles = resolveShellThemeRoles(props);
8056
- const { children, rendering, surfaceId, siteId, dashboardBaseUrl = null, pageId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, apiClient, bearerToken, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, isSiteLaunched, maintenanceModeEnabled, entrySubrouteContext, assistantPanel, sdkConfig, bookingOfferingPresets, themeRuntime = defaultPreviewThemeRuntime, siteStyleAccess = { kind: "hidden" }, onFooterSaved } = props;
7998
+ const { children, rendering, surfaceId, siteId, dashboardBaseUrl = null, pageId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, apiClient, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, isSiteLaunched, maintenanceModeEnabled, entrySubrouteContext, sdkConfig, bookingOfferingPresets, themeRuntime = defaultPreviewThemeRuntime, siteStyleAccess = { kind: "hidden" }, onFooterSaved } = props;
8057
7999
  const layout = useOptionalPreviewLayout();
8058
8000
  const headerNode = layout?.headerNode ?? null;
8059
8001
  const bannerNode = layout?.bannerNode ?? null;
@@ -8063,8 +8005,6 @@ function PreviewShellLayout(props) {
8063
8005
  const isOpen = usePreviewDrawerOpen();
8064
8006
  usePreviewModeRootAttribute(useEditor().isEditingMode);
8065
8007
  const setDrawerOpen = useEditorUiStore((s) => s.setDrawerOpen);
8066
- const sidebarTab = useEditorUiStore((s) => s.previewSidebarTab);
8067
- const setPreviewSidebarActiveTab = useEditorUiStore((s) => s.setPreviewSidebarTab);
8068
8008
  const viewportMode = useEditorUiStore((s) => s.viewport.mode);
8069
8009
  const viewportWidth = useEditorUiStore((s) => s.viewport.width);
8070
8010
  const sidebarWidth = useEditorUiStore((s) => s.viewport.sidebarWidth);
@@ -8134,9 +8074,6 @@ function PreviewShellLayout(props) {
8134
8074
  const handleSidebarWidthChange = useCallback((width) => {
8135
8075
  setSidebarWidth(width);
8136
8076
  }, [setSidebarWidth]);
8137
- useEffect(() => {
8138
- setPreviewSidebarActiveTab(getPreviewSidebarTab());
8139
- }, [setPreviewSidebarActiveTab]);
8140
8077
  const [containerWidth, setContainerWidth] = useState(0);
8141
8078
  const [contentHeight, setContentHeight] = useState(0);
8142
8079
  const containerObserverRef = useRef(null);
@@ -8221,7 +8158,6 @@ function PreviewShellLayout(props) {
8221
8158
  currentTemplate,
8222
8159
  theme: themeRoles?.persistenceTheme,
8223
8160
  apiClient,
8224
- bearerToken,
8225
8161
  themeId,
8226
8162
  themeSelectionId,
8227
8163
  themeSelectionVersion,
@@ -8232,15 +8168,9 @@ function PreviewShellLayout(props) {
8232
8168
  themeSelectionFooterLookId,
8233
8169
  themeSelectionHeaderLogo,
8234
8170
  sdkConfig: sdkConfig ?? null,
8235
- activeTab: sidebarTab,
8236
- onTabChange: (tab) => {
8237
- setPreviewSidebarTab(tab);
8238
- setPreviewSidebarActiveTab(tab);
8239
- },
8240
8171
  onFooterSaved,
8241
8172
  onClose: () => setDrawerOpen(false),
8242
8173
  entrySubrouteContext: entrySubrouteContext ?? null,
8243
- assistantPanel,
8244
8174
  bookingOfferingPresets,
8245
8175
  siteStyleAccess,
8246
8176
  viewportMode,
@@ -8302,6 +8232,16 @@ function usePreviewDrawerOpen() {
8302
8232
  return requestedEditingMode && drawerOpen;
8303
8233
  }
8304
8234
  //#endregion
8235
+ //#region ../preview-next/src/client/preview/PreviewSessionJournalHost.tsx
8236
+ /** Preview supplies its existing server refresh to the shared document-session host. */
8237
+ function PreviewSessionJournalHost(props) {
8238
+ const router = useRouter();
8239
+ return /* @__PURE__ */ jsx(SessionJournalHost, {
8240
+ ...props,
8241
+ onReplay: router.refresh
8242
+ });
8243
+ }
8244
+ //#endregion
8305
8245
  //#region ../preview-next/src/auth-contract.ts
8306
8246
  function isPreviewRuntimeSessionEditable(session) {
8307
8247
  return session?.kind === "userSession" && session.canEdit;
@@ -8325,7 +8265,6 @@ function resolveShellLayoutProps(input) {
8325
8265
  draftContent: props.draftContent,
8326
8266
  currentTemplate: props.currentTemplate,
8327
8267
  apiClient: input.apiClient,
8328
- bearerToken: input.bearerToken,
8329
8268
  themeId: props.themeId ?? null,
8330
8269
  themeSelectionId: props.themeSelectionId ?? null,
8331
8270
  themeSelectionVersion: props.themeSelectionVersion ?? null,
@@ -8340,7 +8279,6 @@ function resolveShellLayoutProps(input) {
8340
8279
  isSiteLaunched: props.isSiteLaunched,
8341
8280
  maintenanceModeEnabled: props.maintenanceModeEnabled,
8342
8281
  entrySubrouteContext: props.entrySubrouteContext,
8343
- assistantPanel: props.assistantPanel,
8344
8282
  sdkConfig: props.sdkConfig ?? null,
8345
8283
  bookingOfferingPresets: props.bookingOfferingPresets,
8346
8284
  siteStyleAccess: input.siteStyleAccess,
@@ -8371,7 +8309,8 @@ function wrapPreviewSiteFontStorage(children, siteFontStorageUrl) {
8371
8309
  function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
8372
8310
  const { apiClient } = useEntryEditorController();
8373
8311
  const bearerToken = usePreviewToken();
8374
- return /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
8312
+ const journal = useOptionalSessionJournal();
8313
+ const content = /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
8375
8314
  apiClient,
8376
8315
  siteId: props.siteId,
8377
8316
  pageId: props.pageId,
@@ -8385,11 +8324,11 @@ function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
8385
8324
  children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch: props.baseFetch }), wrapPreviewSiteFontStorage(renderShellLayout({
8386
8325
  props,
8387
8326
  apiClient,
8388
- siteStyleAccess,
8389
- bearerToken
8327
+ siteStyleAccess
8390
8328
  }), props.siteFontStorageUrl)]
8391
8329
  })
8392
- }) });
8330
+ });
8331
+ return journal ? content : /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: content });
8393
8332
  }
8394
8333
  function PreviewBlockApiProvider({ config, children }) {
8395
8334
  const token = usePreviewToken();
@@ -8412,51 +8351,94 @@ function PreviewBlockApiProvider({ config, children }) {
8412
8351
  });
8413
8352
  }
8414
8353
  function PreviewShell(props) {
8415
- const { apiBaseUrl, blockApiConfig, siteId, siteSlug, editableId, previewSession, previewToken, pageId, routeId, entryData, contentTypeSchema, initialStatus, initialBlocks, pageMetadata, designEditorEligibility, hideSiteStyleConfigurator = false } = props;
8416
- const apiClient = useMemo(() => createGuardedPreviewApiClient(apiBaseUrl), [apiBaseUrl]);
8417
- const { designEditorEnabled, siteStyleAccess } = resolveShellAccess({
8418
- previewSession,
8419
- designEditorEligibility,
8420
- pageId,
8421
- entryData,
8422
- hideSiteStyleConfigurator
8354
+ const apiClient = useMemo(() => createGuardedPreviewApiClient(props.apiBaseUrl), [props.apiBaseUrl]);
8355
+ const access = resolveShellAccess({
8356
+ ...props,
8357
+ hideSiteStyleConfigurator: props.hideSiteStyleConfigurator ?? false
8423
8358
  });
8424
8359
  return /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
8425
- session: previewSession,
8426
- token: previewToken,
8427
- siteId,
8428
- siteSlug,
8429
- pageId: editableId,
8360
+ session: props.previewSession,
8361
+ token: props.previewToken,
8362
+ siteId: props.siteId,
8363
+ siteSlug: props.siteSlug,
8364
+ pageId: props.editableId,
8430
8365
  children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
8431
- config: blockApiConfig,
8366
+ config: props.blockApiConfig,
8432
8367
  children: /* @__PURE__ */ jsx(PreviewEditingModeProvider, {
8433
- siteId,
8434
- children: /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
8435
- blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
8436
- businessTimeZone: props.businessTimeZone,
8437
- siteId,
8438
- pageId,
8439
- pageNodeType: props.pageNodeType,
8440
- routeId,
8441
- entryData,
8442
- contentTypeSchema,
8443
- initialStatus,
8444
- initialBlocks,
8445
- pageMetadata,
8368
+ siteId: props.siteId,
8369
+ children: /* @__PURE__ */ jsx(PreviewEditorMount, {
8370
+ props,
8446
8371
  apiClient,
8447
- subscribeToLeaseChanges: props.subscribeToLeaseChanges,
8448
- onLeaseGranted: props.onLeaseGranted,
8449
- liveDrafts: props.liveDrafts ?? void 0,
8450
- children: [/* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}), /* @__PURE__ */ jsx(PreviewEditorBody, {
8451
- props,
8452
- designEditorEnabled,
8453
- siteStyleAccess
8454
- })]
8372
+ access
8455
8373
  })
8456
8374
  })
8457
8375
  })
8458
8376
  }) });
8459
8377
  }
8378
+ function previewJournalScope(props) {
8379
+ const nodeId = props.pageId ?? props.entryData?.id;
8380
+ return isPreviewRuntimeSessionEditable(props.previewSession) && nodeId ? {
8381
+ siteId: props.siteId,
8382
+ nodeId,
8383
+ nodeType: props.pageNodeType === "page_surface" ? "page_surface" : props.entryData ? "content_entry" : "page"
8384
+ } : null;
8385
+ }
8386
+ /** Render the preview during admission loading through the existing viewing participation. */
8387
+ function PreviewEditorMount({ props, apiClient, access }) {
8388
+ const scope = useMemo(() => previewJournalScope(props), [
8389
+ props.pageId,
8390
+ props.entryData,
8391
+ props.previewSession,
8392
+ props.pageNodeType,
8393
+ props.siteId
8394
+ ]);
8395
+ const editable = isPreviewRuntimeSessionEditable(props.previewSession);
8396
+ const ordinaryPageId = props.pageId && !props.entryData && props.pageNodeType !== "page_surface" ? props.pageId : null;
8397
+ const renderContent = (initialPageJournalState, checkpoint, authoringAdmitted) => /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
8398
+ blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
8399
+ businessTimeZone: props.businessTimeZone,
8400
+ siteId: props.siteId,
8401
+ pageId: props.pageId,
8402
+ pageNodeType: props.pageNodeType,
8403
+ routeId: props.routeId,
8404
+ entryData: props.entryData,
8405
+ contentTypeSchema: props.contentTypeSchema,
8406
+ initialStatus: props.initialStatus,
8407
+ initialBlocks: props.initialBlocks,
8408
+ pageMetadata: props.pageMetadata,
8409
+ initialPageJournalState,
8410
+ authoringAdmitted,
8411
+ apiClient,
8412
+ subscribeToLeaseChanges: props.subscribeToLeaseChanges,
8413
+ onLeaseGranted: props.onLeaseGranted,
8414
+ liveDrafts: props.liveDrafts ?? void 0,
8415
+ children: [
8416
+ authoringAdmitted && /* @__PURE__ */ jsx(SiteAdmissionObserver, {
8417
+ siteId: props.siteId,
8418
+ apiClient,
8419
+ checkpoint,
8420
+ siteOnly: !scope && editable,
8421
+ subscribeToAdmissionChanges: props.subscribeToAdmissionChanges
8422
+ }),
8423
+ authoringAdmitted && /* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}),
8424
+ /* @__PURE__ */ jsx(PreviewEditorBody, {
8425
+ props,
8426
+ ...access,
8427
+ designEditorEnabled: authoringAdmitted && access.designEditorEnabled,
8428
+ siteStyleAccess: authoringAdmitted ? access.siteStyleAccess : { kind: "hidden" }
8429
+ })
8430
+ ]
8431
+ });
8432
+ return /* @__PURE__ */ jsx(PreviewSessionJournalHost, {
8433
+ apiClient,
8434
+ siteId: props.siteId,
8435
+ editable,
8436
+ scope,
8437
+ ordinaryPageId,
8438
+ fallback: renderContent(void 0, void 0, false),
8439
+ children: (initialPageJournalState, checkpoint) => renderContent(initialPageJournalState, checkpoint, true)
8440
+ });
8441
+ }
8460
8442
  function defaultDesignEditorEligibility(input) {
8461
8443
  if (input.entryData) return { kind: "content-entry" };
8462
8444
  if (input.pageId) return { kind: "managed-page" };
@@ -8743,1582 +8725,225 @@ const editorRegistry = {
8743
8725
  linkedEntryEditFrame: LinkedEntryEditFrame
8744
8726
  };
8745
8727
  //#endregion
8746
- //#region ../preview-next/src/client/blocks/isRecord.ts
8747
- function isRecord(value) {
8748
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
8749
- }
8750
- //#endregion
8751
- //#region ../preview-next/src/client/blocks/previewCustomizeSelectedMedia.ts
8752
- function selectedImageFromMediaValue(value, index) {
8753
- if (value?.type !== "image") return null;
8754
- const resolved = resolveManagedMediaReference(value, index);
8755
- return resolved.kind === "resolved" ? {
8756
- reference: value,
8757
- imageAsset: resolved.asset
8758
- } : null;
8759
- }
8760
- function selectedImageFromRenderableAsset(source) {
8761
- const asset = renderableMediaAssetSchema$1.parse({
8762
- ...source,
8763
- width: source.width ?? null,
8764
- height: source.height ?? null
8765
- });
8728
+ //#region ../preview-next/src/client/blocks/useBlockSelection.ts
8729
+ const PHONE_VIEWPORT_QUERY = "(max-width: 639px)";
8730
+ /**
8731
+ * Click to select: a click anywhere in the block selects it, so its controls
8732
+ * stay put instead of only showing on hover. A click on an empty placeholder
8733
+ * also opens the side panel on the field that fills it.
8734
+ */
8735
+ function useBlockSelection(input) {
8736
+ const probeRef = useRef(null);
8737
+ const selection = usePreviewBlockCustomizeSelectionOptional();
8738
+ const selectBlock = selection?.selectBlock;
8739
+ const onOpenFieldRef = useRef(input.onOpenField);
8740
+ onOpenFieldRef.current = input.onOpenField;
8741
+ const phone = useMediaQuery(PHONE_VIEWPORT_QUERY);
8742
+ const [blockElement, setBlockElement] = useState(null);
8743
+ useEffect(() => {
8744
+ const block = probeRef.current?.closest("[data-block-id]") ?? null;
8745
+ setBlockElement(block);
8746
+ if (!block || !selectBlock) return;
8747
+ const handleClick = (event) => {
8748
+ selectBlock(input.blockId);
8749
+ const fieldPath = (event.target instanceof Element ? event.target.closest("[data-placeholder-field]") : null)?.dataset.placeholderField;
8750
+ if (fieldPath) onOpenFieldRef.current(fieldPath);
8751
+ };
8752
+ block.addEventListener("click", handleClick);
8753
+ return () => block.removeEventListener("click", handleClick);
8754
+ }, [input.blockId, selectBlock]);
8766
8755
  return {
8767
- reference: {
8768
- type: "image",
8769
- identifier: mediaIdentifierSchema$2.parse(asset.identifier)
8770
- },
8771
- imageAsset: asset
8756
+ probeRef,
8757
+ selected: selection?.selectedBlockId === input.blockId,
8758
+ blockElement,
8759
+ selectedElsewhere: selection?.selectedBlockId != null && selection.selectedBlockId !== input.blockId,
8760
+ phone
8772
8761
  };
8773
8762
  }
8774
- function imagePoolWithSelectedImage(input) {
8775
- const selection = input.selectedImage;
8776
- if (input.override.kind !== "image" || selection?.reference.identifier !== input.override.reference.identifier) return input.imagePool;
8777
- return [{
8778
- reference: input.override.reference,
8779
- source: "general-media",
8780
- mediaAsset: selection.imageAsset
8781
- }, ...input.imagePool.filter((item) => item.reference.identifier !== selection.reference.identifier)];
8782
- }
8783
- function selectedOrPooledImageAssetForReference(input) {
8784
- if (input.selectedImage?.reference.identifier === input.reference.identifier) return input.selectedImage.imageAsset;
8785
- return input.imagePool?.find((item) => item.reference.identifier === input.reference.identifier)?.mediaAsset;
8763
+ function useMediaQuery(query) {
8764
+ const [matches, setMatches] = useState(false);
8765
+ useEffect(() => {
8766
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
8767
+ const list = window.matchMedia(query);
8768
+ const update = () => setMatches(list.matches);
8769
+ update();
8770
+ list.addEventListener("change", update);
8771
+ return () => list.removeEventListener("change", update);
8772
+ }, [query]);
8773
+ return matches;
8786
8774
  }
8787
8775
  //#endregion
8788
- //#region ../preview-next/src/client/blocks/previewCustomizeActions.ts
8789
- function cyclePageDesignBlockLayout(block, direction) {
8790
- if (block.layoutChoice.effectiveValue === null) return null;
8791
- const layoutKeys = block.availableLayouts.map((layout) => layout.id);
8792
- const currentIndex = layoutKeys.indexOf(block.layoutChoice.effectiveValue);
8793
- if (currentIndex === -1) return null;
8794
- const layoutVariantKey = layoutKeys[direction === "next" ? (currentIndex + 1) % layoutKeys.length : currentIndex === 0 ? layoutKeys.length - 1 : currentIndex - 1];
8795
- if (!layoutVariantKey) return null;
8796
- return {
8797
- kind: "set-layout",
8798
- blockId: block.blockId,
8799
- layoutVariantKey,
8800
- baseContentId: block.contentRevision?.contentId ?? null
8801
- };
8802
- }
8803
- function cyclePageDesignBlockLook(block, direction) {
8804
- if (block.lookAvailability.kind !== "available" || block.availableLooks.length <= 1) return null;
8805
- const values = [null, ...block.availableLooks.map((look) => look.id)];
8806
- const currentIndex = cycleChoiceIndex(block.look, values, direction);
8807
- if (currentIndex === -1) return null;
8808
- const appearancePresetId = values[direction === "next" ? (currentIndex + 1) % values.length : currentIndex === 0 ? values.length - 1 : currentIndex - 1];
8809
- if (appearancePresetId === void 0) return null;
8810
- return {
8811
- kind: "set-look",
8812
- blockId: block.blockId,
8813
- appearancePresetId
8814
- };
8815
- }
8816
- function cyclePageDesignBlockFacet(input) {
8817
- const definition = systemCustomizeFacetDefinitionsForBlock(input.block.blockKind).find((candidate) => candidate.id === input.facetId) ?? null;
8818
- if (!definition) return null;
8819
- const value = systemCustomizeFacetNextValue(definition, input.currentValue, input.direction);
8820
- if (!value) return null;
8821
- return {
8822
- kind: "set-block-facet",
8823
- blockId: input.block.blockId,
8824
- facetId: input.facetId,
8825
- value,
8826
- fromValue: input.currentValue,
8827
- baseContentId: input.block.contentRevision?.contentId ?? null
8828
- };
8829
- }
8830
- function setPageDesignBlockBackground(input) {
8831
- const current = input.currentContent ? parseBackgroundOverrideFromContent(input.currentContent) : {
8832
- kind: "supported",
8833
- override: input.fromOverride ?? { kind: "default" }
8834
- };
8835
- const imagePool = imagePoolWithSelectedImage({
8836
- imagePool: input.imagePool ?? imagePoolForOverride(input.override),
8837
- override: input.override,
8838
- selectedImage: input.selectedImage
8839
- });
8840
- const plan = planBackgroundOverride(current, resolveBackgroundCapability({
8841
- block: input.block,
8842
- imagePool
8843
- }), input.override);
8844
- if (plan.kind !== "apply") return null;
8845
- const imageAsset = plan.override.kind === "image" ? selectedOrPooledImageAssetForReference({
8846
- imagePool: input.imagePool,
8847
- reference: plan.override.reference,
8848
- selectedImage: input.selectedImage
8849
- }) : void 0;
8850
- return {
8851
- kind: "set-background",
8852
- blockId: input.block.blockId,
8853
- override: plan.override,
8854
- fromOverride: plan.fromOverride,
8855
- baseContentId: input.block.contentRevision?.contentId ?? null,
8856
- ...imageAsset ? { imageAsset } : {}
8857
- };
8858
- }
8859
- function cycleChoiceIndex(choice, values, direction) {
8860
- if (choice.kind === "user-pinned" && choice.status === "supported") return values.findIndex((value) => value === choice.effectiveValue);
8861
- if ((choice.kind === "auto" || choice.kind === "user-pinned" && choice.status === "unsupported") && choice.effectiveValue === values[1]) {
8862
- if (values.length <= 2) return -1;
8863
- return direction === "next" ? 1 : 0;
8864
- }
8865
- return 0;
8866
- }
8867
- //#endregion
8868
- //#region ../preview-next/src/client/blocks/customizeFacetControls.ts
8869
- function previewCustomizeFacetControlsFor(blockKind, content, designBlock) {
8870
- if (!designBlock || designBlock.blockKind !== blockKind) return [];
8871
- return systemCustomizeFacetDefinitionsForBlock(blockKind).filter((definition) => systemCustomizeFacetAppliesToLayoutVariant(definition, designBlock.layoutChoice.effectiveValue ?? null)).map((definition) => {
8872
- const value = systemCustomizeFacetCurrentValue(definition, content);
8873
- return {
8874
- facetId: definition.id,
8875
- label: definition.label,
8876
- value,
8877
- valueLabel: systemCustomizeFacetLabelForValue(definition, value)
8878
- };
8879
- });
8880
- }
8881
- //#endregion
8882
- //#region ../preview-next/src/client/blocks/blockCustomizePopoverRows.ts
8883
- function buildBlockCustomizeBuiltinRows({ designBlock, facetControls, hasLayoutControls, hasLookControls, hasBackgroundControls }) {
8884
- const rows = [];
8885
- if (designBlock?.layout && hasLayoutControls) rows.push({
8886
- kind: "variant",
8887
- block: designBlock
8888
- });
8889
- if (designBlock?.layout?.status === "unsupported") rows.push({ kind: "unsupported-variant-warning" });
8890
- if (designBlock && hasLookControls) rows.push({
8891
- kind: "look",
8892
- block: designBlock
8893
- });
8894
- if (hasBackgroundControls) rows.push({ kind: "background" });
8895
- rows.push(...facetControls.map((control) => ({
8896
- kind: "facet",
8897
- control
8898
- })));
8899
- return rows;
8900
- }
8901
- function blockCustomizeBuiltinRowBudget(rows) {
8902
- return rows.length;
8903
- }
8904
- //#endregion
8905
- //#region ../preview-next/src/client/blocks/ArrangementLookControls.tsx
8906
- const darkPill = "flex items-center overflow-hidden rounded-full bg-black/80 text-xs text-white shadow";
8907
- const darkPillButton = "grid h-7 w-7 shrink-0 place-items-center hover:bg-black disabled:cursor-not-allowed disabled:opacity-40";
8908
- function ArrangementModeSwitchPill({ blockLabel, mode, onChoose }) {
8909
- return /* @__PURE__ */ jsxs("div", {
8910
- className: `${darkPill} gap-0.5 py-0.5 pl-2.5 pr-0.5`,
8911
- role: "group",
8912
- "aria-label": `What the ${blockLabel.toLowerCase()} shows`,
8913
- children: [/* @__PURE__ */ jsx("span", {
8914
- className: "pr-1 text-white/70",
8915
- children: "Shows"
8916
- }), mode.options.map((option) => /* @__PURE__ */ jsx("button", {
8917
- type: "button",
8918
- "aria-pressed": option.mode === mode.current,
8919
- className: `rounded-full px-2 py-1 ${option.mode === mode.current ? "bg-white text-black" : "hover:bg-black"}`,
8920
- onClick: (event) => {
8921
- event.preventDefault();
8922
- event.stopPropagation();
8923
- if (option.mode !== mode.current) onChoose(option.mode);
8924
- },
8925
- children: option.label
8926
- }, option.mode))]
8927
- });
8928
- }
8929
- function ArrangementLookPill({ look, canCycle, onCycle }) {
8930
- const arrow = (direction) => /* @__PURE__ */ jsx("button", {
8931
- type: "button",
8932
- className: darkPillButton,
8933
- "aria-label": direction === "prev" ? "Previous Look" : "Next Look",
8934
- disabled: !canCycle,
8935
- onClick: (event) => {
8936
- event.preventDefault();
8937
- event.stopPropagation();
8938
- onCycle(direction);
8939
- },
8940
- children: direction === "prev" ? /* @__PURE__ */ jsx(ChevronLeft, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
8941
- });
8942
- return /* @__PURE__ */ jsxs("div", {
8943
- className: `${darkPill} min-w-0 shrink`,
8776
+ //#region ../preview-next/src/client/blocks/BlockToolbar.tsx
8777
+ function BlockToolbar({ placement = DEFAULT_PREVIEW_CHROME_FLOATING_PLACEMENT, ...input }) {
8778
+ const { selection, controls, toolbar, open, cycleSdk, cycleLegacy } = useBlockToolbar(input);
8779
+ const name = controls.manifest?.title ?? getBlockDefinition(input.blockKind)?.manifest.title ?? input.blockKind;
8780
+ const row = /* @__PURE__ */ jsxs("div", {
8944
8781
  role: "group",
8945
- "aria-label": "Look",
8782
+ "aria-label": `${name} controls`,
8783
+ className: "flex items-center gap-1",
8784
+ "data-preview-chrome-row": "",
8946
8785
  children: [
8947
- arrow("prev"),
8948
- /* @__PURE__ */ jsxs("span", {
8949
- className: "flex min-w-0 max-w-[16rem] items-baseline gap-1.5 px-1 py-1",
8950
- "aria-live": "polite",
8951
- children: [
8952
- lookIsAutomatic(look) ? /* @__PURE__ */ jsx("span", {
8953
- className: "shrink-0 text-white/70",
8954
- children: "Automatic ·"
8955
- }) : null,
8956
- /* @__PURE__ */ jsx("span", {
8957
- className: "truncate font-medium",
8958
- children: look.lookName
8959
- }),
8960
- lookPosition(look) ? /* @__PURE__ */ jsx("span", {
8961
- className: "shrink-0 text-white/70",
8962
- children: lookPosition(look)
8963
- }) : null
8964
- ]
8786
+ /* @__PURE__ */ jsx(ToolbarNameButton, {
8787
+ name,
8788
+ open
8965
8789
  }),
8966
- arrow("next")
8790
+ toolbar?.controls.mode ? /* @__PURE__ */ jsx(ArrangementModeSwitchPill, {
8791
+ blockLabel: name,
8792
+ mode: toolbar.controls.mode,
8793
+ onChoose: toolbar.chooseMode
8794
+ }) : null,
8795
+ /* @__PURE__ */ jsx(ToolbarLook, {
8796
+ controls,
8797
+ toolbar,
8798
+ onCycleSdk: cycleSdk,
8799
+ onCycleLegacy: cycleLegacy
8800
+ })
8967
8801
  ]
8968
8802
  });
8803
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
8804
+ ref: selection.probeRef,
8805
+ "aria-hidden": "true"
8806
+ }), /* @__PURE__ */ jsx(ToolbarPlacement, {
8807
+ blockId: input.blockId,
8808
+ placement,
8809
+ selected: selection.selected,
8810
+ phone: selection.phone,
8811
+ children: row
8812
+ })] });
8969
8813
  }
8970
- function ArrangementOptionsButton({ open, controlsId, buttonRef, onClick }) {
8971
- return /* @__PURE__ */ jsxs("button", {
8972
- ref: buttonRef,
8973
- type: "button",
8974
- className: `${previewCustomizePillButtonClassName} inline-flex items-center gap-1`,
8975
- "aria-expanded": open,
8976
- "aria-haspopup": "dialog",
8977
- "aria-controls": open ? controlsId : void 0,
8978
- onClick,
8979
- children: [/* @__PURE__ */ jsx(SlidersHorizontal, {
8980
- size: 12,
8981
- "aria-hidden": "true"
8982
- }), "Options"]
8983
- });
8984
- }
8985
- /** Says why the block shows a different Look from the one the owner chose. */
8986
- function ArrangementLookNote({ look, styleName }) {
8987
- const message = look ? arrangementLookNote(look, styleName) : null;
8988
- if (!message) return null;
8989
- return /* @__PURE__ */ jsxs("p", {
8990
- className: "flex max-w-xs gap-1.5 rounded-lg border bg-background px-2.5 py-2 text-xs leading-4 text-foreground shadow",
8991
- children: [/* @__PURE__ */ jsx(Info, {
8992
- size: 13,
8993
- className: "mt-px shrink-0 text-muted-foreground",
8994
- "aria-hidden": "true"
8995
- }), /* @__PURE__ */ jsx("span", { children: message })]
8996
- });
8997
- }
8998
- function ArrangementOptionsBody({ controls, styleName, background, onChooseKnob, onChooseSurface, onEditHeadline }) {
8999
- const choices = controls.knobs.filter((control) => control.kind === "choice");
9000
- const flourishes = controls.knobs.filter((control) => control.kind === "text");
9001
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
9002
- controls.headlineHint ? /* @__PURE__ */ jsx(HeadlineHint, {
9003
- length: controls.headlineHint.length,
9004
- onEdit: onEditHeadline
9005
- }) : null,
9006
- choices.length > 0 ? /* @__PURE__ */ jsx("div", {
9007
- className: "space-y-3",
9008
- children: choices.map((control) => /* @__PURE__ */ jsx(KnobChoice, {
9009
- control,
9010
- styleName,
9011
- onChoose: onChooseKnob
9012
- }, control.facetId))
9013
- }) : null,
9014
- flourishes.length > 0 ? /* @__PURE__ */ jsxs("div", {
9015
- className: "space-y-3 border-t pt-3",
9016
- children: [/* @__PURE__ */ jsx("p", {
9017
- className: "text-xs font-medium text-muted-foreground",
9018
- children: "Short text for this Look"
9019
- }), flourishes.map((control) => /* @__PURE__ */ jsx(KnobText, {
9020
- control,
9021
- onChange: onChooseKnob
9022
- }, control.facetId))]
9023
- }) : null,
9024
- controls.knobs.length === 0 ? /* @__PURE__ */ jsx("p", {
9025
- className: "text-xs text-muted-foreground",
9026
- children: "This Look has no options."
9027
- }) : null,
9028
- background ? /* @__PURE__ */ jsx(SectionBackgroundChoice, {
9029
- background,
9030
- onChoose: onChooseSurface
9031
- }) : null
9032
- ] });
9033
- }
9034
- function HeadlineHint({ length, onEdit }) {
9035
- return /* @__PURE__ */ jsxs("p", {
9036
- className: "flex gap-1.5 rounded-md bg-muted/60 p-2 text-xs leading-4",
9037
- children: [/* @__PURE__ */ jsx(Info, {
9038
- size: 13,
9039
- className: "mt-px shrink-0 text-muted-foreground",
9040
- "aria-hidden": "true"
9041
- }), /* @__PURE__ */ jsxs("span", { children: [
9042
- "This Look suits a shorter headline. Yours is ",
9043
- length,
9044
- ", so it’s set a size smaller.",
9045
- " ",
9046
- /* @__PURE__ */ jsx("button", {
9047
- type: "button",
9048
- className: "font-medium underline underline-offset-2",
9049
- onClick: onEdit,
9050
- children: "Edit the headline"
9051
- })
9052
- ] })]
8814
+ function useBlockToolbar(input) {
8815
+ const uiStore = useEditorUiStoreInstance();
8816
+ const editorBlockId = useMemo(() => unsafeAsEditorBlockId(input.blockId), [input.blockId]);
8817
+ const values = useEditorUiStore((state) => state.drafts.getCurrentValues(editorBlockId)) ?? input.content;
8818
+ const { open, openField } = useOpenBlockSidebar(editorBlockId, uiStore);
8819
+ const selection = useBlockSelection({
8820
+ blockId: editorBlockId,
8821
+ onOpenField: openField
9053
8822
  });
9054
- }
9055
- function KnobChoice({ control, styleName, onChoose }) {
9056
- return /* @__PURE__ */ jsxs("div", { children: [
9057
- /* @__PURE__ */ jsx("div", {
9058
- className: "mb-1 text-xs font-medium text-slate-500",
9059
- children: control.label
9060
- }),
9061
- /* @__PURE__ */ jsx("div", {
9062
- className: "flex flex-wrap gap-1 rounded-lg border border-slate-200 bg-slate-50 p-1",
9063
- role: "group",
9064
- "aria-label": control.label,
9065
- children: control.options.map((option) => /* @__PURE__ */ jsx("button", {
9066
- type: "button",
9067
- "aria-pressed": option.value === control.value,
9068
- className: segmentClassName(option.value === control.value),
9069
- onClick: (event) => {
9070
- event.preventDefault();
9071
- event.stopPropagation();
9072
- if (option.value !== control.value) onChoose(control, option.value);
9073
- },
9074
- children: option.label
9075
- }, option.value))
9076
- }),
9077
- control.description ? /* @__PURE__ */ jsx("p", {
9078
- className: "mt-1 text-xs text-muted-foreground",
9079
- children: control.description
9080
- }) : null,
9081
- control.cappedBy ? /* @__PURE__ */ jsxs("p", {
9082
- className: "mt-1 text-[11px] text-muted-foreground",
9083
- children: [
9084
- control.cappedBy === "style" ? styleName : "This Look",
9085
- " goes up to ",
9086
- control.options[control.options.length - 1]?.label,
9087
- ", so that’s what shows."
9088
- ]
9089
- }) : null
9090
- ] });
9091
- }
9092
- function KnobText({ control, onChange }) {
9093
- const inputId = React.useId();
9094
- const countId = `${inputId}-count`;
9095
- return /* @__PURE__ */ jsxs("div", { children: [
9096
- /* @__PURE__ */ jsx("label", {
9097
- htmlFor: inputId,
9098
- className: "mb-1 block text-xs font-medium text-slate-500",
9099
- children: control.label
9100
- }),
9101
- /* @__PURE__ */ jsxs("div", {
9102
- className: "flex items-center gap-2",
9103
- children: [/* @__PURE__ */ jsx("input", {
9104
- id: inputId,
9105
- type: "text",
9106
- value: control.value,
9107
- maxLength: control.maxLength,
9108
- "aria-describedby": countId,
9109
- className: "min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm",
9110
- onChange: (event) => onChange(control, event.currentTarget.value.slice(0, control.maxLength))
9111
- }), /* @__PURE__ */ jsxs("span", {
9112
- id: countId,
9113
- className: "shrink-0 text-xs tabular-nums text-muted-foreground",
9114
- children: [
9115
- control.value.length,
9116
- "/",
9117
- control.maxLength
9118
- ]
9119
- })]
9120
- }),
9121
- /* @__PURE__ */ jsx("p", {
9122
- className: "mt-1 text-[11px] text-muted-foreground",
9123
- children: "Leave it empty and nothing shows."
9124
- })
9125
- ] });
9126
- }
9127
- function SectionBackgroundChoice({ background, onChoose }) {
9128
- if (background.kind === "held-by-photo") return /* @__PURE__ */ jsxs("div", {
9129
- className: "border-t pt-3",
9130
- children: [/* @__PURE__ */ jsx("div", {
9131
- className: "mb-1 text-xs font-medium text-slate-500",
9132
- children: "Section background"
9133
- }), /* @__PURE__ */ jsx("p", {
9134
- className: "text-xs text-muted-foreground",
9135
- children: "This section’s background is its photo for now."
9136
- })]
8823
+ const controls = useBlockCustomizeControls({
8824
+ blockId: editorBlockId,
8825
+ blockKind: input.blockKind,
8826
+ content: values,
8827
+ uiStore,
8828
+ theme: input.theme
9137
8829
  });
9138
- const swatch = (key, selected, label, color, value) => /* @__PURE__ */ jsxs("button", {
9139
- type: "button",
9140
- "aria-pressed": selected,
9141
- className: `flex items-center gap-2 rounded-md border px-2 py-1.5 text-left text-xs ${value === null ? "col-span-2" : ""} ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background hover:bg-muted"}`,
9142
- onClick: (event) => {
9143
- event.preventDefault();
9144
- event.stopPropagation();
9145
- if (!selected) onChoose(value);
8830
+ const { state, applyAction } = usePreviewPageDesignEditorState();
8831
+ const toolbar = useArrangementToolbar({
8832
+ designBlock: controls.designBlock,
8833
+ content: values,
8834
+ pageDesignState: state,
8835
+ selected: selection.selected,
8836
+ save: (action) => {
8837
+ applyAction(action, { runtimeContent: values });
9146
8838
  },
9147
- children: [/* @__PURE__ */ jsx("span", {
9148
- "aria-hidden": "true",
9149
- className: "h-5 w-7 shrink-0 rounded border",
9150
- style: color ? { backgroundColor: color } : { backgroundImage: "linear-gradient(135deg, rgb(var(--tb-background)) 50%, rgb(var(--tb-muted)) 50%)" }
9151
- }), /* @__PURE__ */ jsx("span", {
9152
- className: "min-w-0 truncate",
9153
- children: label
9154
- })]
9155
- }, key);
9156
- return /* @__PURE__ */ jsxs("div", {
9157
- className: "border-t pt-3",
9158
- children: [/* @__PURE__ */ jsx("div", {
9159
- className: "mb-1 text-xs font-medium text-slate-500",
9160
- children: "Section background"
9161
- }), /* @__PURE__ */ jsxs("div", {
9162
- className: "grid grid-cols-2 gap-1.5",
9163
- role: "group",
9164
- "aria-label": "Section background",
9165
- children: [swatch("rhythm", background.selected === null, "From the page rhythm", null, null), background.options.map((option) => swatch(option.name, background.selected === option.name, option.label, `rgb(var(--tb-${option.token}))`, option.name))]
9166
- })]
8839
+ chooseBackground: open,
8840
+ openField
9167
8841
  });
9168
- }
9169
- function segmentClassName(active) {
9170
- return ["min-h-8 flex-1 rounded-md px-2.5 text-xs font-medium transition focus:outline-none focus:ring-2 focus:ring-sky-400", active ? "bg-slate-950 text-white shadow-sm" : "bg-transparent text-slate-600 hover:bg-white hover:text-slate-950"].join(" ");
9171
- }
9172
- /** Unpinned blocks, and pins the current mode can't show, render the automatic Look. */
9173
- function lookIsAutomatic(look) {
9174
- return look.kind === "automatic" || look.kind === "mode-mismatch";
9175
- }
9176
- function lookPosition(look) {
9177
- return look.kind === "pinned" || look.kind === "style-fallback" ? `${look.position} of ${look.total}` : null;
9178
- }
9179
- function arrangementLookNote(look, styleName) {
9180
- switch (look.kind) {
9181
- case "automatic":
9182
- case "pinned": return null;
9183
- case "style-fallback": return `${styleName} doesn’t offer ${look.requestedName}, so this section shows ${look.lookName}. Your choice is kept and comes back if you switch style again.`;
9184
- case "mode-mismatch": return `${look.requestedName} is for the ${look.requestedModeLabel.toLowerCase()} view, so this section shows ${look.lookName}. Switch back and your choice returns.`;
9185
- }
9186
- }
9187
- //#endregion
9188
- //#region ../preview-next/src/client/blocks/ArrangementBlockToolbar.tsx
9189
- /**
9190
- * The block toolbar's state and actions on a style built from arrangement
9191
- * Looks. Every change goes through the customise history the legacy controls
9192
- * use: Looks as set-look, modes as set-layout, knobs as set-block-facet and
9193
- * backgrounds as set-background. Null on a legacy style.
9194
- */
9195
- function useArrangementToolbar(input) {
9196
- const { designBlock, content } = input;
9197
- const controls = useMemo(() => designBlock ? arrangementBlockControlsFor({
9198
- block: designBlock,
9199
- content
9200
- }) : null, [content, designBlock]);
9201
- const background = useMemo(() => designBlock && controls ? arrangementBackgroundControlFor({
9202
- block: designBlock,
9203
- content
9204
- }) : null, [
9205
- content,
9206
- controls,
9207
- designBlock
9208
- ]);
9209
- const [modeNotice, setModeNotice] = useState(null);
9210
- if (!designBlock || !controls) return null;
9211
- const baseContentId = designBlock.contentRevision?.contentId ?? null;
8842
+ const cycleSdk = (direction) => cycleSdkLook(controls, direction);
8843
+ const cycleLegacy = (direction) => {
8844
+ if (!controls.designBlock) return;
8845
+ const action = cyclePageDesignBlockLook(controls.designBlock, direction);
8846
+ if (action) applyAction(action, { runtimeContent: values });
8847
+ };
9212
8848
  return {
8849
+ selection,
9213
8850
  controls,
9214
- background,
9215
- styleName: styleNameFor(input.pageDesignState),
9216
- modeNotice: input.selected ? modeNotice : null,
9217
- cycleLook: (direction) => {
9218
- const appearancePresetId = nextArrangementLookPin(controls, designBlock, direction);
9219
- if (appearancePresetId === void 0) return;
9220
- setModeNotice(null);
9221
- input.save({
9222
- kind: "set-look",
9223
- blockId: designBlock.blockId,
9224
- appearancePresetId
9225
- });
9226
- },
9227
- chooseMode: (mode) => {
9228
- setModeNotice(mode);
9229
- input.save({
9230
- kind: "set-layout",
9231
- blockId: designBlock.blockId,
9232
- layoutVariantKey: asLayoutVariantKey(mode),
9233
- baseContentId
9234
- });
9235
- },
9236
- chooseKnob: (control, value) => {
9237
- input.save({
9238
- kind: "set-block-facet",
9239
- blockId: designBlock.blockId,
9240
- facetId: control.facetId,
9241
- value,
9242
- fromValue: control.stored,
9243
- baseContentId
9244
- });
9245
- },
9246
- chooseSurface: (surfaceName) => {
9247
- const option = background?.kind === "surfaces" ? background.options.find((candidate) => candidate.name === surfaceName) : void 0;
9248
- if (surfaceName === null) input.chooseBackground({ kind: "default" });
9249
- else if (option) input.chooseBackground({
9250
- kind: "color",
9251
- token: option.token
9252
- });
9253
- },
9254
- editHeadline: () => input.openField(headlineFieldPath(designBlock.blockKind))
8851
+ toolbar,
8852
+ open,
8853
+ cycleSdk,
8854
+ cycleLegacy
9255
8855
  };
9256
8856
  }
9257
- function ArrangementControlsRow({ toolbar, blockName, blockTitle, popover, onToggleOptions, editButton }) {
9258
- const { controls } = toolbar;
9259
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
9260
- /* @__PURE__ */ jsxs("div", {
9261
- role: "group",
9262
- "aria-label": `${blockTitle} controls`,
9263
- className: "flex min-w-0 items-center justify-end gap-1 sm:flex-wrap",
9264
- "data-preview-chrome-row": "",
9265
- children: [
9266
- blockName,
9267
- controls.mode ? /* @__PURE__ */ jsx(ArrangementModeSwitchPill, {
9268
- blockLabel: blockTitle,
9269
- mode: controls.mode,
9270
- onChoose: toolbar.chooseMode
9271
- }) : null,
9272
- controls.look ? /* @__PURE__ */ jsx(ArrangementLookPill, {
9273
- look: controls.look,
9274
- canCycle: controls.cycle.length > 1,
9275
- onCycle: toolbar.cycleLook
9276
- }) : null,
9277
- /* @__PURE__ */ jsx(ArrangementOptionsButton, {
9278
- open: popover.open,
9279
- controlsId: popover.panelId,
9280
- buttonRef: popover.buttonRef,
9281
- onClick: onToggleOptions
9282
- }),
9283
- editButton
9284
- ]
9285
- }),
9286
- /* @__PURE__ */ jsx(ArrangementLookNote, {
9287
- look: controls.look,
9288
- styleName: toolbar.styleName
9289
- }),
9290
- /* @__PURE__ */ jsx(ModeSwitchNotice, { toolbar })
9291
- ] });
9292
- }
9293
- function ArrangementOptionsCard({ toolbar, blockTitle, popover, historyFailure }) {
9294
- return /* @__PURE__ */ jsxs(CustomizePopoverShell, {
9295
- panelId: popover.panelId,
9296
- descriptionId: popover.descriptionId,
9297
- dialogLabel: `${blockTitle} options`,
9298
- eyebrow: blockTitle,
9299
- title: toolbar.controls.look?.lookName ?? blockTitle,
9300
- dialogRef: popover.dialogRef,
9301
- closeButtonRef: popover.registerInitialFocus,
9302
- onClose: popover.close,
9303
- onKeyDown: popover.handleDialogKeyDown,
9304
- desktopPlacement: "flow",
9305
- children: [/* @__PURE__ */ jsx(ArrangementOptionsBody, {
9306
- controls: toolbar.controls,
9307
- styleName: toolbar.styleName,
9308
- background: toolbar.background,
9309
- onChooseKnob: toolbar.chooseKnob,
9310
- onChooseSurface: toolbar.chooseSurface,
9311
- onEditHeadline: toolbar.editHeadline
9312
- }), historyFailure ? /* @__PURE__ */ jsx("p", {
9313
- className: "text-xs text-red-700",
9314
- children: historyFailure
9315
- }) : null]
9316
- });
9317
- }
9318
- /** Switching mode lands on a Look for that mode, and says which. */
9319
- function ModeSwitchNotice({ toolbar }) {
9320
- const { controls, modeNotice } = toolbar;
9321
- if (!modeNotice || controls.mode?.current !== modeNotice) return null;
9322
- const label = (controls.mode.options.find((option) => option.mode === modeNotice)?.label ?? modeNotice).toLowerCase();
9323
- return /* @__PURE__ */ jsx("p", {
9324
- role: "status",
9325
- className: "max-w-xs rounded-lg border bg-background px-2.5 py-2 text-xs leading-4 text-foreground shadow",
9326
- children: controls.look ? `Now showing ${label}, as ${controls.look.lookName}. The arrows step through Looks for ${label}.` : `Now showing ${label}. This style has no Looks for it yet, so it uses the plain version.`
9327
- });
9328
- }
9329
- function styleNameFor(state) {
9330
- return (state.kind === "loaded" ? getCuratedSiteStyle(state.editorModel.siteStyleId)?.name : null) ?? "This style";
9331
- }
9332
- function headlineFieldPath(blockKind) {
9333
- const source = getBlockDefinition(blockKind)?.manifest.titleSource;
9334
- return (typeof source === "string" ? source : source?.[0]) ?? "headline";
9335
- }
9336
- //#endregion
9337
- //#region ../preview-next/src/client/blocks/useBlockSelection.ts
9338
- const PHONE_VIEWPORT_QUERY = "(max-width: 639px)";
9339
- /**
9340
- * Click to select: a click anywhere in the block selects it, so its controls
9341
- * stay put instead of only showing on hover. A click on an empty placeholder
9342
- * also opens the side panel on the field that fills it.
9343
- */
9344
- function useBlockSelection(input) {
9345
- const probeRef = useRef(null);
8857
+ function useOpenBlockSidebar(blockId, uiStore) {
9346
8858
  const selection = usePreviewBlockCustomizeSelectionOptional();
9347
- const selectBlock = selection?.selectBlock;
9348
- const onOpenFieldRef = useRef(input.onOpenField);
9349
- onOpenFieldRef.current = input.onOpenField;
9350
- const phone = useMediaQuery(PHONE_VIEWPORT_QUERY);
9351
- const [blockElement, setBlockElement] = useState(null);
9352
- useEffect(() => {
9353
- const block = probeRef.current?.closest("[data-block-id]") ?? null;
9354
- setBlockElement(block);
9355
- if (!block || !selectBlock) return;
9356
- const handleClick = (event) => {
9357
- selectBlock(input.blockId);
9358
- const fieldPath = (event.target instanceof Element ? event.target.closest("[data-placeholder-field]") : null)?.dataset.placeholderField;
9359
- if (fieldPath) onOpenFieldRef.current(fieldPath);
9360
- };
9361
- block.addEventListener("click", handleClick);
9362
- return () => block.removeEventListener("click", handleClick);
9363
- }, [input.blockId, selectBlock]);
9364
- return {
9365
- probeRef,
9366
- selected: selection?.selectedBlockId === input.blockId,
9367
- blockElement,
9368
- selectedElsewhere: selection?.selectedBlockId != null && selection.selectedBlockId !== input.blockId,
9369
- phone
9370
- };
9371
- }
9372
- function useMediaQuery(query) {
9373
- const [matches, setMatches] = useState(false);
9374
- useEffect(() => {
9375
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
9376
- const list = window.matchMedia(query);
9377
- const update = () => setMatches(list.matches);
9378
- update();
9379
- list.addEventListener("change", update);
9380
- return () => list.removeEventListener("change", update);
9381
- }, [query]);
9382
- return matches;
9383
- }
9384
- //#endregion
9385
- //#region ../preview-next/src/client/blocks/BlockBackgroundChooser.tsx
9386
- function BackgroundChooser({ editingSlot, capability, current, imagePoolStatus, onChoose }) {
9387
- const chooseFromClick = (override) => (event) => {
9388
- event.preventDefault();
9389
- event.stopPropagation();
9390
- onChoose(override);
9391
- };
9392
- return /* @__PURE__ */ jsxs("div", {
9393
- className: "mt-2 max-h-80 overflow-y-auto rounded-md border bg-muted/20 p-2",
9394
- children: [
9395
- current.kind === "default" || current.kind === "color" ? /* @__PURE__ */ jsx(BackgroundColourOptions, {
9396
- capability,
9397
- current,
9398
- chooseFromClick
9399
- }) : null,
9400
- current.kind === "gradient" ? /* @__PURE__ */ jsx(BackgroundGradientOptions, {
9401
- capability,
9402
- current,
9403
- chooseFromClick
9404
- }) : null,
9405
- current.kind === "image" ? /* @__PURE__ */ jsx(BackgroundImageOptions, {
9406
- editingSlot,
9407
- capability,
9408
- current,
9409
- imagePoolStatus,
9410
- onChoose,
9411
- chooseFromClick
9412
- }) : null
9413
- ]
9414
- });
9415
- }
9416
- function BackgroundColourOptions({ capability, current, chooseFromClick }) {
9417
- return /* @__PURE__ */ jsx(CustomizeBackgroundColorPicker, {
9418
- title: "Colours",
9419
- selectedToken: current.kind === "color" ? current.token : null,
9420
- recommendedTokens: capability.recommendedColorTokens ?? capability.colorTokens ?? [],
9421
- advancedTokens: capability.advancedColorTokens ?? [],
9422
- defaultSelected: current.kind === "default",
9423
- onChooseDefault: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : void 0,
9424
- labelForToken: formatTokenLabel,
9425
- swatchColorForToken: tokenSwatchCss,
9426
- onChooseToken: (token, event) => {
9427
- chooseFromClick({
9428
- kind: "color",
9429
- token
9430
- })(event);
9431
- }
9432
- });
9433
- }
9434
- function BackgroundGradientOptions({ capability, current, chooseFromClick }) {
9435
- if (!capability.gradientIds?.length) return null;
9436
- return /* @__PURE__ */ jsxs("div", { children: [
9437
- /* @__PURE__ */ jsx("div", {
9438
- className: "mb-1 text-xs font-medium text-muted-foreground",
9439
- children: "Gradients"
9440
- }),
9441
- /* @__PURE__ */ jsx("p", {
9442
- className: "mb-2 text-[11px] leading-4 text-muted-foreground",
9443
- children: "Curated presets use this site's colours. The full section preview shows the final result."
9444
- }),
9445
- /* @__PURE__ */ jsx("div", {
9446
- className: "grid grid-cols-2 gap-2",
9447
- children: capability.gradientIds.map((gradientId) => /* @__PURE__ */ jsx(GradientPresetCard, {
9448
- gradientId,
9449
- selected: current.gradientId === gradientId,
9450
- onClick: chooseFromClick({
9451
- kind: "gradient",
9452
- gradientId
9453
- })
9454
- }, gradientId))
9455
- }),
9456
- /* @__PURE__ */ jsx(SelectedGradient, {
9457
- gradientId: current.gradientId,
9458
- onReset: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : null
9459
- })
9460
- ] });
9461
- }
9462
- function GradientPresetCard({ gradientId, selected, onClick }) {
9463
- const preset = getGradientPreset(gradientId);
9464
- const kindLabel = gradientKindLabel(preset);
9465
- return /* @__PURE__ */ jsxs("button", {
9466
- type: "button",
9467
- "aria-label": `Choose ${preset.name}, ${kindLabel}`,
9468
- "aria-pressed": selected,
9469
- className: `overflow-hidden rounded-md border text-left text-xs transition hover:border-muted-foreground ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background"}`,
9470
- onClick,
9471
- children: [/* @__PURE__ */ jsx("span", {
9472
- "aria-hidden": "true",
9473
- className: "block h-14 w-full border-b",
9474
- style: { backgroundImage: gradientPreviewCss(gradientId) }
9475
- }), /* @__PURE__ */ jsxs("span", {
9476
- className: "relative block min-w-0 px-2 py-1.5",
9477
- children: [
9478
- /* @__PURE__ */ jsx("span", {
9479
- className: "block truncate font-medium",
9480
- children: preset.name
9481
- }),
9482
- /* @__PURE__ */ jsx("span", {
9483
- className: "block text-[10px] text-muted-foreground",
9484
- children: kindLabel
9485
- }),
9486
- selected ? /* @__PURE__ */ jsx("span", {
9487
- "aria-hidden": "true",
9488
- className: "absolute right-2 top-1.5 grid h-4 w-4 place-items-center rounded-full bg-foreground text-[10px] text-background",
9489
- children: "✓"
9490
- }) : null
9491
- ]
9492
- })]
9493
- });
9494
- }
9495
- function SelectedGradient({ gradientId, onReset }) {
9496
- return /* @__PURE__ */ jsxs("div", {
9497
- className: "mt-2 flex items-center justify-between gap-2 border-t pt-2",
9498
- children: [/* @__PURE__ */ jsxs("span", {
9499
- className: "flex min-w-0 items-center gap-2",
9500
- children: [/* @__PURE__ */ jsx("span", {
9501
- "aria-hidden": "true",
9502
- className: "h-7 w-10 shrink-0 rounded border",
9503
- style: { backgroundImage: gradientPreviewCss(gradientId) }
9504
- }), /* @__PURE__ */ jsxs("span", {
9505
- className: "min-w-0",
9506
- children: [/* @__PURE__ */ jsx("span", {
9507
- className: "block truncate text-xs font-medium",
9508
- children: gradientLabel(gradientId)
9509
- }), /* @__PURE__ */ jsx("span", {
9510
- className: "block text-[10px] text-muted-foreground",
9511
- children: "Selected for this section"
9512
- })]
9513
- })]
9514
- }), onReset ? /* @__PURE__ */ jsx("button", {
9515
- type: "button",
9516
- className: "shrink-0 rounded px-1.5 py-1 text-xs font-medium hover:bg-muted",
9517
- onClick: onReset,
9518
- children: "Use the style’s background"
9519
- }) : null]
9520
- });
9521
- }
9522
- function BackgroundImageOptions({ editingSlot, capability, current, imagePoolStatus, onChoose, chooseFromClick }) {
9523
- const mediaEditorContext = useMediaEditorOptional();
9524
- const [mediaPickerOpenKey, setMediaPickerOpenKey] = useState(0);
9525
- if (!capability.modes.includes("image")) return null;
9526
- const images = rankBackgroundImagePoolItems(capability.imagePool ?? []);
9527
- return /* @__PURE__ */ jsxs("div", { children: [
9528
- /* @__PURE__ */ jsx("div", {
9529
- className: "mb-1 text-xs font-medium text-muted-foreground",
9530
- children: "Images"
9531
- }),
9532
- mediaEditorContext ? /* @__PURE__ */ jsx(MediaLibraryButton, { onOpen: () => setMediaPickerOpenKey((key) => key + 1) }) : null,
9533
- images.length ? /* @__PURE__ */ jsx("div", {
9534
- className: "space-y-1",
9535
- children: images.map((item) => /* @__PURE__ */ jsx(ImagePoolButton, {
9536
- item,
9537
- selected: current.reference.identifier === item.reference.identifier,
9538
- thumbnailUrl: backgroundImagePreviewUrl(item, mediaEditorContext),
9539
- onClick: chooseFromClick({
9540
- kind: "image",
9541
- reference: item.reference
9542
- })
9543
- }, `${item.source}:${item.reference.identifier}`))
9544
- }) : /* @__PURE__ */ jsx("p", {
9545
- className: "text-xs text-muted-foreground",
9546
- children: imagePoolStatus === "loading" ? "Loading images..." : "No background-ready images yet."
9547
- }),
9548
- mediaPickerOpenKey > 0 && mediaEditorContext ? /* @__PURE__ */ jsx(BackgroundMediaPicker, {
9549
- editingSlot,
9550
- openKey: mediaPickerOpenKey,
9551
- onChoose,
9552
- onDone: () => setMediaPickerOpenKey(0)
9553
- }) : null
9554
- ] });
9555
- }
9556
- function MediaLibraryButton({ onOpen }) {
9557
- return /* @__PURE__ */ jsxs("button", {
9558
- type: "button",
9559
- className: "mb-2 inline-flex w-full items-center justify-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs font-medium hover:bg-muted",
9560
- onClick: (event) => {
9561
- event.preventDefault();
9562
- event.stopPropagation();
9563
- onOpen();
9564
- },
9565
- children: [/* @__PURE__ */ jsx(Upload, { size: 13 }), "Media library"]
9566
- });
9567
- }
9568
- function ImagePoolButton({ item, selected, thumbnailUrl, onClick }) {
9569
- return /* @__PURE__ */ jsx("button", {
9570
- type: "button",
9571
- className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${selected ? "border-foreground" : "bg-background"}`,
9572
- onClick,
9573
- children: /* @__PURE__ */ jsxs("span", {
9574
- className: "flex min-w-0 items-center gap-2",
9575
- children: [/* @__PURE__ */ jsx("span", {
9576
- className: "grid h-7 w-9 shrink-0 place-items-center overflow-hidden rounded border bg-muted",
9577
- children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
9578
- alt: "",
9579
- className: "h-full w-full object-cover",
9580
- src: thumbnailUrl
9581
- }) : /* @__PURE__ */ jsx(Image, { size: 14 })
9582
- }), /* @__PURE__ */ jsxs("span", {
9583
- className: "min-w-0",
9584
- children: [/* @__PURE__ */ jsx("span", {
9585
- className: "block truncate",
9586
- children: item.label ?? "Image"
9587
- }), /* @__PURE__ */ jsx("span", {
9588
- className: "text-[11px] text-muted-foreground",
9589
- children: imageSourceLabel(item.source)
9590
- })]
9591
- })]
9592
- })
9593
- });
9594
- }
9595
- function BackgroundMediaPicker({ editingSlot, openKey, onChoose, onDone }) {
9596
- const mediaEditorContext = useMediaEditorOptional();
9597
- const chooseMediaValue = (value) => {
9598
- const selectedImage = selectedImageFromMediaValue(value, mediaEditorContext?.imageResolveContext.mediaAssetIndex);
9599
- if (!selectedImage) return;
9600
- onChoose({
9601
- kind: "image",
9602
- reference: selectedImage.reference
9603
- }, { selectedImage });
9604
- onDone();
9605
- };
9606
- return /* @__PURE__ */ jsx("div", {
9607
- onClick: (event) => event.stopPropagation(),
9608
- children: /* @__PURE__ */ jsx(MediaEditor, {
9609
- editingSlot,
9610
- value: void 0,
9611
- onChange: chooseMediaValue,
9612
- allowedKinds: ["image"],
9613
- mediaPickerAutoOpen: true,
9614
- mediaPickerPolicy: { assetSelection: backgroundMediaPickerAssetSelection },
9615
- showPreview: false,
9616
- showAltInput: false,
9617
- uploadIntent: {
9618
- tag: "media-library",
9619
- allowedRenderUses: ["image"]
9620
- },
9621
- onUploadComplete: (asset) => {
9622
- if (backgroundMediaPickerAssetSelection(asset).tag === "disabled") return;
9623
- const selectedImage = selectedImageFromRenderableAsset(asset);
9624
- onChoose({
9625
- kind: "image",
9626
- reference: selectedImage.reference
9627
- }, { selectedImage });
9628
- onDone();
9629
- }
9630
- }, openKey)
9631
- });
9632
- }
9633
- function formatVariantLabel(variantKey) {
9634
- return variantKey.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (letter) => letter.toUpperCase());
9635
- }
9636
- function BackgroundPreviewSwatch({ override, imagePool }) {
9637
- const mediaEditorContext = useMediaEditorOptional();
9638
- const baseClassName = "grid h-6 w-9 shrink-0 place-items-center overflow-hidden rounded-md border";
9639
- switch (override.kind) {
9640
- case "default": return /* @__PURE__ */ jsx("span", {
9641
- className: `${baseClassName} bg-background`,
9642
- children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border bg-muted" })
9643
- });
9644
- case "color": return /* @__PURE__ */ jsx("span", {
9645
- className: baseClassName,
9646
- style: { backgroundColor: tokenSwatchCss(override.token) }
9647
- });
9648
- case "gradient": return /* @__PURE__ */ jsx("span", {
9649
- className: baseClassName,
9650
- style: { backgroundImage: gradientPreviewCss(override.gradientId) }
9651
- });
9652
- case "image":
9653
- const imageItem = imagePool.find((item) => item.reference.identifier === override.reference.identifier);
9654
- const thumbnailUrl = imageItem ? backgroundImagePreviewUrl(imageItem, mediaEditorContext) : void 0;
9655
- return /* @__PURE__ */ jsx("span", {
9656
- className: `${baseClassName} bg-muted`,
9657
- children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
9658
- alt: "",
9659
- className: "h-full w-full object-cover",
9660
- src: thumbnailUrl
9661
- }) : /* @__PURE__ */ jsx(Image, { size: 15 })
9662
- });
9663
- }
9664
- }
9665
- function backgroundImagePreviewUrl(item, mediaEditorContext) {
9666
- const asset = item.mediaAsset;
9667
- if (!asset) return void 0;
9668
- return resolveImageUrlWithContext({
9669
- type: "image",
9670
- asset
9671
- }, {
9672
- width: 72,
9673
- height: 48,
9674
- resize: "cover",
9675
- quality: 70
9676
- }, mediaEditorContext?.imageResolveContext ?? null);
9677
- }
9678
- function backgroundMediaPickerAssetSelection(asset) {
9679
- if (isMarkedBackgroundAsset(asset)) return { tag: "selectable" };
9680
- if (asset.width == null || asset.height == null) return {
9681
- tag: "disabled",
9682
- reason: "This image is missing dimensions, so it cannot be checked for background use."
9683
- };
9684
- if (asset.width < 1920 || asset.height < 900) return {
9685
- tag: "disabled",
9686
- reason: `Background images need to be at least ${SECTION_BACKGROUND_MIN_SOURCE_WIDTH}x900. This image is ${asset.width}x${asset.height}.`
9687
- };
9688
- return { tag: "selectable" };
9689
- }
9690
- function isMarkedBackgroundAsset(asset) {
9691
- return asset.fileUses?.some((fileUse) => fileUse.tag === "site-background-asset") ?? false;
9692
- }
9693
- function gradientLabel(gradientId) {
9694
- return getGradientPreset(gradientId).name;
9695
- }
9696
- function gradientKindLabel(preset) {
9697
- switch (preset.type) {
9698
- case "linear": return "Linear";
9699
- case "radial": return "Radial · top";
9700
- case "conic": return "Conic";
9701
- default: return assertNever$1(preset.type, "Unhandled gradient preset type");
9702
- }
9703
- }
9704
- function imageSourceLabel(source) {
9705
- switch (source) {
9706
- case "current": return "Current";
9707
- case "generated-ambient": return "Generated";
9708
- case "previous-background": return "Previous";
9709
- case "general-media": return "Media library";
9710
- }
9711
- }
9712
- function tokenSwatchCss(token) {
9713
- return `rgb(var(--tb-${token}))`;
9714
- }
9715
- function gradientPreviewCss(gradientId) {
9716
- const preset = getGradientPreset(gradientId);
9717
- return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, tokenSwatchCss(stop.color)])));
9718
- }
9719
- /** Background colours by the part they play on the site, not their token names. */
9720
- const backgroundTokenLabels = {
9721
- background: "Page ground",
9722
- surface: "Card colour",
9723
- muted: "Quiet band",
9724
- primary: "Brand colour",
9725
- secondary: "Second brand colour",
9726
- accent: "Accent colour"
9727
- };
9728
- function formatTokenLabel(token) {
9729
- return backgroundTokenLabels[token] ?? formatVariantLabel(token.replace(/\//g, " "));
9730
- }
9731
- //#endregion
9732
- //#region ../preview-next/src/client/blocks/BlockToolbar.tsx
9733
- function isUnknownArray(value) {
9734
- return Array.isArray(value);
9735
- }
9736
- function BlockToolbar({ blockId, blockKind, content, bookingOfferingPresets, theme = null, placement = DEFAULT_PREVIEW_CHROME_FLOATING_PLACEMENT }) {
9737
- const uiStore = useEditorUiStoreInstance();
9738
- const editorBlockId = useMemo(() => unsafeAsEditorBlockId(blockId), [blockId]);
9739
- const draftContent = useEditorUiStore((state) => state.drafts.getCurrentValues(editorBlockId));
9740
- const customizeContent = useMemo(() => isRecord(draftContent) ? draftContent : content, [content, draftContent]);
9741
- const customizeSelection = usePreviewBlockCustomizeSelectionOptional();
9742
- const popover = useCustomizePopoverController();
9743
- const focusTarget = useMemo(() => computeDefaultFocus(blockKind, customizeContent), [blockKind, customizeContent]);
9744
- const [backgroundChooserOpen, setBackgroundChooserOpen] = useState(false);
9745
- const [backgroundColorPalette, setBackgroundColorPalette] = useState(null);
9746
- const { state: pageDesignState, applyAction: applyPageDesignAction, historyFailure, backgroundImagePool = [], backgroundImagePoolStatus = "idle", loadBackgroundImagePool = async () => [] } = usePreviewPageDesignEditorState();
9747
- const designBlock = useMemo(() => {
9748
- if (pageDesignState.kind !== "loaded") return null;
9749
- return pageDesignState.editorModel.blocks.find((block) => block.blockId === blockId) ?? null;
9750
- }, [blockId, pageDesignState]);
9751
- const hasLayoutControls = Boolean(designBlock?.layout && designBlock.availableLayouts.length > 1);
9752
- const hasLookControls = Boolean(designBlock?.lookAvailability.kind === "available");
9753
- const facetControls = useMemo(() => previewCustomizeFacetControlsFor(blockKind, customizeContent, designBlock), [
9754
- blockKind,
9755
- customizeContent,
9756
- designBlock
9757
- ]);
9758
- const hasFacetControls = facetControls.length > 0;
9759
- const currentBackground = useMemo(() => parseBackgroundOverrideFromContent(customizeContent), [customizeContent]);
9760
- const mergedBackgroundImagePool = useMemo(() => rankBackgroundImagePoolItems(dedupeBackgroundImagePool([...currentBackground.kind === "supported" ? imagePoolForOverride(currentBackground.override) : [], ...backgroundImagePool])), [backgroundImagePool, currentBackground]);
9761
- const backgroundCycleImagePool = useMemo(() => {
9762
- if (currentBackground.kind === "supported" && currentBackground.override.kind === "image") {
9763
- const currentOverride = currentBackground.override;
9764
- if (!backgroundImagePool.some((item) => item.reference.identifier === currentOverride.reference.identifier)) return rankBackgroundImagePoolItems(dedupeBackgroundImagePool([...imagePoolForOverride(currentOverride), ...backgroundImagePool]));
9765
- }
9766
- return rankBackgroundImagePoolItems(backgroundImagePool);
9767
- }, [backgroundImagePool, currentBackground]);
9768
- const backgroundCapability = useMemo(() => designBlock ? resolveBackgroundCapability({
9769
- block: designBlock,
9770
- imagePool: mergedBackgroundImagePool,
9771
- palette: backgroundColorPalette
9772
- }) : null, [
9773
- backgroundColorPalette,
9774
- designBlock,
9775
- mergedBackgroundImagePool
9776
- ]);
9777
- const backgroundTransitionCapability = useMemo(() => backgroundCapability ? {
9778
- ...backgroundCapability,
9779
- imagePool: backgroundCycleImagePool
9780
- } : null, [backgroundCapability, backgroundCycleImagePool]);
9781
- const enabledBackgroundModeList = useMemo(() => backgroundCapability ? enabledBackgroundModes(backgroundCapability) : [], [backgroundCapability]);
9782
- const hasBackgroundControls = currentBackground.kind === "supported" && enabledBackgroundModeList.length > 1;
9783
- const builtInCustomizeRows = useMemo(() => buildBlockCustomizeBuiltinRows({
9784
- designBlock,
9785
- facetControls,
9786
- hasLayoutControls,
9787
- hasLookControls,
9788
- hasBackgroundControls
9789
- }), [
9790
- designBlock,
9791
- facetControls,
9792
- hasBackgroundControls,
9793
- hasLayoutControls,
9794
- hasLookControls
9795
- ]);
9796
- const manifestCustomize = useBlockCustomizeControls({
9797
- blockId: editorBlockId,
9798
- blockKind,
9799
- content: customizeContent,
9800
- uiStore,
9801
- theme,
9802
- maxQuickFields: 3,
9803
- maxPopoverRows: 6,
9804
- builtInPopoverRows: blockCustomizeBuiltinRowBudget(builtInCustomizeRows)
9805
- });
9806
- const quickManifestFields = manifestCustomize.quickFields;
9807
- const hasSidebarCustomizeControls = manifestCustomize.hasControls;
9808
- const hasOverflowCustomizeControls = manifestCustomize.hasOverflowControls;
9809
- const quickManifestBackend = manifestCustomize.backend;
9810
- const canCycleBackgroundMode = enabledBackgroundModeList.length > 1;
9811
- const canCycleBackgroundValue = currentBackground.kind === "supported" && backgroundTransitionCapability ? canCycleBackgroundOverrideValue(currentBackground.override, backgroundTransitionCapability) : false;
9812
- const selection = useBlockSelection({
9813
- blockId: editorBlockId,
9814
- onOpenField: (fieldPath) => openField(fieldPath)
9815
- });
9816
- const arrangementToolbar = useArrangementToolbar({
9817
- designBlock,
9818
- content: customizeContent,
9819
- pageDesignState,
9820
- selected: selection.selected,
9821
- save: (action) => saveBlockCustomizeAction(action),
9822
- chooseBackground: (override) => chooseBackgroundOverride(override),
9823
- openField: (fieldPath) => openField(fieldPath)
9824
- });
9825
- const hasCustomizeControls = arrangementToolbar !== null || hasLayoutControls || hasLookControls || hasFacetControls || hasBackgroundControls || quickManifestFields.length > 0 || hasSidebarCustomizeControls;
9826
- useEffect(() => {
9827
- if (!hasCustomizeControls) {
9828
- popover.close();
9829
- setBackgroundChooserOpen(false);
9830
- }
9831
- }, [hasCustomizeControls, popover.close]);
9832
- useEffect(() => {
9833
- if (!popover.open) return;
9834
- setBackgroundColorPalette(readBackgroundColorPaletteSnapshot());
9835
- }, [pageDesignState, popover.open]);
9836
- useEffect(() => {
9837
- if (!popover.open || !backgroundCapability?.modes.includes("image")) return;
9838
- if (backgroundImagePoolStatus !== "idle") return;
9839
- loadBackgroundImagePool();
9840
- }, [
9841
- backgroundCapability,
9842
- backgroundImagePoolStatus,
9843
- loadBackgroundImagePool,
9844
- popover.open
9845
- ]);
9846
- const openField = useCallback((fieldPath) => {
9847
- const state = uiStore.getState();
9848
- state.setPreviewSidebarTab("editor");
9849
- state.setDrawerOpen(true);
9850
- state.requestFocus({
9851
- kind: "main-field",
9852
- blockId: editorBlockId,
9853
- fieldPath: `content.${fieldPath}`
9854
- });
9855
- }, [editorBlockId, uiStore]);
9856
- useEffect(() => {
9857
- if (selection.selectedElsewhere) popover.close();
9858
- }, [popover.close, selection.selectedElsewhere]);
9859
- const handleEdit = (e) => {
9860
- e.preventDefault();
9861
- e.stopPropagation();
9862
- const state = uiStore.getState();
9863
- state.setPreviewSidebarTab("editor");
9864
- state.setDrawerOpen(true);
9865
- const path = typeof focusTarget.itemIndex === "number" && focusTarget.fieldPath ? `${focusTarget.fieldPath}.${focusTarget.itemIndex}` : focusTarget.fieldPath;
9866
- state.requestFocus(path ? {
8859
+ const open = () => {
8860
+ selection?.selectBlock(blockId);
8861
+ selection?.inspectBlock(blockId);
8862
+ uiStore.getState().setDrawerOpen(true);
8863
+ };
8864
+ const openField = (fieldPath) => {
8865
+ open();
8866
+ uiStore.getState().requestFocus({
9867
8867
  kind: "main-field",
9868
- blockId: editorBlockId,
9869
- fieldPath: path
9870
- } : {
9871
- kind: "block",
9872
- blockId: editorBlockId
9873
- });
9874
- };
9875
- const inspectBlock = useCallback(() => {
9876
- customizeSelection?.inspectBlock(unsafeAsEditorBlockId(blockId));
9877
- }, [blockId, customizeSelection]);
9878
- const openSidebarCustomize = useCallback((e) => {
9879
- e.preventDefault();
9880
- e.stopPropagation();
9881
- inspectBlock();
9882
- const state = uiStore.getState();
9883
- state.setPreviewSidebarTab("editor");
9884
- state.setDrawerOpen(true);
9885
- }, [inspectBlock, uiStore]);
9886
- const cycleLayout = (direction) => {
9887
- if (!designBlock) return;
9888
- const action = cyclePageDesignBlockLayout(designBlock, direction);
9889
- if (!action) return;
9890
- saveBlockCustomizeAction(action);
9891
- };
9892
- const cycleLook = (direction) => {
9893
- if (!designBlock) return;
9894
- const action = cyclePageDesignBlockLook(designBlock, direction);
9895
- if (!action) return;
9896
- saveBlockCustomizeAction(action);
9897
- };
9898
- const cycleFacet = (control, direction) => {
9899
- if (!designBlock) return;
9900
- const action = cyclePageDesignBlockFacet({
9901
- block: designBlock,
9902
- facetId: control.facetId,
9903
- currentValue: control.value,
9904
- direction
9905
- });
9906
- if (!action) return;
9907
- saveBlockCustomizeAction(action);
9908
- };
9909
- const handleBackgroundCycle = (action) => (e) => {
9910
- e.preventDefault();
9911
- e.stopPropagation();
9912
- saveBackgroundTransition(action);
9913
- };
9914
- const chooseBackgroundOverride = (override, options) => {
9915
- if (!designBlock) return;
9916
- const action = setPageDesignBlockBackground({
9917
- block: designBlock,
9918
- override,
9919
- currentContent: customizeContent,
9920
- imagePool: mergedBackgroundImagePool,
9921
- selectedImage: options?.selectedImage
9922
- });
9923
- if (!action) return;
9924
- saveBlockCustomizeAction(action);
9925
- setBackgroundChooserOpen(false);
9926
- };
9927
- const saveBackgroundTransition = (transition) => {
9928
- if (!designBlock || !backgroundTransitionCapability || currentBackground.kind !== "supported") return;
9929
- const plan = planBackgroundTransition(currentBackground.override, backgroundTransitionCapability, transition);
9930
- if (plan.kind !== "apply") return;
9931
- const action = setPageDesignBlockBackground({
9932
- block: designBlock,
9933
- override: plan.override,
9934
- currentContent: customizeContent,
9935
- imagePool: mergedBackgroundImagePool
8868
+ blockId,
8869
+ fieldPath: fieldPath.startsWith("content.") ? fieldPath : `content.${fieldPath}`
9936
8870
  });
9937
- if (!action) return;
9938
- saveBlockCustomizeAction(action);
9939
- };
9940
- const saveBlockCustomizeAction = (action) => {
9941
- applyPageDesignAction(action, { runtimeContent: customizeContent });
9942
- };
9943
- const toggleCustomize = (e) => {
9944
- if (!popover.open) {
9945
- inspectBlock();
9946
- customizeSelection?.selectBlock(editorBlockId);
9947
- }
9948
- popover.toggle(e);
9949
8871
  };
9950
- const blockTitle = formatBlockKindLabel$1(blockKind);
9951
- const blockName = /* @__PURE__ */ jsx(BlockNamePill, {
9952
- phone: selection.phone,
9953
- label: blockTitle
9954
- });
9955
- const editButton = /* @__PURE__ */ jsx("button", {
9956
- type: "button",
9957
- onClick: handleEdit,
9958
- className: previewCustomizePillButtonClassName,
9959
- children: "Edit"
9960
- });
9961
- const legacyPopover = /* @__PURE__ */ jsx(LegacyCustomisePopover, {
9962
- popover,
9963
- blockTitle,
9964
- rows: builtInCustomizeRows.map((row) => renderBlockCustomizeBuiltinRow(row, {
9965
- backgroundCapability,
9966
- backgroundChooserOpen,
9967
- canCycleBackgroundMode,
9968
- canCycleBackgroundValue,
9969
- currentBackground,
9970
- cycleLayout,
9971
- cycleLook,
9972
- cycleFacet,
9973
- enabledBackgroundModeList,
9974
- handleBackgroundCycle,
9975
- imagePoolStatus: backgroundImagePoolStatus,
9976
- editingSlot: `${blockId}:_sectionStyles.background.image`,
9977
- mergedBackgroundImagePool,
9978
- onChooseBackgroundOverride: chooseBackgroundOverride,
9979
- onToggleBackgroundChooser: () => setBackgroundChooserOpen((open) => !open)
9980
- })),
9981
- quickFields: quickManifestBackend ? /* @__PURE__ */ jsx(QuickManifestFields, {
9982
- fields: quickManifestFields,
9983
- backend: quickManifestBackend,
9984
- blockKind,
9985
- bookingOfferingPresets
9986
- }) : null,
9987
- historyFailure,
9988
- onOpenMoreOptions: hasOverflowCustomizeControls ? openSidebarCustomize : null
9989
- });
9990
- return /* @__PURE__ */ jsx(BlockToolbarFrame, {
9991
- selection,
9992
- placement,
9993
- forceVisible: popover.open,
9994
- controls: arrangementToolbar ? /* @__PURE__ */ jsx(ArrangementControlsRow, {
9995
- toolbar: arrangementToolbar,
9996
- blockName,
9997
- blockTitle,
9998
- popover,
9999
- onToggleOptions: toggleCustomize,
10000
- editButton
10001
- }) : /* @__PURE__ */ jsx(LegacyControlsRow, {
10002
- blockName,
10003
- blockTitle,
10004
- popover,
10005
- showCustomise: hasCustomizeControls,
10006
- onToggleCustomise: toggleCustomize,
10007
- editButton
10008
- }),
10009
- popoverPanel: popover.open && arrangementToolbar ? /* @__PURE__ */ jsx(ArrangementOptionsCard, {
10010
- toolbar: arrangementToolbar,
10011
- blockTitle,
10012
- popover,
10013
- historyFailure
10014
- }) : popover.open && (designBlock || hasSidebarCustomizeControls) ? legacyPopover : null
10015
- });
10016
- }
10017
- /**
10018
- * Where a block's controls go: floating with the block on wider screens, or
10019
- * in one dock above the toolbar on a phone (only for the selected section).
10020
- */
10021
- function BlockToolbarFrame({ selection, placement, forceVisible, controls, popoverPanel }) {
10022
- const dock = selection.phone && selection.selected;
10023
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
10024
- /* @__PURE__ */ jsx("span", {
10025
- ref: selection.probeRef,
10026
- "aria-hidden": "true",
10027
- style: { display: "contents" }
10028
- }),
10029
- dock ? /* @__PURE__ */ jsxs(PhoneBlockDock, {
10030
- themeSource: selection.blockElement,
10031
- children: [controls, popoverPanel]
10032
- }) : null,
10033
- selection.phone ? null : /* @__PURE__ */ jsxs(PreviewChromeFloatingControl, {
10034
- anchorSelector: "[data-block-id]",
10035
- placement,
10036
- fallbackClassName: "pointer-events-auto absolute z-50 flex flex-col items-end gap-1 opacity-0 transition group-focus-within:opacity-100 group-hover:opacity-100",
10037
- fallbackStyle: {
10038
- top: placement.kind === "anchor-top-right-clamped" ? placement.minTopPx : placement.topPx,
10039
- right: placement.rightPx
10040
- },
10041
- portalClassName: "absolute z-[70] flex flex-col items-end gap-1 transition",
10042
- forceVisible,
10043
- selected: selection.selected,
10044
- stayInsideAnchor: true,
10045
- children: [controls, popoverPanel]
10046
- })
10047
- ] });
10048
- }
10049
- /** Quiet block identity beside either toolbar's controls, omitted in the phone dock. */
10050
- function BlockNamePill({ phone, label }) {
10051
- if (phone) return null;
10052
- return /* @__PURE__ */ jsx("span", {
10053
- className: "shrink-0 rounded-full bg-background/95 px-2.5 py-1 text-xs text-muted-foreground",
10054
- children: label
10055
- });
10056
- }
10057
- function LegacyControlsRow({ blockName, blockTitle, popover, showCustomise, onToggleCustomise, editButton }) {
10058
- return /* @__PURE__ */ jsxs("div", {
10059
- role: "group",
10060
- "aria-label": `${blockTitle} controls`,
10061
- className: "flex items-center gap-1",
10062
- "data-preview-chrome-row": "",
10063
- children: [
10064
- blockName,
10065
- showCustomise ? /* @__PURE__ */ jsx(CustomizePillButton, {
10066
- buttonRef: popover.buttonRef,
10067
- ariaLabel: "Customise",
10068
- open: popover.open,
10069
- controlsId: popover.panelId,
10070
- onClick: onToggleCustomise
10071
- }) : null,
10072
- editButton
10073
- ]
10074
- });
10075
- }
10076
- function QuickManifestFields({ fields, backend, blockKind, bookingOfferingPresets }) {
10077
- if (fields.length === 0) return null;
10078
- return /* @__PURE__ */ jsx("div", {
10079
- className: "border-t pt-3",
10080
- children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
10081
- bookingOfferingPresets,
10082
- children: /* @__PURE__ */ jsx(FormRenderer, {
10083
- dateContext: civilPickerDisplay.dateContext,
10084
- fields,
10085
- backend,
10086
- widgetOverrides: previewWidgetOverrides,
10087
- showSettingsTrigger: false,
10088
- blockKind,
10089
- className: "space-y-3"
10090
- })
10091
- })
10092
- });
10093
- }
10094
- /** On a phone the selected section's controls sit in one dock above the toolbar. */
10095
- function PhoneBlockDock({ themeSource, children }) {
10096
- if (typeof document === "undefined") return null;
10097
- return createPortal(/* @__PURE__ */ jsx("div", {
8872
+ return {
8873
+ open,
8874
+ openField
8875
+ };
8876
+ }
8877
+ function cycleSdkLook(controls, direction) {
8878
+ const item = controls.lookSource.kind === "sdk" ? controls.lookSource.item : null;
8879
+ if (item?.field.type !== "select" || !controls.backend) return;
8880
+ const options = item.field.options;
8881
+ const current = options.findIndex((option) => option.value === (controls.backend?.getValue(item.path) ?? item.field.defaultValue));
8882
+ const next = options[(Math.max(0, current) + (direction === "next" ? 1 : options.length - 1)) % options.length];
8883
+ if (next) controls.backend.setValue(item.path, next.value);
8884
+ }
8885
+ /** The Look pill shows only while its arrows have somewhere to go. */
8886
+ function ToolbarLook({ controls, toolbar, onCycleSdk, onCycleLegacy }) {
8887
+ if (controls.lookSource.kind === "sdk") {
8888
+ const field = cyclableSdkLookField(controls.lookSource.item);
8889
+ return field && controls.lookSource.item ? /* @__PURE__ */ jsx(SdkToolbarLook, {
8890
+ field,
8891
+ value: controls.backend?.getValue(controls.lookSource.item.path),
8892
+ onCycle: onCycleSdk
8893
+ }) : null;
8894
+ }
8895
+ if (toolbar?.controls.look) return toolbar.controls.cycle.length > 1 ? /* @__PURE__ */ jsx(ArrangementLookPill, {
8896
+ look: toolbar.controls.look,
8897
+ onCycle: toolbar.cycleLook
8898
+ }) : null;
8899
+ if (!controls.designBlock) return null;
8900
+ const preset = pageDesignLookPosition(controls.designBlock);
8901
+ return preset.canCycle ? /* @__PURE__ */ jsx(LookCyclePill, {
8902
+ lookName: preset.lookName,
8903
+ position: preset.position,
8904
+ onCycle: onCycleLegacy
8905
+ }) : null;
8906
+ }
8907
+ function cyclableSdkLookField(item) {
8908
+ return item?.field.type === "select" && item.field.options.length > 1 ? item.field : null;
8909
+ }
8910
+ function ToolbarPlacement({ blockId, placement, selected, phone, children }) {
8911
+ if (phone && selected && typeof document !== "undefined") return createPortal(/* @__PURE__ */ jsx("div", {
10098
8912
  "data-preview-block-dock": "",
8913
+ className: "builder-dashboard-chrome-theme fixed inset-x-2 bottom-[calc(var(--builder-editor-chrome-offset,0px)+0.5rem)] rounded-xl border bg-background/95 p-2 text-foreground shadow-xl",
10099
8914
  style: {
10100
- ...themeSource ? readThemeCustomProperties(themeSource) : {},
10101
- zIndex: PREVIEW_CHROME_Z_INDEX
8915
+ ...readThemeCustomProperties(document.querySelector(`[data-block-id="${blockId}"]`) ?? document.documentElement),
8916
+ zIndex: 30
10102
8917
  },
10103
- className: "builder-dashboard-chrome-theme fixed inset-x-2 bottom-[calc(var(--builder-editor-chrome-offset,0px)+0.5rem)] flex flex-col items-stretch gap-1.5 rounded-xl border bg-background/95 p-2 text-foreground shadow-xl",
10104
8918
  children
10105
8919
  }), document.body);
10106
- }
10107
- /** The Customise card for legacy styles: today's rows, quick fields and More options. */
10108
- function LegacyCustomisePopover({ popover, blockTitle, rows, quickFields, historyFailure, onOpenMoreOptions }) {
10109
- return /* @__PURE__ */ jsxs(CustomizePopoverShell, {
10110
- panelId: popover.panelId,
10111
- descriptionId: popover.descriptionId,
10112
- dialogLabel: "Customise section",
10113
- eyebrow: "Section",
10114
- title: blockTitle,
10115
- dialogRef: popover.dialogRef,
10116
- closeButtonRef: popover.registerInitialFocus,
10117
- onClose: popover.close,
10118
- onKeyDown: popover.handleDialogKeyDown,
10119
- spacing: "compact",
10120
- children: [
10121
- rows,
10122
- quickFields,
10123
- historyFailure ? /* @__PURE__ */ jsx("p", {
10124
- className: "text-xs text-red-700",
10125
- children: historyFailure
10126
- }) : null,
10127
- onOpenMoreOptions ? /* @__PURE__ */ jsx("div", {
10128
- className: "border-t pt-2",
10129
- children: /* @__PURE__ */ jsx("button", {
10130
- type: "button",
10131
- "aria-label": "Open more options in the side panel",
10132
- className: "w-full rounded-md border bg-background px-3 py-2 text-sm font-medium hover:bg-muted",
10133
- onClick: onOpenMoreOptions,
10134
- children: "More options"
10135
- })
10136
- }) : null
10137
- ]
8920
+ return /* @__PURE__ */ jsx(PreviewChromeFloatingControl, {
8921
+ anchorSelector: `[data-block-id="${blockId}"]`,
8922
+ placement,
8923
+ selected,
8924
+ stayInsideAnchor: true,
8925
+ fallbackClassName: "absolute right-4 top-2",
8926
+ children
10138
8927
  });
10139
8928
  }
10140
- function renderBlockCustomizeBuiltinRow(row, context) {
10141
- switch (row.kind) {
10142
- case "variant": return /* @__PURE__ */ jsx(CustomizeCycleRow, {
10143
- label: "Layout",
10144
- valueLabel: layoutLabel(row.block.availableLayouts, row.block.layoutChoice.effectiveValue ?? ""),
10145
- previousLabel: "Previous layout",
10146
- nextLabel: "Next layout",
10147
- availability: cycleAvailability({ kind: "available" }),
10148
- onPrevious: () => context.cycleLayout("prev"),
10149
- onNext: () => context.cycleLayout("next")
10150
- }, "variant");
10151
- case "unsupported-variant-warning": return /* @__PURE__ */ jsx("p", {
10152
- className: "text-xs text-amber-700",
10153
- children: "This layout is no longer available. The preview is using the closest safe option."
10154
- }, "unsupported-variant-warning");
10155
- case "look": return /* @__PURE__ */ jsx(CustomizeCycleRow, {
10156
- label: "Look",
10157
- valueLabel: lookLabel(row.block),
10158
- previousLabel: "Previous look",
10159
- nextLabel: "Next look",
10160
- availability: cycleAvailability(canCycleLookForRow(row.block) ? { kind: "available" } : { kind: "single-option" }),
10161
- onPrevious: () => context.cycleLook("prev"),
10162
- onNext: () => context.cycleLook("next")
10163
- }, "look");
10164
- case "background":
10165
- if (context.currentBackground.kind !== "supported" || !context.backgroundCapability) return null;
10166
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(CustomizeBackgroundControlRows, {
10167
- modeLabel: backgroundModeLabel(context.currentBackground.override.kind),
10168
- valueLabel: backgroundOverrideValueLabel(context.currentBackground.override, context.mergedBackgroundImagePool),
10169
- valueAriaLabel: `Choose background ${backgroundOverrideLabel(context.currentBackground.override).toLowerCase()}`,
10170
- swatch: /* @__PURE__ */ jsx(BackgroundPreviewSwatch, {
10171
- override: context.currentBackground.override,
10172
- imagePool: context.mergedBackgroundImagePool
10173
- }),
10174
- chooserOpen: context.backgroundChooserOpen,
10175
- canCycleMode: context.canCycleBackgroundMode,
10176
- canCycleValue: context.canCycleBackgroundValue,
10177
- onCycleMode: (direction, event) => context.handleBackgroundCycle({
10178
- kind: "cycle-mode",
10179
- direction
10180
- })(event),
10181
- onCycleValue: (direction, event) => context.handleBackgroundCycle({
10182
- kind: "cycle-value",
10183
- direction
10184
- })(event),
10185
- onToggleChooser: (event) => {
10186
- event.preventDefault();
10187
- event.stopPropagation();
10188
- context.onToggleBackgroundChooser();
10189
- },
10190
- chooser: /* @__PURE__ */ jsx(BackgroundChooser, {
10191
- editingSlot: context.editingSlot,
10192
- capability: context.backgroundCapability,
10193
- current: context.currentBackground.override,
10194
- imagePoolStatus: context.imagePoolStatus,
10195
- onChoose: context.onChooseBackgroundOverride
10196
- })
10197
- }) }, "background");
10198
- case "facet": return /* @__PURE__ */ jsx(CustomizeCycleRow, {
10199
- label: row.control.label,
10200
- valueLabel: row.control.valueLabel,
10201
- previousLabel: `Previous ${row.control.label.toLowerCase()}`,
10202
- nextLabel: `Next ${row.control.label.toLowerCase()}`,
10203
- availability: cycleAvailability({ kind: "available" }),
10204
- onPrevious: () => context.cycleFacet(row.control, "prev"),
10205
- onNext: () => context.cycleFacet(row.control, "next")
10206
- }, `facet:${row.control.facetId}`);
10207
- default: return assertNever$1(row, "Unhandled block customize builtin row");
10208
- }
10209
- }
10210
- function canCycleLookForRow(block) {
10211
- return block.lookAvailability.kind === "available" && block.availableLooks.length > 1;
10212
- }
10213
- function computeDefaultFocus(blockKind, content) {
10214
- const definition = getBlockDefinition(blockKind);
10215
- if (!definition?.manifest) return {
10216
- fieldPath: null,
10217
- itemIndex: null
10218
- };
10219
- const result = findFirstFieldPath(definition.manifest.fields, content, []);
10220
- if (!result) return {
10221
- fieldPath: null,
10222
- itemIndex: null
10223
- };
10224
- return {
10225
- fieldPath: result.path ? `content.${result.path}` : null,
10226
- itemIndex: typeof result.itemIndex === "number" ? result.itemIndex : null
10227
- };
10228
- }
10229
- function findFirstFieldPath(fields, data, prefix) {
10230
- for (const field of fields) {
10231
- if (field.ui?.hidden) continue;
10232
- if (Array.isArray(field.visibleRoles) && !field.visibleRoles.includes("author")) continue;
10233
- const nextPrefix = [...prefix, field.id];
10234
- if (field.type === "group") {
10235
- const groupValue = isRecord(data) ? data[field.id] : void 0;
10236
- const nested = findFirstFieldPath(field.schema.fields, groupValue, nextPrefix);
10237
- if (nested) return nested;
10238
- continue;
10239
- }
10240
- if (field.type === "repeater" && field.schema) {
10241
- const collection = isRecord(data) ? data[field.id] : void 0;
10242
- const items = isUnknownArray(collection) ? collection : [];
10243
- if (items.length > 0) {
10244
- const firstItem = items[0];
10245
- const nested = findFirstFieldPath(field.schema.fields, firstItem, [...nextPrefix, "0"]);
10246
- if (nested) return nested;
10247
- return {
10248
- path: nextPrefix.join("."),
10249
- itemIndex: 0
10250
- };
10251
- }
10252
- return {
10253
- path: nextPrefix.join("."),
10254
- itemIndex: 0
10255
- };
10256
- }
10257
- return { path: nextPrefix.join(".") };
10258
- }
10259
- return null;
10260
- }
10261
- function formatBlockKindLabel$1(blockKind) {
10262
- return getBlockDefinition(blockKind)?.manifest.title ?? formatVariantLabel(blockKind.replace(/^block\./, "").replace(/\./g, " "));
10263
- }
10264
- function layoutLabel(layouts, variantKey) {
10265
- return layouts.find((layout) => layout.id === variantKey)?.label ?? formatVariantLabel(variantKey);
10266
- }
10267
- function lookLabel(block) {
10268
- const option = block.availableLooks.find((look) => look.id === block.look.effectiveValue) ?? null;
10269
- if (block.look.kind === "auto" || block.look.status === "unsupported") return option ? `Automatic · ${option.label}` : "Automatic";
10270
- return option?.label ?? "Selected look";
10271
- }
10272
- function backgroundOverrideLabel(override) {
10273
- switch (override.kind) {
10274
- case "default": return "From the style";
10275
- case "color": return `Colour: ${formatTokenLabel(override.token)}`;
10276
- case "gradient": return `Gradient: ${gradientLabel(override.gradientId)}`;
10277
- case "image": return "Image";
10278
- }
10279
- }
10280
- function backgroundOverrideValueLabel(override, imagePool) {
10281
- switch (override.kind) {
10282
- case "default": return "No colour chosen";
10283
- case "color": return formatTokenLabel(override.token);
10284
- case "gradient": return gradientLabel(override.gradientId);
10285
- case "image": return imagePool.find((item) => item.reference.identifier === override.reference.identifier)?.label ?? "Image";
10286
- }
10287
- }
10288
- function backgroundModeLabel(mode) {
10289
- switch (mode) {
10290
- case "default": return "From the style";
10291
- case "color": return "Colour";
10292
- case "gradient": return "Gradient";
10293
- case "image": return "Photo";
10294
- }
8929
+ function ToolbarNameButton({ name, open }) {
8930
+ return /* @__PURE__ */ jsxs("button", {
8931
+ type: "button",
8932
+ className: "flex h-7 shrink-0 items-center rounded-full bg-background/95 px-3 text-xs font-medium text-foreground shadow hover:bg-background",
8933
+ onClick: (event) => {
8934
+ event.stopPropagation();
8935
+ open();
8936
+ },
8937
+ children: [name, " ›"]
8938
+ });
10295
8939
  }
10296
- function readBackgroundColorPaletteSnapshot() {
10297
- if (typeof window === "undefined" || typeof document === "undefined") return null;
10298
- const rootStyle = window.getComputedStyle(document.documentElement);
10299
- const bodyStyle = document.body ? window.getComputedStyle(document.body) : null;
10300
- const entries = backgroundColorTokens.flatMap((token) => {
10301
- const value = rootStyle.getPropertyValue(`--tb-${token}`).trim() || bodyStyle?.getPropertyValue(`--tb-${token}`).trim() || "";
10302
- return value ? [[token, value]] : [];
10303
- });
10304
- return entries.length > 0 ? Object.fromEntries(entries) : null;
10305
- }
10306
- function dedupeBackgroundImagePool(items) {
10307
- return Array.from(items.reduce((pool, item) => {
10308
- const key = item.reference.identifier;
10309
- const existing = pool.get(key);
10310
- const decided = existing ? existing.source === "current" ? {
10311
- ...existing,
10312
- mediaAsset: existing.mediaAsset ?? item.mediaAsset,
10313
- label: existing.label ?? item.label,
10314
- rank: existing.rank ?? item.rank
10315
- } : {
10316
- ...existing,
10317
- label: existing.label ?? item.label,
10318
- rank: existing.rank ?? item.rank
10319
- } : item;
10320
- return new Map([...pool, [key, decided]]);
10321
- }, /* @__PURE__ */ new Map()).values());
8940
+ function SdkToolbarLook({ field, value, onCycle }) {
8941
+ const index = field.options.findIndex((option) => option.value === (value ?? field.defaultValue));
8942
+ return /* @__PURE__ */ jsx(LookCyclePill, {
8943
+ lookName: field.options[index]?.label ?? "Choose a Look",
8944
+ position: lookPositionLabel(index, field.options.length),
8945
+ onCycle
8946
+ });
10322
8947
  }
10323
8948
  //#endregion
10324
8949
  //#region ../preview-next/src/client/blocks/BoundaryControl.tsx
@@ -10646,6 +9271,85 @@ function formatBlockKindLabel(blockKind) {
10646
9271
  return ((blockKind.includes(".") ? blockKindParts[blockKindParts.length - 1] : blockKind) ?? blockKind).split(/[-_]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
10647
9272
  }
10648
9273
  //#endregion
9274
+ //#region ../preview-next/src/client/preview/useSiteTopChromeClearance.ts
9275
+ const SITE_HEADER_SELECTOR = ".block-site-header";
9276
+ /** Announcement banners mark themselves so preview chrome can stay clear of them. */
9277
+ const SITE_BANNER_SELECTOR = "[data-site-banner]";
9278
+ /**
9279
+ * How far the site's header and any banner stacked with it reach down the
9280
+ * canvas right now. Re-measured on scroll as well as on layout changes, since
9281
+ * sticky chrome and a header scrolling away both change it.
9282
+ */
9283
+ function useSiteTopChromeClearance() {
9284
+ const [clearance, setClearance] = useState({ kind: "none" });
9285
+ useEffect(() => {
9286
+ const frame = { id: null };
9287
+ const observed = { elements: [] };
9288
+ const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => schedule());
9289
+ const measure = () => {
9290
+ frame.id = null;
9291
+ const header = document.querySelector(SITE_HEADER_SELECTOR);
9292
+ const banners = Array.from(document.querySelectorAll(SITE_BANNER_SELECTOR));
9293
+ observe(header ? [header, ...banners] : banners);
9294
+ const next = siteTopChromeClearance({
9295
+ header: header ? chromeBox(visibleHeaderPart(header)) : null,
9296
+ banners: banners.map(chromeBox)
9297
+ });
9298
+ setClearance((current) => headerClearanceEquals(current, next) ? current : next);
9299
+ };
9300
+ const schedule = () => {
9301
+ if (frame.id === null) frame.id = window.requestAnimationFrame(measure);
9302
+ };
9303
+ const observe = (elements) => {
9304
+ if (!resizeObserver || sameElements(observed.elements, elements)) return;
9305
+ resizeObserver.disconnect();
9306
+ elements.forEach((element) => resizeObserver.observe(element));
9307
+ observed.elements = elements;
9308
+ };
9309
+ measure();
9310
+ const mutationObserver = new MutationObserver(schedule);
9311
+ mutationObserver.observe(document.body, {
9312
+ attributes: true,
9313
+ attributeFilter: ["class"],
9314
+ childList: true,
9315
+ subtree: true
9316
+ });
9317
+ window.addEventListener("resize", schedule);
9318
+ window.addEventListener("scroll", schedule, true);
9319
+ return () => {
9320
+ if (frame.id !== null) window.cancelAnimationFrame(frame.id);
9321
+ resizeObserver?.disconnect();
9322
+ mutationObserver.disconnect();
9323
+ window.removeEventListener("resize", schedule);
9324
+ window.removeEventListener("scroll", schedule, true);
9325
+ };
9326
+ }, []);
9327
+ return clearance;
9328
+ }
9329
+ /** The header's visible bar, when it marks one, rather than its whole box. */
9330
+ function visibleHeaderPart(header) {
9331
+ return Array.from(header.querySelectorAll(SITE_CHROME_VISIBLE_HEADER_SELECTOR)).find((candidate) => {
9332
+ const rect = candidate.getBoundingClientRect();
9333
+ return window.getComputedStyle(candidate).display !== "none" && rect.height > 0 && rect.bottom > 0;
9334
+ }) ?? header;
9335
+ }
9336
+ function chromeBox(element) {
9337
+ const rect = element.getBoundingClientRect();
9338
+ return {
9339
+ top: rect.top,
9340
+ bottom: rect.bottom
9341
+ };
9342
+ }
9343
+ function sameElements(left, right) {
9344
+ return left.length === right.length && left.every((element, index) => element === right[index]);
9345
+ }
9346
+ function headerClearanceEquals(left, right) {
9347
+ switch (left.kind) {
9348
+ case "none": return right.kind === "none";
9349
+ case "overlay": return right.kind === "overlay" && left.px === right.px;
9350
+ }
9351
+ }
9352
+ //#endregion
10649
9353
  //#region ../preview-next/src/client/blocks/previewBatchLoaderParams.ts
10650
9354
  function isBatchableEndpoint(endpoint) {
10651
9355
  return endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow" || endpoint === "getPublicEventDetails" || endpoint === "listPublicRouteCandidates" || endpoint === "listPublicTeamMembers" || endpoint === "listPublicProducts" || endpoint === "getPublicBookingServices" || endpoint === "getPublicWeeklySlotAvailability" || endpoint === "getPublicFormById";
@@ -10777,7 +9481,28 @@ function toPreviewBatchParams(endpoint, params) {
10777
9481
  //#endregion
10778
9482
  //#region ../preview-next/src/client/blocks/EditablePageRenderer.tsx
10779
9483
  const MAX_PREVIEW_BLOCK_DATA_BATCH_SIZE = 25;
9484
+ /** Published requests bypass every editor, draft, AI and design overlay. View presentation of a live draft still uses the draft renderer. */
10780
9485
  function EditablePageRenderer(props) {
9486
+ if (props.dataContext?.previewStage === "published") {
9487
+ const { blockDataApiClient: _blockDataApiClient, previewAs: _previewAs, previewAuthoring: _previewAuthoring, renderJoin: _renderJoin, ...published } = props;
9488
+ const page = published.page ? {
9489
+ ...published.page,
9490
+ blocks: published.page.blocks.map((block) => ({
9491
+ ...block,
9492
+ draftContent: null,
9493
+ publishedPlacement: readPublishedBlockPlacement(typeof block.contentVersionId === "string" ? block.contentVersionId : null, block.content)
9494
+ }))
9495
+ } : null;
9496
+ return /* @__PURE__ */ jsx(EditorPageRenderer, {
9497
+ ...published,
9498
+ page,
9499
+ previewAs: "visitor",
9500
+ previewAuthoring: void 0
9501
+ });
9502
+ }
9503
+ return /* @__PURE__ */ jsx(EditableDraftPageRenderer, { ...props });
9504
+ }
9505
+ function EditableDraftPageRenderer(props) {
10781
9506
  const { blockDataApiClient = null, ...pageRendererProps } = props;
10782
9507
  const { blocks } = useEntryEditorController();
10783
9508
  const uiStore = useEditorUiStoreInstance();
@@ -10799,7 +9524,7 @@ function EditablePageRenderer(props) {
10799
9524
  } };
10800
9525
  }, [activePreviewField, allowInlineEditing]);
10801
9526
  const isEntryTemplatePage = Boolean(pageRendererProps.dataContext?.contentEntry);
10802
- const headerClearance = usePreviewHeaderClearance();
9527
+ const headerClearance = useSiteTopChromeClearance();
10803
9528
  const cacheRef = useRef(/* @__PURE__ */ new Map());
10804
9529
  const renderStateVersion = useEditorUiStore((state) => {
10805
9530
  const snapshots = state.drafts.inspect();
@@ -10933,13 +9658,13 @@ function EditablePageRenderer(props) {
10933
9658
  dataContext: linkedEntryDataContext,
10934
9659
  apiClient: blockDataApiClient
10935
9660
  });
10936
- useLinkedSaveHandoverRetention(uiStore, entryDataContext, liveResolvedData);
9661
+ useLinkedSaveHandoverRetention(uiStore, entryDataContext, liveResolvedData.resolvedData);
10937
9662
  const generatedIconAssetOverlay = useMemo(() => generatedIconAssetsByBlock(uiStore, renderPage.blocks), [
10938
9663
  renderPage.blocks,
10939
9664
  renderStateVersion,
10940
9665
  uiStore
10941
9666
  ]);
10942
- const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(applyLinkedEntryRenderOverlayToDataContext(mergeResolvedDataContext(linkedEntryDataContext, liveResolvedData), linkedEntryOverlays), generatedIconAssetOverlay), [
9667
+ const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(applyLinkedEntryRenderOverlayToDataContext(mergeLiveLoaderContext(linkedEntryDataContext, liveResolvedData), linkedEntryOverlays), generatedIconAssetOverlay), [
10943
9668
  generatedIconAssetOverlay,
10944
9669
  linkedEntryDataContext,
10945
9670
  liveResolvedData,
@@ -10959,7 +9684,7 @@ function EditablePageRenderer(props) {
10959
9684
  }
10960
9685
  /**
10961
9686
  * Edit mode shows placeholders and block controls; view mode renders the page
10962
- * as visitors see it, with each Look's published fallbacks.
9687
+ * with visitor presentation of the live draft. This does not select publication.
10963
9688
  */
10964
9689
  function editorRenderMode(input) {
10965
9690
  return {
@@ -10976,24 +9701,9 @@ function editorRuntimeJoins(projection, fallback) {
10976
9701
  }
10977
9702
  function usePreviewBlockResolvedData(args) {
10978
9703
  const { page, dataContext, apiClient } = args;
10979
- const cacheKey = useMemo(() => {
10980
- if (!apiClient || !dataContext?.siteId) return null;
10981
- return stableSerialize({
10982
- siteId: dataContext.siteId,
10983
- pageId: dataContext.pageId ?? null,
10984
- previewStage: dataContext.previewStage ?? "published",
10985
- blocks: page.blocks.map((block) => ({
10986
- id: block.id,
10987
- kind: block.kind,
10988
- content: block.content ?? null,
10989
- draftContent: block.draftContent ?? null
10990
- }))
10991
- });
10992
- }, [
9704
+ const cacheKey = useMemo(() => previewBlockDataRequestKey(page, dataContext, apiClient !== null), [
10993
9705
  apiClient,
10994
- dataContext?.pageId,
10995
- dataContext?.previewStage,
10996
- dataContext?.siteId,
9706
+ dataContext,
10997
9707
  page
10998
9708
  ]);
10999
9709
  const [resolvedData, setResolvedData] = useState(null);
@@ -11005,12 +9715,15 @@ function usePreviewBlockResolvedData(args) {
11005
9715
  let cancelled = false;
11006
9716
  const context = buildPreviewBlockDataContext(dataContext);
11007
9717
  const loaderClient = createPreviewBlockDataApiClient(apiClient, context);
11008
- Promise.all([prefetchBlockData(page, context, {
9718
+ Promise.all([prefetchBlockDataWithFailures(page, context, {
11009
9719
  apiClient: loaderClient,
11010
9720
  isValidEndpoint: isSupportedLoaderEndpoint,
11011
9721
  onError: () => {}
11012
9722
  }), prefetchGeneratedIconAssets(page, dataContext.siteId, apiClient).catch(() => ({}))]).then(([data, generatedIconAssets]) => {
11013
- const merged = mergeGeneratedIconAssets(data, generatedIconAssets);
9723
+ const merged = {
9724
+ ...data,
9725
+ resolvedData: mergeGeneratedIconAssets(data.resolvedData, generatedIconAssets)
9726
+ };
11014
9727
  if (!cancelled) setResolvedData({
11015
9728
  key: cacheKey,
11016
9729
  data: merged
@@ -11025,7 +9738,39 @@ function usePreviewBlockResolvedData(args) {
11025
9738
  dataContext,
11026
9739
  page
11027
9740
  ]);
11028
- return resolvedData?.data ?? null;
9741
+ return useMemo(() => {
9742
+ const current = resolvedData?.key === cacheKey ? resolvedData.data : null;
9743
+ return {
9744
+ resolvedData: current?.resolvedData ?? null,
9745
+ loaderFailures: current?.loaderFailures ?? null,
9746
+ prefetchedBlockData: current ?? void 0,
9747
+ loaderSnapshot: current?.loaderSnapshot
9748
+ };
9749
+ }, [cacheKey, resolvedData]);
9750
+ }
9751
+ /** Request identity couples loaded facts to this content selection and its stage. */
9752
+ function previewBlockDataRequestKey(page, context, enabled) {
9753
+ if (!enabled || !context?.siteId) return null;
9754
+ const { siteId, pageId, previewStage } = context;
9755
+ return stableSerialize({
9756
+ siteId,
9757
+ pageId: pageId ?? null,
9758
+ previewStage: previewStage ?? "published",
9759
+ blocks: page.blocks.map((block) => ({
9760
+ id: block.id,
9761
+ kind: block.kind,
9762
+ content: selectBlockContent(block, previewStage)
9763
+ }))
9764
+ });
9765
+ }
9766
+ function mergeLiveLoaderContext(context, live) {
9767
+ const merged = mergeResolvedDataContext(context, live.resolvedData);
9768
+ return merged && live.loaderFailures ? {
9769
+ ...merged,
9770
+ loaderFailures: live.loaderFailures,
9771
+ prefetchedBlockData: live.prefetchedBlockData,
9772
+ loaderSnapshot: live.loaderSnapshot
9773
+ } : merged;
11029
9774
  }
11030
9775
  async function prefetchGeneratedIconAssets(page, siteId, apiClient) {
11031
9776
  const blockRefs = collectGeneratedIconAssetRefs(page);
@@ -11131,65 +9876,6 @@ async function callDirectLoaderApiEndpoint(dashboardApiClient, endpoint, params)
11131
9876
  })));
11132
9877
  }
11133
9878
  }
11134
- function usePreviewHeaderClearance() {
11135
- const [clearance, setClearance] = useState({ kind: "none" });
11136
- useEffect(() => {
11137
- let observedHeader = null;
11138
- let resizeObserver = null;
11139
- const update = () => {
11140
- const header = findPreviewOverlayHeader();
11141
- if (header !== observedHeader) {
11142
- resizeObserver?.disconnect();
11143
- observedHeader = header;
11144
- resizeObserver = header ? new ResizeObserver(update) : null;
11145
- if (header) resizeObserver?.observe(header);
11146
- }
11147
- if (!header) {
11148
- setClearance((current) => current.kind === "none" ? current : { kind: "none" });
11149
- return;
11150
- }
11151
- const style = window.getComputedStyle(header);
11152
- const nextClearance = headerClearanceFromPx(style.position === "fixed" || style.position === "sticky" ? measuredOverlayHeaderClearancePx(header) : 0);
11153
- setClearance((current) => headerClearanceEquals(current, nextClearance) ? current : nextClearance);
11154
- };
11155
- update();
11156
- const mutationObserver = new MutationObserver(update);
11157
- mutationObserver.observe(document.body, {
11158
- attributes: true,
11159
- attributeFilter: ["class"],
11160
- childList: true,
11161
- subtree: true
11162
- });
11163
- window.addEventListener("resize", update);
11164
- return () => {
11165
- resizeObserver?.disconnect();
11166
- mutationObserver.disconnect();
11167
- window.removeEventListener("resize", update);
11168
- };
11169
- }, []);
11170
- return clearance;
11171
- }
11172
- function headerClearanceEquals(left, right) {
11173
- if (left.kind !== right.kind) return false;
11174
- switch (left.kind) {
11175
- case "none": return true;
11176
- case "overlay": return right.kind === "overlay" && left.px === right.px;
11177
- }
11178
- }
11179
- function findPreviewOverlayHeader() {
11180
- return document.querySelector(".block-site-header.rb-fixed, .block-site-header.rb-sticky");
11181
- }
11182
- function measuredOverlayHeaderClearancePx(header) {
11183
- const visibleHeader = findVisibleHeaderMeasurementTarget(header);
11184
- return visibleHeaderClearancePx(visibleHeader ? visibleHeader.getBoundingClientRect() : header.getBoundingClientRect());
11185
- }
11186
- function findVisibleHeaderMeasurementTarget(header) {
11187
- return Array.from(header.querySelectorAll(SITE_CHROME_VISIBLE_HEADER_SELECTOR)).find((candidate) => {
11188
- const style = window.getComputedStyle(candidate);
11189
- const rect = candidate.getBoundingClientRect();
11190
- return style.display !== "none" && rect.height > 0 && rect.bottom > 0;
11191
- }) ?? null;
11192
- }
11193
9879
  function usePreviewDateContext(dataContext) {
11194
9880
  const supplied = dataContext?.dateContext;
11195
9881
  const zone = dataContext?.bookingTimeZone;
@@ -11302,7 +9988,6 @@ function SdkPreviewModeRuntime(props) {
11302
9988
  isSiteLaunched: true,
11303
9989
  maintenanceModeEnabled: false,
11304
9990
  entrySubrouteContext: null,
11305
- assistantPanel: null,
11306
9991
  sdkConfig: sdkConfigForEditor,
11307
9992
  mediaAssets: content.mediaAssets,
11308
9993
  supabaseUrl: content.supabaseUrl,
@@ -11347,7 +10032,7 @@ function sdkPreviewDataContext(props, routeMap) {
11347
10032
  };
11348
10033
  }
11349
10034
  function resolveSdkPreviewRuntimeModel(props) {
11350
- const { apiBaseUrl, content, siteId } = props;
10035
+ const { apiBaseUrl, content } = props;
11351
10036
  const rendering = props.rendering ?? {
11352
10037
  kind: "themed",
11353
10038
  themeRuntime: props.themeRuntime ?? defaultPreviewThemeRuntime