best-email-builder 0.24.0 → 0.24.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.
- package/CHANGELOG.md +17 -0
- package/dist/ai.js +2 -2
- package/dist/builder.js +5 -5
- package/dist/{chunk-6MOFRBFL.js → chunk-3FISN7JB.js} +3 -3
- package/dist/{chunk-OX22IB5D.js → chunk-5IFYYWLW.js} +2 -2
- package/dist/{chunk-FIPMQV6N.js → chunk-6V3WK6IY.js} +4 -4
- package/dist/{chunk-MDFZRNZW.js → chunk-DZTEVV2W.js} +38 -4
- package/dist/chunk-DZTEVV2W.js.map +1 -0
- package/dist/{chunk-FSDQV6FU.js → chunk-HLK7HOJU.js} +2 -2
- package/dist/{chunk-FSDQV6FU.js.map → chunk-HLK7HOJU.js.map} +1 -1
- package/dist/{chunk-7KOL5ON4.js → chunk-RFCL6PW2.js} +5 -5
- package/dist/index.js +6 -6
- package/dist/library.js +4 -4
- package/dist/server.js +2 -2
- package/dist/types/core/constants.d.ts +1 -1
- package/dist/types/engine/NativeAdapter.d.ts +1 -1
- package/dist/types/renderer/columnAlignment.d.ts +9 -3
- package/package.json +1 -1
- package/dist/chunk-MDFZRNZW.js.map +0 -1
- /package/dist/{chunk-6MOFRBFL.js.map → chunk-3FISN7JB.js.map} +0 -0
- /package/dist/{chunk-OX22IB5D.js.map → chunk-5IFYYWLW.js.map} +0 -0
- /package/dist/{chunk-FIPMQV6N.js.map → chunk-6V3WK6IY.js.map} +0 -0
- /package/dist/{chunk-7KOL5ON4.js.map → chunk-RFCL6PW2.js.map} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* project JSON). Both are written with every template, so a document read by
|
|
7
7
|
* a newer version knows whether it must be migrated (see `core/document.js`).
|
|
8
8
|
*/
|
|
9
|
-
export const EMAIL_BUILDER_VERSION: "0.24.
|
|
9
|
+
export const EMAIL_BUILDER_VERSION: "0.24.2";
|
|
10
10
|
export const EMAIL_DOCUMENT_SCHEMA_VERSION: 1;
|
|
11
11
|
/** @typedef {'desktop'|'mobile'} EmailDevice */
|
|
12
12
|
/** @type {EmailDevice[]} */
|
|
@@ -23,7 +23,7 @@ export function createNativeAdapter({ loadCompiler, imageUrl }?: {
|
|
|
23
23
|
* @typedef {import('./model.js').EmailNode} EmailNode
|
|
24
24
|
*/
|
|
25
25
|
export const ENGINE_NAME: "beb-mjml";
|
|
26
|
-
export const ENGINE_VERSION: "0.24.
|
|
26
|
+
export const ENGINE_VERSION: "0.24.2";
|
|
27
27
|
export const EMPTY_MJML: "<mjml><mj-body background-color=\"#eceff4\" width=\"600px\"></mj-body></mjml>";
|
|
28
28
|
export type EmailEditorAdapter = import("../core/EmailEditor.js").EmailEditorAdapter;
|
|
29
29
|
export type EmailBlock = import("../core/EmailEditor.js").EmailBlock;
|
|
@@ -11,9 +11,15 @@ export function prepareColumnAlignment(source: string): string;
|
|
|
11
11
|
/**
|
|
12
12
|
* Columns side by side without media queries (new Outlook, Outlook on the web,
|
|
13
13
|
* webmails that drop `<style>`): MJML gives a stacked column `width:100%` and
|
|
14
|
-
* only widens it from the breakpoint up. Capping it inline at
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* only widens it from the breakpoint up. Capping it inline at its pixel width
|
|
15
|
+
* lets the columns sit side by side at the email's width and wrap on their own
|
|
16
|
+
* on a narrow screen.
|
|
17
|
+
*
|
|
18
|
+
* The cap is the exact width rounded down: the row (section `max-width` minus
|
|
19
|
+
* the padding and borders of its cell) × the column's share. Outlook's cell
|
|
20
|
+
* width is no cap: MJML rounds it, three thirds of 560 px are 187 + 187 + 187
|
|
21
|
+
* = 561 px and the third wraps. When the markup cannot be read, or disagrees
|
|
22
|
+
* with that cell by more than 1 px, the cell width minus half a pixel, floored.
|
|
17
23
|
* @param {string} html
|
|
18
24
|
*/
|
|
19
25
|
export function capColumnWidths(html: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "best-email-builder",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
4
4
|
"description": "Drag-and-drop email builder for React: MJML output that renders in Outlook, Gmail and Apple Mail, with server-side rendering, versions, variables and image uploads.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/renderer/prepareMjml.js","../src/core/mjmlAttributes.js","../src/core/mjmlDefaults.js","../src/features/brand/extract.js","../src/features/brand/messages.js","../src/renderer/columnAlignment.js","../src/renderer/mobileStyles.js","../src/renderer/compileEditorMjml.js"],"sourcesContent":["// @ts-check\n/**\n * Prepares MJML before compilation — shared by the server preview, the test\n * send and saving.\n *\n * The subject and the preview text (preheader) are METADATA of the template,\n * typed outside the canvas: they do not live in the engine project. They are\n * written here, into `<mj-head>`, at compile time:\n *\n * `<mj-title>` document title (browser tab, some webmails);\n * `<mj-preview>` the grey text that follows the subject in the inbox.\n *\n * `lang` is set when missing: otherwise screen readers read the message with\n * the voice of the system language.\n *\n * An image with no picture yet (`src` empty or missing — the canvas shows a\n * grey frame, AI drafts leave them for the user) is left out: sent, it would\n * be a broken image in every inbox (a red cross in Outlook). A preview keeps\n * it (`emptyImages: 'keep'`) to draw the frame that is still to fill.\n */\n\n/** An `<mj-image>` element, self-closing or not; its attributes in group 1. */\nconst MJ_IMAGE = /<mj-image\\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*?)\\s*(?:\\/>|>\\s*<\\/mj-image\\s*>)/gi;\nconst HAS_SRC = /\\ssrc\\s*=\\s*(?:\"\\s*[^\"\\s][^\"]*\"|'\\s*[^'\\s][^']*')/i;\n\n/**\n * How many images have no picture yet.\n * @param {string} mjml\n */\nexport function countImagesWithoutPicture(mjml) {\n return [...String(mjml || '').matchAll(MJ_IMAGE)].filter(([, attrs]) => !HAS_SRC.test(attrs)).length;\n}\n\nfunction escapeXml(text) {\n return String(text ?? '')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"');\n}\n\n/**\n * @param {string} mjml\n * @param {{title?: string|null, preheader?: string|null, lang?: string, emptyImages?: 'drop'|'keep'}} [meta]\n * @returns {string}\n */\nexport function prepareMjml(mjml, { title = null, preheader = null, lang = 'en', emptyImages = 'drop' } = {}) {\n let out = String(mjml || '')\n .replace(/<mj-title(?:\\s[^>]*)?>[\\s\\S]*?<\\/mj-title>/gi, '')\n .replace(/<mj-preview(?:\\s[^>]*)?>[\\s\\S]*?<\\/mj-preview>/gi, '');\n if (emptyImages !== 'keep') out = out.replace(MJ_IMAGE, (element, attrs) => (HAS_SRC.test(attrs) ? element : ''));\n\n out = out.replace(/<mjml(\\s[^>]*)?>/i, (tag, attrs = '') =>\n /\\slang\\s*=/.test(attrs) ? tag : `<mjml lang=\"${escapeXml(lang)}\"${attrs}>`\n );\n\n const head = [\n title && String(title).trim() ? `<mj-title>${escapeXml(String(title).trim())}</mj-title>` : '',\n preheader && String(preheader).trim() ? `<mj-preview>${escapeXml(String(preheader).trim())}</mj-preview>` : '',\n ].join('');\n if (!head) return out;\n\n if (/<mj-head(\\s[^>]*)?>/i.test(out)) {\n return out.replace(/<mj-head(\\s[^>]*)?>/i, (tag) => `${tag}${head}`);\n }\n return out.replace(/<mjml(\\s[^>]*)?>/i, (tag) => `${tag}<mj-head>${head}</mj-head>`);\n}\n","// @ts-check\n/**\n * MJML attributes — reading and writing properties panel values.\n *\n * This is knowledge of the LANGUAGE (MJML), not of the engine: it lives in\n * the core, and every adapter benefits from it.\n *\n * ── PADDING IS WRITTEN IN LONGHAND ─────────────────────────────────────────\n * An MJML element carries both `padding` and `padding-top/-right/-bottom/\n * -left`, and the longhand wins. The canvas, starting from the defaults\n * (`padding-top=\"10px\"`…), ignored a `padding=\"40px 60px\"` that the sent\n * email did apply: the screen lied. So `padding` is always written as four\n * attributes, and read back the same way.\n *\n * `inner-padding` (button) has no longhand in MJML: it stays as is.\n *\n * ── A BORDER IS ONE VALUE IN THE PANEL ──────────────────────────────────────\n * The panel edits a border as one value: one to four widths, a line style, a\n * color (\"2px 0px dashed #cccccc\"). Written, it becomes `border` when the four\n * sides are the same, `border-top`… otherwise; read, both come back as one.\n *\n * ── NO QUOTES IN A VALUE ───────────────────────────────────────────────────\n * The engine export writes attributes unescaped: a `\"` in a value would break\n * the MJML. Double quotes, angle brackets and line breaks are stripped on\n * write.\n */\n\n/** Spacing attributes that have a longhand form in MJML. */\nexport const LONGHAND_SPACING = new Set(['padding']);\n\nexport const SIDES = /** @type {const} */ (['top', 'right', 'bottom', 'left']);\n\n/** Border attributes edited as one value: `border` and its four sides. */\nexport const LONGHAND_BORDER = new Set(['border']);\n\n/** The line styles offered: CSS's, which the email clients draw (a dot-dash line is not one of them). */\nexport const BORDER_STYLES = /** @type {const} */ (['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge']);\n\n/** The widest border written, in pixels. */\nexport const MAX_BORDER = 20;\n\n/** Every CSS line style, to read what an email already has. */\nconst LINE_STYLES = new Set([...BORDER_STYLES, 'inset', 'outset', 'none', 'hidden']);\n/** CSS's width keywords, in pixels as browsers draw them. */\nconst WIDTH_KEYWORDS = { thin: 1, medium: 3, thick: 5 };\n\n/**\n * @typedef {{widths: [number, number, number, number], style: string, color: string}} Border\n * `widths`: in pixels, top, right, bottom, left; `color`: '' for the text's.\n */\n\n/**\n * A CSS border (\"2px dashed #cccccc\", in any order) or the panel's form, with\n * up to four widths (\"2px 0px dashed #cccccc\"). No border (`none`, `0`, no\n * style, nothing): null. Without a width, CSS's `medium` (3 px).\n * @param {string|null|undefined} value\n * @returns {Border|null}\n */\nexport function parseBorder(value) {\n const tokens = String(value || '').trim().match(/[^\\s(]+\\([^)]*\\)|\\S+/g) || [];\n /** @type {number[]} */\n const widths = [];\n let style = '';\n const color = [];\n for (const token of tokens) {\n const word = token.toLowerCase();\n if (/^(\\d+\\.?\\d*|\\.\\d+)(px)?$/.test(word)) widths.push(Number.parseFloat(word));\n else if (word in WIDTH_KEYWORDS) widths.push(WIDTH_KEYWORDS[/** @type {keyof typeof WIDTH_KEYWORDS} */ (word)]);\n else if (LINE_STYLES.has(word)) style = word;\n else color.push(token);\n }\n if (!style || style === 'none' || style === 'hidden') return null;\n const [t = 3, r = t, b = t, l = r] = widths.slice(0, 4).map((width) => Math.max(0, Math.min(MAX_BORDER, Math.round(width))));\n if (!t && !r && !b && !l) return null;\n return { widths: [t, r, b, l], style, color: color.join(' ') };\n}\n\n/**\n * The panel's form of a border: its widths in their shortest form, its style,\n * its color. No border: ''.\n * @param {Border|null} border\n */\nexport function formatBorder(border) {\n if (!border || border.widths.every((width) => !width)) return '';\n return [formatSpacing(border.widths.map((width) => `${width}px`)), border.style, border.color].filter(Boolean).join(' ');\n}\n\n/** One side's (or the four sides') CSS border. @param {Border} border @param {number} width */\nconst borderLine = (border, width) => [`${width}px`, border.style, border.color].filter(Boolean).join(' ');\n\n/**\n * \"10px 25px\" → ['10px', '25px', '10px', '25px'] (CSS 1-to-4 value rule).\n * @param {string|null|undefined} value\n * @returns {[string, string, string, string]}\n */\nexport function parseSpacing(value) {\n const parts = String(value || '')\n .trim()\n .split(/\\s+/)\n .filter(Boolean);\n const [a = '0px', b = a, c = a, d = b] = parts;\n return [a, b, c, d];\n}\n\n/**\n * Shortest form of a four-sided spacing.\n * @param {string[]} sides\n */\nexport function formatSpacing(sides) {\n const [t, r, b, l] = sides.map((s) => String(s || '0px'));\n if (t === b && r === l) return t === r ? t : `${t} ${r}`;\n if (r === l) return `${t} ${r} ${b}`;\n return `${t} ${r} ${b} ${l}`;\n}\n\n/** Attribute value safe for an unescaped export. @param {unknown} value */\nexport function cleanAttributeValue(value) {\n return String(value ?? '')\n .replace(/[\"<>\\r\\n]/g, '')\n .trim();\n}\n\n/**\n * Entered values → MJML attributes to set (`null` = attribute to remove).\n *\n * @param {Record<string, string|null|undefined>} values\n * @returns {Record<string, string|null>}\n */\nexport function toAttributes(values) {\n /** @type {Record<string, string|null>} */\n const out = {};\n for (const [key, raw] of Object.entries(values || {})) {\n const value = raw === null || raw === undefined ? '' : cleanAttributeValue(raw);\n if (LONGHAND_SPACING.has(key)) {\n const sides = value ? parseSpacing(value) : null;\n SIDES.forEach((side, i) => {\n out[`${key}-${side}`] = sides ? sides[i] : null;\n });\n out[key] = null;\n } else if (LONGHAND_BORDER.has(key)) {\n const border = parseBorder(value);\n const same = border && border.widths.every((width) => width === border.widths[0]);\n out[key] = border && same ? borderLine(border, border.widths[0]) : null;\n SIDES.forEach((side, i) => {\n out[`${key}-${side}`] = border && !same && border.widths[i] ? borderLine(border, border.widths[i]) : null;\n });\n } else {\n out[key] = value || null;\n }\n }\n return out;\n}\n\n/**\n * Element attributes → a block's property values.\n *\n * @param {Record<string, unknown>} attributes\n * @param {{key: string}[]} properties\n * @returns {Record<string, string>}\n */\nexport function toValues(attributes, properties) {\n /** @type {Record<string, string>} */\n const values = {};\n for (const { key } of properties) {\n if (LONGHAND_SPACING.has(key)) {\n const base = parseSpacing(String(attributes[key] ?? ''));\n const sides = SIDES.map((side, i) => {\n const v = attributes[`${key}-${side}`];\n return v === undefined || v === null || v === '' ? base[i] : String(v);\n });\n const hasAny = attributes[key] || SIDES.some((side) => attributes[`${key}-${side}`]);\n values[key] = hasAny ? formatSpacing(sides) : '';\n } else if (LONGHAND_BORDER.has(key)) {\n const base = parseBorder(String(attributes[key] ?? ''));\n // A side written on its own wins over `border` (`none` included).\n const sides = SIDES.map((side) => {\n const v = attributes[`${key}-${side}`];\n return v === undefined || v === null || v === '' ? undefined : parseBorder(String(v));\n });\n const line = base || sides.find(Boolean);\n const widths = /** @type {Border['widths']} */ (SIDES.map((_, i) => (sides[i] === undefined ? base?.widths[i] ?? 0 : sides[i]?.widths[0] ?? 0)));\n values[key] = line ? formatBorder({ ...line, widths }) : '';\n } else {\n const v = attributes[key];\n values[key] = v === undefined || v === null ? '' : String(v);\n }\n }\n return values;\n}\n\n/*\n * ── PHONE VALUES SIT BESIDE THE OTHERS ─────────────────────────────────────\n * An element keeps what it looks like on a phone as `mobile-<attribute>`\n * (`mobile-font-size=\"32px\"`, `mobile-padding-top=\"8px\"`): the compiled email\n * gives them to screens under the breakpoint, the editor shows them in its\n * Mobile view. A side stands for its attribute: a phone padding replaces the\n * whole padding, never half of it.\n */\nexport const MOBILE_PREFIX = 'mobile-';\n\n/** `padding-top` → `padding`. @param {string} key */\nexport const attributeOf = (key) => key.replace(/-(?:top|right|bottom|left)$/, '');\n\n/**\n * What a phone shows is the content of the email, not a copy of it: these are\n * the same on every screen, as is the layer under the whole content.\n */\nconst SHARED_ATTRIBUTES = new Set(['src', 'alt', 'href', 'title', 'name', 'background-url', 'css-class', 'mode', 'full-width', 'fluid-on-mobile', 'vertical-align', 'content-background-color']);\n\n/**\n * May an element have its own value of the attribute on a phone? The width of\n * the email or of a column cannot: on a phone the columns stack, full width.\n * @param {string} tag @param {string} key\n */\nexport function mobileAllowed(tag, key) {\n const name = attributeOf(key);\n return !SHARED_ATTRIBUTES.has(name) && !(name === 'width' && (tag === 'mj-body' || tag === 'mj-column'));\n}\n\n/** The attributes a phone overrides, by attribute (`padding` for all four sides). @param {Record<string, unknown>} attributes */\nexport function mobileOverrides(attributes) {\n return new Set(Object.keys(attributes).filter((key) => key.startsWith(MOBILE_PREFIX)).map((key) => attributeOf(key.slice(MOBILE_PREFIX.length))));\n}\n\n/** The attributes without their phone values. @template {Record<string, any>} T @param {T} attributes @returns {T} */\nexport function withoutMobile(attributes) {\n return /** @type {T} */ (Object.fromEntries(Object.entries(attributes).filter(([key]) => !key.startsWith(MOBILE_PREFIX))));\n}\n\n/** The attributes as a phone has them. @template {Record<string, any>} T @param {T} attributes @returns {T} */\nexport function withMobile(attributes) {\n const overrides = mobileOverrides(attributes);\n if (!overrides.size) return attributes;\n const out = Object.fromEntries(Object.entries(attributes).filter(([key]) => !key.startsWith(MOBILE_PREFIX) && !overrides.has(attributeOf(key))));\n for (const [key, value] of Object.entries(attributes)) if (key.startsWith(MOBILE_PREFIX)) out[key.slice(MOBILE_PREFIX.length)] = value;\n return /** @type {T} */ (out);\n}\n\n/**\n * Attributes to set (see toAttributes) → the phone's, for the ones it may have\n * its own of. A removed one (`null`) gives the phone the computer's value back.\n * @param {Record<string, string|null>} attributes @param {string} tag\n */\nexport function toMobileAttributes(attributes, tag) {\n return Object.fromEntries(Object.entries(attributes).map(([key, value]) => [mobileAllowed(tag, key) ? `${MOBILE_PREFIX}${key}` : key, value]));\n}\n","// @ts-check\n/**\n * MJML DEFAULTS — what MJML 5 renders when an attribute is not written.\n *\n * The properties panel shows them, greyed, in empty fields: an empty\n * \"Padding\" of a section is not \"0\" — MJML gives it 20 px above and below,\n * and the panel must say so (and start from there when one side is edited).\n *\n * Copied from the `defaultAttributes` of the mjml 5 components (the same\n * version the server and the canvas compile with); the unit tests check them\n * against the installed components.\n */\n\n/** @type {Record<string, Record<string, string>>} */\nexport const MJML_DEFAULTS = {\n 'mj-body': { width: '600px' },\n 'mj-section': {\n 'background-repeat': 'repeat',\n 'background-size': 'auto',\n 'background-position': 'top center',\n padding: '20px 0',\n 'text-align': 'center',\n },\n 'mj-wrapper': { 'background-repeat': 'repeat', 'background-size': 'auto', 'background-position': 'top center', padding: '20px 0' },\n 'mj-column': { 'vertical-align': 'top' },\n 'mj-text': {\n align: 'left',\n color: '#000000',\n 'font-family': 'Ubuntu, Helvetica, Arial, sans-serif',\n 'font-size': '13px',\n 'line-height': '1',\n padding: '10px 25px',\n },\n 'mj-image': { align: 'center', height: 'auto', padding: '10px 25px' },\n 'mj-button': {\n align: 'center',\n 'background-color': '#414141',\n 'border-radius': '3px',\n color: '#ffffff',\n 'font-family': 'Ubuntu, Helvetica, Arial, sans-serif',\n 'font-size': '13px',\n 'font-weight': 'normal',\n 'inner-padding': '10px 25px',\n 'line-height': '120%',\n padding: '10px 25px',\n },\n 'mj-divider': { 'border-color': '#000000', 'border-style': 'solid', 'border-width': '4px', padding: '10px 25px', width: '100%', align: 'center' },\n 'mj-spacer': { height: '20px' },\n 'mj-social': {\n align: 'center',\n 'border-radius': '3px',\n 'icon-size': '20px',\n mode: 'horizontal',\n padding: '10px 25px',\n },\n 'mj-social-element': { 'border-radius': '3px', padding: '4px' },\n 'mj-navbar': { align: 'center' },\n 'mj-navbar-link': {\n color: '#000000',\n 'font-family': 'Ubuntu, Helvetica, Arial, sans-serif',\n 'font-size': '13px',\n 'font-weight': 'normal',\n 'line-height': '22px',\n padding: '15px 10px',\n 'text-transform': 'uppercase',\n },\n 'mj-hero': { 'background-color': '#ffffff', padding: '0px' },\n};\n","// @ts-check\n/**\n * BRAND FROM A WEBSITE — what a company's home page says about its look:\n * its name, where its logo is, its main color, the color of its headings\n * and its font.\n *\n * Pure text work on what the server downloaded (src/server/brandImport.js\n * does the downloading, with its safety rules): no network, no DOM, so it\n * runs anywhere and is tested on fixtures.\n *\n * name og:site_name → JSON-LD Organization → application-name → the\n * part of <title> that matches the domain → the domain;\n * logo JSON-LD Organization logo → an <img> called \"logo\" (header\n * first) → apple-touch-icon; SVG and WebP are skipped later\n * (most email apps do not show them);\n * colors counted in the CSS, weighted by where they are used (buttons,\n * links, custom properties named primary/brand/accent, the\n * theme-color meta); grays, alert and social colors set aside;\n * font the body's, mapped to the nearest web-safe stack.\n */\n\nimport { FONT_OPTIONS, PALETTE } from '../../blocks/shared.js';\nimport { contrastRatio, parseColor, toHex, toHsl } from './brand.js';\n\n/**\n * @typedef {{\n * name: string,\n * logos: {url: string, from: 'schema'|'img'|'icon'}[],\n * stylesheets: string[],\n * css: string,\n * themeColor: string,\n * }} PageReading\n */\n\n/* ── HTML ───────────────────────────────────────────────────────────────── */\n\n/** @param {string} text */\nfunction decodeEntities(text) {\n return String(text ?? '')\n .replace(/&#x([0-9a-f]+);/gi, (_, hex) => String.fromCodePoint(parseInt(hex, 16)))\n .replace(/&#(\\d+);/g, (_, dec) => String.fromCodePoint(Number(dec)))\n .replace(/"/g, '\"')\n .replace(/'|'/g, \"'\")\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/ /g, ' ')\n .replace(/&/g, '&');\n}\n\n/**\n * The attributes of one start tag, names in lower case.\n * @param {string} tag `<img src=\"…\" class=logo>`\n * @returns {Record<string, string>}\n */\nexport function tagAttributes(tag) {\n /** @type {Record<string, string>} */\n const attributes = {};\n const inner = tag.replace(/^<[^\\s>/]+/, '').replace(/\\/?>$/, '');\n const pattern = /([^\\s\"'=<>/]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]+)))?/g;\n let match;\n while ((match = pattern.exec(inner))) {\n const name = match[1].toLowerCase();\n if (!(name in attributes)) attributes[name] = decodeEntities(match[2] ?? match[3] ?? match[4] ?? '');\n }\n return attributes;\n}\n\n/** @param {string} html @param {string} name */\nconst startTags = (html, name) => html.match(new RegExp(`<${name}\\\\b[^>]*>`, 'gi')) || [];\n\n/** An http(s) address, resolved against the page; '' otherwise. @param {string|undefined} href @param {string} base */\nfunction resolve(href, base) {\n const value = String(href ?? '').trim();\n if (!value || /^(data|javascript|blob):/i.test(value)) return '';\n try {\n const url = new URL(value, base);\n return url.protocol === 'https:' || url.protocol === 'http:' ? url.href : '';\n } catch {\n return '';\n }\n}\n\n/** The largest image of a srcset (\"a.png 1x, a@2x.png 2x\"). @param {string} srcset */\nfunction largestOf(srcset) {\n let best = { url: '', size: 0 };\n for (const part of srcset.split(/,\\s+/)) {\n const [url, descriptor = '1x'] = part.trim().split(/\\s+/);\n const size = parseFloat(descriptor) * (descriptor.endsWith('w') ? 1 : 1000);\n if (url && size > best.size) best = { url, size };\n }\n return best.url;\n}\n\n/** Objects of a JSON-LD script, flattened (@graph, arrays). @param {unknown} value @returns {any[]} */\nfunction jsonLdNodes(value) {\n if (Array.isArray(value)) return value.flatMap(jsonLdNodes);\n if (!value || typeof value !== 'object') return [];\n const node = /** @type {any} */ (value);\n return [node, ...jsonLdNodes(node['@graph']), ...jsonLdNodes(node.publisher), ...jsonLdNodes(node.brand)];\n}\n\nconst ORGANIZATION = /organization|corporation|business|brand|store|restaurant|company|ngo|school|airline|bank|agency/i;\n\n/** The words of a host name that name the company: \"www.acme-corp.co.uk\" → \"acme corp\". @param {string} host */\nfunction hostWords(host) {\n const labels = host.toLowerCase().replace(/^www\\d?\\./, '').split('.');\n const main = labels.length > 2 && labels[labels.length - 2].length <= 3 ? labels[labels.length - 3] : labels[0];\n return main.replace(/[-_]+/g, ' ');\n}\n\n/** @param {string} text */\nconst squash = (text) => text.toLowerCase().replace(/[^a-z0-9À-]+/g, '');\n\n/** @param {unknown} value */\nconst cleanName = (value) =>\n decodeEntities(String(value ?? ''))\n .replace(/\\s+/g, ' ')\n .trim()\n .slice(0, 80);\n\n/**\n * What a home page says about its brand.\n * @param {string} html\n * @param {string} pageUrl the address it was read from (after redirects)\n * @returns {PageReading}\n */\nexport function readPage(html, pageUrl) {\n const source = String(html ?? '');\n const head = source.slice(0, 400_000);\n const baseTag = startTags(head, 'base').map(tagAttributes).find((a) => a.href);\n const base = resolve(baseTag?.href, pageUrl) || pageUrl;\n const host = (() => {\n try {\n return new URL(pageUrl).hostname;\n } catch {\n return '';\n }\n })();\n\n /** @type {Record<string, string>} */\n const meta = {};\n for (const attributes of startTags(head, 'meta').map(tagAttributes)) {\n const key = (attributes.property || attributes.name || '').toLowerCase();\n if (key && attributes.content && !(key in meta)) meta[key] = attributes.content;\n }\n\n // JSON-LD: the organization's own name and logo, when the site states them.\n let schemaName = '';\n let schemaLogo = '';\n for (const [, body] of source.matchAll(/<script\\b[^>]*type\\s*=\\s*[\"']?application\\/ld\\+json[^>]*>([\\s\\S]*?)<\\/script>/gi)) {\n let data;\n try {\n data = JSON.parse(body.trim());\n } catch {\n continue;\n }\n for (const node of jsonLdNodes(data)) {\n const types = [].concat(node['@type'] || []).join(' ');\n if (!ORGANIZATION.test(types)) continue;\n if (!schemaName && typeof node.name === 'string') schemaName = node.name;\n const logo = typeof node.logo === 'string' ? node.logo : node.logo?.url || node.logo?.contentUrl || '';\n if (!schemaLogo && typeof logo === 'string') schemaLogo = resolve(logo, base);\n }\n }\n\n /* Name */\n const title = cleanName(head.match(/<title\\b[^>]*>([\\s\\S]*?)<\\/title>/i)?.[1] || '');\n const words = hostWords(host);\n const fromTitle =\n title\n .split(/\\s+[|–—:·•»-]\\s+/)\n .map((part) => part.trim())\n .find((part) => part && squash(part).length <= 40 && (squash(part).includes(squash(words)) || squash(words).includes(squash(part)))) || '';\n const fromHost = words.replace(/\\b\\p{L}/gu, (letter) => letter.toUpperCase());\n const name = cleanName(meta['og:site_name'] || schemaName || meta['application-name'] || fromTitle || fromHost);\n\n /* Logo candidates, best first */\n /** @type {PageReading['logos']} */\n const logos = [];\n const add = (/** @type {string} */ url, /** @type {PageReading['logos'][number]['from']} */ from) => {\n if (url && !logos.some((logo) => logo.url === url)) logos.push({ url, from });\n };\n add(schemaLogo, 'schema');\n /** @type {{url: string, score: number}[]} */\n const images = [];\n const headerEnd = (() => {\n const at = source.search(/<\\/header>/i);\n return at > 0 ? at : Math.min(source.length, 20_000);\n })();\n for (const match of source.matchAll(/<img\\b[^>]*>/gi)) {\n const attributes = tagAttributes(match[0]);\n const own = [attributes.class, attributes.id, attributes.alt, attributes.src, attributes['data-src']].join(' ').toLowerCase();\n const before = source.slice(Math.max(0, (match.index ?? 0) - 400), match.index).toLowerCase();\n const parent = /<(a|div|span|figure|picture)\\b[^>]*(class|id)\\s*=\\s*[\"'][^\"']*logo[^\"']*[\"'][^>]*>[^<]*(<source\\b[^>]*>\\s*)*$/i.test(before);\n if (!own.includes('logo') && !parent) continue;\n // Partner, client and payment logos are someone else's.\n if (/partner|client|customer|sponsor|award|payment|badge|trust|press|app-?store|google-?play/.test(own)) continue;\n const url = resolve(attributes.srcset ? largestOf(attributes.srcset) : attributes.src || attributes['data-src'] || '', base);\n if (!url) continue;\n let score = own.includes('logo') ? 3 : 2;\n if ((match.index ?? 0) < headerEnd) score += 3;\n if (name && squash(attributes.alt || '').includes(squash(name))) score += 2;\n if (/footer/.test(own)) score -= 2;\n images.push({ url, score: score - images.length * 0.01 });\n }\n images.sort((a, b) => b.score - a.score).forEach((image) => add(image.url, 'img'));\n /** @type {{url: string, size: number}[]} */\n const icons = [];\n for (const attributes of startTags(head, 'link').map(tagAttributes)) {\n const rel = (attributes.rel || '').toLowerCase();\n if (!/apple-touch-icon|icon/.test(rel)) continue;\n const size = parseInt(attributes.sizes || (rel.includes('apple') ? '180' : '0'), 10) || 0;\n if (size >= 96) icons.push({ url: resolve(attributes.href, base), size });\n }\n icons.sort((a, b) => b.size - a.size).forEach((icon) => add(icon.url, 'icon'));\n\n /* Styles */\n const stylesheets = startTags(head, 'link')\n .map(tagAttributes)\n .filter((a) => /(^|\\s)stylesheet(\\s|$)/i.test(a.rel || '') && !/^print$/i.test((a.media || '').trim()))\n .map((a) => resolve(a.href, base))\n .filter(Boolean)\n // Fonts and third-party widgets say nothing about the brand's colors.\n .filter((href) => !/fonts\\.googleapis|use\\.typekit|fontawesome|cookie|consent|onetrust/i.test(href));\n const css = [\n ...[...source.matchAll(/<style\\b[^>]*>([\\s\\S]*?)<\\/style>/gi)].map((m) => m[1]),\n // Inline styles of buttons and links count too: `<a class=\"btn\" style=\"…\">`.\n ...[...source.matchAll(/<(a|button)\\b[^>]*>/gi)]\n .map((m) => tagAttributes(m[0]))\n .filter((a) => a.style)\n .map((a) => `${/btn|button|cta/i.test(a.class || '') ? '.btn' : 'a'}{${a.style}}`),\n ].join('\\n');\n\n return {\n name,\n logos,\n stylesheets: [...new Set(stylesheets)],\n css,\n themeColor: meta['theme-color'] || meta['msapplication-tilecolor'] || '',\n };\n}\n\n/* ── CSS ────────────────────────────────────────────────────────────────── */\n\nconst PRIMARY_NAME = /primary|brand|accent|main|theme|highlight|cta/i;\nconst NOT_A_BRAND_NAME = /text|foreground|fg|border|muted|gr[ae]y|neutral|surface|shadow|overlay|success|error|danger|warning|info|disabled|placeholder/i;\nconst NOISE = /error|danger|success|warning|alert|invalid|valid\\b|notice|toast|badge|disabled|facebook|twitter|linkedin|instagram|youtube|whatsapp|pinterest|tiktok|social|cookie|consent|onetrust|ot-|cmp|gdpr|wp-block|has-[\\w-]+-(background-)?color|syntax|hljs|code/i;\nconst COLOR_IN_VALUE = /#[0-9a-f]{3,8}\\b|rgba?\\([^)]*\\)|hsla?\\([^)]*\\)/gi;\nconst COLOR_PROPERTY = /^(color|background|background-color|border|border-color|border-(top|bottom|left|right)(-color)?|fill|stroke|outline(-color)?|text-decoration-color|accent-color|caret-color)$/;\n\n/** @param {string} css */\nconst stripComments = (css) => css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n\n/** Rules as [selector, declarations], @media flattened. @param {string} css */\nfunction rulesOf(css) {\n /** @type {[string, [string, string][]][]} */\n const rules = [];\n for (const [, selector, body] of stripComments(css).matchAll(/([^{}]+)\\{([^{}]*)\\}/g)) {\n const declarations = body\n .split(';')\n .map((part) => {\n const colon = part.indexOf(':');\n return /** @type {[string, string]} */ ([part.slice(0, colon).trim().toLowerCase(), part.slice(colon + 1).trim()]);\n })\n .filter(([property, value]) => property && value);\n if (declarations.length) rules.push([selector.trim(), declarations]);\n }\n return rules;\n}\n\n/**\n * A custom property's value as a color: `#2977bc`, `rgb(…)`, and the bare\n * channels design systems keep there (`41 119 188`, `210 64% 45%`).\n * @param {string} value\n */\nfunction customColor(value) {\n const direct = parseColor(value.replace(/\\s*!important$/, ''));\n if (direct) return direct;\n if (/^\\d{1,3}(\\.\\d+)?\\s+\\d{1,3}(\\.\\d+)?\\s+\\d{1,3}(\\.\\d+)?$/.test(value)) return parseColor(`rgb(${value})`);\n if (/^\\d{1,3}(\\.\\d+)?(deg)?\\s+\\d{1,3}(\\.\\d+)?%\\s+\\d{1,3}(\\.\\d+)?%$/.test(value)) return parseColor(`hsl(${value.replace('deg', '')})`);\n return null;\n}\n\n/**\n * `var(--x, fallback)` replaced by what --x holds, a few levels deep.\n * @param {string} value @param {Map<string, string>} custom\n */\nfunction resolveVars(value, custom) {\n let out = value;\n for (let depth = 0; depth < 4 && out.includes('var('); depth += 1) {\n out = out.replace(/var\\(\\s*(--[\\w-]+)\\s*(?:,\\s*([^()]*(?:\\([^()]*\\))?[^()]*))?\\)/g, (_, name, fallback) => custom.get(name) ?? fallback ?? '');\n }\n return out;\n}\n\n/** @param {{r: number, g: number, b: number}} a @param {{r: number, g: number, b: number}} b */\nconst distance = (a, b) => Math.hypot(a.r - b.r, a.g - b.g, a.b - b.b);\n\n/** Colors of one value, as found (not resolved through var()). @param {string} value */\nconst colorsIn = (value) => (value.match(COLOR_IN_VALUE) || []).map((text) => parseColor(text)).filter((c) => c && c.a >= 0.6);\n\n/**\n * The web-safe stack nearest to a CSS font-family.\n * @param {string} family\n * @returns {string|undefined}\n */\nexport function nearestFont(family) {\n const stack = String(family ?? '')\n .toLowerCase()\n .replace(/[\"']/g, '');\n if (!stack.trim() || /^(inherit|initial|unset|revert)$/.test(stack.trim())) return undefined;\n const first = stack.split(',')[0].trim();\n const known = FONT_OPTIONS.find((option) => first.startsWith(option.label.toLowerCase()));\n if (known) return known.value;\n if (/^helvetica/.test(first)) return FONT_OPTIONS[0].value;\n if (/^times/.test(first)) return FONT_OPTIONS.find((o) => o.label === 'Times')?.value;\n if (/monospace|mono\\b|courier|consolas/.test(stack)) return FONT_OPTIONS.find((o) => o.label === 'Courier')?.value;\n // Web fonts: their family decides (serif, else sans-serif).\n if (/(^|,)\\s*serif\\s*(,|$)|garamond|playfair|merriweather|lora|baskerville|caslon|didot|bodoni|crimson|libre baskerville|source serif|noto serif|pt serif/.test(stack)) {\n return FONT_OPTIONS.find((o) => o.label === 'Georgia')?.value;\n }\n return FONT_OPTIONS[0].value;\n}\n\n/**\n * Main color, headings color and font of a site, from its CSS.\n * @param {{css: string, themeColor?: string}} input\n * @returns {{primary?: string, heading?: string, font?: string}}\n */\nexport function brandFromCss({ css, themeColor = '' }) {\n const rules = rulesOf(String(css ?? ''));\n\n /** @type {Map<string, string>} */\n const custom = new Map();\n for (const [selector, declarations] of rules) {\n // :root first: a theme's dark variant must not replace it.\n const root = /^(:root|html|body|\\*)(\\s*,|$)/i.test(selector);\n for (const [property, value] of declarations) {\n if (property.startsWith('--') && (root || !custom.has(property))) custom.set(property, value.replace(/\\s*!important$/, ''));\n }\n }\n\n /** @type {{color: {r: number, g: number, b: number}, weight: number}[]} */\n const found = [];\n /** @type {{color: {r: number, g: number, b: number}, weight: number}[]} */\n const darkText = [];\n /** @type {{font: string, weight: number}[]} */\n const fonts = [];\n const count = (/** @type {{r: number, g: number, b: number}} */ color, /** @type {number} */ weight) => found.push({ color, weight });\n\n for (const [selector, declarations] of rules) {\n if (selector.startsWith('@')) continue;\n const noise = NOISE.test(selector);\n const emphasis = /btn|button|cta|primary|brand|accent|hero|highlight/i.test(selector) ? 4 : /(^|[\\s,>+~])a([:.[\\s,]|$)|link/i.test(selector) ? 2 : 1;\n const isHeading = /(^|[\\s,>])h[1-3]\\b|title|heading|headline/i.test(selector);\n const isBody = /^(html|body|:root)(\\s*,|$)|(^|,)\\s*(html|body)\\s*(,|$)/i.test(selector);\n for (const [property, raw] of declarations) {\n if (property.startsWith('--')) {\n const color = customColor(resolveVars(raw, custom));\n if (color && color.a >= 0.6 && PRIMARY_NAME.test(property) && !NOT_A_BRAND_NAME.test(property)) count(color, 10);\n continue;\n }\n const value = resolveVars(raw, custom);\n if (property === 'font-family' || property === 'font') {\n const family = property === 'font' ? value.replace(/^.*?\\d[\\w%.]*(\\/[\\w%.]+)?\\s+/, '') : value;\n if (isBody || isHeading) fonts.push({ font: family, weight: isBody ? 2 : 1 });\n continue;\n }\n if (!COLOR_PROPERTY.test(property) || noise) continue;\n for (const color of colorsIn(value)) {\n if (!color) continue;\n count(color, emphasis * (property.startsWith('background') ? 1.5 : 1));\n if (property === 'color' && (isHeading || isBody)) darkText.push({ color, weight: isHeading ? 2 : 1 });\n }\n }\n }\n const theme = parseColor(themeColor);\n if (theme && theme.a >= 0.6) count(theme, 15);\n\n // Near colors are one color (hover shades, rounding).\n /** @type {{color: {r: number, g: number, b: number}, weight: number}[]} */\n const clusters = [];\n for (const entry of found) {\n const near = clusters.find((cluster) => distance(cluster.color, entry.color) < 24);\n if (near) near.weight += entry.weight;\n else clusters.push({ ...entry });\n }\n clusters.sort((a, b) => b.weight - a.weight);\n const primary = clusters.find(({ color }) => {\n const { s, l } = toHsl(color);\n return s >= 0.25 && l >= 0.15 && l <= 0.85;\n });\n\n /** @type {{primary?: string, heading?: string, font?: string}} */\n const result = {};\n if (primary) result.primary = toHex(primary.color);\n\n const dark = darkText\n .filter(({ color }) => toHsl(color).l < 0.3)\n .reduce((/** @type {Map<string, number>} */ map, { color, weight }) => map.set(toHex(color), (map.get(toHex(color)) || 0) + weight), new Map());\n const heading = [...dark.entries()].sort((a, b) => b[1] - a[1])[0]?.[0];\n if (heading) result.heading = heading;\n else if (result.primary && contrastRatio(result.primary, PALETTE.white) >= 7) result.heading = result.primary;\n else result.heading = PALETTE.ink;\n\n const font = fonts.sort((a, b) => b.weight - a.weight).map(({ font }) => nearestFont(font)).find(Boolean);\n if (font) result.font = font;\n return result;\n}\n\n/* ── Images ─────────────────────────────────────────────────────────────── */\n\n/**\n * Width and height of a PNG, GIF or JPEG, from its header; null otherwise.\n * @param {Uint8Array} bytes\n * @returns {{width: number, height: number}|null}\n */\nexport function imageSize(bytes) {\n if (!bytes || bytes.length < 24) return null;\n const at = (/** @type {number} */ i) => bytes[i];\n // PNG: IHDR right after the signature.\n if (at(0) === 0x89 && at(1) === 0x50 && at(2) === 0x4e && at(3) === 0x47) {\n const read32 = (/** @type {number} */ i) => ((at(i) << 24) | (at(i + 1) << 16) | (at(i + 2) << 8) | at(i + 3)) >>> 0;\n return { width: read32(16), height: read32(20) };\n }\n // GIF: logical screen size.\n if (at(0) === 0x47 && at(1) === 0x49 && at(2) === 0x46) {\n return { width: at(6) | (at(7) << 8), height: at(8) | (at(9) << 8) };\n }\n // JPEG: the first start-of-frame marker.\n if (at(0) === 0xff && at(1) === 0xd8) {\n let i = 2;\n while (i + 9 < bytes.length) {\n if (at(i) !== 0xff) {\n i += 1;\n continue;\n }\n const marker = at(i + 1);\n if (marker === 0xd8 || marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7) || marker === 0xff) {\n i += marker === 0xff ? 1 : 2;\n continue;\n }\n const length = (at(i + 2) << 8) | at(i + 3);\n if (marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc) {\n return { height: (at(i + 5) << 8) | at(i + 6), width: (at(i + 7) << 8) | at(i + 8) };\n }\n i += 2 + length;\n }\n }\n return null;\n}\n\n/**\n * The width a logo is shown at in an email: a wordmark wider, a square mark\n * smaller; never wider than the image itself (a blurry logo is worse than a\n * small one). Retina images (twice the size shown) are common: halved first.\n * @param {{width: number, height: number}} size\n */\nexport function logoWidthFor({ width, height }) {\n if (!width || !height) return 140;\n const ratio = width / height;\n const shown = width >= 240 ? width / 2 : width;\n const target = ratio >= 2.5 ? 180 : ratio >= 1.3 ? 140 : 72;\n return Math.max(24, Math.round(Math.min(target, shown)));\n}\n","// @ts-check\n/**\n * What the user is told about reading a brand from a website: why it failed\n * (the server's answer) and what it could not find (notes under the field).\n * English source strings, translated where they are shown.\n */\n\n/**\n * Why a website could not be read: [HTTP status, message], by\n * BrandImportError code (src/server/brandImport.js).\n * @type {Record<string, [number, string]>}\n */\nexport const BRAND_IMPORT_ERRORS = {\n BAD_URL: [400, 'Enter the address of a website, like acme.com'],\n PRIVATE_ADDRESS: [400, 'This address is not a public website'],\n UNREACHABLE: [422, 'The website could not be reached. Check the address.'],\n TIMEOUT: [422, 'The website took too long to answer'],\n HTTP_ERROR: [422, 'The website does not let the builder read it. Fill in your brand below.'],\n NOT_HTML: [422, 'This address is not a web page'],\n TOO_MANY_REDIRECTS: [422, 'The website redirects too many times'],\n TOO_LARGE: [422, 'The website sent too much data'],\n};\n\n/** What could not be read, by note code. @type {Record<string, string>} */\nexport const BRAND_NOTES = {\n LOGO_NOT_FOUND: 'No logo was found on the website. Upload it below.',\n LOGO_UNSUPPORTED: 'The logo on the website is an SVG or WebP image, which most email apps do not show. Upload a PNG or JPEG version.',\n LOGO_ICON: 'The website icon is used as the logo. Upload your full logo if you have one.',\n COLORS_NOT_FOUND: 'No main color was found on the website. Pick one below.',\n};\n","// @ts-check\nimport { parseMjml, serializeMjml } from '../engine/mjml.js';\nimport { createNode, findFirst, walk } from '../engine/model.js';\n\n/**\n * MJML uses inline blocks outside Outlook. They have independent heights,\n * and mixed middle/top alignment uses a text baseline instead of the row.\n * Use equal-height table cells for every desktop row with multiple columns.\n * Outlook keeps MJML's native conditional table. Mobile stacking is unchanged.\n * This runs inside the compiler, after validation, so callers cannot supply\n * arbitrary raw HTML or CSS through the document.\n * @param {string} source\n */\nexport function prepareColumnAlignment(source) {\n if ((source.match(/<mj-(?:column|group)\\b/g) || []).length < 2 || source.includes('eb-va-row')) return source;\n const root = parseMjml(source);\n let changed = false;\n const backgrounds = [];\n let count = 0;\n walk(root, (node) => {\n if (!['mj-section', 'mj-group'].includes(node.tag)) return;\n const columns = node.children.filter((child) => child.tag === 'mj-column' || child.tag === 'mj-group');\n if (columns.length < 2) return;\n changed = true;\n for (const column of columns) {\n column.attributes['css-class'] = `${column.attributes['css-class'] || ''} eb-va-col`.trim();\n const color = column.attributes['background-color'] || '';\n if (/^(?:#[\\da-f]{3,8}|[a-z]+|rgba?\\([\\d\\s.,%]+\\)|hsla?\\([\\d\\s.,%]+\\))$/i.test(color) && !column.attributes['css-class'].includes('eb-render-box-')) {\n const marker = `eb-va-bg-${count++}`;\n column.attributes['css-class'] += ` ${marker}`;\n backgrounds.push(`.${marker} {background-color:${color};}`);\n }\n }\n node.children = [\n createNode('mj-raw', { content: '<!--[if !mso]><!--><div class=\"eb-va-row\"><!--<![endif]-->' }),\n ...node.children,\n createNode('mj-raw', { content: '<!--[if !mso]><!--></div><!--<![endif]-->' }),\n ];\n });\n if (!changed) return source;\n let head = findFirst(root, 'mj-head');\n if (!head) {\n head = createNode('mj-head');\n root.children.unshift(head);\n }\n const width = findFirst(head, 'mj-breakpoint')?.attributes.width || '';\n const breakpoint = /^\\d+(?:\\.\\d+)?px$/.test(width) ? width : '480px';\n head.children.push(createNode('mj-style', { content:\n `@media only screen and (min-width:${breakpoint}) {` +\n '.eb-va-row {display:table;width:100%;table-layout:fixed;}' +\n '.eb-va-row > .eb-va-col {display:table-cell!important;}' +\n '}' +\n // Undo the inline px cap of `capColumnWidths` on phones: columns stack full width.\n `@media only screen and (max-width:${Number.parseFloat(breakpoint) - 1}px) {.eb-va-col {max-width:100%!important;}}` }));\n if (backgrounds.length) head.children.push(createNode('mj-style', { attributes: { inline: 'inline' }, content: backgrounds.join('') }));\n return serializeMjml(root);\n}\n\n/**\n * Columns side by side without media queries (new Outlook, Outlook on the web,\n * webmails that drop `<style>`): MJML gives a stacked column `width:100%` and\n * only widens it from the breakpoint up. Capping it inline at the pixel width\n * MJML computed for Outlook's table lets the columns sit side by side at the\n * email's width and wrap on their own on a narrow screen.\n * @param {string} html\n */\nexport function capColumnWidths(html) {\n return html.replace(\n /(<td\\b[^>]*?\\bstyle=\"[^\"]*?\\bwidth:(\\d+(?:\\.\\d+)?)px;[^\"]*\"[^>]*>(?:\\s*<!\\[endif\\]-->)?\\s*<div\\s+class=\"[^\"]*\\beb-va-col\\b[^\"]*\"\\s+style=\"[^\"]*?)\\bwidth:100%;/g,\n (_, before, width) => `${before}width:100%;max-width:${Math.floor(Number(width))}px;`\n );\n}\n","// @ts-check\n/**\n * PHONE STYLES — the `mobile-*` values of the elements, in the sent email.\n *\n * MJML has no attribute per screen. So the email is compiled twice, once as a\n * computer shows it and once as a phone does (each element's `mobile-*`\n * values in place of its own), and every tag whose styles differ between the\n * two gets a class and, under the breakpoint, the phone's styles with\n * `!important` (they beat the inline ones). Whatever MJML turns an attribute\n * into — a style on a cell, on a link, on a picture — the phone gets it,\n * with no table of what goes where.\n *\n * Only styles change between the two: the attributes that would change the\n * markup itself (an address, a picture, full width) are the same on every\n * screen (see mobileAllowed). If the two still differ in their tags, the\n * phone keeps the computer's look rather than a wrong one, and the compiler\n * says so (MOBILE_MISMATCH).\n */\n\nimport { parseMjml, serializeMjml } from '../engine/mjml.js';\nimport { findFirst, walk } from '../engine/model.js';\nimport { attributeOf, mobileOverrides, withMobile, withoutMobile } from '../core/mjmlAttributes.js';\n\n/**\n * The editor's box controls are added around an element only when it has one,\n * and MJML adds a table inside a column only when it has a padding: both\n * versions must have the same.\n * @param {string} tag @param {string} key\n */\nconst isBox = (tag, key) => key === 'margin' || key.startsWith('box-') || (tag === 'mj-column' && key === 'padding');\n\n/**\n * The email as a computer shows it and as a phone does, or null when no\n * element has a phone value.\n * @param {string} source\n * @returns {{desktop: string, mobile: string, breakpoint: number}|null}\n */\nexport function splitDevices(source) {\n if (!/\\smobile-[a-z-]+\\s*=/.test(source)) return null;\n const root = parseMjml(source);\n /** @type {[import('../engine/model.js').EmailNode, Record<string, string>][]} */\n const phones = [];\n walk(root, (node) => {\n const overrides = mobileOverrides(node.attributes);\n if (!overrides.size) return;\n const own = withoutMobile(node.attributes);\n for (const key of overrides) {\n if (isBox(node.tag, key) && !Object.keys(own).some((name) => attributeOf(name) === key)) own[key] = key.includes('border') ? 'none' : '0px';\n }\n phones.push([node, withMobile({ ...node.attributes, ...own })]);\n node.attributes = own;\n });\n const desktop = serializeMjml(root);\n for (const [node, attributes] of phones) node.attributes = attributes;\n const width = Number.parseFloat(findFirst(root, 'mj-breakpoint')?.attributes.width || '') || 480;\n return { desktop, mobile: serializeMjml(root), breakpoint: width };\n}\n\nexport const MOBILE_MISMATCH = 'Phone styles not applied: the phone version is built differently, so phones show the desktop styles. Undo the last phone change, or use \"Same as desktop\" on the element.';\n\nconst TAGS = /<!--[\\s\\S]*?-->|<([a-z][\\w:-]*)\\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/gi;\n\n/** @param {string} attributes @param {string} name */\nconst attribute = (attributes, name) => new RegExp(`\\\\s${name}=\"([^\"]*)\"`, 'i').exec(attributes)?.[1];\n\n/** An attribute's text as the stylesheet must have it (`"Arial"` → `\"Arial\"`). @param {string} value */\nconst decoded = (value) =>\n value.replace(/"/g, '\"').replace(/'|'/g, \"'\").replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');\n\n/**\n * The phone's styles leave the cells for a stylesheet: nothing in them may\n * close a rule, open another or reach a script.\n * @param {string} property @param {string} value\n */\nconst safe = (property, value) => /^-?[a-z][a-z-]*$/.test(property) && !/[{}<>@\\\\]|expression\\s*\\(|javascript:|behavior\\s*:/i.test(value);\n\n/** `a:1;b:2` → {a: '1', b: '2'}, with the sizing attributes of old HTML as the styles they are. @param {string} attributes */\nfunction stylesOf(attributes) {\n /** @type {Map<string, string>} */\n const styles = new Map();\n for (const [name, property] of [['width', 'width'], ['height', 'height'], ['bgcolor', 'background-color']]) {\n const value = attribute(attributes, name);\n if (value) styles.set(property, /^\\d+(?:\\.\\d+)?$/.test(value) ? `${value}px` : decoded(value));\n }\n for (const declaration of decoded(attribute(attributes, 'style') || '').split(';')) {\n const colon = declaration.indexOf(':');\n if (colon > 0) styles.set(declaration.slice(0, colon).trim().toLowerCase(), declaration.slice(colon + 1).trim());\n }\n for (const [property, value] of styles) {\n if (!safe(property, value)) styles.delete(property);\n }\n return styles;\n}\n\n/** @param {string} html */\nfunction tagsOf(html) {\n return [...html.matchAll(TAGS)].filter((match) => match[1]).map((match) => ({ index: /** @type {number} */ (match.index), text: match[0], name: match[1].toLowerCase(), attributes: match[2] }));\n}\n\n/**\n * The computer's HTML, its tags that look different on a phone marked, and the\n * phone's styles for them under the breakpoint; null when the two are not\n * built alike.\n * @param {string} desktop @param {string} mobile @param {number} breakpoint\n * @returns {string|null}\n */\nexport function mergeDevices(desktop, mobile, breakpoint) {\n const computer = tagsOf(desktop);\n const phone = tagsOf(mobile);\n if (computer.length !== phone.length || computer.some((tag, index) => tag.name !== phone[index].name)) return null;\n const rules = [];\n let html = desktop;\n for (let index = computer.length - 1; index >= 0; index -= 1) {\n const tag = computer[index];\n if (tag.attributes === phone[index].attributes) continue;\n const before = stylesOf(tag.attributes);\n const after = stylesOf(phone[index].attributes);\n const declarations = [...after].filter(([property, value]) => before.get(property) !== value).map(([property, value]) => `${property}:${value}!important`);\n for (const property of before.keys()) if (!after.has(property)) declarations.push(`${property}:initial!important`);\n const name = `eb-m${index}`;\n // An alignment is an attribute of the cell: its text, and the table in it (a button, a picture).\n const align = attribute(phone[index].attributes, 'align');\n if (align && align !== attribute(tag.attributes, 'align') && /^(?:left|center|right)$/.test(align)) {\n declarations.push(`text-align:${align}!important`);\n rules.unshift(`.${name}>table{margin-left:${align === 'left' ? '0' : 'auto'}!important;margin-right:${align === 'right' ? '0' : 'auto'}!important}`);\n }\n if (!declarations.length) continue;\n const marked = /\\sclass=\"/i.test(tag.text) ? tag.text.replace(/(\\sclass=\")/i, `$1${name} `) : tag.text.replace(/^(<[a-z][\\w:-]*)/i, `$1 class=\"${name}\"`);\n html = html.slice(0, tag.index) + marked + html.slice(tag.index + tag.text.length);\n rules.unshift(`.${name}{${declarations.join(';')}}`);\n }\n if (!rules.length) return desktop;\n const style = `<style type=\"text/css\">@media only screen and (max-width:${breakpoint - 1}px){${rules.join('')}}</style>`;\n return html.includes('</head>') ? html.replace('</head>', `${style}</head>`) : style + html;\n}\n","// @ts-check\nimport { parseMjml, serializeMjml, encodeAttribute } from '../engine/mjml.js';\nimport { boxKeys } from '../core/blockBox.js';\nimport { createNode, findFirst, walk } from '../engine/model.js';\nimport { toValues, parseBorder, parseSpacing } from '../core/mjmlAttributes.js';\nimport { MJML_DEFAULTS } from '../core/mjmlDefaults.js';\nimport { capColumnWidths, prepareColumnAlignment } from './columnAlignment.js';\nimport { MOBILE_MISMATCH, mergeDevices, splitDevices } from './mobileStyles.js';\n\n/** Only lengths may become outside or inside spacing. @param {string} value */\nconst spacing = (value) => parseSpacing(value || '0px').map((part) => {\n const number = Number.parseFloat(part);\n return Number.isFinite(number) && number >= 0 ? `${number}${part.endsWith('%') ? '%' : 'px'}` : '0px';\n}).join(' ');\n\n/** @param {string} value */\nfunction borderStyle(value) {\n const border = parseBorder(value);\n if (!border) return 'border:0;';\n // A border color cannot add declarations, external resources or markup.\n const color = /^(?:#[\\da-f]{3,8}|[a-z]+|rgba?\\([\\d\\s.,%]+\\)|hsla?\\([\\d\\s.,%]+\\))$/i.test(border.color) ? border.color : '#cbd5e1';\n return `border-width:${border.widths.map((width) => `${width}px`).join(' ')};border-style:${border.style};border-color:${color};`;\n}\n\n/** Prepare model-only box controls without sending unsupported attributes to MJML. @param {string} source */\nfunction prepareBoxes(source) {\n /** @type {{marker: string, margin: string, padding: string, border: string, gutter: boolean}[]} */\n const boxes = [];\n if (!/(?:eb-box-[a-f0-9]+|\\bbox-(?:padding|border)\\s*=|\\bmargin\\s*=)/.test(source)) return { mjml: source, boxes };\n const root = parseMjml(source);\n walk(root, (node) => {\n if (node.tag === 'mj-section' || !Object.keys(node.attributes).some((key) => key === 'margin' || key.startsWith('box-'))) return;\n const keys = boxKeys(node.tag);\n const properties = Object.values(keys).map((key) => ({ key }));\n const values = toValues({ ...MJML_DEFAULTS[node.tag], ...node.attributes }, properties);\n const marker = `eb-render-box-${boxes.length}`;\n const margin = spacing(values[keys.margin]);\n const padding = spacing(values[keys.padding]);\n const widths = parseBorder(values[keys.border])?.widths || [0, 0, 0, 0];\n const contextPadding = parseSpacing(margin).map((side, index) => Number.parseFloat(side) + Number.parseFloat(parseSpacing(padding)[index]) + widths[index]);\n boxes.push({ marker, margin, padding, border: borderStyle(values[keys.border]), gutter: node.tag === 'mj-column' && contextPadding.some(Boolean) });\n for (const key of Object.values(keys)) {\n delete node.attributes[key];\n for (const side of ['top', 'right', 'bottom', 'left']) delete node.attributes[`${key}-${side}`];\n }\n // Suppress MJML's default padding: the email table below now supplies it.\n node.attributes.padding = '0px';\n // MJML also uses padding to calculate fixed image widths for Outlook.\n // Reserve the actual box width during compilation, then replace its\n // gutter with the independent layers below.\n if (node.tag === 'mj-image' || node.tag === 'mj-column') node.attributes.padding = contextPadding.map((side) => `${side}px`).join(' ');\n node.attributes['css-class'] = `${node.attributes['css-class'] || ''} ${marker}`.trim();\n });\n return { mjml: boxes.length ? serializeMjml(root) : source, boxes };\n}\n\n/** Find the complete marked element without counting Outlook's conditional HTML as DOM. @param {string} html @param {string} marker */\nfunction markedElement(html, marker) {\n const tokens = /<!--[\\s\\S]*?-->|<\\/?([a-z][\\w:-]*)\\b(?:[^>\"']|\"[^\"]*\"|'[^']*')*>/gi;\n let start = -1;\n let tag = '';\n let opening = '';\n let depth = 0;\n for (const token of html.matchAll(tokens)) {\n if (!token[1]) continue;\n const closing = token[0].startsWith('</');\n if (start < 0) {\n const classes = /\\bclass=\"([^\"]*)\"/.exec(token[0])?.[1].split(/\\s+/) || [];\n if (closing || !classes.includes(marker)) continue;\n start = token.index;\n tag = token[1].toLowerCase();\n opening = token[0];\n depth = 1;\n } else if (token[1].toLowerCase() === tag) {\n depth += closing ? -1 : 1;\n if (!depth) return { start, end: token.index + token[0].length, opening, tag, inner: html.slice(start + opening.length, token.index), closing: token[0] };\n }\n }\n return null;\n}\n\nconst table = (inner) => `<table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"width:100%;border-collapse:separate;\"><tbody><tr>${inner}</tr></tbody></table>`;\n\n/** @param {string} opening @param {string} style */\nfunction styled(opening, style) {\n const safe = encodeAttribute(style);\n return /\\bstyle=\"/.test(opening) ? opening.replace(/\\bstyle=\"([^\"]*)\"/, (_, previous) => `style=\"${previous};${safe}\"`) : opening.replace(/>$/, ` style=\"${safe}\">`);\n}\n\n/**\n * An image given a height (those side by side, fitted to the first) is\n * cropped to it, not stretched; on a phone, where the columns stack, it keeps\n * its own proportions. Outlook on Windows has no `object-fit`: it stretches.\n * @param {string} source\n */\nfunction prepareImageHeights(source) {\n if (!/<mj-image\\b[^>]*\\sheight=\"\\d/.test(source)) return source;\n const root = parseMjml(source);\n walk(root, (node) => {\n if (node.tag === 'mj-image' && /^\\d+(?:\\.\\d+)?px$/.test(node.attributes.height || '')) {\n node.attributes['css-class'] = `${node.attributes['css-class'] || ''} eb-fill`.trim();\n }\n });\n let head = findFirst(root, 'mj-head');\n if (!head) {\n head = createNode('mj-head');\n root.children.unshift(head);\n }\n const width = Number.parseFloat(findFirst(head, 'mj-breakpoint')?.attributes.width || '') || 480;\n head.children.push(createNode('mj-style', { content:\n '.eb-fill img {object-fit:cover;}' +\n `@media only screen and (max-width:${width - 1}px) {.eb-fill img {height:auto!important;}}` }));\n return serializeMjml(root);\n}\n\n/**\n * Compile both native MJML and the editor's independent box controls; the\n * phone values of the elements become the email's styles under the breakpoint.\n * @param {string} source @param {(source: string, options: any) => any} compile @param {any} [options]\n */\nexport async function compileEditorMjml(source, compile, options = {}) {\n const devices = splitDevices(source);\n if (!devices) return compileOne(source, compile, options);\n const [desktop, mobile] = await Promise.all([compileOne(devices.desktop, compile, options), compileOne(devices.mobile, compile, options, false)]);\n const html = mergeDevices(desktop.html, mobile.html, devices.breakpoint);\n return html === null ? { ...desktop, errors: [...(desktop.errors || []), { message: MOBILE_MISMATCH }] } : { ...desktop, html };\n}\n\n/**\n * The phone version is left uncapped: its columns stack, and a different pixel\n * width there would become a phone rule overriding the stacking.\n * @param {string} source @param {(source: string, options: any) => any} compile @param {any} options\n */\nasync function compileOne(source, compile, options, cap = true) {\n const prepared = prepareBoxes(source);\n const result = await compile(prepareColumnAlignment(prepareImageHeights(prepared.mjml)), options);\n let html = String(result.html || '');\n if (cap) html = capColumnWidths(html);\n // Children first: outer wrappers retain every nested canvas marker.\n for (const box of prepared.boxes.reverse()) {\n const element = markedElement(html, box.marker);\n if (!element) continue;\n const inside = `padding:${box.padding};${box.border}`;\n let replacement;\n if (element.tag === 'td') {\n const original = styled(element.opening, inside) + element.inner + element.closing;\n replacement = `<td style=\"padding:${box.margin};font-size:0;\">${table(original)}</td>`;\n } else if (element.tag === 'a') {\n replacement = `<span style=\"display:inline-block;padding:${box.margin};\"><span style=\"display:inline-block;${inside}\">${element.opening}${element.inner}${element.closing}</span></span>`;\n } else {\n const inner = box.gutter ? element.inner.replace(/<td\\b(?:[^>\"']|\"[^\"]*\"|'[^']*')*>/i, (opening) => styled(opening, 'padding:0;')) : element.inner;\n replacement = element.opening + table(`<td style=\"padding:${box.margin};\">${table(`<td style=\"${inside}\">${inner}</td>`)}</td>`) + element.closing;\n }\n html = html.slice(0, element.start) + replacement + html.slice(element.end);\n }\n return { ...result, html };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,IAAM,WAAW;AACjB,IAAM,UAAU;AAMT,SAAS,0BAA0B,MAAM;AAC9C,SAAO,CAAC,GAAG,OAAO,QAAQ,EAAE,EAAE,SAAS,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,EAAE;AAChG;AAEA,SAAS,UAAU,MAAM;AACvB,SAAO,OAAO,QAAQ,EAAE,EACrB,QAAQ,MAAM,OAAO,EACrB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,MAAM,EACpB,QAAQ,MAAM,QAAQ;AAC3B;AAOO,SAAS,YAAY,MAAM,EAAE,QAAQ,MAAM,YAAY,MAAM,OAAO,MAAM,cAAc,OAAO,IAAI,CAAC,GAAG;AAC5G,MAAI,MAAM,OAAO,QAAQ,EAAE,EACxB,QAAQ,gDAAgD,EAAE,EAC1D,QAAQ,oDAAoD,EAAE;AACjE,MAAI,gBAAgB,OAAQ,OAAM,IAAI,QAAQ,UAAU,CAAC,SAAS,UAAW,QAAQ,KAAK,KAAK,IAAI,UAAU,EAAG;AAEhH,QAAM,IAAI;AAAA,IAAQ;AAAA,IAAqB,CAAC,KAAK,QAAQ,OACnD,aAAa,KAAK,KAAK,IAAI,MAAM,eAAe,UAAU,IAAI,CAAC,IAAI,KAAK;AAAA,EAC1E;AAEA,QAAM,OAAO;AAAA,IACX,SAAS,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,UAAU,OAA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