@emabuild/email-renderer 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -5
- package/dist/index.d.ts +19 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1371 -109
- package/dist/index.js.map +1 -1
- package/dist/layout/document-shell.d.ts +23 -1
- package/dist/layout/document-shell.d.ts.map +1 -1
- package/dist/layout/fluid-hybrid.d.ts +23 -2
- package/dist/layout/fluid-hybrid.d.ts.map +1 -1
- package/dist/layout/web-layout.d.ts +51 -0
- package/dist/layout/web-layout.d.ts.map +1 -0
- package/dist/render.d.ts +101 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/utils/border.d.ts +7 -0
- package/dist/utils/border.d.ts.map +1 -0
- package/dist/utils/css-inliner.d.ts +58 -0
- package/dist/utils/css-inliner.d.ts.map +1 -0
- package/dist/utils/css.d.ts +67 -0
- package/dist/utils/css.d.ts.map +1 -0
- package/dist/utils/dark-mode.d.ts +12 -0
- package/dist/utils/dark-mode.d.ts.map +1 -0
- package/dist/utils/display-condition.d.ts +11 -0
- package/dist/utils/display-condition.d.ts.map +1 -0
- package/dist/utils/html-cleanup.d.ts +20 -0
- package/dist/utils/html-cleanup.d.ts.map +1 -0
- package/dist/utils/html-minifier.d.ts +20 -0
- package/dist/utils/html-minifier.d.ts.map +1 -0
- package/dist/utils/html-sanitizer.d.ts.map +1 -1
- package/dist/utils/html-tokenizer.d.ts +89 -0
- package/dist/utils/html-tokenizer.d.ts.map +1 -0
- package/dist/utils/plain-text.d.ts +52 -0
- package/dist/utils/plain-text.d.ts.map +1 -0
- package/dist/utils/responsive-css.d.ts +16 -0
- package/dist/utils/responsive-css.d.ts.map +1 -1
- package/dist/utils/responsive-overrides.d.ts +61 -0
- package/dist/utils/responsive-overrides.d.ts.map +1 -0
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,55 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function A(e) {
|
|
2
|
+
return typeof e != "string" && typeof e != "number" ? null : String(e).replace(/[;{}<>"]/g, "").replace(/!important/gi, "").trim() || null;
|
|
3
|
+
}
|
|
4
|
+
function K(e) {
|
|
5
|
+
return typeof e == "string" && e.trim() !== "" && A(e) === e.trim();
|
|
6
|
+
}
|
|
7
|
+
function ee(e) {
|
|
8
|
+
const t = e?.body;
|
|
9
|
+
return t ? [...t.headers ?? [], ...t.rows ?? [], ...t.footers ?? []] : [];
|
|
10
|
+
}
|
|
11
|
+
const G = (e) => typeof e == "string" ? e.trim() : "", Oe = (e) => typeof e == "string" && /^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e);
|
|
12
|
+
function me(e, t) {
|
|
13
|
+
return G(t) || G(e?.title) || G(e?.subject);
|
|
14
|
+
}
|
|
15
|
+
function ge(e) {
|
|
16
|
+
return Oe(e?.language) ? e.language : "";
|
|
17
|
+
}
|
|
18
|
+
function he(e) {
|
|
19
|
+
const t = String(e?.fontWeight ?? "");
|
|
20
|
+
return /^\d{3}$|^(normal|bold)$/.test(t) ? t : "";
|
|
21
|
+
}
|
|
22
|
+
function Me(e) {
|
|
23
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
24
|
+
}
|
|
25
|
+
function ze(e) {
|
|
26
|
+
return e.trim().replace(/['"()\\\s<>]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
|
|
27
|
+
}
|
|
28
|
+
function De(e, t) {
|
|
29
|
+
const o = e.backgroundImage;
|
|
30
|
+
if (!o || typeof o != "object" || typeof o.url != "string" || !o.url.trim()) return { attr: "", css: "", vml: "" };
|
|
31
|
+
const n = ze(o.url), s = o.repeat === !0 || o.repeat === "repeat" ? "repeat" : "no-repeat", i = o.cover === !0 ? "cover" : o.fullWidth === !0 ? "100% auto" : "auto", r = o.center !== !1 ? "center top" : "left top", c = s === "repeat" ? "tile" : "frame";
|
|
32
|
+
return {
|
|
33
|
+
attr: ` background="${W(n)}"`,
|
|
34
|
+
css: `background-image:url('${n}');background-repeat:${s};background-position:${r};background-size:${i};`,
|
|
35
|
+
vml: `<!--[if gte mso 9]><v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t"><v:fill type="${c}" src="${W(n)}" color="${W(t)}"/></v:background><![endif]-->
|
|
36
|
+
`
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function W(e) {
|
|
40
|
+
return e.replace(/&(?![a-zA-Z0-9#]+;)/g, "&").replace(/"/g, """);
|
|
41
|
+
}
|
|
42
|
+
function Be(e, t, o, n = {}) {
|
|
43
|
+
const s = o.backgroundColor || "transparent", i = o.contentWidth || "600px", r = o.fontFamily?.value || "arial,helvetica,sans-serif", c = o.textColor || "#000000", l = o.preheaderText || "", u = me(o, n.title), a = ge(o), d = a ? ` lang="${a}" xml:lang="${a}"` : "", h = u ? Me(u) : "", m = he(o), p = m ? `font-weight:${m};` : "", f = De(o, s), g = (n.fontUrls ?? []).length ? `
|
|
44
|
+
<!--[if !mso]><!-->
|
|
45
|
+
${n.fontUrls.map((w) => ` <link href="${W(w)}" rel="stylesheet" type="text/css">`).join(`
|
|
46
|
+
`)}
|
|
47
|
+
<!--<![endif]-->` : "", y = (n.styles ?? []).map((w) => `
|
|
48
|
+
<style type="text/css">
|
|
49
|
+
${w}
|
|
50
|
+
</style>`).join(""), v = `<div style="display:none;font-size:1px;color:${s};line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">${l || "‌"}${"‌ ".repeat(80)}</div>`;
|
|
3
51
|
return `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
52
|
+
<html${d} xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
|
5
53
|
<head>
|
|
6
54
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
7
55
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
@@ -10,7 +58,7 @@ function w(e, i, n) {
|
|
|
10
58
|
<meta name="format-detection" content="telephone=no,address=no,email=no,date=no,url=no">
|
|
11
59
|
<meta name="color-scheme" content="light dark">
|
|
12
60
|
<meta name="supported-color-schemes" content="light dark">
|
|
13
|
-
<title
|
|
61
|
+
<title>${h}</title>${g}
|
|
14
62
|
<!--[if mso]>
|
|
15
63
|
<noscript><xml>
|
|
16
64
|
<o:OfficeDocumentSettings>
|
|
@@ -18,12 +66,12 @@ function w(e, i, n) {
|
|
|
18
66
|
</o:OfficeDocumentSettings>
|
|
19
67
|
</xml></noscript>
|
|
20
68
|
<style type="text/css">
|
|
21
|
-
table, td, th { font-family: ${
|
|
69
|
+
table, td, th { font-family: ${r} !important; }
|
|
22
70
|
</style>
|
|
23
71
|
<![endif]-->
|
|
24
72
|
<!--[if !mso]><!-->
|
|
25
73
|
<style type="text/css">
|
|
26
|
-
${
|
|
74
|
+
${t}
|
|
27
75
|
</style>
|
|
28
76
|
<!--<![endif]-->
|
|
29
77
|
<style type="text/css">
|
|
@@ -31,15 +79,15 @@ function w(e, i, n) {
|
|
|
31
79
|
table, tr, td { vertical-align: top; border-collapse: collapse; }
|
|
32
80
|
p { margin: 0; }
|
|
33
81
|
a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; }
|
|
34
|
-
</style
|
|
82
|
+
</style>${y}
|
|
35
83
|
</head>
|
|
36
|
-
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${
|
|
37
|
-
${
|
|
38
|
-
<table id="u_body" role="presentation" style="border-collapse:collapse;border-spacing:0;margin:0 auto;background-color:${
|
|
84
|
+
<body class="clean-body u_body" style="margin:0;padding:0;-webkit-text-size-adjust:100%;background-color:${s};color:${c};${p}">
|
|
85
|
+
${f.vml}${v}
|
|
86
|
+
<table id="u_body" role="presentation"${f.attr} style="border-collapse:collapse;border-spacing:0;margin:0 auto;background-color:${s};${f.css}width:100%;" cellpadding="0" cellspacing="0" border="0">
|
|
39
87
|
<tbody>
|
|
40
88
|
<tr>
|
|
41
89
|
<td style="vertical-align:top;">
|
|
42
|
-
<!--[if (mso)|(IE)]><table width="${parseInt(
|
|
90
|
+
<!--[if (mso)|(IE)]><table width="${parseInt(i)}" align="center" cellpadding="0" cellspacing="0" border="0"><tr><td><![endif]-->
|
|
43
91
|
${e}
|
|
44
92
|
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
|
45
93
|
</td>
|
|
@@ -49,60 +97,21 @@ function w(e, i, n) {
|
|
|
49
97
|
</body>
|
|
50
98
|
</html>`;
|
|
51
99
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const h = s.repeat === !0 || s.repeat === "repeat" ? "repeat" : "no-repeat", y = s.cover === !0 ? "cover" : s.fullWidth === !0 ? "100% auto" : "auto", f = s.center !== !1 ? "center top" : "left top";
|
|
57
|
-
a = `background-image:url('${s.url}');background-repeat:${h};background-position:${f};background-size:${y};`;
|
|
58
|
-
}
|
|
59
|
-
const r = e.columns.length > 1, d = e.columns.map((h, y) => {
|
|
60
|
-
const f = Math.round(e.cells[y] / g * t);
|
|
61
|
-
return { colHtml: k(h, f, p, i, n), colWidthPx: f };
|
|
62
|
-
});
|
|
63
|
-
let m;
|
|
64
|
-
if (r) {
|
|
65
|
-
const h = d.map(
|
|
66
|
-
({ colHtml: y, colWidthPx: f }) => `<!--[if (mso)|(IE)]><td align="center" width="${f}" style="width:${f}px;padding:0px;" valign="top"><![endif]-->${y}<!--[if (mso)|(IE)]></td><![endif]-->`
|
|
67
|
-
);
|
|
68
|
-
m = `<!--[if (mso)|(IE)]><table role="presentation" width="${t}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${h.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
|
|
69
|
-
} else
|
|
70
|
-
m = d.map(({ colHtml: h }) => h).join("");
|
|
71
|
-
const b = e.values.hideDesktop ? " u_hide_desktop" : "", v = e.values.hideMobile ? " u_hide_mobile" : "";
|
|
72
|
-
return `<div class="u_row${b}${v}" style="padding:${u};${o}${a}">
|
|
73
|
-
<div style="margin:0 auto;max-width:${t}px;${r ? "font-size:0;" : ""}text-align:center;">${m}</div>
|
|
74
|
-
</div>`;
|
|
100
|
+
function te(e, t) {
|
|
101
|
+
if (!t || typeof t != "object") return e;
|
|
102
|
+
const o = typeof t.before == "string" ? t.before : "", n = typeof t.after == "string" ? t.after : "";
|
|
103
|
+
return !o && !n ? e : `${o}${e}${n}`;
|
|
75
104
|
}
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
const r = c.get(a.type);
|
|
79
|
-
if (!r) return `<!-- unknown tool: ${a.type} -->`;
|
|
80
|
-
const d = {
|
|
81
|
-
columnWidth: i,
|
|
82
|
-
displayMode: "email",
|
|
83
|
-
contentWidth: parseInt(t.contentWidth || "600"),
|
|
84
|
-
bodyValues: t
|
|
85
|
-
};
|
|
86
|
-
let m = r(a.values, d);
|
|
87
|
-
const b = !!a.values.hideDesktop, v = !!a.values.hideMobile;
|
|
88
|
-
return (b || v) && (m = `<div class="${[b && "u_hide_desktop", v && "u_hide_mobile"].filter(Boolean).join(" ")}">${m}</div>`), m;
|
|
89
|
-
}).join(`
|
|
90
|
-
`);
|
|
91
|
-
return `<div class="u_column" style="display:inline-block;vertical-align:top;width:${i}px;max-width:${i}px;font-size:14px;text-align:left;">
|
|
92
|
-
<div style="width:100%;${o}${g !== "0px" ? `border-radius:${g};` : ""}">
|
|
93
|
-
<div style="padding:${u};">
|
|
94
|
-
${s || " "}
|
|
95
|
-
</div>
|
|
96
|
-
</div>
|
|
97
|
-
</div>`;
|
|
105
|
+
function ne(e) {
|
|
106
|
+
return `only screen and (max-width: ${e + 20}px)`;
|
|
98
107
|
}
|
|
99
|
-
function
|
|
108
|
+
function We(e) {
|
|
100
109
|
return `
|
|
101
110
|
@media only screen and (min-width: ${e + 20}px) {
|
|
102
111
|
.u_row .u_column { display: inline-block !important; }
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
@media
|
|
114
|
+
@media ${ne(e)} {
|
|
106
115
|
.u_row .u_column {
|
|
107
116
|
display: block !important;
|
|
108
117
|
width: 100% !important;
|
|
@@ -111,6 +120,9 @@ function $(e) {
|
|
|
111
120
|
.u_row {
|
|
112
121
|
width: 100% !important;
|
|
113
122
|
}
|
|
123
|
+
.u_row.no-stack .u_column_ns {
|
|
124
|
+
display: inline-block !important;
|
|
125
|
+
}
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
@media only screen and (max-width: 620px) {
|
|
@@ -145,7 +157,324 @@ function $(e) {
|
|
|
145
157
|
.u_hide_mobile { display: block !important; }
|
|
146
158
|
}`;
|
|
147
159
|
}
|
|
148
|
-
|
|
160
|
+
function N(e) {
|
|
161
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
162
|
+
}
|
|
163
|
+
function Ne(e) {
|
|
164
|
+
return `v-${N(e)}`;
|
|
165
|
+
}
|
|
166
|
+
const R = (e) => !!e && typeof e == "object" && !Array.isArray(e), M = (e) => typeof e == "string" ? e.trim().replace(/[^A-Za-z0-9_:.-]/g, "-") : "";
|
|
167
|
+
function q(e) {
|
|
168
|
+
return e.replace(/[:.]/g, "\\$&").replace(/^(-?)(\d)/, (t, o, n) => `${o}\\3${n} `);
|
|
169
|
+
}
|
|
170
|
+
function ye(e, t) {
|
|
171
|
+
return M(`${e}${typeof t == "string" || typeof t == "number" ? t : ""}`);
|
|
172
|
+
}
|
|
173
|
+
function oe(e) {
|
|
174
|
+
const t = e.values ?? {};
|
|
175
|
+
return M(t.anchor) || M(R(t._meta) ? t._meta.htmlID : "") || ye("u_content_", e.id);
|
|
176
|
+
}
|
|
177
|
+
function H(e) {
|
|
178
|
+
const t = e.values ?? {};
|
|
179
|
+
return M(t.anchor) || M(R(t._meta) ? t._meta.htmlID : "") || ye("u_row_", e.id);
|
|
180
|
+
}
|
|
181
|
+
function D(e) {
|
|
182
|
+
if (!R(e) || !R(e._override)) return null;
|
|
183
|
+
const t = e._override.mobile;
|
|
184
|
+
return !R(t) || Object.keys(t).length === 0 ? null : t;
|
|
185
|
+
}
|
|
186
|
+
const Pe = /* @__PURE__ */ new Set([
|
|
187
|
+
"_meta",
|
|
188
|
+
"_override",
|
|
189
|
+
"text",
|
|
190
|
+
"html",
|
|
191
|
+
"anchor",
|
|
192
|
+
"href",
|
|
193
|
+
"action",
|
|
194
|
+
"src",
|
|
195
|
+
"url",
|
|
196
|
+
"altText",
|
|
197
|
+
"displayCondition",
|
|
198
|
+
"hideDesktop",
|
|
199
|
+
"hideMobile",
|
|
200
|
+
"name",
|
|
201
|
+
"calculatedWidth",
|
|
202
|
+
"calculatedHeight"
|
|
203
|
+
]), Le = /* @__PURE__ */ new Set(["fontSize", "letterSpacing", "width", "height", "maxWidth", "borderRadius", "iconSize", "spacing"]), qe = {
|
|
204
|
+
containerPadding: "padding",
|
|
205
|
+
columnsBackgroundColor: "background-color"
|
|
206
|
+
};
|
|
207
|
+
function Y(e, t) {
|
|
208
|
+
return typeof t == "number" ? isFinite(t) ? Le.has(e) ? `${t}px` : String(t) : null : typeof t == "string" ? A(t) : null;
|
|
209
|
+
}
|
|
210
|
+
function F(e) {
|
|
211
|
+
const t = [];
|
|
212
|
+
for (const [o, n] of Object.entries(e)) {
|
|
213
|
+
if (Pe.has(o)) continue;
|
|
214
|
+
if (R(n)) {
|
|
215
|
+
if (o === "border")
|
|
216
|
+
for (const [i, r] of Object.entries(n)) {
|
|
217
|
+
if (!/^border(Top|Right|Bottom|Left)?(Width|Style|Color)$/.test(i)) continue;
|
|
218
|
+
const c = Y(i, r);
|
|
219
|
+
c && t.push({ className: "v-border", property: N(i), value: c });
|
|
220
|
+
}
|
|
221
|
+
else if (o === "buttonColors")
|
|
222
|
+
for (const i of ["backgroundColor", "color"]) {
|
|
223
|
+
const r = Y(i, n[i]);
|
|
224
|
+
r && t.push({ className: "v-button-colors", property: N(i), value: r });
|
|
225
|
+
}
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
const s = Y(o, n);
|
|
229
|
+
s && t.push({ className: Ne(o), property: qe[o] ?? N(o), value: s });
|
|
230
|
+
}
|
|
231
|
+
return t;
|
|
232
|
+
}
|
|
233
|
+
function be(e, t) {
|
|
234
|
+
const o = /* @__PURE__ */ new Map();
|
|
235
|
+
for (const n of e) {
|
|
236
|
+
const s = o.get(n.className) ?? [];
|
|
237
|
+
s.push(`${n.property}: ${n.value} !important;`), o.set(n.className, s);
|
|
238
|
+
}
|
|
239
|
+
return [...o].map(([n, s]) => ` ${t(n)} { ${s.join(" ")} }`);
|
|
240
|
+
}
|
|
241
|
+
function He(e) {
|
|
242
|
+
const t = D(e.values);
|
|
243
|
+
if (!t) return [];
|
|
244
|
+
const o = q(oe(e));
|
|
245
|
+
return o ? be(F(t), (n) => `#${o} .${n}, #${o}.${n}`) : [];
|
|
246
|
+
}
|
|
247
|
+
function Fe(e) {
|
|
248
|
+
const t = D(e.values);
|
|
249
|
+
if (!t) return [];
|
|
250
|
+
const o = q(H(e));
|
|
251
|
+
return o ? be(
|
|
252
|
+
F(t),
|
|
253
|
+
(n) => n === "v-columns-background-color" ? `#${o} .${n}` : `#${o}.${n}`
|
|
254
|
+
) : [];
|
|
255
|
+
}
|
|
256
|
+
function $e(e) {
|
|
257
|
+
const t = Fe(e);
|
|
258
|
+
for (const o of e.columns ?? [])
|
|
259
|
+
for (const n of o.contents ?? []) t.push(...He(n));
|
|
260
|
+
return t;
|
|
261
|
+
}
|
|
262
|
+
function ve(e, t) {
|
|
263
|
+
return e.length ? `@media ${ne(t)} {
|
|
264
|
+
${e.join(`
|
|
265
|
+
`)}
|
|
266
|
+
}` : "";
|
|
267
|
+
}
|
|
268
|
+
function Yt(e) {
|
|
269
|
+
const t = e?.body;
|
|
270
|
+
if (!t) return "";
|
|
271
|
+
const o = parseInt(String(t.values?.contentWidth || "600")) || 600, n = [];
|
|
272
|
+
for (const s of ee(e))
|
|
273
|
+
n.push(...$e(s));
|
|
274
|
+
return ve(n, o);
|
|
275
|
+
}
|
|
276
|
+
function we(e) {
|
|
277
|
+
if (!e || typeof e != "object") return "";
|
|
278
|
+
const t = e;
|
|
279
|
+
let o = "";
|
|
280
|
+
for (const n of ["Top", "Right", "Bottom", "Left"]) {
|
|
281
|
+
const s = String(t[`border${n}Width`] ?? "").trim();
|
|
282
|
+
if (!K(s) || parseFloat(s) <= 0) continue;
|
|
283
|
+
const i = String(t[`border${n}Style`] || "solid"), r = String(t[`border${n}Color`] || "#CCCCCC");
|
|
284
|
+
!K(i) || !K(r) || (o += `border-${n.toLowerCase()}:${s} ${i} ${r};`);
|
|
285
|
+
}
|
|
286
|
+
return o;
|
|
287
|
+
}
|
|
288
|
+
const ke = (e) => e.replace(/&(?![a-zA-Z0-9#]+;)/g, "&").replace(/"/g, """);
|
|
289
|
+
function Ue(e, t, o, n = "email") {
|
|
290
|
+
const s = parseInt(t.contentWidth || "600"), i = e.values.backgroundColor || "", r = e.values.columnsBackgroundColor || "", c = e.values.padding || "0px", l = e.cells.reduce((C, E) => C + E, 0), u = i ? `background-color:${i};` : "", a = e.values.backgroundImage;
|
|
291
|
+
let d = "";
|
|
292
|
+
if (a?.url) {
|
|
293
|
+
const C = a.repeat === !0 || a.repeat === "repeat" ? "repeat" : "no-repeat", E = a.cover === !0 ? "cover" : a.fullWidth === !0 ? "100% auto" : "auto", I = a.center !== !1 ? "center top" : "left top";
|
|
294
|
+
d = `background-image:url('${a.url}');background-repeat:${C};background-position:${I};background-size:${E};`;
|
|
295
|
+
}
|
|
296
|
+
const h = e.columns.length > 1, m = D(e.values), p = !!e.values.noStackMobile && e.columns.length > 1, f = !!m && "columnsBackgroundColor" in m, g = e.columns.map((C, E) => {
|
|
297
|
+
const I = Math.round(e.cells[E] / l * s), Re = p ? +(e.cells[E] / l * 100).toFixed(4) : 0;
|
|
298
|
+
return { colHtml: Ze(C, I, r, t, o, { pct: Re, colsBgHook: f, displayMode: n }), colWidthPx: I };
|
|
299
|
+
});
|
|
300
|
+
let y;
|
|
301
|
+
if (h) {
|
|
302
|
+
const C = g.map(
|
|
303
|
+
({ colHtml: E, colWidthPx: I }) => `<!--[if (mso)|(IE)]><td align="center" width="${I}" style="width:${I}px;padding:0px;" valign="top"><![endif]-->${E}<!--[if (mso)|(IE)]></td><![endif]-->`
|
|
304
|
+
);
|
|
305
|
+
y = `<!--[if (mso)|(IE)]><table role="presentation" width="${s}" cellpadding="0" cellspacing="0" border="0"><tr><![endif]-->${C.join("")}<!--[if (mso)|(IE)]></tr></table><![endif]-->`;
|
|
306
|
+
} else
|
|
307
|
+
y = g.map(({ colHtml: C }) => C).join("");
|
|
308
|
+
const b = e.values.hideDesktop ? " u_hide_desktop" : "", v = e.values.hideMobile ? " u_hide_mobile" : "", w = h ? "font-size:0;" : "", $ = p ? " no-stack" : "", j = m ? ["padding", "backgroundColor"].filter((C) => C in m).map((C) => C === "padding" ? " v-padding" : " v-background-color").join("") : "", O = e.values._meta, _ = e.values.anchor || O?.htmlID || m ? H(e) : "", k = _ ? ` id="${ke(_)}"` : "", x = `<div class="u_row${$}${b}${v}${j}"${k} style="padding:${c};${u}${d}">
|
|
309
|
+
<div style="margin:0 auto;max-width:${s}px;${w}text-align:center;">${y}</div>
|
|
310
|
+
</div>`;
|
|
311
|
+
return te(x, e.values.displayCondition);
|
|
312
|
+
}
|
|
313
|
+
function Ze(e, t, o, n, s, i) {
|
|
314
|
+
const r = e.values?.backgroundColor || "", c = r || o || "", l = i.colsBgHook && !r ? ' class="v-columns-background-color"' : "", u = e.values.padding || "0px", a = e.values.borderRadius || "0px", d = c ? `background-color:${c};` : "", h = xe(e, t, n, s, i.displayMode), m = `<div${l} style="width:100%;box-sizing:border-box;${d}${we(e.values.border)}${a !== "0px" ? `border-radius:${a};` : ""}">
|
|
315
|
+
<div style="padding:${u};">
|
|
316
|
+
${h || " "}
|
|
317
|
+
</div>
|
|
318
|
+
</div>`;
|
|
319
|
+
return i.pct ? `<div class="u_column_ns" style="display:inline-block;vertical-align:top;width:${i.pct}%;max-width:${t}px;">
|
|
320
|
+
<div class="u_column" style="display:inline-block;vertical-align:top;width:100%;font-size:14px;text-align:left;">
|
|
321
|
+
${m}
|
|
322
|
+
</div>
|
|
323
|
+
</div>` : `<div class="u_column" style="display:inline-block;vertical-align:top;width:${t}px;max-width:${t}px;font-size:14px;text-align:left;">
|
|
324
|
+
${m}
|
|
325
|
+
</div>`;
|
|
326
|
+
}
|
|
327
|
+
function xe(e, t, o, n, s) {
|
|
328
|
+
const i = parseInt(o.contentWidth || "600");
|
|
329
|
+
return e.contents.map((r) => {
|
|
330
|
+
const c = n.get(r.type);
|
|
331
|
+
if (!c) return `<!-- unknown tool: ${r.type} -->`;
|
|
332
|
+
const l = { columnWidth: t, displayMode: s, contentWidth: i, bodyValues: o };
|
|
333
|
+
let u = c(r.values, l);
|
|
334
|
+
const a = !!r.values.hideDesktop, d = !!r.values.hideMobile;
|
|
335
|
+
if ((a || d) && (u = `<div class="${[a && "u_hide_desktop", d && "u_hide_mobile"].filter(Boolean).join(" ")}">${u}</div>`), D(r.values)) {
|
|
336
|
+
const h = oe(r);
|
|
337
|
+
h && !u.includes(`id="${h}"`) && (u = `<div id="${ke(h)}">${u}</div>`);
|
|
338
|
+
}
|
|
339
|
+
return te(u, r.values.displayCondition);
|
|
340
|
+
}).join(`
|
|
341
|
+
`);
|
|
342
|
+
}
|
|
343
|
+
const J = (e) => e.replace(/&(?![a-zA-Z0-9#]+;)/g, "&").replace(/"/g, """), Ke = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Ge = (e) => e.trim().replace(/['"()\\\s<>]/g, (t) => `%${t.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`), S = (e) => A(e) ?? "";
|
|
344
|
+
function Ce(e) {
|
|
345
|
+
if (!e || typeof e != "object" || typeof e.url != "string" || !e.url.trim()) return "";
|
|
346
|
+
const t = e.repeat === !0 || e.repeat === "repeat" ? "repeat" : "no-repeat", o = e.cover === !0 ? "cover" : e.fullWidth === !0 ? "100% auto" : "auto", n = e.center !== !1 ? "center top" : "left top";
|
|
347
|
+
return `background-image:url('${Ge(e.url)}');background-repeat:${t};background-position:${n};background-size:${o};`;
|
|
348
|
+
}
|
|
349
|
+
function Ye(e, t, o) {
|
|
350
|
+
const n = parseInt(t.contentWidth || "600") || 600, s = e.cells.reduce((b, v) => b + v, 0) || 1, i = e.values.backgroundColor ? `background-color:${S(e.values.backgroundColor)};` : "", r = Ce(e.values.backgroundImage), c = S(e.values.padding || "0px"), l = D(e.values), u = !!e.values.noStackMobile && e.columns.length > 1, a = !!l && "columnsBackgroundColor" in l, d = e.values.columnsBackgroundColor || "", h = e.columns.map((b, v) => Xe(b, e.cells[v] ?? 1, Math.round((e.cells[v] ?? 1) / s * n), d, a, t, o)).join(`
|
|
351
|
+
`), m = ["u_row"];
|
|
352
|
+
u && m.push("no-stack"), e.values.hideDesktop && m.push("u_hide_desktop"), e.values.hideMobile && m.push("u_hide_mobile"), l && ("padding" in l && m.push("v-padding"), "backgroundColor" in l && m.push("v-background-color"));
|
|
353
|
+
const p = e.values._meta, f = e.values.anchor || p?.htmlID || l ? H(e) : "", g = f ? ` id="${J(f)}"` : "", y = `<div class="${m.join(" ")}"${g} style="padding:${c};${i}${r}">
|
|
354
|
+
<div class="u_row_inner">
|
|
355
|
+
${h}
|
|
356
|
+
</div>
|
|
357
|
+
</div>`;
|
|
358
|
+
return te(Je(y), e.values.displayCondition);
|
|
359
|
+
}
|
|
360
|
+
function Xe(e, t, o, n, s, i, r) {
|
|
361
|
+
const c = e.values?.backgroundColor || "", l = c || n, u = s && !c ? " v-columns-background-color" : "", a = e.values?.borderRadius && e.values.borderRadius !== "0px" ? `border-radius:${S(e.values.borderRadius)};` : "", d = S(e.values?.padding || "0px"), h = xe(e, o, i, r, "web");
|
|
362
|
+
return ` <div class="u_column" style="flex:${+t || 1} 1 0%;">
|
|
363
|
+
<div class="u_column_inner${u}" style="${l ? `background-color:${S(l)};` : ""}${we(e.values?.border)}${a}padding:${d};">
|
|
364
|
+
${h}
|
|
365
|
+
</div>
|
|
366
|
+
</div>`;
|
|
367
|
+
}
|
|
368
|
+
function Je(e) {
|
|
369
|
+
return !e.includes("<!--[if") && !e.includes("<![endif]") ? e : e.replace(/<!--\[if [^\]]*\]>(?!<!-->)[\s\S]*?<!\[endif\]-->/gi, "").replace(/<!--\[if [^\]]*\]><!-->/gi, "").replace(/<!--<!\[endif\]-->/gi, "");
|
|
370
|
+
}
|
|
371
|
+
function Qe(e) {
|
|
372
|
+
return `*, *::before, *::after { box-sizing: border-box; }
|
|
373
|
+
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
|
374
|
+
body { margin: 0; padding: 0; }
|
|
375
|
+
p { margin: 0; }
|
|
376
|
+
img { max-width: 100%; height: auto; }
|
|
377
|
+
table { border-collapse: collapse; }
|
|
378
|
+
.u_body { min-height: 100vh; }
|
|
379
|
+
.u_row { width: 100%; }
|
|
380
|
+
.u_row_inner { display: flex; flex-wrap: nowrap; align-items: stretch; max-width: ${e}px; margin: 0 auto; }
|
|
381
|
+
.u_column { min-width: 0; }
|
|
382
|
+
.u_column_inner { height: 100%; }
|
|
383
|
+
@media ${ne(e)} {
|
|
384
|
+
.u_row:not(.no-stack) > .u_row_inner { flex-direction: column; }
|
|
385
|
+
.u_row:not(.no-stack) > .u_row_inner > .u_column { flex: 0 0 auto !important; width: 100% !important; }
|
|
386
|
+
.u_hide_mobile { display: none !important; }
|
|
387
|
+
}
|
|
388
|
+
@media only screen and (min-width: ${e + 21}px) {
|
|
389
|
+
.u_hide_desktop { display: none !important; }
|
|
390
|
+
}`;
|
|
391
|
+
}
|
|
392
|
+
function Ve(e) {
|
|
393
|
+
if (!e || typeof e != "object") return "";
|
|
394
|
+
const t = (s, i) => [s ? `color: ${S(s)};` : "", typeof i == "boolean" ? `text-decoration: ${i ? "underline" : "none"};` : ""].filter(Boolean).join(" "), o = t(e.linkColor, e.linkUnderline), n = t(e.linkHoverColor, e.linkHoverUnderline);
|
|
395
|
+
return (o ? `
|
|
396
|
+
.u_body a { ${o} }` : "") + (n ? `
|
|
397
|
+
.u_body a:hover { ${n} }` : "");
|
|
398
|
+
}
|
|
399
|
+
function et(e, t, o = {}) {
|
|
400
|
+
const n = parseInt(t.contentWidth || "600") || 600, s = S(t.backgroundColor || "#ffffff"), i = S(t.textColor || "#000000"), r = S(t.fontFamily?.value || "arial,helvetica,sans-serif"), c = he(t), l = c ? ` font-weight: ${c};` : "", u = me(t, o.title), a = Ce(t.backgroundImage), d = Ve(t.linkStyle), h = (o.fontUrls ?? []).map((f) => `
|
|
401
|
+
<link href="${J(f)}" rel="stylesheet">`).join(""), m = (o.styles ?? []).map((f) => `
|
|
402
|
+
<style>
|
|
403
|
+
${f}
|
|
404
|
+
</style>`).join("");
|
|
405
|
+
return `<!DOCTYPE html>
|
|
406
|
+
<html lang="${J(o.lang || ge(t) || "en")}">
|
|
407
|
+
<head>
|
|
408
|
+
<meta charset="utf-8">
|
|
409
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
410
|
+
<title>${u ? Ke(u) : ""}</title>${h}
|
|
411
|
+
<style>
|
|
412
|
+
${Qe(n)}
|
|
413
|
+
body { background-color: ${s}; color: ${i}; font-family: ${r};${l} }
|
|
414
|
+
.u_body { background-color: ${s};${a ? ` ${a.replace(/;(?=.)/g, "; ")}` : ""} }${d}
|
|
415
|
+
</style>${m}
|
|
416
|
+
</head>
|
|
417
|
+
<body>
|
|
418
|
+
<div class="u_body">
|
|
419
|
+
${e}
|
|
420
|
+
</div>
|
|
421
|
+
</body>
|
|
422
|
+
</html>`;
|
|
423
|
+
}
|
|
424
|
+
const P = (e) => !!e && typeof e == "object" && !Array.isArray(e);
|
|
425
|
+
function _e(e) {
|
|
426
|
+
if (!P(e) || !P(e._override)) return null;
|
|
427
|
+
const t = e._override.dark;
|
|
428
|
+
return P(t) && Object.keys(t).length ? t : null;
|
|
429
|
+
}
|
|
430
|
+
const tt = (e) => /color$/.test(e.property);
|
|
431
|
+
function Se(e, t) {
|
|
432
|
+
const o = /* @__PURE__ */ new Map();
|
|
433
|
+
for (const n of e.filter(tt)) o.set(n.className, [...o.get(n.className) ?? [], n]);
|
|
434
|
+
return [...o].map(([n, s]) => ({ selector: t(n), decls: s }));
|
|
435
|
+
}
|
|
436
|
+
function nt(e) {
|
|
437
|
+
const t = _e(e.values);
|
|
438
|
+
if (!t) return [];
|
|
439
|
+
const o = q(oe(e));
|
|
440
|
+
return o ? Se(F(t), (n) => `#${o} .${n}, #${o}.${n}`) : [];
|
|
441
|
+
}
|
|
442
|
+
function ot(e) {
|
|
443
|
+
const t = _e(e.values);
|
|
444
|
+
if (!t) return [];
|
|
445
|
+
const o = q(H(e));
|
|
446
|
+
return o ? Se(F(t), (n) => n === "v-columns-background-color" ? `#${o} .${n}` : `#${o}.${n}`) : [];
|
|
447
|
+
}
|
|
448
|
+
function st(e) {
|
|
449
|
+
const t = e.body?.values?.darkMode;
|
|
450
|
+
if (!P(t)) return [];
|
|
451
|
+
const o = [], n = A(t.backgroundColor), s = A(t.textColor), i = A(t.linkColor);
|
|
452
|
+
return n && o.push({ selector: "body, .u_body, #u_body", decls: [{ className: "", property: "background-color", value: n }] }), s && o.push({ selector: "body, .u_body, #u_body, .u_body .v-color", decls: [{ className: "", property: "color", value: s }] }), i && o.push({ selector: ".u_body a, #u_body a", decls: [{ className: "", property: "color", value: i }] }), o;
|
|
453
|
+
}
|
|
454
|
+
function Xt(e) {
|
|
455
|
+
return Te(e) !== "";
|
|
456
|
+
}
|
|
457
|
+
function Te(e) {
|
|
458
|
+
const t = [...st(e)];
|
|
459
|
+
for (const r of ee(e)) {
|
|
460
|
+
t.push(...ot(r));
|
|
461
|
+
for (const c of r.columns ?? []) for (const l of c.contents ?? []) t.push(...nt(l));
|
|
462
|
+
}
|
|
463
|
+
if (!t.length) return "";
|
|
464
|
+
const o = (r) => `${r.property}: ${r.value} !important;`, n = t.map((r) => ` ${r.selector} { ${r.decls.map(o).join(" ")} }`).join(`
|
|
465
|
+
`), s = (r, c) => t.map((l) => ({ sel: l.selector.split(",").map((u) => `[${r}] ${u.trim()}`).join(", "), decls: l.decls.filter(c) })).filter((l) => l.decls.length).map((l) => `${l.sel} { ${l.decls.map(o).join(" ")} }`).join(`
|
|
466
|
+
`), i = (r) => r.property === "background-color";
|
|
467
|
+
return [
|
|
468
|
+
":root { color-scheme: light dark; supported-color-schemes: light dark; }",
|
|
469
|
+
`@media (prefers-color-scheme: dark) {
|
|
470
|
+
${n}
|
|
471
|
+
}`,
|
|
472
|
+
s("data-ogsc", (r) => !i(r)),
|
|
473
|
+
s("data-ogsb", i)
|
|
474
|
+
].filter(Boolean).join(`
|
|
475
|
+
`);
|
|
476
|
+
}
|
|
477
|
+
const it = [
|
|
149
478
|
"box-sizing",
|
|
150
479
|
"overflow-wrap",
|
|
151
480
|
"word-break",
|
|
@@ -159,67 +488,1000 @@ const _ = [
|
|
|
159
488
|
"display:\\s*flex",
|
|
160
489
|
"display:\\s*grid",
|
|
161
490
|
"gap"
|
|
162
|
-
],
|
|
163
|
-
`(?:;\\s*|^\\s*)(${
|
|
491
|
+
], rt = new RegExp(
|
|
492
|
+
`(?:;\\s*|^\\s*)(${it.join("|")})\\s*:[^;]*`,
|
|
164
493
|
"gi"
|
|
165
|
-
),
|
|
166
|
-
function
|
|
167
|
-
return e.replace(/style="([^"]*)"/gi, (
|
|
168
|
-
let
|
|
169
|
-
return
|
|
494
|
+
), lt = /var\(--[^)]*\)/gi;
|
|
495
|
+
function at(e) {
|
|
496
|
+
return e.replace(/style="([^"]*)"/gi, (t, o) => {
|
|
497
|
+
let n = o;
|
|
498
|
+
return n = n.replace(rt, ";"), n = n.replace(lt, "inherit"), n = n.replace(/;(\s*;)+/g, ";").replace(/^\s*;\s*/, "").replace(/;\s*$/, "").trim(), n ? `style="${n}"` : "";
|
|
170
499
|
});
|
|
171
500
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
501
|
+
const ct = /* @__PURE__ */ new Set(["style", "script", "textarea", "title"]), Q = /* @__PURE__ */ new Set([
|
|
502
|
+
"area",
|
|
503
|
+
"base",
|
|
504
|
+
"br",
|
|
505
|
+
"col",
|
|
506
|
+
"embed",
|
|
507
|
+
"hr",
|
|
508
|
+
"img",
|
|
509
|
+
"input",
|
|
510
|
+
"link",
|
|
511
|
+
"meta",
|
|
512
|
+
"param",
|
|
513
|
+
"source",
|
|
514
|
+
"track",
|
|
515
|
+
"wbr"
|
|
516
|
+
]);
|
|
517
|
+
function B(e) {
|
|
518
|
+
const t = [], o = e.length;
|
|
519
|
+
let n = 0, s = 0;
|
|
520
|
+
const i = (r) => {
|
|
521
|
+
r > s && t.push({ type: "text", raw: e.slice(s, r) });
|
|
522
|
+
};
|
|
523
|
+
for (; n < o; ) {
|
|
524
|
+
const r = e.indexOf("<", n);
|
|
525
|
+
if (r === -1) break;
|
|
526
|
+
const c = e.charAt(r + 1);
|
|
527
|
+
if (e.startsWith("<!--", r)) {
|
|
528
|
+
const l = e.indexOf("-->", r + 4), u = l === -1 ? o : l + 3;
|
|
529
|
+
i(r), t.push({ type: "comment", raw: e.slice(r, u) }), n = s = u;
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
if (c === "!" || c === "?") {
|
|
533
|
+
const l = e.indexOf(">", r + 2), u = l === -1 ? o : l + 1;
|
|
534
|
+
i(r), t.push({ type: "doctype", raw: e.slice(r, u) }), n = s = u;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (c === "/" && /[a-zA-Z]/.test(e.charAt(r + 2))) {
|
|
538
|
+
const l = e.indexOf(">", r + 2), u = l === -1 ? o : l + 1, a = e.slice(r + 2, l === -1 ? o : l).trim().split(/\s/)[0].toLowerCase();
|
|
539
|
+
i(r), t.push({ type: "close", name: a, raw: e.slice(r, u) }), n = s = u;
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (/[a-zA-Z]/.test(c)) {
|
|
543
|
+
const l = ut(e, r);
|
|
544
|
+
if (!l) {
|
|
545
|
+
n = r + 1;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
if (i(r), t.push(l.token), n = s = l.end, ct.has(l.token.name) && !l.token.selfClosing) {
|
|
549
|
+
const u = new RegExp(`</${l.token.name}\\s*>`, "ig");
|
|
550
|
+
u.lastIndex = n;
|
|
551
|
+
const a = u.exec(e), d = a ? a.index : o;
|
|
552
|
+
d > n && t.push({ type: "rawtext", parent: l.token.name, raw: e.slice(n, d) }), a ? (t.push({ type: "close", name: l.token.name, raw: a[0] }), n = s = d + a[0].length) : n = s = o;
|
|
553
|
+
}
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
n = r + 1;
|
|
557
|
+
}
|
|
558
|
+
return i(o), t;
|
|
559
|
+
}
|
|
560
|
+
function ut(e, t) {
|
|
561
|
+
const o = e.length;
|
|
562
|
+
let n = t + 1;
|
|
563
|
+
const s = /^[a-zA-Z][^\s/>]*/.exec(e.slice(n, n + 128));
|
|
564
|
+
if (!s) return null;
|
|
565
|
+
const i = s[0].toLowerCase();
|
|
566
|
+
n += s[0].length;
|
|
567
|
+
const r = [];
|
|
568
|
+
let c = !1;
|
|
569
|
+
for (; n < o; ) {
|
|
570
|
+
for (; n < o && /\s/.test(e.charAt(n)); ) n++;
|
|
571
|
+
const l = e.charAt(n);
|
|
572
|
+
if (l === ">")
|
|
573
|
+
return n++, { token: { type: "open", name: i, attrs: r, selfClosing: c, raw: e.slice(t, n) }, end: n };
|
|
574
|
+
if (l === "/") {
|
|
575
|
+
if (n++, e.charAt(n) === ">")
|
|
576
|
+
return c = !0, n++, { token: { type: "open", name: i, attrs: r, selfClosing: c, raw: e.slice(t, n) }, end: n };
|
|
577
|
+
continue;
|
|
578
|
+
}
|
|
579
|
+
if (n >= o) break;
|
|
580
|
+
const u = n;
|
|
581
|
+
for (; n < o && !/[\s=/>]/.test(e.charAt(n)); ) n++;
|
|
582
|
+
if (n === u) {
|
|
583
|
+
n++;
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
const a = e.slice(u, n).toLowerCase();
|
|
587
|
+
let d = n;
|
|
588
|
+
for (; d < o && /\s/.test(e.charAt(d)); ) d++;
|
|
589
|
+
if (e.charAt(d) === "=") {
|
|
590
|
+
for (d++; d < o && /\s/.test(e.charAt(d)); ) d++;
|
|
591
|
+
const h = e.charAt(d);
|
|
592
|
+
if (h === '"' || h === "'") {
|
|
593
|
+
const m = e.indexOf(h, d + 1), p = m === -1 ? o : m;
|
|
594
|
+
r.push({ name: a, value: e.slice(d + 1, p), quote: h }), n = m === -1 ? o : m + 1;
|
|
595
|
+
} else {
|
|
596
|
+
const m = d;
|
|
597
|
+
for (; d < o && !/[\s>]/.test(e.charAt(d)); ) d++;
|
|
598
|
+
r.push({ name: a, value: e.slice(m, d), quote: "" }), n = d;
|
|
599
|
+
}
|
|
600
|
+
} else
|
|
601
|
+
r.push({ name: a, value: null, quote: "" });
|
|
602
|
+
}
|
|
603
|
+
return null;
|
|
604
|
+
}
|
|
605
|
+
function dt(e) {
|
|
606
|
+
let t = `<${e.name}`;
|
|
607
|
+
for (const o of e.attrs) {
|
|
608
|
+
if (o.value === null) {
|
|
609
|
+
t += ` ${o.name}`;
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
let n = o.quote || '"';
|
|
613
|
+
n === "'" && o.value.includes("'") && (n = '"');
|
|
614
|
+
const s = n === '"' ? o.value.replace(/"/g, """) : o.value;
|
|
615
|
+
t += ` ${o.name}=${n}${s}${n}`;
|
|
616
|
+
}
|
|
617
|
+
return t += e.selfClosing ? " />" : ">", t;
|
|
618
|
+
}
|
|
619
|
+
function U(e) {
|
|
620
|
+
let t = "";
|
|
621
|
+
for (const o of e)
|
|
622
|
+
t += o.type === "open" && o.dirty ? dt(o) : o.raw;
|
|
623
|
+
return t;
|
|
624
|
+
}
|
|
625
|
+
function T(e, t) {
|
|
626
|
+
const o = e.attrs.find((n) => n.name === t);
|
|
627
|
+
return o ? o.value : void 0;
|
|
628
|
+
}
|
|
629
|
+
function ft(e, t, o) {
|
|
630
|
+
const n = e.attrs.find((s) => s.name === t);
|
|
631
|
+
n ? (n.value = o, n.quote || (n.quote = '"')) : e.attrs.push({ name: t, value: o, quote: '"' }), e.dirty = !0;
|
|
632
|
+
}
|
|
633
|
+
function pt(e) {
|
|
634
|
+
const t = e.slice(4, e.endsWith("-->") ? -3 : void 0).trim();
|
|
635
|
+
return /^\[if\b/i.test(t) || /^<!\[endif\]/i.test(t) || /<!\[endif\]$/i.test(t);
|
|
636
|
+
}
|
|
637
|
+
function Ee(e) {
|
|
638
|
+
let t = "", o = 0;
|
|
639
|
+
for (; o < e.length; ) {
|
|
640
|
+
const n = e[o];
|
|
641
|
+
if (n === '"' || n === "'") {
|
|
642
|
+
const s = Z(e, o);
|
|
643
|
+
t += e.slice(o, s), o = s;
|
|
644
|
+
} else if (n === "/" && e[o + 1] === "*") {
|
|
645
|
+
const s = e.indexOf("*/", o + 2);
|
|
646
|
+
o = s === -1 ? e.length : s + 2;
|
|
647
|
+
} else
|
|
648
|
+
t += n, o++;
|
|
649
|
+
}
|
|
650
|
+
return t;
|
|
651
|
+
}
|
|
652
|
+
function Z(e, t) {
|
|
653
|
+
const o = e[t];
|
|
654
|
+
let n = t + 1;
|
|
655
|
+
for (; n < e.length; ) {
|
|
656
|
+
if (e[n] === "\\") {
|
|
657
|
+
n += 2;
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
if (e[n] === o || e[n] === `
|
|
661
|
+
`) return n + 1;
|
|
662
|
+
n++;
|
|
663
|
+
}
|
|
664
|
+
return e.length;
|
|
665
|
+
}
|
|
666
|
+
function L(e, t, o) {
|
|
667
|
+
let n = 0, s = t;
|
|
668
|
+
for (; s < e.length; ) {
|
|
669
|
+
const i = e[s];
|
|
670
|
+
if (i === '"' || i === "'") {
|
|
671
|
+
s = Z(e, s);
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if (i === "(" || i === "[") n++;
|
|
675
|
+
else if (i === ")" || i === "]") n = Math.max(0, n - 1);
|
|
676
|
+
else if (n === 0 && o.includes(i)) return s;
|
|
677
|
+
s++;
|
|
678
|
+
}
|
|
679
|
+
return -1;
|
|
680
|
+
}
|
|
681
|
+
function se(e, t) {
|
|
682
|
+
let o = 0, n = t;
|
|
683
|
+
for (; n < e.length; ) {
|
|
684
|
+
const s = e[n];
|
|
685
|
+
if (s === '"' || s === "'") {
|
|
686
|
+
n = Z(e, n);
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
if (s === "{") o++;
|
|
690
|
+
else if (s === "}" && (o--, o === 0))
|
|
691
|
+
return n;
|
|
692
|
+
n++;
|
|
693
|
+
}
|
|
694
|
+
return e.length - 1;
|
|
695
|
+
}
|
|
696
|
+
function Ie(e, t) {
|
|
697
|
+
const o = [];
|
|
698
|
+
let n = 0, s = L(e, 0, t);
|
|
699
|
+
for (; s !== -1; )
|
|
700
|
+
o.push(e.slice(n, s)), n = s + 1, s = L(e, n, t);
|
|
701
|
+
return o.push(e.slice(n)), o;
|
|
702
|
+
}
|
|
703
|
+
function je(e) {
|
|
704
|
+
const t = [];
|
|
705
|
+
for (const o of Ie(e, ";")) {
|
|
706
|
+
const n = o.indexOf(":");
|
|
707
|
+
if (n === -1) continue;
|
|
708
|
+
const s = o.slice(0, n).trim().toLowerCase();
|
|
709
|
+
let i = o.slice(n + 1).trim();
|
|
710
|
+
if (!s || !i) continue;
|
|
711
|
+
let r = !1;
|
|
712
|
+
const c = /\s*!\s*important\s*$/i.exec(i);
|
|
713
|
+
c && (r = !0, i = i.slice(0, c.index).trim()), t.push({ property: s, value: i, important: r });
|
|
714
|
+
}
|
|
715
|
+
return t;
|
|
716
|
+
}
|
|
717
|
+
function ie(e) {
|
|
718
|
+
return e.map((t) => `${t.property}:${t.value}${t.important ? " !important" : ""}`).join(";");
|
|
719
|
+
}
|
|
720
|
+
function mt(e) {
|
|
721
|
+
const t = Ee(e), o = [];
|
|
722
|
+
let n = 0;
|
|
723
|
+
for (; n < t.length; ) {
|
|
724
|
+
for (; n < t.length && /[\s;]/.test(t[n]); ) n++;
|
|
725
|
+
if (t.startsWith("<!--", n)) {
|
|
726
|
+
n += 4;
|
|
727
|
+
continue;
|
|
728
|
+
}
|
|
729
|
+
if (t.startsWith("-->", n)) {
|
|
730
|
+
n += 3;
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
if (n >= t.length) break;
|
|
734
|
+
if (t[n] === "@") {
|
|
735
|
+
const u = (/^@([\w-]+)/.exec(t.slice(n))?.[1] ?? "").toLowerCase(), a = L(t, n, ";{");
|
|
736
|
+
if (a === -1) {
|
|
737
|
+
o.push({ type: "at-rule", name: u, raw: t.slice(n).trim() });
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
if (t[a] === ";")
|
|
741
|
+
o.push({ type: "at-rule", name: u, raw: t.slice(n, a + 1).trim() }), n = a + 1;
|
|
742
|
+
else {
|
|
743
|
+
const d = se(t, a);
|
|
744
|
+
o.push({ type: "at-rule", name: u, raw: t.slice(n, d + 1).trim() }), n = d + 1;
|
|
745
|
+
}
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
const s = L(t, n, "{");
|
|
749
|
+
if (s === -1) break;
|
|
750
|
+
const i = se(t, s), r = t.slice(n, s).trim(), c = t.slice(s + 1, i);
|
|
751
|
+
o.push({
|
|
752
|
+
type: "rule",
|
|
753
|
+
selectors: Ie(r, ",").map((l) => l.trim()).filter(Boolean),
|
|
754
|
+
declarations: je(c),
|
|
755
|
+
raw: t.slice(n, i + 1).trim()
|
|
756
|
+
}), n = i + 1;
|
|
757
|
+
}
|
|
758
|
+
return o;
|
|
759
|
+
}
|
|
760
|
+
const gt = /^@(?:-[a-z]+-)?(?:media|supports|document|container|layer|keyframes)\b/i;
|
|
761
|
+
function ht(e) {
|
|
762
|
+
const t = Ee(e);
|
|
763
|
+
let o = "", n = 0;
|
|
764
|
+
const s = [];
|
|
765
|
+
let i = 0;
|
|
766
|
+
const r = () => s.length > 0 && s[s.length - 1];
|
|
767
|
+
for (; n < t.length; ) {
|
|
768
|
+
const c = t[n];
|
|
769
|
+
if (c === '"' || c === "'") {
|
|
770
|
+
const l = Z(t, n);
|
|
771
|
+
o += t.slice(n, l), n = l;
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
if (/\s/.test(c)) {
|
|
775
|
+
for (; n < t.length && /\s/.test(t[n]); ) n++;
|
|
776
|
+
const l = o[o.length - 1], u = t[n];
|
|
777
|
+
if (l === void 0 || u === void 0 || "{};,>".includes(l) || "{};,>".includes(u) || l === ":" || u === ":" && r()) continue;
|
|
778
|
+
o += " ";
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
if (c === "{") {
|
|
782
|
+
const l = o.slice(i).trim();
|
|
783
|
+
s.push(!gt.test(l)), o += c, i = o.length, n++;
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
c === "}" && (o[o.length - 1] === ";" && (o = o.slice(0, -1)), s.pop()), o += c, (c === "}" || c === ";") && (i = o.length), n++;
|
|
787
|
+
}
|
|
788
|
+
return o.trim();
|
|
789
|
+
}
|
|
790
|
+
const yt = /^[a-zA-Z0-9_\-#.*\s>]+$/, bt = /^(\*|[a-zA-Z][a-zA-Z0-9-]*)?((?:[#.][a-zA-Z_\-][a-zA-Z0-9_-]*)*)$/;
|
|
791
|
+
function $t(e) {
|
|
792
|
+
const t = e.trim();
|
|
793
|
+
if (!t || !yt.test(t)) return null;
|
|
794
|
+
const o = t.replace(/\s*>\s*/g, " > ").trim().split(/\s+/), n = [], s = [], i = [0, 0, 0];
|
|
795
|
+
let r = null;
|
|
796
|
+
for (const c of o) {
|
|
797
|
+
if (c === ">") {
|
|
798
|
+
if (n.length === 0 || r === ">") return null;
|
|
799
|
+
r = ">";
|
|
800
|
+
continue;
|
|
801
|
+
}
|
|
802
|
+
const l = bt.exec(c);
|
|
803
|
+
if (!l || !l[1] && !l[2]) return null;
|
|
804
|
+
const u = { tag: null, id: null, classes: [] };
|
|
805
|
+
l[1] && l[1] !== "*" && (u.tag = l[1].toLowerCase(), i[2]++);
|
|
806
|
+
for (const a of l[2].match(/[#.][^#.]+/g) ?? [])
|
|
807
|
+
if (a[0] === "#") {
|
|
808
|
+
if (u.id !== null && u.id !== a.slice(1)) return null;
|
|
809
|
+
u.id = a.slice(1), i[0]++;
|
|
810
|
+
} else
|
|
811
|
+
u.classes.push(a.slice(1)), i[1]++;
|
|
812
|
+
n.length > 0 && s.push(r ?? " "), r = null, n.push(u);
|
|
813
|
+
}
|
|
814
|
+
return r !== null || n.length === 0 ? null : (n.reverse(), s.reverse(), { compounds: n, combinators: s, specificity: i });
|
|
815
|
+
}
|
|
816
|
+
function vt(e, t) {
|
|
817
|
+
if (t.tag !== null && e.token.name !== t.tag || t.id !== null && e.id !== t.id) return !1;
|
|
818
|
+
for (const o of t.classes)
|
|
819
|
+
if (!e.classes.includes(o)) return !1;
|
|
820
|
+
return !0;
|
|
821
|
+
}
|
|
822
|
+
function V(e, t, o) {
|
|
823
|
+
if (!vt(e, t.compounds[o])) return !1;
|
|
824
|
+
if (o === t.compounds.length - 1) return !0;
|
|
825
|
+
if (t.combinators[o] === ">")
|
|
826
|
+
return e.parent !== null && V(e.parent, t, o + 1);
|
|
827
|
+
for (let s = e.parent; s; s = s.parent)
|
|
828
|
+
if (V(s, t, o + 1)) return !0;
|
|
829
|
+
return !1;
|
|
830
|
+
}
|
|
831
|
+
function wt(e, t) {
|
|
832
|
+
return V(e, t, 0);
|
|
833
|
+
}
|
|
834
|
+
function kt(e, t) {
|
|
835
|
+
return e[0] - t[0] || e[1] - t[1] || e[2] - t[2];
|
|
836
|
+
}
|
|
837
|
+
function xt(e) {
|
|
838
|
+
const t = [], o = [];
|
|
839
|
+
for (const n of e)
|
|
840
|
+
if (n.type === "open") {
|
|
841
|
+
const s = T(n, "id"), i = T(n, "class"), r = {
|
|
842
|
+
token: n,
|
|
843
|
+
parent: o[o.length - 1] ?? null,
|
|
844
|
+
id: s ? s.trim() : null,
|
|
845
|
+
classes: i ? i.trim().split(/\s+/).filter(Boolean) : []
|
|
846
|
+
};
|
|
847
|
+
t.push(r), !n.selfClosing && !Q.has(n.name) && o.push(r);
|
|
848
|
+
} else if (n.type === "close") {
|
|
849
|
+
for (let s = o.length - 1; s >= 0; s--)
|
|
850
|
+
if (o[s].token.name === n.name) {
|
|
851
|
+
o.length = s;
|
|
852
|
+
break;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return t;
|
|
856
|
+
}
|
|
857
|
+
function Ct(e) {
|
|
858
|
+
for (let t = e; t; t = t.parent)
|
|
859
|
+
if (t.token.name === "body") return !0;
|
|
860
|
+
return !1;
|
|
861
|
+
}
|
|
862
|
+
function _t(e, t = {}) {
|
|
863
|
+
const o = t.removeInlinedRules !== !1, n = B(e), s = [];
|
|
864
|
+
let i = 0;
|
|
865
|
+
const r = /* @__PURE__ */ new Map();
|
|
866
|
+
for (let a = 0; a < n.length; a++) {
|
|
867
|
+
const d = n[a];
|
|
868
|
+
if (d.type !== "open" || d.name !== "style" || T(d, "media") !== void 0) continue;
|
|
869
|
+
const h = n[a + 1];
|
|
870
|
+
if (!h || h.type !== "rawtext") continue;
|
|
871
|
+
const m = [];
|
|
872
|
+
let p = !1;
|
|
873
|
+
for (const f of mt(h.raw)) {
|
|
874
|
+
if (f.type === "at-rule") {
|
|
875
|
+
m.push(f.raw);
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
const g = [], y = [];
|
|
879
|
+
for (const v of f.selectors) {
|
|
880
|
+
const w = $t(v);
|
|
881
|
+
if (w) {
|
|
882
|
+
g.push(v);
|
|
883
|
+
const $ = f.declarations.filter((j) => !j.important);
|
|
884
|
+
$.length > 0 && s.push({ selector: w, declarations: $, order: i++ });
|
|
885
|
+
} else
|
|
886
|
+
y.push(v);
|
|
887
|
+
}
|
|
888
|
+
if (g.length === 0 || !o) {
|
|
889
|
+
m.push(f.raw);
|
|
890
|
+
continue;
|
|
891
|
+
}
|
|
892
|
+
p = !0, y.length > 0 && m.push(`${y.join(", ")} { ${ie(f.declarations)} }`);
|
|
893
|
+
const b = f.declarations.filter((v) => v.important);
|
|
894
|
+
b.length > 0 && m.push(`${g.join(", ")} { ${ie(b)} }`);
|
|
895
|
+
}
|
|
896
|
+
p && r.set(a + 1, m.join(`
|
|
897
|
+
`));
|
|
898
|
+
}
|
|
899
|
+
if (s.length === 0) return e;
|
|
900
|
+
s.sort((a, d) => kt(a.selector.specificity, d.selector.specificity) || a.order - d.order);
|
|
901
|
+
const c = xt(n), l = c.some((a) => a.token.name === "body");
|
|
902
|
+
for (const a of c) {
|
|
903
|
+
if (l && !Ct(a)) continue;
|
|
904
|
+
const d = /* @__PURE__ */ new Map();
|
|
905
|
+
for (const y of s)
|
|
906
|
+
if (wt(a, y.selector))
|
|
907
|
+
for (const b of y.declarations)
|
|
908
|
+
d.delete(b.property), d.set(b.property, b.value);
|
|
909
|
+
if (d.size === 0) continue;
|
|
910
|
+
const h = (T(a.token, "style") ?? "").trim(), m = new Set(je(h).map((y) => y.property)), p = [];
|
|
911
|
+
for (const [y, b] of d)
|
|
912
|
+
m.has(y) || p.push(`${y}:${b}`);
|
|
913
|
+
if (p.length === 0) continue;
|
|
914
|
+
const f = h.replace(/^;+/, ""), g = f ? `${p.join(";")};${f}` : `${p.join(";")};`;
|
|
915
|
+
ft(a.token, "style", g);
|
|
916
|
+
}
|
|
917
|
+
const u = /* @__PURE__ */ new Set();
|
|
918
|
+
for (const [a, d] of r)
|
|
919
|
+
d.trim() ? n[a] = { type: "rawtext", parent: "style", raw: `
|
|
920
|
+
${d}
|
|
921
|
+
` } : (u.add(a - 1), u.add(a), n[a + 1]?.type === "close" && u.add(a + 1));
|
|
922
|
+
return U(n.filter((a, d) => !u.has(d)));
|
|
923
|
+
}
|
|
924
|
+
const St = /* @__PURE__ */ new Set(["class", "style", "id"]), Tt = /* @__PURE__ */ new Set([
|
|
925
|
+
"contenteditable",
|
|
926
|
+
"spellcheck",
|
|
927
|
+
"data-content-id",
|
|
928
|
+
"data-column-id",
|
|
929
|
+
"data-row-id"
|
|
930
|
+
]);
|
|
931
|
+
function Et(e) {
|
|
932
|
+
const t = B(e);
|
|
933
|
+
for (const o of t) {
|
|
934
|
+
if (o.type !== "open" || o.attrs.length === 0) continue;
|
|
935
|
+
const n = o.attrs.filter((s) => !(Tt.has(s.name) || St.has(s.name) && (s.value === null || !s.value.trim())));
|
|
936
|
+
n.length !== o.attrs.length && (o.attrs = n, o.dirty = !0);
|
|
937
|
+
}
|
|
938
|
+
return U(t);
|
|
939
|
+
}
|
|
940
|
+
const It = /* @__PURE__ */ new Set([
|
|
941
|
+
"html",
|
|
942
|
+
"head",
|
|
943
|
+
"body",
|
|
944
|
+
"meta",
|
|
945
|
+
"title",
|
|
946
|
+
"link",
|
|
947
|
+
"style",
|
|
948
|
+
"script",
|
|
949
|
+
"base",
|
|
950
|
+
"table",
|
|
951
|
+
"thead",
|
|
952
|
+
"tbody",
|
|
953
|
+
"tfoot",
|
|
954
|
+
"tr",
|
|
955
|
+
"td",
|
|
956
|
+
"th",
|
|
957
|
+
"caption",
|
|
958
|
+
"colgroup",
|
|
959
|
+
"col",
|
|
960
|
+
"div",
|
|
961
|
+
"p",
|
|
962
|
+
"h1",
|
|
963
|
+
"h2",
|
|
964
|
+
"h3",
|
|
965
|
+
"h4",
|
|
966
|
+
"h5",
|
|
967
|
+
"h6",
|
|
968
|
+
"ul",
|
|
969
|
+
"ol",
|
|
970
|
+
"li",
|
|
971
|
+
"dl",
|
|
972
|
+
"dt",
|
|
973
|
+
"dd",
|
|
974
|
+
"center",
|
|
975
|
+
"blockquote",
|
|
976
|
+
"hr",
|
|
977
|
+
"br",
|
|
978
|
+
"section",
|
|
979
|
+
"article",
|
|
980
|
+
"header",
|
|
981
|
+
"footer",
|
|
982
|
+
"main",
|
|
983
|
+
"nav",
|
|
984
|
+
"aside",
|
|
985
|
+
"figure",
|
|
986
|
+
"figcaption",
|
|
987
|
+
"form",
|
|
988
|
+
"fieldset",
|
|
989
|
+
"noscript",
|
|
990
|
+
"xml",
|
|
991
|
+
"pre"
|
|
992
|
+
]), jt = /[ \t\n\r\f]+/g, At = /^[ \t\n\r\f]*$/;
|
|
993
|
+
function re(e) {
|
|
994
|
+
return !e || e.type === "comment" || e.type === "doctype" ? !0 : e.type === "open" || e.type === "close" ? It.has(e.name) || e.name.includes(":") : !1;
|
|
995
|
+
}
|
|
996
|
+
function Rt(e) {
|
|
997
|
+
const t = [];
|
|
998
|
+
for (const s of B(e)) {
|
|
999
|
+
if (s.type === "comment" && !pt(s.raw)) continue;
|
|
1000
|
+
const i = t[t.length - 1];
|
|
1001
|
+
if (s.type === "text" && i?.type === "text") {
|
|
1002
|
+
t[t.length - 1] = { type: "text", raw: i.raw + s.raw };
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
t.push(s);
|
|
1006
|
+
}
|
|
1007
|
+
const o = [];
|
|
1008
|
+
let n = 0;
|
|
1009
|
+
for (let s = 0; s < t.length; s++) {
|
|
1010
|
+
const i = t[s];
|
|
1011
|
+
if (i.type === "open" && i.name === "pre" && !i.selfClosing && n++, i.type === "close" && i.name === "pre" && (n = Math.max(0, n - 1)), i.type === "rawtext") {
|
|
1012
|
+
i.parent === "style" ? o.push({ ...i, raw: ht(i.raw) }) : o.push(i);
|
|
1013
|
+
continue;
|
|
1014
|
+
}
|
|
1015
|
+
if (i.type !== "text" || n > 0) {
|
|
1016
|
+
o.push(i);
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
const r = re(t[s - 1]), c = re(t[s + 1]);
|
|
1020
|
+
if (At.test(i.raw)) {
|
|
1021
|
+
if (r || c) continue;
|
|
1022
|
+
o.push({ type: "text", raw: " " });
|
|
1023
|
+
continue;
|
|
1024
|
+
}
|
|
1025
|
+
let l = i.raw.replace(jt, " ");
|
|
1026
|
+
r && (l = l.replace(/^ /, "")), c && (l = l.replace(/ $/, "")), o.push({ type: "text", raw: l });
|
|
1027
|
+
}
|
|
1028
|
+
return U(o).trim();
|
|
1029
|
+
}
|
|
1030
|
+
const le = {
|
|
1031
|
+
amp: "&",
|
|
1032
|
+
lt: "<",
|
|
1033
|
+
gt: ">",
|
|
1034
|
+
quot: '"',
|
|
1035
|
+
apos: "'",
|
|
1036
|
+
nbsp: " ",
|
|
1037
|
+
ensp: " ",
|
|
1038
|
+
emsp: " ",
|
|
1039
|
+
thinsp: " ",
|
|
1040
|
+
zwnj: "",
|
|
1041
|
+
zwj: "",
|
|
1042
|
+
shy: "",
|
|
1043
|
+
lrm: "",
|
|
1044
|
+
rlm: "",
|
|
1045
|
+
copy: "©",
|
|
1046
|
+
reg: "®",
|
|
1047
|
+
trade: "™",
|
|
1048
|
+
hellip: "…",
|
|
1049
|
+
mdash: "—",
|
|
1050
|
+
ndash: "–",
|
|
1051
|
+
minus: "−",
|
|
1052
|
+
lsquo: "‘",
|
|
1053
|
+
rsquo: "’",
|
|
1054
|
+
sbquo: "‚",
|
|
1055
|
+
ldquo: "“",
|
|
1056
|
+
rdquo: "”",
|
|
1057
|
+
bdquo: "„",
|
|
1058
|
+
laquo: "«",
|
|
1059
|
+
raquo: "»",
|
|
1060
|
+
bull: "•",
|
|
1061
|
+
middot: "·",
|
|
1062
|
+
euro: "€",
|
|
1063
|
+
pound: "£",
|
|
1064
|
+
yen: "¥",
|
|
1065
|
+
cent: "¢",
|
|
1066
|
+
sect: "§",
|
|
1067
|
+
para: "¶",
|
|
1068
|
+
deg: "°",
|
|
1069
|
+
times: "×",
|
|
1070
|
+
divide: "÷",
|
|
1071
|
+
plusmn: "±",
|
|
1072
|
+
frac12: "½",
|
|
1073
|
+
frac14: "¼",
|
|
1074
|
+
frac34: "¾",
|
|
1075
|
+
agrave: "à",
|
|
1076
|
+
aacute: "á",
|
|
1077
|
+
egrave: "è",
|
|
1078
|
+
eacute: "é",
|
|
1079
|
+
igrave: "ì",
|
|
1080
|
+
iacute: "í",
|
|
1081
|
+
ograve: "ò",
|
|
1082
|
+
oacute: "ó",
|
|
1083
|
+
ugrave: "ù",
|
|
1084
|
+
uacute: "ú",
|
|
1085
|
+
ccedil: "ç",
|
|
1086
|
+
ntilde: "ñ",
|
|
1087
|
+
auml: "ä",
|
|
1088
|
+
ouml: "ö",
|
|
1089
|
+
uuml: "ü",
|
|
1090
|
+
szlig: "ß",
|
|
1091
|
+
Agrave: "À",
|
|
1092
|
+
Aacute: "Á",
|
|
1093
|
+
Egrave: "È",
|
|
1094
|
+
Eacute: "É",
|
|
1095
|
+
Ccedil: "Ç",
|
|
1096
|
+
Ntilde: "Ñ",
|
|
1097
|
+
Auml: "Ä",
|
|
1098
|
+
Ouml: "Ö",
|
|
1099
|
+
Uuml: "Ü",
|
|
1100
|
+
rarr: "→",
|
|
1101
|
+
larr: "←",
|
|
1102
|
+
uarr: "↑",
|
|
1103
|
+
darr: "↓",
|
|
1104
|
+
hearts: "♥",
|
|
1105
|
+
star: "☆",
|
|
1106
|
+
check: "✓"
|
|
1107
|
+
}, ae = /[͏-]/g;
|
|
1108
|
+
function X(e) {
|
|
1109
|
+
return e.replace(/&(#x[0-9a-f]+|#[0-9]+|[a-z][a-z0-9]*);/gi, (t, o) => {
|
|
1110
|
+
if (o[0] === "#") {
|
|
1111
|
+
const n = o[1] === "x" || o[1] === "X" ? parseInt(o.slice(2), 16) : parseInt(o.slice(1), 10);
|
|
1112
|
+
return !isFinite(n) || n <= 0 || n > 1114111 ? "" : n === 160 ? " " : String.fromCodePoint(n);
|
|
1113
|
+
}
|
|
1114
|
+
return o in le ? le[o] : t;
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
const ce = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]), ue = /* @__PURE__ */ new Set([
|
|
1118
|
+
"div",
|
|
1119
|
+
"table",
|
|
1120
|
+
"tbody",
|
|
1121
|
+
"thead",
|
|
1122
|
+
"tfoot",
|
|
1123
|
+
"tr",
|
|
1124
|
+
"ul",
|
|
1125
|
+
"ol",
|
|
1126
|
+
"center",
|
|
1127
|
+
"section",
|
|
1128
|
+
"article",
|
|
1129
|
+
"header",
|
|
1130
|
+
"footer",
|
|
1131
|
+
"nav",
|
|
1132
|
+
"aside",
|
|
1133
|
+
"main",
|
|
1134
|
+
"form",
|
|
1135
|
+
"dl",
|
|
1136
|
+
"dt",
|
|
1137
|
+
"dd",
|
|
1138
|
+
"figure",
|
|
1139
|
+
"figcaption",
|
|
1140
|
+
"pre",
|
|
1141
|
+
"address"
|
|
1142
|
+
]), de = /* @__PURE__ */ new Set(["p", "blockquote"]), Ot = /* @__PURE__ */ new Set(["head", "style", "script", "title", "noscript", "template", "svg", "select", "textarea", "object", "video", "audio", "map"]);
|
|
1143
|
+
function Mt(e) {
|
|
1144
|
+
if (T(e, "hidden") !== void 0 || T(e, "aria-hidden") === "true" && e.name !== "img") return !0;
|
|
1145
|
+
const t = (T(e, "style") ?? "").toLowerCase().replace(/\s+/g, "");
|
|
1146
|
+
return /(^|;)display:none/.test(t) || /mso-hide:all/.test(t) || /(^|;)max-height:0(px|em|%)?(;|$|!)/.test(t);
|
|
1147
|
+
}
|
|
1148
|
+
function zt(e, t) {
|
|
1149
|
+
const o = (n) => n.trim().toLowerCase().replace(/^(mailto:|tel:|sms:)/, "").replace(/^https?:\/\//, "").replace(/^www\./, "").replace(/\/+$/, "");
|
|
1150
|
+
return o(e) === o(t);
|
|
1151
|
+
}
|
|
1152
|
+
function Dt(e, t = {}) {
|
|
1153
|
+
const o = t.linkStyle ?? "inline", n = [], s = [{ kind: "root", buf: "" }], i = [], r = () => s[s.length - 1], c = () => {
|
|
1154
|
+
const p = r();
|
|
1155
|
+
p.buf = p.buf.replace(/[ \t]+$/, "");
|
|
1156
|
+
}, l = (p) => {
|
|
1157
|
+
let f = X(p.replace(/\s+/g, " ")).replace(ae, "").replace(/[ \t ]+/g, " ");
|
|
1158
|
+
if (!f) return;
|
|
1159
|
+
const g = r();
|
|
1160
|
+
(!g.buf || /[\s]$/.test(g.buf)) && (f = f.replace(/^ /, "")), g.buf += f;
|
|
1161
|
+
}, u = (p) => {
|
|
1162
|
+
c();
|
|
1163
|
+
const f = r();
|
|
1164
|
+
if (!f.buf) return;
|
|
1165
|
+
const g = /\n*$/.exec(f.buf)[0].length;
|
|
1166
|
+
g < p && (f.buf += `
|
|
1167
|
+
`.repeat(p - g));
|
|
1168
|
+
}, a = () => {
|
|
1169
|
+
const p = r();
|
|
1170
|
+
p.buf && !/\s$/.test(p.buf) && (p.buf += " ");
|
|
1171
|
+
};
|
|
1172
|
+
let d = "", h = 0;
|
|
1173
|
+
for (const p of B(e)) {
|
|
1174
|
+
if (h) {
|
|
1175
|
+
p.type === "open" && p.name === d && !p.selfClosing && !Q.has(p.name) ? h++ : p.type === "close" && p.name === d && h--;
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
if (p.type === "text") {
|
|
1179
|
+
l(p.raw);
|
|
1180
|
+
continue;
|
|
1181
|
+
}
|
|
1182
|
+
if (p.type !== "open" && p.type !== "close") continue;
|
|
1183
|
+
const f = p.name;
|
|
1184
|
+
if (p.type === "open") {
|
|
1185
|
+
const g = Q.has(f) || p.selfClosing;
|
|
1186
|
+
if (Ot.has(f) || Mt(p) && f !== "br") {
|
|
1187
|
+
g || (d = f, h = 1);
|
|
1188
|
+
continue;
|
|
1189
|
+
}
|
|
1190
|
+
if (f === "br")
|
|
1191
|
+
c(), r().buf += `
|
|
1192
|
+
`;
|
|
1193
|
+
else if (f === "img") {
|
|
1194
|
+
const y = X(T(p, "alt") ?? "").replace(ae, "").trim();
|
|
1195
|
+
y && (a(), r().buf += `[${y}]`);
|
|
1196
|
+
} else if (f === "hr")
|
|
1197
|
+
u(1), r().buf += "---", u(1);
|
|
1198
|
+
else if (ce.has(f))
|
|
1199
|
+
u(2), s.push({ kind: "heading", buf: "" });
|
|
1200
|
+
else if (f === "a")
|
|
1201
|
+
s.push({ kind: "link", buf: "", href: X(T(p, "href") ?? "").trim() });
|
|
1202
|
+
else if (f === "ul" || f === "ol")
|
|
1203
|
+
u(1), i.push({ ordered: f === "ol", n: 0 });
|
|
1204
|
+
else if (f === "li") {
|
|
1205
|
+
u(1);
|
|
1206
|
+
const y = i[i.length - 1], b = " ".repeat(Math.max(0, i.length - 1));
|
|
1207
|
+
r().buf += y?.ordered ? `${b}${++y.n}. ` : `${b}- `;
|
|
1208
|
+
} else de.has(f) ? u(2) : ue.has(f) ? u(1) : (f === "td" || f === "th") && a();
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
if (ce.has(f) && r().kind === "heading") {
|
|
1212
|
+
const g = s.pop().buf.trim().toUpperCase();
|
|
1213
|
+
u(2), g && (r().buf += g), u(2);
|
|
1214
|
+
} else if (f === "a" && r().kind === "link") {
|
|
1215
|
+
const g = s.pop(), y = g.buf.replace(/\s+/g, " ").trim(), b = g.href ?? "", v = b && !b.startsWith("#") && !/^javascript:/i.test(b);
|
|
1216
|
+
let w = y;
|
|
1217
|
+
if (v && !zt(b, y))
|
|
1218
|
+
if (!y) w = b;
|
|
1219
|
+
else if (o === "footnote") {
|
|
1220
|
+
let $ = n.indexOf(b);
|
|
1221
|
+
$ === -1 && ($ = n.push(b) - 1), w = `${y} [${$ + 1}]`;
|
|
1222
|
+
} else w = `${y} (${b})`;
|
|
1223
|
+
w && (a(), r().buf += w);
|
|
1224
|
+
} else f === "ul" || f === "ol" ? (i.pop(), u(1)) : f === "table" ? u(2) : f === "li" || ue.has(f) ? u(1) : de.has(f) ? u(2) : (f === "td" || f === "th") && a();
|
|
1225
|
+
}
|
|
1226
|
+
for (; s.length > 1; ) {
|
|
1227
|
+
const p = s.pop();
|
|
1228
|
+
r().buf += p.kind === "heading" ? p.buf.toUpperCase() : p.buf;
|
|
1229
|
+
}
|
|
1230
|
+
let m = r().buf.split(`
|
|
1231
|
+
`).map((p) => p.replace(/[ \t]+/g, " ").trim()).join(`
|
|
1232
|
+
`).replace(/\n{4,}/g, `
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
`).trim();
|
|
1236
|
+
return t.wordwrap && (m = Bt(m, t.wordwrap)), n.length && (m += `
|
|
1237
|
+
|
|
1238
|
+
${n.map((p, f) => `[${f + 1}] ${p}`).join(`
|
|
1239
|
+
`)}`), m;
|
|
1240
|
+
}
|
|
1241
|
+
function Bt(e, t) {
|
|
1242
|
+
return t > 0 ? e.split(`
|
|
1243
|
+
`).map((o) => {
|
|
1244
|
+
if (o.length <= t) return o;
|
|
1245
|
+
const n = /^(\s*(?:- |\d+\. ))?/.exec(o)[0].replace(/./g, " "), s = [];
|
|
1246
|
+
let i = "";
|
|
1247
|
+
for (const r of o.split(" "))
|
|
1248
|
+
i ? i.length + 1 + r.length <= t ? i += ` ${r}` : (s.push(i), i = n + r) : i = r;
|
|
1249
|
+
return i && s.push(i), s.join(`
|
|
1250
|
+
`);
|
|
1251
|
+
}).join(`
|
|
1252
|
+
`) : e;
|
|
1253
|
+
}
|
|
1254
|
+
class Ae {
|
|
1255
|
+
constructor() {
|
|
1256
|
+
this.rows = /* @__PURE__ */ new WeakMap(), this.stats = { hits: 0, misses: 0 };
|
|
1257
|
+
}
|
|
1258
|
+
clear() {
|
|
1259
|
+
this.rows = /* @__PURE__ */ new WeakMap(), this.stats = { hits: 0, misses: 0 };
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
function Jt() {
|
|
1263
|
+
return new Ae();
|
|
1264
|
+
}
|
|
1265
|
+
const fe = /* @__PURE__ */ new WeakMap();
|
|
1266
|
+
let Wt = 1;
|
|
1267
|
+
function Nt(e) {
|
|
1268
|
+
let t = fe.get(e);
|
|
1269
|
+
return t === void 0 && (t = Wt++, fe.set(e, t)), t;
|
|
1270
|
+
}
|
|
1271
|
+
const Pt = /* @__PURE__ */ new Set(["preheaderText"]);
|
|
1272
|
+
function Lt(e, t, o) {
|
|
1273
|
+
const n = {};
|
|
1274
|
+
for (const s of Object.keys(e ?? {})) Pt.has(s) || (n[s] = e[s]);
|
|
1275
|
+
return `${t}|${Nt(o)}|${JSON.stringify(n)}`;
|
|
1276
|
+
}
|
|
1277
|
+
function pe(e, t, o, n) {
|
|
1278
|
+
const s = n ? Ye(e, t, o) : Ue(e, t, o, "email"), i = Ut(s), r = /* @__PURE__ */ new Set();
|
|
1279
|
+
for (const c of e.columns ?? []) for (const l of c.contents ?? []) z(l.values, r);
|
|
1280
|
+
return {
|
|
1281
|
+
// Web pages keep modern CSS (flex, grid, …); email strips what clients don't support
|
|
1282
|
+
html: n ? i.html : at(i.html),
|
|
1283
|
+
styles: i.styles,
|
|
1284
|
+
fonts: [...r],
|
|
1285
|
+
overrides: $e(e)
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
function qt(e, t, o, n) {
|
|
1289
|
+
const s = e.body.values, i = parseInt(s.contentWidth || "600") || 600, r = o?.displayMode === "web", c = n?.cache ?? o?.cache, l = c instanceof Ae, u = l ? Lt(s, r ? "web" : "email", t) : "", a = [
|
|
1290
|
+
...e.body.headers ?? [],
|
|
1291
|
+
...e.body.rows ?? [],
|
|
1292
|
+
...e.body.footers ?? []
|
|
1293
|
+
], d = [], h = [], m = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set();
|
|
1294
|
+
z({ fontFamily: s?.fontFamily }, p);
|
|
1295
|
+
const f = [];
|
|
1296
|
+
for (const _ of a) {
|
|
1297
|
+
let k;
|
|
1298
|
+
if (l) {
|
|
1299
|
+
const x = c.rows.get(_);
|
|
1300
|
+
x && x.key === u ? (k = x.parts, c.stats.hits++) : (k = pe(_, s, t, r), c.rows.set(_, { key: u, parts: k }), c.stats.misses++);
|
|
1301
|
+
} else
|
|
1302
|
+
k = pe(_, s, t, r);
|
|
1303
|
+
d.push(k.html);
|
|
1304
|
+
for (const x of k.styles)
|
|
1305
|
+
m.has(x) || (m.add(x), h.push(x));
|
|
1306
|
+
for (const x of k.fonts) p.add(x);
|
|
1307
|
+
for (const x of k.overrides) f.push(x);
|
|
1308
|
+
}
|
|
1309
|
+
const g = d.join(`
|
|
1310
|
+
`), y = [...p], b = ve(f, i), v = Te(e), w = [...h, ...b ? [b] : [], ...v ? [v] : []];
|
|
1311
|
+
let $ = r ? et(g, s, { fontUrls: y, styles: w, title: o?.title }) : Be(g, We(i), s, {
|
|
1312
|
+
fontUrls: y,
|
|
1313
|
+
styles: w,
|
|
1314
|
+
title: o?.title
|
|
1315
|
+
});
|
|
1316
|
+
if (o?.mergeTags)
|
|
1317
|
+
for (const [_, k] of Object.entries(o.mergeTags))
|
|
1318
|
+
$ = $.replaceAll(`{{${_}}}`, k);
|
|
1319
|
+
o?.designTags && ($ = Ht($, o.designTags, o.designTagsDelimiter)), o?.inlineStyles && ($ = _t($)), o?.cleanup && ($ = Et($)), o?.minify && ($ = Rt($));
|
|
1320
|
+
const j = Zt($), O = {
|
|
1321
|
+
html: $,
|
|
183
1322
|
chunks: {
|
|
184
|
-
body:
|
|
185
|
-
css:
|
|
186
|
-
|
|
187
|
-
fonts: r,
|
|
1323
|
+
body: j.body,
|
|
1324
|
+
css: j.css,
|
|
1325
|
+
fonts: y,
|
|
188
1326
|
js: ""
|
|
189
1327
|
}
|
|
190
1328
|
};
|
|
1329
|
+
if (l) {
|
|
1330
|
+
let _;
|
|
1331
|
+
Object.defineProperty(O, "design", {
|
|
1332
|
+
enumerable: !0,
|
|
1333
|
+
configurable: !0,
|
|
1334
|
+
get: () => _ ??= structuredClone(e),
|
|
1335
|
+
set: (k) => {
|
|
1336
|
+
_ = k;
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
} else
|
|
1340
|
+
O.design = structuredClone(e);
|
|
1341
|
+
return O;
|
|
1342
|
+
}
|
|
1343
|
+
function Qt(e, t, o, n) {
|
|
1344
|
+
const { html: s } = qt(
|
|
1345
|
+
e,
|
|
1346
|
+
t,
|
|
1347
|
+
{ ...o, inlineStyles: !1, minify: !1, cleanup: !1 },
|
|
1348
|
+
n
|
|
1349
|
+
);
|
|
1350
|
+
return Dt(s, { wordwrap: o?.wordwrap, linkStyle: o?.linkStyle });
|
|
1351
|
+
}
|
|
1352
|
+
function Ht(e, t, o = ["{{", "}}"]) {
|
|
1353
|
+
const [n, s] = o;
|
|
1354
|
+
let i = e;
|
|
1355
|
+
for (const [r, c] of Object.entries(t))
|
|
1356
|
+
i = i.replaceAll(`${n}${r}${s}`, String(c));
|
|
1357
|
+
return i;
|
|
1358
|
+
}
|
|
1359
|
+
function Ft(e) {
|
|
1360
|
+
return e === "fontFamily" || e.endsWith("FontFamily");
|
|
1361
|
+
}
|
|
1362
|
+
function z(e, t, o = 0) {
|
|
1363
|
+
if (!(!e || typeof e != "object" || o > 4)) {
|
|
1364
|
+
for (const [n, s] of Object.entries(e))
|
|
1365
|
+
if (!(!s || typeof s != "object"))
|
|
1366
|
+
if (Ft(n)) {
|
|
1367
|
+
const i = s.url;
|
|
1368
|
+
typeof i == "string" && i.trim() && t.add(i.trim());
|
|
1369
|
+
} else
|
|
1370
|
+
z(s, t, o + 1);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function Vt(e) {
|
|
1374
|
+
const t = /* @__PURE__ */ new Set();
|
|
1375
|
+
z({ fontFamily: e.body.values?.fontFamily }, t);
|
|
1376
|
+
const o = ee(e);
|
|
1377
|
+
for (const n of o)
|
|
1378
|
+
for (const s of n.columns ?? [])
|
|
1379
|
+
for (const i of s.contents ?? [])
|
|
1380
|
+
z(i.values, t);
|
|
1381
|
+
return [...t];
|
|
1382
|
+
}
|
|
1383
|
+
function Ut(e) {
|
|
1384
|
+
const t = B(e), o = [], n = /* @__PURE__ */ new Set(), s = [];
|
|
1385
|
+
for (let i = 0; i < t.length; i++) {
|
|
1386
|
+
const r = t[i];
|
|
1387
|
+
if (r.type === "open" && r.name === "style" && !r.selfClosing) {
|
|
1388
|
+
let c = i + 1, l = "";
|
|
1389
|
+
t[c]?.type === "rawtext" && (l = t[c].raw.trim(), c++);
|
|
1390
|
+
const u = r.attrs.find((a) => a.name === "media")?.value?.trim();
|
|
1391
|
+
if (l && u && u !== "all" && (l = `@media ${u} {
|
|
1392
|
+
${l}
|
|
1393
|
+
}`), t[c]?.type === "close" && t[c].name === "style") {
|
|
1394
|
+
l && !n.has(l) && (n.add(l), o.push(l)), i = c;
|
|
1395
|
+
continue;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
s.push(r);
|
|
1399
|
+
}
|
|
1400
|
+
return { html: o.length || s.length !== t.length ? U(s) : e, styles: o };
|
|
1401
|
+
}
|
|
1402
|
+
function Zt(e) {
|
|
1403
|
+
const t = e.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
|
1404
|
+
return {
|
|
1405
|
+
body: t ? t[1].trim() : e,
|
|
1406
|
+
css: Kt(e)
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
function Kt(e) {
|
|
1410
|
+
const t = /<!--[\s\S]*?-->|<(script|textarea)\b[^>]*>[\s\S]*?<\/\1\s*>|<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi, o = [];
|
|
1411
|
+
let n;
|
|
1412
|
+
for (; n = t.exec(e); ) {
|
|
1413
|
+
if (n[2] === void 0) continue;
|
|
1414
|
+
const s = n[2].trim();
|
|
1415
|
+
s && o.push(s);
|
|
1416
|
+
}
|
|
1417
|
+
return o.join(`
|
|
1418
|
+
`);
|
|
191
1419
|
}
|
|
192
|
-
function
|
|
193
|
-
const
|
|
194
|
-
e.includes("<!DOCTYPE") ||
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
for (const
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
for (const
|
|
204
|
-
e.includes('style="') && e.match(new RegExp(`style="[^"]*${
|
|
205
|
-
e.includes("<!--[if") ||
|
|
206
|
-
const a = (e.match(/<a[^>]*>/gi) || []).filter((
|
|
207
|
-
a.length > 0 &&
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
const
|
|
1420
|
+
function en(e) {
|
|
1421
|
+
const t = [], o = [];
|
|
1422
|
+
e.includes("<!DOCTYPE") || t.push({ rule: "doctype", message: "Missing <!DOCTYPE> declaration. Required for consistent rendering.", severity: "error" }), (!e.includes("<meta") || !e.includes("charset")) && t.push({ rule: "charset", message: 'Missing charset meta tag. Add <meta charset="UTF-8">.', severity: "error" }), e.includes("viewport") || o.push({ rule: "viewport", message: "Missing viewport meta tag. Needed for responsive rendering on mobile.", severity: "warning" });
|
|
1423
|
+
const n = (e.match(/<table/gi) || []).length, s = (e.match(/role="presentation"/gi) || []).length;
|
|
1424
|
+
n > 0 && s < n * 0.5 && o.push({ rule: "table-role", message: `Only ${s}/${n} tables have role="presentation". Screen readers may interpret layout tables as data tables.`, severity: "warning" });
|
|
1425
|
+
const i = e.match(/<img[^>]*>/gi) || [];
|
|
1426
|
+
for (const g of i)
|
|
1427
|
+
g.includes("alt=") || t.push({ rule: "img-alt", message: "Image missing alt attribute. Required for accessibility and when images are blocked.", severity: "error" }), (!g.includes("style=") || !g.includes("display")) && o.push({ rule: "img-display", message: "Image without display:block may have a bottom gap in some email clients.", severity: "warning" }), (g.includes('width="100%"') || !g.includes("width=") && !g.includes("width:")) && o.push({ rule: "img-width", message: "Image without explicit pixel width. Some email clients ignore percentage widths.", severity: "warning" });
|
|
1428
|
+
const r = e.match(/<style[^>]*>[\s\S]*?<\/style>/gi) || [], c = e.includes('style="');
|
|
1429
|
+
r.length > 0 && !e.includes("@media") && o.push({ rule: "no-media-queries", message: "Style block found but no @media queries. Consider adding responsive breakpoints.", severity: "warning" }), !c && n > 0 && t.push({ rule: "inline-styles", message: "No inline styles detected. Gmail and many clients strip <style> tags — inline styles are essential.", severity: "error" });
|
|
1430
|
+
const l = ["position:fixed", "position:absolute", "display:flex", "display:grid", "gap:", "transform:", "animation:"];
|
|
1431
|
+
for (const g of l)
|
|
1432
|
+
e.includes('style="') && e.match(new RegExp(`style="[^"]*${g.replace(":", ":\\s*")}`, "i")) && o.push({ rule: "unsupported-css", message: `CSS property "${g.replace(":", "")}" not supported in most email clients.`, severity: "warning" });
|
|
1433
|
+
e.includes("<!--[if") || o.push({ rule: "mso-conditionals", message: "No MSO conditional comments found. Outlook may not render multi-column layouts correctly.", severity: "warning" }), !e.includes("xmlns:v") && !e.includes("xmlns:o") && o.push({ rule: "mso-namespace", message: "Missing Microsoft Office XML namespaces. May affect Outlook rendering.", severity: "warning" });
|
|
1434
|
+
const a = (e.match(/<a[^>]*>/gi) || []).filter((g) => !g.includes("style="));
|
|
1435
|
+
a.length > 0 && o.push({ rule: "link-color", message: `${a.length} link(s) without inline styles. Email clients override unstyled link colors.`, severity: "warning" }), !e.includes("color-scheme") && !e.includes("prefers-color-scheme") && o.push({ rule: "dark-mode", message: "No dark mode support detected. Consider adding color-scheme meta and prefers-color-scheme media query.", severity: "warning" });
|
|
1436
|
+
const d = Math.round(e.length / 1024);
|
|
1437
|
+
d > 102 ? t.push({ rule: "size-limit", message: `Email HTML is ${d}KB. Gmail clips emails larger than 102KB.`, severity: "error" }) : d > 80 && o.push({ rule: "size-warning", message: `Email HTML is ${d}KB. Getting close to Gmail's 102KB clip limit.`, severity: "warning" }), !e.includes("display:none") && !e.includes("max-height:0") && o.push({ rule: "preheader", message: "No preheader text detected. Preheader text improves open rates in inbox previews.", severity: "warning" });
|
|
1438
|
+
const h = 100, m = t.length * 15, p = o.length * 5, f = Math.max(0, h - m - p);
|
|
211
1439
|
return {
|
|
212
|
-
valid:
|
|
213
|
-
errors:
|
|
214
|
-
warnings:
|
|
215
|
-
score:
|
|
1440
|
+
valid: t.length === 0,
|
|
1441
|
+
errors: t,
|
|
1442
|
+
warnings: o,
|
|
1443
|
+
score: f
|
|
216
1444
|
};
|
|
217
1445
|
}
|
|
218
1446
|
export {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
1447
|
+
ee as allRows,
|
|
1448
|
+
he as bodyFontWeight,
|
|
1449
|
+
Te as buildDarkModeCss,
|
|
1450
|
+
Yt as buildResponsiveOverridesCss,
|
|
1451
|
+
A as cleanCssValue,
|
|
1452
|
+
Et as cleanupHtml,
|
|
1453
|
+
Vt as collectFontUrls,
|
|
1454
|
+
oe as contentElementId,
|
|
1455
|
+
Jt as createRenderCache,
|
|
1456
|
+
X as decodeEntities,
|
|
1457
|
+
ge as documentLanguage,
|
|
1458
|
+
me as documentTitle,
|
|
1459
|
+
_e as getDarkOverrides,
|
|
1460
|
+
D as getMobileOverrides,
|
|
1461
|
+
We as getResponsiveCss,
|
|
1462
|
+
Qe as getWebCss,
|
|
1463
|
+
Xt as hasDarkMode,
|
|
1464
|
+
_t as inlineCss,
|
|
1465
|
+
Oe as isLanguageCode,
|
|
1466
|
+
K as isSafeCssValue,
|
|
1467
|
+
N as kebabKey,
|
|
1468
|
+
ht as minifyCss,
|
|
1469
|
+
Rt as minifyHtml,
|
|
1470
|
+
ne as mobileMediaQuery,
|
|
1471
|
+
Ne as overrideClass,
|
|
1472
|
+
F as overrideDeclarations,
|
|
1473
|
+
qt as renderDesignToHtml,
|
|
1474
|
+
Qt as renderDesignToPlainText,
|
|
1475
|
+
Dt as renderPlainText,
|
|
1476
|
+
Ue as renderRow,
|
|
1477
|
+
Ye as renderWebRow,
|
|
1478
|
+
Ht as replaceDesignTags,
|
|
1479
|
+
H as rowElementId,
|
|
1480
|
+
Je as stripMsoConditionals,
|
|
1481
|
+
en as validateEmailHtml,
|
|
1482
|
+
Be as wrapInDocumentShell,
|
|
1483
|
+
et as wrapInWebShell,
|
|
1484
|
+
Bt as wrapText,
|
|
1485
|
+
te as wrapWithDisplayCondition
|
|
224
1486
|
};
|
|
225
1487
|
//# sourceMappingURL=index.js.map
|