@charisol/plexo-sdk 1.4.1 → 1.4.2

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.
@@ -1,4 +1,4 @@
1
- import { i as e, o as t } from "./sanitizeCompiledHtml-C_sPjL3B.js";
1
+ import { a as e, s as t } from "./sanitizeCompiledHtml-BU82w6E-.js";
2
2
  //#endregion
3
3
  //#region src/utilities/mjmlBrowser.ts
4
4
  var n = /* @__PURE__ */ t((/* @__PURE__ */ e(((e, t) => {
package/dist/sanitize.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, r as t, t as n } from "./sanitizeCompiledHtml-C_sPjL3B.js";
1
+ import { n as e, r as t, t as n } from "./sanitizeCompiledHtml-BU82w6E-.js";
2
2
  export { n as ALLOWED_ATTR, e as ALLOWED_TAGS, t as sanitizeCompiledHtml };
@@ -4595,7 +4595,7 @@ var bn, xn = o((() => {
4595
4595
  }) : [];
4596
4596
  }, t;
4597
4597
  }, t.exports.naughtyHref = i;
4598
- })), nr = /* @__PURE__ */ u((/* @__PURE__ */ s(((e, t) => {
4598
+ })), nr = /* @__PURE__ */ s(((e, t) => {
4599
4599
  var n = (xn(), d(gn)), r = Sn(), { isPlainObject: i } = Cn(), a = wn(), o = Tn(), { parse: s } = $n(), { naughtyHref: c } = tr(), l = [
4600
4600
  "img",
4601
4601
  "audio",
@@ -5020,8 +5020,8 @@ var bn, xn = o((() => {
5020
5020
  };
5021
5021
  };
5022
5022
  };
5023
- })))(), 1);
5024
- function rr(e) {
5023
+ })), rr = /* @__PURE__ */ u(nr(), 1);
5024
+ function ir(e) {
5025
5025
  let t = e.split(";"), n = [], r = /* @__PURE__ */ new Set([
5026
5026
  "position",
5027
5027
  "z-index",
@@ -5043,15 +5043,15 @@ function rr(e) {
5043
5043
  }
5044
5044
  return n.join("; ");
5045
5045
  }
5046
- var ir = /* @__PURE__ */ "html.head.body.title.meta.style.div.span.p.h1.h2.h3.h4.h5.h6.a.img.button.svg.path.table.thead.tbody.tr.th.td.hr.br.ul.ol.li.section.article.main.header.footer.aside".split("."), ar = /* @__PURE__ */ "href.src.alt.class.id.style.title.target.rel.width.height.align.valign.cellpadding.cellspacing.border.viewbox.fill.stroke.d.xmlns.charset.name.content.lang.data-*".split("."), or = [
5046
+ var ar = /* @__PURE__ */ "html.head.body.title.meta.style.div.span.p.h1.h2.h3.h4.h5.h6.a.img.button.svg.path.table.thead.tbody.tr.th.td.hr.br.ul.ol.li.section.article.main.header.footer.aside".split("."), or = /* @__PURE__ */ "href.src.alt.class.id.style.title.target.rel.width.height.align.valign.cellpadding.cellspacing.border.viewbox.fill.stroke.d.xmlns.charset.name.content.lang.data-*".split("."), sr = [
5047
5047
  "javascript:",
5048
5048
  "vbscript:",
5049
5049
  "data:"
5050
5050
  ];
5051
- function sr(e) {
5052
- let t = /^\s*<!doctype\s+html\s*>/i.test(e), n = (0, nr.default)(e, {
5053
- allowedTags: ir,
5054
- allowedAttributes: { "*": ar },
5051
+ function cr(e) {
5052
+ let t = /^\s*<!doctype\s+html\s*>/i.test(e), n = (0, rr.default)(e, {
5053
+ allowedTags: ar,
5054
+ allowedAttributes: { "*": or },
5055
5055
  allowVulnerableTags: !0,
5056
5056
  transformTags: { "*": (e, t) => {
5057
5057
  let n = { ...t };
@@ -5060,11 +5060,11 @@ function sr(e) {
5060
5060
  let t = n[e];
5061
5061
  if (typeof t == "string") {
5062
5062
  let r = t.trim().toLowerCase();
5063
- or.some((e) => r.startsWith(e)) && delete n[e];
5063
+ sr.some((e) => r.startsWith(e)) && delete n[e];
5064
5064
  }
5065
5065
  }
5066
5066
  if (typeof n.style == "string") {
5067
- let e = rr(n.style);
5067
+ let e = ir(n.style);
5068
5068
  e ? n.style = e : delete n.style;
5069
5069
  }
5070
5070
  return {
@@ -5076,4 +5076,4 @@ function sr(e) {
5076
5076
  return t ? `<!DOCTYPE html>\n${n}` : n;
5077
5077
  }
5078
5078
  //#endregion
5079
- export { c as a, s as i, ir as n, u as o, sr as r, ar as t };
5079
+ export { s as a, nr as i, ar as n, c as o, cr as r, u as s, or as t };
@@ -0,0 +1 @@
1
+ export declare function sanitizePastedHtml(html: string): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@charisol/plexo-sdk",
3
3
  "private": false,
4
- "version": "1.4.1",
4
+ "version": "1.4.2",
5
5
  "description": "Plexo visual email and landing page builder SDK — drag-and-drop template editor with AI integration.",
6
6
  "keywords": [
7
7
  "email-builder",
@@ -1,216 +0,0 @@
1
- import { d as e, f as t, g as n, h as r, m as i, o as a, p as o, t as s, u as c, x as l, y as u } from "./iconSvgStatic-CGue7nyp.js";
2
- //#region src/utilities/instrumentation.ts
3
- var d = "plexo-node", f = "plexo-row", p = "plexo-col";
4
- function m(e) {
5
- return `plexo-node-${e}`;
6
- }
7
- //#endregion
8
- //#region src/utilities/compilerClient.ts
9
- var h = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-icons", g = /* @__PURE__ */ new Set([
10
- "selectable",
11
- "draggable",
12
- "duplicatable",
13
- "deletable",
14
- "hideable",
15
- "locked"
16
- ]), _ = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), v = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), y = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), b = (e, t, n, r) => n ? y(e, d, m(t), r) : e, x = (e, t, n) => {
17
- let r = b("", e, t, n);
18
- return r ? ` css-class="${_(r)}"` : "";
19
- }, S = (e, t, n) => {
20
- let r = b("", e, t, n);
21
- return r ? ` class="${_(r)}"` : "";
22
- }, C = (e, t) => {
23
- let n = { ...e.attributes || {} };
24
- if (t === "email") for (let e of g) delete n[e];
25
- return n;
26
- }, w = (e, t, n) => {
27
- let r = C(e, t), i = v(e.style || {}), a = b(y(r.htmlClassNames, r.htmlClass, r.validationClass, r.validationClassName), e.id, t === "landing_page" && n), o = _(r.name || r.fieldName || "field"), s = _(r.placeholder || ""), c = r.required ? " required" : "";
28
- if (t === "email") return `<mj-table${x(e.id, n)}><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${i}">${s || o}</td></tr></mj-table>`;
29
- let l = _(r.inputType || r.type || (e.type === "input" ? r.kind || "text" : e.type)), u = r.htmlId ? ` id="${_(r.htmlId)}"` : "", d = a ? ` class="${_(a)}"` : "";
30
- return e.type === "textarea" ? `<textarea${u}${d} name="${o}" placeholder="${s}" style="${i}"${c}>${_(r.value || "")}</textarea>` : e.type === "select" ? `<select${u}${d} name="${o}" style="${i}"${c}>${(r.options || []).map((e) => `<option value="${_(e.value)}">${_(e.label)}</option>`).join("")}</select>` : `<input${u}${d} type="${l}" name="${o}" placeholder="${s}" value="${_(r.value || "")}" style="${i}"${c} />`;
31
- }, T = (e, t, n) => {
32
- let r = C(e, t), i = v(e.style || {}), a = b(y(r.htmlClassNames, r.htmlClass), e.id, t === "landing_page" && n), o = r.htmlId ? ` id="${_(r.htmlId)}"` : "", s = a ? ` class="${_(a)}"` : "", c = _(r.actionUrl || r.action || "#"), l = _(r.method || "POST"), u = r.fields || [], d = _(r.submitLabel || "Submit");
33
- return t === "email" ? `<mj-table${x(e.id, n)}><tr><td style="${i}"><table role="presentation" width="100%">${u.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${_(e.label || e.name || "Field")}</strong><br/><span style="display:inline-block;margin-top:4px;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;">${_(e.placeholder || "") || "&nbsp;"}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${_(r.href || r.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${d}</a></td></tr></table></td></tr></mj-table>` : `<form${o}${s} action="${c}" method="${l}" style="${i}">${u.map((t) => w({
34
- id: `${e.id}-${String(t.name || t.label || "field")}`,
35
- type: t.kind === "textarea" || t.kind === "select" ? t.kind : "input",
36
- style: {
37
- ...e.style || {},
38
- ...t.style || {}
39
- },
40
- attributes: t
41
- }, "landing_page", n)).join("")}<button type="submit">${d}</button></form>`;
42
- }, E = [], D = !1, O = 148, k = [
43
- ["borderRadius", "border-radius"],
44
- ["borderWidth", "border-width"],
45
- ["borderStyle", "border-style"],
46
- ["borderColor", "border-color"],
47
- ["boxShadow", "box-shadow"]
48
- ], A = (e, t, n = []) => {
49
- let r = [...k.filter(([t]) => e[t]).map(([t, n]) => `${n}: ${_(String(e[t]))}`), ...n];
50
- if (r.length === 0) return "";
51
- let i = `plexo-extra-style-${t}`;
52
- return E.push(`.${i} { ${r.join("; ")}; }`), i;
53
- }, j = (e = {}, t = {}) => {
54
- let n = ["padding=\"0\""], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
55
- return r && n.push(`font-size="${_(String(r))}"`), i && n.push(`font-weight="${_(String(i))}"`), e.color && n.push(`color="${_(String(e.color))}"`), e.fontFamily && n.push(`font-family="${_(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${_(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${_(String(e.letterSpacing))}"`), n.join(" ");
56
- }, M = (e = {}) => {
57
- let t = e.backgroundColor || e.background;
58
- return t ? ` background-color="${_(String(t))}"` : "";
59
- }, N = (e, t, n) => {
60
- if (e[t]) return String(e[t]);
61
- let [r, i, a, o] = n;
62
- if (e[r] || e[i] || e[a] || e[o]) return `${e[r] || "0px"} ${e[i] || "0px"} ${e[a] || "0px"} ${e[o] || "0px"}`;
63
- }, P = (e = {}) => {
64
- let t = [];
65
- e.backgroundColor && t.push(`background-color="${_(String(e.backgroundColor))}"`), e.color && t.push(`color="${_(String(e.color))}"`), e.fontSize && t.push(`font-size="${_(String(e.fontSize))}"`), e.fontWeight && t.push(`font-weight="${_(String(e.fontWeight))}"`), e.fontFamily && t.push(`font-family="${_(String(e.fontFamily))}"`), e.lineHeight && t.push(`line-height="${_(String(e.lineHeight))}"`), e.letterSpacing && t.push(`letter-spacing="${_(String(e.letterSpacing))}"`), e.textAlign && t.push(`align="${_(String(e.textAlign))}"`);
66
- let n = N(e, "borderRadius", [
67
- "borderTopLeftRadius",
68
- "borderTopRightRadius",
69
- "borderBottomRightRadius",
70
- "borderBottomLeftRadius"
71
- ]);
72
- return n && t.push(`border-radius="${_(n)}"`), t.join(" ");
73
- }, F = (l, d, f) => {
74
- let p = C(l, d), m = v(l.style || {}), g = p.htmlId ? ` id="${_(p.htmlId)}"` : "", D = y(p.htmlClassNames, p.htmlClass, d === "landing_page" && p.hideOnMobile ? "hidden md:block" : ""), O = d === "landing_page" ? b(D, l.id, f) : D, k = O ? ` class="${_(O)}"` : "", A = typeof p.customCss == "string" && p.customCss.trim() ? p.customCss.trim() : "", M = A && d === "landing_page" ? `<style>${A}</style>` : "";
75
- if (l.type === "form_container") return `${M}${T(l, d, f)}`;
76
- if (l.type === "input" || l.type === "select" || l.type === "textarea") return `${M}${w(l, d, f)}`;
77
- if (d === "email") {
78
- if (l.type === "button") {
79
- let e = _(p.href || "#"), t = _(p.text || "Button"), n = a(l).width, r = n === "auto" ? "" : ` width="${_(n)}"`, i = l.style || {}, o = P(i), s = N(i, "padding", [
80
- "paddingTop",
81
- "paddingRight",
82
- "paddingBottom",
83
- "paddingLeft"
84
- ]) || "10px 16px";
85
- return `<mj-button href="${e}" css-class="${b(p.hideOnDesktop ? "desktop-hide" : "", l.id, f)}" padding="0" inner-padding="${_(s)}"${r}${o ? ` ${o}` : ""}>${t}</mj-button>`;
86
- }
87
- if (l.type === "image") {
88
- let e = c(l), t = e.width && e.width !== "100%" ? ` width="${_(e.width)}"` : "", n = e.height && e.height !== "auto" ? ` height="${_(e.height)}"` : "", r = x(l.id, f);
89
- return `<mj-image src="${_(p.src || "")}" alt="${_(p.alt || "")}"${t}${n}${r} />`;
90
- }
91
- if (l.type === "social") {
92
- let e = t(l);
93
- if (!e.length) return "";
94
- let n = l.style || {}, r = n.textAlign === "center" ? "center" : n.textAlign === "right" ? "flex-end" : "flex-start", i = n.iconSpacing || "8px", a = N(n, "padding", [
95
- "paddingTop",
96
- "paddingRight",
97
- "paddingBottom",
98
- "paddingLeft"
99
- ]) || "8px", o = N(n, "margin", [
100
- "marginTop",
101
- "marginRight",
102
- "marginBottom",
103
- "marginLeft"
104
- ]), s = (e) => e === "square" ? "14px" : "9999px", c = e.map((e) => {
105
- let t = `<img src="${`${h}/${u[e.provider] ? e.provider : "fallback"}.png`}" alt="" width="${parseInt(e.size, 10) || 36}" style="display:block;width:60%;height:60%;border:0;" />`;
106
- return `<a href="${_(e.url)}" style="display:inline-flex;align-items:center;justify-content:center;width:${_(e.size)};height:${_(e.size)};background-color:${_(e.backgroundColor)};border-radius:${s(e.iconType)};text-decoration:none;">${t}</a>`;
107
- }).join(""), d = `display:flex;flex-wrap:wrap;justify-content:${r};gap:${_(String(i))};padding:${_(a)};${o ? `margin:${_(o)};` : ""}`;
108
- return `<mj-raw><div${S(l.id, f)} style="${d}">${c}</div></mj-raw>`;
109
- }
110
- if (l.type === "menu") {
111
- let t = e(l);
112
- return `<mj-navbar hamburger="hamburger"${x(l.id, f)}>${t.map((e) => `<mj-navbar-link href="${_(e.href)}">${_(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
113
- }
114
- if (l.type === "table") {
115
- let e = o(l), t = l.style || {}, n = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, r = (r, i, a, o) => {
116
- let s = o ? "th" : "td", c = o ? t.headerBgColor || "#f8fafc" : e.striped && i % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", u = o ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
117
- return `<tr>${r.map((e, r) => {
118
- let i = f ? ` data-plexo-cell="${_(l.id)}|${a}-${r}"` : "";
119
- return `<${s}${i} style="padding: ${t.cellPadding || "8px"}; border: ${n}; background-color: ${c}; color: ${u};">${_(e) || "&nbsp;"}</${s}>`;
120
- }).join("")}</tr>`;
121
- }, i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length, s = e.enableHeader && e.cells.length > 0 ? `<thead>${r(e.cells[0], 0, 0, !0)}</thead>` : "", c = e.cells.slice(i, Math.max(i, a)).map((e, t) => r(e, t, i + t, !1)).join(""), u = e.enableFooter && e.cells.length > i ? `<tfoot>${r(e.cells[e.cells.length - 1], e.cells.length - 1, e.cells.length - 1, !1)}</tfoot>` : "";
122
- return `<mj-table${x(l.id, f)}><table role="presentation" style="border-collapse: collapse; width: 100%;">${s}<tbody>${c}</tbody>${u}</table></mj-table>`;
123
- }
124
- if (l.type === "video") {
125
- let e = n(p.videoUrl), t = p.linkType === "email" ? `mailto:${p.href || ""}` : p.href || p.videoUrl || "#", r = x(l.id, f);
126
- return `<mj-image src="${_(e.thumbnailUrl)}" href="${_(t)}" alt="${_(p.alt || "Video preview")}"${r} />`;
127
- }
128
- if (l.type === "timer") {
129
- let e = r(p.targetDate, p.timezone), t = p.showLabels !== !1;
130
- return `<mj-text align="center"${x(l.id, f)}><div style="font-size: 28px; font-weight: 800;">${e.days}d ${e.hours}h ${e.minutes}m ${e.seconds}s</div>${t ? `<div style="font-size: 12px; color: #64748b;">Countdown to ${_(p.targetDate || "")}</div>` : ""}</mj-text>`;
131
- }
132
- if (l.type === "carousel") {
133
- let e = Array.isArray(p.images) ? p.images : [], t = x(l.id, f);
134
- return e.length === 0 ? `<mj-text align="center"${t}>No images in carousel</mj-text>` : `<mj-carousel${t}>${e.map((e) => `<mj-carousel-image src="${_(e.src)}" alt="${_(e.alt || "")}" />`).join("")}</mj-carousel>`;
135
- }
136
- if (l.type === "icon") {
137
- let e = parseInt(String(p.iconSize || 48), 10) || 48, t = l.style?.color || "#1e293b", n = s(p.iconName, e, t);
138
- return `<mj-text align="center"${x(l.id, f)}>${n}</mj-text>`;
139
- }
140
- let d = b(p.hideOnDesktop ? "desktop-hide" : "", l.id, f);
141
- if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
142
- let e = l.type === "heading" ? {
143
- fontSize: "24px",
144
- fontWeight: "700"
145
- } : { fontSize: "14px" }, t = l.style || {}, n = j(t, e), r = i(l).autoWidth, a = String(p.boxAlign || "left"), o = /* @__PURE__ */ new Set([
146
- "fontSize",
147
- "fontWeight",
148
- "color",
149
- "fontFamily",
150
- "lineHeight",
151
- "letterSpacing",
152
- "textAlign"
153
- ]), s = Object.entries(t).filter(([e, t]) => !o.has(e) && e !== "width" && t != null && t !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${_(String(t))}`);
154
- r ? s.push("display: inline-block") : t.width && s.push(`width: ${_(String(t.width))}`), t.height && s.push("overflow: hidden"), (t.textAlign || a !== "left") && s.push(`text-align: ${_(String(t.textAlign || "left"))} !important`);
155
- let c = "";
156
- s.length > 0 && (c = `plexo-textbox-${l.id}`, E.push(`.${c} > div { ${s.join("; ")}; }`));
157
- let u = y(c, d);
158
- return `<mj-text${n ? ` ${n}` : ""} align="${_(a)}" css-class="${u}">${p.text || ""}</mj-text>`;
159
- }
160
- if (l.type === "spacer") {
161
- let e = l.style?.height || "24px", t = x(l.id, f);
162
- return `<mj-spacer height="${_(String(e))}"${t} />`;
163
- }
164
- if (l.type === "divider") {
165
- let e = l.style || {}, t = x(l.id, f);
166
- return `<mj-divider border-width="${_(String(e.borderWidth || "1px"))}" border-style="${_(String(e.borderStyle || "solid"))}" border-color="${_(String(e.borderColor || "#334155"))}"${t} />`;
167
- }
168
- return l.type === "card" ? `<mj-text css-class="${d}"><strong style="display:block;margin-bottom:8px;">${_(p.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${_(p.description || "Card description.")}</span></mj-text>` : l.type === "html" ? `<mj-text css-class="${d}">${p.htmlContent || p.text || ""}</mj-text>` : `<mj-text${g}${k} css-class="${d}">${_(p.text || p.htmlContent || "")}</mj-text>`;
169
- }
170
- if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
171
- let e = l.style || {}, t = i(l).autoWidth, n = String(p.boxAlign || "left"), r = v(t ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== "width")) : e), a = t || !!e.width, o = a ? "display:inline-block;" : "", s = l.type === "heading" ? "h2" : "p", c = l.type === "heading" ? "Heading" : "", u = `${M}<${s}${g}${k} style="${o}${r}">${_(p.text || c)}</${s}>`;
172
- return a ? `<div style="text-align:${_(n)};">${u}</div>` : u;
173
- }
174
- switch (l.type) {
175
- case "button": return `${M}<a${g}${k} href="${_(p.href || "#")}" style="${m}">${_(p.text || "Button")}</a>`;
176
- case "image": return `${M}<img${g}${k} src="${_(p.src || "")}" alt="${_(p.alt || "")}" style="${m}" />`;
177
- case "html": return `${M}<div${g}${k} style="${m}">${String(p.htmlContent || "")}</div>`;
178
- case "blog_title":
179
- case "blog_content":
180
- case "blog_featured_image":
181
- case "blog_date":
182
- case "blog_author":
183
- case "blog_categories":
184
- case "blog_comments":
185
- case "blog_post_list": return `${M}<div${g}${k} data-plexo-blog-${l.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase())}="true"${p.prefix ? ` data-plexo-blog-prefix="${_(p.prefix)}"` : ""} style="${m}"></div>`;
186
- default: return `${M}<div${g}${k} style="${m}">${_(p.text || "")}</div>`;
187
- }
188
- }, I = (e, t, n) => {
189
- if (t === "email") {
190
- let r = new Map(e.elements.map((e) => [e.id, e])), i = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), a = l(e).map((e) => {
191
- let a = r.get(e);
192
- if (a) return F(a, t, n);
193
- let o = i.get(e);
194
- return o ? `<mj-raw><tr><td style="font-size:16px;">${L(o, "landing_page", n)}</td></tr></mj-raw>` : "";
195
- }).join(""), o = M(e.styles || {}), s = e.elements.length === 0 && (!Array.isArray(e.nestedRows) || e.nestedRows.length === 0), c = y(D && s ? A({}, e.id, [`min-height: ${O}px`]) : "", b("", e.id, n, p)), u = c ? ` css-class="${_(c)}"` : "";
196
- return `<mj-column width="${_(e.width || "100%")}"${o}${u}>${a}</mj-column>`;
197
- }
198
- let r = v(e.styles || {}), i = new Map(e.elements.map((e) => [e.id, e])), a = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), o = l(e).map((e) => {
199
- let r = i.get(e);
200
- if (r) return F(r, t, n);
201
- let o = a.get(e);
202
- return o ? L(o, t, n) : "";
203
- }).join(""), s = S(e.id, n, p), c = e.elements.length === 0 && (!Array.isArray(e.nestedRows) || e.nestedRows.length === 0), u = D && c ? `min-height: ${O}px;` : "";
204
- return `<div${s} style="width:${_(e.width || "100%")};${u}${r}">${o}</div>`;
205
- }, L = (e, t, n) => {
206
- if (t === "email") return `<mj-section css-class="${b(e.style?.hideOnDesktop ? "desktop-hide" : "", e.id, n, f)}"${M(e.style || {})}>${e.columns.map((e) => I(e, t, n)).join("")}</mj-section>`;
207
- let r = v(e.style || {}), i = e.columns.map((e) => I(e, t, n)).join("");
208
- return `<section${S(e.id, n, f)} style="display:flex;flex-wrap:wrap;${r}">${i}</section>`;
209
- }, R = (e, t, n) => {
210
- let r = n?.instrument ?? !1;
211
- E = [], D = n?.canvasEditorPadding ?? !1;
212
- let i = (e.body?.rows || []).map((e) => L(e, t, r)).join(""), a = v(e.body?.style || {});
213
- return t === "email" ? `<mjml><mj-head><mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }${E.length > 0 ? ` ${E.join(" ")}` : ""}</mj-style></mj-head><mj-body><mj-section><mj-column><mj-text css-class="preheader" padding="0" font-size="1px" color="#ffffff">&nbsp;</mj-text></mj-column></mj-section>${i}</mj-body></mjml>`.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1") : `<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body style="${a}"><main>${i}</main></body></html>`;
214
- };
215
- //#endregion
216
- export { R as t };