better-react-email-editor 0.1.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +381 -0
  3. package/dist/index.cjs +2 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.js +4190 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/styles.css +1634 -0
  8. package/dist/types/components/BetterEmailEditor.d.ts +34 -0
  9. package/dist/types/components/BlockProperties.d.ts +7 -0
  10. package/dist/types/components/BlocksTab.d.ts +13 -0
  11. package/dist/types/components/BodyTab.d.ts +9 -0
  12. package/dist/types/components/Canvas.d.ts +15 -0
  13. package/dist/types/components/CanvasOverlay.d.ts +10 -0
  14. package/dist/types/components/ContentPanel.d.ts +19 -0
  15. package/dist/types/components/ContentTab.d.ts +17 -0
  16. package/dist/types/components/LayersPanel.d.ts +9 -0
  17. package/dist/types/components/PreviewDialog.d.ts +15 -0
  18. package/dist/types/components/PropertiesPanel.d.ts +12 -0
  19. package/dist/types/components/Sidebar.d.ts +14 -0
  20. package/dist/types/components/TextProperties.d.ts +7 -0
  21. package/dist/types/components/TopBar.d.ts +37 -0
  22. package/dist/types/components/fields.d.ts +103 -0
  23. package/dist/types/components/icons.d.ts +21 -0
  24. package/dist/types/components/inspectors/ButtonInspector.d.ts +2 -0
  25. package/dist/types/components/inspectors/ColumnsInspector.d.ts +3 -0
  26. package/dist/types/components/inspectors/DefaultInspector.d.ts +3 -0
  27. package/dist/types/components/inspectors/HeadingInspector.d.ts +2 -0
  28. package/dist/types/components/inspectors/ImageInspector.d.ts +2 -0
  29. package/dist/types/components/inspectors/SimpleInspectors.d.ts +6 -0
  30. package/dist/types/components/inspectors/SocialLinksInspector.d.ts +2 -0
  31. package/dist/types/components/inspectors/groups.d.ts +22 -0
  32. package/dist/types/components/useDraggableBlock.d.ts +17 -0
  33. package/dist/types/context.d.ts +115 -0
  34. package/dist/types/core/content.d.ts +28 -0
  35. package/dist/types/core/cx.d.ts +8 -0
  36. package/dist/types/core/dnd.d.ts +73 -0
  37. package/dist/types/core/layers.d.ts +27 -0
  38. package/dist/types/core/paste-handler.d.ts +9 -0
  39. package/dist/types/core/paste.d.ts +22 -0
  40. package/dist/types/core/stores.d.ts +19 -0
  41. package/dist/types/core/style-utils.d.ts +3 -0
  42. package/dist/types/i18n/en.d.ts +247 -0
  43. package/dist/types/i18n/fr.d.ts +3 -0
  44. package/dist/types/i18n/index.d.ts +509 -0
  45. package/dist/types/index.d.ts +37 -0
  46. package/dist/types/nodes/custom-nodes.d.ts +19 -0
  47. package/dist/types/registry/default-nodes.d.ts +7 -0
  48. package/dist/types/registry/default-palette.d.ts +7 -0
  49. package/dist/types/registry/default-templates.d.ts +10 -0
  50. package/dist/types/registry/types.d.ts +56 -0
  51. package/package.json +89 -0
package/dist/index.js ADDED
@@ -0,0 +1,4190 @@
1
+ import { createContext as e, forwardRef as t, useCallback as n, useContext as r, useEffect as i, useImperativeHandle as a, useLayoutEffect as o, useMemo as s, useRef as c, useState as l, useSyncExternalStore as u } from "react";
2
+ import { Placeholder as d } from "@tiptap/extension-placeholder";
3
+ import { EditorContent as f, EditorContext as p, useEditor as m, useEditorState as h } from "@tiptap/react";
4
+ import { EmailNode as g, composeReactEmail as _ } from "@react-email/editor/core";
5
+ import { Button as v, StarterKit as y } from "@react-email/editor/extensions";
6
+ import { EmailTheming as b, extendTheme as x, useEditorImage as S } from "@react-email/editor/plugins";
7
+ import { Fragment as C } from "@tiptap/pm/model";
8
+ import { NodeSelection as w, Selection as T, TextSelection as E } from "@tiptap/pm/state";
9
+ import { generateJSON as D } from "@tiptap/html";
10
+ import { AlignCenterIcon as ee, AlignLeftIcon as O, AlignRightIcon as te, BoldIcon as ne, BubbleMenu as k, CodeIcon as re, Columns2Icon as ie, Columns3Icon as ae, Columns4Icon as oe, EditorFocusScope as A, Heading1Icon as j, ImageIcon as se, Inspector as M, ItalicIcon as ce, LayoutIcon as N, LinkIcon as le, ListIcon as ue, ListOrderedIcon as de, MinusIcon as fe, MousePointerClickIcon as pe, PanelLeftIcon as me, PanelTopIcon as he, PlusIcon as ge, SlashCommand as _e, SquareCodeIcon as ve, StrikethroughIcon as ye, TableIcon as be, TextQuoteIcon as P, TypeIcon as xe, UnderlineIcon as Se, XIcon as F, defaultSlashCommands as Ce } from "@react-email/editor/ui";
11
+ import { Fragment as I, jsx as L, jsxs as R } from "react/jsx-runtime";
12
+ import * as we from "@radix-ui/react-popover";
13
+ import { HexColorInput as Te, HexColorPicker as Ee } from "react-colorful";
14
+ import { mergeAttributes as De } from "@tiptap/core";
15
+ import { Column as Oe, Img as ke, Link as Ae, Row as je, Section as Me } from "react-email";
16
+ import { createPortal as Ne } from "react-dom";
17
+ //#region \0rolldown/runtime.js
18
+ var Pe = Object.defineProperty, Fe = (e, t) => {
19
+ let n = {};
20
+ for (var r in e) Pe(n, r, {
21
+ get: e[r],
22
+ enumerable: !0
23
+ });
24
+ return t || Pe(n, Symbol.toStringTag, { value: "Module" }), n;
25
+ };
26
+ //#endregion
27
+ //#region src/core/cx.ts
28
+ function z(...e) {
29
+ return e.filter(Boolean).join(" ");
30
+ }
31
+ //#endregion
32
+ //#region src/core/dnd.ts
33
+ var Ie = /* @__PURE__ */ new Set([
34
+ "container",
35
+ "section",
36
+ "columnsColumn"
37
+ ]), Le = /* @__PURE__ */ new Set([
38
+ "twoColumns",
39
+ "threeColumns",
40
+ "fourColumns"
41
+ ]), Re = "application/x-email-block";
42
+ function ze(e, t) {
43
+ let n = e.nodeDOM(t);
44
+ return n instanceof HTMLElement ? n.getBoundingClientRect() : null;
45
+ }
46
+ function Be(e, t, n) {
47
+ let r = [];
48
+ return t.forEach((t, i) => {
49
+ let a = n + 1 + i, o = ze(e, a);
50
+ o && r.push({
51
+ node: t,
52
+ pos: a,
53
+ rect: o
54
+ });
55
+ }), r;
56
+ }
57
+ function Ve(e) {
58
+ return e.type.name === "paragraph" && e.childCount === 0;
59
+ }
60
+ function He(e) {
61
+ let t = null;
62
+ return e.forEach((e, n) => {
63
+ !t && e.type.name === "container" && (t = {
64
+ node: e,
65
+ pos: n
66
+ });
67
+ }), t;
68
+ }
69
+ function Ue(e, t, n, r, i) {
70
+ let a = He(e.state.doc);
71
+ if (!a) return null;
72
+ let o = (e) => !!i && e >= i.from && e < i.to, s = (i, a) => {
73
+ let c = Be(e, i, a), l = ze(e, a);
74
+ if (!l) return null;
75
+ for (let r of c) {
76
+ let { rect: i } = r, a = Math.min(12, i.height / 4), c = n > i.top + a && n < i.bottom - a, l = t >= i.left && t <= i.right;
77
+ if (!c || !l || o(r.pos)) continue;
78
+ let u = r.node.type.name;
79
+ if (Ie.has(u)) {
80
+ let e = s(r.node, r.pos);
81
+ if (e) return e;
82
+ } else if (Le.has(u)) {
83
+ let n = Be(e, r.node, r.pos), i = n.find((e) => t >= e.rect.left && t <= e.rect.right) ?? (t < n[0]?.rect.left ? n[0] : n[n.length - 1]);
84
+ if (i && !o(i.pos)) {
85
+ let e = s(i.node, i.pos);
86
+ if (e) return e;
87
+ }
88
+ }
89
+ }
90
+ if (c.length === 1 && Ve(c[0].node) && !o(c[0].pos)) {
91
+ let e = c[0];
92
+ return i.type.validContent(r) ? {
93
+ pos: e.pos,
94
+ replaceTo: e.pos + e.node.nodeSize,
95
+ line: {
96
+ top: e.rect.top,
97
+ left: l.left,
98
+ width: l.width
99
+ },
100
+ emptyZone: {
101
+ top: l.top,
102
+ left: l.left,
103
+ width: l.width,
104
+ height: Math.max(l.height, 40)
105
+ }
106
+ } : null;
107
+ }
108
+ let u = c.length;
109
+ for (let e = 0; e < c.length; e++) {
110
+ let { rect: t } = c[e];
111
+ if (n < t.top + t.height / 2) {
112
+ u = e;
113
+ break;
114
+ }
115
+ }
116
+ let d = u, f = u < c.length ? ((e) => {
117
+ let t = 0, n = -1;
118
+ return i.forEach((r, i) => {
119
+ a + 1 + i === e && (n = t), t++;
120
+ }), n;
121
+ })(c[u].pos) : i.childCount;
122
+ if (!i.canReplace(f, f, r)) return null;
123
+ let p = d < c.length ? c[d].pos : a + i.nodeSize - 1, m;
124
+ return m = c.length === 0 ? l.top + 4 : d === 0 ? c[0].rect.top : d === c.length ? c[c.length - 1].rect.bottom : (c[d - 1].rect.bottom + c[d].rect.top) / 2, {
125
+ pos: p,
126
+ line: {
127
+ top: m,
128
+ left: l.left,
129
+ width: l.width
130
+ }
131
+ };
132
+ };
133
+ return s(a.node, a.pos);
134
+ }
135
+ function We(e, t) {
136
+ let { schema: n, doc: r } = e.state;
137
+ if (t.kind === "new") try {
138
+ return C.fromArray(t.content().map((e) => n.nodeFromJSON(e)));
139
+ } catch (e) {
140
+ return console.error("Invalid block content", e), null;
141
+ }
142
+ let i = r.nodeAt(t.pos);
143
+ return i ? C.from(i) : null;
144
+ }
145
+ function Ge(e, t) {
146
+ let n = e.doc.nodeAt(t);
147
+ n && (n.isAtom || n.type.name === "horizontalRule" ? e.setSelection(w.create(e.doc, t)) : e.setSelection(E.near(e.doc.resolve(t + 1))));
148
+ }
149
+ function Ke(e) {
150
+ let { selection: t, doc: n } = e.state;
151
+ t instanceof w && e.dispatch(e.state.tr.setSelection(T.near(n.resolve(t.from))));
152
+ }
153
+ function qe(e, t) {
154
+ if (t.replaceTo !== void 0) return t;
155
+ let n = e.resolve(t.pos), r = n.parent, i = r.lastChild;
156
+ return n.index() !== r.childCount || !i || r.childCount < 2 || !Ve(i) ? t : {
157
+ ...t,
158
+ pos: t.pos - i.nodeSize
159
+ };
160
+ }
161
+ function Je(e, t, n) {
162
+ let { view: r } = e;
163
+ Ke(r);
164
+ let i = We(r, t);
165
+ if (!i) return !1;
166
+ let a = qe(r.state.doc, n), o = r.state.tr;
167
+ if (t.kind === "new") a.replaceTo === void 0 ? o.insert(a.pos, i) : o.replaceWith(a.pos, a.replaceTo, i), Ge(o, a.pos);
168
+ else {
169
+ let e = r.state.doc.nodeAt(t.pos);
170
+ if (!e) return !1;
171
+ let n = t.pos, i = n + e.nodeSize;
172
+ if (a.replaceTo === void 0 && (a.pos === n || a.pos === i)) return !1;
173
+ Ye(o, n, i);
174
+ let s = o.mapping.map(a.pos, -1);
175
+ if (a.replaceTo !== void 0) {
176
+ let t = o.mapping.map(a.replaceTo, 1);
177
+ o.replaceWith(s, t, e);
178
+ } else o.insert(s, e);
179
+ Ge(o, s);
180
+ }
181
+ return r.dispatch(o.scrollIntoView()), r.focus(), !0;
182
+ }
183
+ function Ye(e, t, n) {
184
+ let r = e.doc.resolve(t).parent;
185
+ r.childCount === 1 && Ie.has(r.type.name) ? e.replaceWith(t, n, e.doc.type.schema.nodes.paragraph.create()) : e.delete(t, n);
186
+ }
187
+ function Xe(e, t, n = !0) {
188
+ if (t < 0 || t > e.content.size) return null;
189
+ let r = [], i = e.nodeAt(t);
190
+ n && i && r.push({
191
+ pos: t,
192
+ node: i
193
+ });
194
+ let a = e.resolve(t);
195
+ for (let e = a.depth; e > 0; e--) r.push({
196
+ pos: a.before(e),
197
+ node: a.node(e)
198
+ });
199
+ for (let t of r) {
200
+ let n = e.resolve(t.pos).parent.type.name;
201
+ if (Ie.has(n) || Le.has(n)) return t;
202
+ }
203
+ return null;
204
+ }
205
+ function Ze(e) {
206
+ return e.node.type.name === "columnsColumn";
207
+ }
208
+ function Qe(e, t) {
209
+ let n = e.resolve(t.pos);
210
+ for (let r = n.depth; r > 0; r--) {
211
+ let i = Xe(e, n.before(r));
212
+ if (i && i.pos !== t.pos) return i;
213
+ }
214
+ return null;
215
+ }
216
+ function $e(e) {
217
+ let { selection: t, doc: n } = e.state;
218
+ return t instanceof w ? Xe(n, t.from) ?? {
219
+ pos: t.from,
220
+ node: t.node
221
+ } : Xe(n, t.from, !1);
222
+ }
223
+ function et(e, t) {
224
+ let { view: n } = e, r = n.state.tr.setSelection(w.create(n.state.doc, t.pos));
225
+ n.dispatch(r), n.focus();
226
+ }
227
+ function tt(e, t) {
228
+ let { view: n } = e;
229
+ Ke(n);
230
+ let r = n.state.doc.nodeAt(t.pos);
231
+ if (!r) return;
232
+ let i = t.pos + r.nodeSize, a = n.state.tr.insert(i, r.copy(r.content));
233
+ a.setSelection(w.create(a.doc, i)), n.dispatch(a.scrollIntoView()), n.focus();
234
+ }
235
+ function nt(e, t) {
236
+ let { view: n } = e, r = n.state.doc.nodeAt(t.pos);
237
+ if (!r) return;
238
+ let i = n.state.tr;
239
+ Ye(i, t.pos, t.pos + r.nodeSize), n.dispatch(i);
240
+ }
241
+ function rt(e, t) {
242
+ let n = He(e.state.doc);
243
+ if (!n) return;
244
+ let r = n.node.lastChild, i = n.pos + n.node.nodeSize - 1;
245
+ Je(e, {
246
+ kind: "new",
247
+ label: "",
248
+ content: () => t
249
+ }, r && Ve(r) && n.node.childCount > 1 ? {
250
+ pos: i - r.nodeSize,
251
+ replaceTo: i,
252
+ line: {
253
+ top: 0,
254
+ left: 0,
255
+ width: 0
256
+ }
257
+ } : {
258
+ pos: i,
259
+ line: {
260
+ top: 0,
261
+ left: 0,
262
+ width: 0
263
+ }
264
+ });
265
+ }
266
+ //#endregion
267
+ //#region src/core/paste.ts
268
+ var it = v.extend({ parseHTML() {
269
+ return [{
270
+ tag: "a[data-id=\"react-email-button\"]",
271
+ getAttrs: (e) => {
272
+ if (typeof e == "string") return !1;
273
+ let t = e, n = t.parentElement?.className.match(/align-(left|center|right)/)?.[1], r = t.className.replace(/\bnode-button\b/g, "").trim();
274
+ return {
275
+ href: t.getAttribute("href") ?? t.dataset.href ?? "#",
276
+ alignment: n ?? "left",
277
+ class: r || "button",
278
+ style: t.getAttribute("style")
279
+ };
280
+ }
281
+ }];
282
+ } });
283
+ function at(e, t) {
284
+ let n = t.clipboardData?.getData("text/html") ?? "", r = n.includes("data-pm-slice");
285
+ if ((t.clipboardData?.files?.length ?? 0) > 0) return !1;
286
+ let { view: i } = e, { state: a } = i, { selection: o } = a;
287
+ if (o instanceof w && o.node.isBlock) {
288
+ let e = o.node, t = e.type.name === "columnsColumn" ? o.from + e.nodeSize - 1 : o.from + e.nodeSize, n = a.doc.resolve(t), r = a.schema.nodes.paragraph;
289
+ if (Le.has(n.parent.type.name) || !n.parent.canReplaceWith(n.index(), n.index(), r)) return !1;
290
+ i.dispatch(a.tr.setSelection(E.near(n)));
291
+ let s = i.state.tr.insert(t, r.create());
292
+ s.setSelection(E.create(s.doc, t + 1)), i.dispatch(s);
293
+ }
294
+ return r ? (t.preventDefault(), t.stopPropagation(), i.pasteHTML(n), !0) : !1;
295
+ }
296
+ //#endregion
297
+ //#region src/core/paste-handler.ts
298
+ var ot = /class="[^"]*node-/, st = [
299
+ "script",
300
+ "iframe",
301
+ "object",
302
+ "embed",
303
+ "meta",
304
+ "base"
305
+ ], ct = ["href", "src"], lt = {
306
+ a: [
307
+ "href",
308
+ "target",
309
+ "rel"
310
+ ],
311
+ img: [
312
+ "src",
313
+ "alt",
314
+ "width",
315
+ "height"
316
+ ],
317
+ td: ["colspan", "rowspan"],
318
+ th: [
319
+ "colspan",
320
+ "rowspan",
321
+ "scope"
322
+ ],
323
+ table: [
324
+ "border",
325
+ "cellpadding",
326
+ "cellspacing"
327
+ ],
328
+ "*": ["id"]
329
+ };
330
+ function ut(e, t) {
331
+ let n = e.trim().toLowerCase();
332
+ return n.startsWith("javascript:") || n.startsWith("vbscript:") ? !1 : !n.startsWith("data:") || t && n.startsWith("data:image/");
333
+ }
334
+ function dt(e) {
335
+ let t = /* @__PURE__ */ new Set([...lt[e.tagName.toLowerCase()] ?? [], ...lt["*"]]);
336
+ for (let n of Array.from(e.attributes)) (n.name.startsWith("data-") || !t.has(n.name)) && e.removeAttribute(n.name);
337
+ }
338
+ function ft(e) {
339
+ e.nodeType === Node.ELEMENT_NODE && dt(e);
340
+ for (let t of Array.from(e.childNodes)) ft(t);
341
+ }
342
+ function pt(e) {
343
+ let t = new DOMParser().parseFromString(e, "text/html");
344
+ for (let e of st) for (let n of Array.from(t.body.getElementsByTagName(e))) n.remove();
345
+ for (let e of Array.from(t.body.querySelectorAll("[href], [src]"))) {
346
+ let t = e.tagName.toLowerCase() === "img";
347
+ for (let n of ct) {
348
+ let r = e.getAttribute(n);
349
+ r !== null && !ut(r, t) && e.removeAttribute(n);
350
+ }
351
+ }
352
+ return ot.test(e) || ft(t.body), t.body.innerHTML;
353
+ }
354
+ function mt(e) {
355
+ return (t, n, r) => {
356
+ if (r.content.childCount === 1) return !1;
357
+ let i = n.clipboardData?.getData?.("text/html");
358
+ if (!i) return !1;
359
+ n.preventDefault();
360
+ let a = D(pt(i), e), o = t.state.schema.nodeFromJSON(a);
361
+ return t.dispatch(t.state.tr.replaceSelectionWith(o, !1)), !0;
362
+ };
363
+ }
364
+ //#endregion
365
+ //#region src/core/stores.ts
366
+ function ht() {
367
+ let e = null;
368
+ return {
369
+ get: () => e,
370
+ start: (t) => {
371
+ e = t;
372
+ },
373
+ end: () => {
374
+ e = null;
375
+ }
376
+ };
377
+ }
378
+ function gt() {
379
+ let e = null, t = /* @__PURE__ */ new Set();
380
+ return {
381
+ get: () => e,
382
+ set: (n) => {
383
+ if (n !== e) {
384
+ e = n;
385
+ for (let e of t) e();
386
+ }
387
+ },
388
+ subscribe: (e) => (t.add(e), () => {
389
+ t.delete(e);
390
+ })
391
+ };
392
+ }
393
+ //#endregion
394
+ //#region src/i18n/en.ts
395
+ var _t = {
396
+ topBar: {
397
+ layers: "Layers",
398
+ toggleLayers: "Show / hide layers",
399
+ undo: "Undo (Ctrl+Z)",
400
+ redo: "Redo (Ctrl+Y)",
401
+ canvasWidth: "Canvas width",
402
+ desktop: "Desktop",
403
+ mobile: "Mobile",
404
+ template: "Template",
405
+ confirmTemplate: "Replace the content with the starter template?",
406
+ import: "Import",
407
+ exportJson: "Save JSON",
408
+ preview: "Preview",
409
+ exportHtml: "Export HTML",
410
+ invalidFile: (e) => `Invalid file: ${e}`
411
+ },
412
+ preview: {
413
+ dialogLabel: "Preview and export",
414
+ desktop: "Desktop",
415
+ mobile: "Mobile",
416
+ html: "HTML",
417
+ text: "Plain text",
418
+ copy: "Copy",
419
+ copied: "Copied ✓",
420
+ download: "Download .html",
421
+ close: "Close",
422
+ rendering: "Rendering the email…",
423
+ renderError: (e) => `Render error: ${e}`,
424
+ iframeTitle: "Email preview"
425
+ },
426
+ sidebar: {
427
+ label: "Side panel",
428
+ tabContent: "Content",
429
+ tabBlocks: "Blocks",
430
+ tabBody: "Body",
431
+ layoutTitle: "Layout",
432
+ contentTitle: "Content",
433
+ dragHint: "Drag an item into the email. A click adds it at the end.",
434
+ tileTitle: (e) => `Drag “${e}” into the email (or click to add it at the end)`,
435
+ propertiesEyebrow: "Properties",
436
+ closeProperties: "Close (back to content)",
437
+ breadcrumb: "Hierarchy",
438
+ selectedText: "Selected text"
439
+ },
440
+ body: {
441
+ general: "General",
442
+ previewText: "Preview text",
443
+ previewTextPlaceholder: "Shown after the subject line in the inbox",
444
+ background: "Background",
445
+ backgroundColor: "Background color",
446
+ outerPadding: "Outer padding",
447
+ content: "Content",
448
+ width: "Width",
449
+ contentColor: "Content color",
450
+ innerPadding: "Inner padding",
451
+ radius: "Corner radius",
452
+ defaultStyles: "Default styles",
453
+ text: "Text",
454
+ headings: "Headings",
455
+ links: "Links",
456
+ buttonBackground: "Button background",
457
+ buttonText: "Button text"
458
+ },
459
+ inspector: {
460
+ typography: "Typography",
461
+ color: "Color",
462
+ size: "Size",
463
+ weight: "Weight",
464
+ weightLight: "Light",
465
+ weightNormal: "Normal",
466
+ weightSemibold: "Semibold",
467
+ weightBold: "Bold",
468
+ weightExtrabold: "Extra bold",
469
+ lineHeight: "Line height",
470
+ alignment: "Alignment",
471
+ spacing: "Spacing",
472
+ padding: "Padding",
473
+ box: "Background & border",
474
+ backgroundColor: "Background color",
475
+ radius: "Corner radius",
476
+ border: "Border",
477
+ borderColor: "Border color",
478
+ image: "Image",
479
+ uploadImage: "Upload an image…",
480
+ imageUrl: "Image URL",
481
+ altText: "Alt text",
482
+ altPlaceholder: "Describe the image",
483
+ layout: "Layout",
484
+ autoWidth: "Auto width",
485
+ width: "Width",
486
+ action: "Action",
487
+ clickLink: "Link on click",
488
+ linkUrl: "Link URL",
489
+ button: "Button",
490
+ textColor: "Text color",
491
+ textSize: "Text size",
492
+ buttonPadding: "Button padding",
493
+ networks: "Networks",
494
+ removeNetwork: "Remove",
495
+ addNetwork: "+ Add a network",
496
+ appearance: "Appearance",
497
+ iconSize: "Icon size",
498
+ gap: "Spacing",
499
+ columns: "Columns",
500
+ distribution: "Distribution",
501
+ equal: "Equal",
502
+ columnGap: "Gap between columns",
503
+ columnsHint: "Click inside a column to set its background and padding.",
504
+ spacer: "Spacer",
505
+ height: "Height",
506
+ htmlCode: "HTML code",
507
+ htmlHint: "The HTML is inserted as is in the exported email.",
508
+ line: "Line",
509
+ thickness: "Thickness",
510
+ lineStyle: "Style",
511
+ heading: "Heading",
512
+ level: "Level",
513
+ formatting: "Formatting",
514
+ bold: "Bold",
515
+ italic: "Italic",
516
+ underline: "Underline",
517
+ strike: "Strikethrough",
518
+ link: "Link",
519
+ url: "URL",
520
+ linkColor: "Link color"
521
+ },
522
+ fields: {
523
+ colorDefault: "Default",
524
+ chooseColor: (e) => `Pick a color (${e})`,
525
+ hexCode: "Hex code",
526
+ eyedropper: "Eyedropper: pick a color on screen",
527
+ documentColors: "Document colors",
528
+ palette: "Palette",
529
+ resetColor: "Reset to default",
530
+ alignLeft: "Left",
531
+ alignCenter: "Center",
532
+ alignRight: "Right",
533
+ top: "Top",
534
+ right: "Right",
535
+ bottom: "Bottom",
536
+ left: "Left",
537
+ moreOptions: "More options",
538
+ auto: "auto"
539
+ },
540
+ layers: {
541
+ title: "Layers",
542
+ expandAll: "Expand all",
543
+ collapseAll: "Collapse all",
544
+ close: "Close layers",
545
+ tree: "Email structure",
546
+ emptyEmail: "The email is empty.",
547
+ emptyZone: "Empty — drop content here",
548
+ column: (e) => `Column ${e}`,
549
+ fixedHint: "Columns stay in their row",
550
+ itemHint: "Click to select, drag to move",
551
+ expand: "Expand",
552
+ collapse: "Collapse",
553
+ uploadedImage: "uploaded image",
554
+ empty: "empty"
555
+ },
556
+ canvas: {
557
+ dropHere: "Drop here",
558
+ dropLabel: (e) => e ? `Drop “${e}” here` : "Drop here",
559
+ emptyZone: "Drag content here",
560
+ move: "Drag to move",
561
+ moveLabel: (e) => `Move: ${e}`,
562
+ selectParent: (e) => `Select: ${e}`,
563
+ duplicate: "Duplicate",
564
+ delete: "Delete"
565
+ },
566
+ placeholder: {
567
+ heading: "Heading",
568
+ paragraph: "Write, or type “/” for commands"
569
+ },
570
+ nodes: {
571
+ body: "Body",
572
+ paragraph: "Text",
573
+ heading: "Heading",
574
+ image: "Image",
575
+ button: "Button",
576
+ horizontalRule: "Divider",
577
+ spacer: "Spacer",
578
+ socialLinks: "Social links",
579
+ htmlBlock: "HTML",
580
+ section: "Section",
581
+ twoColumns: "Row · 2 columns",
582
+ threeColumns: "Row · 3 columns",
583
+ fourColumns: "Row · 4 columns",
584
+ columnsColumn: "Column",
585
+ bulletList: "List",
586
+ orderedList: "Numbered list",
587
+ listItem: "List item",
588
+ blockquote: "Quote",
589
+ codeBlock: "Code",
590
+ table: "Table",
591
+ container: "Email"
592
+ },
593
+ palette: {
594
+ oneColumn: "1 column",
595
+ twoColumns: "2 columns",
596
+ threeColumns: "3 columns",
597
+ fourColumns: "4 columns",
598
+ heading: "Heading",
599
+ text: "Text",
600
+ button: "Button",
601
+ image: "Image",
602
+ divider: "Divider",
603
+ spacer: "Spacer",
604
+ social: "Social",
605
+ menu: "Menu",
606
+ list: "List",
607
+ quote: "Quote",
608
+ html: "HTML",
609
+ card: "Card"
610
+ },
611
+ templates: {
612
+ header: "Header",
613
+ headerDescription: "Logo on the left, menu on the right",
614
+ hero: "Hero",
615
+ heroDescription: "Big heading, tagline and button",
616
+ products: "Products",
617
+ productsDescription: "Two product cards side by side",
618
+ features: "Features",
619
+ featuresDescription: "Three columns with heading + text",
620
+ testimonial: "Testimonial",
621
+ testimonialDescription: "Highlighted customer quote",
622
+ footer: "Footer",
623
+ footerDescription: "Social links, address and unsubscribe"
624
+ },
625
+ content: {
626
+ heading: "Your heading here",
627
+ text: "This is a new text block. Click it to edit the content, select text to format it.",
628
+ button: "Click here",
629
+ image: "Image",
630
+ menuHome: "Home",
631
+ menuShop: "Shop",
632
+ menuBlog: "Blog",
633
+ menuContact: "Contact",
634
+ listItems: [
635
+ "First item",
636
+ "Second item",
637
+ "Third item"
638
+ ],
639
+ quote: "“A quote that highlights your message.”",
640
+ html: "<p style=\"margin:0;text-align:center;font-family:sans-serif\">Your custom <strong>HTML</strong></p>",
641
+ cardTitle: "Did you know?",
642
+ cardText: "A card draws attention to an important piece of information.",
643
+ logo: "LOGO",
644
+ heroTitle: "What’s new this season",
645
+ heroText: "Discover our selection made for you, available today.",
646
+ heroButton: "Discover",
647
+ productA: "Product A",
648
+ productB: "Product B",
649
+ productText: "A short description of the product.",
650
+ productButton: "Buy",
651
+ features: [
652
+ "Free shipping",
653
+ "Free returns",
654
+ "24/7 support"
655
+ ],
656
+ featureText: "A clear and concise argument.",
657
+ testimonialQuote: "“Flawless service, I recommend it with my eyes closed.”",
658
+ testimonialAuthor: "— Camille, customer since 2021",
659
+ footerAddress: "Acme Inc. · 10 Main Street, Springfield",
660
+ unsubscribe: "Unsubscribe",
661
+ starterTitle: "Our favourites"
662
+ },
663
+ slashCommands: {}
664
+ }, vt = {
665
+ topBar: {
666
+ layers: "Calques",
667
+ toggleLayers: "Afficher / masquer les calques",
668
+ undo: "Annuler (Ctrl+Z)",
669
+ redo: "Rétablir (Ctrl+Y)",
670
+ canvasWidth: "Largeur du canvas",
671
+ desktop: "Bureau",
672
+ mobile: "Mobile",
673
+ template: "Modèle",
674
+ confirmTemplate: "Remplacer le contenu par le modèle de départ ?",
675
+ import: "Importer",
676
+ exportJson: "Enregistrer JSON",
677
+ preview: "Aperçu",
678
+ exportHtml: "Exporter HTML",
679
+ invalidFile: (e) => `Fichier invalide : ${e}`
680
+ },
681
+ preview: {
682
+ dialogLabel: "Aperçu et export",
683
+ desktop: "Bureau",
684
+ mobile: "Mobile",
685
+ html: "HTML",
686
+ text: "Texte brut",
687
+ copy: "Copier",
688
+ copied: "Copié ✓",
689
+ download: "Télécharger .html",
690
+ close: "Fermer",
691
+ rendering: "Rendu de l’email…",
692
+ renderError: (e) => `Erreur de rendu : ${e}`,
693
+ iframeTitle: "Aperçu de l’email"
694
+ },
695
+ sidebar: {
696
+ label: "Panneau latéral",
697
+ tabContent: "Contenu",
698
+ tabBlocks: "Blocs",
699
+ tabBody: "Corps",
700
+ layoutTitle: "Mise en page",
701
+ contentTitle: "Contenus",
702
+ dragHint: "Glissez un élément dans l’email. Un clic l’ajoute à la fin.",
703
+ tileTitle: (e) => `Glissez « ${e} » dans l’email (ou cliquez pour l’ajouter à la fin)`,
704
+ propertiesEyebrow: "Propriétés",
705
+ closeProperties: "Fermer (retour aux contenus)",
706
+ breadcrumb: "Hiérarchie",
707
+ selectedText: "Texte sélectionné"
708
+ },
709
+ body: {
710
+ general: "Général",
711
+ previewText: "Texte d’aperçu",
712
+ previewTextPlaceholder: "Affiché après l’objet dans la boîte de réception",
713
+ background: "Arrière-plan",
714
+ backgroundColor: "Couleur de fond",
715
+ outerPadding: "Marge extérieure",
716
+ content: "Contenu",
717
+ width: "Largeur",
718
+ contentColor: "Couleur du contenu",
719
+ innerPadding: "Marge intérieure",
720
+ radius: "Arrondi",
721
+ defaultStyles: "Styles par défaut",
722
+ text: "Texte",
723
+ headings: "Titres",
724
+ links: "Liens",
725
+ buttonBackground: "Fond des boutons",
726
+ buttonText: "Texte des boutons"
727
+ },
728
+ inspector: {
729
+ typography: "Typographie",
730
+ color: "Couleur",
731
+ size: "Taille",
732
+ weight: "Graisse",
733
+ weightLight: "Fin",
734
+ weightNormal: "Normal",
735
+ weightSemibold: "Semi-gras",
736
+ weightBold: "Gras",
737
+ weightExtrabold: "Extra-gras",
738
+ lineHeight: "Interligne",
739
+ alignment: "Alignement",
740
+ spacing: "Espacement",
741
+ padding: "Marge intérieure",
742
+ box: "Fond et bordure",
743
+ backgroundColor: "Couleur de fond",
744
+ radius: "Arrondi",
745
+ border: "Bordure",
746
+ borderColor: "Couleur de bordure",
747
+ image: "Image",
748
+ uploadImage: "Importer une image…",
749
+ imageUrl: "URL de l’image",
750
+ altText: "Texte alternatif",
751
+ altPlaceholder: "Décrivez l’image",
752
+ layout: "Disposition",
753
+ autoWidth: "Largeur auto",
754
+ width: "Largeur",
755
+ action: "Action",
756
+ clickLink: "Lien au clic",
757
+ linkUrl: "URL du lien",
758
+ button: "Bouton",
759
+ textColor: "Couleur du texte",
760
+ textSize: "Taille du texte",
761
+ buttonPadding: "Marges du bouton",
762
+ networks: "Réseaux",
763
+ removeNetwork: "Retirer",
764
+ addNetwork: "+ Ajouter un réseau",
765
+ appearance: "Apparence",
766
+ iconSize: "Taille des icônes",
767
+ gap: "Espacement",
768
+ columns: "Colonnes",
769
+ distribution: "Répartition",
770
+ equal: "Égales",
771
+ columnGap: "Espace entre colonnes",
772
+ columnsHint: "Cliquez dans une colonne pour régler son fond et ses marges.",
773
+ spacer: "Espacement",
774
+ height: "Hauteur",
775
+ htmlCode: "Code HTML",
776
+ htmlHint: "Le HTML est inséré tel quel dans l’email exporté.",
777
+ line: "Ligne",
778
+ thickness: "Épaisseur",
779
+ lineStyle: "Style",
780
+ heading: "Titre",
781
+ level: "Niveau",
782
+ formatting: "Mise en forme",
783
+ bold: "Gras",
784
+ italic: "Italique",
785
+ underline: "Souligné",
786
+ strike: "Barré",
787
+ link: "Lien",
788
+ url: "URL",
789
+ linkColor: "Couleur du lien"
790
+ },
791
+ fields: {
792
+ colorDefault: "Par défaut",
793
+ chooseColor: (e) => `Choisir une couleur (${e})`,
794
+ hexCode: "Code hexadécimal",
795
+ eyedropper: "Pipette : prendre une couleur à l’écran",
796
+ documentColors: "Couleurs du document",
797
+ palette: "Palette",
798
+ resetColor: "Revenir à la valeur par défaut",
799
+ alignLeft: "Gauche",
800
+ alignCenter: "Centre",
801
+ alignRight: "Droite",
802
+ top: "Haut",
803
+ right: "Droite",
804
+ bottom: "Bas",
805
+ left: "Gauche",
806
+ moreOptions: "Plus d’options",
807
+ auto: "auto"
808
+ },
809
+ layers: {
810
+ title: "Calques",
811
+ expandAll: "Tout déplier",
812
+ collapseAll: "Tout replier",
813
+ close: "Fermer les calques",
814
+ tree: "Structure de l’email",
815
+ emptyEmail: "L’email est vide.",
816
+ emptyZone: "Vide — déposez du contenu ici",
817
+ column: (e) => `Colonne ${e}`,
818
+ fixedHint: "Les colonnes restent dans leur ligne",
819
+ itemHint: "Cliquer pour sélectionner, glisser pour déplacer",
820
+ expand: "Déplier",
821
+ collapse: "Replier",
822
+ uploadedImage: "image importée",
823
+ empty: "vide"
824
+ },
825
+ canvas: {
826
+ dropHere: "Déposer ici",
827
+ dropLabel: (e) => e ? `Déposer « ${e} » ici` : "Déposer ici",
828
+ emptyZone: "Glissez du contenu ici",
829
+ move: "Glisser pour déplacer",
830
+ moveLabel: (e) => `Déplacer : ${e}`,
831
+ selectParent: (e) => `Sélectionner : ${e}`,
832
+ duplicate: "Dupliquer",
833
+ delete: "Supprimer"
834
+ },
835
+ placeholder: {
836
+ heading: "Titre",
837
+ paragraph: "Écrivez, ou tapez « / » pour les commandes"
838
+ },
839
+ nodes: {
840
+ body: "Corps",
841
+ paragraph: "Texte",
842
+ heading: "Titre",
843
+ image: "Image",
844
+ button: "Bouton",
845
+ horizontalRule: "Séparateur",
846
+ spacer: "Espacement",
847
+ socialLinks: "Réseaux sociaux",
848
+ htmlBlock: "HTML",
849
+ section: "Section",
850
+ twoColumns: "Ligne · 2 colonnes",
851
+ threeColumns: "Ligne · 3 colonnes",
852
+ fourColumns: "Ligne · 4 colonnes",
853
+ columnsColumn: "Colonne",
854
+ bulletList: "Liste",
855
+ orderedList: "Liste numérotée",
856
+ listItem: "Élément de liste",
857
+ blockquote: "Citation",
858
+ codeBlock: "Code",
859
+ table: "Tableau",
860
+ container: "Email"
861
+ },
862
+ palette: {
863
+ oneColumn: "1 colonne",
864
+ twoColumns: "2 colonnes",
865
+ threeColumns: "3 colonnes",
866
+ fourColumns: "4 colonnes",
867
+ heading: "Titre",
868
+ text: "Texte",
869
+ button: "Bouton",
870
+ image: "Image",
871
+ divider: "Séparateur",
872
+ spacer: "Espacement",
873
+ social: "Réseaux",
874
+ menu: "Menu",
875
+ list: "Liste",
876
+ quote: "Citation",
877
+ html: "HTML",
878
+ card: "Encadré"
879
+ },
880
+ templates: {
881
+ header: "En-tête",
882
+ headerDescription: "Logo à gauche, menu à droite",
883
+ hero: "Hero",
884
+ heroDescription: "Grand titre, accroche et bouton",
885
+ products: "Produits",
886
+ productsDescription: "Deux cartes produit côte à côte",
887
+ features: "Avantages",
888
+ featuresDescription: "Trois colonnes titre + texte",
889
+ testimonial: "Témoignage",
890
+ testimonialDescription: "Citation client mise en avant",
891
+ footer: "Pied de page",
892
+ footerDescription: "Réseaux sociaux, adresse et désinscription"
893
+ },
894
+ content: {
895
+ heading: "Votre titre ici",
896
+ text: "Ceci est un nouveau bloc de texte. Cliquez dessus pour modifier le contenu, sélectionnez du texte pour le mettre en forme.",
897
+ button: "Cliquez ici",
898
+ image: "Image",
899
+ menuHome: "Accueil",
900
+ menuShop: "Boutique",
901
+ menuBlog: "Blog",
902
+ menuContact: "Contact",
903
+ listItems: [
904
+ "Premier point",
905
+ "Deuxième point",
906
+ "Troisième point"
907
+ ],
908
+ quote: "« Une citation qui met en valeur votre message. »",
909
+ html: "<p style=\"margin:0;text-align:center;font-family:sans-serif\">Votre <strong>HTML</strong> personnalisé</p>",
910
+ cardTitle: "Le saviez-vous ?",
911
+ cardText: "Un encadré attire l’œil sur une information importante.",
912
+ logo: "LOGO",
913
+ heroTitle: "Les nouveautés de la saison",
914
+ heroText: "Découvrez notre sélection pensée pour vous, disponible dès aujourd’hui.",
915
+ heroButton: "Découvrir",
916
+ productA: "Produit A",
917
+ productB: "Produit B",
918
+ productText: "Une courte description du produit.",
919
+ productButton: "Acheter",
920
+ features: [
921
+ "Livraison offerte",
922
+ "Retours gratuits",
923
+ "Support 7j/7"
924
+ ],
925
+ featureText: "Un argument clair et concis.",
926
+ testimonialQuote: "« Service impeccable, je recommande les yeux fermés. »",
927
+ testimonialAuthor: "— Camille, cliente depuis 2021",
928
+ footerAddress: "Acme SAS · 10 rue de la Paix, 75002 Paris",
929
+ unsubscribe: "Se désinscrire",
930
+ starterTitle: "Nos coups de cœur"
931
+ },
932
+ slashCommands: {
933
+ Text: {
934
+ title: "Texte",
935
+ description: "Paragraphe simple"
936
+ },
937
+ Title: {
938
+ title: "Titre",
939
+ description: "Grand titre"
940
+ },
941
+ Subtitle: {
942
+ title: "Sous-titre",
943
+ description: "Titre moyen"
944
+ },
945
+ Heading: {
946
+ title: "Intertitre",
947
+ description: "Petit titre"
948
+ },
949
+ "Bullet list": {
950
+ title: "Liste à puces",
951
+ description: "Liste non ordonnée"
952
+ },
953
+ "Numbered list": {
954
+ title: "Liste numérotée",
955
+ description: "Liste ordonnée"
956
+ },
957
+ Quote: {
958
+ title: "Citation",
959
+ description: "Bloc de citation"
960
+ },
961
+ "Code block": {
962
+ title: "Bloc de code",
963
+ description: "Extrait de code"
964
+ },
965
+ Button: {
966
+ title: "Bouton",
967
+ description: "Bouton cliquable"
968
+ },
969
+ Divider: {
970
+ title: "Séparateur",
971
+ description: "Ligne horizontale"
972
+ },
973
+ Section: {
974
+ title: "Section",
975
+ description: "Section de contenu"
976
+ },
977
+ "2 columns": {
978
+ title: "2 colonnes",
979
+ description: "Mise en page sur deux colonnes"
980
+ },
981
+ "3 columns": {
982
+ title: "3 colonnes",
983
+ description: "Mise en page sur trois colonnes"
984
+ },
985
+ "4 columns": {
986
+ title: "4 colonnes",
987
+ description: "Mise en page sur quatre colonnes"
988
+ }
989
+ }
990
+ }, yt = {
991
+ en: _t,
992
+ fr: vt
993
+ };
994
+ function bt(e, t) {
995
+ return typeof e == "function" ? e(t) : e;
996
+ }
997
+ function xt(e) {
998
+ return typeof e == "object" && !!e && !Array.isArray(e);
999
+ }
1000
+ function St(e, t) {
1001
+ if (!xt(t) || !xt(e)) return t ?? e;
1002
+ let n = { ...e };
1003
+ for (let [e, r] of Object.entries(t)) r !== void 0 && (n[e] = xt(r) && xt(n[e]) ? St(n[e], r) : r);
1004
+ return n;
1005
+ }
1006
+ function Ct(e, t) {
1007
+ let n = yt[e] ?? _t;
1008
+ return t ? St(n, t) : n;
1009
+ }
1010
+ //#endregion
1011
+ //#region src/components/icons.tsx
1012
+ var wt = /* @__PURE__ */ Fe({
1013
+ CopyIcon: () => Et,
1014
+ DesktopIcon: () => jt,
1015
+ GripIcon: () => Tt,
1016
+ LayersIcon: () => Nt,
1017
+ MobileIcon: () => Mt,
1018
+ OneColumnIcon: () => Rt,
1019
+ ParentIcon: () => Ot,
1020
+ PipetteIcon: () => Pt,
1021
+ RedoIcon: () => At,
1022
+ SocialIcon: () => Lt,
1023
+ SpacerIcon: () => Ft,
1024
+ SpacerTileIcon: () => It,
1025
+ TrashIcon: () => Dt,
1026
+ UndoIcon: () => kt
1027
+ }), B = (e, t = 2) => ({
1028
+ viewBox: "0 0 24 24",
1029
+ width: e,
1030
+ height: e,
1031
+ fill: "none",
1032
+ stroke: "currentColor",
1033
+ strokeWidth: t,
1034
+ strokeLinecap: "round",
1035
+ strokeLinejoin: "round",
1036
+ "aria-hidden": !0
1037
+ }), Tt = ({ size: e = 14 }) => /* @__PURE__ */ L("svg", {
1038
+ viewBox: "0 0 24 24",
1039
+ width: e,
1040
+ height: e,
1041
+ fill: "currentColor",
1042
+ "aria-hidden": !0,
1043
+ children: [
1044
+ 6,
1045
+ 12,
1046
+ 18
1047
+ ].map((e) => /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ L("circle", {
1048
+ cx: "9",
1049
+ cy: e,
1050
+ r: "1.6"
1051
+ }), /* @__PURE__ */ L("circle", {
1052
+ cx: "15",
1053
+ cy: e,
1054
+ r: "1.6"
1055
+ })] }, e))
1056
+ }), Et = ({ size: e = 14 }) => /* @__PURE__ */ R("svg", {
1057
+ ...B(e),
1058
+ children: [/* @__PURE__ */ L("rect", {
1059
+ x: "8",
1060
+ y: "8",
1061
+ width: "12",
1062
+ height: "12",
1063
+ rx: "2"
1064
+ }), /* @__PURE__ */ L("path", { d: "M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2" })]
1065
+ }), Dt = ({ size: e = 14 }) => /* @__PURE__ */ L("svg", {
1066
+ ...B(e),
1067
+ children: /* @__PURE__ */ L("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-12M9 7V4h6v3" })
1068
+ }), Ot = ({ size: e = 14 }) => /* @__PURE__ */ L("svg", {
1069
+ ...B(e),
1070
+ children: /* @__PURE__ */ L("path", { d: "M12 19V5M6 11l6-6 6 6" })
1071
+ }), kt = ({ size: e = 16 }) => /* @__PURE__ */ R("svg", {
1072
+ ...B(e),
1073
+ children: [/* @__PURE__ */ L("path", { d: "M9 14 4 9l5-5" }), /* @__PURE__ */ L("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 0 11H11" })]
1074
+ }), At = ({ size: e = 16 }) => /* @__PURE__ */ R("svg", {
1075
+ ...B(e),
1076
+ children: [/* @__PURE__ */ L("path", { d: "m15 14 5-5-5-5" }), /* @__PURE__ */ L("path", { d: "M20 9H9.5a5.5 5.5 0 0 0 0 11H13" })]
1077
+ }), jt = ({ size: e = 16 }) => /* @__PURE__ */ R("svg", {
1078
+ ...B(e),
1079
+ children: [/* @__PURE__ */ L("rect", {
1080
+ x: "3",
1081
+ y: "4",
1082
+ width: "18",
1083
+ height: "12",
1084
+ rx: "2"
1085
+ }), /* @__PURE__ */ L("path", { d: "M8 20h8M12 16v4" })]
1086
+ }), Mt = ({ size: e = 16 }) => /* @__PURE__ */ R("svg", {
1087
+ ...B(e),
1088
+ children: [/* @__PURE__ */ L("rect", {
1089
+ x: "7",
1090
+ y: "2",
1091
+ width: "10",
1092
+ height: "20",
1093
+ rx: "2"
1094
+ }), /* @__PURE__ */ L("path", { d: "M11 18h2" })]
1095
+ }), Nt = ({ size: e = 16 }) => /* @__PURE__ */ R("svg", {
1096
+ ...B(e),
1097
+ children: [/* @__PURE__ */ L("path", { d: "m12 3 9 5-9 5-9-5 9-5Z" }), /* @__PURE__ */ L("path", { d: "m3 13 9 5 9-5" })]
1098
+ }), Pt = ({ size: e = 15 }) => /* @__PURE__ */ R("svg", {
1099
+ ...B(e),
1100
+ children: [
1101
+ /* @__PURE__ */ L("path", { d: "m2 22 1-1h3l9-9" }),
1102
+ /* @__PURE__ */ L("path", { d: "M3 21v-3l9-9" }),
1103
+ /* @__PURE__ */ L("path", { d: "m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z" })
1104
+ ]
1105
+ }), Ft = ({ size: e = 14 }) => /* @__PURE__ */ L("svg", {
1106
+ ...B(e),
1107
+ children: /* @__PURE__ */ L("path", { d: "M4 4h16M4 20h16M12 8v8" })
1108
+ }), It = ({ size: e = 22 }) => /* @__PURE__ */ L("svg", {
1109
+ ...B(e, 1.8),
1110
+ children: /* @__PURE__ */ L("path", { d: "M4 4h16M4 20h16M12 7v10M9 9.5 12 7l3 2.5M9 14.5l3 2.5 3-2.5" })
1111
+ }), Lt = ({ size: e = 22 }) => /* @__PURE__ */ R("svg", {
1112
+ ...B(e, 1.8),
1113
+ children: [
1114
+ /* @__PURE__ */ L("circle", {
1115
+ cx: "6",
1116
+ cy: "12",
1117
+ r: "2.5"
1118
+ }),
1119
+ /* @__PURE__ */ L("circle", {
1120
+ cx: "18",
1121
+ cy: "6",
1122
+ r: "2.5"
1123
+ }),
1124
+ /* @__PURE__ */ L("circle", {
1125
+ cx: "18",
1126
+ cy: "18",
1127
+ r: "2.5"
1128
+ }),
1129
+ /* @__PURE__ */ L("path", { d: "m8.2 10.8 7.6-3.6M8.2 13.2l7.6 3.6" })
1130
+ ]
1131
+ }), Rt = ({ size: e = 22 }) => /* @__PURE__ */ L("svg", {
1132
+ ...B(e, 1.8),
1133
+ children: /* @__PURE__ */ L("rect", {
1134
+ x: "4",
1135
+ y: "4",
1136
+ width: "16",
1137
+ height: "16",
1138
+ rx: "2"
1139
+ })
1140
+ });
1141
+ //#endregion
1142
+ //#region src/components/fields.tsx
1143
+ function V({ title: e, children: t, defaultOpen: n = !0, className: r, style: i }) {
1144
+ let [a, o] = l(n);
1145
+ return /* @__PURE__ */ R("section", {
1146
+ className: z("bree-group", r),
1147
+ style: i,
1148
+ children: [/* @__PURE__ */ R("button", {
1149
+ type: "button",
1150
+ className: "bree-group-header",
1151
+ onClick: () => o(!a),
1152
+ "aria-expanded": a,
1153
+ children: [/* @__PURE__ */ L("span", { children: e }), /* @__PURE__ */ L("span", {
1154
+ className: z("bree-chevron", a && "bree-open"),
1155
+ "aria-hidden": !0,
1156
+ children: "›"
1157
+ })]
1158
+ }), a && /* @__PURE__ */ L("div", {
1159
+ className: "bree-group-body",
1160
+ children: t
1161
+ })]
1162
+ });
1163
+ }
1164
+ function H({ label: e, children: t, stacked: n, className: r, style: i }) {
1165
+ return /* @__PURE__ */ R("label", {
1166
+ className: z("bree-field", n && "bree-stacked", r),
1167
+ style: i,
1168
+ children: [/* @__PURE__ */ L("span", {
1169
+ className: "bree-field-label",
1170
+ children: e
1171
+ }), /* @__PURE__ */ L("span", {
1172
+ className: "bree-field-control",
1173
+ children: t
1174
+ })]
1175
+ });
1176
+ }
1177
+ function zt(e) {
1178
+ let [t, n] = l(e), [r, i] = l(e);
1179
+ return Object.is(e, r) || (i(e), n(e)), [t, n];
1180
+ }
1181
+ function U({ value: e, onChange: t, placeholder: n, type: r = "text", className: i, style: a }) {
1182
+ let [o, s] = zt(e);
1183
+ return /* @__PURE__ */ L("input", {
1184
+ className: z("bree-input", i),
1185
+ style: a,
1186
+ type: r,
1187
+ value: o,
1188
+ placeholder: n,
1189
+ onChange: (e) => s(e.target.value),
1190
+ onBlur: () => o !== e && t(o),
1191
+ onKeyDown: (e) => {
1192
+ e.key === "Enter" && t(o);
1193
+ }
1194
+ });
1195
+ }
1196
+ function Bt({ value: e, onChange: t, rows: n = 8, className: r, style: i }) {
1197
+ let [a, o] = zt(e);
1198
+ return /* @__PURE__ */ L("textarea", {
1199
+ className: z("bree-input bree-textarea", r),
1200
+ style: i,
1201
+ rows: n,
1202
+ value: a,
1203
+ spellCheck: !1,
1204
+ onChange: (e) => o(e.target.value),
1205
+ onBlur: () => a !== e && t(a)
1206
+ });
1207
+ }
1208
+ function Vt(e) {
1209
+ if (e == null || e === "" || e === "auto") return "";
1210
+ let t = Number.parseFloat(String(e));
1211
+ return Number.isFinite(t) ? t : "";
1212
+ }
1213
+ function W({ value: e, onChange: t, unit: n = "px", min: r = 0, max: i, step: a = 1, placeholder: o, className: s, style: c }) {
1214
+ let l = $(), [u, d] = zt(String(Vt(e))), f = (e) => {
1215
+ if (e.trim() === "") return t("");
1216
+ let n = Number.parseFloat(e);
1217
+ Number.isFinite(n) && t(Math.max(r, i === void 0 ? n : Math.min(i, n)));
1218
+ };
1219
+ return /* @__PURE__ */ R("span", {
1220
+ className: z("bree-number", s),
1221
+ style: c,
1222
+ children: [/* @__PURE__ */ L("input", {
1223
+ className: "bree-input",
1224
+ inputMode: "decimal",
1225
+ value: u,
1226
+ placeholder: o ?? l.fields.auto,
1227
+ onChange: (e) => d(e.target.value),
1228
+ onBlur: () => f(u),
1229
+ onKeyDown: (e) => {
1230
+ if (e.key === "Enter" && f(u), e.key === "ArrowUp" || e.key === "ArrowDown") {
1231
+ e.preventDefault();
1232
+ let t = (Vt(u) || 0) + (e.key === "ArrowUp" ? a : -a) * (e.shiftKey ? 10 : 1);
1233
+ d(String(t)), f(String(t));
1234
+ }
1235
+ }
1236
+ }), n && /* @__PURE__ */ L("span", {
1237
+ className: "bree-unit",
1238
+ children: n
1239
+ })]
1240
+ });
1241
+ }
1242
+ function Ht({ value: e, onChange: t, min: n, max: r, unit: i = "px", className: a, style: o }) {
1243
+ let s = Vt(e) || n;
1244
+ return /* @__PURE__ */ R("span", {
1245
+ className: z("bree-range", a),
1246
+ style: o,
1247
+ children: [/* @__PURE__ */ L("input", {
1248
+ type: "range",
1249
+ min: n,
1250
+ max: r,
1251
+ value: s,
1252
+ onChange: (e) => t(Number(e.target.value))
1253
+ }), /* @__PURE__ */ R("span", {
1254
+ className: "bree-range-value",
1255
+ children: [s, i]
1256
+ })]
1257
+ });
1258
+ }
1259
+ var Ut = [
1260
+ "#111827",
1261
+ "#374151",
1262
+ "#6b7280",
1263
+ "#d1d5db",
1264
+ "#f3f4f6",
1265
+ "#ffffff",
1266
+ "#ef4444",
1267
+ "#f97316",
1268
+ "#f59e0b",
1269
+ "#10b981",
1270
+ "#0ea5e9",
1271
+ "#2563eb",
1272
+ "#4f46e5",
1273
+ "#7c3aed",
1274
+ "#db2777",
1275
+ "#eef2ff",
1276
+ "#ecfdf5",
1277
+ "#fef3c7"
1278
+ ];
1279
+ function Wt(e) {
1280
+ let t = e.trim().toLowerCase();
1281
+ if (/^#[0-9a-f]{6}$/.test(t)) return t;
1282
+ if (/^#[0-9a-f]{3}$/.test(t)) return `#${[...t.slice(1)].map((e) => e + e).join("")}`;
1283
+ let n = t.match(/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/);
1284
+ return n ? `#${n.slice(1, 4).map((e) => Number(e).toString(16).padStart(2, "0")).join("")}` : null;
1285
+ }
1286
+ function G({ value: e, onChange: t, presets: n = [], swatches: r = Ut, placeholder: a, className: o, style: s, popoverClassName: u }) {
1287
+ let d = $(), f = a ?? d.fields.colorDefault, p = typeof e == "string" ? e : "", m = Wt(p), [h, g] = l(!1), [_, v] = l(m ?? "#ffffff"), y = c(t);
1288
+ i(() => {
1289
+ y.current = t;
1290
+ });
1291
+ let b = c(null), x = c(0), S = () => {
1292
+ window.clearTimeout(x.current), x.current = 0, b.current && y.current(b.current), b.current = null;
1293
+ }, C = (e) => {
1294
+ v(e), b.current = e, x.current ||= window.setTimeout(S, 60);
1295
+ }, w = (e) => {
1296
+ b.current = null, window.clearTimeout(x.current), x.current = 0, v(Wt(e) ?? _), y.current(e);
1297
+ }, T = typeof window < "u" ? window.EyeDropper : void 0, E = [...new Set(n.map((e) => Wt(e)).filter((e) => !!e))].slice(0, 9);
1298
+ return /* @__PURE__ */ R(we.Root, {
1299
+ open: h,
1300
+ onOpenChange: (e) => {
1301
+ e ? v(m ?? "#ffffff") : S(), g(e);
1302
+ },
1303
+ children: [/* @__PURE__ */ R("span", {
1304
+ className: z("bree-color-field", o),
1305
+ style: s,
1306
+ children: [/* @__PURE__ */ L(we.Trigger, {
1307
+ asChild: !0,
1308
+ children: /* @__PURE__ */ L("button", {
1309
+ type: "button",
1310
+ className: z("bree-color-trigger", !m && "bree-empty"),
1311
+ style: m ? { background: m } : void 0,
1312
+ "aria-label": d.fields.chooseColor(p || f)
1313
+ })
1314
+ }), /* @__PURE__ */ L(U, {
1315
+ value: p,
1316
+ onChange: t,
1317
+ placeholder: f
1318
+ })]
1319
+ }), /* @__PURE__ */ L(we.Portal, { children: /* @__PURE__ */ L(A, { children: /* @__PURE__ */ R(we.Content, {
1320
+ className: z("bree bree-color-popover", u),
1321
+ side: "left",
1322
+ align: "start",
1323
+ sideOffset: 10,
1324
+ collisionPadding: 12,
1325
+ onOpenAutoFocus: (e) => e.preventDefault(),
1326
+ children: [
1327
+ /* @__PURE__ */ L(Ee, {
1328
+ color: _,
1329
+ onChange: C
1330
+ }),
1331
+ /* @__PURE__ */ R("div", {
1332
+ className: "bree-color-popover-row",
1333
+ children: [
1334
+ /* @__PURE__ */ L("span", {
1335
+ className: "bree-color-preview",
1336
+ style: { background: _ }
1337
+ }),
1338
+ /* @__PURE__ */ R("label", {
1339
+ className: "bree-hex-field",
1340
+ children: [/* @__PURE__ */ L("span", { children: "#" }), /* @__PURE__ */ L(Te, {
1341
+ color: _,
1342
+ onChange: w,
1343
+ "aria-label": d.fields.hexCode
1344
+ })]
1345
+ }),
1346
+ T && /* @__PURE__ */ L("button", {
1347
+ type: "button",
1348
+ className: "bree-icon-button",
1349
+ title: d.fields.eyedropper,
1350
+ onClick: () => new T().open().then((e) => w(e.sRGBHex)).catch(() => {}),
1351
+ children: /* @__PURE__ */ L(Pt, {})
1352
+ })
1353
+ ]
1354
+ }),
1355
+ E.length > 0 && /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("span", {
1356
+ className: "bree-color-popover-title",
1357
+ children: d.fields.documentColors
1358
+ }), /* @__PURE__ */ L("div", {
1359
+ className: "bree-swatches",
1360
+ children: E.map((e) => /* @__PURE__ */ L("button", {
1361
+ type: "button",
1362
+ className: "bree-swatch",
1363
+ style: { background: e },
1364
+ title: e,
1365
+ onClick: () => w(e)
1366
+ }, e))
1367
+ })] }),
1368
+ /* @__PURE__ */ L("span", {
1369
+ className: "bree-color-popover-title",
1370
+ children: d.fields.palette
1371
+ }),
1372
+ /* @__PURE__ */ L("div", {
1373
+ className: "bree-swatches",
1374
+ children: r.map((e) => /* @__PURE__ */ L("button", {
1375
+ type: "button",
1376
+ className: z("bree-swatch", e === _ && "bree-active"),
1377
+ style: { background: e },
1378
+ title: e,
1379
+ onClick: () => w(e)
1380
+ }, e))
1381
+ }),
1382
+ /* @__PURE__ */ L("button", {
1383
+ type: "button",
1384
+ className: "bree-color-reset",
1385
+ onClick: () => {
1386
+ b.current = null, y.current(""), g(!1);
1387
+ },
1388
+ children: d.fields.resetColor
1389
+ })
1390
+ ]
1391
+ }) }) })]
1392
+ });
1393
+ }
1394
+ function Gt({ value: e, onChange: t, options: n, className: r, style: i }) {
1395
+ return /* @__PURE__ */ L("select", {
1396
+ className: z("bree-input bree-select", r),
1397
+ style: i,
1398
+ value: e,
1399
+ onChange: (e) => t(e.target.value),
1400
+ children: n.map(([e, t]) => /* @__PURE__ */ L("option", {
1401
+ value: e,
1402
+ children: t
1403
+ }, e))
1404
+ });
1405
+ }
1406
+ function Kt({ value: e, onChange: t, options: n, ariaLabel: r, className: i, style: a }) {
1407
+ return /* @__PURE__ */ L("span", {
1408
+ className: z("bree-segmented", i),
1409
+ style: a,
1410
+ role: "radiogroup",
1411
+ "aria-label": r,
1412
+ children: n.map((n) => /* @__PURE__ */ L("button", {
1413
+ type: "button",
1414
+ role: "radio",
1415
+ "aria-checked": e === n.value,
1416
+ title: n.title,
1417
+ className: z(e === n.value && "bree-active"),
1418
+ onClick: () => t(n.value),
1419
+ children: n.label
1420
+ }, n.value))
1421
+ });
1422
+ }
1423
+ function qt({ value: e, onChange: t, className: n, style: r }) {
1424
+ let i = $();
1425
+ return /* @__PURE__ */ L(Kt, {
1426
+ className: n,
1427
+ style: r,
1428
+ value: e || "left",
1429
+ onChange: t,
1430
+ options: [
1431
+ {
1432
+ value: "left",
1433
+ label: /* @__PURE__ */ L(O, { size: 14 }),
1434
+ title: i.fields.alignLeft
1435
+ },
1436
+ {
1437
+ value: "center",
1438
+ label: /* @__PURE__ */ L(ee, { size: 14 }),
1439
+ title: i.fields.alignCenter
1440
+ },
1441
+ {
1442
+ value: "right",
1443
+ label: /* @__PURE__ */ L(te, { size: 14 }),
1444
+ title: i.fields.alignRight
1445
+ }
1446
+ ]
1447
+ });
1448
+ }
1449
+ function Jt({ get: e, set: t, className: n, style: r }) {
1450
+ let i = $(), a = [
1451
+ "Top",
1452
+ "Right",
1453
+ "Bottom",
1454
+ "Left"
1455
+ ], o = a.map((t) => Vt(e(t))), s = o.every((e) => e === o[0]), [c, u] = l(!s), d = {
1456
+ Top: i.fields.top,
1457
+ Right: i.fields.right,
1458
+ Bottom: i.fields.bottom,
1459
+ Left: i.fields.left
1460
+ };
1461
+ return /* @__PURE__ */ R("div", {
1462
+ className: z("bree-padding", n),
1463
+ style: r,
1464
+ children: [c ? /* @__PURE__ */ L("div", {
1465
+ className: "bree-padding-grid",
1466
+ children: a.map((e, n) => /* @__PURE__ */ R("label", {
1467
+ className: "bree-padding-side",
1468
+ children: [/* @__PURE__ */ L("span", { children: d[e] }), /* @__PURE__ */ L(W, {
1469
+ value: o[n],
1470
+ onChange: (n) => t([[e, n]])
1471
+ })]
1472
+ }, e))
1473
+ }) : /* @__PURE__ */ L(W, {
1474
+ value: o[0],
1475
+ onChange: (e) => t(a.map((t) => [t, e]))
1476
+ }), /* @__PURE__ */ R("label", {
1477
+ className: "bree-checkbox",
1478
+ children: [/* @__PURE__ */ L("input", {
1479
+ type: "checkbox",
1480
+ checked: c,
1481
+ onChange: (e) => u(e.target.checked)
1482
+ }), i.fields.moreOptions]
1483
+ })]
1484
+ });
1485
+ }
1486
+ //#endregion
1487
+ //#region src/components/inspectors/groups.tsx
1488
+ var K = (e) => e;
1489
+ function Yt({ ctx: e, alignment: t, setAlignment: n, className: r, style: i }) {
1490
+ let a = $().inspector;
1491
+ return /* @__PURE__ */ R(V, {
1492
+ title: a.typography,
1493
+ className: r,
1494
+ style: i,
1495
+ children: [
1496
+ /* @__PURE__ */ L(H, {
1497
+ label: a.color,
1498
+ stacked: !0,
1499
+ children: /* @__PURE__ */ L(G, {
1500
+ value: e.getStyle(K("color")),
1501
+ presets: e.presetColors,
1502
+ onChange: (t) => e.setStyle(K("color"), t)
1503
+ })
1504
+ }),
1505
+ /* @__PURE__ */ L(H, {
1506
+ label: a.size,
1507
+ children: /* @__PURE__ */ L(W, {
1508
+ value: e.getStyle(K("fontSize")),
1509
+ onChange: (t) => e.setStyle(K("fontSize"), t),
1510
+ min: 8,
1511
+ max: 96
1512
+ })
1513
+ }),
1514
+ /* @__PURE__ */ L(H, {
1515
+ label: a.weight,
1516
+ children: /* @__PURE__ */ L(Gt, {
1517
+ value: String(e.getStyle(K("fontWeight")) ?? "400"),
1518
+ onChange: (t) => e.setStyle(K("fontWeight"), t),
1519
+ options: [
1520
+ ["300", a.weightLight],
1521
+ ["400", a.weightNormal],
1522
+ ["600", a.weightSemibold],
1523
+ ["700", a.weightBold],
1524
+ ["800", a.weightExtrabold]
1525
+ ]
1526
+ })
1527
+ }),
1528
+ /* @__PURE__ */ L(H, {
1529
+ label: a.lineHeight,
1530
+ children: /* @__PURE__ */ L(W, {
1531
+ value: e.getStyle(K("lineHeight")),
1532
+ unit: "%",
1533
+ onChange: (t) => e.setStyle(K("lineHeight"), t),
1534
+ min: 80,
1535
+ max: 300,
1536
+ step: 5
1537
+ })
1538
+ }),
1539
+ n && /* @__PURE__ */ L(H, {
1540
+ label: a.alignment,
1541
+ children: /* @__PURE__ */ L(qt, {
1542
+ value: t ?? "left",
1543
+ onChange: n
1544
+ })
1545
+ })
1546
+ ]
1547
+ });
1548
+ }
1549
+ function q({ ctx: e, title: t, className: n, style: r }) {
1550
+ let i = $();
1551
+ return /* @__PURE__ */ L(V, {
1552
+ title: t ?? i.inspector.spacing,
1553
+ className: n,
1554
+ style: r,
1555
+ children: /* @__PURE__ */ L(H, {
1556
+ label: i.inspector.padding,
1557
+ stacked: !0,
1558
+ children: /* @__PURE__ */ L(Jt, {
1559
+ get: (t) => e.getStyle(K(`padding${t}`)) ?? e.getStyle(K("padding")),
1560
+ set: (t) => e.batchSetStyle([{
1561
+ prop: K("padding"),
1562
+ value: ""
1563
+ }, ...t.map(([e, t]) => ({
1564
+ prop: K(`padding${e}`),
1565
+ value: t
1566
+ }))])
1567
+ })
1568
+ })
1569
+ });
1570
+ }
1571
+ function Xt({ ctx: e, className: t, style: n }) {
1572
+ let r = $().inspector;
1573
+ return /* @__PURE__ */ R(V, {
1574
+ title: r.box,
1575
+ className: t,
1576
+ style: n,
1577
+ children: [
1578
+ /* @__PURE__ */ L(H, {
1579
+ label: r.backgroundColor,
1580
+ stacked: !0,
1581
+ children: /* @__PURE__ */ L(G, {
1582
+ value: e.getStyle(K("backgroundColor")),
1583
+ presets: e.presetColors,
1584
+ onChange: (t) => e.setStyle(K("backgroundColor"), t)
1585
+ })
1586
+ }),
1587
+ /* @__PURE__ */ L(H, {
1588
+ label: r.radius,
1589
+ children: /* @__PURE__ */ L(W, {
1590
+ value: e.getStyle(K("borderRadius")),
1591
+ onChange: (t) => e.setStyle(K("borderRadius"), t)
1592
+ })
1593
+ }),
1594
+ /* @__PURE__ */ L(H, {
1595
+ label: r.border,
1596
+ children: /* @__PURE__ */ L(W, {
1597
+ value: e.getStyle(K("borderWidth")),
1598
+ onChange: (t) => e.batchSetStyle([{
1599
+ prop: K("borderWidth"),
1600
+ value: t
1601
+ }, {
1602
+ prop: K("borderStyle"),
1603
+ value: t ? "solid" : ""
1604
+ }])
1605
+ })
1606
+ }),
1607
+ /* @__PURE__ */ L(H, {
1608
+ label: r.borderColor,
1609
+ stacked: !0,
1610
+ children: /* @__PURE__ */ L(G, {
1611
+ value: e.getStyle(K("borderColor")),
1612
+ presets: e.presetColors,
1613
+ onChange: (t) => e.setStyle(K("borderColor"), t)
1614
+ })
1615
+ })
1616
+ ]
1617
+ });
1618
+ }
1619
+ //#endregion
1620
+ //#region src/components/inspectors/ButtonInspector.tsx
1621
+ function Zt({ ctx: e, className: t, style: n }) {
1622
+ let r = $().inspector;
1623
+ return /* @__PURE__ */ R("div", {
1624
+ className: z("bree-inspector", t),
1625
+ style: n,
1626
+ children: [
1627
+ /* @__PURE__ */ L(V, {
1628
+ title: r.action,
1629
+ children: /* @__PURE__ */ L(H, {
1630
+ label: r.linkUrl,
1631
+ stacked: !0,
1632
+ children: /* @__PURE__ */ L(U, {
1633
+ value: String(e.getAttr("href") ?? ""),
1634
+ onChange: (t) => e.setAttr("href", t),
1635
+ placeholder: "https://"
1636
+ })
1637
+ })
1638
+ }),
1639
+ /* @__PURE__ */ R(V, {
1640
+ title: r.button,
1641
+ children: [
1642
+ /* @__PURE__ */ L(H, {
1643
+ label: r.alignment,
1644
+ children: /* @__PURE__ */ L(qt, {
1645
+ value: String(e.getAttr("alignment") ?? "left"),
1646
+ onChange: (t) => e.setAttr("alignment", t)
1647
+ })
1648
+ }),
1649
+ /* @__PURE__ */ L(H, {
1650
+ label: r.backgroundColor,
1651
+ stacked: !0,
1652
+ children: /* @__PURE__ */ L(G, {
1653
+ value: e.getStyle(K("backgroundColor")),
1654
+ presets: e.presetColors,
1655
+ onChange: (t) => e.setStyle(K("backgroundColor"), t)
1656
+ })
1657
+ }),
1658
+ /* @__PURE__ */ L(H, {
1659
+ label: r.textColor,
1660
+ stacked: !0,
1661
+ children: /* @__PURE__ */ L(G, {
1662
+ value: e.getStyle(K("color")),
1663
+ presets: e.presetColors,
1664
+ onChange: (t) => e.setStyle(K("color"), t)
1665
+ })
1666
+ }),
1667
+ /* @__PURE__ */ L(H, {
1668
+ label: r.textSize,
1669
+ children: /* @__PURE__ */ L(W, {
1670
+ value: e.getStyle(K("fontSize")),
1671
+ onChange: (t) => e.setStyle(K("fontSize"), t),
1672
+ min: 8,
1673
+ max: 48
1674
+ })
1675
+ }),
1676
+ /* @__PURE__ */ L(H, {
1677
+ label: r.radius,
1678
+ children: /* @__PURE__ */ L(W, {
1679
+ value: e.getStyle(K("borderRadius")),
1680
+ onChange: (t) => e.setStyle(K("borderRadius"), t)
1681
+ })
1682
+ })
1683
+ ]
1684
+ }),
1685
+ /* @__PURE__ */ L(q, {
1686
+ ctx: e,
1687
+ title: r.buttonPadding
1688
+ })
1689
+ ]
1690
+ });
1691
+ }
1692
+ //#endregion
1693
+ //#region src/components/inspectors/ColumnsInspector.tsx
1694
+ function Qt({ ctx: e, className: t, style: n }) {
1695
+ let { editor: r, t: i } = Q(), a = i.inspector, o = {
1696
+ twoColumns: 2,
1697
+ threeColumns: 3,
1698
+ fourColumns: 4
1699
+ }[e.nodeType] ?? 2, s = o === 2 ? [
1700
+ ["50 / 50", [50, 50]],
1701
+ ["33 / 67", [33, 67]],
1702
+ ["67 / 33", [67, 33]],
1703
+ ["25 / 75", [25, 75]]
1704
+ ] : o === 3 ? [[a.equal, [
1705
+ 33.33,
1706
+ 33.33,
1707
+ 33.34
1708
+ ]], ["25 / 50 / 25", [
1709
+ 25,
1710
+ 50,
1711
+ 25
1712
+ ]]] : [[a.equal, [
1713
+ 25,
1714
+ 25,
1715
+ 25,
1716
+ 25
1717
+ ]]], c = (t) => {
1718
+ let { state: n } = r, i = n.doc.nodeAt(e.nodePos.pos);
1719
+ if (!i) return;
1720
+ let a = n.tr;
1721
+ i.forEach((n, r, i) => {
1722
+ let o = e.nodePos.pos + 1 + r, s = String(n.attrs.style ?? "").split(";").filter((e) => e.trim() && !e.trim().startsWith("width")).join(";");
1723
+ a.setNodeMarkup(o, void 0, {
1724
+ ...n.attrs,
1725
+ style: `${s ? `${s};` : ""}width:${t[i]}%`
1726
+ });
1727
+ }), n.selection instanceof w && a.setSelection(w.create(a.doc, e.nodePos.pos)), r.view.dispatch(a);
1728
+ };
1729
+ return /* @__PURE__ */ L("div", {
1730
+ className: z("bree-inspector", t),
1731
+ style: n,
1732
+ children: /* @__PURE__ */ R(V, {
1733
+ title: a.columns,
1734
+ children: [
1735
+ /* @__PURE__ */ L(H, {
1736
+ label: a.distribution,
1737
+ stacked: !0,
1738
+ children: /* @__PURE__ */ L("div", {
1739
+ className: "bree-ratio-grid",
1740
+ children: s.map(([e, t]) => /* @__PURE__ */ R("button", {
1741
+ type: "button",
1742
+ className: "bree-ratio",
1743
+ onClick: () => c(t),
1744
+ children: [/* @__PURE__ */ L("span", {
1745
+ className: "bree-ratio-bars",
1746
+ children: t.map((e, t) => /* @__PURE__ */ L("i", { style: { flex: e } }, t))
1747
+ }), e]
1748
+ }, e))
1749
+ })
1750
+ }),
1751
+ /* @__PURE__ */ L(H, {
1752
+ label: a.columnGap,
1753
+ children: /* @__PURE__ */ L(W, {
1754
+ value: e.getAttr("cellspacing") ?? 0,
1755
+ onChange: (t) => e.setAttr("cellspacing", t === "" ? null : t)
1756
+ })
1757
+ }),
1758
+ /* @__PURE__ */ L("p", {
1759
+ className: "bree-hint",
1760
+ children: a.columnsHint
1761
+ })
1762
+ ]
1763
+ })
1764
+ });
1765
+ }
1766
+ //#endregion
1767
+ //#region src/components/inspectors/HeadingInspector.tsx
1768
+ function $t({ ctx: e, className: t, style: n }) {
1769
+ let r = $();
1770
+ return /* @__PURE__ */ R("div", {
1771
+ className: z("bree-inspector", t),
1772
+ style: n,
1773
+ children: [
1774
+ /* @__PURE__ */ L(V, {
1775
+ title: r.inspector.heading,
1776
+ children: /* @__PURE__ */ L(H, {
1777
+ label: r.inspector.level,
1778
+ children: /* @__PURE__ */ L(Kt, {
1779
+ value: String(e.getAttr("level") ?? 1),
1780
+ onChange: (t) => e.setAttr("level", Number(t)),
1781
+ options: [
1782
+ {
1783
+ value: "1",
1784
+ label: "H1"
1785
+ },
1786
+ {
1787
+ value: "2",
1788
+ label: "H2"
1789
+ },
1790
+ {
1791
+ value: "3",
1792
+ label: "H3"
1793
+ }
1794
+ ]
1795
+ })
1796
+ })
1797
+ }),
1798
+ /* @__PURE__ */ L(Yt, {
1799
+ ctx: e,
1800
+ alignment: String(e.getAttr("alignment") ?? "left"),
1801
+ setAlignment: (t) => e.setAttr("alignment", t)
1802
+ }),
1803
+ /* @__PURE__ */ L(q, { ctx: e }),
1804
+ /* @__PURE__ */ L(Xt, { ctx: e })
1805
+ ]
1806
+ });
1807
+ }
1808
+ //#endregion
1809
+ //#region src/components/inspectors/ImageInspector.tsx
1810
+ function en({ ctx: e, className: t, style: n }) {
1811
+ let { t: r, uploadImage: i } = Q(), a = r.inspector, o = String(e.getAttr("width") ?? "auto");
1812
+ return /* @__PURE__ */ R("div", {
1813
+ className: z("bree-inspector", t),
1814
+ style: n,
1815
+ children: [
1816
+ /* @__PURE__ */ R(V, {
1817
+ title: a.image,
1818
+ children: [
1819
+ /* @__PURE__ */ L("div", {
1820
+ className: "bree-image-preview",
1821
+ children: e.getAttr("src") ? /* @__PURE__ */ L("img", {
1822
+ src: String(e.getAttr("src")),
1823
+ alt: ""
1824
+ }) : null
1825
+ }),
1826
+ /* @__PURE__ */ R("label", {
1827
+ className: "bree-button-like",
1828
+ children: [a.uploadImage, /* @__PURE__ */ L("input", {
1829
+ type: "file",
1830
+ accept: "image/*",
1831
+ hidden: !0,
1832
+ onChange: async (t) => {
1833
+ let n = t.target.files?.[0];
1834
+ n && e.setAttr("src", (await i(n)).url), t.target.value = "";
1835
+ }
1836
+ })]
1837
+ }),
1838
+ /* @__PURE__ */ L(H, {
1839
+ label: a.imageUrl,
1840
+ stacked: !0,
1841
+ children: /* @__PURE__ */ L(U, {
1842
+ value: String(e.getAttr("src") ?? ""),
1843
+ onChange: (t) => e.setAttr("src", t)
1844
+ })
1845
+ }),
1846
+ /* @__PURE__ */ L(H, {
1847
+ label: a.altText,
1848
+ stacked: !0,
1849
+ children: /* @__PURE__ */ L(U, {
1850
+ value: String(e.getAttr("alt") ?? ""),
1851
+ onChange: (t) => e.setAttr("alt", t),
1852
+ placeholder: a.altPlaceholder
1853
+ })
1854
+ })
1855
+ ]
1856
+ }),
1857
+ /* @__PURE__ */ R(V, {
1858
+ title: a.layout,
1859
+ children: [
1860
+ /* @__PURE__ */ L(H, {
1861
+ label: a.autoWidth,
1862
+ children: /* @__PURE__ */ L("input", {
1863
+ type: "checkbox",
1864
+ checked: o === "auto",
1865
+ onChange: (t) => e.setAttr("width", t.target.checked ? "auto" : "300")
1866
+ })
1867
+ }),
1868
+ o !== "auto" && /* @__PURE__ */ L(H, {
1869
+ label: a.width,
1870
+ children: /* @__PURE__ */ L(Ht, {
1871
+ value: o,
1872
+ min: 20,
1873
+ max: 900,
1874
+ onChange: (t) => e.setAttr("width", String(t))
1875
+ })
1876
+ }),
1877
+ /* @__PURE__ */ L(H, {
1878
+ label: a.alignment,
1879
+ children: /* @__PURE__ */ L(qt, {
1880
+ value: String(e.getAttr("alignment") ?? "center"),
1881
+ onChange: (t) => e.setAttr("alignment", t)
1882
+ })
1883
+ }),
1884
+ /* @__PURE__ */ L(H, {
1885
+ label: a.radius,
1886
+ children: /* @__PURE__ */ L(W, {
1887
+ value: e.getStyle(K("borderRadius")),
1888
+ onChange: (t) => e.setStyle(K("borderRadius"), t)
1889
+ })
1890
+ })
1891
+ ]
1892
+ }),
1893
+ /* @__PURE__ */ L(V, {
1894
+ title: a.action,
1895
+ children: /* @__PURE__ */ L(H, {
1896
+ label: a.clickLink,
1897
+ stacked: !0,
1898
+ children: /* @__PURE__ */ L(U, {
1899
+ value: String(e.getAttr("href") ?? ""),
1900
+ onChange: (t) => e.setAttr("href", t || null),
1901
+ placeholder: "https://"
1902
+ })
1903
+ })
1904
+ }),
1905
+ /* @__PURE__ */ L(q, { ctx: e })
1906
+ ]
1907
+ });
1908
+ }
1909
+ //#endregion
1910
+ //#region src/components/inspectors/SimpleInspectors.tsx
1911
+ function tn({ ctx: e, className: t, style: n }) {
1912
+ let r = $();
1913
+ return /* @__PURE__ */ L("div", {
1914
+ className: z("bree-inspector", t),
1915
+ style: n,
1916
+ children: /* @__PURE__ */ L(V, {
1917
+ title: r.inspector.spacer,
1918
+ children: /* @__PURE__ */ L(H, {
1919
+ label: r.inspector.height,
1920
+ children: /* @__PURE__ */ L(Ht, {
1921
+ value: e.getAttr("height"),
1922
+ min: 4,
1923
+ max: 160,
1924
+ onChange: (t) => e.setAttr("height", t)
1925
+ })
1926
+ })
1927
+ })
1928
+ });
1929
+ }
1930
+ function nn({ ctx: e, className: t, style: n }) {
1931
+ let r = $();
1932
+ return /* @__PURE__ */ L("div", {
1933
+ className: z("bree-inspector", t),
1934
+ style: n,
1935
+ children: /* @__PURE__ */ R(V, {
1936
+ title: r.inspector.htmlCode,
1937
+ children: [/* @__PURE__ */ L(Bt, {
1938
+ value: String(e.getAttr("html") ?? ""),
1939
+ onChange: (t) => e.setAttr("html", t),
1940
+ rows: 14
1941
+ }), /* @__PURE__ */ L("p", {
1942
+ className: "bree-hint",
1943
+ children: r.inspector.htmlHint
1944
+ })]
1945
+ })
1946
+ });
1947
+ }
1948
+ function rn({ ctx: e, className: t, style: n }) {
1949
+ let r = $().inspector;
1950
+ return /* @__PURE__ */ L("div", {
1951
+ className: z("bree-inspector", t),
1952
+ style: n,
1953
+ children: /* @__PURE__ */ R(V, {
1954
+ title: r.line,
1955
+ children: [
1956
+ /* @__PURE__ */ L(H, {
1957
+ label: r.color,
1958
+ stacked: !0,
1959
+ children: /* @__PURE__ */ L(G, {
1960
+ value: e.getStyle(K("borderTopColor")),
1961
+ presets: e.presetColors,
1962
+ onChange: (t) => e.setStyle(K("borderTopColor"), t)
1963
+ })
1964
+ }),
1965
+ /* @__PURE__ */ L(H, {
1966
+ label: r.thickness,
1967
+ children: /* @__PURE__ */ L(W, {
1968
+ value: e.getStyle(K("borderTopWidth")) ?? 1,
1969
+ onChange: (t) => e.batchSetStyle([{
1970
+ prop: K("borderTopWidth"),
1971
+ value: t
1972
+ }, {
1973
+ prop: K("borderTopStyle"),
1974
+ value: "solid"
1975
+ }]),
1976
+ min: 1,
1977
+ max: 12
1978
+ })
1979
+ }),
1980
+ /* @__PURE__ */ L(H, {
1981
+ label: r.lineStyle,
1982
+ children: /* @__PURE__ */ L(Kt, {
1983
+ value: String(e.getStyle(K("borderTopStyle")) ?? "solid"),
1984
+ onChange: (t) => e.setStyle(K("borderTopStyle"), t),
1985
+ options: [
1986
+ {
1987
+ value: "solid",
1988
+ label: "———"
1989
+ },
1990
+ {
1991
+ value: "dashed",
1992
+ label: "- - -"
1993
+ },
1994
+ {
1995
+ value: "dotted",
1996
+ label: "· · ·"
1997
+ }
1998
+ ]
1999
+ })
2000
+ })
2001
+ ]
2002
+ })
2003
+ });
2004
+ }
2005
+ function an({ ctx: e, className: t, style: n }) {
2006
+ return /* @__PURE__ */ R("div", {
2007
+ className: z("bree-inspector", t),
2008
+ style: n,
2009
+ children: [/* @__PURE__ */ L(Xt, { ctx: e }), /* @__PURE__ */ L(q, { ctx: e })]
2010
+ });
2011
+ }
2012
+ //#endregion
2013
+ //#region src/core/style-utils.ts
2014
+ function on(e) {
2015
+ if (typeof e != "string" || !e.trim()) return {};
2016
+ let t = {};
2017
+ for (let n of e.split(";")) {
2018
+ let e = n.indexOf(":");
2019
+ if (e === -1) continue;
2020
+ let r = n.slice(0, e).trim(), i = n.slice(e + 1).trim();
2021
+ r && i && (t[r.replace(/-([a-z])/g, (e, t) => t.toUpperCase())] = i);
2022
+ }
2023
+ return t;
2024
+ }
2025
+ //#endregion
2026
+ //#region src/nodes/custom-nodes.tsx
2027
+ var sn = { style: {
2028
+ default: null,
2029
+ parseHTML: (e) => e.getAttribute("style"),
2030
+ renderHTML: (e) => e.style ? { style: e.style } : {}
2031
+ } }, cn = g.create({
2032
+ name: "spacer",
2033
+ group: "block",
2034
+ atom: !0,
2035
+ selectable: !0,
2036
+ addAttributes() {
2037
+ return {
2038
+ ...sn,
2039
+ height: {
2040
+ default: 32,
2041
+ parseHTML: (e) => Number(e.dataset.height) || 32,
2042
+ renderHTML: (e) => ({ "data-height": e.height })
2043
+ }
2044
+ };
2045
+ },
2046
+ parseHTML() {
2047
+ return [{ tag: "div[data-type=\"spacer\"]" }];
2048
+ },
2049
+ renderHTML({ node: e, HTMLAttributes: t }) {
2050
+ return ["div", De(t, {
2051
+ "data-type": "spacer",
2052
+ class: "node-spacer",
2053
+ style: `height:${Number(e.attrs.height)}px`
2054
+ })];
2055
+ },
2056
+ renderToReactEmail({ node: e }) {
2057
+ let t = Number(e.attrs?.height ?? 32);
2058
+ return /* @__PURE__ */ L(Me, {
2059
+ style: {
2060
+ height: t,
2061
+ lineHeight: `${t}px`,
2062
+ fontSize: "1px",
2063
+ ...on(e.attrs?.style)
2064
+ },
2065
+ children: "\xA0"
2066
+ });
2067
+ }
2068
+ }), ln = {
2069
+ facebook: {
2070
+ label: "Facebook",
2071
+ slug: "facebook",
2072
+ color: "1877F2"
2073
+ },
2074
+ instagram: {
2075
+ label: "Instagram",
2076
+ slug: "instagram",
2077
+ color: "E4405F"
2078
+ },
2079
+ x: {
2080
+ label: "X",
2081
+ slug: "x",
2082
+ color: "000000"
2083
+ },
2084
+ linkedin: {
2085
+ label: "LinkedIn",
2086
+ slug: "linkedin",
2087
+ color: "0A66C2"
2088
+ },
2089
+ youtube: {
2090
+ label: "YouTube",
2091
+ slug: "youtube",
2092
+ color: "FF0000"
2093
+ },
2094
+ tiktok: {
2095
+ label: "TikTok",
2096
+ slug: "tiktok",
2097
+ color: "000000"
2098
+ },
2099
+ github: {
2100
+ label: "GitHub",
2101
+ slug: "github",
2102
+ color: "181717"
2103
+ }
2104
+ }, un = { linkedin: "https://cdn.jsdelivr.net/npm/simple-icons@9.21.0/icons/linkedin.svg" };
2105
+ function dn(e) {
2106
+ if (un[e]) return un[e];
2107
+ let t = ln[e] ?? ln.facebook;
2108
+ return `https://cdn.simpleicons.org/${t.slug}/${t.color}`;
2109
+ }
2110
+ function fn(e) {
2111
+ if (Array.isArray(e)) return e;
2112
+ if (typeof e == "string") try {
2113
+ return JSON.parse(e);
2114
+ } catch {
2115
+ return [];
2116
+ }
2117
+ return [];
2118
+ }
2119
+ var pn = g.create({
2120
+ name: "socialLinks",
2121
+ group: "block",
2122
+ atom: !0,
2123
+ selectable: !0,
2124
+ addAttributes() {
2125
+ return {
2126
+ ...sn,
2127
+ links: {
2128
+ default: [
2129
+ {
2130
+ network: "facebook",
2131
+ url: "https://facebook.com/"
2132
+ },
2133
+ {
2134
+ network: "instagram",
2135
+ url: "https://instagram.com/"
2136
+ },
2137
+ {
2138
+ network: "x",
2139
+ url: "https://x.com/"
2140
+ },
2141
+ {
2142
+ network: "linkedin",
2143
+ url: "https://linkedin.com/"
2144
+ }
2145
+ ],
2146
+ parseHTML: (e) => fn(e.dataset.links),
2147
+ renderHTML: (e) => ({ "data-links": JSON.stringify(e.links ?? []) })
2148
+ },
2149
+ size: { default: 28 },
2150
+ gap: { default: 12 },
2151
+ alignment: { default: "center" }
2152
+ };
2153
+ },
2154
+ parseHTML() {
2155
+ return [{ tag: "div[data-type=\"social-links\"]" }];
2156
+ },
2157
+ renderHTML({ node: e, HTMLAttributes: t }) {
2158
+ let n = Number(e.attrs.size), r = Number(e.attrs.gap), i = fn(e.attrs.links);
2159
+ return [
2160
+ "div",
2161
+ De(t, {
2162
+ "data-type": "social-links",
2163
+ class: "node-socialLinks",
2164
+ alignment: e.attrs.alignment
2165
+ }),
2166
+ ...i.map((e, t) => [
2167
+ "span",
2168
+ {
2169
+ class: "node-socialLinks-item",
2170
+ style: `margin-left:${t === 0 ? 0 : r}px`
2171
+ },
2172
+ ["img", {
2173
+ src: dn(e.network),
2174
+ width: String(n),
2175
+ height: String(n),
2176
+ alt: ln[e.network]?.label ?? e.network
2177
+ }]
2178
+ ])
2179
+ ];
2180
+ },
2181
+ renderToReactEmail({ node: e }) {
2182
+ let t = Number(e.attrs?.size ?? 28), n = Number(e.attrs?.gap ?? 12), r = fn(e.attrs?.links), i = e.attrs?.alignment ?? "center";
2183
+ return /* @__PURE__ */ L(Me, {
2184
+ style: on(e.attrs?.style),
2185
+ children: /* @__PURE__ */ L(je, { children: /* @__PURE__ */ L(Oe, {
2186
+ align: i,
2187
+ children: r.map((e, r) => /* @__PURE__ */ L(Ae, {
2188
+ href: e.url,
2189
+ style: {
2190
+ display: "inline-block",
2191
+ marginLeft: r === 0 ? 0 : n
2192
+ },
2193
+ children: /* @__PURE__ */ L(ke, {
2194
+ src: dn(e.network),
2195
+ width: t,
2196
+ height: t,
2197
+ alt: ln[e.network]?.label ?? e.network
2198
+ })
2199
+ }, `${e.network}-${r}`))
2200
+ }) })
2201
+ });
2202
+ }
2203
+ }), mn = g.create({
2204
+ name: "htmlBlock",
2205
+ group: "block",
2206
+ atom: !0,
2207
+ selectable: !0,
2208
+ addAttributes() {
2209
+ return { html: {
2210
+ default: "<p style=\"margin:0;text-align:center;font-family:sans-serif\">Your custom <strong>HTML</strong></p>",
2211
+ parseHTML: (e) => e.dataset.html ?? e.innerHTML,
2212
+ renderHTML: () => ({})
2213
+ } };
2214
+ },
2215
+ parseHTML() {
2216
+ return [{ tag: "div[data-type=\"html-block\"]" }];
2217
+ },
2218
+ renderHTML({ node: e, HTMLAttributes: t }) {
2219
+ return ["div", De(t, {
2220
+ "data-type": "html-block",
2221
+ class: "node-htmlBlock",
2222
+ "data-html": e.attrs.html
2223
+ })];
2224
+ },
2225
+ addNodeView() {
2226
+ return ({ node: e }) => {
2227
+ let t = document.createElement("div");
2228
+ return t.className = "node-htmlBlock", t.dataset.type = "html-block", t.innerHTML = e.attrs.html, {
2229
+ dom: t,
2230
+ update(n) {
2231
+ return n.type === e.type && (t.innerHTML = n.attrs.html, !0);
2232
+ },
2233
+ ignoreMutation: () => !0
2234
+ };
2235
+ };
2236
+ },
2237
+ renderToReactEmail({ node: e }) {
2238
+ return /* @__PURE__ */ L("div", { dangerouslySetInnerHTML: { __html: e.attrs?.html ?? "" } });
2239
+ }
2240
+ });
2241
+ //#endregion
2242
+ //#region src/components/inspectors/SocialLinksInspector.tsx
2243
+ function hn({ ctx: e, className: t, style: n }) {
2244
+ let r = $().inspector, i = e.getAttr("links"), a = Array.isArray(i) ? i : [], o = (t) => e.setAttr("links", t);
2245
+ return /* @__PURE__ */ R("div", {
2246
+ className: z("bree-inspector", t),
2247
+ style: n,
2248
+ children: [
2249
+ /* @__PURE__ */ R(V, {
2250
+ title: r.networks,
2251
+ children: [/* @__PURE__ */ L("div", {
2252
+ className: "bree-social-list",
2253
+ children: a.map((e, t) => /* @__PURE__ */ R("div", {
2254
+ className: "bree-social-row",
2255
+ children: [
2256
+ /* @__PURE__ */ L(Gt, {
2257
+ value: e.network,
2258
+ onChange: (e) => o(a.map((n, r) => r === t ? {
2259
+ ...n,
2260
+ network: e
2261
+ } : n)),
2262
+ options: Object.entries(ln).map(([e, t]) => [e, t.label])
2263
+ }),
2264
+ /* @__PURE__ */ L(U, {
2265
+ value: e.url,
2266
+ onChange: (e) => o(a.map((n, r) => r === t ? {
2267
+ ...n,
2268
+ url: e
2269
+ } : n))
2270
+ }),
2271
+ /* @__PURE__ */ L("button", {
2272
+ type: "button",
2273
+ className: "bree-icon-button",
2274
+ title: r.removeNetwork,
2275
+ onClick: () => o(a.filter((e, n) => n !== t)),
2276
+ children: /* @__PURE__ */ L(F, { size: 14 })
2277
+ })
2278
+ ]
2279
+ }, t))
2280
+ }), /* @__PURE__ */ L("button", {
2281
+ type: "button",
2282
+ className: "bree-button-like",
2283
+ onClick: () => o([...a, {
2284
+ network: "youtube",
2285
+ url: "https://youtube.com/"
2286
+ }]),
2287
+ children: r.addNetwork
2288
+ })]
2289
+ }),
2290
+ /* @__PURE__ */ R(V, {
2291
+ title: r.appearance,
2292
+ children: [
2293
+ /* @__PURE__ */ L(H, {
2294
+ label: r.iconSize,
2295
+ children: /* @__PURE__ */ L(Ht, {
2296
+ value: e.getAttr("size"),
2297
+ min: 16,
2298
+ max: 64,
2299
+ onChange: (t) => e.setAttr("size", t)
2300
+ })
2301
+ }),
2302
+ /* @__PURE__ */ L(H, {
2303
+ label: r.gap,
2304
+ children: /* @__PURE__ */ L(Ht, {
2305
+ value: e.getAttr("gap"),
2306
+ min: 0,
2307
+ max: 40,
2308
+ onChange: (t) => e.setAttr("gap", t)
2309
+ })
2310
+ }),
2311
+ /* @__PURE__ */ L(H, {
2312
+ label: r.alignment,
2313
+ children: /* @__PURE__ */ L(qt, {
2314
+ value: String(e.getAttr("alignment") ?? "center"),
2315
+ onChange: (t) => e.setAttr("alignment", t)
2316
+ })
2317
+ })
2318
+ ]
2319
+ }),
2320
+ /* @__PURE__ */ L(q, { ctx: e })
2321
+ ]
2322
+ });
2323
+ }
2324
+ //#endregion
2325
+ //#region src/registry/default-nodes.tsx
2326
+ function gn(e, t = 36) {
2327
+ let n = e.replace(/\s+/g, " ").trim();
2328
+ return n.length > t ? `${n.slice(0, t)}…` : n;
2329
+ }
2330
+ var _n = (e, { t }) => gn(e.textContent) || t.layers.empty, vn = () => "", yn = [
2331
+ {
2332
+ type: "paragraph",
2333
+ icon: xe
2334
+ },
2335
+ {
2336
+ type: "heading",
2337
+ icon: j,
2338
+ inspector: $t
2339
+ },
2340
+ {
2341
+ type: "image",
2342
+ icon: se,
2343
+ inspector: en,
2344
+ preview: (e, { t }) => {
2345
+ let { attrs: n } = e;
2346
+ if (n.alt) return gn(n.alt);
2347
+ let r = String(n.src ?? "");
2348
+ if (r.startsWith("data:")) return t.layers.uploadedImage;
2349
+ try {
2350
+ let e = new URL(r);
2351
+ return gn(e.searchParams.get("text") ?? decodeURIComponent(e.pathname.split("/").pop() ?? ""));
2352
+ } catch {
2353
+ return "";
2354
+ }
2355
+ }
2356
+ },
2357
+ {
2358
+ type: "button",
2359
+ icon: pe,
2360
+ inspector: Zt
2361
+ },
2362
+ {
2363
+ type: "horizontalRule",
2364
+ icon: fe,
2365
+ inspector: rn,
2366
+ preview: vn
2367
+ },
2368
+ {
2369
+ type: "spacer",
2370
+ icon: Ft,
2371
+ inspector: tn,
2372
+ preview: (e) => `${e.attrs.height}px`,
2373
+ extensions: [cn]
2374
+ },
2375
+ {
2376
+ type: "socialLinks",
2377
+ icon: le,
2378
+ inspector: hn,
2379
+ preview: (e) => Array.isArray(e.attrs.links) ? e.attrs.links.map((e) => e.network).join(", ") : "",
2380
+ extensions: [pn]
2381
+ },
2382
+ {
2383
+ type: "htmlBlock",
2384
+ icon: ve,
2385
+ inspector: nn,
2386
+ preview: (e) => gn(String(e.attrs.html ?? "").replace(/<[^>]+>/g, " ")),
2387
+ extensions: [mn]
2388
+ },
2389
+ {
2390
+ type: "section",
2391
+ icon: N,
2392
+ inspector: an,
2393
+ preview: vn
2394
+ },
2395
+ {
2396
+ type: "columnsColumn",
2397
+ icon: me,
2398
+ inspector: an,
2399
+ preview: vn
2400
+ },
2401
+ {
2402
+ type: "twoColumns",
2403
+ icon: ie,
2404
+ inspector: Qt,
2405
+ preview: vn
2406
+ },
2407
+ {
2408
+ type: "threeColumns",
2409
+ icon: ae,
2410
+ inspector: Qt,
2411
+ preview: vn
2412
+ },
2413
+ {
2414
+ type: "fourColumns",
2415
+ icon: oe,
2416
+ inspector: Qt,
2417
+ preview: vn
2418
+ },
2419
+ {
2420
+ type: "bulletList",
2421
+ icon: ue
2422
+ },
2423
+ {
2424
+ type: "orderedList",
2425
+ icon: de
2426
+ },
2427
+ {
2428
+ type: "blockquote",
2429
+ icon: P
2430
+ },
2431
+ {
2432
+ type: "codeBlock",
2433
+ icon: re
2434
+ },
2435
+ {
2436
+ type: "table",
2437
+ icon: be
2438
+ }
2439
+ ], bn = /* @__PURE__ */ Fe({
2440
+ button: () => Sn,
2441
+ column: () => wn,
2442
+ columns: () => X,
2443
+ doc: () => An,
2444
+ heading: () => xn,
2445
+ image: () => Cn,
2446
+ link: () => On,
2447
+ padding: () => Dn,
2448
+ paragraph: () => Y,
2449
+ placeholderImage: () => kn,
2450
+ section: () => En,
2451
+ sized: () => Tn,
2452
+ text: () => J
2453
+ }), J = (e, t) => ({
2454
+ type: "text",
2455
+ text: e,
2456
+ ...t ? { marks: t } : {}
2457
+ }), Y = (e = "", t = {}) => ({
2458
+ type: "paragraph",
2459
+ attrs: t,
2460
+ content: typeof e == "string" ? e ? [J(e)] : [] : e
2461
+ }), xn = (e, t, n = {}) => ({
2462
+ type: "heading",
2463
+ attrs: {
2464
+ level: e,
2465
+ ...n
2466
+ },
2467
+ content: [J(t)]
2468
+ }), Sn = (e, t = {}) => ({
2469
+ type: "button",
2470
+ attrs: {
2471
+ href: "https://example.com",
2472
+ alignment: "center",
2473
+ ...t
2474
+ },
2475
+ content: [J(e)]
2476
+ }), Cn = (e, t = {}) => ({
2477
+ type: "image",
2478
+ attrs: {
2479
+ src: e,
2480
+ alt: "",
2481
+ alignment: "center",
2482
+ ...t
2483
+ }
2484
+ }), wn = (...e) => ({
2485
+ type: "columnsColumn",
2486
+ content: e.length ? e : [Y()]
2487
+ }), Tn = (e, t) => ({
2488
+ ...e,
2489
+ attrs: {
2490
+ ...e.attrs,
2491
+ style: `width:${t}%`
2492
+ }
2493
+ }), X = (e, t, n) => ({
2494
+ type: {
2495
+ 2: "twoColumns",
2496
+ 3: "threeColumns",
2497
+ 4: "fourColumns"
2498
+ }[e],
2499
+ ...n ? { attrs: n } : {},
2500
+ content: t ?? Array.from({ length: e }, () => wn())
2501
+ }), En = (e, ...t) => ({
2502
+ type: "section",
2503
+ attrs: { style: e },
2504
+ content: t
2505
+ }), Dn = (e, t = e) => `padding-top:${e}px;padding-right:${t}px;padding-bottom:${e}px;padding-left:${t}px`, On = (e) => [{
2506
+ type: "link",
2507
+ attrs: { href: e }
2508
+ }], kn = (e, t, n = "Image") => `https://placehold.co/${e}x${t}/e2e8f0/64748b/png?text=${encodeURIComponent(n)}`, An = (...e) => ({
2509
+ type: "doc",
2510
+ content: e
2511
+ }), jn = ({ t: e }, t = "center") => Y([
2512
+ J(e.content.menuHome, On("https://example.com")),
2513
+ J(" · "),
2514
+ J(e.content.menuShop, On("https://example.com/shop")),
2515
+ J(" · "),
2516
+ J(e.content.menuBlog, On("https://example.com/blog")),
2517
+ J(" · "),
2518
+ J(e.content.menuContact, On("https://example.com/contact"))
2519
+ ], { alignment: t }), Mn = [{
2520
+ id: "layout",
2521
+ title: ({ t: e }) => e.sidebar.layoutTitle
2522
+ }, {
2523
+ id: "content",
2524
+ title: ({ t: e }) => e.sidebar.contentTitle
2525
+ }], Nn = [
2526
+ {
2527
+ id: "section",
2528
+ group: "layout",
2529
+ label: ({ t: e }) => e.palette.oneColumn,
2530
+ icon: /* @__PURE__ */ L(Rt, {}),
2531
+ content: () => [En(Dn(16), Y())]
2532
+ },
2533
+ {
2534
+ id: "columns-2",
2535
+ group: "layout",
2536
+ label: ({ t: e }) => e.palette.twoColumns,
2537
+ icon: /* @__PURE__ */ L(ie, { size: 22 }),
2538
+ content: () => [X(2)]
2539
+ },
2540
+ {
2541
+ id: "columns-3",
2542
+ group: "layout",
2543
+ label: ({ t: e }) => e.palette.threeColumns,
2544
+ icon: /* @__PURE__ */ L(ae, { size: 22 }),
2545
+ content: () => [X(3)]
2546
+ },
2547
+ {
2548
+ id: "columns-4",
2549
+ group: "layout",
2550
+ label: ({ t: e }) => e.palette.fourColumns,
2551
+ icon: /* @__PURE__ */ L(oe, { size: 22 }),
2552
+ content: () => [X(4)]
2553
+ },
2554
+ {
2555
+ id: "heading",
2556
+ group: "content",
2557
+ label: ({ t: e }) => e.palette.heading,
2558
+ icon: /* @__PURE__ */ L(j, { size: 22 }),
2559
+ content: ({ t: e }) => [xn(2, e.content.heading)]
2560
+ },
2561
+ {
2562
+ id: "text",
2563
+ group: "content",
2564
+ label: ({ t: e }) => e.palette.text,
2565
+ icon: /* @__PURE__ */ L(xe, { size: 22 }),
2566
+ content: ({ t: e }) => [Y(e.content.text)]
2567
+ },
2568
+ {
2569
+ id: "button",
2570
+ group: "content",
2571
+ label: ({ t: e }) => e.palette.button,
2572
+ icon: /* @__PURE__ */ L(pe, { size: 22 }),
2573
+ content: ({ t: e }) => [Sn(e.content.button)]
2574
+ },
2575
+ {
2576
+ id: "image",
2577
+ group: "content",
2578
+ label: ({ t: e }) => e.palette.image,
2579
+ icon: /* @__PURE__ */ L(se, { size: 22 }),
2580
+ content: ({ t: e }) => [Cn(kn(600, 300, e.content.image))]
2581
+ },
2582
+ {
2583
+ id: "divider",
2584
+ group: "content",
2585
+ label: ({ t: e }) => e.palette.divider,
2586
+ icon: /* @__PURE__ */ L(fe, { size: 22 }),
2587
+ content: () => [{ type: "horizontalRule" }]
2588
+ },
2589
+ {
2590
+ id: "spacer",
2591
+ group: "content",
2592
+ label: ({ t: e }) => e.palette.spacer,
2593
+ icon: /* @__PURE__ */ L(It, {}),
2594
+ content: () => [{
2595
+ type: "spacer",
2596
+ attrs: { height: 32 }
2597
+ }]
2598
+ },
2599
+ {
2600
+ id: "social",
2601
+ group: "content",
2602
+ label: ({ t: e }) => e.palette.social,
2603
+ icon: /* @__PURE__ */ L(Lt, {}),
2604
+ content: () => [{ type: "socialLinks" }]
2605
+ },
2606
+ {
2607
+ id: "menu",
2608
+ group: "content",
2609
+ label: ({ t: e }) => e.palette.menu,
2610
+ icon: /* @__PURE__ */ L(he, { size: 22 }),
2611
+ content: (e) => [jn(e)]
2612
+ },
2613
+ {
2614
+ id: "list",
2615
+ group: "content",
2616
+ label: ({ t: e }) => e.palette.list,
2617
+ icon: /* @__PURE__ */ L(ue, { size: 22 }),
2618
+ content: ({ t: e }) => [{
2619
+ type: "bulletList",
2620
+ content: e.content.listItems.map((e) => ({
2621
+ type: "listItem",
2622
+ content: [Y(e)]
2623
+ }))
2624
+ }]
2625
+ },
2626
+ {
2627
+ id: "quote",
2628
+ group: "content",
2629
+ label: ({ t: e }) => e.palette.quote,
2630
+ icon: /* @__PURE__ */ L(P, { size: 22 }),
2631
+ content: ({ t: e }) => [{
2632
+ type: "blockquote",
2633
+ content: [Y(e.content.quote)]
2634
+ }]
2635
+ },
2636
+ {
2637
+ id: "html",
2638
+ group: "content",
2639
+ label: ({ t: e }) => e.palette.html,
2640
+ icon: /* @__PURE__ */ L(ve, { size: 22 }),
2641
+ content: ({ t: e }) => [{
2642
+ type: "htmlBlock",
2643
+ attrs: { html: e.content.html }
2644
+ }]
2645
+ },
2646
+ {
2647
+ id: "card",
2648
+ group: "content",
2649
+ label: ({ t: e }) => e.palette.card,
2650
+ icon: /* @__PURE__ */ L(N, { size: 22 }),
2651
+ content: ({ t: e }) => [En(`${Dn(24)};background-color:#f1f5f9;border-radius:12px`, xn(3, e.content.cardTitle), Y(e.content.cardText))]
2652
+ }
2653
+ ];
2654
+ //#endregion
2655
+ //#region src/registry/default-templates.tsx
2656
+ function Z({ variant: e }) {
2657
+ return /* @__PURE__ */ R("span", {
2658
+ className: `bree-block-thumb bree-thumb-${e}`,
2659
+ "aria-hidden": !0,
2660
+ children: [
2661
+ /* @__PURE__ */ L("i", {}),
2662
+ /* @__PURE__ */ L("i", {}),
2663
+ /* @__PURE__ */ L("i", {})
2664
+ ]
2665
+ });
2666
+ }
2667
+ var Pn = [
2668
+ {
2669
+ id: "header",
2670
+ label: ({ t: e }) => e.templates.header,
2671
+ description: ({ t: e }) => e.templates.headerDescription,
2672
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "header" }),
2673
+ content: (e) => [X(2, [Tn(wn(Cn(kn(140, 40, e.t.content.logo), {
2674
+ alignment: "left",
2675
+ width: "140"
2676
+ })), 33), Tn(wn(jn(e, "right")), 67)])]
2677
+ },
2678
+ {
2679
+ id: "hero",
2680
+ label: ({ t: e }) => e.templates.hero,
2681
+ description: ({ t: e }) => e.templates.heroDescription,
2682
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "hero" }),
2683
+ content: ({ t: e }) => [En(`${Dn(40, 24)};background-color:#eef2ff;border-radius:12px`, xn(1, e.content.heroTitle, { alignment: "center" }), Y(e.content.heroText, { alignment: "center" }), Sn(e.content.heroButton, { style: `background-color:#4f46e5;color:#ffffff;${Dn(12, 24)};border-radius:8px` }))]
2684
+ },
2685
+ {
2686
+ id: "products",
2687
+ label: ({ t: e }) => e.templates.products,
2688
+ description: ({ t: e }) => e.templates.productsDescription,
2689
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "products" }),
2690
+ content: ({ t: e }) => [X(2, [e.content.productA, e.content.productB].map((t) => wn(Cn(kn(280, 200, t)), xn(3, t, { alignment: "center" }), Y(e.content.productText, { alignment: "center" }), Sn(e.content.productButton))), { cellspacing: 16 })]
2691
+ },
2692
+ {
2693
+ id: "features",
2694
+ label: ({ t: e }) => e.templates.features,
2695
+ description: ({ t: e }) => e.templates.featuresDescription,
2696
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "features" }),
2697
+ content: ({ t: e }) => [X(3, e.content.features.map((t) => wn(xn(3, t, { alignment: "center" }), Y(e.content.featureText, { alignment: "center" }))))]
2698
+ },
2699
+ {
2700
+ id: "testimonial",
2701
+ label: ({ t: e }) => e.templates.testimonial,
2702
+ description: ({ t: e }) => e.templates.testimonialDescription,
2703
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "testimonial" }),
2704
+ content: ({ t: e }) => [En(`${Dn(24)};background-color:#f8fafc;border-radius:12px`, {
2705
+ type: "blockquote",
2706
+ content: [Y(e.content.testimonialQuote)]
2707
+ }, Y(e.content.testimonialAuthor, {
2708
+ alignment: "right",
2709
+ style: "color:#64748b"
2710
+ }))]
2711
+ },
2712
+ {
2713
+ id: "footer",
2714
+ label: ({ t: e }) => e.templates.footer,
2715
+ description: ({ t: e }) => e.templates.footerDescription,
2716
+ thumbnail: /* @__PURE__ */ L(Z, { variant: "footer" }),
2717
+ content: ({ t: e }) => [
2718
+ { type: "horizontalRule" },
2719
+ { type: "socialLinks" },
2720
+ Y(e.content.footerAddress, {
2721
+ alignment: "center",
2722
+ style: "color:#94a3b8;font-size:12px"
2723
+ }),
2724
+ Y([J(e.content.unsubscribe, On("https://example.com/unsubscribe"))], {
2725
+ alignment: "center",
2726
+ style: "font-size:12px"
2727
+ })
2728
+ ]
2729
+ }
2730
+ ], Fn = (e, t) => Pn.find((t) => t.id === e)?.content(t) ?? [];
2731
+ function In(e) {
2732
+ let t = {
2733
+ type: "spacer",
2734
+ attrs: { height: 16 }
2735
+ };
2736
+ return {
2737
+ type: "doc",
2738
+ content: [
2739
+ ...Fn("header", e),
2740
+ t,
2741
+ ...Fn("hero", e),
2742
+ t,
2743
+ xn(2, e.t.content.starterTitle, { alignment: "center" }),
2744
+ ...Fn("products", e),
2745
+ t,
2746
+ ...Fn("footer", e)
2747
+ ]
2748
+ };
2749
+ }
2750
+ //#endregion
2751
+ //#region src/context.tsx
2752
+ var Ln = e(null);
2753
+ function Q() {
2754
+ let e = r(Ln);
2755
+ if (!e) throw Error("useEmailEditor must be used inside <EditorRoot> or <BetterEmailEditor>.");
2756
+ return e;
2757
+ }
2758
+ function Rn() {
2759
+ return r(Ln);
2760
+ }
2761
+ function $() {
2762
+ return r(Ln)?.t ?? _t;
2763
+ }
2764
+ function zn() {
2765
+ let { locale: e, t } = Q();
2766
+ return s(() => ({
2767
+ locale: e,
2768
+ t
2769
+ }), [e, t]);
2770
+ }
2771
+ var Bn = x("basic", {
2772
+ body: {
2773
+ backgroundColor: "#eef1f5",
2774
+ padding: "32px 16px"
2775
+ },
2776
+ container: {
2777
+ backgroundColor: "#ffffff",
2778
+ padding: "24px",
2779
+ borderRadius: "12px"
2780
+ }
2781
+ }), Vn = (e) => new Promise((t, n) => {
2782
+ let r = new FileReader();
2783
+ r.onload = () => t({ url: String(r.result) }), r.onerror = n, r.readAsDataURL(e);
2784
+ }), Hn = {
2785
+ type: "doc",
2786
+ content: [{ type: "paragraph" }]
2787
+ };
2788
+ function Un(e) {
2789
+ return typeof e == "object" && !!e && "doc" in e;
2790
+ }
2791
+ function Wn(e) {
2792
+ return e ? Un(e) ? {
2793
+ doc: e.doc,
2794
+ settings: {
2795
+ ...e.settings,
2796
+ previewText: e.settings?.previewText ?? ""
2797
+ }
2798
+ } : {
2799
+ doc: e,
2800
+ settings: { previewText: "" }
2801
+ } : {
2802
+ doc: Hn,
2803
+ settings: { previewText: "" }
2804
+ };
2805
+ }
2806
+ function Gn(e, t, r) {
2807
+ let [i, a] = l(t);
2808
+ return [e === void 0 ? i : e, n((t) => {
2809
+ e === void 0 && a(t), r?.(t);
2810
+ }, [e, r])];
2811
+ }
2812
+ var Kn = t(function({ defaultValue: e, onChange: t, onReady: r, locale: u = "en", messages: f, nodes: h = yn, palette: g = Nn, paletteGroups: v = Mn, templates: x = Pn, starterDocument: C = In, extensions: w, theme: T = Bn, uploadImage: E = Vn, editable: D = !0, device: ee, defaultDevice: O = "desktop", onDeviceChange: te, layersOpen: ne, defaultLayersOpen: k = !0, onLayersOpenChange: re, className: ie, style: ae, children: oe }, A) {
2813
+ let j = s(() => Ct(u, f), [u, f]), [se] = l(() => Wn(e)), [M, ce] = l(se.settings), N = c(M), le = c(j), ue = c(t), de = c(r), fe = c(E);
2814
+ o(() => {
2815
+ le.current = j, ue.current = t, de.current = r, fe.current = E;
2816
+ });
2817
+ let [pe, me] = Gn(ee, O, te), [he, ge] = Gn(ne, k, re), [_e] = l(() => ({
2818
+ dragSession: ht(),
2819
+ hoverStore: gt()
2820
+ })), ve = n((e) => fe.current(e), []), ye = S({ uploadImage: ve }), [be] = l(() => [
2821
+ y.configure({
2822
+ TiptapStarterKit: { dropcursor: !1 },
2823
+ Button: !1
2824
+ }),
2825
+ it,
2826
+ d.configure({
2827
+ placeholder: ({ node: e }) => e.type.name === "heading" ? le.current.placeholder.heading : le.current.placeholder.paragraph,
2828
+ includeChildren: !0
2829
+ }),
2830
+ b.configure({ theme: T }),
2831
+ ...h.flatMap((e) => e.extensions ?? []),
2832
+ ...w ?? [],
2833
+ ye
2834
+ ]), P = m({
2835
+ extensions: be,
2836
+ content: se.doc,
2837
+ editable: D,
2838
+ immediatelyRender: !1,
2839
+ editorProps: { handlePaste: mt(be) }
2840
+ }, []);
2841
+ i(() => {
2842
+ P?.setEditable(D);
2843
+ }, [P, D]);
2844
+ let xe = n(() => ({
2845
+ doc: P?.getJSON() ?? Hn,
2846
+ settings: N.current
2847
+ }), [P]), Se = n((e) => {
2848
+ let t = {
2849
+ ...N.current,
2850
+ ...e
2851
+ };
2852
+ N.current = t, ce(t), P && ue.current?.({
2853
+ doc: P.getJSON(),
2854
+ settings: t
2855
+ });
2856
+ }, [P]), F = s(() => {
2857
+ let e = async () => P ? _({
2858
+ editor: P,
2859
+ preview: N.current.previewText || void 0
2860
+ }) : {
2861
+ html: "",
2862
+ text: "",
2863
+ unformattedHtml: ""
2864
+ };
2865
+ return {
2866
+ editor: P,
2867
+ getValue: xe,
2868
+ getJSON: () => P?.getJSON() ?? Hn,
2869
+ setValue: (e) => {
2870
+ let t = Wn(e);
2871
+ N.current = t.settings, ce(t.settings), P?.commands.setContent(t.doc, { emitUpdate: !0 });
2872
+ },
2873
+ exportEmail: e,
2874
+ getHtml: async () => (await e()).html,
2875
+ getText: async () => (await e()).text,
2876
+ insertBlocks: (e) => {
2877
+ P && rt(P, e);
2878
+ }
2879
+ };
2880
+ }, [P, xe]);
2881
+ a(A, () => F, [F]), i(() => {
2882
+ if (!P) return;
2883
+ de.current?.(F);
2884
+ let e = () => ue.current?.(xe());
2885
+ return P.on("update", e), () => {
2886
+ P.off("update", e);
2887
+ };
2888
+ }, [
2889
+ P,
2890
+ F,
2891
+ xe
2892
+ ]);
2893
+ let Ce = s(() => new Map(h.map((e) => [e.type, e])), [h]), I = s(() => {
2894
+ if (!P) return null;
2895
+ let e = {
2896
+ locale: u,
2897
+ t: j
2898
+ };
2899
+ return {
2900
+ ...e,
2901
+ editor: P,
2902
+ handle: F,
2903
+ nodes: Ce,
2904
+ nodeLabel: (t) => {
2905
+ let n = Ce.get(t)?.label;
2906
+ return n ? bt(n, e) : j.nodes[t] ?? t;
2907
+ },
2908
+ palette: g,
2909
+ paletteGroups: v,
2910
+ templates: x,
2911
+ starterDocument: C,
2912
+ uploadImage: ve,
2913
+ ..._e,
2914
+ device: pe,
2915
+ setDevice: me,
2916
+ layersOpen: he,
2917
+ setLayersOpen: ge,
2918
+ settings: M,
2919
+ updateSettings: Se
2920
+ };
2921
+ }, [
2922
+ P,
2923
+ u,
2924
+ j,
2925
+ F,
2926
+ Ce,
2927
+ g,
2928
+ v,
2929
+ x,
2930
+ C,
2931
+ ve,
2932
+ _e,
2933
+ pe,
2934
+ me,
2935
+ he,
2936
+ ge,
2937
+ M,
2938
+ Se
2939
+ ]), R = s(() => ({ editor: P }), [P]), we = {
2940
+ "--bree-empty-zone-label": JSON.stringify(j.canvas.emptyZone),
2941
+ ...ae
2942
+ };
2943
+ return /* @__PURE__ */ L("div", {
2944
+ className: z("bree bree-root", ie),
2945
+ style: we,
2946
+ lang: u,
2947
+ children: I && /* @__PURE__ */ L(p.Provider, {
2948
+ value: R,
2949
+ children: /* @__PURE__ */ L(Ln.Provider, {
2950
+ value: I,
2951
+ children: oe
2952
+ })
2953
+ })
2954
+ });
2955
+ });
2956
+ //#endregion
2957
+ //#region src/components/CanvasOverlay.tsx
2958
+ function qn(e, t) {
2959
+ let n = e.getBoundingClientRect();
2960
+ return {
2961
+ top: t.top - n.top + e.scrollTop,
2962
+ left: t.left - n.left + e.scrollLeft,
2963
+ width: t.width,
2964
+ height: t.height ?? 0
2965
+ };
2966
+ }
2967
+ function Jn(e, t, n) {
2968
+ if (!n) return null;
2969
+ let r = e.view.nodeDOM(n.pos);
2970
+ return r instanceof HTMLElement ? qn(t, r.getBoundingClientRect()) : null;
2971
+ }
2972
+ function Yn(e, t, n) {
2973
+ let r = e.view.posAtCoords({
2974
+ left: t,
2975
+ top: n
2976
+ });
2977
+ return r && r.inside >= 0 ? Xe(e.state.doc, r.inside) : null;
2978
+ }
2979
+ function Xn(e) {
2980
+ let t = e.node.type.name;
2981
+ return Ie.has(t) || Le.has(t);
2982
+ }
2983
+ function Zn({ editor: e, host: t }) {
2984
+ let { dragSession: r, hoverStore: a, nodeLabel: s, t: d } = Q(), f = c(s);
2985
+ o(() => {
2986
+ f.current = s;
2987
+ });
2988
+ let p = u(a.subscribe, a.get), m = p === null ? null : e.state.doc.nodeAt(p), g = p !== null && m ? {
2989
+ pos: p,
2990
+ node: m
2991
+ } : null, [_, v] = l(null), [y, b] = l(null), [, x] = l(0), S = n(() => x((e) => e + 1), []), C = h({
2992
+ editor: e,
2993
+ selector: ({ editor: e }) => {
2994
+ if (!e?.isFocused) return null;
2995
+ let t = $e(e);
2996
+ return t ? `${t.pos}:${t.node.type.name}:${e.state.doc.content.size}` : null;
2997
+ }
2998
+ }) ? $e(e) : null;
2999
+ i(() => {
3000
+ let n = () => S(), r = () => {
3001
+ a.set(null), S();
3002
+ };
3003
+ e.on("update", r);
3004
+ let i = new ResizeObserver(n);
3005
+ return i.observe(e.view.dom), t.addEventListener("load", n, !0), window.addEventListener("resize", n), () => {
3006
+ e.off("update", r), i.disconnect(), t.removeEventListener("load", n, !0), window.removeEventListener("resize", n);
3007
+ };
3008
+ }, [
3009
+ e,
3010
+ t,
3011
+ S,
3012
+ a
3013
+ ]), i(() => {
3014
+ let n = 0, i = (t) => {
3015
+ r.get() || t.target.closest(".bree-ov-toolbar, .bree-ov-handle, .bree-ov-tag") || (cancelAnimationFrame(n), n = requestAnimationFrame(() => {
3016
+ a.set(Yn(e, t.clientX, t.clientY)?.pos ?? null);
3017
+ }));
3018
+ }, o = () => a.set(null);
3019
+ return t.addEventListener("mousemove", i), t.addEventListener("mouseleave", o), () => {
3020
+ cancelAnimationFrame(n), t.removeEventListener("mousemove", i), t.removeEventListener("mouseleave", o);
3021
+ };
3022
+ }, [
3023
+ e,
3024
+ t,
3025
+ r,
3026
+ a
3027
+ ]), i(() => {
3028
+ let n = (n) => {
3029
+ if (n.button !== 0 || n.shiftKey || n.metaKey || n.ctrlKey || n.target.closest(".bree-ov-layer")) return;
3030
+ if ([
3031
+ t,
3032
+ e.view.dom,
3033
+ e.view.dom.parentElement
3034
+ ].includes(n.target)) {
3035
+ n.preventDefault();
3036
+ let t = document.activeElement;
3037
+ t instanceof HTMLElement && t.blur(), e.commands.blur();
3038
+ return;
3039
+ }
3040
+ let r = Yn(e, n.clientX, n.clientY);
3041
+ r && Xn(r) && (n.preventDefault(), et(e, r));
3042
+ }, r = (t) => {
3043
+ e.view.dom.contains(t.target) && at(e, t);
3044
+ };
3045
+ return t.addEventListener("mousedown", n, !0), t.addEventListener("paste", r, !0), () => {
3046
+ t.removeEventListener("mousedown", n, !0), t.removeEventListener("paste", r, !0);
3047
+ };
3048
+ }, [e, t]), i(() => {
3049
+ let n = 0, i = null, o = null, s = (t) => {
3050
+ let n = r.get();
3051
+ if (!n || (i !== n && (i = n, o = We(e.view, n)), !o)) return null;
3052
+ let a = n.kind === "move" ? {
3053
+ from: n.pos,
3054
+ to: n.pos + (e.state.doc.nodeAt(n.pos)?.nodeSize ?? 0)
3055
+ } : void 0;
3056
+ return Ue(e.view, t.clientX, t.clientY, o, a);
3057
+ }, c = (e) => {
3058
+ let t = r.get();
3059
+ t && (e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = t.kind === "move" ? "move" : "copy"), cancelAnimationFrame(n), n = requestAnimationFrame(() => v(s(e))));
3060
+ }, l = (t) => {
3061
+ let i = r.get();
3062
+ if (!i) return;
3063
+ t.preventDefault(), t.stopPropagation(), cancelAnimationFrame(n);
3064
+ let o = s(t);
3065
+ o && Je(e, i, o), e.view.dragging = null, r.end(), v(null), b(null), a.set(null);
3066
+ }, u = (e) => {
3067
+ r.get() && (t.contains(e.relatedTarget) || (cancelAnimationFrame(n), v(null)));
3068
+ }, d = () => {
3069
+ cancelAnimationFrame(n), r.end(), v(null), b(null), a.set(null);
3070
+ }, p = (t) => {
3071
+ let n = t.target;
3072
+ if (r.get() || n.tagName !== "IMG" || !e.view.dom.contains(n)) return;
3073
+ let i = e.view.posAtDOM(n, 0), a = Xe(e.state.doc, i);
3074
+ a && !Ze(a) && (r.start({
3075
+ kind: "move",
3076
+ pos: a.pos,
3077
+ label: f.current(a.node.type.name)
3078
+ }), requestAnimationFrame(() => b(a.pos)));
3079
+ }, m = (t) => {
3080
+ if (t.key !== "Escape" || !e.isFocused) return;
3081
+ let n = $e(e), r = n ? Qe(e.state.doc, n) : null;
3082
+ if (t.preventDefault(), r) et(e, r);
3083
+ else {
3084
+ let t = document.activeElement;
3085
+ t instanceof HTMLElement && t.blur(), e.commands.blur();
3086
+ }
3087
+ };
3088
+ return t.addEventListener("dragstart", p, !0), t.addEventListener("keydown", m, !0), t.addEventListener("dragover", c, !0), t.addEventListener("drop", l, !0), t.addEventListener("dragleave", u, !0), document.addEventListener("dragend", d), () => {
3089
+ cancelAnimationFrame(n), t.removeEventListener("dragstart", p, !0), t.removeEventListener("keydown", m, !0), t.removeEventListener("dragover", c, !0), t.removeEventListener("drop", l, !0), t.removeEventListener("dragleave", u, !0), document.removeEventListener("dragend", d);
3090
+ };
3091
+ }, [
3092
+ e,
3093
+ t,
3094
+ r,
3095
+ a
3096
+ ]);
3097
+ let w = (t, n) => {
3098
+ let i = e.view.nodeDOM(n.pos);
3099
+ if (r.start({
3100
+ kind: "move",
3101
+ pos: n.pos,
3102
+ label: s(n.node.type.name)
3103
+ }), t.dataTransfer.setData(Re, "move"), t.dataTransfer.effectAllowed = "move", i instanceof HTMLElement) {
3104
+ let e = i.getBoundingClientRect();
3105
+ t.dataTransfer.setDragImage(i, Math.min(24, e.width / 2), Math.min(24, e.height / 2));
3106
+ }
3107
+ requestAnimationFrame(() => b(n.pos));
3108
+ }, T = y !== null, E = g && g.pos !== C?.pos ? Jn(e, t, g) : null, D = Jn(e, t, C), ee = T ? Jn(e, t, Xe(e.state.doc, y)) : null, O = C ? Qe(e.state.doc, C) : null;
3109
+ return /* @__PURE__ */ R("div", {
3110
+ className: "bree-ov-layer",
3111
+ children: [
3112
+ E && g && /* @__PURE__ */ L("div", {
3113
+ className: z("bree-ov-frame bree-ov-hover", T && "bree-ov-ghost"),
3114
+ style: E,
3115
+ children: /* @__PURE__ */ L("button", {
3116
+ type: "button",
3117
+ className: "bree-ov-tag",
3118
+ onMouseDown: (t) => {
3119
+ t.preventDefault(), et(e, g);
3120
+ },
3121
+ children: s(g.node.type.name)
3122
+ })
3123
+ }),
3124
+ D && C && /* @__PURE__ */ R("div", {
3125
+ className: z("bree-ov-frame bree-ov-selected", T && "bree-ov-ghost"),
3126
+ style: D,
3127
+ children: [
3128
+ /* @__PURE__ */ L("span", {
3129
+ className: "bree-ov-tag bree-ov-tag-selected",
3130
+ children: s(C.node.type.name)
3131
+ }),
3132
+ !Ze(C) && /* @__PURE__ */ L(A, { children: /* @__PURE__ */ L("span", {
3133
+ className: "bree-ov-handle",
3134
+ role: "button",
3135
+ tabIndex: -1,
3136
+ draggable: !0,
3137
+ title: d.canvas.move,
3138
+ "aria-label": d.canvas.moveLabel(s(C.node.type.name)),
3139
+ onDragStart: (e) => w(e, C),
3140
+ children: /* @__PURE__ */ L(Tt, {})
3141
+ }) }),
3142
+ /* @__PURE__ */ L(A, { children: /* @__PURE__ */ R("div", {
3143
+ className: "bree-ov-toolbar",
3144
+ onMouseDown: (e) => e.preventDefault(),
3145
+ children: [O && /* @__PURE__ */ L("button", {
3146
+ type: "button",
3147
+ className: "bree-ov-tool",
3148
+ title: d.canvas.selectParent(s(O.node.type.name)),
3149
+ onClick: () => et(e, O),
3150
+ children: /* @__PURE__ */ L(Ot, {})
3151
+ }), !Ze(C) && /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("button", {
3152
+ type: "button",
3153
+ className: "bree-ov-tool",
3154
+ title: d.canvas.duplicate,
3155
+ onClick: () => tt(e, C),
3156
+ children: /* @__PURE__ */ L(Et, {})
3157
+ }), /* @__PURE__ */ L("button", {
3158
+ type: "button",
3159
+ className: "bree-ov-tool bree-ov-danger",
3160
+ title: d.canvas.delete,
3161
+ onClick: () => nt(e, C),
3162
+ children: /* @__PURE__ */ L(Dt, {})
3163
+ })] })]
3164
+ }) })
3165
+ ]
3166
+ }),
3167
+ ee && /* @__PURE__ */ L("div", {
3168
+ className: "bree-ov-frame bree-ov-source",
3169
+ style: ee
3170
+ }),
3171
+ _ && /* @__PURE__ */ L(Qn, {
3172
+ host: t,
3173
+ target: _,
3174
+ label: r.get()?.label ?? "",
3175
+ messages: d
3176
+ })
3177
+ ]
3178
+ });
3179
+ }
3180
+ function Qn({ host: e, target: t, label: n, messages: r }) {
3181
+ if (t.emptyZone) {
3182
+ let i = qn(e, t.emptyZone);
3183
+ return /* @__PURE__ */ L("div", {
3184
+ className: "bree-ov-dropzone",
3185
+ style: i,
3186
+ children: /* @__PURE__ */ R("span", { children: [
3187
+ /* @__PURE__ */ L(ge, { size: 14 }),
3188
+ " ",
3189
+ r.canvas.dropLabel(n)
3190
+ ] })
3191
+ });
3192
+ }
3193
+ if (!t.line) return null;
3194
+ let i = qn(e, {
3195
+ ...t.line,
3196
+ height: 0
3197
+ });
3198
+ return /* @__PURE__ */ L("div", {
3199
+ className: "bree-ov-dropline",
3200
+ style: {
3201
+ top: i.top,
3202
+ left: i.left,
3203
+ width: i.width
3204
+ },
3205
+ children: /* @__PURE__ */ L("span", {
3206
+ className: "bree-ov-dropline-label",
3207
+ children: r.canvas.dropHere
3208
+ })
3209
+ });
3210
+ }
3211
+ //#endregion
3212
+ //#region src/components/Canvas.tsx
3213
+ function $n({ overlay: e = !0, bubbleMenu: t = !0, slashCommands: n = !0, className: r, style: i, children: a }) {
3214
+ let { editor: o, device: c, t: u } = Q(), [d, p] = l(null), m = s(() => Array.isArray(n) ? n : Ce.map((e) => ({
3215
+ ...e,
3216
+ ...u.slashCommands[e.title]
3217
+ })), [n, u]);
3218
+ return /* @__PURE__ */ R("div", {
3219
+ ref: p,
3220
+ className: z("bree-canvas", r),
3221
+ style: i,
3222
+ "data-device": c,
3223
+ children: [
3224
+ /* @__PURE__ */ L(f, {
3225
+ editor: o,
3226
+ className: "bree-canvas-content"
3227
+ }),
3228
+ t && /* @__PURE__ */ R(I, { children: [
3229
+ /* @__PURE__ */ L(k, {
3230
+ hideWhenActiveNodes: ["button", "horizontalRule"],
3231
+ hideWhenActiveMarks: ["link"]
3232
+ }),
3233
+ /* @__PURE__ */ L(k.LinkDefault, {}),
3234
+ /* @__PURE__ */ L(k.ButtonDefault, {}),
3235
+ /* @__PURE__ */ L(k.ImageDefault, {})
3236
+ ] }),
3237
+ n !== !1 && /* @__PURE__ */ L(_e, { items: m }),
3238
+ e && d && /* @__PURE__ */ L(Zn, {
3239
+ editor: o,
3240
+ host: d
3241
+ }),
3242
+ a
3243
+ ]
3244
+ });
3245
+ }
3246
+ //#endregion
3247
+ //#region src/core/layers.ts
3248
+ function er(e, t) {
3249
+ let n = e.child(t);
3250
+ return t === e.childCount - 1 && e.childCount > 1 && Ve(n) && e.child(t - 1).type.name !== "paragraph";
3251
+ }
3252
+ function tr(e, t, n, r) {
3253
+ let i = [];
3254
+ return e.forEach((a, o, s) => {
3255
+ if (er(e, s)) return;
3256
+ let c = t + 1 + o, l = a.type.name, u = `${r}${s}`, d = Ie.has(l), f = d && a.childCount === 1 && Ve(a.firstChild), p = d || Le.has(l);
3257
+ i.push({
3258
+ key: u,
3259
+ pos: c,
3260
+ node: a,
3261
+ depth: n,
3262
+ index: s + 1,
3263
+ children: p && !f ? tr(a, c, n + 1, `${u}.`) : [],
3264
+ accepts: d,
3265
+ fixed: l === "columnsColumn",
3266
+ empty: f
3267
+ });
3268
+ }), i;
3269
+ }
3270
+ function nr(e) {
3271
+ let t = He(e);
3272
+ return t ? tr(t.node, t.pos, 0, "") : [];
3273
+ }
3274
+ function rr(e, t) {
3275
+ return e.fixed ? "inside" : e.accepts ? t < .25 ? "before" : t > .75 ? "after" : "inside" : t < .5 ? "before" : "after";
3276
+ }
3277
+ function ir(e, t, n, r, i) {
3278
+ let a, o;
3279
+ if (n === "inside") {
3280
+ if (!t.accepts) return null;
3281
+ t.empty ? (a = t.pos + 1, o = a + t.node.firstChild.nodeSize) : a = t.pos + t.node.nodeSize - 1;
3282
+ } else {
3283
+ if (t.fixed) return null;
3284
+ a = n === "before" ? t.pos : t.pos + t.node.nodeSize;
3285
+ }
3286
+ if (i && a >= i.from && a <= i.to) return null;
3287
+ let s = e.resolve(a), c = s.index();
3288
+ return s.parent.canReplace(c, o === void 0 ? c : c + 1, r) ? {
3289
+ pos: a,
3290
+ replaceTo: o
3291
+ } : null;
3292
+ }
3293
+ //#endregion
3294
+ //#region src/components/LayersPanel.tsx
3295
+ function ar({ onClose: e, title: t, className: n, style: r }) {
3296
+ let { editor: a, t: o, locale: d, nodes: f, nodeLabel: p, dragSession: m, hoverStore: g } = Q(), _ = (e) => e.node.type.name === "columnsColumn" ? o.layers.column(e.index) : p(e.node.type.name), v = (e) => (f.get(e.node.type.name)?.preview ?? _n)(e.node, {
3297
+ locale: d,
3298
+ t: o
3299
+ }), y = h({
3300
+ editor: a,
3301
+ selector: ({ editor: e }) => e?.state.doc ?? null,
3302
+ equalityFn: (e, t) => e === t
3303
+ }), b = h({
3304
+ editor: a,
3305
+ selector: ({ editor: e }) => e?.isFocused ? $e(e)?.pos ?? null : null
3306
+ }), x = u(g.subscribe, g.get), S = s(() => y ? nr(y) : [], [y]), [C, w] = l(() => /* @__PURE__ */ new Set()), [T, E] = l(null), D = c(null);
3307
+ i(() => {
3308
+ b !== null && D.current?.querySelector("[aria-selected=\"true\"]")?.scrollIntoView({ block: "nearest" });
3309
+ }, [b]);
3310
+ let ee = (e) => w((t) => {
3311
+ let n = new Set(t);
3312
+ return n.has(e) ? n.delete(e) : n.add(e), n;
3313
+ }), O = (e) => {
3314
+ et(a, {
3315
+ pos: e.pos,
3316
+ node: e.node
3317
+ });
3318
+ let t = a.view.nodeDOM(e.pos);
3319
+ t instanceof HTMLElement && t.scrollIntoView({
3320
+ block: "nearest",
3321
+ behavior: "smooth"
3322
+ });
3323
+ }, te = (e, t) => {
3324
+ let n = m.get();
3325
+ if (!n) return null;
3326
+ let r = We(a.view, n);
3327
+ if (!r) return null;
3328
+ let i = e.currentTarget.getBoundingClientRect(), o = rr(t, (e.clientY - i.top) / i.height), s = n.kind === "move" ? a.state.doc.nodeAt(n.pos) : null, c = n.kind === "move" && s ? {
3329
+ from: n.pos,
3330
+ to: n.pos + s.nodeSize
3331
+ } : void 0, l = ir(a.state.doc, t, o, r, c);
3332
+ return l ? {
3333
+ zone: o,
3334
+ target: l,
3335
+ payload: n
3336
+ } : null;
3337
+ }, ne = () => {
3338
+ m.end(), E(null);
3339
+ }, k = (e) => e.map((e) => {
3340
+ let t = f.get(e.node.type.name)?.icon ?? N, n = e.children.length > 0, r = C.has(e.key), i = v(e), s = T?.key === e.key ? T.zone : null;
3341
+ return /* @__PURE__ */ R("div", {
3342
+ role: "none",
3343
+ children: [
3344
+ /* @__PURE__ */ R("div", {
3345
+ role: "treeitem",
3346
+ tabIndex: b === e.pos || b === null && e.key === "0" ? 0 : -1,
3347
+ "aria-level": e.depth + 1,
3348
+ "aria-selected": b === e.pos,
3349
+ "aria-expanded": n ? !r : void 0,
3350
+ className: z("bree-layer", b === e.pos && "bree-selected", x === e.pos && "bree-hovered", s && `bree-drop-${s}`, e.fixed && "bree-fixed"),
3351
+ style: { paddingLeft: 6 + e.depth * 16 },
3352
+ draggable: !e.fixed,
3353
+ title: e.fixed ? o.layers.fixedHint : o.layers.itemHint,
3354
+ onClick: () => O(e),
3355
+ onKeyDown: (t) => {
3356
+ if (t.key === "Enter" || t.key === " ") t.preventDefault(), O(e);
3357
+ else if (t.key === "ArrowLeft" && n && !r || t.key === "ArrowRight" && r) ee(e.key);
3358
+ else if (t.key === "ArrowDown" || t.key === "ArrowUp") {
3359
+ t.preventDefault();
3360
+ let e = [...D.current?.querySelectorAll("[role=\"treeitem\"]") ?? []];
3361
+ e[e.indexOf(t.currentTarget) + (t.key === "ArrowDown" ? 1 : -1)]?.focus();
3362
+ }
3363
+ },
3364
+ onMouseEnter: () => g.set(e.pos),
3365
+ onMouseLeave: () => g.set(null),
3366
+ onDragStart: (t) => {
3367
+ t.stopPropagation(), m.start({
3368
+ kind: "move",
3369
+ pos: e.pos,
3370
+ label: _(e)
3371
+ }), t.dataTransfer.setData(Re, "move"), t.dataTransfer.effectAllowed = "move";
3372
+ },
3373
+ onDragEnd: ne,
3374
+ onDragOver: (t) => {
3375
+ let n = te(t, e);
3376
+ if (!n) {
3377
+ T?.key === e.key && E(null);
3378
+ return;
3379
+ }
3380
+ t.preventDefault(), t.dataTransfer.dropEffect = n.payload.kind === "move" ? "move" : "copy", (T?.key !== e.key || T.zone !== n.zone) && E({
3381
+ key: e.key,
3382
+ zone: n.zone
3383
+ });
3384
+ },
3385
+ onDrop: (t) => {
3386
+ let n = te(t, e);
3387
+ t.preventDefault(), n && Je(a, n.payload, n.target), ne();
3388
+ },
3389
+ children: [
3390
+ n ? /* @__PURE__ */ L("button", {
3391
+ type: "button",
3392
+ className: z("bree-layer-caret", !r && "bree-open"),
3393
+ "aria-label": r ? o.layers.expand : o.layers.collapse,
3394
+ tabIndex: -1,
3395
+ onClick: (t) => {
3396
+ t.stopPropagation(), ee(e.key);
3397
+ },
3398
+ children: "›"
3399
+ }) : /* @__PURE__ */ L("span", { className: "bree-layer-caret-spacer" }),
3400
+ /* @__PURE__ */ L("span", {
3401
+ className: "bree-layer-icon",
3402
+ children: /* @__PURE__ */ L(t, { size: 14 })
3403
+ }),
3404
+ /* @__PURE__ */ L("span", {
3405
+ className: "bree-layer-label",
3406
+ children: _(e)
3407
+ }),
3408
+ i && /* @__PURE__ */ L("span", {
3409
+ className: "bree-layer-preview",
3410
+ children: i
3411
+ })
3412
+ ]
3413
+ }),
3414
+ e.empty && /* @__PURE__ */ L("div", {
3415
+ className: "bree-layer-empty",
3416
+ style: { paddingLeft: 6 + (e.depth + 1) * 16 + 18 },
3417
+ children: o.layers.emptyZone
3418
+ }),
3419
+ n && !r && /* @__PURE__ */ L("div", {
3420
+ role: "group",
3421
+ children: k(e.children)
3422
+ })
3423
+ ]
3424
+ }, e.key);
3425
+ });
3426
+ return /* @__PURE__ */ L(A, { children: /* @__PURE__ */ R("aside", {
3427
+ className: z("bree-layers", n),
3428
+ style: r,
3429
+ "aria-label": t ?? o.layers.title,
3430
+ tabIndex: -1,
3431
+ onDragLeave: (e) => !e.currentTarget.contains(e.relatedTarget) && E(null),
3432
+ children: [/* @__PURE__ */ R("header", {
3433
+ className: "bree-layers-header",
3434
+ children: [/* @__PURE__ */ L("h2", { children: t ?? o.layers.title }), /* @__PURE__ */ R("div", {
3435
+ className: "bree-layers-actions",
3436
+ children: [
3437
+ /* @__PURE__ */ L("button", {
3438
+ type: "button",
3439
+ className: "bree-icon-button bree-small",
3440
+ title: o.layers.expandAll,
3441
+ onClick: () => w(/* @__PURE__ */ new Set()),
3442
+ children: "⊞"
3443
+ }),
3444
+ /* @__PURE__ */ L("button", {
3445
+ type: "button",
3446
+ className: "bree-icon-button bree-small",
3447
+ title: o.layers.collapseAll,
3448
+ onClick: () => {
3449
+ let e = /* @__PURE__ */ new Set(), t = (n) => n.forEach((n) => {
3450
+ n.children.length && e.add(n.key), t(n.children);
3451
+ });
3452
+ t(S), w(e);
3453
+ },
3454
+ children: "⊟"
3455
+ }),
3456
+ e && /* @__PURE__ */ L("button", {
3457
+ type: "button",
3458
+ className: "bree-icon-button bree-small",
3459
+ title: o.layers.close,
3460
+ onClick: e,
3461
+ children: /* @__PURE__ */ L(F, { size: 14 })
3462
+ })
3463
+ ]
3464
+ })]
3465
+ }), /* @__PURE__ */ L("div", {
3466
+ className: "bree-layers-list",
3467
+ role: "tree",
3468
+ "aria-label": o.layers.tree,
3469
+ ref: D,
3470
+ children: S.length ? k(S) : /* @__PURE__ */ L("p", {
3471
+ className: "bree-hint",
3472
+ children: o.layers.emptyEmail
3473
+ })
3474
+ })]
3475
+ }) });
3476
+ }
3477
+ //#endregion
3478
+ //#region src/components/inspectors/DefaultInspector.tsx
3479
+ function or({ ctx: e, className: t, style: n }) {
3480
+ return /* @__PURE__ */ R("div", {
3481
+ className: z("bree-inspector", t),
3482
+ style: n,
3483
+ children: [
3484
+ /* @__PURE__ */ L(Yt, {
3485
+ ctx: e,
3486
+ alignment: String(e.getAttr("alignment") ?? "left"),
3487
+ setAlignment: (t) => e.setAttr("alignment", t)
3488
+ }),
3489
+ /* @__PURE__ */ L(q, { ctx: e }),
3490
+ /* @__PURE__ */ L(Xt, { ctx: e })
3491
+ ]
3492
+ });
3493
+ }
3494
+ //#endregion
3495
+ //#region src/components/PropertiesPanel.tsx
3496
+ function sr() {
3497
+ let { editor: e } = Q();
3498
+ return () => {
3499
+ let t = document.activeElement;
3500
+ t instanceof HTMLElement && t.blur(), e.commands.blur();
3501
+ };
3502
+ }
3503
+ function cr({ title: e, children: t, breadcrumb: n = !0, className: r, style: i }) {
3504
+ let { t: a, nodeLabel: o } = Q(), s = sr();
3505
+ return /* @__PURE__ */ R("div", {
3506
+ className: z("bree-properties", r),
3507
+ style: i,
3508
+ children: [
3509
+ /* @__PURE__ */ R("header", {
3510
+ className: "bree-properties-header",
3511
+ children: [/* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("span", {
3512
+ className: "bree-eyebrow",
3513
+ children: a.sidebar.propertiesEyebrow
3514
+ }), /* @__PURE__ */ L("h2", { children: e })] }), /* @__PURE__ */ L("button", {
3515
+ type: "button",
3516
+ className: "bree-icon-button",
3517
+ title: a.sidebar.closeProperties,
3518
+ onClick: s,
3519
+ children: /* @__PURE__ */ L(F, { size: 16 })
3520
+ })]
3521
+ }),
3522
+ n && /* @__PURE__ */ L(M.Breadcrumb, { children: (e) => e.length > 1 && /* @__PURE__ */ L("nav", {
3523
+ className: "bree-breadcrumb",
3524
+ "aria-label": a.sidebar.breadcrumb,
3525
+ children: e.map((t, n) => /* @__PURE__ */ R("span", {
3526
+ className: "bree-crumb",
3527
+ children: [n > 0 && /* @__PURE__ */ L("span", {
3528
+ className: "bree-crumb-sep",
3529
+ children: "/"
3530
+ }), /* @__PURE__ */ L("button", {
3531
+ type: "button",
3532
+ disabled: n === e.length - 1,
3533
+ onClick: t.focus,
3534
+ children: o(t.node.nodeType)
3535
+ })]
3536
+ }, `${t.node.nodeType}-${t.node.nodePos.pos}`))
3537
+ }) }),
3538
+ /* @__PURE__ */ L("div", {
3539
+ className: "bree-panel-scroll",
3540
+ children: t
3541
+ })
3542
+ ]
3543
+ });
3544
+ }
3545
+ //#endregion
3546
+ //#region src/components/BlockProperties.tsx
3547
+ function lr({ ctx: e, className: t, style: n }) {
3548
+ let { nodes: r, nodeLabel: i } = Q(), a = r.get(e.nodeType)?.inspector ?? or;
3549
+ return /* @__PURE__ */ L(cr, {
3550
+ title: i(e.nodeType),
3551
+ className: t,
3552
+ style: n,
3553
+ children: /* @__PURE__ */ L(a, { ctx: e }, `${e.nodeType}-${e.nodePos.pos}`)
3554
+ });
3555
+ }
3556
+ //#endregion
3557
+ //#region src/components/useDraggableBlock.ts
3558
+ function ur(e, t) {
3559
+ let { editor: n, dragSession: r } = Q();
3560
+ return {
3561
+ draggable: !0,
3562
+ onDragStart: (n) => {
3563
+ r.start({
3564
+ kind: "new",
3565
+ label: e,
3566
+ content: t
3567
+ }), n.dataTransfer.setData(Re, e), n.dataTransfer.effectAllowed = "copy";
3568
+ },
3569
+ onDragEnd: () => r.end(),
3570
+ onClick: () => rt(n, t())
3571
+ };
3572
+ }
3573
+ //#endregion
3574
+ //#region src/components/BlocksTab.tsx
3575
+ function dr({ template: e, className: t, style: n }) {
3576
+ let r = zn(), i = bt(e.label, r), a = ur(i, () => e.content(r));
3577
+ return /* @__PURE__ */ R("button", {
3578
+ type: "button",
3579
+ className: z("bree-block-card", t),
3580
+ style: n,
3581
+ ...a,
3582
+ children: [e.thumbnail ?? /* @__PURE__ */ L(Z, { variant: "default" }), /* @__PURE__ */ R("span", {
3583
+ className: "bree-block-text",
3584
+ children: [/* @__PURE__ */ L("strong", { children: i }), e.description && /* @__PURE__ */ L("span", { children: bt(e.description, r) })]
3585
+ })]
3586
+ });
3587
+ }
3588
+ function fr({ templates: e, className: t, style: n }) {
3589
+ let r = Q();
3590
+ return /* @__PURE__ */ L("div", {
3591
+ className: z("bree-block-list", t),
3592
+ style: n,
3593
+ children: (e ?? r.templates).map((e) => /* @__PURE__ */ L(dr, { template: e }, e.id))
3594
+ });
3595
+ }
3596
+ //#endregion
3597
+ //#region src/components/BodyTab.tsx
3598
+ function pr({ ctx: e, className: t, style: n }) {
3599
+ let { settings: r, updateSettings: i, t: a } = Q(), o = a.body, { findStyleValue: s, setGlobalStyle: c } = e;
3600
+ return /* @__PURE__ */ R("div", {
3601
+ className: z("bree-body-tab", t),
3602
+ style: n,
3603
+ children: [
3604
+ /* @__PURE__ */ L(V, {
3605
+ title: o.general,
3606
+ children: /* @__PURE__ */ L(H, {
3607
+ label: o.previewText,
3608
+ stacked: !0,
3609
+ children: /* @__PURE__ */ L(U, {
3610
+ value: r.previewText,
3611
+ onChange: (e) => i({ previewText: e }),
3612
+ placeholder: o.previewTextPlaceholder
3613
+ })
3614
+ })
3615
+ }),
3616
+ /* @__PURE__ */ R(V, {
3617
+ title: o.background,
3618
+ children: [/* @__PURE__ */ L(H, {
3619
+ label: o.backgroundColor,
3620
+ stacked: !0,
3621
+ children: /* @__PURE__ */ L(G, {
3622
+ value: s("body", "backgroundColor"),
3623
+ onChange: (e) => c("body", "backgroundColor", e)
3624
+ })
3625
+ }), /* @__PURE__ */ L(H, {
3626
+ label: o.outerPadding,
3627
+ children: /* @__PURE__ */ L(W, {
3628
+ value: s("body", "padding"),
3629
+ onChange: (e) => c("body", "padding", e)
3630
+ })
3631
+ })]
3632
+ }),
3633
+ /* @__PURE__ */ R(V, {
3634
+ title: o.content,
3635
+ children: [
3636
+ /* @__PURE__ */ L(H, {
3637
+ label: o.width,
3638
+ children: /* @__PURE__ */ L(W, {
3639
+ value: s("container", "width"),
3640
+ onChange: (e) => c("container", "width", e),
3641
+ min: 320,
3642
+ max: 900
3643
+ })
3644
+ }),
3645
+ /* @__PURE__ */ L(H, {
3646
+ label: o.contentColor,
3647
+ stacked: !0,
3648
+ children: /* @__PURE__ */ L(G, {
3649
+ value: s("container", "backgroundColor"),
3650
+ onChange: (e) => c("container", "backgroundColor", e)
3651
+ })
3652
+ }),
3653
+ /* @__PURE__ */ L(H, {
3654
+ label: o.innerPadding,
3655
+ children: /* @__PURE__ */ L(W, {
3656
+ value: s("container", "padding"),
3657
+ onChange: (e) => c("container", "padding", e)
3658
+ })
3659
+ }),
3660
+ /* @__PURE__ */ L(H, {
3661
+ label: o.radius,
3662
+ children: /* @__PURE__ */ L(W, {
3663
+ value: s("container", "borderRadius"),
3664
+ onChange: (e) => c("container", "borderRadius", e)
3665
+ })
3666
+ })
3667
+ ]
3668
+ }),
3669
+ /* @__PURE__ */ R(V, {
3670
+ title: o.defaultStyles,
3671
+ children: [
3672
+ /* @__PURE__ */ L(H, {
3673
+ label: o.text,
3674
+ stacked: !0,
3675
+ children: /* @__PURE__ */ L(G, {
3676
+ value: s("paragraph", "color"),
3677
+ onChange: (e) => c("paragraph", "color", e)
3678
+ })
3679
+ }),
3680
+ /* @__PURE__ */ L(H, {
3681
+ label: o.headings,
3682
+ stacked: !0,
3683
+ children: /* @__PURE__ */ L(G, {
3684
+ value: s("h1", "color"),
3685
+ onChange: (t) => e.batchSetGlobalStyle([
3686
+ "h1",
3687
+ "h2",
3688
+ "h3"
3689
+ ].map((e) => ({
3690
+ classReference: e,
3691
+ property: "color",
3692
+ value: t
3693
+ })))
3694
+ })
3695
+ }),
3696
+ /* @__PURE__ */ L(H, {
3697
+ label: o.links,
3698
+ stacked: !0,
3699
+ children: /* @__PURE__ */ L(G, {
3700
+ value: s("link", "color"),
3701
+ onChange: (e) => c("link", "color", e)
3702
+ })
3703
+ }),
3704
+ /* @__PURE__ */ L(H, {
3705
+ label: o.buttonBackground,
3706
+ stacked: !0,
3707
+ children: /* @__PURE__ */ L(G, {
3708
+ value: s("button", "backgroundColor"),
3709
+ onChange: (e) => c("button", "backgroundColor", e)
3710
+ })
3711
+ }),
3712
+ /* @__PURE__ */ L(H, {
3713
+ label: o.buttonText,
3714
+ stacked: !0,
3715
+ children: /* @__PURE__ */ L(G, {
3716
+ value: s("button", "color"),
3717
+ onChange: (e) => c("button", "color", e)
3718
+ })
3719
+ })
3720
+ ]
3721
+ })
3722
+ ]
3723
+ });
3724
+ }
3725
+ //#endregion
3726
+ //#region src/components/ContentTab.tsx
3727
+ function mr({ item: e, className: t, style: n }) {
3728
+ let r = zn(), i = bt(e.label, r), a = ur(i, () => e.content(r));
3729
+ return /* @__PURE__ */ R("button", {
3730
+ type: "button",
3731
+ className: z("bree-tile", t),
3732
+ style: n,
3733
+ title: r.t.sidebar.tileTitle(i),
3734
+ ...a,
3735
+ children: [/* @__PURE__ */ L("span", {
3736
+ className: "bree-tile-icon",
3737
+ children: e.icon
3738
+ }), /* @__PURE__ */ L("span", {
3739
+ className: "bree-tile-label",
3740
+ children: i
3741
+ })]
3742
+ });
3743
+ }
3744
+ function hr({ items: e, groups: t, hint: n, className: r, style: i }) {
3745
+ let a = Q(), o = e ?? a.palette, s = t ?? a.paletteGroups, c = [...s, ...[...new Set(o.map((e) => e.group))].filter((e) => !s.some((t) => t.id === e)).map((e) => ({
3746
+ id: e,
3747
+ title: e
3748
+ }))];
3749
+ return /* @__PURE__ */ R("div", {
3750
+ className: z("bree-content-tab", r),
3751
+ style: i,
3752
+ children: [c.map((e) => {
3753
+ let t = o.filter((t) => t.group === e.id);
3754
+ return t.length ? /* @__PURE__ */ R("section", { children: [/* @__PURE__ */ L("h3", {
3755
+ className: "bree-panel-title",
3756
+ children: bt(e.title, a)
3757
+ }), /* @__PURE__ */ L("div", {
3758
+ className: "bree-tiles",
3759
+ children: t.map((e) => /* @__PURE__ */ L(mr, { item: e }, e.id))
3760
+ })] }, e.id) : null;
3761
+ }), n !== null && /* @__PURE__ */ L("p", {
3762
+ className: "bree-hint",
3763
+ children: n ?? a.t.sidebar.dragHint
3764
+ })]
3765
+ });
3766
+ }
3767
+ //#endregion
3768
+ //#region src/components/ContentPanel.tsx
3769
+ function gr({ ctx: e, tabs: t = [
3770
+ "content",
3771
+ "blocks",
3772
+ "body"
3773
+ ], defaultTab: n, className: r, style: i }) {
3774
+ let { t: a } = Q(), o = {
3775
+ content: {
3776
+ id: "content",
3777
+ label: a.sidebar.tabContent,
3778
+ render: () => /* @__PURE__ */ L(hr, {})
3779
+ },
3780
+ blocks: {
3781
+ id: "blocks",
3782
+ label: a.sidebar.tabBlocks,
3783
+ render: () => /* @__PURE__ */ L(fr, {})
3784
+ },
3785
+ body: {
3786
+ id: "body",
3787
+ label: a.sidebar.tabBody,
3788
+ render: (e) => /* @__PURE__ */ L(pr, { ctx: e })
3789
+ }
3790
+ }, s = t.map((e) => typeof e == "string" ? o[e] : e), [c, u] = l(n ?? s[0]?.id), d = s.find((e) => e.id === c) ?? s[0];
3791
+ return /* @__PURE__ */ R("div", {
3792
+ className: z("bree-content-panel", r),
3793
+ style: i,
3794
+ children: [s.length > 1 && /* @__PURE__ */ L("nav", {
3795
+ className: "bree-tabs",
3796
+ role: "tablist",
3797
+ children: s.map((e) => /* @__PURE__ */ L("button", {
3798
+ type: "button",
3799
+ role: "tab",
3800
+ "aria-selected": e.id === d?.id,
3801
+ className: z(e.id === d?.id && "bree-active"),
3802
+ onClick: () => u(e.id),
3803
+ children: e.label
3804
+ }, e.id))
3805
+ }), /* @__PURE__ */ L("div", {
3806
+ className: "bree-panel-scroll",
3807
+ children: d?.render(e)
3808
+ })]
3809
+ });
3810
+ }
3811
+ //#endregion
3812
+ //#region src/components/TextProperties.tsx
3813
+ function _r({ ctx: e, className: t, style: n }) {
3814
+ let r = $(), i = r.inspector, a = [
3815
+ {
3816
+ mark: "bold",
3817
+ Icon: ne,
3818
+ title: i.bold
3819
+ },
3820
+ {
3821
+ mark: "italic",
3822
+ Icon: ce,
3823
+ title: i.italic
3824
+ },
3825
+ {
3826
+ mark: "underline",
3827
+ Icon: Se,
3828
+ title: i.underline
3829
+ },
3830
+ {
3831
+ mark: "strike",
3832
+ Icon: ye,
3833
+ title: i.strike
3834
+ }
3835
+ ];
3836
+ return /* @__PURE__ */ R(cr, {
3837
+ title: r.sidebar.selectedText,
3838
+ className: t,
3839
+ style: n,
3840
+ children: [
3841
+ /* @__PURE__ */ L(V, {
3842
+ title: i.formatting,
3843
+ children: /* @__PURE__ */ L("div", {
3844
+ className: "bree-mark-row",
3845
+ children: a.map(({ mark: t, Icon: n, title: r }) => /* @__PURE__ */ L("button", {
3846
+ type: "button",
3847
+ title: r,
3848
+ "aria-pressed": !!e.marks[t],
3849
+ className: z("bree-mark", e.marks[t] && "bree-active"),
3850
+ onClick: () => e.toggleMark(t),
3851
+ children: /* @__PURE__ */ L(n, { size: 14 })
3852
+ }, t))
3853
+ })
3854
+ }),
3855
+ /* @__PURE__ */ L(Yt, {
3856
+ ctx: e,
3857
+ alignment: e.alignment,
3858
+ setAlignment: e.setAlignment
3859
+ }),
3860
+ e.isLinkActive && /* @__PURE__ */ R(V, {
3861
+ title: i.link,
3862
+ children: [/* @__PURE__ */ L(H, {
3863
+ label: i.url,
3864
+ stacked: !0,
3865
+ children: /* @__PURE__ */ L("span", {
3866
+ className: "bree-readonly",
3867
+ children: e.linkHref
3868
+ })
3869
+ }), /* @__PURE__ */ L(H, {
3870
+ label: i.linkColor,
3871
+ stacked: !0,
3872
+ children: /* @__PURE__ */ L(G, {
3873
+ value: e.linkColor,
3874
+ presets: e.presetColors,
3875
+ onChange: e.setLinkColor
3876
+ })
3877
+ })]
3878
+ })
3879
+ ]
3880
+ });
3881
+ }
3882
+ //#endregion
3883
+ //#region src/components/Sidebar.tsx
3884
+ function vr({ renderDocument: e = (e) => /* @__PURE__ */ L(gr, { ctx: e }), renderNode: t = (e) => /* @__PURE__ */ L(lr, { ctx: e }), renderText: n = (e) => /* @__PURE__ */ L(_r, { ctx: e }), className: r, style: i }) {
3885
+ let { t: a } = Q();
3886
+ return /* @__PURE__ */ R(M.Root, {
3887
+ className: z("bree-sidebar", r),
3888
+ style: i,
3889
+ "aria-label": a.sidebar.label,
3890
+ children: [
3891
+ /* @__PURE__ */ L(M.Document, { children: e }),
3892
+ /* @__PURE__ */ L(M.Node, { children: t }),
3893
+ /* @__PURE__ */ L(M.Text, { children: n })
3894
+ ]
3895
+ });
3896
+ }
3897
+ //#endregion
3898
+ //#region src/components/PreviewDialog.tsx
3899
+ function yr(e, t, n) {
3900
+ let r = URL.createObjectURL(new Blob([t], { type: n })), i = document.createElement("a");
3901
+ i.href = r, i.download = e, i.click(), URL.revokeObjectURL(r);
3902
+ }
3903
+ function br({ onClose: e, defaultView: t = "desktop", views: n = [
3904
+ "desktop",
3905
+ "mobile",
3906
+ "html",
3907
+ "text"
3908
+ ], filename: r = "email.html", className: a, style: o }) {
3909
+ let { handle: s, settings: c, t: u } = Q(), [d, f] = l(t), [p, m] = l(null), [h, g] = l(null), [_, v] = l(!1);
3910
+ i(() => {
3911
+ let e = !1;
3912
+ return s.exportEmail().then((t) => !e && m(t)).catch((t) => !e && g(t instanceof Error ? t.message : String(t))), () => {
3913
+ e = !0;
3914
+ };
3915
+ }, [s, c.previewText]), i(() => {
3916
+ let t = (t) => t.key === "Escape" && e();
3917
+ return window.addEventListener("keydown", t), () => window.removeEventListener("keydown", t);
3918
+ }, [e]);
3919
+ let y = async () => {
3920
+ p && (await navigator.clipboard.writeText(d === "text" ? p.text : p.html), v(!0), setTimeout(() => v(!1), 1500));
3921
+ }, b = u.preview;
3922
+ return Ne(/* @__PURE__ */ L(A, { children: /* @__PURE__ */ L("div", {
3923
+ className: "bree bree-modal-backdrop",
3924
+ onMouseDown: (t) => t.target === t.currentTarget && e(),
3925
+ children: /* @__PURE__ */ R("div", {
3926
+ className: z("bree-modal", a),
3927
+ style: o,
3928
+ role: "dialog",
3929
+ "aria-modal": "true",
3930
+ "aria-label": b.dialogLabel,
3931
+ children: [/* @__PURE__ */ R("header", {
3932
+ className: "bree-modal-header",
3933
+ children: [/* @__PURE__ */ L("nav", {
3934
+ className: "bree-tabs bree-compact",
3935
+ role: "tablist",
3936
+ children: n.map((e) => /* @__PURE__ */ L("button", {
3937
+ type: "button",
3938
+ role: "tab",
3939
+ "aria-selected": d === e,
3940
+ className: z(d === e && "bree-active"),
3941
+ onClick: () => f(e),
3942
+ children: b[e]
3943
+ }, e))
3944
+ }), /* @__PURE__ */ R("div", {
3945
+ className: "bree-modal-actions",
3946
+ children: [
3947
+ p && (d === "html" || d === "text") && /* @__PURE__ */ L("button", {
3948
+ type: "button",
3949
+ className: "bree-btn",
3950
+ onClick: y,
3951
+ children: _ ? b.copied : b.copy
3952
+ }),
3953
+ p && /* @__PURE__ */ L("button", {
3954
+ type: "button",
3955
+ className: "bree-btn bree-primary",
3956
+ onClick: () => yr(r, p.unformattedHtml, "text/html"),
3957
+ children: b.download
3958
+ }),
3959
+ /* @__PURE__ */ L("button", {
3960
+ type: "button",
3961
+ className: "bree-icon-button",
3962
+ onClick: e,
3963
+ title: b.close,
3964
+ children: /* @__PURE__ */ L(F, { size: 18 })
3965
+ })
3966
+ ]
3967
+ })]
3968
+ }), /* @__PURE__ */ R("div", {
3969
+ className: "bree-modal-body",
3970
+ children: [
3971
+ h && /* @__PURE__ */ L("p", {
3972
+ className: "bree-error",
3973
+ children: b.renderError(h)
3974
+ }),
3975
+ !p && !h && /* @__PURE__ */ L("p", {
3976
+ className: "bree-loading",
3977
+ children: b.rendering
3978
+ }),
3979
+ p && (d === "desktop" || d === "mobile") && /* @__PURE__ */ L("div", {
3980
+ className: z("bree-preview-frame", `bree-preview-${d}`),
3981
+ children: /* @__PURE__ */ L("iframe", {
3982
+ title: b.iframeTitle,
3983
+ srcDoc: p.html,
3984
+ sandbox: "allow-same-origin allow-popups"
3985
+ })
3986
+ }),
3987
+ p && d === "html" && /* @__PURE__ */ L("pre", {
3988
+ className: "bree-code",
3989
+ children: p.html
3990
+ }),
3991
+ p && d === "text" && /* @__PURE__ */ L("pre", {
3992
+ className: "bree-code",
3993
+ children: p.text
3994
+ })
3995
+ ]
3996
+ })]
3997
+ })
3998
+ }) }), document.body);
3999
+ }
4000
+ //#endregion
4001
+ //#region src/components/TopBar.tsx
4002
+ function xr({ className: e, style: t }) {
4003
+ let { layersOpen: n, setLayersOpen: r, t: i } = Q();
4004
+ return /* @__PURE__ */ R("button", {
4005
+ type: "button",
4006
+ className: z("bree-btn bree-ghost bree-layers-toggle", n && "bree-active", e),
4007
+ style: t,
4008
+ "aria-pressed": n,
4009
+ onClick: () => r(!n),
4010
+ title: i.topBar.toggleLayers,
4011
+ children: [
4012
+ /* @__PURE__ */ L(Nt, {}),
4013
+ " ",
4014
+ i.topBar.layers
4015
+ ]
4016
+ });
4017
+ }
4018
+ function Sr({ className: e, style: t }) {
4019
+ let { editor: n, t: r } = Q(), i = h({
4020
+ editor: n,
4021
+ selector: ({ editor: e }) => ({
4022
+ undo: !!e?.can().undo(),
4023
+ redo: !!e?.can().redo()
4024
+ })
4025
+ });
4026
+ return /* @__PURE__ */ R("div", {
4027
+ className: z("bree-btn-group", e),
4028
+ style: t,
4029
+ children: [/* @__PURE__ */ L("button", {
4030
+ type: "button",
4031
+ className: "bree-icon-button",
4032
+ title: r.topBar.undo,
4033
+ disabled: !i?.undo,
4034
+ onClick: () => n.chain().focus().undo().run(),
4035
+ children: /* @__PURE__ */ L(kt, {})
4036
+ }), /* @__PURE__ */ L("button", {
4037
+ type: "button",
4038
+ className: "bree-icon-button",
4039
+ title: r.topBar.redo,
4040
+ disabled: !i?.redo,
4041
+ onClick: () => n.chain().focus().redo().run(),
4042
+ children: /* @__PURE__ */ L(At, {})
4043
+ })]
4044
+ });
4045
+ }
4046
+ function Cr({ className: e, style: t }) {
4047
+ let { device: n, setDevice: r, t: i } = Q(), a = [{
4048
+ id: "desktop",
4049
+ label: i.topBar.desktop,
4050
+ Icon: jt
4051
+ }, {
4052
+ id: "mobile",
4053
+ label: i.topBar.mobile,
4054
+ Icon: Mt
4055
+ }];
4056
+ return /* @__PURE__ */ L("div", {
4057
+ className: z("bree-segmented bree-device-toggle", e),
4058
+ style: t,
4059
+ role: "radiogroup",
4060
+ "aria-label": i.topBar.canvasWidth,
4061
+ children: a.map(({ id: e, label: t, Icon: i }) => /* @__PURE__ */ L("button", {
4062
+ type: "button",
4063
+ role: "radio",
4064
+ "aria-checked": n === e,
4065
+ className: z(n === e && "bree-active"),
4066
+ onClick: () => r(e),
4067
+ title: t,
4068
+ children: /* @__PURE__ */ L(i, {})
4069
+ }, e))
4070
+ });
4071
+ }
4072
+ function wr({ className: e, style: t }) {
4073
+ let { editor: n, starterDocument: r, locale: i, t: a } = Q();
4074
+ return /* @__PURE__ */ L("button", {
4075
+ type: "button",
4076
+ className: z("bree-btn bree-ghost", e),
4077
+ style: t,
4078
+ onClick: () => {
4079
+ confirm(a.topBar.confirmTemplate) && n.commands.setContent(r({
4080
+ locale: i,
4081
+ t: a
4082
+ }));
4083
+ },
4084
+ children: a.topBar.template
4085
+ });
4086
+ }
4087
+ function Tr({ className: e, style: t }) {
4088
+ let { handle: n, t: r } = Q(), i = c(null), a = async (e) => {
4089
+ try {
4090
+ n.setValue(JSON.parse(await e.text()));
4091
+ } catch (e) {
4092
+ alert(r.topBar.invalidFile(e instanceof Error ? e.message : String(e)));
4093
+ }
4094
+ };
4095
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("button", {
4096
+ type: "button",
4097
+ className: z("bree-btn bree-ghost", e),
4098
+ style: t,
4099
+ onClick: () => i.current?.click(),
4100
+ children: r.topBar.import
4101
+ }), /* @__PURE__ */ L("input", {
4102
+ ref: i,
4103
+ type: "file",
4104
+ accept: "application/json,.json",
4105
+ hidden: !0,
4106
+ onChange: (e) => {
4107
+ let t = e.target.files?.[0];
4108
+ t && a(t), e.target.value = "";
4109
+ }
4110
+ })] });
4111
+ }
4112
+ function Er({ className: e, style: t, filename: n = "email.json" }) {
4113
+ let { handle: r, t: i } = Q();
4114
+ return /* @__PURE__ */ L("button", {
4115
+ type: "button",
4116
+ className: z("bree-btn bree-ghost", e),
4117
+ style: t,
4118
+ onClick: () => yr(n, JSON.stringify(r.getValue(), null, 2), "application/json"),
4119
+ children: i.topBar.exportJson
4120
+ });
4121
+ }
4122
+ function Dr({ view: e = "desktop", variant: t = "default", children: n, className: r, style: i }) {
4123
+ let { t: a } = Q(), [o, s] = l(!1);
4124
+ return /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("button", {
4125
+ type: "button",
4126
+ className: z("bree-btn", t !== "default" && `bree-${t}`, r),
4127
+ style: i,
4128
+ onClick: () => s(!0),
4129
+ children: n ?? a.topBar.preview
4130
+ }), o && /* @__PURE__ */ L(br, {
4131
+ defaultView: e,
4132
+ onClose: () => s(!1)
4133
+ })] });
4134
+ }
4135
+ function Or(e) {
4136
+ let { t } = Q();
4137
+ return /* @__PURE__ */ L(Dr, {
4138
+ view: "html",
4139
+ variant: "primary",
4140
+ ...e,
4141
+ children: t.topBar.exportHtml
4142
+ });
4143
+ }
4144
+ function kr({ brand: e, actions: t, children: n, className: r, style: i }) {
4145
+ return /* @__PURE__ */ L(A, { children: /* @__PURE__ */ R("header", {
4146
+ className: z("bree-topbar", r),
4147
+ style: i,
4148
+ children: [/* @__PURE__ */ L("div", {
4149
+ className: "bree-topbar-start",
4150
+ children: e
4151
+ }), n ?? /* @__PURE__ */ R(I, { children: [/* @__PURE__ */ L("div", {
4152
+ className: "bree-topbar-center",
4153
+ children: /* @__PURE__ */ L(Cr, {})
4154
+ }), /* @__PURE__ */ R("div", {
4155
+ className: "bree-topbar-actions",
4156
+ children: [t, /* @__PURE__ */ L(Or, {})]
4157
+ })] })]
4158
+ }) });
4159
+ }
4160
+ //#endregion
4161
+ //#region src/components/BetterEmailEditor.tsx
4162
+ function Ar({ showTopBar: e = !0, showLayers: t = !0, showSidebar: n = !0, components: r = {}, slotProps: i = {} }) {
4163
+ let { layersOpen: a } = Q(), { TopBar: o = kr, LayersPanel: s = ar, Canvas: c = $n, Sidebar: l = vr } = r, u = t && a;
4164
+ return /* @__PURE__ */ R("div", {
4165
+ className: z("bree-layout", e && "bree-with-topbar", u && "bree-with-layers", n && "bree-with-sidebar"),
4166
+ children: [
4167
+ e && /* @__PURE__ */ L(o, { ...i.topBar }),
4168
+ u && /* @__PURE__ */ L(s, { ...i.layersPanel }),
4169
+ /* @__PURE__ */ L(c, { ...i.canvas }),
4170
+ n && /* @__PURE__ */ L(l, { ...i.sidebar })
4171
+ ]
4172
+ });
4173
+ }
4174
+ var jr = t(function({ showTopBar: e, showLayers: t, showSidebar: n, components: r, slotProps: i, ...a }, o) {
4175
+ return /* @__PURE__ */ L(Kn, {
4176
+ ref: o,
4177
+ ...a,
4178
+ children: /* @__PURE__ */ L(Ar, {
4179
+ showTopBar: e,
4180
+ showLayers: t,
4181
+ showSidebar: n,
4182
+ components: r,
4183
+ slotProps: i
4184
+ })
4185
+ });
4186
+ });
4187
+ //#endregion
4188
+ export { qt as AlignInput, Ie as BLOCK_CONTAINERS, jr as BetterEmailEditor, lr as BlockProperties, fr as BlocksTab, pr as BodyTab, Xt as BoxGroup, Zt as ButtonInspector, Le as COLUMN_PARENTS, $n as Canvas, Zn as CanvasOverlay, G as ColorInput, Qt as ColumnsInspector, an as ContainerInspector, gr as ContentPanel, hr as ContentTab, Ut as DEFAULT_SWATCHES, or as DefaultInspector, Cr as DeviceToggle, rn as DividerInspector, Kn as EditorRoot, it as EmailButton, Or as ExportHtmlButton, Er as ExportJsonButton, H as Field, V as Group, $t as HeadingInspector, mn as HtmlBlock, nn as HtmlInspector, en as ImageInspector, Tr as ImportButton, ar as LayersPanel, xr as LayersToggle, W as NumberInput, Jt as PaddingInput, mr as PaletteTile, Dr as PreviewButton, br as PreviewDialog, cr as PropertiesPanel, Ht as RangeInput, ln as SOCIAL_NETWORKS, Kt as Segmented, Gt as Select, vr as Sidebar, pn as SocialLinks, hn as SocialLinksInspector, cn as Spacer, tn as SpacerInspector, q as SpacingGroup, wr as TemplateButton, dr as TemplateCard, Z as TemplateThumbnail, Bt as TextArea, U as TextInput, _r as TextProperties, kr as TopBar, Yt as TypographyGroup, Sr as UndoRedo, rt as appendBlocks, Je as applyDrop, bn as content, In as createStarterDocument, K as css, z as cx, yn as defaultNodes, Nn as defaultPalette, Mn as defaultPaletteGroups, Pn as defaultTemplates, Bn as defaultTheme, nt as deleteUnit, yr as download, tt as duplicateUnit, _t as en, Ue as findDropTarget, vt as fr, dn as iconUrl, wt as icons, on as inlineStyleToObject, yt as locales, jn as menuParagraph, Qe as parentUnit, Vn as readFileAsDataUrl, bt as resolveLabel, Ct as resolveMessages, et as selectUnit, $e as selectedUnit, _n as textPreview, Wt as toHex, gn as truncate, Xe as unitAt, sr as useDeselect, ur as useDraggableBlock, Q as useEmailEditor, zn as useI18n, $ as useMessages, Rn as useOptionalEmailEditor };
4189
+
4190
+ //# sourceMappingURL=index.js.map