@boxcc/maildeno-editor 0.4.13 → 0.4.15
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.
- package/README.md +1 -0
- package/dist/{HealthIndicator-4Iw6N-g_.js → HealthIndicator-COWguEXj.js} +2 -2
- package/dist/{HealthIndicator-ZohgzF2_.js → HealthIndicator-D1dFZy5o.js} +1 -1
- package/dist/{PreviewCanvas-DzpLghCo.js → PreviewCanvas-CB0u47NT.js} +3 -3
- package/dist/{PreviewCanvas-QN4C68KA.js → PreviewCanvas-CutgVbs-.js} +3 -3
- package/dist/{RichTextEditor-Cz1-_ZtA.js → RichTextEditor-BMp0pgrh.js} +3 -3
- package/dist/{RichTextEditor-CmM4XRFC.js → RichTextEditor-MVYp_e_O.js} +2 -2
- package/dist/RowPreviewChildren-BANvlvrM.js +4 -0
- package/dist/RowPreviewChildren-DNVfH3gU.js +4 -0
- package/dist/{RowPreviewRow-Dx4ExtSN.js → RowPreviewRow-Cu6EURjr.js} +1 -1
- package/dist/{RowPreviewRow-DPaSbxmB.js → RowPreviewRow-YJGhJ67T.js} +1 -1
- package/dist/{SavedRowsPanel-DqSHB6Jk.js → SavedRowsPanel-CCXBKQYw.js} +37 -37
- package/dist/{SavedRowsPanel-DyXjSOEt.js → SavedRowsPanel-Cl1aZdnL.js} +33 -33
- package/dist/components/features/emailBuilder/EmailEditor.vue.d.ts +1 -0
- package/dist/{element-B3gq8Xvd.js → element-CxahtLpG.js} +4689 -4649
- package/dist/element.js +1 -1
- package/dist/index.js +3843 -3803
- package/dist/init.d.ts +2 -0
- package/dist/init.js +31 -25
- package/dist/{useEmailBuilder-BR4wfai1.js → useEmailBuilder-CBsHIs93.js} +1483 -1473
- package/dist/useEmailBuilder-D-hDPH_x.js +4934 -0
- package/dist/{useToast-DD11IxqP.js → useToast-DAu-9glv.js} +7 -7
- package/package.json +1 -1
- package/dist/RowPreviewChildren-BYaMZID3.js +0 -4
- package/dist/RowPreviewChildren-_A9gPQCs.js +0 -4
- package/dist/useEmailBuilder-B19p-2yp.js +0 -4924
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { F as
|
|
2
|
-
import { c as
|
|
1
|
+
import { F as pr, K as vn, M as $e, R as Ie, h as Ce, k as Oe, lt as mr, q as fr, st as L } from "./vue.runtime.esm-bundler-D2AjRP90.js";
|
|
2
|
+
import { c as pe, o as Rt, r as X, s as de, t as re } from "./borderRadius-CkSa1lQ9.js";
|
|
3
3
|
var ot = (e) => e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "untitled_template";
|
|
4
|
-
function
|
|
4
|
+
function bn(e) {
|
|
5
5
|
if (!e || typeof e != "object") throw new Error("Unrecognized template file format");
|
|
6
6
|
if (e.template_id && e.template_name && e.canvas && e.rows && e.schema_version) {
|
|
7
7
|
if (e.schema_version !== "1.0") {
|
|
@@ -40,14 +40,14 @@ function vn(e) {
|
|
|
40
40
|
}
|
|
41
41
|
throw new Error("Unrecognized template file format");
|
|
42
42
|
}
|
|
43
|
-
var
|
|
44
|
-
function
|
|
43
|
+
var Y = () => crypto.randomUUID().replace(/-/g, "").slice(0, 16), ye = "maildeno:product-rows", Pe = "maildeno:template:", wt = "maildeno:versions:", tn = 20;
|
|
44
|
+
function $n(e) {
|
|
45
45
|
const t = JSON.parse(JSON.stringify(e));
|
|
46
|
-
return t.id =
|
|
46
|
+
return t.id = Y(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
|
|
47
47
|
const n = r.children ?? r.components ?? [], a = {
|
|
48
48
|
...r,
|
|
49
|
-
id:
|
|
50
|
-
children: n.map((i) =>
|
|
49
|
+
id: Y(),
|
|
50
|
+
children: n.map((i) => $n(i))
|
|
51
51
|
};
|
|
52
52
|
return delete a.components, a;
|
|
53
53
|
})), t;
|
|
@@ -63,28 +63,28 @@ function fe(e) {
|
|
|
63
63
|
function De(e, t) {
|
|
64
64
|
localStorage.setItem(e, JSON.stringify(t));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function yn() {
|
|
67
67
|
async function e(s) {
|
|
68
|
-
return s ? fe(
|
|
68
|
+
return s ? fe(Pe + s) : null;
|
|
69
69
|
}
|
|
70
|
-
async function t(s,
|
|
71
|
-
const C =
|
|
70
|
+
async function t(s, y) {
|
|
71
|
+
const C = y || Y();
|
|
72
72
|
try {
|
|
73
|
-
const _ = fe(
|
|
74
|
-
_ &&
|
|
73
|
+
const _ = fe(Pe + C);
|
|
74
|
+
_ && h(C, _);
|
|
75
75
|
} catch (_) {
|
|
76
76
|
console.warn("[maildeno-editor] couldn't record a template version:", _);
|
|
77
77
|
}
|
|
78
|
-
return De(
|
|
78
|
+
return De(Pe + C, {
|
|
79
79
|
...s,
|
|
80
80
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
81
81
|
}), { templateId: C };
|
|
82
82
|
}
|
|
83
83
|
async function r() {
|
|
84
84
|
const s = [];
|
|
85
|
-
for (let
|
|
86
|
-
const C = localStorage.key(
|
|
87
|
-
if (!C?.startsWith(
|
|
85
|
+
for (let y = 0; y < localStorage.length; y++) {
|
|
86
|
+
const C = localStorage.key(y);
|
|
87
|
+
if (!C?.startsWith(Pe)) continue;
|
|
88
88
|
const _ = fe(C);
|
|
89
89
|
s.push({
|
|
90
90
|
templateId: C.slice(18),
|
|
@@ -92,85 +92,85 @@ function $n() {
|
|
|
92
92
|
updatedAt: _?.updatedAt
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
return s.sort((
|
|
95
|
+
return s.sort((y, C) => (C.updatedAt ?? "").localeCompare(y.updatedAt ?? ""));
|
|
96
96
|
}
|
|
97
97
|
async function n(s) {
|
|
98
|
-
localStorage.removeItem(
|
|
98
|
+
localStorage.removeItem(Pe + s), localStorage.removeItem(wt + s);
|
|
99
99
|
}
|
|
100
100
|
function a(s) {
|
|
101
|
-
return fe(
|
|
101
|
+
return fe(wt + s) ?? [];
|
|
102
102
|
}
|
|
103
|
-
function i(s,
|
|
104
|
-
De(
|
|
103
|
+
function i(s, y) {
|
|
104
|
+
De(wt + s, y);
|
|
105
105
|
}
|
|
106
106
|
async function o(s) {
|
|
107
|
-
return a(s).map(({ snapshot:
|
|
107
|
+
return a(s).map(({ snapshot: y, ...C }) => C);
|
|
108
108
|
}
|
|
109
|
-
async function l(s,
|
|
110
|
-
return a(s).find((C) => C.versionId ===
|
|
109
|
+
async function l(s, y) {
|
|
110
|
+
return a(s).find((C) => C.versionId === y)?.snapshot ?? null;
|
|
111
111
|
}
|
|
112
|
-
async function c(s,
|
|
113
|
-
i(s, a(s).filter((C) => C.versionId !==
|
|
112
|
+
async function c(s, y) {
|
|
113
|
+
i(s, a(s).filter((C) => C.versionId !== y));
|
|
114
114
|
}
|
|
115
|
-
async function
|
|
116
|
-
i(s, a(s).filter((
|
|
115
|
+
async function m(s) {
|
|
116
|
+
i(s, a(s).filter((y) => y.kept));
|
|
117
117
|
}
|
|
118
|
-
async function
|
|
119
|
-
i(s, a(s).map((_) => _.versionId ===
|
|
118
|
+
async function b(s, y, C) {
|
|
119
|
+
i(s, a(s).map((_) => _.versionId === y ? {
|
|
120
120
|
..._,
|
|
121
121
|
kept: C
|
|
122
122
|
} : _));
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function h(s, y) {
|
|
125
125
|
const C = a(s);
|
|
126
126
|
C.unshift({
|
|
127
|
-
versionId:
|
|
127
|
+
versionId: Y(),
|
|
128
128
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
129
129
|
kept: !1,
|
|
130
|
-
snapshot:
|
|
130
|
+
snapshot: y
|
|
131
131
|
});
|
|
132
|
-
const _ = C.filter((
|
|
133
|
-
if (_.length >
|
|
134
|
-
const
|
|
135
|
-
i(s, C.filter((
|
|
132
|
+
const _ = C.filter((f) => !f.kept);
|
|
133
|
+
if (_.length > tn) {
|
|
134
|
+
const f = new Set(_.slice(tn).map((p) => p.versionId));
|
|
135
|
+
i(s, C.filter((p) => !f.has(p.versionId)));
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
i(s, C);
|
|
139
139
|
}
|
|
140
|
-
async function
|
|
141
|
-
return fe(
|
|
140
|
+
async function R() {
|
|
141
|
+
return fe(ye) ?? [];
|
|
142
142
|
}
|
|
143
|
-
async function
|
|
143
|
+
async function E() {
|
|
144
144
|
return [];
|
|
145
145
|
}
|
|
146
|
-
async function
|
|
147
|
-
const C = fe(
|
|
148
|
-
id:
|
|
149
|
-
name:
|
|
146
|
+
async function x(s, y) {
|
|
147
|
+
const C = fe(ye) ?? [], _ = {
|
|
148
|
+
id: Y(),
|
|
149
|
+
name: y.trim() || `Row ${C.length + 1}`,
|
|
150
150
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
151
151
|
row: JSON.parse(JSON.stringify(s))
|
|
152
152
|
};
|
|
153
|
-
return De(
|
|
153
|
+
return De(ye, [_, ...C]), _;
|
|
154
154
|
}
|
|
155
|
-
async function
|
|
156
|
-
const
|
|
157
|
-
De(
|
|
155
|
+
async function N(s) {
|
|
156
|
+
const y = fe(ye) ?? [];
|
|
157
|
+
De(ye, y.filter((C) => C.id !== s));
|
|
158
158
|
}
|
|
159
|
-
async function
|
|
160
|
-
const C = fe(
|
|
161
|
-
De(
|
|
159
|
+
async function j(s, y) {
|
|
160
|
+
const C = fe(ye) ?? [];
|
|
161
|
+
De(ye, C.map((_) => _.id === s ? {
|
|
162
162
|
..._,
|
|
163
|
-
name:
|
|
163
|
+
name: y.trim() || _.name
|
|
164
164
|
} : _));
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
const
|
|
168
|
-
return
|
|
166
|
+
function u(s) {
|
|
167
|
+
const y = (fe(ye) ?? []).find((C) => C.id === s);
|
|
168
|
+
return y ? $n(y.row) : null;
|
|
169
169
|
}
|
|
170
|
-
async function
|
|
171
|
-
return new Promise((
|
|
170
|
+
async function d(s) {
|
|
171
|
+
return new Promise((y, C) => {
|
|
172
172
|
const _ = new FileReader();
|
|
173
|
-
_.onload = () =>
|
|
173
|
+
_.onload = () => y(_.result), _.onerror = () => C(_.error), _.readAsDataURL(s);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
return {
|
|
@@ -181,93 +181,93 @@ function $n() {
|
|
|
181
181
|
listTemplateVersions: o,
|
|
182
182
|
getTemplateVersion: l,
|
|
183
183
|
deleteTemplateVersion: c,
|
|
184
|
-
deleteAllTemplateVersions:
|
|
185
|
-
setTemplateVersionKept:
|
|
186
|
-
listSavedRows:
|
|
187
|
-
listSystemSavedRows:
|
|
188
|
-
saveSavedRow:
|
|
189
|
-
deleteSavedRow:
|
|
190
|
-
renameSavedRow:
|
|
191
|
-
cloneSavedRowForCanvas:
|
|
192
|
-
uploadImage:
|
|
184
|
+
deleteAllTemplateVersions: m,
|
|
185
|
+
setTemplateVersionKept: b,
|
|
186
|
+
listSavedRows: R,
|
|
187
|
+
listSystemSavedRows: E,
|
|
188
|
+
saveSavedRow: x,
|
|
189
|
+
deleteSavedRow: N,
|
|
190
|
+
renameSavedRow: j,
|
|
191
|
+
cloneSavedRowForCanvas: u,
|
|
192
|
+
uploadImage: d
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
var
|
|
196
|
-
function
|
|
197
|
-
const t =
|
|
195
|
+
var Sn = /* @__PURE__ */ Symbol("maildeno-editor:storage-adapter");
|
|
196
|
+
function gr(e) {
|
|
197
|
+
const t = yn();
|
|
198
198
|
if (!e) return t;
|
|
199
199
|
const r = { ...t };
|
|
200
200
|
for (const [n, a] of Object.entries(e)) typeof a == "function" && (r[n] = a);
|
|
201
201
|
return r;
|
|
202
202
|
}
|
|
203
|
-
var
|
|
204
|
-
function
|
|
205
|
-
return Oe(
|
|
203
|
+
var kn = /* @__PURE__ */ Symbol("maildeno-editor:can-save");
|
|
204
|
+
function hr() {
|
|
205
|
+
return Oe(kn, Ce(() => !0));
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
Ie(
|
|
207
|
+
function Ka(e) {
|
|
208
|
+
Ie(kn, e);
|
|
209
209
|
}
|
|
210
|
-
var
|
|
211
|
-
function
|
|
212
|
-
return Oe(
|
|
210
|
+
var wn = /* @__PURE__ */ Symbol("maildeno-editor:has-template-library");
|
|
211
|
+
function Ya() {
|
|
212
|
+
return Oe(wn, !0);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
const t =
|
|
216
|
-
return Ie(
|
|
214
|
+
function Xa(e) {
|
|
215
|
+
const t = gr(e);
|
|
216
|
+
return Ie(Sn, t), Ie(wn, !e || typeof e.listTemplates == "function"), t;
|
|
217
217
|
}
|
|
218
|
-
var
|
|
219
|
-
const e = Oe(
|
|
220
|
-
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."),
|
|
221
|
-
},
|
|
222
|
-
function
|
|
223
|
-
Ie(
|
|
218
|
+
var vr = () => {
|
|
219
|
+
const e = Oe(Sn);
|
|
220
|
+
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."), yn());
|
|
221
|
+
}, xn = /* @__PURE__ */ Symbol("maildeno-editor:saved-row-capabilities");
|
|
222
|
+
function Qa(e) {
|
|
223
|
+
Ie(xn, e);
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
return Oe(
|
|
225
|
+
function Za() {
|
|
226
|
+
return Oe(xn, Ce(() => ({})));
|
|
227
227
|
}
|
|
228
|
-
var
|
|
229
|
-
function
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
var ut = mr(null), Et = L(!1);
|
|
229
|
+
function jt() {
|
|
230
|
+
Et.value = !1, setTimeout(() => {
|
|
231
|
+
Et.value || (ut.value = null);
|
|
232
232
|
}, 200);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
const e =
|
|
236
|
-
|
|
234
|
+
function eo() {
|
|
235
|
+
const e = ut.value;
|
|
236
|
+
jt(), e?.accept?.();
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
const e =
|
|
240
|
-
|
|
238
|
+
function to() {
|
|
239
|
+
const e = ut.value;
|
|
240
|
+
jt(), e?.reject?.();
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function br() {
|
|
243
243
|
return {
|
|
244
244
|
require(e) {
|
|
245
|
-
|
|
245
|
+
ut.value = e, Et.value = !0;
|
|
246
246
|
},
|
|
247
|
-
close:
|
|
247
|
+
close: jt
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
var _e = () => ({
|
|
251
251
|
enabled: !1,
|
|
252
252
|
match: "all",
|
|
253
253
|
rules: []
|
|
254
|
-
}),
|
|
254
|
+
}), Mt = () => ({
|
|
255
255
|
desktopHide: !1,
|
|
256
256
|
mobileHide: !1
|
|
257
|
-
}),
|
|
257
|
+
}), ie = () => ({
|
|
258
258
|
visibility: _e(),
|
|
259
|
-
...
|
|
260
|
-
}),
|
|
259
|
+
...Mt()
|
|
260
|
+
}), $r = Object.freeze({
|
|
261
261
|
enabled: !1,
|
|
262
262
|
match: "all",
|
|
263
263
|
rules: []
|
|
264
|
-
}),
|
|
264
|
+
}), yr = Object.freeze({
|
|
265
265
|
desktopHide: !1,
|
|
266
266
|
mobileHide: !1
|
|
267
|
-
}),
|
|
268
|
-
visibility:
|
|
269
|
-
|
|
270
|
-
}),
|
|
267
|
+
}), no = Object.freeze({
|
|
268
|
+
visibility: $r,
|
|
269
|
+
...yr
|
|
270
|
+
}), xt = (e) => ({
|
|
271
271
|
useGradient: !1,
|
|
272
272
|
solid: e,
|
|
273
273
|
gradient: {
|
|
@@ -295,7 +295,7 @@ var _e = () => ({
|
|
|
295
295
|
position: 100
|
|
296
296
|
}]
|
|
297
297
|
}
|
|
298
|
-
}),
|
|
298
|
+
}), zt = () => ({ defaultProps: {
|
|
299
299
|
paragraph: {
|
|
300
300
|
content: "Enter your paragraph text here",
|
|
301
301
|
fontSize: 16,
|
|
@@ -338,7 +338,7 @@ var _e = () => ({
|
|
|
338
338
|
margin: null,
|
|
339
339
|
padding: null
|
|
340
340
|
},
|
|
341
|
-
...
|
|
341
|
+
...ie()
|
|
342
342
|
},
|
|
343
343
|
heading: {
|
|
344
344
|
content: "Heading Text",
|
|
@@ -381,7 +381,7 @@ var _e = () => ({
|
|
|
381
381
|
margin: null,
|
|
382
382
|
padding: null
|
|
383
383
|
},
|
|
384
|
-
...
|
|
384
|
+
...ie()
|
|
385
385
|
},
|
|
386
386
|
image: {
|
|
387
387
|
src: "https://email-builder-nor-dev.s3.amazonaws.com/images/2026/08/20/5bffeaf2.jpeg",
|
|
@@ -418,7 +418,7 @@ var _e = () => ({
|
|
|
418
418
|
borderRadius: null,
|
|
419
419
|
border: null
|
|
420
420
|
},
|
|
421
|
-
...
|
|
421
|
+
...ie()
|
|
422
422
|
},
|
|
423
423
|
video: {
|
|
424
424
|
fallbackLink: "https://example.com",
|
|
@@ -455,7 +455,7 @@ var _e = () => ({
|
|
|
455
455
|
borderRadius: null,
|
|
456
456
|
border: null
|
|
457
457
|
},
|
|
458
|
-
...
|
|
458
|
+
...ie()
|
|
459
459
|
},
|
|
460
460
|
list: {
|
|
461
461
|
content: "<ul><li>List item 1</li><li>List item 2</li><li>List item 3</li></ul>",
|
|
@@ -491,7 +491,7 @@ var _e = () => ({
|
|
|
491
491
|
padding: null,
|
|
492
492
|
itemSpacing: null
|
|
493
493
|
},
|
|
494
|
-
...
|
|
494
|
+
...ie()
|
|
495
495
|
},
|
|
496
496
|
button: {
|
|
497
497
|
text: "Click Me",
|
|
@@ -499,7 +499,7 @@ var _e = () => ({
|
|
|
499
499
|
width: "auto",
|
|
500
500
|
height: "auto",
|
|
501
501
|
backgroundColor: "#007bff",
|
|
502
|
-
backgroundGradient:
|
|
502
|
+
backgroundGradient: xt("#007bff"),
|
|
503
503
|
color: "#fafafa",
|
|
504
504
|
fontSize: 16,
|
|
505
505
|
fontWeight: "medium",
|
|
@@ -545,7 +545,7 @@ var _e = () => ({
|
|
|
545
545
|
border: null,
|
|
546
546
|
align: null
|
|
547
547
|
},
|
|
548
|
-
...
|
|
548
|
+
...ie()
|
|
549
549
|
},
|
|
550
550
|
anchor: {
|
|
551
551
|
text: "Click here",
|
|
@@ -580,11 +580,11 @@ var _e = () => ({
|
|
|
580
580
|
padding: null,
|
|
581
581
|
align: null
|
|
582
582
|
},
|
|
583
|
-
...
|
|
583
|
+
...ie()
|
|
584
584
|
},
|
|
585
585
|
divider: {
|
|
586
586
|
backgroundColor: "#cccccc",
|
|
587
|
-
backgroundGradient:
|
|
587
|
+
backgroundGradient: xt("#cccccc"),
|
|
588
588
|
height: 1,
|
|
589
589
|
width: 100,
|
|
590
590
|
margin: {
|
|
@@ -609,18 +609,18 @@ var _e = () => ({
|
|
|
609
609
|
padding: null,
|
|
610
610
|
align: null
|
|
611
611
|
},
|
|
612
|
-
...
|
|
612
|
+
...ie()
|
|
613
613
|
},
|
|
614
614
|
spacer: {
|
|
615
615
|
height: 20,
|
|
616
616
|
backgroundColor: "transparent",
|
|
617
|
-
backgroundGradient:
|
|
617
|
+
backgroundGradient: xt("transparent"),
|
|
618
618
|
mobile: {
|
|
619
619
|
height: null,
|
|
620
620
|
backgroundColor: null,
|
|
621
621
|
backgroundGradient: null
|
|
622
622
|
},
|
|
623
|
-
...
|
|
623
|
+
...ie()
|
|
624
624
|
},
|
|
625
625
|
menu: {
|
|
626
626
|
items: [
|
|
@@ -683,7 +683,7 @@ var _e = () => ({
|
|
|
683
683
|
margin: null,
|
|
684
684
|
padding: null
|
|
685
685
|
},
|
|
686
|
-
...
|
|
686
|
+
...ie()
|
|
687
687
|
},
|
|
688
688
|
socials: {
|
|
689
689
|
platforms: [
|
|
@@ -728,9 +728,9 @@ var _e = () => ({
|
|
|
728
728
|
margin: null,
|
|
729
729
|
padding: null
|
|
730
730
|
},
|
|
731
|
-
...
|
|
731
|
+
...ie()
|
|
732
732
|
}
|
|
733
|
-
} }),
|
|
733
|
+
} }), ro = (e) => e.trim().toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, ""), ao = (e) => e.split("_").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "), Cn = () => `row_${Y().slice(0, 4)}`, Fe = (e) => ({
|
|
734
734
|
useGradient: !1,
|
|
735
735
|
solid: e,
|
|
736
736
|
gradient: {
|
|
@@ -744,25 +744,25 @@ var _e = () => ({
|
|
|
744
744
|
position: 100
|
|
745
745
|
}]
|
|
746
746
|
}
|
|
747
|
-
}), he = (e) => e.children ?? e.components ?? [], He = (e) => (e.children || (e.children = e.components ?? []), e.children),
|
|
747
|
+
}), he = (e) => e.children ?? e.components ?? [], He = (e) => (e.children || (e.children = e.components ?? []), e.children), Lt = (e) => {
|
|
748
748
|
const t = JSON.parse(JSON.stringify(e));
|
|
749
|
-
return t.id =
|
|
749
|
+
return t.id = Y(), t.type === "row" && Array.isArray(t.columns) && (t.columns = t.columns.map((r) => {
|
|
750
750
|
const n = r.children ?? r.components ?? [], a = {
|
|
751
751
|
...r,
|
|
752
|
-
id:
|
|
753
|
-
children: n.map((i) =>
|
|
752
|
+
id: Y(),
|
|
753
|
+
children: n.map((i) => Lt(i))
|
|
754
754
|
};
|
|
755
755
|
return delete a.components, a;
|
|
756
756
|
})), t;
|
|
757
757
|
}, Xe = (e, t) => {
|
|
758
|
-
const r =
|
|
758
|
+
const r = Lt(e);
|
|
759
759
|
if (r.type === "row-spacer") return r;
|
|
760
|
-
const n = e.name ??
|
|
760
|
+
const n = e.name ?? Cn(), a = new Set(t.map((l) => l.name));
|
|
761
761
|
let i = `${n}_copy`, o = 2;
|
|
762
762
|
for (; a.has(i); )
|
|
763
763
|
i = `${n}_copy_${o}`, o++;
|
|
764
764
|
return r.name = i, r;
|
|
765
|
-
},
|
|
765
|
+
}, Sr = (e) => Lt(e), ve = (e, t) => {
|
|
766
766
|
for (let r = 0; r < e.length; r++) {
|
|
767
767
|
const n = e[r];
|
|
768
768
|
if (n.id === t) return {
|
|
@@ -791,50 +791,50 @@ var _e = () => ({
|
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
793
|
return null;
|
|
794
|
-
},
|
|
795
|
-
|
|
794
|
+
}, oe = /* @__PURE__ */ new Map(), nn = (e) => {
|
|
795
|
+
oe.clear();
|
|
796
796
|
const t = (r) => {
|
|
797
797
|
for (const n of r)
|
|
798
|
-
if (n?.id && (
|
|
798
|
+
if (n?.id && (oe.set(n.id, n), n.type === "row" && Array.isArray(n.columns)))
|
|
799
799
|
for (const a of n.columns)
|
|
800
|
-
a?.id &&
|
|
800
|
+
a?.id && oe.set(a.id, a), t(a.children ?? a.components ?? []);
|
|
801
801
|
};
|
|
802
802
|
t(e);
|
|
803
|
-
},
|
|
804
|
-
if (e?.id && (
|
|
803
|
+
}, le = (e) => {
|
|
804
|
+
if (e?.id && (oe.set(e.id, e), e.type === "row" && Array.isArray(e.columns)))
|
|
805
805
|
for (const t of e.columns) {
|
|
806
|
-
t?.id &&
|
|
806
|
+
t?.id && oe.set(t.id, t);
|
|
807
807
|
const r = t.children ?? t.components ?? [];
|
|
808
|
-
for (const n of r)
|
|
808
|
+
for (const n of r) le(n);
|
|
809
809
|
}
|
|
810
810
|
}, it = (e) => {
|
|
811
|
-
if (e?.id && (
|
|
811
|
+
if (e?.id && (oe.delete(e.id), e.type === "row" && Array.isArray(e.columns)))
|
|
812
812
|
for (const t of e.columns) {
|
|
813
|
-
t?.id &&
|
|
813
|
+
t?.id && oe.delete(t.id);
|
|
814
814
|
const r = t.children ?? t.components ?? [];
|
|
815
815
|
for (const n of r) it(n);
|
|
816
816
|
}
|
|
817
|
-
},
|
|
818
|
-
|
|
819
|
-
const i = (
|
|
820
|
-
let
|
|
821
|
-
if (Array.isArray(
|
|
822
|
-
if (
|
|
817
|
+
}, kr = (e, t, r, n, a = n) => {
|
|
818
|
+
oe.size === 0 && Array.isArray(e.value) && e.value.length && nn(e.value);
|
|
819
|
+
const i = (f, p = !1) => {
|
|
820
|
+
let g;
|
|
821
|
+
if (Array.isArray(f)) {
|
|
822
|
+
if (f.reduce((S, T) => S + T, 0) !== 100) {
|
|
823
823
|
console.warn("Column widths must sum to 100%");
|
|
824
824
|
return;
|
|
825
825
|
}
|
|
826
|
-
|
|
826
|
+
g = f;
|
|
827
827
|
} else {
|
|
828
|
-
const
|
|
829
|
-
|
|
828
|
+
const S = Math.floor(100 / f);
|
|
829
|
+
g = Array(f).fill(S), g[0] += 100 - g.reduce((T, k) => T + k, 0);
|
|
830
830
|
}
|
|
831
|
-
const
|
|
832
|
-
id: `${
|
|
831
|
+
const w = Cn(), $ = {
|
|
832
|
+
id: `${Y()}`,
|
|
833
833
|
type: "row",
|
|
834
|
-
name:
|
|
835
|
-
columns:
|
|
836
|
-
id: `${
|
|
837
|
-
width:
|
|
834
|
+
name: w,
|
|
835
|
+
columns: g.map((S, T) => ({
|
|
836
|
+
id: `${Y()}-${T}`,
|
|
837
|
+
width: S,
|
|
838
838
|
children: [],
|
|
839
839
|
backgroundColor: "transparent",
|
|
840
840
|
backgroundGradient: Fe("transparent"),
|
|
@@ -879,32 +879,32 @@ var _e = () => ({
|
|
|
879
879
|
mobileStack: !0,
|
|
880
880
|
visibility: _e()
|
|
881
881
|
};
|
|
882
|
-
e.value.push(
|
|
883
|
-
const
|
|
884
|
-
|
|
885
|
-
}, o = (
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
888
|
-
const
|
|
889
|
-
if (
|
|
890
|
-
let
|
|
891
|
-
if (Array.isArray(
|
|
892
|
-
if (
|
|
882
|
+
e.value.push($);
|
|
883
|
+
const v = e.value[e.value.length - 1];
|
|
884
|
+
le(v), p || n("add-row");
|
|
885
|
+
}, o = (f, p, g, w) => {
|
|
886
|
+
const $ = xe(e.value, f);
|
|
887
|
+
if (!$?.columns) return;
|
|
888
|
+
const v = $.columns.find((B) => B.id === p);
|
|
889
|
+
if (!v) return;
|
|
890
|
+
let S;
|
|
891
|
+
if (Array.isArray(g)) {
|
|
892
|
+
if (g.reduce((B, D) => B + D, 0) !== 100) {
|
|
893
893
|
console.warn("[addNestedRow] Widths must sum to 100%");
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
896
|
-
|
|
896
|
+
S = g;
|
|
897
897
|
} else {
|
|
898
|
-
const
|
|
899
|
-
|
|
898
|
+
const B = Math.floor(100 / g);
|
|
899
|
+
S = Array(g).fill(B), S[0] += 100 - S.reduce((D, I) => D + I, 0);
|
|
900
900
|
}
|
|
901
|
-
const
|
|
902
|
-
id: `${
|
|
901
|
+
const T = {
|
|
902
|
+
id: `${Y()}`,
|
|
903
903
|
type: "row",
|
|
904
|
-
name: `nested_row_${
|
|
905
|
-
columns:
|
|
906
|
-
id: `${
|
|
907
|
-
width:
|
|
904
|
+
name: `nested_row_${Y().slice(0, 4)}`,
|
|
905
|
+
columns: S.map((B, D) => ({
|
|
906
|
+
id: `${Y()}-${D}`,
|
|
907
|
+
width: B,
|
|
908
908
|
children: [],
|
|
909
909
|
backgroundColor: "transparent",
|
|
910
910
|
backgroundGradient: Fe("transparent"),
|
|
@@ -948,238 +948,238 @@ var _e = () => ({
|
|
|
948
948
|
gap: 0,
|
|
949
949
|
mobileStack: !0,
|
|
950
950
|
visibility: _e()
|
|
951
|
-
},
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
|
|
955
|
-
}, l = (
|
|
956
|
-
if (
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
const
|
|
960
|
-
return
|
|
961
|
-
}, c = (
|
|
962
|
-
const
|
|
963
|
-
if (
|
|
964
|
-
const [
|
|
965
|
-
it(
|
|
951
|
+
}, k = He(v), M = w !== void 0 && w >= 0 && w <= k.length ? w : k.length;
|
|
952
|
+
k.splice(M, 0, T);
|
|
953
|
+
const O = k[M];
|
|
954
|
+
le(O), n("add-nested-row");
|
|
955
|
+
}, l = (f) => {
|
|
956
|
+
if (f == null) return null;
|
|
957
|
+
const p = String(f), g = oe.get(p);
|
|
958
|
+
if (g && (g.type === "row" || g.type === "row-spacer")) return g;
|
|
959
|
+
const w = xe(e.value, f);
|
|
960
|
+
return w && oe.set(p, w), w;
|
|
961
|
+
}, c = (f) => {
|
|
962
|
+
const p = e.value.findIndex((g) => g.id === f);
|
|
963
|
+
if (p !== -1) {
|
|
964
|
+
const [g] = e.value.splice(p, 1);
|
|
965
|
+
it(g), n("delete-row");
|
|
966
966
|
return;
|
|
967
967
|
}
|
|
968
|
-
for (const
|
|
969
|
-
if (
|
|
970
|
-
for (const
|
|
971
|
-
const
|
|
972
|
-
if (
|
|
973
|
-
const [
|
|
974
|
-
it(
|
|
968
|
+
for (const g of e.value)
|
|
969
|
+
if (g.columns)
|
|
970
|
+
for (const w of g.columns) {
|
|
971
|
+
const $ = he(w), v = ve($, f);
|
|
972
|
+
if (v) {
|
|
973
|
+
const [S] = v.parentChildren.splice(v.index, 1);
|
|
974
|
+
it(S), n("delete-row");
|
|
975
975
|
return;
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
|
-
},
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
const [
|
|
984
|
-
e.value.splice(
|
|
978
|
+
}, m = (f, p) => {
|
|
979
|
+
const g = e.value.findIndex(($) => $.id === f);
|
|
980
|
+
if (g !== -1) {
|
|
981
|
+
const $ = p === "up" ? g - 1 : g + 1;
|
|
982
|
+
if ($ < 0 || $ >= e.value.length) return;
|
|
983
|
+
const [v] = e.value.splice(g, 1);
|
|
984
|
+
e.value.splice($, 0, v), n("move-row");
|
|
985
985
|
return;
|
|
986
986
|
}
|
|
987
|
-
const
|
|
988
|
-
const
|
|
989
|
-
if (
|
|
990
|
-
const
|
|
991
|
-
if (
|
|
992
|
-
const [
|
|
993
|
-
return
|
|
987
|
+
const w = ($) => {
|
|
988
|
+
const v = $.findIndex((S) => S.id === f);
|
|
989
|
+
if (v !== -1) {
|
|
990
|
+
const S = p === "up" ? v - 1 : v + 1;
|
|
991
|
+
if (S < 0 || S >= $.length) return !0;
|
|
992
|
+
const [T] = $.splice(v, 1);
|
|
993
|
+
return $.splice(S, 0, T), n("move-row"), !0;
|
|
994
994
|
}
|
|
995
|
-
for (const
|
|
996
|
-
for (const
|
|
995
|
+
for (const S of $) if (S.type === "row" && S.columns) {
|
|
996
|
+
for (const T of S.columns) if (w(T.children ?? T.components ?? [])) return !0;
|
|
997
997
|
}
|
|
998
998
|
return !1;
|
|
999
999
|
};
|
|
1000
|
-
for (const
|
|
1001
|
-
if (
|
|
1002
|
-
for (const
|
|
1000
|
+
for (const $ of e.value)
|
|
1001
|
+
if ($.columns) {
|
|
1002
|
+
for (const v of $.columns) if (w(v.children ?? v.components ?? [])) return;
|
|
1003
1003
|
}
|
|
1004
|
-
},
|
|
1005
|
-
let
|
|
1006
|
-
const
|
|
1007
|
-
if (
|
|
1008
|
-
const
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1011
|
-
return
|
|
1012
|
-
for (const
|
|
1013
|
-
for (const
|
|
1004
|
+
}, b = (f, p, g, w) => {
|
|
1005
|
+
let $ = null;
|
|
1006
|
+
const v = e.value.findIndex((S) => S.id === f);
|
|
1007
|
+
if (v !== -1 && ($ = e.value.splice(v, 1)[0]), !$) {
|
|
1008
|
+
const S = (T) => {
|
|
1009
|
+
const k = T.findIndex((M) => M.id === f);
|
|
1010
|
+
if (k !== -1)
|
|
1011
|
+
return $ = T.splice(k, 1)[0], !0;
|
|
1012
|
+
for (const M of T) if (M.type === "row" && M.columns) {
|
|
1013
|
+
for (const O of M.columns) if (S(O.children ?? O.components ?? [])) return !0;
|
|
1014
1014
|
}
|
|
1015
1015
|
return !1;
|
|
1016
1016
|
};
|
|
1017
|
-
for (const
|
|
1018
|
-
if (
|
|
1019
|
-
for (const
|
|
1020
|
-
if (
|
|
1017
|
+
for (const T of e.value)
|
|
1018
|
+
if (T.columns) {
|
|
1019
|
+
for (const k of T.columns) if (S(k.children ?? k.components ?? [])) break;
|
|
1020
|
+
if ($) break;
|
|
1021
1021
|
}
|
|
1022
1022
|
}
|
|
1023
|
-
if (
|
|
1024
|
-
if (
|
|
1025
|
-
const
|
|
1026
|
-
e.value.splice(
|
|
1023
|
+
if ($) {
|
|
1024
|
+
if (g === null) {
|
|
1025
|
+
const S = Math.min(w, e.value.length);
|
|
1026
|
+
e.value.splice(S, 0, $);
|
|
1027
1027
|
} else {
|
|
1028
|
-
const
|
|
1029
|
-
if (!
|
|
1030
|
-
e.value.push(
|
|
1028
|
+
const S = xe(e.value, p);
|
|
1029
|
+
if (!S?.columns) {
|
|
1030
|
+
e.value.push($);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
|
-
const
|
|
1034
|
-
if (!
|
|
1035
|
-
e.value.push(
|
|
1033
|
+
const T = S.columns.find((O) => O.id === g);
|
|
1034
|
+
if (!T) {
|
|
1035
|
+
e.value.push($);
|
|
1036
1036
|
return;
|
|
1037
1037
|
}
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1038
|
+
const k = He(T), M = Math.min(w, k.length);
|
|
1039
|
+
k.splice(M, 0, $);
|
|
1040
1040
|
}
|
|
1041
1041
|
n("move-nested-row");
|
|
1042
1042
|
}
|
|
1043
|
-
},
|
|
1044
|
-
if (
|
|
1045
|
-
const
|
|
1046
|
-
e.value.splice(
|
|
1047
|
-
},
|
|
1048
|
-
const
|
|
1049
|
-
id: `${
|
|
1043
|
+
}, h = (f, p, g = !1) => {
|
|
1044
|
+
if (f === p) return;
|
|
1045
|
+
const w = e.value[f];
|
|
1046
|
+
e.value.splice(f, 1), e.value.splice(p, 0, w), g || n("reorder-rows");
|
|
1047
|
+
}, R = (f = !1) => {
|
|
1048
|
+
const p = `spacer_${Y().slice(0, 4)}`, g = {
|
|
1049
|
+
id: `${Y()}`,
|
|
1050
1050
|
type: "row-spacer",
|
|
1051
|
-
name:
|
|
1051
|
+
name: p,
|
|
1052
1052
|
height: 20,
|
|
1053
1053
|
backgroundColor: "transparent",
|
|
1054
1054
|
backgroundGradient: Fe("transparent"),
|
|
1055
1055
|
visibility: _e()
|
|
1056
1056
|
};
|
|
1057
|
-
e.value.push(
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
},
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1063
|
-
const
|
|
1064
|
-
e.value.splice(
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1057
|
+
e.value.push(g);
|
|
1058
|
+
const w = e.value[e.value.length - 1];
|
|
1059
|
+
le(w), f || n("add-row-spacer");
|
|
1060
|
+
}, E = (f) => {
|
|
1061
|
+
const p = e.value.findIndex((g) => g.id === f);
|
|
1062
|
+
if (p !== -1) {
|
|
1063
|
+
const g = Xe(e.value[p], e.value);
|
|
1064
|
+
e.value.splice(p + 1, 0, g);
|
|
1065
|
+
const w = e.value[p + 1];
|
|
1066
|
+
le(w), n("duplicate-row");
|
|
1067
1067
|
return;
|
|
1068
1068
|
}
|
|
1069
|
-
for (const
|
|
1070
|
-
if (
|
|
1071
|
-
for (const
|
|
1072
|
-
const
|
|
1073
|
-
if (
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
const
|
|
1077
|
-
|
|
1069
|
+
for (const g of e.value)
|
|
1070
|
+
if (g.columns)
|
|
1071
|
+
for (const w of g.columns) {
|
|
1072
|
+
const $ = he(w), v = ve($, f);
|
|
1073
|
+
if (v) {
|
|
1074
|
+
const S = Xe(v.element, v.parentChildren);
|
|
1075
|
+
v.parentChildren.splice(v.index + 1, 0, S);
|
|
1076
|
+
const T = v.parentChildren[v.index + 1];
|
|
1077
|
+
le(T), n("duplicate-row");
|
|
1078
1078
|
return;
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
|
-
},
|
|
1082
|
-
const
|
|
1083
|
-
if (
|
|
1084
|
-
const
|
|
1085
|
-
e.value.splice(
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1081
|
+
}, x = (f) => {
|
|
1082
|
+
const p = e.value.findIndex((g) => g.id === f);
|
|
1083
|
+
if (p !== -1) {
|
|
1084
|
+
const g = Xe(e.value[p], e.value);
|
|
1085
|
+
e.value.splice(p + 1, 0, g);
|
|
1086
|
+
const w = e.value[p + 1];
|
|
1087
|
+
le(w), n("duplicate-row-spacer");
|
|
1088
1088
|
return;
|
|
1089
1089
|
}
|
|
1090
|
-
for (const
|
|
1091
|
-
if (
|
|
1092
|
-
for (const
|
|
1093
|
-
const
|
|
1094
|
-
if (
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1090
|
+
for (const g of e.value)
|
|
1091
|
+
if (g.columns)
|
|
1092
|
+
for (const w of g.columns) {
|
|
1093
|
+
const $ = he(w), v = ve($, f);
|
|
1094
|
+
if (v) {
|
|
1095
|
+
const S = Xe(v.element, v.parentChildren);
|
|
1096
|
+
v.parentChildren.splice(v.index + 1, 0, S);
|
|
1097
|
+
const T = v.parentChildren[v.index + 1];
|
|
1098
|
+
le(T), n("duplicate-row-spacer");
|
|
1099
1099
|
return;
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
},
|
|
1103
|
-
const
|
|
1104
|
-
if (!
|
|
1105
|
-
const
|
|
1106
|
-
if (
|
|
1107
|
-
const
|
|
1108
|
-
id: `${
|
|
1102
|
+
}, N = (f, p, g) => {
|
|
1103
|
+
const w = xe(e.value, f);
|
|
1104
|
+
if (!w) return;
|
|
1105
|
+
const $ = w.columns.find((k) => k.id === p);
|
|
1106
|
+
if (!$) return;
|
|
1107
|
+
const v = {
|
|
1108
|
+
id: `${Y()}`,
|
|
1109
1109
|
type: "component",
|
|
1110
|
-
componentType:
|
|
1111
|
-
props: JSON.parse(JSON.stringify(r[
|
|
1112
|
-
},
|
|
1113
|
-
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
},
|
|
1117
|
-
const
|
|
1118
|
-
if (!y) return;
|
|
1119
|
-
const $ = y.columns.find((B) => B.id === m);
|
|
1110
|
+
componentType: g,
|
|
1111
|
+
props: JSON.parse(JSON.stringify(r[g]))
|
|
1112
|
+
}, S = He($);
|
|
1113
|
+
S.push(v);
|
|
1114
|
+
const T = S[S.length - 1];
|
|
1115
|
+
le(T), t.value = T.id, n("add-component");
|
|
1116
|
+
}, j = (f, p, g, w) => {
|
|
1117
|
+
const $ = xe(e.value, f);
|
|
1120
1118
|
if (!$) return;
|
|
1121
|
-
const
|
|
1122
|
-
|
|
1119
|
+
const v = $.columns.find((M) => M.id === p);
|
|
1120
|
+
if (!v) return;
|
|
1121
|
+
const S = {
|
|
1122
|
+
id: `${Y()}`,
|
|
1123
1123
|
type: "component",
|
|
1124
|
-
componentType:
|
|
1125
|
-
props: JSON.parse(JSON.stringify(r[
|
|
1126
|
-
},
|
|
1127
|
-
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
},
|
|
1131
|
-
for (const
|
|
1132
|
-
if (
|
|
1133
|
-
for (const
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
1136
|
-
const [
|
|
1137
|
-
it(
|
|
1124
|
+
componentType: g,
|
|
1125
|
+
props: JSON.parse(JSON.stringify(r[g]))
|
|
1126
|
+
}, T = He(v);
|
|
1127
|
+
T.splice(w, 0, S);
|
|
1128
|
+
const k = T[w];
|
|
1129
|
+
le(k), t.value = k.id, n("add-component");
|
|
1130
|
+
}, u = (f) => {
|
|
1131
|
+
for (const p of e.value)
|
|
1132
|
+
if (p.columns)
|
|
1133
|
+
for (const g of p.columns) {
|
|
1134
|
+
const w = he(g), $ = ve(w, f);
|
|
1135
|
+
if ($) {
|
|
1136
|
+
const [v] = $.parentChildren.splice($.index, 1);
|
|
1137
|
+
it(v), t.value === f && (t.value = null), n("delete-component");
|
|
1138
1138
|
return;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
},
|
|
1142
|
-
for (const
|
|
1143
|
-
if (
|
|
1144
|
-
for (const
|
|
1145
|
-
const
|
|
1146
|
-
if (
|
|
1147
|
-
const { parentChildren:
|
|
1148
|
-
if (
|
|
1149
|
-
const [
|
|
1150
|
-
|
|
1141
|
+
}, d = (f, p) => {
|
|
1142
|
+
for (const g of e.value)
|
|
1143
|
+
if (g.columns)
|
|
1144
|
+
for (const w of g.columns) {
|
|
1145
|
+
const $ = he(w), v = ve($, f);
|
|
1146
|
+
if (v) {
|
|
1147
|
+
const { parentChildren: S, index: T } = v, k = p === "up" ? T - 1 : T + 1;
|
|
1148
|
+
if (k >= 0 && k < S.length) {
|
|
1149
|
+
const [M] = S.splice(T, 1);
|
|
1150
|
+
S.splice(k, 0, M), n("move-component");
|
|
1151
1151
|
}
|
|
1152
1152
|
return;
|
|
1153
1153
|
}
|
|
1154
1154
|
}
|
|
1155
|
-
}, s = (
|
|
1156
|
-
let
|
|
1157
|
-
for (const
|
|
1158
|
-
if (
|
|
1159
|
-
for (const
|
|
1160
|
-
const
|
|
1161
|
-
if (
|
|
1162
|
-
|
|
1155
|
+
}, s = (f, p, g, w) => {
|
|
1156
|
+
let $ = null;
|
|
1157
|
+
for (const T of e.value)
|
|
1158
|
+
if (T.columns) {
|
|
1159
|
+
for (const k of T.columns) {
|
|
1160
|
+
const M = he(k), O = ve(M, f);
|
|
1161
|
+
if (O) {
|
|
1162
|
+
$ = O.element, O.parentChildren.splice(O.index, 1);
|
|
1163
1163
|
break;
|
|
1164
1164
|
}
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if ($) break;
|
|
1167
1167
|
}
|
|
1168
|
-
if (
|
|
1169
|
-
const
|
|
1170
|
-
if (
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
},
|
|
1174
|
-
if (
|
|
1175
|
-
const
|
|
1176
|
-
if (
|
|
1177
|
-
for (const
|
|
1178
|
-
if (
|
|
1179
|
-
for (const
|
|
1180
|
-
const
|
|
1181
|
-
if (
|
|
1182
|
-
return
|
|
1168
|
+
if (!$) return;
|
|
1169
|
+
const v = xe(e.value, p);
|
|
1170
|
+
if (!v || !v.columns) return;
|
|
1171
|
+
const S = v.columns.find((T) => T.id === g);
|
|
1172
|
+
S && (He(S).splice(w, 0, $), n("move-component"));
|
|
1173
|
+
}, y = (f) => {
|
|
1174
|
+
if (f == null) return null;
|
|
1175
|
+
const p = String(f), g = oe.get(p);
|
|
1176
|
+
if (g && g.type === "component") return g;
|
|
1177
|
+
for (const w of e.value)
|
|
1178
|
+
if (w.columns)
|
|
1179
|
+
for (const $ of w.columns) {
|
|
1180
|
+
const v = he($), S = ve(v, f);
|
|
1181
|
+
if (S && S.element.type === "component")
|
|
1182
|
+
return oe.set(p, S.element), S.element;
|
|
1183
1183
|
}
|
|
1184
1184
|
return null;
|
|
1185
1185
|
};
|
|
@@ -1188,49 +1188,49 @@ var _e = () => ({
|
|
|
1188
1188
|
addNestedRow: o,
|
|
1189
1189
|
findRow: l,
|
|
1190
1190
|
deleteRow: c,
|
|
1191
|
-
moveRow:
|
|
1192
|
-
moveNestedRow:
|
|
1193
|
-
reorderRows:
|
|
1194
|
-
addSpacer:
|
|
1195
|
-
duplicateRow:
|
|
1196
|
-
duplicateRowSpacer:
|
|
1197
|
-
addComponent:
|
|
1198
|
-
addComponentAtIndex:
|
|
1199
|
-
deleteComponent:
|
|
1200
|
-
moveComponent:
|
|
1191
|
+
moveRow: m,
|
|
1192
|
+
moveNestedRow: b,
|
|
1193
|
+
reorderRows: h,
|
|
1194
|
+
addSpacer: R,
|
|
1195
|
+
duplicateRow: E,
|
|
1196
|
+
duplicateRowSpacer: x,
|
|
1197
|
+
addComponent: N,
|
|
1198
|
+
addComponentAtIndex: j,
|
|
1199
|
+
deleteComponent: u,
|
|
1200
|
+
moveComponent: d,
|
|
1201
1201
|
moveComponentBetweenColumns: s,
|
|
1202
|
-
findComponent:
|
|
1203
|
-
updateComponent: (
|
|
1204
|
-
const
|
|
1205
|
-
|
|
1202
|
+
findComponent: y,
|
|
1203
|
+
updateComponent: (f, p) => {
|
|
1204
|
+
const g = y(f);
|
|
1205
|
+
g && (Object.assign(g.props, p), a("update-component"));
|
|
1206
1206
|
},
|
|
1207
|
-
duplicateComponent: (
|
|
1208
|
-
for (const
|
|
1209
|
-
if (
|
|
1210
|
-
for (const
|
|
1211
|
-
const
|
|
1212
|
-
if (
|
|
1213
|
-
const
|
|
1214
|
-
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1207
|
+
duplicateComponent: (f) => {
|
|
1208
|
+
for (const p of e.value)
|
|
1209
|
+
if (p.columns)
|
|
1210
|
+
for (const g of p.columns) {
|
|
1211
|
+
const w = he(g), $ = ve(w, f);
|
|
1212
|
+
if ($) {
|
|
1213
|
+
const v = Sr($.element);
|
|
1214
|
+
$.parentChildren.splice($.index + 1, 0, v);
|
|
1215
|
+
const S = $.parentChildren[$.index + 1];
|
|
1216
|
+
le(S), t.value = S.id, n("duplicate-component");
|
|
1217
1217
|
return;
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
},
|
|
1221
|
-
rebuildIdRegistry: () =>
|
|
1221
|
+
rebuildIdRegistry: () => nn(e.value)
|
|
1222
1222
|
};
|
|
1223
|
-
},
|
|
1224
|
-
const t =
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1227
|
-
state:
|
|
1228
|
-
action:
|
|
1223
|
+
}, ne = null, wr = 600, Ct = (e) => JSON.parse(JSON.stringify(e)), xr = () => {
|
|
1224
|
+
const t = L([]), r = L(-1), n = L(0), a = Ce(() => r.value > 0), i = Ce(() => r.value < t.value.length - 1), o = Ce(() => `${r.value + 1} / ${t.value.length}`), l = (R, E = "change", x = !1) => {
|
|
1225
|
+
const N = () => {
|
|
1226
|
+
ne = null, r.value < t.value.length - 1 && (t.value = t.value.slice(0, r.value + 1)), t.value.push({
|
|
1227
|
+
state: Ct(R),
|
|
1228
|
+
action: E,
|
|
1229
1229
|
timestamp: Date.now()
|
|
1230
1230
|
}), r.value++, t.value.length > 100 && (t.value.shift(), r.value--), n.value++;
|
|
1231
1231
|
};
|
|
1232
|
-
|
|
1233
|
-
}, c = () => a.value ? (
|
|
1232
|
+
x ? (ne && (clearTimeout(ne), ne = null), N()) : (ne && clearTimeout(ne), ne = setTimeout(N, wr));
|
|
1233
|
+
}, c = () => a.value ? (ne && (clearTimeout(ne), ne = null), r.value--, n.value++, Ct(t.value[r.value].state)) : null, m = () => i.value ? (ne && (clearTimeout(ne), ne = null), r.value++, n.value++, Ct(t.value[r.value].state)) : null, b = () => {
|
|
1234
1234
|
t.value = [], r.value = -1, n.value++;
|
|
1235
1235
|
};
|
|
1236
1236
|
return {
|
|
@@ -1239,87 +1239,87 @@ var _e = () => ({
|
|
|
1239
1239
|
historyStatus: o,
|
|
1240
1240
|
saveState: l,
|
|
1241
1241
|
undo: c,
|
|
1242
|
-
redo:
|
|
1243
|
-
clearHistory:
|
|
1244
|
-
initHistory: (
|
|
1245
|
-
|
|
1242
|
+
redo: m,
|
|
1243
|
+
clearHistory: b,
|
|
1244
|
+
initHistory: (R) => {
|
|
1245
|
+
b(), l(R, "initial");
|
|
1246
1246
|
},
|
|
1247
1247
|
version: n
|
|
1248
1248
|
};
|
|
1249
|
-
},
|
|
1250
|
-
const { saveState: e, undo: t, redo: r, canUndo: n, canRedo: a, historyStatus: i, initHistory: o, version: l } =
|
|
1249
|
+
}, Cr = () => {
|
|
1250
|
+
const { saveState: e, undo: t, redo: r, canUndo: n, canRedo: a, historyStatus: i, initHistory: o, version: l } = xr();
|
|
1251
1251
|
return {
|
|
1252
|
-
getCurrentState: (
|
|
1253
|
-
rows:
|
|
1254
|
-
canvasStyles:
|
|
1252
|
+
getCurrentState: (x, N) => ({
|
|
1253
|
+
rows: x.value,
|
|
1254
|
+
canvasStyles: N.value
|
|
1255
1255
|
}),
|
|
1256
|
-
restoreState: (
|
|
1257
|
-
if (!
|
|
1258
|
-
|
|
1259
|
-
const
|
|
1260
|
-
for (const
|
|
1261
|
-
if (
|
|
1262
|
-
for (const
|
|
1263
|
-
|
|
1256
|
+
restoreState: (x, N, j, u, d, s) => {
|
|
1257
|
+
if (!x) return;
|
|
1258
|
+
N.value = x.rows, j.value = x.canvasStyles;
|
|
1259
|
+
const y = /* @__PURE__ */ new Set(), C = (_) => {
|
|
1260
|
+
for (const f of _)
|
|
1261
|
+
if (f?.id && (y.add(String(f.id)), f.type === "row" && Array.isArray(f.columns)))
|
|
1262
|
+
for (const p of f.columns)
|
|
1263
|
+
p?.id && y.add(String(p.id)), C(p.children ?? p.components ?? []);
|
|
1264
1264
|
};
|
|
1265
|
-
if (C(
|
|
1266
|
-
const { rowId: _, columnId:
|
|
1267
|
-
(!
|
|
1265
|
+
if (C(x.rows), u.value && !y.has(String(u.value)) && (u.value = null), d.value && !y.has(String(d.value)) && (d.value = null), s.value) {
|
|
1266
|
+
const { rowId: _, columnId: f } = s.value;
|
|
1267
|
+
(!y.has(String(_)) || !y.has(String(f))) && (s.value = null);
|
|
1268
1268
|
}
|
|
1269
1269
|
},
|
|
1270
|
-
saveToHistory: (
|
|
1271
|
-
e(
|
|
1270
|
+
saveToHistory: (x, N = "change", j = !1) => {
|
|
1271
|
+
e(x(), N, j);
|
|
1272
1272
|
},
|
|
1273
|
-
undo: (
|
|
1274
|
-
const
|
|
1275
|
-
return
|
|
1273
|
+
undo: (x) => {
|
|
1274
|
+
const N = t();
|
|
1275
|
+
return N ? (x(N), N) : null;
|
|
1276
1276
|
},
|
|
1277
|
-
redo: (
|
|
1278
|
-
const
|
|
1279
|
-
return
|
|
1277
|
+
redo: (x) => {
|
|
1278
|
+
const N = r();
|
|
1279
|
+
return N ? (x(N), N) : null;
|
|
1280
1280
|
},
|
|
1281
1281
|
canUndo: n,
|
|
1282
1282
|
canRedo: a,
|
|
1283
1283
|
historyStatus: i,
|
|
1284
|
-
initialize: (
|
|
1285
|
-
o(
|
|
1284
|
+
initialize: (x) => {
|
|
1285
|
+
o(x);
|
|
1286
1286
|
},
|
|
1287
1287
|
version: l
|
|
1288
1288
|
};
|
|
1289
|
-
},
|
|
1289
|
+
}, _r = (e) => e == null, Pt = (e) => {
|
|
1290
1290
|
if (!e || typeof e != "object") return !0;
|
|
1291
1291
|
const t = e;
|
|
1292
1292
|
return Array.isArray(t.rules) && t.rules.length > 0 ? !1 : t.enabled === !1 && t.match === "all" && t.rules.length === 0;
|
|
1293
|
-
},
|
|
1293
|
+
}, _n = (e) => {
|
|
1294
1294
|
if (!e || typeof e != "object") return !0;
|
|
1295
1295
|
const t = e;
|
|
1296
1296
|
return !t.sides && t.width === 0 && t.style === "solid" && t.color === "#000000" && (t.radius === void 0 || t.radius === 0);
|
|
1297
|
-
},
|
|
1297
|
+
}, qe = (e) => !e || typeof e != "object" ? !0 : e.useGradient === !1, rn = (e) => e === !1, Tr = (e) => {
|
|
1298
1298
|
if (!e || typeof e != "object") return !0;
|
|
1299
1299
|
const t = e;
|
|
1300
1300
|
return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
|
|
1301
|
-
},
|
|
1301
|
+
}, dt = (e) => {
|
|
1302
1302
|
if (!e || typeof e != "object") return !0;
|
|
1303
1303
|
const t = e;
|
|
1304
1304
|
return t.top === 0 && t.right === 0 && t.bottom === 0 && t.left === 0;
|
|
1305
|
-
},
|
|
1305
|
+
}, Ar = (e) => e === 0, Rr = (e) => e == null || e === "", Er = (e) => {
|
|
1306
1306
|
if (!Array.isArray(e)) return;
|
|
1307
1307
|
const t = e.filter((r) => !(r.enabled === !0 && r.link === ""));
|
|
1308
1308
|
if (t.length !== 0)
|
|
1309
1309
|
return t;
|
|
1310
|
-
},
|
|
1310
|
+
}, Mr = (e) => {
|
|
1311
1311
|
const t = {};
|
|
1312
1312
|
for (const [r, n] of Object.entries(e))
|
|
1313
|
-
|
|
1313
|
+
_r(n) || r === "backgroundGradient" && qe(n) || (t[r] = n);
|
|
1314
1314
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
1315
|
-
},
|
|
1315
|
+
}, Ir = (e) => {
|
|
1316
1316
|
const t = { ...e.props };
|
|
1317
1317
|
if (e.props.mobile && typeof e.props.mobile == "object") {
|
|
1318
|
-
const r =
|
|
1318
|
+
const r = Mr(e.props.mobile);
|
|
1319
1319
|
r ? t.mobile = r : delete t.mobile;
|
|
1320
1320
|
}
|
|
1321
|
-
if (Pt(e.props.visibility) && delete t.visibility,
|
|
1322
|
-
const r =
|
|
1321
|
+
if (Pt(e.props.visibility) && delete t.visibility, rn(e.props.desktopHide) && delete t.desktopHide, rn(e.props.mobileHide) && delete t.mobileHide, Tr(e.props.margin) && delete t.margin, dt(e.props.padding) && delete t.padding, qe(e.props.backgroundGradient) && delete t.backgroundGradient, Ar(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 && Rr(e.props.icon) && (delete t.icon, delete t.iconAlt, delete t.iconPosition, delete t.iconSize, delete t.iconGap), "platforms" in e.props) {
|
|
1322
|
+
const r = Er(e.props.platforms);
|
|
1323
1323
|
r === void 0 ? delete t.platforms : t.platforms = r;
|
|
1324
1324
|
}
|
|
1325
1325
|
return {
|
|
@@ -1328,19 +1328,19 @@ var _e = () => ({
|
|
|
1328
1328
|
...e.componentType !== void 0 && { componentType: e.componentType },
|
|
1329
1329
|
props: t
|
|
1330
1330
|
};
|
|
1331
|
-
},
|
|
1331
|
+
}, Nr = (e) => e.type === "component" ? Ir(e) : Tn(e), Br = (e) => {
|
|
1332
1332
|
const { id: t, width: r, children: n, components: a, ...i } = e, o = { ...i };
|
|
1333
|
-
|
|
1334
|
-
const l = (n ?? a ?? []).map(
|
|
1333
|
+
_n(e.border) && delete o.border, qe(e.backgroundGradient) && delete o.backgroundGradient, dt(e.padding) && delete o.padding, e.backgroundImage || (delete o.backgroundImage, delete o.backgroundSize, delete o.backgroundPosition, delete o.backgroundRepeat);
|
|
1334
|
+
const l = (n ?? a ?? []).map(Nr);
|
|
1335
1335
|
return {
|
|
1336
1336
|
id: t,
|
|
1337
1337
|
width: r,
|
|
1338
1338
|
...o,
|
|
1339
1339
|
children: l
|
|
1340
1340
|
};
|
|
1341
|
-
},
|
|
1341
|
+
}, Or = (e) => {
|
|
1342
1342
|
const { id: t, type: r, ...n } = e, a = { ...n };
|
|
1343
|
-
Pt(e.visibility) && delete a.visibility,
|
|
1343
|
+
Pt(e.visibility) && delete a.visibility, qe(e.backgroundGradient) && delete a.backgroundGradient;
|
|
1344
1344
|
const { height: i, ...o } = a;
|
|
1345
1345
|
return {
|
|
1346
1346
|
id: t,
|
|
@@ -1348,20 +1348,20 @@ var _e = () => ({
|
|
|
1348
1348
|
height: i,
|
|
1349
1349
|
...o
|
|
1350
1350
|
};
|
|
1351
|
-
},
|
|
1352
|
-
if (e.type === "row-spacer") return
|
|
1351
|
+
}, Tn = (e) => {
|
|
1352
|
+
if (e.type === "row-spacer") return Or(e);
|
|
1353
1353
|
const { id: t, type: r, name: n, columns: a, ...i } = e, o = { ...i };
|
|
1354
|
-
return Pt(e.visibility) && delete o.visibility,
|
|
1354
|
+
return Pt(e.visibility) && delete o.visibility, _n(e.border) && delete o.border, qe(e.backgroundGradient) && delete o.backgroundGradient, dt(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, {
|
|
1355
1355
|
id: t,
|
|
1356
1356
|
type: r,
|
|
1357
1357
|
...n !== void 0 && { name: n },
|
|
1358
1358
|
...o,
|
|
1359
|
-
columns: a?.map(
|
|
1359
|
+
columns: a?.map(Br)
|
|
1360
1360
|
};
|
|
1361
|
-
},
|
|
1361
|
+
}, An = (e) => {
|
|
1362
1362
|
const t = { ...e };
|
|
1363
|
-
return e.bodyBackgroundImage || (delete t.bodyBackgroundImage, delete t.bodyBackgroundSize, delete t.bodyBackgroundPosition, delete t.bodyBackgroundRepeat),
|
|
1364
|
-
},
|
|
1363
|
+
return e.bodyBackgroundImage || (delete t.bodyBackgroundImage, delete t.bodyBackgroundSize, delete t.bodyBackgroundPosition, delete t.bodyBackgroundRepeat), dt(e.padding) && delete t.padding, t;
|
|
1364
|
+
}, Rn = (e) => e.map(Tn), jr = {
|
|
1365
1365
|
backgroundColor: "#ffffff",
|
|
1366
1366
|
backgroundGradient: {
|
|
1367
1367
|
useGradient: !1,
|
|
@@ -1398,7 +1398,7 @@ var _e = () => ({
|
|
|
1398
1398
|
gap: 12,
|
|
1399
1399
|
mobileStack: !0,
|
|
1400
1400
|
visibility: _e()
|
|
1401
|
-
},
|
|
1401
|
+
}, zr = {
|
|
1402
1402
|
backgroundColor: "transparent",
|
|
1403
1403
|
backgroundGradient: {
|
|
1404
1404
|
useGradient: !1,
|
|
@@ -1416,7 +1416,7 @@ var _e = () => ({
|
|
|
1416
1416
|
}
|
|
1417
1417
|
},
|
|
1418
1418
|
visibility: _e()
|
|
1419
|
-
},
|
|
1419
|
+
}, Lr = {
|
|
1420
1420
|
backgroundColor: "transparent",
|
|
1421
1421
|
backgroundGradient: {
|
|
1422
1422
|
useGradient: !1,
|
|
@@ -1467,22 +1467,22 @@ var _e = () => ({
|
|
|
1467
1467
|
left: 0
|
|
1468
1468
|
},
|
|
1469
1469
|
mobileBreakpoint: 600
|
|
1470
|
-
},
|
|
1471
|
-
const r =
|
|
1470
|
+
}, Dr = (e) => JSON.parse(JSON.stringify(e)), je = (e, t) => {
|
|
1471
|
+
const r = Dr(e);
|
|
1472
1472
|
for (const n of Object.keys(t)) {
|
|
1473
1473
|
const a = t[n], i = e[n];
|
|
1474
1474
|
a != null && (typeof a == "object" && !Array.isArray(a) && typeof i == "object" && i !== null && !Array.isArray(i) ? r[n] = je(i, a) : r[n] = a);
|
|
1475
1475
|
}
|
|
1476
1476
|
return r;
|
|
1477
|
-
},
|
|
1478
|
-
const { defaultProps: t } =
|
|
1477
|
+
}, an = (e) => {
|
|
1478
|
+
const { defaultProps: t } = zt(), r = e.componentType ?? e.type, n = t[r];
|
|
1479
1479
|
if (!n)
|
|
1480
1480
|
return console.warn(`[Hydrator] Unknown component type "${r}" — skipping hydration.`), e;
|
|
1481
1481
|
const a = je(n, e.props);
|
|
1482
1482
|
if (n.mobile && typeof n.mobile == "object" && (a.mobile = {
|
|
1483
1483
|
...n.mobile,
|
|
1484
1484
|
...a.mobile ?? {}
|
|
1485
|
-
}, a.mobile && !a.mobile.backgroundGradient && (a.mobile.backgroundGradient = n.mobile.backgroundGradient)), a.visibility = a.visibility ?? _e(), a.desktopHide = a.desktopHide ??
|
|
1485
|
+
}, a.mobile && !a.mobile.backgroundGradient && (a.mobile.backgroundGradient = n.mobile.backgroundGradient)), a.visibility = a.visibility ?? _e(), a.desktopHide = a.desktopHide ?? Mt().desktopHide, a.mobileHide = a.mobileHide ?? Mt().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) {
|
|
1486
1486
|
const i = a.backgroundColor;
|
|
1487
1487
|
i && (a.backgroundGradient.solid = i);
|
|
1488
1488
|
}
|
|
@@ -1492,36 +1492,36 @@ var _e = () => ({
|
|
|
1492
1492
|
componentType: r,
|
|
1493
1493
|
props: a
|
|
1494
1494
|
};
|
|
1495
|
-
},
|
|
1496
|
-
if (e.type === "component") return
|
|
1497
|
-
const { defaultProps: t } =
|
|
1498
|
-
return e.type in t ?
|
|
1495
|
+
}, Fr = (e) => {
|
|
1496
|
+
if (e.type === "component") return an(e);
|
|
1497
|
+
const { defaultProps: t } = zt();
|
|
1498
|
+
return e.type in t ? an({
|
|
1499
1499
|
...e,
|
|
1500
1500
|
type: "component",
|
|
1501
1501
|
componentType: e.type
|
|
1502
|
-
}) :
|
|
1503
|
-
}, Fr = (e) => {
|
|
1504
|
-
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: l, ...c } = zr;
|
|
1505
|
-
let d = je(c, a);
|
|
1506
|
-
return i ? (d.backgroundColor = e.backgroundColor, d.backgroundGradient = e.backgroundGradient) : (d.backgroundColor = o, d.backgroundGradient = l), e.backgroundImage || (d.backgroundImage = "", d.backgroundSize = "cover", d.backgroundPosition = "center center", d.backgroundRepeat = "no-repeat"), {
|
|
1507
|
-
...d,
|
|
1508
|
-
children: t.map(Dr)
|
|
1509
|
-
};
|
|
1502
|
+
}) : En(e);
|
|
1510
1503
|
}, Hr = (e) => {
|
|
1511
|
-
const t =
|
|
1504
|
+
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: l, ...c } = Lr;
|
|
1505
|
+
let m = je(c, a);
|
|
1506
|
+
return i ? (m.backgroundColor = e.backgroundColor, m.backgroundGradient = e.backgroundGradient) : (m.backgroundColor = o, m.backgroundGradient = l), e.backgroundImage || (m.backgroundImage = "", m.backgroundSize = "cover", m.backgroundPosition = "center center", m.backgroundRepeat = "no-repeat"), {
|
|
1507
|
+
...m,
|
|
1508
|
+
children: t.map(Fr)
|
|
1509
|
+
};
|
|
1510
|
+
}, Ur = (e) => {
|
|
1511
|
+
const t = je(zr, e);
|
|
1512
1512
|
return t.backgroundColor === void 0 && (t.backgroundColor = "transparent"), t;
|
|
1513
|
-
},
|
|
1514
|
-
if (e.type === "row-spacer") return
|
|
1515
|
-
const { columns: t, ...r } = e, n = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: a, backgroundGradient: i, ...o } =
|
|
1513
|
+
}, En = (e) => {
|
|
1514
|
+
if (e.type === "row-spacer") return Ur(e);
|
|
1515
|
+
const { columns: t, ...r } = e, n = e.backgroundColor !== void 0 || e.backgroundGradient !== void 0 || e.backgroundImage !== void 0, { backgroundColor: a, backgroundGradient: i, ...o } = jr;
|
|
1516
1516
|
let l = je(o, r);
|
|
1517
|
-
return n ? (l.backgroundColor = e.backgroundColor, l.backgroundGradient = e.backgroundGradient) : (l.backgroundColor = a, l.backgroundGradient = i), e.backgroundImage || (l.backgroundImage = "", l.backgroundSize = "cover", l.backgroundPosition = "center center", l.backgroundRepeat = "no-repeat"), l.minHeight === void 0 && (l.minHeight = 0), Array.isArray(t) && (l.columns = t.map(
|
|
1518
|
-
},
|
|
1517
|
+
return n ? (l.backgroundColor = e.backgroundColor, l.backgroundGradient = e.backgroundGradient) : (l.backgroundColor = a, l.backgroundGradient = i), e.backgroundImage || (l.backgroundImage = "", l.backgroundSize = "cover", l.backgroundPosition = "center center", l.backgroundRepeat = "no-repeat"), l.minHeight === void 0 && (l.minHeight = 0), Array.isArray(t) && (l.columns = t.map(Hr)), l;
|
|
1518
|
+
}, lt = (e) => {
|
|
1519
1519
|
const t = je(Pr, e);
|
|
1520
1520
|
return e.bodyBackgroundImage || (t.bodyBackgroundImage = "", t.bodyBackgroundSize = "cover", t.bodyBackgroundPosition = "center center", t.bodyBackgroundRepeat = "no-repeat"), t;
|
|
1521
|
-
},
|
|
1521
|
+
}, ct = (e) => e.map(En), ge = "maildeno:autosave", It = "1.0", on = (e, t, r = null, n, a) => {
|
|
1522
1522
|
const i = Date.now();
|
|
1523
1523
|
return {
|
|
1524
|
-
schemaVersion:
|
|
1524
|
+
schemaVersion: It,
|
|
1525
1525
|
templateId: r,
|
|
1526
1526
|
expiresAt: i + 2592e6,
|
|
1527
1527
|
touchedAt: i,
|
|
@@ -1529,33 +1529,33 @@ var _e = () => ({
|
|
|
1529
1529
|
...n !== void 0 && { name: n },
|
|
1530
1530
|
...a !== void 0 && { tags: a },
|
|
1531
1531
|
content: {
|
|
1532
|
-
rows:
|
|
1533
|
-
canvas:
|
|
1532
|
+
rows: Rn(e),
|
|
1533
|
+
canvas: An(t)
|
|
1534
1534
|
}
|
|
1535
1535
|
};
|
|
1536
|
-
},
|
|
1537
|
-
const e =
|
|
1536
|
+
}, _t = null, Jr = () => {
|
|
1537
|
+
const e = L("idle"), t = L(null);
|
|
1538
1538
|
return {
|
|
1539
|
-
saveToLocal: (l, c,
|
|
1539
|
+
saveToLocal: (l, c, m = null, b, h) => {
|
|
1540
1540
|
e.value = "saving";
|
|
1541
|
-
const
|
|
1541
|
+
const R = () => {
|
|
1542
1542
|
try {
|
|
1543
|
-
const
|
|
1544
|
-
localStorage.setItem(ge, JSON.stringify(
|
|
1543
|
+
const E = on(l, c, m, b, h);
|
|
1544
|
+
localStorage.setItem(ge, JSON.stringify(E)), t.value = /* @__PURE__ */ new Date(), _t && clearTimeout(_t), e.value = "saved", _t = setTimeout(() => {
|
|
1545
1545
|
e.value = "idle";
|
|
1546
1546
|
}, 2500);
|
|
1547
|
-
} catch (
|
|
1548
|
-
console.error("[AutoSave] Failed to write to localStorage:",
|
|
1547
|
+
} catch (E) {
|
|
1548
|
+
console.error("[AutoSave] Failed to write to localStorage:", E), e.value = "error", setTimeout(() => {
|
|
1549
1549
|
e.value = "idle";
|
|
1550
1550
|
}, 3e3);
|
|
1551
1551
|
}
|
|
1552
1552
|
};
|
|
1553
|
-
typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback(
|
|
1553
|
+
typeof window < "u" && "requestIdleCallback" in window ? window.requestIdleCallback(R, { timeout: 2e3 }) : setTimeout(R, 0);
|
|
1554
1554
|
},
|
|
1555
|
-
flushSave: (l, c,
|
|
1555
|
+
flushSave: (l, c, m = null, b, h) => {
|
|
1556
1556
|
try {
|
|
1557
|
-
const
|
|
1558
|
-
localStorage.setItem(ge, JSON.stringify(
|
|
1557
|
+
const R = on(l, c, m, b, h);
|
|
1558
|
+
localStorage.setItem(ge, JSON.stringify(R)), t.value = /* @__PURE__ */ new Date();
|
|
1559
1559
|
} catch {
|
|
1560
1560
|
}
|
|
1561
1561
|
},
|
|
@@ -1564,9 +1564,9 @@ var _e = () => ({
|
|
|
1564
1564
|
const l = localStorage.getItem(ge);
|
|
1565
1565
|
if (!l) return null;
|
|
1566
1566
|
const c = JSON.parse(l);
|
|
1567
|
-
return c.schemaVersion !==
|
|
1568
|
-
rows:
|
|
1569
|
-
canvas:
|
|
1567
|
+
return c.schemaVersion !== It ? (console.warn(`[AutoSave] Schema mismatch (stored=${c.schemaVersion}, current=${It}). Discarding.`), localStorage.removeItem(ge), null) : Date.now() > c.expiresAt ? (console.info("[AutoSave] Draft expired. Clearing."), localStorage.removeItem(ge), null) : !c.content?.rows || !c.content?.canvas || !Array.isArray(c.content.rows) ? (console.warn("[AutoSave] Malformed payload. Discarding."), localStorage.removeItem(ge), null) : {
|
|
1568
|
+
rows: ct(c.content.rows),
|
|
1569
|
+
canvas: lt(c.content.canvas),
|
|
1570
1570
|
updatedAt: c.updatedAt,
|
|
1571
1571
|
templateId: c.templateId ?? null,
|
|
1572
1572
|
...c.name !== void 0 && { name: c.name },
|
|
@@ -1583,8 +1583,8 @@ var _e = () => ({
|
|
|
1583
1583
|
try {
|
|
1584
1584
|
const c = localStorage.getItem(ge);
|
|
1585
1585
|
if (!c) return !1;
|
|
1586
|
-
const
|
|
1587
|
-
return !(Date.now() >
|
|
1586
|
+
const m = JSON.parse(c);
|
|
1587
|
+
return !(Date.now() > m.expiresAt || l !== void 0 && m.templateId !== l);
|
|
1588
1588
|
} catch {
|
|
1589
1589
|
return !1;
|
|
1590
1590
|
}
|
|
@@ -1592,12 +1592,12 @@ var _e = () => ({
|
|
|
1592
1592
|
saveStatus: e,
|
|
1593
1593
|
lastSaved: t
|
|
1594
1594
|
};
|
|
1595
|
-
},
|
|
1595
|
+
}, Dt = (e) => !e || /\{\{.*?\}\}/.test(e) || /^(https?:\/\/|mailto:|tel:)/i.test(e) ? e : `https://${e}`, Ft = (e) => e == null ? "" : String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), Ht = (e) => e == null ? "" : String(e).replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), Gr = (e) => {
|
|
1596
1596
|
if (e == null) return "";
|
|
1597
1597
|
const t = String(e);
|
|
1598
1598
|
return t.indexOf(""") === -1 ? t : t.replace(/style="([^"]*)"/g, (r, n) => `style="${n.replace(/"/g, "'")}"`);
|
|
1599
|
-
},
|
|
1600
|
-
function
|
|
1599
|
+
}, Ut = /* @__PURE__ */ new Map();
|
|
1600
|
+
function oo(e, t) {
|
|
1601
1601
|
const r = typeof e == "string" ? t : e;
|
|
1602
1602
|
if (!r) {
|
|
1603
1603
|
console.error("[maildeno-editor] registerBlock was called without a definition.");
|
|
@@ -1608,25 +1608,25 @@ function ro(e, t) {
|
|
|
1608
1608
|
console.error("[maildeno-editor] registerBlock needs a name — either as the first argument or as `name` on the definition.");
|
|
1609
1609
|
return;
|
|
1610
1610
|
}
|
|
1611
|
-
|
|
1611
|
+
Ut.set(n, {
|
|
1612
1612
|
...r,
|
|
1613
1613
|
name: n
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1617
|
-
return
|
|
1616
|
+
function Jt(e) {
|
|
1617
|
+
return Ut.get(e);
|
|
1618
1618
|
}
|
|
1619
|
-
function
|
|
1620
|
-
return
|
|
1619
|
+
function io() {
|
|
1620
|
+
return Ut;
|
|
1621
1621
|
}
|
|
1622
|
-
var
|
|
1622
|
+
var qr = () => {
|
|
1623
1623
|
const e = (n, a) => {
|
|
1624
1624
|
if (!(n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2)) {
|
|
1625
|
-
const
|
|
1626
|
-
return !
|
|
1625
|
+
const h = n && typeof n == "object" && n.solid ? n.solid : a;
|
|
1626
|
+
return !h || h === "transparent" ? "" : `background-color:${h};`;
|
|
1627
1627
|
}
|
|
1628
|
-
const { type: i, direction: o, colors: l } = n.gradient, c = l.map((
|
|
1629
|
-
return `${
|
|
1628
|
+
const { type: i, direction: o, colors: l } = n.gradient, c = l.map((h) => `${h.color} ${h.position}%`).join(", "), m = i === "radial" ? `radial-gradient(circle at center, ${c})` : `linear-gradient(${o}, ${c})`, b = n.solid || a || "";
|
|
1629
|
+
return `${b && b !== "transparent" ? `background-color:${b};` : ""}background:${m};`;
|
|
1630
1630
|
}, t = (n, a) => n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2 ? {
|
|
1631
1631
|
vmlOpen: `
|
|
1632
1632
|
<!--[if mso]>
|
|
@@ -1647,111 +1647,111 @@ var Gr = () => {
|
|
|
1647
1647
|
return { generateHTMLComponent: (n) => {
|
|
1648
1648
|
const a = n.componentType ?? n.type, { props: i } = n;
|
|
1649
1649
|
let o = "";
|
|
1650
|
-
const l = `eb-${n.id}`, c = i.margin ? `margin:${i.margin?.top ?? 0}px ${i.margin?.right ?? 0}px ${i.margin?.bottom ?? 0}px ${i.margin?.left ?? 0}px;` : "",
|
|
1651
|
-
const
|
|
1652
|
-
return
|
|
1653
|
-
},
|
|
1654
|
-
return
|
|
1650
|
+
const l = `eb-${n.id}`, c = i.margin ? `margin:${i.margin?.top ?? 0}px ${i.margin?.right ?? 0}px ${i.margin?.bottom ?? 0}px ${i.margin?.left ?? 0}px;` : "", m = i.padding ? `padding:${i.padding?.top ?? 0}px ${i.padding?.right ?? 0}px ${i.padding?.bottom ?? 0}px ${i.padding?.left ?? 0}px;` : "", b = (R, E, x) => {
|
|
1651
|
+
const N = [x ? `${l}-${x}` : l];
|
|
1652
|
+
return R && N.push("desktop-hide"), E && N.push("mobile-hide"), N.join(" ");
|
|
1653
|
+
}, h = Jt(a);
|
|
1654
|
+
return h ? h.renderEmail.html(i, {
|
|
1655
1655
|
uid: l,
|
|
1656
1656
|
marginStyle: c,
|
|
1657
|
-
paddingStyle:
|
|
1658
|
-
escapeHtml:
|
|
1659
|
-
escapeAttr:
|
|
1660
|
-
safeUrl:
|
|
1657
|
+
paddingStyle: m,
|
|
1658
|
+
escapeHtml: Ft,
|
|
1659
|
+
escapeAttr: Ht,
|
|
1660
|
+
safeUrl: Dt,
|
|
1661
1661
|
resolveBgCss: e,
|
|
1662
1662
|
resolveBgVml: t,
|
|
1663
|
-
getResponsiveClasses:
|
|
1663
|
+
getResponsiveClasses: b,
|
|
1664
1664
|
react: null
|
|
1665
1665
|
}) : o;
|
|
1666
1666
|
} };
|
|
1667
|
-
},
|
|
1667
|
+
}, Mn = (e) => e.replace(/<br\s*\/?>/gi, "<br />"), pt = (e) => e.split(",").map((t) => t.trim().replace(/^'+|'+$/g, "").trim()).join(", "), In = (e) => e.replace(/font-family\s*:\s*([^;]+)/gi, (t, r) => `font-family:${pt(r)}`), Wr = (e) => e.trim().replace(/-([a-z])/g, (t, r) => r.toUpperCase()), Vr = (e) => e.split(";").map((t) => t.trim()).filter(Boolean).map((t) => {
|
|
1668
1668
|
const r = t.indexOf(":");
|
|
1669
1669
|
if (r < 0) return null;
|
|
1670
|
-
const n = t.slice(0, r).trim(), a = t.slice(r + 1).trim(), i = n.toLowerCase() === "font-family" ?
|
|
1671
|
-
return `${
|
|
1672
|
-
}).filter((t) => t !== null).join(", "),
|
|
1670
|
+
const n = t.slice(0, r).trim(), a = t.slice(r + 1).trim(), i = n.toLowerCase() === "font-family" ? pt(a) : In(a);
|
|
1671
|
+
return `${Wr(n)}: "${i}"`;
|
|
1672
|
+
}).filter((t) => t !== null).join(", "), Kr = (e) => e.replace(/\bcontenteditable\s*=\s*(["']?)([^"'\s>]+)\1/gi, (t, r, n) => {
|
|
1673
1673
|
const a = n.toLowerCase();
|
|
1674
1674
|
return a === "true" || a === "false" ? `contentEditable={${a}}` : `contentEditable="${n}"`;
|
|
1675
|
-
}),
|
|
1676
|
-
let t =
|
|
1677
|
-
return t =
|
|
1678
|
-
},
|
|
1675
|
+
}), Yr = (e) => {
|
|
1676
|
+
let t = Gr(e);
|
|
1677
|
+
return t = Mn(t), t = Kr(t), t = t.replace(/\bstyle="([^"]*)"/g, (r, n) => `style={{ ${Vr(n)} }}`), t;
|
|
1678
|
+
}, Xr = () => {
|
|
1679
1679
|
const e = (r, n) => {
|
|
1680
1680
|
if (!(r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2)) {
|
|
1681
|
-
const
|
|
1682
|
-
return !
|
|
1681
|
+
const b = r && typeof r == "object" && r.solid ? r.solid : n;
|
|
1682
|
+
return !b || b === "transparent" ? "" : `background-color:${b};`;
|
|
1683
1683
|
}
|
|
1684
|
-
const { type: a, direction: i, colors: o } = r.gradient, l = o.map((
|
|
1685
|
-
return `${
|
|
1684
|
+
const { type: a, direction: i, colors: o } = r.gradient, l = o.map((b) => `${b.color} ${b.position}%`).join(", "), c = a === "radial" ? `radial-gradient(circle at center, ${l})` : `linear-gradient(${i}, ${l})`, m = r.solid || n || "";
|
|
1685
|
+
return `${m && m !== "transparent" ? `background-color:${m};` : ""}background:${c};`;
|
|
1686
1686
|
};
|
|
1687
1687
|
return { generateReactEmailComponent: (r) => {
|
|
1688
1688
|
const n = r.componentType ?? r.type, { props: a } = r;
|
|
1689
1689
|
let i = "";
|
|
1690
|
-
const o = `eb-${r.id}`, l = a.margin ? `margin:${a.margin?.top ?? 0}px ${a.margin?.right ?? 0}px ${a.margin?.bottom ?? 0}px ${a.margin?.left ?? 0}px;` : "", c = a.padding ? `padding:${a.padding?.top ?? 0}px ${a.padding?.right ?? 0}px ${a.padding?.bottom ?? 0}px ${a.padding?.left ?? 0}px;` : "",
|
|
1690
|
+
const o = `eb-${r.id}`, l = a.margin ? `margin:${a.margin?.top ?? 0}px ${a.margin?.right ?? 0}px ${a.margin?.bottom ?? 0}px ${a.margin?.left ?? 0}px;` : "", c = a.padding ? `padding:${a.padding?.top ?? 0}px ${a.padding?.right ?? 0}px ${a.padding?.bottom ?? 0}px ${a.padding?.left ?? 0}px;` : "", m = (R, E) => R?.useGradient === !0 && Array.isArray(R?.gradient?.colors) && R.gradient.colors.length >= 2 ? {
|
|
1691
1691
|
vmlOpen: "",
|
|
1692
1692
|
vmlClose: ""
|
|
1693
1693
|
} : {
|
|
1694
1694
|
vmlOpen: "",
|
|
1695
1695
|
vmlClose: ""
|
|
1696
|
-
},
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1699
|
-
},
|
|
1700
|
-
return
|
|
1696
|
+
}, b = (R, E, x) => {
|
|
1697
|
+
const N = [x ? `${o}-${x}` : o];
|
|
1698
|
+
return R && N.push("desktop-hide"), E && N.push("mobile-hide"), N.join(" ");
|
|
1699
|
+
}, h = Jt(n);
|
|
1700
|
+
return h ? h.renderEmail.reactEmail(a, {
|
|
1701
1701
|
uid: o,
|
|
1702
1702
|
marginStyle: l,
|
|
1703
1703
|
paddingStyle: c,
|
|
1704
|
-
escapeHtml:
|
|
1705
|
-
escapeAttr:
|
|
1706
|
-
safeUrl:
|
|
1704
|
+
escapeHtml: Ft,
|
|
1705
|
+
escapeAttr: Ht,
|
|
1706
|
+
safeUrl: Dt,
|
|
1707
1707
|
resolveBgCss: e,
|
|
1708
|
-
resolveBgVml:
|
|
1709
|
-
getResponsiveClasses:
|
|
1708
|
+
resolveBgVml: m,
|
|
1709
|
+
getResponsiveClasses: b,
|
|
1710
1710
|
react: {
|
|
1711
|
-
parseCssString:
|
|
1712
|
-
parseMarginPaddingDiscrete:
|
|
1713
|
-
normalizeFontFamily:
|
|
1714
|
-
styleObj:
|
|
1715
|
-
normalizeInlineStylesToReact:
|
|
1716
|
-
buildInlineJsx:
|
|
1711
|
+
parseCssString: Qr,
|
|
1712
|
+
parseMarginPaddingDiscrete: Zr,
|
|
1713
|
+
normalizeFontFamily: pt,
|
|
1714
|
+
styleObj: Nn,
|
|
1715
|
+
normalizeInlineStylesToReact: Yr,
|
|
1716
|
+
buildInlineJsx: ea
|
|
1717
1717
|
}
|
|
1718
1718
|
}) : i;
|
|
1719
1719
|
} };
|
|
1720
1720
|
};
|
|
1721
|
-
function
|
|
1721
|
+
function Qr(e) {
|
|
1722
1722
|
const t = {};
|
|
1723
1723
|
return e.split(";").map((r) => r.trim()).filter(Boolean).forEach((r) => {
|
|
1724
1724
|
const n = r.indexOf(":");
|
|
1725
1725
|
if (n < 0) return;
|
|
1726
1726
|
const a = r.slice(0, n).trim(), i = r.slice(n + 1).trim(), o = a.replace(/-([a-z])/g, (l, c) => c.toUpperCase());
|
|
1727
|
-
t[o] =
|
|
1727
|
+
t[o] = In(i);
|
|
1728
1728
|
}), t;
|
|
1729
1729
|
}
|
|
1730
|
-
function
|
|
1730
|
+
function Zr(e, t) {
|
|
1731
1731
|
const r = {};
|
|
1732
1732
|
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;
|
|
1733
1733
|
}
|
|
1734
|
-
function
|
|
1734
|
+
function Nn(e) {
|
|
1735
1735
|
return Object.entries(e).filter(([, t]) => t != null && t !== "").map(([t, r]) => `${t}: "${r}"`).join(", ");
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1737
|
+
function ea(e, t, r, n, a) {
|
|
1738
1738
|
return `<${e}${a ? `
|
|
1739
1739
|
as="${a}"` : ""}
|
|
1740
1740
|
className="${t}"
|
|
1741
|
-
style={{ ${
|
|
1741
|
+
style={{ ${Nn(r)} }}
|
|
1742
1742
|
>
|
|
1743
1743
|
${n}
|
|
1744
1744
|
</${e}>
|
|
1745
1745
|
`;
|
|
1746
1746
|
}
|
|
1747
|
-
var
|
|
1747
|
+
var Bn = () => {
|
|
1748
1748
|
const e = (o, l) => {
|
|
1749
1749
|
if (!(o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2)) {
|
|
1750
|
-
const
|
|
1751
|
-
return !
|
|
1750
|
+
const x = o && typeof o == "object" && o.solid ? o.solid : l;
|
|
1751
|
+
return !x || x === "transparent" ? "" : `background-color:${x};`;
|
|
1752
1752
|
}
|
|
1753
|
-
const { type: c, direction:
|
|
1754
|
-
return `${
|
|
1753
|
+
const { type: c, direction: m, colors: b } = o.gradient, h = b.map((x) => `${x.color} ${x.position}%`).join(", "), R = c === "radial" ? `radial-gradient(circle at center, ${h})` : `linear-gradient(${m}, ${h})`, E = o.solid || l || "";
|
|
1754
|
+
return `${E && E !== "transparent" ? `background-color:${E};` : ""}background:${R};`;
|
|
1755
1755
|
}, t = (o, l) => o?.useGradient === !0 && Array.isArray(o?.gradient?.colors) && o.gradient.colors.length >= 2 ? {
|
|
1756
1756
|
vmlOpen: `
|
|
1757
1757
|
<!--[if mso]>
|
|
@@ -1771,44 +1771,44 @@ var Nn = () => {
|
|
|
1771
1771
|
}, r = (o, l) => o && typeof o == "object" && o.solid && o.solid !== "transparent" ? o.solid : l && l !== "transparent" ? l : "", n = (o) => o ? `${o.top ?? 0}px ${o.right ?? 0}px ${o.bottom ?? 0}px ${o.left ?? 0}px` : "0px";
|
|
1772
1772
|
return {
|
|
1773
1773
|
generateMJMLComponent: (o) => {
|
|
1774
|
-
const l = o.componentType ?? o.type, { props: c } = o,
|
|
1775
|
-
const
|
|
1776
|
-
return
|
|
1777
|
-
},
|
|
1778
|
-
return
|
|
1779
|
-
uid:
|
|
1780
|
-
marginStyle:
|
|
1781
|
-
paddingStyle:
|
|
1782
|
-
escapeHtml:
|
|
1783
|
-
escapeAttr:
|
|
1784
|
-
safeUrl:
|
|
1774
|
+
const l = o.componentType ?? o.type, { props: c } = o, m = `eb-${o.id}`, b = c.margin ? `margin:${c.margin?.top ?? 0}px ${c.margin?.right ?? 0}px ${c.margin?.bottom ?? 0}px ${c.margin?.left ?? 0}px;` : "", h = c.padding ? `padding:${c.padding?.top ?? 0}px ${c.padding?.right ?? 0}px ${c.padding?.bottom ?? 0}px ${c.padding?.left ?? 0}px;` : "", R = (x, N, j) => {
|
|
1775
|
+
const u = [j ? `${m}-${j}` : m];
|
|
1776
|
+
return x && u.push("desktop-hide"), N && u.push("mobile-hide"), u.join(" ");
|
|
1777
|
+
}, E = Jt(l);
|
|
1778
|
+
return E ? E.renderEmail.mjml(c, {
|
|
1779
|
+
uid: m,
|
|
1780
|
+
marginStyle: b,
|
|
1781
|
+
paddingStyle: h,
|
|
1782
|
+
escapeHtml: Ft,
|
|
1783
|
+
escapeAttr: Ht,
|
|
1784
|
+
safeUrl: Dt,
|
|
1785
1785
|
resolveBgCss: e,
|
|
1786
1786
|
resolveBgVml: t,
|
|
1787
|
-
getResponsiveClasses:
|
|
1787
|
+
getResponsiveClasses: R,
|
|
1788
1788
|
react: null
|
|
1789
1789
|
}) : "";
|
|
1790
1790
|
},
|
|
1791
|
-
assembleMJML: (o, l, c,
|
|
1792
|
-
const
|
|
1793
|
-
@import url('${
|
|
1794
|
-
</mj-style>` : "",
|
|
1791
|
+
assembleMJML: (o, l, c, m, b, h = 600, R = "") => {
|
|
1792
|
+
const E = m ? `<mj-style inline="false">
|
|
1793
|
+
@import url('${m}');
|
|
1794
|
+
</mj-style>` : "", x = `<mj-style inline="false">
|
|
1795
1795
|
.desktop-hide { display: none !important; }
|
|
1796
1796
|
ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
|
|
1797
|
-
</mj-style>`,
|
|
1798
|
-
${
|
|
1799
|
-
</mj-style>` : "",
|
|
1800
|
-
@media only screen and (max-width:${
|
|
1801
|
-
${
|
|
1797
|
+
</mj-style>`, N = R.trim() ? `<mj-style inline="false">
|
|
1798
|
+
${R}
|
|
1799
|
+
</mj-style>` : "", j = b.trim() ? `<mj-style inline="false">
|
|
1800
|
+
@media only screen and (max-width:${h}px) {
|
|
1801
|
+
${b}
|
|
1802
1802
|
}
|
|
1803
|
-
</mj-style>` : "",
|
|
1803
|
+
</mj-style>` : "", u = c.bodyBackgroundColor || "#ffffff", d = c.bodyBackgroundImage ? [
|
|
1804
1804
|
`background-url="${c.bodyBackgroundImage}"`,
|
|
1805
1805
|
`background-size="${c.bodyBackgroundSize || "cover"}"`,
|
|
1806
1806
|
`background-position="${c.bodyBackgroundPosition || "center center"}"`,
|
|
1807
1807
|
`background-repeat="${c.bodyBackgroundRepeat || "no-repeat"}"`
|
|
1808
|
-
].join(" ") : "", s = c.backgroundColor || "#ffffff",
|
|
1808
|
+
].join(" ") : "", s = c.backgroundColor || "#ffffff", y = n(c.padding);
|
|
1809
1809
|
return `<mjml lang="${c.language}">
|
|
1810
1810
|
<mj-head>
|
|
1811
|
-
${
|
|
1811
|
+
${E}
|
|
1812
1812
|
<mj-title>${o}</mj-title>
|
|
1813
1813
|
<mj-preview>${c.preheaderText} ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ </mj-preview>
|
|
1814
1814
|
<mj-attributes>
|
|
@@ -1819,13 +1819,13 @@ ${v}
|
|
|
1819
1819
|
<meta name="supported-color-schemes" content="light dark">
|
|
1820
1820
|
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
|
|
1821
1821
|
</mj-raw>
|
|
1822
|
-
${
|
|
1823
|
-
${
|
|
1824
|
-
${
|
|
1822
|
+
${x}
|
|
1823
|
+
${N}
|
|
1824
|
+
${j}
|
|
1825
1825
|
</mj-head>
|
|
1826
|
-
<mj-body background-color="${
|
|
1827
|
-
<mj-wrapper full-width="full-width" ${
|
|
1828
|
-
<mj-section background-color="${s}" padding="${
|
|
1826
|
+
<mj-body background-color="${u}" width="${c.width ?? 600}px">
|
|
1827
|
+
<mj-wrapper full-width="full-width" ${d} padding="0">
|
|
1828
|
+
<mj-section background-color="${s}" padding="${y}">
|
|
1829
1829
|
${l}
|
|
1830
1830
|
</mj-section>
|
|
1831
1831
|
</mj-wrapper>
|
|
@@ -1835,17 +1835,17 @@ ${l}
|
|
|
1835
1835
|
resolveSolidColor: r,
|
|
1836
1836
|
padAttr: n
|
|
1837
1837
|
};
|
|
1838
|
-
},
|
|
1839
|
-
function
|
|
1840
|
-
const e =
|
|
1841
|
-
return Ie(
|
|
1838
|
+
}, On = /* @__PURE__ */ Symbol("maildeno-editor:info-dialog");
|
|
1839
|
+
function so() {
|
|
1840
|
+
const e = jn();
|
|
1841
|
+
return Ie(On, e), e;
|
|
1842
1842
|
}
|
|
1843
|
-
var
|
|
1844
|
-
const e = Oe(
|
|
1845
|
-
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)."),
|
|
1843
|
+
var ta = () => {
|
|
1844
|
+
const e = Oe(On);
|
|
1845
|
+
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)."), jn());
|
|
1846
1846
|
};
|
|
1847
|
-
function
|
|
1848
|
-
const e =
|
|
1847
|
+
function jn() {
|
|
1848
|
+
const e = L(!1), t = L("Info"), r = L("");
|
|
1849
1849
|
return {
|
|
1850
1850
|
visible: e,
|
|
1851
1851
|
header: t,
|
|
@@ -1855,16 +1855,16 @@ function On() {
|
|
|
1855
1855
|
}
|
|
1856
1856
|
};
|
|
1857
1857
|
}
|
|
1858
|
-
var
|
|
1858
|
+
var lo = ["is_empty", "is_not_empty"], co = ["in", "not_in"], uo = [
|
|
1859
1859
|
">",
|
|
1860
1860
|
"<",
|
|
1861
1861
|
">=",
|
|
1862
1862
|
"<="
|
|
1863
|
-
],
|
|
1863
|
+
], po = [
|
|
1864
1864
|
"date_before",
|
|
1865
1865
|
"date_after",
|
|
1866
1866
|
"date_on"
|
|
1867
|
-
],
|
|
1867
|
+
], mo = [
|
|
1868
1868
|
{
|
|
1869
1869
|
label: "Equals ==",
|
|
1870
1870
|
value: "=="
|
|
@@ -1933,11 +1933,11 @@ var io = ["is_empty", "is_not_empty"], so = ["in", "not_in"], lo = [
|
|
|
1933
1933
|
label: "Is Not Empty",
|
|
1934
1934
|
value: "is_not_empty"
|
|
1935
1935
|
}
|
|
1936
|
-
],
|
|
1936
|
+
], sn = (e) => e.split(/[,\n;]+/).map((t) => t.trim()).filter(Boolean), Qe = (e, t) => [parseFloat(e ?? ""), parseFloat(t)], Ze = (e, t) => !isNaN(e) && !isNaN(t), Ee = (e) => {
|
|
1937
1937
|
if (!e?.trim()) return null;
|
|
1938
1938
|
const t = /^\d{4}-\d{2}-\d{2}$/.test(e.trim()) ? /* @__PURE__ */ new Date(`${e.trim()}T00:00:00Z`) : new Date(e.trim());
|
|
1939
1939
|
return isNaN(t.getTime()) ? null : new Date(Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()));
|
|
1940
|
-
},
|
|
1940
|
+
}, Nt = (e, t) => {
|
|
1941
1941
|
const r = t[e.tag.toLowerCase()], n = r?.toLowerCase() ?? "", a = e.value.toLowerCase();
|
|
1942
1942
|
switch (e.operator) {
|
|
1943
1943
|
case "==":
|
|
@@ -1953,9 +1953,9 @@ var io = ["is_empty", "is_not_empty"], so = ["in", "not_in"], lo = [
|
|
|
1953
1953
|
case "ends_with":
|
|
1954
1954
|
return n.endsWith(a);
|
|
1955
1955
|
case "in":
|
|
1956
|
-
return
|
|
1956
|
+
return sn(a).includes(n);
|
|
1957
1957
|
case "not_in":
|
|
1958
|
-
return !
|
|
1958
|
+
return !sn(a).includes(n);
|
|
1959
1959
|
case ">": {
|
|
1960
1960
|
const [i, o] = Qe(r, e.value);
|
|
1961
1961
|
return Ze(i, o) && i > o;
|
|
@@ -1991,39 +1991,39 @@ var io = ["is_empty", "is_not_empty"], so = ["in", "not_in"], lo = [
|
|
|
1991
1991
|
default:
|
|
1992
1992
|
return !0;
|
|
1993
1993
|
}
|
|
1994
|
-
},
|
|
1994
|
+
}, ln = (e, t) => {
|
|
1995
1995
|
if (!e.rules.length) return !0;
|
|
1996
|
-
const r = e.rules.map((n) =>
|
|
1996
|
+
const r = e.rules.map((n) => Nt(n, t));
|
|
1997
1997
|
return e.match === "any" ? r.some(Boolean) : r.every(Boolean);
|
|
1998
|
-
},
|
|
1998
|
+
}, mt = () => ({
|
|
1999
1999
|
evaluateVisibility: (t, r) => {
|
|
2000
2000
|
if (!t?.enabled) return !0;
|
|
2001
2001
|
const n = t.rules?.length > 0, a = (t.groups?.length ?? 0) > 0;
|
|
2002
2002
|
if (!n && !a) return !0;
|
|
2003
|
-
const i = (t.rules ?? []).map((c) =>
|
|
2003
|
+
const i = (t.rules ?? []).map((c) => Nt(c, r)), o = (t.groups ?? []).map((c) => ln(c, r)), l = [...i, ...o];
|
|
2004
2004
|
return t.match === "any" ? l.some(Boolean) : l.every(Boolean);
|
|
2005
2005
|
},
|
|
2006
|
-
evaluateRule:
|
|
2007
|
-
evaluateGroup:
|
|
2008
|
-
}),
|
|
2006
|
+
evaluateRule: Nt,
|
|
2007
|
+
evaluateGroup: ln
|
|
2008
|
+
}), zn = (e) => {
|
|
2009
2009
|
const { type: t, direction: r, colors: n } = e.gradient, a = n.map((i) => `${i.color} ${i.position}%`).join(", ");
|
|
2010
2010
|
return t === "radial" ? `radial-gradient(circle at center, ${a})` : `linear-gradient(${r}, ${a})`;
|
|
2011
|
-
},
|
|
2011
|
+
}, ue = (e) => {
|
|
2012
2012
|
const t = [], r = e.backgroundGradient;
|
|
2013
2013
|
if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
|
|
2014
|
-
const n =
|
|
2014
|
+
const n = zn(r), a = r.solid || e.backgroundColor || "";
|
|
2015
2015
|
a && a !== "transparent" && t.push(`background-color:${a}`), t.push(`background:${n}`);
|
|
2016
2016
|
} else e.backgroundColor && e.backgroundColor !== "transparent" && t.push(`background-color:${e.backgroundColor}`);
|
|
2017
2017
|
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;
|
|
2018
2018
|
}, et = (e) => {
|
|
2019
2019
|
const t = {}, r = e.backgroundGradient;
|
|
2020
2020
|
if (r?.useGradient === !0 && Array.isArray(r?.gradient?.colors) && r.gradient.colors.length >= 2) {
|
|
2021
|
-
const n =
|
|
2021
|
+
const n = zn(r), a = r.solid || e.backgroundColor || "";
|
|
2022
2022
|
a && a !== "transparent" && (t.backgroundColor = a), t.background = n;
|
|
2023
2023
|
} else e.backgroundColor && e.backgroundColor !== "transparent" && (t.backgroundColor = e.backgroundColor);
|
|
2024
2024
|
return e.backgroundImage && (t.backgroundImage = `url(${e.backgroundImage})`, t.backgroundSize = e.backgroundSize, t.backgroundPosition = e.backgroundPosition, t.backgroundRepeat = e.backgroundRepeat), t;
|
|
2025
|
-
},
|
|
2026
|
-
if (!(r >=
|
|
2025
|
+
}, na = 5, Ln = (e, t, r) => {
|
|
2026
|
+
if (!(r >= na) && Array.isArray(e))
|
|
2027
2027
|
for (const n of e) {
|
|
2028
2028
|
if (!n || n.type === "row-spacer") continue;
|
|
2029
2029
|
n.mobileStack && (n.gap ?? 0) > 0 && t.add(n.gap);
|
|
@@ -2033,19 +2033,19 @@ var io = ["is_empty", "is_not_empty"], so = ["in", "not_in"], lo = [
|
|
|
2033
2033
|
const o = i?.children ?? i?.components;
|
|
2034
2034
|
if (!Array.isArray(o) || o.length === 0) continue;
|
|
2035
2035
|
const l = o.filter((c) => c?.type === "row");
|
|
2036
|
-
l.length > 0 &&
|
|
2036
|
+
l.length > 0 && Ln(l, t, r + 1);
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
2039
|
}, Pn = (e) => {
|
|
2040
2040
|
const t = /* @__PURE__ */ new Set();
|
|
2041
|
-
if (
|
|
2041
|
+
if (Ln(e, t, 0), t.size === 0) return "";
|
|
2042
2042
|
const r = [...t].sort((n, a) => n - a);
|
|
2043
2043
|
return `${r.map((n) => `.mobile-stack.gap-${n}`).join(`,
|
|
2044
2044
|
`) + " { display:block !important; width:100% !important; }"}
|
|
2045
2045
|
${r.map((n) => `.mobile-stack.gap-${n} { height:${n}px !important; line-height:${n}px !important; }`).join(`
|
|
2046
2046
|
`)}`;
|
|
2047
|
-
}, tt =
|
|
2048
|
-
const e =
|
|
2047
|
+
}, tt = L(/* @__PURE__ */ new Set()), ft = () => {
|
|
2048
|
+
const e = L([
|
|
2049
2049
|
"Arial",
|
|
2050
2050
|
"Arial Black",
|
|
2051
2051
|
"Comic Sans MS",
|
|
@@ -2423,45 +2423,45 @@ ${r.map((n) => `.mobile-stack.gap-${n} { height:${n}px !important; line-height:$
|
|
|
2423
2423
|
500,
|
|
2424
2424
|
600,
|
|
2425
2425
|
700
|
|
2426
|
-
], a = (
|
|
2427
|
-
if (r.has(
|
|
2428
|
-
const
|
|
2429
|
-
return `ital,wght@${[...
|
|
2426
|
+
], a = (h) => t.has(h), i = (h) => h.trim().replace(/\s+/g, "+"), o = (h) => {
|
|
2427
|
+
if (r.has(h)) {
|
|
2428
|
+
const R = n.map((x) => `0,${x}`), E = n.map((x) => `1,${x}`);
|
|
2429
|
+
return `ital,wght@${[...R, ...E].join(";")}`;
|
|
2430
2430
|
}
|
|
2431
2431
|
return `wght@${n.join(";")}`;
|
|
2432
|
-
}, l = (
|
|
2433
|
-
if (!
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
}, c = (
|
|
2437
|
-
const
|
|
2438
|
-
return
|
|
2432
|
+
}, l = (h) => {
|
|
2433
|
+
if (!h || a(h) || tt.value.has(h)) return;
|
|
2434
|
+
const R = document.createElement("link");
|
|
2435
|
+
R.rel = "stylesheet", R.href = `https://fonts.googleapis.com/css2?family=${i(h)}:${o(h)}&display=swap`, document.head.appendChild(R), tt.value.add(h);
|
|
2436
|
+
}, c = (h) => {
|
|
2437
|
+
const R = Array.from(new Set(h)).filter((E) => E && !a(E));
|
|
2438
|
+
return R.length ? `https://fonts.googleapis.com/css2?${R.map((E) => `family=${i(E)}:${o(E)}`).join("&")}&display=swap` : "";
|
|
2439
2439
|
};
|
|
2440
2440
|
return {
|
|
2441
2441
|
googleFonts: e,
|
|
2442
2442
|
loadGoogleFont: l,
|
|
2443
2443
|
getGoogleFontImports: c,
|
|
2444
|
-
syncFontsForTemplate: (
|
|
2445
|
-
if (!
|
|
2446
|
-
const
|
|
2447
|
-
for (const
|
|
2448
|
-
|
|
2449
|
-
if (
|
|
2450
|
-
const
|
|
2451
|
-
if (!
|
|
2452
|
-
const
|
|
2453
|
-
|
|
2454
|
-
for (const
|
|
2444
|
+
syncFontsForTemplate: (h) => {
|
|
2445
|
+
if (!h || h.length === 0) return;
|
|
2446
|
+
const R = [], E = /* @__PURE__ */ new Set();
|
|
2447
|
+
for (const j of h)
|
|
2448
|
+
j && (E.has(j) || (E.add(j), !a(j) && (tt.value.has(j) || R.push(j))));
|
|
2449
|
+
if (R.length === 0) return;
|
|
2450
|
+
const x = c(R);
|
|
2451
|
+
if (!x) return;
|
|
2452
|
+
const N = document.createElement("link");
|
|
2453
|
+
N.rel = "stylesheet", N.href = x, N.dataset.canvasFonts = R.join(","), document.head.appendChild(N);
|
|
2454
|
+
for (const j of R) tt.value.add(j);
|
|
2455
2455
|
},
|
|
2456
2456
|
preconnectGoogleFonts: () => {
|
|
2457
2457
|
if (typeof document > "u") return;
|
|
2458
|
-
const
|
|
2459
|
-
const
|
|
2460
|
-
if (document.head.querySelector(
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2458
|
+
const h = (R, E = !1) => {
|
|
2459
|
+
const x = `link[rel="preconnect"][href="${R}"]`;
|
|
2460
|
+
if (document.head.querySelector(x)) return;
|
|
2461
|
+
const N = document.createElement("link");
|
|
2462
|
+
N.rel = "preconnect", N.href = R, E && (N.crossOrigin = "anonymous"), document.head.appendChild(N);
|
|
2463
2463
|
};
|
|
2464
|
-
|
|
2464
|
+
h("https://fonts.googleapis.com"), h("https://fonts.gstatic.com", !0);
|
|
2465
2465
|
},
|
|
2466
2466
|
isWebSafeFont: a,
|
|
2467
2467
|
WEB_SAFE_FONTS: t,
|
|
@@ -2469,175 +2469,184 @@ ${r.map((n) => `.mobile-stack.gap-${n} { height:${n}px !important; line-height:$
|
|
|
2469
2469
|
DEFAULT_WEIGHTS: n
|
|
2470
2470
|
};
|
|
2471
2471
|
};
|
|
2472
|
-
function
|
|
2472
|
+
function Je(e) {
|
|
2473
2473
|
if (typeof e != "string") return "auto";
|
|
2474
2474
|
const t = e.trim().toLowerCase();
|
|
2475
2475
|
return /^(?:auto|(?:\d+(?:\.\d+)?|\.\d+)(?:px|%))$/.test(t) ? t : "auto";
|
|
2476
2476
|
}
|
|
2477
|
-
function
|
|
2478
|
-
const t =
|
|
2477
|
+
function ra(e) {
|
|
2478
|
+
const t = Je(e.width), r = Je(e.height);
|
|
2479
2479
|
return [
|
|
2480
2480
|
t,
|
|
2481
2481
|
r,
|
|
2482
2482
|
e.mobile?.width,
|
|
2483
2483
|
e.mobile?.height
|
|
2484
|
-
].some((n) =>
|
|
2484
|
+
].some((n) => Je(n) !== "auto") ? {
|
|
2485
2485
|
width: t,
|
|
2486
2486
|
height: r,
|
|
2487
2487
|
boxSizing: "border-box",
|
|
2488
2488
|
textAlign: "center"
|
|
2489
2489
|
} : {};
|
|
2490
2490
|
}
|
|
2491
|
-
|
|
2491
|
+
function aa(e, t) {
|
|
2492
|
+
const r = t === "width" ? "100%" : "auto";
|
|
2493
|
+
if (typeof e != "string" && typeof e != "number") return r;
|
|
2494
|
+
let n = String(e).trim().toLowerCase();
|
|
2495
|
+
if (/^(?:\d+(?:\.\d+)?|\.\d+)$/.test(n) && (n += t === "width" ? "%" : "px"), t === "height" && n.endsWith("%")) return r;
|
|
2496
|
+
const a = Je(n);
|
|
2497
|
+
return a === "auto" && n !== "auto" ? r : a;
|
|
2498
|
+
}
|
|
2499
|
+
var Gt = () => ({ emailMobileStyles: (t, r) => {
|
|
2492
2500
|
const n = t.componentType ?? t.type, a = t.props.mobileStack === !0, i = t.props.mobile;
|
|
2493
2501
|
if (!i && !(n === "menu" && a)) return "";
|
|
2494
|
-
const o = i ?? {}, l = [], c = [],
|
|
2495
|
-
|
|
2496
|
-
},
|
|
2497
|
-
const
|
|
2498
|
-
if (
|
|
2499
|
-
if (
|
|
2500
|
-
const { type: s, direction:
|
|
2501
|
-
return
|
|
2502
|
+
const o = i ?? {}, l = [], c = [], m = [], b = (/* @__PURE__ */ new Set(["button", "anchor"])).has(n), h = n === "button" && !!ra(t.props).width, R = (/* @__PURE__ */ new Set(["menu", "socials"])).has(n), E = (u, d) => {
|
|
2503
|
+
d && u.push(d);
|
|
2504
|
+
}, x = () => {
|
|
2505
|
+
const u = o.backgroundGradient;
|
|
2506
|
+
if (u != null) {
|
|
2507
|
+
if (u.useGradient === !0 && Array.isArray(u.gradient?.colors) && u.gradient.colors.length >= 2) {
|
|
2508
|
+
const { type: s, direction: y, colors: C } = u.gradient, _ = C.map((w) => `${w.color} ${w.position}%`).join(", "), f = s === "radial" ? `radial-gradient(circle at center, ${_})` : `linear-gradient(${y}, ${_})`, p = u.solid || o.backgroundColor || "", g = [];
|
|
2509
|
+
return g.push(`background-color: ${p && p !== "transparent" ? p : "transparent"} !important`), g.push(`background: ${f} !important`), g;
|
|
2502
2510
|
}
|
|
2503
|
-
const
|
|
2504
|
-
return
|
|
2511
|
+
const d = u.solid ?? o.backgroundColor;
|
|
2512
|
+
return d != null ? ["background: none !important", `background-color: ${d} !important`] : [];
|
|
2505
2513
|
}
|
|
2506
2514
|
return o.backgroundColor != null ? ["background: none !important", `background-color: ${o.backgroundColor} !important`] : [];
|
|
2507
|
-
},
|
|
2508
|
-
|
|
2515
|
+
}, N = (u) => {
|
|
2516
|
+
E(u, o.fontSize != null && `font-size: ${o.fontSize}px !important`), E(u, o.lineHeight != null && `line-height: ${o.lineHeight} !important`), E(u, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), E(u, o.color != null && `color: ${o.color} !important`), E(u, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), E(u, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), E(u, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), E(u, o.textTransform != null && `text-transform: ${o.textTransform} !important`), E(u, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), h || u.push(...x());
|
|
2509
2517
|
};
|
|
2510
2518
|
if (o.margin) {
|
|
2511
|
-
const
|
|
2512
|
-
l.push(`margin: ${
|
|
2519
|
+
const u = o.margin;
|
|
2520
|
+
l.push(`margin: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
|
|
2513
2521
|
}
|
|
2514
|
-
if (o.padding && !
|
|
2515
|
-
const
|
|
2516
|
-
l.push(`padding: ${
|
|
2522
|
+
if (o.padding && !b && !R) {
|
|
2523
|
+
const u = o.padding;
|
|
2524
|
+
l.push(`padding: ${u.top}px ${u.right}px ${u.bottom}px ${u.left}px !important`);
|
|
2517
2525
|
}
|
|
2518
|
-
if (o.align != null && !
|
|
2519
|
-
|
|
2520
|
-
const
|
|
2526
|
+
if (o.align != null && !R && l.push(`text-align: ${o.align} !important`), b) {
|
|
2527
|
+
N(c);
|
|
2528
|
+
const u = h ? x() : c;
|
|
2521
2529
|
if (o.padding) {
|
|
2522
|
-
const
|
|
2523
|
-
|
|
2530
|
+
const d = o.padding, s = `padding: ${d.top}px ${d.right}px ${d.bottom}px ${d.left}px !important`;
|
|
2531
|
+
h ? m.push(`.${r}-button-content { ${s} }`) : c.push(s);
|
|
2524
2532
|
}
|
|
2525
2533
|
if (o.border) {
|
|
2526
|
-
const
|
|
2527
|
-
|
|
2534
|
+
const d = o.border;
|
|
2535
|
+
u.push(de(d, !0));
|
|
2528
2536
|
}
|
|
2529
|
-
if (o.borderRadius != null &&
|
|
2530
|
-
for (const s of ["width", "height"]) o[s] != null &&
|
|
2531
|
-
const
|
|
2532
|
-
|
|
2537
|
+
if (o.borderRadius != null && u.push(`border-radius: ${X(o.borderRadius)} !important`), n === "button") {
|
|
2538
|
+
for (const s of ["width", "height"]) o[s] != null && u.push(`${s}: ${Je(o[s])} !important`);
|
|
2539
|
+
const d = [];
|
|
2540
|
+
E(d, o.fontSize != null && `font-size: ${o.fontSize}px !important`), E(d, o.letterSpacing != null && `letter-spacing: ${o.letterSpacing}px !important`), E(d, o.color != null && `color: ${o.color} !important`), E(d, o.fontWeight != null && `font-weight: ${o.fontWeight} !important`), E(d, o.fontFamily != null && `font-family: '${o.fontFamily}', Arial, sans-serif !important`), E(d, o.fontStyle != null && `font-style: ${o.fontStyle} !important`), E(d, o.textTransform != null && `text-transform: ${o.textTransform} !important`), E(d, o.textDecoration != null && `text-decoration: ${o.textDecoration} !important`), d.length > 0 && m.push(`.${r}-text { ${d.join("; ")} }`);
|
|
2533
2541
|
}
|
|
2534
|
-
|
|
2535
|
-
} else if (n === "image")
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2542
|
+
h && u.length > 0 && m.push(`.${r}-button-table { ${u.join("; ")} }`);
|
|
2543
|
+
} else if (n === "image") {
|
|
2544
|
+
for (const u of ["width", "height"]) o[u] != null && c.push(`${u}: ${aa(o[u], u)} !important`);
|
|
2545
|
+
E(c, o.borderRadius != null && `border-radius: ${X(o.borderRadius)} !important`), E(c, o.border != null && de(o.border, !0));
|
|
2546
|
+
} else if (n === "video")
|
|
2547
|
+
E(c, o.width != null && `width: ${o.width}% !important`), E(c, o.height != null && `height: ${o.height} !important`), E(c, o.borderRadius != null && `border-radius: ${X(o.borderRadius)} !important`), E(c, o.border != null && de(o.border, !0));
|
|
2539
2548
|
else if (n === "divider") {
|
|
2540
|
-
const
|
|
2541
|
-
if (o.width != null &&
|
|
2542
|
-
const s = o.align === "left" ? "0" : "auto",
|
|
2543
|
-
|
|
2549
|
+
const u = [], d = [];
|
|
2550
|
+
if (o.width != null && u.push(`width: ${o.width}% !important`), o.align != null) {
|
|
2551
|
+
const s = o.align === "left" ? "0" : "auto", y = o.align === "right" ? "0" : "auto";
|
|
2552
|
+
u.push(`margin-left: ${s} !important`), u.push(`margin-right: ${y} !important`);
|
|
2544
2553
|
}
|
|
2545
|
-
o.height != null && (
|
|
2554
|
+
o.height != null && (d.push(`height: ${o.height}px !important`), d.push(`line-height: ${o.height}px !important`)), d.push(...x()), u.length > 0 && m.push(`.${r}-divider-table { ${u.join("; ")} }`), d.length > 0 && m.push(`.${r}-divider-td { ${d.join("; ")} }`);
|
|
2546
2555
|
} else if (n === "spacer") {
|
|
2547
|
-
const
|
|
2548
|
-
o.height != null && (
|
|
2556
|
+
const u = [];
|
|
2557
|
+
o.height != null && (u.push(`height: ${o.height}px !important`), u.push(`line-height: ${o.height}px !important`)), u.push(...x()), u.length > 0 && m.push(`.${r}-spacer-td { ${u.join("; ")} }`);
|
|
2549
2558
|
} else if (n === "list")
|
|
2550
|
-
|
|
2559
|
+
N(l), o.itemSpacing != null && m.push(`.${r} li { margin-bottom: ${o.itemSpacing}px !important; }`);
|
|
2551
2560
|
else if (n === "menu") {
|
|
2552
|
-
const
|
|
2553
|
-
if (
|
|
2561
|
+
const u = [];
|
|
2562
|
+
if (u.push(...x()), o.padding) {
|
|
2554
2563
|
const s = o.padding;
|
|
2555
|
-
|
|
2564
|
+
u.push(`padding: ${s.top}px ${s.right}px ${s.bottom}px ${s.left}px !important`);
|
|
2556
2565
|
}
|
|
2557
|
-
|
|
2558
|
-
const
|
|
2559
|
-
if (o.fontSize != null &&
|
|
2566
|
+
u.length > 0 && m.push(`.${r}-menu-td { ${u.join("; ")} }`), o.align != null && m.push(`.${r}-menu-td { text-align: ${o.align} !important; }`);
|
|
2567
|
+
const d = [];
|
|
2568
|
+
if (o.fontSize != null && d.push(`font-size: ${o.fontSize}px !important`), o.lineHeight != null && d.push(`line-height: ${o.lineHeight} !important`), o.letterSpacing != null && d.push(`letter-spacing: ${o.letterSpacing}px !important`), o.color != null && d.push(`color: ${o.color} !important`), o.fontWeight != null && d.push(`font-weight: ${o.fontWeight} !important`), o.fontFamily != null && d.push(`font-family: '${o.fontFamily}', Arial, sans-serif !important`), o.fontStyle != null && d.push(`font-style: ${o.fontStyle} !important`), o.textTransform != null && d.push(`text-transform: ${o.textTransform} !important`), o.textDecoration != null && d.push(`text-decoration: ${o.textDecoration} !important`), d.length > 0 && m.push(`.${r}-menu-td a { ${d.join("; ")} }`), a) {
|
|
2560
2569
|
const s = o.spacing ?? t.props.spacing ?? 0;
|
|
2561
|
-
|
|
2570
|
+
m.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; }`), m.push(`.${r}-menu-item:last-of-type a { margin-bottom: 0 !important; }`);
|
|
2562
2571
|
} else if (o.spacing != null) {
|
|
2563
2572
|
const s = Math.ceil(o.spacing / 2);
|
|
2564
|
-
|
|
2573
|
+
m.push(`.${r}-menu-item a { margin-left: ${s}px !important; margin-right: ${s}px !important; }`), m.push(`.${r}-menu-item:first-of-type a { margin-left: 0 !important; }`), m.push(`.${r}-menu-item:last-of-type a { margin-right: 0 !important; }`);
|
|
2565
2574
|
}
|
|
2566
2575
|
} else if (n === "socials") {
|
|
2567
|
-
const
|
|
2576
|
+
const u = [];
|
|
2568
2577
|
if (o.padding) {
|
|
2569
|
-
const
|
|
2570
|
-
|
|
2578
|
+
const d = o.padding;
|
|
2579
|
+
u.push(`padding: ${d.top}px ${d.right}px ${d.bottom}px ${d.left}px !important`);
|
|
2571
2580
|
}
|
|
2572
2581
|
if (o.align != null) {
|
|
2573
|
-
const
|
|
2574
|
-
|
|
2582
|
+
const d = o.align === "left" ? "0" : "auto", s = o.align === "right" ? "0" : "auto";
|
|
2583
|
+
m.push(`.${r}-socials-inner { display:inline-table !important; margin-left: ${d} !important; margin-right: ${s} !important; }`), u.push(`text-align: ${o.align} !important`);
|
|
2575
2584
|
}
|
|
2576
|
-
if (
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2585
|
+
if (u.length > 0 && m.push(`.${r}-socials-td { ${u.join("; ")} }`), o.iconSize != null && m.push(`.${r}-socials-inner img { width: ${o.iconSize}px !important; height: ${o.iconSize}px !important; }`), o.spacing != null) {
|
|
2586
|
+
const d = Math.ceil(o.spacing / 2);
|
|
2587
|
+
m.push(`.${r}-socials-item a { margin-left: ${d}px !important; margin-right: ${d}px !important; }`), m.push(`.${r}-socials-item:first-of-type a { margin-left: 0 !important; }`), m.push(`.${r}-socials-item:last-of-type a { margin-right: 0 !important; }`);
|
|
2579
2588
|
}
|
|
2580
|
-
} else
|
|
2581
|
-
const
|
|
2582
|
-
if (l.length > 0 &&
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2589
|
+
} else N(l);
|
|
2590
|
+
const j = [];
|
|
2591
|
+
if (l.length > 0 && j.push(`.${r} { ${l.join("; ")} }`), c.length > 0) {
|
|
2592
|
+
const u = b ? `.${r}-link` : n === "image" ? `.${r} img` : n === "video" ? `.${r} video` : `.${r}`;
|
|
2593
|
+
j.push(`${u} { ${c.join("; ")} }`);
|
|
2585
2594
|
}
|
|
2586
|
-
return
|
|
2595
|
+
return j.push(...m), j.join(`
|
|
2587
2596
|
`);
|
|
2588
|
-
} }),
|
|
2589
|
-
const a = `padding:${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, i = t &&
|
|
2597
|
+
} }), cn = (e) => pe(e) ? de(e) : "", Dn = (e, t, r = [], n) => {
|
|
2598
|
+
const a = `padding:${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, i = t && re(t.radius ?? 0) && pe(t), o = t && pe(t) && !re(t.radius ?? 0);
|
|
2590
2599
|
if (!i) {
|
|
2591
|
-
const
|
|
2592
|
-
return o &&
|
|
2600
|
+
const m = [a];
|
|
2601
|
+
return o && m.push(cn(t)), m.push("line-height:0"), m.push("font-size:0"), `<div style="${m.join(";")}">${e}</div>`;
|
|
2593
2602
|
}
|
|
2594
2603
|
const l = [
|
|
2595
|
-
`border-radius:${
|
|
2604
|
+
`border-radius:${X(t.radius)}`,
|
|
2596
2605
|
"overflow:hidden",
|
|
2597
2606
|
"line-height:0",
|
|
2598
2607
|
"font-size:0"
|
|
2599
2608
|
];
|
|
2600
|
-
|
|
2609
|
+
pe(t) && l.push(cn(t));
|
|
2601
2610
|
const c = [
|
|
2602
2611
|
a,
|
|
2603
2612
|
"line-height:0",
|
|
2604
2613
|
"font-size:0"
|
|
2605
2614
|
];
|
|
2606
2615
|
return `<div style="${l.join(";")}"><div style="${c.join(";")}">${e}</div></div>`;
|
|
2607
|
-
},
|
|
2608
|
-
const i = `${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, o = t &&
|
|
2616
|
+
}, oa = (e, t, r = {}, n, a = !0) => {
|
|
2617
|
+
const i = `${n?.top ?? 0}px ${n?.right ?? 0}px ${n?.bottom ?? 0}px ${n?.left ?? 0}px`, o = t && re(t.radius ?? 0) && pe(t) && a, l = t && pe(t) && !re(t.radius ?? 0) && a;
|
|
2609
2618
|
if (!o) {
|
|
2610
|
-
const
|
|
2619
|
+
const b = {
|
|
2611
2620
|
padding: i,
|
|
2612
2621
|
lineHeight: "0",
|
|
2613
2622
|
fontSize: "0"
|
|
2614
2623
|
};
|
|
2615
|
-
return l && (Object.assign(
|
|
2624
|
+
return l && (Object.assign(b, Rt(t)), re(t.radius ?? 0) && (b.borderRadius = X(t.radius))), `<div style={{ ${Object.entries(b).map(([h, R]) => `${h}:"${R}"`).join(", ")} }}>${e}</div>`;
|
|
2616
2625
|
}
|
|
2617
2626
|
const c = {
|
|
2618
|
-
borderRadius:
|
|
2627
|
+
borderRadius: X(t.radius),
|
|
2619
2628
|
overflow: "hidden",
|
|
2620
2629
|
lineHeight: "0",
|
|
2621
2630
|
fontSize: "0"
|
|
2622
2631
|
};
|
|
2623
|
-
|
|
2624
|
-
const
|
|
2632
|
+
pe(t) && Object.assign(c, Rt(t));
|
|
2633
|
+
const m = {
|
|
2625
2634
|
padding: i,
|
|
2626
2635
|
lineHeight: "0",
|
|
2627
2636
|
fontSize: "0"
|
|
2628
2637
|
};
|
|
2629
|
-
return `<div style={{ ${Object.entries(c).map(([
|
|
2630
|
-
},
|
|
2631
|
-
function
|
|
2632
|
-
return
|
|
2638
|
+
return `<div style={{ ${Object.entries(c).map(([b, h]) => `${b}:"${h}"`).join(", ")} }}><div style={{ ${Object.entries(m).map(([b, h]) => `${b}:"${h}"`).join(", ")} }}>${e}</div></div>`;
|
|
2639
|
+
}, Tt = null, At = null;
|
|
2640
|
+
function Fn() {
|
|
2641
|
+
return Tt ??= Promise.all([import("./standalone-DHvJ30Td.js"), import("./html-wb0gSX1o.js")]).then(([e, t]) => ({
|
|
2633
2642
|
prettier: e.default ?? e,
|
|
2634
2643
|
plugins: [t.default ?? t]
|
|
2635
2644
|
})).catch((e) => {
|
|
2636
|
-
throw
|
|
2637
|
-
}),
|
|
2645
|
+
throw Tt = null, e;
|
|
2646
|
+
}), Tt;
|
|
2638
2647
|
}
|
|
2639
|
-
function
|
|
2640
|
-
return
|
|
2648
|
+
function ia() {
|
|
2649
|
+
return At ??= Promise.all([
|
|
2641
2650
|
import("./standalone-DHvJ30Td.js"),
|
|
2642
2651
|
import("./babel-DV7WPQI0.js"),
|
|
2643
2652
|
import("./estree-DY9POgc0.js")
|
|
@@ -2645,59 +2654,59 @@ function aa() {
|
|
|
2645
2654
|
prettier: e.default ?? e,
|
|
2646
2655
|
plugins: [t.default ?? t, r.default ?? r]
|
|
2647
2656
|
})).catch((e) => {
|
|
2648
|
-
throw
|
|
2649
|
-
}),
|
|
2657
|
+
throw At = null, e;
|
|
2658
|
+
}), At;
|
|
2650
2659
|
}
|
|
2651
|
-
async function
|
|
2660
|
+
async function qt(e, t) {
|
|
2652
2661
|
try {
|
|
2653
2662
|
return await t();
|
|
2654
2663
|
} catch (r) {
|
|
2655
2664
|
return console.warn("[maildeno-editor] formatter unavailable; returning unformatted output", r), e;
|
|
2656
2665
|
}
|
|
2657
2666
|
}
|
|
2658
|
-
var
|
|
2659
|
-
const { prettier: t, plugins: r } = await
|
|
2667
|
+
var sa = async (e) => qt(e, async () => {
|
|
2668
|
+
const { prettier: t, plugins: r } = await Fn();
|
|
2660
2669
|
return t.format(e, {
|
|
2661
2670
|
parser: "html",
|
|
2662
2671
|
plugins: r
|
|
2663
2672
|
});
|
|
2664
|
-
}),
|
|
2665
|
-
const { prettier: t, plugins: r } = await
|
|
2673
|
+
}), la = async (e) => qt(e, async () => {
|
|
2674
|
+
const { prettier: t, plugins: r } = await ia();
|
|
2666
2675
|
return t.format(e, {
|
|
2667
2676
|
parser: "babel-ts",
|
|
2668
2677
|
plugins: r
|
|
2669
2678
|
});
|
|
2670
|
-
}),
|
|
2671
|
-
const { prettier: t, plugins: r } = await
|
|
2679
|
+
}), ca = async (e) => qt(e, async () => {
|
|
2680
|
+
const { prettier: t, plugins: r } = await Fn();
|
|
2672
2681
|
return t.format(e, {
|
|
2673
2682
|
parser: "html",
|
|
2674
2683
|
plugins: r
|
|
2675
2684
|
});
|
|
2676
|
-
}),
|
|
2685
|
+
}), un = (e) => e.trim().toLowerCase().replace(/\s+/g, "_"), ua = (e) => {
|
|
2677
2686
|
const t = e.indexOf("|");
|
|
2678
|
-
if (t === -1) return { key:
|
|
2687
|
+
if (t === -1) return { key: un(e) };
|
|
2679
2688
|
const r = e.slice(0, t), n = e.slice(t + 1).trim().replace(/^['"]|['"]$/g, "");
|
|
2680
2689
|
return {
|
|
2681
|
-
key:
|
|
2690
|
+
key: un(r),
|
|
2682
2691
|
pipeDefault: n
|
|
2683
2692
|
};
|
|
2684
|
-
},
|
|
2685
|
-
const { key: i, pipeDefault: o } =
|
|
2693
|
+
}, dn = (e, t, r) => !r || !e ? e : e.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (n, a) => {
|
|
2694
|
+
const { key: i, pipeDefault: o } = ua(a);
|
|
2686
2695
|
return Object.prototype.hasOwnProperty.call(t, i) && t[i] !== "" ? t[i] : o !== void 0 ? o : n;
|
|
2687
|
-
}),
|
|
2688
|
-
let i =
|
|
2689
|
-
return i =
|
|
2690
|
-
},
|
|
2691
|
-
function
|
|
2692
|
-
for (const t of e)
|
|
2696
|
+
}), Hn = (e, t, r, n, a) => {
|
|
2697
|
+
let i = dn(e, t, r);
|
|
2698
|
+
return i = dn(i, n, a), i;
|
|
2699
|
+
}, Wt = /* @__PURE__ */ new Map();
|
|
2700
|
+
function fo(e) {
|
|
2701
|
+
for (const t of e) Wt.set(t.key, t);
|
|
2693
2702
|
}
|
|
2694
|
-
function
|
|
2695
|
-
return [...
|
|
2703
|
+
function da() {
|
|
2704
|
+
return [...Wt.keys()];
|
|
2696
2705
|
}
|
|
2697
|
-
function
|
|
2698
|
-
return
|
|
2706
|
+
function pa(e, t) {
|
|
2707
|
+
return Wt.get(e)?.tokens?.[t];
|
|
2699
2708
|
}
|
|
2700
|
-
var
|
|
2709
|
+
var Vt = {
|
|
2701
2710
|
unsubscribe_url: {
|
|
2702
2711
|
handlebars: "{{{unsubscribe_url}}}",
|
|
2703
2712
|
sendgrid: "{{{unsubscribe_url}}}",
|
|
@@ -2812,7 +2821,7 @@ var Wt = {
|
|
|
2812
2821
|
hubspot: "{{ today }}",
|
|
2813
2822
|
sfmc: "%%=Format(Now(),'M/d/yyyy')=%%"
|
|
2814
2823
|
}
|
|
2815
|
-
},
|
|
2824
|
+
}, ma = (e, t, r) => {
|
|
2816
2825
|
const n = !!r?.trim(), a = r?.trim() ?? "";
|
|
2817
2826
|
switch (t) {
|
|
2818
2827
|
case "liquid":
|
|
@@ -2841,7 +2850,7 @@ var Wt = {
|
|
|
2841
2850
|
default:
|
|
2842
2851
|
return `{{ ${e} }}`;
|
|
2843
2852
|
}
|
|
2844
|
-
},
|
|
2853
|
+
}, pn = (e, t, r) => {
|
|
2845
2854
|
const n = r.trim();
|
|
2846
2855
|
if (!n) return e;
|
|
2847
2856
|
switch (t) {
|
|
@@ -2865,38 +2874,38 @@ var Wt = {
|
|
|
2865
2874
|
default:
|
|
2866
2875
|
return e;
|
|
2867
2876
|
}
|
|
2868
|
-
},
|
|
2869
|
-
const n =
|
|
2877
|
+
}, mn = (e, t, r) => {
|
|
2878
|
+
const n = Vt[e];
|
|
2870
2879
|
if (n) {
|
|
2871
2880
|
const i = n[t];
|
|
2872
|
-
if (i) return r?.trim() ?
|
|
2881
|
+
if (i) return r?.trim() ? pn(i, t, r) : i;
|
|
2873
2882
|
}
|
|
2874
|
-
const a =
|
|
2875
|
-
return a ? r?.trim() ?
|
|
2876
|
-
},
|
|
2883
|
+
const a = pa(e, t);
|
|
2884
|
+
return a ? r?.trim() ? pn(a, t, r) : a : ma(e, t, r);
|
|
2885
|
+
}, fa = (e, t) => {
|
|
2877
2886
|
if (!e) return "";
|
|
2878
|
-
let r = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, a, i) =>
|
|
2879
|
-
return r = r.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (n, a, i, o, l, c,
|
|
2880
|
-
const
|
|
2881
|
-
return
|
|
2887
|
+
let r = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, a, i) => mn(a, t, i?.trim() || void 0));
|
|
2888
|
+
return r = r.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (n, a, i, o, l, c, m) => {
|
|
2889
|
+
const b = (a ?? i ?? o ?? "").trim(), h = (l ?? c ?? m ?? "").trim();
|
|
2890
|
+
return mn(b, t, h || void 0);
|
|
2882
2891
|
}), r;
|
|
2883
|
-
},
|
|
2892
|
+
}, go = () => [...Object.keys(Vt), ...da()], ho = (e, t) => Vt[e]?.[t] ?? null, Ge = (e) => {
|
|
2884
2893
|
let t = (e ?? "").trim().replace(/[^A-Za-z0-9_$]+/g, "_");
|
|
2885
2894
|
return /^[0-9]/.test(t) && (t = `_${t}`), t || "_tag";
|
|
2886
|
-
},
|
|
2895
|
+
}, fn = (e, t) => {
|
|
2887
2896
|
const r = e.trim();
|
|
2888
2897
|
return r ? t?.trim() ? `{${r} ?? "${t.trim().replace(/"/g, '\\"')}"}` : `{${r}}` : "";
|
|
2889
|
-
},
|
|
2898
|
+
}, ga = (e) => {
|
|
2890
2899
|
if (!e) return "";
|
|
2891
|
-
let t = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (r, n, a) =>
|
|
2900
|
+
let t = e.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (r, n, a) => fn(n, a?.trim() || void 0));
|
|
2892
2901
|
return t = t.replace(/\{\{\s*(?:'([^']*)'|"([^"]*)"|(\w+))(?:\s*\|\s*(?:'([^']*)'|"([^"]*)"|([^'"\}\s][^'"\}]*?)))?\s*\}\}/g, (r, n, a, i, o, l, c) => {
|
|
2893
|
-
const
|
|
2894
|
-
return
|
|
2902
|
+
const m = (n ?? a ?? i ?? "").trim(), b = (o ?? l ?? c ?? "").trim();
|
|
2903
|
+
return fn(m, b || void 0);
|
|
2895
2904
|
}), t = t.replace(/(\b(?!style=)\w[\w-]*=)"([^"]*\{[^}]+\}[^"]*)"/g, (r, n, a) => {
|
|
2896
2905
|
const i = a.match(/^\{(\w+)\}$/);
|
|
2897
2906
|
return i ? `${n}{${i[1]}}` : `${n}{\`${a.replace(/\{(\w+)\}/g, "${$1}")}\`}`;
|
|
2898
2907
|
}), t;
|
|
2899
|
-
},
|
|
2908
|
+
}, ha = (e) => {
|
|
2900
2909
|
if (e.length === 0) return {
|
|
2901
2910
|
propsInterface: "",
|
|
2902
2911
|
propsDestructure: ""
|
|
@@ -2911,7 +2920,7 @@ ${r.map(([n]) => ` ${n}?: string;`).join(`
|
|
|
2911
2920
|
}`,
|
|
2912
2921
|
propsDestructure: `{ ${r.map(([n, a]) => a?.trim() ? `${n} = "${a.trim().replace(/"/g, '\\"')}"` : n).join(", ")} }: EmailProps`
|
|
2913
2922
|
};
|
|
2914
|
-
},
|
|
2923
|
+
}, va = (e) => {
|
|
2915
2924
|
const t = /* @__PURE__ */ new Map();
|
|
2916
2925
|
for (const r of e.matchAll(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs)) {
|
|
2917
2926
|
const n = r[1].trim();
|
|
@@ -2925,11 +2934,11 @@ ${r.map(([n]) => ` ${n}?: string;`).join(`
|
|
|
2925
2934
|
tagId: r,
|
|
2926
2935
|
fallback: n
|
|
2927
2936
|
}));
|
|
2928
|
-
},
|
|
2937
|
+
}, ba = (e) => {
|
|
2929
2938
|
const t = /* @__PURE__ */ new Set(), r = (a) => {
|
|
2930
2939
|
if (a?.enabled) {
|
|
2931
|
-
for (const i of a.rules ?? []) i.tag?.trim() && t.add(
|
|
2932
|
-
for (const i of a.groups ?? []) for (const o of i.rules ?? []) o.tag?.trim() && t.add(
|
|
2940
|
+
for (const i of a.rules ?? []) i.tag?.trim() && t.add(Ge(i.tag));
|
|
2941
|
+
for (const i of a.groups ?? []) for (const o of i.rules ?? []) o.tag?.trim() && t.add(Ge(o.tag));
|
|
2933
2942
|
}
|
|
2934
2943
|
}, n = (a) => {
|
|
2935
2944
|
for (const i of a) if (i.type === "row") {
|
|
@@ -2947,43 +2956,43 @@ ${r.map(([n]) => ` ${n}?: string;`).join(`
|
|
|
2947
2956
|
r(i.props?.visibility), n(i.children ?? i.components ?? []);
|
|
2948
2957
|
}
|
|
2949
2958
|
return [...t];
|
|
2950
|
-
},
|
|
2959
|
+
}, $a = (e) => e.length === 0 ? "" : ` // Visibility data — replace with real values from your data source
|
|
2951
2960
|
${e.map((t) => ` const ${t} = "";`).join(`
|
|
2952
|
-
`)}`,
|
|
2961
|
+
`)}`, Un = (e, t, r, n, a = !1) => {
|
|
2953
2962
|
const i = n?.mergeTagActive || n?.linkTagActive;
|
|
2954
|
-
if (t === "wrap" || !i) return
|
|
2963
|
+
if (t === "wrap" || !i) return fa(e, r);
|
|
2955
2964
|
if (a) {
|
|
2956
|
-
const { mergeTagContext: o, mergeTagActive: l, linkTagContext: c, linkTagActive:
|
|
2957
|
-
return
|
|
2965
|
+
const { mergeTagContext: o, mergeTagActive: l, linkTagContext: c, linkTagActive: m } = n;
|
|
2966
|
+
return Hn(e, o ?? {}, l ?? !1, c ?? {}, m ?? !1);
|
|
2958
2967
|
}
|
|
2959
2968
|
return e;
|
|
2960
|
-
},
|
|
2969
|
+
}, Jn = (e, t, r) => {
|
|
2961
2970
|
if (t === "wrap" || !r) return e;
|
|
2962
2971
|
const { mergeTagContext: n, mergeTagActive: a, linkTagContext: i, linkTagActive: o } = r;
|
|
2963
|
-
return !a && !o ? e :
|
|
2964
|
-
},
|
|
2965
|
-
function
|
|
2966
|
-
|
|
2972
|
+
return !a && !o ? e : Hn(e, n, a, i, o);
|
|
2973
|
+
}, Kt = /* @__PURE__ */ new Map(), Gn = /* @__PURE__ */ new Map();
|
|
2974
|
+
function vo(e, t, r) {
|
|
2975
|
+
Kt.set(e, t), r && Gn.set(e, r);
|
|
2967
2976
|
}
|
|
2968
|
-
var
|
|
2977
|
+
var ya = {
|
|
2969
2978
|
label: "Custom",
|
|
2970
2979
|
group: "custom",
|
|
2971
2980
|
description: "Registered ESP syntax with no metadata override.",
|
|
2972
2981
|
supportsNesting: !0
|
|
2973
2982
|
};
|
|
2974
|
-
function
|
|
2975
|
-
return t[e] ??
|
|
2983
|
+
function Sa(e, t) {
|
|
2984
|
+
return t[e] ?? Kt.get(e) ?? ya;
|
|
2976
2985
|
}
|
|
2977
|
-
function
|
|
2978
|
-
return
|
|
2986
|
+
function qn(e) {
|
|
2987
|
+
return Gn.get(e);
|
|
2979
2988
|
}
|
|
2980
|
-
function
|
|
2981
|
-
return [...
|
|
2989
|
+
function bo() {
|
|
2990
|
+
return [...Kt.entries()].map(([e, t]) => ({
|
|
2982
2991
|
id: e,
|
|
2983
2992
|
meta: t
|
|
2984
2993
|
}));
|
|
2985
2994
|
}
|
|
2986
|
-
var
|
|
2995
|
+
var ka = {
|
|
2987
2996
|
handlebars: {
|
|
2988
2997
|
label: "Handlebars (Generic)",
|
|
2989
2998
|
group: "handlebars",
|
|
@@ -3079,7 +3088,7 @@ var ya = {
|
|
|
3079
3088
|
description: "Microsoft Office VML conditional comments for Outlook",
|
|
3080
3089
|
supportsNesting: !1
|
|
3081
3090
|
}
|
|
3082
|
-
},
|
|
3091
|
+
}, $o = [
|
|
3083
3092
|
{
|
|
3084
3093
|
syntax: "handlebars",
|
|
3085
3094
|
label: "Handlebars",
|
|
@@ -3290,8 +3299,8 @@ var ya = {
|
|
|
3290
3299
|
is_empty: "none",
|
|
3291
3300
|
date: "none"
|
|
3292
3301
|
}
|
|
3293
|
-
],
|
|
3294
|
-
const r =
|
|
3302
|
+
], wa = (e, t) => {
|
|
3303
|
+
const r = Ge(e);
|
|
3295
3304
|
switch (t) {
|
|
3296
3305
|
case "sfmc":
|
|
3297
3306
|
return `AttributeValue("${r}")`;
|
|
@@ -3303,7 +3312,7 @@ var ya = {
|
|
|
3303
3312
|
return r;
|
|
3304
3313
|
}
|
|
3305
3314
|
}, Te = (e, t) => {
|
|
3306
|
-
const { operator: r, value: n } = e, a =
|
|
3315
|
+
const { operator: r, value: n } = e, a = wa(e.tag, t);
|
|
3307
3316
|
switch (t) {
|
|
3308
3317
|
case "handlebars":
|
|
3309
3318
|
case "sendgrid":
|
|
@@ -3379,9 +3388,9 @@ var ya = {
|
|
|
3379
3388
|
case "is_not_empty":
|
|
3380
3389
|
return `${a} != blank`;
|
|
3381
3390
|
case "date_before":
|
|
3382
|
-
return `${
|
|
3391
|
+
return `${Bt(e.tag)} < ${Ot(e.tag, n)}`;
|
|
3383
3392
|
case "date_after":
|
|
3384
|
-
return `${
|
|
3393
|
+
return `${Bt(e.tag)} > ${Ot(e.tag, n)}`;
|
|
3385
3394
|
case "date_on":
|
|
3386
3395
|
return `${a} | date: '%F' == '${n}'`;
|
|
3387
3396
|
default:
|
|
@@ -3544,7 +3553,7 @@ var ya = {
|
|
|
3544
3553
|
default:
|
|
3545
3554
|
return `${a} == '${n}'`;
|
|
3546
3555
|
}
|
|
3547
|
-
},
|
|
3556
|
+
}, gn = (e, t, r) => {
|
|
3548
3557
|
if (e.length === 1) return e[0];
|
|
3549
3558
|
switch (r) {
|
|
3550
3559
|
case "handlebars":
|
|
@@ -3567,8 +3576,8 @@ var ya = {
|
|
|
3567
3576
|
default:
|
|
3568
3577
|
return e.join(t === "all" ? " && " : " || ");
|
|
3569
3578
|
}
|
|
3570
|
-
},
|
|
3571
|
-
const r =
|
|
3579
|
+
}, Wn = (e, t) => {
|
|
3580
|
+
const r = qn(t)?.wrapOpenTag;
|
|
3572
3581
|
if (r) return r(e);
|
|
3573
3582
|
switch (t) {
|
|
3574
3583
|
case "handlebars":
|
|
@@ -3597,8 +3606,8 @@ var ya = {
|
|
|
3597
3606
|
default:
|
|
3598
3607
|
return `{{#if ${e}}}`;
|
|
3599
3608
|
}
|
|
3600
|
-
},
|
|
3601
|
-
const t =
|
|
3609
|
+
}, Vn = (e) => {
|
|
3610
|
+
const t = qn(e)?.wrapCloseTag;
|
|
3602
3611
|
if (t) return t();
|
|
3603
3612
|
switch (e) {
|
|
3604
3613
|
case "handlebars":
|
|
@@ -3627,29 +3636,29 @@ var ya = {
|
|
|
3627
3636
|
default:
|
|
3628
3637
|
return "{{/if}}";
|
|
3629
3638
|
}
|
|
3630
|
-
},
|
|
3639
|
+
}, Bt = (e) => `__esp_ts_${e.replace(/[^a-zA-Z0-9]/g, "_")}`, Ot = (e, t) => `__esp_cmp_${e.replace(/[^a-zA-Z0-9]/g, "_")}_${t.replace(/[^a-zA-Z0-9]/g, "_")}`, xa = (e) => {
|
|
3631
3640
|
const t = /* @__PURE__ */ new Set(), r = [];
|
|
3632
3641
|
for (const n of e) {
|
|
3633
3642
|
const a = n.operator;
|
|
3634
3643
|
if (a !== "date_before" && a !== "date_after") continue;
|
|
3635
|
-
const i =
|
|
3636
|
-
t.has(i) || (t.add(i), r.push(`{%- assign ${i} = ${
|
|
3644
|
+
const i = Bt(n.tag), o = Ot(n.tag, n.value);
|
|
3645
|
+
t.has(i) || (t.add(i), r.push(`{%- assign ${i} = ${Ge(n.tag)} | date: '%s' -%}`)), t.has(o) || (t.add(o), r.push(`{%- assign ${o} = '${n.value}' | date: '%s' -%}`));
|
|
3637
3646
|
}
|
|
3638
3647
|
return r;
|
|
3639
|
-
},
|
|
3640
|
-
const r = (o, l) => o.length === 0 ? l : [...o].reverse().reduce((c,
|
|
3648
|
+
}, Ca = (e) => e === "liquid" || e === "klaviyo" || e === "braze" || e === "hubspot", _a = (e, t) => {
|
|
3649
|
+
const r = (o, l) => o.length === 0 ? l : [...o].reverse().reduce((c, m) => `*|IF:${m}|*
|
|
3641
3650
|
${c}
|
|
3642
3651
|
*|END:IF|*`, l), n = (o, l) => o.length === 0 ? l : o.map((c) => `*|IF:${c}|*
|
|
3643
3652
|
${l}
|
|
3644
3653
|
*|END:IF|*`).join(`
|
|
3645
3654
|
`), a = (o, l, c) => {
|
|
3646
|
-
const
|
|
3647
|
-
return
|
|
3655
|
+
const m = o.map((b) => Te(b, "mailchimp")).filter((b) => b !== null);
|
|
3656
|
+
return m.length === 0 ? null : l === "all" ? r(m, c) : n(m, c);
|
|
3648
3657
|
}, i = (t.rules ?? []).map((o) => Te(o, "mailchimp")).filter((o) => o !== null);
|
|
3649
3658
|
if (t.match === "all") {
|
|
3650
3659
|
let o = e;
|
|
3651
3660
|
for (const l of [...t.groups ?? []].reverse()) {
|
|
3652
|
-
const c = l.rules.map((
|
|
3661
|
+
const c = l.rules.map((m) => Te(m, "mailchimp")).filter((m) => m !== null);
|
|
3653
3662
|
c.length !== 0 && (o = l.match === "all" ? r(c, o) : n(c, o));
|
|
3654
3663
|
}
|
|
3655
3664
|
return i.length > 0 ? r(i, o) : o;
|
|
@@ -3660,55 +3669,55 @@ ${e}
|
|
|
3660
3669
|
return o.length > 0 ? o.join(`
|
|
3661
3670
|
`) : e;
|
|
3662
3671
|
}
|
|
3663
|
-
},
|
|
3664
|
-
const r =
|
|
3672
|
+
}, Kn = (e, t) => {
|
|
3673
|
+
const r = Sa(t, ka), n = (e.rules ?? []).map((o) => Te(o, t)).filter((o) => o !== null);
|
|
3665
3674
|
let a;
|
|
3666
3675
|
r.supportsNesting ? a = (e.groups ?? []).map((o) => {
|
|
3667
|
-
const l = o.rules.map((
|
|
3676
|
+
const l = o.rules.map((m) => Te(m, t)).filter((m) => m !== null);
|
|
3668
3677
|
if (l.length === 0) return null;
|
|
3669
|
-
const c =
|
|
3678
|
+
const c = gn(l, o.match, t);
|
|
3670
3679
|
return l.length > 1 ? `(${c})` : c;
|
|
3671
3680
|
}).filter((o) => o !== null) : a = (e.groups ?? []).flatMap((o) => o.rules).map((o) => Te(o, t)).filter((o) => o !== null);
|
|
3672
3681
|
const i = [...n, ...a];
|
|
3673
3682
|
return i.length === 0 ? null : {
|
|
3674
|
-
expression:
|
|
3675
|
-
preludes:
|
|
3683
|
+
expression: gn(i, e.match, t),
|
|
3684
|
+
preludes: Ca(t) ? xa([...e.rules ?? [], ...(e.groups ?? []).flatMap((o) => o.rules)]) : []
|
|
3676
3685
|
};
|
|
3677
3686
|
}, be = (e, t, r = "handlebars") => {
|
|
3678
3687
|
if (!t?.enabled) return e;
|
|
3679
3688
|
const n = (t.rules?.length ?? 0) > 0, a = (t.groups?.length ?? 0) > 0;
|
|
3680
3689
|
if (!n && !a) return e;
|
|
3681
|
-
if (r === "mailchimp") return
|
|
3682
|
-
const i =
|
|
3690
|
+
if (r === "mailchimp") return _a(e, t);
|
|
3691
|
+
const i = Kn(t, r);
|
|
3683
3692
|
if (!i) return e;
|
|
3684
|
-
const { expression: o, preludes: l } = i, c =
|
|
3693
|
+
const { expression: o, preludes: l } = i, c = Wn(o, r), m = Vn(r);
|
|
3685
3694
|
return `${l.length > 0 ? `${l.join(`
|
|
3686
3695
|
`)}
|
|
3687
3696
|
` : ""}${c}
|
|
3688
3697
|
${e}
|
|
3689
|
-
${
|
|
3690
|
-
},
|
|
3698
|
+
${m}`;
|
|
3699
|
+
}, yo = (e, t = "handlebars") => {
|
|
3691
3700
|
if (!e?.enabled) return null;
|
|
3692
3701
|
const r = (e.rules?.length ?? 0) > 0, n = (e.groups?.length ?? 0) > 0;
|
|
3693
3702
|
if (!r && !n) return null;
|
|
3694
3703
|
if (t === "mailchimp") {
|
|
3695
|
-
const c = [...e.rules ?? [], ...(e.groups ?? []).flatMap((
|
|
3696
|
-
return
|
|
3697
|
-
openTag: `*|IF:${
|
|
3704
|
+
const c = [...e.rules ?? [], ...(e.groups ?? []).flatMap((b) => b.rules)], m = c.map((b) => Te(b, "mailchimp")).find((b) => b !== null);
|
|
3705
|
+
return m ? {
|
|
3706
|
+
openTag: `*|IF:${m}|*${c.length > 1 && e.match === "all" ? " …nested…" : ""}`,
|
|
3698
3707
|
closeTag: "*|END:IF|*"
|
|
3699
3708
|
} : null;
|
|
3700
3709
|
}
|
|
3701
|
-
const a =
|
|
3710
|
+
const a = Kn(e, t);
|
|
3702
3711
|
if (!a) return null;
|
|
3703
|
-
const { expression: i, preludes: o } = a, l =
|
|
3712
|
+
const { expression: i, preludes: o } = a, l = Wn(i, t);
|
|
3704
3713
|
return {
|
|
3705
3714
|
openTag: `${o.length > 0 ? `${o.join(`
|
|
3706
3715
|
`)}
|
|
3707
3716
|
` : ""}${l}`,
|
|
3708
|
-
closeTag:
|
|
3717
|
+
closeTag: Vn(t)
|
|
3709
3718
|
};
|
|
3710
|
-
},
|
|
3711
|
-
const t =
|
|
3719
|
+
}, Yn = (e) => {
|
|
3720
|
+
const t = Ge(e.tag), r = String(e.value ?? "");
|
|
3712
3721
|
switch (e.operator) {
|
|
3713
3722
|
case "==":
|
|
3714
3723
|
return `String(${t}).toLowerCase() === ${JSON.stringify(r.toLowerCase())}`;
|
|
@@ -3751,12 +3760,12 @@ ${d}`;
|
|
|
3751
3760
|
default:
|
|
3752
3761
|
return "true";
|
|
3753
3762
|
}
|
|
3754
|
-
},
|
|
3763
|
+
}, Ta = (e) => {
|
|
3755
3764
|
if (!e.rules.length) return null;
|
|
3756
|
-
const t = e.rules.map(
|
|
3765
|
+
const t = e.rules.map(Yn);
|
|
3757
3766
|
return t.length === 1 ? t[0] : `(${t.join(e.match === "any" ? " || " : " && ")})`;
|
|
3758
|
-
},
|
|
3759
|
-
const t = (e.rules ?? []).map(
|
|
3767
|
+
}, Aa = (e) => {
|
|
3768
|
+
const t = (e.rules ?? []).map(Yn), r = (e.groups ?? []).map(Ta).filter((i) => i !== null), n = [...t, ...r];
|
|
3760
3769
|
if (n.length === 0) return null;
|
|
3761
3770
|
if (n.length === 1) return n[0];
|
|
3762
3771
|
const a = e.match === "any" ? " || " : " && ";
|
|
@@ -3765,7 +3774,7 @@ ${d}`;
|
|
|
3765
3774
|
if (!t?.enabled) return e;
|
|
3766
3775
|
const r = (t.rules?.length ?? 0) > 0, n = (t.groups?.length ?? 0) > 0;
|
|
3767
3776
|
if (!r && !n) return e;
|
|
3768
|
-
const a =
|
|
3777
|
+
const a = Aa(t);
|
|
3769
3778
|
return a ? `{${a} && (
|
|
3770
3779
|
${e.split(`
|
|
3771
3780
|
`).map((i) => ` ${i}`).join(`
|
|
@@ -3774,9 +3783,9 @@ ${e.split(`
|
|
|
3774
3783
|
}, Ae = ({ content: e, filename: t, mimeType: r }) => {
|
|
3775
3784
|
const n = new Blob([e], { type: r }), a = URL.createObjectURL(n), i = document.createElement("a");
|
|
3776
3785
|
i.href = a, i.download = t, i.click(), URL.revokeObjectURL(a);
|
|
3777
|
-
},
|
|
3778
|
-
function
|
|
3779
|
-
const t = e.split(
|
|
3786
|
+
}, gt = (e) => e.toLowerCase().replace(/\s+/g, "-"), Ne = (e, t) => `${e}${t === "wrap" ? "-master" : "-snapshot"}`, Ra = /(<style[\s>][\s\S]*?<\/style>|<script[\s>][\s\S]*?<\/script>|<!--[\s\S]*?-->)/gi;
|
|
3787
|
+
function Xn(e) {
|
|
3788
|
+
const t = e.split(Ra), r = [];
|
|
3780
3789
|
return t.forEach((n, a) => {
|
|
3781
3790
|
if (a % 2 === 1) {
|
|
3782
3791
|
let i = n.replace(/^[ \t]+|[ \t]+$/gm, "");
|
|
@@ -3788,13 +3797,13 @@ function Yn(e) {
|
|
|
3788
3797
|
}
|
|
3789
3798
|
}), r.join("");
|
|
3790
3799
|
}
|
|
3791
|
-
function
|
|
3792
|
-
return e &&
|
|
3800
|
+
function Ea(e) {
|
|
3801
|
+
return e && Xn(e);
|
|
3793
3802
|
}
|
|
3794
|
-
function
|
|
3795
|
-
return e &&
|
|
3803
|
+
function Ma(e) {
|
|
3804
|
+
return e && Xn(e);
|
|
3796
3805
|
}
|
|
3797
|
-
function
|
|
3806
|
+
function Ia(e) {
|
|
3798
3807
|
if (!e) return e;
|
|
3799
3808
|
let t = e.replace(/^[ \t]+|[ \t]+$/gm, "");
|
|
3800
3809
|
return t = t.replace(/\n{3,}/g, `
|
|
@@ -3804,72 +3813,72 @@ function Ea(e) {
|
|
|
3804
3813
|
function Be(e, t) {
|
|
3805
3814
|
switch (e) {
|
|
3806
3815
|
case "html":
|
|
3807
|
-
return
|
|
3816
|
+
return Ea(t);
|
|
3808
3817
|
case "mjml":
|
|
3809
|
-
return
|
|
3818
|
+
return Ma(t);
|
|
3810
3819
|
case "react-email":
|
|
3811
|
-
return
|
|
3820
|
+
return Ia(t);
|
|
3812
3821
|
default:
|
|
3813
3822
|
return t;
|
|
3814
3823
|
}
|
|
3815
3824
|
}
|
|
3816
|
-
var
|
|
3817
|
-
function
|
|
3825
|
+
var Qn = "maildeno:export:minify", st = L(Na());
|
|
3826
|
+
function Na() {
|
|
3818
3827
|
if (typeof window > "u") return !1;
|
|
3819
3828
|
try {
|
|
3820
|
-
return localStorage.getItem(
|
|
3829
|
+
return localStorage.getItem(Qn) === "true";
|
|
3821
3830
|
} catch {
|
|
3822
3831
|
return !1;
|
|
3823
3832
|
}
|
|
3824
3833
|
}
|
|
3825
|
-
|
|
3834
|
+
vn(st, (e) => {
|
|
3826
3835
|
if (!(typeof window > "u"))
|
|
3827
3836
|
try {
|
|
3828
|
-
localStorage.setItem(
|
|
3837
|
+
localStorage.setItem(Qn, String(e));
|
|
3829
3838
|
} catch {
|
|
3830
3839
|
}
|
|
3831
3840
|
});
|
|
3832
|
-
function
|
|
3841
|
+
function Yt() {
|
|
3833
3842
|
return {
|
|
3834
|
-
minifyOutput:
|
|
3843
|
+
minifyOutput: st,
|
|
3835
3844
|
toggleMinify: () => {
|
|
3836
|
-
|
|
3845
|
+
st.value = !st.value;
|
|
3837
3846
|
}
|
|
3838
3847
|
};
|
|
3839
3848
|
}
|
|
3840
|
-
var
|
|
3841
|
-
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS:
|
|
3849
|
+
var Ba = 5, Oa = (e) => {
|
|
3850
|
+
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: m, buildMobileStyleBlock: b } = e, { evaluateVisibility: h } = mt(), R = (s) => s.type === "component" ? s.props?.visibility : s.visibility, E = (s) => {
|
|
3842
3851
|
if (!s?.enabled) return !1;
|
|
3843
|
-
const
|
|
3844
|
-
return
|
|
3845
|
-
},
|
|
3846
|
-
let
|
|
3847
|
-
for (const
|
|
3848
|
-
if (C === "prune" && !
|
|
3849
|
-
const
|
|
3850
|
-
if (
|
|
3851
|
-
if (_ >=
|
|
3852
|
-
const
|
|
3853
|
-
|
|
3852
|
+
const y = (s.rules?.length ?? 0) > 0, C = (s.groups?.length ?? 0) > 0;
|
|
3853
|
+
return y || C;
|
|
3854
|
+
}, x = (s, y, C, _) => {
|
|
3855
|
+
let f = "";
|
|
3856
|
+
for (const p of s) {
|
|
3857
|
+
if (C === "prune" && !h(R(p), y)) continue;
|
|
3858
|
+
const g = p.type;
|
|
3859
|
+
if (g === "row") {
|
|
3860
|
+
if (_ >= Ba) continue;
|
|
3861
|
+
const v = N(p, y, C, _ + 1);
|
|
3862
|
+
v.trim() && (f += `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">${v}</table>`);
|
|
3854
3863
|
continue;
|
|
3855
3864
|
}
|
|
3856
|
-
if (
|
|
3857
|
-
if (!
|
|
3858
|
-
const
|
|
3859
|
-
let
|
|
3860
|
-
C === "wrap" &&
|
|
3865
|
+
if (g === "row-spacer") {
|
|
3866
|
+
if (!p.height || p.height <= 0) continue;
|
|
3867
|
+
const v = ue(p);
|
|
3868
|
+
let S = `<div height="${p.height}" style="height:${p.height}px;line-height:${p.height}px;font-size:1px;mso-line-height-rule:exactly;${v.join(";")}"> </div>`;
|
|
3869
|
+
C === "wrap" && E(p.visibility) && (S = be(S, p.visibility, a.value)), f += S;
|
|
3861
3870
|
continue;
|
|
3862
3871
|
}
|
|
3863
|
-
let
|
|
3864
|
-
const
|
|
3865
|
-
C === "wrap" &&
|
|
3872
|
+
let w = Jn(n.html(p), C, o?.value);
|
|
3873
|
+
const $ = p.props?.visibility;
|
|
3874
|
+
C === "wrap" && E($) && (w = be(w, $, a.value)), f += w;
|
|
3866
3875
|
}
|
|
3867
|
-
return
|
|
3868
|
-
},
|
|
3876
|
+
return f;
|
|
3877
|
+
}, N = (s, y, C, _ = 0) => {
|
|
3869
3878
|
if (s.type === "row-spacer") {
|
|
3870
3879
|
if (!s.height || s.height <= 0) return "";
|
|
3871
|
-
const I =
|
|
3872
|
-
let
|
|
3880
|
+
const I = ue(s);
|
|
3881
|
+
let P = `
|
|
3873
3882
|
<tr>
|
|
3874
3883
|
<td>
|
|
3875
3884
|
<div height="${s.height}" style="height:${s.height}px;line-height:${s.height}px;font-size:1px;mso-line-height-rule:exactly;${I.join(";")}">
|
|
@@ -3877,66 +3886,66 @@ var Ia = 5, Na = (e) => {
|
|
|
3877
3886
|
</td>
|
|
3878
3887
|
</tr>
|
|
3879
3888
|
`;
|
|
3880
|
-
return C === "wrap" &&
|
|
3889
|
+
return C === "wrap" && E(s.visibility) && (P = be(P, s.visibility, a.value)), P;
|
|
3881
3890
|
}
|
|
3882
|
-
const
|
|
3883
|
-
let
|
|
3891
|
+
const f = ue(s), p = r.value.mobileBreakpoint || 600, g = (s.gap || 0) / p * 100, w = 100 - g * (s.columns.length - 1), $ = [];
|
|
3892
|
+
let v = 0;
|
|
3884
3893
|
s.columns.forEach((I) => {
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3894
|
+
const P = I.width / 100 * w;
|
|
3895
|
+
$.push(P), v += P;
|
|
3887
3896
|
});
|
|
3888
|
-
const
|
|
3889
|
-
Math.abs(
|
|
3890
|
-
let
|
|
3891
|
-
s.columns.forEach((I,
|
|
3892
|
-
if (C === "prune" && !
|
|
3893
|
-
const V =
|
|
3897
|
+
const S = w - v;
|
|
3898
|
+
Math.abs(S) > 0.01 && $.length > 0 && ($[$.length - 1] += S);
|
|
3899
|
+
let T = "";
|
|
3900
|
+
s.columns.forEach((I, P) => {
|
|
3901
|
+
if (C === "prune" && !h(I.props?.visibility, y)) return;
|
|
3902
|
+
const V = $[P], q = s.mobileStack ? "mobile-stack" : "", W = ue(I), Z = [
|
|
3894
3903
|
`width:${V}%`,
|
|
3895
3904
|
`max-width:${V}%`,
|
|
3896
3905
|
`vertical-align:${I.verticalAlign ?? "middle"}`,
|
|
3897
3906
|
"box-sizing:border-box",
|
|
3898
3907
|
...W,
|
|
3899
|
-
|
|
3900
|
-
`border-radius:${
|
|
3908
|
+
de(I.border),
|
|
3909
|
+
`border-radius:${X(I.border.radius)}`,
|
|
3901
3910
|
"overflow:hidden",
|
|
3902
3911
|
"line-height:0",
|
|
3903
3912
|
"font-size:0",
|
|
3904
3913
|
`padding:${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`
|
|
3905
|
-
],
|
|
3906
|
-
|
|
3907
|
-
<td valign="${I.verticalAlign ?? "middle"}"${q ? ` class="${q}"` : ""} style="${
|
|
3908
|
-
${
|
|
3914
|
+
], ee = I.children ?? I.components ?? [], me = x(ee, y, C, _);
|
|
3915
|
+
T += `
|
|
3916
|
+
<td valign="${I.verticalAlign ?? "middle"}"${q ? ` class="${q}"` : ""} style="${Z.join(";")}">
|
|
3917
|
+
${me}
|
|
3909
3918
|
</td>
|
|
3910
|
-
`,
|
|
3919
|
+
`, P < s.columns.length - 1 && s.gap && (T += `
|
|
3911
3920
|
<td
|
|
3912
3921
|
class="${q ? `gap-${s.gap} ${q}` : `gap-${s.gap}`}"
|
|
3913
|
-
width="${
|
|
3914
|
-
style="width:${
|
|
3922
|
+
width="${g}%"
|
|
3923
|
+
style="width:${g}%;max-width:${g}%;font-size:0;line-height:0;padding:0;">
|
|
3915
3924
|
|
|
3916
3925
|
</td>
|
|
3917
3926
|
`);
|
|
3918
3927
|
});
|
|
3919
|
-
const
|
|
3920
|
-
let
|
|
3928
|
+
const k = s.columns.some((I) => re(I.border?.radius ?? 0));
|
|
3929
|
+
let M = `<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(s.gap ?? 0) > 0 || k ? "separate" : "collapse"};">
|
|
3921
3930
|
<tr>
|
|
3922
|
-
${
|
|
3931
|
+
${T}
|
|
3923
3932
|
</tr>
|
|
3924
3933
|
</table>`;
|
|
3925
|
-
const
|
|
3926
|
-
...
|
|
3927
|
-
|
|
3934
|
+
const O = re(s.border?.radius ?? 0), B = [
|
|
3935
|
+
...f,
|
|
3936
|
+
O ? `border-radius:${X(s.border.radius, 2)}` : "",
|
|
3928
3937
|
"overflow:hidden"
|
|
3929
3938
|
].filter(Boolean);
|
|
3930
|
-
let
|
|
3931
|
-
return C === "wrap" &&
|
|
3939
|
+
let D = Dn(M, s.border, [], s.padding);
|
|
3940
|
+
return C === "wrap" && E(s.visibility) && (D = be(D, s.visibility, a.value)), (s.minHeight ?? 0) > 0 && B.push(`min-height:${s.minHeight}px`), `
|
|
3932
3941
|
<tr>
|
|
3933
|
-
<td${
|
|
3934
|
-
${
|
|
3942
|
+
<td${B.length ? ` style="${B.join(";")}"` : ""}>
|
|
3943
|
+
${D}
|
|
3935
3944
|
</td>
|
|
3936
3945
|
</tr>
|
|
3937
3946
|
`;
|
|
3938
|
-
},
|
|
3939
|
-
const { getGoogleFontImports: C } =
|
|
3947
|
+
}, j = (s, y) => {
|
|
3948
|
+
const { getGoogleFontImports: C } = ft(), { emailMobileStyles: _ } = Gt(), f = i?.value ?? {}, p = C([...c(s, f)]), g = m(s, f, _), w = b(r.value.mobileBreakpoint, g), $ = [
|
|
3940
3949
|
"margin:0",
|
|
3941
3950
|
"padding:0",
|
|
3942
3951
|
r.value.bodyBackgroundColor ? `background-color:${r.value.bodyBackgroundColor}` : "",
|
|
@@ -3948,7 +3957,7 @@ ${F}
|
|
|
3948
3957
|
"min-height:auto"
|
|
3949
3958
|
].join(";") : ""
|
|
3950
3959
|
].filter(Boolean).join(";");
|
|
3951
|
-
let
|
|
3960
|
+
let v = `<!DOCTYPE html>
|
|
3952
3961
|
<html lang="${r.value.language}" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
3953
3962
|
<head>
|
|
3954
3963
|
<meta charset="UTF-8">
|
|
@@ -3959,7 +3968,7 @@ ${F}
|
|
|
3959
3968
|
<meta name="color-scheme" content="light dark">
|
|
3960
3969
|
<meta name="supported-color-schemes" content="light dark">
|
|
3961
3970
|
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no">
|
|
3962
|
-
<title>${
|
|
3971
|
+
<title>${y}</title>
|
|
3963
3972
|
<!--[if mso]>
|
|
3964
3973
|
<xml>
|
|
3965
3974
|
<o:OfficeDocumentSettings>
|
|
@@ -3968,13 +3977,13 @@ ${F}
|
|
|
3968
3977
|
</o:OfficeDocumentSettings>
|
|
3969
3978
|
</xml>
|
|
3970
3979
|
<![endif]-->
|
|
3971
|
-
${
|
|
3980
|
+
${p ? `<link href="${p}" rel="stylesheet">` : ""}
|
|
3972
3981
|
<style>
|
|
3973
|
-
${
|
|
3982
|
+
${w}
|
|
3974
3983
|
</style>
|
|
3975
3984
|
</head>
|
|
3976
3985
|
|
|
3977
|
-
<body style="${
|
|
3986
|
+
<body style="${$};">
|
|
3978
3987
|
<div style="display:none;font-size:1px;color:#fefefe;line-height:1px;max-height:0;max-width:0;opacity:0;overflow:hidden;">
|
|
3979
3988
|
${r.value.preheaderText} ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌ ͏ ‌
|
|
3980
3989
|
</div>
|
|
@@ -3991,142 +4000,142 @@ ${r.value.preheaderText} ͏ ‌ ͏ ‌ ͏ ‌
|
|
|
3991
4000
|
style="width:100%;max-width:${r.value.width}px;background:${r.value.backgroundColor};border-collapse:collapse;"
|
|
3992
4001
|
>
|
|
3993
4002
|
`;
|
|
3994
|
-
return t.value.forEach((
|
|
3995
|
-
if (s === "prune" && !
|
|
3996
|
-
const
|
|
3997
|
-
|
|
3998
|
-
}),
|
|
4003
|
+
return t.value.forEach((S) => {
|
|
4004
|
+
if (s === "prune" && !h(S.visibility, f)) return;
|
|
4005
|
+
const T = N(S, f, s, 0);
|
|
4006
|
+
T.trim() && (v += T);
|
|
4007
|
+
}), v += `
|
|
3999
4008
|
</table>
|
|
4000
4009
|
</td>
|
|
4001
4010
|
</tr>
|
|
4002
4011
|
</table>
|
|
4003
4012
|
</body>
|
|
4004
4013
|
</html>
|
|
4005
|
-
`,
|
|
4014
|
+
`, v = Un(v, s, a.value, o?.value), v;
|
|
4006
4015
|
};
|
|
4007
4016
|
return {
|
|
4008
|
-
export: async (s = "prune",
|
|
4017
|
+
export: async (s = "prune", y) => {
|
|
4009
4018
|
if (!l("Export")) return;
|
|
4010
|
-
const C =
|
|
4011
|
-
if (
|
|
4019
|
+
const C = y || "Untitled Template", _ = j(s, C), f = gt(C), { minifyOutput: p } = Yt();
|
|
4020
|
+
if (p.value) Ae({
|
|
4012
4021
|
content: Be("html", _),
|
|
4013
|
-
filename: `${Ne(
|
|
4022
|
+
filename: `${Ne(f, s)}.html`,
|
|
4014
4023
|
mimeType: "text/html"
|
|
4015
4024
|
});
|
|
4016
4025
|
else {
|
|
4017
|
-
const
|
|
4026
|
+
const g = await sa(_);
|
|
4018
4027
|
Ae({
|
|
4019
|
-
content:
|
|
4020
|
-
filename: `${Ne(
|
|
4028
|
+
content: g,
|
|
4029
|
+
filename: `${Ne(f, s)}.html`,
|
|
4021
4030
|
mimeType: "text/html"
|
|
4022
4031
|
});
|
|
4023
4032
|
}
|
|
4024
4033
|
},
|
|
4025
|
-
getHTML: (s = "prune",
|
|
4034
|
+
getHTML: (s = "prune", y) => {
|
|
4026
4035
|
if (!t.value || t.value.length === 0) return null;
|
|
4027
|
-
const C =
|
|
4036
|
+
const C = j(s, y || "Untitled Template");
|
|
4028
4037
|
return Be("html", C);
|
|
4029
4038
|
}
|
|
4030
4039
|
};
|
|
4031
|
-
},
|
|
4032
|
-
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS:
|
|
4033
|
-
if (!
|
|
4034
|
-
const s = (
|
|
4035
|
-
return s ||
|
|
4036
|
-
},
|
|
4037
|
-
let
|
|
4038
|
-
for (const
|
|
4039
|
-
const
|
|
4040
|
-
if (
|
|
4041
|
-
const
|
|
4042
|
-
if (
|
|
4043
|
-
if (_ >=
|
|
4044
|
-
const
|
|
4045
|
-
|
|
4040
|
+
}, ja = 5, za = (e) => {
|
|
4041
|
+
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: m, buildMobileStyleBlock: b } = e, { evaluateVisibility: h } = mt(), R = (d) => {
|
|
4042
|
+
if (!d?.enabled) return !1;
|
|
4043
|
+
const s = (d.rules?.length ?? 0) > 0, y = (d.groups?.length ?? 0) > 0;
|
|
4044
|
+
return s || y;
|
|
4045
|
+
}, E = (d, s, y, C, _) => {
|
|
4046
|
+
let f = "";
|
|
4047
|
+
for (const p of d) {
|
|
4048
|
+
const g = p.type === "component" ? p.props?.visibility : p.visibility;
|
|
4049
|
+
if (y === "prune" && !h(g, s)) continue;
|
|
4050
|
+
const w = p.type;
|
|
4051
|
+
if (w === "row") {
|
|
4052
|
+
if (_ >= ja) continue;
|
|
4053
|
+
const v = x(p, s, y, _ + 1);
|
|
4054
|
+
v.trim() && (f += ` ${v.trim()}
|
|
4046
4055
|
`);
|
|
4047
4056
|
continue;
|
|
4048
4057
|
}
|
|
4049
|
-
if (
|
|
4050
|
-
if (!
|
|
4051
|
-
const
|
|
4052
|
-
let
|
|
4053
|
-
|
|
4058
|
+
if (w === "row-spacer") {
|
|
4059
|
+
if (!p.height || p.height <= 0) continue;
|
|
4060
|
+
const v = et(p), S = Object.keys(v).length > 0 ? `, ${Object.entries(v).map(([k, M]) => `${k}:"${M}"`).join(", ")}` : "";
|
|
4061
|
+
let T = `<div style={{ display: "block", height: "${p.height}px", lineHeight: "${p.height}px", fontSize: "1px"${S} }}> </div>`;
|
|
4062
|
+
y === "wrap" && R(p.visibility) && (T = nt(T, p.visibility)), f += ` ${T}
|
|
4054
4063
|
`;
|
|
4055
4064
|
continue;
|
|
4056
4065
|
}
|
|
4057
|
-
let
|
|
4058
|
-
|
|
4066
|
+
let $ = Jn(n.react(p), y, o?.value);
|
|
4067
|
+
y === "wrap" && R(p.props?.visibility) && ($ = nt($, p.props.visibility)), f += ` ${$.trim()}
|
|
4059
4068
|
`;
|
|
4060
4069
|
}
|
|
4061
|
-
return
|
|
4062
|
-
},
|
|
4063
|
-
if (
|
|
4064
|
-
if (
|
|
4065
|
-
if (!
|
|
4066
|
-
const I = et(
|
|
4070
|
+
return f;
|
|
4071
|
+
}, x = (d, s, y, C = 0) => {
|
|
4072
|
+
if (y === "prune" && !h(d.visibility, s)) return "";
|
|
4073
|
+
if (d.type === "row-spacer") {
|
|
4074
|
+
if (!d.height || d.height <= 0) return "";
|
|
4075
|
+
const I = et(d), P = Object.keys(I).length > 0 ? `, ${Object.entries(I).map(([q, W]) => `${q}:"${W}"`).join(", ")}` : "";
|
|
4067
4076
|
let V = `
|
|
4068
4077
|
{/* Row Spacer */}
|
|
4069
4078
|
<Section>
|
|
4070
|
-
<div style={{ display: "block", height: "${
|
|
4079
|
+
<div style={{ display: "block", height: "${d.height}px", lineHeight: "${d.height}px", fontSize: "1px"${P} }}> </div>
|
|
4071
4080
|
</Section>`;
|
|
4072
|
-
return
|
|
4081
|
+
return y === "wrap" && R(d.visibility) && (V = nt(V, d.visibility)), V;
|
|
4073
4082
|
}
|
|
4074
|
-
const _ = r.value.mobileBreakpoint || 600,
|
|
4075
|
-
let
|
|
4076
|
-
|
|
4077
|
-
const
|
|
4078
|
-
|
|
4083
|
+
const _ = r.value.mobileBreakpoint || 600, f = (d.gap || 0) / _ * 100, p = 100 - f * (d.columns.length - 1), g = [];
|
|
4084
|
+
let w = 0;
|
|
4085
|
+
d.columns.forEach((I) => {
|
|
4086
|
+
const P = I.width / 100 * p;
|
|
4087
|
+
g.push(P), w += P;
|
|
4079
4088
|
});
|
|
4080
|
-
const
|
|
4081
|
-
Math.abs(
|
|
4082
|
-
let
|
|
4083
|
-
|
|
4084
|
-
if (
|
|
4085
|
-
const V =
|
|
4089
|
+
const $ = p - w;
|
|
4090
|
+
Math.abs($) > 0.01 && g.length > 0 && (g[g.length - 1] += $);
|
|
4091
|
+
let v = "";
|
|
4092
|
+
d.columns.forEach((I, P) => {
|
|
4093
|
+
if (y === "prune" && !h(I.props?.visibility, s)) return;
|
|
4094
|
+
const V = g[P], q = d.mobileStack ? "mobile-stack" : "", W = et(I), Z = {
|
|
4086
4095
|
width: `${V}%`,
|
|
4087
4096
|
boxSizing: "border-box",
|
|
4088
4097
|
verticalAlign: I.verticalAlign ?? "middle",
|
|
4089
|
-
...
|
|
4090
|
-
borderRadius:
|
|
4098
|
+
...Rt(I.border),
|
|
4099
|
+
borderRadius: X(I.border?.radius ?? 0),
|
|
4091
4100
|
overflow: "hidden",
|
|
4092
4101
|
lineHeight: "0",
|
|
4093
4102
|
fontSize: "0",
|
|
4094
4103
|
padding: `${I.padding?.top ?? 0}px ${I.padding?.right ?? 0}px ${I.padding?.bottom ?? 0}px ${I.padding?.left ?? 0}px`,
|
|
4095
4104
|
...W
|
|
4096
|
-
},
|
|
4097
|
-
|
|
4105
|
+
}, ee = Object.entries(Z).map(([ae, ze]) => `${ae}:"${ze}"`).join(", "), me = I.children ?? I.components ?? [], Se = E(me, s, y, d, C);
|
|
4106
|
+
v += `<Column
|
|
4098
4107
|
className="${q}"
|
|
4099
|
-
style={{ ${
|
|
4108
|
+
style={{ ${ee} }}
|
|
4100
4109
|
>
|
|
4101
|
-
${
|
|
4110
|
+
${Se}
|
|
4102
4111
|
</Column>
|
|
4103
|
-
`,
|
|
4104
|
-
className="${q ? `gap-${
|
|
4105
|
-
style={{ width:"${
|
|
4112
|
+
`, P < d.columns.length - 1 && d.gap && (v += `<Column
|
|
4113
|
+
className="${q ? `gap-${d.gap} ${q}` : `gap-${d.gap}`}"
|
|
4114
|
+
style={{ width:"${f}%", maxWidth:"${f}%", fontSize:"0", lineHeight:"0" }}
|
|
4106
4115
|
> </Column>
|
|
4107
4116
|
`);
|
|
4108
4117
|
});
|
|
4109
|
-
const
|
|
4110
|
-
...
|
|
4111
|
-
...
|
|
4118
|
+
const S = et(d), T = re(d.border?.radius ?? 0), k = {
|
|
4119
|
+
...S,
|
|
4120
|
+
...T ? { borderRadius: X(d.border.radius, 2) } : {},
|
|
4112
4121
|
overflow: "hidden"
|
|
4113
|
-
},
|
|
4114
|
-
let
|
|
4115
|
-
${
|
|
4122
|
+
}, M = Object.entries(k).filter(([I, P]) => P !== void 0 && P !== "").map(([I, P]) => `${I}:"${P}"`).join(", "), O = M ? ` style={{ ${M} }}` : "", B = `<Row>${v}</Row>`;
|
|
4123
|
+
let D = ` <Section${O}>
|
|
4124
|
+
${oa(B, d.border, {}, d.padding, !0)}
|
|
4116
4125
|
</Section>`;
|
|
4117
|
-
return
|
|
4118
|
-
},
|
|
4119
|
-
const
|
|
4120
|
-
`),
|
|
4121
|
-
<link href="${
|
|
4122
|
-
fontFamily="${
|
|
4126
|
+
return y === "wrap" && R(d.visibility) && (D = nt(D, d.visibility)), D;
|
|
4127
|
+
}, N = (d = "prune", s) => {
|
|
4128
|
+
const y = s || "Untitled Template", C = y.replace(/[^a-zA-Z0-9 ]/g, "").split(" ").map((B) => B.charAt(0).toUpperCase() + B.slice(1)).join(""), { getGoogleFontImports: _ } = ft(), { emailMobileStyles: f } = Gt(), p = i?.value ?? {}, g = c(d, p), w = _([...g]), $ = m(d, p, f), v = b(r.value.mobileBreakpoint, $), S = t.value.map((B) => x(B, p, d, 0)).filter(Boolean).join(`
|
|
4129
|
+
`), T = w?.includes("fonts.googleapis.com"), k = w ? T ? ` {/* Google Fonts via <link> — all families in one request */}
|
|
4130
|
+
<link href="${w}" rel="stylesheet" />` : [...g].map((B) => ` <Font
|
|
4131
|
+
fontFamily="${pt(B)}"
|
|
4123
4132
|
fallbackFontFamily="Arial"
|
|
4124
|
-
webFont={{ url: "${
|
|
4133
|
+
webFont={{ url: "${w}", format: "woff2" }}
|
|
4125
4134
|
fontWeight={400}
|
|
4126
4135
|
fontStyle="normal"
|
|
4127
4136
|
/>`).join(`
|
|
4128
4137
|
`) : "";
|
|
4129
|
-
let
|
|
4138
|
+
let M = `import React from "react";
|
|
4130
4139
|
import {
|
|
4131
4140
|
Preview,
|
|
4132
4141
|
Body,
|
|
@@ -4145,10 +4154,10 @@ import {
|
|
|
4145
4154
|
Text,
|
|
4146
4155
|
} from "@react-email/components";
|
|
4147
4156
|
|
|
4148
|
-
${
|
|
4157
|
+
${w ? T ? "// 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"}
|
|
4149
4158
|
|
|
4150
4159
|
const styles = \`
|
|
4151
|
-
${
|
|
4160
|
+
${v}
|
|
4152
4161
|
\`;
|
|
4153
4162
|
|
|
4154
4163
|
export default function ${C}() {
|
|
@@ -4162,9 +4171,9 @@ export default function ${C}() {
|
|
|
4162
4171
|
<meta name="color-scheme" content="light dark" />
|
|
4163
4172
|
<meta name="supported-color-schemes" content="light dark" />
|
|
4164
4173
|
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no, url=no" />
|
|
4165
|
-
<title>${
|
|
4174
|
+
<title>${y}</title>
|
|
4166
4175
|
<style>{styles}</style>
|
|
4167
|
-
${
|
|
4176
|
+
${k}
|
|
4168
4177
|
</Head>
|
|
4169
4178
|
<Preview>${r.value.preheaderText}</Preview>
|
|
4170
4179
|
<Body style={{ margin:0, padding:0, backgroundColor:"${r.value.bodyBackgroundColor}" }}>
|
|
@@ -4188,7 +4197,7 @@ ${f}
|
|
|
4188
4197
|
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"
|
|
4189
4198
|
}}
|
|
4190
4199
|
>
|
|
4191
|
-
${
|
|
4200
|
+
${S}
|
|
4192
4201
|
</Container>
|
|
4193
4202
|
</Container>
|
|
4194
4203
|
</Body>
|
|
@@ -4196,207 +4205,207 @@ ${k}
|
|
|
4196
4205
|
);
|
|
4197
4206
|
}
|
|
4198
4207
|
`;
|
|
4199
|
-
const
|
|
4200
|
-
if (
|
|
4201
|
-
const
|
|
4202
|
-
(
|
|
4203
|
-
|
|
4208
|
+
const O = o?.value?.mergeTagActive || o?.value?.linkTagActive;
|
|
4209
|
+
if (d === "wrap" || !O) {
|
|
4210
|
+
const B = va(M), D = new Set(B.map((W) => W.tagId)), I = ba(t.value).filter((W) => !D.has(W)), { propsInterface: P, propsDestructure: V } = ha(B), q = $a(I);
|
|
4211
|
+
(P || q) && (M = M.replace(/^(export default function (\w+))\(\)\s*\{/m, [
|
|
4212
|
+
P ? `${P}
|
|
4204
4213
|
|
|
4205
4214
|
` : "",
|
|
4206
4215
|
`$1(${V || ""}) {`,
|
|
4207
4216
|
q ? `
|
|
4208
4217
|
${q}
|
|
4209
4218
|
` : ""
|
|
4210
|
-
].join(""))),
|
|
4219
|
+
].join(""))), M = ga(M);
|
|
4211
4220
|
}
|
|
4212
|
-
return
|
|
4221
|
+
return M = Mn(M), M;
|
|
4213
4222
|
};
|
|
4214
4223
|
return {
|
|
4215
|
-
export: async (
|
|
4224
|
+
export: async (d = "prune", s) => {
|
|
4216
4225
|
if (!l("Export")) return;
|
|
4217
|
-
const
|
|
4218
|
-
if (
|
|
4226
|
+
const y = s || "Untitled Template", C = N(d, y), _ = gt(y), { minifyOutput: f } = Yt();
|
|
4227
|
+
if (f.value) Ae({
|
|
4219
4228
|
content: Be("react-email", C),
|
|
4220
|
-
filename: `${Ne(_,
|
|
4229
|
+
filename: `${Ne(_, d)}.tsx`,
|
|
4221
4230
|
mimeType: "text/plain"
|
|
4222
4231
|
});
|
|
4223
4232
|
else {
|
|
4224
|
-
const
|
|
4233
|
+
const p = await la(C);
|
|
4225
4234
|
Ae({
|
|
4226
|
-
content:
|
|
4227
|
-
filename: `${Ne(_,
|
|
4235
|
+
content: p,
|
|
4236
|
+
filename: `${Ne(_, d)}.tsx`,
|
|
4228
4237
|
mimeType: "text/plain"
|
|
4229
4238
|
});
|
|
4230
4239
|
}
|
|
4231
4240
|
},
|
|
4232
|
-
getReactEmail: (
|
|
4241
|
+
getReactEmail: (d = "prune", s) => {
|
|
4233
4242
|
if (!t.value || t.value.length === 0) return null;
|
|
4234
|
-
const
|
|
4235
|
-
return Be("react-email",
|
|
4243
|
+
const y = N(d, s || "Untitled Template");
|
|
4244
|
+
return Be("react-email", y);
|
|
4236
4245
|
}
|
|
4237
4246
|
};
|
|
4238
|
-
},
|
|
4239
|
-
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS:
|
|
4240
|
-
if (!
|
|
4241
|
-
const
|
|
4242
|
-
return
|
|
4243
|
-
},
|
|
4247
|
+
}, La = 5, Pa = (e) => {
|
|
4248
|
+
const { rows: t, canvasStyles: r, generators: n, espSyntax: a, visibilityContext: i, tagSubstitution: o, guardEmpty: l, collectFonts: c, collectMobileCSS: m } = e, { evaluateVisibility: b } = mt(), h = (u) => {
|
|
4249
|
+
if (!u?.enabled) return !1;
|
|
4250
|
+
const d = (u.rules?.length ?? 0) > 0, s = (u.groups?.length ?? 0) > 0;
|
|
4251
|
+
return d || s;
|
|
4252
|
+
}, R = (u, d, s, y) => {
|
|
4244
4253
|
let C = "";
|
|
4245
|
-
for (const _ of
|
|
4246
|
-
const
|
|
4247
|
-
if (s === "prune" && !
|
|
4248
|
-
const
|
|
4249
|
-
if (
|
|
4250
|
-
if (
|
|
4251
|
-
const
|
|
4252
|
-
if (
|
|
4253
|
-
let
|
|
4254
|
-
s === "wrap" &&
|
|
4254
|
+
for (const _ of u) {
|
|
4255
|
+
const f = _.type === "component" ? _.props?.visibility : _.visibility;
|
|
4256
|
+
if (s === "prune" && !b(f, d)) continue;
|
|
4257
|
+
const p = _.type;
|
|
4258
|
+
if (p === "row") {
|
|
4259
|
+
if (y >= La) continue;
|
|
4260
|
+
const w = E(_, d, s, y + 1);
|
|
4261
|
+
if (w.trim()) {
|
|
4262
|
+
let $ = w;
|
|
4263
|
+
s === "wrap" && h(_.visibility) && ($ = be($, _.visibility, a.value)), C += $;
|
|
4255
4264
|
}
|
|
4256
4265
|
continue;
|
|
4257
4266
|
}
|
|
4258
|
-
if (
|
|
4267
|
+
if (p === "row-spacer") {
|
|
4259
4268
|
if (!_.height || _.height <= 0) continue;
|
|
4260
|
-
const
|
|
4261
|
-
let
|
|
4262
|
-
s === "wrap" &&
|
|
4269
|
+
const w = ue(_);
|
|
4270
|
+
let $ = `<div height="${_.height}" style="height:${_.height}px;line-height:${_.height}px;font-size:1px;mso-line-height-rule:exactly;${w.join(";")}"> </div>`;
|
|
4271
|
+
s === "wrap" && h(_.visibility) && ($ = be($, _.visibility, a.value)), C += $;
|
|
4263
4272
|
continue;
|
|
4264
4273
|
}
|
|
4265
|
-
let
|
|
4266
|
-
s === "wrap" &&
|
|
4274
|
+
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>`;
|
|
4275
|
+
s === "wrap" && h(_.props?.visibility) && (g = be(g, _.props.visibility, a.value)), C += g;
|
|
4267
4276
|
}
|
|
4268
4277
|
return C;
|
|
4269
|
-
},
|
|
4270
|
-
if (!
|
|
4271
|
-
const C =
|
|
4272
|
-
let
|
|
4273
|
-
|
|
4274
|
-
const
|
|
4275
|
-
|
|
4278
|
+
}, E = (u, d, s, y) => {
|
|
4279
|
+
if (!u.columns?.length) return "";
|
|
4280
|
+
const C = ue(u), _ = r.value.mobileBreakpoint || 600, f = u.gap || 0, p = f / _ * 100, g = 100 - p * (u.columns.length - 1), w = [];
|
|
4281
|
+
let $ = 0;
|
|
4282
|
+
u.columns.forEach((B) => {
|
|
4283
|
+
const D = B.width / 100 * g;
|
|
4284
|
+
w.push(D), $ += D;
|
|
4276
4285
|
});
|
|
4277
|
-
const
|
|
4278
|
-
Math.abs(
|
|
4279
|
-
let
|
|
4280
|
-
|
|
4281
|
-
if (s === "prune" && !
|
|
4282
|
-
const I =
|
|
4286
|
+
const v = g - $;
|
|
4287
|
+
Math.abs(v) > 0.01 && w.length > 0 && (w[w.length - 1] += v);
|
|
4288
|
+
let S = "";
|
|
4289
|
+
u.columns.forEach((B, D) => {
|
|
4290
|
+
if (s === "prune" && !b(B.props?.visibility, d)) return;
|
|
4291
|
+
const I = w[D], P = u.mobileStack ? "mobile-stack" : "", V = ue(B), q = [
|
|
4283
4292
|
`width:${I}%`,
|
|
4284
4293
|
"box-sizing:border-box",
|
|
4285
|
-
`vertical-align:${
|
|
4286
|
-
|
|
4287
|
-
`border-radius:${
|
|
4294
|
+
`vertical-align:${B.verticalAlign ?? "middle"}`,
|
|
4295
|
+
de(B.border),
|
|
4296
|
+
`border-radius:${X(B.border.radius)}`,
|
|
4288
4297
|
"overflow:hidden",
|
|
4289
4298
|
...V
|
|
4290
|
-
], W =
|
|
4291
|
-
if (
|
|
4292
|
-
${
|
|
4299
|
+
], W = B.children ?? B.components ?? [], Z = R(W, d, s, y), ee = Dn(Z, B.border, [], B.padding), me = P ? ` class="${P}"` : "";
|
|
4300
|
+
if (S += `<td valign="${B.verticalAlign ?? "middle"}"${me} style="${q.join(";")}">
|
|
4301
|
+
${ee}
|
|
4293
4302
|
</td>
|
|
4294
|
-
`,
|
|
4295
|
-
const
|
|
4296
|
-
|
|
4303
|
+
`, D < u.columns.length - 1 && f > 0) {
|
|
4304
|
+
const Se = P ? `gap-${f} ${P}` : `gap-${f}`;
|
|
4305
|
+
S += `<td class="${Se}" width="${p}%" style="width:${p}%;max-width:${p}%;font-size:0;line-height:0;padding:0;"> </td>
|
|
4297
4306
|
`;
|
|
4298
4307
|
}
|
|
4299
4308
|
});
|
|
4300
|
-
const
|
|
4301
|
-
return `<div style="padding:${
|
|
4302
|
-
<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(
|
|
4309
|
+
const T = pe(u.border) ? `${de(u.border)};border-radius:${X(u.border.radius)};overflow:hidden;` : `border-radius:${X(u.border.radius)};overflow:hidden;`, k = u.padding ? `${u.padding.top ?? 0}px ${u.padding.right ?? 0}px ${u.padding.bottom ?? 0}px ${u.padding.left ?? 0}px` : "0px", M = C.length ? `${C.join(";")};` : "", O = u.columns.some((B) => re(B.border?.radius ?? 0));
|
|
4310
|
+
return `<div style="padding:${k};${T}${M}">
|
|
4311
|
+
<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(u.gap ?? 0) > 0 || O ? "separate" : "collapse"};">
|
|
4303
4312
|
<tr>
|
|
4304
|
-
${
|
|
4313
|
+
${S}</tr>
|
|
4305
4314
|
</table>
|
|
4306
4315
|
</div>`;
|
|
4307
|
-
},
|
|
4308
|
-
const s =
|
|
4316
|
+
}, x = (u = "prune", d) => {
|
|
4317
|
+
const s = d || "Untitled Template", { getGoogleFontImports: y } = ft(), { emailMobileStyles: C } = Gt(), { assembleMJML: _ } = Bn(), f = i?.value ?? {}, p = y([...c(u, f)]), g = m(u, f, C), w = Pn(t.value), $ = [
|
|
4309
4318
|
".email-container { max-width:100% !important; width:100% !important; }",
|
|
4310
4319
|
".desktop-hide { display:block !important; }",
|
|
4311
4320
|
".mobile-hide { display:none !important; }",
|
|
4312
4321
|
".mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }",
|
|
4313
|
-
...
|
|
4322
|
+
...w ? [w] : []
|
|
4314
4323
|
].join(`
|
|
4315
4324
|
|
|
4316
|
-
`),
|
|
4317
|
-
|
|
4325
|
+
`), v = g.length > 0 ? [
|
|
4326
|
+
$,
|
|
4318
4327
|
"/* Mobile property overrides */",
|
|
4319
|
-
...
|
|
4328
|
+
...g
|
|
4320
4329
|
].join(`
|
|
4321
|
-
`) :
|
|
4322
|
-
t.value.forEach((
|
|
4323
|
-
if (
|
|
4324
|
-
if (
|
|
4325
|
-
if (!
|
|
4326
|
-
const
|
|
4327
|
-
let
|
|
4330
|
+
`) : $, S = [];
|
|
4331
|
+
t.value.forEach((k) => {
|
|
4332
|
+
if (u === "prune" && !b(k.visibility, f)) return;
|
|
4333
|
+
if (k.type === "row-spacer") {
|
|
4334
|
+
if (!k.height || k.height <= 0) return;
|
|
4335
|
+
const F = ue(k);
|
|
4336
|
+
let te = ` <mj-raw>
|
|
4328
4337
|
<table width="100%" cellpadding="0" cellspacing="0">
|
|
4329
4338
|
<tr>
|
|
4330
4339
|
<td>
|
|
4331
|
-
<div height="${
|
|
4340
|
+
<div height="${k.height}" style="height:${k.height}px;line-height:${k.height}px;font-size:1px;mso-line-height-rule:exactly;${F.join(";")}"> </div>
|
|
4332
4341
|
</td>
|
|
4333
4342
|
</tr>
|
|
4334
4343
|
</table>
|
|
4335
4344
|
</mj-raw>`;
|
|
4336
|
-
|
|
4345
|
+
u === "wrap" && h(k.visibility) && (te = be(te, k.visibility, a.value)), S.push(te);
|
|
4337
4346
|
return;
|
|
4338
4347
|
}
|
|
4339
|
-
const
|
|
4340
|
-
let
|
|
4341
|
-
|
|
4342
|
-
const
|
|
4343
|
-
I.push(
|
|
4348
|
+
const M = r.value.mobileBreakpoint || 600, O = k.gap || 0, B = O / M * 100, D = 100 - B * (k.columns.length - 1), I = [];
|
|
4349
|
+
let P = 0;
|
|
4350
|
+
k.columns.forEach((F) => {
|
|
4351
|
+
const te = F.width / 100 * D;
|
|
4352
|
+
I.push(te), P += te;
|
|
4344
4353
|
});
|
|
4345
|
-
const V =
|
|
4354
|
+
const V = D - P;
|
|
4346
4355
|
Math.abs(V) > 0.01 && I.length > 0 && (I[I.length - 1] += V);
|
|
4347
|
-
const q =
|
|
4348
|
-
const
|
|
4349
|
-
return
|
|
4350
|
-
})(),
|
|
4351
|
-
|
|
4352
|
-
const ze =
|
|
4353
|
-
let
|
|
4354
|
-
|
|
4355
|
-
const
|
|
4356
|
-
`padding:${
|
|
4356
|
+
const q = ue(k), W = (() => {
|
|
4357
|
+
const F = k.backgroundGradient;
|
|
4358
|
+
return F?.useGradient === !0 && Array.isArray(F?.gradient?.colors) && F.gradient.colors.length >= 2 ? F.solid || k.backgroundColor || "" : k.backgroundColor || "";
|
|
4359
|
+
})(), Z = W && W !== "transparent" ? W : "", ee = k.padding ? `${k.padding.top ?? 0}px ${k.padding.right ?? 0}px ${k.padding.bottom ?? 0}px ${k.padding.left ?? 0}px` : "0px", me = re(k.border?.radius ?? 0), Se = pe(k.border) && !re(k.border?.radius ?? 0), ae = [...q, "overflow:hidden"];
|
|
4360
|
+
Se && (ae.push(de(k.border)), ae.push(`padding:${ee}`)), me && ae.push(`border-radius:${X(k.border.radius, 2)}`), (k.minHeight ?? 0) > 0 && ae.push(`min-height:${k.minHeight}px`);
|
|
4361
|
+
const ze = ae.length ? ` style="${ae.join(";")}"` : "";
|
|
4362
|
+
let Le = "";
|
|
4363
|
+
pe(k.border) && (Le = `${de(k.border)};`, re(k.border?.radius ?? 0) && (Le += `border-radius:${X(k.border.radius)};overflow:hidden;`));
|
|
4364
|
+
const ht = [
|
|
4365
|
+
`padding:${ee}`,
|
|
4357
4366
|
"font-size:0",
|
|
4358
4367
|
"line-height:0",
|
|
4359
|
-
|
|
4368
|
+
Le
|
|
4360
4369
|
].filter(Boolean).join(";");
|
|
4361
|
-
let
|
|
4362
|
-
|
|
4363
|
-
if (
|
|
4364
|
-
const
|
|
4365
|
-
`width:${
|
|
4370
|
+
let Re = "";
|
|
4371
|
+
k.columns.forEach((F, te) => {
|
|
4372
|
+
if (u === "prune" && !b(F.props?.visibility, f)) return;
|
|
4373
|
+
const H = I[te], Q = k.mobileStack ? "mobile-stack" : "", vt = ue(F), bt = [
|
|
4374
|
+
`width:${H}%`,
|
|
4366
4375
|
"box-sizing:border-box",
|
|
4367
|
-
`vertical-align:${
|
|
4376
|
+
`vertical-align:${F.verticalAlign ?? "middle"}`,
|
|
4368
4377
|
...vt,
|
|
4369
|
-
|
|
4370
|
-
`border-radius:${
|
|
4378
|
+
de(F.border),
|
|
4379
|
+
`border-radius:${X(F.border?.radius ?? 0)}`,
|
|
4371
4380
|
"overflow:hidden",
|
|
4372
4381
|
"line-height:0",
|
|
4373
4382
|
"font-size:0",
|
|
4374
|
-
`padding:${
|
|
4375
|
-
],
|
|
4376
|
-
if (
|
|
4377
|
-
${
|
|
4383
|
+
`padding:${F.padding?.top ?? 0}px ${F.padding?.right ?? 0}px ${F.padding?.bottom ?? 0}px ${F.padding?.left ?? 0}px`
|
|
4384
|
+
], $t = F.children ?? F.components ?? [], We = R($t, f, u, 0), yt = Q ? ` class="${Q}"` : "";
|
|
4385
|
+
if (Re += `<td valign="${F.verticalAlign ?? "middle"}"${yt} style="${bt.join(";")}">
|
|
4386
|
+
${We}
|
|
4378
4387
|
</td>
|
|
4379
|
-
`,
|
|
4380
|
-
const
|
|
4381
|
-
|
|
4388
|
+
`, te < k.columns.length - 1 && O > 0) {
|
|
4389
|
+
const St = Q ? `gap-${O} ${Q}` : `gap-${O}`;
|
|
4390
|
+
Re += `<td class="${St}" width="${B}%" style="width:${B}%;max-width:${B}%;font-size:0;line-height:0;padding:0;"> </td>
|
|
4382
4391
|
`;
|
|
4383
4392
|
}
|
|
4384
4393
|
});
|
|
4385
|
-
const
|
|
4386
|
-
let
|
|
4394
|
+
const U = k.columns.some((F) => re(F.border?.radius ?? 0));
|
|
4395
|
+
let K = `<div style="${ht}">${`<table width="100%" cellpadding="0" cellspacing="0" style="border-collapse:${(k.gap ?? 0) > 0 || U ? "separate" : "collapse"};">
|
|
4387
4396
|
<tr>
|
|
4388
|
-
${
|
|
4397
|
+
${Re}</tr>
|
|
4389
4398
|
</table>`}</div>`;
|
|
4390
|
-
|
|
4391
|
-
const
|
|
4392
|
-
|
|
4393
|
-
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:${
|
|
4394
|
-
<div style="margin:0px auto;max-width:${
|
|
4399
|
+
u === "wrap" && h(k.visibility) && (K = be(K, k.visibility, a.value));
|
|
4400
|
+
const ke = r.value.width ?? 600;
|
|
4401
|
+
S.push(` <mj-raw>
|
|
4402
|
+
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:${ke}px;" width="${ke}"${Z ? ` bgcolor="${Z}"` : ""}><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
|
|
4403
|
+
<div style="margin:0px auto;max-width:${ke}px;">
|
|
4395
4404
|
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
|
|
4396
4405
|
<tbody>
|
|
4397
4406
|
<tr>
|
|
4398
4407
|
<td${ze}>
|
|
4399
|
-
${
|
|
4408
|
+
${K}
|
|
4400
4409
|
</td>
|
|
4401
4410
|
</tr>
|
|
4402
4411
|
</tbody>
|
|
@@ -4405,83 +4414,83 @@ ${U}</tr>
|
|
|
4405
4414
|
<!--[if mso | IE]></td></tr></table><![endif]-->
|
|
4406
4415
|
</mj-raw>`);
|
|
4407
4416
|
});
|
|
4408
|
-
let
|
|
4409
|
-
`), r.value,
|
|
4410
|
-
return
|
|
4417
|
+
let T = _(s, S.join(`
|
|
4418
|
+
`), r.value, p, v, r.value.mobileBreakpoint ?? 600, "");
|
|
4419
|
+
return T = Un(T, u, a.value, o?.value, !0), T;
|
|
4411
4420
|
};
|
|
4412
4421
|
return {
|
|
4413
|
-
export: async (
|
|
4422
|
+
export: async (u = "prune", d) => {
|
|
4414
4423
|
if (!l("Export")) return;
|
|
4415
|
-
const s =
|
|
4424
|
+
const s = d || "Untitled Template", y = x(u, s), C = gt(s), { minifyOutput: _ } = Yt();
|
|
4416
4425
|
if (_.value) Ae({
|
|
4417
|
-
content: Be("mjml",
|
|
4418
|
-
filename: `${Ne(C,
|
|
4426
|
+
content: Be("mjml", y),
|
|
4427
|
+
filename: `${Ne(C, u)}.mjml`,
|
|
4419
4428
|
mimeType: "text/plain"
|
|
4420
4429
|
});
|
|
4421
4430
|
else {
|
|
4422
|
-
const
|
|
4431
|
+
const f = await ca(y);
|
|
4423
4432
|
Ae({
|
|
4424
|
-
content:
|
|
4425
|
-
filename: `${Ne(C,
|
|
4433
|
+
content: f,
|
|
4434
|
+
filename: `${Ne(C, u)}.mjml`,
|
|
4426
4435
|
mimeType: "text/plain"
|
|
4427
4436
|
});
|
|
4428
4437
|
}
|
|
4429
4438
|
},
|
|
4430
|
-
getMJML: (
|
|
4439
|
+
getMJML: (u = "prune", d) => {
|
|
4431
4440
|
if (!t.value || t.value.length === 0) return null;
|
|
4432
|
-
const s =
|
|
4441
|
+
const s = x(u, d || "Untitled Template");
|
|
4433
4442
|
return Be("mjml", s);
|
|
4434
4443
|
}
|
|
4435
4444
|
};
|
|
4436
|
-
},
|
|
4437
|
-
const { rows: t, canvasStyles: r, saveToHistoryFn: n, guardEmpty: a } = e, i = e.notify ?? ((
|
|
4438
|
-
const
|
|
4445
|
+
}, Da = (e) => {
|
|
4446
|
+
const { rows: t, canvasStyles: r, saveToHistoryFn: n, guardEmpty: a } = e, i = e.notify ?? ((b, h = "Import failed") => console.error(`[maildeno-editor] ${h}: ${b}`)), o = (b) => {
|
|
4447
|
+
const h = b || "Untitled Template";
|
|
4439
4448
|
return {
|
|
4440
|
-
template_id: ot(
|
|
4441
|
-
template_name:
|
|
4442
|
-
canvas:
|
|
4443
|
-
rows:
|
|
4449
|
+
template_id: ot(h),
|
|
4450
|
+
template_name: h,
|
|
4451
|
+
canvas: An(JSON.parse(JSON.stringify(r.value))),
|
|
4452
|
+
rows: Rn(JSON.parse(JSON.stringify(t.value))),
|
|
4444
4453
|
schema_version: "1.0"
|
|
4445
4454
|
};
|
|
4446
4455
|
};
|
|
4447
4456
|
return {
|
|
4448
|
-
export: (
|
|
4457
|
+
export: (b) => {
|
|
4449
4458
|
if (!a("Export")) return;
|
|
4450
|
-
const
|
|
4459
|
+
const h = o(b);
|
|
4451
4460
|
Ae({
|
|
4452
|
-
content: JSON.stringify(
|
|
4453
|
-
filename: `${
|
|
4461
|
+
content: JSON.stringify(h, null, 2),
|
|
4462
|
+
filename: `${gt(h.template_name)}.json`,
|
|
4454
4463
|
mimeType: "application/json"
|
|
4455
4464
|
});
|
|
4456
4465
|
},
|
|
4457
|
-
import: (
|
|
4458
|
-
const
|
|
4459
|
-
|
|
4466
|
+
import: (b, h) => {
|
|
4467
|
+
const R = new FileReader();
|
|
4468
|
+
R.onload = (E) => {
|
|
4460
4469
|
try {
|
|
4461
|
-
let
|
|
4462
|
-
|
|
4463
|
-
} catch (
|
|
4464
|
-
i(
|
|
4470
|
+
let x = JSON.parse(E.target?.result);
|
|
4471
|
+
x = bn(x), x.canvas && x.rows ? (r.value = lt(x.canvas), t.value = ct(x.rows), h.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");
|
|
4472
|
+
} catch (x) {
|
|
4473
|
+
i(x.message, "Couldn't load template");
|
|
4465
4474
|
}
|
|
4466
|
-
},
|
|
4475
|
+
}, R.readAsText(b);
|
|
4467
4476
|
},
|
|
4468
|
-
getJSON: (
|
|
4477
|
+
getJSON: (b) => !t.value || t.value.length === 0 ? null : o(b)
|
|
4469
4478
|
};
|
|
4470
|
-
},
|
|
4479
|
+
}, Fa = 5, hn = /font-family\s*:\s*([^;<]+)/gi, Ha = (e) => e.replace(/"/g, '"').replace(/'/g, "'").replace(/'/g, "'"), Ua = (e) => {
|
|
4471
4480
|
if (!e || typeof e != "string") return [];
|
|
4472
4481
|
if (e.indexOf("font-family") === -1) return [];
|
|
4473
|
-
const t =
|
|
4482
|
+
const t = Ha(e), r = [];
|
|
4474
4483
|
let n;
|
|
4475
|
-
for (
|
|
4484
|
+
for (hn.lastIndex = 0; (n = hn.exec(t)) !== null; ) {
|
|
4476
4485
|
const a = n[1];
|
|
4477
4486
|
if (!a) continue;
|
|
4478
4487
|
let i = a;
|
|
4479
4488
|
const o = i.trimStart()[0];
|
|
4480
4489
|
if (o === '"' || o === "'") {
|
|
4481
|
-
const c = i.indexOf(o),
|
|
4482
|
-
if (
|
|
4483
|
-
const
|
|
4484
|
-
i =
|
|
4490
|
+
const c = i.indexOf(o), m = i.indexOf(o, c + 1);
|
|
4491
|
+
if (m !== -1) {
|
|
4492
|
+
const b = i.slice(m + 1).search(/["<]/);
|
|
4493
|
+
i = b === -1 ? i : i.slice(0, m + 1 + b);
|
|
4485
4494
|
}
|
|
4486
4495
|
} else {
|
|
4487
4496
|
const c = i.search(/["<]/);
|
|
@@ -4491,62 +4500,62 @@ ${U}</tr>
|
|
|
4491
4500
|
l && r.push(l);
|
|
4492
4501
|
}
|
|
4493
4502
|
return r;
|
|
4494
|
-
},
|
|
4495
|
-
let
|
|
4496
|
-
typeof r == "object" && !("value" in r) ? (
|
|
4503
|
+
}, Ja = (e, t, r, n, a, i, o, l, c, m) => {
|
|
4504
|
+
let b, h, R, E;
|
|
4505
|
+
typeof r == "object" && !("value" in r) ? (b = r, h = n, R = a, E = i) : (b = {
|
|
4497
4506
|
html: r,
|
|
4498
4507
|
react: n,
|
|
4499
4508
|
mjml: a
|
|
4500
|
-
},
|
|
4501
|
-
const { evaluateVisibility:
|
|
4502
|
-
if (!(
|
|
4503
|
-
for (const
|
|
4504
|
-
const
|
|
4505
|
-
if (
|
|
4506
|
-
if (
|
|
4507
|
-
for (const
|
|
4508
|
-
const I =
|
|
4509
|
-
|
|
4509
|
+
}, h = i, R = o, E = l);
|
|
4510
|
+
const { evaluateVisibility: x } = mt(), { open: N } = m ?? ta(), j = c ?? L({ syntax: "handlebars" }), u = (v, S, T, k, M = 0) => {
|
|
4511
|
+
if (!(M >= Fa))
|
|
4512
|
+
for (const O of v) {
|
|
4513
|
+
const B = O.type;
|
|
4514
|
+
if (B === "row") {
|
|
4515
|
+
if (S === "prune" && !x(O.visibility, T)) continue;
|
|
4516
|
+
for (const D of O.columns ?? []) {
|
|
4517
|
+
const I = D.children ?? D.components ?? [];
|
|
4518
|
+
u(I, S, T, k, M + 1);
|
|
4510
4519
|
}
|
|
4511
4520
|
continue;
|
|
4512
4521
|
}
|
|
4513
|
-
|
|
4522
|
+
B !== "row-spacer" && (S === "prune" && !x(O.props?.visibility, T) || k(O));
|
|
4514
4523
|
}
|
|
4515
|
-
},
|
|
4516
|
-
const
|
|
4517
|
-
return e.value.forEach((
|
|
4518
|
-
|
|
4519
|
-
const
|
|
4520
|
-
|
|
4521
|
-
if (
|
|
4522
|
-
const
|
|
4523
|
-
for (const I of
|
|
4524
|
+
}, d = (v) => !e.value || e.value.length === 0 ? (N("Your template is empty. Please add at least one row before exporting.", v), !1) : !0, s = (v, S) => {
|
|
4525
|
+
const T = /* @__PURE__ */ new Set();
|
|
4526
|
+
return e.value.forEach((k) => {
|
|
4527
|
+
v === "prune" && !x(k.visibility, S) || k.columns && k.columns.forEach((M) => {
|
|
4528
|
+
const O = M.children ?? M.components ?? [];
|
|
4529
|
+
u(O, v, S, (B) => {
|
|
4530
|
+
if (B.props?.fontFamily && T.add(B.props.fontFamily), B.props?.mobile?.fontFamily && T.add(B.props.mobile.fontFamily), typeof B.props?.content == "string") {
|
|
4531
|
+
const D = Ua(B.props.content);
|
|
4532
|
+
for (const I of D) T.add(I);
|
|
4524
4533
|
}
|
|
4525
4534
|
});
|
|
4526
4535
|
});
|
|
4527
|
-
}),
|
|
4528
|
-
},
|
|
4529
|
-
const
|
|
4530
|
-
return e.value.forEach((
|
|
4531
|
-
|
|
4532
|
-
const
|
|
4533
|
-
|
|
4534
|
-
const I =
|
|
4535
|
-
I &&
|
|
4536
|
+
}), T;
|
|
4537
|
+
}, y = (v, S, T) => {
|
|
4538
|
+
const k = [];
|
|
4539
|
+
return e.value.forEach((M) => {
|
|
4540
|
+
v === "prune" && !x(M.visibility, S) || M.columns && M.columns.forEach((O) => {
|
|
4541
|
+
const B = O.children ?? O.components ?? [];
|
|
4542
|
+
u(B, v, S, (D) => {
|
|
4543
|
+
const I = T(D, `eb-${D.id}`);
|
|
4544
|
+
I && k.push(I);
|
|
4536
4545
|
});
|
|
4537
4546
|
});
|
|
4538
|
-
}),
|
|
4539
|
-
}, C = (
|
|
4540
|
-
const
|
|
4547
|
+
}), k;
|
|
4548
|
+
}, C = (v, S) => {
|
|
4549
|
+
const T = Pn(e.value), k = S.length > 0 ? `
|
|
4541
4550
|
|
|
4542
4551
|
/* Mobile property overrides */
|
|
4543
|
-
${
|
|
4552
|
+
${S.join(`
|
|
4544
4553
|
|
|
4545
4554
|
`)}` : "";
|
|
4546
4555
|
return `
|
|
4547
4556
|
.desktop-hide { display: none !important; }
|
|
4548
4557
|
ul li:last-child, ol li:last-child { margin-bottom: 0 !important; }
|
|
4549
|
-
@media only screen and (max-width:${
|
|
4558
|
+
@media only screen and (max-width:${v}px) {
|
|
4550
4559
|
${`
|
|
4551
4560
|
.email-container { max-width:100% !important; width:100% !important; }
|
|
4552
4561
|
|
|
@@ -4555,41 +4564,41 @@ ${`
|
|
|
4555
4564
|
.mobile-hide { display:none !important; }
|
|
4556
4565
|
|
|
4557
4566
|
.mobile-stack { display:block !important; width:100% !important; min-width:100% !important; max-width:100% !important; box-sizing:border-box !important; }
|
|
4558
|
-
${
|
|
4559
|
-
${
|
|
4567
|
+
${T ? `
|
|
4568
|
+
${T}` : ""}${k}
|
|
4560
4569
|
`}
|
|
4561
4570
|
}`;
|
|
4562
|
-
}, _ = Ce(() =>
|
|
4571
|
+
}, _ = Ce(() => j.value.syntax), f = {
|
|
4563
4572
|
rows: e,
|
|
4564
4573
|
canvasStyles: t,
|
|
4565
|
-
generators:
|
|
4574
|
+
generators: b,
|
|
4566
4575
|
espSyntax: _,
|
|
4567
|
-
visibilityContext:
|
|
4568
|
-
tagSubstitution:
|
|
4569
|
-
guardEmpty:
|
|
4576
|
+
visibilityContext: R,
|
|
4577
|
+
tagSubstitution: E,
|
|
4578
|
+
guardEmpty: d,
|
|
4570
4579
|
collectFonts: s,
|
|
4571
|
-
collectMobileCSS:
|
|
4580
|
+
collectMobileCSS: y,
|
|
4572
4581
|
buildMobileStyleBlock: C
|
|
4573
|
-
},
|
|
4582
|
+
}, p = Oa(f), g = za(f), w = Pa(f), $ = Da({
|
|
4574
4583
|
rows: e,
|
|
4575
4584
|
canvasStyles: t,
|
|
4576
|
-
saveToHistoryFn:
|
|
4577
|
-
guardEmpty:
|
|
4578
|
-
notify: (
|
|
4585
|
+
saveToHistoryFn: h,
|
|
4586
|
+
guardEmpty: d,
|
|
4587
|
+
notify: (v, S) => N(v, S ?? "Import failed")
|
|
4579
4588
|
});
|
|
4580
4589
|
return {
|
|
4581
|
-
exportHTML:
|
|
4582
|
-
getExportedHTML:
|
|
4583
|
-
exportReactEmail:
|
|
4584
|
-
getExportedReactEmail:
|
|
4585
|
-
exportMJML:
|
|
4586
|
-
getExportedMJML:
|
|
4587
|
-
exportJSON:
|
|
4588
|
-
getExportedJSON:
|
|
4589
|
-
importJSON:
|
|
4590
|
-
espConfig:
|
|
4590
|
+
exportHTML: p.export,
|
|
4591
|
+
getExportedHTML: p.getHTML,
|
|
4592
|
+
exportReactEmail: g.export,
|
|
4593
|
+
getExportedReactEmail: g.getReactEmail,
|
|
4594
|
+
exportMJML: w.export,
|
|
4595
|
+
getExportedMJML: w.getMJML,
|
|
4596
|
+
exportJSON: $.export,
|
|
4597
|
+
getExportedJSON: $.getJSON,
|
|
4598
|
+
importJSON: $.import,
|
|
4599
|
+
espConfig: j
|
|
4591
4600
|
};
|
|
4592
|
-
},
|
|
4601
|
+
}, Ga = 3e3, Me = null, Ue, rt, se = -1, at = () => ({
|
|
4593
4602
|
language: "en-US",
|
|
4594
4603
|
preheaderText: "View this email in your browser",
|
|
4595
4604
|
bodyBackgroundColor: "#f9fafb",
|
|
@@ -4606,319 +4615,320 @@ ${A}` : ""}${f}
|
|
|
4606
4615
|
left: 0
|
|
4607
4616
|
},
|
|
4608
4617
|
mobileBreakpoint: 600
|
|
4609
|
-
}),
|
|
4610
|
-
function
|
|
4611
|
-
const
|
|
4612
|
-
return Ie(
|
|
4618
|
+
}), Zn = /* @__PURE__ */ Symbol("maildeno-editor:email-builder");
|
|
4619
|
+
function So(e, t, r) {
|
|
4620
|
+
const n = qa(e, t, r);
|
|
4621
|
+
return Ie(Zn, n), n;
|
|
4613
4622
|
}
|
|
4614
|
-
var
|
|
4615
|
-
const e = Oe(
|
|
4623
|
+
var ko = () => {
|
|
4624
|
+
const e = Oe(Zn);
|
|
4616
4625
|
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.");
|
|
4617
4626
|
return e;
|
|
4618
4627
|
};
|
|
4619
|
-
function
|
|
4620
|
-
const
|
|
4621
|
-
|
|
4622
|
-
componentId:
|
|
4623
|
-
tagName:
|
|
4628
|
+
function qa(e, t, r) {
|
|
4629
|
+
const n = e ?? vr(), a = br(), i = L([]), o = L(null), l = L(at()), c = L(null), m = L([]), b = L(null), h = L(null), R = L("properties"), E = L("desktop"), x = L(!1), N = L(!1), j = L(null), u = L("create"), d = L({}), s = L(null), y = (A, z, J = "") => {
|
|
4630
|
+
s.value = {
|
|
4631
|
+
componentId: A,
|
|
4632
|
+
tagName: z,
|
|
4624
4633
|
default: J
|
|
4625
4634
|
};
|
|
4626
|
-
},
|
|
4627
|
-
html:
|
|
4628
|
-
react:
|
|
4629
|
-
mjml:
|
|
4630
|
-
}, { saveToLocal:
|
|
4631
|
-
const
|
|
4632
|
-
if (!(we >=
|
|
4635
|
+
}, C = L({}), _ = L(!1), f = L({}), p = L(!1), g = L(null), w = L(null), $ = L(!1), v = L(!1), S = L(null), T = L({ syntax: "handlebars" }), { defaultProps: k } = zt(), M = Cr(), O = () => M.getCurrentState(i, l), B = (A) => M.restoreState(A, i, l, o, b, h), { generateHTMLComponent: D } = qr(), { generateReactEmailComponent: I } = Xr(), { generateMJMLComponent: P } = Bn(), V = {
|
|
4636
|
+
html: D,
|
|
4637
|
+
react: I,
|
|
4638
|
+
mjml: P
|
|
4639
|
+
}, { saveToLocal: q, flushSave: W, loadFromLocal: Z, clearLocal: ee, hasDraft: me, saveStatus: Se, lastSaved: ae } = Jr(), { syncFontsForTemplate: ze } = ft(), Le = 5, ht = (A) => {
|
|
4640
|
+
const z = /* @__PURE__ */ new Set(), J = (G, we) => {
|
|
4641
|
+
if (!(we >= Le))
|
|
4633
4642
|
for (const Ve of G) {
|
|
4634
4643
|
if (!Ve) continue;
|
|
4635
|
-
const
|
|
4636
|
-
if (
|
|
4637
|
-
for (const
|
|
4644
|
+
const Zt = Ve.type;
|
|
4645
|
+
if (Zt === "row") {
|
|
4646
|
+
for (const en of Ve.columns ?? []) J(en.children ?? en.components ?? [], we + 1);
|
|
4638
4647
|
continue;
|
|
4639
4648
|
}
|
|
4640
|
-
if (
|
|
4649
|
+
if (Zt === "row-spacer") continue;
|
|
4641
4650
|
const Ke = Ve.props;
|
|
4642
|
-
Ke?.fontFamily &&
|
|
4651
|
+
Ke?.fontFamily && z.add(Ke.fontFamily), Ke?.mobile?.fontFamily && z.add(Ke.mobile.fontFamily);
|
|
4643
4652
|
}
|
|
4644
4653
|
};
|
|
4645
|
-
for (const G of
|
|
4654
|
+
for (const G of A)
|
|
4646
4655
|
if (G && G.type !== "row-spacer")
|
|
4647
4656
|
for (const we of G.columns ?? []) J(we.children ?? we.components ?? [], 0);
|
|
4648
|
-
return Array.from(
|
|
4657
|
+
return Array.from(z);
|
|
4649
4658
|
};
|
|
4650
4659
|
{
|
|
4651
|
-
let
|
|
4652
|
-
|
|
4653
|
-
const
|
|
4654
|
-
|
|
4655
|
-
|
|
4660
|
+
let A = null;
|
|
4661
|
+
fr(() => {
|
|
4662
|
+
const z = ht(i.value);
|
|
4663
|
+
A && clearTimeout(A), A = setTimeout(() => {
|
|
4664
|
+
A = null, ze(z);
|
|
4656
4665
|
}, 200);
|
|
4657
4666
|
});
|
|
4658
4667
|
}
|
|
4659
|
-
const
|
|
4660
|
-
let U = null,
|
|
4668
|
+
const Re = r ?? hr();
|
|
4669
|
+
let U = null, K = !1;
|
|
4661
4670
|
const ke = () => {
|
|
4662
|
-
|
|
4671
|
+
K || Re.value && (U && clearTimeout(U), U = setTimeout(() => {
|
|
4663
4672
|
U = null;
|
|
4664
|
-
const
|
|
4665
|
-
|
|
4666
|
-
},
|
|
4673
|
+
const A = M.version.value;
|
|
4674
|
+
A !== se && (se = A, Ue = c.value ?? void 0, q(i.value, l.value, Me, Ue, rt));
|
|
4675
|
+
}, Ga));
|
|
4667
4676
|
};
|
|
4668
|
-
function
|
|
4669
|
-
|
|
4677
|
+
function F(A = "change", z = !1) {
|
|
4678
|
+
M.saveToHistory(O, A, z), ke();
|
|
4670
4679
|
}
|
|
4671
|
-
function
|
|
4672
|
-
|
|
4680
|
+
function te(A) {
|
|
4681
|
+
F(A, !0);
|
|
4673
4682
|
}
|
|
4674
|
-
const
|
|
4675
|
-
if (
|
|
4676
|
-
for (const J of
|
|
4677
|
-
J?.id &&
|
|
4683
|
+
const H = kr(i, o, k, te, F), Q = () => H.rebuildIdRegistry(), vt = (A) => H.addRow(A, !0), bt = () => H.addSpacer(!0), $t = (A, z) => H.reorderRows(A, z, !0), We = (A, z) => {
|
|
4684
|
+
if (A?.id && (z.add(A.id), A.type === "row" && Array.isArray(A.columns)))
|
|
4685
|
+
for (const J of A.columns) {
|
|
4686
|
+
J?.id && z.add(J.id);
|
|
4678
4687
|
const G = J.children ?? J.components ?? [];
|
|
4679
|
-
for (const we of G) We(we,
|
|
4688
|
+
for (const we of G) We(we, z);
|
|
4680
4689
|
}
|
|
4681
|
-
},
|
|
4682
|
-
const
|
|
4683
|
-
if (
|
|
4690
|
+
}, yt = (A) => {
|
|
4691
|
+
const z = H.findRow(A);
|
|
4692
|
+
if (z) {
|
|
4684
4693
|
const J = /* @__PURE__ */ new Set();
|
|
4685
|
-
We(
|
|
4694
|
+
We(z, J), o.value && J.has(o.value) && (o.value = null), b.value && J.has(b.value) && (b.value = null), h.value && (J.has(h.value.rowId) || J.has(h.value.columnId)) && (h.value = null);
|
|
4686
4695
|
}
|
|
4687
|
-
|
|
4688
|
-
},
|
|
4689
|
-
mergeTagContext:
|
|
4690
|
-
mergeTagActive:
|
|
4691
|
-
linkTagContext:
|
|
4692
|
-
linkTagActive:
|
|
4693
|
-
})),
|
|
4696
|
+
H.deleteRow(A);
|
|
4697
|
+
}, St = Ce(() => ({
|
|
4698
|
+
mergeTagContext: C.value,
|
|
4699
|
+
mergeTagActive: _.value,
|
|
4700
|
+
linkTagContext: f.value,
|
|
4701
|
+
linkTagActive: p.value
|
|
4702
|
+
})), ce = Ja(i, l, V, F, d, St, void 0, void 0, T, t);
|
|
4694
4703
|
{
|
|
4695
|
-
const
|
|
4696
|
-
U && (clearTimeout(U), U = null,
|
|
4704
|
+
const A = () => {
|
|
4705
|
+
U && (clearTimeout(U), U = null, W(i.value, l.value, Me, Ue, rt), se = M.version.value);
|
|
4697
4706
|
};
|
|
4698
|
-
window.addEventListener("beforeunload",
|
|
4699
|
-
window.removeEventListener("beforeunload",
|
|
4707
|
+
window.addEventListener("beforeunload", A), pr(() => {
|
|
4708
|
+
window.removeEventListener("beforeunload", A), U && (clearTimeout(U), U = null, W(i.value, l.value, Me, Ue, rt), se = M.version.value);
|
|
4700
4709
|
});
|
|
4701
4710
|
}
|
|
4702
|
-
const
|
|
4703
|
-
if (
|
|
4704
|
-
return
|
|
4705
|
-
const
|
|
4706
|
-
return !
|
|
4707
|
-
|
|
4708
|
-
}),
|
|
4709
|
-
},
|
|
4710
|
-
if (!
|
|
4711
|
-
const { templateId:
|
|
4712
|
-
|
|
4713
|
-
const J =
|
|
4714
|
-
return J && console.info("[maildeno-editor] Saved — exported JSON:", J),
|
|
4715
|
-
},
|
|
4716
|
-
const
|
|
4717
|
-
return
|
|
4718
|
-
canvas:
|
|
4719
|
-
content: { rows:
|
|
4720
|
-
name:
|
|
4721
|
-
tags:
|
|
4722
|
-
},
|
|
4723
|
-
},
|
|
4724
|
-
|
|
4725
|
-
const
|
|
4726
|
-
if (
|
|
4727
|
-
|
|
4711
|
+
const Xt = () => {
|
|
4712
|
+
if (i.value.length > 0)
|
|
4713
|
+
return x.value = !0, Q(), o.value = null, b.value = null, h.value = null, R.value = "properties", null;
|
|
4714
|
+
const A = Z();
|
|
4715
|
+
return !A || A.templateId !== null ? (x.value = !0, null) : (x.value = !1, K = !0, i.value = A.rows, l.value = A.canvas, o.value = null, b.value = null, h.value = null, R.value = "properties", $e(() => {
|
|
4716
|
+
K = !1, Q(), M.initialize(O()), se = M.version.value, x.value = !0;
|
|
4717
|
+
}), ae.value = new Date(A.updatedAt), A.name !== void 0 && (c.value = A.name), A.tags !== void 0 && (m.value = A.tags), A.updatedAt);
|
|
4718
|
+
}, er = async (A) => {
|
|
4719
|
+
if (!Re.value) throw new Error("[maildeno-editor] this editor has no saveTemplate — nothing was saved");
|
|
4720
|
+
const { templateId: z } = await n.saveTemplate(A, j.value ?? void 0);
|
|
4721
|
+
j.value = z, u.value === "create" && (u.value = "edit");
|
|
4722
|
+
const J = ce.getExportedJSON(A.name);
|
|
4723
|
+
return J && console.info("[maildeno-editor] Saved — exported JSON:", J), z;
|
|
4724
|
+
}, tr = async (A) => {
|
|
4725
|
+
const z = await n.loadTemplate(A);
|
|
4726
|
+
return z ? (Qt({
|
|
4727
|
+
canvas: z.canvasStyles,
|
|
4728
|
+
content: { rows: z.rows },
|
|
4729
|
+
name: z.name,
|
|
4730
|
+
tags: z.tags
|
|
4731
|
+
}, A), j.value = A, u.value = "edit", !0) : !1;
|
|
4732
|
+
}, nr = () => {
|
|
4733
|
+
x.value = !1, h.value = null, b.value = null, R.value = "properties", U && (clearTimeout(U), U = null);
|
|
4734
|
+
const A = Z();
|
|
4735
|
+
if (A && A.templateId === null) {
|
|
4736
|
+
Xt();
|
|
4728
4737
|
return;
|
|
4729
4738
|
}
|
|
4730
|
-
|
|
4731
|
-
|
|
4739
|
+
A && A.templateId !== null && ee(), K = !0, i.value = [], o.value = null, l.value = at(), Me = null, c.value = null, m.value = [], $e(() => {
|
|
4740
|
+
K = !1, Q(), M.initialize(O()), se = M.version.value, x.value = !0;
|
|
4732
4741
|
});
|
|
4733
|
-
},
|
|
4734
|
-
|
|
4735
|
-
|
|
4742
|
+
}, rr = () => {
|
|
4743
|
+
x.value = !1, h.value = null, b.value = null, R.value = "properties", U && (clearTimeout(U), U = null), ee(), K = !0, i.value = [], o.value = null, l.value = at(), Me = null, j.value = null, u.value = "create", c.value = null, m.value = [], $e(() => {
|
|
4744
|
+
K = !1, Q(), M.initialize(O()), se = M.version.value, x.value = !0;
|
|
4736
4745
|
});
|
|
4737
|
-
},
|
|
4738
|
-
|
|
4739
|
-
const G =
|
|
4740
|
-
if (G && G.templateId ===
|
|
4741
|
-
console.info(`[EmailBuilder] Restoring local draft for template ${
|
|
4742
|
-
|
|
4743
|
-
}),
|
|
4746
|
+
}, Qt = (A, z, J) => {
|
|
4747
|
+
x.value = !1, Me = z, Ue = A.name, rt = A.tags, c.value = A.name ?? null, m.value = A.tags ?? [], U && (clearTimeout(U), U = null);
|
|
4748
|
+
const G = Z();
|
|
4749
|
+
if (G && G.templateId === z) {
|
|
4750
|
+
console.info(`[EmailBuilder] Restoring local draft for template ${z} (saved ${G.updatedAt}).`), G.name !== void 0 && (c.value = G.name), G.tags !== void 0 && (m.value = G.tags), K = !0, l.value = G.canvas, i.value = G.rows, o.value = null, b.value = null, h.value = null, R.value = "properties", $e(() => {
|
|
4751
|
+
K = !1, Q(), M.initialize(O()), se = M.version.value, x.value = !0, J?.();
|
|
4752
|
+
}), ae.value = new Date(G.updatedAt);
|
|
4744
4753
|
return;
|
|
4745
4754
|
}
|
|
4746
|
-
G && G.templateId !==
|
|
4747
|
-
|
|
4755
|
+
G && G.templateId !== z && (console.info(`[EmailBuilder] Clearing stale draft (belongs to ${G.templateId}, current is ${z}).`), ee()), K = !0, l.value = lt(JSON.parse(JSON.stringify(A.canvas))), i.value = ct(JSON.parse(JSON.stringify(A.content?.rows ?? []))), o.value = null, b.value = null, h.value = null, R.value = "properties", $e(() => {
|
|
4756
|
+
K = !1, Q(), M.initialize(O()), se = M.version.value, x.value = !0, J?.();
|
|
4748
4757
|
});
|
|
4749
|
-
},
|
|
4750
|
-
U && (clearTimeout(U), U = null),
|
|
4751
|
-
|
|
4758
|
+
}, kt = (A, z = "restore-version") => {
|
|
4759
|
+
U && (clearTimeout(U), U = null), K = !0, l.value = lt(JSON.parse(JSON.stringify(A.canvas))), i.value = ct(JSON.parse(JSON.stringify(A.content?.rows ?? []))), o.value = null, b.value = null, h.value = null, R.value = "properties", $e(() => {
|
|
4760
|
+
K = !1, Q(), te(z);
|
|
4752
4761
|
});
|
|
4753
|
-
}, rr = () => {
|
|
4754
|
-
f.undo(z) && (te(), ke());
|
|
4755
4762
|
}, ar = () => {
|
|
4756
|
-
|
|
4763
|
+
M.undo(B) && (Q(), ke());
|
|
4757
4764
|
}, or = () => {
|
|
4758
|
-
|
|
4759
|
-
te(), f.initialize(B()), oe = f.version.value;
|
|
4760
|
-
});
|
|
4765
|
+
M.redo(B) && (Q(), ke());
|
|
4761
4766
|
}, ir = () => {
|
|
4762
|
-
|
|
4767
|
+
i.value = [], o.value = null, b.value = null, h.value = null, R.value = "properties", l.value = at(), $e(() => {
|
|
4768
|
+
Q(), M.initialize(O()), se = M.version.value;
|
|
4769
|
+
});
|
|
4770
|
+
}, sr = () => {
|
|
4771
|
+
a.require({
|
|
4763
4772
|
message: "Are you sure you want to clear the current template? This cannot be undone.",
|
|
4764
4773
|
header: "Clear Template",
|
|
4765
4774
|
acceptLabel: "Yes",
|
|
4766
4775
|
rejectLabel: "Cancel",
|
|
4767
4776
|
acceptClass: "!bg-red-600 !hover:bg-red-700 !border-red-600 !px-6 !py-2",
|
|
4768
4777
|
rejectClass: "!bg-gray-200 !hover:bg-gray-300 !text-gray-800 !border-gray-200 !px-6 !py-2",
|
|
4769
|
-
accept: () =>
|
|
4778
|
+
accept: () => ir(),
|
|
4770
4779
|
reject: () => {
|
|
4771
4780
|
}
|
|
4772
4781
|
});
|
|
4773
|
-
},
|
|
4774
|
-
const J =
|
|
4782
|
+
}, lr = (A, z = {}) => {
|
|
4783
|
+
const J = bn(A), G = {
|
|
4775
4784
|
canvas: J.canvas,
|
|
4776
4785
|
content: { rows: J.rows }
|
|
4777
4786
|
};
|
|
4778
|
-
if (
|
|
4779
|
-
|
|
4780
|
-
|
|
4787
|
+
if (z.history === "reset") {
|
|
4788
|
+
kt(G, "set-json"), $e(() => {
|
|
4789
|
+
M.initialize(O()), se = M.version.value;
|
|
4781
4790
|
});
|
|
4782
4791
|
return;
|
|
4783
4792
|
}
|
|
4784
|
-
|
|
4785
|
-
},
|
|
4786
|
-
const
|
|
4787
|
-
if (!
|
|
4788
|
-
const
|
|
4793
|
+
kt(G, "set-json");
|
|
4794
|
+
}, cr = () => {
|
|
4795
|
+
const A = o.value;
|
|
4796
|
+
if (!A) return null;
|
|
4797
|
+
const z = H.findComponent(A);
|
|
4789
4798
|
return {
|
|
4790
|
-
id:
|
|
4791
|
-
type:
|
|
4799
|
+
id: A,
|
|
4800
|
+
type: z?.componentType ?? z?.type ?? null
|
|
4792
4801
|
};
|
|
4793
|
-
},
|
|
4802
|
+
}, ur = (A) => A !== null && !H.findComponent(A) ? !1 : (o.value = A, !0), dr = (A) => vn(() => M.version.value, () => A());
|
|
4794
4803
|
return {
|
|
4795
|
-
rows:
|
|
4796
|
-
canvasStyles:
|
|
4797
|
-
templateTags:
|
|
4798
|
-
savedTemplateName:
|
|
4804
|
+
rows: i,
|
|
4805
|
+
canvasStyles: l,
|
|
4806
|
+
templateTags: m,
|
|
4807
|
+
savedTemplateName: c,
|
|
4799
4808
|
previewMode: E,
|
|
4800
|
-
sidebarTab:
|
|
4801
|
-
selectedId:
|
|
4802
|
-
selectedRowId:
|
|
4803
|
-
selectedColumn:
|
|
4804
|
-
visibilityPreviewContext:
|
|
4805
|
-
mergeTagInsertQueue:
|
|
4806
|
-
triggerMergeTagInsert:
|
|
4807
|
-
mergeTagPreviewContext:
|
|
4808
|
-
mergeTagPreviewActive:
|
|
4809
|
-
linkTagPreviewContext:
|
|
4810
|
-
linkTagPreviewActive:
|
|
4811
|
-
isBuilderReady:
|
|
4812
|
-
linksActive:
|
|
4813
|
-
espConfig:
|
|
4814
|
-
canvasHoveredId:
|
|
4815
|
-
nestedRowDragId:
|
|
4816
|
-
isRowDragActive:
|
|
4817
|
-
isTopLevelRowDragActive:
|
|
4818
|
-
layerHoveredId:
|
|
4819
|
-
addRow:
|
|
4820
|
-
addNestedRow:
|
|
4821
|
-
findRow:
|
|
4822
|
-
deleteRow:
|
|
4823
|
-
moveRow:
|
|
4824
|
-
moveNestedRow:
|
|
4825
|
-
reorderRows:
|
|
4826
|
-
addSpacer:
|
|
4827
|
-
duplicateRow:
|
|
4828
|
-
duplicateRowSpacer:
|
|
4829
|
-
addRowSilent:
|
|
4830
|
-
addSpacerSilent:
|
|
4831
|
-
reorderRowsSilent:
|
|
4832
|
-
addComponent:
|
|
4833
|
-
addComponentAtIndex:
|
|
4834
|
-
deleteComponent:
|
|
4835
|
-
moveComponent:
|
|
4836
|
-
moveComponentBetweenColumns:
|
|
4837
|
-
findComponent:
|
|
4838
|
-
updateComponent:
|
|
4839
|
-
duplicateComponent:
|
|
4840
|
-
exportHTML:
|
|
4841
|
-
getExportedHTML:
|
|
4842
|
-
exportReactEmail:
|
|
4843
|
-
getExportedReactEmail:
|
|
4844
|
-
exportMJML:
|
|
4845
|
-
getExportedMJML:
|
|
4846
|
-
exportJSON:
|
|
4847
|
-
getExportedJSON:
|
|
4848
|
-
importJSON: (
|
|
4849
|
-
clearTemplate:
|
|
4850
|
-
undo:
|
|
4851
|
-
redo:
|
|
4852
|
-
canUndo:
|
|
4853
|
-
canRedo:
|
|
4854
|
-
historyStatus:
|
|
4855
|
-
saveToHistory:
|
|
4856
|
-
saveToHistoryImmediate:
|
|
4857
|
-
initFromStorage:
|
|
4858
|
-
clearLocal:
|
|
4859
|
-
loadFromLocal:
|
|
4860
|
-
hasDraft:
|
|
4861
|
-
saveStatus:
|
|
4862
|
-
lastSaved:
|
|
4863
|
-
initForCreate:
|
|
4864
|
-
startNewTemplate:
|
|
4865
|
-
loadTemplate:
|
|
4866
|
-
loadTemplateById:
|
|
4867
|
-
saveTemplate:
|
|
4868
|
-
templateId:
|
|
4869
|
-
builderMode:
|
|
4870
|
-
loadVersionSnapshot:
|
|
4871
|
-
setJson:
|
|
4872
|
-
getSelection:
|
|
4873
|
-
setSelection:
|
|
4874
|
-
onChange:
|
|
4809
|
+
sidebarTab: R,
|
|
4810
|
+
selectedId: o,
|
|
4811
|
+
selectedRowId: b,
|
|
4812
|
+
selectedColumn: h,
|
|
4813
|
+
visibilityPreviewContext: d,
|
|
4814
|
+
mergeTagInsertQueue: s,
|
|
4815
|
+
triggerMergeTagInsert: y,
|
|
4816
|
+
mergeTagPreviewContext: C,
|
|
4817
|
+
mergeTagPreviewActive: _,
|
|
4818
|
+
linkTagPreviewContext: f,
|
|
4819
|
+
linkTagPreviewActive: p,
|
|
4820
|
+
isBuilderReady: x,
|
|
4821
|
+
linksActive: N,
|
|
4822
|
+
espConfig: T,
|
|
4823
|
+
canvasHoveredId: g,
|
|
4824
|
+
nestedRowDragId: w,
|
|
4825
|
+
isRowDragActive: $,
|
|
4826
|
+
isTopLevelRowDragActive: v,
|
|
4827
|
+
layerHoveredId: S,
|
|
4828
|
+
addRow: H.addRow,
|
|
4829
|
+
addNestedRow: H.addNestedRow,
|
|
4830
|
+
findRow: H.findRow,
|
|
4831
|
+
deleteRow: yt,
|
|
4832
|
+
moveRow: H.moveRow,
|
|
4833
|
+
moveNestedRow: H.moveNestedRow,
|
|
4834
|
+
reorderRows: H.reorderRows,
|
|
4835
|
+
addSpacer: H.addSpacer,
|
|
4836
|
+
duplicateRow: H.duplicateRow,
|
|
4837
|
+
duplicateRowSpacer: H.duplicateRowSpacer,
|
|
4838
|
+
addRowSilent: vt,
|
|
4839
|
+
addSpacerSilent: bt,
|
|
4840
|
+
reorderRowsSilent: $t,
|
|
4841
|
+
addComponent: H.addComponent,
|
|
4842
|
+
addComponentAtIndex: H.addComponentAtIndex,
|
|
4843
|
+
deleteComponent: H.deleteComponent,
|
|
4844
|
+
moveComponent: H.moveComponent,
|
|
4845
|
+
moveComponentBetweenColumns: H.moveComponentBetweenColumns,
|
|
4846
|
+
findComponent: H.findComponent,
|
|
4847
|
+
updateComponent: H.updateComponent,
|
|
4848
|
+
duplicateComponent: H.duplicateComponent,
|
|
4849
|
+
exportHTML: ce.exportHTML,
|
|
4850
|
+
getExportedHTML: ce.getExportedHTML,
|
|
4851
|
+
exportReactEmail: ce.exportReactEmail,
|
|
4852
|
+
getExportedReactEmail: ce.getExportedReactEmail,
|
|
4853
|
+
exportMJML: ce.exportMJML,
|
|
4854
|
+
getExportedMJML: ce.getExportedMJML,
|
|
4855
|
+
exportJSON: ce.exportJSON,
|
|
4856
|
+
getExportedJSON: ce.getExportedJSON,
|
|
4857
|
+
importJSON: (A) => ce.importJSON(A, o),
|
|
4858
|
+
clearTemplate: sr,
|
|
4859
|
+
undo: ar,
|
|
4860
|
+
redo: or,
|
|
4861
|
+
canUndo: M.canUndo,
|
|
4862
|
+
canRedo: M.canRedo,
|
|
4863
|
+
historyStatus: M.historyStatus,
|
|
4864
|
+
saveToHistory: F,
|
|
4865
|
+
saveToHistoryImmediate: te,
|
|
4866
|
+
initFromStorage: Xt,
|
|
4867
|
+
clearLocal: ee,
|
|
4868
|
+
loadFromLocal: Z,
|
|
4869
|
+
hasDraft: me,
|
|
4870
|
+
saveStatus: Se,
|
|
4871
|
+
lastSaved: ae,
|
|
4872
|
+
initForCreate: nr,
|
|
4873
|
+
startNewTemplate: rr,
|
|
4874
|
+
loadTemplate: Qt,
|
|
4875
|
+
loadTemplateById: tr,
|
|
4876
|
+
saveTemplate: er,
|
|
4877
|
+
templateId: j,
|
|
4878
|
+
builderMode: u,
|
|
4879
|
+
loadVersionSnapshot: kt,
|
|
4880
|
+
setJson: lr,
|
|
4881
|
+
getSelection: cr,
|
|
4882
|
+
setSelection: ur,
|
|
4883
|
+
onChange: dr
|
|
4875
4884
|
};
|
|
4876
4885
|
}
|
|
4877
4886
|
export {
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
K,
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4887
|
+
Gr as A,
|
|
4888
|
+
Ka as B,
|
|
4889
|
+
lo as C,
|
|
4890
|
+
io as D,
|
|
4891
|
+
ta as E,
|
|
4892
|
+
eo as F,
|
|
4893
|
+
vr as G,
|
|
4894
|
+
Xa as H,
|
|
4895
|
+
ut as I,
|
|
4896
|
+
yn as K,
|
|
4897
|
+
Et as L,
|
|
4898
|
+
Rn as M,
|
|
4899
|
+
ao as N,
|
|
4900
|
+
Jt as O,
|
|
4901
|
+
ro as P,
|
|
4902
|
+
to as R,
|
|
4903
|
+
mo as S,
|
|
4904
|
+
so as T,
|
|
4905
|
+
Ya as U,
|
|
4906
|
+
Qa as V,
|
|
4907
|
+
Za as W,
|
|
4908
|
+
Je as _,
|
|
4909
|
+
$o as a,
|
|
4910
|
+
co as b,
|
|
4911
|
+
bo as c,
|
|
4912
|
+
ho as d,
|
|
4913
|
+
mn as f,
|
|
4914
|
+
ra as g,
|
|
4915
|
+
aa as h,
|
|
4916
|
+
ka as i,
|
|
4908
4917
|
An as j,
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4918
|
+
oo as k,
|
|
4919
|
+
vo as l,
|
|
4920
|
+
fo as m,
|
|
4921
|
+
ko as n,
|
|
4922
|
+
yo as o,
|
|
4923
|
+
da as p,
|
|
4924
|
+
Y as q,
|
|
4925
|
+
Yt as r,
|
|
4926
|
+
Sa as s,
|
|
4927
|
+
So as t,
|
|
4928
|
+
go as u,
|
|
4929
|
+
ft as v,
|
|
4930
|
+
mt as w,
|
|
4921
4931
|
uo as x,
|
|
4922
|
-
|
|
4923
|
-
|
|
4932
|
+
po as y,
|
|
4933
|
+
br as z
|
|
4924
4934
|
};
|