@measured/puck 0.21.0-canary.f3ce0d72 → 0.21.0-canary.fee2ba98

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/dist/Editor-EHVB6NFF.mjs +204 -0
  2. package/dist/Editor-F2LSS6SE.css +403 -0
  3. package/dist/Render-OFE6QLI2.mjs +55 -0
  4. package/dist/Render-QEMDIDQC.css +101 -0
  5. package/dist/{walk-tree-CL-j099F.d.mts → actions-DwdqNb63.d.mts} +216 -52
  6. package/dist/{walk-tree-CL-j099F.d.ts → actions-DwdqNb63.d.ts} +216 -52
  7. package/dist/chunk-2334PLLL.mjs +111 -0
  8. package/dist/chunk-4N3WJM5Y.mjs +33 -0
  9. package/dist/{chunk-73365SXB.mjs → chunk-6AGLD64M.mjs} +5492 -7477
  10. package/dist/chunk-CSSRLPHM.mjs +11 -0
  11. package/dist/chunk-D6RJOV2Z.mjs +1727 -0
  12. package/dist/chunk-M6W7YEVX.mjs +95 -0
  13. package/dist/chunk-NLUHDYVR.mjs +416 -0
  14. package/dist/chunk-NQEE2254.mjs +706 -0
  15. package/dist/chunk-PXYVL42X.mjs +53 -0
  16. package/dist/chunk-QBGM4ELA.mjs +528 -0
  17. package/dist/chunk-QLQZDFXM.mjs +63 -0
  18. package/dist/chunk-T3WX7XJ6.mjs +132 -0
  19. package/dist/chunk-V5I7CVLT.mjs +103 -0
  20. package/dist/chunk-Y2EFNT5P.mjs +108 -0
  21. package/dist/chunk-Y656T6AQ.mjs +419 -0
  22. package/dist/full-2GJTAAZE.css +301 -0
  23. package/dist/full-TVZATY2K.mjs +93 -0
  24. package/dist/index-AfAtzigt.d.ts +117 -0
  25. package/dist/index-jxA1wrW4.d.mts +117 -0
  26. package/dist/index.css +636 -759
  27. package/dist/index.d.mts +100 -133
  28. package/dist/index.d.ts +100 -133
  29. package/dist/index.js +8328 -5321
  30. package/dist/index.mjs +26 -20
  31. package/dist/internal.d.mts +27 -0
  32. package/dist/internal.d.ts +27 -0
  33. package/dist/internal.js +908 -0
  34. package/dist/internal.mjs +13 -0
  35. package/dist/loaded-ICVILKS6.mjs +60 -0
  36. package/dist/loaded-IHAGHNLA.mjs +57 -0
  37. package/dist/loaded-ONU7LATV.mjs +57 -0
  38. package/dist/loaded-RVWBFK7L.css +87 -0
  39. package/dist/no-external.css +736 -855
  40. package/dist/no-external.d.mts +19 -2
  41. package/dist/no-external.d.ts +19 -2
  42. package/dist/no-external.js +8331 -5321
  43. package/dist/no-external.mjs +28 -17
  44. package/dist/rsc.css +101 -0
  45. package/dist/rsc.d.mts +17 -2
  46. package/dist/rsc.d.ts +17 -2
  47. package/dist/rsc.js +411 -26
  48. package/dist/rsc.mjs +18 -9
  49. package/dist/walk-tree-DRy9ca1P.d.ts +29 -0
  50. package/dist/walk-tree-Dppc3XGY.d.mts +29 -0
  51. package/package.json +31 -4
  52. package/dist/chunk-FY5AZKYD.mjs +0 -967
@@ -0,0 +1,1727 @@
1
+ import {
2
+ createReducer,
3
+ generateId,
4
+ getItem,
5
+ makeStatePublic
6
+ } from "./chunk-QBGM4ELA.mjs";
7
+ import {
8
+ defaultAppState,
9
+ defaultViewports,
10
+ getChanged,
11
+ resolveComponentData
12
+ } from "./chunk-T3WX7XJ6.mjs";
13
+ import {
14
+ get_class_name_factory_default
15
+ } from "./chunk-Y2EFNT5P.mjs";
16
+ import {
17
+ walkAppState
18
+ } from "./chunk-NLUHDYVR.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 Component = 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
+ Component.displayName = `${iconName}`;
111
+ return Component;
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/chevron-down.js
177
+ init_react_import();
178
+ var ChevronDown = createLucideIcon("ChevronDown", [
179
+ ["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
180
+ ]);
181
+
182
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-right.js
183
+ init_react_import();
184
+ var ChevronRight = createLucideIcon("ChevronRight", [
185
+ ["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]
186
+ ]);
187
+
188
+ // ../../node_modules/lucide-react/dist/esm/icons/chevron-up.js
189
+ init_react_import();
190
+ var ChevronUp = createLucideIcon("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
191
+
192
+ // ../../node_modules/lucide-react/dist/esm/icons/circle-check-big.js
193
+ init_react_import();
194
+ var CircleCheckBig = createLucideIcon("CircleCheckBig", [
195
+ ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
196
+ ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
197
+ ]);
198
+
199
+ // ../../node_modules/lucide-react/dist/esm/icons/code.js
200
+ init_react_import();
201
+ var Code = createLucideIcon("Code", [
202
+ ["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
203
+ ["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }]
204
+ ]);
205
+
206
+ // ../../node_modules/lucide-react/dist/esm/icons/copy.js
207
+ init_react_import();
208
+ var Copy = createLucideIcon("Copy", [
209
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
210
+ ["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" }]
211
+ ]);
212
+
213
+ // ../../node_modules/lucide-react/dist/esm/icons/corner-left-up.js
214
+ init_react_import();
215
+ var CornerLeftUp = createLucideIcon("CornerLeftUp", [
216
+ ["polyline", { points: "14 9 9 4 4 9", key: "m9oyvo" }],
217
+ ["path", { d: "M20 20h-7a4 4 0 0 1-4-4V4", key: "1blwi3" }]
218
+ ]);
219
+
220
+ // ../../node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.js
221
+ init_react_import();
222
+ var EllipsisVertical = createLucideIcon("EllipsisVertical", [
223
+ ["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }],
224
+ ["circle", { cx: "12", cy: "5", r: "1", key: "gxeob9" }],
225
+ ["circle", { cx: "12", cy: "19", r: "1", key: "lyex9k" }]
226
+ ]);
227
+
228
+ // ../../node_modules/lucide-react/dist/esm/icons/globe.js
229
+ init_react_import();
230
+ var Globe = createLucideIcon("Globe", [
231
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
232
+ ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
233
+ ["path", { d: "M2 12h20", key: "9i4pu4" }]
234
+ ]);
235
+
236
+ // ../../node_modules/lucide-react/dist/esm/icons/hash.js
237
+ init_react_import();
238
+ var Hash = createLucideIcon("Hash", [
239
+ ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
240
+ ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
241
+ ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
242
+ ["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
243
+ ]);
244
+
245
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-1.js
246
+ init_react_import();
247
+ var Heading1 = createLucideIcon("Heading1", [
248
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
249
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
250
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
251
+ ["path", { d: "m17 12 3-2v8", key: "1hhhft" }]
252
+ ]);
253
+
254
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-2.js
255
+ init_react_import();
256
+ var Heading2 = createLucideIcon("Heading2", [
257
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
258
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
259
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
260
+ ["path", { d: "M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1", key: "9jr5yi" }]
261
+ ]);
262
+
263
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-3.js
264
+ init_react_import();
265
+ var Heading3 = createLucideIcon("Heading3", [
266
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
267
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
268
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
269
+ ["path", { d: "M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2", key: "68ncm8" }],
270
+ ["path", { d: "M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2", key: "1ejuhz" }]
271
+ ]);
272
+
273
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-4.js
274
+ init_react_import();
275
+ var Heading4 = createLucideIcon("Heading4", [
276
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
277
+ ["path", { d: "M17 10v3a1 1 0 0 0 1 1h3", key: "tj5zdr" }],
278
+ ["path", { d: "M21 10v8", key: "1kdml4" }],
279
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
280
+ ["path", { d: "M4 18V6", key: "1rz3zl" }]
281
+ ]);
282
+
283
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-5.js
284
+ init_react_import();
285
+ var Heading5 = createLucideIcon("Heading5", [
286
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
287
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
288
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
289
+ ["path", { d: "M17 13v-3h4", key: "1nvgqp" }],
290
+ [
291
+ "path",
292
+ { 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" }
293
+ ]
294
+ ]);
295
+
296
+ // ../../node_modules/lucide-react/dist/esm/icons/heading-6.js
297
+ init_react_import();
298
+ var Heading6 = createLucideIcon("Heading6", [
299
+ ["path", { d: "M4 12h8", key: "17cfdx" }],
300
+ ["path", { d: "M4 18V6", key: "1rz3zl" }],
301
+ ["path", { d: "M12 18V6", key: "zqpxq5" }],
302
+ ["circle", { cx: "19", cy: "16", r: "2", key: "15mx69" }],
303
+ ["path", { d: "M20 10c-2 2-3 3.5-3 6", key: "f35dl0" }]
304
+ ]);
305
+
306
+ // ../../node_modules/lucide-react/dist/esm/icons/italic.js
307
+ init_react_import();
308
+ var Italic = createLucideIcon("Italic", [
309
+ ["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
310
+ ["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
311
+ ["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
312
+ ]);
313
+
314
+ // ../../node_modules/lucide-react/dist/esm/icons/layers.js
315
+ init_react_import();
316
+ var Layers = createLucideIcon("Layers", [
317
+ [
318
+ "path",
319
+ {
320
+ 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",
321
+ key: "zw3jo"
322
+ }
323
+ ],
324
+ [
325
+ "path",
326
+ {
327
+ 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",
328
+ key: "1wduqc"
329
+ }
330
+ ],
331
+ [
332
+ "path",
333
+ {
334
+ 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",
335
+ key: "kqbvx6"
336
+ }
337
+ ]
338
+ ]);
339
+
340
+ // ../../node_modules/lucide-react/dist/esm/icons/layout-grid.js
341
+ init_react_import();
342
+ var LayoutGrid = createLucideIcon("LayoutGrid", [
343
+ ["rect", { width: "7", height: "7", x: "3", y: "3", rx: "1", key: "1g98yp" }],
344
+ ["rect", { width: "7", height: "7", x: "14", y: "3", rx: "1", key: "6d4xhi" }],
345
+ ["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }],
346
+ ["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }]
347
+ ]);
348
+
349
+ // ../../node_modules/lucide-react/dist/esm/icons/link.js
350
+ init_react_import();
351
+ var Link = createLucideIcon("Link", [
352
+ ["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" }],
353
+ ["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" }]
354
+ ]);
355
+
356
+ // ../../node_modules/lucide-react/dist/esm/icons/list-ordered.js
357
+ init_react_import();
358
+ var ListOrdered = createLucideIcon("ListOrdered", [
359
+ ["path", { d: "M10 12h11", key: "6m4ad9" }],
360
+ ["path", { d: "M10 18h11", key: "11hvi2" }],
361
+ ["path", { d: "M10 6h11", key: "c7qv1k" }],
362
+ ["path", { d: "M4 10h2", key: "16xx2s" }],
363
+ ["path", { d: "M4 6h1v4", key: "cnovpq" }],
364
+ ["path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1", key: "m9a95d" }]
365
+ ]);
366
+
367
+ // ../../node_modules/lucide-react/dist/esm/icons/lock-open.js
368
+ init_react_import();
369
+ var LockOpen = createLucideIcon("LockOpen", [
370
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
371
+ ["path", { d: "M7 11V7a5 5 0 0 1 9.9-1", key: "1mm8w8" }]
372
+ ]);
373
+
374
+ // ../../node_modules/lucide-react/dist/esm/icons/lock.js
375
+ init_react_import();
376
+ var Lock = createLucideIcon("Lock", [
377
+ ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
378
+ ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
379
+ ]);
380
+
381
+ // ../../node_modules/lucide-react/dist/esm/icons/minus.js
382
+ init_react_import();
383
+ var Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
384
+
385
+ // ../../node_modules/lucide-react/dist/esm/icons/monitor.js
386
+ init_react_import();
387
+ var Monitor = createLucideIcon("Monitor", [
388
+ ["rect", { width: "20", height: "14", x: "2", y: "3", rx: "2", key: "48i651" }],
389
+ ["line", { x1: "8", x2: "16", y1: "21", y2: "21", key: "1svkeh" }],
390
+ ["line", { x1: "12", x2: "12", y1: "17", y2: "21", key: "vw1qmm" }]
391
+ ]);
392
+
393
+ // ../../node_modules/lucide-react/dist/esm/icons/panel-left.js
394
+ init_react_import();
395
+ var PanelLeft = createLucideIcon("PanelLeft", [
396
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
397
+ ["path", { d: "M9 3v18", key: "fh3hqa" }]
398
+ ]);
399
+
400
+ // ../../node_modules/lucide-react/dist/esm/icons/panel-right.js
401
+ init_react_import();
402
+ var PanelRight = createLucideIcon("PanelRight", [
403
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
404
+ ["path", { d: "M15 3v18", key: "14nvp0" }]
405
+ ]);
406
+
407
+ // ../../node_modules/lucide-react/dist/esm/icons/plus.js
408
+ init_react_import();
409
+ var Plus = createLucideIcon("Plus", [
410
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
411
+ ["path", { d: "M12 5v14", key: "s699le" }]
412
+ ]);
413
+
414
+ // ../../node_modules/lucide-react/dist/esm/icons/quote.js
415
+ init_react_import();
416
+ var Quote = createLucideIcon("Quote", [
417
+ [
418
+ "path",
419
+ {
420
+ 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",
421
+ key: "rib7q0"
422
+ }
423
+ ],
424
+ [
425
+ "path",
426
+ {
427
+ 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",
428
+ key: "1ymkrd"
429
+ }
430
+ ]
431
+ ]);
432
+
433
+ // ../../node_modules/lucide-react/dist/esm/icons/redo-2.js
434
+ init_react_import();
435
+ var Redo2 = createLucideIcon("Redo2", [
436
+ ["path", { d: "m15 14 5-5-5-5", key: "12vg1m" }],
437
+ ["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" }]
438
+ ]);
439
+
440
+ // ../../node_modules/lucide-react/dist/esm/icons/search.js
441
+ init_react_import();
442
+ var Search = createLucideIcon("Search", [
443
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
444
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
445
+ ]);
446
+
447
+ // ../../node_modules/lucide-react/dist/esm/icons/sliders-horizontal.js
448
+ init_react_import();
449
+ var SlidersHorizontal = createLucideIcon("SlidersHorizontal", [
450
+ ["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
451
+ ["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
452
+ ["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
453
+ ["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
454
+ ["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
455
+ ["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
456
+ ["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
457
+ ["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
458
+ ["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
459
+ ]);
460
+
461
+ // ../../node_modules/lucide-react/dist/esm/icons/smartphone.js
462
+ init_react_import();
463
+ var Smartphone = createLucideIcon("Smartphone", [
464
+ ["rect", { width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2", key: "1yt0o3" }],
465
+ ["path", { d: "M12 18h.01", key: "mhygvu" }]
466
+ ]);
467
+
468
+ // ../../node_modules/lucide-react/dist/esm/icons/square-code.js
469
+ init_react_import();
470
+ var SquareCode = createLucideIcon("SquareCode", [
471
+ ["path", { d: "M10 9.5 8 12l2 2.5", key: "3mjy60" }],
472
+ ["path", { d: "m14 9.5 2 2.5-2 2.5", key: "1bir2l" }],
473
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
474
+ ]);
475
+
476
+ // ../../node_modules/lucide-react/dist/esm/icons/strikethrough.js
477
+ init_react_import();
478
+ var Strikethrough = createLucideIcon("Strikethrough", [
479
+ ["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
480
+ ["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
481
+ ["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
482
+ ]);
483
+
484
+ // ../../node_modules/lucide-react/dist/esm/icons/tablet.js
485
+ init_react_import();
486
+ var Tablet = createLucideIcon("Tablet", [
487
+ ["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
488
+ ["line", { x1: "12", x2: "12.01", y1: "18", y2: "18", key: "1dp563" }]
489
+ ]);
490
+
491
+ // ../../node_modules/lucide-react/dist/esm/icons/trash.js
492
+ init_react_import();
493
+ var Trash = createLucideIcon("Trash", [
494
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
495
+ ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
496
+ ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }]
497
+ ]);
498
+
499
+ // ../../node_modules/lucide-react/dist/esm/icons/type.js
500
+ init_react_import();
501
+ var Type = createLucideIcon("Type", [
502
+ ["polyline", { points: "4 7 4 4 20 4 20 7", key: "1nosan" }],
503
+ ["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
504
+ ["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
505
+ ]);
506
+
507
+ // ../../node_modules/lucide-react/dist/esm/icons/underline.js
508
+ init_react_import();
509
+ var Underline = createLucideIcon("Underline", [
510
+ ["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
511
+ ["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
512
+ ]);
513
+
514
+ // ../../node_modules/lucide-react/dist/esm/icons/undo-2.js
515
+ init_react_import();
516
+ var Undo2 = createLucideIcon("Undo2", [
517
+ ["path", { d: "M9 14 4 9l5-5", key: "102s5s" }],
518
+ ["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" }]
519
+ ]);
520
+
521
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-in.js
522
+ init_react_import();
523
+ var ZoomIn = createLucideIcon("ZoomIn", [
524
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
525
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
526
+ ["line", { x1: "11", x2: "11", y1: "8", y2: "14", key: "1vmskp" }],
527
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
528
+ ]);
529
+
530
+ // ../../node_modules/lucide-react/dist/esm/icons/zoom-out.js
531
+ init_react_import();
532
+ var ZoomOut = createLucideIcon("ZoomOut", [
533
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
534
+ ["line", { x1: "21", x2: "16.65", y1: "21", y2: "16.65", key: "13gj7c" }],
535
+ ["line", { x1: "8", x2: "14", y1: "11", y2: "11", key: "durymu" }]
536
+ ]);
537
+
538
+ // store/index.ts
539
+ init_react_import();
540
+ import { create as create2, useStore } from "zustand";
541
+ import { subscribeWithSelector as subscribeWithSelector2 } from "zustand/middleware";
542
+ import { createContext, useContext } from "react";
543
+
544
+ // store/slices/history.ts
545
+ init_react_import();
546
+ import { useEffect as useEffect2 } from "react";
547
+
548
+ // lib/use-hotkey.ts
549
+ init_react_import();
550
+ import { useEffect } from "react";
551
+ import { create } from "zustand";
552
+ import { subscribeWithSelector } from "zustand/middleware";
553
+ var keyCodeMap = {
554
+ ControlLeft: "ctrl",
555
+ ControlRight: "ctrl",
556
+ MetaLeft: "meta",
557
+ MetaRight: "meta",
558
+ ShiftLeft: "shift",
559
+ ShiftRight: "shift",
560
+ KeyA: "a",
561
+ KeyB: "b",
562
+ KeyC: "c",
563
+ KeyD: "d",
564
+ KeyE: "e",
565
+ KeyF: "f",
566
+ KeyG: "g",
567
+ KeyH: "h",
568
+ KeyI: "i",
569
+ KeyJ: "j",
570
+ KeyK: "k",
571
+ KeyL: "l",
572
+ KeyM: "m",
573
+ KeyN: "n",
574
+ KeyO: "o",
575
+ KeyP: "p",
576
+ KeyQ: "q",
577
+ KeyR: "r",
578
+ KeyS: "s",
579
+ KeyT: "t",
580
+ KeyU: "u",
581
+ KeyV: "v",
582
+ KeyW: "w",
583
+ KeyX: "x",
584
+ KeyY: "y",
585
+ KeyZ: "z",
586
+ Delete: "delete",
587
+ Backspace: "backspace"
588
+ };
589
+ var useHotkeyStore = create()(
590
+ subscribeWithSelector((set) => ({
591
+ held: {},
592
+ hold: (key) => set((s) => s.held[key] ? s : { held: __spreadProps(__spreadValues({}, s.held), { [key]: true }) }),
593
+ release: (key) => set((s) => s.held[key] ? { held: __spreadProps(__spreadValues({}, s.held), { [key]: false }) } : s),
594
+ reset: (held = {}) => set(() => ({ held })),
595
+ triggers: {}
596
+ }))
597
+ );
598
+ var monitorHotkeys = (doc) => {
599
+ const onKeyDown = (e) => {
600
+ const key = keyCodeMap[e.code];
601
+ if (key) {
602
+ useHotkeyStore.getState().hold(key);
603
+ const { held, triggers } = useHotkeyStore.getState();
604
+ Object.values(triggers).forEach(({ combo, cb }) => {
605
+ const conditionMet = Object.entries(combo).every(
606
+ ([key2, value]) => value === !!held[key2]
607
+ ) && Object.entries(held).every(
608
+ ([key2, value]) => value === !!combo[key2]
609
+ );
610
+ if (conditionMet) {
611
+ const handled = cb(e);
612
+ if (handled !== false) {
613
+ e.preventDefault();
614
+ }
615
+ }
616
+ });
617
+ if (key !== "meta" && key !== "ctrl" && key !== "shift") {
618
+ useHotkeyStore.getState().release(key);
619
+ }
620
+ }
621
+ };
622
+ const onKeyUp = (e) => {
623
+ const key = keyCodeMap[e.code];
624
+ if (key) {
625
+ if (key === "meta") {
626
+ useHotkeyStore.getState().reset();
627
+ } else {
628
+ useHotkeyStore.getState().release(key);
629
+ }
630
+ }
631
+ };
632
+ const onVisibilityChanged = (e) => {
633
+ if (document.visibilityState === "hidden") {
634
+ useHotkeyStore.getState().reset();
635
+ }
636
+ };
637
+ const onBlur = () => {
638
+ useHotkeyStore.getState().reset();
639
+ };
640
+ window.addEventListener("blur", onBlur);
641
+ doc.addEventListener("keydown", onKeyDown);
642
+ doc.addEventListener("keyup", onKeyUp);
643
+ doc.addEventListener("visibilitychange", onVisibilityChanged);
644
+ return () => {
645
+ doc.removeEventListener("keydown", onKeyDown);
646
+ doc.removeEventListener("keyup", onKeyUp);
647
+ doc.removeEventListener("visibilitychange", onVisibilityChanged);
648
+ window.removeEventListener("blur", onBlur);
649
+ };
650
+ };
651
+ var useMonitorHotkeys = () => {
652
+ useEffect(() => monitorHotkeys(document), []);
653
+ };
654
+ var useHotkey = (combo, cb) => {
655
+ useEffect(
656
+ () => useHotkeyStore.setState((s) => ({
657
+ triggers: __spreadProps(__spreadValues({}, s.triggers), {
658
+ [`${Object.keys(combo).join("+")}`]: { combo, cb }
659
+ })
660
+ })),
661
+ []
662
+ );
663
+ };
664
+
665
+ // store/slices/history.ts
666
+ var EMPTY_HISTORY_INDEX = 0;
667
+ function debounce(func, timeout = 300) {
668
+ let timer;
669
+ return (...args) => {
670
+ clearTimeout(timer);
671
+ timer = setTimeout(() => {
672
+ func(...args);
673
+ }, timeout);
674
+ };
675
+ }
676
+ var tidyState = (state) => {
677
+ return __spreadProps(__spreadValues({}, state), {
678
+ ui: __spreadProps(__spreadValues({}, state.ui), {
679
+ field: __spreadProps(__spreadValues({}, state.ui.field), {
680
+ focus: null
681
+ })
682
+ })
683
+ });
684
+ };
685
+ var createHistorySlice = (set, get) => {
686
+ const record = debounce((state) => {
687
+ const { histories, index } = get().history;
688
+ const history = {
689
+ state,
690
+ id: generateId("history")
691
+ };
692
+ const newHistories = [...histories.slice(0, index + 1), history];
693
+ set({
694
+ history: __spreadProps(__spreadValues({}, get().history), {
695
+ histories: newHistories,
696
+ index: newHistories.length - 1
697
+ })
698
+ });
699
+ }, 250);
700
+ return {
701
+ initialAppState: {},
702
+ index: EMPTY_HISTORY_INDEX,
703
+ histories: [],
704
+ hasPast: () => get().history.index > EMPTY_HISTORY_INDEX,
705
+ hasFuture: () => get().history.index < get().history.histories.length - 1,
706
+ prevHistory: () => {
707
+ const { history } = get();
708
+ return history.hasPast() ? history.histories[history.index - 1] : null;
709
+ },
710
+ nextHistory: () => {
711
+ const s = get().history;
712
+ return s.hasFuture() ? s.histories[s.index + 1] : null;
713
+ },
714
+ currentHistory: () => get().history.histories[get().history.index],
715
+ back: () => {
716
+ var _a;
717
+ const { history, dispatch } = get();
718
+ if (history.hasPast()) {
719
+ const state = tidyState(
720
+ ((_a = history.prevHistory()) == null ? void 0 : _a.state) || history.initialAppState
721
+ );
722
+ dispatch({
723
+ type: "set",
724
+ state
725
+ });
726
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index - 1 }) });
727
+ }
728
+ },
729
+ forward: () => {
730
+ var _a;
731
+ const { history, dispatch } = get();
732
+ if (history.hasFuture()) {
733
+ const state = (_a = history.nextHistory()) == null ? void 0 : _a.state;
734
+ dispatch({ type: "set", state: state ? tidyState(state) : {} });
735
+ set({ history: __spreadProps(__spreadValues({}, history), { index: history.index + 1 }) });
736
+ }
737
+ },
738
+ setHistories: (histories) => {
739
+ var _a;
740
+ const { dispatch, history } = get();
741
+ dispatch({
742
+ type: "set",
743
+ state: ((_a = histories[histories.length - 1]) == null ? void 0 : _a.state) || history.initialAppState
744
+ });
745
+ set({ history: __spreadProps(__spreadValues({}, history), { histories, index: histories.length - 1 }) });
746
+ },
747
+ setHistoryIndex: (index) => {
748
+ var _a;
749
+ const { dispatch, history } = get();
750
+ dispatch({
751
+ type: "set",
752
+ state: ((_a = history.histories[index]) == null ? void 0 : _a.state) || history.initialAppState
753
+ });
754
+ set({ history: __spreadProps(__spreadValues({}, history), { index }) });
755
+ },
756
+ record
757
+ };
758
+ };
759
+ function useRegisterHistorySlice(appStore, {
760
+ histories,
761
+ index,
762
+ initialAppState
763
+ }) {
764
+ useEffect2(
765
+ () => appStore.setState({
766
+ history: __spreadProps(__spreadValues({}, appStore.getState().history), {
767
+ histories,
768
+ index,
769
+ initialAppState
770
+ })
771
+ }),
772
+ [histories, index, initialAppState]
773
+ );
774
+ const back = () => {
775
+ appStore.getState().history.back();
776
+ };
777
+ const forward = () => {
778
+ appStore.getState().history.forward();
779
+ };
780
+ useHotkey({ meta: true, z: true }, back);
781
+ useHotkey({ meta: true, shift: true, z: true }, forward);
782
+ useHotkey({ meta: true, y: true }, forward);
783
+ useHotkey({ ctrl: true, z: true }, back);
784
+ useHotkey({ ctrl: true, shift: true, z: true }, forward);
785
+ useHotkey({ ctrl: true, y: true }, forward);
786
+ }
787
+
788
+ // store/slices/nodes.ts
789
+ init_react_import();
790
+ var createNodesSlice = (set, get) => ({
791
+ nodes: {},
792
+ registerNode: (id, node) => {
793
+ const s = get().nodes;
794
+ const emptyNode = {
795
+ id,
796
+ methods: {
797
+ sync: () => null,
798
+ hideOverlay: () => null,
799
+ showOverlay: () => null
800
+ },
801
+ element: null
802
+ };
803
+ const existingNode = s.nodes[id];
804
+ set({
805
+ nodes: __spreadProps(__spreadValues({}, s), {
806
+ nodes: __spreadProps(__spreadValues({}, s.nodes), {
807
+ [id]: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, emptyNode), existingNode), node), {
808
+ id
809
+ })
810
+ })
811
+ })
812
+ });
813
+ },
814
+ unregisterNode: (id) => {
815
+ const s = get().nodes;
816
+ const existingNode = s.nodes[id];
817
+ if (existingNode) {
818
+ const newNodes = __spreadValues({}, s.nodes);
819
+ delete newNodes[id];
820
+ set({
821
+ nodes: __spreadProps(__spreadValues({}, s), {
822
+ nodes: newNodes
823
+ })
824
+ });
825
+ }
826
+ }
827
+ });
828
+
829
+ // store/slices/permissions.ts
830
+ init_react_import();
831
+ import { useEffect as useEffect3 } from "react";
832
+
833
+ // lib/data/flatten-data.ts
834
+ init_react_import();
835
+ var flattenData = (state, config) => {
836
+ const data = [];
837
+ walkAppState(
838
+ state,
839
+ config,
840
+ (content) => content,
841
+ (item) => {
842
+ data.push(item);
843
+ return item;
844
+ }
845
+ );
846
+ return data;
847
+ };
848
+
849
+ // store/slices/permissions.ts
850
+ var createPermissionsSlice = (set, get) => {
851
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
852
+ const { state, permissions, config } = get();
853
+ const { cache, globalPermissions } = permissions;
854
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
855
+ var _a, _b;
856
+ const { config: config2, state: appState, setComponentLoading } = get();
857
+ const itemCache = cache[item2.props.id];
858
+ const nodes = appState.indexes.nodes;
859
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
860
+ const parentNode = parentId ? nodes[parentId] : null;
861
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
862
+ const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
863
+ if (!componentConfig) {
864
+ return;
865
+ }
866
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
867
+ if (componentConfig.resolvePermissions) {
868
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
869
+ const propsChanged = Object.values(changed).some((el) => el === true);
870
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
871
+ if (propsChanged || parentChanged || force2) {
872
+ const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
873
+ const resolvedPermissions = yield componentConfig.resolvePermissions(
874
+ item2,
875
+ {
876
+ changed,
877
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
878
+ permissions: initialPermissions,
879
+ appState: makeStatePublic(appState),
880
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
881
+ parent: parentData
882
+ }
883
+ );
884
+ const latest = get().permissions;
885
+ set({
886
+ permissions: __spreadProps(__spreadValues({}, latest), {
887
+ cache: __spreadProps(__spreadValues({}, latest.cache), {
888
+ [item2.props.id]: {
889
+ lastParentId: parentId,
890
+ lastData: item2,
891
+ lastPermissions: resolvedPermissions
892
+ }
893
+ }),
894
+ resolvedPermissions: __spreadProps(__spreadValues({}, latest.resolvedPermissions), {
895
+ [item2.props.id]: resolvedPermissions
896
+ })
897
+ })
898
+ });
899
+ clearTimeout2();
900
+ }
901
+ }
902
+ });
903
+ const resolvePermissionsForRoot = (force2 = false) => {
904
+ const { state: appState } = get();
905
+ resolvePermissionsForItem(
906
+ // Shim the root data in by conforming to component data shape
907
+ {
908
+ type: "root",
909
+ props: __spreadProps(__spreadValues({}, appState.data.root.props), { id: "root" })
910
+ },
911
+ force2
912
+ );
913
+ };
914
+ const { item, type, root } = params;
915
+ if (item) {
916
+ yield resolvePermissionsForItem(item, force);
917
+ } else if (type) {
918
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
919
+ yield resolvePermissionsForItem(item2, force);
920
+ }));
921
+ } else if (root) {
922
+ resolvePermissionsForRoot(force);
923
+ } else {
924
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
925
+ yield resolvePermissionsForItem(item2, force);
926
+ }));
927
+ }
928
+ });
929
+ const refreshPermissions = (params) => resolvePermissions(params, true);
930
+ return {
931
+ cache: {},
932
+ globalPermissions: {
933
+ drag: true,
934
+ edit: true,
935
+ delete: true,
936
+ duplicate: true,
937
+ insert: true
938
+ },
939
+ resolvedPermissions: {},
940
+ getPermissions: ({ item, type, root } = {}) => {
941
+ const { config, permissions } = get();
942
+ const { globalPermissions, resolvedPermissions } = permissions;
943
+ if (item) {
944
+ const componentConfig = config.components[item.type];
945
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
946
+ const resolvedForItem = resolvedPermissions[item.props.id];
947
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
948
+ } else if (type) {
949
+ const componentConfig = config.components[type];
950
+ return __spreadValues(__spreadValues({}, globalPermissions), componentConfig == null ? void 0 : componentConfig.permissions);
951
+ } else if (root) {
952
+ const rootConfig = config.root;
953
+ const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), rootConfig == null ? void 0 : rootConfig.permissions);
954
+ const resolvedForItem = resolvedPermissions["root"];
955
+ return resolvedForItem ? __spreadValues(__spreadValues({}, globalPermissions), resolvedForItem) : initialPermissions;
956
+ }
957
+ return globalPermissions;
958
+ },
959
+ resolvePermissions,
960
+ refreshPermissions
961
+ };
962
+ };
963
+ var useRegisterPermissionsSlice = (appStore, globalPermissions) => {
964
+ useEffect3(() => {
965
+ const { permissions } = appStore.getState();
966
+ const { globalPermissions: existingGlobalPermissions } = permissions;
967
+ appStore.setState({
968
+ permissions: __spreadProps(__spreadValues({}, permissions), {
969
+ globalPermissions: __spreadValues(__spreadValues({}, existingGlobalPermissions), globalPermissions)
970
+ })
971
+ });
972
+ permissions.resolvePermissions();
973
+ }, [globalPermissions]);
974
+ useEffect3(() => {
975
+ return appStore.subscribe(
976
+ (s) => s.state.data,
977
+ () => {
978
+ appStore.getState().permissions.resolvePermissions();
979
+ }
980
+ );
981
+ }, []);
982
+ useEffect3(() => {
983
+ return appStore.subscribe(
984
+ (s) => s.config,
985
+ () => {
986
+ appStore.getState().permissions.resolvePermissions();
987
+ }
988
+ );
989
+ }, []);
990
+ };
991
+
992
+ // store/slices/fields.ts
993
+ init_react_import();
994
+ import { useCallback, useEffect as useEffect4 } from "react";
995
+ var createFieldsSlice = (_set, _get) => {
996
+ return {
997
+ fields: {},
998
+ loading: false,
999
+ lastResolvedData: {},
1000
+ id: void 0
1001
+ };
1002
+ };
1003
+ var useRegisterFieldsSlice = (appStore, id) => {
1004
+ const resolveFields = useCallback(
1005
+ (reset) => __async(null, null, function* () {
1006
+ var _a, _b;
1007
+ const { fields, lastResolvedData } = appStore.getState().fields;
1008
+ const metadata = appStore.getState().metadata;
1009
+ const nodes = appStore.getState().state.indexes.nodes;
1010
+ const node = nodes[id || "root"];
1011
+ const componentData = node == null ? void 0 : node.data;
1012
+ const parentNode = (node == null ? void 0 : node.parentId) ? nodes[node.parentId] : null;
1013
+ const parent = (parentNode == null ? void 0 : parentNode.data) || null;
1014
+ const { getComponentConfig, state } = appStore.getState();
1015
+ const componentConfig = getComponentConfig(componentData == null ? void 0 : componentData.type);
1016
+ if (!componentData || !componentConfig) return;
1017
+ const defaultFields = componentConfig.fields || {};
1018
+ const resolver = componentConfig.resolveFields;
1019
+ let lastFields = fields;
1020
+ if (reset) {
1021
+ appStore.setState((s) => ({
1022
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1023
+ }));
1024
+ lastFields = defaultFields;
1025
+ }
1026
+ if (resolver) {
1027
+ const timeout = setTimeout(() => {
1028
+ appStore.setState((s) => ({
1029
+ fields: __spreadProps(__spreadValues({}, s.fields), { loading: true })
1030
+ }));
1031
+ }, 50);
1032
+ const lastData = ((_a = lastResolvedData.props) == null ? void 0 : _a.id) === id ? lastResolvedData : null;
1033
+ const changed = getChanged(componentData, lastData);
1034
+ const newFields = yield resolver(componentData, {
1035
+ changed,
1036
+ fields: defaultFields,
1037
+ lastFields,
1038
+ metadata: __spreadValues(__spreadValues({}, metadata), componentConfig.metadata),
1039
+ lastData,
1040
+ appState: makeStatePublic(state),
1041
+ parent
1042
+ });
1043
+ clearTimeout(timeout);
1044
+ if (((_b = appStore.getState().selectedItem) == null ? void 0 : _b.props.id) !== id) {
1045
+ return;
1046
+ }
1047
+ appStore.setState({
1048
+ fields: {
1049
+ fields: newFields,
1050
+ loading: false,
1051
+ lastResolvedData: componentData,
1052
+ id
1053
+ }
1054
+ });
1055
+ } else {
1056
+ appStore.setState((s) => ({
1057
+ fields: __spreadProps(__spreadValues({}, s.fields), { fields: defaultFields, id })
1058
+ }));
1059
+ }
1060
+ }),
1061
+ [id]
1062
+ );
1063
+ useEffect4(() => {
1064
+ resolveFields(true);
1065
+ return appStore.subscribe(
1066
+ (s) => s.state.indexes.nodes[id || "root"],
1067
+ () => resolveFields()
1068
+ );
1069
+ }, [id]);
1070
+ };
1071
+
1072
+ // lib/data/to-root.ts
1073
+ init_react_import();
1074
+ var toRoot = (item) => {
1075
+ if ("type" in item && item.type !== "root") {
1076
+ throw new Error("Converting non-root item to root.");
1077
+ }
1078
+ const { readOnly } = item;
1079
+ if (item.props) {
1080
+ if ("id" in item.props) {
1081
+ const _a = item.props, { id } = _a, props = __objRest(_a, ["id"]);
1082
+ return { props, readOnly };
1083
+ }
1084
+ return { props: item.props, readOnly };
1085
+ }
1086
+ return { props: {}, readOnly };
1087
+ };
1088
+
1089
+ // store/index.ts
1090
+ var defaultPageFields = {
1091
+ title: { type: "text" }
1092
+ };
1093
+ var createAppStore = (initialAppStore) => create2()(
1094
+ subscribeWithSelector2((set, get) => {
1095
+ var _a, _b;
1096
+ return __spreadProps(__spreadValues({
1097
+ state: defaultAppState,
1098
+ config: { components: {} },
1099
+ componentState: {},
1100
+ plugins: [],
1101
+ overrides: {},
1102
+ viewports: defaultViewports,
1103
+ zoomConfig: {
1104
+ autoZoom: 1,
1105
+ rootHeight: 0,
1106
+ zoom: 1
1107
+ },
1108
+ status: "LOADING",
1109
+ iframe: {},
1110
+ metadata: {},
1111
+ fieldTransforms: {}
1112
+ }, initialAppStore), {
1113
+ fields: createFieldsSlice(set, get),
1114
+ history: createHistorySlice(set, get),
1115
+ nodes: createNodesSlice(set, get),
1116
+ permissions: createPermissionsSlice(set, get),
1117
+ getCurrentData: () => {
1118
+ var _a2;
1119
+ const s = get();
1120
+ return (_a2 = s.selectedItem) != null ? _a2 : s.state.data.root;
1121
+ },
1122
+ getComponentConfig: (type) => {
1123
+ var _a2;
1124
+ const { config, selectedItem } = get();
1125
+ const rootFields = ((_a2 = config.root) == null ? void 0 : _a2.fields) || defaultPageFields;
1126
+ return type && type !== "root" ? config.components[type] : selectedItem ? config.components[selectedItem.type] : __spreadProps(__spreadValues({}, config.root), { fields: rootFields });
1127
+ },
1128
+ selectedItem: ((_a = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _a.ui.itemSelector) ? getItem(
1129
+ (_b = initialAppStore == null ? void 0 : initialAppStore.state) == null ? void 0 : _b.ui.itemSelector,
1130
+ initialAppStore.state
1131
+ ) : null,
1132
+ dispatch: (action) => set((s) => {
1133
+ var _a2, _b2;
1134
+ const { record } = get().history;
1135
+ const dispatch = createReducer({
1136
+ record,
1137
+ appStore: s
1138
+ });
1139
+ const state = dispatch(s.state, action);
1140
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1141
+ (_b2 = (_a2 = get()).onAction) == null ? void 0 : _b2.call(_a2, action, state, get().state);
1142
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1143
+ }),
1144
+ setZoomConfig: (zoomConfig) => set({ zoomConfig }),
1145
+ setStatus: (status) => set({ status }),
1146
+ setComponentState: (componentState) => set({ componentState }),
1147
+ pendingLoadTimeouts: {},
1148
+ setComponentLoading: (id, loading = true, defer = 0) => {
1149
+ const { setComponentState, pendingLoadTimeouts } = get();
1150
+ const loadId = generateId();
1151
+ const setLoading = () => {
1152
+ var _a2;
1153
+ const { componentState } = get();
1154
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1155
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1156
+ loadingCount: (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) + 1
1157
+ })
1158
+ }));
1159
+ };
1160
+ const unsetLoading = () => {
1161
+ var _a2;
1162
+ const { componentState } = get();
1163
+ clearTimeout(timeout);
1164
+ delete pendingLoadTimeouts[loadId];
1165
+ set({ pendingLoadTimeouts });
1166
+ setComponentState(__spreadProps(__spreadValues({}, componentState), {
1167
+ [id]: __spreadProps(__spreadValues({}, componentState[id]), {
1168
+ loadingCount: Math.max(
1169
+ (((_a2 = componentState[id]) == null ? void 0 : _a2.loadingCount) || 0) - 1,
1170
+ 0
1171
+ )
1172
+ })
1173
+ }));
1174
+ };
1175
+ const timeout = setTimeout(() => {
1176
+ if (loading) {
1177
+ setLoading();
1178
+ } else {
1179
+ unsetLoading();
1180
+ }
1181
+ delete pendingLoadTimeouts[loadId];
1182
+ set({ pendingLoadTimeouts });
1183
+ }, defer);
1184
+ set({
1185
+ pendingLoadTimeouts: __spreadProps(__spreadValues({}, pendingLoadTimeouts), {
1186
+ [id]: timeout
1187
+ })
1188
+ });
1189
+ return unsetLoading;
1190
+ },
1191
+ unsetComponentLoading: (id) => {
1192
+ const { setComponentLoading } = get();
1193
+ setComponentLoading(id, false);
1194
+ },
1195
+ // Helper
1196
+ setUi: (ui, recordHistory) => set((s) => {
1197
+ const dispatch = createReducer({
1198
+ record: () => {
1199
+ },
1200
+ appStore: s
1201
+ });
1202
+ const state = dispatch(s.state, {
1203
+ type: "setUi",
1204
+ ui,
1205
+ recordHistory
1206
+ });
1207
+ const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
1208
+ return __spreadProps(__spreadValues({}, s), { state, selectedItem });
1209
+ }),
1210
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
1211
+ const { config, metadata, setComponentLoading, permissions } = get();
1212
+ const timeouts = {};
1213
+ return yield resolveComponentData(
1214
+ componentData,
1215
+ config,
1216
+ metadata,
1217
+ (item) => {
1218
+ const id = "id" in item.props ? item.props.id : "root";
1219
+ timeouts[id] = setComponentLoading(id, true, 50);
1220
+ },
1221
+ (item) => __async(null, null, function* () {
1222
+ const id = "id" in item.props ? item.props.id : "root";
1223
+ if ("type" in item) {
1224
+ yield permissions.refreshPermissions({ item });
1225
+ } else {
1226
+ yield permissions.refreshPermissions({ root: true });
1227
+ }
1228
+ timeouts[id]();
1229
+ }),
1230
+ trigger
1231
+ );
1232
+ }),
1233
+ resolveAndCommitData: () => __async(null, null, function* () {
1234
+ const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
1235
+ walkAppState(
1236
+ state,
1237
+ config,
1238
+ (content) => content,
1239
+ (childItem) => {
1240
+ resolveComponentData2(childItem, "load").then((resolved) => {
1241
+ const { state: state2 } = get();
1242
+ const node = state2.indexes.nodes[resolved.node.props.id];
1243
+ if (node && resolved.didChange) {
1244
+ if (resolved.node.props.id === "root") {
1245
+ dispatch({
1246
+ type: "replaceRoot",
1247
+ root: toRoot(resolved.node)
1248
+ });
1249
+ } else {
1250
+ const zoneCompound = `${node.parentId}:${node.zone}`;
1251
+ const parentZone = state2.indexes.zones[zoneCompound];
1252
+ const index = parentZone.contentIds.indexOf(
1253
+ resolved.node.props.id
1254
+ );
1255
+ dispatch({
1256
+ type: "replace",
1257
+ data: resolved.node,
1258
+ destinationIndex: index,
1259
+ destinationZone: zoneCompound
1260
+ });
1261
+ }
1262
+ }
1263
+ });
1264
+ return childItem;
1265
+ }
1266
+ );
1267
+ })
1268
+ });
1269
+ })
1270
+ );
1271
+ var appStoreContext = createContext(createAppStore());
1272
+ function useAppStore(selector) {
1273
+ const context = useContext(appStoreContext);
1274
+ return useStore(context, selector);
1275
+ }
1276
+ function useAppStoreApi() {
1277
+ return useContext(appStoreContext);
1278
+ }
1279
+
1280
+ // components/RichTextMenu/lib/use-control-context.ts
1281
+ init_react_import();
1282
+ import { createContext as createContext2, useContext as useContext2 } from "react";
1283
+ var ControlContext = createContext2({});
1284
+ var useControlContext = () => {
1285
+ return useContext2(ControlContext);
1286
+ };
1287
+
1288
+ // components/RichTextMenu/components/SelectControl/index.tsx
1289
+ init_react_import();
1290
+ import { useMemo } from "react";
1291
+
1292
+ // components/Select/index.tsx
1293
+ init_react_import();
1294
+
1295
+ // css-module:/home/runner/work/puck/puck/packages/core/components/Select/styles.module.css#css-module
1296
+ init_react_import();
1297
+ var styles_module_default = { "Select": "_Select_xjbef_1", "Select-button": "_Select-button_xjbef_6", "Select--hasOptions": "_Select--hasOptions_xjbef_19", "Select--disabled": "_Select--disabled_xjbef_23", "Select-buttonIcon": "_Select-buttonIcon_xjbef_27", "Select--standalone": "_Select--standalone_xjbef_33", "Select--actionBar": "_Select--actionBar_xjbef_38", "Select--hasValue": "_Select--hasValue_xjbef_44", "Select-items": "_Select-items_xjbef_61", "SelectItem": "_SelectItem_xjbef_72", "SelectItem--isSelected": "_SelectItem--isSelected_xjbef_87", "SelectItem-icon": "_SelectItem-icon_xjbef_93" };
1298
+
1299
+ // components/Select/index.tsx
1300
+ import { useState } from "react";
1301
+ import {
1302
+ Popover,
1303
+ PopoverContent,
1304
+ PopoverPortal,
1305
+ PopoverTrigger
1306
+ } from "@radix-ui/react-popover";
1307
+
1308
+ // lib/index.ts
1309
+ init_react_import();
1310
+
1311
+ // lib/filter.ts
1312
+ init_react_import();
1313
+
1314
+ // lib/data/reorder.ts
1315
+ init_react_import();
1316
+ var reorder = (list, startIndex, endIndex) => {
1317
+ const result = Array.from(list);
1318
+ const [removed] = result.splice(startIndex, 1);
1319
+ result.splice(endIndex, 0, removed);
1320
+ return result;
1321
+ };
1322
+
1323
+ // lib/data/replace.ts
1324
+ init_react_import();
1325
+ var replace = (list, index, newItem) => {
1326
+ const result = Array.from(list);
1327
+ result.splice(index, 1);
1328
+ result.splice(index, 0, newItem);
1329
+ return result;
1330
+ };
1331
+
1332
+ // lib/use-reset-auto-zoom.ts
1333
+ init_react_import();
1334
+
1335
+ // lib/get-zoom-config.ts
1336
+ init_react_import();
1337
+
1338
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1339
+ init_react_import();
1340
+
1341
+ // ../../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1342
+ init_react_import();
1343
+ var isProduction = process.env.NODE_ENV === "production";
1344
+ var prefix = "Invariant failed";
1345
+ function invariant(condition, message) {
1346
+ if (condition) {
1347
+ return;
1348
+ }
1349
+ if (isProduction) {
1350
+ throw new Error(prefix);
1351
+ }
1352
+ var provided = typeof message === "function" ? message() : message;
1353
+ var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1354
+ throw new Error(value);
1355
+ }
1356
+
1357
+ // ../../node_modules/css-box-model/dist/css-box-model.esm.js
1358
+ var getRect = function getRect2(_ref) {
1359
+ var top = _ref.top, right = _ref.right, bottom = _ref.bottom, left = _ref.left;
1360
+ var width = right - left;
1361
+ var height = bottom - top;
1362
+ var rect = {
1363
+ top,
1364
+ right,
1365
+ bottom,
1366
+ left,
1367
+ width,
1368
+ height,
1369
+ x: left,
1370
+ y: top,
1371
+ center: {
1372
+ x: (right + left) / 2,
1373
+ y: (bottom + top) / 2
1374
+ }
1375
+ };
1376
+ return rect;
1377
+ };
1378
+ var expand = function expand2(target, expandBy) {
1379
+ return {
1380
+ top: target.top - expandBy.top,
1381
+ left: target.left - expandBy.left,
1382
+ bottom: target.bottom + expandBy.bottom,
1383
+ right: target.right + expandBy.right
1384
+ };
1385
+ };
1386
+ var shrink = function shrink2(target, shrinkBy) {
1387
+ return {
1388
+ top: target.top + shrinkBy.top,
1389
+ left: target.left + shrinkBy.left,
1390
+ bottom: target.bottom - shrinkBy.bottom,
1391
+ right: target.right - shrinkBy.right
1392
+ };
1393
+ };
1394
+ var noSpacing = {
1395
+ top: 0,
1396
+ right: 0,
1397
+ bottom: 0,
1398
+ left: 0
1399
+ };
1400
+ var createBox = function createBox2(_ref2) {
1401
+ 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;
1402
+ var marginBox = getRect(expand(borderBox, margin));
1403
+ var paddingBox = getRect(shrink(borderBox, border));
1404
+ var contentBox = getRect(shrink(paddingBox, padding));
1405
+ return {
1406
+ marginBox,
1407
+ borderBox: getRect(borderBox),
1408
+ paddingBox,
1409
+ contentBox,
1410
+ margin,
1411
+ border,
1412
+ padding
1413
+ };
1414
+ };
1415
+ var parse = function parse2(raw) {
1416
+ var value = raw.slice(0, -2);
1417
+ var suffix = raw.slice(-2);
1418
+ if (suffix !== "px") {
1419
+ return 0;
1420
+ }
1421
+ var result = Number(value);
1422
+ !!isNaN(result) ? process.env.NODE_ENV !== "production" ? invariant(false, "Could not parse value [raw: " + raw + ", without suffix: " + value + "]") : invariant(false) : void 0;
1423
+ return result;
1424
+ };
1425
+ var calculateBox = function calculateBox2(borderBox, styles) {
1426
+ var margin = {
1427
+ top: parse(styles.marginTop),
1428
+ right: parse(styles.marginRight),
1429
+ bottom: parse(styles.marginBottom),
1430
+ left: parse(styles.marginLeft)
1431
+ };
1432
+ var padding = {
1433
+ top: parse(styles.paddingTop),
1434
+ right: parse(styles.paddingRight),
1435
+ bottom: parse(styles.paddingBottom),
1436
+ left: parse(styles.paddingLeft)
1437
+ };
1438
+ var border = {
1439
+ top: parse(styles.borderTopWidth),
1440
+ right: parse(styles.borderRightWidth),
1441
+ bottom: parse(styles.borderBottomWidth),
1442
+ left: parse(styles.borderLeftWidth)
1443
+ };
1444
+ return createBox({
1445
+ borderBox,
1446
+ margin,
1447
+ padding,
1448
+ border
1449
+ });
1450
+ };
1451
+ var getBox = function getBox2(el) {
1452
+ var borderBox = el.getBoundingClientRect();
1453
+ var styles = window.getComputedStyle(el);
1454
+ return calculateBox(borderBox, styles);
1455
+ };
1456
+
1457
+ // lib/get-zoom-config.ts
1458
+ var RESET_ZOOM_SMALLER_THAN_FRAME = true;
1459
+ var getZoomConfig = (uiViewport, frame, zoom) => {
1460
+ const box = getBox(frame);
1461
+ const { width: frameWidth, height: frameHeight } = box.contentBox;
1462
+ const viewportHeight = uiViewport.height === "auto" ? frameHeight : uiViewport.height;
1463
+ let rootHeight = 0;
1464
+ let autoZoom = 1;
1465
+ if (uiViewport.width > frameWidth || viewportHeight > frameHeight) {
1466
+ const widthZoom = Math.min(frameWidth / uiViewport.width, 1);
1467
+ const heightZoom = Math.min(frameHeight / viewportHeight, 1);
1468
+ zoom = widthZoom;
1469
+ if (widthZoom < heightZoom) {
1470
+ rootHeight = viewportHeight / zoom;
1471
+ } else {
1472
+ rootHeight = viewportHeight;
1473
+ zoom = heightZoom;
1474
+ }
1475
+ autoZoom = zoom;
1476
+ } else {
1477
+ if (RESET_ZOOM_SMALLER_THAN_FRAME) {
1478
+ autoZoom = 1;
1479
+ zoom = 1;
1480
+ rootHeight = viewportHeight;
1481
+ }
1482
+ }
1483
+ return { autoZoom, rootHeight, zoom };
1484
+ };
1485
+
1486
+ // lib/use-reset-auto-zoom.ts
1487
+ var useResetAutoZoom = (frameRef) => {
1488
+ const appStoreApi = useAppStoreApi();
1489
+ const resetAutoZoom = (options) => {
1490
+ const { state, zoomConfig, setZoomConfig } = appStoreApi.getState();
1491
+ const { viewports } = state.ui;
1492
+ const newViewports = (options == null ? void 0 : options.viewports) || viewports;
1493
+ if (frameRef.current) {
1494
+ setZoomConfig(
1495
+ getZoomConfig(newViewports == null ? void 0 : newViewports.current, frameRef.current, zoomConfig.zoom)
1496
+ );
1497
+ }
1498
+ };
1499
+ return resetAutoZoom;
1500
+ };
1501
+
1502
+ // components/Select/index.tsx
1503
+ import { jsx, jsxs } from "react/jsx-runtime";
1504
+ var getClassName = get_class_name_factory_default("Select", styles_module_default);
1505
+ var getItemClassName = get_class_name_factory_default("SelectItem", styles_module_default);
1506
+ var Item = ({
1507
+ children,
1508
+ isSelected,
1509
+ onClick
1510
+ }) => {
1511
+ return /* @__PURE__ */ jsx("button", { className: getItemClassName({ isSelected }), onClick, children });
1512
+ };
1513
+ var Select = ({
1514
+ children,
1515
+ options,
1516
+ onChange,
1517
+ value,
1518
+ defaultValue,
1519
+ mode,
1520
+ disabled = false
1521
+ }) => {
1522
+ const [open, setOpen] = useState(false);
1523
+ const hasOptions = options.length > 0;
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
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-puck-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
+ ChevronDown,
1604
+ ChevronRight,
1605
+ ChevronUp,
1606
+ CircleCheckBig,
1607
+ Code,
1608
+ Copy,
1609
+ CornerLeftUp,
1610
+ EllipsisVertical,
1611
+ Globe,
1612
+ Hash,
1613
+ Heading1,
1614
+ Heading2,
1615
+ Heading3,
1616
+ Heading4,
1617
+ Heading5,
1618
+ Heading6,
1619
+ Heading,
1620
+ Italic,
1621
+ Layers,
1622
+ LayoutGrid,
1623
+ Link,
1624
+ ListOrdered,
1625
+ List,
1626
+ LockOpen,
1627
+ Lock,
1628
+ Minus,
1629
+ Monitor,
1630
+ PanelLeft,
1631
+ PanelRight,
1632
+ Plus,
1633
+ Quote,
1634
+ Redo2,
1635
+ Search,
1636
+ SlidersHorizontal,
1637
+ Smartphone,
1638
+ SquareCode,
1639
+ Strikethrough,
1640
+ Tablet,
1641
+ Trash,
1642
+ Type,
1643
+ Underline,
1644
+ Undo2,
1645
+ ZoomIn,
1646
+ ZoomOut,
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
+ useResetAutoZoom,
1661
+ ControlContext,
1662
+ useControlContext,
1663
+ SelectControl
1664
+ };
1665
+ /*! Bundled license information:
1666
+
1667
+ lucide-react/dist/esm/shared/src/utils.js:
1668
+ lucide-react/dist/esm/defaultAttributes.js:
1669
+ lucide-react/dist/esm/Icon.js:
1670
+ lucide-react/dist/esm/createLucideIcon.js:
1671
+ lucide-react/dist/esm/icons/align-left.js:
1672
+ lucide-react/dist/esm/icons/heading.js:
1673
+ lucide-react/dist/esm/icons/list.js:
1674
+ lucide-react/dist/esm/icons/align-center.js:
1675
+ lucide-react/dist/esm/icons/align-justify.js:
1676
+ lucide-react/dist/esm/icons/align-right.js:
1677
+ lucide-react/dist/esm/icons/bold.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/circle-check-big.js:
1682
+ lucide-react/dist/esm/icons/code.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/ellipsis-vertical.js:
1686
+ lucide-react/dist/esm/icons/globe.js:
1687
+ lucide-react/dist/esm/icons/hash.js:
1688
+ lucide-react/dist/esm/icons/heading-1.js:
1689
+ lucide-react/dist/esm/icons/heading-2.js:
1690
+ lucide-react/dist/esm/icons/heading-3.js:
1691
+ lucide-react/dist/esm/icons/heading-4.js:
1692
+ lucide-react/dist/esm/icons/heading-5.js:
1693
+ lucide-react/dist/esm/icons/heading-6.js:
1694
+ lucide-react/dist/esm/icons/italic.js:
1695
+ lucide-react/dist/esm/icons/layers.js:
1696
+ lucide-react/dist/esm/icons/layout-grid.js:
1697
+ lucide-react/dist/esm/icons/link.js:
1698
+ lucide-react/dist/esm/icons/list-ordered.js:
1699
+ lucide-react/dist/esm/icons/lock-open.js:
1700
+ lucide-react/dist/esm/icons/lock.js:
1701
+ lucide-react/dist/esm/icons/minus.js:
1702
+ lucide-react/dist/esm/icons/monitor.js:
1703
+ lucide-react/dist/esm/icons/panel-left.js:
1704
+ lucide-react/dist/esm/icons/panel-right.js:
1705
+ lucide-react/dist/esm/icons/plus.js:
1706
+ lucide-react/dist/esm/icons/quote.js:
1707
+ lucide-react/dist/esm/icons/redo-2.js:
1708
+ lucide-react/dist/esm/icons/search.js:
1709
+ lucide-react/dist/esm/icons/sliders-horizontal.js:
1710
+ lucide-react/dist/esm/icons/smartphone.js:
1711
+ lucide-react/dist/esm/icons/square-code.js:
1712
+ lucide-react/dist/esm/icons/strikethrough.js:
1713
+ lucide-react/dist/esm/icons/tablet.js:
1714
+ lucide-react/dist/esm/icons/trash.js:
1715
+ lucide-react/dist/esm/icons/type.js:
1716
+ lucide-react/dist/esm/icons/underline.js:
1717
+ lucide-react/dist/esm/icons/undo-2.js:
1718
+ lucide-react/dist/esm/icons/zoom-in.js:
1719
+ lucide-react/dist/esm/icons/zoom-out.js:
1720
+ lucide-react/dist/esm/lucide-react.js:
1721
+ (**
1722
+ * @license lucide-react v0.468.0 - ISC
1723
+ *
1724
+ * This source code is licensed under the ISC license.
1725
+ * See the LICENSE file in the root directory of this source tree.
1726
+ *)
1727
+ */