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