@riverbankcms/sdk 0.159.0 → 0.161.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 (218) hide show
  1. package/README.md +4 -4
  2. package/dist/_dts/{BlocksIslandsHydrator-Cj1i1Yhh.d.ts → BlocksIslandsHydrator-Bx4kLiTA.d.ts} +1 -1
  3. package/dist/_dts/{Page-Cgzbv22M.d.ts → Page-Dm7_P13o.d.ts} +217 -8
  4. package/dist/_dts/{SdkPreviewMode-BC_FGc6b.d.ts → SdkPreviewMode-D7HdWWwF.d.ts} +55 -127
  5. package/dist/_dts/{auth-contract-FPg0-2MC.d.ts → auth-contract-CgJ5nMaH.d.ts} +2 -0
  6. package/dist/_dts/{client-BOK-YHVJ.d.ts → client-Ep0jI9eE.d.ts} +1 -1
  7. package/dist/_dts/{content-types-CsrYWxq_.d.ts → content-types-BgAzCrBc.d.ts} +18 -18
  8. package/dist/_dts/{contracts-ClgMD-9g.d.ts → contracts-DUiOnj9e.d.ts} +10 -6
  9. package/dist/_dts/{footerPageOutline-C_IDuELl.d.ts → footerPageOutline-B-uXamTG.d.ts} +6 -6
  10. package/dist/_dts/{generatePageMetadata-B7bhYSWx.d.ts → generatePageMetadata-BDkZYEcS.d.ts} +2 -2
  11. package/dist/_dts/index-BQDBQvdu.d.ts +13 -0
  12. package/dist/_dts/index-BVkP8f70.d.ts +66 -0
  13. package/dist/_dts/{index-Dt3XSGzY.d.ts → index-CF6Cjs7b.d.ts} +2 -2
  14. package/dist/_dts/{index-Ci1PEk82.d.ts → index-CSsfq6KG.d.ts} +3 -17
  15. package/dist/_dts/{index-BZ4fb2zz.d.ts → index-D_8uz4OP.d.ts} +3 -3
  16. package/dist/_dts/{index-CcaG6O13.d.ts → index-DvKQA6AZ.d.ts} +4 -4
  17. package/dist/_dts/{index-DMOfW1A7.d.ts → index-KPrWM0KF.d.ts} +2 -2
  18. package/dist/_dts/{index-DzUdUaJ-.d.ts → index-ylivB7Jj.d.ts} +2 -2
  19. package/dist/_dts/{loadContent-C1JI2pG0.d.ts → loadContent-DTjKOO-T.d.ts} +19 -10
  20. package/dist/_dts/{resolvePageContent-BtRUtrJa.d.ts → resolvePageContent-C1vA5c5w.d.ts} +2 -2
  21. package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
  22. package/dist/_dts/{hosted-booking-appearance-ChGCQYdQ.d.ts → schema-BHu0PYWl.d.ts} +25911 -23567
  23. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  24. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  25. package/dist/_dts/sdk/src/client.d.ts +13 -7
  26. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  27. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  28. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  29. package/dist/_dts/sdk/src/index.d.ts +8 -8
  30. package/dist/_dts/sdk/src/manifest/index.d.ts +6 -6
  31. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  32. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  33. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  34. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  35. package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
  36. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  37. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  38. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  41. package/dist/_dts/sdk/src/preview-next/keep-alive.d.ts +1 -1
  42. package/dist/_dts/sdk/src/preview-next/session.d.ts +2 -2
  43. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  44. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  45. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  46. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  47. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  48. package/dist/_dts/sdk/src/server.d.ts +5 -5
  49. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  50. package/dist/_dts/{session-Ba2CsnK5.d.ts → session-C_gtSFyZ.d.ts} +2 -1
  51. package/dist/_dts/{navigation-BnV_hOZy.d.ts → types-BR1Yboa9.d.ts} +15530 -16017
  52. package/dist/_dts/{types-CMFIZGUI.d.ts → types-CJXTCF_F.d.ts} +10 -13
  53. package/dist/_dts/{types-CI9dYWJ8.d.ts → types-D02ngcUH.d.ts} +4 -2
  54. package/dist/_dts/{types--oWXIfyz.d.ts → types-ZGUiHpDE.d.ts} +7 -7
  55. package/dist/_dts/{validation-Ct-GL0eA.d.ts → validation-BaV565gb.d.ts} +4 -4
  56. package/dist/client/{BlocksIslandsHydrator-DKS8Ba30.mjs → BlocksIslandsHydrator-DTExCJsb.mjs} +22 -21
  57. package/dist/client/{BookingMailingListNote-Cg9v6d7Y.mjs → BookingMailingListNote-BDpxmn1p.mjs} +2 -2
  58. package/dist/client/{CalendarNavigationChevron-BoVCTUXy.mjs → CalendarNavigationChevron-PeCiL82X.mjs} +6 -6
  59. package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-DWexRLf6.mjs} +1 -1
  60. package/dist/client/{DemoBookingPortalAccess-BxRVCJG3.mjs → DemoBookingPortalAccess-3zmIqakW.mjs} +6 -6
  61. package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-GHi-8BW5.mjs} +1 -1
  62. package/dist/client/{EventCalendar.client-BI-kvwXf.mjs → EventCalendar.client-BxQLY5cX.mjs} +10 -9
  63. package/dist/client/{EventCombined.client-DIvnoN5l.mjs → EventCombined.client-B5bmQ03b.mjs} +8 -8
  64. package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-CgMZ9TeU.mjs} +1 -1
  65. package/dist/client/{EventItem-BRMtEaa6.mjs → EventItem-BEx-qiDE.mjs} +11 -6
  66. package/dist/client/{EventListWeekNavigation-B8DzAUDa.mjs → EventListWeekNavigation-CyH5tA6Y.mjs} +1 -1
  67. package/dist/client/{EventListing.client-Bo4qzQi0.mjs → EventListing.client-D3uySdGP.mjs} +3 -3
  68. package/dist/client/{EventListing.view-D2vemnCx.mjs → EventListing.view-9RFrBejr.mjs} +31 -15
  69. package/dist/client/{EventRegistrationPayment-e5XWtygG.mjs → EventRegistrationPayment-CG2tQx8K.mjs} +92 -99
  70. package/dist/client/LocationMapActions-Wsr83Q7q.mjs +268 -0
  71. package/dist/client/{Page-Dqpv9Ggi.mjs → Page-Bf2nPACI.mjs} +2673 -2290
  72. package/dist/client/{StepIndicator-BrvKa_8H.mjs → StepIndicator-CZweb1vs.mjs} +3 -3
  73. package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-Bkgz67gt.mjs} +1 -1
  74. package/dist/client/ThemedButton-CnyL3s1A.mjs +2243 -0
  75. package/dist/client/{accordion-ByLpb4Dz.mjs → accordion-TcimLLRQ.mjs} +1 -1
  76. package/dist/client/{booking-form.client-BLndwxpx.mjs → booking-form.client-q-RpJ4aF.mjs} +13 -13
  77. package/dist/client/{bookingForm-CTxTEgHX.mjs → bookingForm-DjGfk3Wj.mjs} +4 -4
  78. package/dist/client/bookings.mjs +6 -6
  79. package/dist/client/{carousel-C8ef0vnT.mjs → carousel-CGAk6j0m.mjs} +2 -2
  80. package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-ArlGmYWV.mjs} +1 -1
  81. package/dist/client/{cart-BpH6jkUO.mjs → cart-D_h3rAZ2.mjs} +3 -3
  82. package/dist/client/{cart.client-DV78Td13.mjs → cart.client-DHOxZbJ7.mjs} +1 -1
  83. package/dist/client/{checkout-BJVb2RpL.mjs → checkout-tC-3CzuM.mjs} +3 -3
  84. package/dist/client/{checkout.client-CqGPXPSm.mjs → checkout.client-DsBb2Pkm.mjs} +1 -1
  85. package/dist/client/client.mjs +28 -15
  86. package/dist/client/{context-BRgBWthI.mjs → context-9ZfMb6GA.mjs} +1 -1
  87. package/dist/client/{cta-D8ucLsvX.mjs → cta-D-ZqL7-e.mjs} +2 -1
  88. package/dist/client/{dateFormatting-LeKNQ-iX.mjs → dateFormatting-BCwLqYpW.mjs} +1 -1
  89. package/dist/client/{demoPortalMagicLink-CjstiFPh.mjs → demoPortalMagicLink-BxkSS9fx.mjs} +1 -1
  90. package/dist/client/{enhanceHeaderSection-BaQJyI9x.mjs → enhanceHeaderSection-xg6to91E.mjs} +3 -3
  91. package/dist/client/{event-details.client-CYNQYOsP.mjs → event-details.client-C670TgRd.mjs} +2 -17
  92. package/dist/client/{event-registration.client-DDqSpN36.mjs → event-registration.client-C6GApWTB.mjs} +17 -17
  93. package/dist/client/{eventCalendar-3vQtuC9X.mjs → eventCalendar-CWc0dg9i.mjs} +4 -4
  94. package/dist/client/{eventCombined-CEJFMjqV.mjs → eventCombined-D4DbOrvQ.mjs} +4 -4
  95. package/dist/client/{eventDetails-nGh47jef.mjs → eventDetails-C2DfmbC0.mjs} +2 -2
  96. package/dist/client/{eventListing-BL3Ptb83.mjs → eventListing-C_yXmHyz.mjs} +4 -4
  97. package/dist/client/{eventRegistration-DDSO6KB2.mjs → eventRegistration-DJuaCB-O.mjs} +4 -4
  98. package/dist/client/{form-DjNLfy2Z.mjs → form-QZhtdFHA.mjs} +3 -3
  99. package/dist/client/{form.client-Cj0By6ot.mjs → form.client-CgvPACwG.mjs} +5 -5
  100. package/dist/client/{form.parts-DyA9C5Hy.mjs → form.parts-2uI0-5N-.mjs} +3 -3
  101. package/dist/client/{formatDate-CZo0MPTA.mjs → formatDate-Danr0Nk4.mjs} +1 -1
  102. package/dist/client/gifting/client.mjs +3 -3
  103. package/dist/client/{headerSection-JjSq6Mzp.mjs → headerSection-DJdlLdvZ.mjs} +2 -2
  104. package/dist/client/{mediaAssets-BOj-Co0B.mjs → mediaAssets-BvjcAZpS.mjs} +1 -1
  105. package/dist/client/mediaContext-jPeJ2PmJ.mjs +10801 -0
  106. package/dist/client/{newsletter-form.client-C2EgEBP1.mjs → newsletter-form.client-Cbepz2KU.mjs} +8 -8
  107. package/dist/client/{newsletter-form.parts-CaldoFmi.mjs → newsletter-form.parts-DN8oMCQ0.mjs} +2 -2
  108. package/dist/client/{newsletterForm-hm7L17LM.mjs → newsletterForm-wjLtW-wq.mjs} +3 -3
  109. package/dist/client/{noop-M8FTSgm2.mjs → noop-B7H6gCbj.mjs} +306 -5
  110. package/dist/client/portal/client.mjs +4560 -115
  111. package/dist/client/{product-detail.client-y86uwzEI.mjs → product-detail.client-CYTR165c.mjs} +1 -1
  112. package/dist/client/{product-list.client-_JBndYZT.mjs → product-list.client-B4vTvag8.mjs} +1 -1
  113. package/dist/client/{productDetail-D-9fb2cW.mjs → productDetail-k8LEMSWn.mjs} +3 -3
  114. package/dist/client/{productList-BSRlnwBW.mjs → productList-DEo8Bqoe.mjs} +3 -3
  115. package/dist/client/{propsDecoder-DhbGL302.mjs → propsDecoder-G0j0HXBO.mjs} +3 -28
  116. package/dist/client/{registry.server-BaX0hxf5.mjs → registry.server-BTmSXE3D.mjs} +1154 -997
  117. package/dist/client/rendering/client.mjs +28 -28
  118. package/dist/client/rendering/islands.mjs +1 -1
  119. package/dist/client/rendering.mjs +57 -32
  120. package/dist/client/{richText-coerce-Cny2Ukb6.mjs → richText-coerce-B19taoH6.mjs} +1 -1
  121. package/dist/client/{routeIslandApiConfig-96er7pIx.mjs → routeIslandApiConfig-Chu5BHra.mjs} +1 -1
  122. package/dist/client/{ThemedButton-DVBC_pS9.mjs → schema-C-m8XHuW.mjs} +1123 -2362
  123. package/dist/client/{shop-CnIJfdZA.mjs → shop-RGWa43H7.mjs} +3 -3
  124. package/dist/client/{shop-commerce-CsLwzq5O.mjs → shop-commerce-TJYCBO_H.mjs} +12 -12
  125. package/dist/client/{shop-commerce-store--O8GRBwr.mjs → shop-commerce-store-CjCcUB_o.mjs} +1 -1
  126. package/dist/client/{shop.client-BcaJ-acA.mjs → shop.client-tsKfZw1W.mjs} +15 -15
  127. package/dist/client/{shop.interactive-BxL_bshW.mjs → shop.interactive-CVqLAU53.mjs} +370 -189
  128. package/dist/client/{shopShared-VZjPOfCX.mjs → shopShared-C3lHMz_R.mjs} +2 -2
  129. package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
  130. package/dist/client/timetableModel-V2ifvGGy.mjs +1100 -0
  131. package/dist/client/{useAvailableSlots-pTXuY3jV.mjs → useAvailableSlots-D1X69-pN.mjs} +4 -4
  132. package/dist/client/{useBookingNowIso-D14J-EhJ.mjs → useBookingNowIso-Ch30jino.mjs} +1 -1
  133. package/dist/client/{useDiscountApply-o5sIVZ2u.mjs → useDiscountApply-Bwzr1RjV.mjs} +3 -3
  134. package/dist/client/{useDiscountCodeUi-DJhFP_rg.mjs → useDiscountCodeUi-BimJbFC7.mjs} +1 -1
  135. package/dist/client/{useEventPagination-DMmNf2FP.mjs → useEventPagination-CLAS0upd.mjs} +12 -24
  136. package/dist/client/uuid-BETKW8rS.mjs +12 -0
  137. package/dist/client/{view-BgPql2yH2.mjs → view-BUh4LnLS.mjs} +4 -4
  138. package/dist/client/{view-D1R3Lk05.mjs → view-Dj_FZHmg.mjs} +19 -15
  139. package/dist/client/wizardSteps-BkZc-hKH.mjs +6598 -0
  140. package/dist/preview-next/before-render.mjs +5 -4
  141. package/dist/preview-next/chrome.css +2 -0
  142. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-CwerMfzn.mjs} +2 -1
  143. package/dist/preview-next/client/LocationPickerEnvironment-QtSG2Bl-.mjs +138 -0
  144. package/dist/preview-next/client/MapLibreEditMap-B-rohNcG.mjs +488 -0
  145. package/dist/preview-next/client/{PreviewEditorSidebar-DADCj_ET.mjs → PreviewEditorSidebar-Dvq-RW9-.mjs} +1328 -171
  146. package/dist/preview-next/client/{PreviewEditorUI-La40Dmmh.mjs → PreviewEditorUI-BdFjS39R.mjs} +53 -79
  147. package/dist/preview-next/client/{SdkPreviewModeRuntime-406Hw9zY.mjs → SdkPreviewModeRuntime-BEfHln1E.mjs} +1249 -2551
  148. package/dist/preview-next/client/{SdkPreviewModeRuntime-CWN44I_B.mjs → SdkPreviewModeRuntime-CjkGh1IG.mjs} +1 -1
  149. package/dist/preview-next/client/{SiteChromeCustomizeContext-BdwEZoo9.mjs → SiteChromeCustomizeContext-CDbxk_qZ.mjs} +117481 -162497
  150. package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-b14Bv03E.mjs} +1253 -403
  151. package/dist/preview-next/client/lucide-react-CA9cpo0P.mjs +51984 -0
  152. package/dist/preview-next/client/maplibre-gl-DykfOYYn.mjs +34208 -0
  153. package/dist/preview-next/client/{previewChromeSurface-BVUKIYG0.mjs → previewChromeSurface-Dd1_mNIg.mjs} +3 -8
  154. package/dist/preview-next/client/result-BjJUoxUF.mjs +16 -0
  155. package/dist/preview-next/client/rolldown-runtime-CE6sIgz8.mjs +34 -0
  156. package/dist/preview-next/client/runtime.mjs +3 -3
  157. package/dist/preview-next/client/{sdk-runtime-Cy9AKPy5.mjs → sdk-runtime-B-CXyGVb.mjs} +1 -1
  158. package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +5812 -0
  159. package/dist/preview-next/client/{spinner-Bhpzz2vO.mjs → spinner-CGxS8Ns-.mjs} +2 -1
  160. package/dist/preview-next/{constants-D8Ya7bO4.mjs → constants-Bf-vqdKH.mjs} +2 -1
  161. package/dist/preview-next/editor-base.css +64 -2
  162. package/dist/preview-next/editor-chrome.css +85 -0
  163. package/dist/preview-next/keepAlive.mjs +2 -2
  164. package/dist/preview-next/middleware.mjs +7 -3
  165. package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-hLg-yjQN.mjs} +190 -116
  166. package/dist/preview-next/{session-BgkrPqu0.mjs → session-P1R_ajT7.mjs} +12 -2
  167. package/dist/preview-next/session.mjs +1 -1
  168. package/dist/server/{Block.shared-DB6fb1pR.mjs → Block.shared-CeTd2saO.mjs} +6 -6
  169. package/dist/server/{bindings-z2daXp-2.mjs → bindings-C5YpKuKt.mjs} +3 -2
  170. package/dist/server/{client-Cv-osXoU.mjs → client-Cv26lZQ4.mjs} +14 -10
  171. package/dist/server/config-template-validation.mjs +50 -10
  172. package/dist/server/config-validation.mjs +1 -1
  173. package/dist/server/config.mjs +2 -2
  174. package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → effectiveNavLinkStyle-CGvGr3yD.mjs} +572 -1078
  175. package/dist/server/index.mjs +3 -3
  176. package/dist/server/{loadContent-BNMDYCm8.mjs → loadContent-C8a0b-cC.mjs} +40 -21
  177. package/dist/server/loadPage--DXBwI8V.mjs +2 -0
  178. package/dist/server/{loadPage-CjA_F_AF.mjs → loadPage-BW7dklu3.mjs} +9 -5
  179. package/dist/server/manifest.mjs +1 -1
  180. package/dist/server/next.mjs +9 -9
  181. package/dist/server/{overrideResolution-CGodrtqi.mjs → overrideResolution-tIuqmJB3.mjs} +1 -1
  182. package/dist/server/{overrides-DxRC724a.mjs → overrides-D1fiPOKF.mjs} +1158 -754
  183. package/dist/server/page-converter.mjs +8 -10
  184. package/dist/server/{prebuild-C6bhjRKT.mjs → prebuild--fO0E2tr.mjs} +1 -1
  185. package/dist/server/prebuild.mjs +1 -1
  186. package/dist/server/{prefetchBlockData-DZ5Fq_-r.mjs → prefetchBlockData-CqJnokWJ.mjs} +968 -968
  187. package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-CvvZ4JIe.mjs} +207 -132
  188. package/dist/server/{blocks-BaG8Qpaa.mjs → registry-BVfCqaCq.mjs} +2853 -2799
  189. package/dist/server/rendering/server.mjs +4 -4
  190. package/dist/server/rendering.mjs +8 -8
  191. package/dist/server/{resolveBlockData-CbGDakvp.mjs → resolveBlockData-DPNvhXEz.mjs} +6 -3
  192. package/dist/server/routing.mjs +1 -1
  193. package/dist/server/{schema-Bs735S27.mjs → schema-CD4peO7m.mjs} +2441 -1401
  194. package/dist/server/server.mjs +3 -3
  195. package/dist/server/site-styles-H-EvTJiW.mjs +787 -0
  196. package/dist/server/siteChromeOverlayClearance-DNC2k1U0.mjs +750 -0
  197. package/dist/server/{src-B935_bzN.mjs → src-ILxc6pid.mjs} +427 -190
  198. package/dist/server/theme-bridge.mjs +1 -1
  199. package/dist/server/theme.mjs +1 -1
  200. package/dist/server/{themeAdmission-DK2YBNqy.mjs → themeAdmission-BNHIXiUj.mjs} +117 -26
  201. package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
  202. package/dist/server/{validation-BtHE2S_D.mjs → validation-B1ieVemg.mjs} +22 -63
  203. package/dist/server/{version-CNCdL6id.mjs → version-BQK44wFg.mjs} +1 -1
  204. package/dist/styles/index.css +235 -0
  205. package/package.json +8 -3
  206. package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
  207. package/dist/_dts/index-cnymEAZY.d.ts +0 -1
  208. package/dist/client/LeafletStaticMap-dlapZ6mi.mjs +0 -135
  209. package/dist/client/location-map.client-DRN1JePj.mjs +0 -28
  210. package/dist/client/location-map.view-CuCvQdvp.mjs +0 -282
  211. package/dist/client/locationMap-B9srHHzZ.mjs +0 -15
  212. package/dist/client/mediaContext-DThoeEBU.mjs +0 -136
  213. package/dist/client/renderableMediaAssetAdmission-DGjBr_e-.mjs +0 -152
  214. package/dist/client/timetableModel-D09jPdue.mjs +0 -480
  215. package/dist/client/wizardSteps-C0TsNqJc.mjs +0 -17049
  216. package/dist/preview-next/client/siteStyleAccess-CFMmoMZb.mjs +0 -1326
  217. package/dist/server/loadPage-jade28Xh.mjs +0 -2
  218. package/dist/server/media-CcHwZkdJ.mjs +0 -243
@@ -1,76 +1,14 @@
1
1
  "use client";
2
- import { A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual, Gr as buildFontPreviewUrl, Jn as paletteColorEntries, Jr as VARIANT_ROLES, Kr as generateFontFaceCss, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, Xn as paletteColorsSchema, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, qr as getSiteFontsStorageUrl } from "./ThemedButton-BEOPss9H.mjs";
3
- import { A as previewHeaderStyle, Ao as getHeaderStyle, Ar as Tabs, Bn as listPageSurfaceContentSlots, Br as Collapsible, C as openRow, Cr as Callout, Cs as formatDate, D as previewCuratedPalette, Dn as isEdited, Dr as PopoverContent, E as previewButtonStyle, Er as Popover, Es as resolveBookingBusinessTimeZone, F as syncStyleConfiguratorState, Fn as FormRenderer, Fo as replaceSiteStyleCompilationPlan, Gr as DropdownMenuContent, Hr as CollapsibleTrigger, I as toggleRow, Io as defaultFooterPreferences, Jr as DropdownMenuSeparator, Kr as DropdownMenuItem, L as createOptimisticActionRunner, Li as ThemeScope, Ln as civilPickerDisplay, M as restageSelectionChanges, Mn as ManifestForm, Mr as TabsList, N as setPaletteColors, Nr as TabsTrigger, O as previewFooterLook, On as canWriteLinkedEntry, Oo as findFooterLook, Or as PopoverTrigger, Os as assertNever$1, P as styleConfiguratorHistoryEntryForPersistedSelection, Pn as createManifestValidation, Q as resolvePreviewSidebarTab, R as resolveStyleConfiguratorInitialSnapshot, S as markApplySaving, Si as Button, So as palettesForSiteStyle, Sr as SelectValue, T as planStyleSwitch, Tr as SearchInput, Ts as parseUtcIsoDateTimeString, Ur as Surface, Vn as blocksKeys, Vr as CollapsibleContent, Wr as DropdownMenu, X as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, Xn as getDashboardUrl, Yn as unwrapResponse, Yr as DropdownMenuTrigger, Z as reportPreviewDesignError, Zr as X$1, _ as deriveStyleConfiguratorCapabilities, a as selectionSnapshotFromApplySiteStyleSelectionResponse, ar as createStoreBackend, at as FooterComposerPanel, b as markApplyFailed, bi as ChevronDown, br as SelectItem, bs as syncStateOf, d as cycleSiteChromeSelectionId, di as Maximize2, dn as deriveRouteMetadataPresentation, do as compileUpdatedSiteThemeFromSelections, en as BlockEditor, f as planSiteChromeSelection, fn as resolvePageRouteSlug, ft as ContentFieldsForm, g as createStyleConfiguratorState, gt as useEntryController, h as cancelPreview, hn as useEditorUiStoreInstance, i as buildApplySiteStyleSelectionBody, ii as SlidersHorizontal, j as resetTypographyToSaved, jo as defaultHeaderLogoContext, jr as TabsContent, k as previewHeaderLayout, ko as getHeaderLayout, kr as Input, ln as isAdapterReferenceKind, m as applyTypographyDraftPatch, mn as useEditorUiStore, n as useSiteChromeCustomizeOptional, p as applyResolvedSelections, pn as resolveContentTitle, pt as useUISelector, qr as DropdownMenuLabel, r as StyleSwitchSummary, ri as Smartphone, rt as usePreviewAuth, s as usePreviewDesignCoordinator, sn as routeLifecycleContext, st as resolveFooterLayoutHints, ti as Tablet, u as buildSiteChromeSelectionModels, ui as Monitor, uo as compileReplacementSiteThemeFromSelections, v as dismissWarnings, vi as ChevronRight, vr as Select, w as palettePreviewProjection, wi as cn, wn as toEditorBlockItem, wr as CalloutDescription, ws as parseBookingLocalDate, wt as LinkedEntryLeaseBanner, x as markApplySaved, xi as Check, xo as offeredSiteStyles, xr as SelectTrigger, xs as valueStatus, y as isPreviewingChange, yi as ChevronLeft, yo as getCuratedSiteStyle, yr as SelectContent, ys as displayedValues, yt as useAutosaveStatus, zi as resolveSdkFooterMode, zn as listEntryPageContentSlots } from "./SiteChromeCustomizeContext-BdwEZoo9.mjs";
4
- import { c as resolvePreviewSidebarChromeModel, d as useBlockCustomizeControls, h as previewWidgetOverrides, i as resolvePreviewDashboardSetupHandoff, m as PreviewFormProvider, o as resolvePreviewEditorGuidanceModel, p as usePreviewBlockCustomizeSelectionOptional, r as buildPreviewDashboardSetupUrl, t as canInspectSiteStyle, u as usePreviewSiteFontStorageUrl } from "./siteStyleAccess-CFMmoMZb.mjs";
5
- import { n as Separator, t as Spinner } from "./spinner-Bhpzz2vO.mjs";
2
+ import { $r as VARIANT_ROLES, A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, Pi as parseSiteId, Qr as getSiteFontsStorageUrl, Xr as buildFontPreviewUrl, Zr as generateFontFaceCss, er as paletteColorEntries, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, nr as paletteColorsSchema, wi as expectParsedBrandedId } from "./ThemedButton-b14Bv03E.mjs";
3
+ import { $ as lookTilePosition, $n as civilPickerDisplay, $t as ButtonVariantField, A as createStyleConfiguratorState, Aa as getCuratedSiteStyle, An as useEditorUiStoreInstance, Ao as SelectTrigger, B as previewButtonStyle, Ba as getHeaderStyle, Bs as displayedValues, Bt as SiteOptionWidgetProvider, C as acceptStyleSelection, Cn as BUILT_IN_REFERENCE_KINDS, Cr as SdkConfigProvider, D as applyResolvedSelections, Dn as resolvePageRouteSlug, Do as Select, Dr as mapCurrentValueForSelect, Dt as useAutosaveStatus, E as selectionSnapshotFromApplySiteStyleSelectionResponse, En as deriveRouteMetadataPresentation, Er as hasEmptyOption, F as markApplySaved, Fa as gradientToCss, Fo as SearchInput, Fr as parseBackgroundOverrideFromContent, G as resetTypographyToSaved, Gn as PaletteProvider, Go as TabsList, Gs as parseBookingLocalDate, Gt as loadMailingListAuthoringContext, H as previewFooterLook, Ha as replaceSiteStyleCompilationPlan, Hn as isEdited, Hs as valueStatus, Ht as OfferingsPreviewGroupOrderField, I as markApplySaving, Ia as GRADIENT_PRESETS, Io as Popover, J as styleConfiguratorHistoryEntryForPersistedSelection, Jt as IconPickerField, K as restageSelectionChanges, Kn as usePalette, Ko as TabsTrigger, Ks as parseUtcIsoDateTimeString, Kt as MailingListTargetingProvider, L as openRow, La as getGradientPreset, Lo as PopoverContent, Lr as planBackgroundTransition, Lt as createSiteOptionApiLoader, M as dismissWarnings, Ma as offeredSiteStyles, Mt as LinkedEntryLeaseBanner, N as isPreviewingChange, Na as palettesForSiteStyle, No as Callout, Nr as enabledBackgroundModes, O as applyTypographyDraftPatch, On as resolveContentTitle, Oo as SelectContent, Or as mapOptionValueForSelect, Os as cn, P as markApplyFailed, Po as CalloutDescription, Pr as imagePoolForOverride, Qt as ContentTypeWidgetProvider, R as palettePreviewProjection, Ra as findFooterLook, Ro as PopoverTrigger, Rr as rankBackgroundImagePoolItems, Rt as createSiteOptionWidgetAdapters, S as reportPreviewDesignError, Sn as routeLifecycleContext, So as FieldFrame, St as useEntryController, T as buildApplySiteStyleSelectionBody, Tn as parseReferenceKind, Ts as Button, U as previewHeaderLayout, Ua as defaultFooterPreferences, Un as canWriteLinkedEntry, Uo as Tabs, Ut as OfferingsPreviewWidgetProvider, V as previewCuratedPalette, Va as defaultHeaderLogoContext, Vr as ThemeScope, Vs as syncStateOf, W as previewHeaderStyle, Wo as TabsContent, Wr as resolveSdkFooterMode, Ws as formatDate, Wt as MailingListTargetingField, X as toggleRow, Xt as EntryPickerWidgetProvider, Y as syncStyleConfiguratorState, Yn as createManifestValidation, Ys as assertNever$1, Yt as EntryPickerField, Zn as FormRenderer, Zt as ContentTypeSelectField, _a as compileUpdatedSiteThemeFromSelections, _r as unwrapResponse, a as usePreviewDesignCoordinator, an as useRichTextImagePicker, as as Collapsible, c as buildSiteChromeSelectionModels, cs as Surface, d as createOptimisticActionRunner, dn as LinkWidgetProvider, dr as getDashboardUrl, ds as DropdownMenuItem, dt as FooterComposerPanel, en as ButtonWidgetProvider, f as resolveStyleConfiguratorInitialSnapshot, fn as BlockEditor, fs as DropdownMenuLabel, g as usePreviewPageDesignEditorState, ga as compileReplacementSiteThemeFromSelections, in as ReferenceWidgetProvider, j as deriveStyleConfiguratorCapabilities, jo as SelectValue, jr as canCycleBackgroundOverrideValue, k as cancelPreview, kn as useEditorUiStore, ko as SelectItem, kr as unmapValueFromSelect, ks as useField, l as cycleSiteChromeSelectionId, ls as DropdownMenu, ms as DropdownMenuTrigger, n as useSiteChromeCustomizeOptional, nn as MediaField, nr as listPageSurfaceContentSlots, nt as selectedLookTile, oi as buildThemeRuntime, on as RichTextField, os as CollapsibleContent, pn as BlockSourceLine, ps as DropdownMenuSeparator, pt as resolveFooterLayoutHints, q as setPaletteColors, qn as ManifestForm, qs as resolveBookingBusinessTimeZone, qt as InlineTextField, r as StyleSwitchSummary, rn as ReferenceField, rr as blocksKeys, sn as RichTextWidgetProvider, ss as CollapsibleTrigger, st as usePreviewAuth, tn as FileField, tr as listEntryPageContentSlots, u as planSiteChromeSelection, un as LinkField, us as DropdownMenuContent, vt as ContentFieldsForm, w as usePreviewAuthoringAdmission, wn as isAdapterReferenceKind, wr as useSdkConfig, wt as useOptionalSessionJournal, x as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, xr as createStoreBackend, yt as useUISelector, z as planStyleSwitch, za as getHeaderLayout, zn as toEditorBlockItem, zo as Input, zr as resolveBackgroundCapability, zt as SiteOptionPickerField } from "./SiteChromeCustomizeContext-CDbxk_qZ.mjs";
4
+ import { D as Maximize2, T as Monitor, dt as ChevronDown, f as Smartphone, ft as Check, l as Tablet, lt as ChevronRight, n as X$1, p as SlidersHorizontal, ut as ChevronLeft } from "./lucide-react-CA9cpo0P.mjs";
5
+ import { C as setPageDesignBlockBackground, D as gradientLabel, E as formatTokenLabel, M as locationWidgetOverrides, O as readBackgroundColorPaletteSnapshot, S as pageDesignLookTiles, T as BackgroundPreviewSwatch, _ as lookIsAutomatic, c as resolvePreviewSidebarChromeModel, d as useBlockCustomizeControls, f as ArrangementLookNote, h as ArrangementOptionsBody, i as resolvePreviewDashboardSetupHandoff, j as usePreviewBlockCustomizeSelectionOptional, o as resolvePreviewEditorGuidanceModel, r as buildPreviewDashboardSetupUrl, t as canInspectSiteStyle, u as usePreviewSiteFontStorageUrl, v as useArrangementToolbar, w as BackgroundChooser, y as CustomizeBackgroundControlRows } from "./siteStyleAccess-Kqk0j0dE.mjs";
6
+ import { i as useOptionalLocationPickerEnvironment, n as LocationPickerEnvironmentProvider } from "./LocationPickerEnvironment-QtSG2Bl-.mjs";
7
+ import { n as Separator, t as Spinner } from "./spinner-CGxS8Ns-.mjs";
6
8
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
7
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
10
  import { useQuery, useQueryClient } from "@tanstack/react-query";
9
11
  import { useRouter } from "next/navigation.js";
10
- //#region ../blocks/src/subroutes/formatDate.ts
11
- /** Occurrence instants name the occurrence-local day; civil keys preserve their day. */
12
- function formatOccurrenceDate(iso, context) {
13
- if (!iso) return null;
14
- if (/^\d{4}-\d{2}-\d{2}$/.test(iso)) try {
15
- return formatDate({
16
- kind: "civil",
17
- value: parseBookingLocalDate(iso)
18
- }, context, { date: "long" });
19
- } catch {
20
- return null;
21
- }
22
- const instant = parseUtcIsoDateTimeString(iso);
23
- return instant.ok ? formatDate({
24
- kind: "instant",
25
- value: instant.value
26
- }, context, { date: "long" }) : null;
27
- }
28
- //#endregion
29
- //#region ../blocks/src/subroutes/fold.ts
30
- /**
31
- * Typeclass-style exhaustive dispatch over a subroute context.
32
- *
33
- * The single place that knows how to peel the discriminated union open and
34
- * hand its inner payload to a kind-specific handler. Use this instead of
35
- * inline `switch (ctx.kind)` so the dispatch stays consistent across
36
- * consumers (notice, SEO, breadcrumbs, …).
37
- */
38
- function foldSubroute(ctx, fold) {
39
- switch (ctx.kind) {
40
- case "event-occurrence": return fold["event-occurrence"](ctx.occurrence);
41
- case "event-run": return fold["event-run"](ctx.run);
42
- }
43
- }
44
- //#endregion
45
- //#region ../blocks/src/subroutes/kinds.ts
46
- /**
47
- * The single source of truth for per-kind subroute metadata.
48
- *
49
- * Adding a new {@link EntrySubrouteKind} requires a new entry here; the
50
- * `Record<EntrySubrouteKind, …>` shape will refuse to compile otherwise.
51
- */
52
- const SUBROUTE_KINDS = {
53
- "event-occurrence": {
54
- kind: "event-occurrence",
55
- containerNoun: "event",
56
- instanceNoun: "date",
57
- listLabel: "events list",
58
- formatInstanceName: (occurrence, locale) => formatOccurrenceDate(occurrence.startsAt, {
59
- locale,
60
- timeZone: resolveBookingBusinessTimeZone(occurrence.timeZone)
61
- }),
62
- subEditorPath: () => "bookings/events"
63
- },
64
- "event-run": {
65
- kind: "event-run",
66
- containerNoun: "event",
67
- instanceNoun: "run",
68
- listLabel: "event runs",
69
- formatInstanceName: (run) => run.name,
70
- subEditorPath: () => "bookings/events"
71
- }
72
- };
73
- //#endregion
74
12
  //#region ../../node_modules/.pnpm/react-colorful@5.7.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/react-colorful/dist/index.mjs
75
13
  function u() {
76
14
  return (u = Object.assign || function(e) {
@@ -578,6 +516,430 @@ function ContentSpinner({ className, size = "xl" }) {
578
516
  });
579
517
  }
580
518
  //#endregion
519
+ //#region ../blocks/src/subroutes/formatDate.ts
520
+ /** Occurrence instants name the occurrence-local day; civil keys preserve their day. */
521
+ function formatOccurrenceDate(iso, context) {
522
+ if (!iso) return null;
523
+ if (/^\d{4}-\d{2}-\d{2}$/.test(iso)) try {
524
+ return formatDate({
525
+ kind: "civil",
526
+ value: parseBookingLocalDate(iso)
527
+ }, context, { date: "long" });
528
+ } catch {
529
+ return null;
530
+ }
531
+ const instant = parseUtcIsoDateTimeString(iso);
532
+ return instant.ok ? formatDate({
533
+ kind: "instant",
534
+ value: instant.value
535
+ }, context, { date: "long" }) : null;
536
+ }
537
+ //#endregion
538
+ //#region ../blocks/src/subroutes/fold.ts
539
+ /**
540
+ * Typeclass-style exhaustive dispatch over a subroute context.
541
+ *
542
+ * The single place that knows how to peel the discriminated union open and
543
+ * hand its inner payload to a kind-specific handler. Use this instead of
544
+ * inline `switch (ctx.kind)` so the dispatch stays consistent across
545
+ * consumers (notice, SEO, breadcrumbs, …).
546
+ */
547
+ function foldSubroute(ctx, fold) {
548
+ switch (ctx.kind) {
549
+ case "event-occurrence": return fold["event-occurrence"](ctx.occurrence);
550
+ case "event-run": return fold["event-run"](ctx.run);
551
+ }
552
+ }
553
+ //#endregion
554
+ //#region ../blocks/src/subroutes/kinds.ts
555
+ /**
556
+ * The single source of truth for per-kind subroute metadata.
557
+ *
558
+ * Adding a new {@link EntrySubrouteKind} requires a new entry here; the
559
+ * `Record<EntrySubrouteKind, …>` shape will refuse to compile otherwise.
560
+ */
561
+ const SUBROUTE_KINDS = {
562
+ "event-occurrence": {
563
+ kind: "event-occurrence",
564
+ containerNoun: "event",
565
+ instanceNoun: "date",
566
+ listLabel: "events list",
567
+ formatInstanceName: (occurrence, locale) => formatOccurrenceDate(occurrence.startsAt, {
568
+ locale,
569
+ timeZone: resolveBookingBusinessTimeZone(occurrence.timeZone)
570
+ }),
571
+ subEditorPath: () => "bookings/events"
572
+ },
573
+ "event-run": {
574
+ kind: "event-run",
575
+ containerNoun: "event",
576
+ instanceNoun: "run",
577
+ listLabel: "event runs",
578
+ formatInstanceName: (run) => run.name,
579
+ subEditorPath: () => "bookings/events"
580
+ }
581
+ };
582
+ //#endregion
583
+ //#region ../block-form/src/widgets/SelectWidget.tsx
584
+ /**
585
+ * Standalone select widget with block-form styling parity. Supports custom option
586
+ * renderers while maintaining accessible labelling and message semantics.
587
+ */
588
+ function SelectWidget(props) {
589
+ const { id, label, value, onChange, options, description, hint, error, placeholder, triggerClassName, size = "default", disabled, className, labelClassName, descriptionClassName, renderOption, renderValue, dataPath } = props;
590
+ const normalizedValue = value ?? "";
591
+ const allowEmptyOption = useMemo(() => hasEmptyOption(options), [options]);
592
+ const radixValue = useMemo(() => mapCurrentValueForSelect(value, allowEmptyOption), [value, allowEmptyOption]);
593
+ const selectedOption = useMemo(() => options.find((option) => option.value === normalizedValue), [options, normalizedValue]);
594
+ return /* @__PURE__ */ jsx("div", {
595
+ "data-theme-path": dataPath,
596
+ children: /* @__PURE__ */ jsx(FieldFrame, {
597
+ id,
598
+ label,
599
+ description,
600
+ hint,
601
+ error,
602
+ className,
603
+ labelClassName,
604
+ descriptionClassName,
605
+ children: ({ id: controlId, descriptionId, messageId }) => {
606
+ const describedBy = [descriptionId, messageId].filter(Boolean).join(" ") || void 0;
607
+ return /* @__PURE__ */ jsxs(Select, {
608
+ value: radixValue,
609
+ onValueChange: (nextValue) => onChange(unmapValueFromSelect(nextValue, allowEmptyOption)),
610
+ disabled,
611
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
612
+ id: controlId,
613
+ size,
614
+ className: cn("w-full justify-between", triggerClassName),
615
+ "aria-describedby": describedBy,
616
+ children: renderValue && value !== null && value !== void 0 ? /* @__PURE__ */ jsx("span", {
617
+ className: "truncate",
618
+ children: renderValue(selectedOption)
619
+ }) : /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? `Select ${label.toLowerCase()}` })
620
+ }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => {
621
+ const optionValue = mapOptionValueForSelect(option.value, allowEmptyOption);
622
+ return /* @__PURE__ */ jsx(SelectItem, {
623
+ value: optionValue,
624
+ disabled: option.disabled,
625
+ children: renderOption ? renderOption(option, { selected: option.value === selectedOption?.value }) : renderDefaultOption(option)
626
+ }, optionValue);
627
+ }) })]
628
+ });
629
+ }
630
+ })
631
+ });
632
+ }
633
+ function renderDefaultOption(option) {
634
+ if (!option.description) return option.label;
635
+ return /* @__PURE__ */ jsxs("div", {
636
+ className: "flex flex-col gap-0.5",
637
+ children: [/* @__PURE__ */ jsx("span", {
638
+ className: "text-sm font-medium text-foreground",
639
+ children: option.label
640
+ }), /* @__PURE__ */ jsx("span", {
641
+ className: "text-xs text-muted-foreground",
642
+ children: option.description
643
+ })]
644
+ });
645
+ }
646
+ //#endregion
647
+ //#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorWidget.tsx
648
+ const ROLE_COLOR_NAMES = [
649
+ "primary",
650
+ "secondary",
651
+ "accent"
652
+ ];
653
+ /**
654
+ * BackgroundColorWidget
655
+ *
656
+ * Select a background color from the site's theme palette or SDK config.
657
+ * Automatically uses SDK section backgrounds from context when available.
658
+ * Otherwise supports 'limited' mode (key shades only) or 'full' mode (all shades).
659
+ * Optionally filters to only show legible colors via filterTokens prop.
660
+ */
661
+ function BackgroundColorWidget(props) {
662
+ const { label, value, onChange, mode = "limited", filterTokens = null, className, triggerClassName, description, error, dataPath } = props;
663
+ const { tokens } = usePalette();
664
+ const { sectionBackgrounds, themePalette, isSdkSite } = useSdkConfig();
665
+ const handleChange = useCallback((next) => {
666
+ onChange(next);
667
+ }, [onChange]);
668
+ const useSdkMode = isSdkSite && sectionBackgrounds && sectionBackgrounds.length > 0;
669
+ const sdkOptions = useMemo(() => {
670
+ if (!useSdkMode || !sectionBackgrounds) return [];
671
+ return sectionBackgrounds.map((bg) => ({
672
+ value: bg.id,
673
+ label: bg.label
674
+ }));
675
+ }, [useSdkMode, sectionBackgrounds]);
676
+ const sdkBackgroundsMap = useMemo(() => {
677
+ if (!useSdkMode || !sectionBackgrounds) return /* @__PURE__ */ new Map();
678
+ return new Map(sectionBackgrounds.map((bg) => {
679
+ const hexValue = themePalette?.[bg.token] ?? bg.token;
680
+ return [bg.id, hexValue];
681
+ }));
682
+ }, [
683
+ useSdkMode,
684
+ sectionBackgrounds,
685
+ themePalette
686
+ ]);
687
+ const availableTokens = useMemo(() => {
688
+ if (useSdkMode) return [];
689
+ return Object.keys(tokens).filter((key) => {
690
+ return typeof tokens[key] === "string";
691
+ });
692
+ }, [tokens, useSdkMode]);
693
+ const modeFilteredTokens = useMemo(() => {
694
+ if (useSdkMode) return [];
695
+ if (mode === "full") return availableTokens;
696
+ const limitedPatterns = [
697
+ "surface",
698
+ "background",
699
+ "transparent",
700
+ "-50",
701
+ "-500",
702
+ "-900"
703
+ ];
704
+ return [...availableTokens.filter((token) => {
705
+ if (limitedPatterns.some((pattern) => token.includes(pattern))) return true;
706
+ if (ROLE_COLOR_NAMES.includes(token)) return true;
707
+ return false;
708
+ })].sort((a, b) => {
709
+ const aIsBase = ROLE_COLOR_NAMES.includes(a);
710
+ const bIsBase = ROLE_COLOR_NAMES.includes(b);
711
+ if (aIsBase && !bIsBase) return -1;
712
+ if (!aIsBase && bIsBase) return 1;
713
+ return a.localeCompare(b);
714
+ });
715
+ }, [
716
+ mode,
717
+ availableTokens,
718
+ useSdkMode
719
+ ]);
720
+ const filteredTokens = useMemo(() => {
721
+ if (useSdkMode) return [];
722
+ if (!filterTokens) return modeFilteredTokens;
723
+ return modeFilteredTokens.filter((token) => filterTokens.includes(token));
724
+ }, [
725
+ modeFilteredTokens,
726
+ filterTokens,
727
+ useSdkMode
728
+ ]);
729
+ const paletteOptions = useMemo(() => {
730
+ return filteredTokens.map((token) => ({
731
+ value: token,
732
+ label: getColorTokenLabel(token)
733
+ }));
734
+ }, [filteredTokens]);
735
+ const options = useSdkMode ? sdkOptions : paletteOptions;
736
+ const getHex = useCallback((tokenOrId) => {
737
+ if (useSdkMode) return sdkBackgroundsMap.get(tokenOrId) ?? null;
738
+ const hex = tokens[tokenOrId];
739
+ return typeof hex === "string" ? hex : null;
740
+ }, [
741
+ useSdkMode,
742
+ sdkBackgroundsMap,
743
+ tokens
744
+ ]);
745
+ return /* @__PURE__ */ jsx(SelectWidget, {
746
+ label,
747
+ value: value ?? null,
748
+ onChange: handleChange,
749
+ options,
750
+ className,
751
+ error,
752
+ dataPath,
753
+ description,
754
+ triggerClassName: cn("flex w-full items-center justify-between gap-2", triggerClassName),
755
+ renderOption: (option) => /* @__PURE__ */ jsxs("div", {
756
+ className: "flex items-center gap-3",
757
+ children: [
758
+ /* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }),
759
+ /* @__PURE__ */ jsx("span", {
760
+ className: "text-sm font-medium text-foreground",
761
+ children: option.label
762
+ }),
763
+ !useSdkMode && /* @__PURE__ */ jsx("span", {
764
+ className: "ml-auto text-xs text-muted-foreground",
765
+ children: option.value
766
+ })
767
+ ]
768
+ }),
769
+ renderValue: (option) => option ? /* @__PURE__ */ jsxs("div", {
770
+ className: "flex items-center gap-2",
771
+ children: [/* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }), /* @__PURE__ */ jsx("span", {
772
+ className: "text-sm",
773
+ children: option.label
774
+ })]
775
+ }) : null
776
+ });
777
+ }
778
+ /**
779
+ * Color swatch component
780
+ */
781
+ function ColorSwatch({ hex }) {
782
+ return /* @__PURE__ */ jsx("span", {
783
+ "aria-hidden": "true",
784
+ className: cn("h-4 w-4 rounded-full border border-border/50 shadow-sm", !hex && "bg-gradient-to-br from-muted to-muted-foreground/30"),
785
+ style: hex ? { backgroundColor: hex } : void 0
786
+ });
787
+ }
788
+ /**
789
+ * Get display label for a color token
790
+ * Converts token names to readable labels (e.g., primary-500 becomes Primary 500)
791
+ */
792
+ function getColorTokenLabel(token) {
793
+ const specialLabels = {
794
+ "surface": "Surface",
795
+ "background": "Background",
796
+ "text": "Text",
797
+ "transparent": "Transparent",
798
+ "body": "Body Text",
799
+ "mutedText": "Muted Text"
800
+ };
801
+ if (specialLabels[token]) return specialLabels[token];
802
+ return token.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
803
+ }
804
+ //#endregion
805
+ //#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorField.tsx
806
+ function BackgroundColorField({ path, backend, config }) {
807
+ const { value, error, setValue } = useField(path, backend);
808
+ return /* @__PURE__ */ jsx(BackgroundColorWidget, {
809
+ label: config.label || "Background Color",
810
+ value: value ?? null,
811
+ onChange: setValue,
812
+ mode: "full",
813
+ description: config.description,
814
+ error: error?.message,
815
+ dataPath: path
816
+ });
817
+ }
818
+ //#endregion
819
+ //#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientWidget.tsx
820
+ /**
821
+ * Select a curated gradient from the theme-based library.
822
+ * Gradients use theme color tokens, so they adapt to the site's palette.
823
+ */
824
+ function BackgroundGradientWidget({ label, value, onChange, description, error, dataPath }) {
825
+ const { tokens } = usePalette();
826
+ const selectedPreset = useMemo(() => value ? GRADIENT_PRESETS.find((preset) => gradientConfigsMatch(preset, value)) ?? null : null, [value]);
827
+ const handleSelectPreset = (presetId) => {
828
+ onChange(gradientConfigFromPreset(getGradientPreset(presetId)));
829
+ };
830
+ return /* @__PURE__ */ jsx(FieldFrame, {
831
+ fieldPath: dataPath,
832
+ label,
833
+ description,
834
+ error,
835
+ className: "space-y-3",
836
+ children: ({ id, descriptionId, messageId }) => /* @__PURE__ */ jsxs("div", {
837
+ className: "space-y-3",
838
+ children: [/* @__PURE__ */ jsx("div", {
839
+ role: "group",
840
+ "aria-label": `${label} presets`,
841
+ "aria-describedby": [descriptionId, messageId].filter(Boolean).join(" ") || void 0,
842
+ className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
843
+ children: GRADIENT_PRESETS.map((preset, index) => {
844
+ const isSelected = selectedPreset?.id === preset.id;
845
+ const cssGradient = gradientToCss(gradientConfigFromPreset(preset), tokens);
846
+ const kindLabel = gradientKindLabel(preset.type);
847
+ return /* @__PURE__ */ jsxs("button", {
848
+ id: index === 0 ? id : void 0,
849
+ type: "button",
850
+ "aria-label": `${preset.name}, ${kindLabel} gradient`,
851
+ "aria-pressed": isSelected,
852
+ onClick: () => handleSelectPreset(preset.id),
853
+ className: cn("group flex flex-col gap-2 rounded-md border p-2 text-left transition", isSelected ? "border-foreground bg-accent/30" : "border-muted-foreground/30 bg-background hover:bg-muted/40"),
854
+ children: [/* @__PURE__ */ jsx("span", {
855
+ "aria-hidden": "true",
856
+ className: "h-16 w-full rounded-sm",
857
+ style: { background: cssGradient }
858
+ }), /* @__PURE__ */ jsxs("span", {
859
+ className: "space-y-0.5",
860
+ children: [/* @__PURE__ */ jsx("span", {
861
+ className: "block text-xs font-medium text-foreground",
862
+ children: preset.name
863
+ }), /* @__PURE__ */ jsx("span", {
864
+ className: "block text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
865
+ children: kindLabel
866
+ })]
867
+ })]
868
+ }, preset.id);
869
+ })
870
+ }), value ? /* @__PURE__ */ jsxs("p", {
871
+ className: "text-xs text-muted-foreground",
872
+ "aria-live": "polite",
873
+ children: ["Selected gradient: ", selectedPreset ? `${selectedPreset.name} · ${gradientKindLabel(selectedPreset.type)}` : "Custom"]
874
+ }) : null]
875
+ })
876
+ });
877
+ }
878
+ function gradientConfigFromPreset(preset) {
879
+ return {
880
+ type: preset.type,
881
+ angle: preset.angle,
882
+ shape: preset.shape,
883
+ position: preset.position,
884
+ stops: preset.stops.map((stop) => ({ ...stop }))
885
+ };
886
+ }
887
+ function gradientConfigsMatch(preset, value) {
888
+ return preset.type === value.type && preset.angle === value.angle && radialShape(preset) === radialShape(value) && preset.position === value.position && preset.stops.length === value.stops.length && preset.stops.every((stop, index) => stop.color === value.stops[index]?.color && stop.position === value.stops[index]?.position);
889
+ }
890
+ function radialShape(config) {
891
+ return config.type === "radial" ? config.shape ?? "circle" : config.shape;
892
+ }
893
+ function gradientKindLabel(type) {
894
+ switch (type) {
895
+ case "linear": return "Linear";
896
+ case "radial": return "Radial";
897
+ case "conic": return "Conic";
898
+ }
899
+ }
900
+ //#endregion
901
+ //#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientField.tsx
902
+ /**
903
+ * BackgroundGradientField
904
+ *
905
+ * Field wrapper for BackgroundGradientWidget that integrates with the form system.
906
+ * Converts between GradientConfig objects (used by the widget) and CSS strings
907
+ * (stored in the form data).
908
+ *
909
+ * This is registered as a widget override with key 'backgroundGradient'.
910
+ */
911
+ function BackgroundGradientField({ path, backend, config }) {
912
+ const { value, error, setValue } = useField(path, backend);
913
+ const { tokens } = usePalette();
914
+ const currentConfig = findPresetFromCss(value ?? null, tokens);
915
+ const handleChange = (gradientConfig) => {
916
+ setValue(gradientToCss(gradientConfig, tokens));
917
+ };
918
+ return /* @__PURE__ */ jsx(BackgroundGradientWidget, {
919
+ label: config.label || "Gradient",
920
+ value: currentConfig,
921
+ onChange: handleChange,
922
+ description: config.description,
923
+ error: error?.message,
924
+ dataPath: path
925
+ });
926
+ }
927
+ /**
928
+ * Attempts to find a preset that matches the given CSS gradient string.
929
+ *
930
+ * This is a best-effort reverse lookup - if the CSS was generated from a preset,
931
+ * we can find and highlight that preset. If it's custom CSS, we return null
932
+ * and the widget shows no selection.
933
+ */
934
+ function findPresetFromCss(css, tokens) {
935
+ if (!css) return null;
936
+ for (const preset of GRADIENT_PRESETS) {
937
+ const presetConfig = gradientConfigFromPreset(preset);
938
+ if (gradientToCss(presetConfig, tokens) === css) return presetConfig;
939
+ }
940
+ return null;
941
+ }
942
+ //#endregion
581
943
  //#region ../content-model/src/content-types/entryValidation.ts
582
944
  function hasRepeaterVariants(field) {
583
945
  return field.itemTypes !== void 0;
@@ -880,6 +1242,556 @@ function footerComposerInspectionProps(inspection) {
880
1242
  };
881
1243
  }
882
1244
  //#endregion
1245
+ //#region ../editor-blocks/src/widgets/entry-picker/loaders.ts
1246
+ function getStatusBadgeVariant(status) {
1247
+ switch (status) {
1248
+ case "published": return "default";
1249
+ case "draft": return "secondary";
1250
+ case "scheduled": return "outline";
1251
+ case "archived": return "destructive";
1252
+ default: return "secondary";
1253
+ }
1254
+ }
1255
+ function mapEntryPickerItems(entries, valueFrom) {
1256
+ return entries.map((entry) => ({
1257
+ value: valueFrom === "identifier" ? entry.identifier ?? entry.id : valueFrom === "slug" ? entry.slug ?? entry.id : entry.id,
1258
+ label: entry.draftTitle || entry.title || entry.slug || entry.id,
1259
+ id: entry.id,
1260
+ identifier: entry.identifier ?? null,
1261
+ slug: entry.slug ?? null,
1262
+ badge: {
1263
+ label: entry.status,
1264
+ variant: getStatusBadgeVariant(entry.status)
1265
+ }
1266
+ }));
1267
+ }
1268
+ async function loadEntryPickerItems({ apiClient, siteId, contentType, valueFrom }) {
1269
+ const { entries } = unwrapResponse(await apiClient({
1270
+ endpoint: "listContentEntries",
1271
+ params: {
1272
+ siteId,
1273
+ type: contentType
1274
+ }
1275
+ }));
1276
+ return mapEntryPickerItems(entries, valueFrom);
1277
+ }
1278
+ //#endregion
1279
+ //#region ../editor-blocks/src/widgets/link/loaders.ts
1280
+ async function loadRoutableContentItems({ apiClient, siteId }) {
1281
+ const payload = unwrapResponse(await apiClient({
1282
+ endpoint: "getRoutableContent",
1283
+ params: { siteId }
1284
+ }));
1285
+ if (!Array.isArray(payload?.items)) throw new Error("Invalid routable content response");
1286
+ return payload.items;
1287
+ }
1288
+ //#endregion
1289
+ //#region ../editor-blocks/src/widgets/reference/dynamicAdapters.ts
1290
+ /**
1291
+ * Adds dynamic `content:${contentTypeKey}` adapter resolution to a static
1292
+ * reference adapter map while keeping symbol property lookups inert for
1293
+ * framework/devtool probes.
1294
+ */
1295
+ function createDynamicReferenceAdapters(staticAdapters, createDynamicContentAdapter) {
1296
+ return new Proxy(staticAdapters, { get(target, prop) {
1297
+ if (typeof prop !== "string") return;
1298
+ if (prop in target) return target[prop];
1299
+ const parsed = parseReferenceKind(prop);
1300
+ if (parsed.kind === "dynamicContent") return createDynamicContentAdapter(parsed.contentTypeKey);
1301
+ } });
1302
+ }
1303
+ //#endregion
1304
+ //#region ../editor-blocks/src/widgets/reference/loaders.ts
1305
+ /**
1306
+ * Reference Widget Loaders
1307
+ *
1308
+ * Canonical, environment-agnostic data fetchers for each built-in reference kind.
1309
+ * Both the dashboard reference adapter map (`apps/dashboard/src/lib/block-form/referenceAdapters.tsx`)
1310
+ * and the preview-next reference adapter map (`packages/preview-next/src/client/widgets/widgetAdapters.ts`)
1311
+ * compose these loaders with their own labels, manage-links, caching, and error wrapping.
1312
+ *
1313
+ * Adding a new `BUILT_IN_REFERENCE_KIND` requires adding a loader here and an entry in
1314
+ * `referenceLoaders`. Both gates are enforced by TypeScript and a runtime parity test.
1315
+ *
1316
+ * Each loader takes the request shape `{ apiClient, siteId }` and returns a
1317
+ * `ReferenceWidgetItem[]` ready for the picker UI. Loaders throw raw errors —
1318
+ * environment-specific error wrapping (e.g. `toUserFacingError`) happens at the
1319
+ * composition layer.
1320
+ */
1321
+ function defineReferenceLoader(referenceKind, loader) {
1322
+ return Object.assign(loader, { referenceKind });
1323
+ }
1324
+ function formatStatusBadge(status) {
1325
+ if (status === "published") return {
1326
+ label: "Published",
1327
+ variant: "default"
1328
+ };
1329
+ if (status === "scheduled") return {
1330
+ label: "Scheduled",
1331
+ variant: "secondary"
1332
+ };
1333
+ if (status === "archived") return {
1334
+ label: "Archived",
1335
+ variant: "outline"
1336
+ };
1337
+ return {
1338
+ label: "Draft",
1339
+ variant: "outline"
1340
+ };
1341
+ }
1342
+ function hasSlug(entry) {
1343
+ return entry.slug !== null;
1344
+ }
1345
+ const loadPostReferenceItems = defineReferenceLoader("post", async ({ apiClient, siteId }) => {
1346
+ const { entries } = unwrapResponse(await apiClient({
1347
+ endpoint: "listContentEntries",
1348
+ params: {
1349
+ siteId,
1350
+ type: "post"
1351
+ }
1352
+ }));
1353
+ return entries.filter(hasSlug).filter((entry) => entry.status === "published").map((entry) => ({
1354
+ value: entry.slug,
1355
+ label: entry.title || entry.slug || entry.id,
1356
+ badge: formatStatusBadge(entry.status)
1357
+ }));
1358
+ });
1359
+ const loadFormReferenceItems = defineReferenceLoader("form", async ({ apiClient, siteId }) => {
1360
+ const { forms } = unwrapResponse(await apiClient({
1361
+ endpoint: "listForms",
1362
+ params: { siteId }
1363
+ }));
1364
+ return forms.map((form) => ({
1365
+ value: form.slug,
1366
+ label: form.name
1367
+ }));
1368
+ });
1369
+ const loadBookingFormReferenceItems = defineReferenceLoader("bookingForm", async ({ apiClient, siteId }) => {
1370
+ const { forms } = unwrapResponse(await apiClient({
1371
+ endpoint: "listBookingForms",
1372
+ params: { siteId }
1373
+ }));
1374
+ return forms.map((form) => ({
1375
+ value: form.id,
1376
+ label: form.name
1377
+ }));
1378
+ });
1379
+ const loadAppointmentServiceReferenceItems = defineReferenceLoader("appointmentService", async ({ apiClient, siteId }) => {
1380
+ const { options } = unwrapResponse(await apiClient({
1381
+ endpoint: "getAppointmentServicesReference",
1382
+ params: { siteId }
1383
+ }));
1384
+ return options.map((option) => ({
1385
+ value: option.id,
1386
+ label: option.label
1387
+ }));
1388
+ });
1389
+ const loadAppointmentResourceReferenceItems = defineReferenceLoader("appointmentResource", async ({ apiClient, siteId }) => {
1390
+ const { options } = unwrapResponse(await apiClient({
1391
+ endpoint: "getAppointmentResourcesReference",
1392
+ params: { siteId }
1393
+ }));
1394
+ return options.map((option) => ({
1395
+ value: option.id,
1396
+ label: option.label
1397
+ }));
1398
+ });
1399
+ const loadPageReferenceItems = defineReferenceLoader("page", async ({ apiClient, siteId }) => {
1400
+ const { items } = unwrapResponse(await apiClient({
1401
+ endpoint: "getRoutableContent",
1402
+ params: { siteId }
1403
+ }));
1404
+ return items.filter((item) => item.entityType === "page").map((page) => ({
1405
+ value: page.entityId,
1406
+ label: page.title || "Untitled"
1407
+ }));
1408
+ });
1409
+ const loadNewsletterListReferenceItems = defineReferenceLoader("newsletterList", async ({ apiClient, siteId }) => {
1410
+ const { lists } = unwrapResponse(await apiClient({
1411
+ endpoint: "listNewsletterLists",
1412
+ params: { siteId }
1413
+ }));
1414
+ return lists.map((list) => ({
1415
+ value: list.id,
1416
+ label: list.name
1417
+ }));
1418
+ });
1419
+ const loadMailchimpAudienceReferenceItems = defineReferenceLoader("mailchimpAudience", async ({ apiClient, siteId }) => {
1420
+ const response = unwrapResponse(await apiClient({
1421
+ endpoint: "listMailchimpAudiences",
1422
+ params: { siteId }
1423
+ }));
1424
+ switch (response.tag) {
1425
+ case "not_connected":
1426
+ case "needs_reauth": return [];
1427
+ case "connected": return response.audiences.map((audience) => ({
1428
+ value: audience.id,
1429
+ label: audience.name,
1430
+ subtitle: audience.memberCount === null ? void 0 : `${audience.memberCount.toLocaleString()} contacts`,
1431
+ badge: audience.compatibilityIssues.length > 0 ? {
1432
+ label: "Needs review",
1433
+ variant: "outline"
1434
+ } : void 0
1435
+ }));
1436
+ default: return assertNever$1(response);
1437
+ }
1438
+ });
1439
+ async function loadDynamicContentReferenceItems({ apiClient, siteId, contentTypeKey }) {
1440
+ const { entries } = unwrapResponse(await apiClient({
1441
+ endpoint: "listContentEntries",
1442
+ params: {
1443
+ siteId,
1444
+ type: contentTypeKey
1445
+ }
1446
+ }));
1447
+ return entries.filter((entry) => entry.status === "published").map((entry) => ({
1448
+ value: entry.id,
1449
+ label: entry.title || entry.slug || entry.id,
1450
+ badge: {
1451
+ label: "Published",
1452
+ variant: "default"
1453
+ }
1454
+ }));
1455
+ }
1456
+ /**
1457
+ * Typed map keyed by `BuiltInReferenceKind`. Adding a new built-in kind fails to
1458
+ * compile here. The `satisfies` form preserves the literal's inferred shape while
1459
+ * still enforcing that every `BuiltInReferenceKind` has a loader and that no
1460
+ * extraneous keys are present. The parity test in `loaders.test.ts` is the
1461
+ * defense-in-depth against someone widening this annotation to `Record<string, …>`.
1462
+ */
1463
+ const referenceLoaders = {
1464
+ post: loadPostReferenceItems,
1465
+ form: loadFormReferenceItems,
1466
+ bookingForm: loadBookingFormReferenceItems,
1467
+ appointmentService: loadAppointmentServiceReferenceItems,
1468
+ appointmentResource: loadAppointmentResourceReferenceItems,
1469
+ page: loadPageReferenceItems,
1470
+ newsletterList: loadNewsletterListReferenceItems,
1471
+ mailchimpAudience: loadMailchimpAudienceReferenceItems
1472
+ };
1473
+ //#endregion
1474
+ //#region ../preview-next/src/client/widgets/widgetAdapters.ts
1475
+ const entryPickerCache = /* @__PURE__ */ new Map();
1476
+ const siteOptionItemsCache = /* @__PURE__ */ new Map();
1477
+ /**
1478
+ * Single module-level cache for every built-in reference kind, keyed by
1479
+ * `${kind}:${siteId}`. Module-level (not factory-scoped) so repeated calls to
1480
+ * `createPreviewReferenceAdapters` (StrictMode double-invoke, site switching via
1481
+ * `useMemo`) don't leak per-call Map instances.
1482
+ */
1483
+ const referenceItemsCache = /* @__PURE__ */ new Map();
1484
+ const dynamicReferenceItemsCache = /* @__PURE__ */ new Map();
1485
+ const MAX_CACHE_ENTRIES = 50;
1486
+ function setBoundedCache(map, key, value) {
1487
+ if (!map.has(key) && map.size >= MAX_CACHE_ENTRIES) {
1488
+ const firstKey = map.keys().next().value;
1489
+ if (firstKey !== void 0) map.delete(firstKey);
1490
+ }
1491
+ map.set(key, value);
1492
+ }
1493
+ function createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, fallbackSiteId) {
1494
+ return {
1495
+ labels: {
1496
+ loading: "Loading entries…",
1497
+ select: "Select an entry",
1498
+ empty: "No entries found",
1499
+ emptySelection: "Select an entry to continue."
1500
+ },
1501
+ loadItems: async ({ siteId }) => {
1502
+ const resolvedSiteId = siteId || fallbackSiteId;
1503
+ if (!resolvedSiteId) return [];
1504
+ const cacheKey = `${resolvedSiteId}:content:${contentTypeKey}`;
1505
+ const cached = dynamicReferenceItemsCache.get(cacheKey);
1506
+ if (cached) return cached;
1507
+ const promise = (async () => {
1508
+ try {
1509
+ return await loadDynamicContentReferenceItems({
1510
+ apiClient: previewClient,
1511
+ siteId: resolvedSiteId,
1512
+ contentTypeKey
1513
+ });
1514
+ } catch (error) {
1515
+ dynamicReferenceItemsCache.delete(cacheKey);
1516
+ throw error;
1517
+ }
1518
+ })();
1519
+ setBoundedCache(dynamicReferenceItemsCache, cacheKey, promise);
1520
+ return promise;
1521
+ }
1522
+ };
1523
+ }
1524
+ /**
1525
+ * Wraps a shared reference loader in a module-level cache keyed by
1526
+ * `${kind}:${siteId}`. Rejected promises are evicted so a transient failure
1527
+ * doesn't poison subsequent calls.
1528
+ */
1529
+ function createCachedReferenceAdapterLoader(kind, loader, previewClient, fallbackSiteId) {
1530
+ return async ({ siteId }) => {
1531
+ const resolvedSiteId = siteId || fallbackSiteId;
1532
+ if (!resolvedSiteId) return [];
1533
+ const cacheKey = `${kind}:${resolvedSiteId}`;
1534
+ const cached = referenceItemsCache.get(cacheKey);
1535
+ if (cached) return cached;
1536
+ const promise = (async () => {
1537
+ try {
1538
+ return await loader({
1539
+ apiClient: previewClient,
1540
+ siteId: resolvedSiteId
1541
+ });
1542
+ } catch (error) {
1543
+ referenceItemsCache.delete(cacheKey);
1544
+ throw error;
1545
+ }
1546
+ })();
1547
+ setBoundedCache(referenceItemsCache, cacheKey, promise);
1548
+ return promise;
1549
+ };
1550
+ }
1551
+ function createPreviewLinkAdapters(previewClient) {
1552
+ return { fetchRoutableContent: (siteId) => loadRoutableContentItems({
1553
+ apiClient: previewClient,
1554
+ siteId
1555
+ }) };
1556
+ }
1557
+ function createPreviewEntryPickerAdapter(previewClient) {
1558
+ return {
1559
+ loadItems: async ({ siteId, contentType, valueFrom }) => {
1560
+ if (!siteId || !contentType) return [];
1561
+ const cacheKey = `${siteId}:${contentType}:${valueFrom ?? "id"}`;
1562
+ const cached = entryPickerCache.get(cacheKey);
1563
+ if (cached) return cached;
1564
+ const request = (async () => {
1565
+ try {
1566
+ return await loadEntryPickerItems({
1567
+ apiClient: previewClient,
1568
+ siteId,
1569
+ contentType,
1570
+ valueFrom
1571
+ });
1572
+ } catch (error) {
1573
+ entryPickerCache.delete(cacheKey);
1574
+ throw error;
1575
+ }
1576
+ })();
1577
+ setBoundedCache(entryPickerCache, cacheKey, request);
1578
+ return request;
1579
+ },
1580
+ labels: {
1581
+ loading: "Loading entries...",
1582
+ select: "Select an entry",
1583
+ empty: "No entries found",
1584
+ emptySelection: "Select an entry to embed.",
1585
+ noContentType: "Select a content type first."
1586
+ }
1587
+ };
1588
+ }
1589
+ function createCachedSiteOptionLoader(loadItems) {
1590
+ return async ({ siteId, source }) => {
1591
+ const cacheKey = `${source}:${siteId}`;
1592
+ const cached = siteOptionItemsCache.get(cacheKey);
1593
+ if (cached) return cached;
1594
+ const promise = (async () => {
1595
+ try {
1596
+ return await loadItems({
1597
+ siteId,
1598
+ source
1599
+ });
1600
+ } catch (error) {
1601
+ siteOptionItemsCache.delete(cacheKey);
1602
+ throw error;
1603
+ }
1604
+ })();
1605
+ setBoundedCache(siteOptionItemsCache, cacheKey, promise);
1606
+ return promise;
1607
+ };
1608
+ }
1609
+ function createPreviewSiteOptionAdapters(previewClient) {
1610
+ return createSiteOptionWidgetAdapters({ loadItems: createCachedSiteOptionLoader(createSiteOptionApiLoader(previewClient)) });
1611
+ }
1612
+ /**
1613
+ * Per-kind UI chrome for preview reference adapters. The `Record<BuiltInReferenceKind, …>`
1614
+ * type enforces parity with `BUILT_IN_REFERENCE_KINDS` at compile time — adding a new
1615
+ * kind fails to compile here until chrome is provided.
1616
+ */
1617
+ const previewReferenceChrome = {
1618
+ post: { labels: {
1619
+ loading: "Loading posts…",
1620
+ select: "Select a post",
1621
+ empty: "No posts found",
1622
+ emptySelection: "Select a post to continue."
1623
+ } },
1624
+ form: { labels: {
1625
+ loading: "Loading forms…",
1626
+ select: "Select a form",
1627
+ empty: "No forms found",
1628
+ emptySelection: "Select a form to continue."
1629
+ } },
1630
+ bookingForm: { labels: {
1631
+ loading: "Loading booking forms…",
1632
+ select: "Select a booking form",
1633
+ empty: "No booking forms yet",
1634
+ emptySelection: "Select a booking form to enable appointment booking."
1635
+ } },
1636
+ appointmentService: { labels: {
1637
+ loading: "Loading appointment services…",
1638
+ select: "Select a service",
1639
+ empty: "No services available",
1640
+ emptySelection: "Select a service to enable booking."
1641
+ } },
1642
+ appointmentResource: { labels: {
1643
+ loading: "Loading resources…",
1644
+ select: "Select a resource",
1645
+ empty: "No resources available",
1646
+ emptySelection: "Select a resource (optional)."
1647
+ } },
1648
+ page: { labels: {
1649
+ loading: "Loading pages…",
1650
+ select: "Select a page",
1651
+ empty: "No pages available",
1652
+ emptySelection: "Select a page."
1653
+ } },
1654
+ newsletterList: { labels: {
1655
+ loading: "Loading lists…",
1656
+ select: "Select a list",
1657
+ empty: "No lists yet",
1658
+ emptySelection: "Select a newsletter list to subscribe users to."
1659
+ } },
1660
+ mailchimpAudience: { labels: {
1661
+ loading: "Loading Mailchimp audiences…",
1662
+ select: "Select an audience",
1663
+ empty: "Connect Mailchimp to choose an audience",
1664
+ emptySelection: "Choose a Mailchimp audience once the site is connected."
1665
+ } }
1666
+ };
1667
+ /**
1668
+ * Builds the preview adapter record by iterating the canonical `referenceLoaders`
1669
+ * map. The kind ↔ loader pairing is structurally impossible to mis-couple — each
1670
+ * adapter is constructed by looking the loader up via the same `BuiltInReferenceKind`
1671
+ * key used to index into the chrome map.
1672
+ */
1673
+ function createPreviewReferenceAdapters(previewClient, fallbackSiteId) {
1674
+ const brandedFallbackSiteId = fallbackSiteId ? expectParsedBrandedId(parseSiteId(fallbackSiteId)) : void 0;
1675
+ const adapters = {};
1676
+ for (const kind of BUILT_IN_REFERENCE_KINDS) adapters[kind] = {
1677
+ loadItems: createCachedReferenceAdapterLoader(kind, referenceLoaders[kind], previewClient, brandedFallbackSiteId),
1678
+ labels: previewReferenceChrome[kind].labels
1679
+ };
1680
+ return createDynamicReferenceAdapters(adapters, (contentTypeKey) => createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, brandedFallbackSiteId));
1681
+ }
1682
+ /** The same content-type select as the dashboard, using the authenticated preview transport. */
1683
+ function createPreviewContentTypeAdapter(apiClient) {
1684
+ return { loadContentTypes: async ({ siteId }) => {
1685
+ return unwrapResponse(await apiClient({
1686
+ endpoint: "listContentTypes",
1687
+ params: { siteId }
1688
+ })).contentTypes.map((content) => ({
1689
+ key: content.key,
1690
+ name: content.name,
1691
+ description: content.description ?? void 0,
1692
+ hasPages: content.hasPages ?? false
1693
+ }));
1694
+ } };
1695
+ }
1696
+ //#endregion
1697
+ //#region ../preview-next/src/client/widgets/widgetOverrides.tsx
1698
+ function PreviewFormProviderInner({ theme, children }) {
1699
+ const { onPickImage, picker } = useRichTextImagePicker();
1700
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RichTextWidgetProvider, {
1701
+ surface: "preview-sidebar",
1702
+ theme,
1703
+ onPickImage,
1704
+ children
1705
+ }), picker] });
1706
+ }
1707
+ /**
1708
+ * Composes preview form widget providers beneath PreviewShell's media authority.
1709
+ * Consumers rendering this directly must provide an ancestor MediaEditorProvider.
1710
+ */
1711
+ function PreviewFormProvider({ siteId: rawSiteId, theme = null, previewClient, bookingOfferingPresets, sdkConfig, children }) {
1712
+ const siteId = useMemo(() => expectParsedBrandedId(parseSiteId(rawSiteId)), [rawSiteId]);
1713
+ const locationHost = useOptionalLocationPickerEnvironment();
1714
+ const locationClient = locationHost?.siteId === siteId ? locationHost.apiClient : previewClient;
1715
+ const linkAdapters = useMemo(() => createPreviewLinkAdapters(previewClient), [previewClient]);
1716
+ const contentTypeAdapter = useMemo(() => createPreviewContentTypeAdapter(previewClient), [previewClient]);
1717
+ const entryPickerAdapter = useMemo(() => createPreviewEntryPickerAdapter(previewClient), [previewClient]);
1718
+ const siteOptionAdapters = useMemo(() => createPreviewSiteOptionAdapters(previewClient), [previewClient]);
1719
+ const referenceAdapters = useMemo(() => createPreviewReferenceAdapters(previewClient), [previewClient]);
1720
+ const paletteTokens = useMemo(() => {
1721
+ if (!theme) return void 0;
1722
+ try {
1723
+ return buildThemeRuntime(theme).paletteTokens;
1724
+ } catch {
1725
+ return;
1726
+ }
1727
+ }, [theme]);
1728
+ return /* @__PURE__ */ jsx(LocationPickerEnvironmentProvider, {
1729
+ siteId,
1730
+ apiClient: locationClient,
1731
+ children: /* @__PURE__ */ jsx(ContentTypeWidgetProvider, {
1732
+ siteId,
1733
+ adapter: contentTypeAdapter,
1734
+ children: /* @__PURE__ */ jsx(SdkConfigProvider, {
1735
+ sdkConfig: sdkConfig ?? null,
1736
+ children: /* @__PURE__ */ jsx(PaletteProvider, {
1737
+ tokens: paletteTokens,
1738
+ children: /* @__PURE__ */ jsx(LinkWidgetProvider, {
1739
+ siteId,
1740
+ adapters: linkAdapters,
1741
+ children: /* @__PURE__ */ jsx(ReferenceWidgetProvider, {
1742
+ siteId,
1743
+ adapters: referenceAdapters,
1744
+ children: /* @__PURE__ */ jsx(EntryPickerWidgetProvider, {
1745
+ siteId,
1746
+ adapter: entryPickerAdapter,
1747
+ children: /* @__PURE__ */ jsx(SiteOptionWidgetProvider, {
1748
+ siteId,
1749
+ adapters: siteOptionAdapters,
1750
+ children: /* @__PURE__ */ jsx(MailingListTargetingProvider, {
1751
+ siteId,
1752
+ load: (targetSiteId) => loadMailingListAuthoringContext({
1753
+ apiClient: previewClient,
1754
+ siteId: targetSiteId
1755
+ }),
1756
+ children: /* @__PURE__ */ jsx(ButtonWidgetProvider, {
1757
+ buttonSystem: theme?.buttons ?? null,
1758
+ children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
1759
+ bookingOfferingPresets,
1760
+ children: /* @__PURE__ */ jsx(PreviewFormProviderInner, {
1761
+ theme,
1762
+ children
1763
+ })
1764
+ })
1765
+ })
1766
+ })
1767
+ })
1768
+ })
1769
+ })
1770
+ })
1771
+ })
1772
+ })
1773
+ })
1774
+ });
1775
+ }
1776
+ const previewWidgetOverrides = {
1777
+ ...locationWidgetOverrides,
1778
+ contentTypeSelect: ContentTypeSelectField,
1779
+ link: LinkField,
1780
+ file: FileField,
1781
+ media: MediaField,
1782
+ richText: RichTextField,
1783
+ inlineText: InlineTextField,
1784
+ reference: ReferenceField,
1785
+ backgroundColor: BackgroundColorField,
1786
+ backgroundGradient: BackgroundGradientField,
1787
+ entryPicker: EntryPickerField,
1788
+ iconPicker: IconPickerField,
1789
+ buttonVariant: ButtonVariantField,
1790
+ offeringGroupOrder: OfferingsPreviewGroupOrderField,
1791
+ siteOptionPicker: SiteOptionPickerField,
1792
+ mailingListTargeting: MailingListTargetingField
1793
+ };
1794
+ //#endregion
883
1795
  //#region ../preview-next/src/client/preview/PreviewZoomControls.tsx
884
1796
  function PreviewZoomControls({ zoom, onZoomChange, disabled }) {
885
1797
  return /* @__PURE__ */ jsxs(Select, {
@@ -1614,9 +2526,272 @@ function usePreviewDesignOpenRequest() {
1614
2526
  return useContext(PreviewDesignOpenRequestContext);
1615
2527
  }
1616
2528
  //#endregion
2529
+ //#region ../preview-next/src/client/preview/SelectedBlockBackgroundControls.tsx
2530
+ function SelectedBlockBackgroundControls(props) {
2531
+ const controller = useBackgroundSection(props);
2532
+ if (!controller) return null;
2533
+ const { current, pool, capability, context, open, setOpen, choose, transition } = controller;
2534
+ return /* @__PURE__ */ jsx(CustomizeBackgroundControlRows, {
2535
+ modeLabel: backgroundModeLabel(current.kind),
2536
+ valueLabel: backgroundValueLabel(current, pool),
2537
+ valueAriaLabel: "Choose background",
2538
+ swatch: /* @__PURE__ */ jsx(BackgroundPreviewSwatch, {
2539
+ override: current,
2540
+ imagePool: pool
2541
+ }),
2542
+ chooserOpen: open,
2543
+ canCycleMode: enabledBackgroundModes(capability).length > 1,
2544
+ canCycleValue: canCycleBackgroundOverrideValue(current, capability),
2545
+ onCycleMode: (direction) => transition({
2546
+ kind: "cycle-mode",
2547
+ direction
2548
+ }),
2549
+ onCycleValue: (direction) => transition({
2550
+ kind: "cycle-value",
2551
+ direction
2552
+ }),
2553
+ onToggleChooser: () => setOpen((value) => !value),
2554
+ chooser: /* @__PURE__ */ jsx(BackgroundChooser, {
2555
+ editingSlot: `${props.block.blockId}:_sectionStyles.background.image`,
2556
+ capability,
2557
+ current,
2558
+ imagePoolStatus: context.backgroundImagePoolStatus ?? "idle",
2559
+ onChoose: choose
2560
+ })
2561
+ });
2562
+ }
2563
+ function useBackgroundSection({ block, content }) {
2564
+ const context = usePreviewPageDesignEditorState();
2565
+ const [open, setOpen] = useState(false);
2566
+ const current = parseBackgroundOverrideFromContent(content);
2567
+ const pool = mergedImagePool(current.kind === "supported" ? imagePoolForOverride(current.override) : [], context.backgroundImagePool ?? []);
2568
+ const capability = resolveBackgroundCapability({
2569
+ block,
2570
+ imagePool: pool,
2571
+ palette: readBackgroundColorPaletteSnapshot()
2572
+ });
2573
+ useLoadBackgroundImages(capability?.modes.includes("image") ?? false, context);
2574
+ if (current.kind !== "supported" || !capability || !enabledBackgroundModes(capability).length) return null;
2575
+ const choose = (override, options) => {
2576
+ const action = setPageDesignBlockBackground({
2577
+ block,
2578
+ override,
2579
+ currentContent: content,
2580
+ imagePool: pool,
2581
+ selectedImage: options?.selectedImage
2582
+ });
2583
+ if (action) context.applyAction(action, { runtimeContent: content });
2584
+ setOpen(false);
2585
+ };
2586
+ const transition = (action) => {
2587
+ const plan = planBackgroundTransition(current.override, capability, action);
2588
+ if (plan.kind === "apply") choose(plan.override);
2589
+ };
2590
+ return {
2591
+ current: current.override,
2592
+ pool,
2593
+ capability,
2594
+ context,
2595
+ open,
2596
+ setOpen,
2597
+ choose,
2598
+ transition
2599
+ };
2600
+ }
2601
+ function mergedImagePool(current, pool) {
2602
+ return rankBackgroundImagePoolItems([...new Map([...current, ...pool].map((item) => [item.reference.identifier, item])).values()]);
2603
+ }
2604
+ function backgroundModeLabel(mode) {
2605
+ return {
2606
+ default: "Set by your site style",
2607
+ color: "Colour",
2608
+ gradient: "Gradient",
2609
+ image: "Photo"
2610
+ }[mode];
2611
+ }
2612
+ function backgroundValueLabel(override, pool) {
2613
+ switch (override.kind) {
2614
+ case "default": return "Your site style’s colour";
2615
+ case "color": return formatTokenLabel(override.token);
2616
+ case "gradient": return gradientLabel(override.gradientId);
2617
+ case "image": return pool.find((item) => item.reference.identifier === override.reference.identifier)?.label ?? "Image";
2618
+ }
2619
+ }
2620
+ function useLoadBackgroundImages(supportsImages, context) {
2621
+ useEffect(() => {
2622
+ if (supportsImages && context.backgroundImagePoolStatus === "idle") context.loadBackgroundImagePool?.();
2623
+ }, [
2624
+ supportsImages,
2625
+ context.backgroundImagePoolStatus,
2626
+ context.loadBackgroundImagePool
2627
+ ]);
2628
+ }
2629
+ //#endregion
2630
+ //#region ../preview-next/src/client/preview/SelectedBlockLookControls.tsx
2631
+ function SelectedBlockLookControls(props) {
2632
+ const { toolbar, chooseLook, historyFailure } = useLookSectionActions(props);
2633
+ if (!props.designBlock) return null;
2634
+ return /* @__PURE__ */ jsxs("div", {
2635
+ className: "space-y-4",
2636
+ children: [
2637
+ historyFailure ? /* @__PURE__ */ jsx("p", {
2638
+ role: "alert",
2639
+ className: "text-xs text-red-700",
2640
+ children: historyFailure
2641
+ }) : null,
2642
+ /* @__PURE__ */ jsx(BlockLookChoices, {
2643
+ block: props.designBlock,
2644
+ arrangement: toolbar?.controls,
2645
+ onChoose: chooseLook
2646
+ }),
2647
+ toolbar ? /* @__PURE__ */ jsx(ArrangementLookNote, {
2648
+ look: toolbar.controls.look,
2649
+ styleName: toolbar.styleName
2650
+ }) : null,
2651
+ toolbar ? /* @__PURE__ */ jsx(ArrangementOptionsBody, {
2652
+ controls: toolbar.controls,
2653
+ styleName: toolbar.styleName,
2654
+ background: toolbar.background,
2655
+ onChooseKnob: toolbar.chooseKnob,
2656
+ onChooseSurface: toolbar.chooseSurface,
2657
+ onEditHeadline: toolbar.editHeadline
2658
+ }) : /* @__PURE__ */ jsx(SelectedBlockBackgroundControls, {
2659
+ block: props.designBlock,
2660
+ content: props.content
2661
+ })
2662
+ ]
2663
+ });
2664
+ }
2665
+ function useLookSectionActions({ blockId, content, designBlock }) {
2666
+ const { state, applyAction, historyFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
2667
+ const uiStore = useEditorUiStoreInstance();
2668
+ const save = (action) => {
2669
+ applyAction(action, { runtimeContent: content });
2670
+ };
2671
+ const toolbar = useArrangementToolbar({
2672
+ designBlock,
2673
+ content,
2674
+ pageDesignState: state,
2675
+ selected: true,
2676
+ save,
2677
+ chooseBackground: (override) => {
2678
+ if (!designBlock) return;
2679
+ const action = setPageDesignBlockBackground({
2680
+ block: designBlock,
2681
+ override,
2682
+ currentContent: content,
2683
+ imagePool: backgroundImagePool
2684
+ });
2685
+ if (action) save(action);
2686
+ },
2687
+ openField: (fieldPath) => uiStore.getState().requestFocus({
2688
+ kind: "main-field",
2689
+ blockId,
2690
+ fieldPath: `content.${fieldPath}`
2691
+ })
2692
+ });
2693
+ const chooseLook = (appearancePresetId) => {
2694
+ if (designBlock) save({
2695
+ kind: "set-look",
2696
+ blockId: designBlock.blockId,
2697
+ appearancePresetId
2698
+ });
2699
+ };
2700
+ return {
2701
+ toolbar,
2702
+ chooseLook,
2703
+ historyFailure
2704
+ };
2705
+ }
2706
+ function BlockLookChoices({ block, arrangement, onChoose }) {
2707
+ const [changing, setChanging] = useState(false);
2708
+ const tiles = arrangement?.tiles ?? pageDesignLookTiles(block);
2709
+ if (!tiles.length) return null;
2710
+ const choose = (id) => {
2711
+ onChoose(id);
2712
+ setChanging(false);
2713
+ };
2714
+ return /* @__PURE__ */ jsxs("div", {
2715
+ className: "space-y-2",
2716
+ children: [/* @__PURE__ */ jsx(BlockLookCard, {
2717
+ card: lookCardFor(tiles, arrangement?.look ?? null),
2718
+ changing,
2719
+ onChange: () => setChanging((value) => !value)
2720
+ }), changing ? /* @__PURE__ */ jsx(BlockLookTiles, {
2721
+ tiles,
2722
+ onChoose: choose
2723
+ }) : null]
2724
+ });
2725
+ }
2726
+ /** What the Look card says, read from the same tiles the chooser lists. */
2727
+ function lookCardFor(tiles, look) {
2728
+ return {
2729
+ name: look?.lookName ?? selectedLookTile(tiles)?.label ?? "Default",
2730
+ automatic: look ? lookIsAutomatic(look) : false,
2731
+ position: lookTilePosition(tiles),
2732
+ canChange: tiles.length > 1
2733
+ };
2734
+ }
2735
+ function BlockLookCard({ card, changing, onChange }) {
2736
+ return /* @__PURE__ */ jsxs("div", {
2737
+ className: "flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5",
2738
+ children: [/* @__PURE__ */ jsxs("div", {
2739
+ className: "min-w-0 flex-1",
2740
+ children: [/* @__PURE__ */ jsxs("div", {
2741
+ className: "truncate text-sm font-semibold leading-5 text-foreground",
2742
+ children: [card.automatic ? "Default · " : "", card.name]
2743
+ }), card.position ? /* @__PURE__ */ jsxs("div", {
2744
+ className: "text-xs leading-4 text-muted-foreground",
2745
+ children: [card.position, " Looks"]
2746
+ }) : null]
2747
+ }), card.canChange ? /* @__PURE__ */ jsx("button", {
2748
+ type: "button",
2749
+ "aria-expanded": changing,
2750
+ className: lookChangeButtonClass,
2751
+ onClick: onChange,
2752
+ children: "Change"
2753
+ }) : null]
2754
+ });
2755
+ }
2756
+ function BlockLookTiles({ tiles, onChoose }) {
2757
+ return /* @__PURE__ */ jsx("div", {
2758
+ className: "grid grid-cols-2 gap-1.5",
2759
+ role: "group",
2760
+ "aria-label": "Looks",
2761
+ children: tiles.map((tile) => /* @__PURE__ */ jsx(LookTileButton, {
2762
+ tile,
2763
+ onChoose
2764
+ }, tile.key))
2765
+ });
2766
+ }
2767
+ /** The badge is a description, so the tile is still named for its Look alone. */
2768
+ function LookTileButton({ tile, onChoose }) {
2769
+ const badged = tile.isDefault && tile.key !== "style-default";
2770
+ return /* @__PURE__ */ jsxs("button", {
2771
+ type: "button",
2772
+ "aria-pressed": tile.selected,
2773
+ "aria-description": badged ? "Default" : void 0,
2774
+ className: lookTileClass(tile.selected),
2775
+ onClick: () => onChoose(tile.pin),
2776
+ children: [/* @__PURE__ */ jsx("span", {
2777
+ className: "min-w-0 flex-1",
2778
+ children: tile.label
2779
+ }), badged ? /* @__PURE__ */ jsx("span", {
2780
+ "aria-hidden": "true",
2781
+ className: lookDefaultBadgeClass,
2782
+ children: "Default"
2783
+ }) : null]
2784
+ });
2785
+ }
2786
+ const lookChangeButtonClass = "shrink-0 rounded-full border border-border bg-background px-3 py-1 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
2787
+ const lookDefaultBadgeClass = "shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-semibold leading-3 text-muted-foreground";
2788
+ function lookTileClass(selected) {
2789
+ return ["flex min-h-10 items-center gap-1.5 rounded-md border px-2.5 py-2 text-left text-xs font-medium leading-4 text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", selected ? "border-foreground ring-1 ring-foreground" : "border-border bg-background hover:bg-muted"].join(" ");
2790
+ }
2791
+ //#endregion
1617
2792
  //#region ../preview-next/src/client/preview/SelectedBlockCustomizePanel.tsx
1618
2793
  const EMPTY_BLOCK_VALUES = {};
1619
- function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme, sdkConfig }) {
2794
+ function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme, sdkConfig, dashboardBaseUrl }) {
1620
2795
  const customizeSelection = usePreviewBlockCustomizeSelectionOptional();
1621
2796
  const selection = customizeSelection?.selection ?? { kind: "none" };
1622
2797
  if (selection.kind === "none") return /* @__PURE__ */ jsx("div", {
@@ -1638,72 +2813,51 @@ function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme,
1638
2813
  blockId: selection.blockId,
1639
2814
  uiStoreForBlockEditor,
1640
2815
  theme,
1641
- sdkConfig
2816
+ sdkConfig,
2817
+ dashboardBaseUrl
1642
2818
  });
1643
2819
  }
1644
- function SelectedBlockCustomizeFields({ block, blockId, uiStoreForBlockEditor, theme, sdkConfig }) {
2820
+ function SelectedBlockCustomizeFields({ block, blockId, uiStoreForBlockEditor, theme, sdkConfig, dashboardBaseUrl }) {
2821
+ const { siteId } = usePreviewAuth();
1645
2822
  const blockContent = useBlockCurrentValues(uiStoreForBlockEditor, blockId, block.content ?? EMPTY_BLOCK_VALUES);
1646
- const { backend, manifest, panelFields, quickFields } = useBlockCustomizeControls({
2823
+ const customizeControls = useBlockCustomizeControls({
1647
2824
  blockId,
1648
2825
  blockKind: block.kind,
1649
2826
  content: blockContent,
1650
2827
  uiStore: uiStoreForBlockEditor,
1651
2828
  theme,
1652
- sdkConfig,
1653
- maxQuickFields: 3
2829
+ sdkConfig
1654
2830
  });
2831
+ const { backend, manifest, fields, sectionPlan, designBlock } = customizeControls;
1655
2832
  if (!manifest || !backend) return /* @__PURE__ */ jsx("div", {
1656
2833
  className: "rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",
1657
2834
  children: "No customize controls are available for this section."
1658
2835
  });
1659
- if (quickFields.length === 0 && panelFields.length === 0) return /* @__PURE__ */ jsxs("div", {
1660
- className: "space-y-1 rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",
1661
- children: [/* @__PURE__ */ jsx("p", { children: "No safe customize controls are available for this section yet." }), /* @__PURE__ */ jsx("p", {
1662
- className: "text-xs",
1663
- children: "Content fields remain in Page Blocks."
1664
- })]
1665
- });
1666
2836
  return /* @__PURE__ */ jsxs("div", {
1667
2837
  className: "space-y-5",
1668
- children: [
1669
- /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1670
- className: "text-sm font-semibold",
1671
- children: manifest.title
1672
- }), /* @__PURE__ */ jsx("div", {
1673
- className: "text-xs text-muted-foreground",
1674
- children: formatBlockKindLabel(block.kind)
1675
- })] }),
1676
- quickFields.length > 0 ? /* @__PURE__ */ jsxs("section", {
1677
- className: "space-y-3",
1678
- children: [/* @__PURE__ */ jsx("div", {
1679
- className: "text-xs font-medium uppercase text-muted-foreground",
1680
- children: "Quick controls"
1681
- }), /* @__PURE__ */ jsx(FormRenderer, {
1682
- dateContext: civilPickerDisplay.dateContext,
1683
- fields: quickFields,
1684
- backend,
1685
- widgetOverrides: previewWidgetOverrides,
1686
- showSettingsTrigger: false,
1687
- blockKind: block.kind,
1688
- className: "space-y-4"
1689
- })]
1690
- }) : null,
1691
- panelFields.length > 0 ? /* @__PURE__ */ jsxs("section", {
1692
- className: "space-y-3",
1693
- children: [/* @__PURE__ */ jsx("div", {
1694
- className: "text-xs font-medium uppercase text-muted-foreground",
1695
- children: "More controls"
1696
- }), /* @__PURE__ */ jsx(FormRenderer, {
1697
- dateContext: civilPickerDisplay.dateContext,
1698
- fields: panelFields,
1699
- backend,
1700
- widgetOverrides: previewWidgetOverrides,
1701
- showSettingsTrigger: false,
1702
- blockKind: block.kind,
1703
- className: "space-y-4"
1704
- })]
1705
- }) : null
1706
- ]
2838
+ children: [/* @__PURE__ */ jsx("div", {
2839
+ className: "text-sm font-semibold",
2840
+ children: manifest.title
2841
+ }), /* @__PURE__ */ jsx(FormRenderer, {
2842
+ dateContext: civilPickerDisplay.dateContext,
2843
+ fields,
2844
+ backend,
2845
+ sectionPlan,
2846
+ widgetOverrides: previewWidgetOverrides,
2847
+ blockKind: block.kind,
2848
+ lookContent: customizeControls.lookSource.kind === "sdk" || !designBlock ? void 0 : /* @__PURE__ */ jsx(SelectedBlockLookControls, {
2849
+ blockId,
2850
+ blockKind: block.kind,
2851
+ content: blockContent,
2852
+ designBlock
2853
+ }),
2854
+ sourceLine: manifest.sourceLine ? /* @__PURE__ */ jsx(BlockSourceLine, {
2855
+ source: manifest.sourceLine,
2856
+ getValue: backend.getValue,
2857
+ siteId: siteId ?? "",
2858
+ dashboardBaseUrl: dashboardBaseUrl ?? ""
2859
+ }) : void 0
2860
+ })]
1707
2861
  });
1708
2862
  }
1709
2863
  function useBlockCurrentValues(store, blockId, fallback) {
@@ -1712,9 +2866,6 @@ function useBlockCurrentValues(store, blockId, fallback) {
1712
2866
  function readBlockCurrentValues(store, blockId, fallback) {
1713
2867
  return store.getState().drafts.getCurrentValues(blockId) ?? fallback;
1714
2868
  }
1715
- function formatBlockKindLabel(blockKind) {
1716
- return blockKind.replace(/^block\./, "").replace(/^custom\./, "").replace(/[-_]+/g, " ");
1717
- }
1718
2869
  //#endregion
1719
2870
  //#region ../preview-next/src/client/preview/PageBlockEditorPanel.tsx
1720
2871
  function usePageBlockEditorPanelControls(uiStoreForBlockEditor) {
@@ -1771,10 +2922,7 @@ function useBlockCustomizeNavigation() {
1771
2922
  onSelect: handleCustomizeBlock,
1772
2923
  onAfterMenuClose: handleCustomizeMenuClose
1773
2924
  }
1774
- } : {
1775
- kind: "menu",
1776
- customize: { kind: "modal" }
1777
- }, [
2925
+ } : { kind: "menu" }, [
1778
2926
  customizeSelection,
1779
2927
  handleCustomizeBlock,
1780
2928
  handleCustomizeMenuClose
@@ -1835,6 +2983,7 @@ function PageBlockEditorPanel(props) {
1835
2983
  hidden: takeover,
1836
2984
  sectionRef: controls.customizeSectionRef,
1837
2985
  children: /* @__PURE__ */ jsx(SelectedBlockCustomizePanel, {
2986
+ dashboardBaseUrl: props.dashboardBaseUrl,
1838
2987
  blockItems: props.blockItems,
1839
2988
  uiStoreForBlockEditor: props.uiStoreForBlockEditor,
1840
2989
  theme: props.theme ?? null,
@@ -3930,6 +5079,8 @@ const PALETTE_SURFACE_ROLES = [
3930
5079
  }
3931
5080
  ];
3932
5081
  function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVersion = null, selectionUpdatedAt, initialSelections, buttonStyleRepairs, headerLogoContext, onFocusedSurfaceChange }) {
5082
+ const journal = useOptionalSessionJournal();
5083
+ const authoringAllowed = usePreviewAuthoringAdmission();
3933
5084
  const designOpenRequest = usePreviewDesignOpenRequest();
3934
5085
  const router = useRouter();
3935
5086
  const previewDesign = usePreviewDesignCoordinator();
@@ -4125,39 +5276,54 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
4125
5276
  setState((current) => current ? dismissWarnings(current) : current);
4126
5277
  }, []);
4127
5278
  const applySelection = useCallback(async (live, restage) => {
4128
- if (footerPreferences === null || !live || !isPreviewingChange(live)) return;
5279
+ if (!authoringAllowed() || footerPreferences === null || !live || !isPreviewingChange(live)) return;
4129
5280
  if (!deriveStyleConfiguratorCapabilities(live).canApplyStaged) return;
4130
5281
  const previewed = live.previewed;
4131
5282
  if (!getCuratedSiteStyle(previewed.siteStyleId)) return;
5283
+ const reservation = acceptStyleSelection(journal, {
5284
+ siteId,
5285
+ selectionId: selectionId ?? null,
5286
+ before: live.base,
5287
+ after: previewed
5288
+ });
5289
+ if (reservation?.kind === "busy") return;
4132
5290
  await runnerRef.current.run({
4133
5291
  optimistic: () => {
4134
5292
  applyStarted("style-configurator");
4135
5293
  setState((current) => current ? markApplySaving(current) : current);
4136
5294
  },
4137
5295
  network: async () => {
4138
- const body = buildApplySiteStyleSelectionBody({
4139
- base: live.base,
4140
- previewed,
4141
- selectionId
5296
+ const saved = await persistStyleSelection(apiClient, siteId, selectionId, live, authoringAllowed).catch((error) => {
5297
+ reservation?.refuse("reconcile");
5298
+ throw error;
4142
5299
  });
4143
- if (!body.ok) throw new StyleApplyPlanError(paletteApplyPlanErrorMessage(body.error));
4144
- return unwrapResponse(await apiClient({
4145
- endpoint: "applySiteStyleSelection",
4146
- params: { siteId },
4147
- body: body.body
4148
- }));
5300
+ if (saved.journal) reservation?.settle({
5301
+ revisionKind: "counter",
5302
+ expectedRevision: saved.journal.expectedRevision,
5303
+ revision: saved.journal.revision,
5304
+ change: {
5305
+ kind: "theme-selection",
5306
+ siteId,
5307
+ selectionId: saved.journal.selectionId,
5308
+ before: saved.journal.before,
5309
+ after: saved.journal.after
5310
+ }
5311
+ });
5312
+ else reservation?.refuse("reconcile");
5313
+ return saved;
4149
5314
  },
4150
5315
  onSuccess: (saved) => {
4151
5316
  const persisted = selectionSnapshotFromApplySiteStyleSelectionResponse(saved, previewed);
4152
5317
  const historyEntry = styleConfiguratorHistoryEntryForPersistedSelection(live, persisted);
4153
5318
  setState((current) => current ? restageSelectionChanges(markApplySaved(current, persisted), restage?.staged ?? {}) : current);
4154
- if (historyEntry) siteStyleHistory?.recordAppliedSelection(historyEntry);
5319
+ if (historyEntry && !journal) siteStyleHistory?.recordAppliedSelection(historyEntry);
4155
5320
  applySucceeded("style-configurator");
4156
5321
  startRefreshTransition(() => {
4157
5322
  router.refresh();
4158
5323
  });
4159
5324
  },
4160
5325
  onError: (error) => {
5326
+ reservation?.refuse("reconcile");
4161
5327
  applyFailed("style-configurator");
4162
5328
  const applyError = classifyStyleApplyError(error);
4163
5329
  if (applyError.kind === "stale") startRefreshTransition(() => {
@@ -4168,6 +5334,8 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
4168
5334
  }
4169
5335
  });
4170
5336
  }, [
5337
+ authoringAllowed,
5338
+ journal,
4171
5339
  footerPreferences,
4172
5340
  apiClient,
4173
5341
  applyFailed,
@@ -4712,12 +5880,23 @@ function withResolvedSiteStyleSelections(input) {
4712
5880
  warnings: result.warnings
4713
5881
  });
4714
5882
  }
5883
+ async function persistStyleSelection(apiClient, siteId, selectionId, live, admitted) {
5884
+ if (!admitted()) throw new Error("Editor admission closed before the style save");
5885
+ const body = buildApplySiteStyleSelectionBody({
5886
+ base: live.base,
5887
+ previewed: live.previewed,
5888
+ selectionId
5889
+ });
5890
+ if (!body.ok) throw new StyleApplyPlanError(paletteApplyPlanErrorMessage(body.error));
5891
+ return unwrapResponse(await apiClient({
5892
+ endpoint: "applySiteStyleSelection",
5893
+ params: { siteId },
5894
+ body: body.body
5895
+ }));
5896
+ }
4715
5897
  //#endregion
4716
5898
  //#region ../preview-next/src/client/preview/PreviewEditorSidebar.tsx
4717
- function assistantTabAvailable(input) {
4718
- return input.enabled && Boolean(input.pageId && input.bearerToken && input.canEdit);
4719
- }
4720
- function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, bearerToken, entrySubrouteContext, assistantPanel, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, activeTab, onTabChange, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
5899
+ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, entrySubrouteContext, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
4721
5900
  const controller = useEntryController();
4722
5901
  const controllerBlocks = controller.blocks;
4723
5902
  const uiStore = useEditorUiStoreInstance();
@@ -4742,14 +5921,6 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
4742
5921
  dashboardSetupHandoff,
4743
5922
  surfaceId
4744
5923
  ]);
4745
- const showAssistantTab = Boolean(assistantPanel);
4746
- const assistantAvailable = assistantTabAvailable({
4747
- enabled: showAssistantTab,
4748
- pageId,
4749
- bearerToken,
4750
- canEdit
4751
- });
4752
- const effectiveActiveTab = showAssistantTab ? resolvePreviewSidebarTab(activeTab) : "editor";
4753
5924
  const blockItems = useMemo(() => controllerBlocks.list, [controllerBlocks.list]);
4754
5925
  const blockEditorRef = useRef(null);
4755
5926
  const contentFormWidgets = useMemo(() => previewWidgetOverrides, []);
@@ -4878,29 +6049,21 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
4878
6049
  })
4879
6050
  })
4880
6051
  });
4881
- const assistantPanelDisplay = assistantAvailable ? assistantPanel : /* @__PURE__ */ jsx("div", {
4882
- className: "flex h-full flex-col items-center justify-center p-6 text-center text-sm text-muted-foreground",
4883
- children: "AI Assistant is available for pages in preview mode."
4884
- });
4885
6052
  return /* @__PURE__ */ jsx("div", {
4886
6053
  className: `flex h-full min-h-0 flex-col overflow-hidden pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))] ${sidebarChrome.rootClassName}`,
4887
6054
  "data-preview-sidebar-tone": sidebarChrome.tone,
4888
6055
  children: /* @__PURE__ */ jsxs(Tabs, {
4889
- value: effectiveActiveTab,
4890
- onValueChange: (value) => onTabChange(resolvePreviewSidebarTab(value)),
6056
+ value: "editor",
4891
6057
  className: "flex h-full min-h-0 flex-col overflow-hidden",
4892
6058
  children: [
4893
6059
  /* @__PURE__ */ jsxs("div", {
4894
6060
  className: `shrink-0 flex items-center justify-between px-4 py-3 ${sidebarChrome.headerClassName}`,
4895
- children: [/* @__PURE__ */ jsxs(TabsList, {
6061
+ children: [/* @__PURE__ */ jsx(TabsList, {
4896
6062
  className: "h-8",
4897
- children: [/* @__PURE__ */ jsx(TabsTrigger, {
6063
+ children: /* @__PURE__ */ jsx(TabsTrigger, {
4898
6064
  value: "editor",
4899
6065
  children: "Editor"
4900
- }), showAssistantTab ? /* @__PURE__ */ jsx(TabsTrigger, {
4901
- value: "assistant",
4902
- children: "AI Assistant"
4903
- }) : null]
6066
+ })
4904
6067
  }), /* @__PURE__ */ jsx(Button, {
4905
6068
  variant: "ghost",
4906
6069
  size: "icon",
@@ -4923,15 +6086,9 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
4923
6086
  /* @__PURE__ */ jsx(TabsContent, {
4924
6087
  value: "editor",
4925
6088
  forceMount: true,
4926
- className: "mt-0 min-h-0 flex-1 overflow-hidden data-[state=inactive]:hidden",
6089
+ className: "mt-0 min-h-0 flex-1 overflow-hidden",
4927
6090
  children: editorPanel
4928
- }),
4929
- showAssistantTab ? /* @__PURE__ */ jsx(TabsContent, {
4930
- value: "assistant",
4931
- forceMount: true,
4932
- className: "mt-0 min-h-0 flex-1 overflow-hidden data-[state=inactive]:hidden",
4933
- children: assistantPanelDisplay
4934
- }) : null
6091
+ })
4935
6092
  ]
4936
6093
  })
4937
6094
  });