@maildeno/editor 0.4.6 → 0.4.7

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 (61) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/DatePicker-DIaGGAVI.js +5347 -0
  3. package/dist/DatePicker-DmMga5gQ.js +5347 -0
  4. package/dist/Dialog-GTfGtduh.js +6294 -0
  5. package/dist/HealthIndicator--ScSxVRA.js +1216 -0
  6. package/dist/HealthIndicator-BraAh2Aj.js +1217 -0
  7. package/dist/Icon-BYmOM482.js +2537 -0
  8. package/dist/Icon-c2SPT3-6.js +2577 -0
  9. package/dist/PreviewCanvas-C1-rP9-B.js +533 -0
  10. package/dist/PreviewCanvas-Nro7tNCn.js +533 -0
  11. package/dist/RichTextEditor-CrYhiAOo.js +12217 -0
  12. package/dist/RichTextEditor-D7Itx0fL.js +12218 -0
  13. package/dist/RowPreviewChildren-B66HbFdX.js +4 -0
  14. package/dist/RowPreviewChildren-DvrE9HTT.js +4 -0
  15. package/dist/RowPreviewLegacyComponent-3QuwvWmT.js +402 -0
  16. package/dist/RowPreviewLegacyComponent-CPqaWwsE.js +402 -0
  17. package/dist/RowPreviewRow-B91YPfoz.js +80 -0
  18. package/dist/RowPreviewRow-MaA-9ApX.js +80 -0
  19. package/dist/SavedRowsPanel-CF-7R3q_.js +492 -0
  20. package/dist/SavedRowsPanel-TLOEvs3Z.js +491 -0
  21. package/dist/_plugin-vue_export-helper-Dj7HTbfw.js +8 -0
  22. package/dist/babel-DV7WPQI0.js +10043 -0
  23. package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +3 -3
  24. package/dist/composables/emailBuilder/transform/pipeline/optimize.d.ts +4 -4
  25. package/dist/editor.css +2 -1
  26. package/dist/element-CeRQDEn3.js +21396 -0
  27. package/dist/element.js +2 -2
  28. package/dist/estree-DY9POgc0.js +8195 -0
  29. package/dist/html-wb0gSX1o.js +7273 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/index.js +14886 -14
  32. package/dist/init.js +83 -94
  33. package/dist/mergeTagDefinitions-Cler19nv.js +27 -0
  34. package/dist/standalone-DHvJ30Td.js +3554 -0
  35. package/dist/useEmailBuilder-CjJoxzTi.js +4893 -0
  36. package/dist/useEmailBuilder-gOc8otd8.js +4893 -0
  37. package/dist/useToast-DeNMwkP3.js +194 -0
  38. package/dist/vue.runtime.esm-bundler-D2AjRP90.js +6117 -0
  39. package/package.json +3 -1
  40. package/dist/DatePicker-6dMK-shv.js +0 -5639
  41. package/dist/DatePicker-CEm1DPgG.js +0 -5640
  42. package/dist/HealthIndicator-Ch5Ck0BL.js +0 -1954
  43. package/dist/HealthIndicator-Dr5vMr1T.js +0 -1953
  44. package/dist/PreviewCanvas-CG52GC5m.js +0 -667
  45. package/dist/PreviewCanvas-CjOrVIGt.js +0 -668
  46. package/dist/RichTextEditor-DaaHuVox.js +0 -13487
  47. package/dist/RichTextEditor-DoWpYF0R.js +0 -13432
  48. package/dist/RowPreviewChildren-DQoyExvw.js +0 -4
  49. package/dist/RowPreviewChildren-yl3aB7hb.js +0 -4
  50. package/dist/RowPreviewLegacyComponent-CHxbwy9l.js +0 -454
  51. package/dist/RowPreviewLegacyComponent-Dv7OCys4.js +0 -454
  52. package/dist/RowPreviewRow-Bizr4PTf.js +0 -86
  53. package/dist/RowPreviewRow-CLhz0YQ5.js +0 -86
  54. package/dist/SavedRowsPanel-C0DkAzHi.js +0 -611
  55. package/dist/SavedRowsPanel-Cp3gADrK.js +0 -610
  56. package/dist/babel-Bmz1GpKj.js +0 -7218
  57. package/dist/element-CRfWpZos.js +0 -40842
  58. package/dist/estree-C5xyFN_T.js +0 -4831
  59. package/dist/html-Dc_r73Xn.js +0 -3062
  60. package/dist/index-BlYp4vAp.js +0 -34092
  61. package/dist/standalone-Yv8gSIWN.js +0 -2336
@@ -0,0 +1,4893 @@
1
+ import { F as or, K as un, M as he, R as Ae, h as Se, k as Me, lt as ir, q as sr, st as P } from "./vue.runtime.esm-bundler-D2AjRP90.js";
2
+ var tt = (e) => e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "untitled_template";
3
+ function dn(e) {
4
+ if (!e || typeof e != "object") throw new Error("Unrecognized template file format");
5
+ if (e.template_id && e.template_name && e.canvas && e.rows && e.schema_version) {
6
+ if (e.schema_version !== "1.0") {
7
+ const [t] = String(e.schema_version).split(".").map(Number), [r] = "1.0".split(".").map(Number);
8
+ if (t > r) throw new Error(`Template schema version ${e.schema_version} is newer than supported version 1.0`);
9
+ e.schema_version = "1.0";
10
+ }
11
+ return e;
12
+ }
13
+ if (e.meta && e.canvas && e.content?.rows) {
14
+ const t = e.meta.name || "Untitled Template";
15
+ return {
16
+ template_id: tt(t),
17
+ template_name: t,
18
+ canvas: e.canvas,
19
+ rows: e.content.rows,
20
+ schema_version: "1.0"
21
+ };
22
+ }
23
+ if (e.canvas && e.content?.rows) return {
24
+ template_id: tt("Untitled Template"),
25
+ template_name: "Untitled Template",
26
+ canvas: e.canvas,
27
+ rows: e.content.rows,
28
+ schema_version: "1.0"
29
+ };
30
+ if (!e.meta && e.canvasStyles && e.rows) {
31
+ const t = "Untitled Template";
32
+ return {
33
+ template_id: tt(t),
34
+ template_name: t,
35
+ canvas: e.canvasStyles,
36
+ rows: e.rows,
37
+ schema_version: "1.0"
38
+ };
39
+ }
40
+ throw new Error("Unrecognized template file format");
41
+ }
42
+ var K = () => crypto.randomUUID().replace(/-/g, "").slice(0, 16), ve = "maildeno:product-rows", Oe = "maildeno:template:", vt = "maildeno:versions:", Vt = 20;
43
+ function pn(e) {
44
+ const t = JSON.parse(JSON.stringify(e));
45
+ return t.id = K(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
46
+ const n = r.children ?? r.components ?? [], a = {
47
+ ...r,
48
+ id: K(),
49
+ children: n.map((i) => pn(i))
50
+ };
51
+ return delete a.components, a;
52
+ })), t;
53
+ }
54
+ function ue(e) {
55
+ try {
56
+ const t = localStorage.getItem(e);
57
+ return t ? JSON.parse(t) : null;
58
+ } catch {
59
+ return null;
60
+ }
61
+ }
62
+ function je(e, t) {
63
+ localStorage.setItem(e, JSON.stringify(t));
64
+ }
65
+ function mn() {
66
+ async function e(s) {
67
+ return s ? ue(Oe + s) : null;
68
+ }
69
+ async function t(s, y) {
70
+ const C = y || K();
71
+ try {
72
+ const _ = ue(Oe + C);
73
+ _ && k(C, _);
74
+ } catch (_) {
75
+ console.warn("[maildeno-editor] couldn't record a template version:", _);
76
+ }
77
+ return je(Oe + C, {
78
+ ...s,
79
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
80
+ }), { templateId: C };
81
+ }
82
+ async function r() {
83
+ const s = [];
84
+ for (let y = 0; y < localStorage.length; y++) {
85
+ const C = localStorage.key(y);
86
+ if (!C?.startsWith(Oe)) continue;
87
+ const _ = ue(C);
88
+ s.push({
89
+ templateId: C.slice(18),
90
+ name: _?.name,
91
+ updatedAt: _?.updatedAt
92
+ });
93
+ }
94
+ return s.sort((y, C) => (C.updatedAt ?? "").localeCompare(y.updatedAt ?? ""));
95
+ }
96
+ async function n(s) {
97
+ localStorage.removeItem(Oe + s), localStorage.removeItem(vt + s);
98
+ }
99
+ function a(s) {
100
+ return ue(vt + s) ?? [];
101
+ }
102
+ function i(s, y) {
103
+ je(vt + s, y);
104
+ }
105
+ async function o(s) {
106
+ return a(s).map(({ snapshot: y, ...C }) => C);
107
+ }
108
+ async function c(s, y) {
109
+ return a(s).find((C) => C.versionId === y)?.snapshot ?? null;
110
+ }
111
+ async function l(s, y) {
112
+ i(s, a(s).filter((C) => C.versionId !== y));
113
+ }
114
+ async function d(s) {
115
+ i(s, a(s).filter((y) => y.kept));
116
+ }
117
+ async function v(s, y, C) {
118
+ i(s, a(s).map((_) => _.versionId === y ? {
119
+ ..._,
120
+ kept: C
121
+ } : _));
122
+ }
123
+ function k(s, y) {
124
+ const C = a(s);
125
+ C.unshift({
126
+ versionId: K(),
127
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
128
+ kept: !1,
129
+ snapshot: y
130
+ });
131
+ const _ = C.filter((f) => !f.kept);
132
+ if (_.length > Vt) {
133
+ const f = new Set(_.slice(Vt).map((p) => p.versionId));
134
+ i(s, C.filter((p) => !f.has(p.versionId)));
135
+ return;
136
+ }
137
+ i(s, C);
138
+ }
139
+ async function E() {
140
+ return ue(ve) ?? [];
141
+ }
142
+ async function w() {
143
+ return [];
144
+ }
145
+ async function R(s, y) {
146
+ const C = ue(ve) ?? [], _ = {
147
+ id: K(),
148
+ name: y.trim() || `Row ${C.length + 1}`,
149
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
150
+ row: JSON.parse(JSON.stringify(s))
151
+ };
152
+ return je(ve, [_, ...C]), _;
153
+ }
154
+ async function I(s) {
155
+ const y = ue(ve) ?? [];
156
+ je(ve, y.filter((C) => C.id !== s));
157
+ }
158
+ async function O(s, y) {
159
+ const C = ue(ve) ?? [];
160
+ je(ve, C.map((_) => _.id === s ? {
161
+ ..._,
162
+ name: y.trim() || _.name
163
+ } : _));
164
+ }
165
+ function u(s) {
166
+ const y = (ue(ve) ?? []).find((C) => C.id === s);
167
+ return y ? pn(y.row) : null;
168
+ }
169
+ async function h(s) {
170
+ return new Promise((y, C) => {
171
+ const _ = new FileReader();
172
+ _.onload = () => y(_.result), _.onerror = () => C(_.error), _.readAsDataURL(s);
173
+ });
174
+ }
175
+ return {
176
+ loadTemplate: e,
177
+ saveTemplate: t,
178
+ listTemplates: r,
179
+ deleteTemplate: n,
180
+ listTemplateVersions: o,
181
+ getTemplateVersion: c,
182
+ deleteTemplateVersion: l,
183
+ deleteAllTemplateVersions: d,
184
+ setTemplateVersionKept: v,
185
+ listSavedRows: E,
186
+ listSystemSavedRows: w,
187
+ saveSavedRow: R,
188
+ deleteSavedRow: I,
189
+ renameSavedRow: O,
190
+ cloneSavedRowForCanvas: u,
191
+ uploadImage: h
192
+ };
193
+ }
194
+ var fn = /* @__PURE__ */ Symbol("maildeno-editor:storage-adapter");
195
+ function lr(e) {
196
+ const t = mn();
197
+ if (!e) return t;
198
+ const r = { ...t };
199
+ for (const [n, a] of Object.entries(e)) typeof a == "function" && (r[n] = a);
200
+ return r;
201
+ }
202
+ var gn = /* @__PURE__ */ Symbol("maildeno-editor:can-save");
203
+ function cr() {
204
+ return Me(gn, Se(() => !0));
205
+ }
206
+ function La(e) {
207
+ Ae(gn, e);
208
+ }
209
+ var hn = /* @__PURE__ */ Symbol("maildeno-editor:has-template-library");
210
+ function Da() {
211
+ return Me(hn, !0);
212
+ }
213
+ function Fa(e) {
214
+ const t = lr(e);
215
+ return Ae(fn, t), Ae(hn, !e || typeof e.listTemplates == "function"), t;
216
+ }
217
+ var ur = () => {
218
+ const e = Me(fn);
219
+ return e || (console.warn("[maildeno-editor] useStorageAdapter() couldn't find a provided adapter — falling back to the default localStorage adapter. If you passed a custom storageAdapter, it wasn't picked up; please report this."), mn());
220
+ }, vn = /* @__PURE__ */ Symbol("maildeno-editor:saved-row-capabilities");
221
+ function Ha(e) {
222
+ Ae(vn, e);
223
+ }
224
+ function Ua() {
225
+ return Me(vn, Se(() => ({})));
226
+ }
227
+ var it = ir(null), wt = P(!1);
228
+ function Rt() {
229
+ wt.value = !1, setTimeout(() => {
230
+ wt.value || (it.value = null);
231
+ }, 200);
232
+ }
233
+ function Ja() {
234
+ const e = it.value;
235
+ Rt(), e?.accept?.();
236
+ }
237
+ function Ga() {
238
+ const e = it.value;
239
+ Rt(), e?.reject?.();
240
+ }
241
+ function dr() {
242
+ return {
243
+ require(e) {
244
+ it.value = e, wt.value = !0;
245
+ },
246
+ close: Rt
247
+ };
248
+ }
249
+ var ke = () => ({
250
+ enabled: !1,
251
+ match: "all",
252
+ rules: []
253
+ }), xt = () => ({
254
+ desktopHide: !1,
255
+ mobileHide: !1
256
+ }), ne = () => ({
257
+ visibility: ke(),
258
+ ...xt()
259
+ }), pr = Object.freeze({
260
+ enabled: !1,
261
+ match: "all",
262
+ rules: []
263
+ }), mr = Object.freeze({
264
+ desktopHide: !1,
265
+ mobileHide: !1
266
+ }), qa = Object.freeze({
267
+ visibility: pr,
268
+ ...mr
269
+ }), bt = (e) => ({
270
+ useGradient: !1,
271
+ solid: e,
272
+ gradient: {
273
+ type: "linear",
274
+ direction: "to right",
275
+ colors: [{
276
+ color: e,
277
+ position: 0
278
+ }, {
279
+ color: "#00ff88",
280
+ position: 100
281
+ }]
282
+ }
283
+ }), qe = () => ({
284
+ useGradient: !1,
285
+ solid: "transparent",
286
+ gradient: {
287
+ type: "linear",
288
+ direction: "to right",
289
+ colors: [{
290
+ color: "#ffffff",
291
+ position: 0
292
+ }, {
293
+ color: "#eeeeee",
294
+ position: 100
295
+ }]
296
+ }
297
+ }), Et = () => ({ defaultProps: {
298
+ paragraph: {
299
+ content: "Enter your paragraph text here",
300
+ fontSize: 16,
301
+ lineHeight: 1.5,
302
+ color: "#111111",
303
+ fontWeight: "normal",
304
+ fontFamily: "Arial",
305
+ fontStyle: "normal",
306
+ letterSpacing: 0,
307
+ backgroundColor: "transparent",
308
+ backgroundGradient: qe(),
309
+ margin: {
310
+ top: 0,
311
+ right: 0,
312
+ bottom: 0,
313
+ left: 0
314
+ },
315
+ padding: {
316
+ top: 0,
317
+ right: 0,
318
+ bottom: 0,
319
+ left: 0
320
+ },
321
+ textTransform: "none",
322
+ textDecoration: "none",
323
+ align: "left",
324
+ mobile: {
325
+ fontSize: null,
326
+ lineHeight: null,
327
+ color: null,
328
+ fontWeight: null,
329
+ fontFamily: null,
330
+ fontStyle: null,
331
+ letterSpacing: null,
332
+ backgroundColor: null,
333
+ backgroundGradient: null,
334
+ textTransform: null,
335
+ textDecoration: null,
336
+ align: null,
337
+ margin: null,
338
+ padding: null
339
+ },
340
+ ...ne()
341
+ },
342
+ heading: {
343
+ content: "Heading Text",
344
+ level: "h2",
345
+ fontSize: 32,
346
+ lineHeight: 1.2,
347
+ color: "#111111",
348
+ fontWeight: "bold",
349
+ fontFamily: "Arial",
350
+ letterSpacing: 0,
351
+ backgroundColor: "transparent",
352
+ backgroundGradient: qe(),
353
+ margin: {
354
+ top: 0,
355
+ right: 0,
356
+ bottom: 0,
357
+ left: 0
358
+ },
359
+ padding: {
360
+ top: 0,
361
+ right: 0,
362
+ bottom: 0,
363
+ left: 0
364
+ },
365
+ textTransform: "none",
366
+ textDecoration: "none",
367
+ align: "left",
368
+ mobile: {
369
+ fontSize: null,
370
+ lineHeight: null,
371
+ color: null,
372
+ fontWeight: null,
373
+ fontFamily: null,
374
+ letterSpacing: null,
375
+ backgroundColor: null,
376
+ backgroundGradient: null,
377
+ textTransform: null,
378
+ textDecoration: null,
379
+ align: null,
380
+ margin: null,
381
+ padding: null
382
+ },
383
+ ...ne()
384
+ },
385
+ image: {
386
+ src: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/5bffeaf2.jpeg",
387
+ alt: "Image",
388
+ width: 100,
389
+ height: "auto",
390
+ align: "center",
391
+ link: "https://example.com",
392
+ enabled: !1,
393
+ margin: {
394
+ top: 0,
395
+ right: 0,
396
+ bottom: 0,
397
+ left: 0
398
+ },
399
+ padding: {
400
+ top: 0,
401
+ right: 0,
402
+ bottom: 0,
403
+ left: 0
404
+ },
405
+ borderRadius: 0,
406
+ border: {
407
+ width: 0,
408
+ color: "transparent",
409
+ style: "solid"
410
+ },
411
+ mobile: {
412
+ width: null,
413
+ height: null,
414
+ align: null,
415
+ margin: null,
416
+ padding: null,
417
+ borderRadius: null,
418
+ border: null
419
+ },
420
+ ...ne()
421
+ },
422
+ video: {
423
+ fallbackLink: "https://example.com",
424
+ src: "",
425
+ coverImage: "",
426
+ alt: "Watch video",
427
+ width: 100,
428
+ height: "auto",
429
+ align: "center",
430
+ margin: {
431
+ top: 0,
432
+ right: 0,
433
+ bottom: 0,
434
+ left: 0
435
+ },
436
+ padding: {
437
+ top: 0,
438
+ right: 0,
439
+ bottom: 0,
440
+ left: 0
441
+ },
442
+ borderRadius: 0,
443
+ border: {
444
+ width: 0,
445
+ color: "transparent",
446
+ style: "solid"
447
+ },
448
+ mobile: {
449
+ width: null,
450
+ height: null,
451
+ align: null,
452
+ margin: null,
453
+ padding: null,
454
+ borderRadius: null,
455
+ border: null
456
+ },
457
+ ...ne()
458
+ },
459
+ list: {
460
+ content: "<ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul>",
461
+ fontSize: 16,
462
+ lineHeight: 1.5,
463
+ fontFamily: "Arial",
464
+ letterSpacing: 0,
465
+ color: "#111111",
466
+ backgroundColor: "transparent",
467
+ backgroundGradient: qe(),
468
+ margin: {
469
+ top: 0,
470
+ right: 0,
471
+ bottom: 0,
472
+ left: 0
473
+ },
474
+ padding: {
475
+ top: 0,
476
+ right: 0,
477
+ bottom: 0,
478
+ left: 20
479
+ },
480
+ itemSpacing: 8,
481
+ mobile: {
482
+ fontSize: null,
483
+ lineHeight: null,
484
+ fontFamily: null,
485
+ letterSpacing: null,
486
+ color: null,
487
+ backgroundColor: null,
488
+ backgroundGradient: null,
489
+ margin: null,
490
+ padding: null,
491
+ itemSpacing: null
492
+ },
493
+ ...ne()
494
+ },
495
+ button: {
496
+ text: "Click Me",
497
+ link: "https://example.com",
498
+ backgroundColor: "#007bff",
499
+ backgroundGradient: bt("#007bff"),
500
+ color: "#fafafa",
501
+ fontSize: 16,
502
+ fontWeight: "medium",
503
+ fontFamily: "Arial",
504
+ letterSpacing: 0,
505
+ margin: {
506
+ top: 0,
507
+ right: 0,
508
+ bottom: 0,
509
+ left: 0
510
+ },
511
+ padding: {
512
+ top: 12,
513
+ right: 24,
514
+ bottom: 12,
515
+ left: 24
516
+ },
517
+ borderRadius: 4,
518
+ border: {
519
+ width: 0,
520
+ color: "transparent",
521
+ style: "solid"
522
+ },
523
+ align: "center",
524
+ icon: "",
525
+ iconAlt: "",
526
+ iconPosition: "before",
527
+ iconSize: 20,
528
+ iconGap: 8,
529
+ mobile: {
530
+ fontSize: null,
531
+ fontWeight: null,
532
+ fontFamily: null,
533
+ letterSpacing: null,
534
+ backgroundColor: null,
535
+ backgroundGradient: null,
536
+ color: null,
537
+ padding: null,
538
+ margin: null,
539
+ borderRadius: null,
540
+ border: null,
541
+ align: null
542
+ },
543
+ ...ne()
544
+ },
545
+ anchor: {
546
+ text: "Click here",
547
+ link: "https://example.com",
548
+ color: "#007bff",
549
+ fontSize: 16,
550
+ fontWeight: "normal",
551
+ fontFamily: "Arial",
552
+ letterSpacing: 0,
553
+ textDecoration: "underline",
554
+ margin: {
555
+ top: 0,
556
+ right: 0,
557
+ bottom: 0,
558
+ left: 0
559
+ },
560
+ padding: {
561
+ top: 0,
562
+ right: 0,
563
+ bottom: 0,
564
+ left: 0
565
+ },
566
+ align: "left",
567
+ mobile: {
568
+ fontSize: null,
569
+ fontWeight: null,
570
+ fontFamily: null,
571
+ letterSpacing: null,
572
+ color: null,
573
+ textDecoration: null,
574
+ margin: null,
575
+ padding: null,
576
+ align: null
577
+ },
578
+ ...ne()
579
+ },
580
+ divider: {
581
+ backgroundColor: "#cccccc",
582
+ backgroundGradient: bt("#cccccc"),
583
+ height: 1,
584
+ width: 100,
585
+ margin: {
586
+ top: 20,
587
+ right: 0,
588
+ bottom: 20,
589
+ left: 0
590
+ },
591
+ padding: {
592
+ top: 5,
593
+ right: 0,
594
+ bottom: 5,
595
+ left: 0
596
+ },
597
+ align: "center",
598
+ mobile: {
599
+ backgroundColor: null,
600
+ backgroundGradient: null,
601
+ height: null,
602
+ width: null,
603
+ margin: null,
604
+ padding: null,
605
+ align: null
606
+ },
607
+ ...ne()
608
+ },
609
+ spacer: {
610
+ height: 20,
611
+ backgroundColor: "transparent",
612
+ backgroundGradient: bt("transparent"),
613
+ mobile: {
614
+ height: null,
615
+ backgroundColor: null,
616
+ backgroundGradient: null
617
+ },
618
+ ...ne()
619
+ },
620
+ menu: {
621
+ items: [
622
+ {
623
+ label: "Home",
624
+ link: "https://example.com",
625
+ enabled: !0
626
+ },
627
+ {
628
+ label: "About",
629
+ link: "https://example.com",
630
+ enabled: !0
631
+ },
632
+ {
633
+ label: "Contact",
634
+ link: "https://example.com",
635
+ enabled: !0
636
+ }
637
+ ],
638
+ fontSize: 16,
639
+ lineHeight: 1.5,
640
+ fontWeight: "normal",
641
+ fontFamily: "Arial",
642
+ fontStyle: "normal",
643
+ letterSpacing: 0,
644
+ color: "#111111",
645
+ textTransform: "none",
646
+ textDecoration: "none",
647
+ backgroundColor: "transparent",
648
+ backgroundGradient: qe(),
649
+ spacing: 16,
650
+ align: "center",
651
+ margin: {
652
+ top: 0,
653
+ right: 0,
654
+ bottom: 0,
655
+ left: 0
656
+ },
657
+ padding: {
658
+ top: 0,
659
+ right: 0,
660
+ bottom: 0,
661
+ left: 0
662
+ },
663
+ mobileStack: !1,
664
+ mobile: {
665
+ fontSize: null,
666
+ lineHeight: null,
667
+ fontWeight: null,
668
+ fontFamily: null,
669
+ fontStyle: null,
670
+ letterSpacing: null,
671
+ color: null,
672
+ textTransform: null,
673
+ textDecoration: null,
674
+ backgroundColor: null,
675
+ backgroundGradient: null,
676
+ spacing: null,
677
+ align: null,
678
+ margin: null,
679
+ padding: null
680
+ },
681
+ ...ne()
682
+ },
683
+ socials: {
684
+ platforms: [
685
+ {
686
+ name: "Youtube",
687
+ link: "",
688
+ enabled: !0,
689
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/187d70ab.png"
690
+ },
691
+ {
692
+ name: "Linkedin",
693
+ link: "",
694
+ enabled: !0,
695
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/23e45ac0.png"
696
+ },
697
+ {
698
+ name: "Instagram",
699
+ link: "",
700
+ enabled: !0,
701
+ icon: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/4e9832e6.png"
702
+ }
703
+ ],
704
+ iconSize: 28,
705
+ spacing: 10,
706
+ align: "center",
707
+ margin: {
708
+ top: 0,
709
+ right: 0,
710
+ bottom: 0,
711
+ left: 0
712
+ },
713
+ padding: {
714
+ top: 0,
715
+ right: 0,
716
+ bottom: 0,
717
+ left: 0
718
+ },
719
+ mobile: {
720
+ iconSize: null,
721
+ spacing: null,
722
+ align: null,
723
+ margin: null,
724
+ padding: null
725
+ },
726
+ ...ne()
727
+ }
728
+ } }), Wa = (e) => e.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""), Va = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), bn = () => `row_${K().slice(0, 4)}`, ze = (e) => ({
729
+ useGradient: !1,
730
+ solid: e,
731
+ gradient: {
732
+ type: "linear",
733
+ direction: "to right",
734
+ colors: [{
735
+ color: "#ffffff",
736
+ position: 0
737
+ }, {
738
+ color: "#eeeeee",
739
+ position: 100
740
+ }]
741
+ }
742
+ }), pe = (e) => e.children ?? e.components ?? [], Pe = (e) => (e.children || (e.children = e.components ?? []), e.children), Mt = (e) => {
743
+ const t = JSON.parse(JSON.stringify(e));
744
+ return t.id = K(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
745
+ const n = r.children ?? r.components ?? [], a = {
746
+ ...r,
747
+ id: K(),
748
+ children: n.map((i) => Mt(i))
749
+ };
750
+ return delete a.components, a;
751
+ })), t;
752
+ }, We = (e, t) => {
753
+ const r = Mt(e);
754
+ if (r.type === "row-spacer") return r;
755
+ const n = e.name ?? bn(), a = new Set(t.map((c) => c.name));
756
+ let i = `${n}_copy`, o = 2;
757
+ for (; a.has(i); )
758
+ i = `${n}_copy_${o}`, o++;
759
+ return r.name = i, r;
760
+ }, fr = (e) => Mt(e), me = (e, t) => {
761
+ for (let r = 0; r < e.length; r++) {
762
+ const n = e[r];
763
+ if (n.id === t) return {
764
+ parentChildren: e,
765
+ index: r,
766
+ element: n
767
+ };
768
+ if (n.type === "row") for (const a of n.columns ?? []) {
769
+ const i = me(a.children ?? a.components ?? [], t);
770
+ if (i) return i;
771
+ }
772
+ }
773
+ return null;
774
+ }, ye = (e, t) => {
775
+ for (const r of e) {
776
+ if (r.id === t) return r;
777
+ if (r.type === "row" && r.columns) for (const n of r.columns) {
778
+ const a = pe(n);
779
+ for (const i of a) {
780
+ if (i.id === t && i.type === "row") return i;
781
+ if (i.type === "row" && i.columns) {
782
+ const o = ye([i], t);
783
+ if (o) return o;
784
+ }
785
+ }
786
+ }
787
+ }
788
+ return null;
789
+ }, te = /* @__PURE__ */ new Map(), Kt = (e) => {
790
+ te.clear();
791
+ const t = (r) => {
792
+ for (const n of r)
793
+ if (n?.id && (te.set(n.id, n), n.type === "row" && Array.isArray(n.columns)))
794
+ for (const a of n.columns)
795
+ a?.id && te.set(a.id, a), t(a.children ?? a.components ?? []);
796
+ };
797
+ t(e);
798
+ }, ae = (e) => {
799
+ if (e?.id && (te.set(e.id, e), e.type === "row" && Array.isArray(e.columns)))
800
+ for (const t of e.columns) {
801
+ t?.id && te.set(t.id, t);
802
+ const r = t.children ?? t.components ?? [];
803
+ for (const n of r) ae(n);
804
+ }
805
+ }, nt = (e) => {
806
+ if (e?.id && (te.delete(e.id), e.type === "row" && Array.isArray(e.columns)))
807
+ for (const t of e.columns) {
808
+ t?.id && te.delete(t.id);
809
+ const r = t.children ?? t.components ?? [];
810
+ for (const n of r) nt(n);
811
+ }
812
+ }, gr = (e, t, r, n, a = n) => {
813
+ te.size === 0 && Array.isArray(e.value) && e.value.length && Kt(e.value);
814
+ const i = (f, p = !1) => {
815
+ let g;
816
+ if (Array.isArray(f)) {
817
+ if (f.reduce((S, A) => S + A, 0) !== 100) {
818
+ console.warn("Column widths must sum to 100%");
819
+ return;
820
+ }
821
+ g = f;
822
+ } else {
823
+ const S = Math.floor(100 / f);
824
+ g = Array(f).fill(S), g[0] += 100 - g.reduce((A, m) => A + m, 0);
825
+ }
826
+ const x = bn(), $ = {
827
+ id: `${K()}`,
828
+ type: "row",
829
+ name: x,
830
+ columns: g.map((S, A) => ({
831
+ id: `${K()}-${A}`,
832
+ width: S,
833
+ children: [],
834
+ backgroundColor: "transparent",
835
+ backgroundGradient: ze("transparent"),
836
+ backgroundImage: "",
837
+ backgroundSize: "cover",
838
+ backgroundPosition: "center center",
839
+ backgroundRepeat: "no-repeat",
840
+ padding: {
841
+ top: 10,
842
+ right: 10,
843
+ bottom: 10,
844
+ left: 10
845
+ },
846
+ border: {
847
+ width: 0,
848
+ style: "solid",
849
+ color: "#000000",
850
+ radius: 0
851
+ },
852
+ verticalAlign: "top"
853
+ })),
854
+ backgroundColor: "#ffffff",
855
+ backgroundGradient: ze("#ffffff"),
856
+ backgroundImage: "",
857
+ backgroundSize: "cover",
858
+ backgroundPosition: "center center",
859
+ backgroundRepeat: "no-repeat",
860
+ padding: {
861
+ top: 0,
862
+ right: 0,
863
+ bottom: 0,
864
+ left: 0
865
+ },
866
+ border: {
867
+ width: 0,
868
+ style: "solid",
869
+ color: "#000000",
870
+ radius: 0
871
+ },
872
+ minHeight: 0,
873
+ gap: 12,
874
+ mobileStack: !0,
875
+ visibility: ke()
876
+ };
877
+ e.value.push($);
878
+ const b = e.value[e.value.length - 1];
879
+ ae(b), p || n("add-row");
880
+ }, o = (f, p, g, x) => {
881
+ const $ = ye(e.value, f);
882
+ if (!$?.columns) return;
883
+ const b = $.columns.find((N) => N.id === p);
884
+ if (!b) return;
885
+ let S;
886
+ if (Array.isArray(g)) {
887
+ if (g.reduce((N, F) => N + F, 0) !== 100) {
888
+ console.warn("[addNestedRow] Widths must sum to 100%");
889
+ return;
890
+ }
891
+ S = g;
892
+ } else {
893
+ const N = Math.floor(100 / g);
894
+ S = Array(g).fill(N), S[0] += 100 - S.reduce((F, M) => F + M, 0);
895
+ }
896
+ const A = {
897
+ id: `${K()}`,
898
+ type: "row",
899
+ name: `nested_row_${K().slice(0, 4)}`,
900
+ columns: S.map((N, F) => ({
901
+ id: `${K()}-${F}`,
902
+ width: N,
903
+ children: [],
904
+ backgroundColor: "transparent",
905
+ backgroundGradient: ze("transparent"),
906
+ backgroundImage: "",
907
+ backgroundSize: "cover",
908
+ backgroundPosition: "center center",
909
+ backgroundRepeat: "no-repeat",
910
+ padding: {
911
+ top: 0,
912
+ right: 0,
913
+ bottom: 0,
914
+ left: 0
915
+ },
916
+ border: {
917
+ width: 0,
918
+ style: "solid",
919
+ color: "#000000",
920
+ radius: 0
921
+ },
922
+ verticalAlign: "top"
923
+ })),
924
+ backgroundColor: "transparent",
925
+ backgroundGradient: ze("transparent"),
926
+ backgroundImage: "",
927
+ backgroundSize: "cover",
928
+ backgroundPosition: "center center",
929
+ backgroundRepeat: "no-repeat",
930
+ padding: {
931
+ top: 0,
932
+ right: 0,
933
+ bottom: 0,
934
+ left: 0
935
+ },
936
+ border: {
937
+ width: 0,
938
+ style: "solid",
939
+ color: "#000000",
940
+ radius: 0
941
+ },
942
+ minHeight: 0,
943
+ gap: 0,
944
+ mobileStack: !0,
945
+ visibility: ke()
946
+ }, m = Pe(b), B = x !== void 0 && x >= 0 && x <= m.length ? x : m.length;
947
+ m.splice(B, 0, A);
948
+ const z = m[B];
949
+ ae(z), n("add-nested-row");
950
+ }, c = (f) => {
951
+ if (f == null) return null;
952
+ const p = String(f), g = te.get(p);
953
+ if (g && (g.type === "row" || g.type === "row-spacer")) return g;
954
+ const x = ye(e.value, f);
955
+ return x && te.set(p, x), x;
956
+ }, l = (f) => {
957
+ const p = e.value.findIndex((g) => g.id === f);
958
+ if (p !== -1) {
959
+ const [g] = e.value.splice(p, 1);
960
+ nt(g), n("delete-row");
961
+ return;
962
+ }
963
+ for (const g of e.value)
964
+ if (g.columns)
965
+ for (const x of g.columns) {
966
+ const $ = pe(x), b = me($, f);
967
+ if (b) {
968
+ const [S] = b.parentChildren.splice(b.index, 1);
969
+ nt(S), n("delete-row");
970
+ return;
971
+ }
972
+ }
973
+ }, d = (f, p) => {
974
+ const g = e.value.findIndex(($) => $.id === f);
975
+ if (g !== -1) {
976
+ const $ = p === "up" ? g - 1 : g + 1;
977
+ if ($ < 0 || $ >= e.value.length) return;
978
+ const [b] = e.value.splice(g, 1);
979
+ e.value.splice($, 0, b), n("move-row");
980
+ return;
981
+ }
982
+ const x = ($) => {
983
+ const b = $.findIndex((S) => S.id === f);
984
+ if (b !== -1) {
985
+ const S = p === "up" ? b - 1 : b + 1;
986
+ if (S < 0 || S >= $.length) return !0;
987
+ const [A] = $.splice(b, 1);
988
+ return $.splice(S, 0, A), n("move-row"), !0;
989
+ }
990
+ for (const S of $) if (S.type === "row" && S.columns) {
991
+ for (const A of S.columns) if (x(A.children ?? A.components ?? [])) return !0;
992
+ }
993
+ return !1;
994
+ };
995
+ for (const $ of e.value)
996
+ if ($.columns) {
997
+ for (const b of $.columns) if (x(b.children ?? b.components ?? [])) return;
998
+ }
999
+ }, v = (f, p, g, x) => {
1000
+ let $ = null;
1001
+ const b = e.value.findIndex((S) => S.id === f);
1002
+ if (b !== -1 && ($ = e.value.splice(b, 1)[0]), !$) {
1003
+ const S = (A) => {
1004
+ const m = A.findIndex((B) => B.id === f);
1005
+ if (m !== -1)
1006
+ return $ = A.splice(m, 1)[0], !0;
1007
+ for (const B of A) if (B.type === "row" && B.columns) {
1008
+ for (const z of B.columns) if (S(z.children ?? z.components ?? [])) return !0;
1009
+ }
1010
+ return !1;
1011
+ };
1012
+ for (const A of e.value)
1013
+ if (A.columns) {
1014
+ for (const m of A.columns) if (S(m.children ?? m.components ?? [])) break;
1015
+ if ($) break;
1016
+ }
1017
+ }
1018
+ if ($) {
1019
+ if (g === null) {
1020
+ const S = Math.min(x, e.value.length);
1021
+ e.value.splice(S, 0, $);
1022
+ } else {
1023
+ const S = ye(e.value, p);
1024
+ if (!S?.columns) {
1025
+ e.value.push($);
1026
+ return;
1027
+ }
1028
+ const A = S.columns.find((z) => z.id === g);
1029
+ if (!A) {
1030
+ e.value.push($);
1031
+ return;
1032
+ }
1033
+ const m = Pe(A), B = Math.min(x, m.length);
1034
+ m.splice(B, 0, $);
1035
+ }
1036
+ n("move-nested-row");
1037
+ }
1038
+ }, k = (f, p, g = !1) => {
1039
+ if (f === p) return;
1040
+ const x = e.value[f];
1041
+ e.value.splice(f, 1), e.value.splice(p, 0, x), g || n("reorder-rows");
1042
+ }, E = (f = !1) => {
1043
+ const p = `spacer_${K().slice(0, 4)}`, g = {
1044
+ id: `${K()}`,
1045
+ type: "row-spacer",
1046
+ name: p,
1047
+ height: 20,
1048
+ backgroundColor: "transparent",
1049
+ backgroundGradient: ze("transparent"),
1050
+ visibility: ke()
1051
+ };
1052
+ e.value.push(g);
1053
+ const x = e.value[e.value.length - 1];
1054
+ ae(x), f || n("add-row-spacer");
1055
+ }, w = (f) => {
1056
+ const p = e.value.findIndex((g) => g.id === f);
1057
+ if (p !== -1) {
1058
+ const g = We(e.value[p], e.value);
1059
+ e.value.splice(p + 1, 0, g);
1060
+ const x = e.value[p + 1];
1061
+ ae(x), n("duplicate-row");
1062
+ return;
1063
+ }
1064
+ for (const g of e.value)
1065
+ if (g.columns)
1066
+ for (const x of g.columns) {
1067
+ const $ = pe(x), b = me($, f);
1068
+ if (b) {
1069
+ const S = We(b.element, b.parentChildren);
1070
+ b.parentChildren.splice(b.index + 1, 0, S);
1071
+ const A = b.parentChildren[b.index + 1];
1072
+ ae(A), n("duplicate-row");
1073
+ return;
1074
+ }
1075
+ }
1076
+ }, R = (f) => {
1077
+ const p = e.value.findIndex((g) => g.id === f);
1078
+ if (p !== -1) {
1079
+ const g = We(e.value[p], e.value);
1080
+ e.value.splice(p + 1, 0, g);
1081
+ const x = e.value[p + 1];
1082
+ ae(x), n("duplicate-row-spacer");
1083
+ return;
1084
+ }
1085
+ for (const g of e.value)
1086
+ if (g.columns)
1087
+ for (const x of g.columns) {
1088
+ const $ = pe(x), b = me($, f);
1089
+ if (b) {
1090
+ const S = We(b.element, b.parentChildren);
1091
+ b.parentChildren.splice(b.index + 1, 0, S);
1092
+ const A = b.parentChildren[b.index + 1];
1093
+ ae(A), n("duplicate-row-spacer");
1094
+ return;
1095
+ }
1096
+ }
1097
+ }, I = (f, p, g) => {
1098
+ const x = ye(e.value, f);
1099
+ if (!x) return;
1100
+ const $ = x.columns.find((m) => m.id === p);
1101
+ if (!$) return;
1102
+ const b = {
1103
+ id: `${K()}`,
1104
+ type: "component",
1105
+ componentType: g,
1106
+ props: JSON.parse(JSON.stringify(r[g]))
1107
+ }, S = Pe($);
1108
+ S.push(b);
1109
+ const A = S[S.length - 1];
1110
+ ae(A), t.value = A.id, n("add-component");
1111
+ }, O = (f, p, g, x) => {
1112
+ const $ = ye(e.value, f);
1113
+ if (!$) return;
1114
+ const b = $.columns.find((B) => B.id === p);
1115
+ if (!b) return;
1116
+ const S = {
1117
+ id: `${K()}`,
1118
+ type: "component",
1119
+ componentType: g,
1120
+ props: JSON.parse(JSON.stringify(r[g]))
1121
+ }, A = Pe(b);
1122
+ A.splice(x, 0, S);
1123
+ const m = A[x];
1124
+ ae(m), t.value = m.id, n("add-component");
1125
+ }, u = (f) => {
1126
+ for (const p of e.value)
1127
+ if (p.columns)
1128
+ for (const g of p.columns) {
1129
+ const x = pe(g), $ = me(x, f);
1130
+ if ($) {
1131
+ const [b] = $.parentChildren.splice($.index, 1);
1132
+ nt(b), t.value === f && (t.value = null), n("delete-component");
1133
+ return;
1134
+ }
1135
+ }
1136
+ }, h = (f, p) => {
1137
+ for (const g of e.value)
1138
+ if (g.columns)
1139
+ for (const x of g.columns) {
1140
+ const $ = pe(x), b = me($, f);
1141
+ if (b) {
1142
+ const { parentChildren: S, index: A } = b, m = p === "up" ? A - 1 : A + 1;
1143
+ if (m >= 0 && m < S.length) {
1144
+ const [B] = S.splice(A, 1);
1145
+ S.splice(m, 0, B), n("move-component");
1146
+ }
1147
+ return;
1148
+ }
1149
+ }
1150
+ }, s = (f, p, g, x) => {
1151
+ let $ = null;
1152
+ for (const A of e.value)
1153
+ if (A.columns) {
1154
+ for (const m of A.columns) {
1155
+ const B = pe(m), z = me(B, f);
1156
+ if (z) {
1157
+ $ = z.element, z.parentChildren.splice(z.index, 1);
1158
+ break;
1159
+ }
1160
+ }
1161
+ if ($) break;
1162
+ }
1163
+ if (!$) return;
1164
+ const b = ye(e.value, p);
1165
+ if (!b || !b.columns) return;
1166
+ const S = b.columns.find((A) => A.id === g);
1167
+ S && (Pe(S).splice(x, 0, $), n("move-component"));
1168
+ }, y = (f) => {
1169
+ if (f == null) return null;
1170
+ const p = String(f), g = te.get(p);
1171
+ if (g && g.type === "component") return g;
1172
+ for (const x of e.value)
1173
+ if (x.columns)
1174
+ for (const $ of x.columns) {
1175
+ const b = pe($), S = me(b, f);
1176
+ if (S && S.element.type === "component")
1177
+ return te.set(p, S.element), S.element;
1178
+ }
1179
+ return null;
1180
+ };
1181
+ return {
1182
+ addRow: i,
1183
+ addNestedRow: o,
1184
+ findRow: c,
1185
+ deleteRow: l,
1186
+ moveRow: d,
1187
+ moveNestedRow: v,
1188
+ reorderRows: k,
1189
+ addSpacer: E,
1190
+ duplicateRow: w,
1191
+ duplicateRowSpacer: R,
1192
+ addComponent: I,
1193
+ addComponentAtIndex: O,
1194
+ deleteComponent: u,
1195
+ moveComponent: h,
1196
+ moveComponentBetweenColumns: s,
1197
+ findComponent: y,
1198
+ updateComponent: (f, p) => {
1199
+ const g = y(f);
1200
+ g && (Object.assign(g.props, p), a("update-component"));
1201
+ },
1202
+ duplicateComponent: (f) => {
1203
+ for (const p of e.value)
1204
+ if (p.columns)
1205
+ for (const g of p.columns) {
1206
+ const x = pe(g), $ = me(x, f);
1207
+ if ($) {
1208
+ const b = fr($.element);
1209
+ $.parentChildren.splice($.index + 1, 0, b);
1210
+ const S = $.parentChildren[$.index + 1];
1211
+ ae(S), t.value = S.id, n("duplicate-component");
1212
+ return;
1213
+ }
1214
+ }
1215
+ },
1216
+ rebuildIdRegistry: () => Kt(e.value)
1217
+ };
1218
+ }, Q = null, hr = 600, $t = (e) => JSON.parse(JSON.stringify(e)), vr = () => {
1219
+ const t = P([]), r = P(-1), n = P(0), a = Se(() => r.value > 0), i = Se(() => r.value < t.value.length - 1), o = Se(() => `${r.value + 1} / ${t.value.length}`), c = (E, w = "change", R = !1) => {
1220
+ const I = () => {
1221
+ Q = null, r.value < t.value.length - 1 && (t.value = t.value.slice(0, r.value + 1)), t.value.push({
1222
+ state: $t(E),
1223
+ action: w,
1224
+ timestamp: Date.now()
1225
+ }), r.value++, t.value.length > 100 && (t.value.shift(), r.value--), n.value++;
1226
+ };
1227
+ R ? (Q && (clearTimeout(Q), Q = null), I()) : (Q && clearTimeout(Q), Q = setTimeout(I, hr));
1228
+ }, l = () => a.value ? (Q && (clearTimeout(Q), Q = null), r.value--, n.value++, $t(t.value[r.value].state)) : null, d = () => i.value ? (Q && (clearTimeout(Q), Q = null), r.value++, n.value++, $t(t.value[r.value].state)) : null, v = () => {
1229
+ t.value = [], r.value = -1, n.value++;
1230
+ };
1231
+ return {
1232
+ canUndo: a,
1233
+ canRedo: i,
1234
+ historyStatus: o,
1235
+ saveState: c,
1236
+ undo: l,
1237
+ redo: d,
1238
+ clearHistory: v,
1239
+ initHistory: (E) => {
1240
+ v(), c(E, "initial");
1241
+ },
1242
+ version: n
1243
+ };
1244
+ }, br = () => {
1245
+ const { saveState: e, undo: t, redo: r, canUndo: n, canRedo: a, historyStatus: i, initHistory: o, version: c } = vr();
1246
+ return {
1247
+ getCurrentState: (R, I) => ({
1248
+ rows: R.value,
1249
+ canvasStyles: I.value
1250
+ }),
1251
+ restoreState: (R, I, O, u, h, s) => {
1252
+ if (!R) return;
1253
+ I.value = R.rows, O.value = R.canvasStyles;
1254
+ const y = /* @__PURE__ */ new Set(), C = (_) => {
1255
+ for (const f of _)
1256
+ if (f?.id && (y.add(String(f.id)), f.type === "row" && Array.isArray(f.columns)))
1257
+ for (const p of f.columns)
1258
+ p?.id && y.add(String(p.id)), C(p.children ?? p.components ?? []);
1259
+ };
1260
+ if (C(R.rows), u.value && !y.has(String(u.value)) && (u.value = null), h.value && !y.has(String(h.value)) && (h.value = null), s.value) {
1261
+ const { rowId: _, columnId: f } = s.value;
1262
+ (!y.has(String(_)) || !y.has(String(f))) && (s.value = null);
1263
+ }
1264
+ },
1265
+ saveToHistory: (R, I = "change", O = !1) => {
1266
+ e(R(), I, O);
1267
+ },
1268
+ undo: (R) => {
1269
+ const I = t();
1270
+ return I ? (R(I), I) : null;
1271
+ },
1272
+ redo: (R) => {
1273
+ const I = r();
1274
+ return I ? (R(I), I) : null;
1275
+ },
1276
+ canUndo: n,
1277
+ canRedo: a,
1278
+ historyStatus: i,
1279
+ initialize: (R) => {
1280
+ o(R);
1281
+ },
1282
+ version: c
1283
+ };
1284
+ }, $r = (e) => e == null, It = (e) => {
1285
+ if (!e || typeof e != "object") return !0;
1286
+ const t = e;
1287
+ return Array.isArray(t.rules) && t.rules.length > 0 ? !1 : t.enabled === !1 && t.match === "all" && t.rules.length === 0;
1288
+ }, $n = (e) => {
1289
+ if (!e || typeof e != "object") return !0;
1290
+ const t = e;
1291
+ return t.width === 0 && t.style === "solid" && t.color === "#000000" && (t.radius === void 0 || t.radius === 0);
1292
+ }, Fe = (e) => !e || typeof e != "object" ? !0 : e.useGradient === !1, Yt = (e) => e === !1, yr = (e) => {
1293
+ if (!e || typeof e != "object") return !0;
1294
+ const t = e;
1295
+ return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
1296
+ }, st = (e) => {
1297
+ if (!e || typeof e != "object") return !0;
1298
+ const t = e;
1299
+ return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
1300
+ }, Sr = (e) => e === 0, kr = (e) => e == null || e === "", wr = (e) => {
1301
+ if (!Array.isArray(e)) return;
1302
+ const t = e.filter((r) => !(r.enabled === !0 && r.link === ""));
1303
+ if (t.length !== 0)
1304
+ return t;
1305
+ }, xr = (e) => {
1306
+ const t = {};
1307
+ for (const [r, n] of Object.entries(e))
1308
+ $r(n) || r === "backgroundGradient" && Fe(n) || (t[r] = n);
1309
+ return Object.keys(t).length > 0 ? t : void 0;
1310
+ }, Cr = (e) => {
1311
+ const t = { ...e.props };
1312
+ if (e.props.mobile && typeof e.props.mobile == "object") {
1313
+ const r = xr(e.props.mobile);
1314
+ r ? t.mobile = r : delete t.mobile;
1315
+ }
1316
+ if (It(e.props.visibility) && delete t.visibility, Yt(e.props.desktopHide) && delete t.desktopHide, Yt(e.props.mobileHide) && delete t.mobileHide, yr(e.props.margin) && delete t.margin, st(e.props.padding) && delete t.padding, Fe(e.props.backgroundGradient) && delete t.backgroundGradient, Sr(e.props.letterSpacing) && delete t.letterSpacing, e.props.backgroundImage || (delete t.backgroundImage, delete t.backgroundSize, delete t.backgroundPosition, delete t.backgroundRepeat), "icon" in e.props && kr(e.props.icon) && (delete t.icon, delete t.iconAlt, delete t.iconPosition, delete t.iconSize, delete t.iconGap), "platforms" in e.props) {
1317
+ const r = wr(e.props.platforms);
1318
+ r === void 0 ? delete t.platforms : t.platforms = r;
1319
+ }
1320
+ return {
1321
+ id: e.id,
1322
+ type: e.type,
1323
+ ...e.componentType !== void 0 && { componentType: e.componentType },
1324
+ props: t
1325
+ };
1326
+ }, _r = (e) => e.type === "component" ? Cr(e) : yn(e), Tr = (e) => {
1327
+ const { id: t, width: r, children: n, components: a, ...i } = e, o = { ...i };
1328
+ $n(e.border) && delete o.border, Fe(e.backgroundGradient) && delete o.backgroundGradient, st(e.padding) && delete o.padding, e.backgroundImage || (delete o.backgroundImage, delete o.backgroundSize, delete o.backgroundPosition, delete o.backgroundRepeat);
1329
+ const c = (n ?? a ?? []).map(_r);
1330
+ return {
1331
+ id: t,
1332
+ width: r,
1333
+ ...o,
1334
+ children: c
1335
+ };
1336
+ }, Ar = (e) => {
1337
+ const { id: t, type: r, ...n } = e, a = { ...n };
1338
+ It(e.visibility) && delete a.visibility, Fe(e.backgroundGradient) && delete a.backgroundGradient;
1339
+ const { height: i, ...o } = a;
1340
+ return {
1341
+ id: t,
1342
+ type: r,
1343
+ height: i,
1344
+ ...o
1345
+ };
1346
+ }, yn = (e) => {
1347
+ if (e.type === "row-spacer") return Ar(e);
1348
+ const { id: t, type: r, name: n, columns: a, ...i } = e, o = { ...i };
1349
+ return It(e.visibility) && delete o.visibility, $n(e.border) && delete o.border, Fe(e.backgroundGradient) && delete o.backgroundGradient, st(e.padding) && delete o.padding, e.backgroundImage || (delete o.backgroundImage, delete o.backgroundSize, delete o.backgroundPosition, delete o.backgroundRepeat), e.minHeight === 0 && delete o.minHeight, {
1350
+ id: t,
1351
+ type: r,
1352
+ ...n !== void 0 && { name: n },
1353
+ ...o,
1354
+ columns: a?.map(Tr)
1355
+ };
1356
+ }, Sn = (e) => {
1357
+ const t = { ...e };
1358
+ return e.bodyBackgroundImage || (delete t.bodyBackgroundImage, delete t.bodyBackgroundSize, delete t.bodyBackgroundPosition, delete t.bodyBackgroundRepeat), st(e.padding) && delete t.padding, t;
1359
+ }, kn = (e) => e.map(yn), Rr = {
1360
+ backgroundColor: "#ffffff",
1361
+ backgroundGradient: {
1362
+ useGradient: !1,
1363
+ solid: "#ffffff",
1364
+ gradient: {
1365
+ type: "linear",
1366
+ direction: "to right",
1367
+ colors: [{
1368
+ color: "#ffffff",
1369
+ position: 0
1370
+ }, {
1371
+ color: "#eeeeee",
1372
+ position: 100
1373
+ }]
1374
+ }
1375
+ },
1376
+ backgroundImage: "",
1377
+ backgroundSize: "cover",
1378
+ backgroundPosition: "center center",
1379
+ backgroundRepeat: "no-repeat",
1380
+ padding: {
1381
+ top: 0,
1382
+ right: 0,
1383
+ bottom: 0,
1384
+ left: 0
1385
+ },
1386
+ border: {
1387
+ width: 0,
1388
+ style: "solid",
1389
+ color: "#000000",
1390
+ radius: 0
1391
+ },
1392
+ minHeight: 0,
1393
+ gap: 12,
1394
+ mobileStack: !0,
1395
+ visibility: ke()
1396
+ }, Er = {
1397
+ backgroundColor: "transparent",
1398
+ backgroundGradient: {
1399
+ useGradient: !1,
1400
+ solid: "transparent",
1401
+ gradient: {
1402
+ type: "linear",
1403
+ direction: "to right",
1404
+ colors: [{
1405
+ color: "#ffffff",
1406
+ position: 0
1407
+ }, {
1408
+ color: "#eeeeee",
1409
+ position: 100
1410
+ }]
1411
+ }
1412
+ },
1413
+ visibility: ke()
1414
+ }, Mr = {
1415
+ backgroundColor: "transparent",
1416
+ backgroundGradient: {
1417
+ useGradient: !1,
1418
+ solid: "transparent",
1419
+ gradient: {
1420
+ type: "linear",
1421
+ direction: "to right",
1422
+ colors: [{
1423
+ color: "#ffffff",
1424
+ position: 0
1425
+ }, {
1426
+ color: "#eeeeee",
1427
+ position: 100
1428
+ }]
1429
+ }
1430
+ },
1431
+ backgroundImage: "",
1432
+ backgroundSize: "cover",
1433
+ backgroundPosition: "center center",
1434
+ backgroundRepeat: "no-repeat",
1435
+ padding: {
1436
+ top: 0,
1437
+ right: 0,
1438
+ bottom: 0,
1439
+ left: 0
1440
+ },
1441
+ border: {
1442
+ width: 0,
1443
+ style: "solid",
1444
+ color: "#000000",
1445
+ radius: 0
1446
+ },
1447
+ verticalAlign: "top"
1448
+ }, Ir = {
1449
+ language: "en-US",
1450
+ preheaderText: "View this email in your browser",
1451
+ bodyBackgroundColor: "#f9fafb",
1452
+ bodyBackgroundImage: "",
1453
+ bodyBackgroundSize: "cover",
1454
+ bodyBackgroundPosition: "center center",
1455
+ bodyBackgroundRepeat: "no-repeat",
1456
+ backgroundColor: "#ffffff",
1457
+ width: 600,
1458
+ padding: {
1459
+ top: 0,
1460
+ right: 0,
1461
+ bottom: 0,
1462
+ left: 0
1463
+ },
1464
+ mobileBreakpoint: 600
1465
+ }, Nr = (e) => JSON.parse(JSON.stringify(e)), Ie = (e, t) => {
1466
+ const r = Nr(e);
1467
+ for (const n of Object.keys(t)) {
1468
+ const a = t[n], i = e[n];
1469
+ a != null && (typeof a == "object" && !Array.isArray(a) && typeof i == "object" && i !== null && !Array.isArray(i) ? r[n] = Ie(i, a) : r[n] = a);
1470
+ }
1471
+ return r;
1472
+ }, Xt = (e) => {
1473
+ const { defaultProps: t } = Et(), r = e.componentType ?? e.type, n = t[r];
1474
+ if (!n)
1475
+ return console.warn(`[Hydrator] Unknown component type "${r}" — skipping hydration.`), e;
1476
+ const a = Ie(n, e.props);
1477
+ if (n.mobile && typeof n.mobile == "object" && (a.mobile = {
1478
+ ...n.mobile,
1479
+ ...a.mobile ?? {}
1480
+ }, a.mobile && !a.mobile.backgroundGradient && (a.mobile.backgroundGradient = n.mobile.backgroundGradient)), a.visibility = a.visibility ?? ke(), a.desktopHide = a.desktopHide ?? xt().desktopHide, a.mobileHide = a.mobileHide ?? xt().mobileHide, a.margin === void 0 && n.margin && (a.margin = { ...n.margin }), a.padding === void 0 && n.padding && (a.padding = { ...n.padding }), a.letterSpacing === void 0 && n.letterSpacing !== void 0 && (a.letterSpacing = n.letterSpacing), a.backgroundGradient) {
1481
+ const i = a.backgroundColor;
1482
+ i && (a.backgroundGradient.solid = i);
1483
+ }
1484
+ return !a.backgroundImage && n.backgroundImage !== void 0 && (a.backgroundImage = n.backgroundImage, a.backgroundSize = n.backgroundSize, a.backgroundPosition = n.backgroundPosition, a.backgroundRepeat = n.backgroundRepeat), "icon" in n && (a.icon = a.icon ?? n.icon, a.iconAlt = a.iconAlt ?? n.iconAlt ?? "", a.iconPosition = a.iconPosition ?? n.iconPosition ?? "before", a.iconSize = a.iconSize ?? n.iconSize ?? 20, a.iconGap = a.iconGap ?? n.iconGap ?? 8), {
1485
+ ...e,
1486
+ type: "component",
1487
+ componentType: r,
1488
+ props: a
1489
+ };
1490
+ }, Br = (e) => {
1491
+ if (e.type === "component") return Xt(e);
1492
+ const { defaultProps: t } = Et();
1493
+ return e.type in t ? Xt({
1494
+ ...e,
1495
+ type: "component",
1496
+ componentType: e.type
1497
+ }) : wn(e);
1498
+ }, Or = (e) => {
1499
+ const t = e.children ?? e.components ?? [], { components: r, children: n, ...a } = e, i = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: o, backgroundGradient: c, ...l } = Mr;
1500
+ let d = Ie(l, a);
1501
+ return i ? (d.backgroundColor = e.backgroundColor, d.backgroundGradient = e.backgroundGradient) : (d.backgroundColor = o, d.backgroundGradient = c), e.backgroundImage || (d.backgroundImage = "", d.backgroundSize = "cover", d.backgroundPosition = "center center", d.backgroundRepeat = "no-repeat"), {
1502
+ ...d,
1503
+ children: t.map(Br)
1504
+ };
1505
+ }, jr = (e) => {
1506
+ const t = Ie(Er, e);
1507
+ return t.backgroundColor === void 0 && (t.backgroundColor = "transparent"), t;
1508
+ }, wn = (e) => {
1509
+ if (e.type === "row-spacer") return jr(e);
1510
+ const { columns: t, ...r } = e, n = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: a, backgroundGradient: i, ...o } = Rr;
1511
+ let c = Ie(o, r);
1512
+ return n ? (c.backgroundColor = e.backgroundColor, c.backgroundGradient = e.backgroundGradient) : (c.backgroundColor = a, c.backgroundGradient = i), e.backgroundImage || (c.backgroundImage = "", c.backgroundSize = "cover", c.backgroundPosition = "center center", c.backgroundRepeat = "no-repeat"), c.minHeight === void 0 && (c.minHeight = 0), Array.isArray(t) && (c.columns = t.map(Or)), c;
1513
+ }, at = (e) => {
1514
+ const t = Ie(Ir, e);
1515
+ return e.bodyBackgroundImage || (t.bodyBackgroundImage = "", t.bodyBackgroundSize = "cover", t.bodyBackgroundPosition = "center center", t.bodyBackgroundRepeat = "no-repeat"), t;
1516
+ }, ot = (e) => e.map(wn), de = "maildeno:autosave", Ct = "1.0", Qt = (e, t, r = null, n, a) => {
1517
+ const i = Date.now();
1518
+ return {
1519
+ schemaVersion: Ct,
1520
+ templateId: r,
1521
+ expiresAt: i + 2592e6,
1522
+ touchedAt: i,
1523
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1524
+ ...n !== void 0 && { name: n },
1525
+ ...a !== void 0 && { tags: a },
1526
+ content: {
1527
+ rows: kn(e),
1528
+ canvas: Sn(t)
1529
+ }
1530
+ };
1531
+ }, yt = null, zr = () => {
1532
+ const e = P("idle"), t = P(null);
1533
+ return {
1534
+ saveToLocal: (c, l, d = null, v, k) => {
1535
+ e.value = "saving";
1536
+ const E = () => {
1537
+ try {
1538
+ const w = Qt(c, l, d, v, k);
1539
+ localStorage.setItem(de, JSON.stringify(w)), t.value = /* @__PURE__ */ new Date(), yt && clearTimeout(yt), e.value = "saved", yt = setTimeout(() => {
1540
+ e.value = "idle";
1541
+ }, 2500);
1542
+ } catch (w) {
1543
+ console.error("[AutoSave] Failed to write to localStorage:", w), e.value = "error", setTimeout(() => {
1544
+ e.value = "idle";
1545
+ }, 3e3);
1546
+ }
1547
+ };
1548
+ typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback(E, { timeout: 2e3 }) : setTimeout(E, 0);
1549
+ },
1550
+ flushSave: (c, l, d = null, v, k) => {
1551
+ try {
1552
+ const E = Qt(c, l, d, v, k);
1553
+ localStorage.setItem(de, JSON.stringify(E)), t.value = /* @__PURE__ */ new Date();
1554
+ } catch {
1555
+ }
1556
+ },
1557
+ loadFromLocal: () => {
1558
+ try {
1559
+ const c = localStorage.getItem(de);
1560
+ if (!c) return null;
1561
+ const l = JSON.parse(c);
1562
+ return l.schemaVersion !== Ct ? (console.warn(`[AutoSave] Schema mismatch (stored=${l.schemaVersion}, current=${Ct}). Discarding.`), localStorage.removeItem(de), null) : Date.now() > l.expiresAt ? (console.info("[AutoSave] Draft expired. Clearing."), localStorage.removeItem(de), null) : !l.content?.rows || !l.content?.canvas || !Array.isArray(l.content.rows) ? (console.warn("[AutoSave] Malformed payload. Discarding."), localStorage.removeItem(de), null) : {
1563
+ rows: ot(l.content.rows),
1564
+ canvas: at(l.content.canvas),
1565
+ updatedAt: l.updatedAt,
1566
+ templateId: l.templateId ?? null,
1567
+ ...l.name !== void 0 && { name: l.name },
1568
+ ...l.tags !== void 0 && { tags: l.tags }
1569
+ };
1570
+ } catch (c) {
1571
+ return console.error("[AutoSave] Failed to read from localStorage:", c), localStorage.removeItem(de), null;
1572
+ }
1573
+ },
1574
+ clearLocal: () => {
1575
+ localStorage.removeItem(de), e.value = "idle", t.value = null;
1576
+ },
1577
+ hasDraft: (c) => {
1578
+ try {
1579
+ const l = localStorage.getItem(de);
1580
+ if (!l) return !1;
1581
+ const d = JSON.parse(l);
1582
+ return !(Date.now() > d.expiresAt || c !== void 0 && d.templateId !== c);
1583
+ } catch {
1584
+ return !1;
1585
+ }
1586
+ },
1587
+ saveStatus: e,
1588
+ lastSaved: t
1589
+ };
1590
+ }, Nt = (e) => !e || /\{\{.*?\}\}/.test(e) || /^(https?:\/\/|mailto:|tel:)/i.test(e) ? e : `https://${e}`, Bt = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Ot = (e) => e == null ? "" : String(e).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Pr = (e) => {
1591
+ if (e == null) return "";
1592
+ const t = String(e);
1593
+ return t.indexOf("&quot;") === -1 ? t : t.replace(/style="([^"]*)"/g, (r, n) => `style="${n.replace(/&quot;/g, "'")}"`);
1594
+ }, jt = /* @__PURE__ */ new Map();
1595
+ function Ka(e, t) {
1596
+ const r = typeof e == "string" ? t : e;
1597
+ if (!r) {
1598
+ console.error("[maildeno-editor] registerBlock was called without a definition.");
1599
+ return;
1600
+ }
1601
+ const n = typeof e == "string" ? e : r.name;
1602
+ if (!n) {
1603
+ console.error("[maildeno-editor] registerBlock needs a name — either as the first argument or as `name` on the definition.");
1604
+ return;
1605
+ }
1606
+ jt.set(n, {
1607
+ ...r,
1608
+ name: n
1609
+ });
1610
+ }
1611
+ function zt(e) {
1612
+ return jt.get(e);
1613
+ }
1614
+ function Ya() {
1615
+ return jt;
1616
+ }
1617
+ var Lr = () => {
1618
+ const e = (n, a) => {
1619
+ if (!(n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2)) {
1620
+ const k = n && typeof n == "object" && n.solid ? n.solid : a;
1621
+ return !k || k === "transparent" ? "" : `background-color:${k};`;
1622
+ }
1623
+ const { type: i, direction: o, colors: c } = n.gradient, l = c.map((k) => `${k.color} ${k.position}%`).join(", "), d = i === "radial" ? `radial-gradient(circle at center, ${l})` : `linear-gradient(${o}, ${l})`, v = n.solid || a || "";
1624
+ return `${v && v !== "transparent" ? `background-color:${v};` : ""}background:${d};`;
1625
+ }, t = (n, a) => n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2 ? {
1626
+ vmlOpen: `
1627
+ <!--[if mso]>
1628
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f"
1629
+ style="mso-width-percent:1000;">
1630
+ <v:fill type="solid" color="${n.solid || a || "#ffffff"}" />
1631
+ <v:textbox style="mso-fit-shape-to-text:true;">
1632
+ <![endif]-->`,
1633
+ vmlClose: `
1634
+ <!--[if mso]>
1635
+ </v:textbox>
1636
+ </v:rect>
1637
+ <![endif]-->`
1638
+ } : {
1639
+ vmlOpen: "",
1640
+ vmlClose: ""
1641
+ };
1642
+ return { generateHTMLComponent: (n) => {
1643
+ const a = n.componentType ?? n.type, { props: i } = n;
1644
+ let o = "";
1645
+ const c = `eb-${n.id}`, l = i.margin ? `margin:${i.margin?.top ?? 0}px ${i.margin?.right ?? 0}px ${i.margin?.bottom ?? 0}px ${i.margin?.left ?? 0}px;` : "", d = i.padding ? `padding:${i.padding?.top ?? 0}px ${i.padding?.right ?? 0}px ${i.padding?.bottom ?? 0}px ${i.padding?.left ?? 0}px;` : "", v = (E, w, R) => {
1646
+ const I = [R ? `${c}-${R}` : c];
1647
+ return E && I.push("desktop-hide"), w && I.push("mobile-hide"), I.join(" ");
1648
+ }, k = zt(a);
1649
+ return k ? k.renderEmail.html(i, {
1650
+ uid: c,
1651
+ marginStyle: l,
1652
+ paddingStyle: d,
1653
+ escapeHtml: Bt,
1654
+ escapeAttr: Ot,
1655
+ safeUrl: Nt,
1656
+ resolveBgCss: e,
1657
+ resolveBgVml: t,
1658
+ getResponsiveClasses: v,
1659
+ react: null
1660
+ }) : o;
1661
+ } };
1662
+ }, xn = (e) => e.replace(/<br\s*\/?>/gi, "<br />"), lt = (e) => e.split(",").map((t) => t.trim().replace(/^'+|'+$/g, "").trim()).join(", "), Cn = (e) => e.replace(/font-family\s*:\s*([^;]+)/gi, (t, r) => `font-family:${lt(r)}`), Dr = (e) => e.trim().replace(/-([a-z])/g, (t, r) => r.toUpperCase()), Fr = (e) => e.split(";").map((t) => t.trim()).filter(Boolean).map((t) => {
1663
+ const r = t.indexOf(":");
1664
+ if (r < 0) return null;
1665
+ const n = t.slice(0, r).trim(), a = t.slice(r + 1).trim(), i = n.toLowerCase() === "font-family" ? lt(a) : Cn(a);
1666
+ return `${Dr(n)}: "${i}"`;
1667
+ }).filter((t) => t !== null).join(", "), Hr = (e) => e.replace(/\bcontenteditable\s*=\s*(["']?)([^"'\s>]+)\1/gi, (t, r, n) => {
1668
+ const a = n.toLowerCase();
1669
+ return a === "true" || a === "false" ? `contentEditable={${a}}` : `contentEditable="${n}"`;
1670
+ }), Ur = (e) => {
1671
+ let t = Pr(e);
1672
+ return t = xn(t), t = Hr(t), t = t.replace(/\bstyle="([^"]*)"/g, (r, n) => `style={{ ${Fr(n)} }}`), t;
1673
+ }, Jr = () => {
1674
+ const e = (r, n) => {
1675
+ if (!(r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2)) {
1676
+ const v = r && typeof r == "object" && r.solid ? r.solid : n;
1677
+ return !v || v === "transparent" ? "" : `background-color:${v};`;
1678
+ }
1679
+ const { type: a, direction: i, colors: o } = r.gradient, c = o.map((v) => `${v.color} ${v.position}%`).join(", "), l = a === "radial" ? `radial-gradient(circle at center, ${c})` : `linear-gradient(${i}, ${c})`, d = r.solid || n || "";
1680
+ return `${d && d !== "transparent" ? `background-color:${d};` : ""}background:${l};`;
1681
+ };
1682
+ return { generateReactEmailComponent: (r) => {
1683
+ const n = r.componentType ?? r.type, { props: a } = r;
1684
+ let i = "";
1685
+ const o = `eb-${r.id}`, c = a.margin ? `margin:${a.margin?.top ?? 0}px ${a.margin?.right ?? 0}px ${a.margin?.bottom ?? 0}px ${a.margin?.left ?? 0}px;` : "", l = a.padding ? `padding:${a.padding?.top ?? 0}px ${a.padding?.right ?? 0}px ${a.padding?.bottom ?? 0}px ${a.padding?.left ?? 0}px;` : "", d = (E, w) => E?.useGradient === !0 && Array.isArray(E?.gradient?.colors) && E.gradient.colors.length >= 2 ? {
1686
+ vmlOpen: "",
1687
+ vmlClose: ""
1688
+ } : {
1689
+ vmlOpen: "",
1690
+ vmlClose: ""
1691
+ }, v = (E, w, R) => {
1692
+ const I = [R ? `${o}-${R}` : o];
1693
+ return E && I.push("desktop-hide"), w && I.push("mobile-hide"), I.join(" ");
1694
+ }, k = zt(n);
1695
+ return k ? k.renderEmail.reactEmail(a, {
1696
+ uid: o,
1697
+ marginStyle: c,
1698
+ paddingStyle: l,
1699
+ escapeHtml: Bt,
1700
+ escapeAttr: Ot,
1701
+ safeUrl: Nt,
1702
+ resolveBgCss: e,
1703
+ resolveBgVml: d,
1704
+ getResponsiveClasses: v,
1705
+ react: {
1706
+ parseCssString: Gr,
1707
+ parseMarginPaddingDiscrete: qr,
1708
+ normalizeFontFamily: lt,
1709
+ styleObj: _n,
1710
+ normalizeInlineStylesToReact: Ur,
1711
+ buildInlineJsx: Wr
1712
+ }
1713
+ }) : i;
1714
+ } };
1715
+ };
1716
+ function Gr(e) {
1717
+ const t = {};
1718
+ return e.split(";").map((r) => r.trim()).filter(Boolean).forEach((r) => {
1719
+ const n = r.indexOf(":");
1720
+ if (n < 0) return;
1721
+ const a = r.slice(0, n).trim(), i = r.slice(n + 1).trim(), o = a.replace(/-([a-z])/g, (c, l) => l.toUpperCase());
1722
+ t[o] = Cn(i);
1723
+ }), t;
1724
+ }
1725
+ function qr(e, t) {
1726
+ const r = {};
1727
+ return e && (r.marginTop = `${e?.top ?? 0}px`, r.marginRight = `${e?.right ?? 0}px`, r.marginBottom = `${e?.bottom ?? 0}px`, r.marginLeft = `${e?.left ?? 0}px`), t && (r.paddingTop = `${t?.top ?? 0}px`, r.paddingRight = `${t?.right ?? 0}px`, r.paddingBottom = `${t?.bottom ?? 0}px`, r.paddingLeft = `${t?.left ?? 0}px`), r;
1728
+ }
1729
+ function _n(e) {
1730
+ return Object.entries(e).filter(([, t]) => t != null && t !== "").map(([t, r]) => `${t}: "${r}"`).join(", ");
1731
+ }
1732
+ function Wr(e, t, r, n, a) {
1733
+ return `<${e}${a ? `
1734
+ as="${a}"` : ""}
1735
+ className="${t}"
1736
+ style={{ ${_n(r)} }}
1737
+ >
1738
+ ${n}
1739
+ </${e}>
1740
+ `;
1741
+ }
1742
+ var Tn = () => {
1743
+ const e = (o, c) => {
1744
+ if (!(o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2)) {
1745
+ const R = o && typeof o == "object" && o.solid ? o.solid : c;
1746
+ return !R || R === "transparent" ? "" : `background-color:${R};`;
1747
+ }
1748
+ const { type: l, direction: d, colors: v } = o.gradient, k = v.map((R) => `${R.color} ${R.position}%`).join(", "), E = l === "radial" ? `radial-gradient(circle at center, ${k})` : `linear-gradient(${d}, ${k})`, w = o.solid || c || "";
1749
+ return `${w && w !== "transparent" ? `background-color:${w};` : ""}background:${E};`;
1750
+ }, t = (o, c) => o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2 ? {
1751
+ vmlOpen: `
1752
+ <!--[if mso]>
1753
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f"
1754
+ style="mso-width-percent:1000;">
1755
+ <v:fill type="solid" color="${o.solid || c || "#ffffff"}" />
1756
+ <v:textbox style="mso-fit-shape-to-text:true;">
1757
+ <![endif]-->`,
1758
+ vmlClose: `
1759
+ <!--[if mso]>
1760
+ </v:textbox>
1761
+ </v:rect>
1762
+ <![endif]-->`
1763
+ } : {
1764
+ vmlOpen: "",
1765
+ vmlClose: ""
1766
+ }, r = (o, c) => o && typeof o == "object" && o.solid && o.solid !== "transparent" ? o.solid : c && c !== "transparent" ? c : "", n = (o) => o ? `${o.top ?? 0}px ${o.right ?? 0}px ${o.bottom ?? 0}px ${o.left ?? 0}px` : "0px";
1767
+ return {
1768
+ generateMJMLComponent: (o) => {
1769
+ const c = o.componentType ?? o.type, { props: l } = o, d = `eb-${o.id}`, v = l.margin ? `margin:${l.margin?.top ?? 0}px ${l.margin?.right ?? 0}px ${l.margin?.bottom ?? 0}px ${l.margin?.left ?? 0}px;` : "", k = l.padding ? `padding:${l.padding?.top ?? 0}px ${l.padding?.right ?? 0}px ${l.padding?.bottom ?? 0}px ${l.padding?.left ?? 0}px;` : "", E = (R, I, O) => {
1770
+ const u = [O ? `${d}-${O}` : d];
1771
+ return R && u.push("desktop-hide"), I && u.push("mobile-hide"), u.join(" ");
1772
+ }, w = zt(c);
1773
+ return w ? w.renderEmail.mjml(l, {
1774
+ uid: d,
1775
+ marginStyle: v,
1776
+ paddingStyle: k,
1777
+ escapeHtml: Bt,
1778
+ escapeAttr: Ot,
1779
+ safeUrl: Nt,
1780
+ resolveBgCss: e,
1781
+ resolveBgVml: t,
1782
+ getResponsiveClasses: E,
1783
+ react: null
1784
+ }) : "";
1785
+ },
1786
+ assembleMJML: (o, c, l, d, v, k = 600, E = "") => {
1787
+ const w = d ? `<mj-style inline="false">
1788
+ @import url('${d}');
1789
+ </mj-style>` : "", R = `<mj-style inline="false">
1790
+ .desktop-hide { display: none !important; }
1791
+ ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
1792
+ </mj-style>`, I = E.trim() ? `<mj-style inline="false">
1793
+ ${E}
1794
+ </mj-style>` : "", O = v.trim() ? `<mj-style inline="false">
1795
+ @media only screen and (max-width:${k}px) {
1796
+ ${v}
1797
+ }
1798
+ </mj-style>` : "", u = l.bodyBackgroundColor || "#ffffff", h = l.bodyBackgroundImage ? [
1799
+ `background-url="${l.bodyBackgroundImage}"`,
1800
+ `background-size="${l.bodyBackgroundSize || "cover"}"`,
1801
+ `background-position="${l.bodyBackgroundPosition || "center center"}"`,
1802
+ `background-repeat="${l.bodyBackgroundRepeat || "no-repeat"}"`
1803
+ ].join(" ") : "", s = l.backgroundColor || "#ffffff", y = n(l.padding);
1804
+ return `<mjml lang="${l.language}">
1805
+ <mj-head>
1806
+ ${w}
1807
+ <mj-title>${o}</mj-title>
1808
+ <mj-preview>${l.preheaderText} &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp;</mj-preview>
1809
+ <mj-attributes>
1810
+ <mj-all font-family="Arial, sans-serif" />
1811
+ </mj-attributes>
1812
+ <mj-raw>
1813
+ <meta name="color-scheme" content="light dark">
1814
+ <meta name="supported-color-schemes" content="light dark">
1815
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
1816
+ </mj-raw>
1817
+ ${R}
1818
+ ${I}
1819
+ ${O}
1820
+ </mj-head>
1821
+ <mj-body background-color="${u}" width="${l.width ?? 600}px">
1822
+ <mj-wrapper full-width="full-width" ${h} padding="0">
1823
+ <mj-section background-color="${s}" padding="${y}">
1824
+ ${c}
1825
+ </mj-section>
1826
+ </mj-wrapper>
1827
+ </mj-body>
1828
+ </mjml>`;
1829
+ },
1830
+ resolveSolidColor: r,
1831
+ padAttr: n
1832
+ };
1833
+ }, An = /* @__PURE__ */ Symbol("maildeno-editor:info-dialog");
1834
+ function Xa() {
1835
+ const e = Rn();
1836
+ return Ae(An, e), e;
1837
+ }
1838
+ var Vr = () => {
1839
+ const e = Me(An);
1840
+ return e || (console.warn("[maildeno-editor] useInfoDialog() couldn't find a provided instance — falling back to a standalone instance (open() won't visibly show anything)."), Rn());
1841
+ };
1842
+ function Rn() {
1843
+ const e = P(!1), t = P("Info"), r = P("");
1844
+ return {
1845
+ visible: e,
1846
+ header: t,
1847
+ message: r,
1848
+ open: (a, i = "Info") => {
1849
+ r.value = a, t.value = i, e.value = !0;
1850
+ }
1851
+ };
1852
+ }
1853
+ var Qa = ["is_empty", "is_not_empty"], Za = ["in", "not_in"], eo = [
1854
+ ">",
1855
+ "<",
1856
+ ">=",
1857
+ "<="
1858
+ ], to = [
1859
+ "date_before",
1860
+ "date_after",
1861
+ "date_on"
1862
+ ], no = [
1863
+ {
1864
+ label: "Equals ==",
1865
+ value: "=="
1866
+ },
1867
+ {
1868
+ label: "Not Equals !=",
1869
+ value: "!="
1870
+ },
1871
+ {
1872
+ label: "Contains",
1873
+ value: "contains"
1874
+ },
1875
+ {
1876
+ label: "Not Contains",
1877
+ value: "not_contains"
1878
+ },
1879
+ {
1880
+ label: "Starts With",
1881
+ value: "starts_with"
1882
+ },
1883
+ {
1884
+ label: "Ends With",
1885
+ value: "ends_with"
1886
+ },
1887
+ {
1888
+ label: "In List (comma-separated)",
1889
+ value: "in"
1890
+ },
1891
+ {
1892
+ label: "Not In List (comma-separated)",
1893
+ value: "not_in"
1894
+ },
1895
+ {
1896
+ label: "Greater Than > (numeric)",
1897
+ value: ">"
1898
+ },
1899
+ {
1900
+ label: "Less Than < (numeric)",
1901
+ value: "<"
1902
+ },
1903
+ {
1904
+ label: "Greater Than or Equal >=",
1905
+ value: ">="
1906
+ },
1907
+ {
1908
+ label: "Less Than or Equal <=",
1909
+ value: "<="
1910
+ },
1911
+ {
1912
+ label: "Date Before",
1913
+ value: "date_before"
1914
+ },
1915
+ {
1916
+ label: "Date After",
1917
+ value: "date_after"
1918
+ },
1919
+ {
1920
+ label: "Date On",
1921
+ value: "date_on"
1922
+ },
1923
+ {
1924
+ label: "Is Empty",
1925
+ value: "is_empty"
1926
+ },
1927
+ {
1928
+ label: "Is Not Empty",
1929
+ value: "is_not_empty"
1930
+ }
1931
+ ], Zt = (e) => e.split(/[,\n;]+/).map((t) => t.trim()).filter(Boolean), Ve = (e, t) => [parseFloat(e ?? ""), parseFloat(t)], Ke = (e, t) => !isNaN(e) && !isNaN(t), _e = (e) => {
1932
+ if (!e?.trim()) return null;
1933
+ const t = /^\d{4}-\d{2}-\d{2}$/.test(e.trim()) ? /* @__PURE__ */ new Date(`${e.trim()}T00:00:00Z`) : new Date(e.trim());
1934
+ return isNaN(t.getTime()) ? null : new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()));
1935
+ }, _t = (e, t) => {
1936
+ const r = t[e.tag.toLowerCase()], n = r?.toLowerCase() ?? "", a = e.value.toLowerCase();
1937
+ switch (e.operator) {
1938
+ case "==":
1939
+ return n === a;
1940
+ case "!=":
1941
+ return n !== a;
1942
+ case "contains":
1943
+ return n.includes(a);
1944
+ case "not_contains":
1945
+ return !n.includes(a);
1946
+ case "starts_with":
1947
+ return n.startsWith(a);
1948
+ case "ends_with":
1949
+ return n.endsWith(a);
1950
+ case "in":
1951
+ return Zt(a).includes(n);
1952
+ case "not_in":
1953
+ return !Zt(a).includes(n);
1954
+ case ">": {
1955
+ const [i, o] = Ve(r, e.value);
1956
+ return Ke(i, o) && i > o;
1957
+ }
1958
+ case "<": {
1959
+ const [i, o] = Ve(r, e.value);
1960
+ return Ke(i, o) && i < o;
1961
+ }
1962
+ case ">=": {
1963
+ const [i, o] = Ve(r, e.value);
1964
+ return Ke(i, o) && i >= o;
1965
+ }
1966
+ case "<=": {
1967
+ const [i, o] = Ve(r, e.value);
1968
+ return Ke(i, o) && i <= o;
1969
+ }
1970
+ case "date_before": {
1971
+ const i = _e(r), o = _e(e.value);
1972
+ return i !== null && o !== null && i.getTime() < o.getTime();
1973
+ }
1974
+ case "date_after": {
1975
+ const i = _e(r), o = _e(e.value);
1976
+ return i !== null && o !== null && i.getTime() > o.getTime();
1977
+ }
1978
+ case "date_on": {
1979
+ const i = _e(r), o = _e(e.value);
1980
+ return i !== null && o !== null && i.getTime() === o.getTime();
1981
+ }
1982
+ case "is_empty":
1983
+ return r === void 0 || r.trim() === "";
1984
+ case "is_not_empty":
1985
+ return r !== void 0 && r.trim() !== "";
1986
+ default:
1987
+ return !0;
1988
+ }
1989
+ }, en = (e, t) => {
1990
+ if (!e.rules.length) return !0;
1991
+ const r = e.rules.map((n) => _t(n, t));
1992
+ return e.match === "any" ? r.some(Boolean) : r.every(Boolean);
1993
+ }, ct = () => ({
1994
+ evaluateVisibility: (t, r) => {
1995
+ if (!t?.enabled) return !0;
1996
+ const n = t.rules?.length > 0, a = (t.groups?.length ?? 0) > 0;
1997
+ if (!n && !a) return !0;
1998
+ const i = (t.rules ?? []).map((l) => _t(l, r)), o = (t.groups ?? []).map((l) => en(l, r)), c = [...i, ...o];
1999
+ return t.match === "any" ? c.some(Boolean) : c.every(Boolean);
2000
+ },
2001
+ evaluateRule: _t,
2002
+ evaluateGroup: en
2003
+ }), En = (e) => {
2004
+ const { type: t, direction: r, colors: n } = e.gradient, a = n.map((i) => `${i.color} ${i.position}%`).join(", ");
2005
+ return t === "radial" ? `radial-gradient(circle at center, ${a})` : `linear-gradient(${r}, ${a})`;
2006
+ }, se = (e) => {
2007
+ const t = [], r = e.backgroundGradient;
2008
+ if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
2009
+ const n = En(r), a = r.solid || e.backgroundColor || "";
2010
+ a && a !== "transparent" && t.push(`background-color:${a}`), t.push(`background:${n}`);
2011
+ } else e.backgroundColor && e.backgroundColor !== "transparent" && t.push(`background-color:${e.backgroundColor}`);
2012
+ return e.backgroundImage && (t.push(`background-image:url('${e.backgroundImage}')`), t.push(`background-size:${e.backgroundSize}`), t.push(`background-position:${e.backgroundPosition}`), t.push(`background-repeat:${e.backgroundRepeat}`)), t;
2013
+ }, Ye = (e) => {
2014
+ const t = {}, r = e.backgroundGradient;
2015
+ if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
2016
+ const n = En(r), a = r.solid || e.backgroundColor || "";
2017
+ a && a !== "transparent" && (t.backgroundColor = a), t.background = n;
2018
+ } else e.backgroundColor && e.backgroundColor !== "transparent" && (t.backgroundColor = e.backgroundColor);
2019
+ return e.backgroundImage && (t.backgroundImage = `url(${e.backgroundImage})`, t.backgroundSize = e.backgroundSize, t.backgroundPosition = e.backgroundPosition, t.backgroundRepeat = e.backgroundRepeat), t;
2020
+ }, Kr = 5, Mn = (e, t, r) => {
2021
+ if (!(r >= Kr) && Array.isArray(e))
2022
+ for (const n of e) {
2023
+ if (!n || n.type === "row-spacer") continue;
2024
+ n.mobileStack && (n.gap ?? 0) > 0 && t.add(n.gap);
2025
+ const a = n.columns;
2026
+ if (Array.isArray(a))
2027
+ for (const i of a) {
2028
+ const o = i?.children ?? i?.components;
2029
+ if (!Array.isArray(o) || o.length === 0) continue;
2030
+ const c = o.filter((l) => l?.type === "row");
2031
+ c.length > 0 && Mn(c, t, r + 1);
2032
+ }
2033
+ }
2034
+ }, In = (e) => {
2035
+ const t = /* @__PURE__ */ new Set();
2036
+ if (Mn(e, t, 0), t.size === 0) return "";
2037
+ const r = [...t].sort((n, a) => n - a);
2038
+ return `${r.map((n) => `.mobile-stack.gap-${n}`).join(`,
2039
+ `) + " { display:block !important; width:100% !important; }"}
2040
+ ${r.map((n) => `.mobile-stack.gap-${n} { height:${n}px !important; line-height:${n}px !important; }`).join(`
2041
+ `)}`;
2042
+ }, Xe = P(/* @__PURE__ */ new Set()), ut = () => {
2043
+ const e = P([
2044
+ "Arial",
2045
+ "Arial Black",
2046
+ "Comic Sans MS",
2047
+ "Courier New",
2048
+ "Georgia",
2049
+ "Helvetica",
2050
+ "Impact",
2051
+ "Lucida Console",
2052
+ "Lucida Sans Unicode",
2053
+ "Palatino Linotype",
2054
+ "Tahoma",
2055
+ "Times New Roman",
2056
+ "Trebuchet MS",
2057
+ "Verdana",
2058
+ "ABeeZee",
2059
+ "Abel",
2060
+ "Abril Fatface",
2061
+ "Adamina",
2062
+ "Alegreya",
2063
+ "Alegreya Sans",
2064
+ "Alfa Slab One",
2065
+ "Alice",
2066
+ "Amatic SC",
2067
+ "Amiri",
2068
+ "Anton",
2069
+ "Archivo",
2070
+ "Archivo Black",
2071
+ "Archivo Narrow",
2072
+ "Arimo",
2073
+ "Arvo",
2074
+ "Asap",
2075
+ "Asap Condensed",
2076
+ "Assistant",
2077
+ "Atkinson Hyperlegible",
2078
+ "Barlow",
2079
+ "Barlow Condensed",
2080
+ "Barlow Semi Condensed",
2081
+ "Be Vietnam Pro",
2082
+ "Bebas Neue",
2083
+ "BioRhyme",
2084
+ "Bitter",
2085
+ "Bodoni Moda",
2086
+ "Bree Serif",
2087
+ "Bricolage Grotesque",
2088
+ "Cabin",
2089
+ "Cabin Condensed",
2090
+ "Cairo",
2091
+ "Cal Sans",
2092
+ "Cardo",
2093
+ "Catamaran",
2094
+ "Caveat",
2095
+ "Chivo",
2096
+ "Comfortaa",
2097
+ "Commissioner",
2098
+ "Cormorant",
2099
+ "Cormorant Garamond",
2100
+ "Courier Prime",
2101
+ "Crimson Pro",
2102
+ "Crimson Text",
2103
+ "DM Mono",
2104
+ "DM Sans",
2105
+ "DM Serif Display",
2106
+ "DM Serif Text",
2107
+ "Dancing Script",
2108
+ "Domine",
2109
+ "Dosis",
2110
+ "EB Garamond",
2111
+ "Eczar",
2112
+ "Epilogue",
2113
+ "Exo",
2114
+ "Exo 2",
2115
+ "Figtree",
2116
+ "Fira Code",
2117
+ "Fira Mono",
2118
+ "Fira Sans",
2119
+ "Fira Sans Condensed",
2120
+ "Fjalla One",
2121
+ "Frank Ruhl Libre",
2122
+ "Fraunces",
2123
+ "Fredoka",
2124
+ "Funnel Sans",
2125
+ "Geist Mono",
2126
+ "Geologica",
2127
+ "Hanken Grotesk",
2128
+ "Heebo",
2129
+ "Hind",
2130
+ "Hind Madurai",
2131
+ "Hind Siliguri",
2132
+ "IBM Plex Mono",
2133
+ "IBM Plex Sans",
2134
+ "IBM Plex Sans Condensed",
2135
+ "IBM Plex Serif",
2136
+ "Inconsolata",
2137
+ "Inknut Antiqua",
2138
+ "Instrument Sans",
2139
+ "Instrument Serif",
2140
+ "Inter",
2141
+ "Inter Tight",
2142
+ "JetBrains Mono",
2143
+ "Josefin Sans",
2144
+ "Josefin Slab",
2145
+ "Jost",
2146
+ "Kalam",
2147
+ "Kanit",
2148
+ "Karla",
2149
+ "Khand",
2150
+ "Kumbh Sans",
2151
+ "Lato",
2152
+ "Lexend",
2153
+ "Lexend Deca",
2154
+ "Libre Baskerville",
2155
+ "Libre Bodoni",
2156
+ "Libre Caslon Text",
2157
+ "Libre Franklin",
2158
+ "Lobster",
2159
+ "Lora",
2160
+ "Manrope",
2161
+ "Marcellus",
2162
+ "Maven Pro",
2163
+ "Merriweather",
2164
+ "Merriweather Sans",
2165
+ "Mohave",
2166
+ "Montserrat",
2167
+ "Montserrat Alternates",
2168
+ "Mukta",
2169
+ "Mulish",
2170
+ "Neuton",
2171
+ "Newsreader",
2172
+ "Noticia Text",
2173
+ "Noto Sans",
2174
+ "Noto Sans Display",
2175
+ "Noto Sans Mono",
2176
+ "Noto Serif",
2177
+ "Noto Serif Display",
2178
+ "Nunito",
2179
+ "Nunito Sans",
2180
+ "Old Standard TT",
2181
+ "Onest",
2182
+ "Open Sans",
2183
+ "Oswald",
2184
+ "Outfit",
2185
+ "Overpass",
2186
+ "Overpass Mono",
2187
+ "Oxygen",
2188
+ "PT Mono",
2189
+ "PT Sans",
2190
+ "PT Sans Narrow",
2191
+ "PT Serif",
2192
+ "Pacifico",
2193
+ "Padauk",
2194
+ "Petrona",
2195
+ "Philosopher",
2196
+ "Piazzolla",
2197
+ "Playfair",
2198
+ "Playfair Display",
2199
+ "Playfair Display SC",
2200
+ "Plus Jakarta Sans",
2201
+ "Poppins",
2202
+ "Prata",
2203
+ "Prompt",
2204
+ "Proza Libre",
2205
+ "Public Sans",
2206
+ "Quattrocento",
2207
+ "Quattrocento Sans",
2208
+ "Questrial",
2209
+ "Quicksand",
2210
+ "REM",
2211
+ "Radio Canada",
2212
+ "Raleway",
2213
+ "Readex Pro",
2214
+ "Recursive",
2215
+ "Red Hat Display",
2216
+ "Red Hat Mono",
2217
+ "Red Hat Text",
2218
+ "Roboto",
2219
+ "Roboto Condensed",
2220
+ "Roboto Flex",
2221
+ "Roboto Mono",
2222
+ "Roboto Serif",
2223
+ "Roboto Slab",
2224
+ "Rokkitt",
2225
+ "Rubik",
2226
+ "Saira",
2227
+ "Saira Condensed",
2228
+ "Sanchez",
2229
+ "Sansita",
2230
+ "Sarabun",
2231
+ "Sen",
2232
+ "Signika",
2233
+ "Signika Negative",
2234
+ "Sintony",
2235
+ "Smooch Sans",
2236
+ "Sofia Sans",
2237
+ "Sono",
2238
+ "Sora",
2239
+ "Source Code Pro",
2240
+ "Source Sans 3",
2241
+ "Source Sans Pro",
2242
+ "Source Serif 4",
2243
+ "Source Serif Pro",
2244
+ "Space Grotesk",
2245
+ "Space Mono",
2246
+ "Spectral",
2247
+ "Syne",
2248
+ "Tajawal",
2249
+ "Teko",
2250
+ "Tenor Sans",
2251
+ "TikTok Sans",
2252
+ "Tinos",
2253
+ "Titillium Web",
2254
+ "Ubuntu",
2255
+ "Ubuntu Mono",
2256
+ "Unbounded",
2257
+ "Urbanist",
2258
+ "Vazirmatn",
2259
+ "Vollkorn",
2260
+ "Wix Madefor Display",
2261
+ "Wix Madefor Text",
2262
+ "Work Sans",
2263
+ "Yanone Kaffeesatz",
2264
+ "Yrsa",
2265
+ "Zilla Slab"
2266
+ ]), t = /* @__PURE__ */ new Set([
2267
+ "Arial",
2268
+ "Arial Black",
2269
+ "Comic Sans MS",
2270
+ "Courier New",
2271
+ "Georgia",
2272
+ "Helvetica",
2273
+ "Impact",
2274
+ "Lucida Console",
2275
+ "Lucida Sans Unicode",
2276
+ "Palatino Linotype",
2277
+ "Tahoma",
2278
+ "Times New Roman",
2279
+ "Trebuchet MS",
2280
+ "Verdana"
2281
+ ]), r = /* @__PURE__ */ new Set([
2282
+ "Alegreya",
2283
+ "Alegreya Sans",
2284
+ "Archivo",
2285
+ "Archivo Narrow",
2286
+ "Arimo",
2287
+ "Arvo",
2288
+ "Asap",
2289
+ "Asap Condensed",
2290
+ "Assistant",
2291
+ "Atkinson Hyperlegible",
2292
+ "Barlow",
2293
+ "Barlow Condensed",
2294
+ "Barlow Semi Condensed",
2295
+ "Be Vietnam Pro",
2296
+ "Bitter",
2297
+ "Bree Serif",
2298
+ "Cabin",
2299
+ "Cabin Condensed",
2300
+ "Cardo",
2301
+ "Catamaran",
2302
+ "Chivo",
2303
+ "Commissioner",
2304
+ "Cormorant",
2305
+ "Cormorant Garamond",
2306
+ "Courier Prime",
2307
+ "Crimson Pro",
2308
+ "Crimson Text",
2309
+ "DM Sans",
2310
+ "DM Serif Text",
2311
+ "Domine",
2312
+ "EB Garamond",
2313
+ "Eczar",
2314
+ "Epilogue",
2315
+ "Exo",
2316
+ "Exo 2",
2317
+ "Figtree",
2318
+ "Fira Code",
2319
+ "Fira Sans",
2320
+ "Fira Sans Condensed",
2321
+ "Frank Ruhl Libre",
2322
+ "Fraunces",
2323
+ "Hanken Grotesk",
2324
+ "Heebo",
2325
+ "IBM Plex Mono",
2326
+ "IBM Plex Sans",
2327
+ "IBM Plex Sans Condensed",
2328
+ "IBM Plex Serif",
2329
+ "Inconsolata",
2330
+ "Instrument Sans",
2331
+ "Instrument Serif",
2332
+ "Inter",
2333
+ "Inter Tight",
2334
+ "JetBrains Mono",
2335
+ "Josefin Sans",
2336
+ "Josefin Slab",
2337
+ "Jost",
2338
+ "Karla",
2339
+ "Lato",
2340
+ "Libre Baskerville",
2341
+ "Libre Bodoni",
2342
+ "Libre Caslon Text",
2343
+ "Libre Franklin",
2344
+ "Lora",
2345
+ "Manrope",
2346
+ "Maven Pro",
2347
+ "Merriweather",
2348
+ "Merriweather Sans",
2349
+ "Montserrat",
2350
+ "Mulish",
2351
+ "Neuton",
2352
+ "Newsreader",
2353
+ "Noticia Text",
2354
+ "Noto Sans",
2355
+ "Noto Sans Display",
2356
+ "Noto Serif",
2357
+ "Noto Serif Display",
2358
+ "Nunito",
2359
+ "Nunito Sans",
2360
+ "Open Sans",
2361
+ "Oswald",
2362
+ "Outfit",
2363
+ "Overpass",
2364
+ "Overpass Mono",
2365
+ "Oxygen",
2366
+ "PT Sans",
2367
+ "PT Serif",
2368
+ "Petrona",
2369
+ "Piazzolla",
2370
+ "Playfair",
2371
+ "Playfair Display",
2372
+ "Plus Jakarta Sans",
2373
+ "Poppins",
2374
+ "Proza Libre",
2375
+ "Public Sans",
2376
+ "Quattrocento",
2377
+ "Quattrocento Sans",
2378
+ "Quicksand",
2379
+ "Radio Canada",
2380
+ "Raleway",
2381
+ "Readex Pro",
2382
+ "Recursive",
2383
+ "Red Hat Display",
2384
+ "Red Hat Mono",
2385
+ "Red Hat Text",
2386
+ "Roboto",
2387
+ "Roboto Condensed",
2388
+ "Roboto Mono",
2389
+ "Roboto Serif",
2390
+ "Roboto Slab",
2391
+ "Rokkitt",
2392
+ "Rubik",
2393
+ "Saira",
2394
+ "Saira Condensed",
2395
+ "Sansita",
2396
+ "Sarabun",
2397
+ "Signika Negative",
2398
+ "Source Code Pro",
2399
+ "Source Sans 3",
2400
+ "Source Sans Pro",
2401
+ "Source Serif 4",
2402
+ "Source Serif Pro",
2403
+ "Spectral",
2404
+ "Tajawal",
2405
+ "Tinos",
2406
+ "Titillium Web",
2407
+ "Ubuntu",
2408
+ "Ubuntu Mono",
2409
+ "Vazirmatn",
2410
+ "Vollkorn",
2411
+ "Wix Madefor Display",
2412
+ "Wix Madefor Text",
2413
+ "Work Sans",
2414
+ "Yrsa",
2415
+ "Zilla Slab"
2416
+ ]), n = [
2417
+ 400,
2418
+ 500,
2419
+ 600,
2420
+ 700
2421
+ ], a = (k) => t.has(k), i = (k) => k.trim().replace(/\s+/g, "+"), o = (k) => {
2422
+ if (r.has(k)) {
2423
+ const E = n.map((R) => `0,${R}`), w = n.map((R) => `1,${R}`);
2424
+ return `ital,wght@${[...E, ...w].join(";")}`;
2425
+ }
2426
+ return `wght@${n.join(";")}`;
2427
+ }, c = (k) => {
2428
+ if (!k || a(k) || Xe.value.has(k)) return;
2429
+ const E = document.createElement("link");
2430
+ E.rel = "stylesheet", E.href = `https://fonts.googleapis.com/css2?family=${i(k)}:${o(k)}&display=swap`, document.head.appendChild(E), Xe.value.add(k);
2431
+ }, l = (k) => {
2432
+ const E = Array.from(new Set(k)).filter((w) => w && !a(w));
2433
+ return E.length ? `https://fonts.googleapis.com/css2?${E.map((w) => `family=${i(w)}:${o(w)}`).join("&")}&display=swap` : "";
2434
+ };
2435
+ return {
2436
+ googleFonts: e,
2437
+ loadGoogleFont: c,
2438
+ getGoogleFontImports: l,
2439
+ syncFontsForTemplate: (k) => {
2440
+ if (!k || k.length === 0) return;
2441
+ const E = [], w = /* @__PURE__ */ new Set();
2442
+ for (const O of k)
2443
+ O && (w.has(O) || (w.add(O), !a(O) && (Xe.value.has(O) || E.push(O))));
2444
+ if (E.length === 0) return;
2445
+ const R = l(E);
2446
+ if (!R) return;
2447
+ const I = document.createElement("link");
2448
+ I.rel = "stylesheet", I.href = R, I.dataset.canvasFonts = E.join(","), document.head.appendChild(I);
2449
+ for (const O of E) Xe.value.add(O);
2450
+ },
2451
+ preconnectGoogleFonts: () => {
2452
+ if (typeof document > "u") return;
2453
+ const k = (E, w = !1) => {
2454
+ const R = `link[rel="preconnect"][href="${E}"]`;
2455
+ if (document.head.querySelector(R)) return;
2456
+ const I = document.createElement("link");
2457
+ I.rel = "preconnect", I.href = E, w && (I.crossOrigin = "anonymous"), document.head.appendChild(I);
2458
+ };
2459
+ k("https://fonts.googleapis.com"), k("https://fonts.gstatic.com", !0);
2460
+ },
2461
+ isWebSafeFont: a,
2462
+ WEB_SAFE_FONTS: t,
2463
+ FONTS_WITH_ITALICS: r,
2464
+ DEFAULT_WEIGHTS: n
2465
+ };
2466
+ }, Pt = () => ({ emailMobileStyles: (t, r) => {
2467
+ const n = t.componentType ?? t.type, a = t.props.mobileStack === !0, i = t.props.mobile;
2468
+ if (!i && !(n === "menu" && a)) return "";
2469
+ const o = i ?? {}, c = [], l = [], d = [], v = /* @__PURE__ */ new Set(["button", "anchor"]), k = v.has(n), E = (/* @__PURE__ */ new Set(["menu", "socials"])).has(n), w = (u, h) => {
2470
+ h && u.push(h);
2471
+ }, R = () => {
2472
+ const u = o.backgroundGradient;
2473
+ if (u != null) {
2474
+ if (u.useGradient === !0 && Array.isArray(u.gradient?.colors) && u.gradient.colors.length >= 2) {
2475
+ const { type: s, direction: y, colors: C } = u.gradient, _ = C.map((x) => `${x.color} ${x.position}%`).join(", "), f = s === "radial" ? `radial-gradient(circle at center, ${_})` : `linear-gradient(${y}, ${_})`, p = u.solid || o.backgroundColor || "", g = [];
2476
+ return g.push(`background-color: ${p && p !== "transparent" ? p : "transparent"} !important`), g.push(`background: ${f} !important`), g;
2477
+ }
2478
+ const h = u.solid ?? o.backgroundColor;
2479
+ return h != null ? ["background: none !important", `background-color: ${h} !important`] : [];
2480
+ }
2481
+ return o.backgroundColor != null ? ["background: none !important", `background-color: ${o.backgroundColor} !important`] : [];
2482
+ }, I = (u) => {
2483
+ w(u, o.fontSize != null && `font-size: ${o.fontSize}px !important`), w(u, o.lineHeight != null && `line-height: ${o.lineHeight} !important`), w(u, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), w(u, o.color != null && `color: ${o.color} !important`), w(u, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), w(u, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), w(u, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), w(u, o.textTransform != null && `text-transform: ${o.textTransform} !important`), w(u, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), u.push(...R());
2484
+ };
2485
+ if (o.margin) {
2486
+ const u = o.margin;
2487
+ c.push(`margin: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2488
+ }
2489
+ if (o.padding && !k && !E) {
2490
+ const u = o.padding;
2491
+ c.push(`padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2492
+ }
2493
+ if (o.align != null && !E && c.push(`text-align: ${o.align} !important`), v.has(n)) {
2494
+ if (I(l), o.padding && n === "button") {
2495
+ const u = o.padding;
2496
+ l.push(`padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
2497
+ }
2498
+ if (o.border) {
2499
+ const u = o.border;
2500
+ l.push(`border: ${u.width}px ${u.style} ${u.color} !important`);
2501
+ }
2502
+ if (o.borderRadius != null && l.push(`border-radius: ${o.borderRadius}px !important`), n === "button") {
2503
+ const u = [];
2504
+ w(u, o.fontSize != null && `font-size: ${o.fontSize}px !important`), w(u, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), w(u, o.color != null && `color: ${o.color} !important`), w(u, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), w(u, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), w(u, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), w(u, o.textTransform != null && `text-transform: ${o.textTransform} !important`), w(u, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), u.length > 0 && d.push(`.${r}-text { ${u.join("; ")} }`);
2505
+ }
2506
+ } else if (n === "image")
2507
+ w(l, o.width != null && `width: ${o.width}% !important`), w(l, o.height != null && `height: ${o.height} !important`), w(l, o.borderRadius != null && `border-radius: ${o.borderRadius}px !important`), w(l, o.border != null && `border: ${o.border.width}px ${o.border.style} ${o.border.color} !important`);
2508
+ else if (n === "video")
2509
+ w(l, o.width != null && `width: ${o.width}% !important`), w(l, o.height != null && `height: ${o.height} !important`), w(l, o.borderRadius != null && `border-radius: ${o.borderRadius}px !important`), w(l, o.border != null && `border: ${o.border.width}px ${o.border.style} ${o.border.color} !important`);
2510
+ else if (n === "divider") {
2511
+ const u = [], h = [];
2512
+ if (o.width != null && u.push(`width: ${o.width}% !important`), o.align != null) {
2513
+ const s = o.align === "left" ? "0" : "auto", y = o.align === "right" ? "0" : "auto";
2514
+ u.push(`margin-left: ${s} !important`), u.push(`margin-right: ${y} !important`);
2515
+ }
2516
+ o.height != null && (h.push(`height: ${o.height}px !important`), h.push(`line-height: ${o.height}px !important`)), h.push(...R()), u.length > 0 && d.push(`.${r}-divider-table { ${u.join("; ")} }`), h.length > 0 && d.push(`.${r}-divider-td { ${h.join("; ")} }`);
2517
+ } else if (n === "spacer") {
2518
+ const u = [];
2519
+ o.height != null && (u.push(`height: ${o.height}px !important`), u.push(`line-height: ${o.height}px !important`)), u.push(...R()), u.length > 0 && d.push(`.${r}-spacer-td { ${u.join("; ")} }`);
2520
+ } else if (n === "list")
2521
+ I(c), o.itemSpacing != null && d.push(`.${r} li { margin-bottom: ${o.itemSpacing}px !important; }`);
2522
+ else if (n === "menu") {
2523
+ const u = [];
2524
+ if (u.push(...R()), o.padding) {
2525
+ const s = o.padding;
2526
+ u.push(`padding: ${s.top}px ${s.right}px ${s.bottom}px ${s.left}px !important`);
2527
+ }
2528
+ u.length > 0 && d.push(`.${r}-menu-td { ${u.join("; ")} }`), o.align != null && d.push(`.${r}-menu-td { text-align: ${o.align} !important; }`);
2529
+ const h = [];
2530
+ if (o.fontSize != null && h.push(`font-size: ${o.fontSize}px !important`), o.lineHeight != null && h.push(`line-height: ${o.lineHeight} !important`), o.letterSpacing != null && h.push(`letter-spacing: ${o.letterSpacing}px !important`), o.color != null && h.push(`color: ${o.color} !important`), o.fontWeight != null && h.push(`font-weight: ${o.fontWeight} !important`), o.fontFamily != null && h.push(`font-family: '${o.fontFamily}', Arial, sans-serif !important`), o.fontStyle != null && h.push(`font-style: ${o.fontStyle} !important`), o.textTransform != null && h.push(`text-transform: ${o.textTransform} !important`), o.textDecoration != null && h.push(`text-decoration: ${o.textDecoration} !important`), h.length > 0 && d.push(`.${r}-menu-td a { ${h.join("; ")} }`), a) {
2531
+ const s = o.spacing ?? t.props.spacing ?? 0;
2532
+ d.push(`.${r}-menu-item a { display: block !important; white-space: normal !important; margin-left: 0 !important; margin-right: 0 !important; margin-bottom: ${s}px !important; }`), d.push(`.${r}-menu-item:last-of-type a { margin-bottom: 0 !important; }`);
2533
+ } else if (o.spacing != null) {
2534
+ const s = Math.ceil(o.spacing / 2);
2535
+ d.push(`.${r}-menu-item a { margin-left: ${s}px !important; margin-right: ${s}px !important; }`), d.push(`.${r}-menu-item:first-of-type a { margin-left: 0 !important; }`), d.push(`.${r}-menu-item:last-of-type a { margin-right: 0 !important; }`);
2536
+ }
2537
+ } else if (n === "socials") {
2538
+ const u = [];
2539
+ if (o.padding) {
2540
+ const h = o.padding;
2541
+ u.push(`padding: ${h.top}px ${h.right}px ${h.bottom}px ${h.left}px !important`);
2542
+ }
2543
+ if (o.align != null) {
2544
+ const h = o.align === "left" ? "0" : "auto", s = o.align === "right" ? "0" : "auto";
2545
+ d.push(`.${r}-socials-inner { display:inline-table !important; margin-left: ${h} !important; margin-right: ${s} !important; }`), u.push(`text-align: ${o.align} !important`);
2546
+ }
2547
+ if (u.length > 0 && d.push(`.${r}-socials-td { ${u.join("; ")} }`), o.iconSize != null && d.push(`.${r}-socials-inner img { width: ${o.iconSize}px !important; height: ${o.iconSize}px !important; }`), o.spacing != null) {
2548
+ const h = Math.ceil(o.spacing / 2);
2549
+ d.push(`.${r}-socials-item a { margin-left: ${h}px !important; margin-right: ${h}px !important; }`), d.push(`.${r}-socials-item:first-of-type a { margin-left: 0 !important; }`), d.push(`.${r}-socials-item:last-of-type a { margin-right: 0 !important; }`);
2550
+ }
2551
+ } else I(c);
2552
+ const O = [];
2553
+ if (c.length > 0 && O.push(`.${r} { ${c.join("; ")} }`), l.length > 0) {
2554
+ const u = v.has(n) ? `.${r}-link` : n === "image" ? `.${r} img` : n === "video" ? `.${r} video` : `.${r}`;
2555
+ O.push(`${u} { ${l.join("; ")} }`);
2556
+ }
2557
+ return O.push(...d), O.join(`
2558
+ `);
2559
+ } }), tn = (e) => !e || e.width === 0 ? "" : `border:${e.width}px ${e.style} ${e.color}`, Nn = (e, t, r = [], n) => {
2560
+ const a = `padding:${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, i = t && (t.radius ?? 0) > 0 && t.width > 0, o = t && t.width > 0 && (t.radius ?? 0) === 0;
2561
+ if (!i) {
2562
+ const d = [a];
2563
+ return o && d.push(tn(t)), d.push("line-height:0"), d.push("font-size:0"), `<div style="${d.join(";")}">${e}</div>`;
2564
+ }
2565
+ const c = [
2566
+ `border-radius:${t.radius}px`,
2567
+ "overflow:hidden",
2568
+ "line-height:0",
2569
+ "font-size:0"
2570
+ ];
2571
+ t.width > 0 && c.push(tn(t));
2572
+ const l = [
2573
+ a,
2574
+ "line-height:0",
2575
+ "font-size:0"
2576
+ ];
2577
+ return `<div style="${c.join(";")}"><div style="${l.join(";")}">${e}</div></div>`;
2578
+ }, Yr = (e, t, r = {}, n, a = !0) => {
2579
+ const i = `${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, o = t && (t.radius ?? 0) > 0 && t.width > 0 && a, c = t && t.width > 0 && (t.radius ?? 0) === 0 && a;
2580
+ if (!o) {
2581
+ const v = {
2582
+ padding: i,
2583
+ lineHeight: "0",
2584
+ fontSize: "0"
2585
+ };
2586
+ return c && (v.border = `${t.width}px ${t.style} ${t.color}`, (t.radius ?? 0) > 0 && (v.borderRadius = `${t.radius}px`)), `<div style={{ ${Object.entries(v).map(([k, E]) => `${k}:"${E}"`).join(", ")} }}>${e}</div>`;
2587
+ }
2588
+ const l = {
2589
+ borderRadius: `${t.radius}px`,
2590
+ overflow: "hidden",
2591
+ lineHeight: "0",
2592
+ fontSize: "0"
2593
+ };
2594
+ t.width > 0 && (l.border = `${t.width}px ${t.style} ${t.color}`);
2595
+ const d = {
2596
+ padding: i,
2597
+ lineHeight: "0",
2598
+ fontSize: "0"
2599
+ };
2600
+ return `<div style={{ ${Object.entries(l).map(([v, k]) => `${v}:"${k}"`).join(", ")} }}><div style={{ ${Object.entries(d).map(([v, k]) => `${v}:"${k}"`).join(", ")} }}>${e}</div></div>`;
2601
+ }, St = null, kt = null;
2602
+ function Bn() {
2603
+ return St ??= Promise.all([import("./standalone-DHvJ30Td.js"), import("./html-wb0gSX1o.js")]).then(([e, t]) => ({
2604
+ prettier: e.default ?? e,
2605
+ plugins: [t.default ?? t]
2606
+ })).catch((e) => {
2607
+ throw St = null, e;
2608
+ }), St;
2609
+ }
2610
+ function Xr() {
2611
+ return kt ??= Promise.all([
2612
+ import("./standalone-DHvJ30Td.js"),
2613
+ import("./babel-DV7WPQI0.js"),
2614
+ import("./estree-DY9POgc0.js")
2615
+ ]).then(([e, t, r]) => ({
2616
+ prettier: e.default ?? e,
2617
+ plugins: [t.default ?? t, r.default ?? r]
2618
+ })).catch((e) => {
2619
+ throw kt = null, e;
2620
+ }), kt;
2621
+ }
2622
+ async function Lt(e, t) {
2623
+ try {
2624
+ return await t();
2625
+ } catch (r) {
2626
+ return console.warn("[maildeno-editor] formatter unavailable; returning unformatted output", r), e;
2627
+ }
2628
+ }
2629
+ var Qr = async (e) => Lt(e, async () => {
2630
+ const { prettier: t, plugins: r } = await Bn();
2631
+ return t.format(e, {
2632
+ parser: "html",
2633
+ plugins: r
2634
+ });
2635
+ }), Zr = async (e) => Lt(e, async () => {
2636
+ const { prettier: t, plugins: r } = await Xr();
2637
+ return t.format(e, {
2638
+ parser: "babel-ts",
2639
+ plugins: r
2640
+ });
2641
+ }), ea = async (e) => Lt(e, async () => {
2642
+ const { prettier: t, plugins: r } = await Bn();
2643
+ return t.format(e, {
2644
+ parser: "html",
2645
+ plugins: r
2646
+ });
2647
+ }), nn = (e) => e.trim().toLowerCase().replace(/\s+/g, "_"), ta = (e) => {
2648
+ const t = e.indexOf("|");
2649
+ if (t === -1) return { key: nn(e) };
2650
+ const r = e.slice(0, t), n = e.slice(t + 1).trim().replace(/^['"]|['"]$/g, "");
2651
+ return {
2652
+ key: nn(r),
2653
+ pipeDefault: n
2654
+ };
2655
+ }, rn = (e, t, r) => !r || !e ? e : e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (n, a) => {
2656
+ const { key: i, pipeDefault: o } = ta(a);
2657
+ return Object.prototype.hasOwnProperty.call(t, i) && t[i] !== "" ? t[i] : o !== void 0 ? o : n;
2658
+ }), On = (e, t, r, n, a) => {
2659
+ let i = rn(e, t, r);
2660
+ return i = rn(i, n, a), i;
2661
+ }, Dt = /* @__PURE__ */ new Map();
2662
+ function ro(e) {
2663
+ for (const t of e) Dt.set(t.key, t);
2664
+ }
2665
+ function na() {
2666
+ return [...Dt.keys()];
2667
+ }
2668
+ function ra(e, t) {
2669
+ return Dt.get(e)?.tokens?.[t];
2670
+ }
2671
+ var Ft = {
2672
+ unsubscribe_url: {
2673
+ handlebars: "{{{unsubscribe_url}}}",
2674
+ sendgrid: "{{{unsubscribe_url}}}",
2675
+ iterable: "{{unsubscribeUrl}}",
2676
+ mailchimp: "*|UNSUB|*",
2677
+ klaviyo: "{% unsubscribe_link %}",
2678
+ liquid: "{{ unsubscribe_url }}",
2679
+ braze: "{{${set_user_to_unsubscribed_url}}}",
2680
+ hubspot: "{{ unsubscribe_link_url }}",
2681
+ sfmc: "%%unsub_center_url%%",
2682
+ activecampaign: "%UNSUBSCRIBELINK%",
2683
+ marketo: "{{system.unsubscribeLink}}",
2684
+ pardot: "%%unsubscribe%%",
2685
+ campaign_monitor: "<unsubscribe>Unsubscribe</unsubscribe>"
2686
+ },
2687
+ webview_url: {
2688
+ handlebars: "{{{webview_url}}}",
2689
+ sendgrid: "{{{webview_url}}}",
2690
+ iterable: "{{webViewUrl}}",
2691
+ mailchimp: "*|ARCHIVE|*",
2692
+ klaviyo: "{% web_view_link %}",
2693
+ liquid: "{{ webview_url }}",
2694
+ braze: "{{ webview_url }}",
2695
+ hubspot: "{{ view_as_page_url }}",
2696
+ sfmc: "%%view_email_url%%",
2697
+ activecampaign: "%VIEWINBROWSERLINK%",
2698
+ marketo: "{{system.viewAsWebpageLink}}",
2699
+ pardot: "%%view_online%%",
2700
+ campaign_monitor: "<webversion>View online</webversion>"
2701
+ },
2702
+ email: {
2703
+ handlebars: "{{ email }}",
2704
+ sendgrid: "{{ email }}",
2705
+ iterable: "{{email}}",
2706
+ mailchimp: "*|EMAIL|*",
2707
+ klaviyo: "{{ email }}",
2708
+ liquid: "{{ email }}",
2709
+ braze: "{{${email_address}}}",
2710
+ hubspot: "{{ contact.email }}",
2711
+ sfmc: "%%emailaddr%%",
2712
+ activecampaign: "%EMAIL%",
2713
+ marketo: "{{lead.Email Address}}",
2714
+ pardot: "%%email%%",
2715
+ campaign_monitor: "[email]"
2716
+ },
2717
+ first_name: {
2718
+ handlebars: "{{ first_name }}",
2719
+ sendgrid: "{{ first_name }}",
2720
+ iterable: "{{firstName}}",
2721
+ mailchimp: "*|FNAME|*",
2722
+ klaviyo: "{{ first_name }}",
2723
+ liquid: "{{ first_name }}",
2724
+ braze: "{{${first_name}}}",
2725
+ hubspot: "{{ contact.firstname }}",
2726
+ sfmc: "%%First Name%%",
2727
+ activecampaign: "%FIRSTNAME%",
2728
+ marketo: "{{lead.First Name}}",
2729
+ pardot: "%%first_name%%",
2730
+ campaign_monitor: "[firstname]"
2731
+ },
2732
+ last_name: {
2733
+ handlebars: "{{ last_name }}",
2734
+ sendgrid: "{{ last_name }}",
2735
+ iterable: "{{lastName}}",
2736
+ mailchimp: "*|LNAME|*",
2737
+ klaviyo: "{{ last_name }}",
2738
+ liquid: "{{ last_name }}",
2739
+ braze: "{{${last_name}}}",
2740
+ hubspot: "{{ contact.lastname }}",
2741
+ sfmc: "%%Last Name%%",
2742
+ activecampaign: "%LASTNAME%",
2743
+ marketo: "{{lead.Last Name}}",
2744
+ pardot: "%%last_name%%",
2745
+ campaign_monitor: "[lastname]"
2746
+ },
2747
+ full_name: {
2748
+ handlebars: "{{ full_name }}",
2749
+ sendgrid: "{{ full_name }}",
2750
+ iterable: "{{firstName}} {{lastName}}",
2751
+ mailchimp: "*|FNAME|* *|LNAME|*",
2752
+ klaviyo: "{{ first_name }} {{ last_name }}",
2753
+ liquid: "{{ full_name }}",
2754
+ braze: "{{${first_name}}} {{${last_name}}}",
2755
+ hubspot: "{{ contact.firstname }} {{ contact.lastname }}",
2756
+ sfmc: "%%First Name%% %%Last Name%%",
2757
+ activecampaign: "%FIRSTNAME% %LASTNAME%",
2758
+ marketo: "{{lead.Full Name}}",
2759
+ pardot: "%%full_name%%"
2760
+ },
2761
+ company: {
2762
+ handlebars: "{{ company }}",
2763
+ sendgrid: "{{ company }}",
2764
+ iterable: "{{company}}",
2765
+ mailchimp: "*|COMPANY|*",
2766
+ klaviyo: "{{ organization }}",
2767
+ liquid: "{{ company }}",
2768
+ braze: "{{custom_attribute.${company}}}",
2769
+ hubspot: "{{ contact.company }}",
2770
+ sfmc: "%%Company%%",
2771
+ activecampaign: "%ORG%",
2772
+ marketo: "{{lead.Company Name}}",
2773
+ pardot: "%%company%%"
2774
+ },
2775
+ current_date: {
2776
+ handlebars: "{{ current_date }}",
2777
+ sendgrid: "{{ current_date }}",
2778
+ iterable: "{{now}}",
2779
+ mailchimp: "*|DATE:d F Y|*",
2780
+ klaviyo: "{{ 'now' | date: '%B %d, %Y' }}",
2781
+ liquid: "{{ 'now' | date: '%B %d, %Y' }}",
2782
+ braze: "{{ 'now' | date: '%B %d, %Y' }}",
2783
+ hubspot: "{{ today }}",
2784
+ sfmc: "%%=Format(Now(),'M/d/yyyy')=%%"
2785
+ }
2786
+ }, aa = (e, t, r) => {
2787
+ const n = !!r?.trim(), a = r?.trim() ?? "";
2788
+ switch (t) {
2789
+ case "liquid":
2790
+ case "klaviyo":
2791
+ case "hubspot":
2792
+ return n ? `{{ ${e} | default: '${a}' }}` : `{{ ${e} }}`;
2793
+ case "braze":
2794
+ return n ? `{{custom_attribute.${e} | default: '${a}'}}` : `{{custom_attribute.${e}}}`;
2795
+ case "handlebars":
2796
+ case "sendgrid":
2797
+ return n ? `{{ ${e} }}{{!-- default: ${a} --}}` : `{{ ${e} }}`;
2798
+ case "iterable":
2799
+ return n ? `{{${e}|default:${a}}}` : `{{${e}}}`;
2800
+ case "mailchimp":
2801
+ return n ? `*|${e.toUpperCase()}:${a}|*` : `*|${e.toUpperCase()}|*`;
2802
+ case "sfmc":
2803
+ return n ? `%%=IIF(Empty(@${e}),'${a}',@${e})=%%` : `%%=v(@${e})=%%`;
2804
+ case "activecampaign":
2805
+ return `%${e.toUpperCase()}%`;
2806
+ case "marketo":
2807
+ return n ? `{{lead.${e}:default ${a}}}` : `{{lead.${e}}}`;
2808
+ case "pardot":
2809
+ return `%%${e}%%`;
2810
+ case "campaign_monitor":
2811
+ return `[${e}]`;
2812
+ default:
2813
+ return `{{ ${e} }}`;
2814
+ }
2815
+ }, an = (e, t, r) => {
2816
+ const n = r.trim();
2817
+ if (!n) return e;
2818
+ switch (t) {
2819
+ case "mailchimp":
2820
+ return /^\*\|[\w:]+\|\*$/.test(e) ? e.replace(/\|\*$/, `:${n}|*`) : e;
2821
+ case "marketo":
2822
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `:default ${n}}}`) : e;
2823
+ case "liquid":
2824
+ case "klaviyo":
2825
+ case "hubspot":
2826
+ return /^\{\{\s*[^}]+\s*\}\}$/.test(e) ? e.replace(/\s*\}\}$/, ` | default: '${n}'}}`) : e;
2827
+ case "braze":
2828
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, ` | default: '${n}'}}`) : e;
2829
+ case "iterable":
2830
+ return /^\{\{[^}]+\}\}$/.test(e) ? e.replace(/\}\}$/, `|default:${n}}}`) : e;
2831
+ case "sfmc":
2832
+ return /^%%[^%]+%%$/.test(e) ? `%%=IIF(Empty(${e}),'${n}',${e})=%%` : e;
2833
+ case "handlebars":
2834
+ case "sendgrid":
2835
+ return `${e}{{!-- default: ${n} --}}`;
2836
+ default:
2837
+ return e;
2838
+ }
2839
+ }, on = (e, t, r) => {
2840
+ const n = Ft[e];
2841
+ if (n) {
2842
+ const i = n[t];
2843
+ if (i) return r?.trim() ? an(i, t, r) : i;
2844
+ }
2845
+ const a = ra(e, t);
2846
+ return a ? r?.trim() ? an(a, t, r) : a : aa(e, t, r);
2847
+ }, oa = (e, t) => {
2848
+ if (!e) return "";
2849
+ let r = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, a, i) => on(a, t, i?.trim() || void 0));
2850
+ return r = r.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (n, a, i, o, c, l, d) => {
2851
+ const v = (a ?? i ?? o ?? "").trim(), k = (c ?? l ?? d ?? "").trim();
2852
+ return on(v, t, k || void 0);
2853
+ }), r;
2854
+ }, ao = () => [...Object.keys(Ft), ...na()], oo = (e, t) => Ft[e]?.[t] ?? null, De = (e) => {
2855
+ let t = (e ?? "").trim().replace(/[^A-Za-z0-9_$]+/g, "_");
2856
+ return /^[0-9]/.test(t) && (t = `_${t}`), t || "_tag";
2857
+ }, sn = (e, t) => {
2858
+ const r = e.trim();
2859
+ return r ? t?.trim() ? `{${r} ?? "${t.trim().replace(/"/g, '\\"')}"}` : `{${r}}` : "";
2860
+ }, ia = (e) => {
2861
+ if (!e) return "";
2862
+ let t = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (r, n, a) => sn(n, a?.trim() || void 0));
2863
+ return t = t.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (r, n, a, i, o, c, l) => {
2864
+ const d = (n ?? a ?? i ?? "").trim(), v = (o ?? c ?? l ?? "").trim();
2865
+ return sn(d, v || void 0);
2866
+ }), t = t.replace(/(\b(?!style=)\w[\w-]*=)"([^"]*\{[^}]+\}[^"]*)"/g, (r, n, a) => {
2867
+ const i = a.match(/^\{(\w+)\}$/);
2868
+ return i ? `${n}{${i[1]}}` : `${n}{\`${a.replace(/\{(\w+)\}/g, "${$1}")}\`}`;
2869
+ }), t;
2870
+ }, sa = (e) => {
2871
+ if (e.length === 0) return {
2872
+ propsInterface: "",
2873
+ propsDestructure: ""
2874
+ };
2875
+ const t = /* @__PURE__ */ new Map();
2876
+ for (const { tagId: n, fallback: a } of e) t.has(n) || t.set(n, a);
2877
+ const r = [...t.entries()];
2878
+ return {
2879
+ propsInterface: `interface EmailProps {
2880
+ ${r.map(([n]) => ` ${n}?: string;`).join(`
2881
+ `)}
2882
+ }`,
2883
+ propsDestructure: `{ ${r.map(([n, a]) => a?.trim() ? `${n} = "${a.trim().replace(/"/g, '\\"')}"` : n).join(", ")} }: EmailProps`
2884
+ };
2885
+ }, la = (e) => {
2886
+ const t = /* @__PURE__ */ new Map();
2887
+ for (const r of e.matchAll(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs)) {
2888
+ const n = r[1].trim();
2889
+ n && !t.has(n) && t.set(n, r[2]?.trim() || void 0);
2890
+ }
2891
+ for (const r of e.matchAll(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g)) {
2892
+ const n = (r[1] ?? r[2] ?? r[3] ?? "").trim(), a = (r[4] ?? r[5] ?? r[6] ?? "").trim();
2893
+ n && !t.has(n) && t.set(n, a || void 0);
2894
+ }
2895
+ return [...t.entries()].map(([r, n]) => ({
2896
+ tagId: r,
2897
+ fallback: n
2898
+ }));
2899
+ }, ca = (e) => {
2900
+ const t = /* @__PURE__ */ new Set(), r = (a) => {
2901
+ if (a?.enabled) {
2902
+ for (const i of a.rules ?? []) i.tag?.trim() && t.add(De(i.tag));
2903
+ for (const i of a.groups ?? []) for (const o of i.rules ?? []) o.tag?.trim() && t.add(De(o.tag));
2904
+ }
2905
+ }, n = (a) => {
2906
+ for (const i of a) if (i.type === "row") {
2907
+ r(i.visibility);
2908
+ for (const o of i.columns ?? []) {
2909
+ r(o.props?.visibility);
2910
+ const c = o.children ?? o.components ?? [];
2911
+ n(c);
2912
+ }
2913
+ } else i.type === "row-spacer" ? r(i.visibility) : r(i.props?.visibility);
2914
+ };
2915
+ for (const a of e) {
2916
+ r(a.visibility);
2917
+ for (const i of a.columns ?? [])
2918
+ r(i.props?.visibility), n(i.children ?? i.components ?? []);
2919
+ }
2920
+ return [...t];
2921
+ }, ua = (e) => e.length === 0 ? "" : ` // Visibility data — replace with real values from your data source
2922
+ ${e.map((t) => ` const ${t} = "";`).join(`
2923
+ `)}`, jn = (e, t, r, n, a = !1) => {
2924
+ const i = n?.mergeTagActive || n?.linkTagActive;
2925
+ if (t === "wrap" || !i) return oa(e, r);
2926
+ if (a) {
2927
+ const { mergeTagContext: o, mergeTagActive: c, linkTagContext: l, linkTagActive: d } = n;
2928
+ return On(e, o ?? {}, c ?? !1, l ?? {}, d ?? !1);
2929
+ }
2930
+ return e;
2931
+ }, zn = (e, t, r) => {
2932
+ if (t === "wrap" || !r) return e;
2933
+ const { mergeTagContext: n, mergeTagActive: a, linkTagContext: i, linkTagActive: o } = r;
2934
+ return !a && !o ? e : On(e, n, a, i, o);
2935
+ }, Ht = /* @__PURE__ */ new Map(), Pn = /* @__PURE__ */ new Map();
2936
+ function io(e, t, r) {
2937
+ Ht.set(e, t), r && Pn.set(e, r);
2938
+ }
2939
+ var da = {
2940
+ label: "Custom",
2941
+ group: "custom",
2942
+ description: "Registered ESP syntax with no metadata override.",
2943
+ supportsNesting: !0
2944
+ };
2945
+ function pa(e, t) {
2946
+ return t[e] ?? Ht.get(e) ?? da;
2947
+ }
2948
+ function Ln(e) {
2949
+ return Pn.get(e);
2950
+ }
2951
+ function so() {
2952
+ return [...Ht.entries()].map(([e, t]) => ({
2953
+ id: e,
2954
+ meta: t
2955
+ }));
2956
+ }
2957
+ var ma = {
2958
+ handlebars: {
2959
+ label: "Handlebars (Generic)",
2960
+ group: "handlebars",
2961
+ description: "Generic Handlebars.js template syntax",
2962
+ supportsNesting: !0
2963
+ },
2964
+ sendgrid: {
2965
+ label: "SendGrid",
2966
+ group: "handlebars",
2967
+ description: "SendGrid Dynamic Templates (Handlebars)",
2968
+ docsUrl: "https://docs.sendgrid.com/for-developers/sending-email/using-handlebars",
2969
+ supportsNesting: !0
2970
+ },
2971
+ iterable: {
2972
+ label: "Iterable",
2973
+ group: "handlebars",
2974
+ description: "Iterable templating (Handlebars-compatible)",
2975
+ docsUrl: "https://support.iterable.com/hc/en-us/articles/205480365",
2976
+ supportsNesting: !0
2977
+ },
2978
+ mailchimp: {
2979
+ label: "Mailchimp",
2980
+ group: "custom",
2981
+ description: "Mailchimp merge tag conditionals *|IF:…|*",
2982
+ docsUrl: "https://mailchimp.com/help/use-conditional-merge-tag-blocks/",
2983
+ supportsNesting: !1
2984
+ },
2985
+ klaviyo: {
2986
+ label: "Klaviyo",
2987
+ group: "liquid",
2988
+ description: "Klaviyo (Liquid templating)",
2989
+ docsUrl: "https://help.klaviyo.com/hc/en-us/articles/115002775012",
2990
+ supportsNesting: !0
2991
+ },
2992
+ liquid: {
2993
+ label: "Liquid (Generic)",
2994
+ group: "liquid",
2995
+ description: "Generic Liquid template syntax (Shopify, etc.)",
2996
+ supportsNesting: !0
2997
+ },
2998
+ braze: {
2999
+ label: "Braze",
3000
+ group: "liquid",
3001
+ description: "Braze (Liquid + Connected Content)",
3002
+ docsUrl: "https://www.braze.com/docs/user_guide/personalization_and_dynamic_content/liquid/",
3003
+ supportsNesting: !0
3004
+ },
3005
+ hubspot: {
3006
+ label: "HubSpot",
3007
+ group: "liquid",
3008
+ description: "HubSpot (HubL — Liquid-based)",
3009
+ docsUrl: "https://developers.hubspot.com/docs/cms/hubl/intro-to-hubl",
3010
+ supportsNesting: !0
3011
+ },
3012
+ sfmc: {
3013
+ label: "Salesforce Marketing Cloud",
3014
+ group: "ampscript",
3015
+ description: "SFMC AMPscript conditionals",
3016
+ docsUrl: "https://ampscript.guide/if/",
3017
+ supportsNesting: !0
3018
+ },
3019
+ activecampaign: {
3020
+ label: "ActiveCampaign",
3021
+ group: "custom",
3022
+ description: "ActiveCampaign conditional content tags",
3023
+ docsUrl: "https://help.activecampaign.com/hc/en-us/articles/220358207",
3024
+ supportsNesting: !0
3025
+ },
3026
+ marketo: {
3027
+ label: "Marketo",
3028
+ group: "custom",
3029
+ description: "Marketo Velocity Script conditionals",
3030
+ docsUrl: "https://nation.marketo.com/t5/product-blogs/velocity-scripting/ba-p/232782",
3031
+ supportsNesting: !0
3032
+ },
3033
+ campaign_monitor: {
3034
+ label: "Campaign Monitor",
3035
+ group: "custom",
3036
+ description: "Campaign Monitor conditional merge tags",
3037
+ docsUrl: "https://help.campaignmonitor.com/custom-fields-and-personalization",
3038
+ supportsNesting: !1
3039
+ },
3040
+ pardot: {
3041
+ label: "Pardot / MCAE",
3042
+ group: "custom",
3043
+ description: "Pardot (Marketing Cloud Account Engagement) conditionals",
3044
+ docsUrl: "https://help.salesforce.com/s/articleView?id=pardot_variable_tags.htm",
3045
+ supportsNesting: !1
3046
+ },
3047
+ mso: {
3048
+ label: "Outlook (MSO)",
3049
+ group: "mso",
3050
+ description: "Microsoft Office VML conditional comments for Outlook",
3051
+ supportsNesting: !1
3052
+ }
3053
+ }, lo = [
3054
+ {
3055
+ syntax: "handlebars",
3056
+ label: "Handlebars",
3057
+ eq: "native",
3058
+ neq: "helper",
3059
+ contains: "helper",
3060
+ not_contains: "helper",
3061
+ starts_with: "helper",
3062
+ ends_with: "helper",
3063
+ in: "helper",
3064
+ not_in: "helper",
3065
+ numeric: "helper",
3066
+ is_empty: "helper",
3067
+ date: "helper"
3068
+ },
3069
+ {
3070
+ syntax: "sendgrid",
3071
+ label: "SendGrid",
3072
+ eq: "native",
3073
+ neq: "none",
3074
+ contains: "none",
3075
+ not_contains: "none",
3076
+ starts_with: "none",
3077
+ ends_with: "none",
3078
+ in: "none",
3079
+ not_in: "none",
3080
+ numeric: "none",
3081
+ is_empty: "none",
3082
+ date: "none"
3083
+ },
3084
+ {
3085
+ syntax: "iterable",
3086
+ label: "Iterable",
3087
+ eq: "native",
3088
+ neq: "helper",
3089
+ contains: "helper",
3090
+ not_contains: "helper",
3091
+ starts_with: "helper",
3092
+ ends_with: "helper",
3093
+ in: "helper",
3094
+ not_in: "helper",
3095
+ numeric: "helper",
3096
+ is_empty: "helper",
3097
+ date: "helper"
3098
+ },
3099
+ {
3100
+ syntax: "liquid",
3101
+ label: "Liquid",
3102
+ eq: "native",
3103
+ neq: "native",
3104
+ contains: "native",
3105
+ not_contains: "native",
3106
+ starts_with: "none",
3107
+ ends_with: "none",
3108
+ in: "fallback",
3109
+ not_in: "fallback",
3110
+ numeric: "native",
3111
+ is_empty: "native",
3112
+ date: "native"
3113
+ },
3114
+ {
3115
+ syntax: "klaviyo",
3116
+ label: "Klaviyo",
3117
+ eq: "native",
3118
+ neq: "native",
3119
+ contains: "native",
3120
+ not_contains: "native",
3121
+ starts_with: "none",
3122
+ ends_with: "none",
3123
+ in: "fallback",
3124
+ not_in: "fallback",
3125
+ numeric: "native",
3126
+ is_empty: "native",
3127
+ date: "native"
3128
+ },
3129
+ {
3130
+ syntax: "braze",
3131
+ label: "Braze",
3132
+ eq: "native",
3133
+ neq: "native",
3134
+ contains: "native",
3135
+ not_contains: "native",
3136
+ starts_with: "none",
3137
+ ends_with: "none",
3138
+ in: "fallback",
3139
+ not_in: "fallback",
3140
+ numeric: "native",
3141
+ is_empty: "native",
3142
+ date: "native"
3143
+ },
3144
+ {
3145
+ syntax: "hubspot",
3146
+ label: "HubSpot",
3147
+ eq: "native",
3148
+ neq: "native",
3149
+ contains: "native",
3150
+ not_contains: "native",
3151
+ starts_with: "none",
3152
+ ends_with: "none",
3153
+ in: "fallback",
3154
+ not_in: "fallback",
3155
+ numeric: "native",
3156
+ is_empty: "native",
3157
+ date: "native"
3158
+ },
3159
+ {
3160
+ syntax: "sfmc",
3161
+ label: "SFMC",
3162
+ eq: "native",
3163
+ neq: "native",
3164
+ contains: "native",
3165
+ not_contains: "native",
3166
+ starts_with: "native",
3167
+ ends_with: "native",
3168
+ in: "fallback",
3169
+ not_in: "fallback",
3170
+ numeric: "native",
3171
+ is_empty: "native",
3172
+ date: "native"
3173
+ },
3174
+ {
3175
+ syntax: "activecampaign",
3176
+ label: "ActiveCampaign",
3177
+ eq: "native",
3178
+ neq: "native",
3179
+ contains: "native",
3180
+ not_contains: "native",
3181
+ starts_with: "none",
3182
+ ends_with: "none",
3183
+ in: "native",
3184
+ not_in: "fallback",
3185
+ numeric: "native",
3186
+ is_empty: "native",
3187
+ date: "fallback"
3188
+ },
3189
+ {
3190
+ syntax: "marketo",
3191
+ label: "Marketo",
3192
+ eq: "native",
3193
+ neq: "native",
3194
+ contains: "native",
3195
+ not_contains: "native",
3196
+ starts_with: "native",
3197
+ ends_with: "native",
3198
+ in: "fallback",
3199
+ not_in: "fallback",
3200
+ numeric: "native",
3201
+ is_empty: "native",
3202
+ date: "native"
3203
+ },
3204
+ {
3205
+ syntax: "mailchimp",
3206
+ label: "Mailchimp",
3207
+ eq: "native",
3208
+ neq: "native",
3209
+ contains: "fallback",
3210
+ not_contains: "fallback",
3211
+ starts_with: "fallback",
3212
+ ends_with: "fallback",
3213
+ in: "fallback",
3214
+ not_in: "fallback",
3215
+ numeric: "native",
3216
+ is_empty: "fallback",
3217
+ date: "fallback"
3218
+ },
3219
+ {
3220
+ syntax: "pardot",
3221
+ label: "Pardot",
3222
+ eq: "native",
3223
+ neq: "native",
3224
+ contains: "none",
3225
+ not_contains: "none",
3226
+ starts_with: "none",
3227
+ ends_with: "none",
3228
+ in: "none",
3229
+ not_in: "none",
3230
+ numeric: "none",
3231
+ is_empty: "none",
3232
+ date: "none"
3233
+ },
3234
+ {
3235
+ syntax: "campaign_monitor",
3236
+ label: "Campaign Monitor",
3237
+ eq: "native",
3238
+ neq: "native",
3239
+ contains: "none",
3240
+ not_contains: "none",
3241
+ starts_with: "none",
3242
+ ends_with: "none",
3243
+ in: "none",
3244
+ not_in: "none",
3245
+ numeric: "none",
3246
+ is_empty: "none",
3247
+ date: "none"
3248
+ },
3249
+ {
3250
+ syntax: "mso",
3251
+ label: "MSO/Outlook",
3252
+ eq: "native",
3253
+ neq: "none",
3254
+ contains: "none",
3255
+ not_contains: "none",
3256
+ starts_with: "none",
3257
+ ends_with: "none",
3258
+ in: "none",
3259
+ not_in: "none",
3260
+ numeric: "none",
3261
+ is_empty: "none",
3262
+ date: "none"
3263
+ }
3264
+ ], fa = (e, t) => {
3265
+ const r = De(e);
3266
+ switch (t) {
3267
+ case "sfmc":
3268
+ return `AttributeValue("${r}")`;
3269
+ case "marketo":
3270
+ return `$!{${r}}`;
3271
+ case "mailchimp":
3272
+ return r.toUpperCase();
3273
+ default:
3274
+ return r;
3275
+ }
3276
+ }, we = (e, t) => {
3277
+ const { operator: r, value: n } = e, a = fa(e.tag, t);
3278
+ switch (t) {
3279
+ case "handlebars":
3280
+ case "sendgrid":
3281
+ case "iterable":
3282
+ switch (r) {
3283
+ case "==":
3284
+ return `(eq ${a} '${n}')`;
3285
+ case "!=":
3286
+ return `(neq ${a} '${n}')`;
3287
+ case "contains":
3288
+ return `(contains ${a} '${n}')`;
3289
+ case "not_contains":
3290
+ return `(not (contains ${a} '${n}'))`;
3291
+ case "starts_with":
3292
+ return `(startsWith ${a} '${n}')`;
3293
+ case "ends_with":
3294
+ return `(endsWith ${a} '${n}')`;
3295
+ case "in":
3296
+ return `(in ${a} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")})`;
3297
+ case "not_in":
3298
+ return `(not (in ${a} ${n.split(",").map((i) => `'${i.trim()}'`).join(" ")}))`;
3299
+ case ">":
3300
+ return `(gt ${a} ${n})`;
3301
+ case "<":
3302
+ return `(lt ${a} ${n})`;
3303
+ case ">=":
3304
+ return `(gte ${a} ${n})`;
3305
+ case "<=":
3306
+ return `(lte ${a} ${n})`;
3307
+ case "is_empty":
3308
+ return `(isEmpty ${a})`;
3309
+ case "is_not_empty":
3310
+ return `(not (isEmpty ${a}))`;
3311
+ case "date_before":
3312
+ return `(dateBefore ${a} '${n}')`;
3313
+ case "date_after":
3314
+ return `(dateAfter ${a} '${n}')`;
3315
+ case "date_on":
3316
+ return `(dateOn ${a} '${n}')`;
3317
+ default:
3318
+ return `(eq ${a} '${n}')`;
3319
+ }
3320
+ case "liquid":
3321
+ case "klaviyo":
3322
+ case "braze":
3323
+ case "hubspot":
3324
+ switch (r) {
3325
+ case "==":
3326
+ return `${a} == '${n}'`;
3327
+ case "!=":
3328
+ return `${a} != '${n}'`;
3329
+ case "contains":
3330
+ return `${a} contains '${n}'`;
3331
+ case "not_contains":
3332
+ return `not (${a} contains '${n}')`;
3333
+ case "starts_with":
3334
+ case "ends_with":
3335
+ return null;
3336
+ case "in":
3337
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" or ");
3338
+ case "not_in":
3339
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" and ");
3340
+ case ">":
3341
+ return `${a} > ${n}`;
3342
+ case "<":
3343
+ return `${a} < ${n}`;
3344
+ case ">=":
3345
+ return `${a} >= ${n}`;
3346
+ case "<=":
3347
+ return `${a} <= ${n}`;
3348
+ case "is_empty":
3349
+ return `${a} == blank`;
3350
+ case "is_not_empty":
3351
+ return `${a} != blank`;
3352
+ case "date_before":
3353
+ return `${Tt(e.tag)} < ${At(e.tag, n)}`;
3354
+ case "date_after":
3355
+ return `${Tt(e.tag)} > ${At(e.tag, n)}`;
3356
+ case "date_on":
3357
+ return `${a} | date: '%F' == '${n}'`;
3358
+ default:
3359
+ return `${a} == '${n}'`;
3360
+ }
3361
+ case "mailchimp":
3362
+ switch (r) {
3363
+ case "==":
3364
+ return `${a}='${n}'`;
3365
+ case "!=":
3366
+ return `${a}!='${n}'`;
3367
+ case ">":
3368
+ case "<":
3369
+ case ">=":
3370
+ case "<=": {
3371
+ const i = Number(n);
3372
+ return Number.isNaN(i) ? `${a}='${n}'` : `${a}${r}${i}`;
3373
+ }
3374
+ case "date_before":
3375
+ return `${a}<'${n}'`;
3376
+ case "date_after":
3377
+ return `${a}>'${n}'`;
3378
+ case "date_on":
3379
+ return `${a}='${n}'`;
3380
+ default:
3381
+ return `${a}='${n}'`;
3382
+ }
3383
+ case "sfmc":
3384
+ switch (r) {
3385
+ case "==":
3386
+ return `${a} == '${n}'`;
3387
+ case "!=":
3388
+ return `${a} != '${n}'`;
3389
+ case "contains":
3390
+ return `Contains(${a}, '${n}')`;
3391
+ case "not_contains":
3392
+ return `Not Contains(${a}, '${n}')`;
3393
+ case "starts_with":
3394
+ return `IndexOf(${a}, '${n}') == 1`;
3395
+ case "ends_with":
3396
+ return `Substring(${a}, Subtract(Length(${a}), Subtract(Length('${n}'), 1)), Length('${n}')) == '${n}'`;
3397
+ case "in":
3398
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" OR ");
3399
+ case "not_in":
3400
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" AND ");
3401
+ case ">":
3402
+ return `${a} > ${n}`;
3403
+ case "<":
3404
+ return `${a} < ${n}`;
3405
+ case ">=":
3406
+ return `${a} >= ${n}`;
3407
+ case "<=":
3408
+ return `${a} <= ${n}`;
3409
+ case "is_empty":
3410
+ return `Empty(${a})`;
3411
+ case "is_not_empty":
3412
+ return `Not Empty(${a})`;
3413
+ case "date_before":
3414
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") < 0`;
3415
+ case "date_after":
3416
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") > 0`;
3417
+ case "date_on":
3418
+ return `DateDiff(DateParse(${a}), DateParse('${n}'), "D") == 0`;
3419
+ default:
3420
+ return `${a} == '${n}'`;
3421
+ }
3422
+ case "activecampaign":
3423
+ switch (r) {
3424
+ case "==":
3425
+ return `${a} EQUALS ${n}`;
3426
+ case "!=":
3427
+ return `${a} NOT EQUALS ${n}`;
3428
+ case "contains":
3429
+ return `${a} CONTAINS ${n}`;
3430
+ case "not_contains":
3431
+ return `${a} NOT CONTAINS ${n}`;
3432
+ case "starts_with":
3433
+ case "ends_with":
3434
+ return null;
3435
+ case "in":
3436
+ return `${a} IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3437
+ case "not_in":
3438
+ return `${a} NOT IN ${n.split(",").map((i) => i.trim()).join(",")}`;
3439
+ case ">":
3440
+ return `${a} GREATER THAN ${n}`;
3441
+ case "<":
3442
+ return `${a} LESS THAN ${n}`;
3443
+ case ">=":
3444
+ return `${a} GREATER THAN OR EQUAL TO ${n}`;
3445
+ case "<=":
3446
+ return `${a} LESS THAN OR EQUAL TO ${n}`;
3447
+ case "is_empty":
3448
+ return `${a} IS EMPTY`;
3449
+ case "is_not_empty":
3450
+ return `${a} IS NOT EMPTY`;
3451
+ case "date_before":
3452
+ return `${a} LESS THAN ${n}`;
3453
+ case "date_after":
3454
+ return `${a} GREATER THAN ${n}`;
3455
+ case "date_on":
3456
+ return `${a} EQUALS ${n}`;
3457
+ default:
3458
+ return `${a} EQUALS ${n}`;
3459
+ }
3460
+ case "marketo":
3461
+ switch (r) {
3462
+ case "==":
3463
+ return `${a} == '${n}'`;
3464
+ case "!=":
3465
+ return `${a} != '${n}'`;
3466
+ case "contains":
3467
+ return `${a} && ${a}.contains('${n}')`;
3468
+ case "not_contains":
3469
+ return `!${a} || !${a}.contains('${n}')`;
3470
+ case "starts_with":
3471
+ return `${a}.startsWith('${n}')`;
3472
+ case "ends_with":
3473
+ return `${a}.endsWith('${n}')`;
3474
+ case "in":
3475
+ return n.split(",").map((i) => `${a} == '${i.trim()}'`).join(" || ");
3476
+ case "not_in":
3477
+ return n.split(",").map((i) => `${a} != '${i.trim()}'`).join(" && ");
3478
+ case ">":
3479
+ return `${a}.toInteger() > ${n}`;
3480
+ case "<":
3481
+ return `${a}.toInteger() < ${n}`;
3482
+ case ">=":
3483
+ return `${a}.toInteger() >= ${n}`;
3484
+ case "<=":
3485
+ return `${a}.toInteger() <= ${n}`;
3486
+ case "is_empty":
3487
+ return `!${a} || ${a} == ''`;
3488
+ case "is_not_empty":
3489
+ return `${a} && ${a} != ''`;
3490
+ case "date_before":
3491
+ return `$date.parse('yyyy-MM-dd', ${a}).before($date.parse('yyyy-MM-dd', '${n}'))`;
3492
+ case "date_after":
3493
+ return `$date.parse('yyyy-MM-dd', ${a}).after($date.parse('yyyy-MM-dd', '${n}'))`;
3494
+ case "date_on":
3495
+ return `$date.parse('yyyy-MM-dd', ${a}).equals($date.parse('yyyy-MM-dd', '${n}'))`;
3496
+ default:
3497
+ return `${a} == '${n}'`;
3498
+ }
3499
+ case "campaign_monitor":
3500
+ case "pardot":
3501
+ switch (r) {
3502
+ case "==":
3503
+ return `${a}='${n}'`;
3504
+ case "!=":
3505
+ return `${a}!='${n}'`;
3506
+ case "date_before":
3507
+ case "date_after":
3508
+ case "date_on":
3509
+ return `${a}='${n}'`;
3510
+ default:
3511
+ return `${a}='${n}'`;
3512
+ }
3513
+ case "mso":
3514
+ return "mso | IE";
3515
+ default:
3516
+ return `${a} == '${n}'`;
3517
+ }
3518
+ }, ln = (e, t, r) => {
3519
+ if (e.length === 1) return e[0];
3520
+ switch (r) {
3521
+ case "handlebars":
3522
+ case "sendgrid":
3523
+ case "iterable":
3524
+ return t === "all" ? `(and ${e.join(" ")})` : `(or ${e.join(" ")})`;
3525
+ case "sfmc":
3526
+ case "activecampaign":
3527
+ case "mailchimp":
3528
+ case "campaign_monitor":
3529
+ case "pardot":
3530
+ return e.join(t === "all" ? " AND " : " OR ");
3531
+ case "marketo":
3532
+ return e.join(t === "all" ? " && " : " || ");
3533
+ case "liquid":
3534
+ case "klaviyo":
3535
+ case "braze":
3536
+ case "hubspot":
3537
+ return e.join(t === "all" ? " and " : " or ");
3538
+ default:
3539
+ return e.join(t === "all" ? " && " : " || ");
3540
+ }
3541
+ }, Dn = (e, t) => {
3542
+ const r = Ln(t)?.wrapOpenTag;
3543
+ if (r) return r(e);
3544
+ switch (t) {
3545
+ case "handlebars":
3546
+ case "sendgrid":
3547
+ case "iterable":
3548
+ return `{{#if ${e}}}`;
3549
+ case "liquid":
3550
+ case "klaviyo":
3551
+ case "braze":
3552
+ case "hubspot":
3553
+ return `{% if ${e} %}`;
3554
+ case "mailchimp":
3555
+ return `*|IF:${e}|*`;
3556
+ case "sfmc":
3557
+ return `%%[ IF ${e} THEN ]%%`;
3558
+ case "activecampaign":
3559
+ return `%IF ${e}%`;
3560
+ case "marketo":
3561
+ return `#if(${e})`;
3562
+ case "campaign_monitor":
3563
+ return `<singleline:${e}>`;
3564
+ case "pardot":
3565
+ return `%%if ${e}%%`;
3566
+ case "mso":
3567
+ return `<!--[if ${e}]>`;
3568
+ default:
3569
+ return `{{#if ${e}}}`;
3570
+ }
3571
+ }, Fn = (e) => {
3572
+ const t = Ln(e)?.wrapCloseTag;
3573
+ if (t) return t();
3574
+ switch (e) {
3575
+ case "handlebars":
3576
+ case "sendgrid":
3577
+ case "iterable":
3578
+ return "{{/if}}";
3579
+ case "liquid":
3580
+ case "klaviyo":
3581
+ case "braze":
3582
+ case "hubspot":
3583
+ return "{% endif %}";
3584
+ case "mailchimp":
3585
+ return "*|END:IF|*";
3586
+ case "sfmc":
3587
+ return "%%[ ENDIF ]%%";
3588
+ case "activecampaign":
3589
+ return "%/IF%";
3590
+ case "marketo":
3591
+ return "#end";
3592
+ case "campaign_monitor":
3593
+ return "</singleline>";
3594
+ case "pardot":
3595
+ return "%%endif%%";
3596
+ case "mso":
3597
+ return "<![endif]-->";
3598
+ default:
3599
+ return "{{/if}}";
3600
+ }
3601
+ }, Tt = (e) => `__esp_ts_${e.replace(/[^a-zA-Z0-9]/g, "_")}`, At = (e, t) => `__esp_cmp_${e.replace(/[^a-zA-Z0-9]/g, "_")}_${t.replace(/[^a-zA-Z0-9]/g, "_")}`, ga = (e) => {
3602
+ const t = /* @__PURE__ */ new Set(), r = [];
3603
+ for (const n of e) {
3604
+ const a = n.operator;
3605
+ if (a !== "date_before" && a !== "date_after") continue;
3606
+ const i = Tt(n.tag), o = At(n.tag, n.value);
3607
+ t.has(i) || (t.add(i), r.push(`{%- assign ${i} = ${De(n.tag)} | date: '%s' -%}`)), t.has(o) || (t.add(o), r.push(`{%- assign ${o} = '${n.value}' | date: '%s' -%}`));
3608
+ }
3609
+ return r;
3610
+ }, ha = (e) => e === "liquid" || e === "klaviyo" || e === "braze" || e === "hubspot", va = (e, t) => {
3611
+ const r = (o, c) => o.length === 0 ? c : [...o].reverse().reduce((l, d) => `*|IF:${d}|*
3612
+ ${l}
3613
+ *|END:IF|*`, c), n = (o, c) => o.length === 0 ? c : o.map((l) => `*|IF:${l}|*
3614
+ ${c}
3615
+ *|END:IF|*`).join(`
3616
+ `), a = (o, c, l) => {
3617
+ const d = o.map((v) => we(v, "mailchimp")).filter((v) => v !== null);
3618
+ return d.length === 0 ? null : c === "all" ? r(d, l) : n(d, l);
3619
+ }, i = (t.rules ?? []).map((o) => we(o, "mailchimp")).filter((o) => o !== null);
3620
+ if (t.match === "all") {
3621
+ let o = e;
3622
+ for (const c of [...t.groups ?? []].reverse()) {
3623
+ const l = c.rules.map((d) => we(d, "mailchimp")).filter((d) => d !== null);
3624
+ l.length !== 0 && (o = c.match === "all" ? r(l, o) : n(l, o));
3625
+ }
3626
+ return i.length > 0 ? r(i, o) : o;
3627
+ } else {
3628
+ const o = [...i.map((c) => `*|IF:${c}|*
3629
+ ${e}
3630
+ *|END:IF|*`), ...(t.groups ?? []).map((c) => a(c.rules, c.match, e)).filter((c) => c !== null)];
3631
+ return o.length > 0 ? o.join(`
3632
+ `) : e;
3633
+ }
3634
+ }, Hn = (e, t) => {
3635
+ const r = pa(t, ma), n = (e.rules ?? []).map((o) => we(o, t)).filter((o) => o !== null);
3636
+ let a;
3637
+ r.supportsNesting ? a = (e.groups ?? []).map((o) => {
3638
+ const c = o.rules.map((d) => we(d, t)).filter((d) => d !== null);
3639
+ if (c.length === 0) return null;
3640
+ const l = ln(c, o.match, t);
3641
+ return c.length > 1 ? `(${l})` : l;
3642
+ }).filter((o) => o !== null) : a = (e.groups ?? []).flatMap((o) => o.rules).map((o) => we(o, t)).filter((o) => o !== null);
3643
+ const i = [...n, ...a];
3644
+ return i.length === 0 ? null : {
3645
+ expression: ln(i, e.match, t),
3646
+ preludes: ha(t) ? ga([...e.rules ?? [], ...(e.groups ?? []).flatMap((o) => o.rules)]) : []
3647
+ };
3648
+ }, fe = (e, t, r = "handlebars") => {
3649
+ if (!t?.enabled) return e;
3650
+ const n = (t.rules?.length ?? 0) > 0, a = (t.groups?.length ?? 0) > 0;
3651
+ if (!n && !a) return e;
3652
+ if (r === "mailchimp") return va(e, t);
3653
+ const i = Hn(t, r);
3654
+ if (!i) return e;
3655
+ const { expression: o, preludes: c } = i, l = Dn(o, r), d = Fn(r);
3656
+ return `${c.length > 0 ? `${c.join(`
3657
+ `)}
3658
+ ` : ""}${l}
3659
+ ${e}
3660
+ ${d}`;
3661
+ }, co = (e, t = "handlebars") => {
3662
+ if (!e?.enabled) return null;
3663
+ const r = (e.rules?.length ?? 0) > 0, n = (e.groups?.length ?? 0) > 0;
3664
+ if (!r && !n) return null;
3665
+ if (t === "mailchimp") {
3666
+ const l = [...e.rules ?? [], ...(e.groups ?? []).flatMap((v) => v.rules)], d = l.map((v) => we(v, "mailchimp")).find((v) => v !== null);
3667
+ return d ? {
3668
+ openTag: `*|IF:${d}|*${l.length > 1 && e.match === "all" ? " …nested…" : ""}`,
3669
+ closeTag: "*|END:IF|*"
3670
+ } : null;
3671
+ }
3672
+ const a = Hn(e, t);
3673
+ if (!a) return null;
3674
+ const { expression: i, preludes: o } = a, c = Dn(i, t);
3675
+ return {
3676
+ openTag: `${o.length > 0 ? `${o.join(`
3677
+ `)}
3678
+ ` : ""}${c}`,
3679
+ closeTag: Fn(t)
3680
+ };
3681
+ }, Un = (e) => {
3682
+ const t = De(e.tag), r = String(e.value ?? "");
3683
+ switch (e.operator) {
3684
+ case "==":
3685
+ return `String(${t}).toLowerCase() === ${JSON.stringify(r.toLowerCase())}`;
3686
+ case "!=":
3687
+ return `String(${t}).toLowerCase() !== ${JSON.stringify(r.toLowerCase())}`;
3688
+ case "contains":
3689
+ return `String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3690
+ case "not_contains":
3691
+ return `!String(${t}).toLowerCase().includes(${JSON.stringify(r.toLowerCase())})`;
3692
+ case "starts_with":
3693
+ return `String(${t}).toLowerCase().startsWith(${JSON.stringify(r.toLowerCase())})`;
3694
+ case "ends_with":
3695
+ return `String(${t}).toLowerCase().endsWith(${JSON.stringify(r.toLowerCase())})`;
3696
+ case "in": {
3697
+ const n = r.split(/[,\n;]+/).map((a) => a.trim().toLowerCase()).filter(Boolean);
3698
+ return `${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3699
+ }
3700
+ case "not_in": {
3701
+ const n = r.split(/[,\n;]+/).map((a) => a.trim().toLowerCase()).filter(Boolean);
3702
+ return `!${JSON.stringify(n)}.includes(String(${t}).toLowerCase())`;
3703
+ }
3704
+ case ">":
3705
+ return `Number(${t}) > ${Number(r)}`;
3706
+ case "<":
3707
+ return `Number(${t}) < ${Number(r)}`;
3708
+ case ">=":
3709
+ return `Number(${t}) >= ${Number(r)}`;
3710
+ case "<=":
3711
+ return `Number(${t}) <= ${Number(r)}`;
3712
+ case "date_before":
3713
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) < new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3714
+ case "date_after":
3715
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) > new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3716
+ case "date_on":
3717
+ return `(${t} ? new Date(${t}).setHours(0,0,0,0) : NaN) === new Date(${JSON.stringify(r)}).setHours(0,0,0,0)`;
3718
+ case "is_empty":
3719
+ return `(!${t} || String(${t}).trim() === "")`;
3720
+ case "is_not_empty":
3721
+ return `(!!${t} && String(${t}).trim() !== "")`;
3722
+ default:
3723
+ return "true";
3724
+ }
3725
+ }, ba = (e) => {
3726
+ if (!e.rules.length) return null;
3727
+ const t = e.rules.map(Un);
3728
+ return t.length === 1 ? t[0] : `(${t.join(e.match === "any" ? " || " : " && ")})`;
3729
+ }, $a = (e) => {
3730
+ const t = (e.rules ?? []).map(Un), r = (e.groups ?? []).map(ba).filter((i) => i !== null), n = [...t, ...r];
3731
+ if (n.length === 0) return null;
3732
+ if (n.length === 1) return n[0];
3733
+ const a = e.match === "any" ? " || " : " && ";
3734
+ return `(${n.join(a)})`;
3735
+ }, Qe = (e, t) => {
3736
+ if (!t?.enabled) return e;
3737
+ const r = (t.rules?.length ?? 0) > 0, n = (t.groups?.length ?? 0) > 0;
3738
+ if (!r && !n) return e;
3739
+ const a = $a(t);
3740
+ return a ? `{${a} && (
3741
+ ${e.split(`
3742
+ `).map((i) => ` ${i}`).join(`
3743
+ `)}
3744
+ )}` : e;
3745
+ }, xe = ({ content: e, filename: t, mimeType: r }) => {
3746
+ const n = new Blob([e], { type: r }), a = URL.createObjectURL(n), i = document.createElement("a");
3747
+ i.href = a, i.download = t, i.click(), URL.revokeObjectURL(a);
3748
+ }, dt = (e) => e.toLowerCase().replace(/\s+/g, "-"), Re = (e, t) => `${e}${t === "wrap" ? "-master" : "-snapshot"}`, ya = /(<style[\s>][\s\S]*?<\/style>|<script[\s>][\s\S]*?<\/script>|<!--[\s\S]*?-->)/gi;
3749
+ function Jn(e) {
3750
+ const t = e.split(ya), r = [];
3751
+ return t.forEach((n, a) => {
3752
+ if (a % 2 === 1) {
3753
+ let i = n.replace(/^[ \t]+|[ \t]+$/gm, "");
3754
+ i = i.replace(/\n{2,}/g, `
3755
+ `), r.push(i);
3756
+ } else {
3757
+ let i = n.replace(/>\s+</g, "><");
3758
+ i = i.replace(/[ \t]{2,}/g, " "), i = i.replace(/\n+/g, ""), r.push(i);
3759
+ }
3760
+ }), r.join("");
3761
+ }
3762
+ function Sa(e) {
3763
+ return e && Jn(e);
3764
+ }
3765
+ function ka(e) {
3766
+ return e && Jn(e);
3767
+ }
3768
+ function wa(e) {
3769
+ if (!e) return e;
3770
+ let t = e.replace(/^[ \t]+|[ \t]+$/gm, "");
3771
+ return t = t.replace(/\n{3,}/g, `
3772
+
3773
+ `), t.trim();
3774
+ }
3775
+ function Ee(e, t) {
3776
+ switch (e) {
3777
+ case "html":
3778
+ return Sa(t);
3779
+ case "mjml":
3780
+ return ka(t);
3781
+ case "react-email":
3782
+ return wa(t);
3783
+ default:
3784
+ return t;
3785
+ }
3786
+ }
3787
+ var Gn = "maildeno:export:minify", rt = P(xa());
3788
+ function xa() {
3789
+ if (typeof window > "u") return !1;
3790
+ try {
3791
+ return localStorage.getItem(Gn) === "true";
3792
+ } catch {
3793
+ return !1;
3794
+ }
3795
+ }
3796
+ un(rt, (e) => {
3797
+ if (!(typeof window > "u"))
3798
+ try {
3799
+ localStorage.setItem(Gn, String(e));
3800
+ } catch {
3801
+ }
3802
+ });
3803
+ function Ut() {
3804
+ return {
3805
+ minifyOutput: rt,
3806
+ toggleMinify: () => {
3807
+ rt.value = !rt.value;
3808
+ }
3809
+ };
3810
+ }
3811
+ var Ca = 5, _a = (e) => {
3812
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: c, collectFonts: l, collectMobileCSS: d, buildMobileStyleBlock: v } = e, { evaluateVisibility: k } = ct(), E = (s) => s.type === "component" ? s.props?.visibility : s.visibility, w = (s) => {
3813
+ if (!s?.enabled) return !1;
3814
+ const y = (s.rules?.length ?? 0) > 0, C = (s.groups?.length ?? 0) > 0;
3815
+ return y || C;
3816
+ }, R = (s, y, C, _) => {
3817
+ let f = "";
3818
+ for (const p of s) {
3819
+ if (C === "prune" && !k(E(p), y)) continue;
3820
+ const g = p.type;
3821
+ if (g === "row") {
3822
+ if (_ >= Ca) continue;
3823
+ const b = I(p, y, C, _ + 1);
3824
+ b.trim() && (f += `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">${b}</table>`);
3825
+ continue;
3826
+ }
3827
+ if (g === "row-spacer") {
3828
+ if (!p.height || p.height <= 0) continue;
3829
+ const b = se(p);
3830
+ let S = `<div height="${p.height}" style="height:${p.height}px;line-height:${p.height}px;font-size:1px;mso-line-height-rule:exactly;${b.join(";")}">&nbsp;</div>`;
3831
+ C === "wrap" && w(p.visibility) && (S = fe(S, p.visibility, a.value)), f += S;
3832
+ continue;
3833
+ }
3834
+ let x = zn(n.html(p), C, o?.value);
3835
+ const $ = p.props?.visibility;
3836
+ C === "wrap" && w($) && (x = fe(x, $, a.value)), f += x;
3837
+ }
3838
+ return f;
3839
+ }, I = (s, y, C, _ = 0) => {
3840
+ if (s.type === "row-spacer") {
3841
+ if (!s.height || s.height <= 0) return "";
3842
+ const M = se(s);
3843
+ let L = `
3844
+ <tr>
3845
+ <td>
3846
+ <div height="${s.height}" style="height:${s.height}px;line-height:${s.height}px;font-size:1px;mso-line-height-rule:exactly;${M.join(";")}">&nbsp;
3847
+ </div>
3848
+ </td>
3849
+ </tr>
3850
+ `;
3851
+ return C === "wrap" && w(s.visibility) && (L = fe(L, s.visibility, a.value)), L;
3852
+ }
3853
+ const f = se(s), p = r.value.mobileBreakpoint || 600, g = (s.gap || 0) / p * 100, x = 100 - g * (s.columns.length - 1), $ = [];
3854
+ let b = 0;
3855
+ s.columns.forEach((M) => {
3856
+ const L = M.width / 100 * x;
3857
+ $.push(L), b += L;
3858
+ });
3859
+ const S = x - b;
3860
+ Math.abs(S) > 0.01 && $.length > 0 && ($[$.length - 1] += S);
3861
+ let A = "";
3862
+ s.columns.forEach((M, L) => {
3863
+ if (C === "prune" && !k(M.props?.visibility, y)) return;
3864
+ const V = $[L], q = s.mobileStack ? "mobile-stack" : "", W = se(M), X = [
3865
+ `width:${V}%`,
3866
+ `max-width:${V}%`,
3867
+ `vertical-align:${M.verticalAlign ?? "middle"}`,
3868
+ "box-sizing:border-box",
3869
+ ...W,
3870
+ `border:${M.border.width}px ${M.border.style} ${M.border.color}`,
3871
+ `border-radius:${M.border.radius}px`,
3872
+ "overflow:hidden",
3873
+ "line-height:0",
3874
+ "font-size:0",
3875
+ `padding:${M.padding?.top ?? 0}px ${M.padding?.right ?? 0}px ${M.padding?.bottom ?? 0}px ${M.padding?.left ?? 0}px`
3876
+ ], oe = M.children ?? M.components ?? [], le = R(oe, y, C, _);
3877
+ A += `
3878
+ <td valign="${M.verticalAlign ?? "middle"}"${q ? ` class="${q}"` : ""} style="${X.join(";")}">
3879
+ ${le}
3880
+ </td>
3881
+ `, L < s.columns.length - 1 && s.gap && (A += `
3882
+ <td
3883
+ class="${q ? `gap-${s.gap} ${q}` : `gap-${s.gap}`}"
3884
+ width="${g}%"
3885
+ style="width:${g}%;max-width:${g}%;font-size:0;line-height:0;padding:0;">
3886
+ &nbsp;
3887
+ </td>
3888
+ `);
3889
+ });
3890
+ const m = s.columns.some((M) => (M.border?.radius ?? 0) > 0);
3891
+ let B = `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(s.gap ?? 0) > 0 || m ? "separate" : "collapse"};">
3892
+ <tr>
3893
+ ${A}
3894
+ </tr>
3895
+ </table>`;
3896
+ const z = (s.border?.radius ?? 0) > 0, N = [
3897
+ ...f,
3898
+ z ? `border-radius:${s.border.radius + 2}px` : "",
3899
+ "overflow:hidden"
3900
+ ].filter(Boolean);
3901
+ let F = Nn(B, s.border, [], s.padding);
3902
+ return C === "wrap" && w(s.visibility) && (F = fe(F, s.visibility, a.value)), (s.minHeight ?? 0) > 0 && N.push(`min-height:${s.minHeight}px`), `
3903
+ <tr>
3904
+ <td${N.length ? ` style="${N.join(";")}"` : ""}>
3905
+ ${F}
3906
+ </td>
3907
+ </tr>
3908
+ `;
3909
+ }, O = (s, y) => {
3910
+ const { getGoogleFontImports: C } = ut(), { emailMobileStyles: _ } = Pt(), f = i?.value ?? {}, p = C([...l(s, f)]), g = d(s, f, _), x = v(r.value.mobileBreakpoint, g), $ = [
3911
+ "margin:0",
3912
+ "padding:0",
3913
+ r.value.bodyBackgroundColor ? `background-color:${r.value.bodyBackgroundColor}` : "",
3914
+ r.value.bodyBackgroundImage ? [
3915
+ `background-image:url('${r.value.bodyBackgroundImage}')`,
3916
+ `background-size:${r.value.bodyBackgroundSize}`,
3917
+ `background-position:${r.value.bodyBackgroundPosition}`,
3918
+ `background-repeat:${r.value.bodyBackgroundRepeat}`,
3919
+ "min-height:auto"
3920
+ ].join(";") : ""
3921
+ ].filter(Boolean).join(";");
3922
+ let b = `<!DOCTYPE html>
3923
+ <html lang="${r.value.language}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
3924
+ <head>
3925
+ <meta charset="UTF-8">
3926
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
3927
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
3928
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
3929
+ <meta name="x-apple-disable-message-reformatting">
3930
+ <meta name="color-scheme" content="light dark">
3931
+ <meta name="supported-color-schemes" content="light dark">
3932
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
3933
+ <title>${y}</title>
3934
+ <!--[if mso]>
3935
+ <xml>
3936
+ <o:OfficeDocumentSettings>
3937
+ <o:PixelsPerInch>96</o:PixelsPerInch>
3938
+ <o:AllowPNG/>
3939
+ </o:OfficeDocumentSettings>
3940
+ </xml>
3941
+ <![endif]-->
3942
+ ${p ? `<link href="${p}" rel="stylesheet">` : ""}
3943
+ <style>
3944
+ ${x}
3945
+ </style>
3946
+ </head>
3947
+
3948
+ <body style="${$};">
3949
+ <div style="display:none;font-size:1px;color:#fefefe;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">
3950
+ ${r.value.preheaderText} &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp; &#847; &zwnj; &nbsp;
3951
+ </div>
3952
+ <table width="100%" cellpadding="0" cellspacing="0">
3953
+ <tr>
3954
+ <td style="padding:${r.value.padding?.top ?? 0}px ${r.value.padding?.right ?? 0}px ${r.value.padding?.bottom ?? 0}px ${r.value.padding?.left ?? 0}px;">
3955
+
3956
+ <table
3957
+ width="100%"
3958
+ align="center"
3959
+ cellpadding="0"
3960
+ cellspacing="0"
3961
+ class="email-container"
3962
+ style="width:100%;max-width:${r.value.width}px;background:${r.value.backgroundColor};border-collapse:collapse;"
3963
+ >
3964
+ `;
3965
+ return t.value.forEach((S) => {
3966
+ if (s === "prune" && !k(S.visibility, f)) return;
3967
+ const A = I(S, f, s, 0);
3968
+ A.trim() && (b += A);
3969
+ }), b += `
3970
+ </table>
3971
+ </td>
3972
+ </tr>
3973
+ </table>
3974
+ </body>
3975
+ </html>
3976
+ `, b = jn(b, s, a.value, o?.value), b;
3977
+ };
3978
+ return {
3979
+ export: async (s = "prune", y) => {
3980
+ if (!c("Export")) return;
3981
+ const C = y || "Untitled Template", _ = O(s, C), f = dt(C), { minifyOutput: p } = Ut();
3982
+ if (p.value) xe({
3983
+ content: Ee("html", _),
3984
+ filename: `${Re(f, s)}.html`,
3985
+ mimeType: "text/html"
3986
+ });
3987
+ else {
3988
+ const g = await Qr(_);
3989
+ xe({
3990
+ content: g,
3991
+ filename: `${Re(f, s)}.html`,
3992
+ mimeType: "text/html"
3993
+ });
3994
+ }
3995
+ },
3996
+ getHTML: (s = "prune", y) => {
3997
+ if (!t.value || t.value.length === 0) return null;
3998
+ const C = O(s, y || "Untitled Template");
3999
+ return Ee("html", C);
4000
+ }
4001
+ };
4002
+ }, Ta = 5, Aa = (e) => {
4003
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: c, collectFonts: l, collectMobileCSS: d, buildMobileStyleBlock: v } = e, { evaluateVisibility: k } = ct(), E = (h) => {
4004
+ if (!h?.enabled) return !1;
4005
+ const s = (h.rules?.length ?? 0) > 0, y = (h.groups?.length ?? 0) > 0;
4006
+ return s || y;
4007
+ }, w = (h, s, y, C, _) => {
4008
+ let f = "";
4009
+ for (const p of h) {
4010
+ const g = p.type === "component" ? p.props?.visibility : p.visibility;
4011
+ if (y === "prune" && !k(g, s)) continue;
4012
+ const x = p.type;
4013
+ if (x === "row") {
4014
+ if (_ >= Ta) continue;
4015
+ const b = R(p, s, y, _ + 1);
4016
+ b.trim() && (f += ` ${b.trim()}
4017
+ `);
4018
+ continue;
4019
+ }
4020
+ if (x === "row-spacer") {
4021
+ if (!p.height || p.height <= 0) continue;
4022
+ const b = Ye(p), S = Object.keys(b).length > 0 ? `, ${Object.entries(b).map(([m, B]) => `${m}:"${B}"`).join(", ")}` : "";
4023
+ let A = `<div style={{ display: "block", height: "${p.height}px", lineHeight: "${p.height}px", fontSize: "1px"${S} }}>&nbsp;</div>`;
4024
+ y === "wrap" && E(p.visibility) && (A = Qe(A, p.visibility)), f += ` ${A}
4025
+ `;
4026
+ continue;
4027
+ }
4028
+ let $ = zn(n.react(p), y, o?.value);
4029
+ y === "wrap" && E(p.props?.visibility) && ($ = Qe($, p.props.visibility)), f += ` ${$.trim()}
4030
+ `;
4031
+ }
4032
+ return f;
4033
+ }, R = (h, s, y, C = 0) => {
4034
+ if (y === "prune" && !k(h.visibility, s)) return "";
4035
+ if (h.type === "row-spacer") {
4036
+ if (!h.height || h.height <= 0) return "";
4037
+ const M = Ye(h), L = Object.keys(M).length > 0 ? `, ${Object.entries(M).map(([q, W]) => `${q}:"${W}"`).join(", ")}` : "";
4038
+ let V = `
4039
+ {/* Row Spacer */}
4040
+ <Section>
4041
+ <div style={{ display: "block", height: "${h.height}px", lineHeight: "${h.height}px", fontSize: "1px"${L} }}>&nbsp;</div>
4042
+ </Section>`;
4043
+ return y === "wrap" && E(h.visibility) && (V = Qe(V, h.visibility)), V;
4044
+ }
4045
+ const _ = r.value.mobileBreakpoint || 600, f = (h.gap || 0) / _ * 100, p = 100 - f * (h.columns.length - 1), g = [];
4046
+ let x = 0;
4047
+ h.columns.forEach((M) => {
4048
+ const L = M.width / 100 * p;
4049
+ g.push(L), x += L;
4050
+ });
4051
+ const $ = p - x;
4052
+ Math.abs($) > 0.01 && g.length > 0 && (g[g.length - 1] += $);
4053
+ let b = "";
4054
+ h.columns.forEach((M, L) => {
4055
+ if (y === "prune" && !k(M.props?.visibility, s)) return;
4056
+ const V = g[L], q = h.mobileStack ? "mobile-stack" : "", W = Ye(M), X = {
4057
+ width: `${V}%`,
4058
+ boxSizing: "border-box",
4059
+ verticalAlign: M.verticalAlign ?? "middle",
4060
+ border: `${M.border?.width ?? 0}px ${M.border?.style ?? "solid"} ${M.border?.color ?? "transparent"}`,
4061
+ borderRadius: `${M.border?.radius ?? 0}px`,
4062
+ overflow: "hidden",
4063
+ lineHeight: "0",
4064
+ fontSize: "0",
4065
+ padding: `${M.padding?.top ?? 0}px ${M.padding?.right ?? 0}px ${M.padding?.bottom ?? 0}px ${M.padding?.left ?? 0}px`,
4066
+ ...W
4067
+ }, oe = Object.entries(X).map(([ie, Ne]) => `${ie}:"${Ne}"`).join(", "), le = M.children ?? M.components ?? [], ce = w(le, s, y, h, C);
4068
+ b += `<Column
4069
+ className="${q}"
4070
+ style={{ ${oe} }}
4071
+ >
4072
+ ${ce}
4073
+ </Column>
4074
+ `, L < h.columns.length - 1 && h.gap && (b += `<Column
4075
+ className="${q ? `gap-${h.gap} ${q}` : `gap-${h.gap}`}"
4076
+ style={{ width:"${f}%", maxWidth:"${f}%", fontSize:"0", lineHeight:"0" }}
4077
+ >&nbsp;</Column>
4078
+ `);
4079
+ });
4080
+ const S = Ye(h), A = (h.border?.radius ?? 0) > 0, m = {
4081
+ ...S,
4082
+ ...A ? { borderRadius: `${h.border.radius + 2}px` } : {},
4083
+ overflow: "hidden"
4084
+ }, B = Object.entries(m).filter(([M, L]) => L !== void 0 && L !== "").map(([M, L]) => `${M}:"${L}"`).join(", "), z = B ? ` style={{ ${B} }}` : "", N = `<Row>${b}</Row>`;
4085
+ let F = ` <Section${z}>
4086
+ ${Yr(N, h.border, {}, h.padding, !0)}
4087
+ </Section>`;
4088
+ return y === "wrap" && E(h.visibility) && (F = Qe(F, h.visibility)), F;
4089
+ }, I = (h = "prune", s) => {
4090
+ const y = s || "Untitled Template", C = y.replace(/[^a-zA-Z0-9 ]/g, "").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(""), { getGoogleFontImports: _ } = ut(), { emailMobileStyles: f } = Pt(), p = i?.value ?? {}, g = l(h, p), x = _([...g]), $ = d(h, p, f), b = v(r.value.mobileBreakpoint, $), S = t.value.map((N) => R(N, p, h, 0)).filter(Boolean).join(`
4091
+ `), A = x?.includes("fonts.googleapis.com"), m = x ? A ? ` {/* Google Fonts via <link> — all families in one request */}
4092
+ <link href="${x}" rel="stylesheet" />` : [...g].map((N) => ` <Font
4093
+ fontFamily="${lt(N)}"
4094
+ fallbackFontFamily="Arial"
4095
+ webFont={{ url: "${x}", format: "woff2" }}
4096
+ fontWeight={400}
4097
+ fontStyle="normal"
4098
+ />`).join(`
4099
+ `) : "";
4100
+ let B = `import React from "react";
4101
+ import {
4102
+ Preview,
4103
+ Body,
4104
+ Container,
4105
+ Button,
4106
+ Column,
4107
+ Font,
4108
+ Head,
4109
+ Heading,
4110
+ Hr,
4111
+ Html,
4112
+ Img,
4113
+ Link,
4114
+ Row,
4115
+ Section,
4116
+ Text,
4117
+ } from "@react-email/components";
4118
+
4119
+ ${x ? A ? "// Google Fonts loaded via <link> (email-safe fallback strategy)" : `// Custom web font${g.size > 1 ? "s" : ""} loaded via <Font> — one instance per family` : "// No custom fonts used"}
4120
+
4121
+ const styles = \`
4122
+ ${b}
4123
+ \`;
4124
+
4125
+ export default function ${C}() {
4126
+ return (
4127
+ <Html lang="${r.value.language}">
4128
+ <Head>
4129
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
4130
+ <meta name="x-apple-disable-message-reformatting" />
4131
+ <meta httpEquiv="Content-Type" content="text/html; charset=UTF-8" />
4132
+ <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
4133
+ <meta name="color-scheme" content="light dark" />
4134
+ <meta name="supported-color-schemes" content="light dark" />
4135
+ <meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no" />
4136
+ <title>${y}</title>
4137
+ <style>{styles}</style>
4138
+ ${m}
4139
+ </Head>
4140
+ <Preview>${r.value.preheaderText}</Preview>
4141
+ <Body style={{ margin:0, padding:0, backgroundColor:"${r.value.bodyBackgroundColor}" }}>
4142
+ <Container style={{
4143
+ margin: 0,
4144
+ padding: 0,
4145
+ maxWidth: "100%",
4146
+ ${r.value.bodyBackgroundImage ? `
4147
+ backgroundImage: "url('${r.value.bodyBackgroundImage}')",
4148
+ backgroundSize: "${r.value.bodyBackgroundSize}",
4149
+ backgroundPosition: "${r.value.bodyBackgroundPosition}",
4150
+ backgroundRepeat: "${r.value.bodyBackgroundRepeat}",
4151
+ ` : ""}
4152
+ }}>
4153
+ <Container
4154
+ className="email-container"
4155
+ style={{
4156
+ width:"100%",
4157
+ maxWidth:"${r.value.width}px",
4158
+ backgroundColor:"${r.value.backgroundColor}",
4159
+ padding:"${r.value.padding?.top ?? 0}px ${r.value.padding?.right ?? 0}px ${r.value.padding?.bottom ?? 0}px ${r.value.padding?.left ?? 0}px"
4160
+ }}
4161
+ >
4162
+ ${S}
4163
+ </Container>
4164
+ </Container>
4165
+ </Body>
4166
+ </Html>
4167
+ );
4168
+ }
4169
+ `;
4170
+ const z = o?.value?.mergeTagActive || o?.value?.linkTagActive;
4171
+ if (h === "wrap" || !z) {
4172
+ const N = la(B), F = new Set(N.map((W) => W.tagId)), M = ca(t.value).filter((W) => !F.has(W)), { propsInterface: L, propsDestructure: V } = sa(N), q = ua(M);
4173
+ (L || q) && (B = B.replace(/^(export default function (\w+))\(\)\s*\{/m, [
4174
+ L ? `${L}
4175
+
4176
+ ` : "",
4177
+ `$1(${V || ""}) {`,
4178
+ q ? `
4179
+ ${q}
4180
+ ` : ""
4181
+ ].join(""))), B = ia(B);
4182
+ }
4183
+ return B = xn(B), B;
4184
+ };
4185
+ return {
4186
+ export: async (h = "prune", s) => {
4187
+ if (!c("Export")) return;
4188
+ const y = s || "Untitled Template", C = I(h, y), _ = dt(y), { minifyOutput: f } = Ut();
4189
+ if (f.value) xe({
4190
+ content: Ee("react-email", C),
4191
+ filename: `${Re(_, h)}.tsx`,
4192
+ mimeType: "text/plain"
4193
+ });
4194
+ else {
4195
+ const p = await Zr(C);
4196
+ xe({
4197
+ content: p,
4198
+ filename: `${Re(_, h)}.tsx`,
4199
+ mimeType: "text/plain"
4200
+ });
4201
+ }
4202
+ },
4203
+ getReactEmail: (h = "prune", s) => {
4204
+ if (!t.value || t.value.length === 0) return null;
4205
+ const y = I(h, s || "Untitled Template");
4206
+ return Ee("react-email", y);
4207
+ }
4208
+ };
4209
+ }, Ra = 5, Ea = (e) => {
4210
+ const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: c, collectFonts: l, collectMobileCSS: d } = e, { evaluateVisibility: v } = ct(), k = (u) => {
4211
+ if (!u?.enabled) return !1;
4212
+ const h = (u.rules?.length ?? 0) > 0, s = (u.groups?.length ?? 0) > 0;
4213
+ return h || s;
4214
+ }, E = (u, h, s, y) => {
4215
+ let C = "";
4216
+ for (const _ of u) {
4217
+ const f = _.type === "component" ? _.props?.visibility : _.visibility;
4218
+ if (s === "prune" && !v(f, h)) continue;
4219
+ const p = _.type;
4220
+ if (p === "row") {
4221
+ if (y >= Ra) continue;
4222
+ const x = w(_, h, s, y + 1);
4223
+ if (x.trim()) {
4224
+ let $ = x;
4225
+ s === "wrap" && k(_.visibility) && ($ = fe($, _.visibility, a.value)), C += $;
4226
+ }
4227
+ continue;
4228
+ }
4229
+ if (p === "row-spacer") {
4230
+ if (!_.height || _.height <= 0) continue;
4231
+ const x = se(_);
4232
+ let $ = `<div height="${_.height}" style="height:${_.height}px;line-height:${_.height}px;font-size:1px;mso-line-height-rule:exactly;${x.join(";")}">&nbsp;</div>`;
4233
+ s === "wrap" && k(_.visibility) && ($ = fe($, _.visibility, a.value)), C += $;
4234
+ continue;
4235
+ }
4236
+ let g = `<div style="font-family:none;font-size:0;line-height:0;text-align:left;color:#000000;">${n.mjml(_).replace(/^<mj-text[^>]*>/i, "").replace(/<\/mj-text>\s*$/i, "")}</div>`;
4237
+ s === "wrap" && k(_.props?.visibility) && (g = fe(g, _.props.visibility, a.value)), C += g;
4238
+ }
4239
+ return C;
4240
+ }, w = (u, h, s, y) => {
4241
+ if (!u.columns?.length) return "";
4242
+ const C = se(u), _ = r.value.mobileBreakpoint || 600, f = u.gap || 0, p = f / _ * 100, g = 100 - p * (u.columns.length - 1), x = [];
4243
+ let $ = 0;
4244
+ u.columns.forEach((N) => {
4245
+ const F = N.width / 100 * g;
4246
+ x.push(F), $ += F;
4247
+ });
4248
+ const b = g - $;
4249
+ Math.abs(b) > 0.01 && x.length > 0 && (x[x.length - 1] += b);
4250
+ let S = "";
4251
+ u.columns.forEach((N, F) => {
4252
+ if (s === "prune" && !v(N.props?.visibility, h)) return;
4253
+ const M = x[F], L = u.mobileStack ? "mobile-stack" : "", V = se(N), q = [
4254
+ `width:${M}%`,
4255
+ "box-sizing:border-box",
4256
+ `vertical-align:${N.verticalAlign ?? "middle"}`,
4257
+ `border:${N.border.width}px ${N.border.style} ${N.border.color}`,
4258
+ `border-radius:${N.border.radius}px`,
4259
+ "overflow:hidden",
4260
+ ...V
4261
+ ], W = N.children ?? N.components ?? [], X = E(W, h, s, y), oe = Nn(X, N.border, [], N.padding), le = L ? ` class="${L}"` : "";
4262
+ if (S += `<td valign="${N.verticalAlign ?? "middle"}"${le} style="${q.join(";")}">
4263
+ ${oe}
4264
+ </td>
4265
+ `, F < u.columns.length - 1 && f > 0) {
4266
+ const ce = L ? `gap-${f} ${L}` : `gap-${f}`;
4267
+ S += `<td class="${ce}" width="${p}%" style="width:${p}%;max-width:${p}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4268
+ `;
4269
+ }
4270
+ });
4271
+ const A = (u.border?.width ?? 0) > 0 ? `border:${u.border.width}px ${u.border.style} ${u.border.color};${u.border?.radius ?? 0}` : `border-radius:${u.border.radius}px;overflow:hidden;`, m = u.padding ? `${u.padding.top ?? 0}px ${u.padding.right ?? 0}px ${u.padding.bottom ?? 0}px ${u.padding.left ?? 0}px` : "0px", B = C.length ? `${C.join(";")};` : "", z = u.columns.some((N) => (N.border?.radius ?? 0) > 0);
4272
+ return `<div style="padding:${m};${A}${B}">
4273
+ <table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(u.gap ?? 0) > 0 || z ? "separate" : "collapse"};">
4274
+ <tr>
4275
+ ${S}</tr>
4276
+ </table>
4277
+ </div>`;
4278
+ }, R = (u = "prune", h) => {
4279
+ const s = h || "Untitled Template", { getGoogleFontImports: y } = ut(), { emailMobileStyles: C } = Pt(), { assembleMJML: _ } = Tn(), f = i?.value ?? {}, p = y([...l(u, f)]), g = d(u, f, C), x = In(t.value), $ = [
4280
+ ".email-container { max-width:100% !important; width:100% !important; }",
4281
+ ".desktop-hide { display:block !important; }",
4282
+ ".mobile-hide { display:none !important; }",
4283
+ ".mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }",
4284
+ ...x ? [x] : []
4285
+ ].join(`
4286
+
4287
+ `), b = g.length > 0 ? [
4288
+ $,
4289
+ "/* Mobile property overrides */",
4290
+ ...g
4291
+ ].join(`
4292
+ `) : $, S = [];
4293
+ t.value.forEach((m) => {
4294
+ if (u === "prune" && !v(m.visibility, f)) return;
4295
+ if (m.type === "row-spacer") {
4296
+ if (!m.height || m.height <= 0) return;
4297
+ const H = se(m);
4298
+ let D = ` <mj-raw>
4299
+ <table width="100%" cellpadding="0" cellspacing="0">
4300
+ <tr>
4301
+ <td>
4302
+ <div height="${m.height}" style="height:${m.height}px;line-height:${m.height}px;font-size:1px;mso-line-height-rule:exactly;${H.join(";")}">&nbsp;</div>
4303
+ </td>
4304
+ </tr>
4305
+ </table>
4306
+ </mj-raw>`;
4307
+ u === "wrap" && k(m.visibility) && (D = fe(D, m.visibility, a.value)), S.push(D);
4308
+ return;
4309
+ }
4310
+ const B = r.value.mobileBreakpoint || 600, z = m.gap || 0, N = z / B * 100, F = 100 - N * (m.columns.length - 1), M = [];
4311
+ let L = 0;
4312
+ m.columns.forEach((H) => {
4313
+ const D = H.width / 100 * F;
4314
+ M.push(D), L += D;
4315
+ });
4316
+ const V = F - L;
4317
+ Math.abs(V) > 0.01 && M.length > 0 && (M[M.length - 1] += V);
4318
+ const q = se(m), W = (() => {
4319
+ const H = m.backgroundGradient;
4320
+ return H?.useGradient === !0 && Array.isArray(H?.gradient?.colors) && H.gradient.colors.length >= 2 ? H.solid || m.backgroundColor || "" : m.backgroundColor || "";
4321
+ })(), X = W && W !== "transparent" ? W : "", oe = m.padding ? `${m.padding.top ?? 0}px ${m.padding.right ?? 0}px ${m.padding.bottom ?? 0}px ${m.padding.left ?? 0}px` : "0px", le = (m.border?.radius ?? 0) > 0, ce = (m.border?.width ?? 0) > 0 && (m.border?.radius ?? 0) === 0, ie = [...q, "overflow:hidden"];
4322
+ ce && (ie.push(`border:${m.border.width}px ${m.border.style} ${m.border.color}`), ie.push(`padding:${oe}`)), le && ie.push(`border-radius:${m.border.radius + 2}px`), (m.minHeight ?? 0) > 0 && ie.push(`min-height:${m.minHeight}px`);
4323
+ const Ne = ie.length ? ` style="${ie.join(";")}"` : "";
4324
+ let Be = "";
4325
+ (m.border?.width ?? 0) > 0 && (Be = `border:${m.border.width}px ${m.border.style} ${m.border.color};`, (m.border?.radius ?? 0) > 0 && (Be += `border-radius:${m.border.radius}px;overflow:hidden;`));
4326
+ const He = [
4327
+ `padding:${oe}`,
4328
+ "font-size:0",
4329
+ "line-height:0",
4330
+ Be
4331
+ ].filter(Boolean).join(";");
4332
+ let U = "";
4333
+ m.columns.forEach((H, D) => {
4334
+ if (u === "prune" && !v(H.props?.visibility, f)) return;
4335
+ const Z = M[D], Ce = m.mobileStack ? "mobile-stack" : "", pt = se(H), mt = [
4336
+ `width:${Z}%`,
4337
+ "box-sizing:border-box",
4338
+ `vertical-align:${H.verticalAlign ?? "middle"}`,
4339
+ ...pt,
4340
+ `border:${H.border?.width ?? 0}px ${H.border?.style ?? "solid"} ${H.border?.color ?? "transparent"}`,
4341
+ `border-radius:${H.border?.radius ?? 0}px`,
4342
+ "overflow:hidden",
4343
+ "line-height:0",
4344
+ "font-size:0",
4345
+ `padding:${H.padding?.top ?? 0}px ${H.padding?.right ?? 0}px ${H.padding?.bottom ?? 0}px ${H.padding?.left ?? 0}px`
4346
+ ], Ue = H.children ?? H.components ?? [], ft = E(Ue, f, u, 0), gt = Ce ? ` class="${Ce}"` : "";
4347
+ if (U += `<td valign="${H.verticalAlign ?? "middle"}"${gt} style="${mt.join(";")}">
4348
+ ${ft}
4349
+ </td>
4350
+ `, D < m.columns.length - 1 && z > 0) {
4351
+ const ee = Ce ? `gap-${z} ${Ce}` : `gap-${z}`;
4352
+ U += `<td class="${ee}" width="${N}%" style="width:${N}%;max-width:${N}%;font-size:0;line-height:0;padding:0;">&nbsp;</td>
4353
+ `;
4354
+ }
4355
+ });
4356
+ const Y = m.columns.some((H) => (H.border?.radius ?? 0) > 0);
4357
+ let be = `<div style="${He}">${`<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(m.gap ?? 0) > 0 || Y ? "separate" : "collapse"};">
4358
+ <tr>
4359
+ ${U}</tr>
4360
+ </table>`}</div>`;
4361
+ u === "wrap" && k(m.visibility) && (be = fe(be, m.visibility, a.value));
4362
+ const ge = r.value.width ?? 600;
4363
+ S.push(` <mj-raw>
4364
+ <!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:${ge}px;" width="${ge}"${X ? ` bgcolor="${X}"` : ""}><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
4365
+ <div style="margin:0px auto;max-width:${ge}px;">
4366
+ <table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
4367
+ <tbody>
4368
+ <tr>
4369
+ <td${Ne}>
4370
+ ${be}
4371
+ </td>
4372
+ </tr>
4373
+ </tbody>
4374
+ </table>
4375
+ </div>
4376
+ <!--[if mso | IE]></td></tr></table><![endif]-->
4377
+ </mj-raw>`);
4378
+ });
4379
+ let A = _(s, S.join(`
4380
+ `), r.value, p, b, r.value.mobileBreakpoint ?? 600, "");
4381
+ return A = jn(A, u, a.value, o?.value, !0), A;
4382
+ };
4383
+ return {
4384
+ export: async (u = "prune", h) => {
4385
+ if (!c("Export")) return;
4386
+ const s = h || "Untitled Template", y = R(u, s), C = dt(s), { minifyOutput: _ } = Ut();
4387
+ if (_.value) xe({
4388
+ content: Ee("mjml", y),
4389
+ filename: `${Re(C, u)}.mjml`,
4390
+ mimeType: "text/plain"
4391
+ });
4392
+ else {
4393
+ const f = await ea(y);
4394
+ xe({
4395
+ content: f,
4396
+ filename: `${Re(C, u)}.mjml`,
4397
+ mimeType: "text/plain"
4398
+ });
4399
+ }
4400
+ },
4401
+ getMJML: (u = "prune", h) => {
4402
+ if (!t.value || t.value.length === 0) return null;
4403
+ const s = R(u, h || "Untitled Template");
4404
+ return Ee("mjml", s);
4405
+ }
4406
+ };
4407
+ }, Ma = (e) => {
4408
+ const { rows: t, canvasStyles: r, saveToHistoryFn: n, guardEmpty: a } = e, i = e.notify ?? ((v, k = "Import failed") => console.error(`[maildeno-editor] ${k}: ${v}`)), o = (v) => {
4409
+ const k = v || "Untitled Template";
4410
+ return {
4411
+ template_id: tt(k),
4412
+ template_name: k,
4413
+ canvas: Sn(JSON.parse(JSON.stringify(r.value))),
4414
+ rows: kn(JSON.parse(JSON.stringify(t.value))),
4415
+ schema_version: "1.0"
4416
+ };
4417
+ };
4418
+ return {
4419
+ export: (v) => {
4420
+ if (!a("Export")) return;
4421
+ const k = o(v);
4422
+ xe({
4423
+ content: JSON.stringify(k, null, 2),
4424
+ filename: `${dt(k.template_name)}.json`,
4425
+ mimeType: "application/json"
4426
+ });
4427
+ },
4428
+ import: (v, k) => {
4429
+ const E = new FileReader();
4430
+ E.onload = (w) => {
4431
+ try {
4432
+ let R = JSON.parse(w.target?.result);
4433
+ R = dn(R), R.canvas && R.rows ? (r.value = at(R.canvas), t.value = ot(R.rows), k.value = null, n("import")) : i("That file isn't a Maildeno template. Export one from the editor (Export → JSON) and try again.", "Invalid template file");
4434
+ } catch (R) {
4435
+ i(R.message, "Couldn't load template");
4436
+ }
4437
+ }, E.readAsText(v);
4438
+ },
4439
+ getJSON: (v) => !t.value || t.value.length === 0 ? null : o(v)
4440
+ };
4441
+ }, Ia = 5, cn = /font-family\s*:\s*([^;<]+)/gi, Na = (e) => e.replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&apos;/g, "'"), Ba = (e) => {
4442
+ if (!e || typeof e != "string") return [];
4443
+ if (e.indexOf("font-family") === -1) return [];
4444
+ const t = Na(e), r = [];
4445
+ let n;
4446
+ for (cn.lastIndex = 0; (n = cn.exec(t)) !== null; ) {
4447
+ const a = n[1];
4448
+ if (!a) continue;
4449
+ let i = a;
4450
+ const o = i.trimStart()[0];
4451
+ if (o === '"' || o === "'") {
4452
+ const l = i.indexOf(o), d = i.indexOf(o, l + 1);
4453
+ if (d !== -1) {
4454
+ const v = i.slice(d + 1).search(/["<]/);
4455
+ i = v === -1 ? i : i.slice(0, d + 1 + v);
4456
+ }
4457
+ } else {
4458
+ const l = i.search(/["<]/);
4459
+ l !== -1 && (i = i.slice(0, l));
4460
+ }
4461
+ const c = (i.split(",")[0] ?? "").trim().replace(/^['"]|['"]$/g, "").trim();
4462
+ c && r.push(c);
4463
+ }
4464
+ return r;
4465
+ }, Oa = (e, t, r, n, a, i, o, c, l, d) => {
4466
+ let v, k, E, w;
4467
+ typeof r == "object" && !("value" in r) ? (v = r, k = n, E = a, w = i) : (v = {
4468
+ html: r,
4469
+ react: n,
4470
+ mjml: a
4471
+ }, k = i, E = o, w = c);
4472
+ const { evaluateVisibility: R } = ct(), { open: I } = d ?? Vr(), O = l ?? P({ syntax: "handlebars" }), u = (b, S, A, m, B = 0) => {
4473
+ if (!(B >= Ia))
4474
+ for (const z of b) {
4475
+ const N = z.type;
4476
+ if (N === "row") {
4477
+ if (S === "prune" && !R(z.visibility, A)) continue;
4478
+ for (const F of z.columns ?? []) {
4479
+ const M = F.children ?? F.components ?? [];
4480
+ u(M, S, A, m, B + 1);
4481
+ }
4482
+ continue;
4483
+ }
4484
+ N !== "row-spacer" && (S === "prune" && !R(z.props?.visibility, A) || m(z));
4485
+ }
4486
+ }, h = (b) => !e.value || e.value.length === 0 ? (I("Your template is empty. Please add at least one row before exporting.", b), !1) : !0, s = (b, S) => {
4487
+ const A = /* @__PURE__ */ new Set();
4488
+ return e.value.forEach((m) => {
4489
+ b === "prune" && !R(m.visibility, S) || m.columns && m.columns.forEach((B) => {
4490
+ const z = B.children ?? B.components ?? [];
4491
+ u(z, b, S, (N) => {
4492
+ if (N.props?.fontFamily && A.add(N.props.fontFamily), N.props?.mobile?.fontFamily && A.add(N.props.mobile.fontFamily), typeof N.props?.content == "string") {
4493
+ const F = Ba(N.props.content);
4494
+ for (const M of F) A.add(M);
4495
+ }
4496
+ });
4497
+ });
4498
+ }), A;
4499
+ }, y = (b, S, A) => {
4500
+ const m = [];
4501
+ return e.value.forEach((B) => {
4502
+ b === "prune" && !R(B.visibility, S) || B.columns && B.columns.forEach((z) => {
4503
+ const N = z.children ?? z.components ?? [];
4504
+ u(N, b, S, (F) => {
4505
+ const M = A(F, `eb-${F.id}`);
4506
+ M && m.push(M);
4507
+ });
4508
+ });
4509
+ }), m;
4510
+ }, C = (b, S) => {
4511
+ const A = In(e.value), m = S.length > 0 ? `
4512
+
4513
+ /* Mobile property overrides */
4514
+ ${S.join(`
4515
+
4516
+ `)}` : "";
4517
+ return `
4518
+ .desktop-hide { display: none !important; }
4519
+ ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
4520
+ @media only screen and (max-width:${b}px) {
4521
+ ${`
4522
+ .email-container { max-width:100% !important; width:100% !important; }
4523
+
4524
+ .desktop-hide { display:block !important; }
4525
+
4526
+ .mobile-hide { display:none !important; }
4527
+
4528
+ .mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }
4529
+ ${A ? `
4530
+ ${A}` : ""}${m}
4531
+ `}
4532
+ }`;
4533
+ }, _ = Se(() => O.value.syntax), f = {
4534
+ rows: e,
4535
+ canvasStyles: t,
4536
+ generators: v,
4537
+ espSyntax: _,
4538
+ visibilityContext: E,
4539
+ tagSubstitution: w,
4540
+ guardEmpty: h,
4541
+ collectFonts: s,
4542
+ collectMobileCSS: y,
4543
+ buildMobileStyleBlock: C
4544
+ }, p = _a(f), g = Aa(f), x = Ea(f), $ = Ma({
4545
+ rows: e,
4546
+ canvasStyles: t,
4547
+ saveToHistoryFn: k,
4548
+ guardEmpty: h,
4549
+ notify: (b, S) => I(b, S ?? "Import failed")
4550
+ });
4551
+ return {
4552
+ exportHTML: p.export,
4553
+ getExportedHTML: p.getHTML,
4554
+ exportReactEmail: g.export,
4555
+ getExportedReactEmail: g.getReactEmail,
4556
+ exportMJML: x.export,
4557
+ getExportedMJML: x.getMJML,
4558
+ exportJSON: $.export,
4559
+ getExportedJSON: $.getJSON,
4560
+ importJSON: $.import,
4561
+ espConfig: O
4562
+ };
4563
+ }, ja = 3e3, Te = null, Le, Ze, re = -1, et = () => ({
4564
+ language: "en-US",
4565
+ preheaderText: "View this email in your browser",
4566
+ bodyBackgroundColor: "#f9fafb",
4567
+ bodyBackgroundImage: "",
4568
+ bodyBackgroundSize: "cover",
4569
+ bodyBackgroundPosition: "center center",
4570
+ bodyBackgroundRepeat: "no-repeat",
4571
+ backgroundColor: "#ffffff",
4572
+ width: 600,
4573
+ padding: {
4574
+ top: 0,
4575
+ right: 0,
4576
+ bottom: 0,
4577
+ left: 0
4578
+ },
4579
+ mobileBreakpoint: 600
4580
+ }), qn = /* @__PURE__ */ Symbol("maildeno-editor:email-builder");
4581
+ function uo(e, t) {
4582
+ const r = za(e, t);
4583
+ return Ae(qn, r), r;
4584
+ }
4585
+ var po = () => {
4586
+ const e = Me(qn);
4587
+ if (!e) throw new Error("[maildeno-editor] useEmailBuilder() was called outside an EmailEditor instance. This composable only works inside the component tree under <EmailEditor>, which is where provideEmailBuilder() creates the shared instance.");
4588
+ return e;
4589
+ };
4590
+ function za(e, t) {
4591
+ const r = e ?? ur(), n = dr(), a = P([]), i = P(null), o = P(et()), c = P(null), l = P([]), d = P(null), v = P(null), k = P("properties"), E = P("desktop"), w = P(!1), R = P(!1), I = P(null), O = P("create"), u = P({}), h = P(null), s = (T, j, J = "") => {
4592
+ h.value = {
4593
+ componentId: T,
4594
+ tagName: j,
4595
+ default: J
4596
+ };
4597
+ }, y = P({}), C = P(!1), _ = P({}), f = P(!1), p = P(null), g = P(null), x = P(!1), $ = P(!1), b = P(null), S = P({ syntax: "handlebars" }), { defaultProps: A } = Et(), m = br(), B = () => m.getCurrentState(a, o), z = (T) => m.restoreState(T, a, o, i, d, v), { generateHTMLComponent: N } = Lr(), { generateReactEmailComponent: F } = Jr(), { generateMJMLComponent: M } = Tn(), L = {
4598
+ html: N,
4599
+ react: F,
4600
+ mjml: M
4601
+ }, { saveToLocal: V, flushSave: q, loadFromLocal: W, clearLocal: X, hasDraft: oe, saveStatus: le, lastSaved: ce } = zr(), { syncFontsForTemplate: ie } = ut(), Ne = 5, Be = (T) => {
4602
+ const j = /* @__PURE__ */ new Set(), J = (G, $e) => {
4603
+ if (!($e >= Ne))
4604
+ for (const Je of G) {
4605
+ if (!Je) continue;
4606
+ const qt = Je.type;
4607
+ if (qt === "row") {
4608
+ for (const Wt of Je.columns ?? []) J(Wt.children ?? Wt.components ?? [], $e + 1);
4609
+ continue;
4610
+ }
4611
+ if (qt === "row-spacer") continue;
4612
+ const Ge = Je.props;
4613
+ Ge?.fontFamily && j.add(Ge.fontFamily), Ge?.mobile?.fontFamily && j.add(Ge.mobile.fontFamily);
4614
+ }
4615
+ };
4616
+ for (const G of T)
4617
+ if (G && G.type !== "row-spacer")
4618
+ for (const $e of G.columns ?? []) J($e.children ?? $e.components ?? [], 0);
4619
+ return Array.from(j);
4620
+ };
4621
+ {
4622
+ let T = null;
4623
+ sr(() => {
4624
+ const j = Be(a.value);
4625
+ T && clearTimeout(T), T = setTimeout(() => {
4626
+ T = null, ie(j);
4627
+ }, 200);
4628
+ });
4629
+ }
4630
+ const He = cr();
4631
+ let U = null, Y = !1;
4632
+ const be = () => {
4633
+ Y || He.value && (U && clearTimeout(U), U = setTimeout(() => {
4634
+ U = null;
4635
+ const T = m.version.value;
4636
+ T !== re && (re = T, Le = c.value ?? void 0, V(a.value, o.value, Te, Le, Ze));
4637
+ }, ja));
4638
+ };
4639
+ function ge(T = "change", j = !1) {
4640
+ m.saveToHistory(B, T, j), be();
4641
+ }
4642
+ function H(T) {
4643
+ ge(T, !0);
4644
+ }
4645
+ const D = gr(a, i, A, H, ge), Z = () => D.rebuildIdRegistry(), Ce = (T) => D.addRow(T, !0), pt = () => D.addSpacer(!0), mt = (T, j) => D.reorderRows(T, j, !0), Ue = (T, j) => {
4646
+ if (T?.id && (j.add(T.id), T.type === "row" && Array.isArray(T.columns)))
4647
+ for (const J of T.columns) {
4648
+ J?.id && j.add(J.id);
4649
+ const G = J.children ?? J.components ?? [];
4650
+ for (const $e of G) Ue($e, j);
4651
+ }
4652
+ }, ft = (T) => {
4653
+ const j = D.findRow(T);
4654
+ if (j) {
4655
+ const J = /* @__PURE__ */ new Set();
4656
+ Ue(j, J), i.value && J.has(i.value) && (i.value = null), d.value && J.has(d.value) && (d.value = null), v.value && (J.has(v.value.rowId) || J.has(v.value.columnId)) && (v.value = null);
4657
+ }
4658
+ D.deleteRow(T);
4659
+ }, gt = Se(() => ({
4660
+ mergeTagContext: y.value,
4661
+ mergeTagActive: C.value,
4662
+ linkTagContext: _.value,
4663
+ linkTagActive: f.value
4664
+ })), ee = Oa(a, o, L, ge, u, gt, void 0, void 0, S, t);
4665
+ {
4666
+ const T = () => {
4667
+ U && (clearTimeout(U), U = null, q(a.value, o.value, Te, Le, Ze), re = m.version.value);
4668
+ };
4669
+ window.addEventListener("beforeunload", T), or(() => {
4670
+ window.removeEventListener("beforeunload", T), U && (clearTimeout(U), U = null, q(a.value, o.value, Te, Le, Ze), re = m.version.value);
4671
+ });
4672
+ }
4673
+ const Jt = () => {
4674
+ if (a.value.length > 0)
4675
+ return w.value = !0, Z(), i.value = null, d.value = null, v.value = null, k.value = "properties", null;
4676
+ const T = W();
4677
+ return !T || T.templateId !== null ? (w.value = !0, null) : (w.value = !1, Y = !0, a.value = T.rows, o.value = T.canvas, i.value = null, d.value = null, v.value = null, k.value = "properties", he(() => {
4678
+ Y = !1, Z(), m.initialize(B()), re = m.version.value, w.value = !0;
4679
+ }), ce.value = new Date(T.updatedAt), T.name !== void 0 && (c.value = T.name), T.tags !== void 0 && (l.value = T.tags), T.updatedAt);
4680
+ }, Wn = async (T) => {
4681
+ if (!He.value) throw new Error("[maildeno-editor] this editor has no saveTemplate — nothing was saved");
4682
+ const { templateId: j } = await r.saveTemplate(T, I.value ?? void 0);
4683
+ I.value = j, O.value === "create" && (O.value = "edit");
4684
+ const J = ee.getExportedJSON(T.name);
4685
+ return J && console.info("[maildeno-editor] Saved — exported JSON:", J), j;
4686
+ }, Vn = async (T) => {
4687
+ const j = await r.loadTemplate(T);
4688
+ return j ? (Gt({
4689
+ canvas: j.canvasStyles,
4690
+ content: { rows: j.rows },
4691
+ name: j.name,
4692
+ tags: j.tags
4693
+ }, T), I.value = T, O.value = "edit", !0) : !1;
4694
+ }, Kn = () => {
4695
+ w.value = !1, v.value = null, d.value = null, k.value = "properties", U && (clearTimeout(U), U = null);
4696
+ const T = W();
4697
+ if (T && T.templateId === null) {
4698
+ Jt();
4699
+ return;
4700
+ }
4701
+ T && T.templateId !== null && X(), Y = !0, a.value = [], i.value = null, o.value = et(), Te = null, c.value = null, l.value = [], he(() => {
4702
+ Y = !1, Z(), m.initialize(B()), re = m.version.value, w.value = !0;
4703
+ });
4704
+ }, Yn = () => {
4705
+ w.value = !1, v.value = null, d.value = null, k.value = "properties", U && (clearTimeout(U), U = null), X(), Y = !0, a.value = [], i.value = null, o.value = et(), Te = null, I.value = null, O.value = "create", c.value = null, l.value = [], he(() => {
4706
+ Y = !1, Z(), m.initialize(B()), re = m.version.value, w.value = !0;
4707
+ });
4708
+ }, Gt = (T, j, J) => {
4709
+ w.value = !1, Te = j, Le = T.name, Ze = T.tags, c.value = T.name ?? null, l.value = T.tags ?? [], U && (clearTimeout(U), U = null);
4710
+ const G = W();
4711
+ if (G && G.templateId === j) {
4712
+ console.info(`[EmailBuilder] Restoring local draft for template ${j} (saved ${G.updatedAt}).`), G.name !== void 0 && (c.value = G.name), G.tags !== void 0 && (l.value = G.tags), Y = !0, o.value = G.canvas, a.value = G.rows, i.value = null, d.value = null, v.value = null, k.value = "properties", he(() => {
4713
+ Y = !1, Z(), m.initialize(B()), re = m.version.value, w.value = !0, J?.();
4714
+ }), ce.value = new Date(G.updatedAt);
4715
+ return;
4716
+ }
4717
+ G && G.templateId !== j && (console.info(`[EmailBuilder] Clearing stale draft (belongs to ${G.templateId}, current is ${j}).`), X()), Y = !0, o.value = at(JSON.parse(JSON.stringify(T.canvas))), a.value = ot(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, d.value = null, v.value = null, k.value = "properties", he(() => {
4718
+ Y = !1, Z(), m.initialize(B()), re = m.version.value, w.value = !0, J?.();
4719
+ });
4720
+ }, ht = (T, j = "restore-version") => {
4721
+ U && (clearTimeout(U), U = null), Y = !0, o.value = at(JSON.parse(JSON.stringify(T.canvas))), a.value = ot(JSON.parse(JSON.stringify(T.content?.rows ?? []))), i.value = null, d.value = null, v.value = null, k.value = "properties", he(() => {
4722
+ Y = !1, Z(), H(j);
4723
+ });
4724
+ }, Xn = () => {
4725
+ m.undo(z) && (Z(), be());
4726
+ }, Qn = () => {
4727
+ m.redo(z) && (Z(), be());
4728
+ }, Zn = () => {
4729
+ a.value = [], i.value = null, d.value = null, v.value = null, k.value = "properties", o.value = et(), he(() => {
4730
+ Z(), m.initialize(B()), re = m.version.value;
4731
+ });
4732
+ }, er = () => {
4733
+ n.require({
4734
+ message: "Are you sure you want to clear the current template? This cannot be undone.",
4735
+ header: "Clear Template",
4736
+ acceptLabel: "Yes",
4737
+ rejectLabel: "Cancel",
4738
+ acceptClass: "!bg-red-600 !hover:bg-red-700 !border-red-600 !px-6 !py-2",
4739
+ rejectClass: "!bg-gray-200 !hover:bg-gray-300 !text-gray-800 !border-gray-200 !px-6 !py-2",
4740
+ accept: () => Zn(),
4741
+ reject: () => {
4742
+ }
4743
+ });
4744
+ }, tr = (T, j = {}) => {
4745
+ const J = dn(T), G = {
4746
+ canvas: J.canvas,
4747
+ content: { rows: J.rows }
4748
+ };
4749
+ if (j.history === "reset") {
4750
+ ht(G, "set-json"), he(() => {
4751
+ m.initialize(B()), re = m.version.value;
4752
+ });
4753
+ return;
4754
+ }
4755
+ ht(G, "set-json");
4756
+ }, nr = () => {
4757
+ const T = i.value;
4758
+ if (!T) return null;
4759
+ const j = D.findComponent(T);
4760
+ return {
4761
+ id: T,
4762
+ type: j?.componentType ?? j?.type ?? null
4763
+ };
4764
+ }, rr = (T) => T !== null && !D.findComponent(T) ? !1 : (i.value = T, !0), ar = (T) => un(() => m.version.value, () => T());
4765
+ return {
4766
+ rows: a,
4767
+ canvasStyles: o,
4768
+ templateTags: l,
4769
+ savedTemplateName: c,
4770
+ previewMode: E,
4771
+ sidebarTab: k,
4772
+ selectedId: i,
4773
+ selectedRowId: d,
4774
+ selectedColumn: v,
4775
+ visibilityPreviewContext: u,
4776
+ mergeTagInsertQueue: h,
4777
+ triggerMergeTagInsert: s,
4778
+ mergeTagPreviewContext: y,
4779
+ mergeTagPreviewActive: C,
4780
+ linkTagPreviewContext: _,
4781
+ linkTagPreviewActive: f,
4782
+ isBuilderReady: w,
4783
+ linksActive: R,
4784
+ espConfig: S,
4785
+ canvasHoveredId: p,
4786
+ nestedRowDragId: g,
4787
+ isRowDragActive: x,
4788
+ isTopLevelRowDragActive: $,
4789
+ layerHoveredId: b,
4790
+ addRow: D.addRow,
4791
+ addNestedRow: D.addNestedRow,
4792
+ findRow: D.findRow,
4793
+ deleteRow: ft,
4794
+ moveRow: D.moveRow,
4795
+ moveNestedRow: D.moveNestedRow,
4796
+ reorderRows: D.reorderRows,
4797
+ addSpacer: D.addSpacer,
4798
+ duplicateRow: D.duplicateRow,
4799
+ duplicateRowSpacer: D.duplicateRowSpacer,
4800
+ addRowSilent: Ce,
4801
+ addSpacerSilent: pt,
4802
+ reorderRowsSilent: mt,
4803
+ addComponent: D.addComponent,
4804
+ addComponentAtIndex: D.addComponentAtIndex,
4805
+ deleteComponent: D.deleteComponent,
4806
+ moveComponent: D.moveComponent,
4807
+ moveComponentBetweenColumns: D.moveComponentBetweenColumns,
4808
+ findComponent: D.findComponent,
4809
+ updateComponent: D.updateComponent,
4810
+ duplicateComponent: D.duplicateComponent,
4811
+ exportHTML: ee.exportHTML,
4812
+ getExportedHTML: ee.getExportedHTML,
4813
+ exportReactEmail: ee.exportReactEmail,
4814
+ getExportedReactEmail: ee.getExportedReactEmail,
4815
+ exportMJML: ee.exportMJML,
4816
+ getExportedMJML: ee.getExportedMJML,
4817
+ exportJSON: ee.exportJSON,
4818
+ getExportedJSON: ee.getExportedJSON,
4819
+ importJSON: (T) => ee.importJSON(T, i),
4820
+ clearTemplate: er,
4821
+ undo: Xn,
4822
+ redo: Qn,
4823
+ canUndo: m.canUndo,
4824
+ canRedo: m.canRedo,
4825
+ historyStatus: m.historyStatus,
4826
+ saveToHistory: ge,
4827
+ saveToHistoryImmediate: H,
4828
+ initFromStorage: Jt,
4829
+ clearLocal: X,
4830
+ loadFromLocal: W,
4831
+ hasDraft: oe,
4832
+ saveStatus: le,
4833
+ lastSaved: ce,
4834
+ initForCreate: Kn,
4835
+ startNewTemplate: Yn,
4836
+ loadTemplate: Gt,
4837
+ loadTemplateById: Vn,
4838
+ saveTemplate: Wn,
4839
+ templateId: I,
4840
+ builderMode: O,
4841
+ loadVersionSnapshot: ht,
4842
+ setJson: tr,
4843
+ getSelection: nr,
4844
+ setSelection: rr,
4845
+ onChange: ar
4846
+ };
4847
+ }
4848
+ export {
4849
+ Va as A,
4850
+ Da as B,
4851
+ Vr as C,
4852
+ Pr as D,
4853
+ Ka as E,
4854
+ Ga as F,
4855
+ ur as H,
4856
+ dr as I,
4857
+ La as L,
4858
+ Ja as M,
4859
+ it as N,
4860
+ Sn as O,
4861
+ wt as P,
4862
+ Ha as R,
4863
+ Xa as S,
4864
+ zt as T,
4865
+ mn as U,
4866
+ Ua as V,
4867
+ K as W,
4868
+ Za as _,
4869
+ lo as a,
4870
+ Qa as b,
4871
+ so as c,
4872
+ oo as d,
4873
+ on as f,
4874
+ to as g,
4875
+ ut as h,
4876
+ ma as i,
4877
+ Wa as j,
4878
+ kn as k,
4879
+ io as l,
4880
+ ro as m,
4881
+ po as n,
4882
+ co as o,
4883
+ na as p,
4884
+ Ut as r,
4885
+ pa as s,
4886
+ uo as t,
4887
+ ao as u,
4888
+ eo as v,
4889
+ Ya as w,
4890
+ ct as x,
4891
+ no as y,
4892
+ Fa as z
4893
+ };