@frontify/guideline-blocks-settings 3.0.2 → 3.0.4

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 (262) hide show
  1. package/dist/_virtual/_rolldown/runtime.es.js +17 -0
  2. package/dist/components/Attachments/AttachmentItem.es.js +116 -168
  3. package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
  4. package/dist/components/Attachments/Attachments.es.js +145 -137
  5. package/dist/components/Attachments/Attachments.es.js.map +1 -1
  6. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js +25 -28
  7. package/dist/components/Attachments/AttachmentsButtonTrigger.es.js.map +1 -1
  8. package/dist/components/BlockInjectButton/BlockInjectButton.es.js +114 -126
  9. package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
  10. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +53 -74
  11. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  12. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js +26 -31
  13. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButton.es.js.map +1 -1
  14. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js +22 -25
  15. package/dist/components/BlockItemWrapper/Toolbar/AttachmentsToolbarButton/AttachmentsToolbarButtonTrigger.es.js.map +1 -1
  16. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js +17 -28
  17. package/dist/components/BlockItemWrapper/Toolbar/BaseToolbarButton.es.js.map +1 -1
  18. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js +25 -35
  19. package/dist/components/BlockItemWrapper/Toolbar/DragHandleToolbarButton/DragHandleToolbarButton.es.js.map +1 -1
  20. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js +41 -34
  21. package/dist/components/BlockItemWrapper/Toolbar/FlyoutToolbarButton/FlyoutToolbarButton.es.js.map +1 -1
  22. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js +41 -36
  23. package/dist/components/BlockItemWrapper/Toolbar/MenuToolbarButton/MenuToolbarButton.es.js.map +1 -1
  24. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js +24 -33
  25. package/dist/components/BlockItemWrapper/Toolbar/Toolbar.es.js.map +1 -1
  26. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js +20 -11
  27. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButton/ToolbarButton.es.js.map +1 -1
  28. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js +18 -10
  29. package/dist/components/BlockItemWrapper/Toolbar/ToolbarButtonTooltip.es.js.map +1 -1
  30. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js +10 -12
  31. package/dist/components/BlockItemWrapper/Toolbar/ToolbarSegment.es.js.map +1 -1
  32. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js +13 -13
  33. package/dist/components/BlockItemWrapper/Toolbar/context/DragPreviewContext.es.js.map +1 -1
  34. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js +21 -19
  35. package/dist/components/BlockItemWrapper/Toolbar/context/MultiFlyoutContext.es.js.map +1 -1
  36. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js +18 -25
  37. package/dist/components/BlockItemWrapper/Toolbar/helpers.es.js.map +1 -1
  38. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js +18 -17
  39. package/dist/components/BlockItemWrapper/Toolbar/hooks/useMultiFlyoutState.es.js.map +1 -1
  40. package/dist/components/BlockItemWrapper/constants.es.js +6 -6
  41. package/dist/components/BlockItemWrapper/constants.es.js.map +1 -1
  42. package/dist/components/Link/LinkInput.es.js +63 -63
  43. package/dist/components/Link/LinkInput.es.js.map +1 -1
  44. package/dist/components/Link/LinkSelector/DocumentLink.es.js +46 -63
  45. package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +1 -1
  46. package/dist/components/Link/LinkSelector/DocumentLinks.es.js +50 -64
  47. package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +1 -1
  48. package/dist/components/Link/LinkSelector/LinkSelector2.es.js +77 -0
  49. package/dist/components/Link/LinkSelector/LinkSelector2.es.js.map +1 -0
  50. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +10 -6
  51. package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +1 -1
  52. package/dist/components/Link/LinkSelector/PageLink.es.js +53 -67
  53. package/dist/components/Link/LinkSelector/PageLink.es.js.map +1 -1
  54. package/dist/components/Link/LinkSelector/PageLinks.es.js +28 -37
  55. package/dist/components/Link/LinkSelector/PageLinks.es.js.map +1 -1
  56. package/dist/components/Link/LinkSelector/SectionLink.es.js +31 -24
  57. package/dist/components/Link/LinkSelector/SectionLink.es.js.map +1 -1
  58. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +6 -5
  59. package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +1 -1
  60. package/dist/components/Link/utils/getUrl.es.js +10 -12
  61. package/dist/components/Link/utils/getUrl.es.js.map +1 -1
  62. package/dist/components/Link/utils/relativeUrlRegex.es.js +6 -5
  63. package/dist/components/Link/utils/relativeUrlRegex.es.js.map +1 -1
  64. package/dist/components/Link/utils/url.es.js +21 -17
  65. package/dist/components/Link/utils/url.es.js.map +1 -1
  66. package/dist/components/RichTextEditor/RichTextEditor.es.js +61 -68
  67. package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
  68. package/dist/components/RichTextEditor/SerializedText.es.js +25 -22
  69. package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
  70. package/dist/components/RichTextEditor/constants.es.js +6 -5
  71. package/dist/components/RichTextEditor/constants.es.js.map +1 -1
  72. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js +30 -37
  73. package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
  74. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +31 -39
  75. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
  76. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js +12 -11
  77. package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/index.es.js.map +1 -1
  78. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js +19 -23
  79. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonButton.es.js.map +1 -1
  80. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js +24 -26
  81. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
  82. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js +46 -53
  83. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/CustomFloatingButton.es.js.map +1 -1
  84. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js +52 -54
  85. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/EditButtonModal/EditModal.es.js.map +1 -1
  86. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +68 -68
  87. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
  88. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +91 -103
  89. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
  90. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js +26 -32
  91. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/floatingButtonStore.es.js.map +1 -1
  92. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +47 -53
  93. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
  94. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js +12 -18
  95. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
  96. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js +21 -25
  97. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
  98. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +29 -37
  99. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
  100. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js +13 -17
  101. package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useVirtualFloatingButton.es.js.map +1 -1
  102. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js +56 -62
  103. package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
  104. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js +9 -12
  105. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
  106. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js +23 -24
  107. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/submitFloatingButton.es.js.map +1 -1
  108. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js +28 -33
  109. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
  110. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js +61 -80
  111. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
  112. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js +23 -23
  113. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
  114. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js +18 -18
  115. package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
  116. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js +13 -12
  117. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
  118. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js +9 -8
  119. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getButtonStyle.es.js.map +1 -1
  120. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js +11 -10
  121. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/getUrl.es.js.map +1 -1
  122. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js +85 -84
  123. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/styles.es.js.map +1 -1
  124. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js +13 -16
  125. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
  126. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js +13 -16
  127. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonEdit.es.js.map +1 -1
  128. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js +10 -13
  129. package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
  130. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js +45 -51
  131. package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
  132. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js +20 -22
  133. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/ColumnBreakPlugin.es.js.map +1 -1
  134. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js +12 -12
  135. package/dist/components/RichTextEditor/plugins/ColumnBreakPlugin/helpers.es.js.map +1 -1
  136. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js +48 -57
  137. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/CustomFloatingLink.es.js.map +1 -1
  138. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js +46 -48
  139. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/EditModal.es.js.map +1 -1
  140. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js +12 -8
  141. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertLinkModal.es.js.map +1 -1
  142. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js +62 -71
  143. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/InsertModal.es.js.map +1 -1
  144. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +76 -77
  145. package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
  146. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js +17 -21
  147. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
  148. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js +17 -10
  149. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/LinkMarkupElementNode.es.js.map +1 -1
  150. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js +11 -10
  151. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkMarkupElement/index.es.js.map +1 -1
  152. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js +22 -26
  153. package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkToolbarButton.es.js.map +1 -1
  154. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js +6 -5
  155. package/dist/components/RichTextEditor/plugins/LinkPlugin/id.es.js.map +1 -1
  156. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js +39 -40
  157. package/dist/components/RichTextEditor/plugins/LinkPlugin/index.es.js.map +1 -1
  158. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js +10 -10
  159. package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/getUrl.es.js.map +1 -1
  160. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js +26 -26
  161. package/dist/components/RichTextEditor/plugins/OrderedListPlugin/index.es.js.map +1 -1
  162. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js +40 -46
  163. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom1Plugin.es.js.map +1 -1
  164. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js +40 -46
  165. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom2Plugin.es.js.map +1 -1
  166. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js +40 -46
  167. package/dist/components/RichTextEditor/plugins/TextStylePlugins/custom3Plugin.es.js.map +1 -1
  168. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js +41 -47
  169. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading1Plugin.es.js.map +1 -1
  170. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js +41 -47
  171. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading2Plugin.es.js.map +1 -1
  172. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js +41 -47
  173. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading3Plugin.es.js.map +1 -1
  174. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js +41 -47
  175. package/dist/components/RichTextEditor/plugins/TextStylePlugins/heading4Plugin.es.js.map +1 -1
  176. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js +44 -38
  177. package/dist/components/RichTextEditor/plugins/TextStylePlugins/helpers.es.js.map +1 -1
  178. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js +41 -47
  179. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageCaptionPlugin.es.js.map +1 -1
  180. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js +40 -46
  181. package/dist/components/RichTextEditor/plugins/TextStylePlugins/imageTitlePlugin.es.js.map +1 -1
  182. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js +45 -41
  183. package/dist/components/RichTextEditor/plugins/TextStylePlugins/paragraphPlugin.es.js.map +1 -1
  184. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js +40 -48
  185. package/dist/components/RichTextEditor/plugins/TextStylePlugins/quotePlugin.es.js.map +1 -1
  186. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js +29 -29
  187. package/dist/components/RichTextEditor/plugins/UnorderedListPlugin/index.es.js.map +1 -1
  188. package/dist/components/RichTextEditor/plugins/styles.es.js +167 -166
  189. package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
  190. package/dist/helpers/addHttps.es.js +12 -12
  191. package/dist/helpers/addHttps.es.js.map +1 -1
  192. package/dist/helpers/convertToRichTextValue.es.js +14 -6
  193. package/dist/helpers/convertToRichTextValue.es.js.map +1 -1
  194. package/dist/helpers/hasRichTextValue.es.js +13 -14
  195. package/dist/helpers/hasRichTextValue.es.js.map +1 -1
  196. package/dist/helpers/isDownloadable.es.js +6 -5
  197. package/dist/helpers/isDownloadable.es.js.map +1 -1
  198. package/dist/hooks/useAttachments.es.js +65 -73
  199. package/dist/hooks/useAttachments.es.js.map +1 -1
  200. package/dist/hooks/useIsInViewport.es.js +20 -21
  201. package/dist/hooks/useIsInViewport.es.js.map +1 -1
  202. package/dist/index.cjs.js +6 -8
  203. package/dist/index.cjs.js.map +1 -1
  204. package/dist/index.d.ts +8 -7
  205. package/dist/index.es.js +221 -213
  206. package/dist/index.es.js.map +1 -1
  207. package/dist/index.umd.js +6 -8
  208. package/dist/index.umd.js.map +1 -1
  209. package/dist/settings/background.es.js +20 -21
  210. package/dist/settings/background.es.js.map +1 -1
  211. package/dist/settings/border.es.js +62 -64
  212. package/dist/settings/border.es.js.map +1 -1
  213. package/dist/settings/borderRadius.es.js +49 -52
  214. package/dist/settings/borderRadius.es.js.map +1 -1
  215. package/dist/settings/borderRadiusExtended.es.js +58 -60
  216. package/dist/settings/borderRadiusExtended.es.js.map +1 -1
  217. package/dist/settings/defaultValues.es.js +16 -19
  218. package/dist/settings/defaultValues.es.js.map +1 -1
  219. package/dist/settings/gutter.es.js +48 -52
  220. package/dist/settings/gutter.es.js.map +1 -1
  221. package/dist/settings/margin.es.js +49 -52
  222. package/dist/settings/margin.es.js.map +1 -1
  223. package/dist/settings/marginExtended.es.js +62 -64
  224. package/dist/settings/marginExtended.es.js.map +1 -1
  225. package/dist/settings/padding.es.js +49 -52
  226. package/dist/settings/padding.es.js.map +1 -1
  227. package/dist/settings/paddingExtended.es.js +62 -64
  228. package/dist/settings/paddingExtended.es.js.map +1 -1
  229. package/dist/settings/securityDownloadable.es.js +16 -16
  230. package/dist/settings/securityDownloadable.es.js.map +1 -1
  231. package/dist/settings/securityGlobalControl.es.js +26 -32
  232. package/dist/settings/securityGlobalControl.es.js.map +1 -1
  233. package/dist/settings/types.es.js +41 -47
  234. package/dist/settings/types.es.js.map +1 -1
  235. package/dist/styles.css +2 -1
  236. package/dist/utilities/color/getReadableColor.es.js +15 -13
  237. package/dist/utilities/color/getReadableColor.es.js.map +1 -1
  238. package/dist/utilities/color/isDark.es.js +14 -9
  239. package/dist/utilities/color/isDark.es.js.map +1 -1
  240. package/dist/utilities/color/setAlpha.es.js +7 -6
  241. package/dist/utilities/color/setAlpha.es.js.map +1 -1
  242. package/dist/utilities/color/toColorObject.es.js +14 -8
  243. package/dist/utilities/color/toColorObject.es.js.map +1 -1
  244. package/dist/utilities/color/toHex8String.es.js +7 -6
  245. package/dist/utilities/color/toHex8String.es.js.map +1 -1
  246. package/dist/utilities/color/toHexString.es.js +7 -6
  247. package/dist/utilities/color/toHexString.es.js.map +1 -1
  248. package/dist/utilities/color/toRgbaString.es.js +7 -6
  249. package/dist/utilities/color/toRgbaString.es.js.map +1 -1
  250. package/dist/utilities/color/toShortRgba.es.js +18 -11
  251. package/dist/utilities/color/toShortRgba.es.js.map +1 -1
  252. package/dist/utilities/react/getBackgroundColorStyles.es.js +7 -8
  253. package/dist/utilities/react/getBackgroundColorStyles.es.js.map +1 -1
  254. package/dist/utilities/react/getBorderStyles.es.js +12 -11
  255. package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
  256. package/dist/utilities/react/getRadiusStyles.es.js +7 -8
  257. package/dist/utilities/react/getRadiusStyles.es.js.map +1 -1
  258. package/dist/utilities/react/joinClassNames.es.js +6 -5
  259. package/dist/utilities/react/joinClassNames.es.js.map +1 -1
  260. package/package.json +8 -10
  261. package/dist/components/Link/LinkSelector/LinkSelector.es.js +0 -72
  262. package/dist/components/Link/LinkSelector/LinkSelector.es.js.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -1,10 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),o=require("@frontify/fondue/rte"),K=require("@frontify/app-bridge"),u=require("react"),U=require("@dnd-kit/core"),Rn=require("@dnd-kit/modifiers"),ft=require("@dnd-kit/sortable"),g=require("@frontify/fondue/components"),k=require("@frontify/fondue/icons"),bt=require("@frontify/fondue"),xt=require("react-dom"),F=require("@ctrl/tinycolor"),z=t=>t.filter(Boolean).join(" "),Dn=({onDrop:t,label:e,icon:n,secondaryLabel:r,isLoading:i,fillParentContainer:a,onAssetChooseClick:c,onUploadClick:d,withMenu:l=!0,onClick:f,validFileType:x,verticalLayout:h})=>{const[p,b]=u.useState(!1),[y,S]=u.useState(),B=u.useRef(null),[N,A]=u.useState(void 0),O=C=>{if(C.preventDefault(),b(!1),!j(C.dataTransfer.files)){A("Invalid"),setTimeout(()=>{A(void 0)},1e3);return}t?.(C.dataTransfer.files)},j=C=>{if(!x)return!0;for(let R=0;R<C.length;R++){const _=C[R].name.split(".").pop()??"";if(!K.FileExtensionSets[x].includes(_))return!1}return!0},X=C=>{if(!B.current||i)return;const{clientX:R,clientY:_}=C,lt=R===0&&_===0,{left:gt,top:mt,width:ht,height:It}=B.current.getBoundingClientRect(),jt=lt?ht/2:R-gt,pt=lt?It/2:_-mt;S([jt,pt])},M=u.useCallback(C=>{C(),S(void 0)},[]),J=u.useMemo(()=>{const C=[];return d&&C.push({onSelect:()=>M(d),title:"Upload asset",icon:s.jsx(k.IconArrowCircleUp,{size:"20"})}),c&&C.push({onSelect:()=>M(c),title:"Browse asset",icon:s.jsx(k.IconImageStack,{size:"20"})}),C},[c,d,M]);return s.jsxs("button",{type:"button",ref:B,"data-test-id":"block-inject-button",className:z(["tw-body-medium tw-relative tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",h?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",a?"tw-h-full":"tw-h-[72px]",p&&!i?"tw-border-dashed":"tw-border-solid",y&&"tw-bg-surface-hover",p&&"tw-bg-surface",N?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-line-mid",i||y||p||N?"":"tw-text-secondary hover:tw-text-primary hover:tw-bg-surface hover:tw-border-line-strong active:tw-text-primary active:tw-bg-surface-hover active:tw-border-line-strong",(p||y)&&!N?"[&>*]:tw-pointer-events-none tw-border-line-strong":"tw-bg-surface-dim tw-text-secondary"]),onDragEnter:t?C=>{if(b(!0),x==="Images")for(const R of Array.from(C.dataTransfer.items))R?.type?.startsWith("image/")?A(void 0):A("Invalid")}:void 0,onDragOver:t?C=>{C.preventDefault()}:void 0,onDragLeave:t?()=>{b(!1),A(void 0)}:void 0,onDrop:t?O:void 0,onClick:C=>{l&&!y&&X(C),f?.()},children:[i?s.jsx(g.LoadingCircle,{}):N?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(k.IconExclamationMarkTriangle,{size:"16"}),N]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(e||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[e&&s.jsx("div",{className:"tw-font-medium",children:e}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),y&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:y[0],top:y[1]},children:s.jsxs(g.Flyout.Root,{open:!0,onOpenChange:C=>!C&&S(void 0),children:[s.jsx(g.Flyout.Trigger,{children:s.jsx("div",{})}),s.jsx(g.Flyout.Content,{triggerOffset:"compact",children:s.jsxs(g.Dropdown.Root,{open:!0,children:[s.jsx(g.Dropdown.Trigger,{children:s.jsx("div",{})}),s.jsx(g.Dropdown.Content,{triggerOffset:"compact",children:J.map(C=>s.jsxs(g.Dropdown.Item,{onSelect:C.onSelect,children:[C.icon,C.title]},C.title))})]})})]})})]})},Q=t=>{const e=r=>typeof r=="object"&&["red","green","blue"].every(a=>r.hasOwnProperty(a)),n=r=>{const i=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a:i}};return e(t)?n(t):t},Mn=t=>typeof t=="object"&&["red","green","blue"].every(n=>t?.hasOwnProperty(n)),Fn=(t,e)=>{const n=Mn(t)?Q(t):t,r=new F.TinyColor(n);return e?r.getBrightness()<e:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},On=t=>new F.TinyColor(Q(t)).toHex8String(),_n=t=>new F.TinyColor(Q(t)).toHexString(),_t=t=>new F.TinyColor(Q(t)).toRgbString(),Un=(t,e)=>new F.TinyColor(e).setAlpha(t).toRgbString(),Hn=t=>{const{r:e,g:n,b:r,a:i}=new F.TinyColor(t);return{red:e,green:n,blue:r,alpha:i}},re=t=>typeof t=="object"&&["red","green","blue"].every(n=>t?.hasOwnProperty(n)),zn=(t,e)=>{const n=re(t)?Q(t):t,r=re(e)?Q(e):e;let i=new F.TinyColor(n);const a=new F.TinyColor(r);for(;F.readability(i,a)<4.5;)i=i.darken(1);return i.toRgbString()},Vn=t=>({backgroundColor:_t(t)}),$n={red:241,green:241,blue:241,alpha:1},de={red:234,green:235,blue:235,alpha:1},Wn="1px",ct="24px",dt="24px";var D=(t=>(t.Solid="Solid",t.Dashed="Dashed",t.Dotted="Dotted",t))(D||{});const ue={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(H||{});const G={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var $=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))($||{});const tt={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var W=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(W||{});const et={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var Y=(t=>(t.Global="Global",t.Custom="Custom",t))(Y||{}),q=(t=>(t.Auto="Auto",t.S="S",t.M="M",t.L="L",t))(q||{});const ge={Auto:"4px",S:"10px",M:"30px",L:"50px"},qn=(t=D.Solid,e="1px",n=de)=>({borderStyle:ue[t],borderWidth:e,borderColor:_t(n)}),Gn=(t,e=!1,n)=>({borderRadius:e?n:G[t]}),Ut=u.createContext(!1);Ut.displayName="DragPreviewContext";const me=({children:t,isDragPreview:e})=>s.jsx(Ut.Provider,{value:e,children:t}),it=()=>u.useContext(Ut),Ht=u.createContext({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error("No MultiFlyoutContext Provider found")});Ht.displayName="MultiFlyoutContext";const he=({children:t,openFlyoutIds:e,setOpenFlyoutIds:n})=>{const r=u.useMemo(()=>({openFlyoutIds:e,setOpenFlyoutIds:n}),[e,n]);return s.jsx(Ht.Provider,{value:r,children:t})},pe=()=>u.useContext(Ht),vt=t=>{const{openFlyoutIds:e,setOpenFlyoutIds:n}=pe(),r=u.useCallback(i=>{n(a=>{const c=a.filter(d=>d!==t);return i?[...c,t]:c})},[t,n]);return{isOpen:e.includes(t),onOpenChange:r}},zt=(t,e)=>{const{blockAssets:n,addAssetIdsToKey:r,deleteAssetIdsFromKey:i,updateAssetIdsFromKey:a}=e,c=n?.[t]||[];return{onAttachmentsAdd:async h=>{await r(t,h.map(p=>p.id))},onAttachmentDelete:async h=>{await i(t,[h.id])},onAttachmentReplace:async(h,p)=>{const b=c.map(y=>y.id===h.id?p.id:y.id);await a(t,b)},onAttachmentsSorted:async h=>{const p=h.map(b=>b.id);await a(t,p)},attachments:c}},fe=(t,e)=>{const{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:c}=zt(e,K.useBlockAssets(t));return{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:c,appBridge:t}},Ct=u.createContext(null);Ct.displayName="AttachmentsContext";const xe=({appBridge:t,children:e,assetId:n})=>{const r=fe(t,n);return s.jsx(Ct.Provider,{value:r,children:e})},Kn=({blockAssetBundle:t,appBridge:e,children:n,assetId:r})=>{const i=zt(r,t);return s.jsx(Ct.Provider,{value:{...i,appBridge:e},children:n})},we=()=>{const t=u.useContext(Ct);if(!t)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return t},Yn=(t,e)=>{const n=r=>s.jsx(xe,{appBridge:r.appBridge,assetId:e,children:s.jsx(t,{...r})});return n.displayName="withAttachmentsProvider",n},Qn=t=>t==="IMAGE"?s.jsx(k.IconImage,{size:"24"}):t==="VIDEO"?s.jsx(k.IconPlayFrame,{size:"24"}):t==="AUDIO"?s.jsx(k.IconMusicNote,{size:"24"}):s.jsx(k.IconDocument,{size:"24"}),ye=u.forwardRef(({item:t,isEditing:e,draggableProps:n,transformStyle:r,isDragging:i,isOverlay:a,isLoading:c,onDelete:d,onReplaceWithBrowse:l,onReplaceWithUpload:f,onDownload:x},h)=>{const[p,b]=u.useState(),[y,{selectedFiles:S}]=K.useFileInput({multiple:!0,accept:"image/*"}),[B,{results:N,doneAll:A}]=K.useAssetUpload();u.useEffect(()=>{S&&B(S[0])},[S]),u.useEffect(()=>{A&&f(N[0])},[A,N]);const O=c||S&&!A;return s.jsxs("button",{type:"button","aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>!p&&x?.(),ref:h,style:{...r,opacity:i&&!a?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:z(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-surface-hover focus-visible:tw-outline focus-visible:!-tw-outline-offset-4",i?"tw-bg-surface-hover":""]),children:[s.jsx("div",{className:"tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container",children:O?s.jsx(g.LoadingCircle,{size:"small"}):Qn(t.objectType)}),s.jsxs("div",{className:"tw-text-small tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container",children:t.title}),s.jsx("div",{className:"tw-text-secondary",children:`${t.fileSizeHumanReadable} - ${t.extension}`})]}),e&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:z(["tw-flex tw-gap-0.5 group-hover:tw-opacity-100 group-focus-visible:tw-opacity-100 has-[:focus-visible]:tw-opacity-100",a||p?.id===t.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx(g.Button,{aspect:"square",emphasis:"weak","aria-label":"Drag attachment",className:z([i||a?"tw-cursor-grabbing":"tw-cursor-grab","focus-visible:tw-z-[2]"]),...n,children:s.jsx(k.IconGrabHandle,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsxs(g.Dropdown.Root,{open:p?.id===t.id,onOpenChange:j=>b(j?t:void 0),children:[s.jsx(g.Dropdown.Trigger,{children:s.jsx(g.Button,{aspect:"square",emphasis:p?.id===t.id?"default":"weak",onPress:j=>{j?.stopPropagation(),j?.preventDefault()},children:s.jsx(k.IconPen,{size:"20"})})}),s.jsxs(g.Dropdown.Content,{side:"right",children:[s.jsxs(g.Dropdown.Group,{children:[s.jsxs(g.Dropdown.Item,{"data-test-id":"menu-item",onSelect:j=>{j?.stopPropagation(),y(),b(void 0)},children:[s.jsx(k.IconArrowCircleUp,{size:"20"}),"Replace with upload"]}),s.jsxs(g.Dropdown.Item,{onSelect:j=>{j?.stopPropagation(),l(),b(void 0)},children:[s.jsx(k.IconImageStack,{size:"20"}),"Replace with asset"]})]}),s.jsx(g.Dropdown.Group,{children:s.jsxs(g.Dropdown.Item,{emphasis:"danger",onSelect:j=>{j?.stopPropagation(),d(),b(void 0)},children:[s.jsx(k.IconTrashBin,{size:"20"}),"Delete"]})})]})]})})]})]})});ye.displayName="AttachmentItem";const Xn=t=>{const{attributes:e,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:c}=ft.useSortable({id:t.item.id}),d={transform:i?`translate(${i.x}px, ${i.y}px)`:"",transition:a,zIndex:c?2:1},l={...e,...n};return s.jsx(ye,{ref:r,isDragging:c,transformStyle:d,draggableProps:l,...t})},be=u.forwardRef(({children:t,...e},n)=>s.jsxs(g.Button,{ref:n,size:"small",rounding:"full",emphasis:"default","data-test-id":"attachments-button-trigger",className:"tw-body-medium",...e,children:[s.jsx(k.IconPaperclip,{size:"16"}),t,s.jsx(k.IconCaretDown,{size:"12"})]}));be.displayName="AttachmentsButtonTrigger";const ve=({items:t=[],onDelete:e,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:i,onUpload:a,onSorted:c,appBridge:d,triggerComponent:l=be,isOpen:f,onOpenChange:x})=>{const[h,p]=u.useState(t),[b,y]=u.useState(!1),S=U.useSensors(U.useSensor(U.PointerSensor),U.useSensor(U.KeyboardSensor)),[B,N]=u.useState(void 0),[A,O]=u.useState(!1),[j,X]=u.useState(!1),[M,J]=u.useState([]),[C,R]=u.useState(null),_=K.useEditorState(d),{openAssetChooser:lt,closeAssetChooser:gt}=K.useAssetChooser(d),mt=f!==void 0,ht=mt?f:b,It=h?.find(v=>v.id===B),[jt,{results:pt,doneAll:se}]=K.useAssetUpload({onUploadProgress:()=>!A&&O(!0)}),Z=v=>{(mt?x:y)?.(v)};u.useEffect(()=>{p(t)},[t]),u.useEffect(()=>{C&&(O(!0),jt(C))},[C]),u.useEffect(()=>{(async()=>se&&(await a(pt),O(!1)))()},[se,pt]);const Pn=()=>{Z(!1),lt(async v=>{gt(),Z(!0),X(!0),await i(v),X(!1)},{multiSelection:!0,selectedValueIds:h.map(v=>v.id)})},In=v=>{Z(!1),lt(async L=>{Z(!0),gt(),J([...M,v.id]),await n(v,L[0]),J(M.filter(V=>V!==v.id))},{multiSelection:!1,selectedValueIds:h.map(L=>L.id)})},jn=async(v,L)=>{J([...M,v.id]),await r(v,L),J(M.filter(V=>V!==v.id))},En=v=>{const{active:L}=v;N(L.id)},Bn=v=>{const{active:L,over:V}=v;if(V&&L.id!==V.id&&h){const An=h.findIndex(Et=>Et.id===L.id),Ln=h.findIndex(Et=>Et.id===V.id),oe=ft.arrayMove(h,An,Ln);p(oe),c(oe)}N(void 0)},Nn={onEscapeKeyDown:v=>{v.stopPropagation(),Z(!1)}};return _||(h?.length??0)>0?s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(g.Flyout.Root,{open:ht,onOpenChange:v=>Z(It?!0:v),children:s.jsxs(g.Tooltip.Root,{enterDelay:500,children:[s.jsx(g.Tooltip.Trigger,{asChild:!0,children:s.jsx(g.Flyout.Trigger,{asChild:!0,"data-test-id":"attachments-button-trigger",children:s.jsx(l,{isFlyoutOpen:ht,children:s.jsx("div",{children:t.length>0?t.length:"Add"})})})}),s.jsx(g.Flyout.Content,{side:"bottom",align:"end",width:"300px",...Nn,children:s.jsxs("div",{className:"tw-w-full","data-test-id":"attachments-flyout-content",children:[h.length>0&&s.jsx(U.DndContext,{sensors:S,collisionDetection:U.closestCenter,onDragStart:En,onDragEnd:Bn,modifiers:[Rn.restrictToParentElement],children:s.jsx(ft.SortableContext,{items:h,strategy:ft.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line tw-relative",children:h.map(v=>s.jsx(Xn,{isEditing:_,isLoading:M.includes(v.id),item:v,onDelete:()=>e(v),onReplaceWithBrowse:()=>In(v),onReplaceWithUpload:L=>jn(v,L),onDownload:()=>d.dispatch({name:"downloadAsset",payload:v})},v.id))})})}),_&&s.jsxs("div",{className:"tw-px-5 tw-py-3","data-test-id":"asset-input-placeholder",children:[s.jsx("div",{className:"tw-font-primary tw-font-medium tw-text-primary tw-text-small tw-my-4",children:"Add attachments"}),A||j?s.jsxs(g.AssetInput.Root,{orientation:"horizontal",children:[s.jsx(g.AssetInput.Preview,{children:s.jsx(g.AssetInput.PreviewLoading,{})}),s.jsx(g.AssetInput.Title,{children:"Asset"}),s.jsx(g.AssetInput.Metadata,{children:s.jsx(g.AssetInput.MetadataItem,{children:s.jsxs(g.Flex,{align:"center",gap:.5,children:[j?s.jsx(k.IconImageStack,{size:16}):s.jsx(k.IconArrowCircleUp,{size:16}),j?"Loading":"Uploading"]})})})]}):s.jsxs(g.AssetInput.Placeholder,{children:[s.jsx(g.AssetInput.UploadInput,{allowMultiple:!0,onSelect:v=>R(v.target.files)}),s.jsx(g.AssetInput.BrowseInput,{onBrowse:Pn})]})]})]})}),s.jsx(g.Tooltip.Content,{side:"top",children:"Attachments"})]})})}):null},Jn=(t,e)=>{const n=[bt.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded-medium","tw-body-medium","tw-gap-0.5","focus-visible:tw-z-10"];return e?n.push("tw-bg-container-secondary-active","tw-text-container-secondary-on-secondary-container",t==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-container-secondary-hover active:tw-bg-container-secondary-active","tw-text-secondary hover:tw-text-container-secondary-on-secondary-container active:tw-text-container-secondary-on-secondary-container",t==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),z(n)},at=u.forwardRef(({onClick:t,children:e,forceActiveStyle:n,cursor:r="pointer","data-test-id":i="base-toolbar-button",...a},c)=>s.jsx("button",{onClick:t,className:Jn(r,n),"data-test-id":i,...a,ref:c,children:e}));at.displayName="BaseToolbarButton";const Ce=u.forwardRef(({children:t,isFlyoutOpen:e,...n},r)=>s.jsxs(at,{forceActiveStyle:e,"data-test-id":"attachments-toolbar-button-trigger",ref:r,...n,children:[s.jsx(k.IconPaperclip,{size:"16"}),t,s.jsx(k.IconCaretDown,{size:"12"})]}));Ce.displayName="AttachmentsToolbarButtonTrigger";const Se="attachments",ke=({flyoutId:t=Se})=>{const{appBridge:e,attachments:n,onAttachmentsAdd:r,onAttachmentDelete:i,onAttachmentReplace:a,onAttachmentsSorted:c}=we(),{isOpen:d,onOpenChange:l}=vt(t),f=it();return s.jsx(ve,{onUpload:r,onDelete:i,onReplaceWithBrowse:a,onReplaceWithUpload:a,onSorted:c,onBrowse:r,items:n,appBridge:e,triggerComponent:Ce,isOpen:d&&!f,onOpenChange:l})},Te="Drag or press ↵ to move",Pe="Move with ↑↓←→ and confirm with ↵",Vt=({content:t,children:e,open:n,disabled:r})=>r?e:s.jsxs(g.Tooltip.Root,{enterDelay:300,open:n,children:[s.jsx(g.Tooltip.Trigger,{asChild:!0,children:e}),s.jsx(g.Tooltip.Content,{side:"top",children:s.jsx("div",{children:t})})]}),Ie=({tooltip:t,icon:e,setActivatorNodeRef:n,draggableProps:r})=>{const i=it(),{activatorEvent:a}=U.useDndContext(),c=a instanceof KeyboardEvent;return s.jsx(Vt,{...i&&{open:c},content:s.jsx("div",{children:i?Pe:t??Te}),children:s.jsx(at,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:i,cursor:"grab",...r,children:e})})},je=({content:t,icon:e,tooltip:n,flyoutId:r,flyoutFooter:i,flyoutHeader:a})=>{const{isOpen:c,onOpenChange:d}=vt(r),l=it();return s.jsx(Vt,{disabled:l||c,content:n,children:s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsxs(g.Flyout.Root,{open:c&&!l,onOpenChange:d,children:[s.jsx(g.Flyout.Trigger,{asChild:!0,children:s.jsx(at,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:c&&!l,children:e})}),s.jsxs(g.Flyout.Content,{side:"bottom",align:"end",padding:"comfortable",children:[a?s.jsx(g.Flyout.Header,{children:a}):null,s.jsx(g.Flyout.Body,{children:t}),i?s.jsx(g.Flyout.Footer,{children:i}):null]})]})})})},$t="menu",Ee=({items:t,flyoutId:e=$t,tooltip:n="Options"})=>{const{isOpen:r,onOpenChange:i}=vt(e),a=it();return s.jsx(g.Dropdown.Root,{open:r&&!a,onOpenChange:i,children:s.jsxs(g.Tooltip.Root,{children:[s.jsx(g.Tooltip.Trigger,{asChild:!0,children:s.jsx(g.Dropdown.Trigger,{asChild:!0,children:s.jsx(at,{"data-test-id":"block-item-wrapper-toolbar-flyout",children:s.jsx(k.IconDotsHorizontal,{size:"16"})})})}),s.jsx(g.Dropdown.Content,{children:t.map((c,d)=>s.jsx(g.Dropdown.Group,{children:c.map((l,f)=>s.jsxs(g.Dropdown.Item,{"data-test-id":"menu-item",onSelect:()=>{i(!1),l.onClick()},emphasis:l.style||"default",children:[s.jsx("div",{className:"tw-mr-2",children:l.icon}),s.jsx("span",{children:l.title})]},`${d}-${f}`))},d))}),s.jsx(g.Tooltip.Content,{children:n})]})})},Zn=({tooltip:t,icon:e,onClick:n})=>{const r=it();return s.jsx(Vt,{disabled:r,content:t??"",children:s.jsx(at,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:e})})},ie=({children:t})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-segment",className:"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none",children:t}),Be=({items:t,attachments:e})=>s.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-surface tw-border tw-border-line-mid tw-divide-x tw-divide-line-mid tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[e.isEnabled&&s.jsx(ie,{children:s.jsx(ke,{})}),t.length>0&&s.jsx(ie,{children:t.map(n=>{switch(n.type){case"dragHandle":return s.jsx(Ie,{...n},n.tooltip+n.type);case"menu":return s.jsx(Ee,{...n},n.tooltip+n.type);case"flyout":return s.jsx(je,{...n},n.tooltip+n.type);default:return s.jsx(Zn,{...n},n.tooltip+n.type)}})})]}),Ne=u.memo(({children:t,toolbarItems:e,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:i=!1,shouldFillContainer:a,outlineOffset:c=0,shouldBeShown:d=!1,showAttachments:l=!1})=>{const[f,x]=u.useState(d?[$t]:[]),h=u.useRef(null);if(n)return s.jsx(s.Fragment,{children:t});const p=e?.filter(y=>y!==void 0),b=f.length>0||d;return s.jsx(me,{isDragPreview:i,children:s.jsx(he,{openFlyoutIds:f,setOpenFlyoutIds:x,children:s.jsxs("div",{ref:h,"data-test-id":"block-item-wrapper",style:{outlineOffset:c},className:z(["tw-relative tw-group",a&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline hover:tw-outline-1 hover:tw-outline-container-highlight-on-highlight-container focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-container-highlight-on-highlight-container",b&&"tw-outline tw-outline-1 tw-outline-container-highlight-on-highlight-container",r&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-c,bottom:`calc(100% - ${2+c}px)`},className:z(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100","tw-flex tw-justify-end",b&&"tw-opacity-100"]),children:s.jsx(Be,{attachments:{isEnabled:l},items:p})}),t]})})})});Ne.displayName="BlockItemWrapper";const ts=({ref:t,disabled:e,onChange:n})=>{u.useEffect(()=>{if(e||!t.current)return;let r=!1;const i=new IntersectionObserver(([a])=>{a.isIntersecting!==r&&(r=a.isIntersecting,n(a.isIntersecting))});return i.observe(t.current),()=>{i.disconnect()}},[t,e,n])},Wt=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(t=>({reset:()=>{t.url(""),t.text(""),t.buttonStyle("primary"),t.newTab(!1),t.mode(""),t.isEditing(!1)}})).extendActions(t=>({show:(e,n)=>{t.mode(e),t.isEditing(!1),t.openEditorId(n)},hide:()=>{t.reset(),t.openEditorId(null)}})).extendSelectors(t=>({isOpen:e=>t.openEditorId===e})),I=Wt.set,E=Wt.get,ut=()=>Wt.use,Ae=t=>{if(!t)return!1;const e=n=>n.some(r=>r.text?r.text!=="":r.children?e(r.children):!1);try{const n=JSON.parse(t);return e(n)}catch{return!1}},es=(t="p",e="",n)=>Ae(e)?e:JSON.stringify([{type:t,children:[{text:e,textStyle:t}],align:n}]),ns=(t,e,n)=>t===Y.Custom?e:n,qt=(t,e)=>{const n=o.getAboveNode(t,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},ss=t=>qt(t,e=>e.chosenLink?.searchResult?.link||""),os=t=>qt(t,e=>e.url||""),Gt=t=>t.url||t.chosenLink?.searchResult?.link||"",rs=t=>qt(t,Gt),Kt=/^\/(document|r)\/\S+$/i,St=t=>{if(Kt.test(t))return t;try{return new URL(t),t}catch{return`https://${t}`}},kt=t=>{if(Kt.test(t))return!0;try{const e=new URL(t);return["http:","https:","mailto:","tel:"].includes(e.protocol)&&e.pathname!==""}catch{return!1}},st=t=>kt(St(t))||t==="",Le=(t,{type:e})=>{const{apply:n,normalizeNode:r}=t;return t.apply=i=>{if(i.type!=="set_selection"){n(i);return}const a=i.newProperties;if(!a?.focus||!a.anchor||!o.isCollapsed(a)){n(i);return}const c=o.getAboveNode(t,{at:a,match:{type:o.getPluginType(t,T)}});if(c){const[,d]=c;let l;o.isStartPoint(t,a.focus,d)&&(l=o.getPreviousNodeEndPoint(t,d)),o.isEndPoint(t,a.focus,d)&&(l=o.getNextNodeStartPoint(t,d)),l&&(i.newProperties={anchor:l,focus:l})}n(i)},t.normalizeNode=([i,a])=>{if(i.type===o.getPluginType(t,T)){const c=t.selection;if(c&&o.isCollapsed(c)&&o.isEndPoint(t,c.focus,a)){const d=o.getNextNodeStartPoint(t,a);if(d)o.select(t,d);else{const l=o.Path.next(a);o.insertNodes(t,{text:""},{at:l}),o.select(t,l)}}}r([i,a])},o.withRemoveEmptyNodes(t,o.mockPlugin({options:{types:e}}))},Re=(t,e,n)=>{o.insertNodes(t,[Oe(t,e)],n)},Yt=t=>{if(!t.selection)return;const{isUrl:e,forceSubmit:n}=o.getPluginOptions(t,T),r=E.url();if(!(e?.(r)||n))return;const a=E.text(),c=E.buttonStyle(),d=E.newTab()?void 0:"_self";return I.reset(),De(t,{url:r,text:a,buttonStyle:c,target:d,isUrl:l=>n||!e?!0:e(l)}),setTimeout(()=>{o.focusEditor(t,t.selection??void 0)},0),!0},ot=(t,e)=>o.withoutNormalizing(t,()=>{if(e?.split){if(o.getAboveNode(t,{at:t.selection?.anchor,match:{type:o.getPluginType(t,T)}}))return o.splitNodes(t,{at:t.selection?.anchor,match:i=>o.isElement(i)&&i.type===o.getPluginType(t,T)}),ot(t,{at:t.selection?.anchor}),!0;if(o.getAboveNode(t,{at:t.selection?.focus,match:{type:o.getPluginType(t,T)}}))return o.splitNodes(t,{at:t.selection?.focus,match:i=>o.isElement(i)&&i.type===o.getPluginType(t,T)}),ot(t,{at:t.selection?.focus}),!0}o.unwrapNodes(t,{match:{type:o.getPluginType(t,T)},...e})}),De=(t,{url:e,text:n,buttonStyle:r,target:i,insertTextInButton:a,insertNodesOptions:c,isUrl:d=o.getPluginOptions(t,T).isUrl})=>{const l=t.selection;if(!l)return;const f=o.getAboveNode(t,{at:l,match:{type:o.getPluginType(t,T)}});if(a&&f)return t.insertText(e),!0;if(!d?.(e))return;if(o.isDefined(n)&&n.length===0&&(n=e),f)return ls(e,t,f,i,r,n),!0;const x=o.findNode(t,{at:l,match:{type:o.getPluginType(t,T)}}),[h,p]=x??[],b=is(t,p,n);if(o.isExpanded(l))return as(f,t,e,r,i,n),!0;b&&o.removeNodes(t,{at:p});const y=o.getNodeProps(h??{}),S=t.selection?.focus.path;if(!S)return;const B=o.getNodeLeaf(t,S);return n?.length||(n=e),Re(t,{...y,url:e,target:i,children:[{...B,text:n}]},c),!0};function is(t,e,n){return e&&n?.length&&n!==o.getEditorString(t,e)}function as(t,e,n,r,i,a){t?ot(e,{at:t[1]}):ot(e,{split:!0}),Me(e,{url:n,buttonStyle:r,target:i}),Qt(e,{text:a})}function ls(t,e,n,r,i,a){(t!==n[0]?.url||r!==n[0]?.target||i!==n[0]?.buttonStyle)&&o.setNodes(e,{url:t,target:r,buttonStyle:i},{at:n[1]}),Qt(e,{text:a})}const Qt=(t,{text:e})=>{const n=o.getAboveNode(t,{match:{type:o.getPluginType(t,T)}});if(n){const[r,i]=n;if(e?.length&&e!==o.getEditorString(t,i)){const a=r.children[0];o.replaceNodeChildren(t,{at:i,nodes:{...a,text:e},insertOptions:{select:!0}})}}},Me=(t,{url:e,buttonStyle:n,target:r,...i})=>{o.wrapNodes(t,{type:o.getPluginType(t,T),url:e,buttonStyle:n,target:r,children:[]},{split:!0,...i})},cs=(t,e)=>{const n=o.getAboveNode(t,{match:{type:T}});return Array.isArray(n)?e(n[0]):""},Fe=t=>cs(t,e=>e.url??""),Oe=(t,{url:e,text:n="",buttonStyle:r="primary",target:i,children:a})=>({type:o.getPluginType(t,T),url:e,target:i,buttonStyle:r,children:a??[{text:n}]}),_e=(t,{focused:e}={})=>{if(E.mode()==="edit"){Tt(t);return}Xt(t,{focused:e})},Tt=t=>{const e=o.findNode(t,{match:{type:o.getPluginType(t,T)}});if(!e)return;const[n,r]=e;let i=o.getEditorString(t,r);I.url(n.url),I.newTab(n.target===void 0),i===n.url&&(i=""),I.text(i),I.isEditing(!0)},Xt=(t,{focused:e}={})=>{E.mode()||!e||o.isRangeAcrossBlocks(t,{at:t.selection})||o.someNode(t,{match:{type:o.getPluginType(t,T)}})||(I.text(o.getEditorString(t,t.selection)),I.show("insert",t.id))},Bt={marginTop:"10px",marginBottom:"10px",display:"inline-block",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",verticalAlign:"middle",boxSizing:"border-box",overflowWrap:"normal"},Pt={buttonPrimary:{...Bt,fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{...Bt,fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{...Bt,fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},ds=t=>{const{attributes:e,children:n}=t,r=t.element.url||t.element.chosenLink?.searchResult?.link||"",i=t.element.target||"_self",a=String(t.element.buttonStyle)||"primary";return s.jsx(us,{attributes:e,href:r,target:i,styles:Pt[`button${a.charAt(0).toUpperCase()+a.slice(1)}`],children:n})},us=({attributes:t,styles:e={hover:{}},children:n,href:r="#",target:i})=>{const[a,c]=u.useState(!1);return s.jsx("a",{...t,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:r,target:i,style:a?{...e,...e.hover}:e,children:n})};class gs extends o.MarkupElement{constructor(e=T,n=ds){super(e,n)}}const Ue=u.forwardRef((t,e)=>{const n=o.useEditorRef();return s.jsx(o.ToolbarButton,{ref:e,...t,onMouseDown:r=>{r.preventDefault(),o.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{_e(n,{focused:!0})},children:s.jsx(o.IconStylingWrapper,{icon:s.jsx(k.IconButton,{size:16})})})});Ue.displayName="ButtonToolbarButton";const ms=({editorId:t,id:e})=>{const n=o.useEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection}),i=o.getPluginType(n,T),a=!!n?.selection&&o.someNode(n,{match:{type:i}});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(Ue,{pressed:a,disabled:!r,tooltip:o.getTooltip(r?`Button
2
- ${o.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},rt="link-plugin";var w=(t=>(t.heading1="heading1",t.heading2="heading2",t.heading3="heading3",t.heading4="heading4",t.custom1="custom1",t.custom2="custom2",t.custom3="custom3",t.quote="quote",t.imageCaption="imageCaption",t.imageTitle="imageTitle",t.p="p",t))(w||{});const P={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[rt]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...Pt},hs=()=>{const t=o.useEditorRef();return s.jsx(o.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[s.jsx("a",{"data-test-id":"floating-button-edit-url",href:E.url(),target:"_blank",rel:"noopener noreferrer",style:P[rt],className:"tw-break-all",children:E.url()}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{onClick:()=>{Tt(t)},tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",children:s.jsx(k.IconPen,{size:16})}),s.jsx("button",{onClick:()=>{ot(t),o.focusEditor(t,t.selection??void 0)},tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",children:s.jsx(k.IconTrashBin,{size:16})})]})]})})},He=t=>t.filter(e=>!!e.title?.trim()),ze=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(g.LoadingCircle,{size:"small"})}),ps=({section:t,selectedUrl:e,onSelectUrl:n})=>{const r=t.permanentLink===e;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",type:"button","data-is-active":r,className:`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},o=(e,t,n)=>(a(e,t,`default`),n&&a(n,t,`default`));let s=require("@frontify/app-bridge"),c=require("@frontify/fondue/components"),l=require("@frontify/fondue/icons"),u=require("react"),d=require("react/jsx-runtime"),f=require("@ctrl/tinycolor"),p=require("@dnd-kit/core"),m=require("@dnd-kit/modifiers"),h=require("@dnd-kit/sortable"),g=require("@frontify/fondue"),_=require("@frontify/fondue/rte"),v=require("react-dom");var y=e=>e.filter(Boolean).join(` `),b=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:i,fillParentContainer:a,onAssetChooseClick:o,onUploadClick:f,withMenu:p=!0,onClick:m,validFileType:h,verticalLayout:g})=>{let[_,v]=(0,u.useState)(!1),[b,x]=(0,u.useState)(),S=(0,u.useRef)(null),[C,w]=(0,u.useState)(void 0),T=t=>{if(t.preventDefault(),v(!1),!E(t.dataTransfer.files)){w(`Invalid`),setTimeout(()=>{w(void 0)},1e3);return}e?.(t.dataTransfer.files)},E=e=>{if(!h)return!0;for(let t=0;t<e.length;t++){let n=e[t].name.split(`.`).pop()??``;if(!s.FileExtensionSets[h].includes(n))return!1}return!0},D=e=>{if(!S.current||i)return;let{clientX:t,clientY:n}=e,r=t===0&&n===0,{left:a,top:o,width:s,height:c}=S.current.getBoundingClientRect(),l=r?s/2:t-a,u=r?c/2:n-o;x([l,u])},O=(0,u.useCallback)(e=>{e(),x(void 0)},[]),ee=(0,u.useMemo)(()=>{let e=[];return f&&e.push({onSelect:()=>O(f),title:`Upload asset`,icon:(0,d.jsx)(l.IconArrowCircleUp,{size:`20`})}),o&&e.push({onSelect:()=>O(o),title:`Browse asset`,icon:(0,d.jsx)(l.IconImageStack,{size:`20`})}),e},[o,f,O]);return(0,d.jsxs)(`button`,{type:`button`,ref:S,"data-test-id":`block-inject-button`,className:y([`tw-body-medium tw-relative tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br`,g?`[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl`:`[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr`,a?`tw-h-full`:`tw-h-[72px]`,_&&!i?`tw-border-dashed`:`tw-border-solid`,b&&`tw-bg-surface-hover`,_&&`tw-bg-surface`,C?`!tw-border-red-50 !tw-cursor-not-allowed`:` tw-border-line-mid`,i||b||_||C?``:`tw-text-secondary hover:tw-text-primary hover:tw-bg-surface hover:tw-border-line-strong active:tw-text-primary active:tw-bg-surface-hover active:tw-border-line-strong`,(_||b)&&!C?`[&>*]:tw-pointer-events-none tw-border-line-strong`:`tw-bg-surface-dim tw-text-secondary`]),onDragEnter:e?e=>{if(v(!0),h===`Images`)for(let t of Array.from(e.dataTransfer.items))t?.type?.startsWith(`image/`)?w(void 0):w(`Invalid`)}:void 0,onDragOver:e?e=>{e.preventDefault()}:void 0,onDragLeave:e?()=>{v(!1),w(void 0)}:void 0,onDrop:e?T:void 0,onClick:e=>{p&&!b&&D(e),m?.()},children:[i?(0,d.jsx)(c.LoadingCircle,{}):C?(0,d.jsxs)(`div`,{className:` tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium`,children:[(0,d.jsx)(l.IconExclamationMarkTriangle,{size:`16`}),C]}):(0,d.jsxs)(d.Fragment,{children:[n&&(0,d.jsx)(`div`,{children:n}),(t||r)&&(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-col tw-items-start`,children:[t&&(0,d.jsx)(`div`,{className:`tw-font-medium`,children:t}),r&&(0,d.jsx)(`div`,{className:`tw-font-normal`,children:r})]})]}),b&&(0,d.jsx)(`div`,{className:`tw-absolute tw-left-0 tw-top-full tw-z-20`,style:{left:b[0],top:b[1]},children:(0,d.jsxs)(c.Flyout.Root,{open:!0,onOpenChange:e=>!e&&x(void 0),children:[(0,d.jsx)(c.Flyout.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Flyout.Content,{triggerOffset:`compact`,children:(0,d.jsxs)(c.Dropdown.Root,{open:!0,children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Dropdown.Content,{triggerOffset:`compact`,children:ee.map(e=>(0,d.jsxs)(c.Dropdown.Item,{onSelect:e.onSelect,children:[e.icon,e.title]},e.title))})]})})]})})]})},x=e=>(e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e.hasOwnProperty(t)))(e)?(e=>{let t=typeof e.alpha==`number`?e.alpha:1;return{r:e.red,g:e.green,b:e.blue,a:t}})(e):e,S=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),C=(e,t)=>{let n=S(e)?x(e):e,r=new f.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},w=e=>new f.TinyColor(x(e)).toHex8String(),T=e=>new f.TinyColor(x(e)).toHexString(),E=e=>new f.TinyColor(x(e)).toRgbString(),D=(e,t)=>new f.TinyColor(t).setAlpha(e).toRgbString(),O=e=>{let{r:t,g:n,b:r,a:i}=new f.TinyColor(e);return{red:t,green:n,blue:r,alpha:i}},ee=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),k=(e,t)=>{let n=ee(e)?x(e):e,r=ee(t)?x(t):t,i=new f.TinyColor(n),a=new f.TinyColor(r);for(;(0,f.readability)(i,a)<4.5;)i=i.darken(1);return i.toRgbString()},A=e=>({backgroundColor:E(e)}),te={red:241,green:241,blue:241,alpha:1},ne={red:234,green:235,blue:235,alpha:1},j=`24px`,M=`24px`,N=function(e){return e.Solid=`Solid`,e.Dashed=`Dashed`,e.Dotted=`Dotted`,e}({}),re={Solid:`solid`,Dotted:`dotted`,Dashed:`dashed`},P=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),F={None:`0px`,Small:`2px`,Medium:`4px`,Large:`12px`},I=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),L={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},R=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),z={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},B=function(e){return e.Global=`Global`,e.Custom=`Custom`,e}({}),V=function(e){return e.Auto=`Auto`,e.S=`S`,e.M=`M`,e.L=`L`,e}({}),ie={Auto:`4px`,S:`10px`,M:`30px`,L:`50px`},ae=(e=N.Solid,t=`1px`,n=ne)=>({borderStyle:re[e],borderWidth:t,borderColor:E(n)}),oe=(e,t=!1,n)=>({borderRadius:t?n:F[e]}),se=(0,u.createContext)(!1);se.displayName=`DragPreviewContext`;var ce=({children:e,isDragPreview:t})=>(0,d.jsx)(se.Provider,{value:t,children:e}),H=()=>(0,u.useContext)(se),le=(0,u.createContext)({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error(`No MultiFlyoutContext Provider found`)});le.displayName=`MultiFlyoutContext`;var ue=({children:e,openFlyoutIds:t,setOpenFlyoutIds:n})=>{let r=(0,u.useMemo)(()=>({openFlyoutIds:t,setOpenFlyoutIds:n}),[t,n]);return(0,d.jsx)(le.Provider,{value:r,children:e})},de=()=>(0,u.useContext)(le),fe=e=>{let{openFlyoutIds:t,setOpenFlyoutIds:n}=de(),r=(0,u.useCallback)(t=>{n(n=>{let r=n.filter(t=>t!==e);return t?[...r,e]:r})},[e,n]);return{isOpen:t.includes(e),onOpenChange:r}},pe=(e,t)=>{let{blockAssets:n,addAssetIdsToKey:r,deleteAssetIdsFromKey:i,updateAssetIdsFromKey:a}=t,o=n?.[e]||[];return{onAttachmentsAdd:async t=>{await r(e,t.map(e=>e.id))},onAttachmentDelete:async t=>{await i(e,[t.id])},onAttachmentReplace:async(t,n)=>{let r=o.map(e=>e.id===t.id?n.id:e.id);await a(e,r)},onAttachmentsSorted:async t=>{let n=t.map(e=>e.id);await a(e,n)},attachments:o}},me=(e,t)=>{let{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o}=pe(t,(0,s.useBlockAssets)(e));return{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o,appBridge:e}},he=(0,u.createContext)(null);he.displayName=`AttachmentsContext`;var ge=({appBridge:e,children:t,assetId:n})=>{let r=me(e,n);return(0,d.jsx)(he.Provider,{value:r,children:t})},_e=({blockAssetBundle:e,appBridge:t,children:n,assetId:r})=>{let i=pe(r,e);return(0,d.jsx)(he.Provider,{value:{...i,appBridge:t},children:n})},ve=()=>{let e=(0,u.useContext)(he);if(!e)throw Error(`No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC`);return e},ye=(e,t)=>{let n=n=>(0,d.jsx)(ge,{appBridge:n.appBridge,assetId:t,children:(0,d.jsx)(e,{...n})});return n.displayName=`withAttachmentsProvider`,n},be=e=>e===`IMAGE`?(0,d.jsx)(l.IconImage,{size:`24`}):e===`VIDEO`?(0,d.jsx)(l.IconPlayFrame,{size:`24`}):e===`AUDIO`?(0,d.jsx)(l.IconMusicNote,{size:`24`}):(0,d.jsx)(l.IconDocument,{size:`24`}),xe=(0,u.forwardRef)(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:i,isOverlay:a,isLoading:o,onDelete:f,onReplaceWithBrowse:p,onReplaceWithUpload:m,onDownload:h},g)=>{let[_,v]=(0,u.useState)(),[b,{selectedFiles:x}]=(0,s.useFileInput)({multiple:!0,accept:`image/*`}),[S,{results:C,doneAll:w}]=(0,s.useAssetUpload)();(0,u.useEffect)(()=>{x&&S(x[0])},[x]),(0,u.useEffect)(()=>{w&&m(C[0])},[w,C]);let T=o||x&&!w;return(0,d.jsxs)(`button`,{type:`button`,"aria-label":`Download attachment`,"data-test-id":`attachments-item`,onClick:()=>!_&&h?.(),ref:g,style:{...r,opacity:i&&!a?.3:1,fontFamily:`var(-f-theme-settings-body-font-family)`},className:y([`tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-surface-hover focus-visible:tw-outline focus-visible:!-tw-outline-offset-4`,i?`tw-bg-surface-hover`:``]),children:[(0,d.jsx)(`div`,{className:`tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:T?(0,d.jsx)(c.LoadingCircle,{size:`small`}):be(e.objectType)}),(0,d.jsxs)(`div`,{className:`tw-text-small tw-flex-1 tw-min-w-0`,children:[(0,d.jsx)(`div`,{className:`tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:e.title}),(0,d.jsx)(`div`,{className:`tw-text-secondary`,children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&(0,d.jsxs)(`div`,{"data-test-id":`attachments-actionbar`,className:y([`tw-flex tw-gap-0.5 group-hover:tw-opacity-100 group-focus-visible:tw-opacity-100 has-[:focus-visible]:tw-opacity-100`,a||_?.id===e.id?`tw-opacity-100`:`tw-opacity-0`]),children:[(0,d.jsx)(c.Button,{aspect:`square`,emphasis:`weak`,"aria-label":`Drag attachment`,className:y([i||a?`tw-cursor-grabbing`:`tw-cursor-grab`,`focus-visible:tw-z-[2]`]),...n,children:(0,d.jsx)(l.IconGrabHandle,{})}),(0,d.jsx)(`div`,{"data-test-id":`attachments-actionbar-flyout`,children:(0,d.jsxs)(c.Dropdown.Root,{open:_?.id===e.id,onOpenChange:t=>v(t?e:void 0),children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(c.Button,{aspect:`square`,emphasis:_?.id===e.id?`default`:`weak`,onPress:e=>{e?.stopPropagation(),e?.preventDefault()},children:(0,d.jsx)(l.IconPen,{size:`20`})})}),(0,d.jsxs)(c.Dropdown.Content,{side:`right`,children:[(0,d.jsxs)(c.Dropdown.Group,{children:[(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:e=>{e?.stopPropagation(),b(),v(void 0)},children:[(0,d.jsx)(l.IconArrowCircleUp,{size:`20`}),`Replace with upload`]}),(0,d.jsxs)(c.Dropdown.Item,{onSelect:e=>{e?.stopPropagation(),p(),v(void 0)},children:[(0,d.jsx)(l.IconImageStack,{size:`20`}),`Replace with asset`]})]}),(0,d.jsx)(c.Dropdown.Group,{children:(0,d.jsxs)(c.Dropdown.Item,{emphasis:`danger`,onSelect:e=>{e?.stopPropagation(),f(),v(void 0)},children:[(0,d.jsx)(l.IconTrashBin,{size:`20`}),`Delete`]})})]})]})})]})]})});xe.displayName=`AttachmentItem`;var Se=e=>{let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=(0,h.useSortable)({id:e.item.id}),s={transform:i?`translate(${i.x}px, ${i.y}px)`:``,transition:a,zIndex:o?2:1},c={...t,...n};return(0,d.jsx)(xe,{ref:r,isDragging:o,transformStyle:s,draggableProps:c,...e})},Ce=(0,u.forwardRef)(({children:e,...t},n)=>(0,d.jsxs)(c.Button,{ref:n,size:`small`,rounding:`full`,emphasis:`default`,"data-test-id":`attachments-button-trigger`,className:`tw-body-medium`,...t,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ce.displayName=`AttachmentsButtonTrigger`;var we=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:i,onUpload:a,onSorted:o,appBridge:f,triggerComponent:g=Ce,isOpen:_,onOpenChange:v})=>{let[y,b]=(0,u.useState)(e),[x,S]=(0,u.useState)(!1),C=(0,p.useSensors)((0,p.useSensor)(p.PointerSensor),(0,p.useSensor)(p.KeyboardSensor)),[w,T]=(0,u.useState)(void 0),[E,D]=(0,u.useState)(!1),[O,ee]=(0,u.useState)(!1),[k,A]=(0,u.useState)([]),[te,ne]=(0,u.useState)(null),j=(0,s.useEditorState)(f),{openAssetChooser:M,closeAssetChooser:N}=(0,s.useAssetChooser)(f),re=_!==void 0,P=re?_:x,F=y?.find(e=>e.id===w),I=e.length,L=I>0?`Open attachments, ${I} ${I===1?`attachment`:`attachments`}`:`Add attachments`,[R,{results:z,doneAll:B}]=(0,s.useAssetUpload)({onUploadProgress:()=>!E&&D(!0)}),V=e=>{(re?v:S)?.(e)};(0,u.useEffect)(()=>{b(e)},[e]),(0,u.useEffect)(()=>{te&&(D(!0),R(te))},[te]),(0,u.useEffect)(()=>{(async()=>{B&&(await a(z),D(!1))})()},[B,z]);let ie=()=>{V(!1),M(async e=>{N(),V(!0),ee(!0),await i(e),ee(!1)},{multiSelection:!0,selectedValueIds:y.map(e=>e.id)})},ae=e=>{V(!1),M(async t=>{V(!0),N(),A([...k,e.id]),await n(e,t[0]),A(k.filter(t=>t!==e.id))},{multiSelection:!1,selectedValueIds:y.map(e=>e.id)})},oe=async(e,t)=>{A([...k,e.id]),await r(e,t),A(k.filter(t=>t!==e.id))};return j||(y?.length??0)>0?(0,d.jsx)(`div`,{"data-test-id":`attachments-flyout-button`,children:(0,d.jsx)(c.Flyout.Root,{open:P,onOpenChange:e=>V(F?!0:e),children:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:500,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,"data-test-id":`attachments-button-trigger`,children:(0,d.jsx)(g,{isFlyoutOpen:P,"aria-label":L,children:(0,d.jsx)(`div`,{"aria-hidden":`true`,children:I>0?I:`Add`})})})}),(0,d.jsx)(c.Flyout.Content,{side:`bottom`,align:`end`,width:`300px`,onEscapeKeyDown:e=>{e.stopPropagation(),V(!1)},children:(0,d.jsxs)(`div`,{className:`tw-w-full`,"data-test-id":`attachments-flyout-content`,children:[y.length>0&&(0,d.jsx)(p.DndContext,{sensors:C,collisionDetection:p.closestCenter,onDragStart:e=>{let{active:t}=e;T(t.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id&&y){let e=y.findIndex(e=>e.id===t.id),r=y.findIndex(e=>e.id===n.id),i=(0,h.arrayMove)(y,e,r);b(i),o(i)}T(void 0)},modifiers:[m.restrictToParentElement],children:(0,d.jsx)(h.SortableContext,{items:y,strategy:h.rectSortingStrategy,children:(0,d.jsx)(`div`,{className:`tw-border-b tw-border-b-line tw-relative`,children:y.map(e=>(0,d.jsx)(Se,{isEditing:j,isLoading:k.includes(e.id),item:e,onDelete:()=>t(e),onReplaceWithBrowse:()=>ae(e),onReplaceWithUpload:t=>oe(e,t),onDownload:()=>f.dispatch({name:`downloadAsset`,payload:e})},e.id))})})}),j&&(0,d.jsxs)(`div`,{className:`tw-px-5 tw-py-3`,"data-test-id":`asset-input-placeholder`,children:[(0,d.jsx)(`div`,{className:`tw-font-primary tw-font-medium tw-text-primary tw-text-small tw-my-4`,children:`Add attachments`}),E||O?(0,d.jsxs)(c.AssetInput.Root,{orientation:`horizontal`,children:[(0,d.jsx)(c.AssetInput.Preview,{children:(0,d.jsx)(c.AssetInput.PreviewLoading,{})}),(0,d.jsx)(c.AssetInput.Title,{children:`Asset`}),(0,d.jsx)(c.AssetInput.Metadata,{children:(0,d.jsx)(c.AssetInput.MetadataItem,{children:(0,d.jsxs)(c.Flex,{align:`center`,gap:.5,children:[O?(0,d.jsx)(l.IconImageStack,{size:16}):(0,d.jsx)(l.IconArrowCircleUp,{size:16}),O?`Loading`:`Uploading`]})})})]}):(0,d.jsxs)(c.AssetInput.Placeholder,{children:[(0,d.jsx)(c.AssetInput.UploadInput,{allowMultiple:!0,onSelect:e=>ne(e.target.files)}),(0,d.jsx)(c.AssetInput.BrowseInput,{onBrowse:ie})]})]})]})}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:`Attachments`})]})})}):null},Te=(e,t)=>{let n=[g.FOCUS_VISIBLE_STYLE,`tw-relative tw-inline-flex tw-items-center tw-justify-center`,`tw-h-6 tw-p-1`,`tw-rounded-medium`,`tw-body-medium`,`tw-gap-0.5`,`focus-visible:tw-z-10`];return t?n.push(`tw-bg-container-secondary-active`,`tw-text-container-secondary-on-secondary-container`,e===`grab`?`tw-cursor-grabbing`:`tw-cursor-pointer`):n.push(`hover:tw-bg-container-secondary-hover active:tw-bg-container-secondary-active`,`tw-text-secondary hover:tw-text-container-secondary-on-secondary-container active:tw-text-container-secondary-on-secondary-container`,e===`grab`?`!tw-cursor-grab active:tw-cursor-grabbing`:`tw-cursor-pointer`),y(n)},U=(0,u.forwardRef)(({onClick:e,children:t,forceActiveStyle:n,cursor:r=`pointer`,"data-test-id":i=`base-toolbar-button`,...a},o)=>(0,d.jsx)(`button`,{onClick:e,className:Te(r,n),"data-test-id":i,...a,ref:o,children:t}));U.displayName=`BaseToolbarButton`;var Ee=(0,u.forwardRef)(({children:e,isFlyoutOpen:t,...n},r)=>(0,d.jsxs)(U,{forceActiveStyle:t,"data-test-id":`attachments-toolbar-button-trigger`,ref:r,...n,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ee.displayName=`AttachmentsToolbarButtonTrigger`;var De=`attachments`,Oe=({flyoutId:e=De})=>{let{appBridge:t,attachments:n,onAttachmentsAdd:r,onAttachmentDelete:i,onAttachmentReplace:a,onAttachmentsSorted:o}=ve(),{isOpen:s,onOpenChange:c}=fe(e),l=H();return(0,d.jsx)(we,{onUpload:r,onDelete:i,onReplaceWithBrowse:a,onReplaceWithUpload:a,onSorted:o,onBrowse:r,items:n,appBridge:t,triggerComponent:Ee,isOpen:s&&!l,onOpenChange:c})},ke=`Drag or press ↵ to move`,Ae=`Move with ↑↓←→ and confirm with ↵`,je=({content:e,children:t,open:n,disabled:r})=>r?t:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:300,open:n,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:t}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:(0,d.jsx)(`div`,{children:e})})]}),Me=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:r})=>{let i=H(),{activatorEvent:a}=(0,p.useDndContext)(),o=a instanceof KeyboardEvent;return(0,d.jsx)(je,{...i&&{open:o},content:(0,d.jsx)(`div`,{children:i?Ae:e??`Drag or press ↵ to move`}),children:(0,d.jsx)(U,{ref:n,"data-test-id":`block-item-wrapper-toolbar-btn`,forceActiveStyle:i,cursor:`grab`,...r,children:t})})},Ne=({content:e,icon:t,tooltip:n,flyoutId:r,flyoutFooter:i,flyoutHeader:a})=>{let{isOpen:o,onOpenChange:s}=fe(r),l=H();return(0,d.jsx)(je,{disabled:l||o,content:n,children:(0,d.jsx)(`div`,{className:`tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative`,children:(0,d.jsxs)(c.Flyout.Root,{open:o&&!l,onOpenChange:s,children:[(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,forceActiveStyle:o&&!l,children:t})}),(0,d.jsxs)(c.Flyout.Content,{side:`bottom`,align:`end`,padding:`comfortable`,children:[a?(0,d.jsx)(c.Flyout.Header,{children:a}):null,(0,d.jsx)(c.Flyout.Body,{children:e}),i?(0,d.jsx)(c.Flyout.Footer,{children:i}):null]})]})})})},Pe=`menu`,Fe=({items:e,flyoutId:t=Pe,tooltip:n=`Options`})=>{let{isOpen:r,onOpenChange:i}=fe(t),a=H();return(0,d.jsx)(c.Dropdown.Root,{open:r&&!a,onOpenChange:i,children:(0,d.jsxs)(c.Tooltip.Root,{children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Dropdown.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,children:(0,d.jsx)(l.IconDotsHorizontal,{size:`16`})})})}),(0,d.jsx)(c.Dropdown.Content,{children:e.map((e,t)=>(0,d.jsx)(c.Dropdown.Group,{children:e.map((e,n)=>(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:()=>{i(!1),e.onClick()},emphasis:e.style||`default`,children:[(0,d.jsx)(`div`,{className:`tw-mr-2`,children:e.icon}),(0,d.jsx)(`span`,{children:e.title})]},`${t}-${n}`))},t))}),(0,d.jsx)(c.Tooltip.Content,{children:n})]})})},Ie=({tooltip:e,icon:t,onClick:n})=>{let r=H();return(0,d.jsx)(je,{disabled:r,content:e??``,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-btn`,onClick:n,children:t})})},Le=({children:e})=>(0,d.jsx)(`div`,{"data-test-id":`block-item-wrapper-toolbar-segment`,className:`tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none`,children:e}),Re=({items:e,attachments:t})=>(0,d.jsxs)(`div`,{"data-test-id":`block-item-wrapper-toolbar`,className:`tw-rounded-md tw-bg-surface tw-border tw-border-line-mid tw-divide-x tw-divide-line-mid tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate`,children:[t.isEnabled&&(0,d.jsx)(Le,{children:(0,d.jsx)(Oe,{})}),e.length>0&&(0,d.jsx)(Le,{children:e.map(e=>{switch(e.type){case`dragHandle`:return(0,d.jsx)(Me,{...e},e.tooltip+e.type);case`menu`:return(0,d.jsx)(Fe,{...e},e.tooltip+e.type);case`flyout`:return(0,d.jsx)(Ne,{...e},e.tooltip+e.type);default:return(0,d.jsx)(Ie,{...e},e.tooltip+e.type)}})})]}),ze=(0,u.memo)(({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:i=!1,shouldFillContainer:a,outlineOffset:o=0,shouldBeShown:s=!1,showAttachments:c=!1})=>{let[l,f]=(0,u.useState)(s?[Pe]:[]),p=(0,u.useRef)(null);if(n)return(0,d.jsx)(d.Fragment,{children:e});let m=t?.filter(e=>e!==void 0),h=l.length>0||s;return(0,d.jsx)(ce,{isDragPreview:i,children:(0,d.jsx)(ue,{openFlyoutIds:l,setOpenFlyoutIds:f,children:(0,d.jsxs)(`div`,{ref:p,"data-test-id":`block-item-wrapper`,style:{outlineOffset:o},className:y([`tw-relative tw-group`,a&&`tw-flex-1 tw-h-full tw-w-full`,`hover:tw-outline hover:tw-outline-1 hover:tw-outline-container-highlight-on-highlight-container focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-container-highlight-on-highlight-container`,h&&`tw-outline tw-outline-1 tw-outline-container-highlight-on-highlight-container`,r&&`tw-opacity-0`]),children:[(0,d.jsx)(`div`,{style:{right:-1-o,bottom:`calc(100% - ${2+o}px)`},className:y([`tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]`,`group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100`,`tw-flex tw-justify-end`,h&&`tw-opacity-100`]),children:(0,d.jsx)(Re,{attachments:{isEnabled:c},items:m})}),e]})})})});ze.displayName=`BlockItemWrapper`;var Be=({ref:e,disabled:t,onChange:n})=>{(0,u.useEffect)(()=>{if(t||!e.current)return;let r=!1,i=new IntersectionObserver(([e])=>{e.isIntersecting!==r&&(r=e.isIntersecting,n(e.isIntersecting))});return i.observe(e.current),()=>{i.disconnect()}},[e,t,n])},Ve=(0,_.createStore)(`floatingButton`)({openEditorId:null,mouseDown:!1,updated:!1,url:``,text:``,buttonStyle:`primary`,newTab:!1,mode:``,isEditing:!1}).extendActions(e=>({reset:()=>{e.url(``),e.text(``),e.buttonStyle(`primary`),e.newTab(!1),e.mode(``),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),W=Ve.set,G=Ve.get,He=()=>Ve.use,Ue=e=>{if(!e)return!1;let t=e=>e.some(e=>e.text?e.text!==``:e.children?t(e.children):!1);try{return t(JSON.parse(e))}catch{return!1}},We=(e=`p`,t=``,n)=>Ue(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Ge=(e,t,n)=>e===B.Custom?t:n,Ke=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},qe=e=>Ke(e,e=>e.chosenLink?.searchResult?.link||``),Je=e=>Ke(e,e=>e.url||``),Ye=e=>e.url||e.chosenLink?.searchResult?.link||``,Xe=e=>Ke(e,Ye),Ze=/^\/(document|r)\/\S+$/i,Qe=e=>{if(Ze.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},$e=e=>{if(Ze.test(e))return!0;try{let t=new URL(e);return[`http:`,`https:`,`mailto:`,`tel:`].includes(t.protocol)&&t.pathname!==``}catch{return!1}},K=e=>$e(Qe(e))||e===``,et=(e,{type:t})=>{let{apply:n,normalizeNode:r}=e;return e.apply=t=>{if(t.type!==`set_selection`){n(t);return}let r=t.newProperties;if(!r?.focus||!r.anchor||!(0,_.isCollapsed)(r)){n(t);return}let i=(0,_.getAboveNode)(e,{at:r,match:{type:(0,_.getPluginType)(e,Z)}});if(i){let[,n]=i,a;(0,_.isStartPoint)(e,r.focus,n)&&(a=(0,_.getPreviousNodeEndPoint)(e,n)),(0,_.isEndPoint)(e,r.focus,n)&&(a=(0,_.getNextNodeStartPoint)(e,n)),a&&(t.newProperties={anchor:a,focus:a})}n(t)},e.normalizeNode=([t,n])=>{if(t.type===(0,_.getPluginType)(e,`button`)){let t=e.selection;if(t&&(0,_.isCollapsed)(t)&&(0,_.isEndPoint)(e,t.focus,n)){let t=(0,_.getNextNodeStartPoint)(e,n);if(t)(0,_.select)(e,t);else{let t=_.Path.next(n);(0,_.insertNodes)(e,{text:``},{at:t}),(0,_.select)(e,t)}}}r([t,n])},(0,_.withRemoveEmptyNodes)(e,(0,_.mockPlugin)({options:{types:t}}))},tt=(e,t,n)=>{(0,_.insertNodes)(e,[dt(e,t)],n)},nt=e=>{if(!e.selection)return;let{isUrl:t,forceSubmit:n}=(0,_.getPluginOptions)(e,Z),r=G.url();if(!(t?.(r)||n))return;let i=G.text(),a=G.buttonStyle(),o=G.newTab()?void 0:`_self`;return W.reset(),rt(e,{url:r,text:i,buttonStyle:a,target:o,isUrl:e=>n||!t?!0:t(e)}),setTimeout(()=>{(0,_.focusEditor)(e,e.selection??void 0)},0),!0},q=(e,t)=>(0,_.withoutNormalizing)(e,()=>{if(t?.split){if((0,_.getAboveNode)(e,{at:e.selection?.anchor,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.anchor,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.anchor}),!0;if((0,_.getAboveNode)(e,{at:e.selection?.focus,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.focus,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.focus}),!0}(0,_.unwrapNodes)(e,{match:{type:(0,_.getPluginType)(e,Z)},...t})}),rt=(e,{url:t,text:n,buttonStyle:r,target:i,insertTextInButton:a,insertNodesOptions:o,isUrl:s=(0,_.getPluginOptions)(e,Z).isUrl})=>{let c=e.selection;if(!c)return;let l=(0,_.getAboveNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,Z)}});if(a&&l)return e.insertText(t),!0;if(!s?.(t))return;if((0,_.isDefined)(n)&&n.length===0&&(n=t),l)return ot(t,e,l,i,r,n),!0;let[u,d]=(0,_.findNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,`button`)}})??[],f=it(e,d,n);if((0,_.isExpanded)(c))return at(l,e,t,r,i,n),!0;f&&(0,_.removeNodes)(e,{at:d});let p=(0,_.getNodeProps)(u??{}),m=e.selection?.focus.path;if(!m)return;let h=(0,_.getNodeLeaf)(e,m);return n?.length||(n=t),tt(e,{...p,url:t,target:i,children:[{...h,text:n}]},o),!0};function it(e,t,n){return t&&n?.length&&n!==(0,_.getEditorString)(e,t)}function at(e,t,n,r,i,a){e?q(t,{at:e[1]}):q(t,{split:!0}),ct(t,{url:n,buttonStyle:r,target:i}),st(t,{url:n,target:i,text:a})}function ot(e,t,n,r,i,a){(e!==n[0]?.url||r!==n[0]?.target||i!==n[0]?.buttonStyle)&&(0,_.setNodes)(t,{url:e,target:r,buttonStyle:i},{at:n[1]}),st(t,{url:e,text:a,target:r})}var st=(e,{text:t})=>{let n=(0,_.getAboveNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(n){let[r,i]=n;if(t?.length&&t!==(0,_.getEditorString)(e,i)){let n=r.children[0];(0,_.replaceNodeChildren)(e,{at:i,nodes:{...n,text:t},insertOptions:{select:!0}})}}},ct=(e,{url:t,buttonStyle:n,target:r,...i})=>{(0,_.wrapNodes)(e,{type:(0,_.getPluginType)(e,Z),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...i})},lt=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(n)?t(n[0]):``},ut=e=>lt(e,e=>e.url??``),dt=(e,{url:t,text:n=``,buttonStyle:r=`primary`,target:i,children:a})=>({type:(0,_.getPluginType)(e,Z),url:t,target:i,buttonStyle:r,children:a??[{text:n}]}),ft=(e,{focused:t}={})=>{if(G.mode()===`edit`){pt(e);return}mt(e,{focused:t})},pt=e=>{let t=(0,_.findNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(!t)return;let[n,r]=t,i=(0,_.getEditorString)(e,r);W.url(n.url),W.newTab(n.target===void 0),i===n.url&&(i=``),W.text(i),W.isEditing(!0)},mt=(e,{focused:t}={})=>{G.mode()||t&&((0,_.isRangeAcrossBlocks)(e,{at:e.selection})||(0,_.someNode)(e,{match:{type:(0,_.getPluginType)(e,`button`)}})||(W.text((0,_.getEditorString)(e,e.selection)),W.show(`insert`,e.id)))},ht={marginTop:`10px`,marginBottom:`10px`,display:`inline-block`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:`100%`,verticalAlign:`middle`,boxSizing:`border-box`,overflowWrap:`normal`},gt={buttonPrimary:{...ht,fontFamily:`var(--f-theme-settings-button-primary-font-family)`,fontSize:`var(--f-theme-settings-button-primary-font-size)`,fontWeight:`var(--f-theme-settings-button-primary-font-weight)`,lineHeight:`var(--f-theme-settings-button-primary-line-height)`,paddingTop:`var(--f-theme-settings-button-primary-padding-top)`,paddingRight:`var(--f-theme-settings-button-primary-padding-right)`,paddingBottom:`var(--f-theme-settings-button-primary-padding-bottom)`,paddingLeft:`var(--f-theme-settings-button-primary-padding-left)`,fontStyle:`var(--f-theme-settings-button-primary-font-style)`,textTransform:`var(--f-theme-settings-button-primary-text-transform)`,backgroundColor:`var(--f-theme-settings-button-primary-background-color)`,borderColor:`var(--f-theme-settings-button-primary-border-color)`,borderRadius:`var(--f-theme-settings-button-primary-border-radius)`,borderWidth:`var(--f-theme-settings-button-primary-border-width)`,color:`var(--f-theme-settings-button-primary-color)`,hover:{backgroundColor:`var(--f-theme-settings-button-primary-background-color-hover)`,borderColor:`var(--f-theme-settings-button-primary-border-color-hover)`,color:`var(--f-theme-settings-button-primary-color-hover)`}},buttonSecondary:{...ht,fontFamily:`var(--f-theme-settings-button-secondary-font-family)`,fontSize:`var(--f-theme-settings-button-secondary-font-size)`,fontWeight:`var(--f-theme-settings-button-secondary-font-weight)`,lineHeight:`var(--f-theme-settings-button-secondary-line-height)`,paddingTop:`var(--f-theme-settings-button-secondary-padding-top)`,paddingRight:`var(--f-theme-settings-button-secondary-padding-right)`,paddingBottom:`var(--f-theme-settings-button-secondary-padding-bottom)`,paddingLeft:`var(--f-theme-settings-button-secondary-padding-left)`,fontStyle:`var(--f-theme-settings-button-secondary-font-style)`,textTransform:`var(--f-theme-settings-button-secondary-text-transform)`,backgroundColor:`var(--f-theme-settings-button-secondary-background-color)`,borderColor:`var(--f-theme-settings-button-secondary-border-color)`,borderRadius:`var(--f-theme-settings-button-secondary-border-radius)`,borderWidth:`var(--f-theme-settings-button-secondary-border-width)`,color:`var(--f-theme-settings-button-secondary-color)`,hover:{backgroundColor:`var(--f-theme-settings-button-secondary-background-color-hover)`,borderColor:`var(--f-theme-settings-button-secondary-border-color-hover)`,color:`var(--f-theme-settings-button-secondary-color-hover)`}},buttonTertiary:{...ht,fontFamily:`var(--f-theme-settings-button-tertiary-font-family)`,fontSize:`var(--f-theme-settings-button-tertiary-font-size)`,fontWeight:`var(--f-theme-settings-button-tertiary-font-weight)`,lineHeight:`var(--f-theme-settings-button-tertiary-line-height)`,paddingTop:`var(--f-theme-settings-button-tertiary-padding-top)`,paddingRight:`var(--f-theme-settings-button-tertiary-padding-right)`,paddingBottom:`var(--f-theme-settings-button-tertiary-padding-bottom)`,paddingLeft:`var(--f-theme-settings-button-tertiary-padding-left)`,fontStyle:`var(--f-theme-settings-button-tertiary-font-style)`,textTransform:`var(--f-theme-settings-button-tertiary-text-transform)`,backgroundColor:`var(--f-theme-settings-button-tertiary-background-color)`,borderColor:`var(--f-theme-settings-button-tertiary-border-color)`,borderRadius:`var(--f-theme-settings-button-tertiary-border-radius)`,borderWidth:`var(--f-theme-settings-button-tertiary-border-width)`,color:`var(--f-theme-settings-button-tertiary-color)`,hover:{backgroundColor:`var(--f-theme-settings-button-tertiary-background-color-hover)`,borderColor:`var(--f-theme-settings-button-tertiary-border-color-hover)`,color:`var(--f-theme-settings-button-tertiary-color-hover)`}}},_t=e=>{let{attributes:t,children:n}=e,r=e.element.url||e.element.chosenLink?.searchResult?.link||``,i=e.element.target||`_self`,a=String(e.element.buttonStyle)||`primary`;return(0,d.jsx)(vt,{attributes:t,href:r,target:i,styles:gt[`button${a.charAt(0).toUpperCase()+a.slice(1)}`],children:n})},vt=({attributes:e,styles:t={hover:{}},children:n,href:r=`#`,target:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`a`,{...e,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),href:r,target:i,style:a?{...t,...t.hover}:t,children:n})},yt=class extends _.MarkupElement{constructor(e=Z,t=_t){super(e,t)}},bt=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)();return(0,d.jsx)(_.ToolbarButton,{ref:t,...e,onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},onClick:()=>{ft(n,{focused:!0})},children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconButton,{size:16})})})});bt.displayName=`ButtonToolbarButton`;var xt=({editorId:e,id:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(e)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection}),i=(0,_.getPluginType)(n,Z),a=!!n?.selection&&(0,_.someNode)(n,{match:{type:i}});return(0,d.jsx)(`div`,{"data-plugin-id":t,children:(0,d.jsx)(bt,{pressed:a,disabled:!r,tooltip:(0,_.getTooltip)(r?`Button\n${(0,_.getHotkeyByPlatform)(`Ctrl+Shift+K`)}`:`Buttons can only be set for a single text block.`)})})},J=`link-plugin`,Y=function(e){return e.heading1=`heading1`,e.heading2=`heading2`,e.heading3=`heading3`,e.heading4=`heading4`,e.custom1=`custom1`,e.custom2=`custom2`,e.custom3=`custom3`,e.quote=`quote`,e.imageCaption=`imageCaption`,e.imageTitle=`imageTitle`,e.p=`p`,e}({}),X={heading1:{fontSize:`var(--f-theme-settings-heading1-font-size)`,lineHeight:`var(--f-theme-settings-heading1-line-height)`,marginTop:`var(--f-theme-settings-heading1-margin-top)`,marginBottom:`var(--f-theme-settings-heading1-margin-bottom)`,textDecoration:`var(--f-theme-settings-heading1-text-decoration)`,fontStyle:`var(--f-theme-settings-heading1-font-style)`,textTransform:`var(--f-theme-settings-heading1-text-transform)`,letterSpacing:`var(--f-theme-settings-heading1-letter-spacing)`,fontWeight:`var(--f-theme-settings-heading1-font-weight)`,fontFamily:`var(--f-theme-settings-heading1-font-family)`,color:`var(--f-theme-settings-heading1-color)`},heading2:{fontSize:`var(--f-theme-settings-heading2-font-size)`,lineHeight:`var(--f-theme-settings-heading2-line-height)`,marginTop:`var(--f-theme-settings-heading2-margin-top)`,marginBottom:`var(--f-theme-settings-heading2-margin-bottom)`,textDecoration:`var(--f-theme-settings-heading2-text-decoration)`,fontStyle:`var(--f-theme-settings-heading2-font-style)`,textTransform:`var(--f-theme-settings-heading2-text-transform)`,letterSpacing:`var(--f-theme-settings-heading2-letter-spacing)`,fontWeight:`var(--f-theme-settings-heading2-font-weight)`,fontFamily:`var(--f-theme-settings-heading2-font-family)`,color:`var(--f-theme-settings-heading2-color)`},heading3:{fontSize:`var(--f-theme-settings-heading3-font-size)`,lineHeight:`var(--f-theme-settings-heading3-line-height)`,marginTop:`var(--f-theme-settings-heading3-margin-top)`,marginBottom:`var(--f-theme-settings-heading3-margin-bottom)`,textDecoration:`var(--f-theme-settings-heading3-text-decoration)`,fontStyle:`var(--f-theme-settings-heading3-font-style)`,textTransform:`var(--f-theme-settings-heading3-text-transform)`,letterSpacing:`var(--f-theme-settings-heading3-letter-spacing)`,fontWeight:`var(--f-theme-settings-heading3-font-weight)`,fontFamily:`var(--f-theme-settings-heading3-font-family)`,color:`var(--f-theme-settings-heading3-color)`},heading4:{fontSize:`var(--f-theme-settings-heading4-font-size)`,lineHeight:`var(--f-theme-settings-heading4-line-height)`,marginTop:`var(--f-theme-settings-heading4-margin-top)`,marginBottom:`var(--f-theme-settings-heading4-margin-bottom)`,textDecoration:`var(--f-theme-settings-heading4-text-decoration)`,fontStyle:`var(--f-theme-settings-heading4-font-style)`,textTransform:`var(--f-theme-settings-heading4-text-transform)`,letterSpacing:`var(--f-theme-settings-heading4-letter-spacing)`,fontWeight:`var(--f-theme-settings-heading4-font-weight)`,fontFamily:`var(--f-theme-settings-heading4-font-family)`,color:`var(--f-theme-settings-heading4-color)`},custom1:{fontSize:`var(--f-theme-settings-custom1-font-size)`,lineHeight:`var(--f-theme-settings-custom1-line-height)`,marginTop:`var(--f-theme-settings-custom1-margin-top)`,marginBottom:`var(--f-theme-settings-custom1-margin-bottom)`,textDecoration:`var(--f-theme-settings-custom1-text-decoration)`,fontStyle:`var(--f-theme-settings-custom1-font-style)`,textTransform:`var(--f-theme-settings-custom1-text-transform)`,letterSpacing:`var(--f-theme-settings-custom1-letter-spacing)`,fontWeight:`var(--f-theme-settings-custom1-font-weight)`,fontFamily:`var(--f-theme-settings-custom1-font-family)`,color:`var(--f-theme-settings-custom1-color)`},custom2:{fontSize:`var(--f-theme-settings-custom2-font-size)`,lineHeight:`var(--f-theme-settings-custom2-line-height)`,marginTop:`var(--f-theme-settings-custom2-margin-top)`,marginBottom:`var(--f-theme-settings-custom2-margin-bottom)`,textDecoration:`var(--f-theme-settings-custom2-text-decoration)`,fontStyle:`var(--f-theme-settings-custom2-font-style)`,textTransform:`var(--f-theme-settings-custom2-text-transform)`,letterSpacing:`var(--f-theme-settings-custom2-letter-spacing)`,fontWeight:`var(--f-theme-settings-custom2-font-weight)`,fontFamily:`var(--f-theme-settings-custom2-font-family)`,color:`var(--f-theme-settings-custom2-color)`},custom3:{fontSize:`var(--f-theme-settings-custom3-font-size)`,lineHeight:`var(--f-theme-settings-custom3-line-height)`,marginTop:`var(--f-theme-settings-custom3-margin-top)`,marginBottom:`var(--f-theme-settings-custom3-margin-bottom)`,textDecoration:`var(--f-theme-settings-custom3-text-decoration)`,fontStyle:`var(--f-theme-settings-custom3-font-style)`,textTransform:`var(--f-theme-settings-custom3-text-transform)`,letterSpacing:`var(--f-theme-settings-custom3-letter-spacing)`,fontWeight:`var(--f-theme-settings-custom3-font-weight)`,fontFamily:`var(--f-theme-settings-custom3-font-family)`,color:`var(--f-theme-settings-custom3-color)`},p:{fontSize:`var(--f-theme-settings-body-font-size)`,lineHeight:`var(--f-theme-settings-body-line-height)`,marginTop:`var(--f-theme-settings-body-margin-top)`,marginBottom:`var(--f-theme-settings-body-margin-bottom)`,textDecoration:`var(--f-theme-settings-body-text-decoration)`,fontStyle:`var(--f-theme-settings-body-font-style)`,textTransform:`var(--f-theme-settings-body-text-transform)`,letterSpacing:`var(--f-theme-settings-body-letter-spacing)`,fontWeight:`var(--f-theme-settings-body-font-weight)`,fontFamily:`var(--f-theme-settings-body-font-family)`,color:`var(--f-theme-settings-body-color)`},quote:{fontSize:`var(--f-theme-settings-quote-font-size)`,lineHeight:`var(--f-theme-settings-quote-line-height)`,marginTop:`var(--f-theme-settings-quote-margin-top)`,marginBottom:`var(--f-theme-settings-quote-margin-bottom)`,textDecoration:`var(--f-theme-settings-quote-text-decoration)`,fontStyle:`var(--f-theme-settings-quote-font-style)`,textTransform:`var(--f-theme-settings-quote-text-transform)`,letterSpacing:`var(--f-theme-settings-quote-letter-spacing)`,fontWeight:`var(--f-theme-settings-quote-font-weight)`,fontFamily:`var(--f-theme-settings-quote-font-family)`,color:`var(--f-theme-settings-quote-color)`},imageCaption:{fontSize:`var(--f-theme-settings-image-caption-font-size)`,lineHeight:`var(--f-theme-settings-image-caption-line-height)`,marginTop:`var(--f-theme-settings-image-caption-margin-top)`,marginBottom:`var(--f-theme-settings-image-caption-margin-bottom)`,textDecoration:`var(--f-theme-settings-image-caption-text-decoration)`,fontStyle:`var(--f-theme-settings-image-caption-font-style)`,textTransform:`var(--f-theme-settings-image-caption-text-transform)`,letterSpacing:`var(--f-theme-settings-image-caption-letter-spacing)`,fontWeight:`var(--f-theme-settings-image-caption-font-weight)`,fontFamily:`var(--f-theme-settings-image-caption-font-family)`,color:`var(--f-theme-settings-image-caption-color)`},imageTitle:{fontSize:`var(--f-theme-settings-image-title-font-size)`,lineHeight:`var(--f-theme-settings-image-title-line-height)`,marginTop:`var(--f-theme-settings-image-title-margin-top)`,marginBottom:`var(--f-theme-settings-image-title-margin-bottom)`,textDecoration:`var(--f-theme-settings-image-title-text-decoration)`,fontStyle:`var(--f-theme-settings-image-title-font-style)`,textTransform:`var(--f-theme-settings-image-title-text-transform)`,letterSpacing:`var(--f-theme-settings-image-title-letter-spacing)`,fontWeight:`var(--f-theme-settings-image-title-font-weight)`,fontFamily:`var(--f-theme-settings-image-title-font-family)`,color:`var(--f-theme-settings-image-title-color)`},[J]:{fontSize:`var(--f-theme-settings-link-font-size)`,lineHeight:`var(--f-theme-settings-link-line-height)`,marginTop:`var(--f-theme-settings-link-margin-top)`,marginBottom:`var(--f-theme-settings-link-margin-bottom)`,textDecoration:`var(--f-theme-settings-link-text-decoration)`,fontStyle:`var(--f-theme-settings-link-font-style)`,textTransform:`var(--f-theme-settings-link-text-transform)`,letterSpacing:`var(--f-theme-settings-link-letter-spacing)`,fontWeight:`var(--f-theme-settings-link-font-weight)`,fontFamily:`var(--f-theme-settings-link-font-family)`,color:`var(--f-theme-settings-link-color)`},...gt},St=()=>{let e=(0,_.useEditorRef)();return(0,d.jsx)(_.FloatingModalWrapper,{padding:`16px`,minWidth:`400px`,"data-test-id":`floating-button-edit`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-button-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-button-edit-url`,href:G.url(),target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:G.url()}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{onClick:()=>{pt(e)},tabIndex:0,"data-test-id":`edit-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{onClick:()=>{q(e),(0,_.focusEditor)(e,e.selection??void 0)},tabIndex:0,"data-test-id":`remove-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},Ct=e=>e.filter(e=>!!e.title?.trim()),wt=()=>(0,d.jsx)(`div`,{className:`tw-flex tw-justify-center tw-h-10 tw-items-center`,children:(0,d.jsx)(c.LoadingCircle,{size:`small`})}),Tt=({section:e,selectedUrl:t,onSelectUrl:n})=>{let r=e.permanentLink===t;return(0,d.jsx)(`button`,{"data-test-id":`internal-link-selector-section-link`,type:`button`,"data-is-active":r,className:`
3
2
  tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full
4
- ${r?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(k.IconDocumentText,{size:16}),s.jsx("span",{className:"tw-text-small",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Section"})]})})},fs=({page:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i})=>{const[a,c]=u.useState(t.id===r.documentId),[d,l]=u.useState([]),f=t.permanentLink===e;u.useEffect(()=>{(async()=>{const p=await i(t.id),b=He(p);l(b)})()},[t.id,i]),u.useEffect(()=>{t.id===r.pageId&&c(!0)},[r,t.id]);const x=d.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","data-test-id":"internal-link-selector-page-link",className:`
3
+ ${r?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover`:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container`}`,onClick:()=>n(e.permanentLink),children:(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6`,children:[(0,d.jsx)(l.IconDocumentText,{size:16}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Section`})]})})},Et=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i})=>{let[a,o]=(0,u.useState)(e.id===r.documentId),[s,c]=(0,u.useState)([]),l=e.permanentLink===t;(0,u.useEffect)(()=>{(async()=>{let t=Ct(await i(e.id));c(t)})()},[e.id,i]),(0,u.useEffect)(()=>{e.id===r.pageId&&o(!0)},[r,e.id]);let f=s.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,"data-test-id":`internal-link-selector-page-link`,className:`
5
4
  tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full
6
- ${x?"tw-pl-7 ":"tw-pl-12 "}
7
- ${f?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover ":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container "}`,onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[x&&s.jsx("button",{type:"button",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>c(!a),onKeyDown:h=>h.key==="Enter"&&h.stopPropagation(),children:s.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
8
- ${a?"tw-rotate-90 ":""}`})}),s.jsx("span",{className:"tw-text-small",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Page"})]},t.id)}),a&&d.length>0&&d.map(h=>s.jsx(ps,{section:h,selectedUrl:e,onSelectUrl:n},h.id))]})},xs=({documentId:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{const[c,d]=u.useState([]),[l,f]=u.useState(!0),x=[...c.values()],h=!l&&x.length>0;return u.useEffect(()=>{a(t).then(p=>{const b=p.filter(S=>!!S.category).sort((S,B)=>S.category.sort===B.category.sort?S.sort-B.sort:S.category.sort-B.category.sort),y=p.filter(S=>!S.category).sort((S,B)=>S.sort-B.sort);d([...b,...y])}).finally(()=>{f(!1)})},[]),l?s.jsx(ze,{}):h?s.jsx(s.Fragment,{children:x.map(p=>s.jsx(fs,{page:p,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i},p.id))}):s.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary",children:"This document does not contain any pages."})},ws=({document:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{const[c,d]=u.useState(t.id===r.documentId),l=t.permanentLink===e;return u.useEffect(()=>{t.id===r.documentId&&d(!0)},[r,t.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button","data-test-id":"internal-link-selector-document-link",className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full ${l?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,onClick:()=>n(t.permanentLink),children:[s.jsx("button",{type:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>d(!c),onKeyDown:f=>f.key==="Enter"&&f.stopPropagation(),children:s.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong ${c?"tw-rotate-90":""}`})}),s.jsx(k.IconColorFan,{size:16}),s.jsx("span",{className:"tw-text-small",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Document"})]}),c&&s.jsx(xs,{documentId:t.id,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})]})},ys=({selectedUrl:t,onSelectUrl:e,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:i})=>{const[a,c]=u.useState(!0),[d,l]=u.useState([]),[f,x]=u.useState({documentId:void 0,pageId:void 0});u.useEffect(()=>{t&&d.length>0&&h().then(p=>{x(p)})},[d.length]),u.useEffect(()=>{n().then(p=>{l(p)}).finally(()=>{c(!1)})},[]);const h=async()=>{const p={documentId:void 0,pageId:void 0};if(d.find(y=>y.permanentLink===t))return p;for(const y of d){const S=await r(y.id);if(!!S.find(N=>N.permanentLink===t))return p.documentId=y.id,p;for(const N of S){const A=await i(N.id);if(!!He(A).find(X=>X.permanentLink===t))return p.documentId=y.id,p.pageId=N.id,p}}return p};return a?s.jsx(ze,{}):s.jsx(s.Fragment,{children:d.map(p=>s.jsx(ws,{document:p,selectedUrl:t,onSelectUrl:e,itemsToExpandInitially:f,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:r},p.id))})},Ve=({url:t,onUrlChange:e,buttonSize:n="medium",getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})=>{const[c,d]=u.useState(!1),[l,f]=u.useState(t),x=y=>{f(y)},h=y=>{y.key==="Enter"&&(y.preventDefault(),p())};u.useEffect(()=>{t&&!l&&f(t)},[t,l]);const p=()=>{e?.(l),d(!1)},b={onOpenAutoFocus:()=>{},showUnderlay:!0,"data-is-underlay":!0,minWidth:"800px"};return s.jsx("div",{onPointerDown:y=>{y.preventDefault()},"data-test-id":"internal-link-selector",onKeyDown:h,children:s.jsxs(g.Dialog.Root,{modal:!0,open:c,onOpenChange:d,children:[s.jsx(g.Dialog.Trigger,{asChild:!0,children:s.jsxs(g.Button,{size:n,emphasis:"default",children:[s.jsx(k.IconLink,{size:"20"}),"Internal link"]})}),s.jsxs(g.Dialog.Content,{...b,children:[s.jsx(g.Dialog.Header,{children:s.jsx(g.Dialog.Title,{children:"Select internal link"})}),s.jsx(g.Dialog.Body,{padding:"none",children:s.jsx(g.ScrollArea,{padding:"compact",children:s.jsx(ys,{selectedUrl:l,onSelectUrl:x,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})})}),s.jsxs(g.Dialog.Footer,{children:[s.jsx(g.Button,{size:n,emphasis:"default",onPress:()=>d(!1),children:"Cancel"}),s.jsx(g.Button,{size:n,disabled:!l,emphasis:"strong",onPress:()=>p(),children:"Choose"})]})]})]})})},$e=({onUrlChange:t,onToggleTab:e,isValidUrlOrEmpty:n,appBridge:r,placeholder:i,newTab:a,url:c="",required:d,info:l,label:f,buttonSize:x,hideInternalLinkButton:h})=>{const p=n?n(c):st(c);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(bt.FormControl,{label:{children:f,htmlFor:"url",required:d,tooltip:l?{content:l,position:"top"}:void 0},children:s.jsx(g.TextInput,{"data-test-id":"text-input",id:"url",value:c,onChange:b=>t?.(b.target.value),placeholder:i??"https://example.com"})}),!p&&s.jsx("div",{className:"tw-text-error tw-mt-1 tw-text-small",children:"Please enter a valid URL."}),!h&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(Ve,{url:c,onUrlChange:t,buttonSize:x??"medium",getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:b=>r.getDocumentPagesByDocumentId(b),getDocumentSectionsByDocumentPageId:b=>r.getDocumentSectionsByDocumentPageId(b)})}),s.jsxs("div",{className:"tw-mt-3 tw-flex tw-items-center tw-gap-1.5",children:[s.jsx(g.Checkbox,{id:"new-tab",value:a,onChange:()=>e?.(!a)}),s.jsx(g.Label,{id:"new-tab-label",htmlFor:"new-tab",className:"tw-whitespace-nowrap",children:"Open in new tab"})]})]})},We=({state:t,onTextChange:e,onUrlChange:n,onToggleTab:r,onCancel:i,onSave:a,isValidUrlOrEmpty:c,hasValues:d,testId:l,appBridge:f,children:x})=>s.jsxs(o.FloatingModalWrapper,{"data-test-id":l,padding:"28px",minWidth:"400px",children:[s.jsx(bt.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(g.TextInput,{id:"linkText",value:t.text,placeholder:"Link Text",onChange:h=>e(h.target.value)})}),x,s.jsx("div",{className:"tw-mt-5",children:s.jsx($e,{url:t.url,newTab:t.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:c,appBridge:f})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(g.Button,{"data-test-id":"button",onPress:i,size:"medium",emphasis:"default",children:"Cancel"}),s.jsxs(g.Button,{"data-test-id":"button",onPress:a,size:"medium",disabled:!c(t?.url)||!d,children:[s.jsx(k.IconCheckMark,{size:"20"}),"Save"]})]})})]}),bs=t=>{const e=o.getAboveNode(t,{match:{type:T}});return Array.isArray(e)&&e[0]?.buttonStyle||"primary"},vs={url:"",text:"",buttonStyle:"primary",newTab:!1},Cs=()=>{const[t,e]=u.useReducer((n,r)=>{const{type:i,payload:a}=r;switch(i){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...a};default:return n}},vs);return[t,e]},Ss=()=>{const t=o.useEditorRef(),[e,n]=Cs();u.useEffect(()=>{const h=bs(t);n({type:"INIT",payload:{text:E.text()||E.url(),buttonStyle:h,newTab:!!E.newTab(),url:E.url()}})},[n,t]);const r=h=>{n({type:"TEXT",payload:{text:h}})},i=h=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:h}})},a=h=>{n({type:"URL",payload:{url:h}})},c=h=>{n(h?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.reset()},l=h=>{if(!st(e.url)||!f)return;const p=St(e.url);I.text(e.text),I.url(p),I.buttonStyle(e.buttonStyle),I.newTab(e.newTab),Yt(t)&&h?.preventDefault()},f=e.url!==""&&e.text!=="",{appBridge:x}=o.getPluginOptions(t,T);return o.useHotkeys("enter",l,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onButtonStyleChange:i,onUrlChange:a,onToggleTab:c,onCancel:d,onSave:l,hasValues:f,isValidUrlOrEmpty:st,appBridge:x}},ks=()=>{const t=Ss(),{state:e,onButtonStyleChange:n}=t;return s.jsx(We,{...t,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(bt.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(Nt,{id:"primary",styles:P.buttonPrimary,isActive:e.buttonStyle==="primary",onClick:()=>n("primary"),children:e.text||"Primary Button"}),s.jsx(Nt,{id:"secondary",styles:P.buttonSecondary,isActive:e.buttonStyle==="secondary",onClick:()=>n("secondary"),children:e.text||"Secondary Button"}),s.jsx(Nt,{id:"tertiary",styles:P.buttonTertiary,isActive:e.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:e.text||"Tertiary Button"})]})})})},Nt=({id:t,styles:e,isActive:n,onClick:r,children:i})=>{const[a,c]=u.useState(!1),d=()=>e&&e.hover&&a?{...e,...e.hover}:e;return s.jsx("button",{"data-test-id":`floating-button-insert-${t}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:r,style:{...d(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:i})},ae={placement:"bottom-start",strategy:"absolute",middleware:[o.offset(12),o.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Ts=()=>{const{ref:t,...e}=js(ae),{ref:n,...r}=Ps(ae),i=o.useEditorRef(),a=ut(),c=a.isOpen(i.id),d=a.isEditing(),l=a.mode(),f=s.jsx(ks,{}),x=d?f:s.jsx(hs,{});return s.jsxs(s.Fragment,{children:[c&&l==="insert"&&xt.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:t,...e,style:{...e.style,...P[o.TextStyles.p]},children:f}),document.body),c&&l==="edit"&&xt.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...P[o.TextStyles.p]},children:x}),document.body)]})},T="button",qe="button-plugin",Ge=t=>o.createPluginFactory({key:T,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:Le,renderAfterEditable:Ts,options:{isUrl:kt,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:t},then:(e,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Ke extends o.Plugin{styles={};appBridge;constructor({styles:e=Pt,...n}){super(qe,{button:ms,markupElement:new gs,...n}),this.styles=e,this.appBridge=n?.appBridge}plugins(){return[Ge(this.appBridge)]}}const Ps=t=>{const e=o.useEditorRef(),n=ut().mode(),r=ut().isOpen(e.id),i=o.useEditorVersion(),{triggerFloatingButtonHotkeys:a}=o.getPluginOptions(e,T),c=u.useCallback(()=>{const h=o.getAboveNode(e,{match:{type:o.getPluginType(e,T)}});if(h){const[,p]=h;return o.getRangeBoundingClientRect(e,{anchor:o.getStartPoint(e,p),focus:o.getEndPoint(e,p)})}return o.getDefaultBoundingClientRect()},[e]),d=r&&n==="edit",{update:l,style:f,floating:x}=Qe({open:d,getBoundingClientRect:c,...t});return u.useEffect(()=>{const h=Fe(e);if(h&&I.url(h),e.selection&&o.someNode(e,{match:{type:o.getPluginType(e,T)}})){I.show("edit",e.id),l();return}E.mode()==="edit"&&I.reset()},[e,i,l]),o.useHotkeys(a,h=>{h.preventDefault(),E.mode()==="edit"&&Tt(e)},{enableOnContentEditable:!0},[]),Is(),Ye(),{style:f,ref:o.useComposedRef(x)}},Is=()=>{const t=o.useEditorRef();o.useHotkeys("*",e=>{e.key==="Enter"&&Yt(t)&&e.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Ye=()=>{const t=o.useEditorRef();o.useHotkeys("escape",()=>{if(E.mode()==="edit"){if(E.isEditing()){I.show("edit",t.id),o.focusEditor(t,t.selection??void 0);return}I.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},js=t=>{const e=o.useEditorRef(),n=o.useFocused(),r=ut().mode(),i=ut().isOpen(e.id),{triggerFloatingButtonHotkeys:a}=o.getPluginOptions(e,T);o.useHotkeys(a,f=>{f.preventDefault(),Xt(e,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:c,style:d,floating:l}=Qe({open:i&&r==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...t});return u.useEffect(()=>{i&&c(),I.updated(i)},[i,c]),Ye(),{style:d,ref:o.useComposedRef(l)}},Es=12,Bs=-22,Ns=96,Qe=t=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Es,alignmentAxis:Bs}),o.flip({padding:Ns})],...t}),At="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",As="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",le={1:"tw-columns-1",2:`tw-columns-1 @sm:!tw-columns-2 ${As}`,3:`tw-columns-1 @md:!tw-columns-3 ${At}`,4:`tw-columns-1 @md:!tw-columns-4 ${At}`,5:`tw-columns-1 @md:!tw-columns-5 ${At}`},Xe=t=>t?le[t]||le[1]:"",Ls=({value:t="",gap:e,customClass:n,show:r=!0,plugins:i})=>{const[a,c]=u.useState(null);return u.useEffect(()=>{(async()=>{const l=await o.serializeRawToHtmlAsync(t,i,void 0,e,n);c(l)})().catch(console.error)},[t,e,i,n]),!r||a==="<br />"||a===null?null:s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:a}})},Rs=t=>{E.isOpen(t)&&I.reset()},Je=u.memo(({isEnabled:t,value:e,columns:n,gap:r,placeholder:i,plugins:a,onTextChange:c,showSerializedText:d})=>{const l=Xe(n),[f,x]=u.useState(!1),h=u.useId(),p=u.useCallback(y=>{y!==e&&c?.(y),x(!1)},[c,e]),b=u.useCallback(()=>x(!0),[]);return u.useEffect(()=>{const y=S=>{S.preventDefault(),S.returnValue="Unprocessed changes"};return f&&window.addEventListener("beforeunload",y),()=>window.removeEventListener("beforeunload",y)},[f]),t?s.jsx(o.RichTextEditor,{id:h,value:e,border:!1,placeholder:i,plugins:a,onValueChanged:b,onTextChange:p,hideExternalFloatingModals:Rs,placeholderOpacity:"high"}):s.jsx(Ls,{value:e,gap:r,customClass:l,show:d,plugins:a})});Je.displayName="InternalRichTextEditor";const Ds=t=>{const e=u.useRef(null),[n,r]=u.useState(!1),{isEditing:i,...a}=t,c=u.useCallback(d=>{d&&r(!0)},[]);return ts({ref:e,disabled:!i,onChange:c}),u.useEffect(()=>{i||r(!1)},[i]),s.jsx("div",{"data-test-id":"rich-text-editor-container",className:"tw-block tw-w-full tw-@container",ref:e,children:s.jsx(Je,{...a,isEnabled:i&&n})})},Ms=({editButtonProps:t,unlinkButtonProps:e})=>{const{element:n}=o.useLinkOpenButtonState(),r=n?Gt(n):"";return s.jsx(o.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[s.jsx("a",{"data-test-id":"floating-link-edit-url",href:r,target:"_blank",rel:"noopener noreferrer",style:P[rt],className:"tw-break-all",children:r}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...t,children:s.jsx(k.IconPen,{size:16})}),s.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...e,children:s.jsx(k.IconTrashBin,{size:16})})]})]})})},Ze=(t,e)=>{const n=o.getAboveNode(t,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Fs=t=>Ze(t,e=>e.chosenLink?.searchResult?.link||""),Os=t=>Ze(t,e=>e.url||""),_s={url:"",text:"",newTab:!1},Us=()=>{const[t,e]=u.useReducer((n,r)=>{const{type:i,payload:a}=r;switch(i){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"INIT":return{...n,...a};default:return n}},_s);return[t,e]},Hs=()=>{const t=o.useEditorRef(),[e,n]=Us();u.useEffect(()=>{const x=Fs(t),h=Os(t),p=o.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:o.floatingLinkSelectors.text()||o.floatingLinkSelectors.url(),newTab:p,url:x&&h===""?x:o.floatingLinkSelectors.url()}})},[n,t]);const r=x=>{n({type:"TEXT",payload:{text:x}})},i=x=>{n({type:"URL",payload:{url:x}})},a=x=>{n(x?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{o.floatingLinkActions.reset()},d=x=>{!st(e.url)||!l||(o.floatingLinkActions.text(e.text),o.floatingLinkActions.url(St(e.url)),o.floatingLinkActions.newTab(e.newTab),o.submitFloatingLink(t)&&x?.preventDefault())},l=e.url!==""&&e.text!=="",{appBridge:f}=o.getPluginOptions(t,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onUrlChange:i,onToggleTab:a,onCancel:c,onSave:d,hasValues:l,isValidUrlOrEmpty:st,appBridge:f}},zs=()=>s.jsx(We,{...Hs(),testId:"floating-link-insert"}),ce={placement:"bottom-start",strategy:"absolute",middleware:[o.offset(12),o.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Vs=()=>{const t=o.useFloatingLinkInsertState({floatingOptions:ce}),{props:e,ref:n,hidden:r}=o.useFloatingLinkInsert(t),i=o.useFloatingLinkEditState({floatingOptions:ce}),{props:a,ref:c,editButtonProps:d,unlinkButtonProps:l}=o.useFloatingLinkEdit(i);if(r)return null;const f=s.jsx(zs,{}),x=i.isEditing?f:s.jsx(Ms,{editButtonProps:d,unlinkButtonProps:l});return s.jsxs(s.Fragment,{children:[t.isOpen&&!i.isOpen&&xt.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:n,...e,style:{...e.style,...P[w.p]},children:f}),document.body),i.isOpen&&xt.createPortal(s.jsx("div",{"data-is-underlay":!0,ref:c,...a,style:{...a.style,...P[w.p]},children:x}),document.body)]})},tn=u.forwardRef((t,e)=>{const n=o.useEditorRef(),r=o.useLinkToolbarButtonState(),{props:i}=o.useLinkToolbarButton(r);return s.jsx(o.ToolbarButton,{onMouseDown:a=>{a.preventDefault(),o.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:e,...i,...t,children:s.jsx(o.IconStylingWrapper,{icon:s.jsx(k.IconLink,{size:16})})})});tn.displayName="LinkToolbarButton";const $s=({id:t,editorId:e})=>{const n=o.useEditorState(o.useEventPlateId(e)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":t,children:s.jsx(tn,{disabled:!r,tooltip:o.getTooltip(r?`Link
9
- ${o.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},Ws=t=>{const{attributes:e,children:n}=t,{styles:r}=o.useRichTextEditorContext(),i=t.element.url||t.element.chosenLink?.searchResult?.link||"",a=t.element.target||"_self";return s.jsx("a",{...e,href:i,target:a,style:r[rt],children:n})};class qs extends o.MarkupElement{constructor(e=o.ELEMENT_LINK,n=Ws){super(e,n)}}const en=t=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Vs,options:{isUrl:kt,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class nn extends o.Plugin{styles={};appBridge;constructor({styles:e=P[rt],...n}){super(rt,{button:$s,markupElement:new qs,...n}),this.styles=e,this.appBridge=n.appBridge}plugins(){return[en(this.appBridge)]}}const Gs="breakAfterColumn",sn="normal";class Ks extends o.Plugin{columns;gap;customClass;constructor(e){super("break-after-plugin",{button:o.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??sn,this.customClass=Xe(this.columns)}plugins(){return[o.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const Ys="textstyle-custom1-plugin";class on extends o.Plugin{styles={};constructor({styles:e=P.custom1,...n}={}){super(w.custom1,{label:"Custom 1",markupElement:new Qs,...n}),this.styles=e}plugins(){return[Xs(this.styles)]}}class Qs extends o.MarkupElement{constructor(e=Ys,n=rn){super(e,n)}}const rn=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,style:r,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),children:n})},Xs=t=>o.createPluginFactory({key:w.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:w.custom1}]}})({component:e=>s.jsx(rn,{...e,styles:t})}),Js="textstyle-custom2-plugin";class an extends o.Plugin{styles={};constructor({styles:e=P.custom2,...n}={}){super(w.custom2,{label:"Custom 2",markupElement:new Zs,...n}),this.styles=e}plugins(){return[to(this.styles)]}}class Zs extends o.MarkupElement{constructor(e=Js,n=ln){super(e,n)}}const ln=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},to=t=>o.createPluginFactory({key:w.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:w.custom2}]}})({component:e=>s.jsx(ln,{...e,styles:t})}),eo="textstyle-custom3-plugin";class cn extends o.Plugin{styles={};constructor({styles:e=P.custom3,...n}={}){super(o.TextStyles.custom3,{label:"Custom 3",markupElement:new no,...n}),this.styles=e}plugins(){return[so(this.styles)]}}class no extends o.MarkupElement{constructor(e=eo,n=dn){super(e,n)}}const dn=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},so=t=>o.createPluginFactory({key:o.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:o.TextStyles.custom3}]}})({component:e=>s.jsx(dn,{...e,styles:t})}),oo="textstyle-heading1-plugin";class un extends o.Plugin{styles={};constructor({styles:e=P.heading1,...n}={}){super(w.heading1,{label:"Heading 1",markupElement:new ro,...n}),this.styles=e}plugins(){return[io(this.styles)]}}class ro extends o.MarkupElement{constructor(e=oo,n=Lt){super(e,n)}}const Lt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h1",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},io=t=>o.createPluginFactory({key:w.heading1,isElement:!0,component:Lt,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>s.jsx(Lt,{...e,styles:t})}),ao="textstyle-heading2-plugin";class gn extends o.Plugin{styles={};constructor({styles:e=P.heading2,...n}={}){super(w.heading2,{label:"Heading 2",markupElement:new lo,...n}),this.styles=e}plugins(){return[co(this.styles)]}}class lo extends o.MarkupElement{constructor(e=ao,n=Rt){super(e,n)}}const Rt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h2",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},co=t=>o.createPluginFactory({key:w.heading2,isElement:!0,component:Rt,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>s.jsx(Rt,{...e,styles:t})}),uo="textstyle-heading3-plugin";class mn extends o.Plugin{styles={};constructor({styles:e=P.heading3,...n}={}){super(w.heading3,{label:"Heading 3",markupElement:new go,...n}),this.styles=e}plugins(){return[mo(this.styles)]}}class go extends o.MarkupElement{constructor(e=uo,n=Dt){super(e,n)}}const Dt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h3",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},mo=t=>o.createPluginFactory({key:w.heading3,isElement:!0,component:Dt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>s.jsx(Dt,{...e,styles:t})}),ho="textstyle-heading4-plugin";class hn extends o.Plugin{styles={};constructor({styles:e=P.heading4,...n}={}){super(w.heading4,{label:"Heading 4",markupElement:new po,...n}),this.styles=e}plugins(){return[fo(this.styles)]}}class po extends o.MarkupElement{constructor(e=ho,n=Mt){super(e,n)}}const Mt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("h4",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},fo=t=>o.createPluginFactory({key:w.heading4,isElement:!0,component:Mt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>s.jsx(Mt,{...e,styles:t})}),xo="textstyle-imageCaption-plugin";class pn extends o.Plugin{styles={};constructor({styles:e=P.imageCaption,...n}={}){super(w.imageCaption,{label:"Image Caption",markupElement:new wo,...n}),this.styles=e}plugins(){return[yo(this.styles)]}}class wo extends o.MarkupElement{constructor(e=xo,n=Ft){super(e,n)}}const Ft=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},yo=t=>o.createPluginFactory({key:w.imageCaption,isElement:!0,component:Ft,deserializeHtml:{rules:[{validClassName:w.imageCaption}]}})({component:e=>s.jsx(Ft,{...e,styles:t})}),bo="textstyle-imageTitle-plugin";class fn extends o.Plugin{styles={};constructor({styles:e=P.imageTitle,...n}={}){super(w.imageTitle,{label:"Image Title",markupElement:new vo,...n}),this.styles=e}plugins(){return[Co(this.styles)]}}class vo extends o.MarkupElement{constructor(e=bo,n=Ot){super(e,n)}}const Ot=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("p",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Co=t=>o.createPluginFactory({key:w.imageTitle,isElement:!0,component:Ot,deserializeHtml:{rules:[{validClassName:w.imageTitle}]}})({component:e=>s.jsx(Ot,{...e,styles:t})});class xn extends o.Plugin{styles={};constructor({styles:e=P.p,...n}={}){super(w.p,{markupElement:new yn,label:"Body Text",...n}),this.styles=e}plugins(){return[bn(this.styles)]}}const wn="tw-m-0 tw-px-0 tw-py-0",wt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align,a=o.merge([i&&o.alignmentClassnames[i],wn,o.getColumnBreakClasses(t)]);return s.jsx("p",{...e,className:a,style:r,children:n})};class yn extends o.MarkupElement{constructor(e=w.p,n=wt){super(e,n)}}const bn=t=>o.createPluginFactory({...o.createParagraphPlugin(),key:w.p,isElement:!0,component:wt})({component:e=>s.jsx(wt,{...e,styles:t})}),So="textstyle-quote-plugin";class vn extends o.Plugin{styles={};constructor({styles:e=P.quote,...n}={}){super(w.quote,{label:"Quote",markupElement:new ko,...n}),this.styles=e}plugins(){return[Cn(this.styles)]}}class ko extends o.MarkupElement{constructor(e=So,n=yt){super(e,n)}}const yt=({element:t,attributes:e,children:n,styles:r})=>{const i=t.align;return s.jsx("blockquote",{...e,className:o.merge([i&&o.alignmentClassnames[i],o.getColumnBreakClasses(t)]),style:r,children:n})},Cn=t=>o.createPluginFactory({key:w.quote,isElement:!0,component:yt,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>s.jsx(yt,{...e,styles:t})}),Jt=[new un,new gn,new mn,new hn,new on,new an,new cn,new vn,new xn],nt=[w.heading1,w.heading2,w.heading3,w.heading4,w.custom1,w.custom2,w.custom3,w.quote,w.p],To=[...Jt,new pn,new fn],Po=[...nt,w.imageCaption,w.imageTitle],Io=[{color:"var(--f-theme-settings-list-bullet1-color, currentColor)",shape:"var(--f-theme-settings-list-bullet1-shape, '•')",size:"var(--f-theme-settings-list-bullet1-size, 1em)"},{color:"var(--f-theme-settings-list-bullet2-color, currentColor)",shape:"var(--f-theme-settings-list-bullet2-shape, '•')",size:"var(--f-theme-settings-list-bullet2-size, 1em)"},{color:"var(--f-theme-settings-list-bullet3-color, currentColor)",shape:"var(--f-theme-settings-list-bullet3-shape, '•')",size:"var(--f-theme-settings-list-bullet3-size, 1em)"}];class Sn extends o.UnorderedListPlugin{constructor(e){super({listStyles:Io,...e})}}const jo=[{counterType:"var(--f-theme-settings-list-numbered1-counter-type, decimal)",color:"var(--f-theme-settings-list-numbered1-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)",color:"var(--f-theme-settings-list-numbered2-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered3-counter-type, lower-roman)",color:"var(--f-theme-settings-list-numbered3-color, currentColor)"}];class kn extends o.OrderedListPlugin{constructor(e){super({listStyles:jo,...e})}}const Eo=t=>new o.PluginComposer().setPlugin(new o.SoftBreakPlugin,new o.TextStylePlugin({textStyles:Jt})).setPlugin([new o.BoldPlugin,new o.ItalicPlugin,new o.UnderlinePlugin,new o.StrikethroughPlugin,new nn({appBridge:t}),new Ke({appBridge:t}),new o.CodePlugin],[new o.AlignLeftPlugin({validTypes:nt}),new o.AlignCenterPlugin({validTypes:nt}),new o.AlignRightPlugin({validTypes:nt}),new o.AlignJustifyPlugin({validTypes:nt}),new Sn,new o.CheckboxListPlugin,new kn,new o.ResetFormattingPlugin,new o.AutoformatPlugin]),Bo="--f-theme-settings-",No=t=>{const e=t?.id?`hasBackground${t.id}`:"hasBackground",n=t?.id?`backgroundColor${t.id}`:"backgroundColor",r=t?.preventDefaultColor?void 0:t?.defaultColor||$n,i=t?.label?t.label:"Background",a=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:i,type:"switch",switchLabel:a,defaultValue:!!t?.defaultValue,on:[{id:n,defaultValue:r,type:"colorInput"}]}},Ao=t=>{const e=t?.id?`hasBorder_${t.id}`:"hasBorder",n=t?.id?`borderSelection_${t.id}`:"borderSelection",r=t?.id?`borderStyle_${t.id}`:"borderStyle",i=t?.id?`borderWidth_${t.id}`:"borderWidth",a=t?.id?`borderColor_${t.id}`:"borderColor",c=t?.defaultColor||de,d=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:d,defaultValue:!!t?.defaultValue,on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:D.Solid,choices:[{value:D.Solid,label:D.Solid},{value:D.Dotted,label:D.Dotted},{value:D.Dashed,label:D.Dashed}]},{id:i,type:"input",defaultValue:Wn,rules:[m.numericalOrPixelRule,m.minimumNumericalOrPixelRule(0),m.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:l=>m.appendUnit(l,i)},{id:a,type:"colorInput",defaultValue:c}]}],off:[]}},Zt=(t,e=H.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:H.None,label:"None"},{value:H.Small,label:"S"},{value:H.Medium,label:"M"},{value:H.Large,label:"L"}]}),Lo=t=>{const e=t?.id?`hasRadius_${t.id}`:"hasRadius",n=t?.id?`radiusValue_${t.id}`:"radiusValue",r=t?.id?`radiusChoice_${t.id}`:"radiusChoice",i=t?.defaultRadius||H.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:a=>t?.dependentSettingId?!!a.getBlock(t.dependentSettingId)?.value:!0,onChange:a=>m.presetCustomValue(a,r,n,t?.radiusStyleMap||G),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[m.numericalOrPixelRule,m.minimumNumericalOrPixelRule(0)],onChange:a=>m.appendUnit(a,n)}],off:[Zt(r,i)]}},Ro=t=>{const e=t?.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t?.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",r=t?.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",i=t?.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",a=t?.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t?.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",d=t?.id?`extendedRadiusBottomRight_${t.id}`:"extendedRadiusBottomRight";return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>t?.dependentSettingId?!!l.getBlock(t.dependentSettingId)?.value:!0,onChange:l=>{m.presetCustomValue(l,r,i,G),m.presetCustomValue(l,r,a,G),m.presetCustomValue(l,r,c,G),m.presetCustomValue(l,r,d,G)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Columns,blocks:[{id:i,type:"input",label:"Top Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,i)},{id:a,type:"input",label:"Top Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,a)},{id:c,type:"input",label:"Bottom Left",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,c)},{id:d,type:"input",label:"Bottom Right",rules:[m.numericalOrPixelRule],onChange:l=>m.appendUnit(l,d)}]}],off:[Zt(r,t?.defaultValue)]}},Do=t=>{const e=t?.id?t.id:"hasCustomSpacing",n=t?.dependentSettingId?t.dependentSettingId:"columns",r=t?.spacingChoiceId?t.spacingChoiceId:"spacingChoice",i=t?.spacingCustomId?t.spacingCustomId:"spacingCustom",a=t?.defaultValueChoices?t.defaultValueChoices:q.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>m.presetCustomValue(c,r,i,ge),show:c=>c.getBlock(n)?.value!=="1",on:[{id:i,type:"input",rules:[m.numericalOrPixelRule],onChange:c=>m.appendUnit(c,i)}],off:[{id:r,type:"slider",defaultValue:a,choices:[{value:q.Auto,label:"Auto"},{value:q.S,label:"S"},{value:q.M,label:"M"},{value:q.L,label:"L"}]}]}},te=t=>({id:t,type:"segmentedControls",defaultValue:W.None,choices:[{value:W.None,label:"None"},{value:W.Small,label:"S"},{value:W.Medium,label:"M"},{value:W.Large,label:"L"}]}),Mo=t=>{const e=t?.id?`hasCustomMarginValue_${t?.id}`:"hasCustomMarginValue",n=t?.id?`marginValue_${t?.id}`:"marginValue",r=t?.id?`marginChoice_${t?.id}`:"marginChoice";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:i=>m.presetCustomValue(i,r,n,t?.marginStyleMap||et),on:[{id:n,type:"input",placeholder:dt,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[te(r)]}},Fo=t=>{const e=t?.id?`hasExtendedCustomMargin_${t?.id}`:"hasExtendedCustomMargin",n=t?.id?`extendedMarginValues_${t?.id}`:"extendedMarginValues",r=t?.id?`extendedMarginChoice_${t?.id}`:"extendedMarginChoice",i=t?.id?`extendedMarginTop_${t?.id}`:"extendedMarginTop",a=t?.id?`extendedMarginLeft_${t?.id}`:"extendedMarginLeft",c=t?.id?`extendedMarginRight_${t?.id}`:"extendedMarginRight",d=t?.id?`extendedMarginBottom_${t?.id}`:"extendedMarginBottom";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,et),m.presetCustomValue(l,r,a,et),m.presetCustomValue(l,r,c,et),m.presetCustomValue(l,r,d,et)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:dt,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:dt,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:dt,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:dt,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[te(r)]}},ee=t=>({id:t,type:"segmentedControls",defaultValue:$.Small,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),Oo=t=>{const e=t?.id?`hasCustomPaddingValue_${t?.id}`:"hasCustomPaddingValue",n=t?.id?`paddingValue_${t?.id}`:"paddingValue",r=t?.id?`paddingChoice_${t?.id}`:"paddingChoice";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:i=>m.presetCustomValue(i,r,n,t?.paddingStyleMap||tt),on:[{id:n,type:"input",placeholder:ct,rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)],onChange:i=>m.appendUnit(i,n)}],off:[ee(r)]}},_o=t=>{const e=t?.id?`hasExtendedCustomPadding_${t?.id}`:"hasExtendedCustomPadding",n=t?.id?`extendedPaddingValues_${t?.id}`:"extendedPaddingValues",r=t?.id?`extendedPaddingChoice_${t?.id}`:"extendedPaddingChoice",i=t?.id?`extendedPaddingTop_${t?.id}`:"extendedPaddingTop",a=t?.id?`extendedPaddingLeft_${t?.id}`:"extendedPaddingLeft",c=t?.id?`extendedPaddingRight_${t?.id}`:"extendedPaddingRight",d=t?.id?`extendedPaddingBottom_${t?.id}`:"extendedPaddingBottom";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:l=>{m.presetCustomValue(l,r,i,tt),m.presetCustomValue(l,r,a,tt),m.presetCustomValue(l,r,c,tt),m.presetCustomValue(l,r,d,tt)},on:[{id:n,type:"multiInput",layout:m.MultiInputLayout.Spider,blocks:[{id:i,type:"input",label:"Top",placeholder:ct,onChange:l=>m.appendUnit(l,i),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:a,type:"input",label:"Left",placeholder:ct,onChange:l=>m.appendUnit(l,a),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ct,onChange:l=>m.appendUnit(l,c),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ct,onChange:l=>m.appendUnit(l,d),rules:[m.numericalOrPixelRule,m.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[ee(r)]}},Uo=t=>{const e=ne(t?.globalControlId);return{id:t?.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>n.getBlock(e)?.value===Y.Custom}},ne=t=>t||"security",Ho=t=>[{id:ne(t),type:"segmentedControls",defaultValue:Y.Global,choices:[{value:Y.Global,label:"Global Settings"},{value:Y.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:m.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Tn=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(Tn||{});const zo=t=>t,Vo=t=>t;exports.AllTextStylePlugins=To;exports.AllTextStyles=Po;exports.AttachmentOperationsProvider=Kn;exports.Attachments=ve;exports.AttachmentsProvider=xe;exports.AttachmentsToolbarButton=ke;exports.BUTTON_PLUGIN=qe;exports.BlockButtonStyles=Pt;exports.BlockInjectButton=Dn;exports.BlockItemWrapper=Ne;exports.BlockStyles=P;exports.BorderStyle=D;exports.BreakAfterPlugin=Ks;exports.ButtonPlugin=Ke;exports.Custom1Plugin=on;exports.Custom2Plugin=an;exports.Custom3Plugin=cn;exports.DEFAULT_ATTACHMENTS_BUTTON_ID=Se;exports.DEFAULT_DRAGGING_TOOLTIP=Pe;exports.DEFAULT_DRAG_TOOLTIP=Te;exports.DEFAULT_MENU_BUTTON_ID=$t;exports.DragHandleToolbarButton=Ie;exports.DragPreviewContextProvider=me;exports.ELEMENT_BUTTON=T;exports.FlyoutToolbarButton=je;exports.GAP_DEFAULT=sn;exports.GutterSpacing=q;exports.Heading1Plugin=un;exports.Heading2Plugin=gn;exports.Heading3Plugin=mn;exports.Heading4Plugin=hn;exports.ImageCaptionPlugin=pn;exports.ImageTitlePlugin=fn;exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=Gs;exports.LinkInput=$e;exports.LinkPlugin=nn;exports.LinkSelector=Ve;exports.Margin=W;exports.MenuToolbarButton=Ee;exports.MultiFlyoutContextProvider=he;exports.OrderedListPlugin=kn;exports.PARAGRAPH_CLASSES=wn;exports.Padding=$;exports.ParagraphMarkupElement=yn;exports.ParagraphMarkupElementNode=wt;exports.ParagraphPlugin=xn;exports.QuoteMarkupElementNode=yt;exports.QuotePlugin=vn;exports.Radius=H;exports.RichTextEditor=Ds;exports.Sections=Tn;exports.Security=Y;exports.THEME_PREFIX=Bo;exports.TextStylePluginsWithoutImage=Jt;exports.TextStyles=w;exports.TextStylesWithoutImage=nt;exports.Toolbar=Be;exports.UnorderedListPlugin=Sn;exports.addHttps=St;exports.borderStyleMap=ue;exports.convertToRteValue=es;exports.createButtonNode=Oe;exports.createButtonPlugin=Ge;exports.createLinkPlugin=en;exports.createParagraphPlugin=bn;exports.createQuotePlugin=Cn;exports.defineBlock=zo;exports.defineSettings=Vo;exports.getBackgroundColorStyles=Vn;exports.getBackgroundSettings=No;exports.getBorderRadiusSettings=Lo;exports.getBorderRadiusSlider=Zt;exports.getBorderSettings=Ao;exports.getBorderStyles=qn;exports.getDefaultPluginsWithLinkChooser=Eo;exports.getExtendedBorderRadiusSettings=Ro;exports.getGutterSettings=Do;exports.getLegacyUrl=ss;exports.getLinkFromEditor=rs;exports.getMarginExtendedSettings=Fo;exports.getMarginSettings=Mo;exports.getMarginSlider=te;exports.getPaddingExtendedSettings=_o;exports.getPaddingSettings=Oo;exports.getPaddingSlider=ee;exports.getRadiusStyles=Gn;exports.getReadableColor=zn;exports.getSecurityDownloadableSetting=Uo;exports.getSecurityGlobalControlId=ne;exports.getSecurityGlobalControlSetting=Ho;exports.getUrl=os;exports.getUrlFromEditor=Fe;exports.getUrlFromLinkOrLegacyLink=Gt;exports.gutterSpacingStyleMap=ge;exports.hasRichTextValue=Ae;exports.insertButton=Re;exports.isDark=Fn;exports.isDownloadable=ns;exports.isValidUrl=kt;exports.isValidUrlOrEmpty=st;exports.joinClassNames=z;exports.marginStyleMap=et;exports.paddingStyleMap=tt;exports.radiusStyleMap=G;exports.relativeUrlRegex=Kt;exports.setAlpha=Un;exports.submitFloatingButton=Yt;exports.toColorObject=Hn;exports.toHex8String=On;exports.toHexString=_n;exports.toRgbaString=_t;exports.toShortRgba=Q;exports.triggerFloatingButton=_e;exports.triggerFloatingButtonEdit=Tt;exports.triggerFloatingButtonInsert=Xt;exports.unwrapButton=ot;exports.upsertButton=De;exports.upsertButtonText=Qt;exports.useAttachmentOperations=zt;exports.useAttachments=fe;exports.useAttachmentsContext=we;exports.useDragPreviewContext=it;exports.useMultiFlyoutContext=pe;exports.useMultiFlyoutState=vt;exports.withAttachmentsProvider=Yn;exports.withButton=Le;exports.wrapButton=Me;Object.keys(m).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>m[t]})});
10
- //# sourceMappingURL=index.cjs.js.map
5
+ ${f?`tw-pl-7 `:`tw-pl-12 `}
6
+ ${l?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover `:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container `}`,onClick:()=>n(e.permanentLink),children:(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6`,children:[f&&(0,d.jsx)(`button`,{type:`button`,className:`tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer`,onClick:()=>o(!a),onKeyDown:e=>e.key===`Enter`&&e.stopPropagation(),children:(0,d.jsx)(`div`,{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
7
+ ${a?`tw-rotate-90 `:``}`})}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Page`})]},e.id)}),a&&s.length>0&&s.map(e=>(0,d.jsx)(Tt,{section:e,selectedUrl:t,onSelectUrl:n},e.id))]})},Dt=({documentId:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{let[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!0),f=[...o.values()],p=!c&&f.length>0;return(0,u.useEffect)(()=>{a(e).then(e=>{let t=e.filter(e=>!!e.category).sort((e,t)=>e.category.sort===t.category.sort?e.sort-t.sort:e.category.sort-t.category.sort),n=e.filter(e=>!e.category).sort((e,t)=>e.sort-t.sort);s([...t,...n])}).finally(()=>{l(!1)})},[]),c?(0,d.jsx)(wt,{}):p?(0,d.jsx)(d.Fragment,{children:f.map(e=>(0,d.jsx)(Et,{page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i},e.id))}):(0,d.jsx)(`div`,{className:`tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary`,children:`This document does not contain any pages.`})},Ot=({document:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{let[o,s]=(0,u.useState)(e.id===r.documentId),c=e.permanentLink===t;return(0,u.useEffect)(()=>{e.id===r.documentId&&s(!0)},[r,e.id]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`button`,{type:`button`,"data-test-id":`internal-link-selector-document-link`,className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full ${c?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover`:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container`}`,onClick:()=>n(e.permanentLink),children:[(0,d.jsx)(`button`,{type:`button`,tabIndex:0,"data-test-id":`tree-item-toggle`,className:`tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer`,onClick:()=>s(!o),onKeyDown:e=>e.key===`Enter`&&e.stopPropagation(),children:(0,d.jsx)(`div`,{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong ${o?`tw-rotate-90`:``}`})}),(0,d.jsx)(l.IconColorFan,{size:16}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Document`})]}),o&&(0,d.jsx)(Dt,{documentId:e.id,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})]})},kt=({selectedUrl:e,onSelectUrl:t,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:i})=>{let[a,o]=(0,u.useState)(!0),[s,c]=(0,u.useState)([]),[l,f]=(0,u.useState)({documentId:void 0,pageId:void 0});(0,u.useEffect)(()=>{e&&s.length>0&&p().then(e=>{f(e)})},[s.length]),(0,u.useEffect)(()=>{n().then(e=>{c(e)}).finally(()=>{o(!1)})},[]);let p=async()=>{let t={documentId:void 0,pageId:void 0};if(s.find(t=>t.permanentLink===e))return t;for(let n of s){let a=await r(n.id);if(a.find(t=>t.permanentLink===e))return t.documentId=n.id,t;for(let r of a)if(Ct(await i(r.id)).find(t=>t.permanentLink===e))return t.documentId=n.id,t.pageId=r.id,t}return t};return a?(0,d.jsx)(wt,{}):(0,d.jsx)(d.Fragment,{children:s.map(n=>(0,d.jsx)(Ot,{document:n,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:l,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:r},n.id))})},At=({url:e,onUrlChange:t,buttonSize:n=`medium`,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})=>{let[o,s]=(0,u.useState)(!1),[f,p]=(0,u.useState)(e),m=e=>{p(e)},h=e=>{e.key===`Enter`&&(e.preventDefault(),g())};(0,u.useEffect)(()=>{e&&!f&&p(e)},[e,f]);let g=()=>{t?.(f),s(!1)};return(0,d.jsx)(`div`,{onPointerDown:e=>{e.preventDefault()},"data-test-id":`internal-link-selector`,onKeyDown:h,children:(0,d.jsxs)(c.Dialog.Root,{modal:!0,open:o,onOpenChange:s,children:[(0,d.jsx)(c.Dialog.Trigger,{asChild:!0,children:(0,d.jsxs)(c.Button,{size:n,emphasis:`default`,children:[(0,d.jsx)(l.IconLink,{size:`20`}),`Internal link`]})}),(0,d.jsxs)(c.Dialog.Content,{onOpenAutoFocus:()=>{},showUnderlay:!0,"data-is-underlay":!0,minWidth:`800px`,children:[(0,d.jsx)(c.Dialog.Header,{children:(0,d.jsx)(c.Dialog.Title,{children:`Select internal link`})}),(0,d.jsx)(c.Dialog.Body,{padding:`none`,children:(0,d.jsx)(c.ScrollArea,{padding:`compact`,children:(0,d.jsx)(kt,{selectedUrl:f,onSelectUrl:m,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})})}),(0,d.jsxs)(c.Dialog.Footer,{children:[(0,d.jsx)(c.Button,{size:n,emphasis:`default`,onPress:()=>s(!1),children:`Cancel`}),(0,d.jsx)(c.Button,{size:n,disabled:!f,emphasis:`strong`,onPress:()=>g(),children:`Choose`})]})]})]})})},jt=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,placeholder:i,newTab:a,url:o=``,required:s,info:l,label:u,buttonSize:f,hideInternalLinkButton:p})=>{let m=n?n(o):K(o);return(0,d.jsxs)(`div`,{"data-test-id":`link-input`,children:[(0,d.jsx)(g.FormControl,{label:{children:u,htmlFor:`url`,required:s,tooltip:l?{content:l,position:`top`}:void 0},children:(0,d.jsx)(c.TextInput,{"data-test-id":`text-input`,id:`url`,value:o,onChange:t=>e?.(t.target.value),placeholder:i??`https://example.com`})}),!m&&(0,d.jsx)(`div`,{className:`tw-text-error tw-mt-1 tw-text-small`,children:`Please enter a valid URL.`}),!p&&(0,d.jsx)(`div`,{className:`tw-mt-3`,children:(0,d.jsx)(At,{url:o,onUrlChange:e,buttonSize:f??`medium`,getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:e=>r.getDocumentPagesByDocumentId(e),getDocumentSectionsByDocumentPageId:e=>r.getDocumentSectionsByDocumentPageId(e)})}),(0,d.jsxs)(`div`,{className:`tw-mt-3 tw-flex tw-items-center tw-gap-1.5`,children:[(0,d.jsx)(c.Checkbox,{id:`new-tab`,value:a,onChange:()=>t?.(!a)}),(0,d.jsx)(c.Label,{id:`new-tab-label`,htmlFor:`new-tab`,className:`tw-whitespace-nowrap`,children:`Open in new tab`})]})]})},Mt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:i,onSave:a,isValidUrlOrEmpty:o,hasValues:s,testId:u,appBridge:f,children:p})=>(0,d.jsxs)(_.FloatingModalWrapper,{"data-test-id":u,padding:`28px`,minWidth:`400px`,children:[(0,d.jsx)(g.FormControl,{label:{children:`Text`,htmlFor:`linkText`,required:!0},children:(0,d.jsx)(c.TextInput,{id:`linkText`,value:e.text,placeholder:`Link Text`,onChange:e=>t(e.target.value)})}),p,(0,d.jsx)(`div`,{className:`tw-mt-5`,children:(0,d.jsx)(jt,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:o,appBridge:f})}),(0,d.jsx)(`div`,{className:`tw-mt-3`,children:(0,d.jsxs)(`div`,{className:`tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10`,children:[(0,d.jsx)(c.Button,{"data-test-id":`button`,onPress:i,size:`medium`,emphasis:`default`,children:`Cancel`}),(0,d.jsxs)(c.Button,{"data-test-id":`button`,onPress:a,size:`medium`,disabled:!o(e?.url)||!s,children:[(0,d.jsx)(l.IconCheckMark,{size:`20`}),`Save`]})]})})]}),Nt=e=>{let t=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(t)&&t[0]?.buttonStyle||`primary`},Pt={url:``,text:``,buttonStyle:`primary`,newTab:!1},Ft=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`BUTTON_STYLE`:case`INIT`:return{...e,...r};default:return e}},Pt);return[e,t]},It=()=>{let e=(0,_.useEditorRef)(),[t,n]=Ft();(0,u.useEffect)(()=>{let t=Nt(e);n({type:`INIT`,payload:{text:G.text()||G.url(),buttonStyle:t,newTab:!!G.newTab(),url:G.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`BUTTON_STYLE`,payload:{buttonStyle:e}})},a=e=>{n({type:`URL`,payload:{url:e}})},o=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},s=()=>{W.reset()},c=n=>{if(!K(t.url)||!l)return;let r=Qe(t.url);W.text(t.text),W.url(r),W.buttonStyle(t.buttonStyle),W.newTab(t.newTab),nt(e)&&n?.preventDefault()},l=t.url!==``&&t.text!==``,{appBridge:d}=(0,_.getPluginOptions)(e,Z);return(0,_.useHotkeys)(`enter`,c,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onButtonStyleChange:i,onUrlChange:a,onToggleTab:o,onCancel:s,onSave:c,hasValues:l,isValidUrlOrEmpty:K,appBridge:d}},Lt=()=>{let e=It(),{state:t,onButtonStyleChange:n}=e;return(0,d.jsx)(Mt,{...e,testId:`floating-button-insert`,children:(0,d.jsx)(`div`,{className:`tw-pt-5`,children:(0,d.jsxs)(g.FormControl,{label:{children:`Button Style`,htmlFor:`buttonStyle`,required:!0},children:[(0,d.jsx)(Rt,{id:`primary`,styles:X.buttonPrimary,isActive:t.buttonStyle===`primary`,onClick:()=>n(`primary`),children:t.text||`Primary Button`}),(0,d.jsx)(Rt,{id:`secondary`,styles:X.buttonSecondary,isActive:t.buttonStyle===`secondary`,onClick:()=>n(`secondary`),children:t.text||`Secondary Button`}),(0,d.jsx)(Rt,{id:`tertiary`,styles:X.buttonTertiary,isActive:t.buttonStyle===`tertiary`,onClick:()=>n(`tertiary`),children:t.text||`Tertiary Button`})]})})})},Rt=({id:e,styles:t,isActive:n,onClick:r,children:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`button`,{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onClick:r,style:{...t&&t.hover&&a?{...t,...t.hover}:t,marginTop:0,marginBottom:0},className:n?`tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit`:`tw-w-fit`,children:i})},zt={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},Bt=()=>{let{ref:e,...t}=qt(zt),{ref:n,...r}=Wt(zt),i=(0,_.useEditorRef)(),a=He(),o=a.isOpen(i.id),s=a.isEditing(),c=a.mode(),l=(0,d.jsx)(Lt,{}),u=s?l:(0,d.jsx)(St,{});return(0,d.jsxs)(d.Fragment,{children:[o&&c===`insert`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...X[_.TextStyles.p]},children:l}),document.body),o&&c===`edit`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...X[_.TextStyles.p]},children:u}),document.body)]})},Z=`button`,Vt=`button-plugin`,Ht=e=>(0,_.createPluginFactory)({key:Z,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:et,renderAfterEditable:Bt,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:`command+shift+k, ctrl+shift+k`,appBridge:e},then:(e,{type:t})=>({deserializeHtml:{rules:[{validNodeName:`A`,validClassName:`btn`}],getNode:e=>({type:t,url:e.getAttribute(`href`),target:e.getAttribute(`target`)||`_blank`})}})})(),Ut=class extends _.Plugin{styles={};appBridge;constructor({styles:e=gt,...t}){super(Vt,{button:xt,markupElement:new yt,...t}),this.styles=e,this.appBridge=t?.appBridge}plugins(){return[Ht(this.appBridge)]}},Wt=e=>{let t=(0,_.useEditorRef)(),n=He().mode(),r=He().isOpen(t.id),i=(0,_.useEditorVersion)(),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z),o=(0,u.useCallback)(()=>{let e=(0,_.getAboveNode)(t,{match:{type:(0,_.getPluginType)(t,Z)}});if(e){let[,n]=e;return(0,_.getRangeBoundingClientRect)(t,{anchor:(0,_.getStartPoint)(t,n),focus:(0,_.getEndPoint)(t,n)})}return(0,_.getDefaultBoundingClientRect)()},[t]),{update:s,style:c,floating:l}=Zt({open:r&&n===`edit`,getBoundingClientRect:o,...e});return(0,u.useEffect)(()=>{let e=ut(t);if(e&&W.url(e),t.selection&&(0,_.someNode)(t,{match:{type:(0,_.getPluginType)(t,`button`)}})){W.show(`edit`,t.id),s();return}G.mode()===`edit`&&W.reset()},[t,i,s]),(0,_.useHotkeys)(a,e=>{e.preventDefault(),G.mode()===`edit`&&pt(t)},{enableOnContentEditable:!0},[]),Gt(),Kt(),{style:c,ref:(0,_.useComposedRef)(l)}},Gt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`*`,t=>{t.key===`Enter`&&nt(e)&&t.preventDefault()},{enableOnFormTags:[`INPUT`]},[])},Kt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`escape`,()=>{if(G.mode()===`edit`){if(G.isEditing()){W.show(`edit`,e.id),(0,_.focusEditor)(e,e.selection??void 0);return}W.reset()}},{enableOnFormTags:[`INPUT`],enableOnContentEditable:!0},[])},qt=e=>{let t=(0,_.useEditorRef)(),n=(0,_.useFocused)(),r=He().mode(),i=He().isOpen(t.id),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z);(0,_.useHotkeys)(a,e=>{e.preventDefault(),mt(t,{focused:n})},{enableOnContentEditable:!0},[n]);let{update:o,style:s,floating:c}=Zt({open:i&&r===`insert`,getBoundingClientRect:_.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return(0,u.useEffect)(()=>{i&&o(),W.updated(i)},[i,o]),Kt(),{style:s,ref:(0,_.useComposedRef)(c)}},Jt=12,Yt=-22,Xt=96,Zt=e=>(0,_.useVirtualFloating)({placement:`bottom-start`,middleware:[(0,_.offset)({mainAxis:Jt,alignmentAxis:Yt}),(0,_.flip)({padding:Xt})],...e}),Qt=`[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,$t={1:`tw-columns-1`,2:`tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,3:`tw-columns-1 @md:!tw-columns-3 ${Qt}`,4:`tw-columns-1 @md:!tw-columns-4 ${Qt}`,5:`tw-columns-1 @md:!tw-columns-5 ${Qt}`},en=e=>e?$t[e]||$t[1]:``,tn=({value:e=``,gap:t,customClass:n,show:r=!0,plugins:i})=>{let[a,o]=(0,u.useState)(null);return(0,u.useEffect)(()=>{(async()=>{let r=await(0,_.serializeRawToHtmlAsync)(e,i,void 0,t,n);o(r)})().catch(console.error)},[e,t,i,n]),!r||a===`<br />`||a===null?null:(0,d.jsx)(`div`,{className:`tw-w-full tw-whitespace-pre-wrap`,"data-test-id":`rte-content-html`,dangerouslySetInnerHTML:{__html:a}})},nn=e=>{G.isOpen(e)&&W.reset()},rn=(0,u.memo)(({isEnabled:e,value:t,columns:n,gap:r,placeholder:i,plugins:a,onTextChange:o,showSerializedText:s})=>{let c=en(n),[l,f]=(0,u.useState)(!1),p=(0,u.useId)(),m=(0,u.useCallback)(e=>{e!==t&&o?.(e),f(!1)},[o,t]),h=(0,u.useCallback)(()=>f(!0),[]);return(0,u.useEffect)(()=>{let e=e=>{e.preventDefault(),e.returnValue=`Unprocessed changes`};return l&&window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[l]),e?(0,d.jsx)(_.RichTextEditor,{id:p,value:t,border:!1,placeholder:i,plugins:a,onValueChanged:h,onTextChange:m,hideExternalFloatingModals:nn,placeholderOpacity:`high`}):(0,d.jsx)(tn,{value:t,gap:r,customClass:c,show:s,plugins:a})});rn.displayName=`InternalRichTextEditor`;var an=e=>{let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(!1),{isEditing:i,...a}=e,o=(0,u.useCallback)(e=>{e&&r(!0)},[]);return Be({ref:t,disabled:!i,onChange:o}),(0,u.useEffect)(()=>{i||r(!1)},[i]),(0,d.jsx)(`div`,{"data-test-id":`rich-text-editor-container`,className:`tw-block tw-w-full tw-@container`,ref:t,children:(0,d.jsx)(rn,{...a,isEnabled:i&&n})})},on=({editButtonProps:e,unlinkButtonProps:t})=>{let{element:n}=(0,_.useLinkOpenButtonState)(),r=n?Ye(n):``;return(0,d.jsx)(_.FloatingModalWrapper,{"data-test-id":`floating-link-edit`,padding:`16px`,minWidth:`400px`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-link-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-link-edit-url`,href:r,target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:r}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`edit-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...e,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`remove-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...t,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},sn=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},cn=e=>sn(e,e=>e.chosenLink?.searchResult?.link||``),ln=e=>sn(e,e=>e.url||``),un={url:``,text:``,newTab:!1},dn=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`INIT`:return{...e,...r};default:return e}},un);return[e,t]},fn=()=>{let e=(0,_.useEditorRef)(),[t,n]=dn();(0,u.useEffect)(()=>{let t=cn(e),r=ln(e),i=_.floatingLinkSelectors.newTab();n({type:`INIT`,payload:{text:_.floatingLinkSelectors.text()||_.floatingLinkSelectors.url(),newTab:i,url:t&&r===``?t:_.floatingLinkSelectors.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`URL`,payload:{url:e}})},a=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},o=()=>{_.floatingLinkActions.reset()},s=n=>{!K(t.url)||!c||(_.floatingLinkActions.text(t.text),_.floatingLinkActions.url(Qe(t.url)),_.floatingLinkActions.newTab(t.newTab),(0,_.submitFloatingLink)(e)&&n?.preventDefault())},c=t.url!==``&&t.text!==``,{appBridge:l}=(0,_.getPluginOptions)(e,_.ELEMENT_LINK);return(0,_.useHotkeys)(`enter`,s,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onUrlChange:i,onToggleTab:a,onCancel:o,onSave:s,hasValues:c,isValidUrlOrEmpty:K,appBridge:l}},pn=()=>(0,d.jsx)(Mt,{...fn(),testId:`floating-link-insert`}),mn={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},hn=()=>{let e=(0,_.useFloatingLinkInsertState)({floatingOptions:mn}),{props:t,ref:n,hidden:r}=(0,_.useFloatingLinkInsert)(e),i=(0,_.useFloatingLinkEditState)({floatingOptions:mn}),{props:a,ref:o,editButtonProps:s,unlinkButtonProps:c}=(0,_.useFloatingLinkEdit)(i);if(r)return null;let l=(0,d.jsx)(pn,{}),u=i.isEditing?l:(0,d.jsx)(on,{editButtonProps:s,unlinkButtonProps:c});return(0,d.jsxs)(d.Fragment,{children:[e.isOpen&&!i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...t,style:{...t.style,...X[Y.p]},children:l}),document.body),i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:o,...a,style:{...a.style,...X[Y.p]},children:u}),document.body)]})},gn=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)(),r=(0,_.useLinkToolbarButtonState)(),{props:i}=(0,_.useLinkToolbarButton)(r);return(0,d.jsx)(_.ToolbarButton,{onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},ref:t,...i,...e,children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconLink,{size:16})})})});gn.displayName=`LinkToolbarButton`;var _n=({id:e,editorId:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(t)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection});return(0,d.jsx)(`div`,{"data-plugin-id":e,children:(0,d.jsx)(gn,{disabled:!r,tooltip:(0,_.getTooltip)(r?`Link\n${(0,_.getHotkeyByPlatform)(`Ctrl+K`)}`:`Links can only be set for a single text block.`)})})},vn=e=>{let{attributes:t,children:n}=e,{styles:r}=(0,_.useRichTextEditorContext)(),i=e.element.url||e.element.chosenLink?.searchResult?.link||``,a=e.element.target||`_self`;return(0,d.jsx)(`a`,{...t,href:i,target:a,style:r[J],children:n})},yn=class extends _.MarkupElement{constructor(e=_.ELEMENT_LINK,t=vn){super(e,t)}},bn=e=>(0,_.createPluginFactory)({...(0,_.createLinkPlugin)(),renderAfterEditable:hn,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:`meta+k, ctrl+k`,keepSelectedTextOnPaste:!0,appBridge:e}})(),xn=class extends _.Plugin{styles={};appBridge;constructor({styles:e=X[J],...t}){super(J,{button:_n,markupElement:new yn,...t}),this.styles=e,this.appBridge=t.appBridge}plugins(){return[bn(this.appBridge)]}},Sn=`breakAfterColumn`,Cn=`normal`,wn=class extends _.Plugin{columns;gap;customClass;constructor(e){super(`break-after-plugin`,{button:_.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??`normal`,this.customClass=en(this.columns)}plugins(){return[(0,_.createColumnBreakPlugin)(this.columns,this.gap,this.customClass)]}},Tn=`textstyle-custom1-plugin`,En=class extends _.Plugin{styles={};constructor({styles:e=X.custom1,...t}={}){super(Y.custom1,{label:`Custom 1`,markupElement:new Dn,...t}),this.styles=e}plugins(){return[kn(this.styles)]}},Dn=class extends _.MarkupElement{constructor(e=Tn,t=On){super(e,t)}},On=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,style:r,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),children:n})},kn=e=>(0,_.createPluginFactory)({key:Y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom1}]}})({component:t=>(0,d.jsx)(On,{...t,styles:e})}),An=`textstyle-custom2-plugin`,jn=class extends _.Plugin{styles={};constructor({styles:e=X.custom2,...t}={}){super(Y.custom2,{label:`Custom 2`,markupElement:new Mn,...t}),this.styles=e}plugins(){return[Pn(this.styles)]}},Mn=class extends _.MarkupElement{constructor(e=An,t=Nn){super(e,t)}},Nn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Pn=e=>(0,_.createPluginFactory)({key:Y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom2}]}})({component:t=>(0,d.jsx)(Nn,{...t,styles:e})}),Fn=`textstyle-custom3-plugin`,In=class extends _.Plugin{styles={};constructor({styles:e=X.custom3,...t}={}){super(_.TextStyles.custom3,{label:`Custom 3`,markupElement:new Ln,...t}),this.styles=e}plugins(){return[zn(this.styles)]}},Ln=class extends _.MarkupElement{constructor(e=Fn,t=Rn){super(e,t)}},Rn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},zn=e=>(0,_.createPluginFactory)({key:_.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:_.TextStyles.custom3}]}})({component:t=>(0,d.jsx)(Rn,{...t,styles:e})}),Bn=`textstyle-heading1-plugin`,Vn=class extends _.Plugin{styles={};constructor({styles:e=X.heading1,...t}={}){super(Y.heading1,{label:`Heading 1`,markupElement:new Hn,...t}),this.styles=e}plugins(){return[Wn(this.styles)]}},Hn=class extends _.MarkupElement{constructor(e=Bn,t=Un){super(e,t)}},Un=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h1`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Wn=e=>(0,_.createPluginFactory)({key:Y.heading1,isElement:!0,component:Un,deserializeHtml:{rules:[{validNodeName:[`h1`,`H1`]}]}})({component:t=>(0,d.jsx)(Un,{...t,styles:e})}),Gn=`textstyle-heading2-plugin`,Kn=class extends _.Plugin{styles={};constructor({styles:e=X.heading2,...t}={}){super(Y.heading2,{label:`Heading 2`,markupElement:new qn,...t}),this.styles=e}plugins(){return[Yn(this.styles)]}},qn=class extends _.MarkupElement{constructor(e=Gn,t=Jn){super(e,t)}},Jn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h2`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Yn=e=>(0,_.createPluginFactory)({key:Y.heading2,isElement:!0,component:Jn,deserializeHtml:{rules:[{validNodeName:[`h2`,`H2`]}]}})({component:t=>(0,d.jsx)(Jn,{...t,styles:e})}),Xn=`textstyle-heading3-plugin`,Zn=class extends _.Plugin{styles={};constructor({styles:e=X.heading3,...t}={}){super(Y.heading3,{label:`Heading 3`,markupElement:new Qn,...t}),this.styles=e}plugins(){return[er(this.styles)]}},Qn=class extends _.MarkupElement{constructor(e=Xn,t=$n){super(e,t)}},$n=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h3`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},er=e=>(0,_.createPluginFactory)({key:Y.heading3,isElement:!0,component:$n,deserializeHtml:{rules:[{validNodeName:[`h3`,`H3`]}]}})({component:t=>(0,d.jsx)($n,{...t,styles:e})}),tr=`textstyle-heading4-plugin`,nr=class extends _.Plugin{styles={};constructor({styles:e=X.heading4,...t}={}){super(Y.heading4,{label:`Heading 4`,markupElement:new rr,...t}),this.styles=e}plugins(){return[ar(this.styles)]}},rr=class extends _.MarkupElement{constructor(e=tr,t=ir){super(e,t)}},ir=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h4`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},ar=e=>(0,_.createPluginFactory)({key:Y.heading4,isElement:!0,component:ir,deserializeHtml:{rules:[{validNodeName:[`h4`,`H4`]}]}})({component:t=>(0,d.jsx)(ir,{...t,styles:e})}),or=`textstyle-imageCaption-plugin`,sr=class extends _.Plugin{styles={};constructor({styles:e=X.imageCaption,...t}={}){super(Y.imageCaption,{label:`Image Caption`,markupElement:new cr,...t}),this.styles=e}plugins(){return[ur(this.styles)]}},cr=class extends _.MarkupElement{constructor(e=or,t=lr){super(e,t)}},lr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},ur=e=>(0,_.createPluginFactory)({key:Y.imageCaption,isElement:!0,component:lr,deserializeHtml:{rules:[{validClassName:Y.imageCaption}]}})({component:t=>(0,d.jsx)(lr,{...t,styles:e})}),dr=`textstyle-imageTitle-plugin`,fr=class extends _.Plugin{styles={};constructor({styles:e=X.imageTitle,...t}={}){super(Y.imageTitle,{label:`Image Title`,markupElement:new pr,...t}),this.styles=e}plugins(){return[hr(this.styles)]}},pr=class extends _.MarkupElement{constructor(e=dr,t=mr){super(e,t)}},mr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},hr=e=>(0,_.createPluginFactory)({key:Y.imageTitle,isElement:!0,component:mr,deserializeHtml:{rules:[{validClassName:Y.imageTitle}]}})({component:t=>(0,d.jsx)(mr,{...t,styles:e})}),gr=class extends _.Plugin{styles={};constructor({styles:e=X.p,...t}={}){super(Y.p,{markupElement:new yr,label:`Body Text`,...t}),this.styles=e}plugins(){return[br(this.styles)]}},_r=`tw-m-0 tw-px-0 tw-py-0`,vr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align,a=(0,_.merge)([i&&_.alignmentClassnames[i],_r,(0,_.getColumnBreakClasses)(e)]);return(0,d.jsx)(`p`,{...t,className:a,style:r,children:n})},yr=class extends _.MarkupElement{constructor(e=Y.p,t=vr){super(e,t)}},br=e=>(0,_.createPluginFactory)({...(0,_.createParagraphPlugin)(),key:Y.p,isElement:!0,component:vr})({component:t=>(0,d.jsx)(vr,{...t,styles:e})}),xr=`textstyle-quote-plugin`,Sr=class extends _.Plugin{styles={};constructor({styles:e=X.quote,...t}={}){super(Y.quote,{label:`Quote`,markupElement:new Cr,...t}),this.styles=e}plugins(){return[Tr(this.styles)]}},Cr=class extends _.MarkupElement{constructor(e=xr,t=wr){super(e,t)}},wr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`blockquote`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Tr=e=>(0,_.createPluginFactory)({key:Y.quote,isElement:!0,component:wr,deserializeHtml:{rules:[{validNodeName:[`blockquote`,`BLOCKQUOTE`]}]}})({component:t=>(0,d.jsx)(wr,{...t,styles:e})}),Er=[new Vn,new Kn,new Zn,new nr,new En,new jn,new In,new Sr,new gr],Q=[Y.heading1,Y.heading2,Y.heading3,Y.heading4,Y.custom1,Y.custom2,Y.custom3,Y.quote,Y.p],Dr=[...Er,new sr,new fr],Or=[...Q,Y.imageCaption,Y.imageTitle],kr=[{color:`var(--f-theme-settings-list-bullet1-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet1-shape, '•')`,size:`var(--f-theme-settings-list-bullet1-size, 1em)`},{color:`var(--f-theme-settings-list-bullet2-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet2-shape, '•')`,size:`var(--f-theme-settings-list-bullet2-size, 1em)`},{color:`var(--f-theme-settings-list-bullet3-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet3-shape, '•')`,size:`var(--f-theme-settings-list-bullet3-size, 1em)`}],Ar=class extends _.UnorderedListPlugin{constructor(e){super({listStyles:kr,...e})}},jr=[{counterType:`var(--f-theme-settings-list-numbered1-counter-type, decimal)`,color:`var(--f-theme-settings-list-numbered1-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)`,color:`var(--f-theme-settings-list-numbered2-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered3-counter-type, lower-roman)`,color:`var(--f-theme-settings-list-numbered3-color, currentColor)`}],Mr=class extends _.OrderedListPlugin{constructor(e){super({listStyles:jr,...e})}},Nr=e=>new _.PluginComposer().setPlugin(new _.SoftBreakPlugin,new _.TextStylePlugin({textStyles:Er})).setPlugin([new _.BoldPlugin,new _.ItalicPlugin,new _.UnderlinePlugin,new _.StrikethroughPlugin,new xn({appBridge:e}),new Ut({appBridge:e}),new _.CodePlugin],[new _.AlignLeftPlugin({validTypes:Q}),new _.AlignCenterPlugin({validTypes:Q}),new _.AlignRightPlugin({validTypes:Q}),new _.AlignJustifyPlugin({validTypes:Q}),new Ar,new _.CheckboxListPlugin,new Mr,new _.ResetFormattingPlugin,new _.AutoformatPlugin]),Pr=`--f-theme-settings-`,Fr=e=>{let t=e?.id?`hasBackground${e.id}`:`hasBackground`,n=e?.id?`backgroundColor${e.id}`:`backgroundColor`,r=e?.preventDefaultColor?void 0:e?.defaultColor||te;return{id:t,label:e?.label?e.label:`Background`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,defaultValue:r,type:`colorInput`}]}},Ir=e=>{let t=e?.id?`hasBorder_${e.id}`:`hasBorder`,n=e?.id?`borderSelection_${e.id}`:`borderSelection`,r=e?.id?`borderStyle_${e.id}`:`borderStyle`,i=e?.id?`borderWidth_${e.id}`:`borderWidth`,a=e?.id?`borderColor_${e.id}`:`borderColor`,o=e?.defaultColor||ne;return{id:t,label:`Border`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:`dropdown`,defaultValue:N.Solid,choices:[{value:N.Solid,label:N.Solid},{value:N.Dotted,label:N.Dotted},{value:N.Dashed,label:N.Dashed}]},{id:i,type:`input`,defaultValue:`1px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0),(0,$.maximumNumericalOrPixelOrAutoRule)(500)],placeholder:`e.g. 3px`,onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`colorInput`,defaultValue:o}]}],off:[]}},Lr=(e,t=P.None)=>({id:e,type:`segmentedControls`,defaultValue:t,choices:[{value:P.None,label:`None`},{value:P.Small,label:`S`},{value:P.Medium,label:`M`},{value:P.Large,label:`L`}]}),Rr=e=>{let t=e?.id?`hasRadius_${e.id}`:`hasRadius`,n=e?.id?`radiusValue_${e.id}`:`radiusValue`,r=e?.id?`radiusChoice_${e.id}`:`radiusChoice`,i=e?.defaultRadius||P.None;return{id:t,label:`Corner radius`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`Determining how rounded the corners are.`,show:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:t=>(0,$.presetCustomValue)(t,r,n,e?.radiusStyleMap||F),on:[{id:n,type:`input`,placeholder:`e.g. 10px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Lr(r,i)]}},zr=e=>{let t=e?.id?`hasExtendedCustomRadius_${e.id}`:`hasExtendedCustomRadius`,n=e?.id?`extendedRadiusValue_${e.id}`:`extendedRadiusValue`,r=e?.id?`extendedRadiusChoice_${e.id}`:`extendedRadiusChoice`,i=e?.id?`extendedRadiusTopLeft_${e.id}`:`extendedRadiusTopLeft`,a=e?.id?`extendedRadiusTopRight_${e.id}`:`extendedRadiusTopRight`,o=e?.id?`extendedRadiusBottomLeft_${e.id}`:`extendedRadiusBottomLeft`,s=e?.id?`extendedRadiusBottomRight_${e.id}`:`extendedRadiusBottomRight`;return{id:t,label:`Corner radius`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`Determining how rounded the corners are.`,show:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:e=>{(0,$.presetCustomValue)(e,r,i,F),(0,$.presetCustomValue)(e,r,a,F),(0,$.presetCustomValue)(e,r,o,F),(0,$.presetCustomValue)(e,r,s,F)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,blocks:[{id:i,type:`input`,label:`Top Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`input`,label:`Top Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,a)},{id:o,type:`input`,label:`Bottom Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,o)},{id:s,type:`input`,label:`Bottom Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,s)}]}],off:[Lr(r,e?.defaultValue)]}},Br=e=>{let t=e?.id?e.id:`hasCustomSpacing`,n=e?.dependentSettingId?e.dependentSettingId:`columns`,r=e?.spacingChoiceId?e.spacingChoiceId:`spacingChoice`,i=e?.spacingCustomId?e.spacingCustomId:`spacingCustom`,a=e?.defaultValueChoices?e.defaultValueChoices:V.M;return{id:t,type:`switch`,defaultValue:!1,switchLabel:`Custom`,label:`Gutter`,info:`An official nerds term for ‘gap’`,onChange:e=>(0,$.presetCustomValue)(e,r,i,ie),show:e=>e.getBlock(n)?.value!==`1`,on:[{id:i,type:`input`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)}],off:[{id:r,type:`slider`,defaultValue:a,choices:[{value:V.Auto,label:`Auto`},{value:V.S,label:`S`},{value:V.M,label:`M`},{value:V.L,label:`L`}]}]}},Vr=e=>({id:e,type:`segmentedControls`,defaultValue:R.None,choices:[{value:R.None,label:`None`},{value:R.Small,label:`S`},{value:R.Medium,label:`M`},{value:R.Large,label:`L`}]}),Hr=e=>{let t=e?.id?`hasCustomMarginValue_${e?.id}`:`hasCustomMarginValue`,n=e?.id?`marginValue_${e?.id}`:`marginValue`,r=e?.id?`marginChoice_${e?.id}`:`marginChoice`;return{id:t,label:`Margin`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`The spacing around UI elements to create more space`,onChange:t=>(0,$.presetCustomValue)(t,r,n,e?.marginStyleMap||z),on:[{id:n,type:`input`,placeholder:M,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Vr(r)]}},Ur=e=>{let t=e?.id?`hasExtendedCustomMargin_${e?.id}`:`hasExtendedCustomMargin`,n=e?.id?`extendedMarginValues_${e?.id}`:`extendedMarginValues`,r=e?.id?`extendedMarginChoice_${e?.id}`:`extendedMarginChoice`,i=e?.id?`extendedMarginTop_${e?.id}`:`extendedMarginTop`,a=e?.id?`extendedMarginLeft_${e?.id}`:`extendedMarginLeft`,o=e?.id?`extendedMarginRight_${e?.id}`:`extendedMarginRight`,s=e?.id?`extendedMarginBottom_${e?.id}`:`extendedMarginBottom`;return{id:t,label:`Margin`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`The spacing around UI elements to create more negative space`,onChange:e=>{(0,$.presetCustomValue)(e,r,i,z),(0,$.presetCustomValue)(e,r,a,z),(0,$.presetCustomValue)(e,r,o,z),(0,$.presetCustomValue)(e,r,s,z)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Vr(r)]}},Wr=e=>({id:e,type:`segmentedControls`,defaultValue:I.Small,choices:[{value:I.None,label:`None`},{value:I.Small,label:`S`},{value:I.Medium,label:`M`},{value:I.Large,label:`L`}]}),Gr=e=>{let t=e?.id?`hasCustomPaddingValue_${e?.id}`:`hasCustomPaddingValue`,n=e?.id?`paddingValue_${e?.id}`:`paddingValue`,r=e?.id?`paddingChoice_${e?.id}`:`paddingChoice`;return{id:t,label:`Padding`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`The spacing around UI elements to create more negative space`,onChange:t=>(0,$.presetCustomValue)(t,r,n,e?.paddingStyleMap||L),on:[{id:n,type:`input`,placeholder:j,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Wr(r)]}},Kr=e=>{let t=e?.id?`hasExtendedCustomPadding_${e?.id}`:`hasExtendedCustomPadding`,n=e?.id?`extendedPaddingValues_${e?.id}`:`extendedPaddingValues`,r=e?.id?`extendedPaddingChoice_${e?.id}`:`extendedPaddingChoice`,i=e?.id?`extendedPaddingTop_${e?.id}`:`extendedPaddingTop`,a=e?.id?`extendedPaddingLeft_${e?.id}`:`extendedPaddingLeft`,o=e?.id?`extendedPaddingRight_${e?.id}`:`extendedPaddingRight`,s=e?.id?`extendedPaddingBottom_${e?.id}`:`extendedPaddingBottom`;return{id:t,label:`Padding`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`The spacing around UI elements to create more negative space`,onChange:e=>{(0,$.presetCustomValue)(e,r,i,L),(0,$.presetCustomValue)(e,r,a,L),(0,$.presetCustomValue)(e,r,o,L),(0,$.presetCustomValue)(e,r,s,L)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Wr(r)]}},qr=e=>{let t=Jr(e?.globalControlId);return{id:e?.id?e.id:`downloadable`,type:`switch`,defaultValue:!1,label:`Downloadable`,show:e=>e.getBlock(t)?.value===B.Custom}},Jr=e=>e||`security`,Yr=e=>[{id:Jr(e),type:`segmentedControls`,defaultValue:B.Global,choices:[{value:B.Global,label:`Global Settings`},{value:B.Custom,label:`Custom`}]},{id:`globalSettingsInfo`,type:`notification`,footer:(0,$.createFooter)({label:`Change global settings [here].`,replace:{here:{event:`general-settings.open`}}})}],$=i({AllTextStylePlugins:()=>Dr,AllTextStyles:()=>Or,AttachmentOperationsProvider:()=>_e,Attachments:()=>we,AttachmentsProvider:()=>ge,AttachmentsToolbarButton:()=>Oe,BUTTON_PLUGIN:()=>Vt,BlockButtonStyles:()=>gt,BlockInjectButton:()=>b,BlockItemWrapper:()=>ze,BlockStyles:()=>X,BorderStyle:()=>N,BreakAfterPlugin:()=>wn,ButtonPlugin:()=>Ut,Custom1Plugin:()=>En,Custom2Plugin:()=>jn,Custom3Plugin:()=>In,DEFAULT_ATTACHMENTS_BUTTON_ID:()=>De,DEFAULT_DRAGGING_TOOLTIP:()=>Ae,DEFAULT_DRAG_TOOLTIP:()=>ke,DEFAULT_MENU_BUTTON_ID:()=>Pe,DragHandleToolbarButton:()=>Me,DragPreviewContextProvider:()=>ce,ELEMENT_BUTTON:()=>Z,FlyoutToolbarButton:()=>Ne,GAP_DEFAULT:()=>Cn,GutterSpacing:()=>V,Heading1Plugin:()=>Vn,Heading2Plugin:()=>Kn,Heading3Plugin:()=>Zn,Heading4Plugin:()=>nr,ImageCaptionPlugin:()=>sr,ImageTitlePlugin:()=>fr,KEY_ELEMENT_BREAK_AFTER_COLUMN:()=>Sn,LinkInput:()=>jt,LinkPlugin:()=>xn,LinkSelector:()=>At,Margin:()=>R,MenuToolbarButton:()=>Fe,MultiFlyoutContextProvider:()=>ue,OrderedListPlugin:()=>Mr,PARAGRAPH_CLASSES:()=>_r,Padding:()=>I,ParagraphMarkupElement:()=>yr,ParagraphMarkupElementNode:()=>vr,ParagraphPlugin:()=>gr,QuoteMarkupElementNode:()=>wr,QuotePlugin:()=>Sr,Radius:()=>P,RichTextEditor:()=>an,Sections:()=>Xr,Security:()=>B,THEME_PREFIX:()=>Pr,TextStylePluginsWithoutImage:()=>Er,TextStyles:()=>Y,TextStylesWithoutImage:()=>Q,Toolbar:()=>Re,UnorderedListPlugin:()=>Ar,addHttps:()=>Qe,borderStyleMap:()=>re,convertToRteValue:()=>We,createButtonNode:()=>dt,createButtonPlugin:()=>Ht,createLinkPlugin:()=>bn,createParagraphPlugin:()=>br,createQuotePlugin:()=>Tr,defineBlock:()=>Zr,defineSettings:()=>Qr,getBackgroundColorStyles:()=>A,getBackgroundSettings:()=>Fr,getBorderRadiusSettings:()=>Rr,getBorderRadiusSlider:()=>Lr,getBorderSettings:()=>Ir,getBorderStyles:()=>ae,getDefaultPluginsWithLinkChooser:()=>Nr,getExtendedBorderRadiusSettings:()=>zr,getGutterSettings:()=>Br,getLegacyUrl:()=>qe,getLinkFromEditor:()=>Xe,getMarginExtendedSettings:()=>Ur,getMarginSettings:()=>Hr,getMarginSlider:()=>Vr,getPaddingExtendedSettings:()=>Kr,getPaddingSettings:()=>Gr,getPaddingSlider:()=>Wr,getRadiusStyles:()=>oe,getReadableColor:()=>k,getSecurityDownloadableSetting:()=>qr,getSecurityGlobalControlId:()=>Jr,getSecurityGlobalControlSetting:()=>Yr,getUrl:()=>Je,getUrlFromEditor:()=>ut,getUrlFromLinkOrLegacyLink:()=>Ye,gutterSpacingStyleMap:()=>ie,hasRichTextValue:()=>Ue,insertButton:()=>tt,isDark:()=>C,isDownloadable:()=>Ge,isValidUrl:()=>$e,isValidUrlOrEmpty:()=>K,joinClassNames:()=>y,marginStyleMap:()=>z,paddingStyleMap:()=>L,radiusStyleMap:()=>F,relativeUrlRegex:()=>Ze,setAlpha:()=>D,submitFloatingButton:()=>nt,toColorObject:()=>O,toHex8String:()=>w,toHexString:()=>T,toRgbaString:()=>E,toShortRgba:()=>x,triggerFloatingButton:()=>ft,triggerFloatingButtonEdit:()=>pt,triggerFloatingButtonInsert:()=>mt,unwrapButton:()=>q,upsertButton:()=>rt,upsertButtonText:()=>st,useAttachmentOperations:()=>pe,useAttachments:()=>me,useAttachmentsContext:()=>ve,useDragPreviewContext:()=>H,useMultiFlyoutContext:()=>de,useMultiFlyoutState:()=>fe,withAttachmentsProvider:()=>ye,withButton:()=>et,wrapButton:()=>ct});o($,require("@frontify/sidebar-settings"));var Xr=function(e){return e.Main=`main`,e.Basics=`basics`,e.Layout=`layout`,e.Style=`style`,e.Security=`security`,e.Targets=`targets`,e}({}),Zr=e=>e,Qr=e=>e;exports.AllTextStylePlugins=Dr,exports.AllTextStyles=Or,exports.AttachmentOperationsProvider=_e,exports.Attachments=we,exports.AttachmentsProvider=ge,exports.AttachmentsToolbarButton=Oe,exports.BUTTON_PLUGIN=Vt,exports.BlockButtonStyles=gt,exports.BlockInjectButton=b,exports.BlockItemWrapper=ze,exports.BlockStyles=X,exports.BorderStyle=N,exports.BreakAfterPlugin=wn,exports.ButtonPlugin=Ut,exports.Custom1Plugin=En,exports.Custom2Plugin=jn,exports.Custom3Plugin=In,exports.DEFAULT_ATTACHMENTS_BUTTON_ID=De,exports.DEFAULT_DRAGGING_TOOLTIP=Ae,exports.DEFAULT_DRAG_TOOLTIP=ke,exports.DEFAULT_MENU_BUTTON_ID=Pe,exports.DragHandleToolbarButton=Me,exports.DragPreviewContextProvider=ce,exports.ELEMENT_BUTTON=Z,exports.FlyoutToolbarButton=Ne,exports.GAP_DEFAULT=Cn,exports.GutterSpacing=V,exports.Heading1Plugin=Vn,exports.Heading2Plugin=Kn,exports.Heading3Plugin=Zn,exports.Heading4Plugin=nr,exports.ImageCaptionPlugin=sr,exports.ImageTitlePlugin=fr,exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=Sn,exports.LinkInput=jt,exports.LinkPlugin=xn,exports.LinkSelector=At,exports.Margin=R,exports.MenuToolbarButton=Fe,exports.MultiFlyoutContextProvider=ue,exports.OrderedListPlugin=Mr,exports.PARAGRAPH_CLASSES=_r,exports.Padding=I,exports.ParagraphMarkupElement=yr,exports.ParagraphMarkupElementNode=vr,exports.ParagraphPlugin=gr,exports.QuoteMarkupElementNode=wr,exports.QuotePlugin=Sr,exports.Radius=P,exports.RichTextEditor=an,exports.Sections=Xr,exports.Security=B,exports.THEME_PREFIX=Pr,exports.TextStylePluginsWithoutImage=Er,exports.TextStyles=Y,exports.TextStylesWithoutImage=Q,exports.Toolbar=Re,exports.UnorderedListPlugin=Ar,exports.addHttps=Qe,exports.borderStyleMap=re,exports.convertToRteValue=We,exports.createButtonNode=dt,exports.createButtonPlugin=Ht,exports.createLinkPlugin=bn,exports.createParagraphPlugin=br,exports.createQuotePlugin=Tr,exports.defineBlock=Zr,exports.defineSettings=Qr,exports.getBackgroundColorStyles=A,exports.getBackgroundSettings=Fr,exports.getBorderRadiusSettings=Rr,exports.getBorderRadiusSlider=Lr,exports.getBorderSettings=Ir,exports.getBorderStyles=ae,exports.getDefaultPluginsWithLinkChooser=Nr,exports.getExtendedBorderRadiusSettings=zr,exports.getGutterSettings=Br,exports.getLegacyUrl=qe,exports.getLinkFromEditor=Xe,exports.getMarginExtendedSettings=Ur,exports.getMarginSettings=Hr,exports.getMarginSlider=Vr,exports.getPaddingExtendedSettings=Kr,exports.getPaddingSettings=Gr,exports.getPaddingSlider=Wr,exports.getRadiusStyles=oe,exports.getReadableColor=k,exports.getSecurityDownloadableSetting=qr,exports.getSecurityGlobalControlId=Jr,exports.getSecurityGlobalControlSetting=Yr,exports.getUrl=Je,exports.getUrlFromEditor=ut,exports.getUrlFromLinkOrLegacyLink=Ye,exports.gutterSpacingStyleMap=ie,exports.hasRichTextValue=Ue,exports.insertButton=tt,exports.isDark=C,exports.isDownloadable=Ge,exports.isValidUrl=$e,exports.isValidUrlOrEmpty=K,exports.joinClassNames=y,exports.marginStyleMap=z,exports.paddingStyleMap=L,exports.radiusStyleMap=F,exports.relativeUrlRegex=Ze,exports.setAlpha=D,exports.submitFloatingButton=nt,exports.toColorObject=O,exports.toHex8String=w,exports.toHexString=T,exports.toRgbaString=E,exports.toShortRgba=x,exports.triggerFloatingButton=ft,exports.triggerFloatingButtonEdit=pt,exports.triggerFloatingButtonInsert=mt,exports.unwrapButton=q,exports.upsertButton=rt,exports.upsertButtonText=st,exports.useAttachmentOperations=pe,exports.useAttachments=me,exports.useAttachmentsContext=ve,exports.useDragPreviewContext=H,exports.useMultiFlyoutContext=de,exports.useMultiFlyoutState=fe,exports.withAttachmentsProvider=ye,exports.withButton=et,exports.wrapButton=ct;var $r=require("@frontify/sidebar-settings");Object.keys($r).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return $r[e]}})});
8
+ //# sourceMappingURL=index.cjs.js.map