@reacteditor/core 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +85 -0
  2. package/dist/Editor-GBV2O5RD.css +415 -0
  3. package/dist/Editor-IKMJILGR.mjs +204 -0
  4. package/dist/Render-EFT7YD2C.css +103 -0
  5. package/dist/Render-VDC7AEQK.mjs +55 -0
  6. package/dist/actions-BCDhqbeL.d.mts +849 -0
  7. package/dist/actions-BCDhqbeL.d.ts +849 -0
  8. package/dist/chunk-2YLS65V2.mjs +103 -0
  9. package/dist/chunk-6B2Q5R3C.mjs +53 -0
  10. package/dist/chunk-DXGQXXQG.mjs +63 -0
  11. package/dist/chunk-F7S5S6I2.mjs +114 -0
  12. package/dist/chunk-GAUBBDIR.mjs +463 -0
  13. package/dist/chunk-GUMYXUO3.mjs +33 -0
  14. package/dist/chunk-M6W7YEVX.mjs +95 -0
  15. package/dist/chunk-MFI3RDA4.mjs +11 -0
  16. package/dist/chunk-QNHSXCWU.mjs +8692 -0
  17. package/dist/chunk-SURZYH7D.mjs +1726 -0
  18. package/dist/chunk-V2OPYD42.mjs +708 -0
  19. package/dist/chunk-VD3EVRUF.mjs +476 -0
  20. package/dist/chunk-VOLQMQPK.mjs +146 -0
  21. package/dist/chunk-VUEM62JF.mjs +523 -0
  22. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  23. package/dist/full-ELX6RALJ.css +311 -0
  24. package/dist/full-OBTPW7TC.mjs +93 -0
  25. package/dist/index-ComBHfdn.d.ts +117 -0
  26. package/dist/index-DVwiIwYU.d.mts +117 -0
  27. package/dist/index.css +3033 -0
  28. package/dist/index.d.mts +396 -0
  29. package/dist/index.d.ts +396 -0
  30. package/dist/index.js +14688 -0
  31. package/dist/index.mjs +87 -0
  32. package/dist/internal.d.mts +27 -0
  33. package/dist/internal.d.ts +27 -0
  34. package/dist/internal.js +931 -0
  35. package/dist/internal.mjs +13 -0
  36. package/dist/loaded-35WC23HJ.mjs +60 -0
  37. package/dist/loaded-TBSVRJPY.css +90 -0
  38. package/dist/loaded-ULSROV73.mjs +57 -0
  39. package/dist/loaded-YYRJPIWZ.mjs +57 -0
  40. package/dist/no-external.css +3031 -0
  41. package/dist/no-external.d.mts +21 -0
  42. package/dist/no-external.d.ts +21 -0
  43. package/dist/no-external.js +14688 -0
  44. package/dist/no-external.mjs +87 -0
  45. package/dist/rsc.css +103 -0
  46. package/dist/rsc.d.mts +27 -0
  47. package/dist/rsc.d.ts +27 -0
  48. package/dist/rsc.js +1493 -0
  49. package/dist/rsc.mjs +148 -0
  50. package/dist/walk-tree-BPIigVTF.d.mts +29 -0
  51. package/dist/walk-tree-BZq1CPCH.d.ts +29 -0
  52. package/package.json +139 -0
@@ -0,0 +1,1726 @@
1
+ import {
2
+ createReducer,
3
+ getItem,
4
+ makeStatePublic
5
+ } from "./chunk-VUEM62JF.mjs";
6
+ import {
7
+ defaultAppState,
8
+ defaultViewports,
9
+ getChanged,
10
+ resolveComponentData
11
+ } from "./chunk-VOLQMQPK.mjs";
12
+ import {
13
+ get_class_name_factory_default
14
+ } from "./chunk-Y2EFNT5P.mjs";
15
+ import {
16
+ generateId,
17
+ walkAppState
18
+ } from "./chunk-GAUBBDIR.mjs";
19
+ import {
20
+ __async,
21
+ __objRest,
22
+ __spreadProps,
23
+ __spreadValues,
24
+ init_react_import
25
+ } from "./chunk-M6W7YEVX.mjs";
26
+
27
+ // ../../node_modules/lucide-react/dist/esm/icons/align-left.js
28
+ init_react_import();
29
+
30
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
31
+ init_react_import();
32
+ import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
33
+
34
+ // ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
35
+ init_react_import();
36
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
37
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
38
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
39
+ }).join(" ").trim();
40
+
41
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
42
+ init_react_import();
43
+ import { forwardRef, createElement } from "react";
44
+
45
+ // ../../node_modules/lucide-react/dist/esm/defaultAttributes.js
46
+ init_react_import();
47
+ var defaultAttributes = {
48
+ xmlns: "http://www.w3.org/2000/svg",
49
+ width: 24,
50
+ height: 24,
51
+ viewBox: "0 0 24 24",
52
+ fill: "none",
53
+ stroke: "currentColor",
54
+ strokeWidth: 2,
55
+ strokeLinecap: "round",
56
+ strokeLinejoin: "round"
57
+ };
58
+
59
+ // ../../node_modules/lucide-react/dist/esm/Icon.js
60
+ var Icon = forwardRef(
61
+ (_a, ref) => {
62
+ var _b = _a, {
63
+ color = "currentColor",
64
+ size = 24,
65
+ strokeWidth = 2,
66
+ absoluteStrokeWidth,
67
+ className = "",
68
+ children,
69
+ iconNode
70
+ } = _b, rest = __objRest(_b, [
71
+ "color",
72
+ "size",
73
+ "strokeWidth",
74
+ "absoluteStrokeWidth",
75
+ "className",
76
+ "children",
77
+ "iconNode"
78
+ ]);
79
+ return createElement(
80
+ "svg",
81
+ __spreadValues(__spreadProps(__spreadValues({
82
+ ref
83
+ }, defaultAttributes), {
84
+ width: size,
85
+ height: size,
86
+ stroke: color,
87
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
88
+ className: mergeClasses("lucide", className)
89
+ }), rest),
90
+ [
91
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
92
+ ...Array.isArray(children) ? children : [children]
93
+ ]
94
+ );
95
+ }
96
+ );
97
+
98
+ // ../../node_modules/lucide-react/dist/esm/createLucideIcon.js
99
+ var createLucideIcon = (iconName, iconNode) => {
100
+ const Component2 = forwardRef2(
101
+ (_a, ref) => {
102
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
103
+ return createElement2(Icon, __spreadValues({
104
+ ref,
105
+ iconNode,
106
+ className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className)
107
+ }, props));
108
+ }
109
+ );
110
+ Component2.displayName = `${iconName}`;
111
+ return Component2;
112
+ };
113
+
114
+ // ../../node_modules/lucide-react/dist/esm/icons/align-left.js
115
+ var AlignLeft = createLucideIcon("AlignLeft", [
116
+ ["path", { d: "M15 12H3", key: "6jk70r" }],
117
+ ["path", { d: "M17 18H3", key: "1amg6g" }],
118
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
119
+ ]);
120
+
121
+ // ../../node_modules/lucide-react/dist/esm/icons/heading.js
122
+ init_react_import();
123
+ var Heading = createLucideIcon("Heading", [
124
+ ["path", { d: "M6 12h12", key: "8npq4p" }],
125
+ ["path", { d: "M6 20V4", key: "1w1bmo" }],
126
+ ["path", { d: "M18 20V4", key: "o2hl4u" }]
127
+ ]);
128
+
129
+ // ../../node_modules/lucide-react/dist/esm/icons/list.js
130
+ init_react_import();
131
+ var List = createLucideIcon("List", [
132
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
133
+ ["path", { d: "M3 18h.01", key: "1tta3j" }],
134
+ ["path", { d: "M3 6h.01", key: "1rqtza" }],
135
+ ["path", { d: "M8 12h13", key: "1za7za" }],
136
+ ["path", { d: "M8 18h13", key: "1lx6n3" }],
137
+ ["path", { d: "M8 6h13", key: "ik3vkj" }]
138
+ ]);
139
+
140
+ // ../../node_modules/lucide-react/dist/esm/lucide-react.js
141
+ init_react_import();
142
+
143
+ // ../../node_modules/lucide-react/dist/esm/icons/align-center.js
144
+ init_react_import();
145
+ var AlignCenter = createLucideIcon("AlignCenter", [
146
+ ["path", { d: "M17 12H7", key: "16if0g" }],
147
+ ["path", { d: "M19 18H5", key: "18s9l3" }],
148
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
149
+ ]);
150
+
151
+ // ../../node_modules/lucide-react/dist/esm/icons/align-justify.js
152
+ init_react_import();
153
+ var AlignJustify = createLucideIcon("AlignJustify", [
154
+ ["path", { d: "M3 12h18", key: "1i2n21" }],
155
+ ["path", { d: "M3 18h18", key: "1h113x" }],
156
+ ["path", { d: "M3 6h18", key: "d0wm0j" }]
157
+ ]);
158
+
159
+ // ../../node_modules/lucide-react/dist/esm/icons/align-right.js
160
+ init_react_import();
161
+ var AlignRight = createLucideIcon("AlignRight", [
162
+ ["path", { d: "M21 12H9", key: "dn1m92" }],
163
+ ["path", { d: "M21 18H7", key: "1ygte8" }],
164
+ ["path", { d: "M21 6H3", key: "1jwq7v" }]
165
+ ]);
166
+
167
+ // ../../node_modules/lucide-react/dist/esm/icons/bold.js
168
+ init_react_import();
169
+ var Bold = createLucideIcon("Bold", [
170
+ [
171
+ "path",
172
+ { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
173
+ ]
174
+ ]);
175
+
176
+ // ../../node_modules/lucide-react/dist/esm/icons/check.js
177
+ init_react_import();
178
+ var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
179
+
180
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-down.js
181
+ init_react_import();
182
+ var ChevronDown = createLucideIcon("ChevronDown", [
183
+ ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
184
+ ]);
185
+
186
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
187
+ init_react_import();
188
+ var ChevronRight = createLucideIcon("ChevronRight", [
189
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
190
+ ]);
191
+
192
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
193
+ init_react_import();
194
+ var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
195
+
196
+ // ../../node_modules/lucide-react/dist/esm/icons/code.js
197
+ init_react_import();
198
+ var Code = createLucideIcon("Code", [
199
+ ["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
200
+ ["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }]
201
+ ]);
202
+
203
+ // ../../node_modules/lucide-react/dist/esm/icons/component.js
204
+ init_react_import();
205
+ var Component = createLucideIcon("Component", [
206
+ [
207
+ "path",
208
+ {
209
+ d: "M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",
210
+ key: "1uwlt4"
211
+ }
212
+ ],
213
+ [
214
+ "path",
215
+ {
216
+ d: "M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",
217
+ key: "10291m"
218
+ }
219
+ ],
220
+ [
221
+ "path",
222
+ {
223
+ d: "M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",
224
+ key: "1tqoq1"
225
+ }
226
+ ],
227
+ [
228
+ "path",
229
+ {
230
+ d: "M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",
231
+ key: "1x6lto"
232
+ }
233
+ ]
234
+ ]);
235
+
236
+ // ../../node_modules/lucide-react/dist/esm/icons/copy.js
237
+ init_react_import();
238
+ var Copy = createLucideIcon("Copy", [
239
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
240
+ ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
241
+ ]);
242
+
243
+ // ../../node_modules/lucide-react/dist/esm/icons/corner-left-up.js
244
+ init_react_import();
245
+ var CornerLeftUp = createLucideIcon("CornerLeftUp", [
246
+ ["polyline", { points: "14 9 9 4 4 9", key: "m9oyvo" }],
247
+ ["path", { d: "M20 20h-7a4 4 0 0 1-4-4V4", key: "1blwi3" }]
248
+ ]);
249
+
250
+ // ../../node_modules/lucide-react/dist/esm/icons/globe.js
251
+ init_react_import();
252
+ var Globe = createLucideIcon("Globe", [
253
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
254
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
255
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
256
+ ]);
257
+
258
+ // ../../node_modules/lucide-react/dist/esm/icons/grip-vertical.js
259
+ init_react_import();
260
+ var GripVertical = createLucideIcon("GripVertical", [
261
+ ["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
262
+ ["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
263
+ ["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
264
+ ["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
265
+ ["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
266
+ ["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
267
+ ]);
268
+
269
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
270
+ init_react_import();
271
+ var Heading1 = createLucideIcon("Heading1", [
272
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
273
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
274
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
275
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
276
+ ]);
277
+
278
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-2.js
279
+ init_react_import();
280
+ var Heading2 = createLucideIcon("Heading2", [
281
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
282
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
283
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
284
+ ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
285
+ ]);
286
+
287
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-3.js
288
+ init_react_import();
289
+ var Heading3 = createLucideIcon("Heading3", [
290
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
291
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
292
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
293
+ ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
294
+ ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
295
+ ]);
296
+
297
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-4.js
298
+ init_react_import();
299
+ var Heading4 = createLucideIcon("Heading4", [
300
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
301
+ ["path", { d: "M17 10v3a1 1 0 0 0 1 1h3", key: "tj5zdr" }],
302
+ ["path", { d: "M21 10v8", key: "1kdml4" }],
303
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
304
+ ["path", { d: "M4 18V6", key: "1rz3zl" }]
305
+ ]);
306
+
307
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-5.js
308
+ init_react_import();
309
+ var Heading5 = createLucideIcon("Heading5", [
310
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
311
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
312
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
313
+ ["path", { d: "M17 13v-3h4", key: "1nvgqp" }],
314
+ [
315
+ "path",
316
+ { d: "M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17", key: "2nebdn" }
317
+ ]
318
+ ]);
319
+
320
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-6.js
321
+ init_react_import();
322
+ var Heading6 = createLucideIcon("Heading6", [
323
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
324
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
325
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
326
+ ["circle", { cx: "19", cy: "16", r: "2", key: "15mx69" }],
327
+ ["path", { d: "M20 10c-2 2-3 3.5-3 6", key: "f35dl0" }]
328
+ ]);
329
+
330
+ // ../../node_modules/lucide-react/dist/esm/icons/italic.js
331
+ init_react_import();
332
+ var Italic = createLucideIcon("Italic", [
333
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
334
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
335
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
336
+ ]);
337
+
338
+ // ../../node_modules/lucide-react/dist/esm/icons/layers.js
339
+ init_react_import();
340
+ var Layers = createLucideIcon("Layers", [
341
+ [
342
+ "path",
343
+ {
344
+ d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
345
+ key: "zw3jo"
346
+ }
347
+ ],
348
+ [
349
+ "path",
350
+ {
351
+ d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
352
+ key: "1wduqc"
353
+ }
354
+ ],
355
+ [
356
+ "path",
357
+ {
358
+ d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
359
+ key: "kqbvx6"
360
+ }
361
+ ]
362
+ ]);
363
+
364
+ // ../../node_modules/lucide-react/dist/esm/icons/link.js
365
+ init_react_import();
366
+ var Link = createLucideIcon("Link", [
367
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
368
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
369
+ ]);
370
+
371
+ // ../../node_modules/lucide-react/dist/esm/icons/list-ordered.js
372
+ init_react_import();
373
+ var ListOrdered = createLucideIcon("ListOrdered", [
374
+ ["path", { d: "M10 12h11", key: "6m4ad9" }],
375
+ ["path", { d: "M10 18h11", key: "11hvi2" }],
376
+ ["path", { d: "M10 6h11", key: "c7qv1k" }],
377
+ ["path", { d: "M4 10h2", key: "16xx2s" }],
378
+ ["path", { d: "M4 6h1v4", key: "cnovpq" }],
379
+ ["path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1", key: "m9a95d" }]
380
+ ]);
381
+
382
+ // ../../node_modules/lucide-react/dist/esm/icons/lock.js
383
+ init_react_import();
384
+ var Lock = createLucideIcon("Lock", [
385
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
386
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
387
+ ]);
388
+
389
+ // ../../node_modules/lucide-react/dist/esm/icons/maximize.js
390
+ init_react_import();
391
+ var Maximize = createLucideIcon("Maximize", [
392
+ ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
393
+ ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
394
+ ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
395
+ ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
396
+ ]);
397
+
398
+ // ../../node_modules/lucide-react/dist/esm/icons/minimize.js
399
+ init_react_import();
400
+ var Minimize = createLucideIcon("Minimize", [
401
+ ["path", { d: "M8 3v3a2 2 0 0 1-2 2H3", key: "hohbtr" }],
402
+ ["path", { d: "M21 8h-3a2 2 0 0 1-2-2V3", key: "5jw1f3" }],
403
+ ["path", { d: "M3 16h3a2 2 0 0 1 2 2v3", key: "198tvr" }],
404
+ ["path", { d: "M16 21v-3a2 2 0 0 1 2-2h3", key: "ph8mxp" }]
405
+ ]);
406
+
407
+ // ../../node_modules/lucide-react/dist/esm/icons/minus.js
408
+ init_react_import();
409
+ var Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
410
+
411
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
412
+ init_react_import();
413
+ var Monitor = createLucideIcon("Monitor", [
414
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
415
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
416
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
417
+ ]);
418
+
419
+ // ../../node_modules/lucide-react/dist/esm/icons/moon.js
420
+ init_react_import();
421
+ var Moon = createLucideIcon("Moon", [
422
+ ["path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z", key: "a7tn18" }]
423
+ ]);
424
+
425
+ // ../../node_modules/lucide-react/dist/esm/icons/plus.js
426
+ init_react_import();
427
+ var Plus = createLucideIcon("Plus", [
428
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
429
+ ["path", { d: "M12 5v14", key: "s699le" }]
430
+ ]);
431
+
432
+ // ../../node_modules/lucide-react/dist/esm/icons/quote.js
433
+ init_react_import();
434
+ var Quote = createLucideIcon("Quote", [
435
+ [
436
+ "path",
437
+ {
438
+ d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
439
+ key: "rib7q0"
440
+ }
441
+ ],
442
+ [
443
+ "path",
444
+ {
445
+ d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",
446
+ key: "1ymkrd"
447
+ }
448
+ ]
449
+ ]);
450
+
451
+ // ../../node_modules/lucide-react/dist/esm/icons/rectangle-ellipsis.js
452
+ init_react_import();
453
+ var RectangleEllipsis = createLucideIcon("RectangleEllipsis", [
454
+ ["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }],
455
+ ["path", { d: "M12 12h.01", key: "1mp3jc" }],
456
+ ["path", { d: "M17 12h.01", key: "1m0b6t" }],
457
+ ["path", { d: "M7 12h.01", key: "eqddd0" }]
458
+ ]);
459
+
460
+ // ../../node_modules/lucide-react/dist/esm/icons/redo-2.js
461
+ init_react_import();
462
+ var Redo2 = createLucideIcon("Redo2", [
463
+ ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
464
+ ["path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13", key: "6uklza" }]
465
+ ]);
466
+
467
+ // ../../node_modules/lucide-react/dist/esm/icons/search.js
468
+ init_react_import();
469
+ var Search = createLucideIcon("Search", [
470
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
471
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
472
+ ]);
473
+
474
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
475
+ init_react_import();
476
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
477
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
478
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
479
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
480
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
481
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
482
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
483
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
484
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
485
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
486
+ ]);
487
+
488
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
489
+ init_react_import();
490
+ var Smartphone = createLucideIcon("Smartphone", [
491
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
492
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
493
+ ]);
494
+
495
+ // ../../node_modules/lucide-react/dist/esm/icons/square-code.js
496
+ init_react_import();
497
+ var SquareCode = createLucideIcon("SquareCode", [
498
+ ["path", { d: "M10 9.5 8 12l2 2.5", key: "3mjy60" }],
499
+ ["path", { d: "m14 9.5 2 2.5-2 2.5", key: "1bir2l" }],
500
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
501
+ ]);
502
+
503
+ // ../../node_modules/lucide-react/dist/esm/icons/strikethrough.js
504
+ init_react_import();
505
+ var Strikethrough = createLucideIcon("Strikethrough", [
506
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
507
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
508
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
509
+ ]);
510
+
511
+ // ../../node_modules/lucide-react/dist/esm/icons/sun.js
512
+ init_react_import();
513
+ var Sun = createLucideIcon("Sun", [
514
+ ["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
515
+ ["path", { d: "M12 2v2", key: "tus03m" }],
516
+ ["path", { d: "M12 20v2", key: "1lh1kg" }],
517
+ ["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
518
+ ["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
519
+ ["path", { d: "M2 12h2", key: "1t8f8n" }],
520
+ ["path", { d: "M20 12h2", key: "1q8mjw" }],
521
+ ["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
522
+ ["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
523
+ ]);
524
+
525
+ // ../../node_modules/lucide-react/dist/esm/icons/toy-brick.js
526
+ init_react_import();
527
+ var ToyBrick = createLucideIcon("ToyBrick", [
528
+ ["rect", { width: "18", height: "12", x: "3", y: "8", rx: "1", key: "158fvp" }],
529
+ ["path", { d: "M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3", key: "s0042v" }],
530
+ ["path", { d: "M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3", key: "9wmeh2" }]
531
+ ]);
532
+
533
+ // ../../node_modules/lucide-react/dist/esm/icons/trash.js
534
+ init_react_import();
535
+ var Trash = createLucideIcon("Trash", [
536
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
537
+ ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
538
+ ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }]
539
+ ]);
540
+
541
+ // ../../node_modules/lucide-react/dist/esm/icons/underline.js
542
+ init_react_import();
543
+ var Underline = createLucideIcon("Underline", [
544
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
545
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
546
+ ]);
547
+
548
+ // ../../node_modules/lucide-react/dist/esm/icons/undo-2.js
549
+ init_react_import();
550
+ var Undo2 = createLucideIcon("Undo2", [
551
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
552
+ ["path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11", key: "f3b9sd" }]
553
+ ]);
554
+
555
+ // ../../node_modules/lucide-react/dist/esm/icons/unlink-2.js
556
+ init_react_import();
557
+ var Unlink2 = createLucideIcon("Unlink2", [
558
+ ["path", { d: "M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2", key: "1re2ne" }]
559
+ ]);
560
+
561
+ // ../../node_modules/lucide-react/dist/esm/icons/x.js
562
+ init_react_import();
563
+ var X = createLucideIcon("X", [
564
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
565
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
566
+ ]);
567
+
568
+ // store/index.ts
569
+ init_react_import();
570
+ import { create as create2, useStore } from "zustand";
571
+ import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
572
+ import { createContext, useContext } from "react";
573
+
574
+ // store/slices/history.ts
575
+ init_react_import();
576
+ import { useEffect as useEffect2 } from "react";
577
+
578
+ // lib/use-hotkey.ts
579
+ init_react_import();
580
+ import { useEffect } from "react";
581
+ import { create } from "zustand";
582
+ import { subscribeWithSelector } from "zustand/middleware";
583
+ var keyCodeMap = {
584
+ ControlLeft: "ctrl",
585
+ ControlRight: "ctrl",
586
+ MetaLeft: "meta",
587
+ MetaRight: "meta",
588
+ ShiftLeft: "shift",
589
+ ShiftRight: "shift",
590
+ KeyA: "a",
591
+ KeyB: "b",
592
+ KeyC: "c",
593
+ KeyD: "d",
594
+ KeyE: "e",
595
+ KeyF: "f",
596
+ KeyG: "g",
597
+ KeyH: "h",
598
+ KeyI: "i",
599
+ KeyJ: "j",
600
+ KeyK: "k",
601
+ KeyL: "l",
602
+ KeyM: "m",
603
+ KeyN: "n",
604
+ KeyO: "o",
605
+ KeyP: "p",
606
+ KeyQ: "q",
607
+ KeyR: "r",
608
+ KeyS: "s",
609
+ KeyT: "t",
610
+ KeyU: "u",
611
+ KeyV: "v",
612
+ KeyW: "w",
613
+ KeyX: "x",
614
+ KeyY: "y",
615
+ KeyZ: "z",
616
+ Delete: "delete",
617
+ Backspace: "backspace",
618
+ AltRight: "altRight"
619
+ };
620
+ var useHotkeyStore = create()(
621
+ subscribeWithSelector((set) => ({
622
+ held: {},
623
+ hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
624
+ release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
625
+ reset: (held = {}) => set(() => ({ held })),
626
+ triggers: {}
627
+ }))
628
+ );
629
+ var monitorHotkeys = (doc) => {
630
+ const onKeyDown = (e) => {
631
+ if (e.getModifierState("AltGraph")) {
632
+ useHotkeyStore.getState().hold("altRight");
633
+ return;
634
+ }
635
+ const key = keyCodeMap[e.code];
636
+ if (key) {
637
+ useHotkeyStore.getState().hold(key);
638
+ const { held, triggers } = useHotkeyStore.getState();
639
+ Object.values(triggers).forEach(({ combo, cb }) => {
640
+ const conditionMet = Object.entries(combo).every(
641
+ ([key2, value]) => value === !!held[key2]
642
+ ) && Object.entries(held).every(
643
+ ([key2, value]) => value === !!combo[key2]
644
+ );
645
+ if (conditionMet) {
646
+ const handled = cb(e);
647
+ if (handled !== false) {
648
+ e.preventDefault();
649
+ }
650
+ }
651
+ });
652
+ if (key !== "meta" && key !== "ctrl" && key !== "shift") {
653
+ useHotkeyStore.getState().release(key);
654
+ }
655
+ }
656
+ };
657
+ const onKeyUp = (e) => {
658
+ if (!e.getModifierState("AltGraph") && e.code === "ControlRight") {
659
+ useHotkeyStore.getState().release("altRight");
660
+ return;
661
+ }
662
+ const key = keyCodeMap[e.code];
663
+ if (key) {
664
+ if (key === "meta") {
665
+ useHotkeyStore.getState().reset();
666
+ } else {
667
+ useHotkeyStore.getState().release(key);
668
+ }
669
+ }
670
+ };
671
+ const onVisibilityChanged = (e) => {
672
+ if (document.visibilityState === "hidden") {
673
+ useHotkeyStore.getState().reset();
674
+ }
675
+ };
676
+ const onBlur = () => {
677
+ useHotkeyStore.getState().reset();
678
+ };
679
+ window.addEventListener("blur", onBlur);
680
+ doc.addEventListener("keydown", onKeyDown);
681
+ doc.addEventListener("keyup", onKeyUp);
682
+ doc.addEventListener("visibilitychange", onVisibilityChanged);
683
+ return () => {
684
+ doc.removeEventListener("keydown", onKeyDown);
685
+ doc.removeEventListener("keyup", onKeyUp);
686
+ doc.removeEventListener("visibilitychange", onVisibilityChanged);
687
+ window.removeEventListener("blur", onBlur);
688
+ };
689
+ };
690
+ var useMonitorHotkeys = () => {
691
+ useEffect(() => monitorHotkeys(document), []);
692
+ };
693
+ var useHotkey = (combo, cb) => {
694
+ useEffect(
695
+ () => useHotkeyStore.setState((s) => ({
696
+ triggers: __spreadProps(__spreadValues({}, s.triggers), {
697
+ [`${Object.keys(combo).join("+")}`]: { combo, cb }
698
+ })
699
+ })),
700
+ []
701
+ );
702
+ };
703
+
704
+ // store/slices/history.ts
705
+ var EMPTY_HISTORY_INDEX = 0;
706
+ function debounce(func, timeout = 300) {
707
+ let timer;
708
+ return (...args) => {
709
+ clearTimeout(timer);
710
+ timer = setTimeout(() => {
711
+ func(...args);
712
+ }, timeout);
713
+ };
714
+ }
715
+ var tidyState = (state) => {
716
+ return __spreadProps(__spreadValues({}, state), {
717
+ ui: __spreadProps(__spreadValues({}, state.ui), {
718
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
719
+ focus: null
720
+ })
721
+ })
722
+ });
723
+ };
724
+ var createHistorySlice = (set, get) => {
725
+ const record = debounce((state) => {
726
+ const { histories, index } = get().history;
727
+ const history = {
728
+ state,
729
+ id: generateId("history")
730
+ };
731
+ const newHistories = [...histories.slice(0, index + 1), history];
732
+ set({
733
+ history: __spreadProps(__spreadValues({}, get().history), {
734
+ histories: newHistories,
735
+ index: newHistories.length - 1
736
+ })
737
+ });
738
+ }, 250);
739
+ return {
740
+ initialAppState: {},
741
+ index: EMPTY_HISTORY_INDEX,
742
+ histories: [],
743
+ hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
744
+ hasFuture: () => get().history.index < get().history.histories.length - 1,
745
+ prevHistory: () => {
746
+ const { history } = get();
747
+ return history.hasPast() ? history.histories[history.index - 1] : null;
748
+ },
749
+ nextHistory: () => {
750
+ const s = get().history;
751
+ return s.hasFuture() ? s.histories[s.index + 1] : null;
752
+ },
753
+ currentHistory: () => get().history.histories[get().history.index],
754
+ back: () => {
755
+ var _a;
756
+ const { history, dispatch } = get();
757
+ if (history.hasPast()) {
758
+ const state = tidyState(
759
+ ((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
760
+ );
761
+ dispatch({
762
+ type: "set",
763
+ state
764
+ });
765
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
766
+ }
767
+ },
768
+ forward: () => {
769
+ var _a;
770
+ const { history, dispatch } = get();
771
+ if (history.hasFuture()) {
772
+ const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
773
+ dispatch({ type: "set", state: state ? tidyState(state) : {} });
774
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
775
+ }
776
+ },
777
+ setHistories: (histories) => {
778
+ var _a;
779
+ const { dispatch, history } = get();
780
+ dispatch({
781
+ type: "set",
782
+ state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
783
+ });
784
+ set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
785
+ },
786
+ setHistoryIndex: (index) => {
787
+ var _a;
788
+ const { dispatch, history } = get();
789
+ dispatch({
790
+ type: "set",
791
+ state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
792
+ });
793
+ set({ history: __spreadProps(__spreadValues({}, history), { index }) });
794
+ },
795
+ record
796
+ };
797
+ };
798
+ function useRegisterHistorySlice(appStore, {
799
+ histories,
800
+ index,
801
+ initialAppState
802
+ }) {
803
+ useEffect2(
804
+ () => appStore.setState({
805
+ history: __spreadProps(__spreadValues({}, appStore.getState().history), {
806
+ histories,
807
+ index,
808
+ initialAppState
809
+ })
810
+ }),
811
+ [histories, index, initialAppState]
812
+ );
813
+ const back = () => {
814
+ appStore.getState().history.back();
815
+ };
816
+ const forward = () => {
817
+ appStore.getState().history.forward();
818
+ };
819
+ useHotkey({ altRight: false, meta: true, z: true }, back);
820
+ useHotkey({ altRight: false, meta: true, shift: true, z: true }, forward);
821
+ useHotkey({ altRight: false, meta: true, y: true }, forward);
822
+ useHotkey({ altRight: false, ctrl: true, z: true }, back);
823
+ useHotkey({ altRight: false, ctrl: true, shift: true, z: true }, forward);
824
+ useHotkey({ altRight: false, ctrl: true, y: true }, forward);
825
+ }
826
+
827
+ // store/slices/nodes.ts
828
+ init_react_import();
829
+ var createNodesSlice = (_set, _get) => {
830
+ const registry = /* @__PURE__ */ new Map();
831
+ return {
832
+ registerNode: (id, handle) => {
833
+ registry.set(id, handle);
834
+ },
835
+ unregisterNode: (id) => {
836
+ registry.delete(id);
837
+ },
838
+ syncNode: (id) => {
839
+ var _a;
840
+ if (!id) return;
841
+ (_a = registry.get(id)) == null ? void 0 : _a.sync();
842
+ },
843
+ syncNodes: (ids) => {
844
+ ids.forEach((id) => {
845
+ var _a;
846
+ if (!id) return;
847
+ (_a = registry.get(id)) == null ? void 0 : _a.sync();
848
+ });
849
+ },
850
+ setOverlayVisible: (id, visible) => {
851
+ if (!id) return;
852
+ const node = registry.get(id);
853
+ if (!node) return;
854
+ if (visible) {
855
+ node.showOverlay();
856
+ return;
857
+ }
858
+ node.hideOverlay();
859
+ }
860
+ };
861
+ };
862
+
863
+ // store/slices/permissions.ts
864
+ init_react_import();
865
+ import { useEffect as useEffect3 } from "react";
866
+
867
+ // lib/data/flatten-data.ts
868
+ init_react_import();
869
+ var flattenData = (state, config) => {
870
+ const data = [];
871
+ walkAppState(
872
+ state,
873
+ config,
874
+ (content) => content,
875
+ (item) => {
876
+ data.push(item);
877
+ return item;
878
+ }
879
+ );
880
+ return data;
881
+ };
882
+
883
+ // store/slices/permissions.ts
884
+ var createPermissionsSlice = (set, get) => {
885
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
886
+ const { state, permissions, config } = get();
887
+ const { cache, globalPermissions } = permissions;
888
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
889
+ var _a, _b;
890
+ const { config: config2, state: appState, setComponentLoading } = get();
891
+ const itemCache = cache[item2.props.id];
892
+ const nodes = appState.indexes.nodes;
893
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
894
+ const parentNode = parentId ? nodes[parentId] : null;
895
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
896
+ const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
897
+ if (!componentConfig) {
898
+ return;
899
+ }
900
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
901
+ if (componentConfig.resolvePermissions) {
902
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
903
+ const propsChanged = Object.values(changed).some((el) => el === true);
904
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
905
+ if (propsChanged || parentChanged || force2) {
906
+ const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
907
+ const resolvedPermissions = yield componentConfig.resolvePermissions(
908
+ item2,
909
+ {
910
+ changed,
911
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
912
+ permissions: initialPermissions,
913
+ appState: makeStatePublic(appState),
914
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
915
+ parent: parentData
916
+ }
917
+ );
918
+ const latest = get().permissions;
919
+ set({
920
+ permissions: __spreadProps(__spreadValues({}, latest), {
921
+ cache: __spreadProps(__spreadValues({}, latest.cache), {
922
+ [item2.props.id]: {
923
+ lastParentId: parentId,
924
+ lastData: item2,
925
+ lastPermissions: resolvedPermissions
926
+ }
927
+ }),
928
+ resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
929
+ [item2.props.id]: resolvedPermissions
930
+ })
931
+ })
932
+ });
933
+ clearTimeout2();
934
+ }
935
+ }
936
+ });
937
+ const resolvePermissionsForRoot = (force2 = false) => {
938
+ const { state: appState } = get();
939
+ resolvePermissionsForItem(
940
+ // Shim the root data in by conforming to component data shape
941
+ {
942
+ type: "root",
943
+ props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "root" })
944
+ },
945
+ force2
946
+ );
947
+ };
948
+ const { item, type, root } = params;
949
+ if (item) {
950
+ yield resolvePermissionsForItem(item, force);
951
+ } else if (type) {
952
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
953
+ yield resolvePermissionsForItem(item2, force);
954
+ }));
955
+ } else if (root) {
956
+ resolvePermissionsForRoot(force);
957
+ } else {
958
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
959
+ yield resolvePermissionsForItem(item2, force);
960
+ }));
961
+ }
962
+ });
963
+ const refreshPermissions = (params) => resolvePermissions(params, true);
964
+ return {
965
+ cache: {},
966
+ globalPermissions: {
967
+ drag: true,
968
+ edit: true,
969
+ delete: true,
970
+ duplicate: true,
971
+ insert: true
972
+ },
973
+ resolvedPermissions: {},
974
+ getPermissions: ({ item, type, root } = {}) => {
975
+ const { config, permissions } = get();
976
+ const { globalPermissions, resolvedPermissions } = permissions;
977
+ if (item) {
978
+ const componentConfig = config.components[item.type];
979
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
980
+ const resolvedForItem = resolvedPermissions[item.props.id];
981
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
982
+ } else if (type) {
983
+ const componentConfig = config.components[type];
984
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
985
+ } else if (root) {
986
+ const rootConfig = config.root;
987
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
988
+ const resolvedForItem = resolvedPermissions["root"];
989
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
990
+ }
991
+ return globalPermissions;
992
+ },
993
+ resolvePermissions,
994
+ refreshPermissions
995
+ };
996
+ };
997
+ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
998
+ useEffect3(() => {
999
+ const { permissions } = appStore.getState();
1000
+ const { globalPermissions: existingGlobalPermissions } = permissions;
1001
+ appStore.setState({
1002
+ permissions: __spreadProps(__spreadValues({}, permissions), {
1003
+ globalPermissions: __spreadValues(__spreadValues({}, existingGlobalPermissions), globalPermissions)
1004
+ })
1005
+ });
1006
+ permissions.resolvePermissions();
1007
+ }, [globalPermissions]);
1008
+ useEffect3(() => {
1009
+ return appStore.subscribe(
1010
+ (s) => s.state.data,
1011
+ () => {
1012
+ appStore.getState().permissions.resolvePermissions();
1013
+ }
1014
+ );
1015
+ }, []);
1016
+ useEffect3(() => {
1017
+ return appStore.subscribe(
1018
+ (s) => s.config,
1019
+ () => {
1020
+ appStore.getState().permissions.resolvePermissions();
1021
+ }
1022
+ );
1023
+ }, []);
1024
+ };
1025
+
1026
+ // store/slices/fields.ts
1027
+ init_react_import();
1028
+ import { useCallback, useEffect as useEffect4 } from "react";
1029
+ var createFieldsSlice = (_set, _get) => {
1030
+ return {
1031
+ fields: {},
1032
+ loading: false,
1033
+ lastResolvedData: {},
1034
+ id: void 0
1035
+ };
1036
+ };
1037
+ var useRegisterFieldsSlice = (appStore, id) => {
1038
+ const resolveFields = useCallback(
1039
+ (reset) => __async(null, null, function* () {
1040
+ var _a, _b;
1041
+ const { fields, lastResolvedData } = appStore.getState().fields;
1042
+ const metadata = appStore.getState().metadata;
1043
+ const nodes = appStore.getState().state.indexes.nodes;
1044
+ const node = nodes[id || "root"];
1045
+ const componentData = node == null ? void 0 : node.data;
1046
+ const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node.parentId] : null;
1047
+ const parent = (parentNode == null ? void 0 : parentNode.data) || null;
1048
+ const { getComponentConfig, state } = appStore.getState();
1049
+ const componentConfig = getComponentConfig(componentData == null ? void 0 : componentData.type);
1050
+ if (!componentData || !componentConfig) return;
1051
+ const defaultFields = componentConfig.fields || {};
1052
+ const resolver = componentConfig.resolveFields;
1053
+ let lastFields = fields;
1054
+ if (reset) {
1055
+ appStore.setState((s) => ({
1056
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1057
+ }));
1058
+ lastFields = defaultFields;
1059
+ }
1060
+ if (resolver) {
1061
+ const timeout = setTimeout(() => {
1062
+ appStore.setState((s) => ({
1063
+ fields: __spreadProps(__spreadValues({}, s.fields), { loading: true })
1064
+ }));
1065
+ }, 50);
1066
+ const lastData = ((_a = lastResolvedData.props) == null ? void 0 : _a.id) === id ? lastResolvedData : null;
1067
+ const changed = getChanged(componentData, lastData);
1068
+ const newFields = yield resolver(componentData, {
1069
+ changed,
1070
+ fields: defaultFields,
1071
+ lastFields,
1072
+ metadata: __spreadValues(__spreadValues({}, metadata), componentConfig.metadata),
1073
+ lastData,
1074
+ appState: makeStatePublic(state),
1075
+ parent
1076
+ });
1077
+ clearTimeout(timeout);
1078
+ if (((_b = appStore.getState().selectedItem) == null ? void 0 : _b.props.id) !== id) {
1079
+ return;
1080
+ }
1081
+ appStore.setState({
1082
+ fields: {
1083
+ fields: newFields,
1084
+ loading: false,
1085
+ lastResolvedData: componentData,
1086
+ id
1087
+ }
1088
+ });
1089
+ } else {
1090
+ appStore.setState((s) => ({
1091
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1092
+ }));
1093
+ }
1094
+ }),
1095
+ [id]
1096
+ );
1097
+ useEffect4(() => {
1098
+ resolveFields(true);
1099
+ return appStore.subscribe(
1100
+ (s) => s.state.indexes.nodes[id || "root"],
1101
+ () => resolveFields()
1102
+ );
1103
+ }, [id]);
1104
+ };
1105
+
1106
+ // lib/data/to-root.ts
1107
+ init_react_import();
1108
+ var toRoot = (item) => {
1109
+ if ("type" in item && item.type !== "root") {
1110
+ throw new Error("Converting non-root item to root.");
1111
+ }
1112
+ const { readOnly } = item;
1113
+ if (item.props) {
1114
+ if ("id" in item.props) {
1115
+ const _a = item.props, { id } = _a, props = __objRest(_a, ["id"]);
1116
+ return { props, readOnly };
1117
+ }
1118
+ return { props: item.props, readOnly };
1119
+ }
1120
+ return { props: {}, readOnly };
1121
+ };
1122
+
1123
+ // store/index.ts
1124
+ var defaultPageFields = {
1125
+ title: { type: "text" }
1126
+ };
1127
+ var createAppStore = (initialAppStore) => create2()(
1128
+ subscribeWithSelector2((set, get) => {
1129
+ var _a, _b;
1130
+ return __spreadProps(__spreadValues({
1131
+ instanceId: generateId(),
1132
+ state: defaultAppState,
1133
+ config: { components: {} },
1134
+ componentState: {},
1135
+ plugins: [],
1136
+ overrides: {},
1137
+ viewports: defaultViewports,
1138
+ zoomConfig: {
1139
+ autoZoom: 1,
1140
+ rootHeight: 0,
1141
+ zoom: 1
1142
+ },
1143
+ status: "LOADING",
1144
+ iframe: {},
1145
+ fullScreenCanvas: false,
1146
+ _experimentalVirtualization: false,
1147
+ metadata: {},
1148
+ fieldTransforms: {}
1149
+ }, initialAppStore), {
1150
+ fields: createFieldsSlice(set, get),
1151
+ history: createHistorySlice(set, get),
1152
+ nodes: createNodesSlice(set, get),
1153
+ permissions: createPermissionsSlice(set, get),
1154
+ getCurrentData: () => {
1155
+ var _a2;
1156
+ const s = get();
1157
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
1158
+ },
1159
+ getComponentConfig: (type) => {
1160
+ var _a2;
1161
+ const { config, selectedItem } = get();
1162
+ const rootFields = ((_a2 = config.root) == null ? void 0 : _a2.fields) || defaultPageFields;
1163
+ return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
1164
+ },
1165
+ selectedItem: ((_a = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _a.ui.itemSelector) ? getItem(
1166
+ (_b = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _b.ui.itemSelector,
1167
+ initialAppStore.state
1168
+ ) : null,
1169
+ dispatch: (action) => set((s) => {
1170
+ var _a2, _b2;
1171
+ const { record } = get().history;
1172
+ const dispatch = createReducer({
1173
+ record,
1174
+ appStore: s
1175
+ });
1176
+ const state = dispatch(s.state, action);
1177
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1178
+ (_b2 = (_a2 = get()).onAction) == null ? void 0 : _b2.call(_a2, action, state, get().state);
1179
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1180
+ }),
1181
+ setZoomConfig: (zoomConfig) => set({ zoomConfig }),
1182
+ setStatus: (status) => set({ status }),
1183
+ setComponentState: (componentState) => set({ componentState }),
1184
+ pendingLoadTimeouts: {},
1185
+ setComponentLoading: (id, loading = true, defer = 0) => {
1186
+ const { setComponentState, pendingLoadTimeouts } = get();
1187
+ const loadId = generateId();
1188
+ const setLoading = () => {
1189
+ var _a2;
1190
+ const { componentState } = get();
1191
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1192
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1193
+ loadingCount: (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) + 1
1194
+ })
1195
+ }));
1196
+ };
1197
+ const unsetLoading = () => {
1198
+ var _a2;
1199
+ const { componentState } = get();
1200
+ clearTimeout(timeout);
1201
+ delete pendingLoadTimeouts[loadId];
1202
+ set({ pendingLoadTimeouts });
1203
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1204
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1205
+ loadingCount: Math.max(
1206
+ (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) - 1,
1207
+ 0
1208
+ )
1209
+ })
1210
+ }));
1211
+ };
1212
+ const timeout = setTimeout(() => {
1213
+ if (loading) {
1214
+ setLoading();
1215
+ } else {
1216
+ unsetLoading();
1217
+ }
1218
+ delete pendingLoadTimeouts[loadId];
1219
+ set({ pendingLoadTimeouts });
1220
+ }, defer);
1221
+ set({
1222
+ pendingLoadTimeouts: __spreadProps(__spreadValues({}, pendingLoadTimeouts), {
1223
+ [id]: timeout
1224
+ })
1225
+ });
1226
+ return unsetLoading;
1227
+ },
1228
+ unsetComponentLoading: (id) => {
1229
+ const { setComponentLoading } = get();
1230
+ setComponentLoading(id, false);
1231
+ },
1232
+ // Helper
1233
+ setUi: (ui, recordHistory) => set((s) => {
1234
+ const dispatch = createReducer({
1235
+ record: () => {
1236
+ },
1237
+ appStore: s
1238
+ });
1239
+ const state = dispatch(s.state, {
1240
+ type: "setUi",
1241
+ ui,
1242
+ recordHistory
1243
+ });
1244
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1245
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1246
+ }),
1247
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
1248
+ var _a2, _b2;
1249
+ const { config, metadata, setComponentLoading, permissions, state } = get();
1250
+ const componentId = "id" in componentData.props ? componentData.props.id : "root";
1251
+ const parentId = (_a2 = state.indexes.nodes[componentId]) == null ? void 0 : _a2.parentId;
1252
+ const parentNode = parentId ? state.indexes.nodes[parentId] : null;
1253
+ const parentData = (_b2 = parentNode == null ? void 0 : parentNode.data) != null ? _b2 : null;
1254
+ const timeouts = {};
1255
+ return yield resolveComponentData(
1256
+ componentData,
1257
+ config,
1258
+ metadata,
1259
+ (item) => {
1260
+ const id = "id" in item.props ? item.props.id : "root";
1261
+ timeouts[id] = setComponentLoading(id, true, 50);
1262
+ },
1263
+ (item) => __async(null, null, function* () {
1264
+ const id = "id" in item.props ? item.props.id : "root";
1265
+ if ("type" in item) {
1266
+ yield permissions.refreshPermissions({ item });
1267
+ } else {
1268
+ yield permissions.refreshPermissions({ root: true });
1269
+ }
1270
+ timeouts[id]();
1271
+ }),
1272
+ trigger,
1273
+ parentData
1274
+ );
1275
+ }),
1276
+ resolveAndCommitData: () => __async(null, null, function* () {
1277
+ const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1278
+ walkAppState(
1279
+ state,
1280
+ config,
1281
+ (content) => content,
1282
+ (childItem, path) => {
1283
+ if (path.length > 1) return childItem;
1284
+ resolveComponentData2(childItem, "load").then((resolved) => {
1285
+ const { state: state2 } = get();
1286
+ const node = state2.indexes.nodes[resolved.node.props.id];
1287
+ if (node && resolved.didChange) {
1288
+ if (resolved.node.props.id === "root") {
1289
+ dispatch({
1290
+ type: "replaceRoot",
1291
+ root: toRoot(resolved.node)
1292
+ });
1293
+ } else {
1294
+ const zoneCompound = `${node.parentId}:${node.zone}`;
1295
+ const parentZone = state2.indexes.zones[zoneCompound];
1296
+ const index = parentZone.contentIds.indexOf(
1297
+ resolved.node.props.id
1298
+ );
1299
+ dispatch({
1300
+ type: "replace",
1301
+ data: resolved.node,
1302
+ destinationIndex: index,
1303
+ destinationZone: zoneCompound
1304
+ });
1305
+ }
1306
+ }
1307
+ });
1308
+ return childItem;
1309
+ }
1310
+ );
1311
+ })
1312
+ });
1313
+ })
1314
+ );
1315
+ var appStoreContext = createContext(createAppStore());
1316
+ function useAppStore(selector) {
1317
+ const context = useContext(appStoreContext);
1318
+ return useStore(context, selector);
1319
+ }
1320
+ function useAppStoreApi() {
1321
+ return useContext(appStoreContext);
1322
+ }
1323
+
1324
+ // components/RichTextMenu/lib/use-control-context.ts
1325
+ init_react_import();
1326
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1327
+ var ControlContext = createContext2({});
1328
+ var useControlContext = () => {
1329
+ return useContext2(ControlContext);
1330
+ };
1331
+
1332
+ // components/RichTextMenu/components/SelectControl/index.tsx
1333
+ init_react_import();
1334
+ import { useMemo } from "react";
1335
+
1336
+ // components/Select/index.tsx
1337
+ init_react_import();
1338
+
1339
+ // css-module:/Users/rami/Documents/apps/frontend-react-editor/packages/core/components/Select/styles.module.css#css-module
1340
+ init_react_import();
1341
+ var styles_module_default = { "Select": "_Select_6nen1_1", "Select-button": "_Select-button_6nen1_6", "Select--hasOptions": "_Select--hasOptions_6nen1_21", "Select--disabled": "_Select--disabled_6nen1_25", "Select-buttonIcon": "_Select-buttonIcon_6nen1_29", "Select--standalone": "_Select--standalone_6nen1_35", "Select--actionBar": "_Select--actionBar_6nen1_40", "Select--hasValue": "_Select--hasValue_6nen1_46", "Select-items": "_Select-items_6nen1_63", "SelectItem": "_SelectItem_6nen1_75", "SelectItem--isSelected": "_SelectItem--isSelected_6nen1_92", "SelectItem-icon": "_SelectItem-icon_6nen1_98" };
1342
+
1343
+ // components/Select/index.tsx
1344
+ import { useState } from "react";
1345
+ import {
1346
+ Popover,
1347
+ PopoverContent,
1348
+ PopoverPortal,
1349
+ PopoverTrigger
1350
+ } from "@radix-ui/react-popover";
1351
+
1352
+ // lib/index.ts
1353
+ init_react_import();
1354
+
1355
+ // lib/filter.ts
1356
+ init_react_import();
1357
+
1358
+ // lib/data/reorder.ts
1359
+ init_react_import();
1360
+ var reorder = (list, startIndex, endIndex) => {
1361
+ const result = Array.from(list);
1362
+ const [removed] = result.splice(startIndex, 1);
1363
+ result.splice(endIndex, 0, removed);
1364
+ return result;
1365
+ };
1366
+
1367
+ // lib/data/replace.ts
1368
+ init_react_import();
1369
+ var replace = (list, index, newItem) => {
1370
+ const result = Array.from(list);
1371
+ result.splice(index, 1);
1372
+ result.splice(index, 0, newItem);
1373
+ return result;
1374
+ };
1375
+
1376
+ // lib/use-reset-auto-zoom.ts
1377
+ init_react_import();
1378
+
1379
+ // lib/get-zoom-config.ts
1380
+ init_react_import();
1381
+
1382
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1383
+ init_react_import();
1384
+
1385
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1386
+ init_react_import();
1387
+ var isProduction = process.env.NODE_ENV === "production";
1388
+ var prefix = "Invariant failed";
1389
+ function invariant(condition, message) {
1390
+ if (condition) {
1391
+ return;
1392
+ }
1393
+ if (isProduction) {
1394
+ throw new Error(prefix);
1395
+ }
1396
+ var provided = typeof message === "function" ? message() : message;
1397
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1398
+ throw new Error(value);
1399
+ }
1400
+
1401
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1402
+ var getRect = function getRect2(_ref) {
1403
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1404
+ var width = right - left;
1405
+ var height = bottom - top;
1406
+ var rect = {
1407
+ top,
1408
+ right,
1409
+ bottom,
1410
+ left,
1411
+ width,
1412
+ height,
1413
+ x: left,
1414
+ y: top,
1415
+ center: {
1416
+ x: (right + left) / 2,
1417
+ y: (bottom + top) / 2
1418
+ }
1419
+ };
1420
+ return rect;
1421
+ };
1422
+ var expand = function expand2(target, expandBy) {
1423
+ return {
1424
+ top: target.top - expandBy.top,
1425
+ left: target.left - expandBy.left,
1426
+ bottom: target.bottom + expandBy.bottom,
1427
+ right: target.right + expandBy.right
1428
+ };
1429
+ };
1430
+ var shrink = function shrink2(target, shrinkBy) {
1431
+ return {
1432
+ top: target.top + shrinkBy.top,
1433
+ left: target.left + shrinkBy.left,
1434
+ bottom: target.bottom - shrinkBy.bottom,
1435
+ right: target.right - shrinkBy.right
1436
+ };
1437
+ };
1438
+ var noSpacing = {
1439
+ top: 0,
1440
+ right: 0,
1441
+ bottom: 0,
1442
+ left: 0
1443
+ };
1444
+ var createBox = function createBox2(_ref2) {
1445
+ var borderBox = _ref2.borderBox, _ref2$margin = _ref2.margin, margin = _ref2$margin === void 0 ? noSpacing : _ref2$margin, _ref2$border = _ref2.border, border = _ref2$border === void 0 ? noSpacing : _ref2$border, _ref2$padding = _ref2.padding, padding = _ref2$padding === void 0 ? noSpacing : _ref2$padding;
1446
+ var marginBox = getRect(expand(borderBox, margin));
1447
+ var paddingBox = getRect(shrink(borderBox, border));
1448
+ var contentBox = getRect(shrink(paddingBox, padding));
1449
+ return {
1450
+ marginBox,
1451
+ borderBox: getRect(borderBox),
1452
+ paddingBox,
1453
+ contentBox,
1454
+ margin,
1455
+ border,
1456
+ padding
1457
+ };
1458
+ };
1459
+ var parse = function parse2(raw) {
1460
+ var value = raw.slice(0, -2);
1461
+ var suffix = raw.slice(-2);
1462
+ if (suffix !== "px") {
1463
+ return 0;
1464
+ }
1465
+ var result = Number(value);
1466
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1467
+ return result;
1468
+ };
1469
+ var calculateBox = function calculateBox2(borderBox, styles) {
1470
+ var margin = {
1471
+ top: parse(styles.marginTop),
1472
+ right: parse(styles.marginRight),
1473
+ bottom: parse(styles.marginBottom),
1474
+ left: parse(styles.marginLeft)
1475
+ };
1476
+ var padding = {
1477
+ top: parse(styles.paddingTop),
1478
+ right: parse(styles.paddingRight),
1479
+ bottom: parse(styles.paddingBottom),
1480
+ left: parse(styles.paddingLeft)
1481
+ };
1482
+ var border = {
1483
+ top: parse(styles.borderTopWidth),
1484
+ right: parse(styles.borderRightWidth),
1485
+ bottom: parse(styles.borderBottomWidth),
1486
+ left: parse(styles.borderLeftWidth)
1487
+ };
1488
+ return createBox({
1489
+ borderBox,
1490
+ margin,
1491
+ padding,
1492
+ border
1493
+ });
1494
+ };
1495
+ var getBox = function getBox2(el) {
1496
+ var borderBox = el.getBoundingClientRect();
1497
+ var styles = window.getComputedStyle(el);
1498
+ return calculateBox(borderBox, styles);
1499
+ };
1500
+
1501
+ // components/Select/index.tsx
1502
+ import { jsx, jsxs } from "react/jsx-runtime";
1503
+ var getClassName = get_class_name_factory_default("Select", styles_module_default);
1504
+ var getItemClassName = get_class_name_factory_default("SelectItem", styles_module_default);
1505
+ var Item = ({
1506
+ children,
1507
+ isSelected,
1508
+ onClick
1509
+ }) => {
1510
+ return /* @__PURE__ */ jsx("button", { className: getItemClassName({ isSelected }), onClick, children });
1511
+ };
1512
+ var Select = ({
1513
+ children,
1514
+ options,
1515
+ onChange,
1516
+ value,
1517
+ defaultValue,
1518
+ mode,
1519
+ disabled = false
1520
+ }) => {
1521
+ const [open, setOpen] = useState(false);
1522
+ const hasOptions = options.length > 0;
1523
+ const isDisabled = disabled || !hasOptions;
1524
+ return /* @__PURE__ */ jsx(
1525
+ "div",
1526
+ {
1527
+ className: getClassName({
1528
+ hasValue: value !== defaultValue,
1529
+ hasOptions,
1530
+ actionBar: mode === "actionBar",
1531
+ standalone: mode === "standalone",
1532
+ disabled: isDisabled
1533
+ }),
1534
+ children: /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
1535
+ hasOptions ? /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("button", { className: getClassName("button"), children: [
1536
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1537
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1538
+ ] }) }) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: getClassName("button"), children: [
1539
+ /* @__PURE__ */ jsx("span", { className: getClassName("buttonIcon"), children }),
1540
+ /* @__PURE__ */ jsx(ChevronDown, { size: 12 })
1541
+ ] }) }),
1542
+ options.length > 0 && /* @__PURE__ */ jsx(PopoverPortal, { children: /* @__PURE__ */ jsx(PopoverContent, { align: "start", children: /* @__PURE__ */ jsx("ul", { className: getClassName("items"), "data-editor-rte-menu": true, children: options.map((option) => {
1543
+ const Icon2 = option.icon;
1544
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
1545
+ Item,
1546
+ {
1547
+ isSelected: value === option.value,
1548
+ onClick: () => {
1549
+ onChange(option.value);
1550
+ setOpen(false);
1551
+ },
1552
+ children: [
1553
+ Icon2 && /* @__PURE__ */ jsx("div", { className: getItemClassName("icon"), children: /* @__PURE__ */ jsx(Icon2, { size: 16 }) }),
1554
+ option.label
1555
+ ]
1556
+ }
1557
+ ) }, option.value);
1558
+ }) }) }) })
1559
+ ] })
1560
+ }
1561
+ );
1562
+ };
1563
+
1564
+ // components/RichTextMenu/components/SelectControl/index.tsx
1565
+ import { jsx as jsx2 } from "react/jsx-runtime";
1566
+ function SelectControl({
1567
+ renderDefaultIcon,
1568
+ onChange,
1569
+ options,
1570
+ value,
1571
+ defaultValue
1572
+ }) {
1573
+ var _a, _b;
1574
+ const { inline, readOnly } = useControlContext();
1575
+ const optionsByValue = useMemo(
1576
+ () => options.reduce(
1577
+ (acc, option) => __spreadProps(__spreadValues({}, acc), { [option.value]: option }),
1578
+ {}
1579
+ ),
1580
+ [options]
1581
+ );
1582
+ const Node = (_b = value && ((_a = optionsByValue[value]) == null ? void 0 : _a.icon)) != null ? _b : renderDefaultIcon;
1583
+ return /* @__PURE__ */ jsx2(
1584
+ Select,
1585
+ {
1586
+ options,
1587
+ onChange,
1588
+ value,
1589
+ defaultValue,
1590
+ mode: inline ? "actionBar" : "standalone",
1591
+ disabled: readOnly,
1592
+ children: /* @__PURE__ */ jsx2(Node, {})
1593
+ }
1594
+ );
1595
+ }
1596
+
1597
+ export {
1598
+ AlignCenter,
1599
+ AlignJustify,
1600
+ AlignLeft,
1601
+ AlignRight,
1602
+ Bold,
1603
+ Check,
1604
+ ChevronDown,
1605
+ ChevronRight,
1606
+ ChevronUp,
1607
+ Code,
1608
+ Component,
1609
+ Copy,
1610
+ CornerLeftUp,
1611
+ Globe,
1612
+ GripVertical,
1613
+ Heading1,
1614
+ Heading2,
1615
+ Heading3,
1616
+ Heading4,
1617
+ Heading5,
1618
+ Heading6,
1619
+ Heading,
1620
+ Italic,
1621
+ Layers,
1622
+ Link,
1623
+ ListOrdered,
1624
+ List,
1625
+ Lock,
1626
+ Maximize,
1627
+ Minimize,
1628
+ Minus,
1629
+ Monitor,
1630
+ Moon,
1631
+ Plus,
1632
+ Quote,
1633
+ RectangleEllipsis,
1634
+ Redo2,
1635
+ Search,
1636
+ SlidersHorizontal,
1637
+ Smartphone,
1638
+ SquareCode,
1639
+ Strikethrough,
1640
+ Sun,
1641
+ ToyBrick,
1642
+ Trash,
1643
+ Underline,
1644
+ Undo2,
1645
+ Unlink2,
1646
+ X,
1647
+ reorder,
1648
+ replace,
1649
+ monitorHotkeys,
1650
+ useMonitorHotkeys,
1651
+ useHotkey,
1652
+ useRegisterHistorySlice,
1653
+ useRegisterPermissionsSlice,
1654
+ useRegisterFieldsSlice,
1655
+ createAppStore,
1656
+ appStoreContext,
1657
+ useAppStore,
1658
+ useAppStoreApi,
1659
+ getBox,
1660
+ ControlContext,
1661
+ useControlContext,
1662
+ SelectControl
1663
+ };
1664
+ /*! Bundled license information:
1665
+
1666
+ lucide-react/dist/esm/shared/src/utils.js:
1667
+ lucide-react/dist/esm/defaultAttributes.js:
1668
+ lucide-react/dist/esm/Icon.js:
1669
+ lucide-react/dist/esm/createLucideIcon.js:
1670
+ lucide-react/dist/esm/icons/align-left.js:
1671
+ lucide-react/dist/esm/icons/heading.js:
1672
+ lucide-react/dist/esm/icons/list.js:
1673
+ lucide-react/dist/esm/icons/align-center.js:
1674
+ lucide-react/dist/esm/icons/align-justify.js:
1675
+ lucide-react/dist/esm/icons/align-right.js:
1676
+ lucide-react/dist/esm/icons/bold.js:
1677
+ lucide-react/dist/esm/icons/check.js:
1678
+ lucide-react/dist/esm/icons/chevron-down.js:
1679
+ lucide-react/dist/esm/icons/chevron-right.js:
1680
+ lucide-react/dist/esm/icons/chevron-up.js:
1681
+ lucide-react/dist/esm/icons/code.js:
1682
+ lucide-react/dist/esm/icons/component.js:
1683
+ lucide-react/dist/esm/icons/copy.js:
1684
+ lucide-react/dist/esm/icons/corner-left-up.js:
1685
+ lucide-react/dist/esm/icons/globe.js:
1686
+ lucide-react/dist/esm/icons/grip-vertical.js:
1687
+ lucide-react/dist/esm/icons/heading-1.js:
1688
+ lucide-react/dist/esm/icons/heading-2.js:
1689
+ lucide-react/dist/esm/icons/heading-3.js:
1690
+ lucide-react/dist/esm/icons/heading-4.js:
1691
+ lucide-react/dist/esm/icons/heading-5.js:
1692
+ lucide-react/dist/esm/icons/heading-6.js:
1693
+ lucide-react/dist/esm/icons/italic.js:
1694
+ lucide-react/dist/esm/icons/layers.js:
1695
+ lucide-react/dist/esm/icons/link.js:
1696
+ lucide-react/dist/esm/icons/list-ordered.js:
1697
+ lucide-react/dist/esm/icons/lock.js:
1698
+ lucide-react/dist/esm/icons/maximize.js:
1699
+ lucide-react/dist/esm/icons/minimize.js:
1700
+ lucide-react/dist/esm/icons/minus.js:
1701
+ lucide-react/dist/esm/icons/monitor.js:
1702
+ lucide-react/dist/esm/icons/moon.js:
1703
+ lucide-react/dist/esm/icons/plus.js:
1704
+ lucide-react/dist/esm/icons/quote.js:
1705
+ lucide-react/dist/esm/icons/rectangle-ellipsis.js:
1706
+ lucide-react/dist/esm/icons/redo-2.js:
1707
+ lucide-react/dist/esm/icons/search.js:
1708
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
1709
+ lucide-react/dist/esm/icons/smartphone.js:
1710
+ lucide-react/dist/esm/icons/square-code.js:
1711
+ lucide-react/dist/esm/icons/strikethrough.js:
1712
+ lucide-react/dist/esm/icons/sun.js:
1713
+ lucide-react/dist/esm/icons/toy-brick.js:
1714
+ lucide-react/dist/esm/icons/trash.js:
1715
+ lucide-react/dist/esm/icons/underline.js:
1716
+ lucide-react/dist/esm/icons/undo-2.js:
1717
+ lucide-react/dist/esm/icons/unlink-2.js:
1718
+ lucide-react/dist/esm/icons/x.js:
1719
+ lucide-react/dist/esm/lucide-react.js:
1720
+ (**
1721
+ * @license lucide-react v0.468.0 - ISC
1722
+ *
1723
+ * This source code is licensed under the ISC license.
1724
+ * See the LICENSE file in the root directory of this source tree.
1725
+ *)
1726
+ */