@makeswift/runtime 0.8.11 → 0.9.1

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 (273) hide show
  1. package/dist/Box.cjs.js +16 -15
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +11 -10
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +13 -12
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +11 -10
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +28 -27
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +7 -6
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +16 -15
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +8 -7
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +13 -12
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +11 -10
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.cjs.js +4 -29
  22. package/dist/Embed.cjs.js.map +1 -1
  23. package/dist/Embed.es.js +3 -28
  24. package/dist/Embed.es.js.map +1 -1
  25. package/dist/Form.cjs.js +52 -51
  26. package/dist/Form.cjs.js.map +1 -1
  27. package/dist/Form.es.js +8 -7
  28. package/dist/Form.es.js.map +1 -1
  29. package/dist/Image.cjs.js +9 -8
  30. package/dist/Image.cjs.js.map +1 -1
  31. package/dist/Image.es.js +8 -7
  32. package/dist/Image.es.js.map +1 -1
  33. package/dist/LiveProvider.cjs.js +6 -5
  34. package/dist/LiveProvider.cjs.js.map +1 -1
  35. package/dist/LiveProvider.es.js +8 -7
  36. package/dist/LiveProvider.es.js.map +1 -1
  37. package/dist/Navigation.cjs.js +28 -27
  38. package/dist/Navigation.cjs.js.map +1 -1
  39. package/dist/Navigation.es.js +7 -6
  40. package/dist/Navigation.es.js.map +1 -1
  41. package/dist/PreviewProvider.cjs.js +23 -7
  42. package/dist/PreviewProvider.cjs.js.map +1 -1
  43. package/dist/PreviewProvider.es.js +24 -8
  44. package/dist/PreviewProvider.es.js.map +1 -1
  45. package/dist/ReadOnlyText.cjs.js +22 -20
  46. package/dist/ReadOnlyText.cjs.js.map +1 -1
  47. package/dist/ReadOnlyText.es.js +18 -16
  48. package/dist/ReadOnlyText.es.js.map +1 -1
  49. package/dist/ReadOnlyTextV2.cjs.js +19 -17
  50. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  51. package/dist/ReadOnlyTextV2.es.js +16 -14
  52. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  53. package/dist/Root.cjs.js +8 -7
  54. package/dist/Root.cjs.js.map +1 -1
  55. package/dist/Root.es.js +6 -5
  56. package/dist/Root.es.js.map +1 -1
  57. package/dist/SocialLinks.cjs.js +15 -14
  58. package/dist/SocialLinks.cjs.js.map +1 -1
  59. package/dist/SocialLinks.es.js +11 -10
  60. package/dist/SocialLinks.es.js.map +1 -1
  61. package/dist/Text.cjs.js +5 -4
  62. package/dist/Text.cjs.js.map +1 -1
  63. package/dist/Text.es.js +6 -5
  64. package/dist/Text.es.js.map +1 -1
  65. package/dist/Video.cjs.js +4 -29
  66. package/dist/Video.cjs.js.map +1 -1
  67. package/dist/Video.es.js +3 -28
  68. package/dist/Video.es.js.map +1 -1
  69. package/dist/actions.cjs.js +16 -1
  70. package/dist/actions.cjs.js.map +1 -1
  71. package/dist/actions.es.js +14 -2
  72. package/dist/actions.es.js.map +1 -1
  73. package/dist/builder.cjs.js +5 -0
  74. package/dist/builder.cjs.js.map +1 -1
  75. package/dist/builder.es.js +5 -0
  76. package/dist/builder.es.js.map +1 -1
  77. package/dist/components.cjs.js +10 -9
  78. package/dist/components.cjs.js.map +1 -1
  79. package/dist/components.es.js +10 -9
  80. package/dist/components.es.js.map +1 -1
  81. package/dist/control-serialization.cjs.js +89 -10
  82. package/dist/control-serialization.cjs.js.map +1 -1
  83. package/dist/control-serialization.es.js +90 -11
  84. package/dist/control-serialization.es.js.map +1 -1
  85. package/dist/controls.cjs.js +12 -3
  86. package/dist/controls.cjs.js.map +1 -1
  87. package/dist/controls.es.js +6 -2
  88. package/dist/controls.es.js.map +1 -1
  89. package/dist/deepEqual.cjs.js +40 -0
  90. package/dist/deepEqual.cjs.js.map +1 -0
  91. package/dist/deepEqual.es.js +39 -0
  92. package/dist/deepEqual.es.js.map +1 -0
  93. package/dist/index.cjs.js +298 -292
  94. package/dist/index.cjs.js.map +1 -1
  95. package/dist/index.cjs10.js +18 -16
  96. package/dist/index.cjs10.js.map +1 -1
  97. package/dist/index.cjs2.js +14 -14
  98. package/dist/index.cjs2.js.map +1 -1
  99. package/dist/index.cjs4.js +2 -1
  100. package/dist/index.cjs4.js.map +1 -1
  101. package/dist/index.cjs5.js +0 -522
  102. package/dist/index.cjs5.js.map +1 -1
  103. package/dist/index.cjs6.js +1 -2
  104. package/dist/index.cjs6.js.map +1 -1
  105. package/dist/index.cjs7.js +0 -52
  106. package/dist/index.cjs7.js.map +1 -1
  107. package/dist/index.cjs8.js +5 -4
  108. package/dist/index.cjs8.js.map +1 -1
  109. package/dist/index.cjs9.js +72 -69
  110. package/dist/index.cjs9.js.map +1 -1
  111. package/dist/index.es.js +282 -275
  112. package/dist/index.es.js.map +1 -1
  113. package/dist/index.es10.js +16 -14
  114. package/dist/index.es10.js.map +1 -1
  115. package/dist/index.es2.js +3 -3
  116. package/dist/index.es3.js +1 -1
  117. package/dist/index.es4.js +2 -1
  118. package/dist/index.es4.js.map +1 -1
  119. package/dist/index.es5.js +2 -514
  120. package/dist/index.es5.js.map +1 -1
  121. package/dist/index.es6.js +1 -2
  122. package/dist/index.es6.js.map +1 -1
  123. package/dist/index.es7.js +2 -53
  124. package/dist/index.es7.js.map +1 -1
  125. package/dist/index.es8.js +5 -4
  126. package/dist/index.es8.js.map +1 -1
  127. package/dist/index.es9.js +74 -71
  128. package/dist/index.es9.js.map +1 -1
  129. package/dist/leaf.cjs.js +1 -1
  130. package/dist/leaf.cjs.js.map +1 -1
  131. package/dist/leaf.es.js +2 -2
  132. package/dist/main.cjs.js +8 -0
  133. package/dist/main.cjs.js.map +1 -1
  134. package/dist/main.es.js +7 -2
  135. package/dist/main.es.js.map +1 -1
  136. package/dist/next.cjs.js +5 -4
  137. package/dist/next.cjs.js.map +1 -1
  138. package/dist/next.es.js +6 -5
  139. package/dist/next.es.js.map +1 -1
  140. package/dist/prop-controllers.cjs.js +5 -0
  141. package/dist/prop-controllers.cjs.js.map +1 -1
  142. package/dist/prop-controllers.es.js +5 -0
  143. package/dist/prop-controllers.es.js.map +1 -1
  144. package/dist/react-page.cjs.js +1013 -190
  145. package/dist/react-page.cjs.js.map +1 -1
  146. package/dist/react-page.es.js +968 -185
  147. package/dist/react-page.es.js.map +1 -1
  148. package/dist/react.cjs.js +5 -4
  149. package/dist/react.cjs.js.map +1 -1
  150. package/dist/react.es.js +5 -4
  151. package/dist/react.es.js.map +1 -1
  152. package/dist/slate.cjs.js +96 -14
  153. package/dist/slate.cjs.js.map +1 -1
  154. package/dist/slate.es.js +89 -6
  155. package/dist/slate.es.js.map +1 -1
  156. package/dist/types/src/api/graphql/documents/queries.d.ts.map +1 -1
  157. package/dist/types/src/api/graphql/generated/types.d.ts +0 -8
  158. package/dist/types/src/api/graphql/generated/types.d.ts.map +1 -1
  159. package/dist/types/src/builder/serialization/control-serialization.d.ts +3 -3
  160. package/dist/types/src/builder/serialization/control-serialization.d.ts.map +1 -1
  161. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts +2 -2
  162. package/dist/types/src/builder/serialization/controls/rich-text-v2.d.ts.map +1 -1
  163. package/dist/types/src/builder/serialization/controls/style-v2.d.ts +5 -0
  164. package/dist/types/src/builder/serialization/controls/style-v2.d.ts.map +1 -0
  165. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  166. package/dist/types/src/components/builtin/Carousel/register.d.ts.map +1 -1
  167. package/dist/types/src/components/builtin/Countdown/register.d.ts.map +1 -1
  168. package/dist/types/src/components/builtin/Divider/register.d.ts.map +1 -1
  169. package/dist/types/src/components/builtin/Embed/register.d.ts.map +1 -1
  170. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  171. package/dist/types/src/components/builtin/Form/register.d.ts.map +1 -1
  172. package/dist/types/src/components/builtin/Navigation/register.d.ts.map +1 -1
  173. package/dist/types/src/components/builtin/SocialLinks/register.d.ts.map +1 -1
  174. package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +1 -1
  175. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  176. package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +1 -1
  177. package/dist/types/src/components/builtin/Video/register.d.ts.map +1 -1
  178. package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
  179. package/dist/types/src/components/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
  180. package/dist/types/src/controls/control.d.ts +3 -2
  181. package/dist/types/src/controls/control.d.ts.map +1 -1
  182. package/dist/types/src/controls/index.d.ts +1 -0
  183. package/dist/types/src/controls/index.d.ts.map +1 -1
  184. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +10 -5
  185. package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  186. package/dist/types/src/controls/style-v2.d.ts +55 -0
  187. package/dist/types/src/controls/style-v2.d.ts.map +1 -0
  188. package/dist/types/src/index.d.ts +2 -1
  189. package/dist/types/src/index.d.ts.map +1 -1
  190. package/dist/types/src/next/api-handler/handlers/manifest.d.ts +3 -1
  191. package/dist/types/src/next/api-handler/handlers/manifest.d.ts.map +1 -1
  192. package/dist/types/src/next/api-handler/handlers/proxy-preview-mode.d.ts.map +1 -1
  193. package/dist/types/src/next/api-handler/index.d.ts +2 -1
  194. package/dist/types/src/next/api-handler/index.d.ts.map +1 -1
  195. package/dist/types/src/next/client.d.ts +7 -7
  196. package/dist/types/src/next/client.d.ts.map +1 -1
  197. package/dist/types/src/next/index.d.ts +8 -5
  198. package/dist/types/src/next/index.d.ts.map +1 -1
  199. package/dist/types/src/next/preview-mode.d.ts +17 -3
  200. package/dist/types/src/next/preview-mode.d.ts.map +1 -1
  201. package/dist/types/src/prop-controllers/descriptors.d.ts +4 -3
  202. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  203. package/dist/types/src/prop-controllers/instances.d.ts +2 -2
  204. package/dist/types/src/prop-controllers/instances.d.ts.map +1 -1
  205. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
  206. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  207. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts +2 -1
  208. package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
  209. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  210. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts +1 -1
  211. package/dist/types/src/runtimes/react/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
  212. package/dist/types/src/runtimes/react/controls/style-v2.d.ts +4 -0
  213. package/dist/types/src/runtimes/react/controls/style-v2.d.ts.map +1 -0
  214. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  215. package/dist/types/src/runtimes/react/index.d.ts +3 -1
  216. package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
  217. package/dist/types/src/slate/BlockPlugin/constants.d.ts.map +1 -0
  218. package/dist/types/src/slate/BlockPlugin/dedent.d.ts.map +1 -0
  219. package/dist/types/src/slate/BlockPlugin/indent.d.ts.map +1 -0
  220. package/dist/types/src/slate/BlockPlugin/index.d.ts +29 -3
  221. package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
  222. package/dist/types/src/slate/BlockPlugin/toggleList.d.ts.map +1 -0
  223. package/dist/types/src/slate/BlockPlugin/unwrapList.d.ts.map +1 -0
  224. package/dist/types/src/slate/BlockPlugin/utils/filterForSubtreeRoots.d.ts.map +1 -0
  225. package/dist/types/src/slate/BlockPlugin/utils/getSelectedListItems.d.ts.map +1 -0
  226. package/dist/types/src/slate/BlockPlugin/utils/location.d.ts.map +1 -0
  227. package/dist/types/src/slate/BlockPlugin/wrapList.d.ts.map +1 -0
  228. package/dist/types/src/slate/InlineModePlugin/index.d.ts +2 -1
  229. package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
  230. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +9 -0
  231. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -0
  232. package/dist/types/src/slate/index.d.ts +1 -1
  233. package/dist/types/src/slate/index.d.ts.map +1 -1
  234. package/dist/types/src/slate/types.d.ts +18 -0
  235. package/dist/types/src/slate/types.d.ts.map +1 -1
  236. package/dist/types/src/slate/utils/element.d.ts +1 -2
  237. package/dist/types/src/slate/utils/element.d.ts.map +1 -1
  238. package/dist/types/src/state/actions.d.ts +26 -1
  239. package/dist/types/src/state/actions.d.ts.map +1 -1
  240. package/dist/types/src/state/modules/components-meta.d.ts +25 -1
  241. package/dist/types/src/state/modules/components-meta.d.ts.map +1 -1
  242. package/dist/types/src/state/modules/locales.d.ts +16 -0
  243. package/dist/types/src/state/modules/locales.d.ts.map +1 -0
  244. package/dist/types/src/state/react-builder-preview.d.ts +2 -0
  245. package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
  246. package/dist/types/src/state/react-page.d.ts +5 -1
  247. package/dist/types/src/state/react-page.d.ts.map +1 -1
  248. package/dist/useMediaQuery.es.js +1 -1
  249. package/package.json +6 -3
  250. package/dist/select.cjs.js +0 -8
  251. package/dist/select.cjs.js.map +0 -1
  252. package/dist/select.es.js +0 -6
  253. package/dist/select.es.js.map +0 -1
  254. package/dist/types/src/slate/ListPlugin/constants.d.ts.map +0 -1
  255. package/dist/types/src/slate/ListPlugin/dedent.d.ts.map +0 -1
  256. package/dist/types/src/slate/ListPlugin/indent.d.ts.map +0 -1
  257. package/dist/types/src/slate/ListPlugin/index.d.ts +0 -17
  258. package/dist/types/src/slate/ListPlugin/index.d.ts.map +0 -1
  259. package/dist/types/src/slate/ListPlugin/toggleList.d.ts.map +0 -1
  260. package/dist/types/src/slate/ListPlugin/unwrapList.d.ts.map +0 -1
  261. package/dist/types/src/slate/ListPlugin/utils/filterForSubtreeRoots.d.ts.map +0 -1
  262. package/dist/types/src/slate/ListPlugin/utils/getSelectedListItems.d.ts.map +0 -1
  263. package/dist/types/src/slate/ListPlugin/utils/location.d.ts.map +0 -1
  264. package/dist/types/src/slate/ListPlugin/wrapList.d.ts.map +0 -1
  265. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/constants.d.ts +0 -0
  266. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/dedent.d.ts +0 -0
  267. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/indent.d.ts +0 -0
  268. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/toggleList.d.ts +0 -0
  269. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/unwrapList.d.ts +0 -0
  270. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/filterForSubtreeRoots.d.ts +0 -0
  271. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/getSelectedListItems.d.ts +0 -0
  272. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/utils/location.d.ts +0 -0
  273. /package/dist/types/src/slate/{ListPlugin → BlockPlugin}/wrapList.d.ts +0 -0
@@ -22,13 +22,64 @@ var __publicField = (obj, key, value) => {
22
22
  return value;
23
23
  };
24
24
  const import_meta = {};
25
+ var _a;
25
26
  import { combineReducers, createStore, applyMiddleware } from "redux";
26
27
  import thunk from "redux-thunk";
27
28
  import { A as ActionTypes } from "./actions.es.js";
28
- import { reducer as reducer$9, getInitialState as getInitialState$8 } from "./state/breakpoints.es.js";
29
- import "slate";
30
- import "is-hotkey";
29
+ import { findBreakpointOverride, reducer as reducer$a, getInitialState as getInitialState$9 } from "./state/breakpoints.es.js";
30
+ import * as React from "react";
31
+ import { cache, cx } from "@emotion/css";
32
+ import { serializeStyles } from "@emotion/serialize";
33
+ import { registerStyles, insertStyles } from "@emotion/utils";
34
+ import { Element, Range, Editor, Text, Path, Transforms, Node, Point } from "slate";
35
+ import isHotkey from "is-hotkey";
31
36
  import "slate-react";
37
+ import { jsx, Fragment } from "react/jsx-runtime";
38
+ const ComponentIcon = {
39
+ Billing: "billing",
40
+ Bolt: "bolt",
41
+ Button: "button",
42
+ Carousel: "carousel",
43
+ Chats: "chats",
44
+ Code: "code",
45
+ Countdown: "countdown",
46
+ Cube: "cube",
47
+ Database: "database",
48
+ Divider: "divider",
49
+ Form: "form",
50
+ Gallery: "gallery",
51
+ Help: "help",
52
+ Image: "image",
53
+ Layout: "layout",
54
+ Lock: "lock",
55
+ Navigation: "navigation",
56
+ SocialLinks: "social-links",
57
+ Star: "star",
58
+ Text: "text",
59
+ Users: "users",
60
+ Video: "video"
61
+ };
62
+ function getInitialState$8({
63
+ componentsMeta = /* @__PURE__ */ new Map()
64
+ } = {}) {
65
+ return componentsMeta;
66
+ }
67
+ function getComponentsMeta(state) {
68
+ return state;
69
+ }
70
+ function reducer$9(state = getInitialState$8(), action) {
71
+ switch (action.type) {
72
+ case ActionTypes.REGISTER_COMPONENT:
73
+ return new Map(state).set(action.payload.type, action.payload.meta);
74
+ case ActionTypes.UNREGISTER_COMPONENT: {
75
+ const nextState = new Map(state);
76
+ const deleted = nextState.delete(action.payload.type);
77
+ return deleted ? nextState : state;
78
+ }
79
+ default:
80
+ return state;
81
+ }
82
+ }
32
83
  function isElementReference(element) {
33
84
  return !("props" in element);
34
85
  }
@@ -51,8 +102,8 @@ function getDocuments(state) {
51
102
  return state;
52
103
  }
53
104
  function getDocument$1(state, documentKey) {
54
- var _a;
55
- return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
105
+ var _a2;
106
+ return (_a2 = getDocuments(state).get(documentKey)) != null ? _a2 : null;
56
107
  }
57
108
  function reducer$8(state = getInitialState$7(), action) {
58
109
  switch (action.type) {
@@ -76,8 +127,8 @@ function getReactComponents(state) {
76
127
  return state;
77
128
  }
78
129
  function getReactComponent$1(state, type) {
79
- var _a;
80
- return (_a = getReactComponents(state).get(type)) != null ? _a : null;
130
+ var _a2;
131
+ return (_a2 = getReactComponents(state).get(type)) != null ? _a2 : null;
81
132
  }
82
133
  function reducer$7(state = getInitialState$6(), action) {
83
134
  switch (action.type) {
@@ -93,27 +144,6 @@ function reducer$7(state = getInitialState$6(), action) {
93
144
  }
94
145
  }
95
146
  function getInitialState$5({
96
- componentsMeta = /* @__PURE__ */ new Map()
97
- } = {}) {
98
- return componentsMeta;
99
- }
100
- function getComponentsMeta(state) {
101
- return state;
102
- }
103
- function reducer$6(state = getInitialState$5(), action) {
104
- switch (action.type) {
105
- case ActionTypes.REGISTER_COMPONENT:
106
- return new Map(state).set(action.payload.type, action.payload.meta);
107
- case ActionTypes.UNREGISTER_COMPONENT: {
108
- const nextState = new Map(state);
109
- const deleted = nextState.delete(action.payload.type);
110
- return deleted ? nextState : state;
111
- }
112
- default:
113
- return state;
114
- }
115
- }
116
- function getInitialState$4({
117
147
  propControllerDescriptors = /* @__PURE__ */ new Map()
118
148
  } = {}) {
119
149
  return propControllerDescriptors;
@@ -122,10 +152,10 @@ function getPropControllerDescriptors$1(state) {
122
152
  return state;
123
153
  }
124
154
  function getComponentPropControllerDescriptors$1(state, componentType) {
125
- var _a;
126
- return (_a = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a : null;
155
+ var _a2;
156
+ return (_a2 = getPropControllerDescriptors$1(state).get(componentType)) != null ? _a2 : null;
127
157
  }
128
- function reducer$5(state = getInitialState$4(), action) {
158
+ function reducer$6(state = getInitialState$5(), action) {
129
159
  switch (action.type) {
130
160
  case ActionTypes.REGISTER_COMPONENT:
131
161
  return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
@@ -144,28 +174,28 @@ function isPropControllersHandle(value) {
144
174
  }
145
175
  return false;
146
176
  }
147
- function getInitialState$3() {
177
+ function getInitialState$4() {
148
178
  return { handles: /* @__PURE__ */ new Map(), instances: /* @__PURE__ */ new Map() };
149
179
  }
150
180
  function getPropControllersHandle(state, documentKey, elementKey) {
151
- var _a, _b;
152
- return (_b = (_a = state.handles.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
181
+ var _a2, _b;
182
+ return (_b = (_a2 = state.handles.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
153
183
  }
154
184
  function getPropControllers$1(state, documentKey, elementKey) {
155
- var _a, _b;
156
- return (_b = (_a = state.instances.get(documentKey)) == null ? void 0 : _a.get(elementKey)) != null ? _b : null;
185
+ var _a2, _b;
186
+ return (_b = (_a2 = state.instances.get(documentKey)) == null ? void 0 : _a2.get(elementKey)) != null ? _b : null;
157
187
  }
158
188
  function getPropController(state, documentKey, elementKey, propName) {
159
- var _a, _b;
160
- return (_b = (_a = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a[propName]) != null ? _b : null;
189
+ var _a2, _b;
190
+ return (_b = (_a2 = getPropControllers$1(state, documentKey, elementKey)) == null ? void 0 : _a2[propName]) != null ? _b : null;
161
191
  }
162
- function reducer$4(state = getInitialState$3(), action) {
163
- var _a, _b, _c, _d;
192
+ function reducer$5(state = getInitialState$4(), action) {
193
+ var _a2, _b, _c, _d;
164
194
  switch (action.type) {
165
195
  case ActionTypes.REGISTER_PROP_CONTROLLERS_HANDLE: {
166
196
  const { documentKey, elementKey, handle } = action.payload;
167
197
  return __spreadProps(__spreadValues({}, state), {
168
- handles: new Map(state.handles).set(documentKey, new Map((_a = state.handles.get(documentKey)) != null ? _a : []).set(elementKey, handle))
198
+ handles: new Map(state.handles).set(documentKey, new Map((_a2 = state.handles.get(documentKey)) != null ? _a2 : []).set(elementKey, handle))
169
199
  });
170
200
  }
171
201
  case ActionTypes.UNREGISTER_PROP_CONTROLLERS_HANDLE: {
@@ -190,10 +220,10 @@ function reducer$4(state = getInitialState$3(), action) {
190
220
  return state;
191
221
  }
192
222
  }
193
- function getInitialState$2() {
223
+ function getInitialState$3() {
194
224
  return false;
195
225
  }
196
- function reducer$3(state = getInitialState$2(), action) {
226
+ function reducer$4(state = getInitialState$3(), action) {
197
227
  switch (action.type) {
198
228
  case ActionTypes.SET_IS_IN_BUILDER:
199
229
  return action.payload;
@@ -201,13 +231,13 @@ function reducer$3(state = getInitialState$2(), action) {
201
231
  return state;
202
232
  }
203
233
  }
204
- function getInitialState$1(isPreview = false) {
234
+ function getInitialState$2(isPreview = false) {
205
235
  return isPreview;
206
236
  }
207
237
  function getIsPreview$1(state) {
208
238
  return state;
209
239
  }
210
- function reducer$2(state = getInitialState$1(), action) {
240
+ function reducer$3(state = getInitialState$2(), action) {
211
241
  switch (action.type) {
212
242
  default:
213
243
  return state;
@@ -218,10 +248,10 @@ const BuilderEditMode = {
218
248
  CONTENT: "content",
219
249
  INTERACT: "interact"
220
250
  };
221
- function getInitialState() {
251
+ function getInitialState$1() {
222
252
  return null;
223
253
  }
224
- function reducer$1(state = getInitialState(), action) {
254
+ function reducer$2(state = getInitialState$1(), action) {
225
255
  switch (action.type) {
226
256
  case ActionTypes.SET_BUILDER_EDIT_MODE:
227
257
  return action.payload.editMode;
@@ -229,16 +259,44 @@ function reducer$1(state = getInitialState(), action) {
229
259
  return state;
230
260
  }
231
261
  }
262
+ function getInitialState(initialState) {
263
+ var _a2, _b, _c;
264
+ return {
265
+ locales: (_a2 = initialState == null ? void 0 : initialState.locales) != null ? _a2 : [],
266
+ locale: (_b = initialState == null ? void 0 : initialState.locale) != null ? _b : null,
267
+ defaultLocale: (_c = initialState == null ? void 0 : initialState.defaultLocale) != null ? _c : null
268
+ };
269
+ }
270
+ function reducer$1(state = getInitialState(), action) {
271
+ switch (action.type) {
272
+ case ActionTypes.SET_LOCALES: {
273
+ const locales = action.payload.locales;
274
+ return __spreadProps(__spreadValues({}, state), { locales });
275
+ }
276
+ case ActionTypes.SET_LOCALE: {
277
+ if (action.payload.locale === state.locale)
278
+ return state;
279
+ return __spreadProps(__spreadValues({}, state), { locale: action.payload.locale });
280
+ }
281
+ case ActionTypes.SET_DEFAULT_LOCALE: {
282
+ if (action.payload.defaultLocale === state.defaultLocale)
283
+ return state;
284
+ return __spreadProps(__spreadValues({}, state), { defaultLocale: action.payload.defaultLocale });
285
+ }
286
+ default:
287
+ return state;
288
+ }
289
+ }
232
290
  const ColorControlType = "makeswift::controls::color";
233
291
  function Color(config = {}) {
234
292
  return { type: ColorControlType, config };
235
293
  }
236
294
  function copyColorData(value, context) {
237
- var _a;
295
+ var _a2;
238
296
  if (value == null)
239
297
  return value;
240
298
  return __spreadProps(__spreadValues({}, value), {
241
- swatchId: (_a = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a : value.swatchId
299
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(value.swatchId)) != null ? _a2 : value.swatchId
242
300
  });
243
301
  }
244
302
  const ImageControlType = "makeswift::controls::image";
@@ -251,10 +309,10 @@ function Image$1(config = {}) {
251
309
  }
252
310
  Image$1.Format = ImageControlValueFormat;
253
311
  function copyImageData(value, context) {
254
- var _a;
312
+ var _a2;
255
313
  if (value == null)
256
314
  return value;
257
- return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
315
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
258
316
  }
259
317
  if (import_meta.vitest) {
260
318
  const { describe, test, expect } = import_meta.vitest;
@@ -287,7 +345,7 @@ function Link$1(config = {}) {
287
345
  return { type: LinkControlType, config };
288
346
  }
289
347
  function copyLinkData(value, context) {
290
- var _a;
348
+ var _a2;
291
349
  if (value == null)
292
350
  return value;
293
351
  if (value.type === "OPEN_PAGE") {
@@ -295,7 +353,7 @@ function copyLinkData(value, context) {
295
353
  if (pageId != null) {
296
354
  return __spreadProps(__spreadValues({}, value), {
297
355
  payload: __spreadProps(__spreadValues({}, value.payload), {
298
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
356
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
299
357
  })
300
358
  });
301
359
  }
@@ -448,6 +506,8 @@ function createPropController(descriptor, send) {
448
506
  return new ShapeControl(send, descriptor);
449
507
  case StyleControlType:
450
508
  return new StyleControl(send);
509
+ case StyleV2ControlType:
510
+ return new StyleV2Control(send);
451
511
  default:
452
512
  return new DefaultPropController(send);
453
513
  }
@@ -504,11 +564,11 @@ class ListControl extends PropController {
504
564
  this.controls = /* @__PURE__ */ new Map();
505
565
  }
506
566
  }
507
- function copyListData(definition, value, context) {
567
+ function copyListData(definition2, value, context) {
508
568
  if (value == null)
509
569
  return value;
510
570
  return value && value.map((item) => __spreadProps(__spreadValues({}, item), {
511
- value: copy(definition.config.type, item.value, context)
571
+ value: copy(definition2.config.type, item.value, context)
512
572
  }));
513
573
  }
514
574
  const ShapeControlType = "makeswift::controls::shape";
@@ -554,11 +614,11 @@ class ShapeControl extends PropController {
554
614
  this.setControls();
555
615
  }
556
616
  }
557
- function copyShapeData(definition, value, context) {
617
+ function copyShapeData(definition2, value, context) {
558
618
  if (value == null)
559
619
  return value;
560
620
  const newValue = {};
561
- for (const [key, itemDefinition] of Object.entries(definition.config.type)) {
621
+ for (const [key, itemDefinition] of Object.entries(definition2.config.type)) {
562
622
  const prop = value[key];
563
623
  newValue[key] = copy(itemDefinition, prop, context);
564
624
  }
@@ -586,10 +646,10 @@ const AllStyleControlProperties = [
586
646
  StyleControlProperty.TextStyle
587
647
  ];
588
648
  function Style(params) {
589
- var _a;
649
+ var _a2;
590
650
  return {
591
651
  type: StyleControlType,
592
- config: { properties: (_a = params == null ? void 0 : params.properties) != null ? _a : StyleControlDefaultProperties }
652
+ config: { properties: (_a2 = params == null ? void 0 : params.properties) != null ? _a2 : StyleControlDefaultProperties }
593
653
  };
594
654
  }
595
655
  Style.Default = StyleControlDefaultProperties;
@@ -807,22 +867,22 @@ function copy$e(value, context) {
807
867
  return value;
808
868
  return value.map((override) => __spreadProps(__spreadValues({}, override), {
809
869
  value: override.value.map((backgroundItem) => {
810
- var _a, _b;
870
+ var _a2, _b;
811
871
  switch (backgroundItem.type) {
812
872
  case "color":
813
873
  return __spreadProps(__spreadValues({}, backgroundItem), {
814
874
  payload: backgroundItem.payload === null ? null : __spreadProps(__spreadValues({}, backgroundItem.payload), {
815
- swatchId: (_a = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a : backgroundItem.payload.swatchId
875
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(backgroundItem.payload.swatchId)) != null ? _a2 : backgroundItem.payload.swatchId
816
876
  })
817
877
  });
818
878
  case "gradient":
819
879
  return __spreadProps(__spreadValues({}, backgroundItem), {
820
880
  payload: __spreadProps(__spreadValues({}, backgroundItem.payload), {
821
881
  stops: backgroundItem.payload.stops.map((stop) => {
822
- var _a2;
882
+ var _a3;
823
883
  return __spreadProps(__spreadValues({}, stop), {
824
884
  color: stop.color == null ? null : __spreadProps(__spreadValues({}, stop.color), {
825
- swatchId: (_a2 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a2 : stop.color.swatchId
885
+ swatchId: (_a3 = context.replacementContext.swatchIds.get(stop.color.swatchId)) != null ? _a3 : stop.color.swatchId
826
886
  })
827
887
  });
828
888
  })
@@ -848,7 +908,7 @@ function copy$d(value, context) {
848
908
  });
849
909
  }
850
910
  function copy$c(value, context) {
851
- var _a, _b;
911
+ var _a2, _b;
852
912
  if (value == null)
853
913
  return value;
854
914
  switch (value.type) {
@@ -858,7 +918,7 @@ function copy$c(value, context) {
858
918
  return value;
859
919
  return __spreadProps(__spreadValues({}, value), {
860
920
  payload: __spreadProps(__spreadValues({}, value.payload), {
861
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : pageId
921
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : pageId
862
922
  })
863
923
  });
864
924
  }
@@ -891,10 +951,10 @@ function copy$b(value, context) {
891
951
  payload: __spreadProps(__spreadValues({}, item.payload), {
892
952
  link: link != null ? copy$c(link, context) : void 0,
893
953
  color: color != null ? color.map((override) => {
894
- var _a;
954
+ var _a2;
895
955
  return __spreadProps(__spreadValues({}, override), {
896
956
  value: __spreadProps(__spreadValues({}, override.value), {
897
- swatchId: (_a = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a : override.value.swatchId
957
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(override.value.swatchId)) != null ? _a2 : override.value.swatchId
898
958
  })
899
959
  });
900
960
  }) : void 0
@@ -952,14 +1012,14 @@ function copy$a(value, context) {
952
1012
  return value;
953
1013
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: override.value.map(copyShadowItem) }));
954
1014
  function copyShadowItem(item) {
955
- var _a;
1015
+ var _a2;
956
1016
  const { color } = item.payload;
957
1017
  if (color == null)
958
1018
  return item;
959
1019
  return __spreadProps(__spreadValues({}, item), {
960
1020
  payload: __spreadProps(__spreadValues({}, item.payload), {
961
1021
  color: __spreadProps(__spreadValues({}, color), {
962
- swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1022
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
963
1023
  })
964
1024
  })
965
1025
  });
@@ -1013,10 +1073,10 @@ if (import_meta.vitest) {
1013
1073
  });
1014
1074
  }
1015
1075
  function copy$9(value, context) {
1016
- var _a;
1076
+ var _a2;
1017
1077
  if (value == null)
1018
1078
  return value;
1019
- return (_a = context.replacementContext.fileIds.get(value)) != null ? _a : value;
1079
+ return (_a2 = context.replacementContext.fileIds.get(value)) != null ? _a2 : value;
1020
1080
  }
1021
1081
  if (import_meta.vitest) {
1022
1082
  const { describe, test, expect } = import_meta.vitest;
@@ -1049,13 +1109,13 @@ function copy$8(value, context) {
1049
1109
  return value;
1050
1110
  return value.map(copyImagesPanelItem);
1051
1111
  function copyImagesPanelItem(imagesPanelItem) {
1052
- var _a;
1112
+ var _a2;
1053
1113
  const { file } = imagesPanelItem.props;
1054
1114
  if (file == null)
1055
1115
  return imagesPanelItem;
1056
1116
  return __spreadProps(__spreadValues({}, imagesPanelItem), {
1057
1117
  props: __spreadProps(__spreadValues({}, imagesPanelItem.props), {
1058
- file: (_a = context.replacementContext.fileIds.get(file)) != null ? _a : file
1118
+ file: (_a2 = context.replacementContext.fileIds.get(file)) != null ? _a2 : file
1059
1119
  })
1060
1120
  });
1061
1121
  }
@@ -1104,9 +1164,9 @@ function copy$7(value, context) {
1104
1164
  return value;
1105
1165
  return value.map((override) => __spreadProps(__spreadValues({}, override), { value: copyColorValue(override.value) }));
1106
1166
  function copyColorValue(colorValue) {
1107
- var _a;
1167
+ var _a2;
1108
1168
  return __spreadProps(__spreadValues({}, colorValue), {
1109
- swatchId: (_a = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a : colorValue.swatchId
1169
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(colorValue.swatchId)) != null ? _a2 : colorValue.swatchId
1110
1170
  });
1111
1171
  }
1112
1172
  }
@@ -1115,9 +1175,9 @@ function copy$6(value, context) {
1115
1175
  return value;
1116
1176
  return __spreadProps(__spreadValues({}, value), { fields: value.fields.map(copyFormFieldsPanelItem) });
1117
1177
  function copyFormFieldsPanelItem(item) {
1118
- var _a;
1178
+ var _a2;
1119
1179
  return __spreadProps(__spreadValues({}, item), {
1120
- tableColumnId: (_a = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a : item.tableColumnId
1180
+ tableColumnId: (_a2 = context.replacementContext.tableColumnIds.get(item.tableColumnId)) != null ? _a2 : item.tableColumnId
1121
1181
  });
1122
1182
  }
1123
1183
  }
@@ -1171,10 +1231,10 @@ if (import_meta.vitest) {
1171
1231
  });
1172
1232
  }
1173
1233
  function copy$5(value, context) {
1174
- var _a;
1234
+ var _a2;
1175
1235
  if (value == null)
1176
1236
  return value;
1177
- return (_a = context.replacementContext.tableIds.get(value)) != null ? _a : value;
1237
+ return (_a2 = context.replacementContext.tableIds.get(value)) != null ? _a2 : value;
1178
1238
  }
1179
1239
  if (import_meta.vitest) {
1180
1240
  const { describe, test, expect } = import_meta.vitest;
@@ -1216,13 +1276,13 @@ function copy$4(value, context) {
1216
1276
  };
1217
1277
  }
1218
1278
  function copyBorderSide(borderSide) {
1219
- var _a;
1279
+ var _a2;
1220
1280
  const { color } = borderSide;
1221
1281
  if (color == null)
1222
1282
  return borderSide;
1223
1283
  return __spreadProps(__spreadValues({}, borderSide), {
1224
1284
  color: __spreadProps(__spreadValues({}, color), {
1225
- swatchId: (_a = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a : color.swatchId
1285
+ swatchId: (_a2 = context.replacementContext.swatchIds.get(color.swatchId)) != null ? _a2 : color.swatchId
1226
1286
  })
1227
1287
  });
1228
1288
  }
@@ -1336,24 +1396,24 @@ function copy$3(value, context) {
1336
1396
  return value;
1337
1397
  return __spreadProps(__spreadValues({}, value), { document: value.document ? copyNode(value.document) : value.document });
1338
1398
  function copyNode(node) {
1339
- var _a;
1399
+ var _a2;
1340
1400
  switch (node.object) {
1341
1401
  case "document":
1342
1402
  case "block":
1343
1403
  case "inline":
1344
1404
  return copyInline(node);
1345
1405
  case "text":
1346
- return __spreadProps(__spreadValues({}, node), { marks: (_a = node.marks) == null ? void 0 : _a.map(copyMark) });
1406
+ return __spreadProps(__spreadValues({}, node), { marks: (_a2 = node.marks) == null ? void 0 : _a2.map(copyMark) });
1347
1407
  default:
1348
1408
  return node;
1349
1409
  }
1350
1410
  }
1351
1411
  function copyInline(inline) {
1352
- var _a, _b;
1412
+ var _a2, _b;
1353
1413
  switch (inline.type) {
1354
1414
  case "link":
1355
1415
  return __spreadProps(__spreadValues({}, inline), {
1356
- nodes: (_a = inline.nodes) == null ? void 0 : _a.map(copyNode),
1416
+ nodes: (_a2 = inline.nodes) == null ? void 0 : _a2.map(copyNode),
1357
1417
  data: inline.data ? copyLinkData2(inline.data) : inline.data
1358
1418
  });
1359
1419
  default:
@@ -1361,7 +1421,7 @@ function copy$3(value, context) {
1361
1421
  }
1362
1422
  }
1363
1423
  function copyLinkData2(data) {
1364
- var _a, _b;
1424
+ var _a2, _b;
1365
1425
  switch (data.type) {
1366
1426
  case "OPEN_PAGE": {
1367
1427
  const pageId = data.payload.pageId;
@@ -1369,7 +1429,7 @@ function copy$3(value, context) {
1369
1429
  return data;
1370
1430
  return __spreadProps(__spreadValues({}, data), {
1371
1431
  payload: __spreadProps(__spreadValues({}, data.payload), {
1372
- pageId: (_a = context.replacementContext.pageIds.get(pageId)) != null ? _a : data.payload.pageId
1432
+ pageId: (_a2 = context.replacementContext.pageIds.get(pageId)) != null ? _a2 : data.payload.pageId
1373
1433
  })
1374
1434
  });
1375
1435
  }
@@ -1390,20 +1450,20 @@ function copy$3(value, context) {
1390
1450
  }
1391
1451
  }
1392
1452
  function copyMark(mark) {
1393
- var _a, _b, _c, _d;
1453
+ var _a2, _b, _c, _d;
1394
1454
  switch (mark.type) {
1395
1455
  case "typography": {
1396
- const typographyId = (_a = mark.data) == null ? void 0 : _a.value.id;
1456
+ const typographyId = (_a2 = mark.data) == null ? void 0 : _a2.value.id;
1397
1457
  return __spreadProps(__spreadValues({}, mark), {
1398
1458
  data: __spreadProps(__spreadValues({}, mark.data), {
1399
1459
  value: __spreadProps(__spreadValues({}, (_b = mark.data) == null ? void 0 : _b.value), {
1400
1460
  id: (_c = context.replacementContext.typographyIds.get(typographyId)) != null ? _c : typographyId,
1401
1461
  style: (_d = mark.data) == null ? void 0 : _d.value.style.map((override) => {
1402
- var _a2, _b2, _c2;
1462
+ var _a3, _b2, _c2;
1403
1463
  return __spreadProps(__spreadValues({}, override), {
1404
1464
  value: __spreadProps(__spreadValues({}, override.value), {
1405
1465
  color: override.value.color == null ? override.value.color : __spreadProps(__spreadValues({}, override.value.color), {
1406
- swatchId: (_c2 = context.replacementContext.swatchIds.get((_a2 = override.value.color) == null ? void 0 : _a2.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1466
+ swatchId: (_c2 = context.replacementContext.swatchIds.get((_a3 = override.value.color) == null ? void 0 : _a3.swatchId)) != null ? _c2 : (_b2 = override.value.color) == null ? void 0 : _b2.swatchId
1407
1467
  })
1408
1468
  })
1409
1469
  });
@@ -1554,8 +1614,8 @@ function copy$1(descriptor, value, context) {
1554
1614
  function copyElementReference(value, context) {
1555
1615
  return context.replacementContext.globalElementIds.get(value) || value;
1556
1616
  }
1557
- function copy(definition, value, context) {
1558
- switch (definition.type) {
1617
+ function copy(definition2, value, context) {
1618
+ switch (definition2.type) {
1559
1619
  case Types.Backgrounds:
1560
1620
  case Types.Grid:
1561
1621
  case Types.NavigationLinks:
@@ -1569,7 +1629,7 @@ function copy(definition, value, context) {
1569
1629
  case Types.Border:
1570
1630
  case Types.RichText:
1571
1631
  case Types.ElementID:
1572
- return copy$1(definition, value, context);
1632
+ return copy$1(definition2, value, context);
1573
1633
  case ColorControlType:
1574
1634
  return copyColorData(value, context);
1575
1635
  case ImageControlType:
@@ -1577,9 +1637,9 @@ function copy(definition, value, context) {
1577
1637
  case LinkControlType:
1578
1638
  return copyLinkData(value, context);
1579
1639
  case ShapeControlType:
1580
- return copyShapeData(definition, value, context);
1640
+ return copyShapeData(definition2, value, context);
1581
1641
  case ListControlType:
1582
- return copyListData(definition, value, context);
1642
+ return copyListData(definition2, value, context);
1583
1643
  case StyleControlType:
1584
1644
  return copyStyleData(value, context);
1585
1645
  case SlotControlType:
@@ -1588,14 +1648,49 @@ function copy(definition, value, context) {
1588
1648
  return value;
1589
1649
  }
1590
1650
  }
1591
- function merge(definition, a, b = a, context) {
1592
- switch (definition.type) {
1651
+ function merge(definition2, a, b = a, context) {
1652
+ switch (definition2.type) {
1593
1653
  case SlotControlType:
1594
1654
  return mergeSlotData(a, b, context);
1595
1655
  default:
1596
1656
  return b;
1597
1657
  }
1598
1658
  }
1659
+ const SelectControlType = "makeswift::controls::select";
1660
+ function Select(config) {
1661
+ return { type: SelectControlType, config };
1662
+ }
1663
+ const isServer = typeof window === "undefined";
1664
+ const useInsertionEffectSpecifier = "useInsertionEffect";
1665
+ const useInsertionEffect = (_a = React[useInsertionEffectSpecifier]) != null ? _a : React.useLayoutEffect;
1666
+ function useStyle(style) {
1667
+ const serialized = serializeStyles([style], cache.registered);
1668
+ registerStyles(cache, serialized, false);
1669
+ useInsertionEffect(() => {
1670
+ insertStyles(cache, serialized, false);
1671
+ });
1672
+ if (isServer)
1673
+ insertStyles(cache, serialized, false);
1674
+ return `${cache.key}-${serialized.name}`;
1675
+ }
1676
+ const StyleV2ControlType = "makeswift::controls::style-v2";
1677
+ const unstable_useStyleV2ClassName = useStyle;
1678
+ function unstable_StyleV2(config) {
1679
+ return { type: StyleV2ControlType, config };
1680
+ }
1681
+ const StyleV2ControlMessageType = {
1682
+ CHANGE_BOX_MODEL: "makeswift::controls::style::message::change-box-model"
1683
+ };
1684
+ class StyleV2Control extends PropController {
1685
+ constructor(send) {
1686
+ super(send);
1687
+ }
1688
+ changeBoxModel(boxModel) {
1689
+ this.send({ type: StyleV2ControlMessageType.CHANGE_BOX_MODEL, payload: { boxModel } });
1690
+ }
1691
+ recv() {
1692
+ }
1693
+ }
1599
1694
  const ObjectType = {
1600
1695
  Value: "value",
1601
1696
  Text: "text",
@@ -1641,6 +1736,687 @@ const BlockTextAlignment = {
1641
1736
  Right: "right",
1642
1737
  Justify: "justify"
1643
1738
  };
1739
+ const ElementUtils = {
1740
+ isRootBlock(node) {
1741
+ return Element.isElement(node) && (Element.isElementType(node, BlockType.Paragraph) || Element.isElementType(node, BlockType.Heading1) || Element.isElementType(node, BlockType.Heading2) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading3) || Element.isElementType(node, BlockType.Heading4) || Element.isElementType(node, BlockType.Heading5) || Element.isElementType(node, BlockType.Heading6) || Element.isElementType(node, BlockType.BlockQuote) || Element.isElementType(node, BlockType.UnorderedList) || Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.Text) || Element.isElementType(node, BlockType.Default));
1742
+ },
1743
+ isBlock(node) {
1744
+ return Element.isElement(node) && (this.isRootBlock(node) || Element.isElementType(node, BlockType.ListItem) || Element.isElementType(node, BlockType.ListItemChild));
1745
+ },
1746
+ isInline(node) {
1747
+ return Element.isElementType(node, InlineType.Code) || Element.isElementType(node, InlineType.Link) || Element.isElementType(node, InlineType.SubScript) || Element.isElementType(node, InlineType.SuperScript);
1748
+ },
1749
+ isConvertibleToListTextNode(node) {
1750
+ return !this.isList(node) && !this.isListItem(node) && !this.isListItemChild(node);
1751
+ },
1752
+ isList(node) {
1753
+ return Element.isElementType(node, BlockType.OrderedList) || Element.isElementType(node, BlockType.UnorderedList);
1754
+ },
1755
+ isListItem(node) {
1756
+ return Element.isElementType(node, BlockType.ListItem);
1757
+ },
1758
+ isListItemChild(node) {
1759
+ return Element.isElementType(node, BlockType.ListItemChild);
1760
+ },
1761
+ createText() {
1762
+ return { text: "" };
1763
+ },
1764
+ createParagraph() {
1765
+ return {
1766
+ children: [this.createText()],
1767
+ type: BlockType.Paragraph
1768
+ };
1769
+ },
1770
+ createList(type = BlockType.UnorderedList) {
1771
+ return { children: [this.createText()], type };
1772
+ },
1773
+ createListItem() {
1774
+ return {
1775
+ children: [this.createListItemChild()],
1776
+ type: BlockType.ListItem
1777
+ };
1778
+ },
1779
+ createListItemChild() {
1780
+ return {
1781
+ children: [this.createText()],
1782
+ type: BlockType.ListItemChild
1783
+ };
1784
+ }
1785
+ };
1786
+ function unhangRange(editor, range) {
1787
+ let [start, end] = Range.edges(range);
1788
+ if (start.offset !== 0 || end.offset !== 0 || Range.isCollapsed(range)) {
1789
+ return range;
1790
+ }
1791
+ const endBlock = Editor.above(editor, {
1792
+ at: end,
1793
+ match: (n) => Element.isElement(n) && Editor.isBlock(editor, n)
1794
+ });
1795
+ const blockPath = endBlock ? endBlock[1] : [];
1796
+ const first = Editor.start(editor, start);
1797
+ const before = { anchor: first, focus: end };
1798
+ let skip = true;
1799
+ for (const [node, path] of Editor.nodes(editor, {
1800
+ at: before,
1801
+ match: Text.isText,
1802
+ reverse: true
1803
+ })) {
1804
+ if (skip) {
1805
+ skip = false;
1806
+ continue;
1807
+ }
1808
+ if (node.text !== "" || Path.isBefore(path, blockPath)) {
1809
+ end = { path, offset: node.text.length };
1810
+ break;
1811
+ }
1812
+ }
1813
+ return { anchor: start, focus: end };
1814
+ }
1815
+ function getSelection(editor) {
1816
+ if (editor.selection)
1817
+ return unhangRange(editor, editor.selection);
1818
+ return {
1819
+ anchor: Editor.start(editor, []),
1820
+ focus: Editor.end(editor, [])
1821
+ };
1822
+ }
1823
+ function getBlocksInSelection(editor) {
1824
+ return Array.from(Editor.nodes(editor, {
1825
+ at: getSelection(editor),
1826
+ match: (node) => ElementUtils.isRootBlock(node)
1827
+ })).filter((entry) => ElementUtils.isRootBlock(entry[0]));
1828
+ }
1829
+ function getActiveBlockType(editor) {
1830
+ var _a2;
1831
+ const rootBlocks = getBlocksInSelection(editor).map(([node]) => node.type);
1832
+ return rootBlocks.reduce((a, b) => a === b ? b : null, (_a2 = rootBlocks.at(0)) != null ? _a2 : null);
1833
+ }
1834
+ function setBlockKeyForDevice(editor, breakpoints, deviceId, key, value, options) {
1835
+ var _a2, _b;
1836
+ const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1837
+ if (!at)
1838
+ return;
1839
+ const rootElements = getBlocksInSelection(editor);
1840
+ for (const [node, path] of rootElements) {
1841
+ if (ElementUtils.isBlock(node)) {
1842
+ const deviceValues = (_b = node[key]) != null ? _b : [];
1843
+ const currentDeviceValue = findBreakpointOverride(breakpoints, deviceValues, deviceId, (v) => v);
1844
+ const nextDeviceValue = __spreadProps(__spreadValues({}, currentDeviceValue), {
1845
+ deviceId,
1846
+ value
1847
+ });
1848
+ Transforms.setNodes(editor, {
1849
+ [key]: [...deviceValues.filter((v) => v.deviceId !== deviceId), nextDeviceValue]
1850
+ }, { at: path });
1851
+ }
1852
+ }
1853
+ }
1854
+ function clearBlockKeyForDevice(editor, deviceId, key) {
1855
+ var _a2;
1856
+ const rootElements = getBlocksInSelection(editor);
1857
+ for (const [node, path] of rootElements) {
1858
+ if (ElementUtils.isBlock(node)) {
1859
+ const deviceOverrides = (_a2 = node[key]) != null ? _a2 : [];
1860
+ Transforms.setNodes(editor, {
1861
+ [key]: deviceOverrides.filter((v) => v.deviceId !== deviceId)
1862
+ }, { at: path });
1863
+ }
1864
+ }
1865
+ }
1866
+ function wrapInline(editor, inline) {
1867
+ Transforms.wrapNodes(editor, inline, {
1868
+ at: getSelection(editor),
1869
+ split: true
1870
+ });
1871
+ }
1872
+ function unwrapInline(editor, type) {
1873
+ Transforms.unwrapNodes(editor, {
1874
+ match: (node) => ElementUtils.isInline(node) && node.type === type,
1875
+ at: getSelection(editor)
1876
+ });
1877
+ }
1878
+ const EditorUtils = {
1879
+ getFirstAncestorList(editor, path) {
1880
+ try {
1881
+ const parentList = Editor.above(editor, {
1882
+ at: path,
1883
+ match: (node) => ElementUtils.isList(node)
1884
+ });
1885
+ return parentList != null ? parentList : null;
1886
+ } catch (e) {
1887
+ return null;
1888
+ }
1889
+ },
1890
+ getFirstAncestorListItem(editor, path) {
1891
+ try {
1892
+ const parentListItem = Editor.above(editor, {
1893
+ at: path,
1894
+ match: (node) => ElementUtils.isListItem(node)
1895
+ });
1896
+ return parentListItem != null ? parentListItem : null;
1897
+ } catch (e) {
1898
+ return null;
1899
+ }
1900
+ }
1901
+ };
1902
+ const LIST_ITEM_CHILD_POSITION = 0;
1903
+ const LIST_ITEM_LIST_POSITION = 1;
1904
+ function filterForSubtreeRoots(entries) {
1905
+ return entries.filter(([, nodePath]) => !Path.ancestors(nodePath).some((ancestor) => {
1906
+ return entries.some(([, path]) => Path.equals(path, ancestor));
1907
+ }));
1908
+ }
1909
+ function unwrapPath(editor, listItemPath) {
1910
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
1911
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
1912
+ if (!parentList || listItemContainingParentList)
1913
+ return;
1914
+ Editor.withoutNormalizing(editor, () => {
1915
+ const listItemTextPath = [...listItemPath, LIST_ITEM_CHILD_POSITION];
1916
+ const listItemNestedListPath = [...listItemPath, LIST_ITEM_LIST_POSITION];
1917
+ if (Node.has(editor, listItemNestedListPath)) {
1918
+ Transforms.setNodes(editor, { type: parentList[0].type }, { at: listItemNestedListPath });
1919
+ Transforms.liftNodes(editor, { at: listItemNestedListPath });
1920
+ Transforms.liftNodes(editor, { at: Path.next(listItemPath) });
1921
+ }
1922
+ if (Node.has(editor, listItemTextPath)) {
1923
+ Transforms.setNodes(editor, { type: BlockType.Paragraph }, {
1924
+ at: listItemTextPath
1925
+ });
1926
+ Transforms.liftNodes(editor, { at: listItemTextPath });
1927
+ Transforms.liftNodes(editor, { at: listItemPath });
1928
+ }
1929
+ });
1930
+ }
1931
+ function unwrapList(editor, options) {
1932
+ var _a2;
1933
+ const at = (_a2 = options == null ? void 0 : options.at) != null ? _a2 : editor.selection;
1934
+ if (!at)
1935
+ return;
1936
+ const listItems = Array.from(Editor.nodes(editor, {
1937
+ at,
1938
+ match: (node) => {
1939
+ return Element.isElement(node) && ElementUtils.isListItem(node);
1940
+ }
1941
+ }));
1942
+ const subRoots = filterForSubtreeRoots(listItems);
1943
+ const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
1944
+ refs.forEach((ref) => {
1945
+ if (ref.current) {
1946
+ unwrapPath(editor, ref.current);
1947
+ }
1948
+ ref.unref();
1949
+ });
1950
+ }
1951
+ function wrapList(editor, options = { type: BlockType.UnorderedList }) {
1952
+ var _a2;
1953
+ const at = (_a2 = options.at) != null ? _a2 : editor.selection;
1954
+ if (!at)
1955
+ return;
1956
+ const nonListEntries = Array.from(Editor.nodes(editor, {
1957
+ at,
1958
+ match: (node) => {
1959
+ return Element.isElement(node) && ElementUtils.isConvertibleToListTextNode(node);
1960
+ }
1961
+ }));
1962
+ const refs = nonListEntries.map(([_, path]) => Editor.pathRef(editor, path));
1963
+ refs.forEach((ref) => {
1964
+ const path = ref.current;
1965
+ if (path) {
1966
+ Editor.withoutNormalizing(editor, () => {
1967
+ Transforms.setNodes(editor, { type: BlockType.ListItemChild }, {
1968
+ at: path
1969
+ });
1970
+ Transforms.wrapNodes(editor, ElementUtils.createListItem(), {
1971
+ match: (node) => ElementUtils.isListItemChild(node),
1972
+ at: path
1973
+ });
1974
+ Transforms.wrapNodes(editor, ElementUtils.createList(options.type), {
1975
+ at: path
1976
+ });
1977
+ });
1978
+ }
1979
+ ref.unref();
1980
+ });
1981
+ }
1982
+ const LocationUtils = {
1983
+ getStartPath(location) {
1984
+ if (Range.isRange(location))
1985
+ return Range.start(location).path;
1986
+ if (Point.isPoint(location))
1987
+ return location.path;
1988
+ return location;
1989
+ }
1990
+ };
1991
+ function getSelectedListItems(editor) {
1992
+ var _a2, _b;
1993
+ if (!editor.selection)
1994
+ return [];
1995
+ const start = LocationUtils.getStartPath(editor.selection);
1996
+ const listItems = Editor.nodes(editor, {
1997
+ at: editor.selection,
1998
+ match: (node) => ElementUtils.isListItem(node)
1999
+ });
2000
+ const firstAncestorPath = (_b = (_a2 = EditorUtils.getFirstAncestorListItem(editor, start)) == null ? void 0 : _a2[1]) != null ? _b : [];
2001
+ return Array.from(listItems).filter((node) => Path.isDescendant(start, node[1]) ? Path.equals(node[1], firstAncestorPath) : !Path.isAfter(start, node[1]));
2002
+ }
2003
+ function indentPath(editor, path) {
2004
+ const parent = Node.parent(editor, path);
2005
+ if (!path || !Path.hasPrevious(path) || !ElementUtils.isList(parent))
2006
+ return;
2007
+ const previosPath = Path.previous(path);
2008
+ const previousChildListPath = [...previosPath, LIST_ITEM_LIST_POSITION];
2009
+ const previousHasChildList = Node.has(editor, previousChildListPath);
2010
+ Editor.withoutNormalizing(editor, () => {
2011
+ if (!previousHasChildList) {
2012
+ Transforms.insertNodes(editor, ElementUtils.createList(parent.type), {
2013
+ at: previousChildListPath
2014
+ });
2015
+ }
2016
+ const previousChildList = Node.get(editor, previousChildListPath);
2017
+ if (ElementUtils.isList(previousChildList)) {
2018
+ const index = previousHasChildList ? previousChildList.children.length : 0;
2019
+ Transforms.moveNodes(editor, {
2020
+ at: path,
2021
+ to: [...previousChildListPath, index]
2022
+ });
2023
+ }
2024
+ });
2025
+ }
2026
+ function indent(editor) {
2027
+ if (!editor.selection)
2028
+ return;
2029
+ const listItems = getSelectedListItems(editor);
2030
+ const subRoots = filterForSubtreeRoots(listItems);
2031
+ const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
2032
+ refs.forEach((ref) => {
2033
+ if (ref.current) {
2034
+ indentPath(editor, ref.current);
2035
+ }
2036
+ ref.unref();
2037
+ });
2038
+ }
2039
+ function dedentPath(editor, listItemPath) {
2040
+ const parentList = EditorUtils.getFirstAncestorList(editor, listItemPath);
2041
+ const listItemContainingParentList = EditorUtils.getFirstAncestorListItem(editor, listItemPath);
2042
+ if (!parentList || !listItemContainingParentList)
2043
+ return;
2044
+ const [parentListNode, parentListPath] = parentList;
2045
+ const [_, listItemContainingParentListPath] = listItemContainingParentList;
2046
+ const listItemPosition = listItemPath[listItemPath.length - 1];
2047
+ const previousSiblings = parentListNode.children.slice(0, listItemPosition);
2048
+ const nextSiblings = parentListNode.children.slice(listItemPosition + 1);
2049
+ Editor.withoutNormalizing(editor, () => {
2050
+ nextSiblings.forEach(() => {
2051
+ const nextSiblingPath = [...parentListPath, listItemPosition + 1];
2052
+ indentPath(editor, nextSiblingPath);
2053
+ });
2054
+ Transforms.moveNodes(editor, {
2055
+ at: listItemPath,
2056
+ to: Path.next(listItemContainingParentListPath)
2057
+ });
2058
+ if (previousSiblings.length === 0) {
2059
+ Transforms.removeNodes(editor, { at: parentListPath });
2060
+ }
2061
+ });
2062
+ }
2063
+ function dedent(editor) {
2064
+ if (!editor.selection)
2065
+ return;
2066
+ const listItems = getSelectedListItems(editor);
2067
+ const subRoots = filterForSubtreeRoots(listItems);
2068
+ const refs = subRoots.map(([_, path]) => Editor.pathRef(editor, path));
2069
+ refs.forEach((ref) => {
2070
+ if (ref.current) {
2071
+ dedentPath(editor, ref.current);
2072
+ }
2073
+ ref.unref();
2074
+ });
2075
+ }
2076
+ function toggleList(editor, options = { type: BlockType.UnorderedList }) {
2077
+ var _a2;
2078
+ const at = (_a2 = options.at) != null ? _a2 : editor.selection;
2079
+ if (at == null)
2080
+ return;
2081
+ const start = LocationUtils.getStartPath(at);
2082
+ const ancestorPath = Path.ancestors(start).at(1);
2083
+ if (!ancestorPath || !Node.has(editor, ancestorPath))
2084
+ return;
2085
+ const ancestor = Node.get(editor, ancestorPath);
2086
+ if (!ElementUtils.isList(ancestor)) {
2087
+ return wrapList(editor, { type: options.type, at });
2088
+ }
2089
+ if (ancestor.type === options.type) {
2090
+ unwrapList(editor, { at });
2091
+ } else {
2092
+ Transforms.setNodes(editor, { type: options.type }, { at: ancestorPath });
2093
+ }
2094
+ }
2095
+ const BlockActions = {
2096
+ setBlockKeyForDevice,
2097
+ clearBlockKeyForDevice,
2098
+ wrapInline,
2099
+ unwrapInline
2100
+ };
2101
+ const ListActions = {
2102
+ unwrapList,
2103
+ wrapList,
2104
+ indent,
2105
+ dedent,
2106
+ toggleList
2107
+ };
2108
+ function onKeyDown(e, editor) {
2109
+ if (!editor.selection || Array.from(Editor.nodes(editor, {
2110
+ match: (node) => ElementUtils.isListItem(node)
2111
+ })).length === 0)
2112
+ return;
2113
+ if (isHotkey("shift+tab", e)) {
2114
+ e.preventDefault();
2115
+ ListActions.dedent(editor);
2116
+ }
2117
+ if (isHotkey("tab", e)) {
2118
+ e.preventDefault();
2119
+ ListActions.indent(editor);
2120
+ }
2121
+ if (isHotkey("backspace", e)) {
2122
+ if (!editor.selection)
2123
+ return;
2124
+ if (Range.isExpanded(editor.selection))
2125
+ return;
2126
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2127
+ if (editor.selection.anchor.offset === 0 && listItem) {
2128
+ e.preventDefault();
2129
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2130
+ const list = EditorUtils.getFirstAncestorList(editor, listItem[1]);
2131
+ if (parentListItem) {
2132
+ ListActions.dedent(editor);
2133
+ } else if (list) {
2134
+ ListActions.unwrapList(editor);
2135
+ }
2136
+ return;
2137
+ }
2138
+ }
2139
+ if (isHotkey("enter", e)) {
2140
+ e.preventDefault();
2141
+ if (!editor.selection)
2142
+ return;
2143
+ if (Range.isExpanded(editor.selection)) {
2144
+ Transforms.delete(editor);
2145
+ return;
2146
+ }
2147
+ const listItem = EditorUtils.getFirstAncestorListItem(editor, editor.selection.anchor.path);
2148
+ if (editor.selection.anchor.offset === 0 && listItem && Editor.string(editor, listItem[1]) === "") {
2149
+ const parentListItem = EditorUtils.getFirstAncestorListItem(editor, listItem[1]);
2150
+ if (parentListItem) {
2151
+ ListActions.dedent(editor);
2152
+ } else {
2153
+ ListActions.unwrapList(editor);
2154
+ }
2155
+ return;
2156
+ }
2157
+ Transforms.splitNodes(editor, {
2158
+ at: editor.selection,
2159
+ always: true,
2160
+ match: (node) => ElementUtils.isListItem(node)
2161
+ });
2162
+ }
2163
+ if (isHotkey("shift+enter", e)) {
2164
+ e.preventDefault();
2165
+ editor.insertText("\n");
2166
+ }
2167
+ }
2168
+ function withBlock(editor) {
2169
+ const {
2170
+ normalizeNode
2171
+ } = editor;
2172
+ editor.isInline = (entry) => {
2173
+ return ElementUtils.isInline(entry);
2174
+ };
2175
+ editor.normalizeNode = (entry) => {
2176
+ var _a2;
2177
+ const [normalizationNode, normalizationPath] = entry;
2178
+ if (ElementUtils.isBlock(normalizationNode) && ((_a2 = normalizationNode == null ? void 0 : normalizationNode.textAlign) == null ? void 0 : _a2.length) == 0) {
2179
+ Transforms.unsetNodes(editor, "textAlign", {
2180
+ at: normalizationPath
2181
+ });
2182
+ return;
2183
+ }
2184
+ if (ElementUtils.isListItem(normalizationNode)) {
2185
+ const pathToListItemText = [...normalizationPath, LIST_ITEM_CHILD_POSITION];
2186
+ if (Node.has(editor, pathToListItemText)) {
2187
+ const nodeInListItemTextPosition = Node.get(editor, pathToListItemText);
2188
+ if (ElementUtils.isRootBlock(nodeInListItemTextPosition)) {
2189
+ Transforms.setNodes(editor, {
2190
+ type: BlockType.ListItemChild
2191
+ }, {
2192
+ at: pathToListItemText
2193
+ });
2194
+ return;
2195
+ }
2196
+ } else {
2197
+ Transforms.insertNodes(editor, ElementUtils.createListItem(), {
2198
+ at: pathToListItemText
2199
+ });
2200
+ return;
2201
+ }
2202
+ }
2203
+ if (!Text.isText(normalizationNode)) {
2204
+ const mergeableChildren = Array.from(Node.children(editor, normalizationPath)).map((child, index, children) => {
2205
+ const potentialNodeToBeMerged = children.at(index + 1);
2206
+ if (!potentialNodeToBeMerged || !ElementUtils.isList(potentialNodeToBeMerged[0]) || !ElementUtils.isList(child[0]) || potentialNodeToBeMerged[0].type !== child[0].type) {
2207
+ return null;
2208
+ }
2209
+ return [Editor.pathRef(editor, child[1]), Editor.pathRef(editor, potentialNodeToBeMerged[1])];
2210
+ }).filter((mergeableNodes) => Boolean(mergeableNodes));
2211
+ if (mergeableChildren.length !== 0) {
2212
+ mergeableChildren.reverse().forEach(([nodePathRef, nodeToBeMergedPathRef]) => {
2213
+ const nodePath = nodePathRef.current;
2214
+ const nodeToBeMergedPath = nodeToBeMergedPathRef.current;
2215
+ if (nodePath == null || nodeToBeMergedPath == null)
2216
+ return;
2217
+ const nodeChildren = Array.from(Node.children(editor, nodePath));
2218
+ const childrenToBeMerged = Array.from(Node.children(editor, nodeToBeMergedPath));
2219
+ Editor.withoutNormalizing(editor, () => {
2220
+ childrenToBeMerged.reverse().forEach(([_, childPath]) => {
2221
+ Transforms.moveNodes(editor, {
2222
+ at: childPath,
2223
+ to: [...nodePath, nodeChildren.length]
2224
+ });
2225
+ });
2226
+ Transforms.removeNodes(editor, {
2227
+ at: nodeToBeMergedPath
2228
+ });
2229
+ });
2230
+ nodePathRef.unref();
2231
+ nodeToBeMergedPathRef.unref();
2232
+ });
2233
+ return;
2234
+ }
2235
+ }
2236
+ normalizeNode(entry);
2237
+ };
2238
+ return editor;
2239
+ }
2240
+ const definition = Select({
2241
+ label: "Block",
2242
+ labelOrientation: "horizontal",
2243
+ options: [{
2244
+ value: BlockType.Paragraph,
2245
+ label: "Paragraph"
2246
+ }, {
2247
+ value: BlockType.Heading1,
2248
+ label: "Heading 1"
2249
+ }, {
2250
+ value: BlockType.Heading2,
2251
+ label: "Heading 2"
2252
+ }, {
2253
+ value: BlockType.Heading3,
2254
+ label: "Heading 3"
2255
+ }, {
2256
+ value: BlockType.Heading4,
2257
+ label: "Heading 4"
2258
+ }, {
2259
+ value: BlockType.Heading5,
2260
+ label: "Heading 5"
2261
+ }, {
2262
+ value: BlockType.Heading6,
2263
+ label: "Heading 6"
2264
+ }, {
2265
+ value: BlockType.UnorderedList,
2266
+ label: "Bulleted list"
2267
+ }, {
2268
+ value: BlockType.OrderedList,
2269
+ label: "Numbered list"
2270
+ }, {
2271
+ value: BlockType.BlockQuote,
2272
+ label: "Quote"
2273
+ }],
2274
+ defaultValue: BlockType.Paragraph
2275
+ });
2276
+ function BlockPlugin() {
2277
+ return createRichTextV2Plugin({
2278
+ withPlugin: withBlock,
2279
+ onKeyDown,
2280
+ control: {
2281
+ definition,
2282
+ onChange: (editor, value) => {
2283
+ const activeBlockType = getActiveBlockType(editor);
2284
+ if (value === BlockType.UnorderedList || value === BlockType.OrderedList) {
2285
+ ListActions.toggleList(editor, {
2286
+ type: value,
2287
+ at: getSelection(editor)
2288
+ });
2289
+ } else if (activeBlockType === value) {
2290
+ Transforms.setNodes(editor, {
2291
+ type: BlockType.Default
2292
+ }, {
2293
+ at: getSelection(editor)
2294
+ });
2295
+ } else {
2296
+ ListActions.unwrapList(editor, {
2297
+ at: getSelection(editor)
2298
+ });
2299
+ Transforms.setNodes(editor, {
2300
+ type: value != null ? value : BlockType.Default
2301
+ }, {
2302
+ at: getSelection(editor)
2303
+ });
2304
+ }
2305
+ },
2306
+ getValue: (editor) => {
2307
+ const activeBlock = getActiveBlockType(editor);
2308
+ if (activeBlock === RootBlockType.Text || activeBlock === RootBlockType.Default)
2309
+ return void 0;
2310
+ return activeBlock;
2311
+ }
2312
+ },
2313
+ renderElement: (renderElement) => (props) => /* @__PURE__ */ jsx(BlockPluginComponent, __spreadProps(__spreadValues({}, props), {
2314
+ renderElement
2315
+ }))
2316
+ });
2317
+ }
2318
+ function BlockPluginComponent({
2319
+ element,
2320
+ attributes,
2321
+ children,
2322
+ renderElement
2323
+ }) {
2324
+ const blockStyles = [useStyle({
2325
+ margin: 0
2326
+ }), element.className];
2327
+ const quoteStyles = useStyle({
2328
+ padding: "0.5em 10px",
2329
+ fontSize: "1.25em",
2330
+ fontWeight: "300",
2331
+ borderLeft: "5px solid rgba(0, 0, 0, 0.1)"
2332
+ });
2333
+ switch (element.type) {
2334
+ case BlockType.Text:
2335
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
2336
+ className: cx(...blockStyles),
2337
+ children
2338
+ }));
2339
+ case BlockType.Paragraph:
2340
+ return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
2341
+ className: cx(...blockStyles),
2342
+ children
2343
+ }));
2344
+ case BlockType.Heading1:
2345
+ return /* @__PURE__ */ jsx("h1", __spreadProps(__spreadValues({}, attributes), {
2346
+ className: cx(...blockStyles),
2347
+ children
2348
+ }));
2349
+ case BlockType.Heading2:
2350
+ return /* @__PURE__ */ jsx("h2", __spreadProps(__spreadValues({}, attributes), {
2351
+ className: cx(...blockStyles),
2352
+ children
2353
+ }));
2354
+ case BlockType.Heading3:
2355
+ return /* @__PURE__ */ jsx("h3", __spreadProps(__spreadValues({}, attributes), {
2356
+ className: cx(...blockStyles),
2357
+ children
2358
+ }));
2359
+ case BlockType.Heading4:
2360
+ return /* @__PURE__ */ jsx("h4", __spreadProps(__spreadValues({}, attributes), {
2361
+ className: cx(...blockStyles),
2362
+ children
2363
+ }));
2364
+ case BlockType.Heading5:
2365
+ return /* @__PURE__ */ jsx("h5", __spreadProps(__spreadValues({}, attributes), {
2366
+ className: cx(...blockStyles),
2367
+ children
2368
+ }));
2369
+ case BlockType.Heading6:
2370
+ return /* @__PURE__ */ jsx("h6", __spreadProps(__spreadValues({}, attributes), {
2371
+ className: cx(...blockStyles),
2372
+ children
2373
+ }));
2374
+ case BlockType.BlockQuote:
2375
+ return /* @__PURE__ */ jsx("blockquote", __spreadProps(__spreadValues({}, attributes), {
2376
+ className: cx(...blockStyles, quoteStyles),
2377
+ children
2378
+ }));
2379
+ case BlockType.OrderedList:
2380
+ return /* @__PURE__ */ jsx("ol", __spreadProps(__spreadValues({}, attributes), {
2381
+ className: cx(...blockStyles),
2382
+ style: {
2383
+ listStylePosition: "inside"
2384
+ },
2385
+ children
2386
+ }));
2387
+ case BlockType.UnorderedList:
2388
+ return /* @__PURE__ */ jsx("ul", __spreadProps(__spreadValues({}, attributes), {
2389
+ className: cx(...blockStyles),
2390
+ style: {
2391
+ listStylePosition: "inside"
2392
+ },
2393
+ children
2394
+ }));
2395
+ case BlockType.ListItem:
2396
+ return /* @__PURE__ */ jsx("li", __spreadProps(__spreadValues({}, attributes), {
2397
+ className: cx(...blockStyles),
2398
+ children
2399
+ }));
2400
+ case BlockType.ListItemChild:
2401
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, attributes), {
2402
+ className: cx(...blockStyles),
2403
+ children
2404
+ }));
2405
+ case BlockType.Default:
2406
+ return /* @__PURE__ */ jsx("p", __spreadProps(__spreadValues({}, attributes), {
2407
+ className: cx(...blockStyles),
2408
+ children
2409
+ }));
2410
+ default:
2411
+ return /* @__PURE__ */ jsx(Fragment, {
2412
+ children: renderElement({
2413
+ element,
2414
+ attributes,
2415
+ children
2416
+ })
2417
+ });
2418
+ }
2419
+ }
1644
2420
  const RichTextV2ControlType = "makeswift::controls::rich-text-v2";
1645
2421
  const RichTextV2Mode = {
1646
2422
  Inline: "makeswift::controls::rich-text-v2::mode::inline",
@@ -1649,9 +2425,10 @@ const RichTextV2Mode = {
1649
2425
  function createRichTextV2Plugin({
1650
2426
  control,
1651
2427
  withPlugin,
1652
- onKeyDown
2428
+ onKeyDown: onKeyDown2,
2429
+ renderElement
1653
2430
  }) {
1654
- return { control, withPlugin, onKeyDown };
2431
+ return { control, withPlugin, onKeyDown: onKeyDown2, renderElement };
1655
2432
  }
1656
2433
  function unstable_RichTextV2(config = {}) {
1657
2434
  return { type: RichTextV2ControlType, config };
@@ -1674,7 +2451,7 @@ class RichTextV2Control extends PropController {
1674
2451
  __publicField(this, "defaultValue", null);
1675
2452
  __publicField(this, "descriptor");
1676
2453
  __publicField(this, "recv", (message) => {
1677
- var _a, _b, _c;
2454
+ var _a2, _b, _c;
1678
2455
  if (!this.editor)
1679
2456
  return;
1680
2457
  switch (message.type) {
@@ -1691,7 +2468,7 @@ class RichTextV2Control extends PropController {
1691
2468
  break;
1692
2469
  }
1693
2470
  case RichTextV2ControlMessageType.RUN_PLUGIN_CONTROL_ACTION: {
1694
- (_c = (_b = (_a = this.descriptor.config.plugins) == null ? void 0 : _a.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
2471
+ (_c = (_b = (_a2 = this.descriptor.config.plugins) == null ? void 0 : _a2.at(message.pluginIndex)) == null ? void 0 : _b.control) == null ? void 0 : _c.onChange(this.editor, message.value);
1695
2472
  break;
1696
2473
  }
1697
2474
  }
@@ -1700,13 +2477,13 @@ class RichTextV2Control extends PropController {
1700
2477
  this.send = send;
1701
2478
  }
1702
2479
  setEditor(editor) {
1703
- var _a, _b, _c;
2480
+ var _a2, _b, _c;
1704
2481
  this.editor = editor;
1705
2482
  this.send({
1706
2483
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
1707
- value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
1708
- var _a2;
1709
- return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
2484
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2485
+ var _a3;
2486
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
1710
2487
  })) != null ? _c : []
1711
2488
  });
1712
2489
  }
@@ -1721,7 +2498,7 @@ class RichTextV2Control extends PropController {
1721
2498
  this.send({ type: RichTextV2ControlMessageType.SWITCH_TO_BUILD_MODE });
1722
2499
  }
1723
2500
  onChange(value) {
1724
- var _a, _b, _c;
2501
+ var _a2, _b, _c;
1725
2502
  const editor = this.editor;
1726
2503
  if (editor == null)
1727
2504
  return;
@@ -1731,9 +2508,9 @@ class RichTextV2Control extends PropController {
1731
2508
  });
1732
2509
  this.send({
1733
2510
  type: RichTextV2ControlMessageType.SET_PLUGIN_CONTROL_VALUE,
1734
- value: (_c = (_b = (_a = this.descriptor.config) == null ? void 0 : _a.plugins) == null ? void 0 : _b.map((plugin) => {
1735
- var _a2;
1736
- return (_a2 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a2.getValue(editor);
2511
+ value: (_c = (_b = (_a2 = this.descriptor.config) == null ? void 0 : _a2.plugins) == null ? void 0 : _b.map((plugin) => {
2512
+ var _a3;
2513
+ return (_a3 = plugin == null ? void 0 : plugin.control) == null ? void 0 : _a3.getValue(editor);
1737
2514
  })) != null ? _c : []
1738
2515
  });
1739
2516
  }
@@ -1747,8 +2524,8 @@ function isText(node) {
1747
2524
  return false;
1748
2525
  }
1749
2526
  function toTextDAO(node) {
1750
- var _a, _b, _c, _d;
1751
- const typographyMark = (_a = node.marks) == null ? void 0 : _a.find((mark) => mark.type === "typography");
2527
+ var _a2, _b, _c, _d;
2528
+ const typographyMark = (_a2 = node.marks) == null ? void 0 : _a2.find((mark) => mark.type === "typography");
1752
2529
  return [
1753
2530
  {
1754
2531
  text: (_b = node.text) != null ? _b : "",
@@ -1757,12 +2534,12 @@ function toTextDAO(node) {
1757
2534
  ];
1758
2535
  }
1759
2536
  function toInlineDAO(node) {
1760
- var _a, _b, _c, _d;
2537
+ var _a2, _b, _c, _d;
1761
2538
  switch (node.type) {
1762
2539
  case InlineType.Link:
1763
2540
  return [
1764
2541
  {
1765
- children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toInlineOrTextDAO)) != null ? _b : [],
2542
+ children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toInlineOrTextDAO)) != null ? _b : [],
1766
2543
  [node.type]: node.data,
1767
2544
  type: node.type
1768
2545
  }
@@ -1791,7 +2568,7 @@ function toInlineOrTextDAO(node) {
1791
2568
  }
1792
2569
  }
1793
2570
  function toNodeDAO(node) {
1794
- var _a, _b;
2571
+ var _a2, _b;
1795
2572
  switch (node.object) {
1796
2573
  case ObjectType.Inline:
1797
2574
  case ObjectType.Text:
@@ -1801,7 +2578,7 @@ function toNodeDAO(node) {
1801
2578
  {
1802
2579
  type: node.type,
1803
2580
  textAlign: (node == null ? void 0 : node.data) && "textAlign" in node.data ? node == null ? void 0 : node.data.textAlign : void 0,
1804
- children: (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(toNodeDAO)) != null ? _b : []
2581
+ children: (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(toNodeDAO)) != null ? _b : []
1805
2582
  }
1806
2583
  ];
1807
2584
  default:
@@ -1809,8 +2586,8 @@ function toNodeDAO(node) {
1809
2586
  }
1810
2587
  }
1811
2588
  function richTextDTOtoSelection(data) {
1812
- var _a, _b, _c, _d;
1813
- if (((_b = (_a = data.selection) == null ? void 0 : _a.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
2589
+ var _a2, _b, _c, _d;
2590
+ if (((_b = (_a2 = data.selection) == null ? void 0 : _a2.anchor) == null ? void 0 : _b.offset) != null && data.selection.anchor.path != null && ((_d = (_c = data.selection) == null ? void 0 : _c.focus) == null ? void 0 : _d.offset) != null && data.selection.focus.path != null)
1814
2591
  return {
1815
2592
  anchor: {
1816
2593
  offset: data.selection.anchor.offset,
@@ -1824,8 +2601,8 @@ function richTextDTOtoSelection(data) {
1824
2601
  return null;
1825
2602
  }
1826
2603
  function richTextDTOtoDAO(data) {
1827
- var _a, _b, _c;
1828
- return (_c = (_b = (_a = data.document) == null ? void 0 : _a.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
2604
+ var _a2, _b, _c;
2605
+ return (_c = (_b = (_a2 = data.document) == null ? void 0 : _a2.nodes) == null ? void 0 : _b.flatMap(toNodeDAO)) != null ? _c : [];
1829
2606
  }
1830
2607
  function toInlineOrTextDTO(node) {
1831
2608
  if (isText(node)) {
@@ -1869,7 +2646,7 @@ function toInlineOrTextDTO(node) {
1869
2646
  }
1870
2647
  }
1871
2648
  function toNodeDTO(node) {
1872
- var _a, _b;
2649
+ var _a2, _b;
1873
2650
  if (isText(node))
1874
2651
  return toInlineOrTextDTO(node);
1875
2652
  switch (node.type) {
@@ -1894,7 +2671,7 @@ function toNodeDTO(node) {
1894
2671
  textAlign: node.textAlign
1895
2672
  } : {},
1896
2673
  object: "block",
1897
- nodes: (_b = (_a = node.children) == null ? void 0 : _a.flatMap(toNodeDTO)) != null ? _b : []
2674
+ nodes: (_b = (_a2 = node.children) == null ? void 0 : _a2.flatMap(toNodeDTO)) != null ? _b : []
1898
2675
  }
1899
2676
  ];
1900
2677
  default:
@@ -2258,51 +3035,51 @@ function getElementId$1(descriptor, prop) {
2258
3035
  }
2259
3036
  }
2260
3037
  function getBackgroundsSwatchIds(value) {
2261
- var _a;
2262
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
2263
- var _a2;
3038
+ var _a2;
3039
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
3040
+ var _a3;
2264
3041
  switch (backgroundItem.type) {
2265
3042
  case "color":
2266
- return ((_a2 = backgroundItem.payload) == null ? void 0 : _a2.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
3043
+ return ((_a3 = backgroundItem.payload) == null ? void 0 : _a3.swatchId) == null ? [] : [backgroundItem.payload.swatchId];
2267
3044
  case "gradient":
2268
3045
  return backgroundItem.payload.stops.flatMap((stop) => stop.color == null ? [] : stop.color.swatchId);
2269
3046
  default:
2270
3047
  return [];
2271
3048
  }
2272
- })) != null ? _a : [];
3049
+ })) != null ? _a2 : [];
2273
3050
  }
2274
3051
  function getBorderSwatchIds(value) {
2275
- var _a;
2276
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
2277
- var _a2, _b, _c, _d, _e, _f, _g, _h;
3052
+ var _a2;
3053
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((borderValue) => {
3054
+ var _a3, _b, _c, _d, _e, _f, _g, _h;
2278
3055
  return [
2279
- (_b = (_a2 = borderValue.borderTop) == null ? void 0 : _a2.color) == null ? void 0 : _b.swatchId,
3056
+ (_b = (_a3 = borderValue.borderTop) == null ? void 0 : _a3.color) == null ? void 0 : _b.swatchId,
2280
3057
  (_d = (_c = borderValue.borderRight) == null ? void 0 : _c.color) == null ? void 0 : _d.swatchId,
2281
3058
  (_f = (_e = borderValue.borderBottom) == null ? void 0 : _e.color) == null ? void 0 : _f.swatchId,
2282
3059
  (_h = (_g = borderValue.borderLeft) == null ? void 0 : _g.color) == null ? void 0 : _h.swatchId
2283
3060
  ].filter((swatchId) => swatchId != null);
2284
- })) != null ? _a : [];
3061
+ })) != null ? _a2 : [];
2285
3062
  }
2286
3063
  function getBoxShadowsSwatchIds(value) {
2287
- var _a;
2288
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
2289
- var _a2;
2290
- return (_a2 = item.payload.color) == null ? void 0 : _a2.swatchId;
2291
- }).filter((swatchId) => swatchId != null)) != null ? _a : [];
3064
+ var _a2;
3065
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).map((item) => {
3066
+ var _a3;
3067
+ return (_a3 = item.payload.color) == null ? void 0 : _a3.swatchId;
3068
+ }).filter((swatchId) => swatchId != null)) != null ? _a2 : [];
2292
3069
  }
2293
3070
  function getResponsiveColorSwatchIds(value) {
2294
- var _a;
2295
- return (_a = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a : [];
3071
+ var _a2;
3072
+ return (_a2 = value == null ? void 0 : value.map((override) => override.value).map((color) => color.swatchId)) != null ? _a2 : [];
2296
3073
  }
2297
3074
  function getTypographyStyleSwatchIds(style) {
2298
- var _a;
2299
- return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
2300
- var _a2;
2301
- return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
2302
- }).filter(isNonNullable)) != null ? _a : [];
3075
+ var _a2;
3076
+ return (_a2 = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
3077
+ var _a3;
3078
+ return (_a3 = typographyStyle.color) == null ? void 0 : _a3.swatchId;
3079
+ }).filter(isNonNullable)) != null ? _a2 : [];
2303
3080
  }
2304
3081
  function getElementSwatchIds(descriptor, prop) {
2305
- var _a;
3082
+ var _a2;
2306
3083
  if (prop == null)
2307
3084
  return [];
2308
3085
  switch (descriptor.type) {
@@ -2312,17 +3089,17 @@ function getElementSwatchIds(descriptor, prop) {
2312
3089
  return getBorderSwatchIds(prop);
2313
3090
  case Types.NavigationLinks: {
2314
3091
  const value = prop;
2315
- return (_a = value == null ? void 0 : value.flatMap((item) => {
2316
- var _a2, _b, _c, _d;
3092
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => {
3093
+ var _a3, _b, _c, _d;
2317
3094
  switch (item.type) {
2318
3095
  case "button":
2319
3096
  case "dropdown":
2320
3097
  return [
2321
- ...(_b = (_a2 = item.payload.color) == null ? void 0 : _a2.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
3098
+ ...(_b = (_a3 = item.payload.color) == null ? void 0 : _a3.map((override) => override.value).map((color) => color.swatchId)) != null ? _b : [],
2322
3099
  ...(_d = (_c = item.payload.textColor) == null ? void 0 : _c.map((override) => override.value).map((color) => color.swatchId)) != null ? _d : []
2323
3100
  ];
2324
3101
  }
2325
- })) != null ? _a : [];
3102
+ })) != null ? _a2 : [];
2326
3103
  }
2327
3104
  case Types.ResponsiveColor:
2328
3105
  return getResponsiveColorSwatchIds(prop);
@@ -2330,20 +3107,20 @@ function getElementSwatchIds(descriptor, prop) {
2330
3107
  return getBoxShadowsSwatchIds(prop);
2331
3108
  case Types.RichText: {
2332
3109
  let getNodeSwatchIds = function(node) {
2333
- var _a2, _b, _c, _d;
3110
+ var _a3, _b, _c, _d;
2334
3111
  switch (node.object) {
2335
3112
  case "document":
2336
3113
  case "block":
2337
3114
  case "inline":
2338
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeSwatchIds)) != null ? _b : [];
3115
+ return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodeSwatchIds)) != null ? _b : [];
2339
3116
  case "text":
2340
3117
  return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkSwatchIds)) != null ? _d : [];
2341
3118
  default:
2342
3119
  return [];
2343
3120
  }
2344
3121
  }, getMarkSwatchIds = function(mark) {
2345
- var _a2, _b;
2346
- return getTypographyStyleSwatchIds((_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.style);
3122
+ var _a3, _b;
3123
+ return getTypographyStyleSwatchIds((_b = (_a3 = mark.data) == null ? void 0 : _a3.value) == null ? void 0 : _b.style);
2347
3124
  };
2348
3125
  const value = prop;
2349
3126
  if (value == null || value.document == null)
@@ -2359,18 +3136,18 @@ function getElementSwatchIds(descriptor, prop) {
2359
3136
  }
2360
3137
  }
2361
3138
  function getBackgroundsFileIds(value) {
2362
- var _a;
2363
- return (_a = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
3139
+ var _a2;
3140
+ return (_a2 = value == null ? void 0 : value.flatMap((override) => override.value).flatMap((backgroundItem) => {
2364
3141
  switch (backgroundItem.type) {
2365
3142
  case "image":
2366
3143
  return [backgroundItem.payload.imageId];
2367
3144
  default:
2368
3145
  return [];
2369
3146
  }
2370
- })) != null ? _a : [];
3147
+ })) != null ? _a2 : [];
2371
3148
  }
2372
3149
  function getFileIds(descriptor, prop) {
2373
- var _a;
3150
+ var _a2;
2374
3151
  if (prop == null)
2375
3152
  return [];
2376
3153
  switch (descriptor.type) {
@@ -2382,7 +3159,7 @@ function getFileIds(descriptor, prop) {
2382
3159
  }
2383
3160
  case Types.Images: {
2384
3161
  const value = prop;
2385
- return (_a = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a : [];
3162
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => item.props.file == null ? [] : [item.props.file])) != null ? _a2 : [];
2386
3163
  }
2387
3164
  case ImageControlType: {
2388
3165
  const value = prop;
@@ -2398,20 +3175,20 @@ function getTypographyIds(descriptor, prop) {
2398
3175
  switch (descriptor.type) {
2399
3176
  case Types.RichText: {
2400
3177
  let getNodeTypographyIds = function(node) {
2401
- var _a, _b, _c, _d;
3178
+ var _a2, _b, _c, _d;
2402
3179
  switch (node.object) {
2403
3180
  case "document":
2404
3181
  case "block":
2405
3182
  case "inline":
2406
- return (_b = (_a = node.nodes) == null ? void 0 : _a.flatMap(getNodeTypographyIds)) != null ? _b : [];
3183
+ return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodeTypographyIds)) != null ? _b : [];
2407
3184
  case "text":
2408
3185
  return (_d = (_c = node.marks) == null ? void 0 : _c.flatMap(getMarkTypographyIds)) != null ? _d : [];
2409
3186
  default:
2410
3187
  return [];
2411
3188
  }
2412
3189
  }, getMarkTypographyIds = function(mark) {
2413
- var _a, _b;
2414
- return [(_b = (_a = mark.data) == null ? void 0 : _a.value) == null ? void 0 : _b.id].filter((id) => id != null);
3190
+ var _a2, _b;
3191
+ return [(_b = (_a2 = mark.data) == null ? void 0 : _a2.value) == null ? void 0 : _b.id].filter((id) => id != null);
2415
3192
  };
2416
3193
  const value = prop;
2417
3194
  if (value == null || value.document == null)
@@ -2435,7 +3212,7 @@ function getTableIds(descriptor, prop) {
2435
3212
  }
2436
3213
  }
2437
3214
  function getPageIds(descriptor, prop) {
2438
- var _a;
3215
+ var _a2;
2439
3216
  if (prop == null)
2440
3217
  return [];
2441
3218
  switch (descriptor.type) {
@@ -2454,8 +3231,8 @@ function getPageIds(descriptor, prop) {
2454
3231
  const value = prop;
2455
3232
  if (value == null)
2456
3233
  return [];
2457
- return (_a = value == null ? void 0 : value.flatMap((item) => {
2458
- var _a2, _b;
3234
+ return (_a2 = value == null ? void 0 : value.flatMap((item) => {
3235
+ var _a3, _b;
2459
3236
  switch (item.type) {
2460
3237
  case "button": {
2461
3238
  if (item.payload.link == null)
@@ -2468,7 +3245,7 @@ function getPageIds(descriptor, prop) {
2468
3245
  }
2469
3246
  }
2470
3247
  case "dropdown": {
2471
- return (_b = (_a2 = item.payload.links) == null ? void 0 : _a2.flatMap((link) => {
3248
+ return (_b = (_a3 = item.payload.links) == null ? void 0 : _a3.flatMap((link) => {
2472
3249
  if (link.payload.link == null)
2473
3250
  return [];
2474
3251
  switch (link.payload.link.type) {
@@ -2480,25 +3257,25 @@ function getPageIds(descriptor, prop) {
2480
3257
  })) != null ? _b : [];
2481
3258
  }
2482
3259
  }
2483
- })) != null ? _a : [];
3260
+ })) != null ? _a2 : [];
2484
3261
  }
2485
3262
  case Types.RichText: {
2486
3263
  let getNodePageIds = function(node) {
2487
- var _a2, _b;
3264
+ var _a3, _b;
2488
3265
  switch (node.object) {
2489
3266
  case "document":
2490
3267
  case "block":
2491
- return (_b = (_a2 = node.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
3268
+ return (_b = (_a3 = node.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2492
3269
  case "inline":
2493
3270
  return getInlinePageIds(node);
2494
3271
  default:
2495
3272
  return [];
2496
3273
  }
2497
3274
  }, getInlinePageIds = function(inline) {
2498
- var _a2, _b, _c, _d;
3275
+ var _a3, _b, _c, _d;
2499
3276
  switch (inline.type) {
2500
3277
  case "link": {
2501
- const nodePageIds = (_b = (_a2 = inline.nodes) == null ? void 0 : _a2.flatMap(getNodePageIds)) != null ? _b : [];
3278
+ const nodePageIds = (_b = (_a3 = inline.nodes) == null ? void 0 : _a3.flatMap(getNodePageIds)) != null ? _b : [];
2502
3279
  const dataPageIds = inline.data ? getLinkDataPageIds(inline.data) : [];
2503
3280
  return [...nodePageIds, ...dataPageIds];
2504
3281
  }
@@ -2541,13 +3318,14 @@ var introspection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
2541
3318
  const reducer = combineReducers({
2542
3319
  documents: reducer$8,
2543
3320
  reactComponents: reducer$7,
2544
- componentsMeta: reducer$6,
2545
- propControllers: reducer$5,
2546
- propControllerHandles: reducer$4,
2547
- isInBuilder: reducer$3,
2548
- isPreview: reducer$2,
2549
- builderEditMode: reducer$1,
2550
- breakpoints: reducer$9
3321
+ componentsMeta: reducer$9,
3322
+ propControllers: reducer$6,
3323
+ propControllerHandles: reducer$5,
3324
+ isInBuilder: reducer$4,
3325
+ isPreview: reducer$3,
3326
+ builderEditMode: reducer$2,
3327
+ breakpoints: reducer$a,
3328
+ locales: reducer$1
2551
3329
  });
2552
3330
  function getDocumentsStateSlice(state) {
2553
3331
  return state.documents;
@@ -2612,14 +3390,14 @@ function getDocumentKeysSortedByDepth(state) {
2612
3390
  elements.set(key, getDocumentElements(state, key));
2613
3391
  });
2614
3392
  keys.sort((a, b) => {
2615
- var _a;
2616
- return ((_a = elements.get(a)) == null ? void 0 : _a.has(b)) ? -1 : 1;
3393
+ var _a2;
3394
+ return ((_a2 = elements.get(a)) == null ? void 0 : _a2.has(b)) ? -1 : 1;
2617
3395
  });
2618
3396
  return keys;
2619
3397
  }
2620
3398
  function getElement(state, documentKey, elementKey) {
2621
- var _a;
2622
- return (_a = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a : null;
3399
+ var _a2;
3400
+ return (_a2 = getDocumentElements(state, documentKey).get(elementKey)) != null ? _a2 : null;
2623
3401
  }
2624
3402
  function getElementPropControllerDescriptors(state, documentKey, elementKey) {
2625
3403
  const element = getElement(state, documentKey, elementKey);
@@ -2690,15 +3468,20 @@ function getBuilderEditMode(state) {
2690
3468
  function getBreakpoints(state) {
2691
3469
  return state.breakpoints;
2692
3470
  }
3471
+ function getLocales(state) {
3472
+ return state.locales;
3473
+ }
2693
3474
  function configureStore({
2694
3475
  rootElements,
2695
3476
  preloadedState,
2696
- breakpoints
3477
+ breakpoints,
3478
+ locales
2697
3479
  } = {}) {
2698
3480
  return createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), {
2699
3481
  documents: getInitialState$7({ rootElements }),
2700
- breakpoints: getInitialState$8(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints)
3482
+ breakpoints: getInitialState$9(breakpoints != null ? breakpoints : preloadedState == null ? void 0 : preloadedState.breakpoints),
3483
+ locales: getInitialState(locales != null ? locales : preloadedState == null ? void 0 : preloadedState.locales)
2701
3484
  }), applyMiddleware(thunk));
2702
3485
  }
2703
- export { getResponsiveColorSwatchIds as $, TextArea as A, Backgrounds as B, Checkbox as C, Date as D, ElementID as E, Font as F, GapY as G, Table as H, Images as I, TableFormFields as J, Image as K, ListControlType as L, Margin as M, Number as N, ResponsiveOpacity as O, Padding as P, NavigationLinks as Q, RichTextPropControllerMessageType as R, ShapeControlType as S, TableFormFieldsMessageType as T, SocialLinks as U, RichText as V, Width as W, Video as X, getBorderSwatchIds as Y, isNonNullable as Z, getBoxShadowsSwatchIds as _, createDocumentReference as a, createRichTextV2Plugin as a$, StyleControlProperty as a0, ImageControlValueFormat as a1, isPropControllersHandle as a2, StyleControlType as a3, RichTextV2ControlType as a4, RichTextControlType as a5, SlotControlType as a6, LinkControlType as a7, ImageControlType as a8, ColorControlType as a9, copyLinkData as aA, List$1 as aB, ListControlMessageType as aC, ListControl as aD, copyListData as aE, Shape$1 as aF, ShapeControlMessageType as aG, ShapeControl as aH, copyShapeData as aI, Slot as aJ, SlotControlMessageType as aK, SlotControl as aL, copySlotData as aM, mergeSlotData as aN, Style as aO, StyleControlMessageType as aP, StyleControl as aQ, copyStyleData as aR, ObjectType as aS, RichText$1 as aT, RichTextControlMessageType as aU, RichTextControl as aV, richTextDTOtoSelection as aW, richTextDTOtoDAO as aX, toSelectionDTO as aY, richTextDAOToDTO as aZ, RichTextV2Mode as a_, getComponentPropControllerDescriptors as aa, getPropControllers as ab, BorderPropControllerFormat as ac, ShadowsPropControllerFormat as ad, BorderRadiusPropControllerFormat as ae, MarginPropControllerFormat as af, PaddingPropControllerFormat as ag, WidthPropControllerFormat as ah, configureStore as ai, copyElementTree as aj, getBreakpoints as ak, getDocument as al, getElementId as am, getIsPreview as an, getIsInBuilder as ao, getReactComponent as ap, getBuilderEditMode as aq, getBackgroundsFileIds as ar, getBackgroundsSwatchIds as as, Color as at, copyColorData as au, copy as av, merge as aw, Image$1 as ax, copyImageData as ay, Link$1 as az, isElementReference as b, unstable_RichTextV2 as b0, RichTextV2ControlMessageType as b1, RichTextV2Control as b2, RootBlockType as b3, BlockType as b4, InlineType as b5, BlockTextAlignment as b6, getInitialState$7 as b7, reducer$8 as b8, getDocument$1 as b9, getComponentsMeta as ba, getComponentPropControllerDescriptors$1 as bb, BuilderEditMode as bc, getDocumentKeysSortedByDepth as bd, getPropController as be, getPropControllersHandle as bf, getElement as bg, getElementPropControllerDescriptors as bh, createPropController as bi, reducer$7 as bj, reducer$6 as bk, reducer$5 as bl, reducer$4 as bm, reducer$3 as bn, reducer$2 as bo, reducer$1 as bp, getInitialState$1 as bq, createDocument as c, descriptors as d, getElementSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, Types as m, ResponsiveIconRadioGroup as n, Border as o, BorderRadius as p, Shadows as q, GapX as r, ResponsiveSelect as s, ResponsiveNumber as t, Grid as u, TextInput as v, Link as w, ResponsiveColor as x, TextStyle as y, ResponsiveLength as z };
3486
+ export { isNonNullable as $, ResponsiveLength as A, Backgrounds as B, ComponentIcon as C, Date as D, ElementID as E, Font as F, GapY as G, TextArea as H, Images as I, Table as J, TableFormFields as K, ListControlType as L, Margin as M, Number as N, Image as O, Padding as P, ResponsiveOpacity as Q, RichTextPropControllerMessageType as R, ShapeControlType as S, TableFormFieldsMessageType as T, NavigationLinks as U, SocialLinks as V, Width as W, RichText as X, Video as Y, useStyle as Z, getBorderSwatchIds as _, createDocumentReference as a, ObjectType as a$, getBoxShadowsSwatchIds as a0, getResponsiveColorSwatchIds as a1, StyleControlProperty as a2, ImageControlValueFormat as a3, isPropControllersHandle as a4, StyleV2ControlType as a5, StyleControlType as a6, RichTextV2ControlType as a7, RichTextControlType as a8, SlotControlType as a9, merge as aA, Image$1 as aB, copyImageData as aC, Link$1 as aD, copyLinkData as aE, List$1 as aF, ListControlMessageType as aG, ListControl as aH, copyListData as aI, Select as aJ, Shape$1 as aK, ShapeControlMessageType as aL, ShapeControl as aM, copyShapeData as aN, Slot as aO, SlotControlMessageType as aP, SlotControl as aQ, copySlotData as aR, mergeSlotData as aS, Style as aT, StyleControlMessageType as aU, StyleControl as aV, copyStyleData as aW, unstable_useStyleV2ClassName as aX, unstable_StyleV2 as aY, StyleV2ControlMessageType as aZ, StyleV2Control as a_, LinkControlType as aa, ImageControlType as ab, ColorControlType as ac, SelectControlType as ad, getComponentPropControllerDescriptors as ae, getPropControllers as af, BorderPropControllerFormat as ag, ShadowsPropControllerFormat as ah, BorderRadiusPropControllerFormat as ai, MarginPropControllerFormat as aj, PaddingPropControllerFormat as ak, WidthPropControllerFormat as al, configureStore as am, copyElementTree as an, getBreakpoints as ao, getDocument as ap, getElementId as aq, getIsPreview as ar, getIsInBuilder as as, getReactComponent as at, getBuilderEditMode as au, getBackgroundsFileIds as av, getBackgroundsSwatchIds as aw, Color as ax, copyColorData as ay, copy as az, isElementReference as b, RichText$1 as b0, RichTextControlMessageType as b1, RichTextControl as b2, richTextDTOtoSelection as b3, richTextDTOtoDAO as b4, toSelectionDTO as b5, richTextDAOToDTO as b6, RichTextV2Mode as b7, createRichTextV2Plugin as b8, unstable_RichTextV2 as b9, reducer$7 as bA, reducer$9 as bB, reducer$6 as bC, reducer$5 as bD, reducer$4 as bE, reducer$3 as bF, reducer$2 as bG, reducer$1 as bH, getInitialState$2 as bI, RichTextV2ControlMessageType as ba, RichTextV2Control as bb, getBlocksInSelection as bc, ElementUtils as bd, BlockActions as be, ListActions as bf, onKeyDown as bg, withBlock as bh, BlockPlugin as bi, RootBlockType as bj, BlockType as bk, InlineType as bl, BlockTextAlignment as bm, getInitialState$7 as bn, reducer$8 as bo, getDocument$1 as bp, getComponentsMeta as bq, getComponentPropControllerDescriptors$1 as br, getLocales as bs, BuilderEditMode as bt, getDocumentKeysSortedByDepth as bu, getPropController as bv, getPropControllersHandle as bw, getElement as bx, getElementPropControllerDescriptors as by, createPropController as bz, createDocument as c, descriptors as d, getElementSwatchIds as e, getFileIds as f, getPropControllerDescriptors as g, getTypographyIds as h, introspection as i, getTableIds as j, getPageIds as k, getElementChildren as l, Types as m, ResponsiveIconRadioGroup as n, Border as o, BorderRadius as p, Shadows as q, GapX as r, ResponsiveSelect as s, ResponsiveNumber as t, Checkbox as u, Grid as v, TextInput as w, Link as x, ResponsiveColor as y, TextStyle as z };
2704
3487
  //# sourceMappingURL=react-page.es.js.map