@charisol/plexo-sdk 1.1.3 → 1.1.4

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/dist/compiler.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-Do7SiKdp.js";
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-BpXCk9OP.js";
2
2
  export { c as DEFAULT_BODY_FONT_FAMILY, i as FORM_NON_CSS_STYLE_KEYS, o as collectResponsiveRule, n as compileToHTML, e as compileToHTMLWithStrataAuto, a as compileToPlainText, s as convertSectionRowToPlexoRow, t as getFormDefaultStyle, r as getInlineStylesImportant, l as injectStrataBundle };
@@ -1,32 +1,31 @@
1
- import { c as e, d as t, f as n, g as r, i, m as a, p as o, t as s, u as c } from "./iconSvgStatic-DKNX8fUj.js";
1
+ import { _ as e, a as t, d as n, f as r, h as i, l as a, m as o, n as s, p as c, t as l } from "./iconSvgStatic-CeiuMavi.js";
2
2
  //#region src/utilities/compilerClient.ts
3
- var l = {
4
- facebook: "facebook",
5
- x: "twitter",
6
- twitter: "twitter",
7
- linkedin: "linkedin",
8
- instagram: "instagram",
9
- youtube: "youtube",
10
- pinterest: "pinterest"
11
- }, u = /* @__PURE__ */ new Set([
3
+ var u = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", d = (e) => {
4
+ let t = "";
5
+ for (let n = 0; n < e.length; n += 3) {
6
+ let r = e.charCodeAt(n), i = e.charCodeAt(n + 1), a = e.charCodeAt(n + 2), o = r << 16 | (Number.isNaN(i) ? 0 : i) << 8 | (Number.isNaN(a) ? 0 : a);
7
+ t += u[o >> 18 & 63], t += u[o >> 12 & 63], t += Number.isNaN(i) ? "=" : u[o >> 6 & 63], t += Number.isNaN(a) ? "=" : u[o & 63];
8
+ }
9
+ return t;
10
+ }, f = /* @__PURE__ */ new Set([
12
11
  "selectable",
13
12
  "draggable",
14
13
  "duplicatable",
15
14
  "deletable",
16
15
  "hideable",
17
16
  "locked"
18
- ]), d = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), f = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), p = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), m = (e, t) => {
17
+ ]), p = (e) => String(e ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), m = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), h = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), g = (e, t) => {
19
18
  let n = { ...e.attributes || {} };
20
- if (t === "email") for (let e of u) delete n[e];
19
+ if (t === "email") for (let e of f) delete n[e];
21
20
  return n;
22
- }, h = (e, t) => {
23
- let n = m(e, t), r = f(e.style || {}), i = p(n.htmlClassNames, n.htmlClass, n.validationClass, n.validationClassName), a = d(n.name || n.fieldName || "field"), o = d(n.placeholder || ""), s = n.required ? " required" : "";
21
+ }, _ = (e, t) => {
22
+ let n = g(e, t), r = m(e.style || {}), i = h(n.htmlClassNames, n.htmlClass, n.validationClass, n.validationClassName), a = p(n.name || n.fieldName || "field"), o = p(n.placeholder || ""), s = n.required ? " required" : "";
24
23
  if (t === "email") return `<mj-table><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${r}">${o || a}</td></tr></mj-table>`;
25
- let c = d(n.inputType || n.type || (e.type === "input" ? n.kind || "text" : e.type)), l = n.htmlId ? ` id="${d(n.htmlId)}"` : "", u = i ? ` class="${d(i)}"` : "";
26
- return e.type === "textarea" ? `<textarea${l}${u} name="${a}" placeholder="${o}" style="${r}"${s}>${d(n.value || "")}</textarea>` : e.type === "select" ? `<select${l}${u} name="${a}" style="${r}"${s}>${(n.options || []).map((e) => `<option value="${d(e.value)}">${d(e.label)}</option>`).join("")}</select>` : `<input${l}${u} type="${c}" name="${a}" placeholder="${o}" value="${d(n.value || "")}" style="${r}"${s} />`;
27
- }, g = (e, t) => {
28
- let n = m(e, t), r = f(e.style || {}), i = p(n.htmlClassNames, n.htmlClass), a = n.htmlId ? ` id="${d(n.htmlId)}"` : "", o = i ? ` class="${d(i)}"` : "", s = d(n.actionUrl || n.action || "#"), c = d(n.method || "POST"), l = n.fields || [], u = d(n.submitLabel || "Submit");
29
- return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${d(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;">${d(e.placeholder || "") || "&nbsp;"}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${d(n.href || n.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${u}</a></td></tr></table></td></tr></mj-table>` : `<form${a}${o} action="${s}" method="${c}" style="${r}">${l.map((t) => h({
24
+ let c = p(n.inputType || n.type || (e.type === "input" ? n.kind || "text" : e.type)), l = n.htmlId ? ` id="${p(n.htmlId)}"` : "", u = i ? ` class="${p(i)}"` : "";
25
+ return e.type === "textarea" ? `<textarea${l}${u} name="${a}" placeholder="${o}" style="${r}"${s}>${p(n.value || "")}</textarea>` : e.type === "select" ? `<select${l}${u} name="${a}" style="${r}"${s}>${(n.options || []).map((e) => `<option value="${p(e.value)}">${p(e.label)}</option>`).join("")}</select>` : `<input${l}${u} type="${c}" name="${a}" placeholder="${o}" value="${p(n.value || "")}" style="${r}"${s} />`;
26
+ }, v = (e, t) => {
27
+ let n = g(e, t), r = m(e.style || {}), i = h(n.htmlClassNames, n.htmlClass), a = n.htmlId ? ` id="${p(n.htmlId)}"` : "", o = i ? ` class="${p(i)}"` : "", s = p(n.actionUrl || n.action || "#"), c = p(n.method || "POST"), l = n.fields || [], u = p(n.submitLabel || "Submit");
28
+ return t === "email" ? `<mj-table><tr><td style="${r}"><table role="presentation" width="100%">${l.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${p(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;">${p(e.placeholder || "") || "&nbsp;"}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${p(n.href || n.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${u}</a></td></tr></table></td></tr></mj-table>` : `<form${a}${o} action="${s}" method="${c}" style="${r}">${l.map((t) => _({
30
29
  id: `${e.id}-${String(t.name || t.label || "field")}`,
31
30
  type: t.kind === "textarea" || t.kind === "select" ? t.kind : "input",
32
31
  style: {
@@ -35,100 +34,105 @@ var l = {
35
34
  },
36
35
  attributes: t
37
36
  }, "landing_page")).join("")}<button type="submit">${u}</button></form>`;
38
- }, _ = (e = {}, t = {}) => {
37
+ }, y = (e = {}, t = {}) => {
39
38
  let n = [], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
40
- return r && n.push(`font-size="${d(String(r))}"`), i && n.push(`font-weight="${d(String(i))}"`), e.color && n.push(`color="${d(String(e.color))}"`), e.fontFamily && n.push(`font-family="${d(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${d(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${d(String(e.letterSpacing))}"`), e.textAlign && n.push(`align="${d(String(e.textAlign))}"`), e.backgroundColor && n.push(`container-background-color="${d(String(e.backgroundColor))}"`), n.join(" ");
41
- }, v = (e = {}) => {
39
+ return r && n.push(`font-size="${p(String(r))}"`), i && n.push(`font-weight="${p(String(i))}"`), e.color && n.push(`color="${p(String(e.color))}"`), e.fontFamily && n.push(`font-family="${p(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${p(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${p(String(e.letterSpacing))}"`), e.textAlign && n.push(`align="${p(String(e.textAlign))}"`), e.backgroundColor && n.push(`container-background-color="${p(String(e.backgroundColor))}"`), n.join(" ");
40
+ }, b = (e = {}) => {
42
41
  let t = e.backgroundColor || e.background;
43
- return t ? ` background-color="${d(String(t))}"` : "";
44
- }, y = (r, u) => {
45
- let v = m(r, u), y = f(r.style || {}), b = v.htmlId ? ` id="${d(v.htmlId)}"` : "", x = p(v.htmlClassNames, v.htmlClass, u === "landing_page" && v.hideOnMobile ? "hidden md:block" : ""), S = x ? ` class="${d(x)}"` : "", C = typeof v.customCss == "string" && v.customCss.trim() ? v.customCss.trim() : "", w = C && u === "landing_page" ? `<style>${C}</style>` : "";
46
- if (r.type === "form_container") return `${w}${g(r, u)}`;
47
- if (r.type === "input" || r.type === "select" || r.type === "textarea") return `${w}${h(r, u)}`;
42
+ return t ? ` background-color="${p(String(t))}"` : "";
43
+ }, x = (e, u) => {
44
+ let f = g(e, u), b = m(e.style || {}), x = f.htmlId ? ` id="${p(f.htmlId)}"` : "", S = h(f.htmlClassNames, f.htmlClass, u === "landing_page" && f.hideOnMobile ? "hidden md:block" : ""), C = S ? ` class="${p(S)}"` : "", w = typeof f.customCss == "string" && f.customCss.trim() ? f.customCss.trim() : "", T = w && u === "landing_page" ? `<style>${w}</style>` : "";
45
+ if (e.type === "form_container") return `${T}${v(e, u)}`;
46
+ if (e.type === "input" || e.type === "select" || e.type === "textarea") return `${T}${_(e, u)}`;
48
47
  if (u === "email") {
49
- if (r.type === "button") {
50
- let e = d(v.href || "#"), t = d(v.text || "Button"), n = i(r).width, a = n === "auto" ? "" : ` width="${d(n)}"`;
51
- return `<mj-button href="${e}" css-class="${v.hideOnDesktop ? "desktop-hide" : ""}" padding="0" inner-padding="10px 16px"${a}>${t}</mj-button>`;
48
+ if (e.type === "button") {
49
+ let n = p(f.href || "#"), r = p(f.text || "Button"), i = t(e).width, a = i === "auto" ? "" : ` width="${p(i)}"`;
50
+ return `<mj-button href="${n}" css-class="${f.hideOnDesktop ? "desktop-hide" : ""}" padding="0" inner-padding="10px 16px"${a}>${r}</mj-button>`;
52
51
  }
53
- if (r.type === "image") {
54
- let t = e(r), n = t.width && t.width !== "100%" ? ` width="${d(t.width)}"` : "", i = t.height && t.height !== "auto" ? ` height="${d(t.height)}"` : "";
55
- return `<mj-image src="${d(v.src || "")}" alt="${d(v.alt || "")}"${n}${i} />`;
52
+ if (e.type === "image") {
53
+ let t = a(e), n = t.width && t.width !== "100%" ? ` width="${p(t.width)}"` : "", r = t.height && t.height !== "auto" ? ` height="${p(t.height)}"` : "";
54
+ return `<mj-image src="${p(f.src || "")}" alt="${p(f.alt || "")}"${n}${r} />`;
56
55
  }
57
- if (r.type === "social") {
58
- let e = t(r), n = e.filter((e) => l[e.provider]), i = e.filter((e) => !l[e.provider]);
59
- return `${n.length ? `<mj-social font-size="13px" icon-size="30px" mode="horizontal">${n.map((e) => `<mj-social-element name="${l[e.provider]}" href="${d(e.url)}" background-color="${d(e.backgroundColor)}" color="${d(e.color)}"></mj-social-element>`).join("")}</mj-social>` : ""}${i.length ? `<mj-text align="center">${i.map((e) => `<a href="${d(e.url)}" style="color: ${d(e.color)}; text-decoration: none; margin: 0 6px;">${d(e.provider)}</a>`).join("")}</mj-text>` : ""}`;
56
+ if (e.type === "social") {
57
+ let t = r(e);
58
+ if (!t.length) return "";
59
+ let n = (e) => e === "square" ? "14px" : "9999px";
60
+ return `<mj-social font-size="13px" mode="horizontal">${t.map((e) => {
61
+ let t = `data:image/svg+xml;base64,${d(s(e.provider, e.color))}`;
62
+ return `<mj-social-element href="${p(e.url)}" src="${t}" background-color="${p(e.backgroundColor)}" icon-size="${p(e.size)}" border-radius="${n(e.iconType)}"></mj-social-element>`;
63
+ }).join("")}</mj-social>`;
60
64
  }
61
- if (r.type === "menu") return `<mj-navbar hamburger="hamburger">${c(r).map((e) => `<mj-navbar-link href="${d(e.href)}">${d(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
62
- if (r.type === "table") {
63
- let e = n(r), t = r.style || {}, i = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, a = (n, r, a) => {
64
- let o = a ? "th" : "td", s = a ? t.headerBgColor || "#f8fafc" : e.striped && r % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", c = a ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
65
- return `<tr>${n.map((e) => `<${o} style="padding: ${t.cellPadding || "8px"}; border: ${i}; background-color: ${s}; color: ${c};">${d(e) || "&nbsp;"}</${o}>`).join("")}</tr>`;
66
- }, o = +!!e.enableHeader, s = e.enableFooter ? e.cells.length - 1 : e.cells.length;
67
- return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${e.enableHeader && e.cells.length > 0 ? `<thead>${a(e.cells[0], 0, !0)}</thead>` : ""}<tbody>${e.cells.slice(o, Math.max(o, s)).map((e, t) => a(e, t, !1)).join("")}</tbody>${e.enableFooter && e.cells.length > o ? `<tfoot>${a(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : ""}</table></mj-table>`;
65
+ if (e.type === "menu") return `<mj-navbar hamburger="hamburger">${n(e).map((e) => `<mj-navbar-link href="${p(e.href)}">${p(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
66
+ if (e.type === "table") {
67
+ let t = c(e), n = e.style || {}, r = `${n.borderWidth || "1px"} ${n.borderStyle || "solid"} ${n.borderColor || "#cbd5e1"}`, i = (e, i, a) => {
68
+ let o = a ? "th" : "td", s = a ? n.headerBgColor || "#f8fafc" : t.striped && i % 2 == 1 ? "#f8fafc" : n.contentBgColor || "#ffffff", c = a ? n.headerTextColor || "#1e293b" : n.contentTextColor || "#475569";
69
+ return `<tr>${e.map((e) => `<${o} style="padding: ${n.cellPadding || "8px"}; border: ${r}; background-color: ${s}; color: ${c};">${p(e) || "&nbsp;"}</${o}>`).join("")}</tr>`;
70
+ }, a = +!!t.enableHeader, o = t.enableFooter ? t.cells.length - 1 : t.cells.length;
71
+ return `<mj-table><table role="presentation" style="border-collapse: collapse; width: 100%;">${t.enableHeader && t.cells.length > 0 ? `<thead>${i(t.cells[0], 0, !0)}</thead>` : ""}<tbody>${t.cells.slice(a, Math.max(a, o)).map((e, t) => i(e, t, !1)).join("")}</tbody>${t.enableFooter && t.cells.length > a ? `<tfoot>${i(t.cells[t.cells.length - 1], t.cells.length - 1, !1)}</tfoot>` : ""}</table></mj-table>`;
68
72
  }
69
- if (r.type === "video") {
70
- let e = a(v.videoUrl), t = v.linkType === "email" ? `mailto:${v.href || ""}` : v.href || v.videoUrl || "#";
71
- return `<mj-image src="${d(e.thumbnailUrl)}" href="${d(t)}" alt="${d(v.alt || "Video preview")}" />`;
73
+ if (e.type === "video") {
74
+ let e = i(f.videoUrl), t = f.linkType === "email" ? `mailto:${f.href || ""}` : f.href || f.videoUrl || "#";
75
+ return `<mj-image src="${p(e.thumbnailUrl)}" href="${p(t)}" alt="${p(f.alt || "Video preview")}" />`;
72
76
  }
73
- if (r.type === "timer") {
74
- let e = o(v.targetDate), t = v.showLabels !== !1;
75
- return `<mj-text align="center"><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 ${d(v.targetDate || "")}</div>` : ""}</mj-text>`;
77
+ if (e.type === "timer") {
78
+ let e = o(f.targetDate), t = f.showLabels !== !1;
79
+ return `<mj-text align="center"><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(f.targetDate || "")}</div>` : ""}</mj-text>`;
76
80
  }
77
- if (r.type === "carousel") {
78
- let e = Array.isArray(v.images) ? v.images : [];
79
- return e.length === 0 ? "<mj-text align=\"center\">No images in carousel</mj-text>" : `<mj-carousel>${e.map((e) => `<mj-carousel-image src="${d(e.src)}" alt="${d(e.alt || "")}" />`).join("")}</mj-carousel>`;
81
+ if (e.type === "carousel") {
82
+ let e = Array.isArray(f.images) ? f.images : [];
83
+ return e.length === 0 ? "<mj-text align=\"center\">No images in carousel</mj-text>" : `<mj-carousel>${e.map((e) => `<mj-carousel-image src="${p(e.src)}" alt="${p(e.alt || "")}" />`).join("")}</mj-carousel>`;
80
84
  }
81
- if (r.type === "icon") {
82
- let e = parseInt(String(v.iconSize || 48), 10) || 48, t = r.style?.color || "#1e293b";
83
- return `<mj-text align="center">${s(v.iconName, e, t)}</mj-text>`;
85
+ if (e.type === "icon") {
86
+ let t = parseInt(String(f.iconSize || 48), 10) || 48, n = e.style?.color || "#1e293b";
87
+ return `<mj-text align="center">${l(f.iconName, t, n)}</mj-text>`;
84
88
  }
85
- let u = v.hideOnDesktop ? "desktop-hide" : "";
86
- if (r.type === "heading" || r.type === "paragraph" || r.type === "text") {
87
- let e = r.type === "heading" ? {
89
+ let u = f.hideOnDesktop ? "desktop-hide" : "";
90
+ if (e.type === "heading" || e.type === "paragraph" || e.type === "text") {
91
+ let t = e.type === "heading" ? {
88
92
  fontSize: "24px",
89
93
  fontWeight: "700"
90
- } : { fontSize: "14px" }, t = _(r.style || {}, e);
91
- return `<mj-text${t ? ` ${t}` : ""} css-class="${u}">${v.text || ""}</mj-text>`;
94
+ } : { fontSize: "14px" }, n = y(e.style || {}, t);
95
+ return `<mj-text${n ? ` ${n}` : ""} css-class="${u}">${f.text || ""}</mj-text>`;
92
96
  }
93
- if (r.type === "spacer") {
94
- let e = r.style?.height || "24px";
95
- return `<mj-spacer height="${d(String(e))}" />`;
97
+ if (e.type === "spacer") {
98
+ let t = e.style?.height || "24px";
99
+ return `<mj-spacer height="${p(String(t))}" />`;
96
100
  }
97
- if (r.type === "divider") {
98
- let e = r.style || {};
99
- return `<mj-divider border-width="${d(String(e.borderWidth || "1px"))}" border-style="${d(String(e.borderStyle || "solid"))}" border-color="${d(String(e.borderColor || "#334155"))}" />`;
101
+ if (e.type === "divider") {
102
+ let t = e.style || {};
103
+ return `<mj-divider border-width="${p(String(t.borderWidth || "1px"))}" border-style="${p(String(t.borderStyle || "solid"))}" border-color="${p(String(t.borderColor || "#334155"))}" />`;
100
104
  }
101
- return r.type === "card" ? `<mj-text css-class="${u}"><strong style="display:block;margin-bottom:8px;">${d(v.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${d(v.description || "Card description.")}</span></mj-text>` : r.type === "html" ? `<mj-text css-class="${u}">${v.htmlContent || v.text || ""}</mj-text>` : `<mj-text${b}${S} css-class="${u}">${d(v.text || v.htmlContent || "")}</mj-text>`;
105
+ return e.type === "card" ? `<mj-text css-class="${u}"><strong style="display:block;margin-bottom:8px;">${p(f.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${p(f.description || "Card description.")}</span></mj-text>` : e.type === "html" ? `<mj-text css-class="${u}">${f.htmlContent || f.text || ""}</mj-text>` : `<mj-text${x}${C} css-class="${u}">${p(f.text || f.htmlContent || "")}</mj-text>`;
102
106
  }
103
- switch (r.type) {
104
- case "heading": return `${w}<h2${b}${S} style="${y}">${d(v.text || "Heading")}</h2>`;
107
+ switch (e.type) {
108
+ case "heading": return `${T}<h2${x}${C} style="${b}">${p(f.text || "Heading")}</h2>`;
105
109
  case "paragraph":
106
- case "text": return `${w}<p${b}${S} style="${y}">${d(v.text || "")}</p>`;
107
- case "button": return `${w}<a${b}${S} href="${d(v.href || "#")}" style="${y}">${d(v.text || "Button")}</a>`;
108
- case "image": return `${w}<img${b}${S} src="${d(v.src || "")}" alt="${d(v.alt || "")}" style="${y}" />`;
109
- case "html": return `${w}<div${b}${S} style="${y}">${String(v.htmlContent || "")}</div>`;
110
- default: return `${w}<div${b}${S} style="${y}">${d(v.text || "")}</div>`;
110
+ case "text": return `${T}<p${x}${C} style="${b}">${p(f.text || "")}</p>`;
111
+ case "button": return `${T}<a${x}${C} href="${p(f.href || "#")}" style="${b}">${p(f.text || "Button")}</a>`;
112
+ case "image": return `${T}<img${x}${C} src="${p(f.src || "")}" alt="${p(f.alt || "")}" style="${b}" />`;
113
+ case "html": return `${T}<div${x}${C} style="${b}">${String(f.htmlContent || "")}</div>`;
114
+ default: return `${T}<div${x}${C} style="${b}">${p(f.text || "")}</div>`;
111
115
  }
112
- }, b = (e, t) => {
113
- if (t === "email") {
114
- let n = new Map(e.elements.map((e) => [e.id, e])), i = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), a = r(e).map((e) => {
115
- let r = n.get(e);
116
- if (r) return y(r, t);
116
+ }, S = (t, n) => {
117
+ if (n === "email") {
118
+ let r = new Map(t.elements.map((e) => [e.id, e])), i = new Map((Array.isArray(t.nestedRows) ? t.nestedRows : []).map((e) => [e.id, e])), a = e(t).map((e) => {
119
+ let t = r.get(e);
120
+ if (t) return x(t, n);
117
121
  let a = i.get(e);
118
- return a ? `<mj-raw>${x(a, "landing_page")}</mj-raw>` : "";
119
- }).join(""), o = v(e.styles || {});
120
- return `<mj-column width="${d(e.width || "100%")}"${o}>${a}</mj-column>`;
122
+ return a ? `<mj-raw>${C(a, "landing_page")}</mj-raw>` : "";
123
+ }).join(""), o = b(t.styles || {});
124
+ return `<mj-column width="${p(t.width || "100%")}"${o}>${a}</mj-column>`;
121
125
  }
122
- let n = f(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 = r(e).map((e) => {
123
- let n = i.get(e);
124
- if (n) return y(n, t);
126
+ let r = m(t.styles || {}), i = new Map(t.elements.map((e) => [e.id, e])), a = new Map((Array.isArray(t.nestedRows) ? t.nestedRows : []).map((e) => [e.id, e])), o = e(t).map((e) => {
127
+ let t = i.get(e);
128
+ if (t) return x(t, n);
125
129
  let r = a.get(e);
126
- return r ? x(r, t) : "";
130
+ return r ? C(r, n) : "";
127
131
  }).join("");
128
- return `<div style="width:${d(e.width || "100%")};${n}">${o}</div>`;
129
- }, x = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}"${v(e.style || {})}>${e.columns.map((e) => b(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${f(e.style || {})}">${e.columns.map((e) => b(e, t)).join("")}</section>`, S = (e, t) => {
130
- let n = (e.body?.rows || []).map((e) => x(e, t)).join(""), r = f(e.body?.style || {});
132
+ return `<div style="width:${p(t.width || "100%")};${r}">${o}</div>`;
133
+ }, C = (e, t) => t === "email" ? `<mj-section css-class="${e.style?.hideOnDesktop ? "desktop-hide" : ""}"${b(e.style || {})}>${e.columns.map((e) => S(e, t)).join("")}</mj-section>` : `<section style="display:flex;flex-wrap:wrap;${m(e.style || {})}">${e.columns.map((e) => S(e, t)).join("")}</section>`, w = (e, t) => {
134
+ let n = (e.body?.rows || []).map((e) => C(e, t)).join(""), r = m(e.body?.style || {});
131
135
  return t === "email" ? `<mjml><mj-head><mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }</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>${n}</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="${r}"><main>${n}</main></body></html>`;
132
136
  };
133
137
  //#endregion
134
- export { S as parseJsonToTargetFormat };
138
+ export { w as parseJsonToTargetFormat };
@@ -9,8 +9,20 @@ function t(e, t, n) {
9
9
  }
10
10
  //#endregion
11
11
  //#region src/utilities/elementResolvers.ts
12
- var n = (e) => e === "twitter" ? "x" : e;
13
- function r(e) {
12
+ var n = (e) => e === "twitter" ? "x" : e, r = (e, t = "currentColor") => {
13
+ switch (n(e)) {
14
+ case "facebook": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M14 8h2V4h-2c-2.2 0-4 1.8-4 4v2H8v4h2v6h4v-6h2.5l.5-4H14V8c0-.55.45-1 1-1Z"/></svg>`;
15
+ case "instagram": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="5" ry="5" fill="none" stroke="${t}" stroke-width="2"/><circle cx="12" cy="12" r="3.5" fill="none" stroke="${t}" stroke-width="2"/><circle cx="17" cy="7" r="1" fill="${t}"/></svg>`;
16
+ case "linkedin": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="8" cy="9" r="1.25" fill="${t}"/><path fill="${t}" d="M7 11h2v6H7zM11 11h2v.9c.5-.7 1.34-1.15 2.4-1.15 2 0 3.1 1.25 3.1 3.6V17h-2v-2.2c0-1.3-.45-2.05-1.55-2.05-1.2 0-1.85.8-1.85 2.05V17h-2z"/></svg>`;
17
+ case "x": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M6 5h3.1l3 4.2L15.7 5H18l-4.8 5.5L18.4 18h-3.1l-3.3-4.7L8 18H5.6l5-5.8z"/></svg>`;
18
+ case "youtube": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><rect x="3" y="6.5" width="18" height="11" rx="3" fill="${t}"/><path fill="#fff" d="m10 9 5 3-5 3z"/></svg>`;
19
+ case "pinterest": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M12 4a8 8 0 0 0-2.9 15.46c-.04-1.17 0-2.58.3-3.82l1.1-4.6s-.27-.56-.27-1.4c0-1.3.75-2.27 1.68-2.27.8 0 1.18.6 1.18 1.3 0 .8-.5 2-.77 3.12-.22.94.47 1.7 1.4 1.7 1.67 0 2.8-2.15 2.8-4.7 0-1.93-1.3-3.37-3.67-3.37-2.68 0-4.35 2-4.35 4.23 0 .77.23 1.34.6 1.77.17.2.2.29.13.53l-.2.8c-.07.25-.3.34-.56.25-1.55-.63-2.27-2.32-2.27-4.22 0-3.14 2.64-6.9 7.89-6.9 4.21 0 6.98 3.05 6.98 6.32 0 4.32-2.4 7.54-5.93 7.54-1.18 0-2.28-.64-2.65-1.37l-.73 2.78c-.26.95-.77 2.14-1.22 2.96A8 8 0 1 0 12 4Z"/></svg>`;
20
+ case "whatsapp": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M12 4a8 8 0 0 0-6.9 12.04L4 20l4.11-1.06A8 8 0 1 0 12 4Zm4.55 11.36c-.2.56-1.14 1.04-1.57 1.1-.4.06-.92.09-1.48-.08-.34-.11-.78-.25-1.35-.5-2.37-1.03-3.92-3.45-4.04-3.6-.11-.15-.96-1.27-.96-2.42s.6-1.72.8-1.96c.2-.24.45-.3.6-.3h.43c.14 0 .33-.05.51.38.2.48.7 1.67.75 1.79.06.12.1.26.02.42-.07.15-.11.26-.22.39-.11.13-.23.29-.33.39-.11.11-.22.23-.1.45.11.22.52.86 1.11 1.39.76.68 1.4.89 1.62.99.22.11.35.09.48-.06.13-.15.56-.65.72-.88.15-.22.31-.18.52-.11.22.08 1.36.64 1.6.76.23.11.38.17.44.27.06.1.06.61-.14 1.17Z"/></svg>`;
21
+ case "tiktok": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M14.4 4c.24 1.12.9 2.08 1.86 2.67.7.42 1.52.64 2.35.63V10a6.5 6.5 0 0 1-4.2-1.52v5.24A4.72 4.72 0 1 1 9.7 9v2.6a2.12 2.12 0 1 0 2.1 2.12V4z"/></svg>`;
22
+ default: return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="12" cy="12" r="4" fill="${t}"/></svg>`;
23
+ }
24
+ };
25
+ function i(e) {
14
26
  let t = e.attributes || {}, r = e.style || {};
15
27
  return (Array.isArray(t.links) ? t.links : []).filter((e) => e && typeof e == "object").map((e) => ({
16
28
  provider: n(String(e.provider || "")),
@@ -21,21 +33,21 @@ function r(e) {
21
33
  iconType: (e.iconType || t.iconType) === "square" ? "square" : "circle"
22
34
  }));
23
35
  }
24
- function i(e) {
36
+ function a(e) {
25
37
  let t = e.attributes || {};
26
38
  return (Array.isArray(t.links) ? t.links : []).filter((e) => e && typeof e == "object").map((e) => ({
27
39
  label: typeof e.label == "string" && e.label.trim() ? e.label : "Link",
28
40
  href: typeof e.href == "string" && e.href.trim() ? e.href : "#"
29
41
  }));
30
42
  }
31
- function a(e) {
43
+ function o(e) {
32
44
  let t = e.style || {}, n = e.attributes || {};
33
45
  return {
34
46
  width: t.width || "100%",
35
47
  height: n.autoHeight === !1 && t.height || "auto"
36
48
  };
37
49
  }
38
- function o(e, t, n, r) {
50
+ function s(e, t, n, r) {
39
51
  if (e) return e;
40
52
  if (t) {
41
53
  let e = t.trim().split(/\s+/).filter(Boolean);
@@ -51,22 +63,22 @@ function o(e, t, n, r) {
51
63
  }
52
64
  return r;
53
65
  }
54
- function s(e) {
66
+ function c(e) {
55
67
  let t = e.style || {}, n = e.attributes || {};
56
68
  return {
57
69
  width: n.autoWidth === !1 ? t.width || "100%" : "auto",
58
70
  height: n.autoHeight === !1 && t.height || "auto"
59
71
  };
60
72
  }
61
- function c(e) {
73
+ function l(e) {
62
74
  let t = e.style || {};
63
75
  return (e.attributes || {}).autoHeight === !1 && t.height || "auto";
64
76
  }
65
- function l(e, t) {
77
+ function u(e, t) {
66
78
  let n = e.style || {};
67
79
  return (e.attributes || {}).autoHeight === !1 && n.height || t;
68
80
  }
69
- var u = [
81
+ var d = [
70
82
  "showLabel",
71
83
  "fontSize",
72
84
  "labelFontWeight",
@@ -77,16 +89,16 @@ var u = [
77
89
  "inputTextColor",
78
90
  "placeholderColor"
79
91
  ];
80
- function d(e) {
92
+ function f(e) {
81
93
  let t = null;
82
94
  return (Array.isArray(e) ? e : []).map((e) => {
83
95
  let n = e?.inheritStylesFromPrevious && t ? { ...e } : e;
84
- if (e?.inheritStylesFromPrevious && t) for (let e of u) n[e] = t[e];
96
+ if (e?.inheritStylesFromPrevious && t) for (let e of d) n[e] = t[e];
85
97
  return t = n, n;
86
98
  });
87
99
  }
88
- var f = (e) => String(Math.max(0, e)).padStart(2, "0");
89
- function p(e, t, n = Date.now()) {
100
+ var p = (e) => String(Math.max(0, e)).padStart(2, "0");
101
+ function m(e, t, n = Date.now()) {
90
102
  let r = e ? Date.parse(e) : NaN, i = Number.isNaN(r) ? n : r, a = i - n;
91
103
  if (a <= 0) return {
92
104
  days: "00",
@@ -98,31 +110,31 @@ function p(e, t, n = Date.now()) {
98
110
  };
99
111
  let o = Math.floor(a / 1e3), s = Math.floor(o / 86400), c = Math.floor(o % 86400 / 3600), l = Math.floor(o % 3600 / 60), u = o % 60;
100
112
  return {
101
- days: f(s),
102
- hours: f(c),
103
- minutes: f(l),
104
- seconds: f(u),
113
+ days: p(s),
114
+ hours: p(c),
115
+ minutes: p(l),
116
+ seconds: p(u),
105
117
  isExpired: !1,
106
118
  targetTimestamp: i
107
119
  };
108
120
  }
109
- var m = [
121
+ var h = [
110
122
  "youtube.com",
111
123
  "www.youtube.com",
112
124
  "youtu.be",
113
125
  "m.youtube.com"
114
126
  ];
115
- function h(e) {
127
+ function g(e) {
116
128
  return e.hostname === "youtu.be" ? e.pathname.slice(1).split("/")[0] || null : e.pathname.startsWith("/embed/") ? e.pathname.slice(7).split("/")[0] || null : e.pathname.startsWith("/shorts/") ? e.pathname.slice(8).split("/")[0] || null : e.searchParams.get("v");
117
129
  }
118
- function g(e) {
130
+ function _(e) {
119
131
  let t = e.pathname.match(/(\d+)/);
120
132
  return t ? t[1] : null;
121
133
  }
122
- var _ = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
123
- function v(e) {
134
+ var v = "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22640%22%20height%3D%22360%22%20viewBox%3D%220%200%20640%20360%22%3E%3Crect%20width%3D%22640%22%20height%3D%22360%22%20fill%3D%22%230f172a%22%2F%3E%3Ccircle%20cx%3D%22320%22%20cy%3D%22180%22%20r%3D%2248%22%20fill%3D%22%23ffffff%22%20opacity%3D%220.9%22%2F%3E%3Cpath%20d%3D%22M304%20156%20L356%20180%20L304%20204%20Z%22%20fill%3D%22%230f172a%22%2F%3E%3C%2Fsvg%3E";
135
+ function y(e) {
124
136
  if (!e || typeof e != "string") return {
125
- thumbnailUrl: _,
137
+ thumbnailUrl: v,
126
138
  provider: "unknown"
127
139
  };
128
140
  let t;
@@ -130,34 +142,34 @@ function v(e) {
130
142
  t = new URL(e);
131
143
  } catch {
132
144
  return {
133
- thumbnailUrl: _,
145
+ thumbnailUrl: v,
134
146
  provider: "unknown"
135
147
  };
136
148
  }
137
- if (m.includes(t.hostname)) {
138
- let e = h(t);
149
+ if (h.includes(t.hostname)) {
150
+ let e = g(t);
139
151
  if (e) return {
140
152
  thumbnailUrl: `https://img.youtube.com/vi/${e}/hqdefault.jpg`,
141
153
  provider: "youtube"
142
154
  };
143
155
  }
144
156
  if (t.hostname === "vimeo.com" || t.hostname === "www.vimeo.com" || t.hostname === "player.vimeo.com") {
145
- let e = g(t);
157
+ let e = _(t);
146
158
  if (e) return {
147
159
  thumbnailUrl: `https://vumbnail.com/${e}.jpg`,
148
160
  provider: "vimeo"
149
161
  };
150
162
  }
151
163
  return {
152
- thumbnailUrl: _,
164
+ thumbnailUrl: v,
153
165
  provider: "unknown"
154
166
  };
155
167
  }
156
- function y(e, t) {
168
+ function b(e, t) {
157
169
  let n = e || "Star", r = n.replace(/[-_]([a-z0-9])/gi, (e, t) => t.toUpperCase()).replace(/^\w/, (e) => e.toUpperCase()), i = n.toLowerCase().replace(/[-_]/g, "");
158
170
  return t.includes(n) ? n : t.includes(r) ? r : t.includes(`${r}Icon`) ? `${r}Icon` : t.find((e) => e.toLowerCase().replace(/[-_]/g, "") === i) || "HelpCircle";
159
171
  }
160
- function b(e) {
172
+ function x(e) {
161
173
  let t = e.attributes || {}, n = Math.max(1, Number(t.rowCount) || 2), r = Math.max(1, Number(t.colCount) || 2), i = Array.isArray(t.cells) ? t.cells : [], a = [];
162
174
  for (let e = 0; e < n; e++) {
163
175
  let t = Array.isArray(i[e]) ? i[e] : [], n = [];
@@ -173,29 +185,29 @@ function b(e) {
173
185
  striped: !!t.striped
174
186
  };
175
187
  }
176
- var x = 8;
177
- function S(e, t, n) {
178
- let r = n < x && Array.isArray(e?.children) ? e.children : [];
188
+ var S = 8;
189
+ function C(e, t, n) {
190
+ let r = n < S && Array.isArray(e?.children) ? e.children : [];
179
191
  return {
180
192
  id: typeof e?.id == "string" && e.id ? e.id : `item-${t}`,
181
193
  title: typeof e?.title == "string" && e.title.trim() ? e.title : `Item ${t + 1}`,
182
194
  content: typeof e?.content == "string" ? e.content : "",
183
195
  defaultOpen: !!e?.defaultOpen,
184
- children: r.map((e, t) => S(e, t, n + 1))
196
+ children: r.map((e, t) => C(e, t, n + 1))
185
197
  };
186
198
  }
187
- function C(e, t) {
199
+ function w(e, t) {
188
200
  if (t !== "multi") {
189
201
  let t = !1;
190
202
  for (let n of e) n.defaultOpen && (t ? n.defaultOpen = !1 : t = !0);
191
203
  }
192
- for (let n of e) C(n.children, t);
204
+ for (let n of e) w(n.children, t);
193
205
  }
194
- function w(e) {
195
- let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => S(e, t, 0));
196
- return C(r, n), r;
206
+ function T(e) {
207
+ let t = e.attributes || {}, n = t.mode === "multi" ? "multi" : "single", r = (Array.isArray(t.items) ? t.items : []).map((e, t) => C(e, t, 0));
208
+ return w(r, n), r;
197
209
  }
198
- function T(e, t, n) {
210
+ function E(e, t, n) {
199
211
  let r = JSON.parse(JSON.stringify(Array.isArray(e) ? e : [])), i = (e, t) => {
200
212
  let [r, ...a] = t;
201
213
  if (e[r]) {
@@ -213,7 +225,7 @@ function T(e, t, n) {
213
225
  }
214
226
  //#endregion
215
227
  //#region src/utilities/iconSvgStatic.ts
216
- var E = {
228
+ var D = {
217
229
  "a-arrow-down": [
218
230
  ["path", { d: "m14 12 4 4 4-4" }],
219
231
  ["path", { d: "M18 16V7" }],
@@ -15033,18 +15045,18 @@ var E = {
15033
15045
  y2: "11"
15034
15046
  }]
15035
15047
  ]
15036
- }, D = "circle-help";
15037
- function O(e) {
15048
+ }, O = "circle-help";
15049
+ function k(e) {
15038
15050
  return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
15039
15051
  }
15040
- function k(e) {
15041
- let t = e || "HelpCircle", n = O(t.replace(/^\w/, (e) => e.toUpperCase()));
15042
- if (E[n]) return n;
15052
+ function A(e) {
15053
+ let t = e || "HelpCircle", n = k(t.replace(/^\w/, (e) => e.toUpperCase()));
15054
+ if (D[n]) return n;
15043
15055
  let r = t.toLowerCase().replace(/[-_\s]/g, "");
15044
- return Object.keys(E).find((e) => e.replace(/-/g, "") === r) || D;
15056
+ return Object.keys(D).find((e) => e.replace(/-/g, "") === r) || O;
15045
15057
  }
15046
- function A(e, t, n) {
15047
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(E[k(e)] || E[D] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15058
+ function j(e, t, n) {
15059
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(D[A(e)] || D[O] || []).map(([e, t]) => `<${e} ${Object.entries(t).map(([e, t]) => `${e}="${String(t)}"`).join(" ")}></${e}>`).join("")}</svg>`;
15048
15060
  }
15049
15061
  //#endregion
15050
- export { t as _, c as a, a as c, r as d, b as f, e as g, T as h, s as i, y as l, v as m, w as n, d as o, p, o as r, l as s, A as t, i as u };
15062
+ export { e as _, c as a, u as c, a as d, i as f, E as g, y as h, s as i, o as l, m, r as n, l as o, x as p, T as r, f as s, j as t, b as u, t as v };