@h-k-dev/angular-email-editor 0.0.0-stage → 0.0.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/README.md +127 -2
- package/fesm2022/h-k-dev-angular-email-editor-actions.mjs +179 -0
- package/fesm2022/h-k-dev-angular-email-editor-actions.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-address-chip.mjs +383 -0
- package/fesm2022/h-k-dev-angular-email-editor-address-chip.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-address-input.mjs +1106 -0
- package/fesm2022/h-k-dev-angular-email-editor-address-input.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-address.mjs +489 -0
- package/fesm2022/h-k-dev-angular-email-editor-address.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-anchor.mjs +64 -0
- package/fesm2022/h-k-dev-angular-email-editor-anchor.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-attachment-chip.mjs +387 -0
- package/fesm2022/h-k-dev-angular-email-editor-attachment-chip.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-attachment-chips.mjs +80 -0
- package/fesm2022/h-k-dev-angular-email-editor-attachment-chips.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-chat-input.mjs +346 -0
- package/fesm2022/h-k-dev-angular-email-editor-chat-input.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-focus.mjs +78 -0
- package/fesm2022/h-k-dev-angular-email-editor-focus.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-image.mjs +132 -0
- package/fesm2022/h-k-dev-angular-email-editor-image.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-material.mjs +124 -0
- package/fesm2022/h-k-dev-angular-email-editor-material.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-metrics.mjs +243 -0
- package/fesm2022/h-k-dev-angular-email-editor-metrics.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-palette.mjs +87 -0
- package/fesm2022/h-k-dev-angular-email-editor-palette.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-proposal.mjs +307 -0
- package/fesm2022/h-k-dev-angular-email-editor-proposal.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor-suggestion-menu.mjs +392 -0
- package/fesm2022/h-k-dev-angular-email-editor-suggestion-menu.mjs.map +1 -0
- package/fesm2022/h-k-dev-angular-email-editor.mjs +18820 -0
- package/fesm2022/h-k-dev-angular-email-editor.mjs.map +1 -0
- package/package.json +133 -3
- package/styles/_scroll.scss +101 -0
- package/types/h-k-dev-angular-email-editor-actions.d.ts +147 -0
- package/types/h-k-dev-angular-email-editor-address-chip.d.ts +234 -0
- package/types/h-k-dev-angular-email-editor-address-input.d.ts +449 -0
- package/types/h-k-dev-angular-email-editor-address.d.ts +125 -0
- package/types/h-k-dev-angular-email-editor-anchor.d.ts +44 -0
- package/types/h-k-dev-angular-email-editor-attachment-chip.d.ts +271 -0
- package/types/h-k-dev-angular-email-editor-attachment-chips.d.ts +48 -0
- package/types/h-k-dev-angular-email-editor-chat-input.d.ts +101 -0
- package/types/h-k-dev-angular-email-editor-focus.d.ts +46 -0
- package/types/h-k-dev-angular-email-editor-image.d.ts +66 -0
- package/types/h-k-dev-angular-email-editor-material.d.ts +65 -0
- package/types/h-k-dev-angular-email-editor-metrics.d.ts +110 -0
- package/types/h-k-dev-angular-email-editor-palette.d.ts +51 -0
- package/types/h-k-dev-angular-email-editor-proposal.d.ts +170 -0
- package/types/h-k-dev-angular-email-editor-suggestion-menu.d.ts +177 -0
- package/types/h-k-dev-angular-email-editor.d.ts +3959 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"h-k-dev-angular-email-editor.mjs","sources":["../../../projects/angular-email-editor/src/lib/prose-mirror/extension.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/verbatim.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/html-tags.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/email-vocabulary.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/authored.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/schema.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/dual-contrast.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/inline-atoms.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/set.utils.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/unset.utils.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/text-style.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/split-keeping-marks.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/inline-style.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/table.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/import-html.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/merge-tag.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/link.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/button.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/columns.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/safe-url.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/parse-mode.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/preserve.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/envelope.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/corrections.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/html.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/fixtures/mjml-worldly.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/client-support.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/utils/escape.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/html-source.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/client-rendering.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/plain-text.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/email-document.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/quoted-history.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/document.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/paragraph.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/editor.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/lists.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/email-paragraph.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/code-line.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/text.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/html-language.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/code-line-indent.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/html-source-marks.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/hard-break.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/heading.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/blockquote.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/inline-images.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/image.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/divider.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/inline-atom-selection.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/toggle.utils.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/bold.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/italic.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/underline.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/marks/strike.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/history.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/layout-guides.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/gapcursor.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/column-resize.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/columns-resize.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/no-text-drag.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/base-keymap.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/paste-hygiene.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/clear-formatting.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/nodes/section.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/document-styles.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/kits.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/reply.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/html-autocomplete.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/menu-scroll.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/bubble-menu.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/block-menu.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/suggestion-menu.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/content-stream.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/content-proposal.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/menu-position.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/dialects/dialect.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/dialects/angular-expressions.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/table-handles.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/fold.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/send-intent.ts","../../../projects/angular-email-editor/src/lib/prose-mirror/extensions/merge-tag-resolution.ts","../../../projects/angular-email-editor/src/lib/inline-images.ts","../../../projects/angular-email-editor/src/public-api.ts","../../../projects/angular-email-editor/src/h-k-dev-angular-email-editor.ts"],"sourcesContent":["import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model';\nimport { Command, EditorState, Plugin } from 'prosemirror-state';\nimport { InputRule } from 'prosemirror-inputrules';\n\n/** Passed to every extension factory once the schema has been built. */\nexport interface ExtensionContext {\n schema: Schema;\n /** All extensions of the editor, so aggregators (e.g. a suggestion menu) can introspect them. */\n extensions: readonly Extension[];\n}\n\n/**\n * A command factory: called with user arguments (e.g. a heading level),\n * returns a ProseMirror {@link Command} ready to run against the editor.\n */\nexport type CommandFactory = (...args: any[]) => Command;\n\ninterface SuggestionItemBase {\n /** Stable and locale-neutral (`'heading-2'`, `'table'`): what a menu's\n `i18n` labels are keyed by, and what a renderer tracks rows by. Unique\n within its level. */\n id: string;\n /** Shown, and matched first — the menu's `i18n` may translate it. */\n title: string;\n /** Extra strings the query is matched against besides the title. */\n keywords?: string[];\n /** A secondary line for the row — a merge tag's path, a shortcut. */\n detail?: string;\n /** An icon name, for renderers that show one (the demo: Material). */\n icon?: string;\n /** The heading a renderer groups rows under — a stable id (`'blocks'`,\n `'styling'`, `'color'`), worded by the trigger's `sections` (see\n `SuggestionTrigger`). Rows are listed in the order given, so a\n section's rows are listed together, and a renderer shows the heading\n where the section changes. */\n section?: string;\n /** A colour the row shows in an icon's place — a palette's rows. */\n swatch?: string;\n}\n\n/** A suggestion that acts: picking it deletes the trigger and query text,\n then runs `command` at that spot. The only kind a {@link SuggestionGroup}\n may hold. */\nexport interface SuggestionCommandItem extends SuggestionItemBase {\n /** Runs after the trigger and query text have been deleted. */\n command: Command;\n /** Whether it can run right now, when the item wants to say. A menu does\n not offer a row that says no; a button for it shows disabled. Absent,\n a menu always offers the row — it never asks a plain command, which a\n host may not have written to the dry-run convention — and a button\n asks the command itself (see {@link isActionEnabled}). */\n isEnabled?: (state: EditorState) => boolean;\n children?: never;\n}\n\n/**\n * Something an extension can do, declared once and shown wherever a host\n * wants it: a row of a `/` menu, a toolbar button, a bubble menu, a menu\n * item. It is a {@link SuggestionCommandItem} — the same id, words, icon and\n * command — that also knows its state, so a button can show it.\n *\n * An action is permanent and named; a *suggestion* in the narrower sense (a\n * merge tag for `{{fi`, a template, a correction) is an answer to a moment\n * and comes from a {@link SuggestionSource}. Both end in the same row.\n */\nexport interface EditorAction extends SuggestionCommandItem {\n /** Whether it is on at the selection — a toggle's pressed state. Absent\n for what has no \"on\": inserting a table, sending. */\n isActive?: (state: EditorState) => boolean;\n}\n\n/** Whether `action` can run on `state`: its own `isEnabled` when it has\n one, else the command is asked the ProseMirror way — run without a\n dispatch, it only says whether it would apply. An extension's commands\n keep to that; declare `isEnabled` where the answer is too costly to ask\n on every transaction. */\nexport const isActionEnabled = (action: EditorAction, state: EditorState): boolean =>\n action.isEnabled ? action.isEnabled(state) : action.command(state);\n\n/** What a {@link SuggestionSource} is asked for. */\nexport interface SuggestionRequest {\n /** The search string of the level being asked for. */\n query: string;\n /** `null` for the first page, else the `nextCursor` the previous page\n returned. */\n cursor: string | null;\n /** Aborted once the answer is no longer wanted — a newer query, a\n dismissal, a destroyed editor. Hand it to `fetch` / `HttpClient`. */\n signal: AbortSignal;\n}\n\n/** One page of suggestions. A non-null `nextCursor` means more pages exist:\n the menu reports `hasMore` and fetches the next on `loadMore()`. */\nexport interface SuggestionPage<T extends SuggestionItem = SuggestionItem> {\n items: T[];\n nextCursor?: string | null;\n}\n\n/** A server-backed (or any computed) list of suggestions, asked per query\n and per page; it owns its own matching. A bare array is one page with\n nothing after it. A rejected promise is the menu's `error`. */\nexport type SuggestionSource<T extends SuggestionItem = SuggestionItem> = (\n request: SuggestionRequest,\n) => T[] | SuggestionPage<T> | Promise<T[] | SuggestionPage<T>>;\n\n/**\n * A suggestion that opens a second level: picking it rewrites the query to\n * `<word> ` (its title, lowercased, spaces as hyphens) after the trigger, and\n * whatever is typed after that space searches its children. Two levels, no\n * more — a group's children are command items.\n *\n * `children` is either a list, which the menu filters and ranks like the\n * first level, or a {@link SuggestionSource}.\n */\nexport interface SuggestionGroup extends SuggestionItemBase {\n /** Shown after `<trigger><word> `, until the group's own query is typed —\n \"Search templates…\". The second level's counterpart of a trigger's\n `placeholder`, handed to the session's decoration the same way; the\n menu's `i18n` may translate it. */\n placeholder?: string;\n children: readonly SuggestionCommandItem[] | SuggestionSource<SuggestionCommandItem>;\n command?: never;\n}\n\n/** An entry in a suggestion menu. */\nexport type SuggestionItem = SuggestionCommandItem | SuggestionGroup;\n\ninterface BaseExtension {\n name: string;\n /** Named commands exposed on the editor, e.g. `editor.commands.toggleBold()`. */\n commands?: (ctx: ExtensionContext) => Record<string, CommandFactory>;\n /** Key bindings. Earlier extensions in the array win over later ones. */\n keymap?: (ctx: ExtensionContext) => Record<string, Command>;\n /** Markdown-style input rules, e.g. `# ` becoming a heading. */\n inputRules?: (ctx: ExtensionContext) => InputRule[];\n /** Arbitrary ProseMirror plugins (decorations, paste handling, ...). */\n plugins?: (ctx: ExtensionContext) => Plugin[];\n /** What this extension can do, for every surface that shows it — a `/`\n menu's rows, a toolbar's buttons. Gathered by {@link extensionActions}. */\n actions?: (ctx: ExtensionContext) => EditorAction[];\n}\n\nexport interface NodeExtension extends BaseExtension {\n type: 'node';\n /** Marks this node as the document root. Exactly one extension must set it. */\n topNode?: boolean;\n spec: NodeSpec;\n}\n\nexport interface MarkExtension extends BaseExtension {\n type: 'mark';\n spec: MarkSpec;\n}\n\n/** Behaviour-only extension: history, base keymap, future `/`-command, ... */\nexport interface FunctionalExtension extends BaseExtension {\n type: 'extension';\n}\n\nexport type Extension = NodeExtension | MarkExtension | FunctionalExtension;\n\nexport const defineNode = (extension: Omit<NodeExtension, 'type'>): NodeExtension => ({\n type: 'node',\n ...extension,\n});\n\nexport const defineMark = (extension: Omit<MarkExtension, 'type'>): MarkExtension => ({\n type: 'mark',\n ...extension,\n});\n\nexport const defineExtension = (\n extension: Omit<FunctionalExtension, 'type'>,\n): FunctionalExtension => ({\n type: 'extension',\n ...extension,\n});\n\n/** Every action the editor's extensions declare, in kit order. */\nexport const extensionActions = (ctx: ExtensionContext): EditorAction[] =>\n ctx.extensions.flatMap((extension) => extension.actions?.(ctx) ?? []);\n\n/** The extensions' actions as the rows of a `/` menu — the same list, seen as\n suggestions: `createSuggestionMenu({ trigger: '/', items: extensionSuggestions })`. */\nexport const extensionSuggestions = (ctx: ExtensionContext): SuggestionItem[] =>\n extensionActions(ctx);\n","/** Attributes as an ordered list of pairs — JSON-plain, so ProseMirror can\n compare node attrs, and ordered, so the round trip keeps authored order. */\nexport type AttributePairs = [string, string][];\n\n/**\n * A DOM element with its attributes set **verbatim**. Array output specs run\n * `style` through the CSSOM (`style.cssText = …`), which reformats it and\n * drops every declaration the browser does not know — MJML's `mso-*` hints\n * for Outlook would vanish. Preserved markup therefore builds its own\n * elements; `setAttribute` keeps the string as authored.\n */\nexport function verbatimElement(\n tag: string,\n attrs: Iterable<[string, string | null | undefined]>,\n content: boolean,\n): { dom: HTMLElement; contentDOM?: HTMLElement } {\n const dom = document.createElement(tag);\n for (const [name, value] of attrs) {\n if (value != null) dom.setAttribute(name, value);\n }\n return content ? { dom, contentDOM: dom } : { dom };\n}\n","/**\n * Tag classifications shared by the source language (scanner, formatter) and\n * the preserving parser. One vocabulary, so \"what is a block\" never differs\n * between the pane that formats the source and the pane that parses it.\n */\n\n/** Elements that never have content and never a closing tag. */\nexport const VOID_TAGS = new Set([\n 'area',\n 'base',\n 'br',\n 'col',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'link',\n 'meta',\n 'source',\n 'track',\n 'wbr',\n]);\n\n/** Phrasing-level containers: they lay out inline and become marks (or, when\n they wrap blocks, generic containers) in the preserving parse. */\nexport const INLINE_TAGS = new Set([\n 'a',\n 'abbr',\n 'acronym',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'cite',\n 'code',\n 'data',\n 'del',\n 'dfn',\n 'em',\n 'font',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'mark',\n 'q',\n 's',\n 'samp',\n 'small',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'sup',\n 'time',\n 'tt',\n 'u',\n 'var',\n]);\n\n/** Void elements that lay out inline. */\nexport const INLINE_VOID_TAGS = new Set(['br', 'img', 'input', 'wbr']);\n\n/** Table sections: structure the browser injects and the serializer emits on\n its own — they are walked through, never nodes of their own, wherever the\n surrounding table is canonical. */\nexport const TABLE_SECTION_TAGS = new Set(['tbody', 'thead', 'tfoot']);\n\n/** Tags that make up a document's envelope rather than its content. Gmail\n strips the head anyway, so they are neither content nor a deliverability\n warning — just the envelope MJML-class tooling emits. */\nexport const DOCUMENT_TAGS = new Set(['html', 'head', 'body', 'title', 'meta', 'link', 'style']);\n\n/** Never preserved, in any mode: executable or embedding content has no\n place in an email and the parse refuses it outright. */\nexport const REFUSED_TAGS = new Set([\n 'applet',\n 'base',\n 'embed',\n 'frame',\n 'frameset',\n 'iframe',\n 'math',\n 'object',\n 'param',\n 'script',\n 'svg',\n 'template',\n]);\n\n/** Whether an element takes part in block layout among its siblings —\n everything that is neither phrasing content nor an inline void. */\nexport function isBlockLevel(tag: string): boolean {\n return !INLINE_TAGS.has(tag) && !INLINE_VOID_TAGS.has(tag);\n}\n","/**\n * The email vocabulary: every tag, attribute and CSS property that at least\n * one of the floor clients — **Apple Mail, Outlook, Gmail** — applies. This is\n * what the default `email` parse mode recognizes and keeps *exactly as\n * authored*; it is the reason MJML's output survives untouched, because MJML\n * emits nothing a floor client ignores.\n *\n * Curation rule: grounded in caniemail's feature list (a feature supported by\n * any one of the three clients is usable), plus Outlook's own dialect\n * (`mso-*` properties, VML and Office namespaced elements), plus the legacy\n * presentational HTML every email toolchain still relies on (`bgcolor`,\n * `cellpadding`, `align`, …). Anything outside — framework attributes\n * (`ng-*`, `v-*`), `data-*`, typos, invented CSS properties, custom elements —\n * is dropped by the `email` parse and kept only in `preserve` mode, which is\n * the opt-in for special needs.\n *\n * Deliberately static: filtering by what the *running* browser knows\n * (`CSS.supports`, `in style`) would make canonical output depend on the\n * engine — and no browser knows `mso-*`.\n */\n\nimport { REFUSED_TAGS } from './html-tags';\n\n/** Tags applied by at least one floor client. */\nexport const EMAIL_TAGS = new Set([\n // Document envelope\n 'html',\n 'head',\n 'body',\n 'title',\n 'meta',\n 'link',\n 'style',\n // Sections and grouping\n 'address',\n 'article',\n 'aside',\n 'blockquote',\n 'center',\n 'dd',\n 'details',\n 'div',\n 'dl',\n 'dt',\n 'figcaption',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'noscript',\n 'ol',\n 'p',\n 'pre',\n 'section',\n 'summary',\n 'ul',\n // Tables — the most client-compatible layout there is\n 'caption',\n 'col',\n 'colgroup',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'tr',\n // Text-level\n 'a',\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'br',\n 'cite',\n 'code',\n 'del',\n 'dfn',\n 'em',\n 'font',\n 'i',\n 'ins',\n 'kbd',\n 'mark',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n 'small',\n 'span',\n 'strike',\n 'strong',\n 'sub',\n 'sup',\n 'time',\n 'tt',\n 'u',\n 'var',\n 'wbr',\n // Media — Apple Mail plays video and audio; <picture> selects sources\n 'area',\n 'audio',\n 'img',\n 'map',\n 'picture',\n 'source',\n 'track',\n 'video',\n // Interactive — Apple Mail honours forms and the checkbox hack MJML's\n // navbar and every \"interactive email\" relies on\n 'button',\n 'fieldset',\n 'form',\n 'input',\n 'label',\n 'legend',\n 'meter',\n 'optgroup',\n 'option',\n 'progress',\n 'select',\n 'textarea',\n]);\n\n/** Outlook's own elements (`<v:rect>`, `<o:p>`, `<w:anchorlock>`) — VML and\n Office markup that the Word engine renders. */\nconst OUTLOOK_ELEMENT = /^(?:v|o|w):[a-z]/i;\n\n/** Attributes applied by at least one floor client, on any element — the\n global set, the legacy presentational set, and the per-element ones\n flattened (an `href` on a `<div>` is inert, not harmful). */\nexport const EMAIL_ATTRIBUTES = new Set([\n // Global\n 'class',\n 'dir',\n 'hidden',\n 'id',\n 'lang',\n 'role',\n 'style',\n 'tabindex',\n 'title',\n 'translate',\n 'xml:lang',\n 'xmlns',\n // Legacy presentational — the backbone of table-based email\n 'align',\n 'alink',\n 'background',\n 'bgcolor',\n 'border',\n 'bordercolor',\n 'cellpadding',\n 'cellspacing',\n 'char',\n 'charoff',\n 'clear',\n 'color',\n 'compact',\n 'face',\n 'frame',\n 'height',\n 'hspace',\n 'leftmargin',\n 'link',\n 'marginheight',\n 'marginwidth',\n 'noshade',\n 'nowrap',\n 'rules',\n 'size',\n 'text',\n 'topmargin',\n 'valign',\n 'vlink',\n 'vspace',\n 'width',\n // Tables\n 'abbr',\n 'axis',\n 'colspan',\n 'headers',\n 'rowspan',\n 'scope',\n 'span',\n 'summary',\n // Links and media\n 'alt',\n 'autoplay',\n 'controls',\n 'coords',\n 'download',\n 'href',\n 'hreflang',\n 'ismap',\n 'loop',\n 'media',\n 'muted',\n 'name',\n 'playsinline',\n 'poster',\n 'preload',\n 'rel',\n 'shape',\n 'sizes',\n 'src',\n 'srcset',\n 'target',\n 'type',\n 'usemap',\n // Lists, quotes, edits\n 'cite',\n 'datetime',\n 'reversed',\n 'start',\n 'value',\n // Forms\n 'action',\n 'checked',\n 'cols',\n 'disabled',\n 'enctype',\n 'for',\n 'label',\n 'max',\n 'maxlength',\n 'method',\n 'min',\n 'multiple',\n 'open',\n 'placeholder',\n 'readonly',\n 'required',\n 'rows',\n 'selected',\n 'step',\n // Document head\n 'charset',\n 'content',\n 'http-equiv',\n]);\n\n/** Attribute name patterns applied by floor clients: ARIA, and XML\n namespace declarations (`xmlns:v`, `xmlns:o` — what makes VML work). */\nconst EMAIL_ATTRIBUTE_PATTERN = /^(?:aria-[a-z]+|xmlns:[a-z]+)$/;\n\n/** CSS properties applied by at least one floor client — caniemail's\n property list plus the universally supported basics it doesn't track. */\nexport const EMAIL_CSS_PROPERTIES = new Set([\n 'accent-color',\n 'align-content',\n 'align-items',\n 'align-self',\n 'animation',\n 'animation-delay',\n 'animation-direction',\n 'animation-duration',\n 'animation-fill-mode',\n 'animation-iteration-count',\n 'animation-name',\n 'animation-play-state',\n 'animation-timing-function',\n 'appearance',\n 'aspect-ratio',\n 'backdrop-filter',\n 'background',\n 'background-attachment',\n 'background-blend-mode',\n 'background-clip',\n 'background-color',\n 'background-image',\n 'background-origin',\n 'background-position',\n 'background-position-x',\n 'background-position-y',\n 'background-repeat',\n 'background-size',\n 'block-size',\n 'border',\n 'border-block',\n 'border-block-color',\n 'border-block-end',\n 'border-block-end-color',\n 'border-block-end-style',\n 'border-block-end-width',\n 'border-block-start',\n 'border-block-start-color',\n 'border-block-start-style',\n 'border-block-start-width',\n 'border-block-style',\n 'border-block-width',\n 'border-bottom',\n 'border-bottom-color',\n 'border-bottom-left-radius',\n 'border-bottom-right-radius',\n 'border-bottom-style',\n 'border-bottom-width',\n 'border-collapse',\n 'border-color',\n 'border-end-end-radius',\n 'border-end-start-radius',\n 'border-image',\n 'border-image-outset',\n 'border-image-repeat',\n 'border-image-slice',\n 'border-image-source',\n 'border-image-width',\n 'border-inline',\n 'border-inline-color',\n 'border-inline-end',\n 'border-inline-end-color',\n 'border-inline-end-style',\n 'border-inline-end-width',\n 'border-inline-start',\n 'border-inline-start-color',\n 'border-inline-start-style',\n 'border-inline-start-width',\n 'border-inline-style',\n 'border-inline-width',\n 'border-left',\n 'border-left-color',\n 'border-left-style',\n 'border-left-width',\n 'border-radius',\n 'border-right',\n 'border-right-color',\n 'border-right-style',\n 'border-right-width',\n 'border-spacing',\n 'border-start-end-radius',\n 'border-start-start-radius',\n 'border-style',\n 'border-top',\n 'border-top-color',\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-top-style',\n 'border-top-width',\n 'border-width',\n 'bottom',\n 'box-shadow',\n 'box-sizing',\n 'caption-side',\n 'caret-color',\n 'clear',\n 'clip',\n 'clip-path',\n 'color',\n 'color-scheme',\n 'column-count',\n 'column-fill',\n 'column-gap',\n 'column-rule',\n 'column-rule-color',\n 'column-rule-style',\n 'column-rule-width',\n 'column-span',\n 'column-width',\n 'columns',\n 'content',\n 'counter-increment',\n 'counter-reset',\n 'cursor',\n 'direction',\n 'display',\n 'empty-cells',\n 'filter',\n 'flex',\n 'flex-basis',\n 'flex-direction',\n 'flex-flow',\n 'flex-grow',\n 'flex-shrink',\n 'flex-wrap',\n 'float',\n 'font',\n 'font-family',\n 'font-feature-settings',\n 'font-kerning',\n 'font-size',\n 'font-size-adjust',\n 'font-stretch',\n 'font-style',\n 'font-variant',\n 'font-variant-caps',\n 'font-variant-ligatures',\n 'font-variant-numeric',\n 'font-weight',\n 'gap',\n 'grid',\n 'grid-area',\n 'grid-auto-columns',\n 'grid-auto-flow',\n 'grid-auto-rows',\n 'grid-column',\n 'grid-column-end',\n 'grid-column-gap',\n 'grid-column-start',\n 'grid-gap',\n 'grid-row',\n 'grid-row-end',\n 'grid-row-gap',\n 'grid-row-start',\n 'grid-template',\n 'grid-template-areas',\n 'grid-template-columns',\n 'grid-template-rows',\n 'height',\n 'hyphenate-character',\n 'hyphens',\n 'image-rendering',\n 'inline-size',\n 'inset',\n 'inset-block',\n 'inset-block-end',\n 'inset-block-start',\n 'inset-inline',\n 'inset-inline-end',\n 'inset-inline-start',\n 'isolation',\n 'justify-content',\n 'justify-items',\n 'justify-self',\n 'left',\n 'letter-spacing',\n 'line-break',\n 'line-height',\n 'list-style',\n 'list-style-image',\n 'list-style-position',\n 'list-style-type',\n 'margin',\n 'margin-block',\n 'margin-block-end',\n 'margin-block-start',\n 'margin-bottom',\n 'margin-inline',\n 'margin-inline-end',\n 'margin-inline-start',\n 'margin-left',\n 'margin-right',\n 'margin-top',\n 'mask',\n 'mask-image',\n 'max-block-size',\n 'max-height',\n 'max-inline-size',\n 'max-width',\n 'min-block-size',\n 'min-height',\n 'min-inline-size',\n 'min-width',\n 'mix-blend-mode',\n 'object-fit',\n 'object-position',\n 'opacity',\n 'order',\n 'orphans',\n 'outline',\n 'outline-color',\n 'outline-offset',\n 'outline-style',\n 'outline-width',\n 'overflow',\n 'overflow-wrap',\n 'overflow-x',\n 'overflow-y',\n 'padding',\n 'padding-block',\n 'padding-block-end',\n 'padding-block-start',\n 'padding-bottom',\n 'padding-inline',\n 'padding-inline-end',\n 'padding-inline-start',\n 'padding-left',\n 'padding-right',\n 'padding-top',\n 'page-break-after',\n 'page-break-before',\n 'page-break-inside',\n 'perspective',\n 'place-content',\n 'place-items',\n 'place-self',\n 'pointer-events',\n 'position',\n 'quotes',\n 'resize',\n 'right',\n 'rotate',\n 'row-gap',\n 'scale',\n 'scroll-behavior',\n 'scroll-snap-align',\n 'scroll-snap-type',\n 'speak',\n 'tab-size',\n 'table-layout',\n 'text-align',\n 'text-align-last',\n 'text-decoration',\n 'text-decoration-color',\n 'text-decoration-line',\n 'text-decoration-skip-ink',\n 'text-decoration-style',\n 'text-decoration-thickness',\n 'text-emphasis',\n 'text-emphasis-color',\n 'text-emphasis-position',\n 'text-emphasis-style',\n 'text-indent',\n 'text-orientation',\n 'text-overflow',\n 'text-rendering',\n 'text-shadow',\n 'text-size-adjust',\n 'text-transform',\n 'text-underline-offset',\n 'text-underline-position',\n 'top',\n 'transform',\n 'transform-origin',\n 'transition',\n 'transition-delay',\n 'transition-duration',\n 'transition-property',\n 'transition-timing-function',\n 'translate',\n 'unicode-bidi',\n 'user-select',\n 'vertical-align',\n 'visibility',\n 'white-space',\n 'white-space-collapse',\n 'widows',\n 'width',\n 'will-change',\n 'word-break',\n 'word-spacing',\n 'word-wrap',\n 'writing-mode',\n 'z-index',\n 'zoom',\n]);\n\n/** Vendor-only properties with no unprefixed twin in the list above. */\nconst VENDOR_ONLY_PROPERTIES = new Set([\n 'font-smoothing',\n 'interpolation-mode',\n 'line-clamp',\n 'box-orient',\n 'osx-font-smoothing',\n 'tap-highlight-color',\n 'text-fill-color',\n 'text-stroke',\n 'text-stroke-color',\n 'text-stroke-width',\n 'touch-callout',\n]);\n\n/** Whether a tag is applied by at least one floor client. */\nexport function isEmailTag(tag: string): boolean {\n return EMAIL_TAGS.has(tag) || OUTLOOK_ELEMENT.test(tag);\n}\n\n/** Whether an attribute is applied by at least one floor client. Outlook's\n own elements keep all their attributes — VML is its own vocabulary. */\nexport function isEmailAttribute(name: string, tag = ''): boolean {\n return (\n EMAIL_ATTRIBUTES.has(name) || EMAIL_ATTRIBUTE_PATTERN.test(name) || OUTLOOK_ELEMENT.test(tag)\n );\n}\n\n/**\n * Whether a CSS property is applied by at least one floor client: a listed\n * property, a vendor-prefixed one (`-webkit-`, `-moz-`, `-ms-`) of a listed\n * or known vendor-only property, Outlook's `mso-*`, or a custom property\n * (Apple Mail supports CSS variables).\n */\nexport function isEmailCssProperty(property: string): boolean {\n const name = property.trim().toLowerCase();\n if (EMAIL_CSS_PROPERTIES.has(name)) return true;\n if (/^mso-[a-z-]+$/.test(name) || /^--[\\w-]+$/.test(name)) return true;\n const vendor = /^-(?:webkit|moz|ms)-([a-z-]+)$/.exec(name);\n return !!vendor && (EMAIL_CSS_PROPERTIES.has(vendor[1]) || VENDOR_ONLY_PROPERTIES.has(vendor[1]));\n}\n\n/** A style attribute split into declarations at top-level semicolons —\n never inside quotes or parentheses, so `url(data:image/png;base64,…)`\n stays one declaration. Each entry keeps its exact original text. */\nexport function splitDeclarations(style: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let quote: string | null = null;\n let start = 0;\n for (let i = 0; i < style.length; i++) {\n const char = style[i];\n if (quote) {\n if (char === '\\\\') i++;\n else if (char === quote) quote = null;\n } else if (char === '\"' || char === \"'\") {\n quote = char;\n } else if (char === '(') {\n depth++;\n } else if (char === ')') {\n depth = Math.max(0, depth - 1);\n } else if (char === ';' && depth === 0) {\n parts.push(style.slice(start, i));\n start = i + 1;\n }\n }\n parts.push(style.slice(start));\n return parts;\n}\n\n/** The property name of one declaration, lower-cased; `null` when the\n declaration has no `:` (empty or malformed). */\nexport function declarationProperty(declaration: string): string | null {\n const colon = declaration.indexOf(':');\n if (colon < 0) return null;\n return declaration.slice(0, colon).trim().toLowerCase();\n}\n\n/**\n * A style attribute with every declaration outside the email vocabulary\n * removed. **Byte-identical when nothing is dropped** — the kept declarations\n * keep their exact text and separators, so authored styles round-trip as\n * written. Returns the dropped property names alongside.\n */\nexport function filterEmailStyle(style: string): { style: string; dropped: string[] } {\n const parts = splitDeclarations(style);\n const dropped: string[] = [];\n const kept = parts.filter((part) => {\n const property = declarationProperty(part);\n if (property === null || isEmailCssProperty(property)) return true;\n dropped.push(property);\n return false;\n });\n if (!dropped.length) return { style, dropped };\n return {\n style: kept\n .join(';')\n .replace(/^\\s*;\\s*/, '')\n .trim(),\n dropped,\n };\n}\n\n/**\n * Applies the email vocabulary to a throwaway DOM, in place: elements\n * outside it are unwrapped (their content stays, as the repair parse does) —\n * except executable ones, which go with their content, never leaking it as\n * text — attributes outside it are removed, style declarations outside it\n * are removed. Comments and text are untouched. Runs before the `email` parse.\n */\nexport function applyEmailVocabulary(root: Element): void {\n // Deepest first, so an unwrap never skips a descendant.\n const elements = Array.from(root.querySelectorAll('*')).reverse();\n for (const element of [...elements, root]) {\n const tag = element.tagName.toLowerCase();\n for (const { name, value } of Array.from(element.attributes)) {\n if (!isEmailAttribute(name, tag)) {\n element.removeAttribute(name);\n } else if (name === 'style') {\n const filtered = filterEmailStyle(value);\n if (filtered.dropped.length) element.setAttribute('style', filtered.style);\n }\n }\n if (element === root) continue;\n if (REFUSED_TAGS.has(tag)) element.remove();\n else if (!isEmailTag(tag)) element.replaceWith(...Array.from(element.childNodes));\n }\n}\n","/**\n * Authored markup on the composer's own nodes and marks.\n *\n * In the `email` parse mode every node and mark the schema knows recognizes\n * the markup its parse rule accepts — MJML's styled `<div>` is a paragraph, a\n * hand-written `<table>` a table, `<b class=\"x\">` bold — while the element's\n * tag and attributes ride along **exactly as authored** in an `html` attr.\n * For a node whose rendering is several elements deep (a table and its\n * `<tbody>`, a section's band), every element on the way to the content is\n * kept.\n *\n * The rule for rendering is one sentence: **verbatim until edited, then the\n * edit patched in.** While the modelled attributes are what the parse read,\n * the authored elements render as written. Once a command changes them (an\n * alignment, a cell fill, a link's href), the node's canonical rendering is\n * computed twice — for what was parsed and for what is now — and only that\n * difference is applied to the authored markup: an attribute set or removed,\n * a style declaration replaced in place, appended or dropped. Everything the\n * edit did not touch stays byte for byte.\n *\n * `html` is `null` for the composer's own canonical output and for everything\n * a command creates, which is why the golden corpus is unaffected.\n *\n * Installed once, for every node and mark, by the schema builder\n * ({@link withAuthoredMarkup}); a spec opts out with `authoredMarkup: false`.\n */\nimport {\n Attrs,\n DOMOutputSpec,\n DOMSerializer,\n Mark,\n MarkSpec,\n Node,\n NodeSpec,\n} from 'prosemirror-model';\nimport { AttributePairs, verbatimElement } from './verbatim';\nimport { declarationProperty, splitDeclarations } from './email-vocabulary';\n\nexport interface AuthoredElement {\n /** Lower-cased tag name as authored. */\n tag: string;\n /** Attributes verbatim, in authored order. */\n attrs: AttributePairs;\n}\n\nexport interface AuthoredMarkup {\n /** The authored elements from the node's outer element down to the one\n holding its content — one entry for most nodes. */\n path: AuthoredElement[];\n /** The modelled attributes as the parse read them (`html` excluded): the\n baseline an edit is measured against. */\n parsed: Record<string, unknown>;\n}\n\n/** The attribute holding authored markup, on every node and mark. */\nexport const AUTHORED_ATTR = 'html';\n\n/** Spec key: `false` opts a node or mark out of authored markup (the\n preserve family, which is verbatim by construction). */\nexport const AUTHORED_SPEC_KEY = 'authoredMarkup';\n\n/** Spec key: style values to write instead of *removing* a declaration an\n edit took away — `{ 'text-align': 'left' }` on the paragraph, because an\n authored line usually sits in a container with an alignment of its own\n (MJML cells centre) and a removed declaration would inherit that. */\nexport const AUTHORED_STYLE_DEFAULTS_KEY = 'authoredStyleDefaults';\n\n/** The canonical render functions, kept beside the wrapped ones. */\nconst CANONICAL_TO_DOM = 'aeeCanonicalToDOM';\nconst CANONICAL_EMIT_DOM = 'aeeCanonicalEmitDOM';\n\ntype Subject = Node | Mark;\ntype Render = (subject: any, inline?: boolean) => DOMOutputSpec;\n\nexport function authoredMarkupOf(subject: Subject): AuthoredMarkup | null {\n return (subject.attrs[AUTHORED_ATTR] as AuthoredMarkup | null | undefined) ?? null;\n}\n\n/** A node or mark spec with the `html` attribute and authored rendering —\n applied by `createSchema` to every spec that does not opt out. */\nexport function withAuthoredMarkup<T extends NodeSpec | MarkSpec>(spec: T): T {\n if (spec[AUTHORED_SPEC_KEY] === false || !spec.toDOM) return spec;\n if (spec.attrs?.[AUTHORED_ATTR]) return spec;\n const next: Record<string, unknown> = {\n ...spec,\n attrs: { ...(spec.attrs ?? {}), [AUTHORED_ATTR]: { default: null } },\n [CANONICAL_TO_DOM]: spec.toDOM,\n };\n const emit = spec['emitDOM'] as Render | null | undefined;\n next['toDOM'] = authoredRender(spec.toDOM as Render, spec, emit ?? undefined);\n if (emit) {\n next[CANONICAL_EMIT_DOM] = emit;\n next['emitDOM'] = authoredRender(emit, spec);\n }\n return next as T;\n}\n\n/** The node's (or mark's) canonical rendering, authored markup ignored —\n what the parse compares an element against. `emit` picks the email's\n rendering over the editor view's. */\nexport function canonicalRender(\n subject: Subject,\n emit: boolean,\n): { dom: globalThis.Node; contentDOM?: HTMLElement } | null {\n const spec = subject.type.spec as Record<string, unknown>;\n const render = ((emit && (spec[CANONICAL_EMIT_DOM] ?? spec['emitDOM'])) ||\n spec[CANONICAL_TO_DOM] ||\n spec['toDOM']) as Render | undefined;\n if (!render) return null;\n const out = render(subject, true);\n if (typeof out === 'string') return null;\n return DOMSerializer.renderSpec(document, out) as {\n dom: globalThis.Node;\n contentDOM?: HTMLElement;\n };\n}\n\n/** The elements from a rendering's outer element down to its content hole\n (or the outer element alone for a leaf). */\nexport function renderedPath(rendered: {\n dom: globalThis.Node;\n contentDOM?: HTMLElement;\n}): Element[] | null {\n if (!(rendered.dom instanceof Element)) return null;\n if (!rendered.contentDOM) return [rendered.dom];\n const path: Element[] = [];\n for (let el: Element | null = rendered.contentDOM; el; el = el.parentElement) {\n path.unshift(el);\n if (el === rendered.dom) return path;\n }\n return null;\n}\n\nfunction modelledEqual(subject: Subject, parsed: Record<string, unknown>): boolean {\n for (const [name, value] of Object.entries(subject.attrs)) {\n if (name === AUTHORED_ATTR) continue;\n if (JSON.stringify(value) !== JSON.stringify(parsed[name])) return false;\n }\n return true;\n}\n\nfunction withParsedAttrs(subject: Subject, parsed: Record<string, unknown>): Subject {\n const attrs: Attrs = { ...parsed, [AUTHORED_ATTR]: null };\n return subject instanceof Mark\n ? subject.type.create(attrs)\n : (subject as Node).type.create(attrs);\n}\n\n/** A render function that honours authored markup. `viewOf` is set for the\n editor view's rendering (`toDOM`) when the spec has a separate email\n rendering (`emitDOM`): attributes the view adds for editing alone — a\n `tabindex`, a class, `contenteditable` — are kept beside the authored\n ones, because they are how the editor works, not how the email looks. */\nfunction authoredRender(render: Render, spec: NodeSpec | MarkSpec, viewOf?: Render): Render {\n const defaults = (spec[AUTHORED_STYLE_DEFAULTS_KEY] ?? {}) as Record<string, string>;\n return (subject: Subject, inline?: boolean) => {\n const out = render(subject, inline);\n const markup = authoredMarkupOf(subject);\n if (!markup || typeof out === 'string') return out;\n const current = DOMSerializer.renderSpec(document, out) as {\n dom: globalThis.Node;\n contentDOM?: HTMLElement;\n };\n const currentPath = renderedPath(current);\n if (!currentPath || currentPath.length !== markup.path.length) return out;\n\n let path = markup.path;\n if (!modelledEqual(subject, markup.parsed)) {\n const baseline = DOMSerializer.renderSpec(\n document,\n render(withParsedAttrs(subject, markup.parsed), inline) as DOMOutputSpec,\n ) as { dom: globalThis.Node; contentDOM?: HTMLElement };\n const baselinePath = renderedPath(baseline);\n if (!baselinePath || baselinePath.length !== path.length) return out;\n path = path.map((element, i) =>\n patchElement(element, baselinePath[i], currentPath[i], defaults),\n );\n }\n if (viewOf) path = withViewAttributes(path, currentPath, viewOf(subject, inline));\n return replacePath(current, currentPath, path);\n };\n}\n\n/** Adds the editing-only attributes of the view's rendering (present there,\n absent from the email's) to the authored elements. Never `style`: the\n authored style is what the email shows, so it is what the view shows. */\nfunction withViewAttributes(\n path: AuthoredElement[],\n viewPath: Element[],\n emitted: DOMOutputSpec,\n): AuthoredElement[] {\n if (typeof emitted === 'string') return path;\n const emitPath = renderedPath(\n DOMSerializer.renderSpec(document, emitted) as {\n dom: globalThis.Node;\n contentDOM?: HTMLElement;\n },\n );\n if (!emitPath || emitPath.length !== path.length) return path;\n return path.map((element, i) => {\n let result = element;\n for (const { name, value } of Array.from(viewPath[i].attributes)) {\n if (name === 'style' || emitPath[i].hasAttribute(name)) continue;\n if (name === 'class') {\n const authored = authoredAttribute(result, 'class');\n result = withAttribute(result, 'class', authored ? `${authored} ${value}` : value);\n } else if (authoredAttribute(result, name) === null) {\n result = withAttribute(result, name, value);\n }\n }\n return result;\n });\n}\n\n/** Swaps every element on the rendered path for its authored counterpart,\n children moved across, so what the rendering put inside stays. */\nfunction replacePath(\n rendered: { dom: globalThis.Node; contentDOM?: HTMLElement },\n renderedElements: Element[],\n authored: AuthoredElement[],\n): { dom: HTMLElement; contentDOM?: HTMLElement } {\n let root: HTMLElement | null = null;\n let content: HTMLElement | undefined;\n renderedElements.forEach((old, i) => {\n const { dom } = verbatimElement(authored[i].tag, authored[i].attrs, false);\n while (old.firstChild) dom.appendChild(old.firstChild);\n old.parentNode?.replaceChild(dom, old);\n if (i === 0) root = dom;\n if (old === rendered.contentDOM) content = dom;\n });\n return content ? { dom: root!, contentDOM: content } : { dom: root! };\n}\n\n/** One authored element with the difference between two canonical\n renderings (what was parsed → what is now) applied to it. */\nfunction patchElement(\n authored: AuthoredElement,\n baseline: Element,\n current: Element,\n defaults: Record<string, string>,\n): AuthoredElement {\n let result: AuthoredElement = {\n tag: baseline.tagName === current.tagName ? authored.tag : current.tagName.toLowerCase(),\n attrs: authored.attrs,\n };\n const names = new Set([\n ...Array.from(baseline.attributes, (a) => a.name),\n ...Array.from(current.attributes, (a) => a.name),\n ]);\n for (const name of names) {\n const before = baseline.getAttribute(name);\n const after = current.getAttribute(name);\n if (before === after) continue;\n if (name === 'style') {\n result = patchStyle(result, before ?? '', after ?? '', defaults);\n } else if (after === null) {\n result = withoutAttribute(result, name);\n } else {\n result = withAttribute(result, name, after);\n }\n }\n return result;\n}\n\nfunction declarations(style: string): Map<string, string> {\n const map = new Map<string, string>();\n for (const part of splitDeclarations(style)) {\n const property = declarationProperty(part);\n if (property) map.set(property, part.slice(part.indexOf(':') + 1).trim());\n }\n return map;\n}\n\n/** Legacy presentational attributes that say what a style declaration says.\n An edit to the declaration lands on the attribute when the authored\n element states it only there (`<p align=\"left\">`), so the two never\n disagree. */\nconst LEGACY_ATTRIBUTES: Record<string, string> = {\n 'text-align': 'align',\n 'vertical-align': 'valign',\n};\n\nfunction patchStyle(\n markup: AuthoredElement,\n before: string,\n after: string,\n defaults: Record<string, string>,\n): AuthoredElement {\n const was = declarations(before);\n const now = declarations(after);\n let result = markup;\n const set = (property: string, value: string | null) => {\n const legacy = LEGACY_ATTRIBUTES[property];\n const declared = declarations(authoredAttribute(result, 'style') ?? '').has(property);\n if (legacy && !declared && authoredAttribute(result, legacy) !== null) {\n result =\n value === null ? withoutAttribute(result, legacy) : withAttribute(result, legacy, value);\n } else {\n result =\n value === null\n ? withoutStyleDeclaration(result, property)\n : withStyleDeclaration(result, property, value);\n }\n };\n for (const [property, value] of now) {\n if (was.get(property) !== value) set(property, value);\n }\n for (const property of was.keys()) {\n if (now.has(property)) continue;\n set(property, property in defaults ? defaults[property] : null);\n }\n return result;\n}\n\n/** The value of one attribute, or null. */\nexport function authoredAttribute(markup: AuthoredElement, name: string): string | null {\n return markup.attrs.find(([existing]) => existing === name)?.[1] ?? null;\n}\n\n/**\n * Sets one CSS declaration in the markup's `style`, touching nothing else:\n * an existing declaration keeps its place and spacing, a new one is appended\n * in the style's own punctuation (`a:b;` stays compact, `a: b;` stays spaced).\n */\nexport function withStyleDeclaration(\n markup: AuthoredElement,\n property: string,\n value: string,\n): AuthoredElement {\n const style = authoredAttribute(markup, 'style');\n let next: string;\n if (style === null || !style.trim()) {\n next = `${property}: ${value};`;\n } else {\n const parts = splitDeclarations(style);\n const index = parts.findIndex((part) => declarationProperty(part) === property);\n if (index >= 0) {\n const part = parts[index];\n const colon = part.indexOf(':');\n const spacing = /^\\s*/.exec(part.slice(colon + 1))![0];\n const trailing = /\\s*$/.exec(part)![0];\n parts[index] = `${part.slice(0, colon + 1)}${spacing}${value}${trailing}`;\n next = parts.join(';');\n } else {\n const compact = !/:\\s/.test(style);\n const declaration = compact ? `${property}:${value};` : `${property}: ${value};`;\n const base = style.trimEnd();\n next = base.endsWith(';')\n ? `${base}${compact ? '' : ' '}${declaration}`\n : `${base}; ${declaration}`;\n }\n }\n return withAttribute(markup, 'style', next);\n}\n\n/** Removes one CSS declaration from the markup's `style` (and the attribute\n when nothing is left). */\nexport function withoutStyleDeclaration(\n markup: AuthoredElement,\n property: string,\n): AuthoredElement {\n const style = authoredAttribute(markup, 'style');\n if (style === null) return markup;\n const parts = splitDeclarations(style).filter((part) => declarationProperty(part) !== property);\n const next = parts\n .join(';')\n .replace(/^\\s*;\\s*/, '')\n .trim();\n return next ? withAttribute(markup, 'style', next) : withoutAttribute(markup, 'style');\n}\n\n/** Sets one attribute, in place when present, appended otherwise. */\nexport function withAttribute(\n markup: AuthoredElement,\n name: string,\n value: string,\n): AuthoredElement {\n const exists = markup.attrs.some(([existing]) => existing === name);\n return {\n tag: markup.tag,\n attrs: exists\n ? markup.attrs.map(([existing, old]) => [existing, existing === name ? value : old])\n : [...markup.attrs, [name, value]],\n };\n}\n\nexport function withoutAttribute(markup: AuthoredElement, name: string): AuthoredElement {\n return { tag: markup.tag, attrs: markup.attrs.filter(([existing]) => existing !== name) };\n}\n\n/** The markup of a block split off an authored one: everything inherited\n but the attributes that must stay unique (`id`). */\nexport function inheritedMarkup(markup: AuthoredMarkup): AuthoredMarkup {\n return {\n parsed: markup.parsed,\n path: markup.path.map((element) => withoutAttribute(element, 'id')),\n };\n}\n\n/**\n * For a NodeView that builds its own elements (the table's scroll wrapper,\n * the columns' resize box): the attributes the view should put on the\n * element standing for path entry `index`, or null when the node carries no\n * authored markup — then the view keeps its canonical attributes. Classes the\n * view sets itself are kept alongside the authored ones by\n * {@link applyAuthoredAttributes}.\n */\nexport function authoredViewAttributes(node: Node, index: number): AttributePairs | null {\n const markup = authoredMarkupOf(node);\n if (!markup) return null;\n const rendered = node.type.spec.toDOM?.(node);\n if (!rendered || typeof rendered === 'string') return null;\n const path = renderedPath(\n DOMSerializer.renderSpec(document, rendered) as {\n dom: globalThis.Node;\n contentDOM?: HTMLElement;\n },\n );\n const element = path?.[index];\n if (!element) return null;\n return Array.from(element.attributes, (attr): [string, string] => [attr.name, attr.value]);\n}\n\n/** Puts a node's authored attributes on a view-built element: every other\n attribute goes, except the view's own classes, which stay beside the\n authored ones. No authored markup: nothing changes. */\nexport function applyAuthoredAttributes(element: HTMLElement, node: Node, index: number): void {\n const attrs = authoredViewAttributes(node, index);\n if (!attrs) return;\n const viewClasses = Array.from(element.classList).filter((name) => name.startsWith('aee-'));\n for (const { name } of Array.from(element.attributes)) element.removeAttribute(name);\n for (const [name, value] of attrs) element.setAttribute(name, value);\n element.classList.add(...viewClasses);\n}\n","import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model';\nimport { Extension } from './extension';\nimport { withAuthoredMarkup } from './authored';\n\n/**\n * Builds a ProseMirror {@link Schema} from a list of extensions.\n * Node and mark order follows the array order, which matters for\n * parse precedence and mark nesting.\n */\nexport function createSchema(extensions: Extension[]): Schema {\n const nodes: Record<string, NodeSpec> = {};\n const marks: Record<string, MarkSpec> = {};\n let topNode: string | undefined;\n\n for (const extension of extensions) {\n switch (extension.type) {\n case 'node':\n if (nodes[extension.name]) {\n throw new Error(`Duplicate node extension \"${extension.name}\"`);\n }\n nodes[extension.name] = withAuthoredMarkup(extension.spec);\n if (extension.topNode) {\n topNode = extension.name;\n }\n break;\n case 'mark':\n if (marks[extension.name]) {\n throw new Error(`Duplicate mark extension \"${extension.name}\"`);\n }\n marks[extension.name] = withAuthoredMarkup(extension.spec);\n break;\n case 'extension':\n break;\n }\n }\n\n if (!topNode) {\n throw new Error('No top node defined: one node extension must set `topNode: true`');\n }\n\n return new Schema({ nodes, marks, topNode });\n}\n","/**\n * The dual-contrast rule (we don't fight dark mode): a text color is only\n * offered if it reads against both a white and a near-black background, so\n * it survives light mode and forced dark-mode inversion without a single\n * dark-mode declaration in the output.\n *\n * Honest math note: 4.5:1 (WCAG AA body text) against *both* backgrounds is\n * mathematically empty — no color satisfies it. 3:1, the WCAG threshold for\n * large text and UI components, leaves a band of mid-tones; that band is the\n * palette. Enforcement lives here, at the affordance — colors hand-typed in\n * the HTML source are the author's own responsibility and are never policed.\n */\n\n/** Light-mode reference background. */\nexport const DUAL_CONTRAST_LIGHT = '#ffffff';\n\n/** Typical forced-inversion background (Gmail dark mode territory). */\nexport const DUAL_CONTRAST_DARK = '#121212';\n\n/** WCAG large-text/UI threshold — see the math note above for why not 4.5. */\nexport const DUAL_CONTRAST_MIN_RATIO = 3;\n\nfunction linearize(channel: number): number {\n const s = channel / 255;\n return s <= 0.04045 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);\n}\n\n/** WCAG relative luminance of a `#rrggbb` color. */\nexport function relativeLuminance(hex: string): number {\n const n = parseInt(hex.slice(1), 16);\n return (\n 0.2126 * linearize((n >> 16) & 255) +\n 0.7152 * linearize((n >> 8) & 255) +\n 0.0722 * linearize(n & 255)\n );\n}\n\n/** WCAG contrast ratio between two `#rrggbb` colors, 1..21. */\nexport function contrastRatio(a: string, b: string): number {\n const la = relativeLuminance(a);\n const lb = relativeLuminance(b);\n return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);\n}\n\n/** Whether a color reads against both the light and the dark reference. */\nexport function passesDualContrast(hex: string): boolean {\n return (\n contrastRatio(hex, DUAL_CONTRAST_LIGHT) >= DUAL_CONTRAST_MIN_RATIO &&\n contrastRatio(hex, DUAL_CONTRAST_DARK) >= DUAL_CONTRAST_MIN_RATIO\n );\n}\n\nexport interface PaletteColor {\n name: string;\n value: string;\n /** Offered although it fails its palette's rule — and why. The palette\n tests hold every other swatch to the rule, and this one to failing it,\n so an exception is always a decision on record, never an accident. */\n exception?: string;\n}\n\n/** Flip a `#rrggbb` colour the way a forced-inversion client (Gmail/Outlook\n dark mode) roughly does: each channel to its complement. */\nfunction invert(hex: string): string {\n const n = parseInt(hex.slice(1), 16);\n const r = 255 - ((n >> 16) & 255);\n const g = 255 - ((n >> 8) & 255);\n const b = 255 - (n & 255);\n return '#' + [r, g, b].map((c) => c.toString(16).padStart(2, '0')).join('');\n}\n\n/**\n * The dual-contrast rule for *backgrounds* (principle 9, again). Dark mode\n * hits a fill in two different ways, and a fill must survive both:\n *\n * 1. **Non-transforming dark modes** (Apple Mail, and any surface that only\n * flips the *default text* to near-white while explicit styles stay):\n * near-white text on an untouched pale fill is unreadable. No palette can\n * fix this — the fix is that every fill is **paired with an explicit\n * text colour** inline ({@link fillTextColor}), so the text on a fill\n * never depends on the client's default.\n * 2. **Forced inversion** (Gmail/Outlook dark mode): fill *and* text are\n * recoloured together — a pale fill becomes dark, its near-black text\n * near-white; a dark fill becomes light, its white text dark. The pair\n * must still read after that flip.\n *\n * Unlike the text rule (mid-tones), this selects the **ends**: pale tints\n * paired with near-black text, and near-blacks paired with white. Mid-tone\n * fills fail one side and are excluded — enforcement at the affordance, never\n * policing hand-typed source.\n */\nexport const DUAL_BACKGROUND_MIN_RATIO = 4.5;\n\n/**\n * The text colour a pale fill carries (highlight span, table cell, column\n * panel) alongside its `background-color`. Near-black, so it reads on every\n * pale fill in light mode and in non-transforming dark modes; its complement\n * is near-white, so forced inversion keeps the pair readable. Emitted as an\n * *artifact of the fill* — parsing absorbs it back to \"no explicit colour\"\n * (see {@link isFillTextColor}), so it round-trips clean.\n */\nexport const FILL_TEXT_COLOR = '#202124';\n\n/** {@link FILL_TEXT_COLOR} as the CSSOM serialises it. */\nexport const FILL_TEXT_COLOR_RGB = 'rgb(32, 33, 36)';\n\n/** The text colour a dark fill carries: white — the mirror of\n {@link FILL_TEXT_COLOR}, for the same two dark-mode reasons. */\nexport const FILL_TEXT_COLOR_LIGHT = '#ffffff';\n\n/** A `#rgb`, `#rrggbb` or CSSOM `rgb()` / `rgba()` colour as `#rrggbb`, or\n null for anything else (a keyword, a function this does not read). */\nfunction toHex(raw: string): string | null {\n const v = raw.trim().toLowerCase();\n if (/^#[0-9a-f]{6}$/.test(v)) return v;\n if (/^#[0-9a-f]{3}$/.test(v)) return '#' + [...v.slice(1)].map((c) => c + c).join('');\n const rgb = /^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/.exec(v);\n if (!rgb) return null;\n return (\n '#' +\n rgb\n .slice(1, 4)\n .map((c) => Math.min(255, Number(c)).toString(16).padStart(2, '0'))\n .join('')\n );\n}\n\n/** A `#rrggbb` colour as the CSSOM serialises it. */\nfunction cssomRgb(hex: string): string {\n const n = parseInt(hex.slice(1), 16);\n return `rgb(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255})`;\n}\n\n/** The text a fill is paired with: white on a dark fill, near-black on\n anything else (a colour this cannot read included). */\nexport function fillTextColor(background: string): string {\n const hex = toHex(background);\n if (!hex) return FILL_TEXT_COLOR;\n return contrastRatio(hex, FILL_TEXT_COLOR_LIGHT) > contrastRatio(hex, FILL_TEXT_COLOR)\n ? FILL_TEXT_COLOR_LIGHT\n : FILL_TEXT_COLOR;\n}\n\n/** Whether a parsed `color` is the text paired with `background` (hex or\n CSSOM rgb form) — an emit artifact to absorb, not an authored colour to\n keep. */\nexport function isFillTextColor(raw: string | null | undefined, background: string): boolean {\n if (!raw) return false;\n const v = raw.trim().toLowerCase().replace(/\\s+/g, ' ');\n const paired = fillTextColor(background);\n return v === paired || v === cssomRgb(paired);\n}\n\n/** Whether a fill reads with the text it is paired with ({@link fillTextColor})\n both as-is (light mode and non-transforming dark modes) and after forced\n inversion. */\nexport function passesDualBackground(hex: string): boolean {\n const text = fillTextColor(hex);\n return (\n contrastRatio(hex, text) >= DUAL_BACKGROUND_MIN_RATIO && // paired text reads on it\n contrastRatio(invert(hex), invert(text)) >= DUAL_BACKGROUND_MIN_RATIO // and inverted\n );\n}\n\n/**\n * The curated background palette: white, pale tints and a near-black, all\n * passing {@link passesDualBackground} — proven by test. Shared by every\n * background affordance (text highlight, table cells, column panels) so fills\n * read the same everywhere and survive inversion. Black carries white text.\n */\nexport const emailBackgroundPalette: PaletteColor[] = [\n { name: 'White', value: '#ffffff' },\n { name: 'Gray', value: '#f1f3f4' },\n { name: 'Black', value: '#202124' },\n { name: 'Red', value: '#fce8e6' },\n { name: 'Orange', value: '#feefe3' },\n { name: 'Yellow', value: '#fef7e0' },\n { name: 'Green', value: '#e6f4ea' },\n { name: 'Teal', value: '#e0f2f1' },\n { name: 'Blue', value: '#e8f0fe' },\n { name: 'Purple', value: '#f3e8fd' },\n { name: 'Pink', value: '#fce7f0' },\n];\n\n/**\n * The curated text palette: mid-tone hues that pass {@link passesDualContrast}\n * — proven by test, not by promise. This is what a color picker should offer\n * instead of an arbitrary hex input.\n *\n * Black and white are the two exceptions (no neutral near either end passes:\n * the band runs from #616161 to #949494), offered because a writer needs\n * them — black to take coloured text back to plain, white for text on a dark\n * fill.\n */\nexport const emailTextPalette: PaletteColor[] = [\n {\n name: 'Black',\n value: '#202124',\n exception: 'Vanishes on a dark client that keeps explicit colours; inverters flip it.',\n },\n { name: 'Gray', value: '#5f6368' },\n {\n name: 'White',\n value: '#ffffff',\n exception: 'Invisible on a white page — it is for text on a dark fill.',\n },\n { name: 'Brown', value: '#8d6e63' },\n { name: 'Red', value: '#c5221f' },\n { name: 'Orange', value: '#c2410c' },\n { name: 'Amber', value: '#a05a00' },\n { name: 'Olive', value: '#808000' },\n { name: 'Green', value: '#188038' },\n { name: 'Teal', value: '#0f766e' },\n { name: 'Cyan', value: '#0e7490' },\n { name: 'Blue', value: '#1a73e8' },\n { name: 'Indigo', value: '#6366f1' },\n { name: 'Purple', value: '#9333ea' },\n { name: 'Pink', value: '#c2185b' },\n];\n","import { Node } from 'prosemirror-model';\nimport { EditorState, NodeSelection, TextSelection } from 'prosemirror-state';\n\n/** An inline atom with a box of its own — what a range can cover like a\n character, and a click selects whole: an image, a button. Not a line\n break, which has no box to paint. */\nexport function isInlineAtom(node: Node): boolean {\n return (\n node.isInline &&\n node.isAtom &&\n !node.isText &&\n node.type.spec.selectable !== false &&\n !node.type.spec.linebreakReplacement &&\n node.type.name !== 'hardBreak'\n );\n}\n\n/** The marks an atom takes as boolean attributes of the mark's name — a\n button's `bold` and `italic` (`markAttrs` in its spec). Empty for the\n rest. */\nexport function markAttrsOf(node: Node): readonly string[] {\n return (node.type.spec['markAttrs'] as readonly string[] | undefined) ?? [];\n}\n\nexport interface InlineAtomAt {\n pos: number;\n node: Node;\n}\n\n/** The one inline atom a range holds beside whitespace, or null — see\n {@link soleInlineAtom}. */\nfunction soleAtomIn(doc: Node, from: number, to: number): InlineAtomAt | null {\n let atom: InlineAtomAt | null = null;\n let other = false;\n doc.nodesBetween(from, to, (node, pos) => {\n if (other) return false;\n if (!node.isInline) return true;\n if (node.isText) {\n // Only the part inside the range: a drag that took half a word took\n // letters, one that stopped in the spaces before it took none.\n const text = (node.text ?? '').slice(\n Math.max(from, pos) - pos,\n Math.min(to, pos + node.nodeSize) - pos,\n );\n if (text.trim()) other = true;\n } else if (isInlineAtom(node)) {\n if (atom) other = true;\n else atom = { pos, node };\n }\n // A line break, or any other inline leaf, is whitespace.\n return false;\n });\n return other ? null : atom;\n}\n\n/**\n * The inline atom a selection holds and nothing else, or null: a click's\n * node selection, or a range — a drag's, Shift-arrow's — whose content is\n * that one atom. Whitespace does not count: a range that took the spaces or\n * tabs around an image, or the line break after it, still holds the image\n * alone (a hundred spaces are no space). A letter does, and so does a\n * second atom — a range over an image and a button is a text selection.\n *\n * What an atom's own chrome keys on: an image's bubble menu, a button's,\n * their actions. `type` narrows it to one node type.\n */\nexport function soleInlineAtom(state: EditorState, type?: string): InlineAtomAt | null {\n const { selection, doc } = state;\n let atom: InlineAtomAt | null = null;\n if (selection instanceof NodeSelection) {\n if (isInlineAtom(selection.node)) atom = { pos: selection.from, node: selection.node };\n } else if (!selection.empty && selection instanceof TextSelection) {\n atom = soleAtomIn(doc, selection.from, selection.to);\n }\n if (!atom) return null;\n return type && atom.node.type.name !== type ? null : atom;\n}\n","import { EditorState, Transaction, TextSelection } from 'prosemirror-state';\nimport { MarkType } from 'prosemirror-model';\nimport { isInlineAtom, markAttrsOf } from '../inline-atoms';\n\n/**\n * A reusable, safe command to set a mark, inspired by Tiptap.\n *\n * An inline atom in the range takes no mark: one that carries the mark as\n * an attribute (a button's `bold`) has it switched on instead, and the\n * rest — an image — are left alone, the styling landing on the text\n * around them.\n */\nexport function setMark(markType: MarkType, attributes: Record<string, any> = {}) {\n return (state: EditorState, dispatch?: (tr: Transaction) => void): boolean => {\n const { selection, tr, doc } = state;\n const { empty, ranges } = selection;\n\n // 1. Handle the Empty Cursor State safely (Fixing your TS Error)\n if (empty) {\n if (selection instanceof TextSelection && selection.$cursor) {\n if (dispatch) {\n // Merge with the mark about to be typed in, as a range merges below:\n // a background picked at the caret keeps the colour picked there.\n const marks = state.storedMarks ?? selection.$cursor.marks();\n const existing = marks.find((mark) => mark.type === markType);\n tr.addStoredMark(markType.create({ ...existing?.attrs, ...attributes }));\n dispatch(tr);\n }\n return true;\n }\n return false; // Not a text selection, cannot apply stored mark\n }\n\n // 2. Handle Selected Text (Using Tiptap's nodesBetween approach)\n let hasApplied = false;\n\n if (dispatch) {\n ranges.forEach((range) => {\n const { $from, $to } = range;\n\n doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n // Skip if it's not an inline text node\n if (!node.isInline) return true;\n\n if (isInlineAtom(node)) {\n if (markAttrsOf(node).includes(markType.name)) {\n if (node.attrs[markType.name] !== true) tr.setNodeAttribute(pos, markType.name, true);\n hasApplied = true;\n }\n return false;\n }\n\n const trimmedFrom = Math.max(pos, $from.pos);\n const trimmedTo = Math.min(pos + node.nodeSize, $to.pos);\n\n // Check if this node already has this mark type\n const existingMark = node.marks.find((m) => m.type === markType);\n\n if (existingMark) {\n // MERGE attributes (Lesson 3)\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n markType.create({ ...existingMark.attrs, ...attributes }),\n );\n } else {\n // CREATE fresh mark\n tr.addMark(trimmedFrom, trimmedTo, markType.create(attributes));\n }\n\n hasApplied = true;\n return true; // Continue iterating\n });\n });\n\n if (hasApplied) {\n dispatch(tr.scrollIntoView());\n }\n } else {\n // If no dispatch is provided, the editor is just asking \"CAN I run this command?\"\n // We return true to light up the toolbar button.\n hasApplied = true;\n }\n\n return hasApplied;\n };\n}\n","import { EditorState, Transaction } from 'prosemirror-state';\nimport { MarkType } from 'prosemirror-model';\nimport { markAttrsOf } from '../inline-atoms';\n\n/**\n * A reusable, safe command to unset a mark. An atom in the range that\n * carries the mark as an attribute (a button's `bold`) has it switched\n * off with the text's mark.\n */\nexport function unsetMark(markType: MarkType, attrs?: string[]) {\n return (state: EditorState, dispatch?: (tr: Transaction) => void): boolean => {\n if (!dispatch) return true;\n\n const { selection, tr } = state;\n const { empty, ranges } = selection;\n\n if (!empty) {\n ranges.forEach((range) => {\n if (!attrs) {\n // Original behavior — nuke the whole mark\n tr.removeMark(range.$from.pos, range.$to.pos, markType);\n state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n if (markAttrsOf(node).includes(markType.name) && node.attrs[markType.name] === true) {\n tr.setNodeAttribute(pos, markType.name, false);\n }\n });\n } else {\n const nulled = Object.fromEntries(attrs.map((k) => [k, null]));\n state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n const mark = markType.isInSet(node.marks);\n if (!mark) return;\n const next = { ...mark.attrs, ...nulled };\n tr.removeMark(pos, pos + node.nodeSize, markType);\n if (!Object.values(next).every((v) => v === null)) {\n tr.addMark(pos, pos + node.nodeSize, markType.create(next));\n }\n });\n }\n });\n }\n\n // Stored mark (cursor) handling\n if (!attrs) {\n tr.removeStoredMark(markType);\n } else {\n const nulled = Object.fromEntries(attrs.map((k) => [k, null]));\n const stored = tr.storedMarks ?? state.selection.$from.marks();\n const current = markType.isInSet(stored);\n if (current) {\n const next = { ...current.attrs, ...nulled };\n tr.removeStoredMark(markType);\n if (!Object.values(next).every((v) => v === null)) {\n tr.addStoredMark(markType.create(next));\n }\n }\n }\n\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n","import { Schema } from 'prosemirror-model';\nimport { EditorState } from 'prosemirror-state';\nimport { defineMark } from '../../extension';\nimport { fillTextColor, isFillTextColor } from '../../dual-contrast';\nimport { setMark } from './set.utils';\nimport { unsetMark } from './unset.utils';\n\n/**\n * Allow only color values that can't smuggle extra declarations into the\n * `style` attribute: hex, rgb[a]/hsl[a] functional notation, or a bare CSS\n * named color. Mirrors the security-consciousness of the link mark's\n * `isSafeUrl`. `node.style.color` is already normalised by the browser's\n * CSSOM, but the legacy `<font color>` path and the programmatic `setColor`\n * command take raw strings, so we gate both.\n */\nexport function isSafeColor(color: string | null | undefined): color is string {\n if (!color) return false;\n return (\n /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||\n /^rgba?\\([\\d\\s.,%]+\\)$/i.test(color) ||\n /^hsla?\\([\\d\\s.,%]+\\)$/i.test(color) ||\n /^[a-z]+$/i.test(color)\n );\n}\n\n/**\n * Normalise any CSS color to a hex string the editor stores internally.\n * Call this before passing a color value to setColor — never store oklch/lab/hsl\n * in the mark attrs, because toDOM emits them verbatim into email HTML.\n */\nexport function toEmailSafeColor(raw: string): string | null {\n if (!raw) return null;\n // A CSS-wide keyword is no colour: `initial` is what the CSSOM says for a\n // `background: url(…)` shorthand's colour, and it computes to black.\n if (\n /^(initial|inherit|unset|revert|revert-layer|transparent|currentcolor|none)$/i.test(raw.trim())\n ) {\n return null;\n }\n\n // Already hex — fast path. Lower-cased, as the rgb path writes it: an\n // engine that expands a builder's `background: #040B4F` shorthand hands\n // the rgb over, one that does not hands the words over, and the import\n // must come out the same in both.\n if (/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(raw)) return raw.toLowerCase();\n\n // Use the browser's own color parser: assign to a hidden element's style,\n // read back the computed value (always rgb(...) or rgba(...)), then hex-encode.\n const el = document.createElement('span');\n el.style.color = raw; // browser parses + normalises\n document.body.appendChild(el);\n const computed = getComputedStyle(el).color; // → \"rgb(r, g, b)\" or \"rgba(...)\"\n document.body.removeChild(el);\n\n const match = computed.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*[\\d.]+)?\\)/);\n if (!match) return null;\n\n const [, r, g, b] = match.map(Number);\n return '#' + [r, g, b].map((n) => n.toString(16).padStart(2, '0')).join('');\n}\n\nexport type TextTransform = 'uppercase' | 'lowercase' | 'capitalize';\n\n/** A `text-transform` the mark takes: the three cases; `none` and the\n rest are the words as written. */\nexport function parseTextTransform(raw: string | null | undefined): TextTransform | null {\n const value = (raw ?? '').trim().toLowerCase();\n return value === 'uppercase' || value === 'lowercase' || value === 'capitalize' ? value : null;\n}\n\n/** Whether the selection (or the caret's stored marks) shows in capitals. */\nfunction isUppercase(state: EditorState, schema: Schema): boolean {\n const type = schema.marks['textStyle'];\n const { from, $from, to, empty } = state.selection;\n if (empty) {\n const marks = state.storedMarks ?? $from.marks();\n return marks.some((mark) => mark.type === type && mark.attrs['textTransform'] === 'uppercase');\n }\n let found = false;\n state.doc.nodesBetween(from, to, (node) => {\n if (found || !node.isInline) return !found;\n found = node.marks.some(\n (mark) => mark.type === type && mark.attrs['textTransform'] === 'uppercase',\n );\n return !found;\n });\n return found;\n}\n\nconst ALLOWED_SIZES = [10, 12, 14, 16, 18, 24, 32] as const;\nexport type FontSize = (typeof ALLOWED_SIZES)[number];\n\nexport function isSafeFontSize(value: unknown): value is FontSize {\n return ALLOWED_SIZES.includes(value as FontSize);\n}\n\n/**\n * Parse a font-size value from the DOM into one of our allowed sizes.\n * Handles px strings (\"16px\"), plain numbers, and rejects everything else.\n */\nexport function parseFontSize(raw: string | null | undefined): FontSize | null {\n if (!raw) return null;\n const n = parseFloat(raw);\n if (!Number.isFinite(n) || n <= 0 || !/^\\s*\\d+(?:\\.\\d+)?(?:px)?\\s*$/.test(raw)) return null;\n if (isSafeFontSize(n)) return n;\n // A size off the ladder — a builder's 11px, 13px, 15px — snaps to the\n // nearest rung, upward on a tie: read as the size it is nearest to, not\n // dropped to the default. (The schema still emits only its own rungs.)\n let nearest: FontSize = ALLOWED_SIZES[0];\n for (const size of ALLOWED_SIZES) {\n const better =\n Math.abs(size - n) < Math.abs(nearest - n) ||\n (Math.abs(size - n) === Math.abs(nearest - n) && size > nearest);\n if (better) nearest = size;\n }\n return nearest;\n}\n\n/**\n * The sizes the toolbar picker offers: the phone-safe subset (≥14px). Below\n * ~13px iOS auto-inflates text and reflows the layout (responsiveness ledger,\n * principle 8), so we don't *offer* those — but {@link parseFontSize} still\n * accepts the full {@link ALLOWED_SIZES} range, because a hand-typed size in\n * the HTML source pane is the author's own responsibility, exactly like a\n * hand-typed hex colour.\n */\nexport const emailFontSizes: FontSize[] = [14, 16, 18, 24, 32];\n\n/** A curated, email-safe font stack the toolbar offers. */\nexport interface EmailFont {\n /** Toolbar label. */\n name: string;\n /** The exact `font-family` value emitted — the canonical stored form. */\n stack: string;\n}\n\n/**\n * The curated font stacks — the picker offers only these, no free-form fonts\n * (principle 7: if a mainstream client can't render it, we don't emit it).\n *\n * Deliberately built from *single-word* family identifiers plus a generic\n * fallback: a stack like `Courier New` would round-trip through the CSSOM\n * (serialization builds real elements and re-reads them) and come back quoted\n * as `\"Courier New\"` in Chrome but unquoted in jsdom — a byte-instability that\n * breaks canonical determinism and makes tests disagree with the runtime (the\n * same trap the longhand/`rgb()` rule guards against). Bare identifiers and\n * generic keywords serialize identically everywhere.\n */\nexport const emailFontFamilies: EmailFont[] = [\n { name: 'Sans-serif', stack: 'Arial, Helvetica, sans-serif' },\n { name: 'Serif', stack: 'Georgia, Times, serif' },\n { name: 'Monospace', stack: 'Courier, monospace' },\n { name: 'System', stack: 'system-ui, sans-serif' },\n];\n\n/** Normalise a `font-family` value to a comparison key: lower-cased, quotes\n dropped, whitespace around commas collapsed. Lets a hand-typed or CSSOM-\n reserialized stack match a curated one regardless of cosmetic differences. */\nfunction fontFamilyKey(raw: string): string {\n return raw\n .toLowerCase()\n .replace(/[\"']/g, '')\n .replace(/\\s*,\\s*/g, ',')\n .trim();\n}\n\nconst FONT_STACK_BY_KEY = new Map(emailFontFamilies.map((f) => [fontFamilyKey(f.stack), f.stack]));\n\n/** Each family a curated stack names — a face or its generic — to the first\n stack naming it: `helvetica` and `sans-serif` to Sans-serif, `times` and\n `serif` to Serif. */\nconst FONT_STACK_BY_FAMILY = new Map<string, string>();\nfor (const { stack } of emailFontFamilies) {\n for (const family of fontFamilyKey(stack).split(',')) {\n if (!FONT_STACK_BY_FAMILY.has(family)) FONT_STACK_BY_FAMILY.set(family, stack);\n }\n}\n\nexport function isSafeFontFamily(value: unknown): value is string {\n return typeof value === 'string' && FONT_STACK_BY_KEY.has(fontFamilyKey(value));\n}\n\n/**\n * Parse a font-family value from the DOM into one of our curated stacks,\n * returning the *canonical* stack string (so a cosmetically different but\n * equivalent input normalises to the exact bytes we emit). A stack of\n * someone else's reads as the curated one it falls back to — the first of\n * its families a curated stack names, its generic last: a builder's web\n * font (`Ubuntu, Helvetica, Arial, sans-serif`) is Sans-serif, the face a\n * client without that font draws anyway. Nothing to fall back to, no font.\n */\nexport function parseFontFamily(raw: string | null | undefined): string | null {\n if (!raw) return null;\n const key = fontFamilyKey(raw);\n const exact = FONT_STACK_BY_KEY.get(key);\n if (exact) return exact;\n for (const family of key.split(',')) {\n const stack = FONT_STACK_BY_FAMILY.get(family.trim());\n if (stack) return stack;\n }\n return null;\n}\n\n/**\n * TipTap-style `textStyle` mark: a `<span style=\"…\">` container holding inline\n * text-styling attributes — `color`, `fontSize`, `fontFamily` and\n * `backgroundColor` (the highlighter). All hang off one shared span and merge\n * into a single `style` string instead of nesting wrapper tags.\n *\n * Modeled on `@tiptap/extension-text-style` + `@tiptap/extension-color`: each\n * primitive is an *attribute* on the span, not its own mark, so `setColor`,\n * `setFontSize`, … all coalesce onto the same element. `backgroundColor` fills\n * only from the curated dual-safe background palette (principle 9); a hand-typed\n * fill in the HTML source is the author's own responsibility, never policed.\n */\nexport const TextStyle = defineMark({\n name: 'textStyle',\n spec: {\n attrs: {\n color: { default: null },\n fontSize: { default: null },\n fontFamily: { default: null },\n backgroundColor: { default: null },\n /** `uppercase`, `lowercase` or `capitalize` — a builder's navbar and\n headings wear one; null for the words as written. */\n textTransform: { default: null },\n },\n parseDOM: [\n {\n tag: 'span',\n getAttrs: (node) => {\n let color = isSafeColor(node.style?.color) ? node.style.color : null;\n const fontSize = parseFontSize(node.style?.fontSize);\n const fontFamily = parseFontFamily(node.style?.fontFamily);\n const backgroundColor = isSafeColor(node.style?.backgroundColor)\n ? node.style.backgroundColor\n : null;\n // The paired fill text colour is an emit artifact of the fill, not\n // an authored colour — absorb it so the pair round-trips clean and\n // clearing the fill later also clears its text colour.\n if (backgroundColor && isFillTextColor(color, backgroundColor)) color = null;\n const textTransform = parseTextTransform(node.style?.textTransform);\n if (!color && !fontSize && !fontFamily && !backgroundColor && !textTransform) {\n return false;\n }\n return { color, fontSize, fontFamily, backgroundColor, textTransform };\n },\n },\n {\n // Legacy <font color=\"…\"> turns up in plenty of inbound email HTML.\n tag: 'font[color]',\n getAttrs: (node) => {\n const color = node.getAttribute('color');\n return isSafeColor(color) ? { color } : false;\n },\n },\n ],\n toDOM: (mark) => {\n const { color, fontSize, fontFamily, backgroundColor, textTransform } = mark.attrs;\n // A fill never rides on the client's default text colour: without an\n // authored colour it carries its paired text (see fillTextColor).\n const textColor = color ?? (backgroundColor ? fillTextColor(backgroundColor) : null);\n const style = [\n textColor ? `color: ${textColor}` : null,\n fontSize ? `font-size: ${fontSize}px` : null,\n fontFamily ? `font-family: ${fontFamily}` : null,\n backgroundColor ? `background-color: ${backgroundColor}` : null,\n textTransform ? `text-transform: ${textTransform}` : null,\n ]\n .filter(Boolean)\n .join('; ');\n return ['span', style ? { style } : {}, 0];\n },\n },\n commands: ({ schema }) => ({\n /**\n * Apply (or recolor) the selection. setMark merges attrs, so this also\n * updates an existing textStyle span in place rather than nesting.\n */\n setColor: (color: string) => (state, dispatch) => {\n const safeColor = toEmailSafeColor(color);\n return safeColor\n ? setMark(schema.marks['textStyle'], { color: safeColor })(state, dispatch)\n : false;\n },\n\n /**\n * Clear the color. `color` is textStyle's only attribute today, so this\n * drops the whole span; make it attribute-aware if more attrs are added.\n */\n unsetColor: () => unsetMark(schema.marks['textStyle'], ['color']),\n\n /**\n * Apply a font-size to the selection.\n */\n setFontSize: (size: number) => (state, dispatch) =>\n isSafeFontSize(size)\n ? setMark(schema.marks['textStyle'], { fontSize: size })(state, dispatch)\n : false,\n\n /**\n * Clear the font-size.\n */\n unsetFontSize: () => unsetMark(schema.marks['textStyle'], ['fontSize']),\n\n /**\n * Apply one of the curated font stacks to the selection. A value outside\n * the curated set is refused (the picker never sends one; a hand-typed\n * source-pane value is handled by the parser, not this command).\n */\n setFontFamily: (family: string) => (state, dispatch) => {\n const stack = parseFontFamily(family);\n return stack\n ? setMark(schema.marks['textStyle'], { fontFamily: stack })(state, dispatch)\n : false;\n },\n\n /**\n * Clear the font-family.\n */\n unsetFontFamily: () => unsetMark(schema.marks['textStyle'], ['fontFamily']),\n\n /**\n * Set the case the words are shown in — `uppercase`, `lowercase` or\n * `capitalize` — leaving them as typed underneath.\n */\n setTextTransform: (value: TextTransform) => (state, dispatch) =>\n parseTextTransform(value)\n ? setMark(schema.marks['textStyle'], { textTransform: value })(state, dispatch)\n : false,\n\n /**\n * Show the words as typed again.\n */\n unsetTextTransform: () => unsetMark(schema.marks['textStyle'], ['textTransform']),\n\n /**\n * Apply a background color to the selection.\n */\n setBackgroundColor: (color: string) => (state, dispatch) => {\n const safe = toEmailSafeColor(color);\n return safe\n ? setMark(schema.marks['textStyle'], { backgroundColor: safe })(state, dispatch)\n : false;\n },\n\n /**\n * Clear the background color.\n */\n unsetBackgroundColor: () => unsetMark(schema.marks['textStyle'], ['backgroundColor']),\n }),\n actions: ({ schema }) => [\n {\n id: 'uppercase',\n section: 'styling',\n title: 'Uppercase',\n keywords: ['uppercase', 'capitals', 'caps', 'case'],\n icon: 'keyboard_capslock',\n command: (state, dispatch) =>\n isUppercase(state, schema)\n ? unsetMark(schema.marks['textStyle'], ['textTransform'])(state, dispatch)\n : setMark(schema.marks['textStyle'], { textTransform: 'uppercase' })(state, dispatch),\n isActive: (state) => isUppercase(state, schema),\n },\n ],\n});\n","import {\n chainCommands,\n createParagraphNear,\n liftEmptyBlock,\n newlineInCode,\n splitBlockAs,\n} from 'prosemirror-commands';\nimport { Command, EditorState, Transaction } from 'prosemirror-state';\nimport { Mark, Node } from 'prosemirror-model';\nimport { defineExtension } from '../extension';\nimport { AUTHORED_ATTR, authoredMarkupOf, inheritedMarkup } from '../authored';\n\n/**\n * The marks active at the cursor that should *continue past a break* — dropping\n * any that opt out via `splittable: false` (e.g. `link`, so a break inside a\n * link doesn't drag it onto the next line).\n *\n * This is the single rule both break paths share: forced line breaks\n * (Shift-Enter, {@link ../nodes/hard-break}) and paragraph splits (Enter,\n * below). Formatting like font/colour/bold has no `splittable` flag, so it\n * survives — matching Gmail, where a font chosen on a bare cursor sticks for\n * the rest of the passage you type, new lines included.\n */\nexport function marksAcrossBreak(state: EditorState): readonly Mark[] | 0 {\n const active =\n state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n // `active` is `0` at the very start of a block (no marks to carry); an empty\n // array means every active mark opted out and continuation is cleared.\n return active ? active.filter((mark) => mark.type.spec['splittable'] !== false) : active;\n}\n\n/**\n * The block Enter at the *end* of a line starts: ProseMirror's default is a\n * bare default block, which drops the line's alignment and indent. Gmail\n * and Docs keep both — a centred or indented passage stays so as you type\n * on — so a paragraph continues as a paragraph with its own attrs. Any other\n * block (a heading) still ends in a plain line, and a split mid-line keeps\n * the attrs on both halves by itself.\n */\nconst continueParagraph = (node: Node, atEnd: boolean) =>\n atEnd && node.type.name === 'paragraph' ? { type: node.type, attrs: node.attrs } : null;\n\n/**\n * `splitBlock` that carries the surviving marks onto the new block — the\n * `splittable`-aware sibling of prosemirror-commands' `splitBlockKeepMarks`.\n * Without this, ProseMirror's default `splitBlock` drops every mark on Enter,\n * so a font/colour set on the cursor vanishes the moment you start a new line.\n */\nconst splitBlockKeepingMarks: Command = (state, dispatch) =>\n splitBlockAs(continueParagraph)(\n state,\n dispatch &&\n ((tr) => {\n const marks = marksAcrossBreak(state);\n if (marks) tr.ensureMarks(marks);\n inheritAuthoredMarkup(state, tr);\n dispatch(tr);\n }),\n );\n\n/**\n * Binds Enter to a mark-preserving paragraph split. Must sit *after* the list\n * and blockquote extensions in the kit (so their own Enter handling wins inside\n * those structures) and *before* {@link ../base-keymap} (whose plain\n * `splitBlock` this replaces as the fallback). Lists already keep marks via\n * `splitListItemKeepMarks`; this closes the same gap for ordinary `<div>` lines.\n */\nexport const SplitKeepingMarks = defineExtension({\n name: 'splitKeepingMarks',\n keymap: () => ({\n Enter: chainCommands(\n newlineInCode,\n createParagraphNear,\n liftEmptyBlock,\n splitBlockKeepingMarks,\n ),\n }),\n});\n\n/**\n * A line split off an authored one (MJML's `<div style=\"font-size:11px;…\">`)\n * inherits its markup, minus the `id` (authored.ts). ProseMirror's split\n * clones attributes mid-line but may start a *default* block at the end of\n * one — a bare `<div>` that, inside an MJML cell (`font-size: 0px`), would be\n * invisible text.\n */\nfunction inheritAuthoredMarkup(state: EditorState, tr: Transaction): void {\n const original = state.selection.$from.parent;\n const markup = authoredMarkupOf(original);\n if (!markup) return;\n const $pos = tr.selection.$from;\n if ($pos.depth === 0 || $pos.parent.type !== original.type) return;\n tr.setNodeMarkup($pos.before(), undefined, {\n ...$pos.parent.attrs,\n [AUTHORED_ATTR]: inheritedMarkup(markup),\n });\n}\n","/**\n * An element's inline style read off the `style` attribute's own text,\n * and the normalisation that lets every engine's CSSOM read it the same.\n *\n * The import reads a builder's styles through the CSSOM where it can —\n * the engine expands a shorthand, prints a colour one way — and the\n * canonical form must come out the same wherever the import runs: the\n * replica the editor shows is what is sent, and the replica files the\n * unit suite writes under jsdom must be what a browser makes. jsdom's\n * CSSOM is not a browser's:\n *\n * - a `background:` shorthand it cannot parse (MJML's `background:#fff`,\n * a `background:url(…) center / cover no-repeat`) makes it drop the\n * **whole** attribute — display, colour, size, padding and all;\n * - a `padding`/`margin` longhand written after the shorthand\n * (`padding:0px;padding-top:20px`) is dropped, the shorthand kept.\n *\n * {@link normalizeInlineStyles} rewrites exactly those two shapes into\n * declarations every engine parses alike (the longhands of a background,\n * one four-value shorthand for a box), leaving every other declaration\n * as authored; {@link inlineBox} reads a box off the text regardless.\n */\n\nexport interface Declaration {\n name: string;\n value: string;\n important: boolean;\n}\n\n/** A style attribute's declarations: split on `;` outside parentheses and\n quotes (a `url(data:…;base64,…)` holds one), names lower-cased,\n `!important` lifted off the value. Empty and nameless parts dropped. */\nexport function parseDeclarations(style: string): Declaration[] {\n const declarations: Declaration[] = [];\n for (const text of splitDeclarations(style)) {\n const colon = text.indexOf(':');\n if (colon < 0) continue;\n const name = text.slice(0, colon).trim().toLowerCase();\n let value = text.slice(colon + 1).trim();\n const important = /!\\s*important$/i.test(value);\n if (important) value = value.replace(/!\\s*important$/i, '').trim();\n if (!name || !value) continue;\n declarations.push({ name, value, important });\n }\n return declarations;\n}\n\nfunction splitDeclarations(style: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let quote: string | null = null;\n let start = 0;\n for (let i = 0; i < style.length; i++) {\n const ch = style[i];\n if (quote) {\n if (ch === quote && style[i - 1] !== '\\\\') quote = null;\n continue;\n }\n if (ch === '\"' || ch === \"'\") quote = ch;\n else if (ch === '(') depth++;\n else if (ch === ')') depth = Math.max(0, depth - 1);\n else if (ch === ';' && depth === 0) {\n parts.push(style.slice(start, i));\n start = i + 1;\n }\n }\n parts.push(style.slice(start));\n return parts.map((part) => part.trim()).filter(Boolean);\n}\n\n/** The four sides of a box as written (`20px`, `0`, `auto`), top right\n bottom left — or null where the element declares none. The cascade's\n reading: a shorthand sets all four, a longhand its one, later wins; a\n longhand alone leaves the other sides `0`. */\nexport type BoxSides = [string, string, string, string];\n\nconst SIDES = ['top', 'right', 'bottom', 'left'] as const;\n\nexport function inlineBox(el: Element, property: 'padding' | 'margin'): BoxSides | null {\n const style = el.getAttribute('style');\n if (!style) return null;\n return boxOf(parseDeclarations(style), property);\n}\n\nfunction boxOf(declarations: Declaration[], property: 'padding' | 'margin'): BoxSides | null {\n let sides: BoxSides | null = null;\n for (const { name, value } of declarations) {\n if (name === property) {\n const parts = value.split(/\\s+/);\n if (parts.length > 4) continue;\n const [t, r = t, b = t, l = r] = parts;\n sides = [t, r, b, l];\n } else if (name.startsWith(`${property}-`)) {\n const index = SIDES.indexOf(name.slice(property.length + 1) as (typeof SIDES)[number]);\n if (index < 0) continue;\n sides ??= ['0', '0', '0', '0'];\n sides[index] = value;\n }\n }\n return sides;\n}\n\n/** The padding an element declares inline — see {@link inlineBox}. */\nexport const inlinePadding = (el: Element): BoxSides | null => inlineBox(el, 'padding');\n\n/** Whether a declared side is a zero (`0`, `0px`, `0em`, `0%`). */\nexport function isZeroSide(side: string): boolean {\n return /^0(?:px|em|rem|%)?$/i.test(side.trim());\n}\n\n/**\n * Rewrites, under `root`, every `style` attribute whose text an engine\n * might read wrong — see the module note — into the same declarations in\n * longhand or one shorthand. An attribute with neither shape is left as\n * authored, to the character.\n */\nexport function normalizeInlineStyles(root: ParentNode): void {\n for (const el of Array.from(root.querySelectorAll('[style]'))) {\n const authored = el.getAttribute('style') ?? '';\n const normalized = normalizeStyleText(authored);\n if (normalized !== null) el.setAttribute('style', normalized);\n }\n}\n\n/** The normalised text, or null when the authored text needs no change. */\nexport function normalizeStyleText(style: string): string | null {\n const declarations = parseDeclarations(style);\n const hasBackgroundShorthand = declarations.some((d) => d.name === 'background');\n const mixed = (property: 'padding' | 'margin') =>\n declarations.some((d) => d.name === property) &&\n declarations.some((d) => d.name.startsWith(`${property}-`));\n const mixedPadding = mixed('padding');\n const mixedMargin = mixed('margin');\n if (!hasBackgroundShorthand && !mixedPadding && !mixedMargin) return null;\n\n const out: string[] = [];\n const boxWritten = { padding: false, margin: false };\n const print = (name: string, value: string, important: boolean) =>\n out.push(`${name}: ${value}${important ? ' !important' : ''}`);\n for (const { name, value, important } of declarations) {\n if (name === 'background') {\n for (const [longhand, part] of expandBackground(value)) print(longhand, part, important);\n continue;\n }\n const box = (['padding', 'margin'] as const).find(\n (property) => name === property || name.startsWith(`${property}-`),\n );\n if (box && (box === 'padding' ? mixedPadding : mixedMargin)) {\n // The resolved box once, where its first declaration stood; the\n // `!important` of any of them carries.\n if (boxWritten[box]) continue;\n boxWritten[box] = true;\n const sides = boxOf(declarations, box)!;\n const anyImportant = declarations.some(\n (d) => (d.name === box || d.name.startsWith(`${box}-`)) && d.important,\n );\n print(box, sides.join(' '), anyImportant);\n continue;\n }\n print(name, value, important);\n }\n return `${out.join('; ')};`;\n}\n\nconst REPEAT = /^(?:repeat|repeat-x|repeat-y|no-repeat|space|round)$/i;\nconst SIZE = /^(?:cover|contain|auto)$/i;\nconst POSITION = /^(?:left|right|top|bottom|center|-?\\d+(?:\\.\\d+)?(?:px|%|em|rem)?)$/i;\nconst DROPPED = /^(?:scroll|fixed|local|border-box|padding-box|content-box|none)$/i;\nconst COLOR = /^(?:#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla)\\(.*\\)|[a-z]+)$/i;\n\n/**\n * A `background` shorthand's parts as longhands, in a fixed order: the\n * image (a `url(…)`), the colour, the repeat, the position, the size\n * (what follows a `/`). One layer; attachment, origin and clip are\n * dropped — no email reads them. A bare word that is no keyword is the\n * colour (`white`).\n */\nfunction expandBackground(value: string): [name: string, value: string][] {\n const longhands: [string, string][] = [];\n let color: string | null = null;\n let repeat: string | null = null;\n const position: string[] = [];\n const size: string[] = [];\n // After a `/` the size tokens follow; the first token that is no size\n // (`no-repeat`) is back in the shorthand's general run.\n let inSize = false;\n for (const token of tokens(value)) {\n if (token === '/') {\n inSize = true;\n continue;\n }\n if (inSize && (SIZE.test(token) || LENGTH.test(token))) {\n size.push(token);\n continue;\n }\n inSize = false;\n if (/^url\\(/i.test(token)) longhands.push(['background-image', token]);\n else if (REPEAT.test(token)) repeat = token;\n else if (POSITION.test(token)) position.push(token);\n else if (DROPPED.test(token)) continue;\n else if (COLOR.test(token)) color = token;\n }\n if (color) longhands.push(['background-color', color]);\n if (repeat) longhands.push(['background-repeat', repeat]);\n if (position.length) longhands.push(['background-position', position.join(' ')]);\n if (size.length) longhands.push(['background-size', size.join(' ')]);\n return longhands;\n}\n\nconst LENGTH = /^-?\\d+(?:\\.\\d+)?(?:px|%|em|rem)?$/;\n\n/** Whitespace-separated tokens, a parenthesised one (`url(a b)`,\n `rgb(1, 2, 3)`) kept whole, a `/` a token of its own (`top/cover`). */\nfunction tokens(value: string): string[] {\n const out: string[] = [];\n let depth = 0;\n let quote: string | null = null;\n let current = '';\n const flush = () => {\n if (current) out.push(current);\n current = '';\n };\n for (const ch of value) {\n if (quote) {\n current += ch;\n if (ch === quote) quote = null;\n continue;\n }\n if (ch === '\"' || ch === \"'\") {\n quote = ch;\n current += ch;\n } else if (ch === '(') {\n depth++;\n current += ch;\n } else if (ch === ')') {\n depth = Math.max(0, depth - 1);\n current += ch;\n } else if (depth === 0 && /\\s/.test(ch)) {\n flush();\n } else if (depth === 0 && ch === '/') {\n flush();\n out.push('/');\n } else current += ch;\n }\n flush();\n return out;\n}\n","import {\n Command,\n EditorState,\n Plugin,\n PluginKey,\n Selection,\n TextSelection,\n Transaction,\n} from 'prosemirror-state';\nimport { Fragment, Node, ResolvedPos, Schema } from 'prosemirror-model';\nimport { EditorView } from 'prosemirror-view';\nimport { keymap } from 'prosemirror-keymap';\nimport { chainCommands } from 'prosemirror-commands';\nimport {\n CellSelection,\n TableMap,\n TableRect,\n addColumn,\n addColumnAfter,\n addColumnBefore,\n addRow,\n addRowAfter,\n addRowBefore,\n deleteColumn,\n deleteRow,\n deleteTable,\n fixTables,\n goToNextCell,\n isInTable,\n mergeCells,\n nextCell,\n removeColumn,\n removeRow,\n selectedRect,\n setCellAttr,\n splitCell,\n tableEditing,\n} from 'prosemirror-tables';\nimport { defineNode } from '../../extension';\nimport { fillTextColor } from '../../dual-contrast';\nimport { isSafeColor, toEmailSafeColor } from '../marks/text-style';\nimport { marksAcrossBreak } from '../split-keeping-marks';\nimport { inlinePadding } from '../../inline-style';\n\n/**\n * Email data tables: a real `<table>` (the most client-compatible layout there\n * is), driven by **prosemirror-tables** — the same model Tiptap and friends\n * run on. That library owns the hard parts we were re-deriving by hand: the\n * `TableMap` (grid geometry through merged cells), `CellSelection`\n * (shift-drag a rectangle of cells), and `fixTables` (repair of ragged or\n * overlapping tables). This is a *data* table (it stays tabular, the user\n * scrolls on a phone); `/columns` is the spongy layout that stacks. Styles are\n * longhand-only + rgb() so they survive the CSSOM serialize round trip\n * identically across engines (see ROADMAP).\n *\n * Two deliberate departures from the library's defaults:\n * - **No pixel column widths.** The library's own `columnResizing` plugin\n * writes `colwidth` in *pixels* — the responsiveness ledger's central trap\n * — so it stays off. Our `ColumnResize` extension reuses the same\n * `colwidth` attr but holds **percentages**, serialized as `width: n%` on\n * the cells (never a `<colgroup>` — enough clients strip it): fluid at\n * every viewport, read by fixed layout in every client, identical in the\n * editor and the email.\n * - **No header cells.** `<th>` parses (as a plain cell) but never\n * serializes: an email table is presentational, and a header row that\n * renders bold in one client and not another is a lie we'd rather not tell.\n *\n * `colspan`/`rowspan`, by contrast, are fully email-safe — Outlook's Word\n * engine handles both — so merged cells are a real feature here, and imported\n * mail keeps its shape instead of being flattened.\n */\n// The serialized table is intentionally borderless — grid lines are an\n// editor-only editing aid (see the `.ProseMirror table` rules in the app's\n// global styles), not part of the email a recipient receives. Padding is a\n// fixed, responsive value (horizontal padding eats a phone's width, so it\n// stays modest).\n// `table-layout: fixed` is the difference between a table you can type in and\n// one that jumps: without it, column widths are computed from *content*, so\n// every keystroke re-lays out the whole grid and the column you are typing in\n// shoves its neighbours sideways. Fixed layout takes the widths from the first\n// row instead (equal shares when none are given) and content never moves them.\n//\n// It is serialized, not editor-only CSS: mail clients default to `auto` too, so\n// styling this in the editor alone would make the editor lie about the email —\n// stable while composing, jumpy when received. Support is broad (it is CSS2,\n// and Word honours it), and with `width: 100%` above it stays fluid.\n/** The table's serialized style. Width and offset are attrs (percent; width\n defaults to 100, offset to 0) so the whole table can be resized from\n either edge — the same email-honest unit as the columns: fluid at every\n viewport, and nested percentages compose (a 50% column of an 80% table is\n 40% of the container, in every client and in the editor alike). The\n offset serializes as `margin-left` — inline margins on tables are what\n Outlook's own Word composer emits, so its engine reads them, and a client\n that strips them degrades the table gracefully to left-aligned. */\nexport const tableStyle = (width: number, offset: number): string =>\n `width: ${formatPct(width)};` +\n (offset > 0 ? ` margin-left: ${formatPct(offset)};` : '') +\n ' table-layout: fixed; border-collapse: collapse;';\n// Fixed layout means a long unbroken word can no longer widen its column, so it\n// would spill out of the cell instead. The editor never showed that (the\n// editable root sets `word-wrap` for its own reasons, and it inherits), which\n// is exactly why it has to be said out loud here — otherwise the overflow shows\n// up only in the recipient's client.\n// No padding here: the email carries only *authored* padding (the `padding`\n// attr, parsed off user markup). The comfortable default spacing seen while\n// composing is editorial — an `.aee-editor` CSS rule the serializer never\n// sees — so it can also reserve the room the block affordances live in.\nconst cellStyle = (valign: CellVerticalAlignment): string =>\n `vertical-align: ${valign}; overflow-wrap: break-word;`;\n\n/** How a cell's content sits across its width. The same three the rest of the\n editor aligns by (a paragraph's `align`), so one set of buttons drives\n both — and `left` is the default, which canonicalizes to `null` and\n serializes nothing. */\nexport type CellAlignment = 'center' | 'right' | null;\n\n/** How a cell's content sits down its height. `top` is the default and *is*\n serialized: a cell with no `vertical-align` reads as `middle` in enough\n clients (it is the HTML default) that leaving it out would make the email\n disagree with the editor. */\nexport type CellVerticalAlignment = 'top' | 'middle' | 'bottom';\n\n/** A cell's horizontal alignment off parsed markup: the inline style first,\n then the legacy `align` attribute — the pair real mail is written with,\n and Outlook's own composer emits both. Anything else (`justify`, an\n inherited `start`) is not a look this schema sells, and repairs to the\n default. */\nfunction parseCellAlign(dom: HTMLElement): CellAlignment {\n const align = (dom.style?.textAlign || dom.getAttribute('align') || '').trim().toLowerCase();\n return align === 'center' || align === 'right' ? align : null;\n}\n\n/** The vertical half, the same way: `vertical-align` then the legacy\n `valign`. `baseline` — what a stripped cell reports — is the HTML default\n and means \"top\" here, which is what every mail client renders it as in a\n single-line cell. */\nfunction parseCellVerticalAlign(dom: HTMLElement): CellVerticalAlignment {\n const align = (dom.style?.verticalAlign || dom.getAttribute('valign') || '').trim().toLowerCase();\n return align === 'middle' || align === 'bottom' ? align : 'top';\n}\n\n/**\n * A px-only padding (the shorthand, or any set of longhands) off parsed\n * markup, canonicalized through the CSSOM so serialize → parse → serialize is\n * a fixpoint. Anything else — %, em, negative, calc — repairs away: padding\n * in the email is a deliberate authored choice, in the one unit every client\n * reads the same.\n */\nexport function parsePadding(dom: HTMLElement): string | null {\n // Off the attribute's own text (`inlinePadding`), never the CSSOM's\n // reading: jsdom drops a longhand written after its shorthand.\n const sides = inlinePadding(dom);\n if (!sides) return null;\n if (!sides.every((side) => side === '0' || /^\\d+(?:\\.\\d+)?px$/.test(side))) return null;\n const probe = document.createElement('div');\n probe.style.padding = sides.join(' ');\n return probe.style.padding || null;\n}\n\n/** The bordered table's default grid color: Excel's classic gridline\n blue-gray (#D0D7E5) — the shade a spreadsheet-shaped table is expected to\n wear, light enough to organize without shouting, and legible on both\n white and dark-mode-inverted grounds. Serialized per *cell* (`border` on\n `<td>` is the bulletproof border in email — Outlook's Word engine renders\n it), with `border-collapse` on the table keeping the grid single-lined. */\nexport const TABLE_BORDER_COLOR = 'rgb(208, 215, 229)';\n\n/** The bordered table's *real* cell padding — Excel-style breathing room, so\n the rendered email is readable inside its grid. Deliberately the same\n value as the editor's editorial default spacing (the app's `.aee-editor\n table td` rule): a bordered and a plain table feel identical while\n composing; only what the recipient gets differs — the preset ships its\n padding, the plain table ships none unless authored. */\nexport const TABLE_CELL_PADDING = '8px 12px';\n\n/** Canonical percentage: one decimal at most, no trailing zero (25%, 33.3%). */\nexport const formatPct = (n: number): string => `${Math.round(n * 10) / 10}%`;\n\n/** No column below 10%: at 320px that is ~32px — the width where a column\n stops being a column. The resize drag clamps here, and the add-column\n rescale floors here. */\nexport const MIN_COLUMN_PCT = 10;\n\n/** No table below 20% of its container — narrower stops being a table. */\nexport const MIN_TABLE_PCT = 20;\n\n/** A percentage off parsed markup, or null for anything else — pixel values\n are the responsiveness trap and repair away. */\nfunction pctOf(raw: string): number | null {\n const trimmed = raw.trim();\n if (!trimmed.endsWith('%')) return null;\n const parsed = Number.parseFloat(trimmed);\n return Number.isFinite(parsed) ? Math.round(parsed * 10) / 10 : null;\n}\n\n/** The table's box off parsed markup — width and left offset, percentages\n only, like the cells. A pixel width (the classic fixed-600px newsletter)\n repairs to full fluid width; the pair clamps so offset + width ≤ 100 and\n the width keeps its floor. */\nfunction parseTableBox(dom: HTMLElement): { width: number; offset: number } {\n const width = Math.min(\n Math.max(pctOf(dom.style?.width || dom.getAttribute('width') || '') ?? 100, MIN_TABLE_PCT),\n 100,\n );\n const offset = Math.min(Math.max(pctOf(dom.style?.marginLeft || '') ?? 0, 0), 100 - width);\n return { width, offset };\n}\n\n/** A `colspan`/`rowspan` off parsed markup: 1 when absent, malformed, zero or\n negative — real mail carries all of those, and the grid must stay sane. */\nfunction span(raw: string | null): number {\n const parsed = Number.parseInt(raw ?? '', 10);\n return Number.isFinite(parsed) && parsed > 0 ? parsed : 1;\n}\n\n/** A declared cell width off parsed markup — **percentages only**. Pixel\n widths (Tiptap's `colwidth`, legacy `width=\"200\"`) are the responsiveness\n trap and drop here; parsing is repair. A span shares its width evenly\n across its columns, matching how fixed layout distributes it. */\nfunction parseCellWidth(dom: HTMLElement, colspan: number): number[] | null {\n const raw = (dom.style?.width || dom.getAttribute('width') || '').trim();\n if (!raw.endsWith('%')) return null;\n const total = Number.parseFloat(raw);\n if (!Number.isFinite(total) || total <= 0 || total >= 100) return null;\n const share = Math.round((total / colspan) * 10) / 10;\n return Array.from({ length: colspan }, () => share);\n}\n\n/** Cell attrs from a `td`/`th`: the spans prosemirror-tables needs, a\n percentage width if one is declared, plus our fill from an inline\n `background-color` or the legacy `bgcolor` attribute. Anything not\n colour-safe drops (the schema is law). */\n/** A cell border off parsed markup: the color, when it is colour-safe and a\n border is actually drawn. Width and style normalize to the canonical\n `1px solid` — parsing is repair, and a 3px dashed border is not a look\n this schema sells. */\nfunction parseCellBorder(dom: HTMLElement): string | null {\n const style = dom.style;\n if (!style) return null;\n const color = style.borderTopColor || style.borderColor;\n if (!color || style.borderTopStyle === 'none') return null;\n return isSafeColor(color) ? color : null;\n}\n\nfunction cellAttrs(dom: HTMLElement): Record<string, unknown> {\n const raw = dom.style?.backgroundColor || dom.getAttribute('bgcolor');\n const colspan = span(dom.getAttribute('colspan'));\n return {\n colspan,\n rowspan: span(dom.getAttribute('rowspan')),\n colwidth: parseCellWidth(dom, colspan),\n padding: parsePadding(dom),\n border: parseCellBorder(dom),\n background: isSafeColor(raw) ? raw : null,\n align: parseCellAlign(dom),\n valign: parseCellVerticalAlign(dom),\n };\n}\n\n/** One serialization for the editor and the email alike: spans are email-safe,\n so there is nothing to hide from either side. Attribute order is fixed\n (spans, then style) to keep serialize → parse → serialize a fixpoint. */\nfunction cellDOM(node: { attrs: Record<string, any> }): [string, Record<string, string>, 0] {\n const { colspan, rowspan, colwidth, padding, border, background, align, valign } = node.attrs;\n const attrs: Record<string, string> = {};\n if (colspan > 1) attrs['colspan'] = String(colspan);\n if (rowspan > 1) attrs['rowspan'] = String(rowspan);\n // Style order is fixed — padding (authored only), base, alignment, width,\n // border, fill — to keep the round trip a fixpoint. A span serializes the\n // *sum* of its entries: that is the width the cell actually occupies, and\n // parse splits it back evenly.\n let style = (padding ? `padding: ${padding}; ` : '') + cellStyle(valign);\n // Inline `text-align`, not the legacy `align` attribute: the style is what\n // every client reads (the attribute is obsolete HTML that only some still\n // honour), and it is the one declaration a paragraph aligns with too, so a\n // centred cell and a centred line are the same thing in the markup. Left is\n // the default and says nothing.\n if (align) style += ` text-align: ${align};`;\n const width = Array.isArray(colwidth)\n ? colwidth.reduce((total: number, entry: number | null) => total + (entry ?? 0), 0)\n : 0;\n if (width > 0) style += ` width: ${formatPct(width)};`;\n // The real grid line, per cell (the editor's faint editing grid is a class\n // style; this inline border wins over it, so a bordered table shows its\n // actual borders while composing).\n if (border) style += ` border: 1px solid ${border};`;\n // The fill always carries its paired text colour (fillTextColor): the cell\n // must not depend on the client's default text, which flips to near-white in\n // non-transforming dark modes while the fill keeps its colour.\n if (background) style += ` background-color: ${background}; color: ${fillTextColor(background)};`;\n attrs['style'] = style;\n return ['td', attrs, 0];\n}\n\nexport const TableCell = defineNode({\n name: 'tableCell',\n spec: {\n // Inline content directly in the cell (a textblock), not wrapped\n // paragraphs: an empty cell is `<td></td>`, never `<td><div><br></div></td>`\n // — the stray `<br>` made ProseMirror's parser grow a phantom cell on the\n // round trip. Text marks (bold, links, colour) work in cells for free.\n content: 'inline*',\n isolating: true,\n // The role is how prosemirror-tables recognises our nodes as a table;\n // `colspan`/`rowspan`/`colwidth` are the attrs its commands read and write.\n tableRole: 'cell',\n attrs: {\n colspan: { default: 1 },\n rowspan: { default: 1 },\n // Column widths in **percentages** (one entry per spanned column) —\n // written by the `ColumnResize` extension, serialized as `width: n%`.\n // Same attr name the library's commands expect, different unit on\n // purpose; pixel widths never parse in (see the node docs).\n colwidth: { default: null },\n // Authored padding only (px, via `parsePadding`); `null` — the default —\n // serializes none, and the editor's comfortable spacing is CSS-only.\n padding: { default: null },\n // The cell's grid-line colour (`border: 1px solid <color>`), or null\n // for the borderless default. Set for every cell of a `/bordered-table`\n // insert; kept uniform by the repair plugin (see `unifyCellBorders`).\n border: { default: null },\n // A fill colour on the cell (the most bulletproof background in email —\n // `background-color` on `<td>` renders even in Outlook). From the curated\n // dual-safe palette via `setCellBackground`; longhand rgb() keeps it a\n // canonical fixpoint like every other style.\n background: { default: null },\n // Where the content sits in the cell. Both are the cell's own business,\n // not a line's: our cells hold inline content directly (there is no\n // paragraph inside to carry an alignment), and a `<td>` is where mail\n // clients expect to read one anyway — `align`/`valign` on the cell is\n // the oldest, most bulletproof layout instruction in email, which is\n // why real messages are full of them. Parsing keeps what they say\n // (`parseCellAlign`, `parseCellVerticalAlign`) instead of flattening\n // every imported table to top-left.\n align: { default: null },\n valign: { default: 'top' },\n },\n parseDOM: [\n { tag: 'td', getAttrs: cellAttrs },\n // A header cell parses as an ordinary cell — see the node docs.\n { tag: 'th', getAttrs: cellAttrs },\n ],\n toDOM: cellDOM,\n },\n});\n\nexport const TableRow = defineNode({\n name: 'tableRow',\n spec: {\n content: 'tableCell+',\n tableRole: 'row',\n // Our cells are textblocks (inline content), which makes the gap cursor\n // consider the slot *between two cells* a valid stop — ArrowRight at a\n // cell's end would park a blinking gap there before moving on. Cells are\n // navigated cell to cell (see the arrow keymap); the gap cursor belongs\n // only around the table.\n allowGapCursor: false,\n parseDOM: [{ tag: 'tr' }],\n toDOM: () => ['tr', 0],\n },\n});\n\nexport const Table = defineNode({\n name: 'table',\n spec: {\n content: 'tableRow+',\n group: 'block',\n isolating: true,\n tableRole: 'table',\n allowGapCursor: false,\n // Width and left offset in percent of the container; the defaults\n // (100, 0) serialize identically to the pre-attr canonical form.\n attrs: { width: { default: 100 }, offset: { default: 0 } },\n parseDOM: [{ tag: 'table', getAttrs: (dom) => parseTableBox(dom) }],\n // <tbody> wrapper matches what mail clients expect and what the HTML\n // parser re-injects, so serialize → parse → serialize is a fixpoint.\n // `style` last: ProseMirror writes it through `style.cssText`, and a\n // browser materialises that attribute after any set later, where jsdom\n // keeps insertion order — last in the spec, it is last in both.\n toDOM: (node) => [\n 'table',\n {\n role: 'presentation',\n style: tableStyle(node.attrs['width'] as number, node.attrs['offset'] as number),\n },\n ['tbody', 0],\n ],\n },\n commands: ({ schema }) => ({\n /** The default shape is the one /table inserts — three rows by two. */\n insertTable: (rows = 3, cols = 2): Command => insertTableFocused(schema, rows, cols),\n // Selection-relative structure edits, straight from the library: each one\n // understands merged cells and multi-cell selections for free. The\n // add-column pair is wrapped: on a table with declared widths, the library\n // inserts the new column with none — and under fixed layout an unspecified\n // column gets the *leftover* space, which after a resize is zero. The\n // wrapper rescales the declared widths to free an equal share.\n addRowBefore: (): Command => addRowBefore,\n addRowAfter: (): Command => addRowAfter,\n addColumnBefore: (): Command => withColumnRescale(addColumnBefore),\n addColumnAfter: (): Command => withColumnRescale(addColumnAfter),\n // These refuse when the selection covers every row/column, which is\n // exactly \"never delete the last one\".\n deleteRow: (): Command => deleteRow,\n deleteColumn: (): Command => deleteColumn,\n deleteTable: (): Command => deleteTable,\n /** Merge the selected rectangle of cells into one (`colspan`/`rowspan`). */\n mergeCells: (): Command => mergeCells,\n /** Split a merged cell back into its grid positions. */\n splitCell: (): Command => splitCell,\n /** Whichever of the two applies — one button for both, which is how a\n cell toolbar wants to show it (Tiptap's `mergeOrSplit`). */\n mergeOrSplit: (): Command => chainCommands(mergeCells, splitCell),\n // Index-addressed variants for the hover controls (a handle targets a\n // specific row/column, independent of where the cursor sits).\n addRowAt: (index: number): Command =>\n editTable((tr, rect) => {\n addRow(tr, rect, clamp(index, 0, rect.map.height));\n return true;\n }),\n addColumnAt: (index: number): Command =>\n editTable((tr, rect) => {\n addColumn(tr, rect, clamp(index, 0, rect.map.width));\n rescaleForNewColumn(tr, rect.tableStart - 1);\n return true;\n }),\n deleteRowAt: (index: number): Command =>\n editTable((tr, rect) => {\n if (rect.map.height <= 1 || index < 0 || index >= rect.map.height) return false;\n removeRow(tr, rect, index);\n return true;\n }),\n deleteColumnAt: (index: number): Command =>\n editTable((tr, rect) => {\n if (rect.map.width <= 1 || index < 0 || index >= rect.map.width) return false;\n removeColumn(tr, rect, index);\n return true;\n }),\n /** Fill the cell the cursor is in — or every cell of a cell selection. */\n setCellBackground: (color: string | null): Command => setCellBackground(color),\n /** Align the cell's content across its width — the cell the cursor is in,\n or every cell of a cell selection. The editor's own Align buttons\n reach this without asking for it: `setAlignment` aligns the cell when\n there is no paragraph to align (see email-paragraph.ts). */\n setCellAlignment: (align: CellAlignment): Command => setCellAttr('align', align),\n /** Move the selected row(s) one place up or down — the row grip's menu.\n Refuses where a merged cell crosses the boundary it would pass. */\n moveRow: (offset: number): Command => moveRow(offset),\n /** Move the selected column(s) one place left or right. */\n moveColumn: (offset: number): Command => moveColumn(offset),\n /** Copy the selected row(s) directly below, the column(s) to the right. */\n duplicateRow: (): Command => duplicateRow(),\n duplicateColumn: (): Command => duplicateColumn(),\n /** Align it down the cell's height — top, middle or bottom. */\n setCellVerticalAlign: (valign: CellVerticalAlignment): Command => setCellAttr('valign', valign),\n /** Empties the caret's cell — or every cell of a cell selection — the\n cells themselves staying. */\n clearCells: (): Command => clearCells,\n }),\n keymap: () => ({\n Tab: tabToCell(1),\n 'Shift-Tab': tabToCell(-1),\n }),\n plugins: () => [\n // Ordered on purpose. Extension plugins all run before extension keymaps\n // (see `createEditor`), so these bindings can't live in this extension's\n // `keymap` — `tableEditing` would claim the keys first. Registering them\n // as a plugin keymap *ahead* of it keeps two pinned behaviours: from the\n // last row, ArrowDown writes below the table rather than stepping between\n // cells; and Backspace/Delete over a selection covering a *whole*\n // structural unit removes that unit — the full grid removes the table,\n // full rows remove those rows, full columns remove those columns.\n // Anything less falls through to the library's deleteCellSelection,\n // which clears the selected cells' content. Structure deletion is\n // therefore a gesture, not a menu item: select the unit (shift-drag, or\n // shift-arrows growing the cell selection), press Delete.\n //\n // The arrows are ours as well, because the library's own cell navigation\n // is dead for this schema: its `atEndOfCell` starts walking at\n // `$head.depth - 1`, expecting a paragraph *inside* the cell, and our cells\n // hold inline content directly — so it never finds a cell and returns\n // null forever. Left to the browser, arrows crossed cells by accident and\n // Shift-arrows selected cells only when the native selection happened to\n // spill over. Now: an arrow at a cell's edge moves to the neighbouring\n // cell (wrapping rows, leaving the table at its ends); a Shift-arrow at\n // the edge grows a cell selection, the established editor convention and\n // the keyboard route to every cell-selection gesture.\n keymap({\n // A newline in a cell is a hard break: cells are inline-only textblocks\n // (no paragraphs — see the cell node docs), so the stock Enter chain has\n // nothing valid to split. Worse than useless, in fact: on an *empty*\n // in-between cell, `liftEmptyBlock` splits the closest splittable\n // ancestor — the row — and Enter grows the table. Both bindings live\n // here (not on the extensions that own them) because the cell is\n // isolating, which makes the generic handlers refuse it.\n // Yield to a slash / token menu when one is open: these bindings live\n // in `plugins` so they beat `tableEditing`, which also puts them\n // *ahead* of later extension plugins (the menu). A single-line cell\n // is always `endOfTextblock` up and down, so without the yield the\n // table would steal ArrowDown and walk to the next cell. Enter would\n // insert a break instead of applying the highlighted row.\n Enter: yieldToSuggestion(breakInCell),\n 'Shift-Enter': breakInCell,\n // Select-all is scoped to the unit being edited: from inside a cell it\n // selects that cell's text, never the whole document. An *empty* cell\n // has no text to scope to, so there it selects every cell — the\n // grid-wide selection whose Delete removes the table. From a cell\n // selection the key falls through to the stock whole-document one.\n 'Mod-a': selectCellContent,\n ArrowLeft: cellArrow('horiz', -1),\n ArrowRight: cellArrow('horiz', 1),\n ArrowUp: yieldToSuggestion(cellArrow('vert', -1)),\n ArrowDown: yieldToSuggestion(chainCommands(escapeTableDown, cellArrow('vert', 1))),\n 'Shift-ArrowLeft': cellShiftArrow('horiz', -1),\n 'Shift-ArrowRight': cellShiftArrow('horiz', 1),\n 'Shift-ArrowUp': cellShiftArrow('vert', -1),\n 'Shift-ArrowDown': cellShiftArrow('vert', 1),\n Backspace: deleteFullySelected,\n 'Mod-Backspace': deleteFullySelected,\n Delete: deleteFullySelected,\n 'Mod-Delete': deleteFullySelected,\n }),\n // Cell selection (shift-click/drag a rectangle), arrow navigation across\n // cells, and Backspace/Delete over a cell selection. Table node selection\n // stays off: a selected table node has no affordance in our UI, and it\n // would swallow keystrokes that should reach the cells.\n tableEditing({ allowTableNodeSelection: false }),\n // Parsing is repair, and this is the table half of it: real mail is full\n // of ragged rows and overlapping spans, which `fixTables` normalizes into\n // a rectangle. Covers everything that reaches the editor as a transaction\n // — paste, drops, `setContent`, an import landing on the html signal —\n // while `repairTables` covers the pure parse path (see `html.ts`).\n // `unifyCellBorders` rides the same pass: cells that structural edits add\n // arrive with the default null border and inherit a uniform table's.\n new Plugin({\n key: new PluginKey('tableRepair'),\n appendTransaction: (transactions, oldState, newState) => {\n if (!transactions.some((tr) => tr.docChanged)) return undefined;\n const tr = fixTables(newState, oldState) ?? newState.tr;\n unifyCellBorders(tr);\n return tr.docChanged ? tr : undefined;\n },\n }),\n ],\n // The editor-only grid shown while editing is not the table's own business:\n // `LayoutGuides` marks whichever layout block (table *or* columns) holds the\n // cursor, so both structures reveal themselves identically.\n // Three rows by two: a table asked for by name starts with somewhere to\n // write a heading line and two entries under it, which is what an email\n // table almost always turns out to be. A picker (the app's grid) says its\n // own size; this is only what `/table` means on its own.\n actions: ({ schema }) => [\n {\n id: 'table',\n section: 'layout',\n title: 'Table',\n keywords: ['table', 'grid', 'rows', 'columns'],\n icon: 'table_chart',\n command: insertTableFocused(schema, 3, 2),\n },\n {\n id: 'bordered-table',\n section: 'layout',\n title: 'Bordered table',\n keywords: ['bordered-table', 'table', 'borders', 'grid', 'excel', 'lines'],\n icon: 'grid_on',\n command: insertTableFocused(schema, 3, 2, TABLE_BORDER_COLOR),\n },\n ],\n});\n\n/**\n * Normalizes every table in a freshly parsed document: ragged rows are padded,\n * overlong spans are trimmed. The transaction-driven half lives in the node's\n * repair plugin; this is the pure-function path, so `importedDocument` and\n * `replyDocument` produce the same repaired canonical HTML the editor would.\n * A schema without tables (the HTML source editor) passes straight through.\n */\nexport function repairTables(doc: Node, schema: Schema): Node {\n if (!schema.nodes['table']) return doc;\n const repair = fixTables(EditorState.create({ doc, schema }));\n return repair ? repair.doc : doc;\n}\n\n/** Sets (or clears) the `background` attr of the cell the cursor is in — or of\n every cell in a cell selection, which the library's `setCellAttr` handles.\n Exposed for the app's fill affordance. */\nexport function setCellBackground(color: string | null): Command {\n return setCellAttr('background', color ? toEmailSafeColor(color) : null);\n}\n\n/** Inserts a table and drops the cursor into its first cell. The table is\n located after insertion (rather than by fragile nodeSize math) and\n `cellStart` resolves the exact text position inside cell (0, 0). */\nfunction insertTableFocused(\n schema: Schema,\n rows: number,\n cols: number,\n border: string | null = null,\n): Command {\n return (state, dispatch) => {\n // Asked, not told: answer before building anything — a toolbar asks on\n // every transaction.\n if (!dispatch) return true;\n const table = buildTable(schema, rows, cols, border);\n\n const from = state.selection.from;\n const tr = state.tr.replaceSelectionWith(table);\n\n let tablePos = -1;\n tr.doc.descendants((node, pos) => {\n if (tablePos !== -1) return false;\n if (node.type.name === 'table' && pos >= from - 1) tablePos = pos;\n return tablePos === -1;\n });\n if (tablePos >= 0) {\n const inner = cellStart(tr.doc, tablePos, 0, 0);\n if (inner != null) tr.setSelection(TextSelection.create(tr.doc, inner));\n }\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n\n// --- Structure helpers -----------------------------------------------------\n\ninterface TableContext {\n table: Node;\n tablePos: number;\n tableDepth: number;\n rowIndex: number;\n colIndex: number;\n cols: number;\n rows: number;\n}\n\n/** Locates the table around the selection: the enclosing table node plus the\n current row/column indices. Indices are *grid* coordinates (a merged cell\n reports its top-left corner), because that is what the geometry means once\n spans exist. `null` when the cursor is outside any table. */\nexport function findTableContext(state: EditorState): TableContext | null {\n const { $from } = state.selection;\n for (let depth = $from.depth; depth > 0; depth--) {\n if ($from.node(depth).type.name !== 'tableCell') continue;\n const tableDepth = depth - 2;\n const table = $from.node(tableDepth);\n const tablePos = $from.before(tableDepth);\n const map = TableMap.get(table);\n const cell = map.findCell($from.before(depth) - (tablePos + 1));\n return {\n table,\n tablePos,\n tableDepth,\n rowIndex: cell.top,\n colIndex: cell.left,\n cols: map.width,\n rows: map.height,\n };\n }\n return null;\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));\n\n/** Runs a structural edit against the table holding the selection. The\n transaction is built even while probing (no dispatch) so enablement is\n reported by the edit itself — cheap, and it can't disagree with what the\n edit would actually do. */\nfunction editTable(edit: (tr: Transaction, rect: TableRect) => boolean): Command {\n return (state, dispatch) => {\n if (!isInTable(state)) return false;\n const tr = state.tr;\n if (!edit(tr, selectedRect(state))) return false;\n dispatch?.(tr.scrollIntoView());\n return true;\n };\n}\n\n/** Wraps a selection-relative add-column command with the width rescale. */\nfunction withColumnRescale(command: Command): Command {\n return (state, dispatch) => {\n if (!isInTable(state)) return false;\n const tablePos = selectedRect(state).tableStart - 1;\n return command(\n state,\n dispatch &&\n ((tr: Transaction) => {\n rescaleForNewColumn(tr, tablePos);\n dispatch(tr);\n }),\n );\n };\n}\n\n/**\n * After a column insert: scales every declared width by (n-1)/n, so the new\n * (undeclared) column inherits an equal share of the freed space instead of\n * the leftover — which, on a fully-declared table, is zero, and a zero-width\n * column is a column that looks deleted. Scaled entries floor at\n * {@link MIN_COLUMN_PCT}; tables with no declared widths are untouched.\n */\nfunction rescaleForNewColumn(tr: Transaction, tablePos: number): void {\n const table = tr.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return;\n const map = TableMap.get(table);\n const factor = (map.width - 1) / map.width;\n\n const seen = new Set<number>();\n for (const rel of map.map) {\n if (seen.has(rel)) continue;\n seen.add(rel);\n const cell = table.nodeAt(rel)!;\n const colwidth = cell.attrs['colwidth'] as (number | null)[] | null;\n if (!colwidth || !colwidth.some((entry) => entry)) continue;\n const scaled = colwidth.map((entry) =>\n // 0 entries are the library's padding for freshly spanned columns —\n // \"no width\", not \"zero width\" — and stay untouched.\n entry ? Math.max(Math.round(entry * factor * 10) / 10, MIN_COLUMN_PCT) : entry,\n );\n tr.setNodeMarkup(tablePos + 1 + rel, null, { ...cell.attrs, colwidth: scaled });\n }\n}\n\n/**\n * Appends a column at the table's end — what the editor's `+` pill on the\n * table's right flank commits (the `ColumnResize` NodeView renders it).\n * Position-addressed rather than selection-relative, because the pill knows\n * which table it belongs to regardless of where the caret is. Runs the same\n * width rescale as every other column add.\n */\nexport function addColumnAtEnd(tablePos: number): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n if (dispatch) {\n const map = TableMap.get(table);\n const tr = state.tr;\n addColumn(\n tr,\n { map, tableStart: tablePos + 1, table, left: 0, top: 0, right: 0, bottom: 0 },\n map.width,\n );\n rescaleForNewColumn(tr, tablePos);\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\n\n/** The row twin: appends a row at the table's end for the pill under the\n bottom edge. No width math — rows carry none. */\nexport function addRowAtEnd(tablePos: number): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n if (dispatch) {\n const map = TableMap.get(table);\n const tr = state.tr;\n addRow(\n tr,\n { map, tableStart: tablePos + 1, table, left: 0, top: 0, right: 0, bottom: 0 },\n map.height,\n );\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\n\n/**\n * Selects a whole row (or column) of the table at `tablePos` — what a grip\n * on the row's flank does when it is pressed.\n *\n * The selection is the handle's whole trick: once the row is a\n * {@link CellSelection}, every command the menu offers is the ordinary\n * selection-relative one — insert, delete, fill, align — and the row lights\n * up while its menu is open, which is the feedback the gesture needs. The\n * library builds the selection out of the two cells at the row's ends, which\n * is also how a shift-drag across the row ends up.\n */\nexport function selectRow(tablePos: number, index: number): Command {\n return selectBand(tablePos, index, 'row');\n}\n\n/** The column twin. */\nexport function selectColumn(tablePos: number, index: number): Command {\n return selectBand(tablePos, index, 'column');\n}\n\nfunction selectBand(tablePos: number, index: number, kind: 'row' | 'column'): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n const map = TableMap.get(table);\n const last = kind === 'row' ? map.height : map.width;\n if (index < 0 || index >= last) return false;\n const start = tablePos + 1;\n const first = kind === 'row' ? map.map[index * map.width] : map.map[index];\n const end =\n kind === 'row'\n ? map.map[index * map.width + map.width - 1]\n : map.map[(map.height - 1) * map.width + index];\n if (dispatch) {\n const $anchor = state.doc.resolve(start + first);\n const $head = state.doc.resolve(start + end);\n const selection =\n kind === 'row'\n ? CellSelection.rowSelection($anchor, $head)\n : CellSelection.colSelection($anchor, $head);\n dispatch(state.tr.setSelection(selection).scrollIntoView());\n }\n return true;\n };\n}\n\n/**\n * Moves the selected row one place up or down (`offset` −1 or 1) — the\n * menu's Move row up/down, and the gesture a grip exists for.\n *\n * Rows move as whole nodes: the table's children are reordered and written\n * back in one transaction, so nothing is re-derived and the move is one undo\n * step. A merged cell reaching across either boundary makes the move a lie —\n * the grid would have to be rebuilt around it, and \"move\" is not a promise\n * to restructure — so the command refuses, and the menu item shows disabled.\n */\nexport function moveRow(offset: number): Command {\n return (state, dispatch) => {\n if (!isInTable(state)) return false;\n const rect = selectedRect(state);\n const { map, table, tableStart } = rect;\n const from = rect.top;\n const to = rect.bottom - 1 + offset;\n if (to < 0 || to >= map.height || from + offset < 0) return false;\n // Every boundary the block crosses, and its own two, must be clean.\n for (const row of [rect.top, rect.bottom, offset < 0 ? from + offset : to + 1]) {\n if (!isRowBoundaryClean(map, row)) return false;\n }\n if (dispatch) {\n const rows: Node[] = [];\n table.forEach((row) => rows.push(row));\n const block = rows.splice(rect.top, rect.bottom - rect.top);\n rows.splice(rect.top + offset, 0, ...block);\n const tr = state.tr.replaceWith(tableStart, tableStart + table.content.size, rows);\n // The band travels with its selection: it stays lit where it landed,\n // and the next press on Move moves the same rows again.\n reselectBand(tr, tableStart, 'row', rect.top + offset, rect.bottom - rect.top);\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\n\n/** Puts the selection back over a band of rows or columns after its table's\n content has been rewritten — the moved block, at its new index. */\nfunction reselectBand(\n tr: Transaction,\n tableStart: number,\n kind: 'row' | 'column',\n start: number,\n length: number,\n): void {\n const table = tr.doc.nodeAt(tableStart - 1);\n if (!table) return;\n const map = TableMap.get(table);\n const end = start + length - 1;\n const first = kind === 'row' ? map.map[start * map.width] : map.map[start];\n const last =\n kind === 'row'\n ? map.map[end * map.width + map.width - 1]\n : map.map[(map.height - 1) * map.width + end];\n const $anchor = tr.doc.resolve(tableStart + first);\n const $head = tr.doc.resolve(tableStart + last);\n tr.setSelection(\n kind === 'row'\n ? CellSelection.rowSelection($anchor, $head)\n : CellSelection.colSelection($anchor, $head),\n );\n}\n\n/** Duplicates the selected row (or rows) straight below — the menu's\n Duplicate row. Refused where a merged cell crosses the block's edges, for\n the same reason a move is. */\nexport function duplicateRow(): Command {\n return (state, dispatch) => {\n if (!isInTable(state)) return false;\n const rect = selectedRect(state);\n const { map, table, tableStart } = rect;\n if (!isRowBoundaryClean(map, rect.top) || !isRowBoundaryClean(map, rect.bottom)) return false;\n if (dispatch) {\n const rows: Node[] = [];\n table.forEach((row) => rows.push(row));\n const copy = rows.slice(rect.top, rect.bottom).map((row) => row.copy(row.content));\n rows.splice(rect.bottom, 0, ...copy);\n dispatch(\n state.tr.replaceWith(tableStart, tableStart + table.content.size, rows).scrollIntoView(),\n );\n }\n return true;\n };\n}\n\n/** The column twins. A column is not a node — it is one cell per row — so\n these rebuild every row with its cells reordered (or copied), which is\n exactly what the browser's own column-less table model forces. The same\n span rule applies: a cell spanning a boundary the column crosses refuses\n the move. */\nexport function moveColumn(offset: number): Command {\n return columnEdit((cells, rect) => {\n const block = cells.splice(rect.left, rect.right - rect.left);\n cells.splice(rect.left + offset, 0, ...block);\n }, offset);\n}\n\nexport function duplicateColumn(): Command {\n return columnEdit((cells, rect) => {\n const copy = cells.slice(rect.left, rect.right).map((cell) => cell.copy(cell.content));\n cells.splice(rect.right, 0, ...copy);\n }, 0);\n}\n\nfunction columnEdit(edit: (cells: Node[], rect: TableRect) => void, offset: number): Command {\n return (state, dispatch) => {\n if (!isInTable(state)) return false;\n const rect = selectedRect(state);\n const { map, table, tableStart } = rect;\n const target = offset < 0 ? rect.left + offset : rect.right - 1 + offset;\n if (target < 0 || target >= map.width) return false;\n // Cleanliness is per column boundary, checked across every row — and a\n // row whose cells do not simply line up one per column (a rowspan from\n // above) has no cell of its own to move.\n for (const col of [rect.left, rect.right, offset < 0 ? rect.left + offset : target + 1]) {\n if (!isColumnBoundaryClean(map, col)) return false;\n }\n for (let row = 0; row < map.height; row++) {\n if (table.child(row).childCount !== map.width) return false;\n }\n if (dispatch) {\n const rows: Node[] = [];\n table.forEach((row) => {\n const cells: Node[] = [];\n row.forEach((cell) => cells.push(cell));\n edit(cells, rect);\n rows.push(row.copy(Fragment.fromArray(cells)));\n });\n const tr = state.tr.replaceWith(tableStart, tableStart + table.content.size, rows);\n reselectBand(tr, tableStart, 'column', rect.left + offset, rect.right - rect.left);\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\n\n/** Whether the horizontal line above row `index` cuts no merged cell — the\n table's own top and bottom edges always do. */\nfunction isRowBoundaryClean(map: TableMap, index: number): boolean {\n if (index <= 0 || index >= map.height) return true;\n for (let col = 0; col < map.width; col++) {\n if (map.map[(index - 1) * map.width + col] === map.map[index * map.width + col]) return false;\n }\n return true;\n}\n\n/** The vertical twin. */\nfunction isColumnBoundaryClean(map: TableMap, index: number): boolean {\n if (index <= 0 || index >= map.width) return true;\n for (let row = 0; row < map.height; row++) {\n if (map.map[row * map.width + index - 1] === map.map[row * map.width + index]) return false;\n }\n return true;\n}\n\nfunction buildTable(schema: Schema, rows: number, cols: number, border: string | null): Node {\n const cellType = schema.nodes['tableCell'];\n const rowType = schema.nodes['tableRow'];\n const tableType = schema.nodes['table'];\n // The bordered preset ships real padding with its grid (see\n // TABLE_CELL_PADDING); a plain table ships none unless authored.\n const attrs = { border, padding: border ? TABLE_CELL_PADDING : null };\n const makeRow = () =>\n rowType.create(\n null,\n Array.from({ length: cols }, () => cellType.createAndFill(attrs)!),\n );\n return tableType.create(null, Array.from({ length: rows }, makeRow))!;\n}\n\n/**\n * Keeps a *uniformly* bordered table uniform: when every bordered cell wears\n * the same colour and some cells have none — which is what any structural\n * edit produces, since `addRow`/`addColumn`/the pills create cells with the\n * default null border — the bare cells inherit it. A table with *mixed*\n * border colours (authored, imported) is left exactly as written: repair,\n * not opinion. `setNodeMarkup` never changes node sizes, so positions\n * collected up front stay valid as the jobs apply.\n */\nfunction unifyCellBorders(tr: Transaction): void {\n const jobs: { pos: number; attrs: Record<string, unknown> }[] = [];\n tr.doc.descendants((node, pos) => {\n if (node.type.name !== 'table') return true;\n\n const colors = new Set<string>();\n let bare = 0;\n node.descendants((cell) => {\n if (cell.type.name !== 'tableCell') return true;\n const border = cell.attrs['border'] as string | null;\n if (border) colors.add(border);\n else bare++;\n return true;\n });\n\n if (colors.size === 1 && bare > 0) {\n const border = [...colors][0];\n node.descendants((cell, rel) => {\n if (cell.type.name === 'tableCell' && !cell.attrs['border']) {\n jobs.push({ pos: pos + 1 + rel, attrs: { ...cell.attrs, border } });\n }\n return true;\n });\n }\n return false; // cells handled; nothing tabular nests deeper\n });\n for (const job of jobs) tr.setNodeMarkup(job.pos, null, job.attrs);\n}\n\n/** Backspace/Delete with a whole structural unit selected: the user marked\n it — deleting \"all the content\" of a table, row or column *is* deleting\n the unit, and leaving an empty husk behind would be the one thing that\n selection did not ask for. Full grid → the table; full-width rows → those\n rows; full-height columns → those columns. Any lesser selection returns\n false and falls through to `deleteCellSelection` (clear contents), the\n library default. */\nexport const deleteFullySelected: Command = (state, dispatch) => {\n const selection = state.selection;\n if (!(selection instanceof CellSelection)) return false;\n const table = selection.$anchorCell.node(-1);\n const tableStart = selection.$anchorCell.start(-1);\n const map = TableMap.get(table);\n const rect = map.rectBetween(\n selection.$anchorCell.pos - tableStart,\n selection.$headCell.pos - tableStart,\n );\n const fullWidth = rect.left === 0 && rect.right === map.width;\n const fullHeight = rect.top === 0 && rect.bottom === map.height;\n if (fullWidth && fullHeight) return deleteTable(state, dispatch);\n if (fullWidth) return deleteRow(state, dispatch);\n if (fullHeight) return deleteColumn(state, dispatch);\n return false;\n};\n\n/** A suggestion menu (slash, tokens, …) is open at the caret — its plugin\n state carries a `session`. Those keys are the menu's, not the table's. */\nfunction suggestionMenuIsOpen(state: EditorState): boolean {\n for (const plugin of state.plugins) {\n const value = plugin.getState(state) as { session?: unknown } | undefined;\n if (value?.session) return true;\n }\n return false;\n}\n\n/** Runs `command` only when no suggestion menu is claiming the key. */\nfunction yieldToSuggestion(command: Command): Command {\n return (state, dispatch, view) =>\n suggestionMenuIsOpen(state) ? false : command(state, dispatch, view);\n}\n\ntype Axis = 'horiz' | 'vert';\n\nconst edgeName = (axis: Axis, dir: 1 | -1) =>\n axis === 'vert' ? (dir > 0 ? 'down' : 'up') : dir > 0 ? 'right' : 'left';\n\n/** The caret's cell, resolved at the cell's own position, when the caret\n stands at that cell's edge in `dir` (so the arrow has nowhere to go within\n the cell). Vertical moves require an empty selection, like the library. */\nfunction caretCellAtEdge(\n state: EditorState,\n view: EditorView,\n axis: Axis,\n dir: 1 | -1,\n): ResolvedPos | null {\n const selection = state.selection;\n if (!(selection instanceof TextSelection)) return null;\n if (axis === 'vert' && !selection.empty) return null;\n const { $head } = selection;\n if ($head.parent.type.spec['tableRole'] !== 'cell') return null;\n if (!view.endOfTextblock(edgeName(axis, dir))) return null;\n return state.doc.resolve($head.before());\n}\n\n/** Arrow keys across cells: from a cell's edge, the caret moves into the\n neighbouring cell (rows wrap horizontally; the table's outer edges hand\n off to the surrounding blocks). A cell selection collapses to a caret at\n its head cell. Anywhere inside a cell's text, the browser keeps the key. */\nfunction cellArrow(axis: Axis, dir: 1 | -1): Command {\n return (state, dispatch, view) => {\n if (!view) return false;\n const selection = state.selection;\n if (selection instanceof CellSelection) {\n dispatch?.(state.tr.setSelection(Selection.near(selection.$headCell, dir)).scrollIntoView());\n return true;\n }\n const $cell = caretCellAtEdge(state, view, axis, dir);\n if (!$cell) return false;\n\n let target: Selection | null;\n if (axis === 'horiz') {\n const from = dir > 0 ? $cell.pos + $cell.nodeAfter!.nodeSize : $cell.pos;\n target = Selection.findFrom(state.doc.resolve(from), dir, true);\n } else {\n const $next = nextCell($cell, axis, dir);\n target = $next\n ? Selection.near($next, 1)\n : Selection.findFrom(\n state.doc.resolve(dir > 0 ? $cell.after(-1) : $cell.before(-1)),\n dir,\n true,\n );\n }\n if (!target) return false;\n dispatch?.(state.tr.setSelection(target).scrollIntoView());\n return true;\n };\n}\n\n/** Shift-arrows grow a cell selection: from a caret at a cell's edge, this\n cell plus the neighbour; from a cell selection, one more cell at the head.\n At the table's outer edge a cell selection stays put rather than spilling\n into the surrounding text. */\nfunction cellShiftArrow(axis: Axis, dir: 1 | -1): Command {\n return (state, dispatch, view) => {\n if (!view) return false;\n const selection = state.selection;\n let $anchor: ResolvedPos;\n let $head: ResolvedPos;\n if (selection instanceof CellSelection) {\n $anchor = selection.$anchorCell;\n $head = selection.$headCell;\n } else {\n const $cell = caretCellAtEdge(state, view, axis, dir);\n if (!$cell) return false;\n $anchor = $head = $cell;\n }\n const $next = nextCell($head, axis, dir);\n if (!$next) return selection instanceof CellSelection;\n dispatch?.(state.tr.setSelection(new CellSelection($anchor, $next)).scrollIntoView());\n return true;\n };\n}\n\n/** Enter / Shift-Enter inside a cell: a hard break, carrying the marks that\n survive a break — the same continuation rule as everywhere else (see\n {@link marksAcrossBreak}). A cell selection is not a place to type a\n newline, so it falls through. */\nconst breakInCell: Command = (state, dispatch) => {\n const { $from, $to } = state.selection;\n if (state.selection instanceof CellSelection) return false;\n if ($from.parent.type.spec['tableRole'] !== 'cell' || !$from.sameParent($to)) return false;\n\n if (dispatch) {\n const marks = marksAcrossBreak(state);\n const tr = state.tr.replaceSelectionWith(state.schema.nodes['hardBreak'].create());\n if (marks) tr.ensureMarks(marks);\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n\n/** Mod-A with the caret in a cell: select that cell's content — or, from an\n empty cell, every cell — and stop; see the keymap note. A cell selection\n is already beyond single-cell editing and falls through to the stock\n select-all. */\nconst selectCellContent: Command = (state, dispatch) => {\n const { $from } = state.selection;\n if (state.selection instanceof CellSelection) return false;\n if ($from.parent.type.spec['tableRole'] !== 'cell') return false;\n\n if (dispatch) {\n if ($from.parent.content.size === 0) {\n const map = TableMap.get($from.node(-2));\n const tableStart = $from.start(-2);\n const $first = state.doc.resolve(tableStart + map.map[0]);\n const $last = state.doc.resolve(tableStart + map.map[map.map.length - 1]);\n dispatch(state.tr.setSelection(new CellSelection($first, $last)));\n } else {\n dispatch(state.tr.setSelection(TextSelection.create(state.doc, $from.start(), $from.end())));\n }\n }\n return true;\n};\n\n/** ArrowDown from a table's last row: move to the block below, creating an\n empty paragraph when the table is the last node so text can go under it. */\nconst escapeTableDown: Command = (state, dispatch) => {\n const ctx = findTableContext(state);\n if (!ctx || ctx.rowIndex !== ctx.rows - 1) return false;\n\n const tableEnd = ctx.tablePos + ctx.table.nodeSize;\n const after = state.doc.resolve(tableEnd).nodeAfter;\n if (after) return false; // a block already follows — let the default move there\n\n if (dispatch) {\n const paragraph = state.schema.nodes['paragraph'].createAndFill();\n if (!paragraph) return false;\n const tr = state.tr.insert(tableEnd, paragraph);\n tr.setSelection(TextSelection.create(tr.doc, tableEnd + 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n\n/** Tab / Shift-Tab: move to the next / previous cell, adding a row when\n tabbing past the last cell. Tab stays swallowed anywhere inside a table so\n it never escapes into the page's focus order mid-edit. */\nfunction tabToCell(direction: 1 | -1): Command {\n return (state, dispatch) => {\n if (goToNextCell(direction)(state, dispatch)) return true;\n if (!isInTable(state)) return false;\n // Backwards out of the first cell: nothing to move to, but still ours.\n return direction === -1 ? true : appendRowAndEnter(state, dispatch);\n };\n}\n\n/** Appends a row to the end of the table and puts the cursor in its first\n cell — Tab's \"past the last cell\" behaviour. */\nconst appendRowAndEnter: Command = (state, dispatch) => {\n if (!isInTable(state)) return false;\n if (dispatch) {\n const rect = selectedRect(state);\n const tr = state.tr;\n addRow(tr, rect, rect.map.height);\n const table = tr.doc.nodeAt(rect.tableStart - 1);\n if (table) {\n const map = TableMap.get(table);\n const firstCell = rect.tableStart + map.map[(map.height - 1) * map.width];\n tr.setSelection(TextSelection.near(tr.doc.resolve(firstCell + 1)));\n }\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n\n/** First text position inside the cell at [row, col] of the table at\n `tablePos`, addressed through the grid so merged cells resolve correctly. */\nfunction cellStart(doc: Node, tablePos: number, row: number, col: number): number | null {\n const table = doc.nodeAt(tablePos);\n if (!table) return null;\n const map = TableMap.get(table);\n if (row >= map.height || col >= map.width) return null;\n // Cell positions in the map are relative to the table's content start.\n return tablePos + 1 + map.map[row * map.width + col] + 1;\n}\n\n/** The cell the caret is in, as its position in the document — null for a\n cell selection (which knows its cells) and outside any table. */\nexport function caretCellPos(state: EditorState): number | null {\n const { selection } = state;\n if (selection instanceof CellSelection) return null;\n const { $from } = selection;\n for (let depth = $from.depth; depth > 0; depth--) {\n if ($from.node(depth).type.spec['tableRole'] === 'cell') return $from.before(depth);\n }\n return null;\n}\n\n/** Deletes the content of the caret's cell, or of every selected cell. */\nexport const clearCells: Command = (state, dispatch) => {\n const { selection } = state;\n const cells: { pos: number; node: Node }[] = [];\n if (selection instanceof CellSelection) {\n selection.forEachCell((node, pos) => cells.push({ pos, node }));\n } else {\n const pos = caretCellPos(state);\n if (pos === null) return false;\n cells.push({ pos, node: state.doc.nodeAt(pos)! });\n }\n if (!cells.length) return false;\n if (dispatch) {\n const tr = state.tr;\n // Last first, so earlier positions stay put.\n for (const { pos, node } of [...cells].reverse()) {\n if (node.content.size) tr.delete(pos + 1, pos + node.nodeSize - 1);\n }\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n","/**\n * What a whole HTML document needs before the schema parses its body — the\n * two things a builder's export (MJML, Stripo, Mailchimp) leans on that the\n * canonical email HTML never has:\n *\n * 1. **A stylesheet.** The head's `<style>` rules are folded into the\n * elements they match ({@link inlineStyles}), so the mobile-first pattern\n * — `width: 100%` inline, `width: 50% !important` in a `min-width` media\n * query — comes out the way a desktop client draws it.\n * 2. **Wrapper tables.** Every section, column and image sits in a one-cell\n * `role=\"presentation\"` table for Outlook's sake; each one would parse as\n * a table of ours with its content hoisted out beside it. They are\n * unwrapped ({@link unwrapLayoutTables}) — only the builders' own, which\n * the canonical form never emits, and never one that carries a fill or a\n * padding: that is a band, the section node's own.\n * 3. **Hidden elements.** What a builder hides with `display: none` — the\n * trigger of a hamburger menu, a preview text, a desktop-only or\n * mobile-only variant — is dropped ({@link dropHidden}), rather than\n * read as text standing in the message: the schema has no notion of\n * hidden, and the client the import is drawn for would not show it.\n * 4. **Inheritance.** A builder writes the colour, the size, the face and\n * the alignment on a wrapping `<div>` or `<td>` and lets CSS carry them\n * down; the schema reads a paragraph's alignment off the paragraph and\n * a colour off a `<span>`. What an ancestor declares is written down\n * onto the blocks and the runs beneath it ({@link inheritTextStyles}),\n * so it reaches the words the way a client's cascade would.\n */\n\n/**\n * Drops the comments, and every element hidden with an inline\n * `display: none` (the sheet's having been folded in, a rule's counts too). A builder's export hides\n * the part of a trick the client cannot pull off — the label of an\n * MJML hamburger menu, whose ☰ would otherwise stand in the message as\n * text — and the alternative of a responsive pair; a preview text sits\n * in such a block as well, and goes with it: an email of ours carries no\n * hidden text. Not `visibility` or `mso-hide`: those are a client's\n * concern, not a rendering's.\n */\n/**\n * Drops the whitespace a client never shows: the text nodes of nothing but\n * spaces inside a box whose own `font-size` is 0. A builder kills the gaps\n * between a row of inline-block boxes that way — MJML's navbar links, its\n * grouped columns — and the row is laid out as the boxes abutting, their\n * own padding apart. Read as text, each gap would be a space at the\n * paragraph's size: 13px over four links, and the last one wraps.\n */\nexport function dropZeroSizedWhitespace(root: ParentNode): void {\n // The size is inherited: MJML sets it on the cell, and the links' own\n // box inside says nothing.\n const visit = (el: Element, inherited: boolean): void => {\n const own = el instanceof HTMLElement ? inlineValue(el, 'font-size') : '';\n const zero = own ? /^0(?:px|em|rem|%)?$/.test(own) : inherited;\n if (zero) {\n for (const node of Array.from(el.childNodes)) {\n // The markup's own whitespace only — never a hair space, which a\n // builder's spacer holds on purpose to keep its line.\n if (node.nodeType !== Node.TEXT_NODE || !/^[ \\t\\r\\n\\f]*$/.test(node.textContent ?? ''))\n continue;\n // Two links alike on either side would join into one box without\n // it (the schema holds one run for adjacent identical marks): the\n // gap stays, as the lesser wrong.\n if (joinsAlike(node.previousSibling, node.nextSibling)) continue;\n node.remove();\n }\n }\n for (const child of Array.from(el.children)) visit(child, zero);\n };\n for (const child of Array.from(root.children)) visit(child, false);\n}\n\n/** Whether two neighbours are anchors the schema would read as one link. */\nfunction joinsAlike(a: globalThis.Node | null, b: globalThis.Node | null): boolean {\n return (\n a instanceof HTMLAnchorElement &&\n b instanceof HTMLAnchorElement &&\n a.getAttribute('href') === b.getAttribute('href') &&\n (a.getAttribute('style') ?? '') === (b.getAttribute('style') ?? '')\n );\n}\n\nexport function dropHidden(root: ParentNode): void {\n // Comments first — a builder's Outlook conditionals stand between the\n // elements, and the schema never reads one; gone, a wrapper's cell is\n // seen to hold nothing but elements.\n const doc = root instanceof Document ? root : root.ownerDocument!;\n const walker = doc.createTreeWalker(root, NodeFilter.SHOW_COMMENT);\n const comments: globalThis.Node[] = [];\n while (walker.nextNode()) comments.push(walker.currentNode);\n for (const comment of comments) comment.parentNode?.removeChild(comment);\n for (const el of Array.from(root.querySelectorAll<HTMLElement>('[style]'))) {\n if (!el.isConnected) continue;\n if (/(?:^|;)\\s*display\\s*:\\s*none\\b/i.test(el.getAttribute('style') ?? '')) el.remove();\n }\n}\n\nimport { isFillTextColor } from './dual-contrast';\nimport { inlinePadding, isZeroSide, normalizeStyleText } from './inline-style';\n\n/**\n * Writes down, on each element, the `width` its author gave it inline —\n * `data-aee-own-width` — before {@link inlineStyles} folds a sheet's\n * `!important` over it. A column's own width is what says whether it\n * stacks on a phone (`width: 100%`, the mobile-first pattern, capped by a\n * `min-width` rule) or holds its share (`width: 50%`, a builder's grouped\n * columns): folded at 600px both read `50%`, and only the author's own\n * word tells them apart.\n */\nexport function noteOwnWidths(root: ParentNode): void {\n for (const el of Array.from(root.querySelectorAll<HTMLElement>('[style]'))) {\n const width = inlineValue(el, 'width');\n if (width) el.setAttribute('data-aee-own-width', width);\n }\n}\n\n/** The width the import is drawn at: an email's container. A `min-width`\n media query at or below it applies; a `max-width` one below it does not. */\nexport const IMPORT_VIEWPORT_WIDTH = 600;\n\ninterface Declaration {\n name: string;\n value: string;\n important: boolean;\n}\n\n/**\n * Folds the document's `<style>` rules into inline styles, then drops the\n * blocks. The cascade is the simple one an email tool can afford: a rule\n * applies to what its selector matches, in document order, later rules\n * over earlier ones; an inline declaration stands unless the rule is\n * `!important` (the mobile-first pattern relies on exactly that);\n * specificity is not weighed. Media queries are answered for\n * {@link IMPORT_VIEWPORT_WIDTH}; other at-rules and selectors the document\n * cannot match (`:hover`, `::before`) are skipped.\n */\nexport function inlineStyles(doc: Document, viewportWidth = IMPORT_VIEWPORT_WIDTH): void {\n const sheets = Array.from(doc.querySelectorAll('style'));\n if (!sheets.length) return;\n /** What the sheet itself set on an element: a later rule may replace it,\n where it may never replace what the element carried inline. */\n const fromSheet = new WeakMap<Element, Set<string>>();\n for (const sheet of sheets) {\n for (const rule of parseRules(sheet.textContent ?? '', viewportWidth)) {\n let matches: Element[];\n try {\n matches = Array.from(doc.querySelectorAll(rule.selector));\n } catch {\n continue;\n }\n for (const element of matches) {\n if (!(element instanceof HTMLElement)) continue;\n const own = fromSheet.get(element) ?? new Set<string>();\n fromSheet.set(element, own);\n for (const { name, value, important } of rule.declarations) {\n const inline = element.style.getPropertyValue(name);\n const inlineImportant = element.style.getPropertyPriority(name) === 'important';\n if (inline && !own.has(name) && !important) continue;\n if (inline && inlineImportant && !important) continue;\n // Appended to the attribute's own text, never set through the\n // CSSOM: a `setProperty` re-serialises the whole attribute from\n // the engine's reading, and jsdom's reading drops a longhand\n // written after its shorthand (MJML's section padding). The\n // cascade reads the text the same everywhere: later wins.\n const authored = element.getAttribute('style')?.trim().replace(/;$/, '') ?? '';\n const text = `${authored ? `${authored}; ` : ''}${name}: ${value}${important ? ' !important' : ''};`;\n // A sheet's `background: #fff` is as unreadable to jsdom as an\n // authored one: normalised on the way in, like the authored text.\n element.setAttribute('style', normalizeStyleText(text) ?? text);\n own.add(name);\n }\n }\n }\n sheet.remove();\n }\n}\n\ninterface StyleRule {\n selector: string;\n declarations: Declaration[];\n}\n\n/** The style rules of a sheet, flattened: those inside a media query that\n holds at `viewportWidth`, in order; other at-rules dropped. */\nexport function parseRules(css: string, viewportWidth: number): StyleRule[] {\n const rules: StyleRule[] = [];\n const text = css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, '');\n let index = 0;\n while (index < text.length) {\n const open = text.indexOf('{', index);\n if (open < 0) break;\n const prelude = text.slice(index, open).trim();\n const close = matchingBrace(text, open);\n if (close < 0) break;\n const body = text.slice(open + 1, close);\n index = close + 1;\n if (!prelude) continue;\n if (prelude.startsWith('@')) {\n if (/^@media\\b/i.test(prelude) && mediaMatches(prelude.slice(6), viewportWidth)) {\n rules.push(...parseRules(body, viewportWidth));\n }\n continue;\n }\n const declarations = parseDeclarations(body);\n if (!declarations.length) continue;\n for (const selector of prelude.split(',')) {\n const trimmed = selector.trim();\n if (!trimmed || /::?[a-z-]+/i.test(trimmed.replace(/:not\\([^)]*\\)/gi, ''))) continue;\n rules.push({ selector: trimmed, declarations });\n }\n }\n return rules;\n}\n\nfunction matchingBrace(text: string, open: number): number {\n let depth = 0;\n for (let i = open; i < text.length; i++) {\n if (text[i] === '{') depth++;\n else if (text[i] === '}' && --depth === 0) return i;\n }\n return -1;\n}\n\nfunction parseDeclarations(body: string): Declaration[] {\n const declarations: Declaration[] = [];\n for (const part of body.split(';')) {\n const colon = part.indexOf(':');\n if (colon < 0) continue;\n const name = part.slice(0, colon).trim().toLowerCase();\n let value = part.slice(colon + 1).trim();\n if (!name || !value) continue;\n const important = /!\\s*important$/i.test(value);\n if (important) value = value.replace(/!\\s*important$/i, '').trim();\n declarations.push({ name, value, important });\n }\n return declarations;\n}\n\n/** Whether a media query list holds for a screen `viewportWidth` wide:\n `screen`/`all`, `min-width` and `max-width` in px, `and` between them;\n `not`, `print` and any other feature do not hold. */\nexport function mediaMatches(query: string, viewportWidth: number): boolean {\n return query.split(',').some((part) => {\n const q = part.trim().toLowerCase();\n if (!q) return false;\n if (/^not\\b/.test(q) || /\\bprint\\b/.test(q)) return false;\n const rest = q.replace(/^only\\s+/, '').replace(/^(screen|all)\\b\\s*(and\\s*)?/, '');\n if (!rest.trim()) return true;\n for (const feature of rest.split(/\\band\\b/)) {\n const m = /^\\s*\\(\\s*(min-width|max-width)\\s*:\\s*([\\d.]+)px\\s*\\)\\s*$/.exec(feature);\n if (!m) return false;\n const px = parseFloat(m[2]);\n if (m[1] === 'min-width' ? viewportWidth < px : viewportWidth > px) return false;\n }\n return true;\n });\n}\n\n/**\n * Takes the builders' wrapper tables out: a one-row, one-cell\n * `role=\"presentation\"` table carrying the attributes the builders write\n * (`cellpadding`, `cellspacing`, `border=\"0\"`) whose cell holds nothing but\n * elements — a column, another table, an image — is replaced by what it\n * holds. A cell written right-to-left (`direction: rtl`, MJML's way to put\n * an image on the right) hands its children over in reverse, which is the\n * order a client draws them in. Innermost first, until none is left. A\n * table with text in its one cell is a table, and stays one; the\n * canonical form's own tables carry none of those attributes.\n */\nexport function unwrapLayoutTables(root: ParentNode): void {\n for (;;) {\n const wrappers = Array.from(root.querySelectorAll('table')).filter(isWrapperTable);\n if (!wrappers.length) return;\n // Innermost first: a wrapper whose own wrapper goes first would move\n // with it and still be there next round — either way the loop ends.\n for (const table of wrappers.reverse()) {\n if (!table.isConnected) continue;\n const content: globalThis.Node[] = [];\n for (const row of Array.from(table.rows)) content.push(...cellContent(row.cells[0], table));\n table.replaceWith(...content);\n }\n }\n}\n\n/** What a wrapper's cell hands over: its children — reversed when written\n right-to-left — with the cell's own alignment (`align`, `text-align`)\n and padding carried onto them, since the cell goes: the alignment onto\n each block that has none of its own, and round the inline runs (a\n button, a row of links) as a paragraph of that alignment; the padding\n shared out as {@link distributePadding} does. */\nfunction cellContent(cell: HTMLTableCellElement, table: HTMLTableElement): globalThis.Node[] {\n const children = Array.from(cell.childNodes);\n if (cell.style.direction === 'rtl' || table.style.direction === 'rtl') children.reverse();\n // Left said in so many words is an alignment too: the cell's blocks keep\n // it, rather than take a centre from further up (MJML centres a section\n // and aligns a column's cell left). A button's own cell — its fill round\n // the one anchor — aligns the label inside the box, not the box in its\n // line: that is the cell round it's to say.\n const ownButton =\n !!(cell.getAttribute('bgcolor') || cell.style.backgroundColor) &&\n cell.children.length === 1 &&\n cell.children[0].tagName === 'A';\n const align = ownButton ? null : (alignmentOf(cell) ?? (alignsItself(cell) ? 'left' : null));\n const box = paddingOf(cell);\n if (!align && !box) return children;\n const out: globalThis.Node[] = [];\n let run: globalThis.Node[] = [];\n const flush = () => {\n if (run.some((node) => node.textContent?.trim() || node.nodeType === 1)) {\n const paragraph = cell.ownerDocument.createElement('div');\n if (align) paragraph.style.textAlign = align;\n paragraph.append(...run);\n out.push(paragraph);\n }\n run = [];\n };\n for (const child of children) {\n if (child instanceof HTMLElement && isBlock(child)) {\n flush();\n if (align && !alignsItself(child)) child.style.textAlign = align;\n out.push(child);\n } else {\n run.push(child);\n }\n }\n flush();\n if (box)\n distributePadding(\n box,\n out.filter((node): node is HTMLElement => node instanceof HTMLElement && isBlock(node)),\n );\n return out;\n}\n\n/** A box's four sides, in px — top, right, bottom, left. */\ntype Box = [number, number, number, number];\n\n/** An element's padding, where it declares one that is not all zeros —\n the CSSOM's longhands, else the attribute's own shorthand. */\nexport function paddingOf(el: HTMLElement): Box | null {\n const px = (value: string): number => {\n const m = /^(-?\\d+(?:\\.\\d+)?)(?:px)?$/.exec(value.trim());\n return m ? parseFloat(m[1]) : 0;\n };\n const sides = inlinePadding(el);\n if (!sides) return null;\n const box = sides.map(px) as Box;\n return box.some((side) => side > 0) ? box : null;\n}\n\n/** Shares a dissolved box's padding out among the blocks it held, the way\n the box laid them out: the sides on every block, the top on the first,\n the bottom on the last — on top of any padding of their own. A table or\n a list takes none (they read no padding); a paragraph, a heading, a div\n do, and a paragraph's becomes its spacing. */\nexport function distributePadding(box: Box, blocks: HTMLElement[]): void {\n const takers = blocks.filter((block) => !/^(TABLE|UL|OL|HR)$/.test(block.tagName));\n takers.forEach((block, index) => {\n const own = paddingOf(block) ?? [0, 0, 0, 0];\n const next: Box = [\n own[0] + (index === 0 ? box[0] : 0),\n own[1] + box[1],\n own[2] + (index === takers.length - 1 ? box[2] : 0),\n own[3] + box[3],\n ];\n block.style.padding = next.map((side) => `${side}px`).join(' ');\n });\n}\n\n/** A cell's or block's own alignment — centre or right; left is the\n default, and not carried. */\nfunction alignmentOf(el: HTMLElement): 'center' | 'right' | null {\n const align = (el.style.textAlign || el.getAttribute('align') || '').trim().toLowerCase();\n return align === 'center' || align === 'right' ? align : null;\n}\n\n/** Whether a block says where its text goes, left included — a said\n alignment is its own, and takes nothing from above. */\nfunction alignsItself(el: HTMLElement): boolean {\n return !!(el.style.textAlign || el.getAttribute('align'));\n}\n\nconst BLOCK_TAGS = new Set([\n 'div',\n 'p',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'ul',\n 'ol',\n 'li',\n 'blockquote',\n 'table',\n 'hr',\n 'section',\n 'article',\n 'header',\n 'footer',\n]);\n\n/** Whether an element lays out as a block — a column, a paragraph, a\n table — as against a run of a line (a link, an image, a span). */\nexport function isBlock(el: Element): boolean {\n return BLOCK_TAGS.has(el.tagName.toLowerCase());\n}\n\n/** Whether a cell holds a block of its own — what a section's does, as\n against a button's wrapper (one anchor) or an image's (one `<img>`). */\nexport function holdsBlock(cell: Element): boolean {\n return Array.from(cell.children).some(isBlock);\n}\n\n/** A builder's wrapper: one column of cells — one cell round a section,\n a column or an image, or the stack a column's blocks sit in, a row\n each — every cell holding elements alone. Never a table of ours: the\n canonical form writes none of the builders' attributes. */\nfunction isWrapperTable(table: HTMLTableElement): boolean {\n if (table.getAttribute('role') !== 'presentation') return false;\n // A wrapper with a fill or a padding on it is a band — the section node's\n // to parse, not this pass's to take out.\n if (isBand(table)) return false;\n if (\n !table.hasAttribute('cellpadding') &&\n !table.hasAttribute('cellspacing') &&\n table.getAttribute('border') !== '0'\n ) {\n return false;\n }\n if (!table.rows.length) return false;\n return Array.from(table.rows).every(\n (row) =>\n row.cells.length === 1 &&\n Array.from(row.cells[0].childNodes).every(\n (node) => node.nodeType === Node.ELEMENT_NODE || !node.textContent?.trim(),\n ),\n );\n}\n\n/** Whether a one-cell table carries what makes it a section: a block in\n the cell (a button's wrapper round one anchor is a wrapper, whatever\n its fill), and a fill or an image on the cell, the table or the div\n wrapping it — or a padding on the cell round a *column* (a builder's\n section holds its columns; a builder's text block sits in a padded\n cell too, and is no band). */\nfunction isBand(table: HTMLTableElement): boolean {\n if (table.rows.length !== 1 || table.rows[0].cells.length !== 1) return false;\n const cell = table.rows[0].cells[0];\n if (!holdsBlock(cell)) return false;\n const parent = table.parentElement;\n const declares = (el: Element, property: string) =>\n new RegExp(`(?:^|;)\\\\s*${property}\\\\s*:`, 'i').test(el.getAttribute('style') ?? '');\n const filled = !!(\n declares(cell, 'background(?:-color|-image)?') ||\n cell.getAttribute('bgcolor') ||\n cell.getAttribute('background') ||\n declares(table, 'background(?:-color|-image)?') ||\n table.getAttribute('bgcolor') ||\n table.getAttribute('background') ||\n (parent instanceof HTMLElement &&\n parent.tagName === 'DIV' &&\n declares(parent, 'background(?:-color|-image)?'))\n );\n // Our own card: the centring div inside, with a fill or a padding of its\n // own — a band whose cell says nothing itself.\n const inner = Array.from(cell.children).find(\n (child): child is HTMLElement =>\n child instanceof HTMLElement &&\n child.tagName === 'DIV' &&\n !!child.style?.maxWidth &&\n child.style?.marginLeft === 'auto',\n );\n const card = !!inner && (declares(inner, 'background(?:-color)?') || isPadded(inner));\n return filled || card || (isPadded(cell) && holdsColumn(cell));\n}\n\n/** Whether a cell declares a padding that is not all zeros. */\nexport function isPadded(cell: Element): boolean {\n const sides = inlinePadding(cell);\n return !!sides && sides.some((side) => !isZeroSide(side));\n}\n\n/** Whether a cell holds a column — a builder's inline-block div, or our\n own centring div — which is what a section's cell holds. */\nexport function holdsColumn(cell: Element): boolean {\n return Array.from(cell.children).some(\n (child) =>\n child.tagName === 'DIV' &&\n (/inline-block/i.test((child as HTMLElement).style.display) ||\n !!(child as HTMLElement).style.maxWidth),\n );\n}\n\n/** An inline declaration's value: the CSSOM's reading, else the attribute's\n own words — an engine that trips on a shorthand before it drops the\n rest. */\nfunction inlineValue(el: HTMLElement, property: string): string {\n const cssom = el.style.getPropertyValue(property).trim();\n if (cssom) return cssom;\n const m = new RegExp(`(?:^|;)\\\\s*${property}\\\\s*:\\\\s*([^;]+)`, 'i').exec(\n el.getAttribute('style') ?? '',\n );\n return m?.[1]?.trim() ?? '';\n}\n\n/** What an ancestor's style hands down to the words: the properties CSS\n inherits that the schema reads — a colour, a size, a face off a\n `<span>`, an alignment and a line height off the block. */\nconst INHERITED = ['color', 'font-size', 'font-family', 'text-transform', 'line-height'] as const;\n\n/** The inherited properties only a block reads — never written onto a run. */\nconst BLOCK_ONLY: ReadonlySet<string> = new Set(['line-height']);\n\n/**\n * Writes down what CSS would inherit. A builder puts `color`, `font-size`,\n * `font-family` and `text-align` on a wrapping `<div>` (MJML's text\n * block), or `align` on a cell, and the words beneath inherit them; the\n * schema reads a colour off a `<span>` and an alignment off the paragraph\n * itself, so the cascade is materialised: each declaring element hands\n * the properties to the blocks under it that declare none of their own\n * (alignment and line height among them), and wraps its runs of inline content in a\n * `<span>` carrying the colour, the size and the face — an anchor's own\n * colour included, which is how a navbar's black links stay black. Top\n * down, so a grandchild takes the nearer ancestor's word. A `font-size`\n * of 0 (a builder's way to kill the gaps between inline-block columns)\n * is not a size and is not passed on.\n */\nexport function inheritTextStyles(root: ParentNode): void {\n const doc = root instanceof Document ? root : root.ownerDocument!;\n const declared = (el: HTMLElement): Partial<Record<(typeof INHERITED)[number], string>> => {\n const out: Partial<Record<(typeof INHERITED)[number], string>> = {};\n // A fill's paired text colour (our bands, columns and cells write one\n // beside the fill) is the fill's, not an authored colour: the span rule\n // absorbs it on a span, and it is not passed down here either.\n const fill = el.style.backgroundColor || el.getAttribute('bgcolor') || '';\n for (const property of INHERITED) {\n const value = inlineValue(el, property);\n if (!value || /^(inherit|initial|unset|transparent)$/i.test(value)) continue;\n // A size or a line height of 0 is a builder's way to close the gaps\n // round inline-block columns, not a measure for the words.\n if (/^(font-size|line-height)$/.test(property) && /^0(px|em|rem|%)?$/.test(value)) continue;\n if (property === 'line-height' && !/^\\d+(?:\\.\\d+)?(?:px|%)?$/.test(value)) continue;\n if (property === 'color' && fill && isFillTextColor(value, fill)) continue;\n out[property] = value;\n }\n return out;\n };\n /** `carried`: what the span round this element's run says — the words\n here sit in it, and a span of their own must say it too: the schema\n keeps one text style on a word, the innermost. */\n const visit = (el: HTMLElement, carried: Record<string, string> = {}): void => {\n resolveLineHeight(el);\n const inherited = declared(el);\n // A heading's size is the heading's own (the schema's headings say\n // theirs), not a size to write onto its words.\n if (/^H[1-6]$/.test(el.tagName)) delete inherited['font-size'];\n const align = alignmentOf(el);\n const own = Object.entries(inherited).filter(([property]) => !BLOCK_ONLY.has(property));\n const onRuns = Object.entries({ ...carried, ...Object.fromEntries(own) });\n // A span (or a legacy font) is read for its own styles by the schema:\n // nothing to hand down, and a span inside it would stand in its way —\n // what the run round it says is written onto it instead.\n if (/^(SPAN|FONT)$/.test(el.tagName)) {\n for (const [property, value] of Object.entries(carried)) {\n if (!el.style.getPropertyValue(property)) el.style.setProperty(property, value);\n }\n }\n const passes = own.length > 0 && !/^(SPAN|FONT)$/.test(el.tagName);\n // A nav item's line height is its row's: an inline-block link's box\n // sets the line it stands in, and the schema reads a line's height off\n // the line.\n if (el.tagName === 'A' && /^inline-block$/i.test(el.style.display)) {\n const line = blockAround(el);\n if (line && !line.style.lineHeight && /px$/.test(el.style.lineHeight)) {\n line.style.lineHeight = el.style.lineHeight;\n }\n }\n const made = new Set<Element>();\n // A run of inline content beside blocks (a builder's loose words before\n // a `<p>`) is a line of its own, and takes the alignment as a block.\n const mixed = !!align && Array.from(el.children).some((child) => isBlock(child));\n // A list item's words stand in a line the parser makes up, which reads\n // nothing off the item: one of ours carries its line height.\n const itemLine = el.tagName === 'LI' ? el.style.lineHeight : '';\n let run: globalThis.Node[] = [];\n const flush = () => {\n const words = run.some((node) =>\n node.nodeType === Node.TEXT_NODE ? !!node.textContent?.trim() : node.nodeType === 1,\n );\n if (words && (passes || mixed || itemLine)) {\n let holder: HTMLElement = el;\n if (mixed || itemLine) {\n const line = doc.createElement('div');\n if (align) line.style.textAlign = align;\n // The loose words' line is as tall as the element says its lines\n // are — a factor worked out against its size, as on any line.\n const lineHeight = itemLine || inherited['line-height'];\n if (lineHeight) {\n line.style.lineHeight = lineHeight;\n line.style.fontSize = el.style.fontSize;\n resolveLineHeight(line);\n line.style.fontSize = '';\n }\n el.insertBefore(line, run[0]);\n holder = line;\n made.add(line);\n }\n if (passes) {\n const span = doc.createElement('span');\n for (const [property, value] of onRuns) {\n span.style.setProperty(property, value);\n }\n if (holder === el) el.insertBefore(span, run[0]);\n span.append(...run);\n if (holder !== el) holder.append(span);\n made.add(span);\n } else {\n holder.append(...run);\n }\n }\n run = [];\n };\n for (const child of Array.from(el.childNodes)) {\n if (child instanceof HTMLElement && isBlock(child)) {\n flush();\n for (const [property, value] of Object.entries({ ...carried, ...inherited })) {\n if (!child.style.getPropertyValue(property)) child.style.setProperty(property, value);\n }\n if (align && !alignsItself(child) && child.tagName !== 'TABLE') {\n child.style.textAlign = align;\n }\n } else {\n run.push(child);\n }\n }\n flush();\n // A builder's plain wrapper div (no column, no centring div of ours: no\n // `display`, no `max-width`) with a padding round blocks: shared out\n // among them, since the schema reads a paragraph's box, not a div's.\n if (el.tagName === 'DIV' && !inlineValue(el, 'display') && !inlineValue(el, 'max-width')) {\n const blocks = Array.from(el.children).filter(\n (child): child is HTMLElement => child instanceof HTMLElement && isBlock(child),\n );\n const box = blocks.length ? paddingOf(el) : null;\n if (box) {\n distributePadding(box, blocks);\n el.style.padding = '';\n }\n }\n // Down into the children with what they were handed. A span just made\n // holds what stood here — an anchor with a colour of its own among it,\n // which is visited in turn, carrying what that span says.\n const runCarry = passes ? Object.fromEntries(onRuns) : carried;\n const descend = (parent: HTMLElement): void => {\n for (const child of Array.from(parent.children)) {\n if (!(child instanceof HTMLElement)) continue;\n if (made.has(child)) descend(child);\n else visit(child, isBlock(child) ? {} : runCarry);\n }\n };\n descend(el);\n };\n for (const child of Array.from(root.children)) if (child instanceof HTMLElement) visit(child);\n}\n\n/** The block an inline element stands in. */\nfunction blockAround(el: HTMLElement): HTMLElement | null {\n for (let up = el.parentElement; up; up = up.parentElement) if (isBlock(up)) return up;\n return null;\n}\n\n/**\n * An element's line height in px where CSS would hold it in px: a\n * percentage is worked out where it is declared, against the size there,\n * and inherited as that length; a bare number is a factor of each line's\n * own size, worked out on the line itself (a block with no blocks in it).\n * The schema keeps a line's size on its words, not on the line — a factor\n * or a percentage left on the line would multiply the line's default size\n * instead. Without a px size to work from, left as written.\n */\nfunction resolveLineHeight(el: HTMLElement): void {\n const value = el.style.lineHeight.trim();\n const factor = /^(\\d+(?:\\.\\d+)?)(%?)$/.exec(value);\n const size = /^(\\d+(?:\\.\\d+)?)px$/.exec(el.style.fontSize.trim());\n if (!factor || !size) return;\n if (!factor[2] && Array.from(el.children).some((child) => isBlock(child))) return;\n const px = (parseFloat(size[1]) * parseFloat(factor[1])) / (factor[2] ? 100 : 1);\n el.style.lineHeight = `${Math.round(px * 100) / 100}px`;\n}\n","import { Command, EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';\nimport { Mark, MarkType, Node, Schema } from 'prosemirror-model';\nimport { AddMarkStep, RemoveMarkStep, Transform } from 'prosemirror-transform';\nimport { defineMark } from '../../extension';\n\n/**\n * Personalization tokens — `{{cf_70}}`, `{{customer_gender == 'male' ? 'Herr'\n * : 'Frau'}}` — as **text with a mark** (decided 2026-09-02; they were inline\n * atoms before). The raw `{{expression}}` is ordinary document text, braces\n * included, so the cursor lands anywhere inside it, it is edited like any\n * text, and a long expression wraps across lines like text. The `mergeTag`\n * mark only paints the pill, editor-only: the serialized email carries the\n * raw text, stored and re-emitted **verbatim** — the expression is another\n * system's program (an AngularJS-style evaluator, a Handlebars renderer, …)\n * and rewriting so much as its spacing could change what a string literal or\n * date format means. The editor protects; it never interprets.\n *\n * Two invariants, kept by the extension's `appendTransaction` after every\n * change (and by {@link promoteMergeTags} at parse time):\n *\n * 0. **A token is padded canonically**: `{{ expr }}`, one space each side\n * ({@link canonicalMergeTagInner}) — the only rewrite the editor makes\n * to a token, applied on parse, on completion, and by the formatter; a\n * token under the cursor is left alone until the cursor leaves it.\n * 1. **The mark covers exactly the tokens.** Text that reads `{{…}}` (per\n * {@link isMergeTagExpression}) carries the mark, nothing else does —\n * type a token by hand and it becomes a pill on the closing brace,\n * delete a brace and the pill is gone. Derived from the text, never\n * stored: the round trip cannot lie.\n * 2. **Formatting is all-or-nothing on a token.** Bold, italic, colour, a\n * link: whatever applies to any part of a token applies to the whole of\n * it — Ctrl-B with the cursor inside bolds the entire `{{…}}`, so the\n * value it renders to (\"Mr Wild\") is bold as a whole. A mark added or\n * removed over part of a token is widened to the token; a token that\n * arrives partially formatted (a paste, the source pane) is repaired to\n * whole.\n *\n * What is *not* a token: Handlebars block helpers and partials (`{{#if}}`,\n * `{{/each}}`, `{{>partial}}`) — half of a block is not a value and pairing\n * them is a renderer's job — plus anything nested, multi-line, or past the\n * length ceiling. Those stay plain text.\n */\n\n/** The longest expression the editor protects as one token, in characters\n inside the braces. Real templates run long — a salutation with four\n branches and string concatenation passes 300 — so the ceiling is a\n runaway guard, not a style limit: past it, stray braces around ordinary\n prose stay prose. Measured on the trimmed expression; the scanner and the\n source-pane lint mask allow it plus the two padding spaces (regex\n literals cannot read a constant). */\nexport const MAX_MERGE_TAG_LENGTH = 1000;\n\n/** A bare dotted identifier — what the registry menu inserts, and the shape\n a field reference takes inside an expression. */\nconst PATH = /^[A-Za-z_$][\\w$]*(?:\\.[\\w$]+)*$/;\n\nexport const isMergeTagPath = (path: string): boolean => PATH.test(path);\n\n/** An inner text the editor will protect as one token: single-line, sanely\n sized, no nested braces, not block syntax (a Handlebars helper / closer /\n `{{else}}` / partial / comment) — half of a block is not a value. */\nexport function isMergeTagExpression(raw: string): boolean {\n if (/[{}\\r\\n]/.test(raw)) return false;\n const trimmed = raw.trim();\n if (trimmed.length > MAX_MERGE_TAG_LENGTH) return false;\n return trimmed.length > 0 && trimmed !== 'else' && !/^[#/>!^]/.test(trimmed);\n}\n\n/** `{{ … }}` occurrences in running text (capture = the inner expression,\n verbatim). The lookbehind keeps a triple-stash's `{{{` from matching. */\n// 1002: the ceiling plus the two canonical padding spaces.\nconst SCAN = /(?<!\\{)\\{\\{([^{}\\r\\n]{1,1002})\\}\\}/g;\n\n/** The canonical padding of a token: `{{ expr }}` — one space each side of\n the trimmed expression. Edge whitespace is insignificant to every dialect\n we transport (AngularJS `$parse`, Handlebars), so this is the one\n rewrite the editor allows itself on a token; the expression itself stays\n byte-verbatim. Handlebars' `{{~ … ~}}` whitespace control and `{{& …}}`\n need their sigil against the braces: those are left as written. */\nexport function canonicalMergeTagInner(expr: string): string {\n const trimmed = expr.trim();\n if (/^[~&]|~$/.test(trimmed)) return expr;\n return ` ${trimmed} `;\n}\n\n/** Every token in running text at its canonical padding — the source\n formatter's rule (Shift-Alt-F, Mod-S, format-on-blur), and the same form\n the schema serializes. Pure. */\nexport function normalizeMergeTagText(text: string): string {\n return text.replace(SCAN, (match, inner: string) =>\n isMergeTagExpression(inner) ? `{{${canonicalMergeTagInner(inner)}}}` : match,\n );\n}\n\n/** Every token in a piece of running text, as offsets: the whole `{{ … }}`\n and the expression inside it — what a highlighter paints (the source\n pane mutes the braces, Angular-template style). Pure. */\nexport function scanMergeTags(\n text: string,\n options: { multiline?: boolean } = {},\n): { from: number; to: number; expr: [number, number] }[] {\n const found: { from: number; to: number; expr: [number, number] }[] = [];\n // Source text may carry a token the formatter wrapped over several lines\n // (Prettier's interpolation style); the parser collapses those newlines\n // back to spaces, so the token is judged on its collapsed form.\n const scan = options.multiline ? /(?<!\\{)\\{\\{([^{}]{1,1002})\\}\\}/g : SCAN;\n scan.lastIndex = 0;\n for (let match; (match = scan.exec(text));) {\n if (!isMergeTagExpression(match[1].replace(/\\s+/g, ' '))) continue;\n const from = match.index;\n const to = from + match[0].length;\n found.push({ from, to, expr: [from + 2, to - 2] });\n }\n return found;\n}\n\n/** A token's place in the document: `[from, to)` around the braces. */\nexport interface MergeTagRange {\n from: number;\n to: number;\n /** The inner expression, verbatim. */\n expr: string;\n}\n\n/** The tokens of one textblock, from its text alone. A non-text inline node\n (an image, a hard break) counts as a separator: a token never spans one. */\nfunction textblockTags(textblock: Node, base: number): MergeTagRange[] {\n let text = '';\n textblock.forEach((child) => {\n text += child.isText ? (child.text ?? '') : '\\n'.repeat(child.nodeSize);\n });\n const tags: MergeTagRange[] = [];\n SCAN.lastIndex = 0;\n for (let match; (match = SCAN.exec(text));) {\n if (!isMergeTagExpression(match[1])) continue;\n tags.push({\n from: base + match.index,\n to: base + match.index + match[0].length,\n expr: match[1],\n });\n }\n return tags;\n}\n\n/** Every token in the document, in document order — derived from the text,\n which is the only truth about them. */\nexport function mergeTagRanges(doc: Node): MergeTagRange[] {\n const tags: MergeTagRange[] = [];\n doc.descendants((node, pos) => {\n if (!node.isTextblock) return true;\n tags.push(...textblockTags(node, pos + 1));\n return false;\n });\n return tags;\n}\n\n/** Every token's raw expression, in document order — for a host that wants\n to evaluate or audit the template as written. */\nexport function mergeTagExpressions(doc: Node): string[] {\n return mergeTagRanges(doc).map((tag) => tag.expr);\n}\n\n/** The token at `pos` — inside it or at either edge — if any. */\nexport function mergeTagAt(doc: Node, pos: number): MergeTagRange | undefined {\n const $pos = doc.resolve(pos);\n if (!$pos.parent.isTextblock) return undefined;\n return textblockTags($pos.parent, $pos.start()).find((tag) => tag.from <= pos && pos <= tag.to);\n}\n\n/** A command inserting the token for `path` at the selection — what a `{{`\n suggestion runs. The token is text; the pill follows from the mark's\n invariants. */\nexport const insertMergeTag =\n (path: string): Command =>\n (state, dispatch) => {\n dispatch?.(state.tr.insertText(`{{ ${path} }}`).scrollIntoView());\n return true;\n };\n\n/** Whether a selection lies within one token — the bubble menu stays away\n then (formatting still works from the keyboard, on the whole token). */\nexport function selectionInsideMergeTag(state: EditorState): boolean {\n const tag = mergeTagAt(state.doc, state.selection.from);\n return !!tag && state.selection.to <= tag.to;\n}\n\n/** Whether the caret stands strictly inside a token — between its braces,\n at neither edge. What a `{{` suggestion menu's `allow` turns down: there\n the braces before the caret open a token that is already written, and\n picking a row would write a second one into it. */\nexport function caretInsideMergeTag(state: EditorState): boolean {\n const { empty, from } = state.selection;\n const tag = empty ? mergeTagAt(state.doc, from) : undefined;\n return !!tag && tag.from < from && from < tag.to;\n}\n\n// ---------------------------------------------------------------------------\n// The invariants\n\n/** Does every text node across `[from, to)` carry `mark`? */\nfunction wholeRangeHasMark(doc: Node, from: number, to: number, mark: Mark): boolean {\n let whole = true;\n doc.nodesBetween(from, to, (node) => {\n if (node.isText && !mark.isInSet(node.marks)) whole = false;\n return whole;\n });\n return whole;\n}\n\n/** Invariant 0: a token's padding is canonical (`{{ expr }}`). The token the\n cursor is *inside* is left alone while it is being edited — the padding\n would fight the typist — and fixed the moment the cursor leaves it, or on\n the next parse. Replacements run last-to-first so earlier positions hold. */\nfunction padTokens(tr: Transform, cursor?: number): boolean {\n let changed = false;\n const tags = mergeTagRanges(tr.doc);\n for (let i = tags.length - 1; i >= 0; i--) {\n const tag = tags[i];\n if (cursor !== undefined && cursor > tag.from && cursor < tag.to) continue;\n const canonical = canonicalMergeTagInner(tag.expr);\n if (canonical === tag.expr) continue;\n const marks = tr.doc.resolve(tag.from + 2).nodeAfter?.marks ?? [];\n tr.replaceWith(tag.from + 2, tag.to - 2, tr.doc.type.schema.text(canonical, marks));\n changed = true;\n }\n return changed;\n}\n\n/** Invariant 1: the `mergeTag` mark covers exactly the tokens. Compares\n per character, so two adjacent tokens (one merged text node) never read\n as a difference. */\nfunction coverTokens(tr: Transform, type: MarkType): boolean {\n let changed = false;\n const doc = tr.doc;\n doc.descendants((node, pos) => {\n if (!node.isTextblock) return true;\n const base = pos + 1;\n const wanted = new Uint8Array(node.content.size);\n for (const tag of textblockTags(node, base)) wanted.fill(1, tag.from - base, tag.to - base);\n const have = new Uint8Array(node.content.size);\n node.forEach((child, offset) => {\n if (child.isText && type.isInSet(child.marks)) have.fill(1, offset, offset + child.nodeSize);\n });\n if (wanted.every((value, i) => value === have[i])) return false;\n tr.removeMark(base, base + node.content.size, type);\n for (const tag of textblockTags(node, base)) tr.addMark(tag.from, tag.to, type.create());\n changed = true;\n return false;\n });\n return changed;\n}\n\n/** Invariant 2a: a mark added or removed over *part* of a token by a\n transaction's steps is widened to the whole token. */\nfunction widenMarkSteps(tr: Transform, applied: Transaction, later: Transaction[]): boolean {\n let changed = false;\n let tags: MergeTagRange[] | null = null;\n applied.steps.forEach((step, i) => {\n if (!(step instanceof AddMarkStep) && !(step instanceof RemoveMarkStep)) return;\n const mapping = applied.mapping.slice(i + 1);\n let from = mapping.map(step.from, 1);\n let to = mapping.map(step.to, -1);\n for (const next of later) {\n from = next.mapping.map(from, 1);\n to = next.mapping.map(to, -1);\n }\n // …and through what this repair already did (the padding moves text).\n from = tr.mapping.map(from, 1);\n to = tr.mapping.map(to, -1);\n tags ??= mergeTagRanges(tr.doc);\n for (const tag of tags) {\n if (tag.from >= to || tag.to <= from) continue;\n if (step instanceof AddMarkStep) {\n if (wholeRangeHasMark(tr.doc, tag.from, tag.to, step.mark)) continue;\n tr.addMark(tag.from, tag.to, step.mark);\n } else {\n if (!tr.doc.rangeHasMark(tag.from, tag.to, step.mark.type)) continue;\n tr.removeMark(tag.from, tag.to, step.mark.type);\n }\n changed = true;\n }\n });\n return changed;\n}\n\n/** Invariant 2b: a token that is partially formatted (a paste, the source\n pane, an import) is repaired to whole — whatever any part of it carries,\n all of it carries. Only ever widens, so it cannot fight a removal. */\nfunction wholeMarksOnTokens(tr: Transform, type: MarkType): boolean {\n let changed = false;\n for (const tag of mergeTagRanges(tr.doc)) {\n const present = new Map<MarkType, Mark>();\n tr.doc.nodesBetween(tag.from, tag.to, (node) => {\n if (node.isText) {\n for (const mark of node.marks) {\n if (mark.type !== type && !present.has(mark.type)) present.set(mark.type, mark);\n }\n }\n });\n for (const mark of present.values()) {\n if (wholeRangeHasMark(tr.doc, tag.from, tag.to, mark)) continue;\n tr.addMark(tag.from, tag.to, mark);\n changed = true;\n }\n }\n return changed;\n}\n\n/** Invariant 2c: a mark toggled with the cursor *inside* a token (no\n selection — ProseMirror would only set stored marks for the next typed\n character) applies to the whole token instead. */\nfunction applyStoredMarksToToken(\n tr: Transaction,\n state: EditorState,\n applied: Transaction,\n): boolean {\n if (!applied.storedMarksSet || !state.selection.empty) return false;\n const tag = mergeTagAt(state.doc, state.selection.from);\n if (!tag || state.selection.from === tag.from || state.selection.from === tag.to) return false;\n const stored = state.storedMarks;\n if (!stored) return false;\n const current = state.doc.resolve(state.selection.from).marks();\n let changed = false;\n for (const mark of stored) {\n if (mark.isInSet(current)) continue;\n tr.addMark(tag.from, tag.to, mark);\n changed = true;\n }\n for (const mark of current) {\n if (mark.isInSet(stored) || mark.type.name === 'mergeTag') continue;\n tr.removeMark(tag.from, tag.to, mark.type);\n changed = true;\n }\n if (changed) tr.setStoredMarks(null);\n return changed;\n}\n\n/**\n * Applies both invariants to a parsed document — the token half of \"parsing\n * is repair\", run by `parseHTML` right after the table repair. A schema\n * without the mark (the HTML source editor) passes straight through.\n */\nexport function promoteMergeTags(doc: Node, schema: Schema): Node {\n const type = schema.marks['mergeTag'];\n if (!type) return doc;\n const tr = new Transform(doc);\n padTokens(tr);\n coverTokens(tr, type);\n wholeMarksOnTokens(tr, type);\n return tr.doc;\n}\n\nexport const MergeTag = defineMark({\n name: 'mergeTag',\n spec: {\n // Typing right after `}}` continues as plain text; inside, as token text.\n inclusive: false,\n // The clipboard carries `toDOM`; this rule reads it back. The text alone\n // would re-mark on paste anyway (invariant 1) — the rule just keeps the\n // pill through the round trip without a repair step.\n parseDOM: [{ tag: 'span[data-aee-merge-tag]' }],\n toDOM: () => ['span', { class: 'aee-merge-tag', 'data-aee-merge-tag': '' }, 0],\n // The email carries the raw token text — no editor chrome leaves the app.\n emitDOM: null,\n },\n commands: () => ({\n /** Inserts a field token at the selection — the `{{` menu calls this.\n Fields only: free-form expressions are typed or imported, never built\n by an API that could smuggle syntax past the validation. The mark\n follows from the text (invariant 1). */\n insertMergeTag:\n (path: string): Command =>\n (state, dispatch) => {\n if (!isMergeTagPath(path)) return false;\n dispatch?.(state.tr.insertText(`{{ ${path} }}`).scrollIntoView());\n return true;\n },\n }),\n plugins: ({ schema }) => [\n new Plugin({\n key: new PluginKey('mergeTags'),\n appendTransaction: (transactions, _old, state) => {\n const type = schema.marks['mergeTag'];\n if (!type) return null;\n const tr = state.tr;\n let changed = false;\n transactions.forEach((applied) => {\n changed = applyStoredMarksToToken(tr, state, applied) || changed;\n });\n if (transactions.some((applied) => applied.docChanged)) {\n changed = padTokens(tr, state.selection.head) || changed;\n changed = coverTokens(tr, type) || changed;\n transactions.forEach((applied, i) => {\n changed = widenMarkSteps(tr, applied, transactions.slice(i + 1)) || changed;\n });\n changed = wholeMarksOnTokens(tr, type) || changed;\n }\n return changed ? tr : null;\n },\n }),\n ],\n});\n\n/**\n * The *required fields* of the document: every identifier the token\n * expressions read that the host must supply a value for, deduplicated, in\n * first-use order. This is a lex over the tokens' expressions, not a text\n * parse of the HTML — and it understands enough expression grammar to\n * exclude what is not a field:\n *\n * - string literals (`'Herr'`, `\"+5 days\"`),\n * - filter names (`x | formatPrice` — the identifier after a single `|`),\n * - function calls (`round(…)`, `parseFloat(…)`),\n * - dotted tails (`customer.name` needs `customer`, not `name`),\n * - locals assigned inside any token (`mwst = …; mwst` — `mwst` is\n * computed, not fetched; the assignment is seen document-wide),\n * - literals and builtins (`true`, `null`, `now`, …).\n *\n * `{{ mwst = round(parseFloat(cf_70) * 0.19, 2); mwst }}` therefore requires\n * exactly `cf_70`.\n */\nexport function mergeTagFields(doc: Node): string[] {\n const stripped = mergeTagExpressions(doc).map(blankStrings);\n\n // Pass 1: locals — an identifier assigned anywhere is computed everywhere.\n const assigned = new Set<string>();\n for (const expr of stripped) {\n forEachIdentifier(expr, (name, context) => {\n if (context.isAssignment) assigned.add(name);\n });\n }\n\n const fields: string[] = [];\n const seen = new Set<string>();\n for (const expr of stripped) {\n forEachIdentifier(expr, (name, context) => {\n if (context.isFilter || context.isCall || context.isDottedTail || context.isAssignment)\n return;\n if (RESERVED.has(name) || assigned.has(name) || seen.has(name)) return;\n seen.add(name);\n fields.push(name);\n });\n }\n return fields;\n}\n\n/** Literals and ambient values an evaluator provides — never fetched. */\nconst RESERVED = new Set(['true', 'false', 'null', 'undefined', 'this', 'now']);\n\n/** Replaces string literals with spaces of the same length, so identifier\n positions survive and quoted text can never look like a field. */\nfunction blankStrings(expr: string): string {\n return expr.replace(/'(?:[^'\\\\]|\\\\.)*'|\"(?:[^\"\\\\]|\\\\.)*\"/g, (match) => ' '.repeat(match.length));\n}\n\ninterface IdentifierContext {\n /** Named directly after a single `|` — a filter, not a value. */\n isFilter: boolean;\n /** Followed by `(` — a function, not a value. */\n isCall: boolean;\n /** Preceded by `.` — a property tail; the dotted root is the field. */\n isDottedTail: boolean;\n /** Followed by a lone `=` — the target of a local assignment. */\n isAssignment: boolean;\n}\n\nfunction forEachIdentifier(\n expr: string,\n visit: (name: string, context: IdentifierContext) => void,\n): void {\n for (const match of expr.matchAll(/[A-Za-z_$][\\w$]*/g)) {\n const start = match.index;\n const before = expr.slice(0, start).replace(/\\s+$/, '');\n const after = expr.slice(start + match[0].length).replace(/^\\s+/, '');\n visit(match[0], {\n // A single `|` is the filter pipe; `||` is boolean-or, whose operand\n // is still a value.\n isFilter: before.endsWith('|') && !before.endsWith('||'),\n isCall: after.startsWith('('),\n isDottedTail: before.endsWith('.'),\n isAssignment: after.startsWith('=') && !after.startsWith('=='),\n });\n }\n}\n","import { defineMark } from '../../extension';\nimport { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Mark } from 'prosemirror-model';\nimport { InputRule } from 'prosemirror-inputrules';\n\nexport interface LinkAttrs {\n href: string;\n title?: string | null;\n target?: string;\n}\n\nexport interface LinkRange {\n from: number;\n to: number;\n attrs: LinkAttrs;\n}\n\n/** The contiguous extent of the link at `pos`, if any — the range that a\n link edit from a bare cursor (no selection) applies to. */\nexport function linkRangeAt(state: EditorState, pos: number): LinkRange | null {\n const type = state.schema.marks['link'];\n if (!type) return null;\n\n const $pos = state.doc.resolve(pos);\n const parentStart = $pos.start();\n const children: { from: number; to: number; mark: Mark | null }[] = [];\n $pos.parent.forEach((child, offset) => {\n children.push({\n from: parentStart + offset,\n to: parentStart + offset + child.nodeSize,\n mark: type.isInSet(child.marks) ?? null,\n });\n });\n\n const index = children.findIndex((c) => c.mark && pos >= c.from && pos <= c.to);\n if (index < 0) return null;\n\n // Expand over adjacent nodes carrying the same link (same href etc.).\n const mark = children[index].mark!;\n let from = children[index].from;\n let to = children[index].to;\n for (let i = index - 1; i >= 0 && children[i].mark?.eq(mark); i--) from = children[i].from;\n for (let i = index + 1; i < children.length && children[i].mark?.eq(mark); i++)\n to = children[i].to;\n\n return { from, to, attrs: mark.attrs as LinkAttrs };\n}\n\n/** A URL typed in prose, committed by the following space. */\nconst AUTO_LINK = /(?:^|\\s)((?:https?:\\/\\/|www\\.)[^\\s]+)\\s$/;\n\n/** A simple security check to prevent XSS. Shared by every URL-bearing\n extension (links, images): script URLs are refused on parse and on the\n inserting command alike — the schema is the sanitizer. */\nexport function isSafeUrl(url: string | null): boolean {\n if (!url) return false;\n // Block javascript: and vbscript: protocols (case-insensitive, ignoring leading spaces)\n const isMalicious = /^\\s*(javascript|vbscript):/i.test(url);\n return !isMalicious;\n}\n\n/**\n * What a person typed into a link field → the href it means: a scheme or a\n * `#fragment` as written, an address `mailto:`, a `{{ token }}` untouched\n * (it becomes a URL at send), anything else `https://`. Empty stays empty.\n */\nexport function normalizeHref(raw: string): string {\n const value = raw.trim();\n if (!value) return '';\n if (/^[a-z][\\w+.-]*:/i.test(value) || value.startsWith('#') || value.startsWith('{{')) {\n return value;\n }\n if (/^[^\\s@/]+@[^\\s@/]+\\.[^\\s@/]+$/.test(value)) return `mailto:${value}`;\n return `https://${value}`;\n}\n\n/** Why a typed link cannot be applied — see {@link hrefProblem}. */\nexport type HrefProblem = 'required' | 'unsafe' | 'invalid';\n\n/** The schemes a link in an email may use. */\nconst LINK_SCHEMES = /^(https?|mailto|tel):$/i;\n\n/**\n * Whether what was typed into a link field can be a link in an email, after\n * {@link normalizeHref}: `'required'` for nothing (or a bare `#`),\n * `'unsafe'` for a script or `data:` URL — refused like `isSafeUrl`, plus\n * `data:`, the phishing favourite no mail client should be handed —\n * `'invalid'` for what is no URL at all (no host, a scheme mail cannot\n * use, a host without a dot), null when it is fine. A link holding a\n * `{{ token }}` passes: its shape is known only once it is filled in.\n */\nexport function hrefProblem(raw: string): HrefProblem | null {\n const href = normalizeHref(raw);\n if (!href || href === '#') return 'required';\n if (!isSafeUrl(href) || /^\\s*data:/i.test(href)) return 'unsafe';\n if (href.includes('{{') || href.startsWith('#')) return null;\n let url: URL;\n try {\n url = new URL(href);\n } catch {\n return 'invalid';\n }\n if (!LINK_SCHEMES.test(url.protocol)) return 'invalid';\n if (/^https?:$/.test(url.protocol) && !url.hostname.includes('.')) return 'invalid';\n return null;\n}\n\n/** A single URL from pasted text → an href (prepending https:// for `www.`).\n Returns null when the text isn't one bare URL (has spaces, or isn't a\n recognised scheme), so ordinary text still pastes normally. */\nfunction urlFromText(text: string): string | null {\n const trimmed = text.trim();\n if (!trimmed || /\\s/.test(trimmed)) return null;\n if (/^(https?:\\/\\/|mailto:)/i.test(trimmed)) return trimmed;\n if (/^www\\./i.test(trimmed)) return `https://${trimmed}`;\n return null;\n}\n\n/** Paste a URL onto selected text and the text becomes the link, rather than\n replacing the selection with the raw URL (the Gmail/Docs behaviour). */\nexport const linkPastePlugin = new Plugin({\n key: new PluginKey('linkPaste'),\n props: {\n handlePaste: (view, event) => {\n const { state } = view;\n const type = state.schema.marks['link'];\n if (!type || state.selection.empty) return false;\n\n const href = urlFromText(event.clipboardData?.getData('text/plain') ?? '');\n if (!href || !isSafeUrl(href)) return false;\n\n const { from, to } = state.selection;\n view.dispatch(state.tr.addMark(from, to, type.create({ href })).scrollIntoView());\n return true;\n },\n },\n});\n\nexport const linkClickPlugin = new Plugin({\n key: new PluginKey('linkClick'),\n props: {\n // Listen to all click events inside the editor\n handleClick: (view, pos, event) => {\n // 1. Check if the user is holding Ctrl (Windows) or Cmd (Mac)\n // If not, return false to let ProseMirror handle standard cursor placement\n if (!event.ctrlKey && !event.metaKey) {\n return false;\n }\n\n // 2. See if the element they clicked on is an <a> tag\n const target = event.target as HTMLElement;\n const link = target.closest('a');\n\n // 3. If it is a link, manually open it!\n if (link && link.href) {\n window.open(link.href, '_blank', 'noopener,noreferrer');\n\n // Return true to tell ProseMirror \"We handled this click, do nothing else\"\n return true;\n }\n\n return false;\n },\n },\n});\n\n/** A link's own look, as the email writes it: `text-decoration: none` for\n one the author took the underline off (a builder's navbar, a footer\n link), the room round a nav item as an inline-block's padding. Nothing\n for the client's own blue underlined link. */\nfunction linkStyle(attrs: Record<string, any>, view: boolean): string | null {\n const declarations = [\n attrs['spacing'] && `display: inline-block; padding: ${attrs['spacing']};`,\n attrs['decoration'] === 'none'\n ? 'text-decoration: none;'\n : view && 'text-decoration: underline;',\n ].filter(Boolean);\n return declarations.length ? declarations.join(' ') : null;\n}\n\n/** The padding of an inline-block link — a builder's nav item — in the\n shorthand the CSSOM prints, null for none. A padded block is no link's:\n without the inline-block the padding is the client's to ignore. */\nfunction linkSpacingOf(node: HTMLElement): string | null {\n if (!/^inline-block$/i.test(node.style?.display ?? '')) return null;\n const padding = node.style?.padding ?? '';\n return /^(\\d+(?:\\.\\d+)?px\\s*){1,4}$/.test(padding.trim()) && /[1-9]/.test(padding)\n ? padding.trim()\n : null;\n}\n\nexport const Link = defineMark({\n name: 'link',\n spec: {\n attrs: {\n href: {},\n title: { default: null },\n target: { default: '_blank' }, // Force new tabs\n rel: { default: 'noopener noreferrer' }, // Security best practice for _blank\n /** `none` where the author took the underline off; null for the\n client's own underlined link. */\n decoration: { default: null },\n /** A nav item's room, `t r b l` in px — emitted as an inline-block's\n padding. Null for none. */\n spacing: { default: null },\n },\n inclusive: false,\n // A Shift-Enter inside a link shouldn't drag the link onto the next line.\n splittable: false,\n parseDOM: [\n {\n tag: 'a[href]',\n getAttrs: (node) => {\n const href = node.getAttribute('href');\n\n // If the link is dangerous, reject the mark entirely\n if (!isSafeUrl(href)) return false;\n\n const decoration = node.style?.textDecorationLine || node.style?.textDecoration || '';\n return {\n href,\n title: node.getAttribute('title'),\n target: node.getAttribute('target') || '_blank',\n decoration: /^none\\b/i.test(decoration.trim()) ? 'none' : null,\n spacing: linkSpacingOf(node),\n };\n },\n },\n ],\n toDOM: (mark) => {\n const { href, title, target, rel } = mark.attrs;\n // Editor-view styling only — see emitDOM for what the email carries.\n // No stop in the page's Tab order: in the editor a link is text.\n return [\n 'a',\n {\n href,\n title,\n target,\n rel,\n tabindex: '-1',\n style: `color: var(--mat-sys-primary,#0056b3); ${linkStyle(mark.attrs, true)}`,\n },\n 0,\n ];\n },\n // Serialization-only override (see serializeToHTML): mail clients style\n // links natively, `var()` colors mean nothing to them, and re-parsing an\n // inline `text-decoration: underline` would misread it as an Underline\n // mark — the canonical email link is a clean <a>, styled only where the\n // author took the underline off or gave a nav item its room.\n emitDOM: (mark: { attrs: Record<string, any> }) => {\n const { href, title, target, rel } = mark.attrs;\n const style = linkStyle(mark.attrs, false);\n return ['a', { href, title, target, rel, ...(style ? { style } : {}) }, 0];\n },\n },\n commands: ({ schema }) => ({\n setLink: (attrs: LinkAttrs) => (state, dispatch) => {\n if (!isSafeUrl(attrs.href)) return false;\n\n // A bare cursor inside an existing link edits that whole link — and an\n // edited link keeps what else it carried (an authored link's `class`\n // and `style`, see authored.ts): only the href/title change is patched.\n let { from, to } = state.selection;\n const existing = linkRangeAt(state, from);\n if (state.selection.empty) {\n if (!existing) return false;\n ({ from, to } = existing);\n }\n const base = existing && existing.from <= from && existing.to >= to ? existing.attrs : {};\n dispatch?.(state.tr.addMark(from, to, schema.marks['link'].create({ ...base, ...attrs })));\n return true;\n },\n unsetLink: () => (state, dispatch) => {\n let { from, to } = state.selection;\n if (state.selection.empty) {\n const range = linkRangeAt(state, from);\n if (!range) return false;\n ({ from, to } = range);\n }\n dispatch?.(state.tr.removeMark(from, to, schema.marks['link']));\n return true;\n },\n }),\n inputRules: ({ schema }) => [\n // Auto-link: \"see https://x.io \" links the URL as the space commits it.\n // Trailing punctuation stays outside (\"(see https://x.io).\" style).\n new InputRule(AUTO_LINK, (state, match, start, end) => {\n const type = schema.marks['link'];\n const url = match[1].replace(/[.,!?;:)\\]]+$/, '');\n if (!url) return null;\n\n const urlStart = start + match[0].indexOf(match[1]);\n const urlEnd = urlStart + url.length;\n if (state.doc.rangeHasMark(urlStart, urlEnd, type)) return null;\n\n const href = url.toLowerCase().startsWith('www.') ? `https://${url}` : url;\n if (!isSafeUrl(href)) return null;\n\n // The committing space is not in the doc yet — the rule inserts it.\n return state.tr.insertText(' ', end).addMark(urlStart, urlEnd, type.create({ href }));\n }),\n ],\n plugins: () => [linkClickPlugin, linkPastePlugin],\n});\n","import { Fragment, Node, Schema, Slice } from 'prosemirror-model';\nimport {\n Command,\n EditorState,\n NodeSelection,\n Plugin,\n PluginKey,\n TextSelection,\n} from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { closeHistory } from 'prosemirror-history';\nimport { FunctionalExtension, defineExtension, defineNode } from '../../extension';\nimport { isSafeUrl } from '../marks/link';\nimport { isSafeColor, parseFontFamily, toEmailSafeColor } from '../marks/text-style';\nimport { fillTextColor } from '../../dual-contrast';\nimport { soleInlineAtom } from '../inline-atoms';\n\n/* Declared before `BUTTON_STYLE`: it is built at module load and reads\n `BUTTON_FILL` through `buttonStyle`, so a later declaration is a TDZ read. */\n/** The default button's fill — the primary blue — and the text on it. */\nexport const BUTTON_FILL = 'rgb(26, 115, 232)';\n\nconst BUTTON_FILL_HEX = '#1a73e8';\n\n/** The button's canonical styling — the *border-based* bulletproof button:\n the touch target (≥ 44px tall, per the ledger) comes from borders in the\n background colour, not from padding, because Outlook's Word engine ignores\n padding on an anchor (the client-support module says so) and would render\n a padded button as a bare coloured text run — while it does draw borders\n on inline elements, so the box survives there too. No `height`. No\n `border-radius` — Outlook squares it anyway, and dropping it keeps our own\n output lint-clean. rgb() colours, not hex: the browser normalizes hex to\n rgb on the serialize round trip, so the canonical form must already be\n rgb to stay stable. The label's weight and slant are the button's\n own (`bold`, `italic`): this is a default button's. */\nexport const BUTTON_STYLE = buttonStyle({\n bold: true,\n italic: false,\n background: null,\n color: null,\n});\n\n/** The canonical style of a button with that label styling and fill: bold\n is `font-weight: bold` and not bold `normal` (said, never left out — a\n client's own anchor styling may be bold); italic adds `font-style`\n after the weight, and not italic leaves it out; the fill (hex, null for\n the default blue) colours the box and its borders, in the rgb form the\n CSSOM prints, with the words in `color` (hex) or, null, the text the\n fill pairs (`fillTextColor`; white on the default blue). */\nexport function buttonStyle({\n bold,\n italic,\n background,\n color,\n fontFamily,\n}: {\n bold: boolean;\n italic: boolean;\n background?: string | null;\n color?: string | null;\n fontFamily?: string | null;\n}): string {\n const fill = background ? hexToRgb(background) : BUTTON_FILL;\n const text = color\n ? hexToRgb(color)\n : background\n ? hexToRgb(fillTextColor(background))\n : 'rgb(255, 255, 255)';\n return (\n `display: inline-block; background-color: ${fill}; color: ${text}; ` +\n `font-weight: ${bold ? 'bold' : 'normal'}; ` +\n (italic ? 'font-style: italic; ' : '') +\n (fontFamily ? `font-family: ${fontFamily}; ` : '') +\n 'text-decoration: none; ' +\n // One line, however narrow the column: a label broken in two reads as\n // two buttons, and the box's 28px sides leave a short label little room.\n 'white-space: nowrap; ' +\n // Longhands in the CSSOM's own order (width, style, color) and at the end,\n // where every serializer puts them — the canonical string is a fixpoint.\n `border-width: 14px 28px; border-style: solid; border-color: ${fill};`\n );\n}\n\nfunction hexToRgb(hex: string): string {\n const n = parseInt(hex.slice(1), 16);\n return `rgb(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255})`;\n}\n\n/**\n * A call-to-action button: an inline atom that serializes to a bordered\n * `inline-block` anchor — the email-safe \"fake button\" every client,\n * Outlook included, renders as a tappable coloured box. `display: inline-block` in the style is also the parse\n * discriminator: it is what tells a button apart from an ordinary link, so the\n * two never collide on the round trip.\n *\n * Inline, like an image, so it sits in a paragraph *or* a table cell\n * (`inline*`) — cells stay textblocks; they do not open to headings or\n * nested tables. It is an **atom** (label and href are attributes, not\n * editable content): a contentEditable `<a>` would ignore the node\n * boundary and unwrap when you type. Selected text becomes one, and a\n * button linked text again (`button-link`, a toggle); a selected button's\n * link is set with `setButtonHref`, its words with `setButtonLabel`. The\n * label is bold or italic as a whole — attributes, not marks: the kit's own\n * Bold and Italic (the toolbar's, Mod-B, Mod-I) flip them on a selected\n * button (`markAttrs`, see `selectedMarkAtom`).\n */\nexport const Button = defineNode({\n name: 'button',\n spec: {\n inline: true,\n group: 'inline',\n atom: true,\n selectable: true,\n draggable: true,\n // The box paints its own weight, slant and colour on the `<a>`. Allowing\n // marks would re-parse that `font-weight: bold` as a wrapping `<strong>`\n // — so bold and italic are attributes, which the kit's mark toggles set\n // on a selected button.\n marks: '',\n markAttrs: ['bold', 'italic'],\n attrs: {\n href: { default: '#' },\n label: { default: 'Button' },\n bold: { default: true },\n italic: { default: false },\n /** The box's fill, as hex — null for the default blue. A builder's\n button keeps its colour; the box stays ours (borders, square). */\n background: { default: null },\n /** The words' colour, as hex — null for the one the fill pairs. */\n color: { default: null },\n /** The label's face, one of the curated stacks (a builder's web font\n read as the one it falls back to) — null for the client's. */\n fontFamily: { default: null },\n },\n parseDOM: [\n {\n tag: 'a[href]',\n // Higher than the link mark's default so an inline-block anchor is\n // claimed as a button node before it can be read as a link.\n priority: 60,\n getAttrs: (dom) => {\n if (!(dom instanceof HTMLElement)) return false;\n if (!isButtonBox(dom)) return false;\n // Same rule as the link mark: a script URL kills the button on\n // parse — and, refused here, the link mark refuses it too.\n const href = dom.getAttribute('href') ?? UNSET_BUTTON_HREF;\n if (!isSafeUrl(href)) return false;\n // Collapsed: a formatter may print the label on its own line, and a\n // label never carries raw whitespace.\n const label = (dom.textContent ?? '').replace(/\\s+/g, ' ').trim();\n // Bold unless the weight is said to be less; italic where the\n // slant is said — the label's styling reads off the box alone.\n // A 500 is a medium, drawn as the regular by every email-safe face.\n const bold = !/^(normal|lighter|[1-5]\\d\\d)$/i.test(inlineValue(dom, 'font-weight'));\n const italic = /^(italic|oblique)/i.test(inlineValue(dom, 'font-style'));\n const background = buttonFill(dom);\n const fontFamily = parseFontFamily(inlineValue(dom, 'font-family'));\n return {\n href,\n label,\n bold,\n italic,\n background,\n color: buttonText(dom, background),\n fontFamily,\n };\n },\n },\n ],\n // In the editor: content, not a stop on the page's Tab order — a link\n // is focusable, and inside a non-editable island it would take a Tab\n // (and a click's focus) away from the text. The email never carries\n // that: see emitDOM.\n toDOM: (node) => ['a', { ...buttonAttrs(node), tabindex: '-1' }, node.attrs['label']],\n // Serialization-only (see serializeToHTML): the anchor as it is sent.\n emitDOM: (node: Node) => ['a', buttonAttrs(node), node.attrs['label']],\n },\n plugins: () => [\n new Plugin({\n key: new PluginKey('buttonClick'),\n props: {\n // A click on a button edits it — it never follows it, with or\n // without Ctrl/Cmd (this runs before the link mark's handleClick,\n // and answering stops it). The button is selected, and a host that\n // asked (`createButtonEdit`) is told to open its link editor.\n handleClickOn: (view, _pos, node, nodePos, _event, direct) => {\n if (!direct || node.type.name !== 'button') return false;\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos)));\n // The caret is the editor's, not the anchor's: Delete and typing\n // act on the selected button.\n view.focus();\n const onEdit = buttonEditKey.getState(view.state)?.onEdit;\n if (onEdit) {\n const dom = view.nodeDOM(nodePos) as HTMLElement | null;\n onEdit({ pos: nodePos, rect: dom?.getBoundingClientRect() ?? null });\n }\n return true;\n },\n // The anchor is non-editable (an atom), so to the browser it is a\n // live link: a click — a middle click too — would open it, in a new\n // tab (`target=\"_blank\"`). In the editor it is content, not a way out.\n handleDOMEvents: {\n click: preventButtonNavigation,\n auxclick: preventButtonNavigation,\n },\n // Pasted HTML is parsed like a document, and paints the same\n // `<strong>` around every button (see `bareButtons`): stripped here\n // too, so a pasted button is as bare as a loaded one.\n transformPasted: (slice) =>\n new Slice(bareButtonsIn(slice.content), slice.openStart, slice.openEnd),\n },\n }),\n ],\n commands: ({ schema }) => ({\n insertButton: (): Command => insertButton(schema),\n toggleButtonLink: (): Command => toggleButtonLink,\n setButtonHref: (href: string): Command => setButtonHref(href),\n setButtonLabel: (label: string): Command => setButtonLabel(label),\n /** Fill the selected button (or, with `null`, the default blue again). */\n setButtonBackground: (color: string | null): Command => setButtonBackground(color),\n }),\n actions: ({ schema }) => [\n {\n id: 'button',\n section: 'layout',\n title: 'Button',\n keywords: ['button', 'cta', 'call to action', 'link'],\n icon: 'smart_button',\n command: insertButton(schema),\n },\n // The selection's own: selected text becomes a button, a selected\n // button becomes linked text again. Needs one or the other, so a `/`\n // menu (a caret) never offers it.\n {\n id: 'button-link',\n section: 'layout',\n title: 'Button link',\n keywords: ['button', 'cta', 'call to action', 'link'],\n icon: 'smart_button',\n command: toggleButtonLink,\n isEnabled: (state) => !!selectedButton(state) || !!buttonLabelAt(state),\n isActive: (state) => !!selectedButton(state),\n },\n ],\n});\n\n/** A button's anchor attributes as the email carries them: a new tab,\n without the opener — what every link in the email carries (the link\n mark's defaults), so a button is no exception to it. */\n/** Whether an anchor is drawn as a box — `display: inline-block` with a\n fill or a border, which is what makes a fake button one. An inline-block\n anchor with neither is a link a builder laid out, a navbar's say (MJML\n gives every menu link `inline-block` and a padding), and stays a link. */\nfunction isButtonBox(dom: HTMLElement): boolean {\n const style = dom.getAttribute('style') ?? '';\n if (!/display:\\s*inline-block/i.test(style)) return false;\n if (dom.getAttribute('bgcolor')) return true;\n const declarations = style\n .split(';')\n .map((declaration) => declaration.split(/:(.*)/s).map((part) => part.trim().toLowerCase()));\n const declared = (property: RegExp) =>\n declarations.some(\n ([name, value]) =>\n !!name &&\n property.test(name) &&\n !!value &&\n !/^(none|transparent|initial|inherit|unset|0(px)?)(\\s|$|!)/.test(value),\n );\n return (\n declared(/^background(-color|-image)?$/) ||\n declared(/^border(-style|-width|-top|-bottom|-left|-right)?$/)\n );\n}\n\nfunction buttonAttrs(node: Node): Record<string, string> {\n return {\n href: node.attrs['href'] as string,\n target: '_blank',\n rel: 'noopener noreferrer',\n style: buttonStyle(\n node.attrs as {\n bold: boolean;\n italic: boolean;\n background: string | null;\n color: string | null;\n fontFamily: string | null;\n },\n ),\n };\n}\n\n/** An inline declaration's value: the CSSOM's reading, else the attribute's\n own words — an engine that trips on the `background` shorthand before\n it drops the rest. */\nfunction inlineValue(dom: HTMLElement, property: string): string {\n const cssom = dom.style.getPropertyValue(property).trim();\n if (cssom) return cssom;\n const m = new RegExp(`(?:^|;)\\\\s*${property}\\\\s*:\\\\s*([^;]+)`, 'i').exec(\n dom.getAttribute('style') ?? '',\n );\n return m?.[1]?.trim() ?? '';\n}\n\n/** The text colour a parsed box carries, where it is not the one the fill\n pairs (the canonical form's, absorbed): a builder's white on a mid\n fill, say. */\nfunction buttonText(dom: HTMLElement, background: string | null): string | null {\n const raw = inlineValue(dom, 'color');\n if (!raw || !isSafeColor(raw)) return null;\n const hex = toEmailSafeColor(raw)?.toLowerCase() ?? null;\n if (!hex) return null;\n const paired = background ? fillTextColor(background).toLowerCase() : '#ffffff';\n return hex === paired ? null : hex;\n}\n\n/** The fill a parsed box carries: its `background-color`, the colour in\n its `background` shorthand, or a `bgcolor` attribute — as hex; null\n for none, or for our own default blue (the canonical form's). */\nfunction buttonFill(dom: HTMLElement): string | null {\n const style = dom.getAttribute('style') ?? '';\n const raw =\n dom.style.backgroundColor ||\n /(?:^|;)\\s*background\\s*:\\s*([^;]+)/i.exec(style)?.[1]?.trim().split(/\\s+/)[0] ||\n dom.getAttribute('bgcolor') ||\n '';\n if (!raw || !isSafeColor(raw)) return null;\n const hex = toEmailSafeColor(raw)?.toLowerCase() ?? null;\n return hex && hex !== BUTTON_FILL_HEX ? hex : null;\n}\n\n/** Stops the browser following a button's anchor. Never answers: the\n event stays ProseMirror's (and the page's) otherwise. */\nfunction preventButtonNavigation(view: EditorView, event: MouseEvent): boolean {\n const anchor = (event.target as Element | null)?.closest?.('a');\n if (!anchor || !view.dom.contains(anchor)) return false;\n const node = view.state.doc.nodeAt(view.posAtDOM(anchor, 0));\n if (node?.type.name === 'button') event.preventDefault();\n return false;\n}\n\n/** Where a clicked button is, for the host's link editor to stand on. */\nexport interface ButtonEditTarget {\n pos: number;\n /** The button's box in viewport coordinates — null where nothing is laid\n out (a test DOM). */\n rect: DOMRect | null;\n}\n\nexport interface ButtonEditOptions {\n /** A button was clicked, and is now the selection: open its link editor.\n (A click never follows the button's link — its editor's own \"open\"\n is the way out.) */\n onEdit: (target: ButtonEditTarget) => void;\n}\n\nconst buttonEditKey = new PluginKey<ButtonEditOptions>('buttonEdit');\n\n/**\n * What a click on a button does, told to the host: the kit selects the\n * button and never follows its link; this hands the host the moment to\n * open its link editor on it — the one a text link opens with, so a button\n * is edited the way a link is. Without it, a click only selects the button\n * (and a bubble menu can offer the editor).\n *\n * createButtonEdit({ onEdit: () => linkEditor.show() })\n */\nexport const createButtonEdit = (options: ButtonEditOptions): FunctionalExtension =>\n defineExtension({\n name: 'buttonEdit',\n plugins: () => [\n new Plugin<ButtonEditOptions>({\n key: buttonEditKey,\n state: { init: () => options, apply: (_tr, value) => value },\n }),\n ],\n });\n\n/** The button a selection holds and nothing else, or null: a click's node\n selection, or a range — a drag's, Shift-arrow's — that covers the button\n and whitespace only (see `soleInlineAtom`). A range with text in it is\n a text selection: the button in it takes the text styling with the\n text (its `bold`, its `italic`). */\nexport function selectedButton(state: EditorState): { pos: number; node: Node } | null {\n return soleInlineAtom(state, 'button');\n}\n\n/** A button's `href` before it has been given one — the placeholder\n `insertButton` and a text without a link start from. */\nexport const UNSET_BUTTON_HREF = '#';\n\n/**\n * What a text selection would become, or null when it cannot be a button:\n * the range must lie in one line and hold text only — an image or a line\n * break is not a label (a `{{ token }}` is: it is text, and personalizes\n * the button) — and say something. The range is the selection *without*\n * the whitespace at its ends: a double-click that took a word's trailing\n * space must not swallow the space into the button and glue the words\n * around it together. The label is its text with the whitespace inside\n * collapsed (a label never carries raw whitespace, see the parse rule).\n */\nfunction buttonLabelAt(state: EditorState): { from: number; to: number; label: string } | null {\n const { selection, schema } = state;\n if (!schema.nodes['button'] || !(selection instanceof TextSelection) || selection.empty) {\n return null;\n }\n const { $from, $to } = selection;\n if (!$from.sameParent($to) || !$from.parent.inlineContent) return null;\n let textOnly = true;\n state.doc.nodesBetween(selection.from, selection.to, (node) => {\n if (node.isInline && !node.isText) textOnly = false;\n return textOnly;\n });\n if (!textOnly) return null;\n // Text only, in one parent: one character per position.\n const text = state.doc.textBetween(selection.from, selection.to);\n const label = text.replace(/\\s+/g, ' ').trim();\n if (!label) return null;\n const from = selection.from + (text.length - text.trimStart().length);\n const to = selection.to - (text.length - text.trimEnd().length);\n return { from, to, label };\n}\n\n/**\n * Selected text → a button: the text is its label, the link it carried (if\n * any) its `href`, and the button is left selected. A selected button →\n * linked text again: the label, carrying the button's link (none for a\n * placeholder `#`), left selected as text. Whatever marks the text had —\n * bold, a colour — do not survive into the button: it is an atom that\n * paints itself (see `BUTTON_STYLE`).\n */\nconst toggleButtonLink: Command = (state, dispatch) => {\n const button = selectedButton(state);\n if (button) {\n if (dispatch) {\n const { href, label } = button.node.attrs as { href: string; label: string };\n const link = state.schema.marks['link'];\n const marks = link && href !== UNSET_BUTTON_HREF ? [link.create({ href })] : [];\n const text = state.schema.text(label, marks);\n const tr = state.tr.replaceWith(button.pos, button.pos + button.node.nodeSize, text);\n tr.setSelection(TextSelection.create(tr.doc, button.pos, button.pos + text.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n\n const target = buttonLabelAt(state);\n if (!target) return false;\n if (dispatch) {\n const { from, to, label } = target;\n const link = state.schema.marks['link'];\n let href = UNSET_BUTTON_HREF;\n if (link) {\n state.doc.nodesBetween(from, to, (node) => {\n const mark = link.isInSet(node.marks);\n if (mark && href === UNSET_BUTTON_HREF) href = mark.attrs['href'] as string;\n });\n }\n const node = state.schema.nodes['button'].create({ href, label });\n // Its own history event, never merged into the typing just before it:\n // one undo takes back exactly the conversion — what a host does when\n // the new button is left without a link.\n const tr = closeHistory(state.tr).replaceWith(from, to, node);\n tr.setSelection(NodeSelection.create(tr.doc, from));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n\n/** Sets the selected button's link, keeping it selected. An empty href is\n the placeholder again; a script URL is refused, as the link mark's is. */\nconst setButtonHref =\n (href: string): Command =>\n (state, dispatch) => {\n const button = selectedButton(state);\n if (!button || (href.trim() && !isSafeUrl(href))) return false;\n if (dispatch) {\n const tr = state.tr.setNodeMarkup(button.pos, undefined, {\n ...button.node.attrs,\n href: href.trim() || UNSET_BUTTON_HREF,\n });\n tr.setSelection(NodeSelection.create(tr.doc, button.pos));\n dispatch(tr);\n }\n return true;\n };\n\n/** Fills the selected button — or, with `null`, gives it the default blue\n back — keeping it selected. */\nconst setButtonBackground =\n (color: string | null): Command =>\n (state, dispatch) => {\n const button = selectedButton(state);\n if (!button) return false;\n const hex = color ? (toEmailSafeColor(color)?.toLowerCase() ?? null) : null;\n if (color && !hex) return false;\n if (dispatch) {\n const tr = state.tr.setNodeAttribute(\n button.pos,\n 'background',\n hex === BUTTON_FILL_HEX ? null : hex,\n );\n tr.setSelection(NodeSelection.create(tr.doc, button.pos));\n dispatch(tr);\n }\n return true;\n };\n\n/** Sets the selected button's words, keeping it selected. Whitespace inside\n is collapsed, as a parsed label's is; a label with no words is refused —\n a button always says something. */\nconst setButtonLabel =\n (label: string): Command =>\n (state, dispatch) => {\n const button = selectedButton(state);\n const words = label.replace(/\\s+/g, ' ').trim();\n if (!button || !words) return false;\n if (dispatch && words !== button.node.attrs['label']) {\n const tr = state.tr.setNodeAttribute(button.pos, 'label', words);\n tr.setSelection(NodeSelection.create(tr.doc, button.pos));\n dispatch(tr);\n }\n return true;\n };\n\nfunction insertButton(schema: Schema): Command {\n return (state, dispatch) => {\n const node = schema.nodes['button'].create({ href: '#', label: 'Button' });\n dispatch?.(state.tr.replaceSelectionWith(node, false).scrollIntoView());\n return true;\n };\n}\n\n/**\n * The parser paints `font-weight: bold` from {@link BUTTON_STYLE} onto the\n * atom as a wrapping mark — it asks the parent, not the node, whether bold\n * is allowed. The box already is bold; those marks would re-serialize as a\n * `<strong>` around every button. Strip them so parse stays a fixpoint.\n */\nexport function bareButtons(doc: Node, schema: Schema): Node {\n if (!schema.nodes['button']) return doc;\n return doc.copy(bareButtonsIn(doc.content));\n}\n\n/** The fragment with every button in it stripped of its marks — the same\n fragment where none carries any. */\nfunction bareButtonsIn(fragment: Fragment): Fragment {\n let changed = false;\n const children: Node[] = [];\n fragment.forEach((node) => {\n let next = node;\n if (node.type.name === 'button') {\n if (node.marks.length) next = node.mark([]);\n } else if (!node.isLeaf) {\n const content = bareButtonsIn(node.content);\n if (content !== node.content) next = node.copy(content);\n }\n if (next !== node) changed = true;\n children.push(next);\n });\n return changed ? Fragment.fromArray(children) : fragment;\n}\n","import { Command, EditorState, NodeSelection, Selection, TextSelection } from 'prosemirror-state';\nimport { Node, Schema } from 'prosemirror-model';\nimport { keymap } from 'prosemirror-keymap';\nimport { defineNode } from '../../extension';\nimport { fillTextColor } from '../../dual-contrast';\nimport { isSafeColor, toEmailSafeColor } from '../marks/text-style';\nimport { parsePadding } from './table';\n\n/**\n * Responsive layout columns — the fluid, no-media-query answer to MJML. Each\n * column is an `inline-block` div with `width: 100%` capped by a fixed px\n * `max-width`: on a wide screen the caps let the columns sit side by side; on\n * a phone `width: 100%` wins and they stack. `box-sizing: border-box` keeps\n * the gutter padding inside the cap so the row never overflows. Outlook\n * (which ignores `inline-block`) simply stacks them — the same graceful,\n * phone-first result. All longhand + fixed px, so it round-trips deterministic.\n */\nconst CONTAINER_MAX = 600;\n\n/**\n * Width the receiving client shaves off each side of the container — reading\n * pane insets, body margins, webmail card padding — before our markup sees a\n * single pixel. Unknowable and uncontrollable, so it is *budgeted*: the column\n * caps sum to `CONTAINER_MAX - 2 × this`, not to `CONTAINER_MAX`. Caps that\n * sum to the full container are a zero-slack cliff — the row stacks the moment\n * the client hands us 599px, which in practice is every client (verified\n * empirically: side-by-side at exactly 600px available, stacked at 599px).\n */\nconst CLIENT_PADDING_BUDGET = 20;\n\ntype ColumnsAlignment = 'left' | 'center' | 'right';\n\n/**\n * The block's own alignment, expressed as auto margins against its `max-width`.\n *\n * Auto margins are normally the thing to distrust in email (Outlook's Word\n * engine handles them poorly), but they are *safe here by the same pairing\n * logic as `width: 100%` + `max-width`*: Outlook ignores `max-width` entirely,\n * so the container spans the full width there and has nothing to align — the\n * only clients where the cap is visible are the ones that honour auto margins.\n *\n * `left` carries **no declaration** — the same rule the email paragraph uses for\n * its default, so an unaligned block stays free of styling. Longhand only\n * (never the `margin: 0 auto` shorthand): shorthands re-serialize\n * non-deterministically through the CSSOM and break the canonical fixpoint.\n */\nexport const containerStyle = (align: ColumnsAlignment): string => {\n const base = `width: 100%; max-width: ${CONTAINER_MAX}px;`;\n if (align === 'center') return `${base} margin-left: auto; margin-right: auto;`;\n if (align === 'right') return `${base} margin-left: auto;`;\n return base;\n};\n\n/** Read the alignment back out of the margins — the exact inverse of\n {@link containerStyle}, so the round trip is a fixpoint. */\nfunction parseAlignment(dom: HTMLElement): ColumnsAlignment {\n const left = dom.style?.marginLeft;\n const right = dom.style?.marginRight;\n if (left === 'auto' && right === 'auto') return 'center';\n if (left === 'auto') return 'right';\n return 'left';\n}\n\n// A filled panel always pairs its background with its text (fillTextColor) —\n// explicit text survives the dark modes that flip default text but keep the fill.\n// Padding is *authored only* (the attr, from user markup) — the gutters seen\n// while composing are editorial `.aee-editor` CSS, which also reserves the\n// room the boundary/add affordances live in; the email carries none of it\n// unless the author asked.\nconst columnStyle = (\n maxWidth: number,\n background: string | null,\n padding: string | null,\n hold = false,\n): string =>\n `display: inline-block; width: ${hold ? `${columnShare(maxWidth)}%` : '100%'}; max-width: ${maxWidth}px; ` +\n `vertical-align: top; box-sizing: border-box;` +\n (padding ? ` padding: ${padding};` : '') +\n (background ? ` background-color: ${background}; color: ${fillTextColor(background)};` : '');\n\n/** A column's share of the row, in whole percent — what a held column is\n wide on a phone (its cap still holds on a desktop). */\nconst columnShare = (maxWidth: number): number =>\n Math.max(\n 1,\n Math.min(100, Math.round((maxWidth / (CONTAINER_MAX - 2 * CLIENT_PADDING_BUDGET)) * 100)),\n );\n\nconst columnMaxWidth = (count: number): number =>\n Math.floor((CONTAINER_MAX - 2 * CLIENT_PADDING_BUDGET) / count);\n\n/**\n * The most columns a block will grow to. At 4 the even split is already down\n * to ~140px per column — enough for an icon-and-caption feature row, but the\n * floor for readable prose; a fifth would put every column below it. The cap\n * lives on the *command* (the affordance is the enforcement, like the colour\n * palette): authored markup with more columns still parses — parsing is\n * repair, not opinion.\n */\nexport const MAX_COLUMNS = 4;\n\n/** No column cap below this: ~an icon-and-caption column. The boundary drag\n clamps here from both sides. */\nexport const MIN_COLUMN_CAP = 120;\n\n/** Every column's px cap, in order — the block's geometry, straight from the\n model: a column's left edge is the sum of the caps before it. */\nexport function columnCaps(columns: Node): number[] {\n const caps: number[] = [];\n columns.forEach((column) => caps.push(column.attrs['maxWidth'] as number));\n return caps;\n}\n\n/**\n * Sets the caps of the two columns meeting at `boundary` — what the boundary\n * drag commits. `leftCap` is the left column's new cap in px; the pair's\n * total is conserved (the block's budget never changes, so a phone still\n * stacks exactly as before), and both sides clamp at {@link MIN_COLUMN_CAP}.\n * Position-addressed: the NodeView knows its block wherever the caret is.\n */\nexport function setColumnsBoundary(columnsPos: number, boundary: number, leftCap: number): Command {\n return (state, dispatch) => {\n const columns = state.doc.nodeAt(columnsPos);\n if (!columns || columns.type.name !== 'columns') return false;\n if (boundary < 0 || boundary >= columns.childCount - 1) return false;\n\n const caps = columnCaps(columns);\n const pair = caps[boundary] + caps[boundary + 1];\n if (pair < MIN_COLUMN_CAP * 2) return false;\n const left = Math.round(Math.max(MIN_COLUMN_CAP, Math.min(leftCap, pair - MIN_COLUMN_CAP)));\n const right = pair - left;\n\n if (dispatch) {\n const tr = state.tr;\n let pos = columnsPos + 1;\n columns.forEach((column, _offset, index) => {\n if (index === boundary || index === boundary + 1) {\n tr.setNodeMarkup(pos, null, {\n ...column.attrs,\n maxWidth: index === boundary ? left : right,\n });\n }\n pos += column.nodeSize;\n });\n dispatch(tr);\n }\n return true;\n };\n}\n\n/** The cap a column's `max-width` means: px as written; a percentage — a\n builder's share of the row (MJML's `mj-column-per-50`) — as that share\n of the budget, so two halves sit side by side exactly as two of ours.\n Not held to {@link MIN_COLUMN_CAP}: that floor is the boundary drag's —\n a builder's 2% gutter or 10% price column, widened to it, would push\n the row past the container and stack it on a desktop. */\nfunction parseColumnMaxWidth(style: string | null): number {\n const m = /max-width:\\s*(\\d+(?:\\.\\d+)?)(px|%)/i.exec(style ?? '');\n if (!m) return columnMaxWidth(2);\n if (m[2] === 'px') return Math.round(+m[1]);\n const budget = CONTAINER_MAX - 2 * CLIENT_PADDING_BUDGET;\n return Math.max(1, Math.min(budget, Math.floor((budget * +m[1]) / 100)));\n}\n\n/**\n * The class a stacking column carries in the sent email — the hook of the\n * one rule the email document's head holds ({@link STACK_RULE}): on a phone\n * a stacked column takes the whole width instead of its desktop cap. Where\n * a client drops the head, the column keeps its cap: narrower, still whole.\n * The editor's HTML never carries it ({@link markStackingColumns} adds it\n * at send), so the canonical form stays class-free.\n */\nexport const STACK_CLASS = 'aee-stack';\n\n/** The phone rule for {@link STACK_CLASS} — MJML's breakpoint. */\nexport const STACK_RULE =\n `@media only screen and (max-width: 479px) { ` +\n `.${STACK_CLASS} { max-width: 100% !important; } }`;\n\n/** The opening of a stacking column as {@link columnStyle} writes it — a\n held column's `width` is a percentage, and never matches. */\nconst STACKING_COLUMN = /<div style=\"display: inline-block; width: 100%; max-width: \\d+px;/g;\n\n/** Canonical HTML with every stacking column carrying {@link STACK_CLASS}\n — for the email document only. */\nexport function markStackingColumns(html: string): string {\n return html.replace(STACKING_COLUMN, (open) =>\n open.replace('<div style=', `<div class=\"${STACK_CLASS}\" style=`),\n );\n}\n\n/** A single column: an `inline-block` div, recognised on parse by that style\n (a `<div>`, so it never collides with the inline-block button `<a>`). */\nexport const Column = defineNode({\n name: 'column',\n spec: {\n content: 'block+',\n isolating: true,\n // `background` fills the whole column panel — a coloured callout — from the\n // curated dual-safe palette via `setColumnBackground`. Longhand rgb(), so\n // the block stays a byte-stable fixpoint in both engines. `padding` is\n // authored only (px, via `parsePadding`) — `null` serializes none.\n attrs: {\n maxWidth: { default: columnMaxWidth(2) },\n background: { default: null },\n padding: { default: null },\n /** Holds its share of the row on a phone instead of stacking — a\n builder's grouped columns (MJML's `mj-group`), written with a\n percent `width` of their own rather than the stacking pattern's\n `width: 100%`. Emitted as that percent. */\n hold: { default: false },\n },\n parseDOM: [\n {\n tag: 'div',\n priority: 55,\n getAttrs: (dom) => {\n const el = dom as HTMLElement;\n const style = el.getAttribute('style') ?? '';\n if (!/display:\\s*inline-block/i.test(style)) return false;\n const bg = el.style?.backgroundColor;\n // The width the author wrote, before an import folded a sheet's\n // `!important` over it (`noteOwnWidths`), else the inline one.\n const own = el.getAttribute('data-aee-own-width') ?? el.style?.width ?? '';\n const share = /^(\\d+(?:\\.\\d+)?)%$/.exec(own.trim());\n return {\n maxWidth: parseColumnMaxWidth(style),\n background: isSafeColor(bg) ? bg : null,\n padding: parsePadding(el),\n hold: !!share && +share[1] < 100,\n };\n },\n },\n ],\n // The class is an editor-only CSS hook for the layout guides; `emitDOM`\n // (serialization) drops it, so the email stays a bare inline-block div.\n toDOM: (node) => [\n 'div',\n {\n class: 'aee-column',\n style: columnStyle(\n node.attrs['maxWidth'],\n node.attrs['background'],\n node.attrs['padding'],\n node.attrs['hold'],\n ),\n },\n 0,\n ],\n emitDOM: (node: { attrs: Record<string, any> }) => [\n 'div',\n {\n style: columnStyle(\n node.attrs['maxWidth'],\n node.attrs['background'],\n node.attrs['padding'],\n node.attrs['hold'],\n ),\n },\n 0,\n ],\n },\n});\n\n/** The column container: a plain `<div>` whose direct children are column\n divs. The child check discriminates it from an ordinary paragraph div. */\nexport const Columns = defineNode({\n name: 'columns',\n spec: {\n content: 'column+',\n group: 'block',\n isolating: true,\n // New blocks are centred: an email body that hugs the left of a wide screen\n // reads as broken. Parsed markup keeps whatever it authored (parsing is\n // repair, not opinion) — hence `parseAlignment` rather than this default.\n // No command or UI sets this: centre is the only option offered; the attr\n // exists solely so authored margins survive the round trip.\n attrs: { align: { default: 'center' } },\n parseDOM: [\n {\n tag: 'div',\n priority: 60,\n getAttrs: (dom) =>\n hasColumnChildren(dom as HTMLElement)\n ? { align: parseAlignment(dom as HTMLElement) }\n : false,\n },\n ],\n // Editor-only class (see the Column node) — `emitDOM` keeps the email clean.\n toDOM: (node) => [\n 'div',\n { class: 'aee-columns', style: containerStyle(node.attrs['align']) },\n 0,\n ],\n emitDOM: (node: { attrs: Record<string, any> }) => [\n 'div',\n { style: containerStyle(node.attrs['align']) },\n 0,\n ],\n },\n commands: ({ schema }) => ({\n insertColumns: (count = 2): Command => insertColumns(schema, count),\n /** Fill the column the cursor is in (or clear it with `null`). */\n setColumnBackground: (color: string | null): Command => setColumnBackground(color),\n // Structural edits for the block menu. Named apart from the table's\n // `addColumnAfter`/`deleteColumn` — commands merge into one flat record.\n addColumn: (): Command => addColumn,\n removeColumn: (): Command => removeColumn,\n deleteColumns: (): Command => deleteColumns,\n }),\n keymap: () => ({\n ArrowDown: escapeColumnsDown,\n // Tab walks the columns, the table's convention applied to the layout\n // block. Unbound, Tab fell through to the browser's focus navigation and\n // jumped out of the editor entirely (into the source pane, in the example\n // app) with the caret left behind — so it is claimed for the whole block,\n // even where there is nowhere left to go.\n Tab: columnTab(1),\n 'Shift-Tab': columnTab(-1),\n }),\n // A plugin keymap (ahead of the gap cursor's) so a horizontal arrow at a\n // column's edge hops straight into the neighbouring column — the layout\n // twin of the table's cell-to-cell arrows. Mod-A is the table's scoped\n // select-all applied here: column content first, block from an empty\n // column, the stock whole-document one from the block selection on.\n plugins: () => [\n keymap({\n ArrowLeft: columnArrow(-1),\n ArrowRight: columnArrow(1),\n 'Mod-a': selectColumnContent,\n }),\n ],\n actions: ({ schema }) => [\n {\n id: 'columns',\n section: 'layout',\n title: 'Columns',\n keywords: ['columns', 'column', 'layout', 'grid', 'side by side'],\n icon: 'view_column',\n command: insertColumns(schema, 2),\n },\n {\n id: '3-columns',\n section: 'layout',\n title: '3 columns',\n keywords: ['columns', 'three', 'layout'],\n icon: 'view_column',\n command: insertColumns(schema, 3),\n },\n ],\n});\n\nfunction hasColumnChildren(dom: HTMLElement): boolean {\n for (const child of Array.from(dom.children)) {\n if (\n child.tagName === 'DIV' &&\n /display:\\s*inline-block/i.test(child.getAttribute('style') ?? '')\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Inserts an n-column block and drops the cursor into the first column. */\nfunction insertColumns(schema: Schema, count: number): Command {\n return (state, dispatch) => {\n // Asked, not told: answer before building anything — a toolbar asks on\n // every transaction.\n if (!dispatch) return true;\n const colType = schema.nodes['column'];\n const columnsType = schema.nodes['columns'];\n const maxWidth = columnMaxWidth(count);\n const columns = Array.from({ length: count }, () => colType.createAndFill({ maxWidth })!);\n const node = columnsType.create(null, columns);\n\n const from = state.selection.from;\n const tr = state.tr.replaceSelectionWith(node);\n let pos = -1;\n tr.doc.descendants((n, p) => {\n if (pos !== -1) return false;\n if (n.type.name === 'columns' && p >= from - 1) pos = p;\n return pos === -1;\n });\n if (pos >= 0) {\n // columns(pos) → column(+1) → first block(+1) → inline start(+1)\n tr.setSelection(TextSelection.create(tr.doc, pos + 3));\n }\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n\n/** ArrowDown from the end of a column's last block escapes to a paragraph\n below the columns block, creating one when it is the last node — so you\n can always write underneath (mirrors the table's escape). */\nconst escapeColumnsDown: Command = (state, dispatch) => {\n const { $from } = state.selection;\n let columnDepth = -1;\n let columnsDepth = -1;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'column' && columnDepth < 0) columnDepth = d;\n if ($from.node(d).type.name === 'columns') {\n columnsDepth = d;\n break;\n }\n }\n if (columnsDepth < 0 || columnDepth < 0) return false;\n\n const column = $from.node(columnDepth);\n if ($from.index(columnDepth) !== column.childCount - 1) return false; // not the last block\n if ($from.parentOffset !== $from.parent.content.size) return false; // not at its end\n\n const columnsEnd = $from.before(columnsDepth) + $from.node(columnsDepth).nodeSize;\n if (state.doc.resolve(columnsEnd).nodeAfter) return false; // a block already follows\n\n if (dispatch) {\n const paragraph = state.schema.nodes['paragraph'].createAndFill();\n if (!paragraph) return false;\n const tr = state.tr.insert(columnsEnd, paragraph);\n tr.setSelection(TextSelection.create(tr.doc, columnsEnd + 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n\n/** Exposed for the app to detect when the cursor is inside a columns block. */\nexport function findColumnsContext(state: EditorState): { pos: number; node: Node } | null {\n const { $from } = state.selection;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'columns') {\n return { pos: $from.before(d), node: $from.node(d) };\n }\n }\n return null;\n}\n\n/** The single `column` enclosing the selection (the innermost, if nested).\n Exposed so the app can route a fill to the column the cursor sits in. */\nexport function findColumnContext(state: EditorState): { pos: number; node: Node } | null {\n const { $from } = state.selection;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'column') {\n return { pos: $from.before(d), node: $from.node(d) };\n }\n }\n return null;\n}\n\n/** The columns block around the cursor plus which column the cursor is in —\n the structural-edit sibling of {@link findColumnsContext}. */\nfunction findColumnsEditContext(\n state: EditorState,\n): { pos: number; node: Node; index: number } | null {\n const { $from } = state.selection;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'columns') {\n return { pos: $from.before(d), node: $from.node(d), index: $from.index(d) };\n }\n }\n return null;\n}\n\n/** Rebuilds the block with every column's cap re-split to the even budgeted\n share — a structure change re-derives the geometry from the new count, so\n an authored asymmetric cap does not survive it (rebuilding is repair).\n Backgrounds and content are kept. */\nfunction resplitColumns(columns: Node[], count: number): Node[] {\n const maxWidth = columnMaxWidth(count);\n return columns.map((col) => col.type.create({ ...col.attrs, maxWidth }, col.content));\n}\n\n/** Inserts an empty column after the cursor's, up to {@link MAX_COLUMNS};\n every cap re-splits evenly and the cursor lands in the new column. */\nexport const addColumn: Command = (state, dispatch) => {\n const ctx = findColumnsEditContext(state);\n if (!ctx || ctx.node.childCount >= MAX_COLUMNS) return false;\n if (!dispatch) return true;\n\n const count = ctx.node.childCount + 1;\n const existing: Node[] = [];\n ctx.node.forEach((col) => existing.push(col));\n const columns = resplitColumns(existing, count);\n const fresh = state.schema.nodes['column'].createAndFill({\n maxWidth: columnMaxWidth(count),\n })!;\n columns.splice(ctx.index + 1, 0, fresh);\n\n const tr = state.tr.replaceWith(\n ctx.pos,\n ctx.pos + ctx.node.nodeSize,\n ctx.node.type.create(ctx.node.attrs, columns),\n );\n // The fresh column starts after the block's opening token (+1) and every\n // column kept before it; +2 more enters the column and its first block.\n let pos = ctx.pos + 1;\n for (let i = 0; i <= ctx.index; i++) pos += columns[i].nodeSize;\n tr.setSelection(TextSelection.create(tr.doc, pos + 2));\n dispatch(tr.scrollIntoView());\n return true;\n};\n\n/** Deletes the cursor's column and re-splits the rest evenly. Refuses on the\n last column — emptying the block is {@link deleteColumns}' job, on its own\n explicit affordance (mirrors the table's deleteRow/deleteTable split). */\nexport const removeColumn: Command = (state, dispatch) => {\n const ctx = findColumnsEditContext(state);\n if (!ctx || ctx.node.childCount <= 1) return false;\n if (!dispatch) return true;\n\n const kept: Node[] = [];\n ctx.node.forEach((col, _offset, index) => {\n if (index !== ctx.index) kept.push(col);\n });\n const tr = state.tr.replaceWith(\n ctx.pos,\n ctx.pos + ctx.node.nodeSize,\n ctx.node.type.create(ctx.node.attrs, resplitColumns(kept, kept.length)),\n );\n // Map the cursor through the rebuild, then snap to the nearest valid spot.\n const mapped = Math.min(tr.mapping.map(state.selection.from), tr.doc.content.size);\n tr.setSelection(Selection.near(tr.doc.resolve(mapped)));\n dispatch(tr.scrollIntoView());\n return true;\n};\n\n/** Deletes the whole columns block (the table's `deleteTable` sibling). */\nexport const deleteColumns: Command = (state, dispatch) => {\n const ctx = findColumnsContext(state);\n if (!ctx) return false;\n dispatch?.(state.tr.delete(ctx.pos, ctx.pos + ctx.node.nodeSize).scrollIntoView());\n return true;\n};\n\n/**\n * Tab / Shift-Tab inside a columns block: move to the next / previous column,\n * and past the block's ends hand off to the surrounding blocks. Always claims\n * the key while the caret is inside the block — an unclaimed Tab in a\n * contenteditable moves *browser focus*, which yanks the user out of the\n * editor mid-edit.\n */\nfunction columnTab(dir: 1 | -1): Command {\n return (state, dispatch) => {\n const ctx = findColumnsEditContext(state);\n if (!ctx) return false;\n\n const index = ctx.index + dir;\n if (index >= 0 && index < ctx.node.childCount) {\n let pos = ctx.pos + 1;\n for (let i = 0; i < index; i++) pos += ctx.node.child(i).nodeSize;\n // Enter at the column's near edge: its start going forward, its end\n // coming back — the same feel as tabbing across table cells.\n const inside = dir > 0 ? pos + 1 : pos + ctx.node.child(index).nodeSize - 1;\n dispatch?.(\n state.tr.setSelection(Selection.near(state.doc.resolve(inside), dir)).scrollIntoView(),\n );\n return true;\n }\n\n const from = dir > 0 ? ctx.pos + ctx.node.nodeSize : ctx.pos;\n const outside = Selection.findFrom(state.doc.resolve(from), dir, true);\n if (outside) {\n dispatch?.(state.tr.setSelection(outside).scrollIntoView());\n return true;\n }\n // Tabbing out of the last column of a trailing block: write a paragraph\n // to land in, the same courtesy ArrowDown already extends (a dead-ended\n // Tab would just look like the key stopped working).\n if (dir > 0 && dispatch) {\n const paragraph = state.schema.nodes['paragraph'].createAndFill();\n if (paragraph) {\n const tr = state.tr.insert(from, paragraph);\n tr.setSelection(TextSelection.create(tr.doc, from + 1));\n dispatch(tr.scrollIntoView());\n }\n }\n return true;\n };\n}\n\n/** ArrowLeft/Right at a column's outer edge (the start of its first block,\n the end of its last): move into the neighbouring column — or out of the\n block at its ends. Anywhere else the browser keeps the key. */\nfunction columnArrow(dir: 1 | -1): Command {\n return (state, dispatch, view) => {\n if (!view) return false;\n const selection = state.selection;\n if (!(selection instanceof TextSelection)) return false;\n const { $head } = selection;\n let depth = -1;\n for (let d = $head.depth; d > 0; d--) {\n if ($head.node(d).type.name === 'column') {\n depth = d;\n break;\n }\n }\n if (depth < 0) return false;\n // At the column's edge: the caret's block is the column's first/last child\n // and the caret is at that block's own edge.\n const column = $head.node(depth);\n const index = $head.index(depth);\n if (dir > 0 ? index !== column.childCount - 1 : index !== 0) return false;\n if (!view.endOfTextblock(dir > 0 ? 'right' : 'left')) return false;\n\n const from = dir > 0 ? $head.after(depth) : $head.before(depth);\n const target = Selection.findFrom(state.doc.resolve(from), dir, true);\n if (!target) return false;\n dispatch?.(state.tr.setSelection(target).scrollIntoView());\n return true;\n };\n}\n\n/** Mod-A with the caret in a column: select that column's content — or, from\n an *empty* column, the whole columns block (whose Delete removes it) — and\n stop. The table's scoped select-all applied to the layout block; from the\n block selection the key falls through to the stock whole-document one. */\nconst selectColumnContent: Command = (state, dispatch) => {\n const selection = state.selection;\n if (!(selection instanceof TextSelection)) return false;\n const { $from } = selection;\n let depth = -1;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'column') {\n depth = d;\n break;\n }\n }\n if (depth < 0) return false;\n\n const column = $from.node(depth);\n const empty = column.childCount === 1 && column.firstChild!.childCount === 0;\n if (dispatch) {\n if (empty) {\n dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $from.before(depth - 1))));\n } else {\n const $start = state.doc.resolve($from.start(depth));\n const $end = state.doc.resolve($from.end(depth));\n dispatch(state.tr.setSelection(TextSelection.between($start, $end)));\n }\n }\n return true;\n};\n\n/** Sets (or clears) the `background` of the `column` the cursor is in. */\nexport function setColumnBackground(color: string | null): Command {\n return (state, dispatch) => {\n const ctx = findColumnContext(state);\n if (!ctx) return false;\n if (dispatch) {\n const background = color ? toEmailSafeColor(color) : null;\n dispatch(\n state.tr\n .setNodeMarkup(ctx.pos, undefined, { ...ctx.node.attrs, background })\n .scrollIntoView(),\n );\n }\n return true;\n };\n}\n\n/**\n * The hybrid's other half, for the email as sent: round every columns\n * block a fixed table the Word engine reads and no one else sees — one\n * cell per column, the column's cap as its width — inside `[if mso]`\n * conditional comments, before, between and after the fluid columns.\n * Outlook lays the columns side by side at their caps (it ignores\n * `inline-block` and `max-width`, and would stack them); every other\n * client drops the comments and keeps the fluid divs. MJML's own way, and\n * the one way to a row in Outlook. A serializer's pass over the rendered\n * DOM (`serializeToHTML`): the comments stand between the columns, where\n * no node's own `emitDOM` can put them; on parse they are dropped, and\n * the block re-emits them, so the round trip holds.\n */\nexport function outlookColumns(root: HTMLElement): void {\n const prefix = `width: 100%; max-width: ${CONTAINER_MAX}px;`;\n for (const container of Array.from(root.querySelectorAll<HTMLElement>('div'))) {\n if (!(container.getAttribute('style') ?? '').startsWith(prefix)) continue;\n const columns = Array.from(container.children).filter(\n (child): child is HTMLElement =>\n child instanceof HTMLElement &&\n child.tagName === 'DIV' &&\n /^display: inline-block;/.test(child.getAttribute('style') ?? ''),\n );\n if (columns.length < 2 || columns.length !== container.children.length) continue;\n const doc = container.ownerDocument;\n const cell = (column: HTMLElement) =>\n `<td width=\"${parseColumnMaxWidth(column.getAttribute('style'))}\" valign=\"top\">`;\n container.insertBefore(\n doc.createComment(\n '[if mso]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">' +\n `<tr>${cell(columns[0])}<![endif]`,\n ),\n columns[0],\n );\n for (let i = 1; i < columns.length; i++) {\n container.insertBefore(\n doc.createComment(`[if mso]></td>${cell(columns[i])}<![endif]`),\n columns[i],\n );\n }\n container.appendChild(doc.createComment('[if mso]></td></tr></table><![endif]'));\n }\n}\n","/** Whether a URL may be emitted at all: script schemes are refused on parse\n and on every command — mail clients block them anyway, and the schema\n never carries what a client would refuse. */\nexport function isSafeUrl(url: string | null): boolean {\n if (!url) return false;\n // Block javascript: and vbscript: protocols (case-insensitive, ignoring leading spaces)\n const isMalicious = /^\\s*(javascript|vbscript):/i.test(url);\n return !isMalicious;\n}\n","import { ParseRule, TagParseRule } from 'prosemirror-model';\n\n/**\n * How markup is parsed through the schema.\n *\n * - `email` — the default for everything a host or the source pane hands the\n * editor. Every tag, attribute and CSS property that Apple Mail, Outlook or\n * Gmail applies is recognized and kept **exactly as authored** (see\n * `email-vocabulary.ts`): MJML's output, a hand-built table template, the\n * document envelope, Outlook conditional comments. Text lines, headings and\n * images become real editor nodes carrying their authored attributes;\n * layout structure stays structure. Anything no floor client applies is\n * dropped.\n * - `preserve` — the opt-in for special needs: like `email`, but nothing is\n * dropped for being outside the vocabulary (custom elements, `data-*`,\n * framework attributes, invented CSS). Executable content is still refused.\n * - `repair` — the schema is law: markup is rewritten into the composer's\n * canonical form. The clipboard and the reply/forward/import seeds use it —\n * pasted Word or Docs markup is cleaned, not kept.\n */\nexport type ParseMode = 'email' | 'preserve' | 'repair';\n\n/** Which parse rules take part: the `repair` set, or the `authored` set\n shared by `email` and `preserve` (they differ only in the vocabulary\n filter that runs before the parse). */\nexport type RuleScope = 'repair' | 'authored';\n\n/** The rule scope a mode parses with. */\nexport function scopeOf(mode: ParseMode): RuleScope {\n return mode === 'repair' ? 'repair' : 'authored';\n}\n\n/** Custom key on a parse rule restricting it to one scope. */\nexport const PARSE_SCOPE_KEY = 'aeeParseScope';\n\n/** A parse rule that only takes part in the given scope. */\nexport function ruleForScope<T extends ParseRule>(scope: RuleScope, rule: T): T {\n return Object.assign({}, rule, { [PARSE_SCOPE_KEY]: scope });\n}\n\n/** The scope a rule is restricted to, if any. */\nexport function ruleScope(rule: ParseRule | TagParseRule): RuleScope | undefined {\n return (rule as unknown as Record<string, RuleScope | undefined>)[PARSE_SCOPE_KEY];\n}\n","/**\n * The preserving parse — \"the source is law\".\n *\n * MJML-class tooling emits markup our canonical vocabulary never will: nested\n * layout tables with `align`/`cellpadding`/`bgcolor`, classed `div`s driven by\n * head media queries, Outlook conditional comments, `<input>` hamburger\n * toggles. Repairing all that into canonical form destroys the template, so in\n * `preserve` mode foreign markup is kept **verbatim** — tag and every\n * attribute — through a small family of generic nodes:\n *\n * - {@link HtmlElement} — a block container (`<div>`, `<table>`, `<tr>`, …\n * holding blocks), `{ tag, attrs }`.\n * - {@link HtmlTextElement} — a block holding inline content (a `<td>` with a\n * link, a styled `<p>`), same attrs.\n * - {@link HtmlVoid} / {@link HtmlVoidBlock} — void elements (`<img>`,\n * `<input>`, `<hr>`, …) as inline or block atoms, by context.\n * - {@link HtmlComment} / {@link HtmlCommentInline} — comments, conditional\n * comments included, as atoms; the serializer emits real comment nodes.\n * - {@link HtmlRaw} — a `<style>` in the body, text kept raw.\n * - {@link HtmlInline} — a mark for phrasing elements (`<span class>`,\n * `<label>`, …) that no canonical mark claims.\n *\n * Our own canonical shapes keep parsing into their rich nodes, so everything\n * the composer produced stays editable and the golden corpus is an identity in\n * both modes. The discriminator is general, not per node: a canonical node\n * rule claims an element in `preserve` mode only if that node would **re-emit\n * the element's opening tag identically** (same tag, same attributes, styles\n * compared declaration-wise) and its structural children are canonical too.\n * Anything else is foreign and preserved. A preserved subtree stays preserved\n * (a canonical `<tr>` inside a foreign table would have nowhere to live).\n *\n * `repair` mode is unchanged: these rules do not take part, unknown markup\n * dies in the parse as before — the clipboard and the reply/import seeds keep\n * that law.\n *\n * Safety holds in both modes: `script`/`iframe`/… are refused outright, event\n * handler attributes drop, and script URLs drop with the attribute.\n */\nimport {\n Attrs,\n ContentMatch,\n DOMOutputSpec,\n DOMParser as ProseMirrorDOMParser,\n DOMSerializer,\n Node,\n NodeType,\n ParseRule,\n Schema,\n TagParseRule,\n} from 'prosemirror-model';\nimport { defineMark, defineNode } from './extension';\nimport { AttributePairs, verbatimElement } from './verbatim';\nimport { AUTHORED_ATTR, AUTHORED_SPEC_KEY, canonicalRender, renderedPath } from './authored';\n\nexport type { AttributePairs } from './verbatim';\nexport { verbatimElement } from './verbatim';\nimport { isSafeUrl } from './safe-url';\nimport { Command } from 'prosemirror-state';\nimport { ParseMode, RuleScope, ruleForScope, ruleScope, scopeOf } from './parse-mode';\nimport { defineExtension } from './extension';\nimport {\n INLINE_TAGS,\n REFUSED_TAGS,\n TABLE_SECTION_TAGS,\n VOID_TAGS,\n isBlockLevel,\n} from './html-tags';\n\n/** Placeholder element the comment pre-pass turns DOM comments into:\n ProseMirror's parser never sees comment nodes, elements it does. */\nexport const COMMENT_TAG = 'aee-comment';\nconst COMMENT_ATTR = 'data-text';\n\n/** Below every canonical rule (default 50): a preserve rule only ever takes\n what no canonical rule claimed. */\nconst FALLBACK_PRIORITY = 10;\n/** Above every canonical rule: structure that must be decided first. */\nconst STRUCTURAL_PRIORITY = 100;\n\nconst URL_ATTRIBUTES = new Set([\n 'action',\n 'background',\n 'cite',\n 'data',\n 'formaction',\n 'href',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href',\n]);\n\n/** An element's attributes, verbatim and in order — minus what must never be\n emitted: event handlers, `srcdoc`, script URLs, styles with script hooks. */\nexport function preservedAttributes(element: Element): AttributePairs {\n const pairs: AttributePairs = [];\n for (const { name, value } of Array.from(element.attributes)) {\n if (/^on[a-z]/i.test(name) || name === 'srcdoc') continue;\n if (URL_ATTRIBUTES.has(name) && value.trim() && !isSafeUrl(value)) continue;\n if (name === 'style' && /expression\\s*\\(|(?:javascript|vbscript)\\s*:/i.test(value)) continue;\n // A line break and the indentation after it are formatting, never style:\n // the source pane's formatter breaks a long style that way (and only\n // that way — see `attributeLines`), so dropping them restores the style\n // exactly as written.\n pairs.push([name, name === 'style' ? value.replace(/\\r?\\n[ \\t]*/g, '') : value]);\n }\n return pairs;\n}\n\n/** Comment text with its inner indentation dropped: `<!--[if mso]>\\n <xml>`\n and `<!--[if mso]>\\n<xml>` are the same comment, and the formatter must\n be free to re-indent inner lines without changing the document. */\nexport function normalizeCommentText(text: string): string {\n return text.replace(/[ \\t]*\\r?\\n[ \\t]*/g, '\\n');\n}\n\n/** CSS with every line trimmed and re-indented by brace depth — idempotent,\n whitespace-only, so the head styles are a byte-stable fixpoint no matter\n how the source pane indents them. */\nexport function normalizeCss(css: string): string[] {\n const lines: string[] = [];\n let depth = 0;\n for (const raw of css.split('\\n')) {\n const line = raw.trim();\n if (!line) continue;\n const leadingCloses = /^}+/.exec(line)?.[0].length ?? 0;\n depth = Math.max(0, depth - leadingCloses);\n lines.push(' '.repeat(depth) + line);\n const opens = (line.match(/{/g) ?? []).length;\n const closes = (line.match(/}/g) ?? []).length - leadingCloses;\n depth = Math.max(0, depth + opens - closes);\n }\n return lines;\n}\n\n/** Turns every comment under `root` into a placeholder element the parse\n rules can see. Runs on the throwaway DOM a parse builds, never on live DOM. */\nexport function materializeComments(root: globalThis.Node): void {\n const doc = root.ownerDocument ?? (root as Document);\n const walker = doc.createTreeWalker(root, NodeFilter.SHOW_COMMENT);\n const comments: Comment[] = [];\n for (let node = walker.nextNode(); node; node = walker.nextNode()) {\n comments.push(node as Comment);\n }\n for (const comment of comments) {\n const placeholder = doc.createElement(COMMENT_TAG);\n placeholder.setAttribute(COMMENT_ATTR, comment.nodeValue ?? '');\n comment.replaceWith(placeholder);\n }\n}\n\n/**\n * Drops the edge whitespace inside phrasing elements that are displayed as\n * boxes (`<a style=\"display: inline-block\">` — MJML's navbar links and\n * buttons come as `<a> home </a>`). A box drops the whitespace at the start\n * and end of its own line boxes, so this is rendering-neutral in a client —\n * but the editor view keeps whitespace (`pre-wrap`, as an editor must), where\n * those spaces would take width and wrap a navbar the client keeps on one\n * line. Runs on the throwaway DOM a parse builds.\n */\nexport function trimInlineBoxes(root: Element): void {\n const boxed = /(?:^|;)\\s*display\\s*:\\s*(?:inline-)?(?:block|table|flex|grid)\\b/i;\n for (const element of Array.from(root.querySelectorAll('[style]'))) {\n if (!INLINE_TAGS.has(tagOf(element)) || !boxed.test(element.getAttribute('style') ?? '')) {\n continue;\n }\n const { firstChild, lastChild } = element;\n if (firstChild?.nodeType === globalThis.Node.TEXT_NODE) {\n firstChild.nodeValue = (firstChild.nodeValue ?? '').replace(/^\\s+/, '');\n }\n if (lastChild?.nodeType === globalThis.Node.TEXT_NODE) {\n lastChild.nodeValue = (lastChild.nodeValue ?? '').replace(/\\s+$/, '');\n }\n }\n}\n\nconst tagOf = (element: Element): string => element.tagName.toLowerCase();\n\n/**\n * Whether an element takes part in block layout among its siblings: a\n * block-level tag, or a phrasing element wrapping blocks (`<a href><table>`).\n * Images are inline (the composer's image node is an inline atom), so a\n * `td > img` is a cell holding an image, and `td > a > img` a linked image.\n */\nexport function isBlockish(element: Element): boolean {\n const tag = tagOf(element);\n if (tag === COMMENT_TAG) return false;\n if (INLINE_TAGS.has(tag)) return hasBlockChildren(element);\n return isBlockLevel(tag);\n}\n\n/** Whether an element lays its children out as blocks (any block-ish child). */\nexport function hasBlockChildren(element: Element): boolean {\n for (const child of Array.from(element.children)) {\n if (isBlockish(child)) return true;\n }\n return false;\n}\n\n/** Whether an element sits among block siblings — decides inline vs block\n for the atoms (comments, voids) that could be either. */\nfunction inBlockContext(element: Element): boolean {\n const parent = element.parentElement;\n return !parent || hasBlockChildren(parent);\n}\n\n/** A tag the generic block nodes may represent. */\nfunction isGenericBlockTag(tag: string): boolean {\n return (\n !INLINE_TAGS.has(tag) &&\n !VOID_TAGS.has(tag) &&\n !REFUSED_TAGS.has(tag) &&\n tag !== 'style' &&\n tag !== COMMENT_TAG\n );\n}\n\n// Per-parse bookkeeping — keyed by the throwaway DOM elements a parse walks,\n// so nothing outlives them.\n/** What each element was parsed as: the node type's name, the preserve\n family's included. An element no rule claimed has no entry. */\nconst decided = new WeakMap<Element, string>();\n/** Elements recognized as a node that cannot hold a comment (`column+`,\n `tableRow+`) in its canonical form: a comment inside one is the node's\n own serializer output (the columns' Outlook ghost table) and is written\n again on the way out. */\nconst commentless = new WeakSet<Element>();\n\n/** The nearest ancestor that is a node of its own (table sections are walked\n through), or null at the parse root. */\nfunction structuralParent(element: Element): Element | null {\n let parent = element.parentElement;\n while (parent && TABLE_SECTION_TAGS.has(tagOf(parent))) parent = parent.parentElement;\n return parent;\n}\n\n/** The name of the node the element's content lands in: the nearest decided\n ancestor's, or null at the parse root (the document). */\nfunction parentDecision(element: Element): string | null {\n for (let parent = structuralParent(element); parent; parent = structuralParent(parent)) {\n const name = decided.get(parent);\n if (name) return name;\n }\n return null;\n}\n\n/** Whether the element sits inside markup the preserve family keeps. */\nfunction underPreserved(element: Element): boolean {\n const parent = parentDecision(element);\n return parent === 'htmlElement' || parent === 'htmlTextElement';\n}\n\nconst claimAs =\n (name: string) =>\n (element: Element): Attrs => {\n decided.set(element, name);\n return { tag: tagOf(element), attrs: preservedAttributes(element) };\n };\n\nconst elementAttrs = { tag: {}, attrs: { default: [] as AttributePairs } };\nconst renderElement = (node: Node): DOMOutputSpec =>\n verbatimElement(node.attrs['tag'], node.attrs['attrs'] as AttributePairs, true);\nconst renderVoid = (node: Node): DOMOutputSpec =>\n verbatimElement(node.attrs['tag'], node.attrs['attrs'] as AttributePairs, false);\n\n/** A comment on its way out: the serializer cannot emit comment nodes from a\n spec (only elements), so it emits this placeholder and `serializeToHTML`\n turns it into a real comment before reading the HTML back. */\nconst renderComment = (node: Node): DOMOutputSpec => [\n COMMENT_TAG,\n { [COMMENT_ATTR]: node.attrs['text'] },\n];\n\n/** Replaces emitted comment placeholders under `root` with comment nodes. */\nexport function realizeComments(root: Element): void {\n for (const placeholder of Array.from(root.querySelectorAll(COMMENT_TAG))) {\n placeholder.replaceWith(\n root.ownerDocument.createComment(placeholder.getAttribute(COMMENT_ATTR) ?? ''),\n );\n }\n}\n\nconst preserveRule = (rule: TagParseRule): TagParseRule =>\n ruleForScope('authored', { priority: FALLBACK_PRIORITY, ...rule });\n\n/** A foreign block container — anything holding block-level children. */\nexport const HtmlElement = defineNode({\n name: 'htmlElement',\n spec: {\n authoredMarkup: false,\n content: 'block*',\n group: 'block',\n attrs: elementAttrs,\n parseDOM: [\n // A phrasing element wrapping blocks (`<a href><table>…`, `<span><div>`)\n // cannot be a mark — it is a container, decided before any mark rule.\n preserveRule({\n tag: '*',\n priority: STRUCTURAL_PRIORITY,\n getAttrs: (element) => {\n const tag = tagOf(element);\n if (!INLINE_TAGS.has(tag) || REFUSED_TAGS.has(tag)) return false;\n return hasBlockChildren(element) ? claimAs('htmlElement')(element) : false;\n },\n }),\n preserveRule({\n tag: '*',\n getAttrs: (element) => {\n const tag = tagOf(element);\n if (!isGenericBlockTag(tag) || !hasBlockChildren(element)) return false;\n if (TABLE_SECTION_TAGS.has(tag) && !underPreserved(element)) return false;\n return claimAs('htmlElement')(element);\n },\n }),\n ],\n toDOM: renderElement,\n },\n});\n\n/** A structural block holding inline content — a `<td>` with a link (MJML's\n button cell), a `<center>` or `<label>`-free text container. Text lines\n (`div`, `p`) and headings are the composer's own nodes instead; see\n `authored.ts`. Enter inserts a line break here (see {@link AuthoredEnter})\n — splitting a table cell would add a cell. */\nexport const HtmlTextElement = defineNode({\n name: 'htmlTextElement',\n spec: {\n authoredMarkup: false,\n content: 'inline*',\n group: 'block',\n attrs: elementAttrs,\n parseDOM: [\n preserveRule({\n tag: '*',\n getAttrs: (element) => {\n const tag = tagOf(element);\n if (!isGenericBlockTag(tag) || hasBlockChildren(element)) return false;\n if (TABLE_SECTION_TAGS.has(tag) && !underPreserved(element)) return false;\n return claimAs('htmlTextElement')(element);\n },\n }),\n ],\n toDOM: renderElement,\n },\n});\n\nconst voidAttrs = (element: Element, inline: boolean): Attrs | false => {\n const tag = tagOf(element);\n if (!VOID_TAGS.has(tag) || REFUSED_TAGS.has(tag)) return false;\n if (inBlockContext(element) === inline) return false;\n return claimAs(inline ? 'htmlVoid' : 'htmlVoidBlock')(element);\n};\n\n/** A foreign void element among inline content (`<img>` in a cell, `<input>`). */\nexport const HtmlVoid = defineNode({\n name: 'htmlVoid',\n spec: {\n authoredMarkup: false,\n inline: true,\n group: 'inline',\n atom: true,\n attrs: elementAttrs,\n parseDOM: [preserveRule({ tag: '*', getAttrs: (element) => voidAttrs(element, true) })],\n toDOM: renderVoid,\n },\n});\n\n/** A foreign void element among blocks (`<hr class>`, an `<input>` between divs). */\nexport const HtmlVoidBlock = defineNode({\n name: 'htmlVoidBlock',\n spec: {\n authoredMarkup: false,\n group: 'block',\n atom: true,\n attrs: elementAttrs,\n parseDOM: [preserveRule({ tag: '*', getAttrs: (element) => voidAttrs(element, false) })],\n toDOM: renderVoid,\n },\n});\n\nconst commentAttrs = (element: Element, inline: boolean): Attrs | false => {\n const parent = structuralParent(element);\n if (parent && commentless.has(parent)) return false;\n return inBlockContext(element) === inline\n ? false\n : { text: normalizeCommentText(element.getAttribute(COMMENT_ATTR) ?? '') };\n};\n\n/** A comment between blocks — MJML's Outlook conditionals live here. Hidden\n in the editor (a browser renders nothing for it either); the serializer\n emits a real comment node. */\nexport const HtmlComment = defineNode({\n name: 'htmlComment',\n spec: {\n authoredMarkup: false,\n group: 'block',\n atom: true,\n selectable: false,\n attrs: { text: { default: '' } },\n parseDOM: [preserveRule({ tag: COMMENT_TAG, getAttrs: (el) => commentAttrs(el, false) })],\n toDOM: () => ['div', { class: 'aee-comment', hidden: '' }],\n emitDOM: renderComment,\n },\n});\n\n/** A comment among inline content. */\nexport const HtmlCommentInline = defineNode({\n name: 'htmlCommentInline',\n spec: {\n authoredMarkup: false,\n inline: true,\n group: 'inline',\n atom: true,\n selectable: false,\n attrs: { text: { default: '' } },\n parseDOM: [preserveRule({ tag: COMMENT_TAG, getAttrs: (el) => commentAttrs(el, true) })],\n toDOM: () => ['span', { class: 'aee-comment', hidden: '' }],\n emitDOM: renderComment,\n },\n});\n\n/**\n * A `<style>` in the body, text kept raw (whitespace-normalized). Hidden in\n * the editor — a live `<style>` inside the editable DOM would restyle the host\n * app; the `DocumentStyles` extension applies it scoped, like the head's.\n * Also carries the refusals: executable content is never parsed, in any mode,\n * and a body `<style>` dies in repair mode (its text would leak otherwise).\n */\nexport const HtmlRaw = defineNode({\n name: 'htmlRaw',\n spec: {\n authoredMarkup: false,\n group: 'block',\n atom: true,\n selectable: false,\n attrs: { attrs: { default: [] as AttributePairs }, text: { default: '' } },\n parseDOM: [\n ...[...REFUSED_TAGS].map((tag): TagParseRule => ({ tag, ignore: true })),\n ruleForScope('repair', { tag: 'style', ignore: true }),\n preserveRule({\n tag: 'style',\n getAttrs: (element) => ({\n attrs: preservedAttributes(element),\n text: normalizeCss(element.textContent ?? '').join('\\n'),\n }),\n }),\n ],\n toDOM: () => ['span', { class: 'aee-raw', hidden: '' }],\n emitDOM: (node: Node): DOMOutputSpec => {\n const { dom } = verbatimElement('style', node.attrs['attrs'] as AttributePairs, false);\n dom.textContent = node.attrs['text'];\n return { dom };\n },\n },\n});\n\n/** A phrasing element no canonical mark claims (`<span class=\"…\">`,\n `<label>`, `<font face>`), kept verbatim. Instances nest freely\n (`excludes: ''`), outermost first, so `<a><span>…` survives as authored. */\nexport const HtmlInline = defineMark({\n name: 'htmlInline',\n spec: {\n authoredMarkup: false,\n attrs: elementAttrs,\n excludes: '',\n parseDOM: [\n preserveRule({\n tag: '*',\n getAttrs: (element) => {\n const tag = tagOf(element);\n if (!INLINE_TAGS.has(tag) || hasBlockChildren(element)) return false;\n return { tag, attrs: preservedAttributes(element) };\n },\n }),\n ],\n toDOM: (mark) =>\n verbatimElement(mark.attrs['tag'], mark.attrs['attrs'] as AttributePairs, true),\n },\n});\n\n/**\n * Enter inside a structural text block ({@link HtmlTextElement}) inserts a\n * line break instead of splitting it: splitting a `<td>` adds a table cell,\n * splitting a `<center>` duplicates a container. Must sit before the kit's\n * `SplitKeepingMarks`, whose split would otherwise claim Enter.\n */\nexport const AuthoredEnter = defineExtension({\n name: 'authoredEnter',\n keymap: ({ schema }) => {\n const breakLine: Command = (state, dispatch) => {\n const textElement = schema.nodes[HtmlTextElement.name];\n const hardBreak = schema.nodes['hardBreak'];\n if (!textElement || !hardBreak || state.selection.$from.parent.type !== textElement) {\n return false;\n }\n dispatch?.(state.tr.replaceSelectionWith(hardBreak.create()).scrollIntoView());\n return true;\n };\n return { Enter: breakLine };\n },\n});\n\n/** The whole family, in schema order: block nodes, then inline atoms, then\n the mark. Both kits include it; the mode decides whether it takes part. */\nexport const preserveExtensions = [\n HtmlElement,\n HtmlTextElement,\n HtmlVoidBlock,\n HtmlVoid,\n HtmlComment,\n HtmlCommentInline,\n HtmlRaw,\n HtmlInline,\n];\n\n// --- The mode-aware parser ---------------------------------------------------\n\n/** Style declarations as a sorted, whitespace-normalized list, so `a:b;c:d`\n and `c: d; a: b;` compare equal — order and spacing never render. */\nfunction normalizeStyle(style: string): string {\n return style\n .split(';')\n .map((declaration) => declaration.trim())\n .filter(Boolean)\n .map((declaration) => {\n const colon = declaration.indexOf(':');\n if (colon < 0) return declaration.toLowerCase();\n const property = declaration.slice(0, colon).trim().toLowerCase();\n const value = declaration\n .slice(colon + 1)\n .trim()\n .replace(/\\s+/g, ' ');\n return `${property}: ${value}`;\n })\n .sort()\n .join('; ');\n}\n\n/** Same tag, same attribute set, same values (styles declaration-wise). */\nfunction sameOpeningTag(a: Element, b: Element): boolean {\n if (a.tagName !== b.tagName || a.attributes.length !== b.attributes.length) return false;\n for (const { name, value } of Array.from(a.attributes)) {\n const other = b.getAttribute(name);\n if (other === null) return false;\n if (name === 'style' ? normalizeStyle(value) !== normalizeStyle(other) : value !== other) {\n return false;\n }\n }\n return true;\n}\n\n/** Element children that take part in block structure, table sections\n walked through. Phrasing elements and comments are marks/inline atoms and\n never affect whether a parent is canonical. */\nfunction* structuralChildren(element: Element): Iterable<Element> {\n for (const child of Array.from(element.children)) {\n const tag = tagOf(child);\n if (TABLE_SECTION_TAGS.has(tag)) yield* structuralChildren(child);\n else if (!INLINE_TAGS.has(tag) && tag !== COMMENT_TAG) yield child;\n }\n}\n\n/** Every node type a node of `type` may hold directly, anywhere in its\n content — what the parse may put inside it without inventing a wrapper. */\nconst childTypesCache = new WeakMap<NodeType, Set<NodeType>>();\nfunction childTypes(type: NodeType): Set<NodeType> {\n let types = childTypesCache.get(type);\n if (types) return types;\n types = new Set<NodeType>();\n const seen = new Set<ContentMatch>();\n const visit = (match: ContentMatch) => {\n if (seen.has(match)) return;\n seen.add(match);\n for (let i = 0; i < match.edgeCount; i++) {\n const edge = match.edge(i);\n types!.add(edge.type);\n visit(edge.next);\n }\n };\n visit(type.contentMatch);\n childTypesCache.set(type, types);\n return types;\n}\n\n/**\n * The authored elements from `element` down to where its content is read,\n * following the canonical rendering's own path (`expected`, tag by tag): the\n * rule's `contentElement` when it names one, else the only child of the\n * expected tag at each level — the `<tbody>` a browser inserts into every\n * `<table>`, which the parser walks through the same way. Null when the\n * authored markup does not have that shape.\n */\nfunction authoredElements(\n element: HTMLElement,\n rule: TagParseRule,\n expected: Element[],\n): Element[] | null {\n if (expected.length === 1) return [element];\n const selector = rule.contentElement;\n if (selector) {\n const content =\n typeof selector === 'string'\n ? element.querySelector(selector)\n : typeof selector === 'function'\n ? selector(element)\n : selector;\n if (!(content instanceof Element)) return null;\n const path: Element[] = [];\n for (let el: Element | null = content; el; el = el.parentElement) {\n path.unshift(el);\n if (el === element) return path;\n }\n return null;\n }\n const path: Element[] = [element];\n for (let i = 1; i < expected.length; i++) {\n const tag = expected[i].tagName;\n const matches = Array.from(path[i - 1].children).filter((child) => child.tagName === tag);\n if (matches.length !== 1) return null;\n path.push(matches[0]);\n }\n return path;\n}\n\n/** Whether an element holds anything besides `next` — text, or other\n elements (comments included). */\nfunction hasSiblingsOf(element: Element, next: Element): boolean {\n for (const child of Array.from(element.childNodes)) {\n if (child === next) continue;\n if (child.nodeType === globalThis.Node.TEXT_NODE && !(child.nodeValue ?? '').trim()) continue;\n return true;\n }\n return false;\n}\n\n/** Whether an element's content holds a comment where the node keeps none. */\nfunction holdsCommentChild(element: Element): boolean {\n for (const child of Array.from(element.children)) {\n const tag = tagOf(child);\n if (tag === COMMENT_TAG) return true;\n if (TABLE_SECTION_TAGS.has(tag) && holdsCommentChild(child)) return true;\n }\n return false;\n}\n\n/** No elements and no text but HTML whitespace. */\nfunction isBare(element: Element): boolean {\n return element.children.length === 0 && /^[ \\t\\n\\f\\r]*$/.test(element.textContent ?? '');\n}\n\n/** Same tag and attributes, element by element. */\nfunction samePath(a: Element[], b: Element[]): boolean {\n return a.length === b.length && a.every((element, i) => sameOpeningTag(element, b[i]));\n}\n\ntype TypeOf = (element: Element, parent: NodeType) => NodeType | null;\n\n/**\n * A node rule for the authored scope: the node **recognizes** whatever\n * markup its own rule accepts, and keeps that markup as authored (the `html`\n * overlay, see `authored.ts`) wherever it is not exactly the node's own\n * canonical rendering. Recognition is refused — and the preserve family\n * keeps the element verbatim instead — whenever taking it would change the\n * markup's *structure*:\n *\n * - the node could not stand where the element stands (no wrapper is ever\n * invented: a `<tr>` outside a table, a column outside a columns block);\n * - the authored elements down to the content are not the ones the node\n * renders (a section's band without the inner `<div>` it writes), or carry\n * anything beside that path;\n * - the content would not fit: a textblock laying out blocks, or a node\n * that holds only certain children (`tableRow+`, `column+`, `inline*`)\n * given ones it cannot hold, in order;\n * - it holds comments the node has no place for (MJML's conditionals in a\n * columns block) — only the node's own canonical rendering may, because\n * it writes them itself.\n */\nfunction recognize(schema: Schema, rule: TagParseRule, typeOf: TypeOf): TagParseRule {\n const type = schema.nodes[rule.node!];\n const comment = schema.nodes[HtmlComment.name];\n const foreignBlock = schema.nodes[HtmlElement.name];\n const leaf = type.isLeaf;\n const holdsComments = leaf || type.inlineContent || !comment || childTypes(type).has(comment);\n const holdsForeignBlocks = !!foreignBlock && childTypes(type).has(foreignBlock);\n const memo = new WeakMap<Element, Map<NodeType | null, Attrs | false | null>>();\n\n const decide = (element: HTMLElement, parent: NodeType): Attrs | false | null => {\n const own = rule.getAttrs ? rule.getAttrs(element) : null;\n if (own === false) return false;\n // Inline nodes (an image, a button) stand in whatever line holds them —\n // among blocks, the parser gives them one, as it does loose text.\n if (!type.isInline && !childTypes(parent).has(type)) return false;\n if (type.isTextblock && hasBlockChildren(element)) return false;\n\n const attrs: Record<string, unknown> = { ...(rule.attrs ?? {}), ...(own ?? {}) };\n delete attrs[AUTHORED_ATTR];\n let rendered;\n try {\n rendered = canonicalRender(type.create({ ...attrs, [AUTHORED_ATTR]: null }), true);\n } catch {\n return false;\n }\n const canonicalPath = rendered && renderedPath(rendered);\n const path = canonicalPath && authoredElements(element, rule, canonicalPath);\n if (!canonicalPath || !path || path.length !== canonicalPath.length) return false;\n for (let i = 1; i < path.length; i++) {\n if (path[i].tagName !== canonicalPath[i].tagName) return false;\n }\n const exact = samePath(path, canonicalPath);\n if (!exact) {\n for (let i = 0; i < path.length - 1; i++) {\n if (hasSiblingsOf(path[i], path[i + 1])) return false;\n }\n }\n\n const content = path[path.length - 1];\n // Nothing inside, where the node's own rendering of nothing puts\n // something: MJML's divider is an empty `<p>` drawing a border, and the\n // `<br>` an empty line is written with would give it a line's height.\n if (isBare(content) && canonicalPath[canonicalPath.length - 1].hasChildNodes()) return false;\n if (!leaf && !type.inlineContent && !holdsForeignBlocks) {\n let match = type.contentMatch;\n for (const child of structuralChildren(content)) {\n const childType = typeOf(child, type);\n const next = childType && match.matchType(childType);\n if (!next) return false;\n match = next;\n }\n // Too few is a misfit too: MJML's empty gutter column is a `<table>`\n // with no rows, and the parse would invent the row a table needs.\n if (!match.validEnd) return false;\n }\n if (!holdsComments && holdsCommentChild(content)) {\n if (!exact) return false;\n commentless.add(content);\n commentless.add(element);\n }\n\n const html = exact\n ? null\n : {\n path: path.map((el) => ({ tag: tagOf(el), attrs: preservedAttributes(el) })),\n parsed: attrs,\n };\n return { ...attrs, [AUTHORED_ATTR]: html };\n };\n\n const decideMemo = (element: HTMLElement, parent: NodeType): Attrs | false | null => {\n let byParent = memo.get(element);\n if (!byParent) memo.set(element, (byParent = new Map()));\n if (!byParent.has(parent)) byParent.set(parent, decide(element, parent));\n return byParent.get(parent)!;\n };\n\n return {\n ...rule,\n getAttrs: (element) => {\n const parentName = parentDecision(element);\n const parent = parentName ? schema.nodes[parentName] : schema.topNodeType;\n const result = decideMemo(element, parent);\n if (result !== false) decided.set(element, type.name);\n return result;\n },\n // The same decision, asked by a parent about a child it would hold.\n [PROBE_KEY]: (element: HTMLElement, parent: NodeType) => decideMemo(element, parent),\n } as TagParseRule;\n}\n\nconst PROBE_KEY = 'aeeProbe';\ntype TypeOfProbe = (element: HTMLElement, parent: NodeType) => Attrs | false | null;\n\n/**\n * A mark rule for the authored scope: the mark keeps the element as\n * authored (`<b class=\"x\">`, a link's own `style`) wherever it is not\n * exactly the mark's canonical rendering.\n */\nfunction recognizeMark(schema: Schema, rule: TagParseRule): TagParseRule {\n const type = schema.marks[rule.mark!];\n if (type.spec[AUTHORED_SPEC_KEY] === false || !type.spec.attrs?.[AUTHORED_ATTR]) return rule;\n return {\n ...rule,\n getAttrs: (element) => {\n const own = rule.getAttrs ? rule.getAttrs(element) : null;\n if (own === false) return false;\n const attrs: Record<string, unknown> = { ...(rule.attrs ?? {}), ...(own ?? {}) };\n delete attrs[AUTHORED_ATTR];\n let rendered;\n try {\n rendered = canonicalRender(type.create({ ...attrs, [AUTHORED_ATTR]: null }), true);\n } catch {\n return false;\n }\n const exact = rendered?.dom instanceof Element && sameOpeningTag(rendered.dom, element);\n const html = exact\n ? null\n : { path: [{ tag: tagOf(element), attrs: preservedAttributes(element) }], parsed: attrs };\n return { ...attrs, [AUTHORED_ATTR]: html };\n },\n };\n}\n\n/** Every parse rule of the schema, marks before nodes, sorted by priority\n (stable), each tagged with the node or mark it produces — what ProseMirror\n itself builds for `DOMParser.fromSchema`, rebuilt here from the public\n specs so it can be filtered and wrapped per mode. */\nfunction schemaParseRules(schema: Schema): ParseRule[] {\n const rules: ParseRule[] = [];\n const priorityOf = (rule: ParseRule) => rule.priority ?? 50;\n const insert = (rule: ParseRule) => {\n let index = 0;\n while (index < rules.length && priorityOf(rules[index]) >= priorityOf(rule)) index++;\n rules.splice(index, 0, rule);\n };\n const isProducer = (rule: ParseRule) =>\n 'mark' in rule || 'node' in rule || rule.ignore || 'clearMark' in rule;\n for (const [name, type] of Object.entries(schema.marks)) {\n for (const rule of type.spec.parseDOM ?? []) {\n insert(isProducer(rule) ? { ...rule } : { ...rule, mark: name });\n }\n }\n for (const [name, type] of Object.entries(schema.nodes)) {\n for (const rule of type.spec.parseDOM ?? []) {\n insert(isProducer(rule) ? { ...rule } : { ...rule, node: name });\n }\n }\n return rules;\n}\n\nconst parserCache = new WeakMap<Schema, Partial<Record<RuleScope, ProseMirrorDOMParser>>>();\n\n/**\n * The schema's parser for a mode. `repair` is the plain schema parser minus\n * the authored rules. `email` and `preserve` share one parser (they differ\n * only in the vocabulary filter applied before it runs): it drops style\n * rules (they would mark authored text up — `font-weight: bold` on an\n * authored `<div>` must stay a style, not become a `<strong>`), lets the\n * nodes that carry authored markup claim theirs, strictifies every other\n * canonical node rule, and lets the preserve family take the rest.\n */\nexport function createDOMParser(schema: Schema, mode: ParseMode): ProseMirrorDOMParser {\n const scope = scopeOf(mode);\n let byScope = parserCache.get(schema);\n if (!byScope) parserCache.set(schema, (byScope = {}));\n const cached = byScope[scope];\n if (cached) return cached;\n\n const all = schemaParseRules(schema).filter((rule) => {\n const restricted = ruleScope(rule);\n if (restricted && restricted !== scope) return false;\n return scope === 'repair' || 'tag' in rule;\n });\n\n let rules: ParseRule[] = all;\n if (scope === 'authored' && schema.nodes[HtmlElement.name]) {\n const recognized: TagParseRule[] = [];\n const typeOf: TypeOf = (element, parent) => {\n for (const rule of recognized) {\n if (!element.matches(rule.tag!)) continue;\n const probe = (rule as unknown as Record<string, TypeOfProbe>)[PROBE_KEY];\n if (probe(element as HTMLElement, parent) !== false) return schema.nodes[rule.node!];\n }\n return null;\n };\n rules = all.map((rule) => {\n const tagRule = rule as TagParseRule;\n // The preserve family is the fallback, verbatim by construction.\n if (ruleScope(rule)) return rule;\n if (tagRule.mark && tagRule.tag) return recognizeMark(schema, tagRule);\n if (!tagRule.node || !tagRule.tag || tagRule.ignore) return rule;\n const made = recognize(schema, tagRule, typeOf);\n recognized.push(made);\n return made;\n });\n }\n\n const parser = new ProseMirrorDOMParser(schema, rules);\n byScope[scope] = parser;\n return parser;\n}\n","/**\n * The document envelope: doctype, `<html>` and `<body>` attributes, and the\n * `<head>` — everything around the body that MJML-class tooling emits and\n * that the body's responsiveness depends on (the media queries driving\n * `.mj-column-per-50` live in the head). Gmail strips the head; other\n * clients honour it; either way it is the author's and rides along.\n *\n * It lives as an attribute of the document node, never as content, and the\n * head is stored in one **canonical, line-based form** (see\n * {@link canonicalHead}) so that formatting the source pane can never change\n * the canonical document — the formatter prints exactly these lines and the\n * next parse normalizes them straight back.\n */\nimport { REFUSED_TAGS, VOID_TAGS } from './html-tags';\nimport {\n AttributePairs,\n normalizeCommentText,\n normalizeCss,\n preservedAttributes,\n} from './preserve';\n\nexport interface DocumentEnvelope {\n /** The doctype as re-emitted (`<!doctype html>`), or null when absent. */\n doctype: string | null;\n /** Attributes of `<html>`, in authored order. */\n html: AttributePairs;\n /** The head in canonical line form, `\\n`-joined, unindented; `''` when empty. */\n head: string;\n /** Attributes of `<body>`, in authored order. */\n body: AttributePairs;\n}\n\n/** Whether HTML carries a document envelope rather than being a bare body\n fragment — a doctype or an explicit `html`/`head`/`body` tag. */\nexport function hasDocumentEnvelope(html: string): boolean {\n return /<(?:!doctype|html|head|body)(?=[\\s>/])/i.test(html);\n}\n\n/** Parses HTML into a throwaway document. A bare fragment is parsed inside\n an explicit `<body>`: otherwise the HTML parser files a leading comment\n or `<style>` under the head, and body-only consumers would lose it. */\nexport function parseDocument(html: string): Document {\n const source = hasDocumentEnvelope(html) ? html : `<body>${html}`;\n return new DOMParser().parseFromString(source, 'text/html');\n}\n\n/** Reads the envelope off a parsed document. */\nexport function readEnvelope(dom: Document): DocumentEnvelope {\n return {\n doctype: doctypeString(dom.doctype),\n html: preservedAttributes(dom.documentElement),\n head: canonicalHead(dom.head),\n body: preservedAttributes(dom.body),\n };\n}\n\nfunction doctypeString(doctype: DocumentType | null): string | null {\n if (!doctype) return null;\n const name = doctype.name || 'html';\n if (doctype.publicId) {\n return `<!DOCTYPE ${name} PUBLIC \"${doctype.publicId}\" \"${doctype.systemId}\">`;\n }\n if (doctype.systemId) return `<!DOCTYPE ${name} SYSTEM \"${doctype.systemId}\">`;\n return `<!doctype ${name}>`;\n}\n\n/**\n * The head, one child per line: `<title>`/`<meta>`/`<link>` on a line each,\n * `<style>` with its CSS trimmed and re-indented by nesting, comments with\n * their inner indentation dropped. Whitespace-only normalization, idempotent —\n * so the head string is a fixpoint of parse → serialize → format → parse.\n * Executable content (`<script>`, `<base>`) never makes it in.\n */\nexport function canonicalHead(head: Element | null): string {\n if (!head) return '';\n const lines: string[] = [];\n for (const node of Array.from(head.childNodes)) {\n if (node.nodeType === Node.COMMENT_NODE) {\n lines.push(`<!--${normalizeCommentText(node.nodeValue ?? '')}-->`);\n continue;\n }\n if (node.nodeType === Node.TEXT_NODE) {\n const text = (node.nodeValue ?? '').replace(/\\s+/g, ' ').trim();\n if (text) lines.push(escapeText(text));\n continue;\n }\n if (!(node instanceof Element)) continue;\n\n const tag = node.tagName.toLowerCase();\n if (REFUSED_TAGS.has(tag)) continue;\n const open = openTag(tag, preservedAttributes(node));\n if (VOID_TAGS.has(tag)) {\n lines.push(open);\n } else if (tag === 'style') {\n lines.push(\n open,\n ...normalizeCss(node.textContent ?? '').map((line) => ` ${line}`),\n '</style>',\n );\n } else {\n const text = (node.textContent ?? '').replace(/\\s+/g, ' ').trim();\n lines.push(`${open}${escapeText(text)}</${tag}>`);\n }\n }\n return lines.join('\\n');\n}\n\n/** The canonical document: envelope lines around the zero-whitespace body. */\nexport function serializeDocument(envelope: DocumentEnvelope, body: string): string {\n const lines: string[] = [];\n if (envelope.doctype) lines.push(envelope.doctype);\n lines.push(openTag('html', envelope.html), '<head>');\n if (envelope.head) lines.push(envelope.head);\n lines.push('</head>', `${openTag('body', envelope.body)}${body}</body>`, '</html>');\n return lines.join('\\n');\n}\n\n/** An opening tag with escaped attribute values; a valueless attribute is\n written bare (`<td nowrap>`), matching how the browser serializes it. */\nexport function openTag(tag: string, attrs: AttributePairs): string {\n let out = `<${tag}`;\n for (const [name, value] of attrs) out += ` ${attributeString(name, value)}`;\n return `${out}>`;\n}\n\n/** One attribute as the source writes it: `name=\"value\"` — bare only for an\n HTML boolean, where the name alone is the value. An empty value anywhere\n else is spelled out (`alt=\"\"` is a decision, not a leftover). */\nexport function attributeString(name: string, value: string): string {\n return value === '' && isBooleanAttribute(name) ? name : `${name}=\"${escapeAttribute(value)}\"`;\n}\n\n/** Whether the attribute is one of HTML's booleans — written bare. */\nexport function isBooleanAttribute(name: string): boolean {\n return BOOLEAN_ATTRIBUTES.has(name.toLowerCase());\n}\n\n/** HTML's boolean attributes: present means true, and the value is moot. */\nconst BOOLEAN_ATTRIBUTES = new Set([\n 'allowfullscreen',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'inert',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected',\n]);\n\nexport function escapeText(text: string): string {\n return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n}\n\nexport function escapeAttribute(value: string): string {\n return value.replace(/&/g, '&').replace(/\"/g, '"');\n}\n","/**\n * Mistakes other editors store, corrected on the way in.\n *\n * The `email` parse keeps authored markup as written — right for a builder's\n * template, wrong for what a WYSIWYG editor saved on the author's behalf.\n * Summernote (and the Word or Gmail markup pasted into it) stores shapes that\n * look fine in that editor and break in a mail client. Each correction here\n * repairs one such shape toward what the author saw, and is correct for any\n * input — it never fires on markup that already means what it shows:\n *\n * - `mailto://a@b.de`, `tel://+49…` — Summernote's `checkLinkUrl` writes the\n * scheme with slashes; no client reads the address after them.\n * - `http://{{link}}` — the same function glues a scheme onto a link that is\n * only a placeholder; the placeholder already resolves to a whole URL.\n * - `<o:p>` — Word's paragraph-end marker. It renders nothing, but as an\n * element nobody claims it turns the `<p>` around it into a container, and\n * the line inside comes out nested.\n * - `class=\"MsoNormal\"` with no stylesheet defining it — the Word styles stay\n * behind on the clipboard; the class points at nothing.\n * - `<table class=\"table table-bordered\">` — the borders were the host app's\n * Bootstrap CSS, which no inbox has. They are written inline, as Bootstrap\n * drew them.\n * - An inline element wrapped around blocks (`<font color><div>…</div></font>`,\n * `<span style><div>…</div></span>`) — a client re-nests it and the blocks\n * lose the formatting. The inline is pushed down into each block.\n * - A video embed (`<iframe>`, `<video>`) — no client plays one, and the\n * vocabulary drops it. The intent, \"watch this\", stays as a link.\n *\n * Runs in the `email` parse only: `preserve` keeps the source as law, and\n * `repair` rewrites everything into canonical form anyway.\n */\nimport { declarationProperty, splitDeclarations } from './email-vocabulary';\n\n/** Applies every correction to a parsed document, in place. */\nexport function correctStoredMistakes(dom: Document): void {\n const root = dom.body;\n embedsAsLinks(root);\n repairLinkSchemes(root);\n unwrapOfficeParagraphMarks(root);\n dropDeadOfficeClasses(dom);\n inlineBootstrapTableBorders(dom);\n lowerInlinesAroundBlocks(root);\n}\n\n// ── links ───────────────────────────────────────────────────────────────\n\n/** `mailto://` and `tel://` back to the scheme a client reads; `http://` off\n a link that is one placeholder and nothing else. */\nexport function repairLinkSchemes(root: ParentNode): void {\n for (const link of Array.from(root.querySelectorAll('a[href]'))) {\n const href = link.getAttribute('href')!;\n const repaired = href\n .replace(/^\\s*(mailto|tel):\\/\\//i, (_, scheme: string) => `${scheme.toLowerCase()}:`)\n .replace(/^\\s*https?:\\/\\/(\\{\\{[^{}]*\\}\\})\\s*$/i, '$1');\n if (repaired !== href) link.setAttribute('href', repaired);\n }\n}\n\n/** The page a viewer opens for an embedded player's address. */\nexport function videoPage(src: string): string {\n const url = src.trim().replace(/^\\/\\//, 'https://');\n const youtube = /^https?:\\/\\/(?:www\\.)?youtube(?:-nocookie)?\\.com\\/embed\\/([\\w-]+)/i.exec(url);\n if (youtube) return `https://www.youtube.com/watch?v=${youtube[1]}`;\n const vimeo = /^https?:\\/\\/player\\.vimeo\\.com\\/video\\/(\\d+)/i.exec(url);\n if (vimeo) return `https://vimeo.com/${vimeo[1]}`;\n return url;\n}\n\n/** Each embedded player becomes a link to its page, where it stood. */\nexport function embedsAsLinks(root: ParentNode): void {\n for (const embed of Array.from(root.querySelectorAll('iframe[src], video[src]'))) {\n const page = videoPage(embed.getAttribute('src')!);\n if (!/^https?:\\/\\//i.test(page)) {\n embed.remove();\n continue;\n }\n const link = embed.ownerDocument.createElement('a');\n link.setAttribute('href', page);\n link.textContent = embed.getAttribute('title')?.trim() || page;\n embed.replaceWith(link);\n }\n}\n\n// ── Word ────────────────────────────────────────────────────────────────\n\n/** `<o:p>` replaced by what it holds (an ` ` keeps an empty line). */\nexport function unwrapOfficeParagraphMarks(root: ParentNode): void {\n for (const mark of Array.from(root.querySelectorAll('*')).reverse()) {\n if (mark.tagName.toLowerCase() === 'o:p') mark.replaceWith(...Array.from(mark.childNodes));\n }\n}\n\n/** `Mso…` class names no `<style>` in the document mentions. */\nexport function dropDeadOfficeClasses(dom: Document): void {\n const css = Array.from(dom.querySelectorAll('style'))\n .map((style) => style.textContent ?? '')\n .join('\\n');\n for (const element of Array.from(dom.body.querySelectorAll('[class]'))) {\n const names = element.getAttribute('class')!.split(/\\s+/).filter(Boolean);\n const kept = names.filter((name) => !/^Mso/.test(name) || new RegExp(`\\\\.${name}\\\\b`).test(css));\n if (kept.length === names.length) continue;\n if (kept.length) element.setAttribute('class', kept.join(' '));\n else element.removeAttribute('class');\n }\n}\n\n// ── Bootstrap ───────────────────────────────────────────────────────────\n\n/** Bootstrap 5's `.table.table-bordered`, as an inbox needs it: inline. */\nconst BORDERED_TABLE = ['width: 100%', 'border-collapse: collapse'];\nconst BORDERED_CELL = ['border: 1px solid #dee2e6', 'padding: 8px'];\n\n/** Bordered tables whose borders came from a class no stylesheet here\n defines get them inline; declarations the author wrote win. */\nexport function inlineBootstrapTableBorders(dom: Document): void {\n const css = Array.from(dom.querySelectorAll('style'))\n .map((style) => style.textContent ?? '')\n .join('\\n');\n if (/\\.table-bordered\\b/.test(css)) return;\n\n for (const table of Array.from(dom.body.querySelectorAll('table.table-bordered'))) {\n addDeclarations(table, BORDERED_TABLE);\n for (const cell of Array.from(table.querySelectorAll('td, th'))) {\n if (cell.closest('table') === table) addDeclarations(cell, BORDERED_CELL);\n }\n const kept = table\n .getAttribute('class')!\n .split(/\\s+/)\n .filter((name) => name && name !== 'table' && name !== 'table-bordered');\n if (kept.length) table.setAttribute('class', kept.join(' '));\n else table.removeAttribute('class');\n }\n}\n\n/** Appends declarations an element's style text does not set yet — as text,\n never through the CSSOM (jsdom misreads shorthands). */\nfunction addDeclarations(element: Element, declarations: string[]): void {\n const style = element.getAttribute('style') ?? '';\n const own = new Set(splitDeclarations(style).map(declarationProperty));\n const added = declarations.filter((declaration) => !own.has(declarationProperty(declaration)));\n if (!added.length) return;\n const base = style.trim().replace(/;?$/, style.trim() ? '; ' : '');\n element.setAttribute('style', `${base}${added.join('; ')};`);\n}\n\n// ── inline around blocks ────────────────────────────────────────────────\n\n/** Phrasing elements that carry formatting a block inside them would lose. */\nconst FORMATTING = new Set([\n 'a', 'b', 'strong', 'i', 'em', 'u', 's', 'strike', 'del', 'ins', 'font', 'span', 'sub', 'sup', 'small', 'big',\n]);\n\nconst BLOCK = new Set([\n 'address', 'article', 'aside', 'blockquote', 'center', 'dd', 'div', 'dl', 'dt', 'figure', 'footer', 'form',\n 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'li', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul',\n]);\n\nconst isBlock = (node: Node) => node.nodeType === 1 && BLOCK.has((node as Element).tagName.toLowerCase());\n\n/**\n * `<font color><div>a</div>b</font>` → `<div><font color>a</font></div><font color>b</font>`.\n * Each run of inline children keeps a copy of the wrapper; each block gets\n * one inside it, around its own content — recursively, so a block of blocks\n * hands it on down. An `<hr>` or an empty block takes none.\n */\nexport function lowerInlinesAroundBlocks(root: ParentNode): void {\n // Deepest first: an inner wrapper lowered hands its blocks to the outer one.\n for (const element of Array.from(root.querySelectorAll('*')).reverse()) {\n if (!element.isConnected || !FORMATTING.has(element.tagName.toLowerCase())) continue;\n if (Array.from(element.childNodes).some(isBlock)) lower(element);\n }\n}\n\nfunction lower(wrapper: Element): void {\n const replacement: Node[] = [];\n let run: Node[] = [];\n const flush = () => {\n if (run.some((node) => node.nodeType !== 3 || node.textContent!.trim())) {\n const copy = wrapper.cloneNode(false) as Element;\n copy.append(...run);\n replacement.push(copy);\n } else {\n replacement.push(...run);\n }\n run = [];\n };\n for (const child of Array.from(wrapper.childNodes)) {\n if (!isBlock(child)) {\n run.push(child);\n continue;\n }\n flush();\n wrapInto(child as Element, wrapper);\n replacement.push(child);\n }\n flush();\n wrapper.replaceWith(...replacement);\n}\n\n/** Puts a copy of `wrapper` around a block's content — or, for a block of\n blocks, around each inner block's content. */\nfunction wrapInto(block: Element, wrapper: Element): void {\n if (block.tagName.toLowerCase() === 'hr' || !block.childNodes.length) return;\n if (Array.from(block.childNodes).some(isBlock)) {\n const copy = wrapper.cloneNode(false) as Element;\n copy.append(...Array.from(block.childNodes));\n block.append(copy);\n lower(copy);\n return;\n }\n const copy = wrapper.cloneNode(false) as Element;\n copy.append(...Array.from(block.childNodes));\n block.append(copy);\n}\n","import { DOMOutputSpec, DOMSerializer, Node, Schema, Slice } from 'prosemirror-model';\nimport { Command, Selection } from 'prosemirror-state';\nimport { repairTables } from './extensions/nodes/table';\nimport {\n dropHidden,\n dropZeroSizedWhitespace,\n inheritTextStyles,\n inlineStyles,\n noteOwnWidths,\n unwrapLayoutTables,\n} from './import-html';\nimport { normalizeInlineStyles } from './inline-style';\nimport { promoteMergeTags } from './extensions/nodes/merge-tag';\nimport { bareButtons } from './extensions/nodes/button';\nimport { outlookColumns } from './extensions/nodes/columns';\nimport {\n DocumentEnvelope,\n hasDocumentEnvelope,\n parseDocument,\n readEnvelope,\n serializeDocument,\n} from './envelope';\nimport { ParseMode } from './parse-mode';\nimport { createDOMParser, materializeComments, realizeComments, trimInlineBoxes } from './preserve';\nimport { applyEmailVocabulary } from './email-vocabulary';\nimport { correctStoredMistakes } from './corrections';\n\nconst serializerCache = new WeakMap<Schema, DOMSerializer>();\n\n/**\n * A DOMSerializer honouring `emitDOM` node- and mark-spec overrides:\n * serialization-only renderings (email empty lines as `<div><br></div>`,\n * links without editor-only styling) that must not affect the live editor\n * view, which keeps using `toDOM`.\n */\nfunction getSerializer(schema: Schema): DOMSerializer {\n let serializer = serializerCache.get(schema);\n if (!serializer) {\n const nodes = DOMSerializer.nodesFromSchema(schema);\n for (const [name, type] of Object.entries(schema.nodes)) {\n const emitDOM = type.spec['emitDOM'] as ((node: Node) => DOMOutputSpec) | undefined;\n if (emitDOM) nodes[name] = emitDOM;\n }\n const marks = DOMSerializer.marksFromSchema(schema);\n for (const [name, type] of Object.entries(schema.marks)) {\n // A mark may declare `emitDOM: null` — editor-only chrome that leaves\n // no trace in the email (the merge-tag pill): the serializer then skips\n // the mark and emits its text bare.\n if (!('emitDOM' in type.spec)) continue;\n const emitDOM = type.spec['emitDOM'] as\n ((mark: unknown, inline: boolean) => DOMOutputSpec) | null | undefined;\n if (emitDOM) marks[name] = emitDOM;\n else delete (marks as Record<string, unknown>)[name];\n }\n serializer = new DOMSerializer(nodes, marks);\n // A bare string is documented DOMOutputSpec (\"a text node\") but the\n // fragment serializer predates it — only the static `renderSpec` (the\n // editor view's path) honours it, and `serializeNodeInner` throws trying\n // to use \"{{\" as a tag name. The merge tag's `emitDOM` is exactly that\n // case: `{{path}}` as raw text. Patch the instance so both the fragment\n // walk and mark wrapping route strings to a text node.\n const inner = (\n serializer as unknown as {\n serializeNodeInner(node: Node, options: object): globalThis.Node;\n }\n ).serializeNodeInner.bind(serializer);\n (serializer as unknown as Record<string, unknown>)['serializeNodeInner'] = (\n node: Node,\n options: object,\n ): globalThis.Node => {\n const spec = nodes[node.type.name]?.(node);\n return typeof spec === 'string' ? document.createTextNode(spec) : inner(node, options);\n };\n serializerCache.set(schema, serializer);\n }\n return serializer;\n}\n\n/** Serializes a document (or any node) to an HTML string, e.g. for the email\n body. A document carrying an envelope (see {@link DocumentEnvelope})\n serializes as a whole document — doctype, head and all. */\nexport function serializeToHTML(doc: Node, schema: Schema): string {\n const fragment = getSerializer(schema).serializeFragment(doc.content);\n const container = document.createElement('div');\n container.appendChild(fragment);\n // The Outlook half of the columns hybrid: comments between the columns,\n // where no node's own emit can put them (columns.ts).\n if (schema.nodes['columns']) outlookColumns(container);\n realizeComments(container);\n const body = container.innerHTML;\n const envelope = doc.attrs['envelope'] as DocumentEnvelope | null | undefined;\n return envelope ? serializeDocument(envelope, body) : body;\n}\n\nexport interface ParseOptions {\n /** `repair` (this function's default — canonical form), `email` (the\n editor's default — the email vocabulary, kept exactly as authored) or\n `preserve` (anything but executable content). See {@link ParseMode}. */\n mode?: ParseMode;\n}\n\n/**\n * Parses an HTML string into a document conforming to the schema.\n *\n * - `repair` (the default here; paste, seeds, templates): parsing is repair\n * (principle 2). A builder's export leans on its stylesheet, on wrapper\n * tables and on hiding what a client cannot show; the canonical schema\n * reads none of those, so the import pipeline (import-html.ts) folds,\n * unwraps and drops them first.\n * - `email` (the editor's default) and `preserve`: the markup is kept as\n * authored — comments survive as nodes, a document envelope (`<!doctype>`,\n * `<html>`, `<head>`, `<body>` attributes) lands on the document node's\n * `envelope` attribute, and `email` first corrects what another editor\n * stored wrongly (corrections.ts: `mailto://`, Word's `<o:p>`, Bootstrap\n * borders, an inline around blocks, a video embed) and then drops whatever\n * no floor client applies (email-vocabulary.ts).\n *\n * Every mode then shares the structural repairs. Tables are where foreign\n * markup breaks the rules hardest: real mail arrives with rows of unequal\n * length and spans that reach past the grid, and `repairTables` normalizes\n * the composer's own tables so every pure consumer of the parser —\n * `importedDocument`, `replyDocument`, the source pane's round trip — sees\n * the same rectangle the editor would. `{{path}}` tokens in running text\n * become `mergeTag` pills (`promoteMergeTags`): the serialized email carries\n * the raw Handlebars-flavoured text, and parse restores the structured form.\n * Button atoms lose marks the parser painted from their own `font-weight`\n * (`bareButtons`) — the box is already bold.\n */\nexport function parseHTML(html: string, schema: Schema, options: ParseOptions = {}): Node {\n const mode = options.mode ?? 'repair';\n const parser = createDOMParser(schema, mode);\n let parsed: Node;\n\n if (mode === 'repair') {\n const dom = new window.DOMParser().parseFromString(html, 'text/html');\n // First: what an engine's CSSOM might misread is rewritten so every\n // engine reads it alike (a `background` shorthand, a box's longhand\n // after its shorthand) — the import must come out the same wherever\n // it runs.\n normalizeInlineStyles(dom.body);\n noteOwnWidths(dom.body);\n inlineStyles(dom);\n dropHidden(dom.body);\n dropZeroSizedWhitespace(dom.body);\n unwrapLayoutTables(dom.body);\n // `<a> home </a>`: a client drops a box's edge spaces, and left in they\n // would collapse into the link beside them, joining a navbar's items.\n trimInlineBoxes(dom.body);\n inheritTextStyles(dom.body);\n parsed = parser.parse(dom.body);\n } else {\n const dom = parseDocument(html);\n if (mode === 'email') {\n // Before the vocabulary: an embed becomes a link before it is refused.\n correctStoredMistakes(dom);\n applyEmailVocabulary(dom.documentElement);\n }\n materializeComments(dom.body);\n trimInlineBoxes(dom.body);\n const docType = schema.topNodeType;\n const topNode =\n hasDocumentEnvelope(html) && docType.spec.attrs?.['envelope']\n ? docType.create({ envelope: readEnvelope(dom) })\n : undefined;\n parsed = parser.parse(dom.body, topNode ? { topNode } : undefined);\n }\n return bareButtons(promoteMergeTags(repairTables(parsed, schema), schema), schema);\n}\n\n/**\n * A command inserting an HTML fragment at the selection — a template, a\n * snippet — parsed exactly as {@link parseHTML} parses a whole document, so\n * tables are repaired and merge tags promoted on the way in. Block content\n * dropped into an empty paragraph takes its place.\n */\nexport const insertHTML =\n (html: string, options?: ParseOptions): Command =>\n (state, dispatch) => {\n const doc = parseHTML(html, state.schema, options);\n dispatch?.(state.tr.replaceSelection(new Slice(doc.content, 0, 0)).scrollIntoView());\n return true;\n };\n\n/** A command that puts `html` in the whole document's place — an example\n loaded over what is written, as one undoable change; the caret lands at\n its end. A whole document parsed in the `email` or `preserve` mode brings\n its envelope along. */\nexport const replaceHTML =\n (html: string, options?: ParseOptions): Command =>\n (state, dispatch) => {\n const doc = parseHTML(html, state.schema, options);\n if (dispatch) {\n const tr = state.tr.replaceWith(0, state.doc.content.size, doc.content);\n if (\n JSON.stringify(state.doc.attrs['envelope'] ?? null) !==\n JSON.stringify(doc.attrs['envelope'] ?? null)\n ) {\n tr.setDocAttribute('envelope', doc.attrs['envelope'] ?? null);\n }\n dispatch(tr.setSelection(Selection.atEnd(tr.doc)).scrollIntoView());\n }\n return true;\n };\n","/**\n * MJML's \"Worldly\" reference template, compiled — the target the preserving\n * parse is measured against: a document envelope with head styles and media\n * queries, Outlook conditional comments in head and body, nested layout\n * tables with legacy attributes, VML inside conditionals, a checkbox-driven\n * navbar, images with `height=\"auto\"`. It must survive the round trip and\n * render identically in every pane.\n */\nexport const MJML_WORLDLY_HTML = `<!doctype html>\n<html lang=\"und\" dir=\"auto\" xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">\n\n<head>\n <title></title>\n <!--[if !mso]><!-->\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <!--<![endif]-->\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <style type=\"text/css\">\n #outlook a {\n padding: 0;\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-text-size-adjust: 100%;\n -ms-text-size-adjust: 100%;\n }\n\n table,\n td {\n border-collapse: collapse;\n mso-table-lspace: 0pt;\n mso-table-rspace: 0pt;\n }\n\n img {\n border: 0;\n height: auto;\n line-height: 100%;\n outline: none;\n text-decoration: none;\n -ms-interpolation-mode: bicubic;\n }\n\n p {\n display: block;\n margin: 13px 0;\n }\n </style>\n <!--[if mso]>\n <noscript>\n <xml>\n <o:OfficeDocumentSettings>\n <o:AllowPNG/>\n <o:PixelsPerInch>96</o:PixelsPerInch>\n </o:OfficeDocumentSettings>\n </xml>\n </noscript>\n <![endif]-->\n <!--[if lte mso 11]>\n <style type=\"text/css\">\n .mj-outlook-group-fix { width:100% !important; }\n </style>\n <![endif]-->\n <!--[if !mso]><!-->\n <link href=\"https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700\" rel=\"stylesheet\" type=\"text/css\">\n <style type=\"text/css\">\n @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);\n </style>\n <!--<![endif]-->\n <style type=\"text/css\">\n @media only screen and (min-width:480px) {\n .mj-column-per-100 {\n width: 100% !important;\n max-width: 100%;\n }\n\n .mj-column-per-50 {\n width: 50% !important;\n max-width: 50%;\n }\n\n .mj-column-per-33 {\n width: 33% !important;\n max-width: 33%;\n }\n\n .mj-column-per-33-33333333333333 {\n width: 33.33333333333333% !important;\n max-width: 33.33333333333333%;\n }\n }\n </style>\n <style media=\"screen and (min-width:480px)\">\n .moz-text-html .mj-column-per-100 {\n width: 100% !important;\n max-width: 100%;\n }\n\n .moz-text-html .mj-column-per-50 {\n width: 50% !important;\n max-width: 50%;\n }\n\n .moz-text-html .mj-column-per-33 {\n width: 33% !important;\n max-width: 33%;\n }\n\n .moz-text-html .mj-column-per-33-33333333333333 {\n width: 33.33333333333333% !important;\n max-width: 33.33333333333333%;\n }\n </style>\n <style type=\"text/css\">\n @media only screen and (max-width:479px) {\n table.mj-full-width-mobile {\n width: 100% !important;\n }\n\n td.mj-full-width-mobile {\n width: auto !important;\n }\n }\n\n noinput.mj-menu-checkbox {\n display: block !important;\n max-height: none !important;\n visibility: visible !important;\n }\n\n @media only screen and (max-width:479px) {\n .mj-menu-checkbox[type=\"checkbox\"]~.mj-inline-links {\n display: none !important;\n }\n\n .mj-menu-checkbox[type=\"checkbox\"]:checked~.mj-inline-links,\n .mj-menu-checkbox[type=\"checkbox\"]~.mj-menu-trigger {\n display: block !important;\n max-width: none !important;\n max-height: none !important;\n font-size: inherit !important;\n }\n\n .mj-menu-checkbox[type=\"checkbox\"]~.mj-inline-links>a {\n display: block !important;\n }\n\n .mj-menu-checkbox[type=\"checkbox\"]:checked~.mj-menu-trigger .mj-menu-icon-close {\n display: block !important;\n }\n\n .mj-menu-checkbox[type=\"checkbox\"]:checked~.mj-menu-trigger .mj-menu-icon-open {\n display: none !important;\n }\n }\n </style>\n</head>\n\n<body style=\"word-spacing:normal;background-color:#d2eeff;\">\n <div aria-roledescription=\"email\" role=\"article\" lang=\"und\" dir=\"auto\" style=\"word-spacing:normal;background-color:#d2eeff;\">\n <!--[if mso | IE]><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:0px;padding-bottom:20px;padding-top:20px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"width:600px;\" ><![endif]-->\n <div class=\"mj-column-per-100 mj-outlook-group-fix\" style=\"font-size:0;line-height:0;text-align:left;display:inline-block;width:100%;direction:ltr;\">\n <!--[if mso | IE]><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" ><tr><td style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:50%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" style=\"font-size:0px;padding:0 20px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:11px;line-height:1;text-align:left;color:#000000;\"><a href=\"https://mjml.io\" style=\"text-decoration: none; color: inherit;\">[[HEADLINE]]</a></div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:50%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"right\" style=\"font-size:0px;padding:0 20px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:11px;line-height:1;text-align:right;color:#000000;\"><a href=\"https://mjml.io\" style=\"text-decoration: none; color: inherit;\">[[PERMALINK_LABEL]]</a></div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#ffffff\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#ffffff;background-color:#ffffff;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#ffffff;background-color:#ffffff;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:0px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:600px;\" ><![endif]-->\n <div class=\"mj-column-per-100 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 0;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:105px;\">\n <img alt=\"Worldly logo\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-logo.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"105\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#ffe118\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#ffe118;background-color:#ffe118;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#ffe118;background-color:#ffe118;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:20px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:560px;\" ><![endif]-->\n <div class=\"mj-column-per-100 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;word-break:break-word;\">\n <!--[if !mso]><!--><input type=\"checkbox\" id=\"29f3f9bba1fb0a37\" class=\"mj-menu-checkbox\" style=\"display:none !important; max-height:0; visibility:hidden;\"><!--<![endif]-->\n <div class=\"mj-menu-trigger\" style=\"display:none;max-height:0px;max-width:0px;font-size:0px;overflow:hidden;\">\n <label for=\"29f3f9bba1fb0a37\" class=\"mj-menu-label\" style=\"display:block;cursor:pointer;mso-hide:all;-moz-user-select:none;user-select:none;color:#444444;font-size:30px;font-family:Ubuntu, Helvetica, Arial, sans-serif;text-transform:uppercase;text-decoration:none;line-height:30px;padding:10px;\" align=\"center\">\n <span class=\"mj-menu-icon-open\" style=\"mso-hide:all;\"> ☰ </span>\n <span class=\"mj-menu-icon-close\" style=\"display:none;mso-hide:all;\"> ⊗ </span>\n </label>\n </div>\n <div class=\"mj-inline-links\" style>\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td style=\"padding:0 35px;\" class=\"\" ><![endif]-->\n <a class=\"mj-link\" href=\"https://mjml.iohttps://mjml.io\" target=\"_blank\" style=\"display: inline-block; color: #000000; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 12px; font-weight: bold; line-height: 22px; text-decoration: none; text-transform: uppercase; padding: 0 35px;\"> home </a>\n <!--[if mso | IE]></td><td style=\"padding:0 35px;\" class=\"\" ><![endif]-->\n <a class=\"mj-link\" href=\"https://mjml.iohttps://mjml.io\" target=\"_blank\" style=\"display: inline-block; color: #000000; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 12px; font-weight: bold; line-height: 22px; text-decoration: none; text-transform: uppercase; padding: 0 35px;\"> Summer deals </a>\n <!--[if mso | IE]></td><td style=\"padding:0 35px;\" class=\"\" ><![endif]-->\n <a class=\"mj-link\" href=\"https://mjml.iohttps://mjml.io\" target=\"_blank\" style=\"display: inline-block; color: #000000; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 12px; font-weight: bold; line-height: 22px; text-decoration: none; text-transform: uppercase; padding: 0 35px;\"> Our blog </a>\n <!--[if mso | IE]></td><td style=\"padding:0 35px;\" class=\"\" ><![endif]-->\n <a class=\"mj-link\" href=\"https://mjml.iohttps://mjml.io\" target=\"_blank\" style=\"display: inline-block; color: #000000; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 12px; font-weight: bold; line-height: 22px; text-decoration: none; text-transform: uppercase; padding: 0 35px;\"> Follow us </a>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><v:rect style=\"width:600px;\" xmlns:v=\"urn:schemas-microsoft-com:vml\" fill=\"true\" stroke=\"false\"><v:fill origin=\"0, -0.5\" position=\"0, -0.5\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-hero.jpg\" type=\"frame\" size=\"1,1\" aspect=\"atleast\" /><v:textbox style=\"mso-fit-shape-to-text:true\" inset=\"0,0,0,0\"><![endif]-->\n <div style=\"background:url('https://static.mailjet.com/mjml-website/templates/worldly-hero.jpg') center top / cover no-repeat;background-position:center top;background-repeat:no-repeat;background-size:cover;margin:0px auto;max-width:600px;\">\n <div style=\"line-height:0;font-size:0;\">\n <table align=\"center\" background=\"https://static.mailjet.com/mjml-website/templates/worldly-hero.jpg\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:url('https://static.mailjet.com/mjml-website/templates/worldly-hero.jpg') center top / cover no-repeat;background-position:center top;background-repeat:no-repeat;background-size:cover;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:20px 0;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:28px;line-height:32px;text-align:center;color:#ffffff;\">ARE YOU <br> SEASCAPE?</div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:bottom;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:bottom;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:bottom;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;padding-top:180px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:28px;line-height:32px;text-align:center;color:#ffffff;\">OR <br> CITYSCAPE?</div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <!--[if mso | IE]></v:textbox></v:rect></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#ffffff\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#ffffff;background-color:#ffffff;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#ffffff;background-color:#ffffff;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:20px 0;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:15px;line-height:1;text-align:center;color:#BD8714;\">\n <p>SUNNIEST DESTINATIONS</p>\n </div>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:240px;\">\n <img alt=\"Maldives, Corse : -15%\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-offer1.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"240\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:20px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:separate;line-height:100%;\">\n <tbody>\n <tr>\n <td align=\"center\" bgcolor=\"#bd8714\" role=\"presentation\" style=\"border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:#bd8714;\" valign=\"middle\">\n <a href=\"https://mjml.io\" style=\"display: inline-block; background: #bd8714; color: #FFFFFF; font-family: Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 10px 25px; mso-padding-alt: 0px; border-radius: 3px;\" target=\"_blank\"> BOOK NOW </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:240px;\">\n <img alt=\"Tahiti, Bora Bora : -10 %\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-offer2.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"240\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:20px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:separate;line-height:100%;\">\n <tbody>\n <tr>\n <td align=\"center\" bgcolor=\"#bd8714\" role=\"presentation\" style=\"border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:#bd8714;\" valign=\"middle\">\n <a href=\"https://mjml.io\" style=\"display: inline-block; background: #bd8714; color: #FFFFFF; font-family: Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 10px 25px; mso-padding-alt: 0px; border-radius: 3px;\" target=\"_blank\"> BOOK NOW </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:15px;line-height:1;text-align:center;color:#BD8714;\">\n <p>CHEAP CITY TOUR</p>\n </div>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:240px;\">\n <img alt=\"Stockholm, Rome : from 162 € / day\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-offer3.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"240\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:20px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:separate;line-height:100%;\">\n <tbody>\n <tr>\n <td align=\"center\" bgcolor=\"#48b6bf\" role=\"presentation\" style=\"border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:#48b6bf;\" valign=\"middle\">\n <a href=\"https://mjml.io\" style=\"display: inline-block; background: #48b6bf; color: #FFFFFF; font-family: Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 10px 25px; mso-padding-alt: 0px; border-radius: 3px;\" target=\"_blank\"> BOOK NOW </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:240px;\">\n <img alt=\"New York, London : -30 %\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-offer4.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"240\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:20px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:separate;line-height:100%;\">\n <tbody>\n <tr>\n <td align=\"center\" bgcolor=\"#48b6bf\" role=\"presentation\" style=\"border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:#48b6bf;\" valign=\"middle\">\n <a href=\"https://mjml.io\" style=\"display: inline-block; background: #48b6bf; color: #FFFFFF; font-family: Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: normal; line-height: 120%; margin: 0; text-decoration: none; text-transform: none; padding: 10px 25px; mso-padding-alt: 0px; border-radius: 3px;\" target=\"_blank\"> BOOK NOW </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#ffffff\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#ffffff;background-color:#ffffff;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#ffffff;background-color:#ffffff;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:20px 0;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:250px;\">\n <a href=\"https://mjml.io\" target=\"_blank\" style=\"text-decoration: none; color: inherit;\">\n <img alt=\"NEW : Donwload your city guide\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-image1.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"250\" height=\"auto\">\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:300px;\" ><![endif]-->\n <div class=\"mj-column-per-50 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:13px;font-weight:bold;line-height:1;text-align:center;color:#000000;\">\n <p>RATE YOUR STAY !</p>\n </div>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:131px;\">\n <a href=\"https://mjml.io\" target=\"_blank\" style=\"text-decoration: none; color: inherit;\">\n <img alt=\"Book rate\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-image2.jpg\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"131\" height=\"auto\">\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#4b525c\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#4b525c;background-color:#4b525c;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#4b525c;background-color:#4b525c;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:0px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:198px;\" ><![endif]-->\n <div class=\"mj-column-per-33 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:30px;\">\n <img alt=\"Best companies for your flights\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-icon1.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"30\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:15px;line-height:1;text-align:center;color:#ffffff;\">\n <p> BEST COMPANIES FOR YOUR FLIGHTS </p>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:198px;\" ><![endif]-->\n <div class=\"mj-column-per-33 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:29px;\">\n <img alt=\"Insurances included\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-icon2.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"29\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:15px;line-height:1;text-align:center;color:#ffffff;\">\n <p> INSURANCES INCLUDED </p>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:198px;\" ><![endif]-->\n <div class=\"mj-column-per-33 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:31px;\">\n <img alt=\"Hotels best selection\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-icon3.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"31\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0 25px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif, Helvetica, Arial, sans-serif;font-size:15px;line-height:1;text-align:center;color:#ffffff;\">\n <p> HOTELS BEST SELECTION </p>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" bgcolor=\"#4395b1\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"background:#4395b1;background-color:#4395b1;margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"background:#4395b1;background-color:#4395b1;width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:0px;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:200px;\" ><![endif]-->\n <div class=\"mj-column-per-33-33333333333333 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:97px;\">\n <img alt=\"Call us : 0 800 123 456\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-footerlogo.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"97\" height=\"auto\">\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:200px;\" ><![endif]-->\n <div class=\"mj-column-per-33-33333333333333 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:117px;\">\n <a href=\"https://mjml.io\" target=\"_blank\" style=\"text-decoration: none; color: inherit;\">\n <img alt=\"Meet us : find an agency\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-contact1.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"117\" height=\"auto\">\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td><td class=\"\" style=\"vertical-align:top;width:200px;\" ><![endif]-->\n <div class=\"mj-column-per-33-33333333333333 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:10px 25px;word-break:break-word;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"border-collapse:collapse;border-spacing:0px;\">\n <tbody>\n <tr>\n <td style=\"width:110px;\">\n <a href=\"https://mjml.io\" target=\"_blank\" style=\"text-decoration: none; color: inherit;\">\n <img alt=\"ASK US : find an expert\" src=\"https://static.mailjet.com/mjml-website/templates/worldly-contact2.png\" style=\"border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;\" width=\"110\" height=\"auto\">\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"\" role=\"presentation\" style=\"width:600px;\" width=\"600\" ><tr><td style=\"line-height:0px;font-size:0px;mso-line-height-rule:exactly;\"><![endif]-->\n <div style=\"margin:0px auto;max-width:600px;\">\n <table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style=\"width:100%;\">\n <tbody>\n <tr>\n <td style=\"direction:ltr;font-size:0px;padding:20px 0;text-align:center;\">\n <!--[if mso | IE]><table role=\"presentation\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"\" style=\"vertical-align:top;width:600px;\" ><![endif]-->\n <div class=\"mj-column-per-100 mj-outlook-group-fix\" style=\"font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td style=\"vertical-align:top;padding:0px;\">\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" style width=\"100%\">\n <tbody>\n <tr>\n <td align=\"center\" style=\"font-size:0px;padding:0px;word-break:break-word;\">\n <div style=\"font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:11px;line-height:1;text-align:center;color:#000000;\">[[DELIVERY_INFO]] <p>[[POSTAL_ADDRESS]]</p>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n <!--[if mso | IE]></td></tr></table><![endif]-->\n </div>\n</body>\n\n</html>\n`;\n","/**\n * The client-support data module (M3): a curated, versioned subset of what\n * caniemail documents about our floor clients. Pure data + lookups — the\n * lint engine, tooltips and (later) autocomplete all read from here.\n *\n * Curation rule: only entries we are confident about, phrased as what\n * *actually happens* in the client. Accuracy beats coverage.\n */\n\nexport type EmailClient = 'gmail' | 'outlook-desktop' | 'outlook-web' | 'apple-mail' | 'yahoo';\n\nexport const CLIENT_LABELS: Record<EmailClient, string> = {\n gmail: 'Gmail',\n 'outlook-desktop': 'Outlook (Windows)',\n 'outlook-web': 'Outlook.com',\n 'apple-mail': 'Apple Mail',\n yahoo: 'Yahoo Mail',\n};\n\nexport function clientList(clients: EmailClient[]): string {\n return clients.map((client) => CLIENT_LABELS[client]).join(', ');\n}\n\nexport interface CssSupportIssue {\n /** Lower-cased CSS property this entry describes. */\n property: string;\n /** Restrict to matching values (e.g. display:flex, background:url(…)). */\n valuePattern?: RegExp;\n /** Restrict to these tags (e.g. padding is fine on table cells). */\n onTags?: string[];\n /** Clients where the declaration does not do what it says. */\n ignoredBy: EmailClient[];\n /** What actually happens — this is the tooltip. */\n note: string;\n}\n\nexport const CSS_SUPPORT: CssSupportIssue[] = [\n {\n property: 'max-width',\n ignoredBy: ['outlook-desktop'],\n note: 'it sizes from the width attribute instead — pair both (the hybrid) or the cap is lost',\n },\n {\n property: 'padding',\n onTags: ['div', 'p', 'span', 'a'],\n ignoredBy: ['outlook-desktop'],\n note: 'the Word engine only honours padding on table cells — a button gets its size from borders in its background colour instead',\n },\n {\n property: 'display',\n valuePattern: /^inline-block\\b/i,\n ignoredBy: ['outlook-desktop'],\n note: 'renders inline, or stacks — never side by side; the fluid columns pattern (width: 100% + max-width) stacks on purpose there, and a bordered anchor button keeps its box',\n },\n {\n property: 'border-radius',\n ignoredBy: ['outlook-desktop'],\n note: 'corners render square',\n },\n {\n property: 'background-image',\n ignoredBy: ['outlook-desktop'],\n note: 'image backgrounds need VML there; the background color shows instead',\n },\n {\n property: 'background',\n valuePattern: /url\\s*\\(/i,\n ignoredBy: ['outlook-desktop'],\n note: 'image backgrounds need VML there; the background color shows instead',\n },\n {\n property: 'position',\n ignoredBy: ['outlook-desktop', 'gmail'],\n note: 'elements fall back into normal flow',\n },\n {\n property: 'display',\n valuePattern: /^(inline-)?(flex|grid)\\b/i,\n ignoredBy: ['outlook-desktop', 'gmail'],\n note: 'modern layout falls back to block flow — use spongy inline-block columns instead',\n },\n {\n property: 'float',\n ignoredBy: ['outlook-desktop'],\n note: 'content stacks instead of wrapping around',\n },\n {\n property: 'opacity',\n ignoredBy: ['outlook-desktop'],\n note: 'renders fully opaque',\n },\n {\n property: 'box-shadow',\n ignoredBy: ['outlook-desktop'],\n note: 'shadows simply vanish',\n },\n {\n property: 'transform',\n ignoredBy: ['outlook-desktop', 'gmail'],\n note: 'renders untransformed in place',\n },\n {\n property: 'animation',\n ignoredBy: ['outlook-desktop', 'gmail'],\n note: 'nothing animates; the first frame is the email',\n },\n {\n property: 'font',\n ignoredBy: ['outlook-desktop'],\n note: 'the Word engine misreads the shorthand — set font-size and font-family separately',\n },\n {\n property: 'line-height',\n ignoredBy: ['outlook-desktop'],\n note: 'the Word engine may substitute its own unless mso-line-height-rule is set',\n },\n];\n\n/** Issues that apply to a concrete declaration on a concrete tag. */\nexport function findCssIssues(property: string, value: string, tag: string): CssSupportIssue[] {\n return CSS_SUPPORT.filter(\n (issue) =>\n issue.property === property &&\n (!issue.valuePattern || issue.valuePattern.test(value)) &&\n (!issue.onTags || issue.onTags.includes(tag)),\n );\n}\n\n/** Attributes worth suggesting per email-safe tag; `'*'` applies to all.\n The schema knows what is legal — autocomplete offers only that. */\nexport const EMAIL_TAG_ATTRIBUTES: Record<string, string[]> = {\n '*': ['style', 'title'],\n a: ['href', 'target', 'rel'],\n img: ['src', 'alt', 'width'],\n};\n\n/** Style properties safe enough to *suggest*. Anything here that still has\n a CSS_SUPPORT entry (max-width, padding) is legitimate but situational —\n the lint explains the situation when it applies. */\nexport const EMAIL_SAFE_STYLE_PROPERTIES: string[] = [\n 'background-color',\n 'border',\n 'color',\n 'font-family',\n 'font-size',\n 'font-style',\n 'font-weight',\n 'height',\n 'letter-spacing',\n 'margin-left',\n 'max-width',\n 'padding',\n 'text-align',\n 'text-decoration',\n 'width',\n];\n\n/** Gmail clips messages above ~102 KB — the recipient sees a truncated email\n with a \"[View entire message]\" link, and tracking of anything below the\n clip is lost. The hardest size constraint in email. */\nexport const GMAIL_CLIP_BYTES = 102 * 1024;\n\nexport interface SizeBudget {\n bytes: number;\n limit: number;\n level: 'ok' | 'warning' | 'error';\n}\n\n/** UTF-8 size of the canonical HTML against the Gmail clipping limit;\n warning from 80% of the budget, error above it. */\nexport function emailSizeBudget(html: string): SizeBudget {\n const bytes = new TextEncoder().encode(html).length;\n const level =\n bytes > GMAIL_CLIP_BYTES ? 'error' : bytes > GMAIL_CLIP_BYTES * 0.8 ? 'warning' : 'ok';\n return { bytes, limit: GMAIL_CLIP_BYTES, level };\n}\n","/** Escapes text for an HTML text position. */\nexport function escapeText(text: string): string {\n return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n}\n\n/** Escapes a value for a double-quoted HTML attribute. */\nexport function escapeAttribute(value: string): string {\n return value.replace(/&/g, '&').replace(/\"/g, '"');\n}\n","/**\n * A tiny HTML source language: scanner, email-focused linter and formatter.\n * Powers the HTML source editor kit — syntax highlighting and diagnostics run\n * on the scanner, while the formatter pretty-prints through the browser's own\n * parser so its output is always well-formed.\n */\nimport { clientList, findCssIssues } from './client-support';\nimport { normalizeMergeTagText } from './extensions/nodes/merge-tag';\nimport { escapeAttribute, escapeText } from './utils/escape';\nimport { VOID_TAGS } from './html-tags';\nimport {\n isEmailAttribute,\n isEmailCssProperty,\n isEmailTag,\n splitDeclarations as splitStyleExactly,\n} from './email-vocabulary';\nimport {\n hasDocumentEnvelope,\n isBooleanAttribute,\n openTag as tagString,\n parseDocument,\n readEnvelope,\n} from './envelope';\nimport { normalizeCommentText, normalizeCss } from './preserve';\nimport { ParseMode } from './parse-mode';\n\nexport { VOID_TAGS };\n\nexport type HtmlTokenType =\n 'delimiter' | 'tagName' | 'attributeName' | 'attributeValue' | 'comment';\n\nexport interface HtmlToken {\n type: HtmlTokenType;\n from: number;\n to: number;\n}\n\nexport interface HtmlTag {\n /** Lower-cased tag name. */\n name: string;\n kind: 'open' | 'close';\n selfClosing: boolean;\n /** False when the tag never reaches its `>` (e.g. `<div` at end of input). */\n terminated: boolean;\n from: number;\n to: number;\n nameFrom: number;\n nameTo: number;\n}\n\nexport interface HtmlScan {\n tokens: HtmlToken[];\n tags: HtmlTag[];\n}\n\n/** The responsiveness ledger's floor: below it iOS Mail auto-inflates text\n and reflows the layout. The picker never offers less; a hand-typed size\n is linted. */\nexport const MIN_FONT_SIZE = 14;\n\n/** The ledger's line budget: about this many characters fit a 320px line at\n 14px. A longer run with no break point forces the email to scroll\n sideways. */\nexport const MAX_UNBROKEN_RUN = 40;\n\n/** How the source is read: the parse mode of the visual editor it feeds.\n `repair` (the default) lints and formats for the canonical import;\n `email` and `preserve` for markup kept as authored — the document\n envelope formats whole, a wide style breaks reversibly, comments are\n content, and `email` warns on whatever the email vocabulary drops. */\nexport interface SourceOptions {\n mode?: ParseMode;\n}\n\nexport interface HtmlDiagnostic {\n from: number;\n to: number;\n severity: 'error' | 'warning';\n message: string;\n}\n\n/** Tags the composer's own blocks are built from — the autocomplete's\n suggestions. What the parse *accepts* is wider: see `email-vocabulary.ts`. */\nexport const EMAIL_SAFE_TAGS = new Set([\n 'a',\n 'b',\n 'blockquote',\n 'br',\n 'del',\n 'div',\n 'em',\n 'font',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'hr',\n 'i',\n 'img',\n 'li',\n 'ol',\n 'p',\n 's',\n 'span',\n 'strike',\n 'strong',\n 'u',\n 'ul',\n // Tables are the most client-compatible layout there is.\n 'table',\n 'thead',\n 'tbody',\n 'tfoot',\n 'tr',\n 'td',\n 'th',\n]);\n\nconst NAME_START = /[a-zA-Z]/;\nconst NAME_CHAR = /[-\\w]/;\nconst WHITESPACE = /\\s/;\n\n/** Single-pass scanner producing highlight tokens and a tag event stream. */\nexport function scanHTML(source: string): HtmlScan {\n const tokens: HtmlToken[] = [];\n const tags: HtmlTag[] = [];\n let i = 0;\n\n while (i < source.length) {\n const lt = source.indexOf('<', i);\n if (lt === -1) break;\n\n if (source.startsWith('<!--', lt)) {\n const end = source.indexOf('-->', lt + 4);\n const to = end === -1 ? source.length : end + 3;\n tokens.push({ type: 'comment', from: lt, to });\n i = to;\n continue;\n }\n\n const isClose = source[lt + 1] === '/';\n const nameFrom = lt + (isClose ? 2 : 1);\n if (!NAME_START.test(source[nameFrom] ?? '')) {\n // A lone `<` in text (e.g. \"a < b\") is not markup.\n i = lt + 1;\n continue;\n }\n\n tokens.push({ type: 'delimiter', from: lt, to: nameFrom });\n let j = nameFrom;\n while (j < source.length && NAME_CHAR.test(source[j])) j++;\n const nameTo = j;\n tokens.push({ type: 'tagName', from: nameFrom, to: nameTo });\n\n let terminated = false;\n let selfClosing = false;\n scanAttributes: while (j < source.length) {\n while (j < source.length && WHITESPACE.test(source[j])) j++;\n if (j >= source.length) break;\n\n switch (source[j]) {\n case '>':\n tokens.push({ type: 'delimiter', from: j, to: j + 1 });\n j += 1;\n terminated = true;\n break scanAttributes;\n case '/':\n if (source[j + 1] === '>') {\n tokens.push({ type: 'delimiter', from: j, to: j + 2 });\n j += 2;\n terminated = true;\n selfClosing = true;\n break scanAttributes;\n }\n j++;\n continue;\n case '<':\n // Runaway tag: a new tag starts before this one was terminated.\n break scanAttributes;\n case '=': {\n tokens.push({ type: 'delimiter', from: j, to: j + 1 });\n j++;\n while (j < source.length && WHITESPACE.test(source[j])) j++;\n const quote = source[j];\n if (quote === '\"' || quote === \"'\") {\n const closing = source.indexOf(quote, j + 1);\n const to = closing === -1 ? source.length : closing + 1;\n tokens.push({ type: 'attributeValue', from: j, to });\n j = to;\n } else {\n const start = j;\n while (j < source.length && !/[\\s<>]/.test(source[j])) j++;\n if (j > start) tokens.push({ type: 'attributeValue', from: start, to: j });\n }\n continue;\n }\n default: {\n const start = j;\n while (j < source.length && !/[\\s=/<>]/.test(source[j])) j++;\n if (j === start)\n j++; // stray character; never stall\n else tokens.push({ type: 'attributeName', from: start, to: j });\n }\n }\n }\n\n tags.push({\n name: source.slice(nameFrom, nameTo).toLowerCase(),\n kind: isClose ? 'close' : 'open',\n selfClosing,\n terminated,\n from: lt,\n to: j,\n nameFrom,\n nameTo,\n });\n i = j;\n }\n\n return { tokens, tags };\n}\n\n/** A named attribute within a tag's span, with the source range of its\n value: `null` when absent, empty value at the name's range when the\n attribute is present without one. */\nfunction attributeValueToken(\n source: string,\n scan: HtmlScan,\n tag: HtmlTag,\n name: string,\n): { value: string; from: number; to: number } | null {\n let nameToken: HtmlToken | null = null;\n for (const token of scan.tokens) {\n if (token.from < tag.from || token.to > tag.to) continue;\n if (token.type === 'attributeName') {\n if (nameToken) break; // the named attribute came and went without a value\n if (source.slice(token.from, token.to).toLowerCase() === name) nameToken = token;\n } else if (token.type === 'attributeValue' && nameToken) {\n // Range of the value *content*, quotes excluded, so lint positions can\n // point at spans inside the value.\n const raw = source.slice(token.from, token.to);\n const quoted = raw.startsWith('\"') || raw.startsWith(\"'\");\n const closed = quoted && raw.length > 1 && raw.endsWith(raw[0]);\n return {\n value: raw.slice(quoted ? 1 : 0, closed ? -1 : undefined),\n from: token.from + (quoted ? 1 : 0),\n to: token.to - (closed ? 1 : 0),\n };\n }\n }\n return nameToken ? { value: '', from: nameToken.from, to: nameToken.to } : null;\n}\n\n/** The value of a named attribute within a tag's span: `null` when absent,\n `''` when present without a value. */\n/** Whether the tag carries the attribute at all — with a value, an empty one,\n or bare. */\nfunction hasAttribute(source: string, scan: HtmlScan, tag: HtmlTag, name: string): boolean {\n return scan.tokens.some(\n (token) =>\n token.type === 'attributeName' &&\n token.from >= tag.from &&\n token.to <= tag.to &&\n source.slice(token.from, token.to).toLowerCase() === name,\n );\n}\n\nfunction attributeValue(source: string, scan: HtmlScan, tag: HtmlTag, name: string): string | null {\n return attributeValueToken(source, scan, tag, name)?.value ?? null;\n}\n\n/** Balance-checks the tag stream: unclosed tags, stray closers, closed void\n elements, and an error for a comment that never closes. What else is\n flagged follows the parse mode (see {@link SourceOptions}): in `repair`,\n tags outside the email-safe set and comments the schema drops; in\n `email`, every tag, attribute and CSS property outside the email\n vocabulary — exactly what that parse drops (the document envelope is\n inside it: Gmail strips the head, and that is fine). */\nexport function lintHTML(\n source: string,\n scan: HtmlScan = scanHTML(source),\n options: SourceOptions = {},\n): HtmlDiagnostic[] {\n const mode = options.mode ?? 'repair';\n const vocabulary = mode === 'email';\n const diagnostics: HtmlDiagnostic[] = [];\n const stack: HtmlTag[] = [];\n\n // Ambiguous ampersands in text: entity-like but missing the ';'. Browsers\n // still decode the legacy forms ('©' → ©, '©' → ©), silently\n // changing the text. A plain '&' (followed by whitespace or punctuation)\n // is safe — the round trip normalizes it to '&' without changing\n // meaning, so it is not worth a warning.\n for (const [regionFrom, regionTo] of textRegions(source, scan)) {\n const region = source.slice(regionFrom, regionTo);\n // Each form terminates on its own alphabet: '&b' decodes as '&' + 'b'.\n const ambiguous =\n /&(?:#x[0-9a-fA-F]+(?![0-9a-fA-F;])|#\\d+(?![\\d;])|[a-zA-Z][a-zA-Z0-9]*(?![a-zA-Z0-9;]))/g;\n for (let match; (match = ambiguous.exec(region));) {\n diagnostics.push({\n from: regionFrom + match.index,\n to: regionFrom + match.index + match[0].length,\n severity: 'warning',\n message: `Ambiguous \"${match[0]}\" — legacy entities decode without the \";\"; write \"&${match[0].slice(1)}\" for literal text or add the \";\"`,\n });\n }\n\n // The ledger's line budget: a run with no break point wider than a phone\n // line forces the whole email to scroll sideways. Merge tags are a\n // renderer's business, not a line's — masked out before measuring.\n // Same ceiling as MAX_MERGE_TAG_LENGTH in the merge-tag node.\n const masked = region.replace(/\\{\\{[^{}]{1,1002}\\}\\}/g, (tag) => ' '.repeat(tag.length));\n const runs = new RegExp(`\\\\S{${MAX_UNBROKEN_RUN + 1},}`, 'g');\n for (let match; (match = runs.exec(masked));) {\n diagnostics.push({\n from: regionFrom + match.index,\n to: regionFrom + match.index + match[0].length,\n severity: 'warning',\n message: `Unbroken run of ${match[0].length} characters — wider than a phone line (${MAX_UNBROKEN_RUN} fit at 320px), the email scrolls sideways; break it or shorten it`,\n });\n }\n }\n\n // Images without alt text: image-blocking clients (corporate Outlook,\n // Gmail before the tap) render only the alt — a missing one leaves a hole.\n for (const tag of scan.tags) {\n if (tag.kind !== 'open' || tag.name !== 'img' || !tag.terminated) continue;\n // No source: a placeholder — a sized frame awaiting its file. One warning,\n // not the alt one on top: the file brings the alt.\n if (!attributeValue(source, scan, tag, 'src')?.trim()) {\n diagnostics.push({\n from: tag.nameFrom,\n to: tag.nameTo,\n severity: 'warning',\n message:\n 'Image placeholder — no source yet; click it in the editor to choose the file before sending',\n });\n continue;\n }\n // An empty alt is a decision — WCAG's \"decorative, skip me\" (MJML writes\n // it for logos beside their own text) — so only a missing one warns.\n if (!hasAttribute(source, scan, tag, 'alt')) {\n diagnostics.push({\n from: tag.nameFrom,\n to: tag.nameTo,\n severity: 'warning',\n message: 'Image without alt text — image-blocking clients render nothing in its place',\n });\n }\n }\n\n // Images embedded as data URLs — the drop/paste stopgap. Gmail and Outlook\n // refuse them, so the recipient sees a hole where the image was. The send\n // intent promotes them to `cid:` parts, but the HTML as written is not a\n // sendable email, and the source pane says so.\n for (const tag of scan.tags) {\n if (tag.kind !== 'open' || tag.name !== 'img' || !tag.terminated) continue;\n const src = attributeValueToken(source, scan, tag, 'src');\n if (!src || !src.value.trimStart().toLowerCase().startsWith('data:')) continue;\n diagnostics.push({\n from: src.from,\n to: src.to,\n severity: 'warning',\n message:\n `Image embedded as a data URL — ${clientList(['gmail', 'outlook-desktop'])}: ` +\n 'the image is not displayed; sending promotes it to an inline cid: part',\n });\n }\n\n // A picture behind text drawn Outlook's way: a `v:fill` in a conditional\n // comment. Where the email carries one, a cell's CSS background image —\n // paired with the `background` attribute, the section node's pattern —\n // is the same picture for everyone else, not an image Outlook drops.\n const hasVml = scan.tokens.some(\n (token) => token.type === 'comment' && /<v:fill\\b/i.test(source.slice(token.from, token.to)),\n );\n\n // Style declarations the floor clients ignore or mangle — data-driven from\n // the client-support module; the message names the client and what happens.\n for (const tag of scan.tags) {\n if (tag.kind !== 'open' || !tag.terminated) continue;\n const style = attributeValueToken(source, scan, tag, 'style');\n if (!style?.value) continue;\n const hasWidthAttribute = attributeValue(source, scan, tag, 'width') !== null;\n const hasVmlBackground = hasVml && attributeValue(source, scan, tag, 'background') !== null;\n // `max-width` is only a problem when it is the *sole* width constraint;\n // paired with `width: 100%` (the fluid columns pattern) Outlook falls back\n // to 100% and fills the container gracefully.\n const hasFluidWidth = /(^|;)\\s*width:\\s*100%/.test(style.value);\n\n let offset = 0;\n // Split at top-level semicolons only: `url(data:image/png;base64,…)` is\n // one declaration.\n for (const declaration of splitStyleExactly(style.value)) {\n const declarationFrom = style.from + offset;\n offset += declaration.length + 1;\n\n const colon = declaration.indexOf(':');\n if (colon < 0) continue;\n const property = declaration.slice(0, colon).trim().toLowerCase();\n const value = declaration.slice(colon + 1).trim();\n\n // The image hybrid pairs max-width with a width attribute precisely\n // because Outlook ignores max-width; the fluid columns pattern pairs it\n // with `width: 100%`. Both are deliberate, safe degradations.\n if (\n property === 'max-width' &&\n ((tag.name === 'img' && hasWidthAttribute) || hasFluidWidth)\n ) {\n continue;\n }\n\n // Two of our own patterns degrade in Outlook *on purpose*: the fluid\n // columns (inline-block + width: 100%) stack, and the bordered button\n // anchor renders inline with its box intact. Neither is a surprise.\n if (\n property === 'display' &&\n /^inline-block\\b/i.test(value) &&\n (tag.name === 'a' || hasFluidWidth)\n ) {\n continue;\n }\n\n const leading = /^\\s*/.exec(declaration)![0].length;\n const trimmed = declaration.trimEnd().length;\n if (vocabulary && !isEmailCssProperty(property)) {\n diagnostics.push({\n from: declarationFrom + leading,\n to: declarationFrom + trimmed,\n severity: 'warning',\n message: `\"${property}\" isn't applied by Apple Mail, Outlook or Gmail — dropped on parse (preserve mode keeps it)`,\n });\n continue;\n }\n\n // The responsiveness ledger, enforced: sizes that reflow on iOS, and\n // fixed widths that overflow a phone (the image hybrid pairs its width\n // *attribute* with a fluid style, so an <img> is exempt).\n const px = /^(\\d+(?:\\.\\d+)?)px$/i.exec(value);\n if (property === 'font-size' && px && parseFloat(px[1]) < MIN_FONT_SIZE) {\n diagnostics.push({\n from: declarationFrom + leading,\n to: declarationFrom + trimmed,\n severity: 'warning',\n message: `\"font-size: ${value}\" — below ${MIN_FONT_SIZE}px iOS Mail auto-inflates text and reflows the layout; the minimum is ${MIN_FONT_SIZE}px`,\n });\n }\n if (property === 'width' && px && tag.name !== 'img') {\n diagnostics.push({\n from: declarationFrom + leading,\n to: declarationFrom + trimmed,\n severity: 'warning',\n message: `\"width: ${value}\" — a fixed width overflows a phone; use width: 100% with max-width: ${value} (the hybrid)`,\n });\n }\n\n if (hasVmlBackground && /^background(-image)?$/.test(property)) continue;\n\n for (const issue of findCssIssues(property, value, tag.name)) {\n diagnostics.push({\n from: declarationFrom + leading,\n to: declarationFrom + trimmed,\n severity: 'warning',\n message: `\"${property}\" — ${clientList(issue.ignoredBy)}: ${issue.note}`,\n });\n }\n }\n }\n\n // Attributes no floor client applies (`data-*`, framework bindings, typos):\n // the email parse drops them, so say so where they are written.\n let owner = 0;\n for (const token of vocabulary ? scan.tokens : []) {\n if (token.type !== 'attributeName') continue;\n while (owner < scan.tags.length && scan.tags[owner].to <= token.from) owner++;\n const tag = scan.tags[owner];\n if (!tag || tag.from > token.from || tag.kind !== 'open') continue;\n const name = source.slice(token.from, token.to).toLowerCase();\n if (!isEmailAttribute(name, tag.name)) {\n diagnostics.push({\n from: token.from,\n to: token.to,\n severity: 'warning',\n message: `\"${name}\" isn't applied by Apple Mail, Outlook or Gmail — dropped on parse (preserve mode keeps it)`,\n });\n }\n }\n\n // Script URL schemes in attribute values: the email schema refuses them on\n // parse and mail clients block them — an error, not a taste question.\n let lastAttribute = '';\n for (const token of scan.tokens) {\n if (token.type === 'attributeName') {\n lastAttribute = source.slice(token.from, token.to).toLowerCase();\n continue;\n }\n if (token.type !== 'attributeValue') continue;\n const value = source.slice(token.from, token.to).replace(/^[\"']|[\"']$/g, '');\n if (/^\\s*(javascript|vbscript)\\s*:/i.test(value)) {\n diagnostics.push({\n from: token.from,\n to: token.to,\n severity: 'error',\n message: `\"${lastAttribute}\" uses a script URL — the schema refuses it and mail clients block it`,\n });\n }\n }\n\n // A comment that never closes swallows the rest of the document, in every\n // mode. A closed one is content where the markup is kept as authored; in\n // `repair` only a conditional comment is — Outlook's own content: the Word\n // engine reads what stands inside `[if mso]`, and the columns block and\n // the section's picture write one for it — any other the schema drops.\n for (const token of scan.tokens) {\n if (token.type !== 'comment') continue;\n const comment = source.slice(token.from, token.to);\n if (comment.endsWith('-->')) {\n if (mode !== 'repair') continue;\n if (/^<!--\\[if\\s/i.test(comment) || /^<!--<!\\[endif\\]-->$/i.test(comment)) continue;\n diagnostics.push({\n from: token.from,\n to: token.to,\n severity: 'warning',\n message: 'Comments are not email content — the schema drops them on the next parse',\n });\n } else {\n diagnostics.push({\n from: token.from,\n to: token.to,\n severity: 'error',\n message: 'Comment is never closed with \"-->\"',\n });\n }\n }\n\n const unclosed = (tag: HtmlTag) =>\n diagnostics.push({\n from: tag.nameFrom,\n to: tag.nameTo,\n severity: 'error',\n message: `<${tag.name}> is never closed`,\n });\n\n for (const tag of scan.tags) {\n if (!tag.terminated) {\n diagnostics.push({\n from: tag.from,\n to: tag.to,\n severity: 'error',\n message: `\"<${tag.kind === 'close' ? '/' : ''}${tag.name}\" is missing its closing \">\"`,\n });\n continue;\n }\n\n if (tag.kind === 'open') {\n if (vocabulary && !isEmailTag(tag.name)) {\n diagnostics.push({\n from: tag.nameFrom,\n to: tag.nameTo,\n severity: 'warning',\n message: `<${tag.name}> isn't applied by Apple Mail, Outlook or Gmail — dropped on parse (preserve mode keeps it)`,\n });\n } else if (mode === 'repair' && !EMAIL_SAFE_TAGS.has(tag.name)) {\n diagnostics.push({\n from: tag.nameFrom,\n to: tag.nameTo,\n severity: 'warning',\n message: `<${tag.name}> is not email-safe — many mail clients strip it`,\n });\n }\n if (!VOID_TAGS.has(tag.name) && !tag.selfClosing) stack.push(tag);\n continue;\n }\n\n if (VOID_TAGS.has(tag.name)) {\n diagnostics.push({\n from: tag.from,\n to: tag.to,\n severity: 'error',\n message: `</${tag.name}> closes a void element that must not have a closing tag`,\n });\n continue;\n }\n\n let match = -1;\n for (let k = stack.length - 1; k >= 0; k--) {\n if (stack[k].name === tag.name) {\n match = k;\n break;\n }\n }\n if (match === -1) {\n diagnostics.push({\n from: tag.from,\n to: tag.to,\n severity: 'error',\n message: `</${tag.name}> has no matching opening tag`,\n });\n continue;\n }\n // Everything opened after the match is implicitly (wrongly) closed by it.\n for (let k = stack.length - 1; k > match; k--) unclosed(stack[k]);\n stack.length = match;\n }\n\n for (const tag of stack) unclosed(tag);\n\n return diagnostics.sort((a, b) => a.from - b.from);\n}\n\n/** Complete character references (`&`, `©`, `©`) — spans that\n edits and selection endpoints must treat as atomic: splitting one breaks\n the reference and changes the decoded text. */\nexport function entitySpans(source: string): [number, number][] {\n const pattern = /&(?:#\\d+|#x[0-9a-fA-F]+|[a-zA-Z][a-zA-Z0-9]*);/g;\n const spans: [number, number][] = [];\n for (let match; (match = pattern.exec(source));) {\n spans.push([match.index, match.index + match[0].length]);\n }\n return spans;\n}\n\n/** Text regions of the source — everything outside tags and comments. */\n/** The runs of source outside tags and comments — running text, where tokens\n live. Exported for the highlighter. */\nexport function textRegions(source: string, scan: HtmlScan): [number, number][] {\n const blocked = [\n ...scan.tags.map((tag): [number, number] => [tag.from, tag.to]),\n ...scan.tokens\n .filter((token) => token.type === 'comment')\n .map((token): [number, number] => [token.from, token.to]),\n ].sort((x, y) => x[0] - y[0]);\n\n const regions: [number, number][] = [];\n let cursor = 0;\n for (const [from, to] of blocked) {\n if (from > cursor) regions.push([cursor, from]);\n cursor = Math.max(cursor, to);\n }\n if (cursor < source.length) regions.push([cursor, source.length]);\n return regions;\n}\n\n/** Names of tags still open at the end of the source, outermost first.\n Powers `</` auto-completion: the innermost open tag is the last entry. */\nexport function openTags(source: string, scan: HtmlScan = scanHTML(source)): string[] {\n const stack: string[] = [];\n for (const tag of scan.tags) {\n if (!tag.terminated) continue;\n if (tag.kind === 'open') {\n if (!VOID_TAGS.has(tag.name) && !tag.selfClosing) stack.push(tag.name);\n } else {\n for (let i = stack.length - 1; i >= 0; i--) {\n if (stack[i] === tag.name) {\n stack.length = i;\n break;\n }\n }\n }\n }\n return stack;\n}\n\n/** What the cursor is in the middle of typing, for autocomplete. */\nexport type CompletionContext =\n | { kind: 'tag'; query: string }\n | { kind: 'closing'; query: string }\n | { kind: 'attribute'; tag: string; query: string; existing: string[] }\n | { kind: 'style-property'; tag: string; query: string };\n\n/**\n * Derives the completion context at a source offset — like the slash menu,\n * this reads the *document*, not keystrokes, so it survives any way the text\n * got there. Returns `null` when the cursor is in plain prose or a\n * non-`style` attribute value.\n */\nexport function completionContextAt(source: string, offset: number): CompletionContext | null {\n const before = source.slice(0, offset);\n\n const closing = /<\\/([a-zA-Z][-\\w]*)?$/.exec(before);\n if (closing) return { kind: 'closing', query: closing[1] ?? '' };\n\n const opening = /<([a-zA-Z][-\\w]*)?$/.exec(before);\n if (opening) return { kind: 'tag', query: opening[1] ?? '' };\n\n // Inside an unterminated tag?\n const lt = before.lastIndexOf('<');\n if (lt < 0 || before.indexOf('>', lt) !== -1) return null;\n const fragment = before.slice(lt);\n const tag = /^<([a-zA-Z][-\\w]*)/.exec(fragment)?.[1]?.toLowerCase();\n if (!tag) return null;\n\n // Inside a quoted attribute value: only style properties are completable.\n const inValue = /([a-zA-Z-]+)\\s*=\\s*([\"'])((?:(?!\\2).)*)$/.exec(fragment);\n if (inValue) {\n if (inValue[1].toLowerCase() !== 'style') return null;\n const declaration = inValue[3].split(';').pop() ?? '';\n if (declaration.includes(':')) return null; // typing a value, not a property\n return { kind: 'style-property', tag, query: declaration.trimStart() };\n }\n\n // Attribute position: after whitespace, possibly mid-word.\n const attribute = /\\s([a-zA-Z-]*)$/.exec(fragment);\n if (attribute) {\n const existing = [...fragment.matchAll(/([a-zA-Z-]+)\\s*=/g)].map((m) => m[1].toLowerCase());\n return { kind: 'attribute', tag, query: attribute[1], existing };\n }\n\n return null;\n}\n\n/** Block-level tags that get their own indented lines when formatting. */\nconst BLOCK_TAGS = new Set([\n 'address',\n 'article',\n 'aside',\n 'blockquote',\n 'div',\n 'dd',\n 'dl',\n 'dt',\n 'fieldset',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'ol',\n 'p',\n 'pre',\n 'section',\n 'table',\n 'tbody',\n 'td',\n 'tfoot',\n 'th',\n 'thead',\n 'tr',\n 'ul',\n]);\n\n/**\n * Pretty-prints HTML for the source editor: block tags on their own indented\n * lines, inline content kept together. Parses through the browser's DOM, so\n * malformed input comes back auto-corrected — formatting is also repair.\n *\n * A whole document (doctype, `<html>`, `<head>`) formats as one: the head is\n * printed in exactly the canonical line form the parse stores (see\n * `canonicalHead`), so the pretty source and the canonical document can never\n * disagree about it.\n */\n/** The width the formatter optimizes for — Prettier's. Email HTML is built\n for arbitrary line lengths; the formatter only ever adds whitespace the\n parser discards, so a break lands on a space in running text (never\n inside a tag, an attribute value or a `{{ }}` token) or between a tag's\n attributes. A word wider than the line stays whole and overflows. */\nexport const FORMAT_WIDTH = 80;\n\n/** The room a line at this indent has: the width — or, deeper than a quarter\n of it, three quarters of the width after the indent. MJML nests 19 levels\n (38 columns): counted into the 80 they would leave 42 and fold every\n line; this keeps 60. Prettier counts the indent in; Prettier is not\n formatting email tables. */\nfunction room(pad: string, width: number): number {\n return Math.max(width, pad.length + Math.round(width * 0.75));\n}\n\nexport function formatHTML(\n html: string,\n indent = ' ',\n width = FORMAT_WIDTH,\n options: SourceOptions = {},\n): string {\n const lines: string[] = [];\n if ((options.mode ?? 'repair') === 'repair') {\n const doc = new DOMParser().parseFromString(html, 'text/html');\n // A whole document's stylesheet — a builder's export leans on it, and the\n // parse folds it in (`inlineStyles`) — comes first, then the body: the\n // head has nothing else the email keeps. Formatting stays presentation\n // only: what the parse read before, it reads after.\n for (const style of Array.from(doc.head.querySelectorAll('style'))) {\n formatNode(style, 0, lines, indent, width, false);\n }\n for (const child of Array.from(doc.body.childNodes)) {\n formatNode(child, 0, lines, indent, width, false);\n }\n return lines.join('\\n');\n }\n\n // Markup kept as authored: the whole document formats as one — the head in\n // exactly the canonical line form the parse stores (`canonicalHead`), so\n // the pretty source and the canonical document never disagree about it —\n // and a wide style breaks only where the parse can undo it.\n const dom = parseDocument(html);\n if (!hasDocumentEnvelope(html)) {\n for (const child of Array.from(dom.body.childNodes)) {\n formatNode(child, 0, lines, indent, width, true);\n }\n return lines.join('\\n');\n }\n const envelope = readEnvelope(dom);\n if (envelope.doctype) lines.push(envelope.doctype);\n lines.push(tagString('html', envelope.html), `${indent}<head>`);\n if (envelope.head) {\n for (const line of envelope.head.split('\\n')) lines.push(indent + indent + line);\n }\n lines.push(`${indent}</head>`, indent + tagString('body', envelope.body));\n for (const child of Array.from(dom.body.childNodes)) {\n formatNode(child, 2, lines, indent, width, true);\n }\n lines.push(`${indent}</body>`, '</html>');\n return lines.join('\\n');\n}\n\nfunction formatNode(\n node: globalThis.Node,\n depth: number,\n lines: string[],\n indent: string,\n width: number,\n authored: boolean,\n): void {\n const pad = indent.repeat(depth);\n\n if (node.nodeType === Node.TEXT_NODE) {\n // Tokens at their canonical padding — the same form the schema serializes,\n // so formatting stays presentation-only (the invariance test pins it).\n const text = normalizeMergeTagText(trimWhitespace(collapseWhitespace(node.nodeValue ?? '')));\n if (text) lines.push(...wrapInline(sourceText(text), pad, width, authored));\n return;\n }\n if (node.nodeType === Node.COMMENT_NODE) {\n // Inner lines re-indented to the comment's depth; the parse drops that\n // indentation again, so this is presentation only.\n const text = normalizeCommentText(node.nodeValue ?? '').replace(/\\n/g, `\\n${pad}`);\n lines.push(`${pad}<!--${text}-->`);\n return;\n }\n if (!(node instanceof Element)) return;\n\n const tag = node.tagName.toLowerCase();\n if (VOID_TAGS.has(tag)) {\n lines.push(...openTagLines(node, pad, indent, width, authored));\n return;\n }\n // Raw text elements: kept as written, line by line — escaped or re-wrapped\n // they would no longer be the stylesheet they were. A stylesheet is\n // re-indented by nesting, exactly as the parse stores it (`normalizeCss`),\n // so formatting never changes a preserved `<style>`.\n if (tag === 'style' || tag === 'script') {\n lines.push(`${pad}${openTag(node)}`);\n const text = node.textContent ?? '';\n const body =\n tag === 'style' && authored\n ? normalizeCss(text)\n : text\n .split('\\n')\n .map((line) => line.trim())\n .filter(Boolean);\n for (const line of body) lines.push(`${pad}${indent}${line}`);\n lines.push(`${pad}</${tag}>`);\n return;\n }\n if (!BLOCK_TAGS.has(tag) || !hasBlockChild(node)) {\n const open = openTag(node);\n const content = inlineContent(node);\n const close = `</${tag}>`;\n const oneLine = pad + open + content + close;\n if (oneLine.length <= room(pad, width)) {\n lines.push(oneLine);\n return;\n }\n // Too wide: the open tag alone (its attributes broken if that is the wide\n // part), the content wrapped one level in, the close tag back on the\n // margin — every added break is whitespace the parser drops at a block's\n // edges or collapses to the one space that was already there.\n lines.push(...openTagLines(node, pad, indent, width, authored));\n if (content) lines.push(...wrapInline(content, pad + indent, width, authored));\n lines.push(pad + close);\n return;\n }\n\n lines.push(...openTagLines(node, pad, indent, width, authored));\n for (const child of Array.from(node.childNodes)) {\n if (child.nodeType === Node.TEXT_NODE && !(child.nodeValue ?? '').trim()) continue;\n formatNode(child, depth + 1, lines, indent, width, authored);\n }\n lines.push(`${pad}</${tag}>`);\n}\n\n/** The open tag on one line when it fits, else one attribute per line with\n the `>` back on the margin — whitespace inside a tag is free. A break only\n where it helps: a lone attribute that stays one line would be as wide one\n line down, so the tag stays whole and overflows instead (the source pane\n scrolls). */\nfunction openTagLines(\n element: Element,\n pad: string,\n indent: string,\n width: number,\n authored = false,\n): string[] {\n const whole = pad + openTag(element);\n if (whole.length <= room(pad, width) || !element.attributes.length) return [whole];\n const lines = [`${pad}<${element.tagName.toLowerCase()}`];\n for (const attr of element.attributes) {\n const value =\n attr.value === '' && isBooleanAttribute(attr.name) ? null : escapeAttribute(attr.value);\n lines.push(...attributeLines(attr.name, value, pad + indent, indent, width, authored));\n }\n lines.push(`${pad}>`);\n return element.attributes.length === 1 && lines.length === 3 ? [whole] : lines;\n}\n\n/** One attribute of a broken-up tag on its own line at `pad` — or, for a\n `style` that still does not fit, Prettier's embedded-CSS form: one\n declaration per line one level in, the closing quote back at `pad`.\n `value` is already escaped.\n\n For the canonical import, whitespace between declarations is nothing\n (every parse rule reads the style through the CSSOM or a whitespace-\n tolerant regex). Markup kept as authored (`authored`) keeps its style\n byte for byte, so there the breaks are the only thing added: each goes\n *after* a separator and its own spacing (`a: b; ⏎ c: d;`, `a:b;⏎c:d;`),\n and the parse drops a line break together with the indentation after it\n inside a style (`preservedAttributes`) — the style reads back exactly as\n written. */\nfunction attributeLines(\n name: string,\n value: string | null,\n pad: string,\n indent: string,\n width: number,\n authored = false,\n): string[] {\n const line = value === null ? `${pad}${name}` : `${pad}${name}=\"${value}\"`;\n if (line.length <= room(pad, width) || name !== 'style' || value === null) return [line];\n if (!authored) {\n const declarations = splitDeclarations(value);\n if (declarations.length < 2) return [line];\n return [`${pad}style=\"`, ...declarations.map((d) => `${pad}${indent}${d};`), `${pad}\"`];\n }\n // Split the unescaped value, so an `"` never looks like a separator —\n // and read it the way the parse does, so a style broken by an earlier\n // format is re-broken from its original, never broken twice.\n const raw = value\n .replace(/"/g, '\"')\n .replace(/&/g, '&')\n .replace(/\\r?\\n[ \\t]*/g, '');\n const parts = splitStyleExactly(raw);\n if (parts.filter((part) => part.trim()).length < 2) return [line];\n const leading = (part: string) => /^\\s*/.exec(part)![0];\n const lines = [`${pad}style=\"${leading(parts[0])}`];\n for (let i = 0; i < parts.length; i++) {\n const body = parts[i].slice(leading(parts[i]).length);\n const last = i === parts.length - 1;\n if (last && !body) break;\n const separator = last ? '' : `;${leading(parts[i + 1])}`;\n lines.push(`${pad}${indent}${escapeAttribute(body + separator)}`);\n }\n lines.push(`${pad}\"`);\n return lines;\n}\n\n/** CSS declarations of a style value, split at the `;` between them (not\n one inside quotes or parentheses), trimmed, empties dropped. */\nfunction splitDeclarations(style: string): string[] {\n const declarations: string[] = [];\n let current = '';\n let quote: string | null = null;\n let depth = 0;\n for (const ch of style) {\n if (quote) {\n if (ch === quote) quote = null;\n } else if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === '(') {\n depth++;\n } else if (ch === ')') {\n depth = Math.max(0, depth - 1);\n } else if (ch === ';' && depth === 0) {\n if (current.trim()) declarations.push(current.trim());\n current = '';\n continue;\n }\n current += ch;\n }\n if (current.trim()) declarations.push(current.trim());\n return declarations;\n}\n\n/** The words of serialized inline content: a break opportunity is a space\n outside any tag (attribute values included) and outside any `{{ }}`\n token — a token is one word, whatever its length. */\nfunction breakableWords(content: string): string[] {\n const words: string[] = [];\n let word = '';\n let inTag = false;\n let quote: string | null = null;\n let inToken = false;\n for (let i = 0; i < content.length; i++) {\n const ch = content[i];\n if (inTag) {\n if (quote) {\n if (ch === quote) quote = null;\n } else if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === '>') {\n inTag = false;\n }\n word += ch;\n continue;\n }\n if (ch === '<') {\n inTag = true;\n word += ch;\n continue;\n }\n if (!inToken && ch === '{' && content[i + 1] === '{') {\n inToken = true;\n word += '{{';\n i++;\n continue;\n }\n if (inToken && ch === '}' && content[i + 1] === '}') {\n inToken = false;\n word += '}}';\n i++;\n continue;\n }\n if (ch === ' ' && !inToken) {\n if (word) words.push(word);\n word = '';\n continue;\n }\n word += ch;\n }\n if (word) words.push(word);\n return words;\n}\n\n/** Greedy fill of inline content to the width, every line at `pad`. A word\n that is a tag and does not fit even alone breaks at its attributes (see\n {@link tagWordLines}); any other over-wide word simply overflows. */\nfunction wrapInline(content: string, pad: string, width: number, authored = false): string[] {\n const lines: string[] = [];\n let line = '';\n for (const word of breakableWords(content)) {\n if (line && line.length + 1 + word.length <= room(pad, width)) {\n line += ` ${word}`;\n continue;\n }\n if (line) lines.push(line);\n line = '';\n const expanded =\n (pad + word).length > room(pad, width)\n ? (tagWordLines(word, pad, width, authored) ?? tokenWordLines(word, pad, width))\n : null;\n if (expanded) lines.push(...expanded);\n else line = pad + word;\n }\n if (line) lines.push(line);\n return lines;\n}\n\n/** Greedy fill of plain words, every line at `pad`. */\nfunction fillWords(words: string[], pad: string, width: number): string[] {\n const lines: string[] = [];\n let line = '';\n for (const word of words) {\n if (!line) line = pad + word;\n else if (line.length + 1 + word.length > room(pad, width)) {\n lines.push(line);\n line = pad + word;\n } else line += ` ${word}`;\n }\n if (line) lines.push(line);\n return lines;\n}\n\n/** The words of an expression: split at spaces outside string literals —\n a break inside a literal would read as a changed string, even though the\n parser would collapse it back. */\nfunction expressionWords(expr: string): string[] {\n const words: string[] = [];\n let word = '';\n let quote: string | null = null;\n for (let i = 0; i < expr.length; i++) {\n const ch = expr[i];\n if (quote) {\n word += ch;\n if (ch === '\\\\' && i + 1 < expr.length) word += expr[++i];\n else if (ch === quote) quote = null;\n continue;\n }\n if (ch === \"'\" || ch === '\"') {\n quote = ch;\n word += ch;\n continue;\n }\n if (ch === ' ') {\n if (word) words.push(word);\n word = '';\n continue;\n }\n word += ch;\n }\n if (word) words.push(word);\n return words;\n}\n\n/** An over-wide word holding a `{{ … }}` token, the way Prettier prints a long\n Angular interpolation: the braces on their own lines (anything glued to\n them stays glued), the expression filled between them one level in. Every\n break replaces a space the parser collapses back, so the token — and the\n email — is unchanged; the source-side scanner reads the wrapped form. */\nfunction tokenWordLines(word: string, pad: string, width: number): string[] | null {\n const match = /^([^{]*)\\{\\{(.*)\\}\\}([^{]*)$/s.exec(word);\n if (!match) return null;\n const [, head, inner, tail] = match;\n const words = expressionWords(inner.trim());\n if (words.length < 2) return null;\n return [`${pad}${head}{{`, ...fillWords(words, pad + ' ', width), `${pad}}}${tail}`];\n}\n\n/** An over-wide word that starts with a tag, broken one attribute per line\n with the `>` (and whatever text was glued to it) back on the margin. A\n word begins and ends at a break opportunity, so the added line breaks\n are exactly the whitespace that was there — or a block edge. Null when\n the word is not a tag with attributes. */\nfunction tagWordLines(word: string, pad: string, width: number, authored = false): string[] | null {\n const match = /^<([A-Za-z][\\w-]*)((?:\\s+[^\\s\"'>=]+(?:=\"[^\"]*\"|='[^']*')?)+)\\s*>([\\s\\S]*)$/.exec(\n word,\n );\n if (!match) return null;\n const [, name, attributes, tail] = match;\n const indent = pad + ' ';\n const lines = [`${pad}<${name}`];\n for (const attribute of attributes.match(/[^\\s\"'>=]+(?:=\"[^\"]*\"|='[^']*')?/g) ?? []) {\n const eq = attribute.indexOf('=');\n const attrName = eq < 0 ? attribute : attribute.slice(0, eq);\n const attrValue = eq < 0 ? null : attribute.slice(eq + 2, -1);\n lines.push(...attributeLines(attrName, attrValue, indent, ' ', width, authored));\n }\n lines.push(`${pad}>${tail}`);\n // A lone attribute that stayed one line: breaking it off gained nothing.\n return lines.length === 3 ? null : lines;\n}\n\nfunction hasBlockChild(element: Element): boolean {\n for (const child of element.children) {\n if (BLOCK_TAGS.has(child.tagName.toLowerCase())) return true;\n }\n return false;\n}\n\n/** An element's inline content on one line. Whitespace is collapsed, never\n moved: a space inside a `<span>` stays inside it, because the parse keeps\n it there too and a moved space would change the canonical document.\n Only the block's own edges are trimmed — the parse drops those as well. */\nfunction inlineContent(element: Element, trimEdges = true): string {\n const parts: string[] = [];\n for (const child of element.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n // Tokens at their canonical padding here too (inline text is the common case).\n parts.push(sourceText(normalizeMergeTagText(collapseWhitespace(child.nodeValue ?? ''))));\n } else if (child.nodeType === Node.COMMENT_NODE) {\n parts.push(`<!--${normalizeCommentText(child.nodeValue ?? '')}-->`);\n } else if (child instanceof Element) {\n const tag = child.tagName.toLowerCase();\n parts.push(\n VOID_TAGS.has(tag)\n ? openTag(child)\n : openTag(child) + inlineContent(child, false) + `</${tag}>`,\n );\n }\n }\n const joined = parts.join('');\n return trimEdges ? joined.replace(/^ +| +$/g, '') : joined;\n}\n\nfunction openTag(element: Element): string {\n return tagString(\n element.tagName.toLowerCase(),\n Array.from(element.attributes, (attr) => [attr.name, attr.value]),\n );\n}\n\n/** HTML's whitespace only — `\\s` would also match U+00A0 and the other\n Unicode spaces, which are content: MJML spaces footer links with eight\n non-breaking spaces, and a spacer row holds a lone hair space. */\nfunction collapseWhitespace(text: string): string {\n return text.replace(/[ \\t\\n\\f\\r]+/g, ' ');\n}\n\nconst trimWhitespace = (text: string): string => text.replace(/^ | $/g, '');\n\n/** Text for the source pane: a Unicode space shows as its reference\n (` `, ` `) — the raw character is invisible there and reads\n as a plain space, or as nothing. */\nconst sourceText = (text: string): string =>\n escapeText(text).replace(\n /[\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]/g,\n (ch) => (ch === '\\u00a0' ? ' ' : `&#${ch.charCodeAt(0)};`),\n );\n","import { CSS_SUPPORT, EmailClient } from './client-support';\n\n/** The clients a rendering can be drawn for: the three that matter, and\n that read HTML differently enough to look at one by one. */\nexport type RenderingClient = 'apple-mail' | 'gmail' | 'outlook-desktop';\n\nexport const RENDERING_CLIENTS: readonly RenderingClient[] = [\n 'apple-mail',\n 'gmail',\n 'outlook-desktop',\n];\n\nexport interface ClientRenderingOptions {\n /** Draw the client's dark mode: Gmail's forced inversion, Apple Mail's\n and Outlook's own dark surfaces. */\n dark?: boolean;\n /** The reading pane: a phone draws the message edge to edge (iOS Mail,\n the Gmail app), a desktop pane keeps a margin round it. Default\n desktop. */\n pane?: 'phone' | 'desktop';\n}\n\n/**\n * The email as a client would draw it — a simulation, in a browser, of what\n * each client keeps of the HTML and what it drops, from the same\n * client-support data the linter reads. Not a screenshot service: what the\n * data says a client ignores is taken out, what only that client reads is\n * put in, and the client's own surface (its default face, size and colours)\n * is laid underneath. The result is a whole document for a sandboxed frame.\n *\n * - **Apple Mail** reads it all: the document as it is, on Apple's surface.\n * - **Gmail** drops the comments, the form controls (a hamburger's\n * checkbox and label), every `<style>` rule whose selector it cannot\n * match (pseudo-classes, attribute selectors, sibling combinators), and\n * the declarations the data marks as ignored there (position, flex and\n * grid, transforms, animation). Its dark mode inverts the colours.\n * - **Outlook on Windows** reads what the Word engine reads: the\n * conditional comments meant for it are opened (`[if mso]`, `[if mso |\n * IE]`, `[if gte mso 9]`) and the parts kept from it are taken out\n * (`[if !mso]><!-->` … `<!--<![endif]`); media queries go; the\n * declarations the data marks as ignored go (`max-width`, a padding on\n * anything but a cell, `border-radius`, background images, floats,\n * shadows, and the rest), and an `inline-block` block stacks. VML is left\n * standing — a browser draws none of it, so a picture behind text shows\n * as the colour beneath, which is what an Outlook without VML shows too.\n *\n * Takes a fragment (the editor's canonical HTML) or a whole document (an\n * import as it was pasted): a document keeps its head — its `<style>`,\n * subject to the client — with the client's surface laid before it.\n */\nexport function renderForClient(\n html: string,\n client: RenderingClient,\n options: ClientRenderingOptions = {},\n): string {\n const source = client === 'outlook-desktop' ? openOutlookConditionals(html) : html;\n const doc = new DOMParser().parseFromString(source, 'text/html');\n if (client !== 'apple-mail') dropComments(doc);\n if (client === 'gmail') {\n for (const el of Array.from(\n doc.querySelectorAll('input, label, form, button, select, textarea'),\n )) {\n el.replaceWith(...Array.from(el.childNodes));\n }\n for (const sheet of Array.from(doc.querySelectorAll('style'))) {\n sheet.textContent = keepGmailRules(sheet.textContent ?? '');\n }\n }\n if (client === 'outlook-desktop') {\n for (const sheet of Array.from(doc.querySelectorAll('style'))) {\n sheet.textContent = dropMediaQueries(sheet.textContent ?? '');\n }\n }\n if (client !== 'apple-mail') dropIgnoredDeclarations(doc, client);\n const surface = doc.createElement('style');\n surface.textContent =\n SURFACE[client] +\n (options.pane === 'phone' ? ' body { margin: 0; }' : '') +\n (options.dark ? DARK[client] : '');\n doc.head.insertBefore(surface, doc.head.firstChild);\n const charset = doc.createElement('meta');\n charset.setAttribute('charset', 'utf-8');\n doc.head.insertBefore(charset, doc.head.firstChild);\n return '<!doctype html>' + doc.documentElement.outerHTML;\n}\n\n/** Each client's surface: its reading pane's default face, size and\n colours, under whatever the email says for itself. */\nconst SURFACE: Record<RenderingClient, string> = {\n 'apple-mail': `\n body { margin: 16px; background: #ffffff; color: #000000;\n font-family: -apple-system, \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n font-size: 15px; line-height: 1.35; -webkit-text-size-adjust: 100%; }\n `,\n gmail: `\n body { margin: 16px; background: #ffffff; color: #222222;\n font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4;\n word-wrap: break-word; }\n `,\n 'outlook-desktop': `\n body { margin: 16px; background: #ffffff; color: #000000;\n font-family: Calibri, Arial, sans-serif; font-size: 14.67px; line-height: 1.2; }\n /* The Word engine draws no block side by side: a column stacks. */\n div[style*=\"inline-block\"] { display: block !important; width: auto !important; }\n `,\n};\n\n/** Each client's dark mode: Gmail (and Outlook's app) invert the message,\n keeping the hue; Apple Mail and Outlook on Windows turn the surface dark\n and leave the message's own colours to it. */\nconst DARK: Record<RenderingClient, string> = {\n 'apple-mail': `\n html { background: #1e1e1e; } body { background: #1e1e1e; color: #ffffff; }\n `,\n gmail: `\n html { filter: invert(1) hue-rotate(180deg); background: #ffffff; }\n img { filter: invert(1) hue-rotate(180deg); }\n `,\n 'outlook-desktop': `\n html { background: #292929; } body { background: #292929; color: #ffffff; }\n `,\n};\n\n/** The Word engine reads what the conditional comments keep for it, and\n not what they keep from it. */\nfunction openOutlookConditionals(html: string): string {\n return (\n html\n // `<!--[if !mso]><!-->` … `<!--<![endif]-->`: for everyone but Outlook.\n .replace(/<!--\\[if\\s+!mso\\]><!-->[\\s\\S]*?<!--<!\\[endif\\]-->/gi, '')\n // `<!--[if mso]>` … `<![endif]-->` (and `mso | IE`, `gte mso 9`): Outlook's own.\n .replace(\n /<!--\\[if\\s+(?:gte\\s+|lte\\s+|gt\\s+|lt\\s+)?mso(?:\\s*\\|\\s*IE)?[^\\]]*\\]>([\\s\\S]*?)<!\\[endif\\]-->/gi,\n '$1',\n )\n );\n}\n\nfunction dropComments(doc: Document): void {\n const walker = doc.createTreeWalker(doc, NodeFilter.SHOW_COMMENT);\n const comments: Node[] = [];\n while (walker.nextNode()) comments.push(walker.currentNode);\n for (const comment of comments) comment.parentNode?.removeChild(comment);\n}\n\n/** Gmail keeps a rule whose selector it can match — elements, classes,\n ids, descendants — and drops one with a pseudo-class, an attribute\n selector or a sibling combinator; media queries it keeps. */\nexport function keepGmailRules(css: string): string {\n return rewriteRules(css, (selector) => !/[:\\[~+]/.test(selector));\n}\n\n/** The Word engine reads no media query. */\nexport function dropMediaQueries(css: string): string {\n let out = '';\n let i = 0;\n while (i < css.length) {\n const at = css.indexOf('@media', i);\n if (at < 0) {\n out += css.slice(i);\n break;\n }\n out += css.slice(i, at);\n const open = css.indexOf('{', at);\n if (open < 0) break;\n i = matchingBrace(css, open) + 1;\n }\n return out;\n}\n\n/** The stylesheet with only the rules `keep` says yes to, inside media\n queries too. */\nfunction rewriteRules(css: string, keep: (selector: string) => boolean): string {\n let out = '';\n let i = 0;\n while (i < css.length) {\n const open = css.indexOf('{', i);\n if (open < 0) break;\n const head = css.slice(i, open).trim();\n const close = matchingBrace(css, open);\n if (close < 0) break;\n const body = css.slice(open + 1, close);\n if (head.startsWith('@media')) {\n out += `${head} {${rewriteRules(body, keep)}}\\n`;\n } else if (head.startsWith('@')) {\n out += `${head} {${body}}\\n`;\n } else {\n const selectors = head\n .split(',')\n .map((s) => s.trim())\n .filter(keep);\n if (selectors.length) out += `${selectors.join(', ')} {${body}}\\n`;\n }\n i = close + 1;\n }\n return out;\n}\n\nfunction matchingBrace(text: string, open: number): number {\n let depth = 0;\n for (let i = open; i < text.length; i++) {\n if (text[i] === '{') depth++;\n else if (text[i] === '}' && --depth === 0) return i;\n }\n return -1;\n}\n\n/** Takes out of every inline style what the data says the client ignores. */\nfunction dropIgnoredDeclarations(doc: Document, client: EmailClient): void {\n for (const el of Array.from(doc.querySelectorAll<HTMLElement>('[style]'))) {\n const tag = el.tagName.toLowerCase();\n const kept = (el.getAttribute('style') ?? '')\n .split(';')\n .map((declaration) => declaration.trim())\n .filter(Boolean)\n .filter((declaration) => {\n const colon = declaration.indexOf(':');\n if (colon < 0) return true;\n const property = declaration.slice(0, colon).trim().toLowerCase();\n const value = declaration.slice(colon + 1).trim();\n return !CSS_SUPPORT.some(\n (issue) =>\n issue.property === property &&\n issue.ignoredBy.includes(client) &&\n (!issue.valuePattern || issue.valuePattern.test(value)) &&\n (!issue.onTags || issue.onTags.includes(tag)),\n );\n });\n if (kept.length) el.setAttribute('style', kept.join('; ') + ';');\n else el.removeAttribute('style');\n }\n}\n","/**\n * The `text/plain` projection of canonical email HTML — the multipart\n * alternative every well-formed email should carry (spam scoring cares, and\n * some recipients read it). Blockquotes become `> `, lists become `- ` /\n * `1. `, links keep their URL, images fall back to their alt text.\n */\nexport function emailPlainText(html: string): string {\n const body = new DOMParser().parseFromString(html, 'text/html').body;\n const lines: string[] = [];\n renderChildren(body, lines, '');\n return lines.join('\\n');\n}\n\nfunction renderChildren(parent: Element, lines: string[], prefix: string): void {\n for (const child of Array.from(parent.children)) renderBlock(child, lines, prefix);\n}\n\nfunction renderBlock(element: Element, lines: string[], prefix: string): void {\n const tag = element.tagName.toLowerCase();\n\n if (tag === 'blockquote') {\n renderChildren(element, lines, `${prefix}> `);\n return;\n }\n if (tag === 'ul' || tag === 'ol') {\n renderList(element, lines, prefix, tag === 'ol');\n return;\n }\n if (tag === 'img') {\n lines.push(prefix + imageText(element));\n return;\n }\n if (tag === 'hr') {\n lines.push(`${prefix}---`);\n return;\n }\n\n // div, p, headings — one line each, more via <br>. A single trailing <br>\n // is the empty-line marker (<div><br></div>), not an extra line. An\n // indented line (Gmail's margin-left, 40px a step) indents in text too,\n // four spaces a step.\n const indent = ' '.repeat(indentSteps(element));\n const raw = inlineText(element);\n const text = raw.endsWith('\\n') ? raw.slice(0, -1) : raw;\n for (const line of text.split('\\n')) lines.push(prefix + (line ? indent + line : line));\n}\n\nfunction indentSteps(element: Element): number {\n const margin = (element as HTMLElement).style?.marginLeft ?? '';\n const px = /^(\\d+(?:\\.\\d+)?)px$/.exec(margin.trim());\n return px ? Math.max(0, Math.round(parseFloat(px[1]) / 40)) : 0;\n}\n\nfunction renderList(list: Element, lines: string[], prefix: string, ordered: boolean): void {\n let index = 1;\n for (const item of Array.from(list.children)) {\n if (item.tagName.toLowerCase() !== 'li') continue;\n const bullet = ordered ? `${index++}. ` : '- ';\n\n const itemLines: string[] = [];\n renderChildren(item, itemLines, '');\n if (!itemLines.length) itemLines.push(inlineText(item).trim());\n\n lines.push(prefix + bullet + itemLines[0]);\n for (const rest of itemLines.slice(1)) {\n lines.push(prefix + ' '.repeat(bullet.length) + rest);\n }\n }\n}\n\nfunction inlineText(element: Element): string {\n let out = '';\n for (const node of Array.from(element.childNodes)) {\n if (node.nodeType === Node.TEXT_NODE) {\n out += node.nodeValue ?? '';\n } else if (node instanceof Element) {\n const tag = node.tagName.toLowerCase();\n if (tag === 'br') {\n out += '\\n';\n } else if (tag === 'a') {\n const href = node.getAttribute('href') ?? '';\n const text = inlineText(node);\n out += !href || text === href ? text || href : `${text} (${href})`;\n } else if (tag === 'img') {\n out += imageText(node);\n } else {\n out += inlineText(node);\n }\n }\n }\n return out;\n}\n\nfunction imageText(element: Element): string {\n const alt = element.getAttribute('alt');\n return alt ? `[${alt}]` : '[image]';\n}\n","import { escapeAttribute, escapeText } from './utils/escape';\nimport { STACK_RULE, markStackingColumns } from './extensions/nodes/columns';\n\nexport interface EmailDocumentOptions {\n /** The body's language (`en`, `ja`, `de`, …) — screen readers pick their\n voice from it, and for CJK it picks the glyph set: without `lang=\"ja\"`\n a client may draw Japanese text with Chinese forms. */\n lang?: string;\n /** Text direction; `auto` (the default) lets the first strong character\n decide, so a right-to-left body renders right-to-left unasked. */\n dir?: 'ltr' | 'rtl' | 'auto';\n /** The document `<title>` — usually the subject. Webmail ignores it; the\n clients that open the message as a page (web views, some Android apps)\n show it. */\n title?: string;\n /** The inbox snippet shown next to the subject. Without it the client\n takes the first text it finds — often an image's alt or a greeting. */\n previewText?: string;\n}\n\n/**\n * The body's head and shell: the fixes every mail client needs, none of which\n * belongs in the editor's canonical HTML.\n *\n * - Outlook on Windows scales everything by the screen DPI unless told the\n * document is 96 DPI (`o:PixelsPerInch`), and blocks PNGs without\n * `o:AllowPNG`. The Office XML sits in a conditional comment only Outlook\n * reads; every other client drops comments.\n * - iOS enlarges small text unless `-webkit-text-size-adjust` says not to,\n * and Apple Mail rewraps layouts unless\n * `x-apple-disable-message-reformatting` is set.\n * - The body sits in `role=\"article\" aria-roledescription=\"email\"`, which\n * screen readers announce as the message, carrying `lang` and `dir`.\n *\n * Everything the email needs is inline. The head's one `<style>` rule is an\n * enhancement nothing depends on: on a phone a stacked column takes the\n * whole width instead of its desktop cap (columns.ts, `STACK_RULE`). A\n * client that strips the head (Gmail's app with a non-Google account)\n * keeps the cap — narrower, still whole — and loses nothing else, which is\n * the same rule the canonical HTML already keeps.\n *\n * The result is for the transport, not for the editor: parse and\n * `emailPlainText` take the fragment `serializeToHTML` returns (the preview\n * text would otherwise read as body text).\n */\nexport function emailDocument(html: string, options: EmailDocumentOptions = {}): string {\n const { lang, dir = 'auto', title, previewText } = options;\n const langAttr = lang ? ` lang=\"${escapeAttribute(lang)}\"` : '';\n const dirAttr = ` dir=\"${dir}\"`;\n return (\n '<!doctype html>' +\n `<html${langAttr}${dirAttr} xmlns=\"http://www.w3.org/1999/xhtml\" ` +\n 'xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\">' +\n '<head>' +\n '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">' +\n '<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">' +\n '<meta name=\"x-apple-disable-message-reformatting\">' +\n `<title>${escapeText(title ?? '')}</title>` +\n OUTLOOK_SETTINGS +\n `<style type=\"text/css\">${STACK_RULE}</style>` +\n '</head>' +\n `<body style=\"${BODY_STYLE}\">` +\n `<div role=\"article\" aria-roledescription=\"email\"${langAttr}${dirAttr}>` +\n (previewText ? previewBlock(previewText) : '') +\n markStackingColumns(html) +\n '</div>' +\n '</body>' +\n '</html>'\n );\n}\n\nconst OUTLOOK_SETTINGS =\n '<!--[if mso]><noscript><xml><o:OfficeDocumentSettings>' +\n '<o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch>' +\n '</o:OfficeDocumentSettings></xml></noscript><![endif]-->';\n\nconst BODY_STYLE =\n 'margin: 0; padding: 0; word-spacing: normal; ' +\n '-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%;';\n\n/** Hidden everywhere (`mso-hide` for Outlook, which ignores `display: none`\n on a div). */\nconst PREVIEW_STYLE = 'display: none; max-height: 0; overflow: hidden; mso-hide: all;';\n\n/** Invisible filler after the preview text: clients fill the snippet up to\n its length, and without the filler they would pull in the body's first\n words. Combining grapheme joiner, zero-width non-joiner and a no-break\n space per step — none renders, each counts as a character. */\nconst PREVIEW_FILLER = '͏‌ '.repeat(90);\n\nfunction previewBlock(text: string): string {\n return `<div style=\"${PREVIEW_STYLE}\">${escapeText(text)}${PREVIEW_FILLER}</div>`;\n}\n","import { Command, EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { DOMSerializer, Node, Schema } from 'prosemirror-model';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { parseHTML, serializeToHTML } from '../html';\n\n/**\n * The quoted history a reply or forward answers — Gmail's `⋯` — kept\n * **beside** the body, never in it.\n *\n * - **It stays.** The history is the document's `quoted` attribute, not its\n * content: a template applied, an `.eml` dropped, the source pane\n * rewritten — anything that replaces the body (`setContent`, `setText`,\n * `replaceHTML`) leaves it where it is. `getHTML()` is the body alone.\n * - **Only a deliberate step changes it.** The trash drops it; Edit moves it\n * into the body, where it is ordinary text from then on. Both are steps of\n * the document, so one undo brings it back — Edit's undo takes the text\n * out of the body again in the same step.\n * - **It is sent.** The send intent puts it under the body\n * ({@link withQuoted}): HTML, plain text and inline images alike.\n * - **It is what the schema keeps.** Whatever comes in is parsed through the\n * schema the way a paste is — foreign markup repaired, unsafe markup gone —\n * and held as canonical HTML.\n *\n * It renders as a widget after the last block — read-only, folded behind a\n * `⋯` toggle, with Edit and a trash beside it. Behaviour and structure ship\n * here; pixels are the host's, through `.aee-quoted` and its `data-slot`\n * parts (`bar`, `fold`, `edit`, `remove`, `content`), the fold button keeping\n * its `.aee-quote-fold` class.\n */\nexport interface QuotedHistoryLabels {\n /** The fold toggle while folded. Default \"Show quoted text\". */\n show?: QuotedHistoryLabel;\n /** The fold toggle while open. Default \"Hide quoted text\". */\n hide?: QuotedHistoryLabel;\n /** Moves the history into the body. Default \"Edit quoted text\". */\n edit?: QuotedHistoryLabel;\n /** Drops the history. Default \"Remove quoted text\". */\n remove?: QuotedHistoryLabel;\n}\n\n/** A word, or a function asked for it each time the widget is drawn or\n brought up to date — so a language switched at runtime reaches it. */\nexport type QuotedHistoryLabel = string | (() => string);\n\nconst word = (label: QuotedHistoryLabel): string => (typeof label === 'function' ? label() : label);\n\nexport interface QuotedHistoryOptions {\n /** The widget's words, in the host's language; each left out stays English. */\n labels?: QuotedHistoryLabels;\n}\n\nconst ENGLISH: Required<QuotedHistoryLabels> = {\n show: 'Show quoted text',\n hide: 'Hide quoted text',\n edit: 'Edit quoted text',\n remove: 'Remove quoted text',\n};\n\n/** The quoted history, as canonical HTML, or null. */\nexport function quotedHistory(state: EditorState): string | null {\n return (state.doc.attrs['quoted'] as string | null | undefined) ?? null;\n}\n\n/** Whether the quoted history is folded behind its `⋯` — true while there\n is one and the user has not opened it. */\nexport function isQuotedHistoryFolded(state: EditorState): boolean {\n return quotedHistory(state) !== null && !quotedKey.getState(state)?.expanded;\n}\n\n/** The history as schema content — parsed the way a paste is. */\nfunction quotedContent(html: string, schema: Schema): Node {\n return parseHTML(html, schema);\n}\n\n/** The document with its quoted history under the body — what is sent. */\nexport function withQuoted(doc: Node): Node {\n const quoted = doc.attrs['quoted'] as string | null | undefined;\n if (!quoted) return doc;\n const history = quotedContent(quoted, doc.type.schema);\n return doc.type.create(doc.attrs, doc.content.append(history.content), doc.marks);\n}\n\n/** Sets the quoted history — sanitized through the schema — or drops it.\n False when that is what it already is. A host's own sync marks the\n transaction as such (the editor's `setQuoted` does). */\nexport const setQuotedHistory =\n (html: string | null): Command =>\n (state, dispatch) => {\n const canonical = html ? serializeToHTML(quotedContent(html, state.schema), state.schema) : null;\n if (canonical === quotedHistory(state)) return false;\n dispatch?.(state.tr.setDocAttribute('quoted', canonical));\n return true;\n };\n\n/** The trash: the history goes — as a step, so undo brings it back. */\nexport const removeQuotedHistory: Command = (state, dispatch) => {\n if (quotedHistory(state) === null) return false;\n dispatch?.(state.tr.setDocAttribute('quoted', null));\n return true;\n};\n\n/** Edit: the history moves to the end of the body, as ordinary text, and\n stops being kept — one step, so one undo reverses both. */\nexport const editQuotedHistory: Command = (state, dispatch) => {\n const quoted = quotedHistory(state);\n if (quoted === null) return false;\n if (dispatch) {\n const content = quotedContent(quoted, state.schema).content;\n dispatch(\n state.tr\n .insert(state.doc.content.size, content)\n .setDocAttribute('quoted', null)\n .scrollIntoView(),\n );\n }\n return true;\n};\n\ninterface QuotedState {\n /** The user opened the fold. A new history starts folded again. */\n expanded: boolean;\n /** Counts the histories this editor has held — the widget re-renders when\n it moves, and only then. */\n version: number;\n}\n\ntype QuotedMeta = { expanded: boolean };\n\nconst quotedKey = new PluginKey<QuotedState>('quotedHistory');\n\nconst setExpanded =\n (expanded: boolean): Command =>\n (state, dispatch) => {\n if (quotedHistory(state) === null || isQuotedHistoryFolded(state) === !expanded) return false;\n dispatch?.(state.tr.setMeta(quotedKey, { expanded } satisfies QuotedMeta));\n return true;\n };\n\n/** The quoted history as an editor extension — see {@link QuotedHistoryLabels}\n for its words. The email kit carries it as {@link QuotedHistory}. */\nexport function createQuotedHistory(options: QuotedHistoryOptions = {}): FunctionalExtension {\n const labels = { ...ENGLISH, ...options.labels };\n\n return defineExtension({\n name: 'quotedHistory',\n commands: () => ({\n /** Shows the quoted history (the `⋯` button's action). */\n expandQuotedHistory: (): Command => setExpanded(true),\n /** Folds it back behind the `⋯`. */\n foldQuotedHistory: (): Command => setExpanded(false),\n /** Moves it into the body as ordinary text. */\n editQuotedHistory: (): Command => editQuotedHistory,\n /** Drops it. */\n removeQuotedHistory: (): Command => removeQuotedHistory,\n /** Replaces it — sanitized — or drops it with `null`. */\n setQuotedHistory: (html: string | null): Command => setQuotedHistory(html),\n }),\n plugins: () => [\n new Plugin<QuotedState>({\n key: quotedKey,\n state: {\n init: () => ({ expanded: false, version: 0 }),\n apply(tr, value): QuotedState {\n let next = value;\n if (tr.docChanged && tr.before.attrs['quoted'] !== tr.doc.attrs['quoted']) {\n next = { expanded: false, version: value.version + 1 };\n }\n const meta = tr.getMeta(quotedKey) as QuotedMeta | undefined;\n if (meta && meta.expanded !== next.expanded) next = { ...next, expanded: meta.expanded };\n return next;\n },\n },\n props: {\n decorations(state) {\n const quoted = quotedHistory(state);\n if (quoted === null) return null;\n const { version } = quotedKey.getState(state)!;\n return DecorationSet.create(state.doc, [\n Decoration.widget(state.doc.content.size, (view) => render(view, quoted, labels), {\n side: 1,\n key: `aee-quoted-${version}`,\n ignoreSelection: true,\n stopEvent: () => true,\n }),\n ]);\n },\n },\n // The fold is state, the widget keeps its element across it — so a\n // keyboard user's focus stays on the toggle they pressed.\n view: (view) => {\n reflect(view, labels);\n return { update: (updated) => reflect(updated, labels) };\n },\n }),\n ],\n });\n}\n\n/** The email kit's quoted history, in English. */\nexport const QuotedHistory = createQuotedHistory();\n\nfunction render(view: EditorView, quoted: string, labels: Required<QuotedHistoryLabels>): HTMLElement {\n const doc = view.dom.ownerDocument;\n const box = doc.createElement('div');\n box.className = 'aee-quoted';\n box.setAttribute('contenteditable', 'false');\n\n const bar = doc.createElement('div');\n bar.dataset['slot'] = 'bar';\n const button = (slot: string, className: string, run: Command, icon: string) => {\n const element = doc.createElement('button');\n element.type = 'button';\n element.dataset['slot'] = slot;\n if (className) element.className = className;\n element.innerHTML = icon;\n // A presentation toggle or a command, never a caret move: the editor\n // keeps its selection and focus.\n element.addEventListener('mousedown', (event) => event.preventDefault());\n element.addEventListener('click', () => run(view.state, view.dispatch, view));\n bar.appendChild(element);\n };\n button(\n 'fold',\n 'aee-quote-fold',\n (state, dispatch) => setExpanded(isQuotedHistoryFolded(state))(state, dispatch),\n '⋯',\n );\n button('edit', '', editQuotedHistory, PENCIL);\n button('remove', '', removeQuotedHistory, TRASH);\n box.appendChild(bar);\n\n const content = doc.createElement('div');\n content.dataset['slot'] = 'content';\n const history = quotedContent(quoted, view.state.schema);\n content.appendChild(DOMSerializer.fromSchema(view.state.schema).serializeFragment(history.content, { document: doc }));\n box.appendChild(content);\n\n reflectOn(box, isQuotedHistoryFolded(view.state), labels);\n return box;\n}\n\n/** Brings the rendered widget in line with the fold state. */\nfunction reflect(view: EditorView, labels: Required<QuotedHistoryLabels>): void {\n const box = view.dom.querySelector<HTMLElement>(':scope > .aee-quoted');\n if (box) reflectOn(box, isQuotedHistoryFolded(view.state), labels);\n}\n\nfunction reflectOn(box: HTMLElement, folded: boolean, labels: Required<QuotedHistoryLabels>): void {\n box.toggleAttribute('data-folded', folded);\n const name = (slot: string, label: QuotedHistoryLabel) => {\n const button = box.querySelector<HTMLElement>(`[data-slot=${slot}]`)!;\n button.setAttribute('aria-label', word(label));\n button.title = word(label);\n return button;\n };\n name('fold', folded ? labels.show : labels.hide).setAttribute('aria-expanded', String(!folded));\n name('edit', labels.edit);\n name('remove', labels.remove);\n box.querySelector<HTMLElement>('[data-slot=content]')!.hidden = folded;\n}\n\n// Own 1em glyphs — no icon font, no dependency; they take the button's colour.\nconst PENCIL =\n '<svg viewBox=\"0 0 24 24\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" fill=\"currentColor\"><path d=\"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z\"/></svg>';\nconst TRASH =\n '<svg viewBox=\"0 0 24 24\" width=\"1em\" height=\"1em\" aria-hidden=\"true\" fill=\"currentColor\"><path d=\"M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z\"/></svg>';\n","import { defineNode } from '../../extension';\n\n/**\n * The document root. Two attributes, neither of them content:\n *\n * - `envelope` holds a parsed document's surroundings — doctype,\n * `<html>`/`<body>` attributes, the canonical head — when the source\n * carried them (see `DocumentEnvelope`); `null` for a bare body fragment,\n * which is what the composer produces on its own. The serializer wraps the\n * body in it, the editor never shows it. It comes *with* content: a\n * replacement brings its own.\n * - `quoted` holds the quoted history a reply or forward answers — canonical\n * HTML, or `null` (see `QuotedHistory`). It stays *beside* the content: a\n * replacement of the body never touches it; only a deliberate step does.\n */\nexport const Document = defineNode({\n name: 'doc',\n topNode: true,\n spec: { content: 'block+', attrs: { envelope: { default: null }, quoted: { default: null } } },\n});\n\n/** The document attributes that come with content — what a replacement of\n the body carries over from the new document. Every other one stays. */\nexport const CONTENT_ATTRS: readonly string[] = ['envelope'];\n","import { setBlockType } from 'prosemirror-commands';\nimport { defineNode } from '../../extension';\n\nexport const Paragraph = defineNode({\n name: 'paragraph',\n spec: {\n content: 'inline*',\n group: 'block',\n parseDOM: [\n {\n tag: 'p',\n getAttrs: (dom) => {\n if (!(dom instanceof HTMLElement)) {\n return false;\n }\n\n return {};\n },\n },\n ],\n toDOM: () => ['p', { dir: 'auto' }, 0],\n },\n commands: ({ schema }) => ({\n setParagraph: () => setBlockType(schema.nodes['paragraph']),\n }),\n keymap: ({ schema }) => ({\n 'Mod-Alt-0': setBlockType(schema.nodes['paragraph']),\n }),\n actions: ({ schema }) => [\n {\n id: 'text',\n section: 'blocks',\n title: 'Text',\n keywords: ['paragraph', 'plain'],\n icon: 'notes',\n command: setBlockType(schema.nodes['paragraph']),\n },\n ],\n});\n","import { Command, EditorState, Plugin } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { MarkType, Node, NodeType, Schema } from 'prosemirror-model';\nimport { keymap } from 'prosemirror-keymap';\nimport { InputRule, inputRules } from 'prosemirror-inputrules';\nimport {\n CommandFactory,\n EditorAction,\n Extension,\n ExtensionContext,\n extensionActions,\n} from './extension';\nimport { createSchema } from './schema';\nimport { parseHTML, serializeToHTML } from './html';\nimport { markAttrsOf, soleInlineAtom } from './extensions/inline-atoms';\nimport { CONTENT_ATTRS } from './extensions/nodes/document';\nimport { quotedHistory, setQuotedHistory } from './extensions/quoted-history';\nimport { ParseMode } from './parse-mode';\n\nexport interface EditorOptions {\n /** Element the editable view is mounted into. */\n parent: HTMLElement;\n extensions: Extension[];\n /** Initial content as HTML. */\n content?: string;\n /** The quoted history a reply or forward answers, as HTML (`replyQuote`,\n `forwardQuote`) — kept beside the body, never replaced with it. See\n `QuotedHistory`. */\n quoted?: string | null;\n /** How `content` and `setContent` parse markup. Default `email`: every\n tag, attribute and CSS property Apple Mail, Outlook or Gmail applies is\n recognized — as the kit's own nodes and marks wherever their rules\n accept it (a table is a table, `<b>` is bold) — and kept exactly as\n authored (authored.ts); a whole document keeps its head and\n conditional comments. `preserve` additionally keeps what no floor\n client applies — the opt-in for special needs. `repair` rewrites into\n canonical blocks through the import pipeline (import-html.ts), as the\n paste path always does. */\n parseMode?: ParseMode;\n /** DOM attributes for the editable element. */\n attributes?: Record<string, string>;\n /** Called after every transaction that changed the document. */\n onUpdate?: (editor: Editor) => void;\n}\n\nexport interface Editor {\n view: EditorView;\n schema: Schema;\n readonly state: EditorState;\n /**\n * Named commands collected from all extensions, bound to the live view:\n * `editor.commands.toggleBold()` runs immediately and returns whether it applied.\n */\n commands: Record<string, (...args: any[]) => boolean>;\n /** Every action the editor's extensions declare, in kit order — what a\n toolbar, a bubble menu or a `/` menu shows. */\n readonly actions: readonly EditorAction[];\n /** Runs a raw ProseMirror command against the current state. */\n exec(command: Command): boolean;\n /**\n * Calls `listener` after every change of the editor's state — the text,\n * the selection, a stored mark — and returns the way to stop. Unlike\n * `onUpdate` (document changes, given at creation) it can be asked of an\n * editor that already exists, which is what lets a toolbar bind to one.\n */\n subscribe(listener: (editor: Editor) => void): () => void;\n /** Whether a node or mark with the given name (and attrs) is active at the selection. */\n isActive(name: string, attrs?: Record<string, any>): boolean;\n getHTML(): string;\n /** Replaces the document with the given HTML, applied as a minimal diff:\n unchanged content keeps its positions, so selection, scroll and plugin\n state survive. The change counts as an external sync — it never enters\n the undo history and never fires `onUpdate`, so editors mirroring each\n other cannot echo. */\n setContent(html: string): void;\n /** The quoted history, as canonical HTML, or null — the part of the\n message {@link getHTML} leaves out and the send intent puts back. */\n getQuoted(): string | null;\n /** Replaces the quoted history — sanitized through the schema — or drops\n it. Same external-sync semantics as {@link setContent}. */\n setQuoted(html: string | null): void;\n /** The document as plain text: top-level blocks joined with newlines. */\n getText(): string;\n /** Replaces the document with plain text, one default block per line.\n Same external-sync semantics as {@link setContent}. */\n setText(text: string): void;\n focus(): void;\n destroy(): void;\n}\n\nexport function createEditor(options: EditorOptions): Editor {\n const schema = createSchema(options.extensions);\n const ctx: ExtensionContext = { schema, extensions: options.extensions };\n const parse = (html: string) => parseHTML(html, schema, { mode: options.parseMode ?? 'email' });\n\n // Extension plugins run before all keymaps so interactive plugins (slash\n // menu, ...) can claim keys like Enter ahead of node bindings.\n const extensionPlugins: Plugin[] = [];\n const keymaps: Plugin[] = [];\n const rules: InputRule[] = [];\n const commandFactories: Record<string, CommandFactory> = {};\n\n for (const extension of options.extensions) {\n if (extension.keymap) keymaps.push(keymap(extension.keymap(ctx)));\n if (extension.inputRules) rules.push(...extension.inputRules(ctx));\n if (extension.plugins) extensionPlugins.push(...extension.plugins(ctx));\n if (extension.commands) Object.assign(commandFactories, extension.commands(ctx));\n }\n\n const plugins: Plugin[] = [...extensionPlugins, ...keymaps];\n if (rules.length) plugins.push(inputRules({ rules }));\n\n // The editable root always carries our own identity class alongside the\n // `.ProseMirror` one the view adds: all styling (ours and the host app's)\n // scopes to `.aee-editor`, so another ProseMirror instance living in the\n // same application is never touched by this editor's CSS.\n const attributes = {\n ...options.attributes,\n class: ['aee-editor', options.attributes?.['class']].filter(Boolean).join(' '),\n };\n\n const view = new EditorView(options.parent, {\n state: EditorState.create({\n doc: options.content ? parse(options.content) : undefined,\n schema,\n plugins,\n }),\n attributes,\n dispatchTransaction(transaction) {\n // Plugins may append transactions (the merge-tag invariants turn a\n // stored-mark toggle into a whole-token mark): the document can change\n // even when the dispatched transaction itself did not. Judge by all of\n // them, or the html signal falls behind the editor.\n const { state, transactions } = view.state.applyTransaction(transaction);\n view.updateState(state);\n for (const listener of listeners) listener(editor);\n if (\n transactions.some((applied) => applied.docChanged) &&\n !transaction.getMeta('externalSync')\n ) {\n options.onUpdate?.(editor);\n }\n },\n });\n\n const exec = (command: Command) => command(view.state, view.dispatch, view);\n const listeners = new Set<(editor: Editor) => void>();\n const setQuoted = (html: string | null) =>\n setQuotedHistory(html)(view.state, (tr) =>\n view.dispatch(tr.setMeta('addToHistory', false).setMeta('externalSync', true)),\n );\n\n const commands: Editor['commands'] = {};\n for (const [name, factory] of Object.entries(commandFactories)) {\n commands[name] = (...args) => exec(factory(...args));\n }\n\n const editor: Editor = {\n view,\n schema,\n get state() {\n return view.state;\n },\n commands,\n actions: extensionActions(ctx),\n exec,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n isActive(name, attrs) {\n const nodeType = schema.nodes[name];\n if (nodeType) return isNodeActive(view.state, nodeType, attrs);\n const markType = schema.marks[name];\n if (markType) return isMarkActive(view.state, markType);\n return false;\n },\n getHTML: () => serializeToHTML(view.state.doc, schema),\n setContent(html) {\n syncDoc(view, parse(html));\n },\n getQuoted: () => quotedHistory(view.state),\n setQuoted,\n getText() {\n const lines: string[] = [];\n view.state.doc.forEach((node) => lines.push(node.textContent));\n return lines.join('\\n');\n },\n setText(text) {\n const lineType = schema.topNodeType.contentMatch.defaultType;\n if (!lineType) throw new Error('setText: schema has no default block type');\n const lines = text\n .split('\\n')\n .map((line) => lineType.create(null, line ? schema.text(line) : null));\n syncDoc(view, schema.topNodeType.create(null, lines));\n },\n focus: () => view.focus(),\n destroy: () => {\n listeners.clear();\n view.destroy();\n },\n };\n\n if (options.quoted) setQuoted(options.quoted);\n return editor;\n}\n\n/**\n * Applies a new document as a minimal diff transaction. Content outside the\n * changed range keeps its positions, so the receiving editor's selection,\n * scroll and plugin state survive — and its own undo history stays intact:\n * the sync is flagged `addToHistory: false` (external changes aren't yours\n * to undo) and `externalSync` (so `dispatchTransaction` skips `onUpdate`,\n * keeping mirrored editors echo-free).\n */\nfunction syncDoc(view: EditorView, doc: Node): void {\n const previous = view.state.doc;\n if (previous.eq(doc)) return;\n\n let tr = view.state.tr;\n const start = previous.content.findDiffStart(doc.content);\n const end = start === null ? null : previous.content.findDiffEnd(doc.content);\n if (start !== null && end) {\n let { a: endA, b: endB } = end;\n // With overlapping diffs (repeated content) the end can fall before the\n // start; widen both ends so the replaced range stays valid.\n const overlap = start - Math.min(endA, endB);\n if (overlap > 0) {\n endA += overlap;\n endB += overlap;\n }\n\n try {\n tr.replace(start, endA, doc.slice(start, endB));\n } catch {\n tr = null!;\n }\n // The slice is open at both ends, and where its ends stand at different\n // depths ProseMirror *fits* it rather than refusing: it closes and reopens\n // the nodes around the gap, leaving a duplicated row here, a column at its\n // default width there. Neither is the document that was asked for. A\n // slice the schema cannot fit at all throws instead. Either way, fall\n // back to replacing the whole document — still one transaction, so the\n // history semantics hold; only the selection lands less precisely.\n if (!tr || !tr.doc.content.eq(doc.content)) {\n tr = view.state.tr.replaceWith(0, previous.content.size, doc.content);\n }\n }\n // The document's own attributes (the envelope: doctype, head, body attrs)\n // are not content — a head-only edit is an attribute step, not a diff.\n // Only those that come with content follow it; the quoted history stays.\n for (const name of CONTENT_ATTRS) {\n const value = doc.attrs[name] ?? null;\n if (JSON.stringify(previous.attrs[name] ?? null) !== JSON.stringify(value)) {\n tr.setDocAttribute(name, value);\n }\n }\n if (!tr.steps.length) return;\n view.dispatch(tr.setMeta('addToHistory', false).setMeta('externalSync', true));\n}\n\n/**\n * The selected node that carries `type` as an attribute instead of as a\n * mark — or null. An atom that paints its own text (a button: its label is\n * an attribute, and it allows no marks) names the marks it takes this way\n * in its spec, `markAttrs: ['bold', 'italic']`, each a boolean attribute of\n * the mark's name. Bold and italic then work on it as on text — the\n * toolbar, the bubble menu, Mod-B — through {@link isMarkActive} and the\n * kit's `toggleMark`. The atom is the selection's whole content (clicked,\n * or dragged over with nothing but whitespace, `soleInlineAtom`); in a\n * range with text the kit's `setMark` flips it along with the text.\n */\nexport function selectedMarkAtom(\n state: EditorState,\n type: MarkType,\n): { pos: number; node: Node } | null {\n const atom = soleInlineAtom(state);\n return atom && markAttrsOf(atom.node).includes(type.name) ? atom : null;\n}\n\n/** Whether the mark is on in the selection: at a caret, what typing would\n carry; in a range, whether any of it has the mark — text marked, or an\n atom whose attribute for it is on (a bold button). */\nexport function isMarkActive(state: EditorState, type: MarkType): boolean {\n const atom = selectedMarkAtom(state, type);\n if (atom) return atom.node.attrs[type.name] === true;\n const { empty, $from, from, to } = state.selection;\n if (empty) return Boolean(type.isInSet(state.storedMarks ?? $from.marks()));\n if (state.doc.rangeHasMark(from, to, type)) return true;\n let active = false;\n state.doc.nodesBetween(from, to, (node) => {\n if (markAttrsOf(node).includes(type.name) && node.attrs[type.name] === true) active = true;\n return !active;\n });\n return active;\n}\n\n/** Checks the selection's whole ancestor chain, so wrapper nodes\n (blockquote, lists) report active even though the cursor's direct\n parent is a paragraph. */\nexport function isNodeActive(\n state: EditorState,\n type: NodeType,\n attrs?: Record<string, any>,\n): boolean {\n const { $from } = state.selection;\n\n for (let depth = $from.depth; depth > 0; depth--) {\n const node = $from.node(depth);\n if (node.type !== type) continue;\n if (!attrs || Object.entries(attrs).every(([key, value]) => node.attrs[key] === value)) {\n return true;\n }\n }\n\n return false;\n}\n","import {\n liftListItem,\n sinkListItem,\n splitListItem as pmSplitListItem,\n wrapInList,\n} from 'prosemirror-schema-list';\nimport { wrappingInputRule } from 'prosemirror-inputrules';\nimport { Command } from 'prosemirror-state';\nimport { NodeType, ResolvedPos } from 'prosemirror-model';\nimport { isNodeActive } from '../../editor';\nimport { defineNode } from '../../extension';\n\n/** Depth of the innermost list wrapping the selection start, or null. */\nexport const findListDepth = ($from: ResolvedPos): number | null => {\n for (let depth = $from.depth; depth > 0; depth--) {\n if ($from.node(depth).type.spec.content?.startsWith('listItem')) return depth;\n }\n return null;\n};\n\n/**\n * Wraps the selection in a list, lifts out of it when already in that list,\n * or converts the list in place when it is of the other flavour.\n */\nexport const toggleList =\n (listType: NodeType, itemType: NodeType): Command =>\n (state, dispatch, view) => {\n const { $from } = state.selection;\n const depth = findListDepth($from);\n if (depth === null) return wrapInList(listType)(state, dispatch);\n if ($from.node(depth).type === listType) return liftListItem(itemType)(state, dispatch, view);\n dispatch?.(state.tr.setNodeMarkup($from.before(depth), listType));\n return true;\n };\n\n/**\n * Tiptap-inspired helper: Intercepts the default splitListItem transaction\n * and ensures marks (bold, italic, etc.) are carried over to the new list item.\n */\nexport const splitListItemKeepMarks =\n (itemType: NodeType): Command =>\n (state, dispatch, view) => {\n return pmSplitListItem(itemType)(\n state,\n (tr) => {\n const marks =\n state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n\n if (marks) {\n tr.ensureMarks(marks);\n }\n\n dispatch?.(tr);\n },\n view,\n );\n };\n\n/** The ledger's answer to the 40px-per-level default indent that eats a\n third of a phone screen: a small explicit indent, no margins (lines carry\n none). Nested lists compound 24px per level, readable at 320px. */\nexport const LIST_STYLE = 'margin: 0px; padding-left: 24px;';\n\nexport const ListItem = defineNode({\n name: 'listItem',\n spec: {\n content: 'paragraph block*',\n defining: true,\n parseDOM: [{ tag: 'li' }],\n toDOM: () => ['li', 0],\n },\n // These return false outside a list, so they fall through to the base keymap.\n keymap: ({ schema }) => ({\n // Use the custom mark-preserving split command here\n Enter: splitListItemKeepMarks(schema.nodes['listItem']),\n Tab: sinkListItem(schema.nodes['listItem']),\n 'Shift-Tab': liftListItem(schema.nodes['listItem']),\n }),\n});\n\nexport const BulletList = defineNode({\n name: 'bulletList',\n spec: {\n content: 'listItem+',\n group: 'block list',\n parseDOM: [{ tag: 'ul' }],\n toDOM: () => ['ul', { style: LIST_STYLE }, 0],\n },\n commands: ({ schema }) => ({\n toggleBulletList: () => toggleList(schema.nodes['bulletList'], schema.nodes['listItem']),\n }),\n keymap: ({ schema }) => ({\n 'Shift-Ctrl-8': toggleList(schema.nodes['bulletList'], schema.nodes['listItem']),\n }),\n inputRules: ({ schema }) => [\n // `- `, `* ` or `+ ` at the start of a block becomes a bullet list.\n wrappingInputRule(/^\\s*([-+*])\\s$/, schema.nodes['bulletList']),\n ],\n actions: ({ schema }) => [\n {\n id: 'bulleted-list',\n section: 'blocks',\n title: 'Bulleted list',\n keywords: ['ul', 'unordered', 'list'],\n icon: 'format_list_bulleted',\n command: toggleList(schema.nodes['bulletList'], schema.nodes['listItem']),\n isActive: (state) => isNodeActive(state, schema.nodes['bulletList']),\n },\n ],\n});\n\nexport const OrderedList = defineNode({\n name: 'orderedList',\n spec: {\n attrs: { order: { default: 1 } },\n content: 'listItem+',\n group: 'block list',\n parseDOM: [\n {\n tag: 'ol',\n getAttrs: (node) => ({\n order: node.hasAttribute('start') ? +node.getAttribute('start')! : 1,\n }),\n },\n ],\n toDOM: (node) =>\n node.attrs['order'] === 1\n ? ['ol', { style: LIST_STYLE }, 0]\n : ['ol', { start: node.attrs['order'], style: LIST_STYLE }, 0],\n },\n commands: ({ schema }) => ({\n toggleOrderedList: () => toggleList(schema.nodes['orderedList'], schema.nodes['listItem']),\n }),\n keymap: ({ schema }) => ({\n 'Shift-Ctrl-9': toggleList(schema.nodes['orderedList'], schema.nodes['listItem']),\n }),\n inputRules: ({ schema }) => [\n // `1. ` at the start of a block becomes an ordered list starting there.\n wrappingInputRule(\n /^(\\d+)\\.\\s$/,\n schema.nodes['orderedList'],\n (match) => ({ order: +match[1] }),\n (match, node) => node.childCount + node.attrs['order'] === +match[1],\n ),\n ],\n actions: ({ schema }) => [\n {\n id: 'numbered-list',\n section: 'blocks',\n title: 'Numbered list',\n keywords: ['ol', 'ordered', 'list'],\n icon: 'format_list_numbered',\n command: toggleList(schema.nodes['orderedList'], schema.nodes['listItem']),\n isActive: (state) => isNodeActive(state, schema.nodes['orderedList']),\n },\n ],\n});\n","import { setBlockType } from 'prosemirror-commands';\nimport { liftListItem, sinkListItem } from 'prosemirror-schema-list';\nimport { Command, EditorState } from 'prosemirror-state';\nimport { Fragment, ResolvedPos } from 'prosemirror-model';\nimport { isNodeActive } from '../../editor';\nimport { defineNode } from '../../extension';\nimport { findListDepth } from './lists';\n\nconst BLOCK_TAGS = new Set([\n 'P',\n 'DIV',\n 'UL',\n 'OL',\n 'BLOCKQUOTE',\n 'PRE',\n 'TABLE',\n 'FIGURE',\n 'H1',\n 'H2',\n 'H3',\n 'H4',\n 'H5',\n 'H6',\n]);\n\nfunction hasBlockChildren(node: HTMLElement) {\n for (const child of node.children) {\n if (BLOCK_TAGS.has(child.tagName)) return true;\n }\n\n return false;\n}\n\nexport type ParagraphAlignment = 'center' | 'right' | null;\n\n/** One indent level, in px — Gmail's step, and what its own indented\n messages carry, so the two round-trip into each other. */\nexport const INDENT_STEP = 40;\n\n/** The deepest indent offered: eight steps are 320px, a phone screen's\n worth of margin — past that a line has no room left to say anything. */\nexport const INDENT_MAX = 8;\n\n/**\n * A line whose sole content is one `<br>` — the empty-line *marker* our own\n * `emitDOM` writes (mail clients collapse a truly empty div). It must parse\n * back to an **empty** paragraph: read as a hardBreak instead, the editor\n * renders marker + its own trailing break as a double-height blank line,\n * while the serialized bytes (and thus the preview) show a single one — the\n * one honest height.\n */\nfunction isEmptyLineMarker(node: HTMLElement): boolean {\n if (node.children.length !== 1 || node.children[0].tagName !== 'BR') return false;\n return !(node.textContent ?? '').trim();\n}\n\n/** Left is the default and canonicalizes to `null` — `text-align: left`\n never serializes, so unaligned text stays free of declarations (which\n also keeps `dir=\"auto\"` meaningful for RTL). Justify is not offered:\n Outlook's Word engine mangles it. */\nfunction alignmentOf(node: HTMLElement): ParagraphAlignment {\n const align = node.style?.textAlign || node.getAttribute('align');\n return align === 'center' || align === 'right' ? align : null;\n}\n\n/** The indent a line carries, in steps: its start margin in px, rounded to\n the step and capped. Only a px margin counts — an em or a percentage is\n someone else's layout, not an indent — and none canonicalizes to 0,\n which serializes to nothing. */\nfunction indentOf(node: HTMLElement): number {\n const margin = node.style?.marginLeft || node.style?.marginInlineStart || '';\n const px = /^(\\d+(?:\\.\\d+)?)px$/.exec(margin.trim());\n if (!px) return 0;\n return Math.min(INDENT_MAX, Math.max(0, Math.round(parseFloat(px[1]) / INDENT_STEP)));\n}\n\nfunction attrsOf(node: HTMLElement) {\n const spacing = spacingOf(node);\n // With a box of its own the line's margins are the box's: no indent read\n // off the same margin-left twice.\n return {\n align: alignmentOf(node),\n indent: spacing ? 0 : indentOf(node),\n spacing,\n lineHeight: lineHeightOf(node),\n };\n}\n\n/** A line's own `line-height`: a number, a percentage or px, as written;\n `normal` and anything else is the client's. */\nfunction lineHeightOf(node: HTMLElement): string | null {\n const value = node.style?.lineHeight?.trim() ?? '';\n return /^\\d+(?:\\.\\d+)?(?:px|%)?$/.test(value) ? value : null;\n}\n\n/** The room a line keeps round itself — a builder's cell padding, carried\n onto the line (the import shares a dissolved cell's box out): its\n `padding`, else its `margin` where that is more than the indent's\n `margin-left` alone; as the four sides in px, `t r b l` normalised the\n way the CSSOM prints a shorthand, or null for none. */\nfunction spacingOf(node: HTMLElement): string | null {\n const style = node.style;\n if (!style) return null;\n const px = (value: string) => /^(\\d+(?:\\.\\d+)?)px$/.exec(value.trim())?.[1] ?? null;\n const sides = (prefix: 'padding' | 'margin'): [string, string, string, string] | null => {\n const raw = [\n style.getPropertyValue(`${prefix}-top`),\n style.getPropertyValue(`${prefix}-right`),\n style.getPropertyValue(`${prefix}-bottom`),\n style.getPropertyValue(`${prefix}-left`),\n ].map((side) => (side ? px(side) : '0'));\n if (raw.some((side) => side === null)) return null;\n const box = raw as [string, string, string, string];\n return box.some((side) => parseFloat(side) > 0) ? box : null;\n };\n const padding = sides('padding');\n const margin = sides('margin');\n // A margin-left alone is the indent, read elsewhere.\n const box =\n padding ??\n (margin && (margin[0] !== '0' || margin[1] !== '0' || margin[2] !== '0') ? margin : null);\n if (!box) return null;\n const probe = document.createElement('div');\n probe.style.margin = box.map((side) => `${side}px`).join(' ');\n return probe.style.margin || null;\n}\n\n/** The inline style a paragraph serializes with — none when it carries\n neither an alignment, an indent, a spacing nor a line height. A spacing\n is written as `margin`: what the Word engine honours on a block (a\n padding it does not), and Gmail the same; the indent rides on its left\n side. A line height is written as MJML writes it, bare: the Word engine\n takes it as a minimum (an `mso-line-height-rule` would not survive —\n the serializer sets a style through the CSSOM, which drops what it does\n not know). */\nfunction styleOf(attrs: Record<string, any>): { style: string } | Record<never, never> {\n const indent = (attrs['indent'] ?? 0) * INDENT_STEP;\n const declarations = [\n attrs['align'] && `text-align: ${attrs['align']};`,\n attrs['spacing']\n ? `margin: ${indent > 0 ? withLeft(attrs['spacing'], indent) : attrs['spacing']};`\n : indent > 0 && `margin-left: ${indent}px;`,\n attrs['lineHeight'] && `line-height: ${attrs['lineHeight']};`,\n ].filter(Boolean);\n return declarations.length ? { style: declarations.join(' ') } : {};\n}\n\n/** A spacing with an indent added to its left side — one `margin` says\n both; parsed back, the sum is the spacing's (the indent folded in). */\nfunction withLeft(spacing: string, extra: number): string {\n const probe = document.createElement('div');\n probe.style.margin = spacing;\n const left = /^(\\d+(?:\\.\\d+)?)px$/.exec(probe.style.marginLeft)?.[1] ?? '0';\n probe.style.marginLeft = `${parseFloat(left) + extra}px`;\n return probe.style.margin || spacing;\n}\n\n/**\n * The table cell the position sits in, if any — by the schema's own\n * `tableRole`, which is how prosemirror-tables marks its nodes, so nothing\n * here has to know that extension exists (a schema without tables never\n * matches, and never pays for the check).\n */\nfunction cellAround($pos: ResolvedPos): number | null {\n for (let depth = $pos.depth; depth > 0; depth--) {\n if ($pos.node(depth).type.spec['tableRole'] === 'cell') return $pos.before(depth);\n }\n return null;\n}\n\n/**\n * Applies an alignment to every paragraph the selection touches — and to\n * every table cell it touches that holds no paragraph to take it.\n *\n * A cell in this schema holds inline content directly (see the table node),\n * so there is no line inside it to align: the alignment belongs to the\n * `<td>`, which is where a mail client expects to read one anyway. That makes\n * one set of Align buttons do the obvious thing everywhere — a line, a\n * selection of lines, a cell, or a shift-dragged rectangle of them — instead\n * of going dead the moment the cursor enters a table.\n *\n * The selection's own `ranges` are what is walked, not one `from`–`to` span:\n * a cell selection carries one range per selected cell, so a rectangle\n * aligns exactly the cells in it and none of the ones it reaches across.\n */\nconst setAlignment =\n (align: ParagraphAlignment): Command =>\n (state, dispatch) => {\n const paragraph = state.schema.nodes['paragraph'];\n const tr = state.tr;\n const cells = new Set<number>();\n let applied = false;\n\n for (const range of state.selection.ranges) {\n const { $from, $to } = range;\n let lines = false;\n state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.type !== paragraph) return true;\n tr.setNodeMarkup(pos, undefined, { ...node.attrs, align });\n lines = true;\n applied = true;\n return false;\n });\n // Only where the range has no line of its own: a cell that does holds\n // its alignment on those, the way the rest of the document does.\n if (lines) continue;\n const cell = cellAround($from);\n if (cell !== null) cells.add(cell);\n }\n\n // Positions hold: `setNodeMarkup` swaps a node for one of the same size.\n for (const pos of cells) {\n const cell = tr.doc.nodeAt(pos);\n if (!cell) continue;\n tr.setNodeMarkup(pos, undefined, { ...cell.attrs, align });\n applied = true;\n }\n\n if (!applied) return false;\n dispatch?.(tr.scrollIntoView());\n return true;\n };\n\n/** Whether the selection is aligned that way. A line answers for itself\n wherever there is one — inside a cell too, for a host whose cells hold\n paragraphs; only where there is none does the cell answer. */\nconst isAligned = (state: EditorState, align: ParagraphAlignment): boolean => {\n const paragraph = state.schema.nodes['paragraph'];\n if (isNodeActive(state, paragraph)) return isNodeActive(state, paragraph, { align });\n const pos = cellAround(state.selection.$from);\n const cell = pos === null ? null : state.doc.nodeAt(pos);\n return !!cell && 'align' in cell.attrs && cell.attrs['align'] === align;\n};\n\n/**\n * Moves every paragraph the selection touches one step in (+1) or out (-1),\n * Gmail's \"Indent more\" / \"Indent less\". Inside a list the same gesture\n * nests the item or lifts it out instead — an indent there is structure,\n * not margin — so the one pair of buttons does the right thing in both\n * places. Returns false when nothing can move (the margin already, or a\n * list item that cannot nest further), so a keybinding falls through.\n */\nconst shiftIndent =\n (step: 1 | -1): Command =>\n (state, dispatch, view) => {\n const listItem = state.schema.nodes['listItem'];\n if (listItem && findListDepth(state.selection.$from) !== null) {\n const nest = step > 0 ? sinkListItem(listItem) : liftListItem(listItem);\n return nest(state, dispatch, view);\n }\n\n const { from, to } = state.selection;\n const paragraph = state.schema.nodes['paragraph'];\n const tr = state.tr;\n let applied = false;\n\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.type !== paragraph) return true;\n const indent = Math.min(INDENT_MAX, Math.max(0, (node.attrs['indent'] ?? 0) + step));\n if (indent !== node.attrs['indent']) {\n tr.setNodeMarkup(pos, undefined, { ...node.attrs, indent });\n applied = true;\n }\n return false;\n });\n\n if (!applied) return false;\n dispatch?.(tr.scrollIntoView());\n return true;\n };\n\n/**\n * Email flavour of the paragraph. Mail clients render the default margins of\n * `<p>` as double spacing, so email bodies use `<div>` lines instead — the\n * same model contenteditable composers (Gmail, Outlook) produce natively.\n *\n * A line carries its alignment and its indent (in steps of\n * {@link INDENT_STEP}); both serialize as inline style, the only style mail\n * clients keep, and both stay on the next line when Enter is pressed at the\n * line's end (see `splitKeepingMarks`), as they do in Gmail.\n */\nexport const EmailParagraph = defineNode({\n name: 'paragraph',\n spec: {\n content: 'inline*',\n group: 'block',\n // An authored line (MJML's styled `<div>`) keeps its markup (authored.ts);\n // aligning it back to the default writes `text-align: left` rather than\n // removing the declaration — an authored line usually sits in a container\n // with an alignment of its own (MJML cells centre), which it would inherit.\n authoredStyleDefaults: { 'text-align': 'left' },\n attrs: {\n align: { default: null },\n indent: { default: 0 },\n /** The room round the line, `t r b l` in px — a builder's cell\n padding carried over; emitted as `margin`. Null for none. */\n spacing: { default: null },\n /** The line's height as authored — `1`, `120%`, `22px` — a builder's\n text block carries one; null for the client's own. */\n lineHeight: { default: null },\n },\n parseDOM: [\n // The empty-line marker first (same tags, earlier rules win): its <br>\n // is transport syntax, not content — see {@link isEmptyLineMarker}.\n {\n tag: 'p',\n getAttrs: (node) => (isEmptyLineMarker(node) ? attrsOf(node) : false),\n getContent: () => Fragment.empty,\n },\n {\n tag: 'div',\n getAttrs: (node) => (isEmptyLineMarker(node) ? attrsOf(node) : false),\n getContent: () => Fragment.empty,\n },\n { tag: 'p', getAttrs: (node) => attrsOf(node) },\n // Divs holding inline content are lines. Container divs do not match,\n // so the parser descends into their children instead.\n {\n tag: 'div',\n getAttrs: (node) => (hasBlockChildren(node) ? false : attrsOf(node)),\n },\n ],\n toDOM: (node) => ['div', { dir: 'auto', ...styleOf(node.attrs) }, 0],\n // Serialization-only override (see serializeToHTML): empty lines must be\n // emitted as <div><br></div> or mail clients collapse them. The editor\n // view keeps the plain content hole — it needs it for cursor placement.\n emitDOM: (node: { childCount: number; attrs: Record<string, any> }) => {\n const attrs = styleOf(node.attrs);\n return node.childCount === 0 ? ['div', attrs, ['br']] : ['div', attrs, 0];\n },\n },\n\n commands: ({ schema }) => ({\n setParagraph: () => setBlockType(schema.nodes['paragraph']),\n setAlignment: (align: ParagraphAlignment) => setAlignment(align),\n indent: () => shiftIndent(1),\n outdent: () => shiftIndent(-1),\n }),\n\n keymap: ({ schema }) => ({\n 'Mod-Alt-0': setBlockType(schema.nodes['paragraph']),\n // Gmail/Docs bindings; left = back to the default.\n 'Mod-Shift-l': setAlignment(null),\n 'Mod-Shift-e': setAlignment('center'),\n 'Mod-Shift-r': setAlignment('right'),\n // Gmail/Docs bindings for the indent; in a list, Tab and Shift-Tab do\n // the same (lists.ts).\n 'Mod-]': shiftIndent(1),\n 'Mod-[': shiftIndent(-1),\n }),\n\n actions: ({ schema }) => [\n {\n id: 'text',\n section: 'blocks',\n title: 'Text',\n keywords: ['paragraph', 'plain'],\n icon: 'notes',\n command: setBlockType(schema.nodes['paragraph']),\n },\n ...(\n [\n ['align-left', 'Align left', 'format_align_left', null],\n ['align-center', 'Align center', 'format_align_center', 'center'],\n ['align-right', 'Align right', 'format_align_right', 'right'],\n ] as const\n ).map(([id, title, icon, align]) => ({\n id,\n section: 'styling',\n title,\n keywords: ['align', 'alignment'],\n icon,\n command: setAlignment(align),\n isActive: (state: EditorState) => isAligned(state, align),\n })),\n // Gmail's pair: a paragraph moves by a step of margin, a list item nests\n // or lifts. Whether one can move right now is the command's own answer.\n {\n id: 'indent',\n section: 'styling',\n title: 'Indent more',\n keywords: ['indent', 'nest', 'tab'],\n icon: 'format_indent_increase',\n command: shiftIndent(1),\n },\n {\n id: 'outdent',\n section: 'styling',\n title: 'Indent less',\n keywords: ['outdent', 'unindent', 'lift'],\n icon: 'format_indent_decrease',\n command: shiftIndent(-1),\n },\n ],\n});\n","import { Command, EditorState } from 'prosemirror-state';\nimport { defineNode } from '../../extension';\n\nconst INDENT_UNIT = ' ';\n\n/** Enter keeps the current line's leading indentation on the new line. */\nconst splitLineKeepIndent: Command = (state, dispatch) => {\n const { $from } = state.selection;\n if ($from.parent.type.name !== 'codeLine') return false;\n\n const indent = /^[ \\t]*/.exec($from.parent.textContent)?.[0] ?? '';\n if (!dispatch) return true;\n\n const tr = state.tr.deleteSelection();\n tr.split(tr.selection.from);\n if (indent) tr.insertText(indent);\n dispatch(tr.scrollIntoView());\n return true;\n};\n\n/** Collects the start positions of all code lines the selection touches. */\nfunction selectedLines(state: EditorState): number[] {\n const { from, to } = state.selection;\n const positions: number[] = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.type.name !== 'codeLine') return true;\n positions.push(pos);\n return false;\n });\n return positions;\n}\n\n/** Tab: indent the selected lines, or insert an indent unit at the cursor. */\nconst indentLines: Command = (state, dispatch) => {\n if (state.selection.$from.parent.type.name !== 'codeLine') return false;\n\n if (state.selection.empty) {\n dispatch?.(state.tr.insertText(INDENT_UNIT).scrollIntoView());\n return true;\n }\n if (!dispatch) return true;\n\n const tr = state.tr;\n // Back to front so earlier insertions don't shift later positions.\n for (const pos of selectedLines(state).reverse()) tr.insertText(INDENT_UNIT, pos + 1);\n dispatch(tr.scrollIntoView());\n return true;\n};\n\n/** Shift-Tab: remove up to one indent unit from each selected line. */\nconst dedentLines: Command = (state, dispatch) => {\n if (state.selection.$from.parent.type.name !== 'codeLine') return false;\n if (!dispatch) return true;\n\n const tr = state.tr;\n for (const pos of selectedLines(state).reverse()) {\n const line = state.doc.nodeAt(pos);\n const leading = /^ {1,2}|^\\t/.exec(line?.textContent ?? '')?.[0];\n if (leading) tr.delete(pos + 1, pos + 1 + leading.length);\n }\n if (!tr.docChanged) return true;\n dispatch(tr.scrollIntoView());\n return true;\n};\n\n/**\n * One line of source code. The document of the HTML source kit is a flat list\n * of these; the source text is the lines joined with newlines. `code: true`\n * makes ProseMirror treat pastes as plain text, and `marks: ''` keeps\n * formatting out — colour comes from decorations, not marks.\n */\nexport const CodeLine = defineNode({\n name: 'codeLine',\n spec: {\n content: 'text*',\n group: 'block',\n code: true,\n marks: '',\n parseDOM: [{ tag: 'div.aee-code-line', preserveWhitespace: 'full' }],\n toDOM: () => ['div', { class: 'aee-code-line' }, 0],\n },\n keymap: () => ({\n Enter: splitLineKeepIndent,\n Tab: indentLines,\n 'Shift-Tab': dedentLines,\n }),\n});\n","import { defineNode } from '../../extension';\n\nexport const Text = defineNode({\n name: 'text',\n spec: { group: 'inline' },\n});\n","import { scanMergeTags } from './nodes/merge-tag';\nimport { textRegions } from '../html-source';\nimport {\n Command,\n EditorState,\n Plugin,\n PluginKey,\n TextSelection,\n Transaction,\n} from 'prosemirror-state';\nimport { closeHistory } from 'prosemirror-history';\nimport { Fragment, Node, Slice } from 'prosemirror-model';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { ParseMode } from '../parse-mode';\nimport {\n HtmlDiagnostic,\n HtmlTokenType,\n VOID_TAGS,\n formatHTML,\n lintHTML,\n openTags,\n scanHTML,\n} from '../html-source';\n\nexport interface HtmlLanguageOptions {\n /** Called with fresh diagnostics whenever the text is rescanned: once\n typing rests, and at once for a wholesale change. */\n onDiagnostics?: (diagnostics: HtmlDiagnostic[]) => void;\n /** How long typing must rest, in ms, before the whole text is rescanned\n — highlighting and lint rebuilt from scratch. Until then each edit\n only moves the existing decorations along. Default\n {@link TYPING_REST}. */\n rescanDelay?: number;\n /** The parse mode of the visual editor this source feeds — lint and\n format follow it (see `SourceOptions`). Default `email`, the editor's\n own default. */\n parseMode?: ParseMode;\n}\n\n/**\n * How long typing must rest before work that covers the whole text runs, in\n * ms — tuned for the fastest typists, not the average: around 300 words a\n * minute a record typist lands a key every ~40 ms (~30 in a burst), so five\n * missed keys is a stop, not a gap between two. Shorter would fire mid-burst;\n * longer only keeps a finished edit waiting.\n */\nexport const TYPING_REST = 200;\n\n/** An edit small enough to be typing: under this many characters changed,\n the decorations are mapped and the rescan waits for rest. Anything\n larger — a paste, a format, a mirrored rewrite — rescans at once, or it\n would sit unhighlighted until the rest. */\nconst TYPING_EDIT = 64;\n\ninterface HtmlLanguageState {\n decorations: DecorationSet;\n /** Mapped through edits since the last full scan: a rescan is due. */\n stale: boolean;\n}\n\n/** The meta a rest rescan is dispatched with. */\nconst RESCAN = 'rescan';\n\nfunction editSize(tr: Transaction): number {\n let size = 0;\n for (const map of tr.mapping.maps) {\n map.forEach((oldStart, oldEnd, newStart, newEnd) => {\n size += oldEnd - oldStart + (newEnd - newStart);\n });\n }\n return size;\n}\n\n/** Interpolation classes — Angular-template style: the `{{` `}}` muted like\n any delimiter, the expression between them set apart from prose. */\nconst BRACE_CLASS = 'aee-tok-brace';\nconst EXPRESSION_CLASS = 'aee-tok-expression';\n\nconst TOKEN_CLASSES: Record<HtmlTokenType, string> = {\n delimiter: 'aee-tok-delimiter',\n tagName: 'aee-tok-tag',\n attributeName: 'aee-tok-attr',\n attributeValue: 'aee-tok-value',\n comment: 'aee-tok-comment',\n};\n\n/** The document's source text: top-level lines joined with newlines. */\nexport function docText(doc: Node): string {\n const lines: string[] = [];\n doc.forEach((line) => lines.push(line.textContent));\n return lines.join('\\n');\n}\n\n/**\n * Maps offsets in the joined source text back to ProseMirror positions.\n * Line i's text starts at `linePm[i]`; the newline between lines has no\n * position of its own, so offsets into it clamp to the line end.\n */\nexport function createOffsetMapper(doc: Node): (offset: number) => number {\n const lineText: number[] = [];\n const linePm: number[] = [];\n const lineLength: number[] = [];\n let textOffset = 0;\n doc.forEach((line, nodeOffset) => {\n lineText.push(textOffset);\n linePm.push(nodeOffset + 1);\n lineLength.push(line.content.size);\n textOffset += line.textContent.length + 1;\n });\n\n return (offset) => {\n let low = 0;\n let high = lineText.length - 1;\n let index = 0;\n while (low <= high) {\n const mid = (low + high) >> 1;\n if (lineText[mid] <= offset) {\n index = mid;\n low = mid + 1;\n } else {\n high = mid - 1;\n }\n }\n const column = Math.min(offset - lineText[index], lineLength[index]);\n return linePm[index] + column;\n };\n}\n\nfunction buildDecorations(doc: Node, options: HtmlLanguageOptions): DecorationSet {\n const source = docText(doc);\n const scan = scanHTML(source);\n const diagnostics = lintHTML(source, scan, { mode: options.parseMode ?? 'email' });\n const toPm = createOffsetMapper(doc);\n\n const decorations: Decoration[] = [];\n for (const token of scan.tokens) {\n const from = toPm(token.from);\n const to = toPm(token.to);\n if (to > from)\n decorations.push(Decoration.inline(from, to, { class: TOKEN_CLASSES[token.type] }));\n }\n // `{{ … }}` in running text: the braces muted, the expression set apart.\n for (const [regionFrom, regionTo] of textRegions(source, scan)) {\n for (const tag of scanMergeTags(source.slice(regionFrom, regionTo), { multiline: true })) {\n const [exprFrom, exprTo] = tag.expr;\n const spans: [number, number, string][] = [\n [tag.from, tag.from + 2, BRACE_CLASS],\n [exprFrom, exprTo, EXPRESSION_CLASS],\n [tag.to - 2, tag.to, BRACE_CLASS],\n ];\n for (const [from, to, className] of spans) {\n const pmFrom = toPm(regionFrom + from);\n const pmTo = toPm(regionFrom + to);\n if (pmTo > pmFrom) decorations.push(Decoration.inline(pmFrom, pmTo, { class: className }));\n }\n }\n }\n for (const diagnostic of diagnostics) {\n const from = toPm(diagnostic.from);\n const to = toPm(diagnostic.to);\n if (to > from) {\n decorations.push(\n Decoration.inline(from, to, {\n class: diagnostic.severity === 'error' ? 'aee-lint-error' : 'aee-lint-warning',\n title: diagnostic.message,\n }),\n );\n }\n }\n\n options.onDiagnostics?.(diagnostics);\n return DecorationSet.create(doc, decorations);\n}\n\n/** Replaces the document with its pretty-printed (and thereby repaired) form. */\nconst formatDocumentFor =\n (mode?: ParseMode): Command =>\n (state, dispatch) => {\n const lineType = state.schema.nodes['codeLine'];\n if (!lineType) return false;\n\n const source = docText(state.doc);\n const formatted = formatHTML(source, undefined, undefined, { mode });\n if (formatted === source) return true;\n\n if (dispatch) {\n const lines = formatted\n .split('\\n')\n .map((line) => lineType.create(null, line ? state.schema.text(line) : null));\n dispatch(state.tr.replaceWith(0, state.doc.content.size, lines).scrollIntoView());\n }\n return true;\n };\n\n/** Maps a ProseMirror position to its offset in the joined source text. */\nexport function textOffsetAt(doc: Node, pos: number): number {\n let acc = 0;\n let result = 0;\n doc.forEach((line, nodeOffset) => {\n const start = nodeOffset + 1;\n const end = start + line.content.size;\n if (pos >= start - 1 && pos <= end + 1) {\n result = acc + Math.min(Math.max(pos - start, 0), line.content.size);\n }\n acc += line.textContent.length + 1;\n });\n return result;\n}\n\n/**\n * Editor-style tag closing: `>` completing a just-typed open tag inserts the\n * matching closing tag with the cursor between them, and `</` completes with\n * the innermost still-open tag. Void tags and self-closing tags are left\n * alone, as is a `>` typed right before an existing matching closer.\n */\nfunction handleTagTyping(view: EditorView, from: number, to: number, text: string): boolean {\n const { state } = view;\n const $from = state.doc.resolve(from);\n if (!$from.parent.type.spec['code']) return false;\n\n const lineStart = $from.start();\n const before = $from.parent.textContent.slice(0, from - lineStart);\n const after = $from.parent.textContent.slice(to - lineStart);\n\n if (text === '>') {\n const open = /<([a-zA-Z][-\\w]*)([^<>]*)$/.exec(before);\n if (!open || open[2].endsWith('/') || VOID_TAGS.has(open[1].toLowerCase())) return false;\n if (after.startsWith(`</${open[1]}`)) return false;\n\n const tr = state.tr.insertText(`></${open[1]}>`, from, to);\n tr.setSelection(TextSelection.create(tr.doc, from + 1));\n view.dispatch(tr);\n return true;\n }\n\n if (text === '/' && before.endsWith('<')) {\n const upToCursor = docText(state.doc).slice(0, textOffsetAt(state.doc, from));\n const name = openTags(upToCursor).at(-1);\n if (!name) return false;\n\n view.dispatch(state.tr.insertText(`/${name}>`, from, to).scrollIntoView());\n return true;\n }\n\n return false;\n}\n\n/** Pastes multi-line text as proper code lines instead of one long line. */\nfunction handleCodePaste(state: EditorState, text: string | undefined): Slice | null {\n if (!text || !state.selection.$from.parent.type.spec['code']) return null;\n const lineType = state.schema.nodes['codeLine'];\n const lines = text.split(/\\r?\\n/);\n if (!lineType || lines.length < 2) return null;\n\n const nodes = lines.map((line) => lineType.create(null, line ? state.schema.text(line) : null));\n // Open sides let ProseMirror merge the first/last line into the cut points.\n return new Slice(Fragment.from(nodes), 1, 1);\n}\n\n/**\n * The HTML language service of the source editor kit: syntax-highlight and\n * lint decorations over the document treated as HTML source text, a\n * `formatDocument` command (Shift-Alt-F and Mod-S, VS Code style), tag auto-closing\n * while typing, format-on-blur when the markup is error-free, and line-aware\n * pasting. Diagnostics render as wavy underlines with the message as tooltip.\n *\n * Formatting is presentation-only: the indentation and line breaks it inserts\n * are exactly the whitespace the email schema's parser discards, so the\n * serialized output never changes.\n */\nexport const createHtmlLanguage = (options: HtmlLanguageOptions = {}): FunctionalExtension => {\n const mode = options.parseMode ?? 'email';\n const formatDocument = formatDocumentFor(mode);\n const key = new PluginKey<HtmlLanguageState>('htmlLanguage');\n const scanned = (doc: Node): HtmlLanguageState => ({\n decorations: buildDecorations(doc, options),\n stale: false,\n });\n return defineExtension({\n name: 'htmlLanguage',\n commands: () => ({ formatDocument: () => formatDocument }),\n // Both bindings live on the editor's own keymap: they fire only while the\n // source editor has focus, never from a window listener. Mod-S always\n // reports handled so the browser's save dialog stays shut even when\n // formatting refuses (errors in the markup) — VS Code's format-on-save.\n keymap: () => ({\n 'Shift-Alt-f': formatDocument,\n 'Mod-s': (state, dispatch, view) => {\n formatDocument(state, dispatch, view);\n return true;\n },\n }),\n plugins: () => [\n // Paced for the fastest typist: a full scan of a 100 KB source costs\n // tens of ms — more than the gap between two of their keys — so a\n // keystroke only maps the decorations it has, and the scan (and the\n // lint it reports) waits for typing to rest.\n new Plugin<HtmlLanguageState>({\n key,\n state: {\n init: (_, state) => scanned(state.doc),\n apply: (tr, value, _prev, state) => {\n if (tr.getMeta(key) === RESCAN) return scanned(state.doc);\n if (!tr.docChanged) return value;\n // Only typing waits: a mirrored write (`setText`, however small\n // its diff) or a large edit is not someone's next keystroke.\n if (tr.getMeta('externalSync') || editSize(tr) > TYPING_EDIT) return scanned(state.doc);\n return { decorations: value.decorations.map(tr.mapping, tr.doc), stale: true };\n },\n },\n view: (view) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const rescan = () => {\n timer = undefined;\n if (view.isDestroyed || !key.getState(view.state)?.stale) return;\n // Never under an IME's feet: redrawing the decorations mid-\n // composition can break it. Try again after the next rest.\n if (view.composing) return schedule();\n view.dispatch(view.state.tr.setMeta(key, RESCAN).setMeta('addToHistory', false));\n };\n const schedule = () => {\n clearTimeout(timer);\n timer = setTimeout(rescan, options.rescanDelay ?? TYPING_REST);\n };\n return {\n update: (current, prev) => {\n if (current.state.doc !== prev.doc && key.getState(current.state)?.stale) schedule();\n },\n destroy: () => clearTimeout(timer),\n };\n },\n props: {\n decorations: (state) => key.getState(state)?.decorations,\n handleTextInput: handleTagTyping,\n handlePaste: (view, event) => {\n const text = event.clipboardData?.getData('text/plain');\n const { state } = view;\n // A paste that *is* the document — into an empty pane, or over\n // everything — is a template handed over (the MJML playground's\n // beautified output, a minified export): it goes in as pasted, then\n // formats as a step of its own, so one undo gives the paste back.\n // Markup with errors stays as pasted, as on blur.\n const { from, to } = state.selection;\n const lineType = state.schema.nodes['codeLine'];\n if (text && lineType && from <= 1 && to >= state.doc.content.size - 1) {\n const lines = text\n .split(/\\r?\\n/)\n .map((line) => lineType.create(null, line ? state.schema.text(line) : null));\n view.dispatch(state.tr.replaceWith(0, state.doc.content.size, lines).scrollIntoView());\n const source = docText(view.state.doc);\n if (!lintHTML(source, undefined, { mode }).some((d) => d.severity === 'error')) {\n // Its own undo step: history would merge two changes this close.\n formatDocument(view.state, (tr) => view.dispatch(closeHistory(tr)));\n }\n return true;\n }\n const slice = handleCodePaste(state, text);\n if (!slice) return false;\n view.dispatch(state.tr.replaceSelection(slice).scrollIntoView());\n return true;\n },\n handleDOMEvents: {\n // Prettier-style: format when leaving the editor, but refuse\n // while the markup has errors — repair stays an explicit choice\n // (Shift-Alt-F). Never returns true: blur must proceed normally.\n blur: (view) => {\n const source = docText(view.state.doc);\n if (lintHTML(source, undefined, { mode }).some((d) => d.severity === 'error')) {\n return false;\n }\n formatDocument(view.state, view.dispatch);\n return false;\n },\n },\n },\n }),\n ],\n });\n};\n\n/** Default instance for kits; use {@link createHtmlLanguage} for callbacks. */\nexport const HtmlLanguage = createHtmlLanguage();\n","import { Node } from 'prosemirror-model';\nimport { Plugin, PluginKey, Transaction } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { defineExtension } from '../extension';\n\n/**\n * Each source line's indentation, as the custom property `--aee-line-indent`\n * (in characters) on its `.aee-code-line` — what a host needs for VS Code's\n * soft wrap: a wrapped line continues under its own indentation, not at the\n * margin (`wrappingIndent: \"same\"`). The pixels are the host's:\n *\n * .aee-code-line {\n * padding-inline-start: calc(var(--aee-line-indent, 0) * 1ch);\n * text-indent: calc(var(--aee-line-indent, 0) * -1ch);\n * }\n *\n * The first row starts at the margin (its spaces fill the indent); every row\n * the line wraps into starts where its text does.\n *\n * Decorations, not the line's `toDOM`: a line's element is not re-rendered\n * when its text changes, so an indent typed or deleted would never reach it.\n * An edit rebuilds only the lines it touched — a keystroke in a 3000-line\n * template costs one line.\n */\nexport const CodeLineIndent = defineExtension({\n name: 'codeLineIndent',\n plugins: () => [\n new Plugin<DecorationSet>({\n key: new PluginKey('codeLineIndent'),\n state: {\n init: (_, state) => DecorationSet.create(state.doc, lineDecorations(state.doc, 0, state.doc.content.size)),\n apply: (tr, set) => (tr.docChanged ? rebuildTouched(tr, set.map(tr.mapping, tr.doc)) : set),\n },\n props: {\n decorations(state) {\n return this.getState(state);\n },\n },\n }),\n ],\n});\n\n/** The indentation decorations of the top-level lines between two positions. */\nfunction lineDecorations(doc: Node, from: number, to: number): Decoration[] {\n const decorations: Decoration[] = [];\n doc.nodesBetween(from, to, (node, pos) => {\n const indent = /^[ \\t]*/.exec(node.textContent)![0].length;\n if (indent) {\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, { style: `--aee-line-indent: ${indent}` }),\n );\n }\n return false; // lines only — never their text\n });\n return decorations;\n}\n\n/** Replaces the decorations of every line the transaction changed. */\nfunction rebuildTouched(tr: Transaction, set: DecorationSet): DecorationSet {\n let from = Infinity;\n let to = -Infinity;\n tr.mapping.maps.forEach((map, index) => {\n const after = tr.mapping.slice(index + 1);\n map.forEach((_oldStart, _oldEnd, newStart, newEnd) => {\n from = Math.min(from, after.map(newStart, -1));\n to = Math.max(to, after.map(newEnd, 1));\n });\n });\n if (from === Infinity) return set;\n const size = tr.doc.content.size;\n // Widen to whole lines: the one before the change may have been joined.\n from = Math.max(0, Math.min(from, size) - 1);\n to = Math.min(size, to + 1);\n let start = from;\n let end = to;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n start = Math.min(start, pos);\n end = Math.max(end, pos + node.nodeSize);\n return false;\n });\n // `find` also returns what merely touches the range — the neighbours'.\n const stale = set.find(start, end).filter((d) => d.from >= start && d.to <= end);\n return set.remove(stale).add(tr.doc, lineDecorations(tr.doc, start, end));\n}\n","import { Command, EditorState, TextSelection } from 'prosemirror-state';\nimport { Node, Schema } from 'prosemirror-model';\nimport {\n CommandFactory,\n EditorAction,\n Extension,\n ExtensionContext,\n FunctionalExtension,\n defineExtension,\n} from '../extension';\nimport { createSchema } from '../schema';\nimport { parseHTML, serializeToHTML } from '../html';\nimport { ParseMode } from '../parse-mode';\nimport { entitySpans, formatHTML, scanHTML } from '../html-source';\nimport { createOffsetMapper, docText, textOffsetAt } from './html-language';\n\n/** Private-use sentinels that ride through parse → command → serialize,\n giving an exact selection mapping between source text and rich document. */\nconst MARK_START = '\\uE000';\nconst MARK_END = '\\uE001';\n\nexport interface SourceMarksOptions {\n /** The rich-text extension set whose schema defines the mark semantics —\n pass the same kit the visual editor runs so both sides toggle alike. */\n extensions: Extension[];\n /** The parse mode of the visual editor this source pane mirrors. Default\n `email`, the editor's own default; pass the visual editor's mode when it\n chose another, so a toggle never drops markup the visual side keeps. */\n parseMode?: ParseMode;\n}\n\n/**\n * Rich-text mark editing for the HTML source editor: every mark extension's\n * keymap (Mod-B, Mod-I, ...) and commands are mirrored, but instead of string\n * surgery the selected source is parsed through the rich schema, the original\n * mark command runs on the resulting document, and the source is replaced\n * with the re-serialized, formatted result. Toggling therefore behaves\n * exactly like the visual editor — it *is* the visual editor's command.\n *\n * Side effect by design: the command pipeline canonicalizes, so running one\n * also repairs and formats the document, like Shift-Alt-F does.\n */\nexport const createSourceMarks = ({\n extensions,\n parseMode = 'email',\n}: SourceMarksOptions): FunctionalExtension => {\n const schema = createSchema(extensions);\n const ctx: ExtensionContext = { schema, extensions };\n\n const keymap: Record<string, Command> = {};\n const commands: Record<string, CommandFactory> = {};\n const actions: EditorAction[] = [];\n for (const extension of extensions) {\n if (extension.type !== 'mark') continue;\n // The same action, run through the rich schema. Whether it is on cannot\n // be read off source text, and asking the command would parse the source\n // on every transaction: on the source side a mark action is simply there.\n for (const action of extension.actions?.(ctx) ?? []) {\n actions.push({\n ...action,\n command: throughRichSchema(schema, action.command, parseMode),\n isActive: undefined,\n isEnabled: () => true,\n });\n }\n for (const [key, command] of Object.entries(extension.keymap?.(ctx) ?? {})) {\n keymap[key] = throughRichSchema(schema, command, parseMode);\n }\n for (const [name, factory] of Object.entries(extension.commands?.(ctx) ?? {})) {\n commands[name] = (...args) => throughRichSchema(schema, factory(...args), parseMode);\n }\n }\n\n return defineExtension({\n name: 'sourceMarks',\n keymap: () => keymap,\n commands: () => commands,\n actions: () => actions,\n });\n};\n\n/** Wraps a rich-schema command so it can run against source-editor state. */\nfunction throughRichSchema(schema: Schema, richCommand: Command, mode: ParseMode): Command {\n return (state, dispatch) => {\n const lineType = state.schema.nodes['codeLine'];\n if (!lineType || state.selection.empty) return false;\n\n const source = docText(state.doc);\n const [a, b] = clampToText(\n source,\n textOffsetAt(state.doc, state.selection.from),\n textOffsetAt(state.doc, state.selection.to),\n );\n if (a >= b) return false;\n if (!dispatch) return true;\n\n // 1. Parse with sentinels marking the selection, then drop them.\n const marked =\n source.slice(0, a) + MARK_START + source.slice(a, b) + MARK_END + source.slice(b);\n // The source is law here too: a toggle inside foreign markup must leave\n // that markup alone — only the mark changes.\n let rich = EditorState.create({ doc: parseHTML(marked, schema, { mode }) });\n const p1 = findChar(rich.doc, MARK_START);\n const p2 = findChar(rich.doc, MARK_END);\n if (p1 < 0 || p2 <= p1) return false;\n {\n const tr = rich.tr.delete(p2, p2 + 1).delete(p1, p1 + 1);\n tr.setSelection(TextSelection.create(tr.doc, p1, p2 - 1));\n rich = rich.apply(tr);\n }\n\n // 2. The visual editor's own command, on the rich document.\n if (!richCommand(rich, (tr) => (rich = rich.apply(tr)))) return false;\n\n // 3. Sentinels back in around the resulting selection, serialize, format.\n {\n const { from, to } = rich.selection;\n rich = rich.apply(rich.tr.insertText(MARK_END, to).insertText(MARK_START, from));\n }\n const formatted = formatHTML(serializeToHTML(rich.doc, schema), undefined, undefined, { mode });\n const start = formatted.indexOf(MARK_START);\n const end = formatted.indexOf(MARK_END);\n const cleaned = formatted.replace(MARK_START, '').replace(MARK_END, '');\n\n // 4. Replace the source document and restore the mapped selection.\n const lines = cleaned\n .split('\\n')\n .map((line) => lineType.create(null, line ? state.schema.text(line) : null));\n const tr = state.tr.replaceWith(0, state.doc.content.size, lines);\n if (start >= 0 && end > start) {\n const toPm = createOffsetMapper(tr.doc);\n tr.setSelection(TextSelection.create(tr.doc, toPm(start), toPm(end - 1)));\n }\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n\n/** Shrinks a source range onto visible text: endpoints inside tags or\n comments move to the region edge, surrounding whitespace is dropped, so\n \"select the whole line, hit Mod-B\" marks exactly the line's text. */\nfunction clampToText(source: string, a: number, b: number): [number, number] {\n const scan = scanHTML(source);\n const blocked: [number, number][] = [\n ...scan.tags.map((tag): [number, number] => [tag.from, tag.to]),\n ...scan.tokens\n .filter((token) => token.type === 'comment')\n .map((token): [number, number] => [token.from, token.to]),\n ];\n const blockedAt = (index: number) => blocked.find(([from, to]) => index >= from && index < to);\n\n while (a < b) {\n const hit = blockedAt(a);\n if (hit) a = hit[1];\n else if (/\\s/.test(source[a])) a++;\n else break;\n }\n while (b > a) {\n const hit = blockedAt(b - 1);\n if (hit) b = hit[0];\n else if (/\\s/.test(source[b - 1])) b--;\n else break;\n }\n\n // Character references are atomic: a sentinel inside '&' would break\n // the reference and change the decoded text. Endpoints expand outward so\n // the whole entity rides along with the selection.\n for (const [from, to] of entitySpans(source)) {\n if (a > from && a < to) a = from;\n if (b > from && b < to) b = to;\n }\n return [a, b];\n}\n\nfunction findChar(doc: Node, char: string): number {\n let found = -1;\n doc.descendants((node, pos) => {\n if (found >= 0) return false;\n const index = node.isText ? (node.text ?? '').indexOf(char) : -1;\n if (index >= 0) found = pos + index;\n return found < 0;\n });\n return found;\n}\n","import { chainCommands, exitCode } from 'prosemirror-commands';\nimport { Command } from 'prosemirror-state';\nimport { Schema } from 'prosemirror-model';\nimport { defineNode } from '../../extension';\nimport { marksAcrossBreak } from '../split-keeping-marks';\n\n/**\n * Insert a hard break at the current selection, carrying the marks that opt\n * into surviving a break (`mark.spec.splittable !== false`) onto the new line.\n *\n * Marks that shouldn't continue past a forced line break — e.g. `link`, since\n * you don't want a Shift-Enter inside a link to drag it onto the next line —\n * set `splittable: false`. The rule is shared with the Enter/paragraph split\n * (see {@link marksAcrossBreak}) so both breaks continue formatting identically.\n */\nfunction insertHardBreak(schema: Schema): Command {\n return chainCommands(exitCode, (state, dispatch) => {\n // Bail out early if we are inside an isolating node.\n if (state.selection.$from.parent.type.spec.isolating) return false;\n\n // ProseMirror sometimes calls commands without dispatch just to probe\n // whether they *can* run.\n if (dispatch) {\n const marks = marksAcrossBreak(state);\n const tr = state.tr.replaceSelectionWith(schema.nodes['hardBreak'].create());\n // Re-apply the surviving marks to the cursor's new position. An empty\n // array is meaningful: every active mark opted out, so ensureMarks([])\n // *clears* the continuation. The `0` (start-of-block) case is falsy and\n // correctly skipped.\n if (marks) tr.ensureMarks(marks);\n dispatch(tr.scrollIntoView());\n }\n\n return true;\n });\n}\n\nexport const HardBreak = defineNode({\n name: 'hardBreak',\n spec: {\n inline: true,\n group: 'inline',\n selectable: false,\n linebreakReplacement: true,\n parseDOM: [{ tag: 'br' }],\n toDOM: () => ['br'],\n },\n commands: ({ schema }) => ({\n setHardBreak: () => insertHardBreak(schema),\n }),\n keymap: ({ schema }) => ({\n 'Shift-Enter': insertHardBreak(schema),\n }),\n});\n","import { setBlockType } from 'prosemirror-commands';\nimport { textblockTypeInputRule } from 'prosemirror-inputrules';\nimport { defineNode } from '../../extension';\n\nconst LEVELS = [1, 2, 3, 4, 5, 6];\n\n/** The ledger's conservative scale: reads at 320px and on a desktop alike. */\nexport const HEADING_SIZES: Record<number, number> = { 1: 24, 2: 20, 3: 18, 4: 16, 5: 16, 6: 16 };\n\n/** A heading's canonical inline style. No margins — lines carry none\n (principle 3), spacing is an empty line; no `line-height` — Outlook\n substitutes its own (the client-support module says so) and our output\n stays lint-clean. Incoming heading styles never survive: the scale is the\n schema's, not the author's. */\nexport const headingStyle = (level: number): string =>\n `margin: 0px; font-size: ${HEADING_SIZES[level] ?? 16}px;`;\n\nexport const Heading = defineNode({\n name: 'heading',\n spec: {\n attrs: { level: { default: 1 } },\n content: 'inline*',\n group: 'block',\n defining: true,\n parseDOM: LEVELS.map((level) => ({ tag: `h${level}`, attrs: { level } })),\n toDOM: (node) => [\n `h${node.attrs['level']}`,\n { style: headingStyle(node.attrs['level'] as number) },\n 0,\n ],\n },\n commands: ({ schema }) => ({\n setHeading: (level: number) => setBlockType(schema.nodes['heading'], { level }),\n }),\n keymap: ({ schema }) =>\n Object.fromEntries(\n LEVELS.map((level) => [\n `Shift-Ctrl-${level}`,\n setBlockType(schema.nodes['heading'], { level }),\n ]),\n ),\n inputRules: ({ schema }) => [\n // `## ` at the start of a block becomes an h2, etc.\n textblockTypeInputRule(/^(#{1,6})\\s$/, schema.nodes['heading'], (match) => ({\n level: match[1].length,\n })),\n ],\n actions: ({ schema }) =>\n [1, 2, 3].map((level) => ({\n id: `heading-${level}`,\n section: 'blocks',\n title: `Heading ${level}`,\n keywords: [`h${level}`, 'title', 'heading'],\n icon: `format_h${level}`,\n command: setBlockType(schema.nodes['heading'], { level }),\n })),\n});\n","import { lift, wrapIn } from 'prosemirror-commands';\nimport { wrappingInputRule } from 'prosemirror-inputrules';\nimport { isNodeActive } from '../../editor';\nimport { defineNode } from '../../extension';\n\n/** The ledger's answer to reply chains whose margins stack until text is one\n word per line: a small fixed indent and a rule, no margins at all — each\n nesting level costs 14px, never more. The grey is the divider's, safe\n against both white and near-black (the dual-contrast rule). */\nexport const BLOCKQUOTE_STYLE =\n 'margin: 0px; padding-left: 12px; border-left: 2px solid rgb(224, 224, 224);';\n\nexport const Blockquote = defineNode({\n name: 'blockquote',\n spec: {\n content: 'block+',\n group: 'block',\n defining: true,\n parseDOM: [{ tag: 'blockquote' }],\n toDOM: () => ['blockquote', { style: BLOCKQUOTE_STYLE }, 0],\n },\n commands: ({ schema }) => ({\n wrapInBlockquote: () => wrapIn(schema.nodes['blockquote']),\n liftBlock: () => lift,\n }),\n keymap: ({ schema }) => ({\n 'Ctrl->': wrapIn(schema.nodes['blockquote']),\n }),\n inputRules: ({ schema }) => [\n // `> ` at the start of a block wraps it in a blockquote.\n wrappingInputRule(/^\\s*>\\s$/, schema.nodes['blockquote']),\n ],\n actions: ({ schema }) => [\n {\n id: 'quote',\n section: 'blocks',\n title: 'Quote',\n keywords: ['blockquote', 'citation'],\n icon: 'format_quote',\n // A toggle: on a quote it lifts the text back out, anywhere else it\n // wraps — what a button does, and what a second \"/quote\" should.\n command: (state, dispatch, view) =>\n isNodeActive(state, schema.nodes['blockquote'])\n ? lift(state, dispatch)\n : wrapIn(schema.nodes['blockquote'])(state, dispatch, view),\n isActive: (state) => isNodeActive(state, schema.nodes['blockquote']),\n },\n ],\n});\n","import { Node } from 'prosemirror-model';\nimport { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Transform } from 'prosemirror-transform';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\n\n/**\n * Inline images — the half of the attachment story that lives in the\n * document. Dropped and pasted image files enter the editor as data-URL\n * images (the only thing a browser editor can hold on its own), but a data\n * URL is not an email image: Gmail and Outlook refuse it and the recipient\n * sees a hole. The email form is a `cid:` reference to a `multipart/related`\n * part — and assembling MIME is the host's job, not ours.\n *\n * So the editor reports the truth about the document at send time\n * ({@link promoteInlineImages}): every data-URL image is decoded into its\n * bytes and re-pointed at a generated Content-ID *in the payload copy only*;\n * the document itself keeps its data URL (the editor still has to display\n * it, and the round trip never learns about the promotion). Images that\n * already reference a `cid:` — an imported reply's inline parts — are\n * reported with the bytes the configured registry holds for them, else by\n * id alone: the host received those parts with the import and owns them.\n */\nexport interface InlineImage {\n /** The Content-ID the payload's HTML references as `src=\"cid:<cid>\"` —\n bare, without the `cid:` scheme or the `<…>` the MIME header wraps it\n in. */\n cid: string;\n /** The image bytes, typed — present for images the editor holds itself\n (dropped, pasted, picked), `null` for pre-existing `cid:` references\n whose part the host already has. */\n blob: Blob | null;\n}\n\nexport interface PromotedInlineImages {\n /** A copy of the document with every data-URL image pointing at its\n `cid:` — serialize this for the payload; the original is untouched. */\n doc: Node;\n /** Every inline part the payload references, in document order, each id\n once. */\n images: InlineImage[];\n}\n\nconst DATA_URL = /^\\s*data:([^,]*?)(;base64)?,([\\s\\S]*)$/i;\n\n/** Decodes a `data:` URL into a typed `Blob` — base64 or percent-encoded,\n the media type without its parameters. `null` for anything that is not a\n well-formed data URL, so a malformed source is left alone rather than\n sent as garbage. */\nexport function decodeDataUrl(src: string): Blob | null {\n const match = DATA_URL.exec(src);\n if (!match) return null;\n const type = (match[1].split(';')[0].trim() || 'text/plain').toLowerCase();\n try {\n const bytes = match[2]\n ? Uint8Array.from(atob(match[3].replace(/\\s/g, '')), (char) => char.charCodeAt(0))\n : new TextEncoder().encode(decodeURIComponent(match[3]));\n return new Blob([bytes], { type });\n } catch {\n return null;\n }\n}\n\nconst isDataUrl = (src: string): boolean => /^\\s*data:/i.test(src);\nconst cidOf = (src: string): string | null =>\n /^\\s*cid:/i.test(src) ? src.trim().slice(4).trim() || null : null;\n\n/** Generated ids are deterministic (`image-1@aee`, `image-2@aee`, …) so the\n same document always yields the same payload — a Content-ID only has to\n be unique within its message. */\nconst generatedCid = (n: number): string => `image-${n}@aee`;\n\n/** The send-time projection: data-URL images become `cid:` parts in a copy\n of the document; every inline reference — promoted or pre-existing — is\n listed once, in document order. Pure: the input document is never\n modified, and an image whose data URL cannot be decoded keeps its source\n (the source-pane lint names it). Identical data URLs share one part. */\nexport function promoteInlineImages(\n doc: Node,\n registry?: InlineImageRegistry,\n): PromotedInlineImages {\n const imageType = doc.type.schema.nodes['image'];\n if (!imageType) return { doc, images: [] };\n\n // Ids already referenced by the document must not be handed out again.\n const used = new Set<string>();\n doc.descendants((node) => {\n if (node.type !== imageType) return;\n const cid = cidOf(String(node.attrs['src']));\n if (cid) used.add(cid);\n });\n\n const tr = new Transform(doc);\n const images: InlineImage[] = [];\n const reported = new Set<string>();\n const promoted = new Map<string, string>();\n let counter = 0;\n\n doc.descendants((node, pos) => {\n if (node.type !== imageType) return;\n const src = String(node.attrs['src']);\n\n const existing = cidOf(src);\n if (existing) {\n if (!reported.has(existing)) {\n reported.add(existing);\n images.push({ cid: existing, blob: registry?.blob(existing) ?? null });\n }\n return;\n }\n if (!isDataUrl(src)) return;\n\n let cid = promoted.get(src);\n if (!cid) {\n const blob = decodeDataUrl(src);\n if (!blob) return;\n do cid = generatedCid(++counter);\n while (used.has(cid));\n used.add(cid);\n promoted.set(src, cid);\n images.push({ cid, blob });\n }\n // Attribute-only change: node sizes are unchanged, positions stay valid.\n tr.setNodeMarkup(pos, undefined, { ...node.attrs, src: `cid:${cid}` });\n });\n\n return { doc: tr.doc, images };\n}\n\n/**\n * The inline image registry — the half of the attachment story that the\n * editor owns (decided 2026-09-02, the Gmail model): one map per composer\n * from Content-ID to bytes, with a display URL for each. Two writers — the\n * editor (a dropped, pasted or picked file) and the host (an import's MIME\n * parts) — and four readers: the editor view, the preview, the send intent,\n * and the host persisting a draft's parts. With a registry configured\n * ({@link createInlineImages}) a drop produces `src=\"cid:…\"` at once and the\n * document stays light; without one, today's data-URL path still applies.\n * The contract is framework-free; the Angular service implements it with a\n * signal underneath.\n */\nexport interface InlineImageRegistry {\n /** Registers bytes and returns their Content-ID — a supplied one is kept\n (an import's part), otherwise one is generated. Re-registering a cid\n replaces its bytes. */\n add(blob: Blob, cid?: string): string;\n /** The display URL for the editor (an object URL); undefined for a part\n the registry does not hold. */\n resolve(cid: string): string | undefined;\n /** The bytes; undefined when the host owns the part. */\n blob(cid: string): Blob | undefined;\n /** Change notification, so views can re-resolve; returns the unsubscribe. */\n subscribe?(listener: () => void): () => void;\n}\n\nexport interface InlineImageStoreOptions {\n /** How display URLs are made (default `URL.createObjectURL`) … */\n createUrl?: (blob: Blob) => string;\n /** … and released (default `URL.revokeObjectURL`). */\n revokeUrl?: (url: string) => void;\n}\n\n/** The in-memory registry. Parts stay registered after their image is\n deleted from the document (undo brings it back); the send intent reports\n only what the document references, and so should a host's draft. Every\n URL is released by {@link revokeAll} when the composer goes away. */\nexport class InlineImageStore implements InlineImageRegistry {\n readonly #parts = new Map<string, { blob: Blob; url: string }>();\n readonly #listeners = new Set<() => void>();\n #counter = 0;\n /** What sets this store's generated ids apart from every other store's.\n A Content-ID is meant to be unique worldwide (RFC 2392), and a counter\n alone is only unique in its registry: a draft persisted by one tab and\n restored by another — or by the same tab after a reload — would meet a\n new image under the same id, and a host keying the parts by cid would\n overwrite one with the other. */\n readonly #scope = randomToken();\n\n constructor(private readonly options: InlineImageStoreOptions = {}) {}\n\n add(blob: Blob, cid?: string): string {\n const id = cid ?? this.#nextId();\n const previous = this.#parts.get(id);\n if (previous) this.#revoke(previous.url);\n this.#parts.set(id, { blob, url: this.#createUrl(blob) });\n for (const listener of this.#listeners) listener();\n return id;\n }\n\n resolve(cid: string): string | undefined {\n return this.#parts.get(cid)?.url;\n }\n\n blob(cid: string): Blob | undefined {\n return this.#parts.get(cid)?.blob;\n }\n\n has(cid: string): boolean {\n return this.#parts.has(cid);\n }\n\n /** Every registered Content-ID, in registration order. */\n cids(): string[] {\n return [...this.#parts.keys()];\n }\n\n subscribe(listener: () => void): () => void {\n this.#listeners.add(listener);\n return () => this.#listeners.delete(listener);\n }\n\n /** Releases every display URL and forgets every part. */\n revokeAll(): void {\n for (const { url } of this.#parts.values()) this.#revoke(url);\n this.#parts.clear();\n for (const listener of this.#listeners) listener();\n }\n\n #nextId(): string {\n let id: string;\n do id = `image-${++this.#counter}.${this.#scope}@aee`;\n while (this.#parts.has(id));\n return id;\n }\n\n #createUrl(blob: Blob): string {\n return (this.options.createUrl ?? ((b) => URL.createObjectURL(b)))(blob);\n }\n\n #revoke(url: string): void {\n (this.options.revokeUrl ?? ((u) => URL.revokeObjectURL(u)))(url);\n }\n}\n\n/** The registry configured for an editor, if any — plugin state, so the\n Image node, the send intent and the host all read the same one. */\nexport const inlineImagesKey = new PluginKey<InlineImagesState>('inlineImages');\n\ninterface InlineImagesState {\n registry: InlineImageRegistry;\n /** Bumped on every registry change: the image decorations carry it, so a\n node view re-resolves its `cid:` when a part arrives late. */\n version: number;\n}\n\nexport const inlineImageRegistry = (state: EditorState): InlineImageRegistry | undefined =>\n inlineImagesKey.getState(state)?.registry;\n\nconst isCidSource = (src: unknown): boolean => typeof src === 'string' && /^\\s*cid:/i.test(src);\n\n/**\n * The registry extension — the roadmap's \"`cid:` resolver input\", and the\n * editor's write side. Hands the registry to the Image node (drops register\n * their bytes and insert `cid:` sources; node views resolve them for display)\n * and to the send intent (bytes for `inlineImages`). A registry change is a\n * meta transaction that bumps a version carried by a node decoration on every\n * `cid:` image, which is how ProseMirror re-renders those node views without\n * the document changing.\n */\nexport const createInlineImages = (options: {\n registry: InlineImageRegistry;\n}): FunctionalExtension =>\n defineExtension({\n name: 'inlineImages',\n plugins: () => [\n new Plugin<InlineImagesState>({\n key: inlineImagesKey,\n state: {\n init: () => ({ registry: options.registry, version: 0 }),\n apply: (tr, value) =>\n tr.getMeta(inlineImagesKey) ? { ...value, version: value.version + 1 } : value,\n },\n view: (view) => {\n const off = options.registry.subscribe?.(() => {\n if (!view.isDestroyed) view.dispatch(view.state.tr.setMeta(inlineImagesKey, true));\n });\n return { destroy: () => off?.() };\n },\n props: {\n decorations(state) {\n const version = inlineImagesKey.getState(state)?.version ?? 0;\n const decorations: Decoration[] = [];\n state.doc.descendants((node, pos) => {\n if (node.type.name === 'image' && isCidSource(node.attrs['src'])) {\n decorations.push(Decoration.node(pos, pos + node.nodeSize, {}, { version }));\n }\n });\n return DecorationSet.create(state.doc, decorations);\n },\n },\n }),\n ],\n });\n\n/** Eight base-36 characters from the platform's CSPRNG. */\nfunction randomToken(): string {\n const bytes = crypto.getRandomValues(new Uint8Array(8));\n return Array.from(bytes, (byte) => (byte % 36).toString(36)).join('');\n}\n\n/** Every Content-ID the html's images reference, once each, in document\n order — the parts a draft has to keep (the registry holds more: a\n deleted image's part stays for undo). Pure. */\nexport function inlineImageCids(html: string): string[] {\n const cids = new Set<string>();\n for (const [, cid] of html.matchAll(/<img\\b[^>]*?\\bsrc=\"cid:([^\"]*)\"/gi)) cids.add(cid.trim());\n return [...cids];\n}\n\n/** Rewrites every `cid:` image source the resolver knows — the preview's\n projection (a sandboxed, opaque-origin frame cannot load the editor's\n blob URLs, so the preview resolves to data URLs). Unknown cids are left\n untouched. Pure. */\nexport function rewriteInlineImageSources(\n html: string,\n resolve: (cid: string) => string | undefined,\n): string {\n return html.replace(/(<img\\b[^>]*?\\bsrc=\")cid:([^\"]*)(\")/gi, (match, before, cid, after) => {\n const url = resolve(cid.trim());\n return url ? `${before}${url}${after}` : match;\n });\n}\n","import { authoredMarkupOf } from '../../authored';\nimport {\n Command,\n EditorState,\n NodeSelection,\n Plugin,\n PluginKey,\n TextSelection,\n Transaction,\n} from 'prosemirror-state';\nimport { EditorView, NodeView } from 'prosemirror-view';\nimport { DOMSerializer, Node, Schema } from 'prosemirror-model';\nimport { FunctionalExtension, defineExtension, defineNode } from '../../extension';\nimport { isSafeUrl } from '../marks/link';\nimport { InlineImageRegistry, inlineImageRegistry } from '../inline-images';\nimport { soleInlineAtom } from '../inline-atoms';\n\nexport interface ImageAttrs {\n /** `null` is a placeholder: a sized frame awaiting its file (see the\n NodeView) — serialized as an `<img>` without `src`, linted as unfilled. */\n src: string | null;\n alt?: string | null;\n title?: string | null;\n /** Natural display width in px, capped at {@link MAX_IMAGE_WIDTH}. */\n width?: number | null;\n}\n\n/** Email convention: wider than this overflows phones and gets Gmail-clipped\n layouts; parse and file drops both cap to it. */\nexport const MAX_IMAGE_WIDTH = 600;\n\nfunction parseWidth(node: HTMLElement): number | null {\n const attr = parseInt(node.getAttribute('width') ?? '', 10);\n if (attr > 0) return Math.min(attr, MAX_IMAGE_WIDTH);\n const style =\n /(?:^|;)\\s*max-width:\\s*(\\d+)px/.exec(node.getAttribute('style') ?? '') ??\n /(?:^|;)\\s*width:\\s*(\\d+)px/.exec(node.getAttribute('style') ?? '');\n const parsed = style ? parseInt(style[1], 10) : NaN;\n return parsed > 0 ? Math.min(parsed, MAX_IMAGE_WIDTH) : null;\n}\n\n/** The natural width of an image at `url`, capped for email — null when it\n cannot be measured. */\nfunction naturalWidth(url: string): Promise<number | null> {\n return new Promise((resolve) => {\n const probe = document.createElement('img');\n probe.onload = () =>\n resolve(probe.naturalWidth ? Math.min(probe.naturalWidth, MAX_IMAGE_WIDTH) : null);\n probe.onerror = () => resolve(null);\n probe.src = url;\n });\n}\n\nfunction dataUrl(file: File): Promise<string> {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(file);\n });\n}\n\n/** Reads a dropped/pasted/picked image file into insertable attrs: alt\n defaulted from the filename, natural width capped for email, and the\n source — a `cid:` when a registry holds the bytes (the Gmail model: the\n document stays light, the part travels with the send intent), else a\n data URL (the registry-less fallback, promoted at send). */\nexport function readImageFile(file: File, registry?: InlineImageRegistry): Promise<ImageAttrs> {\n const alt = file.name.replace(/\\.\\w+$/, '');\n if (registry) {\n const cid = registry.add(file);\n return naturalWidth(registry.resolve(cid) ?? '').then((width) => ({\n src: `cid:${cid}`,\n alt,\n width,\n }));\n }\n return dataUrl(file).then((src) => naturalWidth(src).then((width) => ({ src, alt, width })));\n}\n\n/**\n * The drop-claim rule (decided 2026-09-02): the editor takes a file drop only\n * when *every* file is an image. Pure images are content and embed inline;\n * a mixed drop — an image alongside a PDF, say — is an attachment gesture,\n * so the editor leaves the event untouched and it bubbles *whole* to the\n * host's dropzone. Nothing to decide, nothing silently lost: the host\n * attaches everything, and may still embed the images itself via\n * `readImageFile` + `insertImage` if it wants to.\n */\nexport function claimedImageFiles(files: Iterable<File>): File[] {\n const list = Array.from(files);\n return list.length && list.every((file) => file.type.startsWith('image/')) ? list : [];\n}\n\nfunction imageFiles(data: DataTransfer | null): File[] {\n return claimedImageFiles(data?.files ?? []);\n}\n\n/** The claim rule read off a drag in flight: during `dragover` a browser\n exposes file *types* only, no files. An image drag is one where every\n file item is an image; a type the browser withholds counts as one, so the\n line errs on showing. A mixed drag shows nothing here — the host's zone\n takes it. */\nfunction isImageDrag(data: DataTransfer | null): boolean {\n const items = Array.from(data?.items ?? []).filter((item) => item.kind === 'file');\n if (items.length) return items.every((item) => !item.type || item.type.startsWith('image/'));\n return isFileDrag(data);\n}\n\n/** A drag carrying files at all — the OS kind, as opposed to a text\n selection or one of the editor's own node drags. */\nfunction isFileDrag(data: DataTransfer | null): boolean {\n return Array.from(data?.types ?? []).includes('Files');\n}\n\n/**\n * The drag phase of the claim rule, as a `handleDOMEvents` hook: an image\n * drag is claimed the moment it comes over the editor, not only at the drop.\n *\n * A dropzone wrapping the editor highlights for every file drag over it.\n * `handleDrop` takes image drops — but by then the zone has been promising\n * an attachment for the whole drag. Saying it here, on `dragenter` and\n * `dragover`, keeps the zone's word honest: it lights over the text for a\n * PDF, which it will get, and not for an image, which the editor keeps.\n *\n * *How* a drag is claimed is the host's, because only the host knows what\n * zone is around the editor: the library calls {@link ImageDragOptions.claim}\n * and does nothing else — ProseMirror still accepts the drag as it always\n * has (false: its own handler runs), and a host with no zone configures\n * nothing and sees no difference at all. Mixed drags and anything that is\n * not a file drag are never claimed: the zone's, or nobody's.\n */\nfunction claimImageDrag(view: EditorView, event: DragEvent): boolean {\n if (isImageDrag(event.dataTransfer)) imageDragKey.getState(view.state)?.claim?.(event);\n return false;\n}\n\n/**\n * Whether an image drag the editor will embed is over it — the drag phase of\n * the claim rule (`isImageDrag`), told to the host.\n *\n * A host that wraps the editor in a file dropzone needs this to say the\n * right thing while a file hangs over the text: its zone reports a drag it\n * would take, and an image drag is exactly the one it will *not* get — the\n * editor claims those as they come over it (`claimImageDrag`), so the zone\n * stands down and reads nothing. This is the other half, from the editor\n * that knows: on while an image-only drag is over the editing\n * surface, off when it leaves, drops, or turns out to be mixed. Reported on\n * change only. The drop line (`ImageDropLine`) is what tracks it — this is\n * the same state, spoken.\n *\n * And it is where the host says how the editor tells that zone \"this one is\n * mine\" — `claim`. The library depends on no dropzone; any of them fits:\n *\n * // @h-k-dev/angular-file-drop: a mark the zone reads.\n * createImageDrag({ claim: claimDragEvent, onChange })\n *\n * // dropzone.js, ngx-file-drop, a hand-written zone — anything that\n * // listens for the drag events bubbling up to it: they never get there.\n * createImageDrag({ claim: (event) => event.stopPropagation(), onChange })\n */\nexport const createImageDrag = (options: ImageDragOptions): FunctionalExtension =>\n defineExtension({\n name: 'imageDrag',\n plugins: () => [\n new Plugin<ImageDragOptions>({\n key: imageDragKey,\n state: { init: () => options, apply: (_tr, value) => value },\n }),\n ],\n });\n\nexport interface ImageDragOptions {\n /** Told when an image-only drag comes over the editing surface, and when\n it is gone. */\n onChange?: (over: boolean) => void;\n /**\n * Claims a drag event for the editor, so a dropzone around it stands\n * down: called on every `dragenter` and `dragover` of an image-only drag,\n * and on the `drop` the editor takes (after its `preventDefault()`).\n * Never for a mixed drag or a file the editor will not embed — those stay\n * the zone's. What it does is the zone's protocol: mark the event, stop\n * it bubbling, flip a flag the zone checks.\n */\n claim?: (event: DragEvent) => void;\n}\n\n/** The host's listener, if one is configured — plugin state, like the\n registry, so the drop line can find it from its view. */\nconst imageDragKey = new PluginKey<ImageDragOptions>('imageDrag');\n\nexport interface ImageDropTarget {\n /** The caret — the image is inserted inline where the cursor sits (Gmail's\n rule: the pointer only says the drag is over the editor). */\n pos: number;\n /** The drop line on screen: the bottom of the visual line the image is\n about to join, spanning that line's block. */\n top: number;\n left: number;\n width: number;\n}\n\nfunction rectOf(view: EditorView, pos: number): DOMRect | null {\n const dom = view.nodeDOM(pos) as HTMLElement | null;\n return dom && typeof dom.getBoundingClientRect === 'function'\n ? dom.getBoundingClientRect()\n : null;\n}\n\n/** Where an image drag drops — the caret, exactly what the drop uses — and\n the line to draw for it: under the visual line the caret is on (the\n caret's own box gives the line's bottom, the surrounding block its\n width). Gmail's rule: the image lands where the cursor sat before the\n drag; the pointer decides only that the drag is over the editor. */\nexport function imageDropTarget(view: EditorView): ImageDropTarget {\n const pos = view.state.selection.from;\n const caret = view.coordsAtPos(pos);\n const $pos = view.state.doc.resolve(pos);\n const box = ($pos.depth ? rectOf(view, $pos.before()) : null) ?? view.dom.getBoundingClientRect();\n return { pos, top: caret.bottom, left: box.left, width: box.width };\n}\n\n/**\n * The drop line — editor-only, the app owns the pixels through the\n * `aee-drop-line` class: a horizontal line under the caret's visual line —\n * where the image will land, wherever the pointer is. Positioned the way\n * prosemirror-dropcursor positions itself — absolutely, against the editor's\n * offset parent — so it never enters the document or the DOM ProseMirror\n * manages. Shown only for drags the editor would claim (see `isImageDrag`).\n */\nclass ImageDropLine {\n private element: HTMLElement | null = null;\n private timeout: ReturnType<typeof setTimeout> | null = null;\n private over = false;\n private readonly listeners: [keyof HTMLElementEventMap, (event: DragEvent) => void][];\n\n constructor(private readonly view: EditorView) {\n this.listeners = [\n ['dragover', (event) => this.onDragOver(event)],\n ['dragleave', (event) => this.onDragLeave(event)],\n ['drop', () => this.hide()],\n ['dragend', () => this.hide()],\n ];\n for (const [name, listener] of this.listeners) {\n view.dom.addEventListener(name, listener as EventListener);\n }\n }\n\n destroy(): void {\n for (const [name, listener] of this.listeners) {\n this.view.dom.removeEventListener(name, listener as EventListener);\n }\n this.hide();\n }\n\n private onDragOver(event: DragEvent): void {\n if (!this.view.editable || !isImageDrag(event.dataTransfer)) return this.hide();\n this.show(imageDropTarget(this.view));\n // A drag the browser never ends for us (a lost dragleave) must not leave\n // the line behind — dropcursor's safety net.\n if (this.timeout) clearTimeout(this.timeout);\n this.timeout = setTimeout(() => this.hide(), 5000);\n }\n\n private onDragLeave(event: DragEvent): void {\n const into = event.relatedTarget as globalThis.Node | null;\n if (event.target === this.view.dom || !into || !this.view.dom.contains(into)) this.hide();\n }\n\n /** The host's view of the same state (`createImageDrag`), on change only. */\n private report(over: boolean): void {\n if (this.over === over) return;\n this.over = over;\n imageDragKey.getState(this.view.state)?.onChange?.(over);\n }\n\n private show(target: ImageDropTarget): void {\n this.report(true);\n const parent = (this.view.dom.offsetParent as HTMLElement | null) ?? document.body;\n if (!this.element) {\n this.element = document.createElement('div');\n this.element.className = 'aee-drop-line';\n parent.appendChild(this.element);\n }\n let parentLeft: number;\n let parentTop: number;\n if (parent === document.body && getComputedStyle(parent).position === 'static') {\n parentLeft = -window.scrollX;\n parentTop = -window.scrollY;\n } else {\n const rect = parent.getBoundingClientRect();\n parentLeft = rect.left - parent.scrollLeft;\n parentTop = rect.top - parent.scrollTop;\n }\n this.element.style.left = `${target.left - parentLeft}px`;\n this.element.style.top = `${target.top - parentTop}px`;\n this.element.style.width = `${target.width}px`;\n }\n\n private hide(): void {\n this.report(false);\n if (this.timeout) clearTimeout(this.timeout);\n this.timeout = null;\n this.element?.remove();\n this.element = null;\n }\n}\n\nasync function insertImageFiles(\n view: EditorView,\n schema: Schema,\n files: File[],\n pos: number,\n): Promise<void> {\n for (const file of files) {\n const attrs = await readImageFile(file, inlineImageRegistry(view.state));\n if (view.isDestroyed) return;\n // Fitted to its line with room for the caret to its right (`CARET_ROOM`):\n // a full-width image would push the caret's spot to the next line.\n const width = fitImageWidth(attrs.width, lineCeilingAt(view, pos));\n const node = schema.nodes['image'].create({ ...attrs, width });\n const tr = view.state.tr.insert(Math.min(pos, view.state.doc.content.size), node);\n // A tall image can push the caret below the fold; bring it back the same\n // way `insertImage` does, so a drop is not a caret that vanished.\n view.dispatch(tr.scrollIntoView());\n // Past whatever was inserted: at a block boundary the transform wraps the\n // inline image into a line of its own, so the growth is not the node's size.\n pos = tr.mapping.map(pos);\n }\n}\n\n/** Opens the OS file picker for images and resolves with the choice (a\n cancelled dialog never resolves — the browser does not tell). */\nfunction pickImageFiles(multiple: boolean): Promise<File[]> {\n return new Promise((resolve) => {\n const input = document.createElement('input');\n input.type = 'file';\n input.accept = 'image/*';\n input.multiple = multiple;\n input.style.display = 'none';\n input.addEventListener('change', () => {\n resolve(Array.from(input.files ?? []).filter((file) => file.type.startsWith('image/')));\n input.remove();\n });\n document.body.appendChild(input);\n openFileChooser(() => input.click());\n });\n}\n\n/** How long a keyboard-opened chooser waits for the pointer to move before\n it opens regardless — inside the browser's window of user activation\n (five seconds in Chromium), so the click still counts. */\nexport const FILE_CHOOSER_POINTER_WAIT = 2500;\n\n/** Whether the last input the page saw was a key, not the pointer. */\nlet keyboardLast = false;\nlet modalityWatched = false;\n\nfunction watchModality(): void {\n if (modalityWatched || typeof document === 'undefined') return;\n modalityWatched = true;\n document.addEventListener('keydown', () => (keyboardLast = true), true);\n document.addEventListener('pointermove', () => (keyboardLast = false), true);\n document.addEventListener('pointerdown', () => (keyboardLast = false), true);\n}\n\n/**\n * Opens a file chooser the way the pointer stays visible in it. Chromium on\n * Windows hides the mouse pointer while a key is typed and shows it again\n * on the next mouse move *it* handles; the OS file dialog is modal and\n * takes the moves itself, so a chooser opened from a keyboard action — a\n * `/image` picked with Enter — runs with no pointer at all. Where the last\n * input was a key on Windows, the opening waits for the pointer to move\n * (the page shows it again on that move), or for a moment to pass\n * ({@link FILE_CHOOSER_POINTER_WAIT}) for the writer who never reaches for\n * the mouse. Anywhere else, and after a click, it opens at once.\n */\nexport function openFileChooser(\n open: () => void,\n options: { keyboard?: boolean; windows?: boolean; wait?: number } = {},\n): void {\n watchModality();\n const keyboard = options.keyboard ?? keyboardLast;\n const windows = options.windows ?? isWindows();\n if (!keyboard || !windows) {\n open();\n return;\n }\n let done = false;\n const now = () => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n document.removeEventListener('pointermove', now, true);\n open();\n };\n const timer = setTimeout(now, options.wait ?? FILE_CHOOSER_POINTER_WAIT);\n document.addEventListener('pointermove', now, true);\n}\n\nfunction isWindows(): boolean {\n if (typeof navigator === 'undefined') return false;\n const platform =\n (navigator as { userAgentData?: { platform?: string } }).userAgentData?.platform ??\n navigator.platform ??\n '';\n return /win/i.test(platform);\n}\n\n/** Opens the OS file picker and inserts the chosen image(s) at the cursor —\n the slash-menu path, mirroring what drop and paste already do. */\nfunction pickAndInsertImages(view: EditorView, schema: Schema): void {\n void pickImageFiles(true).then((files) => {\n if (files.length && !view.isDestroyed) {\n void insertImageFiles(view, schema, files, view.state.selection.from);\n }\n });\n}\n\n/** Floor for a resized image: below this a pad has nothing left to grab. */\nexport const MIN_IMAGE_WIDTH = 40;\n\nconst clamp = (value: number, min: number, max: number): number =>\n Math.min(Math.max(value, min), max);\n\n/** Room an image leaves at the end of its line for the caret (decided\n 2026-09-24): the widest an image gets in a line is the line less this,\n so the caret can always stand to its right — on a drop, and at the top\n of a resize. Wider, and the caret's spot (ProseMirror's 1px separator)\n wraps to the next line, with nothing beside the image to click or to\n start a drag from. */\nexport const CARET_ROOM = 4;\n\n/** The content width of a textblock's element — the line an image in it\n gets. 0 when unmeasurable (jsdom), and the caller falls back to the\n email maximum. */\nfunction contentWidth(block: Element | null): number {\n if (!(block instanceof HTMLElement)) return 0;\n const style = getComputedStyle(block);\n const padding = (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.paddingRight) || 0);\n return Math.round(block.clientWidth - padding);\n}\n\n/** The widest an image at `pos` can be and leave the caret its room: the\n line's content width less {@link CARET_ROOM} (never below the resize\n floor), or null where nothing is laid out. */\nfunction lineCeilingAt(view: EditorView, pos: number): number | null {\n const $pos = view.state.doc.resolve(Math.min(pos, view.state.doc.content.size));\n const block = $pos.depth ? (view.nodeDOM($pos.before()) as Element | null) : null;\n const line = contentWidth(block);\n return line > 0 ? Math.max(MIN_IMAGE_WIDTH, line - CARET_ROOM) : null;\n}\n\n/** `width` fitted under a line's `ceiling` (see `CARET_ROOM`): an unknown\n width stays unknown (fluid, `max-width: 100%`), and without a ceiling\n the width stands. */\nexport function fitImageWidth(\n width: number | null | undefined,\n ceiling: number | null,\n): number | null {\n if (!width) return null;\n return ceiling !== null ? Math.min(width, ceiling) : width;\n}\n\n/** Width a fresh placeholder opens at — the ledger's phone width; the pads\n take it from there. */\nexport const PLACEHOLDER_WIDTH = 320;\n\n/** A placeholder keeps the frame its author sized: the picked file supplies\n the source (and the alt when the placeholder has none); `width` stays. */\nexport function filledPlaceholderAttrs(placeholder: ImageAttrs, picked: ImageAttrs): ImageAttrs {\n return {\n ...placeholder,\n src: picked.src,\n alt: placeholder.alt ?? picked.alt ?? null,\n width: placeholder.width ?? picked.width ?? null,\n };\n}\n\n/** A frame standing in for the image: the placeholder awaiting its file, or\n a `cid:` whose part the registry does not hold. The app owns the pixels. */\nfunction imageFrame(className: string, label: string): HTMLElement {\n const box = document.createElement('span');\n box.className = className;\n box.setAttribute('role', 'button');\n box.textContent = label;\n return box;\n}\n\n/**\n * The image's editor-only wrapper — `span.aee-image > img`, a NodeView. The\n * `<img>` inside is exactly `toDOM` (one source of truth; the serializer and\n * the clipboard never see the span) — except that a `cid:` source is\n * *displayed* through the registry's URL while the document keeps the `cid:`\n * (the resolver is a view concern; the round trip never learns about it). A\n * `cid:` with no part renders as a \"missing\" frame, never a broken icon.\n * The wrapper exists because an `<img>` cannot carry an overlay: a click\n * makes the image the node selection, the wrapper carries\n * `ProseMirror-selectednode`, and the app paints the selection there — the\n * tint and the outline. Attribute changes update the `<img>` in place, and\n * so does a registry change (the extension's decoration version).\n *\n * The wrapper also carries the **resize pads**: two pads inset on the left\n * and right edges, shown on hover and on the selected image (the app's CSS).\n * A drag on an unselected image works too and leaves it selected. Dragging\n * a pad draws only a primary *frame* at the would-be size; the real resize\n * — a `width` write, clamped between {@link MIN_IMAGE_WIDTH} and the line's\n * width less the caret's room (never past {@link MAX_IMAGE_WIDTH}), so at\n * the ceiling the caret still stands to the image's right (`CARET_ROOM`) —\n * happens once, on release (`ColumnsResize`'s deferred commit). The ratio\n * is kept by construction: only `width` is ever written, and the serialized\n * style keeps `height: auto`. Pad presses never reach ProseMirror\n * (`stopEvent`), so a resize is never mistaken for a node drag or a click.\n *\n * A **placeholder** — an image with no `src` — renders as a dashed frame\n * (`span.aee-image__placeholder`, the app owns the pixels) with the same\n * pads: size the frame first, then click it to pick the file that fills it\n * ({@link filledPlaceholderAttrs} keeps the frame's width). The slide-deck\n * model — Keynote's media placeholder — and the image counterpart of the\n * merge tag.\n */\nclass ImageView implements NodeView {\n readonly dom: HTMLSpanElement;\n private img: HTMLElement;\n private readonly frame: HTMLSpanElement;\n /** A resize that just ended: the browser fires a click for a press on a\n pad released over the wrapper, and that click must not open the\n picker. */\n private resized = false;\n\n constructor(\n private node: Node,\n private readonly view: EditorView,\n private readonly getPos: () => number | undefined,\n ) {\n this.dom = document.createElement('span');\n this.dom.className = 'aee-image';\n this.apply(node);\n this.img = this.render(node);\n this.dom.appendChild(this.img);\n for (const side of ['left', 'right'] as const) {\n const pad = document.createElement('span');\n pad.className = `aee-image__pad aee-image__pad--${side}`;\n pad.addEventListener('pointerdown', (event) => this.startResize(side, event));\n this.dom.appendChild(pad);\n }\n this.frame = document.createElement('span');\n this.frame.className = 'aee-image__frame';\n this.dom.appendChild(this.frame);\n this.dom.addEventListener('click', (event) => this.onClick(event));\n }\n\n private render(node: Node): HTMLElement {\n const src = node.attrs['src'] as string | null;\n if (!src) return imageFrame('aee-image__placeholder', 'Choose an image');\n const img = DOMSerializer.renderSpec(document, node.type.spec.toDOM!(node)).dom as HTMLElement;\n const cid = /^\\s*cid:(.+)$/i.exec(src)?.[1]?.trim();\n if (cid) {\n const url = inlineImageRegistry(this.view.state)?.resolve(cid);\n if (!url) return imageFrame('aee-image__missing', 'Image not available');\n img.setAttribute('src', url);\n }\n return img;\n }\n\n update(node: Node): boolean {\n if (node.type !== this.node.type) return false;\n this.node = node;\n const img = this.render(node);\n this.img.replaceWith(img);\n this.img = img;\n this.apply(node);\n return true;\n }\n\n /** The wrapper is shrink-to-fit, and a percentage width inside a\n shrink-to-fit box resolves against the image's *natural* size — so a\n cap above it (an enlarged image) would never show in the editor while\n the sent email honours it. The wrapper therefore carries the cap\n itself, fluid below it through the app's `max-width: 100%`: exactly\n the box `width: 100%; max-width: <n>px` resolves to in the recipient's\n container. No cap → shrink-to-fit, the natural size, as in the email.\n A placeholder is flagged for the app's frame styling. */\n private apply(node: Node): void {\n const width = node.attrs['width'] as number | null;\n // An authored image (a template's, kept as written — authored.ts) sizes\n // itself as written: MJML's `display:block; width:100%` fills its cell.\n // The wrapper then takes no width of its own and stands as the image\n // does, so the cell around it lays out exactly as in the email.\n const authored = authoredMarkupOf(node);\n const style =\n authored?.path[0]?.attrs.find(([name]: [string, string]) => name === 'style')?.[1] ?? '';\n this.dom.style.width = width && !authored ? `${width}px` : '';\n this.dom.style.display =\n authored && /(?:^|;)\\s*display\\s*:\\s*block\\b/i.test(style) ? 'block' : '';\n this.dom.classList.toggle('aee-image--placeholder', !node.attrs['src']);\n }\n\n selectNode(): void {\n this.dom.classList.add('ProseMirror-selectednode');\n }\n\n deselectNode(): void {\n this.dom.classList.remove('ProseMirror-selectednode');\n }\n\n /** The pads are ours: a press on one must not become ProseMirror's node\n drag or click. */\n stopEvent(event: Event): boolean {\n const target = event.target as Element | null;\n return !!target?.closest?.('.aee-image__pad');\n }\n\n /** A click on a placeholder opens the picker; the picked file fills the\n frame in place and leaves it selected. Pads and a just-finished resize\n are not clicks. */\n private onClick(event: MouseEvent): void {\n if (this.node.attrs['src'] || this.resized) return;\n if ((event.target as Element | null)?.closest?.('.aee-image__pad')) return;\n void pickImageFiles(false).then(async ([file]) => {\n if (!file || this.view.isDestroyed) return;\n const picked = await readImageFile(file, inlineImageRegistry(this.view.state));\n const pos = this.getPos();\n if (pos === undefined || this.view.isDestroyed) return;\n const attrs = filledPlaceholderAttrs(this.node.attrs as ImageAttrs, picked);\n const tr = this.view.state.tr.setNodeMarkup(pos, undefined, attrs);\n tr.setSelection(NodeSelection.create(tr.doc, pos));\n this.view.dispatch(tr);\n });\n }\n\n private startResize(side: 'left' | 'right', event: PointerEvent): void {\n if (event.button !== 0) return;\n event.preventDefault();\n const rect = this.img.getBoundingClientRect();\n if (!rect.width) return;\n const ratio = rect.height / rect.width;\n const startX = event.clientX;\n const startWidth = Math.round(rect.width);\n let width = startWidth;\n // The line less the caret's room is the ceiling (`CARET_ROOM`): at it\n // the image fills the line but for the spot the caret stands in to its\n // right — and never past the email maximum.\n const pos = this.getPos();\n const ceiling = pos === undefined ? null : lineCeilingAt(this.view, pos);\n const max = ceiling !== null ? Math.min(MAX_IMAGE_WIDTH, ceiling) : MAX_IMAGE_WIDTH;\n this.resized = true;\n\n const preview = (ev: PointerEvent) => {\n const delta = ev.clientX - startX;\n width = clamp(\n Math.round(rect.width + (side === 'right' ? delta : -delta)),\n MIN_IMAGE_WIDTH,\n max,\n );\n this.frame.style.width = `${width}px`;\n this.frame.style.height = `${Math.round(width * ratio)}px`;\n };\n const finish = () => {\n window.removeEventListener('pointermove', preview);\n window.removeEventListener('pointerup', finish);\n window.removeEventListener('pointercancel', finish);\n this.dom.classList.remove('aee-image--resizing', `aee-image--resizing-${side}`);\n this.frame.removeAttribute('style');\n // The click for this press, if any, fires before this timeout.\n setTimeout(() => (this.resized = false), 0);\n const pos = this.getPos();\n if (pos === undefined || width === startWidth) return;\n const tr = this.view.state.tr.setNodeMarkup(pos, undefined, { ...this.node.attrs, width });\n tr.setSelection(NodeSelection.create(tr.doc, pos));\n this.view.dispatch(tr);\n };\n\n this.dom.classList.add('aee-image--resizing', `aee-image--resizing-${side}`);\n preview(event);\n window.addEventListener('pointermove', preview);\n window.addEventListener('pointerup', finish);\n window.addEventListener('pointercancel', finish);\n }\n}\n\n/**\n * The image a selection holds and nothing else, or null: a click's node\n * selection, or a range that covers the image alone — a drag over it, or\n * Shift-arrow, that caught nothing but whitespace along the way (spaces,\n * tabs, a line break: no character, no token, no second atom; see\n * `soleInlineAtom`). What an image's own chrome (a bubble menu, its\n * actions) keys on; a range with text in it is a text selection.\n */\nexport function selectedImage(state: EditorState): { pos: number; node: Node } | null {\n return soleInlineAtom(state, 'image');\n}\n\n/** The selected image's alt text: `''` when it has none, `null` when no\n image is the selection (see {@link selectedImage}). */\nexport function selectedImageAlt(state: EditorState): string | null {\n const image = selectedImage(state);\n return image ? ((image.node.attrs['alt'] as string | null) ?? '') : null;\n}\n\n/** Keeps the selection an image edit started from: the node selection a\n click made, or the range a drag made. A node replaced in place does not\n map a node selection over itself, so it is set again. */\nfunction reselect(tr: Transaction, state: EditorState, pos: number): Transaction {\n return state.selection instanceof NodeSelection\n ? tr.setSelection(NodeSelection.create(tr.doc, pos))\n : tr.setSelection(TextSelection.create(tr.doc, state.selection.from, state.selection.to));\n}\n\n/** Sets the selected image's alt text; empty or null takes it off. */\nconst setImageAlt =\n (alt: string | null): Command =>\n (state, dispatch) => {\n const image = selectedImage(state);\n if (!image) return false;\n const tr = state.tr.setNodeMarkup(image.pos, undefined, {\n ...image.node.attrs,\n alt: alt?.trim() || null,\n });\n dispatch?.(reselect(tr, state, image.pos));\n return true;\n };\n\n/** Deletes the selected image. */\nconst removeImage: Command = (state, dispatch) => {\n const image = selectedImage(state);\n if (!image) return false;\n dispatch?.(state.tr.delete(image.pos, image.pos + image.node.nodeSize).scrollIntoView());\n return true;\n};\n\n/** Opens the picker and swaps the selected image's file, in place. The\n frame stays the author's: a width they set is kept (the new picture\n takes it, at its own ratio). The alt goes with the old picture, so the\n new one's is the file's name — rewrite it after. Nothing happens if the\n image has gone or moved by the time the file is read. */\nfunction replaceSelectedImage(view: EditorView): void {\n const image = selectedImage(view.state);\n if (!image) return;\n void pickImageFiles(false).then(async ([file]) => {\n if (!file || view.isDestroyed) return;\n const picked = await readImageFile(file, inlineImageRegistry(view.state));\n const { state } = view;\n if (view.isDestroyed || state.doc.nodeAt(image.pos) !== image.node) return;\n const tr = state.tr.setNodeMarkup(image.pos, undefined, {\n ...image.node.attrs,\n src: picked.src,\n alt: picked.alt ?? null,\n width: image.node.attrs['width'] ?? picked.width ?? null,\n });\n view.dispatch(reselect(tr, state, image.pos));\n });\n}\n\n/**\n * Inline image — Gmail's and Proton's model (decided 2026-09-02): the image\n * sits in the text line like a character, so the caret can stand right\n * beside it at the image's height and typing continues next to it. The\n * serialized form is then Gmail's own (`<div><img …></div>` for an image on\n * a line of its own), which is as safe as email HTML gets. Sizing is the\n * responsiveness-ledger hybrid: the `width`\n * *attribute* for Outlook (which ignores `max-width` entirely) plus\n * `width:100%; max-width:<n>px; height:auto` for everyone else — fluid on\n * phones, capped at natural size on desktop, no media queries. `float` never\n * parses and never serializes. Dropped or pasted image files insert as\n * data-URL images — what a browser editor can hold on its own; the send\n * intent promotes them to `cid:` parts (`promoteInlineImages`), and the\n * source pane lints them until then. Which drops the editor claims at all\n * is {@link claimedImageFiles}: all images, or none.\n */\nexport const Image = defineNode({\n name: 'image',\n spec: {\n inline: true,\n group: 'inline',\n draggable: true,\n atom: true,\n attrs: {\n src: { default: null },\n alt: { default: null },\n title: { default: null },\n width: { default: null },\n },\n parseDOM: [\n {\n // Any <img>: one without a source (or with an empty one) is a\n // placeholder — a sized frame awaiting its file.\n tag: 'img',\n getAttrs: (node) => {\n const src = node.getAttribute('src') || null;\n // Same rule as the link mark: a script URL kills the node on parse.\n if (src && !isSafeUrl(src)) return false;\n return {\n src,\n alt: node.getAttribute('alt'),\n title: node.getAttribute('title'),\n width: parseWidth(node),\n };\n },\n },\n ],\n toDOM: (node) => {\n const { src, alt, title, width } = node.attrs;\n const style = width\n ? `width: 100%; max-width: ${width}px; height: auto;`\n : 'max-width: 100%; height: auto;';\n return [\n 'img',\n {\n ...(src && { src }),\n ...(alt && { alt }),\n ...(title && { title }),\n ...(width && { width: String(width) }),\n style,\n },\n ];\n },\n },\n commands: ({ schema }) => ({\n insertImage: (attrs: ImageAttrs) => (state, dispatch) => {\n if (attrs.src && !isSafeUrl(attrs.src)) return false;\n dispatch?.(\n state.tr.replaceSelectionWith(schema.nodes['image'].create(attrs)).scrollIntoView(),\n );\n return true;\n },\n setImageAlt,\n removeImage: () => removeImage,\n }),\n actions: ({ schema }) => [\n {\n id: 'image',\n section: 'media',\n title: 'Image',\n keywords: ['image', 'picture', 'photo', 'img'],\n icon: 'image',\n command: (_state, _dispatch, view) => {\n if (view) pickAndInsertImages(view, schema);\n return true;\n },\n },\n {\n // The slide-deck model: size the frame first, click it to fill it.\n id: 'image-placeholder',\n section: 'media',\n title: 'Image placeholder',\n keywords: ['placeholder', 'image', 'frame', 'slot', 'picture'],\n icon: 'add_photo_alternate',\n command: (state, dispatch) => {\n dispatch?.(\n state.tr\n .replaceSelectionWith(schema.nodes['image'].create({ width: PLACEHOLDER_WIDTH }))\n .scrollIntoView(),\n );\n return true;\n },\n },\n // The selected image's own: enabled only while an image is the whole\n // selection, so a `/` menu (a caret) never offers them.\n {\n id: 'replace-image',\n section: 'media',\n title: 'Replace image',\n keywords: ['replace', 'image', 'swap', 'change'],\n icon: 'swap_horiz',\n isEnabled: (state) => !!selectedImage(state),\n command: (state, _dispatch, view) => {\n if (!selectedImage(state)) return false;\n if (view) replaceSelectedImage(view);\n return true;\n },\n },\n {\n id: 'remove-image',\n section: 'media',\n title: 'Remove image',\n keywords: ['remove', 'delete', 'image'],\n icon: 'delete',\n isEnabled: (state) => !!selectedImage(state),\n command: removeImage,\n },\n ],\n plugins: ({ schema }) => [\n new Plugin({\n key: new PluginKey('imageFiles'),\n props: {\n handleDOMEvents: {\n dragenter: claimImageDrag,\n dragover: claimImageDrag,\n },\n handleDrop(view, event) {\n const files = imageFiles(event.dataTransfer);\n if (!files.length) return false;\n event.preventDefault();\n imageDragKey.getState(view.state)?.claim?.(event);\n void insertImageFiles(view, schema, files, imageDropTarget(view).pos);\n return true;\n },\n handlePaste(view, event) {\n const files = imageFiles(event.clipboardData);\n if (!files.length) return false;\n void insertImageFiles(view, schema, files, view.state.selection.from);\n return true;\n },\n },\n }),\n new Plugin({\n key: new PluginKey('imageDropLine'),\n view: (view) => new ImageDropLine(view),\n }),\n new Plugin({\n key: new PluginKey('imageView'),\n props: { nodeViews: { image: (node, view, getPos) => new ImageView(node, view, getPos) } },\n }),\n ],\n});\n","import { Command } from 'prosemirror-state';\nimport { defineNode } from '../../extension';\n\n/** A block-level rule. Ledger row: horizontal rule → `width: 100%`, done —\n no fixed pixel width to overflow a phone. Colour is a faint neutral line,\n not text, so it is exempt from the dual-contrast rule. */\nexport const Divider = defineNode({\n name: 'divider',\n spec: {\n group: 'block',\n atom: true,\n selectable: true,\n draggable: true,\n parseDOM: [{ tag: 'hr' }],\n // A filled 1px bar, styled with pure longhand properties and an rgb()\n // colour only. Shorthands (`border`, `border-width`, `margin`) are\n // avoided on purpose: the CSSOM re-serializes them non-deterministically\n // across engines — jsdom even *reorders* `border-width` vs Chrome — which\n // would break canonical stability. Longhands keep their insertion order\n // everywhere.\n toDOM: () => [\n 'hr',\n {\n style:\n 'height: 1px; width: 100%; background-color: rgb(224, 224, 224); ' +\n 'margin-top: 12px; margin-bottom: 12px;',\n },\n ],\n },\n commands: ({ schema }) => ({\n insertDivider: (): Command => (state, dispatch) => {\n dispatch?.(state.tr.replaceSelectionWith(schema.nodes['divider'].create()).scrollIntoView());\n return true;\n },\n }),\n actions: ({ schema }) => [\n {\n id: 'divider',\n section: 'blocks',\n title: 'Divider',\n keywords: ['divider', 'separator', 'rule', 'hr', 'line'],\n icon: 'horizontal_rule',\n command: (state, dispatch) => {\n dispatch?.(\n state.tr.replaceSelectionWith(schema.nodes['divider'].create()).scrollIntoView(),\n );\n return true;\n },\n },\n ],\n});\n","import {\n Command,\n NodeSelection,\n Plugin,\n PluginKey,\n Selection,\n TextSelection,\n} from 'prosemirror-state';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { Node } from 'prosemirror-model';\nimport { defineExtension } from '../extension';\nimport { isInlineAtom } from './inline-atoms';\n\nexport { isInlineAtom, soleInlineAtom, markAttrsOf } from './inline-atoms';\nexport type { InlineAtomAt } from './inline-atoms';\n\n/** The class a text range puts on every inline atom it covers — an image,\n a button: the highlight the app draws, since the browser draws none. */\nexport const IN_SELECTION_CLASS = 'aee-atom--in-selection';\n\n/** The position of the inline atom whose DOM holds a point, or null. */\nfunction atomAt(view: EditorView, node: globalThis.Node): number | null {\n for (\n let element = node.nodeType === 1 ? (node as Element) : node.parentElement;\n element && element !== view.dom && view.dom.contains(element);\n element = element.parentElement\n ) {\n const pos = view.posAtDOM(element, 0);\n const found = view.state.doc.nodeAt(pos);\n if (found && isInlineAtom(found) && view.nodeDOM(pos) === element) return pos;\n }\n return null;\n}\n\n/** Whether a textblock holds an inline atom — a line with an image or a\n button in it. */\nfunction holdsAtom(textblock: Node): boolean {\n let holds = false;\n textblock.forEach((child) => {\n if (isInlineAtom(child)) holds = true;\n });\n return holds;\n}\n\n/**\n * Shift-arrow from a selected atom grows a range from it, the way it grows\n * one from a selected letter: the atom stays in, and the next character —\n * or atom, or line — joins it. (ProseMirror alone collapses the node\n * selection to a caret beside the atom, and the atom is lost.) The anchor\n * is the atom's far side, so the range covers it.\n */\nconst extendFromAtom =\n (dir: 1 | -1): Command =>\n (state, dispatch) => {\n const { selection, doc } = state;\n if (!(selection instanceof NodeSelection) || !isInlineAtom(selection.node)) return false;\n const $edge = dir > 0 ? selection.$to : selection.$from;\n const next = dir > 0 ? $edge.nodeAfter : $edge.nodeBefore;\n let head = $edge.pos;\n if (next) {\n head += dir * (next.isText ? 1 : next.nodeSize);\n } else {\n // The line's end: the next line's start (or the previous line's end).\n const beyond = Selection.findFrom(\n doc.resolve(dir > 0 ? $edge.after() : $edge.before()),\n dir,\n true,\n );\n if (beyond) head = beyond.head;\n }\n const anchor = dir > 0 ? selection.from : selection.to;\n dispatch?.(\n state.tr\n .setSelection(TextSelection.between(doc.resolve(anchor), doc.resolve(head)))\n .scrollIntoView(),\n );\n return true;\n };\n\n/** A mouse drag in progress, from its press. */\ninterface Drag {\n /** The press as a document position: the anchor of a range made here. */\n press: number;\n /** The atom pressed on, if any: the range then anchors on its far side. */\n atom: number | null;\n /** Whether the plugin makes the whole selection (`own`: a press on an\n atom, or in a line with one — the browser was kept from it), or only\n corrects the browser's for the stretch the pointer spends over an\n atom. */\n own: boolean;\n /** Where the pointer is, once it has moved. */\n pointer: { left: number; top: number } | null;\n /** Past the click's slack: a drag, not a click. */\n moved: boolean;\n /** The selection as the press found it — a click that changed nothing\n through ProseMirror's own handling puts the caret at the press. */\n before: Selection;\n}\n\n/**\n * The range a drag makes for where its pointer is — or null where the\n * browser's own selection serves (a drag the plugin does not own, with the\n * pointer over text).\n *\n * The pointer over an atom takes it whole, whichever half it is over:\n * `posAtCoords` names the node under the point, where the browser would\n * only snap the point to the atom's nearer side (and then keep the\n * selection off the non-editable island altogether). A drag from an atom\n * anchors on the atom's side away from the head, so the atom stays in\n * whichever way the drag runs — and is the range alone while the pointer\n * is on it.\n */\nfunction dragRange(view: EditorView, drag: Drag): Selection | null {\n if (!drag.pointer) return null;\n const found = view.posAtCoords(drag.pointer);\n if (!found) return null;\n const { doc } = view.state;\n const under = found.inside >= 0 ? doc.nodeAt(found.inside) : null;\n const over = under && isInlineAtom(under) ? found.inside : null;\n if (!drag.own && over === null) return null;\n if (drag.atom !== null && !doc.nodeAt(drag.atom)) return null;\n const press = Math.min(drag.press, doc.content.size);\n const base = drag.atom ?? press;\n const head = over !== null ? (over >= base ? over + 1 : over) : found.pos;\n const anchor = drag.atom === null ? press : head > drag.atom ? drag.atom : drag.atom + 1;\n return TextSelection.between(doc.resolve(anchor), doc.resolve(head));\n}\n\n/** The click's slack: a hand at rest still moves a pixel or two. */\nconst CLICK_SLACK = 4;\n\n/**\n * Inline atoms — an image, a button — selected the way characters are, by\n * a click-drag over them, and shown selected when they are.\n *\n * **Why by hand.** An atom is a non-editable island in the editable text,\n * and the browser's selection will not treat it as a character: a\n * selection based inside the island never leaves it, and one based\n * beside it — anywhere on its line — will not grow over it either (Chrome\n * keeps a selection from crossing an editing boundary, and snaps a point\n * over the island to its nearer side). The atom's element, draggable,\n * answers a press with a drag of itself besides. Only a drag from another\n * line, passing clear across the atom, covers it on its own.\n *\n * **So.** A press on an atom, or on a line that holds one, is kept from\n * the browser at `mousedown` (its default is prevented — after\n * ProseMirror's own handling of the press, which stays: a press released\n * in place is still its click, the node selection, a button's link\n * editor), and the plugin makes the selection itself from the press,\n * following the pointer through `posAtCoords` (`dragRange`). A press\n * elsewhere is the browser's drag, corrected for the stretch the pointer\n * spends over an atom — on each move, and again whenever ProseMirror reads\n * the browser's selection back, so the two never disagree. Where the\n * browser puts a DOM endpoint *inside* an atom's element (past it at the\n * line's end), ProseMirror reads the point as \"before the atom\": such an\n * endpoint covers the atom too. A *selected* atom's press is ProseMirror's\n * whole: its drag moves the node, as in Gmail. Shift-arrow from a selected\n * atom grows a range that keeps it (`extendFromAtom`).\n *\n * **Showing.** A range that covers an atom is a text selection (it copies\n * and deletes it as a character), but the element is contenteditable false,\n * so the browser never paints `::selection` on it: {@link IN_SELECTION_CLASS}\n * is the highlight the app draws instead. A click is a node selection;\n * `ProseMirror-selectednode` covers that.\n *\n * What an atom's own chrome (a bubble menu) keys on is {@link soleInlineAtom}:\n * the atom alone, clicked or dragged over with nothing but whitespace.\n */\nexport const InlineAtomSelection = defineExtension({\n name: 'inlineAtomSelection',\n keymap: () => ({\n 'Shift-ArrowRight': extendFromAtom(1),\n 'Shift-ArrowLeft': extendFromAtom(-1),\n }),\n plugins: () => {\n // The mouse drag in progress, if any (one editor's).\n let drag: Drag | null = null;\n let forget: ReturnType<typeof setTimeout> | undefined;\n return [\n new Plugin({\n key: new PluginKey('inlineAtomSelection'),\n view: (view) => {\n const select = (selection: Selection | null) => {\n if (selection && !selection.eq(view.state.selection)) {\n view.dispatch(view.state.tr.setSelection(selection));\n }\n };\n const follow = (current: Drag) => {\n const move = (event: MouseEvent) => {\n if (view.isDestroyed) return stop();\n current.pointer = { left: event.clientX, top: event.clientY };\n if (!current.moved) {\n if (\n current.own &&\n Math.abs(event.clientX - pressed.x) < CLICK_SLACK &&\n Math.abs(event.clientY - pressed.y) < CLICK_SLACK\n ) {\n return;\n }\n current.moved = true;\n }\n select(dragRange(view, current));\n };\n const up = () => {\n stop();\n if (view.isDestroyed) return;\n // A click the plugin kept from the browser, which ProseMirror\n // answered with nothing (a press in the text — the browser\n // would have placed the caret): the caret, at the press.\n if (current.own && !current.moved && current.before.eq(view.state.selection)) {\n const $press = view.state.doc.resolve(\n Math.min(current.press, view.state.doc.content.size),\n );\n select(Selection.near($press));\n }\n // The browser's last word on its selection comes a moment\n // after the release, and is read against the drag still.\n forget = setTimeout(() => {\n if (drag === current) drag = null;\n }, 100);\n };\n const stop = () => {\n window.removeEventListener('mousemove', move);\n window.removeEventListener('mouseup', up);\n };\n const pressed = { x: current.pointer?.left ?? 0, y: current.pointer?.top ?? 0 };\n current.pointer = null;\n clearTimeout(forget);\n drag = current;\n window.addEventListener('mousemove', move);\n window.addEventListener('mouseup', up);\n };\n // After ProseMirror's own mousedown handling (registered before\n // this, at the view's creation), so its click stays.\n const down = (event: MouseEvent) => {\n if (!view.editable || event.button !== 0 || event.shiftKey || event.detail > 1) return;\n const atom = atomAt(view, event.target as globalThis.Node);\n const { selection } = view.state;\n // The selected atom's press is ProseMirror's: its drag moves it.\n if (atom !== null && selection instanceof NodeSelection && selection.from === atom) {\n return;\n }\n const found = view.posAtCoords({ left: event.clientX, top: event.clientY });\n if (!found) return;\n const $press = view.state.doc.resolve(found.pos);\n const own = atom !== null || ($press.parent.isTextblock && holdsAtom($press.parent));\n if (own) {\n // No browser selection, no drag of the element, no focus on\n // it (a button's anchor would take it): the editor's.\n event.preventDefault();\n view.focus();\n }\n follow({\n press: found.pos,\n atom,\n own,\n pointer: { left: event.clientX, top: event.clientY },\n moved: false,\n before: selection,\n });\n };\n view.dom.addEventListener('mousedown', down);\n return {\n destroy() {\n view.dom.removeEventListener('mousedown', down);\n clearTimeout(forget);\n drag = null;\n },\n };\n },\n props: {\n createSelectionBetween(view, $anchor, $head) {\n // Mid-drag, what the browser says is beside the point: the\n // drag's own range, whatever was read (its re-reads then all\n // agree, and the selection holds still).\n if (drag) {\n const range = dragRange(view, drag);\n if (range) return range;\n }\n // The view's own root: inside a shadow root the document's\n // selection does not reach into it.\n const root = view.root as\n Document | (ShadowRoot & { getSelection?: () => globalThis.Selection });\n const dom = root.getSelection?.() ?? view.dom.ownerDocument.getSelection();\n if (!dom?.anchorNode || !dom.focusNode) return null;\n const anchorAtom = atomAt(view, dom.anchorNode);\n const headAtom = atomAt(view, dom.focusNode);\n if (anchorAtom === null && headAtom === null) return null;\n if (anchorAtom !== null && anchorAtom === headAtom) return null;\n let anchor = $anchor.pos;\n let head = $head.pos;\n if (headAtom !== null) head = anchor <= headAtom ? headAtom + 1 : headAtom;\n if (anchorAtom !== null) anchor = head > anchorAtom ? anchorAtom : anchorAtom + 1;\n return TextSelection.create(view.state.doc, anchor, head);\n },\n handleDOMEvents: {\n // A drag of an unselected atom that got past a press the\n // plugin never saw (a synthetic press, a pen): cancelled, and\n // the atom is the selection — where the pointer goes from\n // here the press's own tracking would have followed.\n dragstart(view, event) {\n if (!view.editable) return false;\n const atom = atomAt(view, event.target as globalThis.Node);\n if (atom === null) return false;\n const { selection } = view.state;\n // The selected atom moves by drag — ProseMirror's own.\n if (selection instanceof NodeSelection && selection.from === atom) return false;\n event.preventDefault();\n view.focus();\n view.dispatch(\n view.state.tr.setSelection(TextSelection.create(view.state.doc, atom, atom + 1)),\n );\n return true;\n },\n },\n decorations(state) {\n const { selection } = state;\n if (selection.empty || selection instanceof NodeSelection) return null;\n const decorations: Decoration[] = [];\n state.doc.nodesBetween(selection.from, selection.to, (node, pos) => {\n if (isInlineAtom(node)) {\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, { class: IN_SELECTION_CLASS }),\n );\n }\n });\n return decorations.length ? DecorationSet.create(state.doc, decorations) : null;\n },\n },\n }),\n ];\n },\n});\n","import { EditorState, NodeSelection, Transaction } from 'prosemirror-state';\nimport { MarkType } from 'prosemirror-model';\n\nimport { isMarkActive, selectedMarkAtom } from '../../editor';\nimport { setMark } from './set.utils';\nimport { unsetMark } from './unset.utils';\n\n/**\n * A reusable toggle command that orchestrates set and unset.\n *\n * Active-state is delegated to {@link isMarkActive} — the exact check the\n * toolbar uses to light up its buttons — so the command and the UI can never\n * disagree. The previous `$from.marks()` test only looked at the selection's\n * left edge, so toggling a fully-marked range read it as inactive and\n * re-applied the mark instead of removing it.\n *\n * A selected atom that takes the mark as an attribute (a button, see\n * `selectedMarkAtom`) has that attribute flipped instead, and stays selected\n * as it was — the click's node selection, or the drag's range.\n */\nexport function toggleMark(markType: MarkType, attributes: Record<string, any> = {}) {\n return (state: EditorState, dispatch?: (tr: Transaction) => void): boolean => {\n const atom = selectedMarkAtom(state, markType);\n if (atom) {\n if (dispatch) {\n const { pos, node } = atom;\n const tr = state.tr.setNodeAttribute(\n pos,\n markType.name,\n node.attrs[markType.name] !== true,\n );\n if (state.selection instanceof NodeSelection) {\n tr.setSelection(NodeSelection.create(tr.doc, pos));\n }\n dispatch(tr);\n }\n return true;\n }\n if (isMarkActive(state, markType)) {\n return unsetMark(markType)(state, dispatch);\n }\n return setMark(markType, attributes)(state, dispatch);\n };\n}\n","import { isMarkActive } from '../../editor';\nimport { defineMark } from '../../extension';\n\nimport { setMark } from './set.utils';\nimport { unsetMark } from './unset.utils';\nimport { toggleMark } from './toggle.utils';\n\n/** **bold** */\nexport const starInputRegex = /(?:^|\\s)(\\*\\*(?!\\s+\\*\\*)((?:[^*]+))\\*\\*(?!\\s+\\*\\*))$/;\n\n/** **bold** while pasting. */\nexport const starPasteRegex = /(?:^|\\s)(\\*\\*(?!\\s+\\*\\*)((?:[^*]+))\\*\\*(?!\\s+\\*\\*))/g;\n\n/** __bold__ */\nexport const underscoreInputRegex = /(?:^|\\s)(__(?!\\s+__)((?:[^_]+))__(?!\\s+__))$/;\n\n/** __bold__ while pasting. */\nexport const underscorePasteRegex = /(?:^|\\s)(__(?!\\s+__)((?:[^_]+))__(?!\\s+__))/g;\n\n/**\n * Email specific html bold parsing rules.\n * Watchout for normlization against\n * - numeric font weights\n * - case-insensitive font weights\n * - inline styles resetting the weight back to normal\n * - inline styles resetting the weight back to 400\n * - inline styles resetting the weight back to normal\n * - inline styles resetting the weight back to 400\n */\nexport const Bold = defineMark({\n name: 'bold',\n spec: {\n parseDOM: [\n { tag: 'strong' },\n {\n /** <b> counts as bold unless inline styles reset the weight back to normal.*/\n tag: 'b',\n getAttrs: (node) => {\n if (node.style?.fontWeight === 'normal' || node.style?.fontWeight === '400') {\n return false;\n }\n return null;\n },\n },\n {\n style: 'font-weight=normal',\n clearMark: (mark) => mark.type.name === 'bold',\n },\n {\n style: 'font-weight=400',\n clearMark: (mark) => mark.type.name === 'bold',\n },\n {\n style: 'font-weight',\n // Cast value to string and use 'i' flag for case-insensitivity. From\n // 600: a 500 is a medium, which a face without one (Arial, every\n // email-safe stack) draws as its regular.\n getAttrs: (value) => (/^(bold(er)?|[6-9]\\d{2,})$/i.test(value as string) ? null : false),\n },\n ],\n toDOM: () => ['strong', { style: 'font-weight: bold;' }, 0],\n },\n commands: ({ schema }) => ({\n setBold: () => setMark(schema.marks['bold']),\n unsetBold: () => unsetMark(schema.marks['bold']),\n toggleBold: () => toggleMark(schema.marks['bold']),\n }),\n keymap: ({ schema }) => ({\n 'Mod-b': toggleMark(schema.marks['bold']),\n 'Mod-B': toggleMark(schema.marks['bold']),\n }),\n actions: ({ schema }) => [\n {\n id: 'bold',\n section: 'styling',\n title: 'Bold',\n keywords: ['bold'],\n icon: 'format_bold',\n command: toggleMark(schema.marks['bold']),\n isActive: (state) => isMarkActive(state, schema.marks['bold']),\n },\n ],\n});\n","import { isMarkActive } from '../../editor';\nimport { defineMark } from '../../extension';\nimport { setMark } from './set.utils';\nimport { unsetMark } from './unset.utils';\nimport { toggleMark } from './toggle.utils';\n\n/** *italic* */\nexport const italicStarInputRegex = /(?:^|\\s)(\\*(?!\\s+\\*)((?:[^*]+))\\*(?!\\s+\\*))$/;\n\n/** *italic* while pasting. */\nexport const italicStarPasteRegex = /(?:^|\\s)(\\*(?!\\s+\\*)((?:[^*]+))\\*(?!\\s+\\*))/g;\n\n/** _italic_ */\nexport const italicUnderscoreInputRegex = /(?:^|\\s)(_(?!\\s+_)((?:[^_]+))_(?!\\s+_))$/;\n\n/** _italic_ while pasting. */\nexport const italicUnderscorePasteRegex = /(?:^|\\s)(_(?!\\s+_)((?:[^_]+))_(?!\\s+_))/g;\n\nexport const Italic = defineMark({\n name: 'italic',\n spec: {\n parseDOM: [\n { tag: 'em' },\n { tag: 'i', getAttrs: (node) => (node.style.fontStyle !== 'normal' ? null : false) },\n { style: 'font-style=normal', clearMark: (mark) => mark.type.name === 'italic' },\n { style: 'font-style=italic' },\n ],\n toDOM: () => ['em', { style: 'font-style: italic;' }, 0],\n },\n commands: ({ schema }) => ({\n setItalic: () => setMark(schema.marks['italic']),\n unsetItalic: () => unsetMark(schema.marks['italic']),\n toggleItalic: () => toggleMark(schema.marks['italic']),\n }),\n keymap: ({ schema }) => ({\n 'Mod-i': toggleMark(schema.marks['italic']),\n 'Mod-I': toggleMark(schema.marks['italic']),\n }),\n actions: ({ schema }) => [\n {\n id: 'italic',\n section: 'styling',\n title: 'Italic',\n keywords: ['italic'],\n icon: 'format_italic',\n command: toggleMark(schema.marks['italic']),\n isActive: (state) => isMarkActive(state, schema.marks['italic']),\n },\n ],\n});\n","import { isMarkActive } from '../../editor';\nimport { defineMark } from '../../extension';\nimport { setMark } from './set.utils';\nimport { toggleMark } from './toggle.utils';\nimport { unsetMark } from './unset.utils';\n\nexport const Underline = defineMark({\n name: 'underline',\n spec: {\n parseDOM: [\n { tag: 'u' },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: (style) => (style.includes('underline') ? {} : false),\n },\n ],\n toDOM: () => ['u', { style: 'text-decoration: underline;' }, 0],\n },\n commands: ({ schema }) => ({\n setUnderline: () => setMark(schema.marks['underline']),\n unsetUnderline: () => unsetMark(schema.marks['underline']),\n toggleUnderline: () => toggleMark(schema.marks['underline']),\n }),\n keymap: ({ schema }) => ({\n 'Mod-u': toggleMark(schema.marks['underline']),\n 'Mod-U': toggleMark(schema.marks['underline']),\n }),\n actions: ({ schema }) => [\n {\n id: 'underline',\n section: 'styling',\n title: 'Underline',\n keywords: ['underline'],\n icon: 'format_underlined',\n command: toggleMark(schema.marks['underline']),\n isActive: (state) => isMarkActive(state, schema.marks['underline']),\n },\n ],\n});\n","import { toggleMark } from 'prosemirror-commands';\nimport { isMarkActive } from '../../editor';\nimport { defineMark } from '../../extension';\nimport { setMark } from './set.utils';\nimport { unsetMark } from './unset.utils';\n\nexport const Strike = defineMark({\n name: 'strike',\n spec: {\n parseDOM: [\n {\n tag: 's',\n },\n {\n tag: 'del',\n },\n {\n tag: 'strike',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: (style) => ((style as string).includes('line-through') ? {} : false),\n },\n ],\n toDOM: () => ['s', { style: 'text-decoration: line-through;' }, 0],\n },\n commands: ({ schema }) => ({\n setStrike: () => setMark(schema.marks['strike']),\n unsetStrike: () => unsetMark(schema.marks['strike']),\n toggleStrike: () => toggleMark(schema.marks['strike']),\n }),\n actions: ({ schema }) => [\n {\n id: 'strike',\n section: 'styling',\n title: 'Strike',\n keywords: ['strike', 'strikethrough'],\n icon: 'format_strikethrough',\n command: toggleMark(schema.marks['strike']),\n isActive: (state) => isMarkActive(state, schema.marks['strike']),\n },\n ],\n});\n","import { history, redo, undo } from 'prosemirror-history';\nimport { defineExtension } from '../extension';\n\nexport const History = defineExtension({\n name: 'history',\n plugins: () => [history()],\n commands: () => ({\n undo: () => undo,\n redo: () => redo,\n }),\n keymap: () => ({\n 'Mod-z': undo,\n 'Mod-y': redo,\n 'Shift-Mod-z': redo,\n }),\n});\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Node } from 'prosemirror-model';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { defineExtension } from '../extension';\n\n/** The layout blocks the editor treats as structures in their own right: their\n shape is invisible in the exported email (our tables are borderless; columns\n are bare inline-block divs), so the editor has to reveal it — and they carry\n block-level commands (align, add/remove row…) that need somewhere to live.\n One definition, shared by the guides and the block menu. */\nexport type LayoutBlockType = 'table' | 'columns' | 'section';\n\nconst LAYOUT_BLOCKS = new Set<string>(['table', 'columns', 'section']);\n\nexport interface LayoutBlock {\n pos: number;\n node: Node;\n type: LayoutBlockType;\n}\n\n/** The innermost `table`/`columns`/`section` ancestor of the selection, or null. */\nexport function layoutBlockAt(state: EditorState): LayoutBlock | null {\n const { $from } = state.selection;\n for (let depth = $from.depth; depth > 0; depth--) {\n const node = $from.node(depth);\n if (LAYOUT_BLOCKS.has(node.type.name)) {\n return { pos: $from.before(depth), node, type: node.type.name as LayoutBlockType };\n }\n }\n return null;\n}\n\n/** Class on the layout block the cursor is currently inside. */\nexport const GUIDES_ACTIVE_CLASS = 'aee-guides-active';\n\n/** Class on the editor root while the peek modifier is held — reveals *every*\n layout block's guides at once. */\nexport const GUIDES_PEEK_CLASS = 'aee-guides-peek';\n\n/**\n * How long Ctrl must be held before guides appear. Ctrl is also the prefix for\n * every shortcut (Ctrl-B, Ctrl-C, Ctrl-Z), so revealing instantly would make the\n * grid flash on every one of them. A hold delay — cancelled by any other key —\n * separates \"I'm peeking at the layout\" from \"I'm running a shortcut\".\n *\n * Kept just under the ~100ms that still reads as instant: a real chord presses\n * its letter 30–80ms after the modifier, so this catches shortcuts while a\n * deliberate hold feels immediate. The rest of the debouncing is perceptual —\n * the guides *fade* in (see the `.aee-guides-*` transition in the app's global\n * styles), so anything slipping past this timer is a soft partial fade rather\n * than a hard blink. Longer than this and a deliberate peek just feels laggy.\n */\nexport const GUIDES_PEEK_DELAY_MS = 100;\n\n/**\n * One shared mechanism for showing the structure of layout blocks (tables and\n * columns alike) while editing — never in the email itself.\n *\n * Three ways in, all resolved in CSS against a border that is *always reserved\n * as transparent*, so revealing a guide never shifts layout:\n * 1. **Cursor inside** — the block being edited is tagged {@link GUIDES_ACTIVE_CLASS}.\n * 2. **Hover** — pure CSS on the block itself; nothing to coordinate here.\n * 3. **Peek** — hold Ctrl ({@link GUIDES_PEEK_DELAY_MS}) to reveal every block\n * at once via {@link GUIDES_PEEK_CLASS} on the editor root.\n *\n * The app owns the pixels (see the `.aee-guides-*` rules in its global styles);\n * this extension only supplies the state.\n */\nexport const LayoutGuides = defineExtension({\n name: 'layoutGuides',\n plugins: () => [\n new Plugin({\n key: new PluginKey('layoutGuides'),\n props: {\n decorations(state) {\n const block = layoutBlockAt(state);\n if (!block) return null;\n return DecorationSet.create(state.doc, [\n Decoration.node(block.pos, block.pos + block.node.nodeSize, {\n class: GUIDES_ACTIVE_CLASS,\n }),\n ]);\n },\n },\n view: (view) => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const clearTimer = () => {\n if (timer !== undefined) clearTimeout(timer);\n timer = undefined;\n };\n const setPeek = (on: boolean) => {\n clearTimer();\n view.dom.classList.toggle(GUIDES_PEEK_CLASS, on);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n // Any key that isn't the modifier itself means a shortcut is being\n // typed, not a peek — cancel the pending reveal and hide.\n if (event.key !== 'Control') {\n setPeek(false);\n return;\n }\n if (timer !== undefined || view.dom.classList.contains(GUIDES_PEEK_CLASS)) return;\n timer = setTimeout(() => {\n timer = undefined;\n view.dom.classList.add(GUIDES_PEEK_CLASS);\n }, GUIDES_PEEK_DELAY_MS);\n };\n const onKeyUp = (event: KeyboardEvent) => {\n if (event.key === 'Control') setPeek(false);\n };\n // A lost keyup (tabbing away mid-hold) would strand the guides on.\n const onBlur = () => setPeek(false);\n\n document.addEventListener('keydown', onKeyDown);\n document.addEventListener('keyup', onKeyUp);\n window.addEventListener('blur', onBlur);\n\n return {\n destroy() {\n clearTimer();\n document.removeEventListener('keydown', onKeyDown);\n document.removeEventListener('keyup', onKeyUp);\n window.removeEventListener('blur', onBlur);\n },\n };\n },\n }),\n ],\n});\n","import { gapCursor } from 'prosemirror-gapcursor';\nimport { defineExtension } from '../extension';\n\n/**\n * A real cursor in the gaps *between* block nodes — ProseMirror's own answer to\n * the trap every layout block falls into: our table and columns are\n * `isolating`, so when one is the last thing in the document there is no text\n * position after it, and clicking the empty space below it does nothing.\n *\n * With this, that click (and ArrowDown/ArrowRight out of a block, and a\n * click *between* two adjacent blocks) lands a blinking gap cursor; typing\n * there creates a paragraph. It is the mouse sibling of the block escapes we\n * hand-rolled per node — one mechanism, every block, no per-node code.\n *\n * Ordering note: this must sit *after* the layout nodes in the kit. Extension\n * plugins run in kit order and gap-cursor claims the arrow keys, so the\n * table's own ArrowDown escape (which writes a paragraph below a trailing\n * table rather than parking a cursor in the gap) has to be reached first.\n *\n * Pixels: `.ProseMirror-gapcursor` in the app's global styles, transcribed\n * from `prosemirror-gapcursor/style/gapcursor.css` (MIT) and scoped to\n * `.aee-editor` like everything else we ship.\n */\nexport const Gapcursor = defineExtension({\n name: 'gapcursor',\n plugins: () => [gapCursor()],\n});\n","import { applyAuthoredAttributes } from '../authored';\nimport { Command, EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Node } from 'prosemirror-model';\nimport { Decoration, DecorationSet, EditorView, ViewMutationRecord } from 'prosemirror-view';\nimport { CellSelection, TableMap } from 'prosemirror-tables';\nimport { defineExtension } from '../extension';\nimport {\n MIN_COLUMN_PCT,\n MIN_TABLE_PCT,\n addColumnAtEnd,\n addRowAtEnd,\n formatPct,\n tableStyle,\n} from './nodes/table';\n\n/**\n * Column resize — drag the boundary between two columns, in percentages.\n *\n * The reference UX is Tiptap's (hover a boundary, a primary-coloured line\n * lights up, drag it), but its mechanism can't ship in email, so ours differs\n * under the skin in exactly the ways the ROADMAP's responsiveness ledger\n * demands:\n *\n * - **Percentages, never pixels.** Tiptap commits `colwidth=\"137\"` (px) and a\n * px `<colgroup>`; a fixed-px column is the ledger's central trap. Our drag\n * commits percentages into the same `colwidth` attr, and the email carries\n * them as `width: n%` *on the cells* — the one place every client honours a\n * width — while staying fluid at every viewport.\n * - **Everything visual is editor furniture.** The table's NodeView renders\n * `div.aee-table-wrap > table (colgroup + tbody) + div.aee-col-lines`: a\n * scroll wrapper, a display colgroup the drag previews against, and one\n * full-height boundary line per draggable boundary. None of it serializes —\n * the schema's `toDOM` (which also feeds the clipboard) stays the bare\n * canonical table.\n * - **No per-column px minimum.** Tiptap floors columns at 120px; px again.\n * The drag clamps at {@link MIN_COLUMN_PCT} instead — at 320px that is\n * ~32px, and a column resized to 15% *is* 15% on a phone. Honest fluidity.\n *\n * The boundary lines are the payoff of the percentage model: their positions\n * are *computed from the document* (`left` = the cumulative column share), so\n * a full-height line exists per boundary with zero measurement and zero\n * pointer tracking — hovering anywhere along the boundary lights the whole\n * line, because the line is one element, not a per-cell segment. Only the\n * drag itself follows the pointer (a drag *is* a pointer gesture), and its\n * move/up listeners live on `window` for its duration, so the pointer can\n * never outrun the handle and stutter.\n *\n * **The drag is a deferred commit, Word-style: only the guide line moves.**\n * We tried live reflow first (previewing through the colgroup) and the\n * tracking was perfect — and unusable: reflowing the table on every\n * pointermove rewraps its text on every frame, and the whole grid churns\n * under the hand. So mid-drag the table does not move at all; the lit line is\n * the preview (its clamp stops it at the 10% floors, so the limits read\n * directly off it), and release applies one rounded transaction — the table\n * lays out exactly once, and the drag is one undo step.\n */\nconst columnResizeKey = new PluginKey<DecorationSet>('columnResize');\n\nexport const ColumnResize = defineExtension({\n name: 'columnResize',\n plugins: () => [\n new Plugin<DecorationSet>({\n key: columnResizeKey,\n state: {\n init: (_, state) => selectionDecorations(state),\n apply: (tr, decorations, _old, state) => {\n // Selection chrome is a handful of node decorations. Typing maps\n // them; a caret or cell-selection change rebuilds them. Building\n // a new set on every keystroke is the thing Tiptap's table view\n // refuses to do, and so do we.\n if (!tr.docChanged && !tr.selectionSet) return decorations;\n if (tr.docChanged && !tr.selectionSet) {\n const mapped = decorations.map(tr.mapping, state.doc);\n // A resize rewrites cell markup and mapping drops the node\n // decorations that sat on those cells (the selection rectangle,\n // the last-row/column classes). Rebuild when the set shrank.\n if (mapped.find().length === decorations.find().length) return mapped;\n }\n return selectionDecorations(state);\n },\n },\n props: {\n nodeViews: {\n table: (node, view, getPos) => new TableView(node, view, getPos as () => number),\n },\n decorations: (state) => columnResizeKey.getState(state),\n },\n }),\n ],\n});\n\nexport { MIN_COLUMN_PCT, MIN_TABLE_PCT } from './nodes/table';\n\nconst clamp = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));\nconst round1 = (n: number) => Math.round(n * 10) / 10;\n\n/** The declared width of each grid column (`null` = unspecified, shares the\n leftover) — read from the first cell in the column that declares one. */\nexport function columnWidths(table: Node): (number | null)[] {\n const map = TableMap.get(table);\n const widths: (number | null)[] = Array.from({ length: map.width }, () => null);\n for (let col = 0; col < map.width; col++) {\n for (let row = 0; row < map.height; row++) {\n const rel = map.map[row * map.width + col];\n const cell = table.nodeAt(rel)!;\n const colwidth = cell.attrs['colwidth'] as number[] | null;\n if (!colwidth) continue;\n const entry = colwidth[col - map.findCell(rel).left];\n // 0 is the library's padding for freshly spanned columns — \"no width\",\n // not \"zero width\"; a zero-wide column would render as deleted.\n if (entry) {\n widths[col] = entry;\n break;\n }\n }\n }\n return widths;\n}\n\n/** Every column's effective share, normalized to sum to 100: declared widths\n as declared, undeclared columns splitting the leftover equally — the same\n distribution fixed layout uses, so these numbers *are* the pixels and the\n boundary lines can be placed by pure arithmetic. */\nexport function effectiveWidths(table: Node): number[] {\n const declared = columnWidths(table);\n const specified = declared.filter((width): width is number => width != null);\n const leftover = Math.max(100 - specified.reduce((total, width) => total + width, 0), 0);\n const share = leftover / Math.max(declared.length - specified.length, 1);\n const raw = declared.map((width) => width ?? share);\n // Foreign markup can declare widths summing past 100; browsers scale\n // proportionally, and so do we, so the lines stay on the real boundaries.\n const total = raw.reduce((sum, width) => sum + width, 0) || 1;\n return raw.map((width) => (width / total) * 100);\n}\n\n/**\n * Sets the widths of the two columns meeting at `boundary` (the line between\n * grid columns `boundary` and `boundary + 1`) — what a resize drag commits.\n * `leftPct` is the left column's new share; the pair's total is conserved, so\n * only these two columns move. Clamped so neither side drops below\n * {@link MIN_COLUMN_PCT}. Every cell touching the two columns gets its\n * `colwidth` entries set (spans included, sum-preserving), so the widths\n * survive first-row edits and row deletion alike.\n */\nexport function setColumnBoundary(tablePos: number, boundary: number, leftPct: number): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n const map = TableMap.get(table);\n if (boundary < 0 || boundary >= map.width - 1) return false;\n\n const effective = effectiveWidths(table);\n const pair = effective[boundary] + effective[boundary + 1];\n if (pair < MIN_COLUMN_PCT * 2) return false;\n const left = round1(clamp(leftPct, MIN_COLUMN_PCT, pair - MIN_COLUMN_PCT));\n const right = round1(pair - left);\n\n if (dispatch) {\n const tr = state.tr;\n const patched = new Map<number, number[]>();\n for (const col of [boundary, boundary + 1]) {\n for (let row = 0; row < map.height; row++) {\n const rel = map.map[row * map.width + col];\n const cell = table.nodeAt(rel)!;\n const start = map.findCell(rel).left;\n // A spanned cell gets a full array (missing entries materialize at\n // their current effective width) so the one entry can move while the\n // others hold still.\n const colwidth =\n patched.get(rel) ??\n (cell.attrs['colwidth'] as number[] | null)?.slice() ??\n effective.slice(start, start + (cell.attrs['colspan'] as number)).map(round1);\n colwidth[col - start] = col === boundary ? left : right;\n patched.set(rel, colwidth);\n }\n }\n for (const [rel, colwidth] of patched) {\n const cell = table.nodeAt(rel)!;\n tr.setNodeMarkup(tablePos + 1 + rel, null, { ...cell.attrs, colwidth });\n }\n dispatch(tr);\n }\n return true;\n };\n}\n\n/**\n * Sets the table's box — left offset and width, both percent of the\n * container — what dragging either outer edge commits. The left edge moves\n * the offset (the right edge stays put), the right edge moves the width;\n * the pair clamps so the offset stays ≥ 0, the width keeps its floor, and\n * together they never pass 100.\n *\n * `absorb` is the Word rule that keeps columns independent of the table's\n * edges: column widths are percentages *of the table*, so changing the table\n * width would slide every interior boundary proportionally. With `absorb`,\n * the edge-adjacent column ('first' for a left-edge drag, 'last' for a\n * right-edge one) takes the entire change and every other column is rescaled\n * by oldWidth/newWidth — same absolute size, boundaries exactly where they\n * were (to the 0.1% rounding). The width additionally floors where the\n * absorbing column would hit {@link MIN_COLUMN_PCT}. Without `absorb`,\n * columns scale proportionally.\n */\nexport function setTableBox(\n tablePos: number,\n offsetPct: number,\n widthPct: number,\n absorb?: 'first' | 'last',\n): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n const map = TableMap.get(table);\n const oldWidth = table.attrs['width'] as number;\n\n const offset = round1(clamp(offsetPct, 0, 100 - MIN_TABLE_PCT));\n let width = round1(clamp(widthPct, MIN_TABLE_PCT, 100 - offset));\n\n if (dispatch) {\n const tr = state.tr;\n if (absorb && map.width > 1) {\n const effective = effectiveWidths(table);\n const absorbIndex = absorb === 'first' ? 0 : map.width - 1;\n const others = 100 - effective[absorbIndex];\n width = round1(clamp(width, minTableWidth(oldWidth, others), 100 - offset));\n const factor = oldWidth / width;\n const pcts = effective.map((pct, index) =>\n index === absorbIndex ? 0 : round1(pct * factor),\n );\n pcts[absorbIndex] = round1(100 - pcts.reduce((sum, pct) => sum + pct, 0));\n\n const seen = new Set<number>();\n for (const rel of map.map) {\n if (seen.has(rel)) continue;\n seen.add(rel);\n const cell = table.nodeAt(rel)!;\n const left = map.findCell(rel).left;\n const colwidth = pcts.slice(left, left + (cell.attrs['colspan'] as number));\n tr.setNodeMarkup(tablePos + 1 + rel, null, { ...cell.attrs, colwidth });\n }\n }\n tr.setNodeMarkup(tablePos, null, { ...table.attrs, offset, width });\n dispatch(tr);\n }\n return true;\n };\n}\n\n/** The narrowest the table may get while its non-absorbing columns keep\n their absolute widths and the absorbing one keeps the column floor. */\nfunction minTableWidth(oldWidth: number, othersPct: number): number {\n return Math.max(MIN_TABLE_PCT, round1((oldWidth * othersPct) / (100 - MIN_COLUMN_PCT)));\n}\n\n/** Width-only convenience over {@link setTableBox}: keeps the offset. */\nexport function setTableWidth(tablePos: number, widthPct: number): Command {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(tablePos);\n if (!table || table.type.name !== 'table') return false;\n return setTableBox(tablePos, table.attrs['offset'] as number, widthPct)(state, dispatch);\n };\n}\n\n/**\n * Edge classes for the cells on a cell selection's boundary, so CSS can draw\n * the selection as *one object* — a crisp rectangle around the whole selected\n * region, Tiptap-style — without Tiptap's machinery. Their overlay is a\n * floating portal positioned by pixel measurement; ours needs none of it: a\n * `CellSelection` is always a rectangle in the `TableMap`, so every selected\n * cell knows from the model alone which of its edges lie on the boundary,\n * and per-cell border segments assemble into the rectangle by themselves.\n */\nfunction selectionDecorations(state: EditorState): DecorationSet {\n const decorations = selectionEdgeDecorations(state);\n const marked = tableEdgeDecoration(state);\n if (marked) decorations.push(marked);\n const active = activeCellDecoration(state);\n if (active) decorations.push(active);\n return decorations.length ? DecorationSet.create(state.doc, decorations) : DecorationSet.empty;\n}\n\nfunction selectionEdgeDecorations(state: EditorState): Decoration[] {\n const selection = state.selection;\n if (!(selection instanceof CellSelection)) return [];\n const table = selection.$anchorCell.node(-1);\n const tableStart = selection.$anchorCell.start(-1);\n const map = TableMap.get(table);\n const rect = map.rectBetween(\n selection.$anchorCell.pos - tableStart,\n selection.$headCell.pos - tableStart,\n );\n\n const decorations: Decoration[] = [];\n const seen = new Set<number>();\n for (const rel of map.cellsInRect(rect)) {\n if (seen.has(rel)) continue;\n seen.add(rel);\n const cell = table.nodeAt(rel)!;\n const box = map.findCell(rel);\n const classes = [\n box.top === rect.top ? 'aee-sel-top' : '',\n box.bottom === rect.bottom ? 'aee-sel-bottom' : '',\n box.left === rect.left ? 'aee-sel-left' : '',\n box.right === rect.right ? 'aee-sel-right' : '',\n ]\n .filter(Boolean)\n .join(' ');\n if (classes) {\n decorations.push(\n Decoration.node(tableStart + rel, tableStart + rel + cell.nodeSize, { class: classes }),\n );\n }\n }\n return decorations;\n}\n\n/** A node decoration outlining the caret's cell — the selection rectangle's\n quiet sibling (same outline, none of the tint), so the cell being typed in\n is always visible. Text cursor or in-cell text selection only: a cell\n selection draws the real rectangle instead. */\nfunction activeCellDecoration(state: EditorState): Decoration | null {\n const selection = state.selection;\n if (selection instanceof CellSelection) return null;\n const { $from, $to } = selection;\n if ($from.parent.type.name !== 'tableCell' || !$from.sameParent($to)) return null;\n const pos = $from.before();\n return Decoration.node(pos, pos + $from.parent.nodeSize, { class: 'aee-cell-active' });\n}\n\n/** A node decoration marking the table whose *last column* and/or *last row*\n holds the caret — a cell counts when its span reaches that edge of the\n grid. The classes drive the add pills' focus reveal. */\nfunction tableEdgeDecoration(state: EditorState): Decoration | null {\n const { $from } = state.selection;\n for (let depth = $from.depth; depth > 0; depth--) {\n if ($from.node(depth).type.name !== 'tableCell') continue;\n const table = $from.node(depth - 2);\n const tablePos = $from.before(depth - 2);\n const map = TableMap.get(table);\n const cell = map.findCell($from.before(depth) - (tablePos + 1));\n const classes = [\n cell.right === map.width ? 'aee-table-wrap--in-last-column' : '',\n cell.bottom === map.height ? 'aee-table-wrap--in-last-row' : '',\n ]\n .filter(Boolean)\n .join(' ');\n if (!classes) return null;\n return Decoration.node(tablePos, tablePos + table.nodeSize, { class: classes });\n }\n return null;\n}\n\n/** A boundary is draggable only where some row actually has a cell edge on\n it — inside a cell that spans it there is nothing to move. */\nfunction isDraggable(map: TableMap, boundary: number): boolean {\n for (let row = 0; row < map.height; row++) {\n const index = row * map.width + boundary;\n if (map.map[index] !== map.map[index + 1]) return true;\n }\n return false;\n}\n\n/**\n * The editor's rendering of a table: a scroll wrapper, a `<colgroup>`\n * mirroring the declared widths, and the full-height boundary lines. All of\n * it is editor furniture — the schema's `toDOM` (used for the email *and* the\n * clipboard) stays the bare table, so nothing here can leak into a\n * serialization.\n */\nclass TableView {\n dom: HTMLElement;\n contentDOM: HTMLElement;\n #box: HTMLElement;\n #table: HTMLTableElement;\n #colgroup: HTMLElement;\n #lines: HTMLElement;\n #boundaries: HTMLElement;\n #edges: { left: HTMLElement; right: HTMLElement };\n #addColumnZone: HTMLElement;\n #addColumn: HTMLElement;\n #addRowZone: HTMLElement;\n #addRow: HTMLElement;\n #node: Node;\n #view: EditorView;\n #getPos: () => number;\n\n constructor(node: Node, view: EditorView, getPos: () => number) {\n this.#node = node;\n this.#view = view;\n this.#getPos = getPos;\n this.dom = document.createElement('div');\n this.dom.className = 'aee-table-wrap';\n // The gutter belongs to the wrapper (editorial space); the box inside it\n // is the block's own area, and every piece of geometry measures against\n // that — so the gutter can change without moving a single number.\n this.#box = this.dom.appendChild(document.createElement('div'));\n this.#box.className = 'aee-table-box';\n this.#table = this.#box.appendChild(document.createElement('table'));\n this.#table.setAttribute(\n 'style',\n tableStyle(node.attrs['width'] as number, node.attrs['offset'] as number),\n );\n this.#table.setAttribute('role', 'presentation');\n this.#colgroup = this.#table.appendChild(document.createElement('colgroup'));\n this.contentDOM = this.#table.appendChild(document.createElement('tbody'));\n this.#lines = this.#box.appendChild(document.createElement('div'));\n this.#lines.className = 'aee-col-lines';\n this.#lines.contentEditable = 'false';\n this.#lines.setAttribute('aria-hidden', 'true');\n // The boundary lines get their own container: the render pass trims it to\n // exactly one child per boundary, which would otherwise delete the edge\n // handles and the add zone that share this layer.\n this.#boundaries = this.#lines.appendChild(document.createElement('div'));\n this.#boundaries.className = 'aee-col-boundaries';\n // The table's own resize handles, one per outer edge. Wrapper-relative,\n // so their `left`s *are* the model's offset and offset + width — numbers\n // straight from the document, no measurement.\n const edge = (side: 'left' | 'right') => {\n // Inside the lines layer, which CSS insets to the wrapper's *content*\n // box — so every percentage below is a share of the table's own area,\n // gutter or no gutter.\n const el = this.#lines.appendChild(document.createElement('div'));\n el.className = 'aee-col-line aee-col-line--edge';\n el.contentEditable = 'false';\n el.setAttribute('aria-hidden', 'true');\n el.addEventListener('pointerdown', (event) => this.#startEdgeDrag(side, event));\n return el;\n };\n this.#edges = { left: edge('left'), right: edge('right') };\n // The `+` pills: one on the right flank (append a column), one under the\n // bottom edge (append a row). Compact, not Tiptap's full-length strips,\n // so the edge-drag handle keeps the rest of the edge to itself.\n const pill = (className: string, label: string, command: (pos: number) => Command) => {\n const el = this.dom.appendChild(document.createElement('div'));\n el.className = `aee-add-pill ${className}`;\n el.textContent = '+';\n el.contentEditable = 'false';\n el.setAttribute('role', 'button');\n el.setAttribute('aria-hidden', 'true');\n el.setAttribute('title', label);\n // preventDefault keeps the caret where it is; the command runs on click.\n el.addEventListener('mousedown', (event) => event.preventDefault());\n el.addEventListener('click', () => {\n command(this.#getPos())(this.#view.state, this.#view.dispatch);\n });\n return el;\n };\n this.#addColumn = pill('aee-add-pill--column', 'Add column', addColumnAtEnd);\n // The sensor zone — one contiguous strip from the table's right edge out\n // to the pill (the YouTube-gesture-layer idea): hovering anywhere along\n // it reveals the pill, so the pointer never crosses dead space on its way\n // over. It covers only non-editable ground, which is why it can stay\n // hit-testable at all times; clicks on the zone itself do nothing — only\n // the pill acts.\n this.#addColumnZone = this.#lines.appendChild(document.createElement('div'));\n this.#addColumnZone.className = 'aee-add-zone aee-add-zone--column';\n this.#addColumnZone.contentEditable = 'false';\n this.#addColumnZone.setAttribute('aria-hidden', 'true');\n this.#addColumnZone.appendChild(this.#addColumn);\n // The row twin lives on the box, not the wrapper: its `left` / `width`\n // are then the same table-relative percentages the column zone and the\n // edge handles already speak, and a right-edge drag can restamp them\n // on release without measuring. It hangs into the wrapper's bottom\n // gutter (`top: 100%`), so approaching from below still wakes the\n // pill and nothing editable is covered.\n this.#addRowZone = this.#box.appendChild(document.createElement('div'));\n this.#addRowZone.className = 'aee-add-zone aee-add-zone--row';\n this.#addRowZone.contentEditable = 'false';\n this.#addRowZone.setAttribute('aria-hidden', 'true');\n this.#addRow = pill('aee-add-pill--row', 'Add row', addRowAtEnd);\n this.#addRowZone.appendChild(this.#addRow);\n // Column-grip hover is a data attribute on this wrap, not 24 `:has()`\n // rules walking the grid on every pointer move — same reveal, none of\n // the style-recalc tax those selectors levy on a hovered table.\n this.dom.addEventListener('pointerover', (event) => this.#hoverColumn(event));\n this.dom.addEventListener('pointerleave', () => this.#clearHoverColumn());\n this.#render(node);\n }\n\n update(node: Node): boolean {\n if (node.type.name !== 'table') return false;\n // Typing in a cell produces a new table node. The chrome (widths, lines,\n // edges) has not moved, and rewriting it every keystroke is what makes a\n // table feel like it is flying apart — Tiptap's TableView skips this\n // path for the same reason. Persistent node identity makes the compare\n // a handful of pointer checks on the rows that did not change.\n if (!sameTableChrome(this.#node, node) || node.attrs['html'] !== this.#node.attrs['html']) {\n this.#render(node);\n }\n this.#node = node;\n return true;\n }\n\n ignoreMutation(record: ViewMutationRecord): boolean {\n // The wrapper, the table element, the colgroup and the lines layer are\n // ours; ProseMirror owns only what happens inside the tbody.\n const target = record.target;\n return (\n target !== this.contentDOM && !this.contentDOM.contains(target) && this.dom.contains(target)\n );\n }\n\n #hoverColumn(event: PointerEvent): void {\n const target = event.target;\n if (!(target instanceof Element)) return;\n // A row grip lives inside that row's first cell. Reading `data-col`\n // off that cell would light column 0's grip for a pointer that is\n // only asking for the row. Clear instead, so only the row handle\n // shows; a later cell hover writes the column back.\n if (target.closest('.aee-grip--row')) {\n this.#clearHoverColumn();\n return;\n }\n const col = target.closest('td')?.getAttribute('data-col') ?? '';\n if (this.dom.dataset['hoverCol'] === col) return;\n if (col) this.dom.dataset['hoverCol'] = col;\n else delete this.dom.dataset['hoverCol'];\n }\n\n #clearHoverColumn(): void {\n delete this.dom.dataset['hoverCol'];\n }\n\n #render(node: Node): void {\n const declared = columnWidths(node);\n const effective = effectiveWidths(node);\n const map = TableMap.get(node);\n const tableWidth = node.attrs['width'] as number;\n const offset = node.attrs['offset'] as number;\n\n // The table's box and everything positioned against it. The lines layer\n // is CSS-inset to the wrapper's content box (inside the editor-only\n // gutter), so a child's `left` percentage is a share of the table's own\n // area — table-relative shares are converted once, here.\n this.#table.setAttribute('style', tableStyle(tableWidth, offset));\n // An authored table (a template's, parsed in the `email` mode) shows its\n // own attributes, as the email does — see authored.ts.\n applyAuthoredAttributes(this.#table, node, 0);\n applyAuthoredAttributes(this.contentDOM, node, 1);\n // The hook for drawing it without the composer's table chrome.\n this.dom.classList.toggle('aee-table-wrap--authored', !!node.attrs['html']);\n this.#edges.left.style.left = `${offset}%`;\n this.#edges.right.style.left = `${offset + tableWidth}%`;\n // At the container's own edges the *grab strip* tucks fully inside — a\n // 9px strip hanging half out is phantom overflow (a scrollbar with\n // nothing visibly overflowing), and it would reach into the flank where\n // the row affordances live. Anywhere else the strip straddles its edge.\n // The class says which, because the line drawn inside the strip has to\n // know: a tucked strip's line sits at the tucked side, on the table's\n // edge, not in the middle of the strip 4.5px inside it (styles.scss).\n this.#edges.left.classList.toggle('aee-col-line--tuck-start', offset === 0);\n this.#edges.right.classList.toggle('aee-col-line--tuck-end', offset + tableWidth >= 100);\n this.#placeAddOns(offset, tableWidth);\n\n // The display colgroup: declared widths verbatim, the rest left to the\n // browser — the same input the email gives a mail client.\n resizeChildren(this.#colgroup, declared.length, 'col');\n declared.forEach((width, index) => {\n const col = this.#colgroup.children[index] as HTMLElement;\n if (width != null) col.style.width = formatPct(width);\n else col.style.removeProperty('width');\n });\n\n // One line per interior boundary, placed at the cumulative share — the\n // document says where the boundary is, so no measurement, ever. Elements\n // are reused so a mid-drag re-render can't orphan the drag.\n resizeChildren(this.#boundaries, Math.max(declared.length - 1, 0), 'div', (line) => {\n line.className = 'aee-col-line';\n line.addEventListener('pointerdown', (event) => this.#startDrag(line, event));\n });\n let cumulative = 0;\n for (let boundary = 0; boundary < declared.length - 1; boundary++) {\n cumulative += effective[boundary];\n const line = this.#boundaries.children[boundary] as HTMLElement;\n line.style.left = `${this.#toBoxPct(cumulative)}%`;\n line.style.display = isDraggable(map, boundary) ? '' : 'none';\n }\n }\n\n /** The add-on zones: column strip starts on the table's right edge, row\n strip is the table's own width under it. Model percentages, same\n language as the edge handles — a right-edge drag restamps both. */\n #placeAddOns(offset: number, width: number): void {\n this.#addColumnZone.style.left = `${offset + width}%`;\n this.#addRowZone.style.left = `${offset}%`;\n this.#addRowZone.style.width = `${width}%`;\n }\n\n /** A share of the *table* (what the model speaks) as a share of the\n wrapper's content box (what the lines layer measures against). */\n #toBoxPct(tablePct: number): number {\n const width = this.#node.attrs['width'] as number;\n const offset = this.#node.attrs['offset'] as number;\n return offset + (tablePct * width) / 100;\n }\n\n /** The block's own area — the box inside the editorial gutter, which is\n what every percentage here is a share of. */\n #contentBox(): { left: number; width: number } {\n const rect = this.#box.getBoundingClientRect();\n return { left: rect.left, width: rect.width };\n }\n\n #startDrag(line: HTMLElement, event: PointerEvent): void {\n // Keeps the caret where it is and stops ProseMirror starting a selection.\n event.preventDefault();\n const boundary = Array.prototype.indexOf.call(this.#boundaries.children, line);\n const tableWidth = this.#table.getBoundingClientRect().width;\n if (boundary < 0 || !tableWidth) return;\n\n const effective = effectiveWidths(this.#node);\n const pair = effective[boundary] + effective[boundary + 1];\n if (pair < MIN_COLUMN_PCT * 2) return;\n const startX = event.clientX;\n const startLeft = effective.slice(0, boundary + 1).reduce((sum, width) => sum + width, 0);\n\n const leftAt = (ev: PointerEvent) =>\n clamp(\n effective[boundary] + ((ev.clientX - startX) / tableWidth) * 100,\n MIN_COLUMN_PCT,\n pair - MIN_COLUMN_PCT,\n );\n\n // Deferred commit: mid-drag ONLY the guide line moves, at full float\n // precision. The table itself must not reflow per pointermove — its text\n // rewrapping every frame reads as the grid flying apart (tried, reverted).\n // A bonus of the still table: `tableWidth`, measured once above, stays\n // exact for the whole drag.\n const preview = (ev: PointerEvent) => {\n line.style.left = `${this.#toBoxPct(startLeft - effective[boundary] + leftAt(ev))}%`;\n };\n const finish = (ev: PointerEvent) => {\n document.body.style.cursor = bodyCursor;\n setColumnBoundary(\n this.#getPos(),\n boundary,\n leftAt(ev),\n )(this.#view.state, this.#view.dispatch);\n // Chrome stays hidden until the commit has restamped it — otherwise\n // the pills flash one frame at the pre-drag box.\n line.classList.remove('aee-col-line--drag');\n this.dom.classList.remove('aee-table-wrap--resizing');\n };\n\n line.classList.add('aee-col-line--drag');\n // Pin the grid for the drag's lifetime. The guides are hover-revealed, and\n // mid-drag the pointer wanders off the wrapper — without this the walls\n // fade in and out under the moving line, which reads as dragging one\n // object while a different one trails behind.\n this.dom.classList.add('aee-table-wrap--resizing');\n // Same reasoning for the cursor: off the 9px strip it would flip back to\n // a text caret mid-drag. It stays col-resize until release.\n const bodyCursor = document.body.style.cursor;\n document.body.style.cursor = 'col-resize';\n // Window-level, animation-frame coalesced: the pointer can move faster\n // than a frame (and faster than layout follows), and a handle-bound\n // listener would lose the stream and stutter. `window` never loses it;\n // rAF writes the line at most once per frame, the way Notion and Tiptap\n // keep a drag on the compositor.\n trackPointer(preview, finish);\n }\n\n /** The table's own resize: drag either outer edge, same deferred-commit\n and pinning discipline as a boundary drag — only the edge line moves,\n and release applies one transaction. The left edge moves the offset\n (the right edge stays put); the right edge moves the width. */\n #startEdgeDrag(side: 'left' | 'right', event: PointerEvent): void {\n event.preventDefault();\n const { left: wrapperLeft, width: wrapperWidth } = this.#contentBox();\n if (!wrapperWidth) return;\n\n const handle = this.#edges[side];\n const offset = this.#node.attrs['offset'] as number;\n const oldWidth = this.#node.attrs['width'] as number;\n const right = offset + oldWidth;\n\n // The drag can't shrink the table past the point where the absorbing\n // column (the one beside the dragged edge) hits the column floor — the\n // same bound the commit enforces, so the preview line never over-promises.\n const map = TableMap.get(this.#node);\n const effective = effectiveWidths(this.#node);\n const others = map.width > 1 ? 100 - effective[side === 'left' ? 0 : map.width - 1] : 0;\n const minWidth = minTableWidth(oldWidth, others);\n\n const pctAt = (ev: PointerEvent) => ((ev.clientX - wrapperLeft) / wrapperWidth) * 100;\n const edgeAt = (ev: PointerEvent) =>\n side === 'left'\n ? clamp(pctAt(ev), 0, right - minWidth)\n : clamp(pctAt(ev), offset + minWidth, 100);\n\n const preview = (ev: PointerEvent) => {\n const edge = edgeAt(ev);\n handle.style.left = `${edge}%`;\n // The column `+` rides the moving edge so it is already at the new\n // flank when the drag ends. The row `+` waits for release: resizing\n // it every frame would be a live reflow of a strip we then hide.\n if (side === 'right') this.#addColumnZone.style.left = `${edge}%`;\n };\n const finish = (ev: PointerEvent) => {\n document.body.style.cursor = bodyCursor;\n const edge = edgeAt(ev);\n const box: [number, number] =\n side === 'left' ? [edge, right - edge] : [offset, edge - offset];\n setTableBox(\n this.#getPos(),\n ...box,\n side === 'left' ? 'first' : 'last',\n )(this.#view.state, this.#view.dispatch);\n // Commit restamps the handles *and* both add-ons onto the model.\n // The row `+` picks up the new width here, once, on release. If the\n // commit was a no-op (clamped to the same values), this snaps the\n // previewed column zone back too.\n this.#render(this.#node);\n handle.classList.remove('aee-col-line--drag');\n this.dom.classList.remove('aee-table-wrap--resizing');\n };\n\n handle.classList.add('aee-col-line--drag');\n this.dom.classList.add('aee-table-wrap--resizing');\n const bodyCursor = document.body.style.cursor;\n document.body.style.cursor = 'col-resize';\n trackPointer(preview, finish);\n }\n}\n\n/** Whether the table chrome (box, column widths, grid) is the same — the\n question `TableView.update` asks before it touches the DOM. Unchanged\n rows are the same object (ProseMirror's persistent tree), so a keystroke\n is one new cell and a handful of identity compares. */\nfunction sameTableChrome(a: Node, b: Node): boolean {\n if (a.attrs['width'] !== b.attrs['width'] || a.attrs['offset'] !== b.attrs['offset']) {\n return false;\n }\n if (a.childCount !== b.childCount) return false;\n for (let row = 0; row < a.childCount; row++) {\n const left = a.child(row);\n const right = b.child(row);\n if (left === right) continue;\n if (left.childCount !== right.childCount) return false;\n for (let column = 0; column < left.childCount; column++) {\n const from = left.child(column);\n const to = right.child(column);\n if (from === to) continue;\n if (from.attrs['colspan'] !== to.attrs['colspan']) return false;\n if (from.attrs['rowspan'] !== to.attrs['rowspan']) return false;\n if (\n !sameWidthList(\n from.attrs['colwidth'] as number[] | null,\n to.attrs['colwidth'] as number[] | null,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\nfunction sameWidthList(a: number[] | null, b: number[] | null): boolean {\n if (a === b) return true;\n if (!a || !b || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\n return true;\n}\n\n/** Window-level pointer tracking for the life of a drag: move is coalesced\n to animation frames so a 120 Hz stream cannot write the line more than\n once per paint; up/cancel apply the last event immediately. */\nfunction trackPointer(\n preview: (event: PointerEvent) => void,\n finish: (event: PointerEvent) => void,\n): void {\n let frame = 0;\n let last: PointerEvent | null = null;\n const onMove = (event: PointerEvent) => {\n last = event;\n if (frame) return;\n frame = requestAnimationFrame(() => {\n frame = 0;\n if (last) preview(last);\n });\n };\n const onUp = (event: PointerEvent) => {\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n window.removeEventListener('pointercancel', onUp);\n if (frame) cancelAnimationFrame(frame);\n finish(event);\n };\n window.addEventListener('pointermove', onMove, { passive: true });\n window.addEventListener('pointerup', onUp);\n window.addEventListener('pointercancel', onUp);\n}\n\n/** Grows or shrinks `parent` to exactly `count` children of `tag`, reusing\n the ones that exist. `init` runs once per newly created element. */\nfunction resizeChildren(\n parent: HTMLElement,\n count: number,\n tag: string,\n init?: (el: HTMLElement) => void,\n): void {\n while (parent.children.length > count) parent.lastElementChild!.remove();\n while (parent.children.length < count) {\n const el = parent.appendChild(document.createElement(tag));\n init?.(el);\n }\n}\n","import { applyAuthoredAttributes } from '../authored';\nimport { Plugin, PluginKey } from 'prosemirror-state';\nimport { Node } from 'prosemirror-model';\nimport { EditorView, ViewMutationRecord } from 'prosemirror-view';\nimport { defineExtension } from '../extension';\nimport { MIN_COLUMN_CAP, columnCaps, containerStyle, setColumnsBoundary } from './nodes/columns';\n\n/**\n * Boundary drag for the `/columns` layout block — the table drag's twin, with\n * the layout model underneath (see ROADMAP, \"Columns and tables — decided\").\n *\n * Same vocabulary: full-height primary lines on every boundary, hover to\n * reveal, deferred commit (only the line moves, one transaction on release,\n * one undo step), window-level listeners so the pointer can't outrun the\n * handle, guides pinned for the drag's lifetime.\n *\n * Different model: a table splits 100% of itself; columns redistribute the\n * email's px *budget* — the `max-width` caps that make the block fluid\n * (side by side where the caps fit, stacked on a phone). The drag moves px\n * between two neighbouring caps and conserves their sum, so the block's\n * stacking behaviour never changes, only the split.\n *\n * Geometry, as always, from the model: the NodeView's *box* carries the\n * container style (the email's centred 600px box), so a boundary's `left` is\n * simply the sum of the caps before it, in px. And \"stacked\" — the one state\n * where a horizontal drag means nothing — is a CSS container query on that\n * same box: the caps sum to a constant budget, so the block stacks at a\n * constant width, and the lines hide themselves. No measurement, no\n * observer.\n */\nexport const ColumnsResize = defineExtension({\n name: 'columnsResize',\n plugins: () => [\n new Plugin({\n key: new PluginKey('columnsResize'),\n props: {\n nodeViews: {\n columns: (node, view, getPos) => new ColumnsView(node, view, getPos as () => number),\n },\n },\n }),\n ],\n});\n\nconst clamp = (n: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, n));\n\n/**\n * `div.aee-columns-wrap (editorial gutter) > div.aee-columns-box (the email's\n * container style) > div.aee-columns (contentDOM) + div.aee-col-lines`.\n *\n * The split matters: the gutter is editor-only room for the block's\n * affordances, while the box is the email's 600px centred container. Putting\n * both on one element would let editorial padding shrink the width the\n * columns lay out in — and since they stack at a constant budget, the editor\n * would start stacking at a pane width where the recipient still sees them\n * side by side. Separated, the gutter costs the layout nothing. The lines\n * layer sits inside the box, so its coordinates are the columns' own. The\n * schema's `toDOM` (clipboard) and `emitDOM` (email) are untouched.\n */\nclass ColumnsView {\n dom: HTMLElement;\n contentDOM: HTMLElement;\n #box: HTMLElement;\n #lines: HTMLElement;\n #node: Node;\n #view: EditorView;\n #getPos: () => number;\n\n constructor(node: Node, view: EditorView, getPos: () => number) {\n this.#node = node;\n this.#view = view;\n this.#getPos = getPos;\n this.dom = document.createElement('div');\n this.dom.className = 'aee-columns-wrap';\n // Two roles, two elements — the reason this block needed restructuring.\n // The wrapper carries the *editorial* gutter (affordance room, no effect\n // on the email); the box inside it carries the *email's* container style,\n // so padding can never narrow the 600px the columns actually lay out in.\n this.#box = this.dom.appendChild(document.createElement('div'));\n this.#box.className = 'aee-columns-box';\n this.contentDOM = this.#box.appendChild(document.createElement('div'));\n this.contentDOM.className = 'aee-columns';\n this.contentDOM.setAttribute('style', 'width: 100%;');\n this.#lines = this.#box.appendChild(document.createElement('div'));\n this.#lines.className = 'aee-col-lines';\n this.#lines.contentEditable = 'false';\n this.#lines.setAttribute('aria-hidden', 'true');\n this.#render(node);\n }\n\n update(node: Node): boolean {\n if (node.type.name !== 'columns') return false;\n this.#node = node;\n this.#render(node);\n return true;\n }\n\n ignoreMutation(record: ViewMutationRecord): boolean {\n const target = record.target;\n return (\n target === this.dom ||\n target === this.#box ||\n target === this.#lines ||\n this.#lines.contains(target) ||\n // The contentDOM's own attributes are ours; its children are ProseMirror's.\n (target === this.contentDOM && record.type === 'attributes')\n );\n }\n\n #render(node: Node): void {\n this.#box.setAttribute('style', containerStyle(node.attrs['align']));\n // An authored columns block shows its own attributes (authored.ts).\n applyAuthoredAttributes(this.#box, node, 0);\n\n const caps = columnCaps(node);\n const boundaries = Math.max(caps.length - 1, 0);\n while (this.#lines.children.length > boundaries) this.#lines.lastElementChild!.remove();\n while (this.#lines.children.length < boundaries) {\n const line = this.#lines.appendChild(document.createElement('div'));\n line.className = 'aee-col-line';\n line.addEventListener('pointerdown', (event) => this.#startDrag(line, event));\n }\n let cumulative = 0;\n for (let boundary = 0; boundary < boundaries; boundary++) {\n cumulative += caps[boundary];\n (this.#lines.children[boundary] as HTMLElement).style.left = `${cumulative}px`;\n }\n }\n\n #startDrag(line: HTMLElement, event: PointerEvent): void {\n event.preventDefault();\n const boundary = Array.prototype.indexOf.call(this.#lines.children, line);\n if (boundary < 0) return;\n\n const caps = columnCaps(this.#node);\n const pair = caps[boundary] + caps[boundary + 1];\n if (pair < MIN_COLUMN_CAP * 2) return;\n const startX = event.clientX;\n const startLeft = caps.slice(0, boundary + 1).reduce((sum, cap) => sum + cap, 0);\n\n // px in the editor are px in the email: the box is the 600px container.\n const leftAt = (ev: PointerEvent) =>\n clamp(caps[boundary] + (ev.clientX - startX), MIN_COLUMN_CAP, pair - MIN_COLUMN_CAP);\n\n const preview = (ev: PointerEvent) => {\n line.style.left = `${startLeft - caps[boundary] + leftAt(ev)}px`;\n };\n const finish = (ev: PointerEvent) => {\n window.removeEventListener('pointermove', preview);\n window.removeEventListener('pointerup', finish);\n window.removeEventListener('pointercancel', finish);\n line.classList.remove('aee-col-line--drag');\n this.dom.classList.remove('aee-columns-wrap--resizing');\n document.body.style.cursor = bodyCursor;\n setColumnsBoundary(\n this.#getPos(),\n boundary,\n leftAt(ev),\n )(this.#view.state, this.#view.dispatch);\n this.#render(this.#node);\n };\n\n line.classList.add('aee-col-line--drag');\n this.dom.classList.add('aee-columns-wrap--resizing');\n const bodyCursor = document.body.style.cursor;\n document.body.style.cursor = 'col-resize';\n window.addEventListener('pointermove', preview);\n window.addEventListener('pointerup', finish);\n window.addEventListener('pointercancel', finish);\n }\n}\n","import { NodeSelection, Plugin, PluginKey } from 'prosemirror-state';\nimport { defineExtension } from '../extension';\n\n/**\n * Selected text in contenteditable is natively draggable, which is never\n * wanted in a composer. Node drags (e.g. images) stay allowed.\n */\nexport const NoTextDrag = defineExtension({\n name: 'noTextDrag',\n plugins: () => [\n new Plugin({\n key: new PluginKey('noTextDrag'),\n props: {\n handleDOMEvents: {\n dragstart: (view, event) => {\n if (view.state.selection instanceof NodeSelection) return false;\n event.preventDefault();\n return true;\n },\n },\n },\n }),\n ],\n});\n","import { baseKeymap } from 'prosemirror-commands';\nimport { defineExtension } from '../extension';\n\n/**\n * Enter, Backspace, Delete, select-all, ... Keep this last in the extension\n * list so node/mark specific bindings take precedence.\n */\nexport const BaseKeymap = defineExtension({\n name: 'baseKeymap',\n keymap: () => baseKeymap,\n});\n","import { Plugin, PluginKey } from 'prosemirror-state';\nimport { defineExtension } from '../extension';\nimport { createDOMParser } from '../preserve';\n\n/** Subtrees that are pure noise in pasted markup. `<style>` is the dangerous\n one: ProseMirror descends into unknown elements, so a pasted style block\n would land its CSS as document *text*. */\nconst STRIP_TAGS = new Set(['style', 'script', 'xml', 'meta', 'link', 'title', 'iframe']);\n\n/**\n * Pre-parse cleanup for pasted HTML. Deliberately minimal: the email schema\n * already discards classes, ids, unknown tags and unknown styles on parse —\n * this only removes what would otherwise *leak through* the parse:\n *\n * - `<style>`/`<script>`/… subtrees (their text content would survive),\n * - Word's namespaced tags (`<o:p>`, `<w:sdt>`, `<v:shape>`, …),\n * - Word's fake list glyphs (`<span style=\"mso-list:Ignore\">· </span>`),\n * which would paste literal bullet characters into the text.\n *\n * Everything else — `class` soup, `mso-*` style properties, Google Docs'\n * `<b style=\"font-weight:normal\">` wrapper — dies in the schema parse, where\n * it belongs.\n */\nexport function sanitizePastedHTML(html: string): string {\n const body = new DOMParser().parseFromString(html, 'text/html').body;\n\n for (const element of Array.from(body.querySelectorAll('*'))) {\n const tag = element.tagName.toLowerCase();\n if (STRIP_TAGS.has(tag) || tag.includes(':')) {\n element.remove();\n continue;\n }\n const style = element.getAttribute('style');\n if (style && /mso-list\\s*:\\s*ignore/i.test(style)) {\n element.remove();\n }\n }\n\n return body.innerHTML;\n}\n\n/** Cleans clipboard HTML before it reaches the schema parse — and parses it\n in `repair` mode: the source pane may be law, the clipboard never is.\n Pasted class soup, foreign tables and Word's markup are still repaired\n into canonical form, exactly as before the preserving parse existed. */\nexport const PasteHygiene = defineExtension({\n name: 'pasteHygiene',\n plugins: ({ schema }) => [\n new Plugin({\n key: new PluginKey('pasteHygiene'),\n props: {\n transformPastedHTML: sanitizePastedHTML,\n clipboardParser: createDOMParser(schema, 'repair'),\n },\n }),\n ],\n});\n","import { Command } from 'prosemirror-state';\nimport { defineExtension } from '../extension';\n\n/** Strips every mark from the selection — Gmail's \"remove formatting\". Block\n structure (lists, quotes, alignment) is layout, not formatting: it stays. */\nconst clearFormatting: Command = (state, dispatch) => {\n const { from, to, empty } = state.selection;\n if (empty) return false;\n\n if (dispatch) {\n let tr = state.tr;\n for (const type of Object.values(state.schema.marks)) {\n tr = tr.removeMark(from, to, type);\n }\n dispatch(tr.setStoredMarks([]).scrollIntoView());\n }\n return true;\n};\n\nexport const ClearFormatting = defineExtension({\n name: 'clearFormatting',\n commands: () => ({ clearFormatting: () => clearFormatting }),\n actions: () => [\n {\n id: 'clear-formatting',\n section: 'styling',\n title: 'Clear formatting',\n keywords: ['clear', 'remove', 'formatting', 'plain'],\n icon: 'format_clear',\n command: clearFormatting,\n // It works on a selection. Said out loud, so a caret's `/` menu — which\n // can never have one — does not offer a row that would do nothing.\n isEnabled: (state) => !state.selection.empty,\n },\n ],\n // Gmail's binding.\n keymap: () => ({ 'Mod-\\\\': clearFormatting }),\n});\n","import { Command, EditorState, TextSelection } from 'prosemirror-state';\nimport { DOMOutputSpec, Node, Schema } from 'prosemirror-model';\nimport { defineNode } from '../../extension';\nimport { emailBackgroundPalette, fillTextColor } from '../../dual-contrast';\nimport { isSafeColor, toEmailSafeColor } from '../marks/text-style';\nimport { parsePadding } from './table';\nimport { holdsBlock, holdsColumn, isPadded } from '../../import-html';\nimport { inlinePadding } from '../../inline-style';\n\n/** How wide a section's content runs: the email's container, centred in\n the band. */\nexport const SECTION_CONTENT_MAX = 600;\n\n/** A band's default breathing room, above and below — MJML's own. */\nexport const SECTION_PADDING = '20px 0px';\n\n/** The content column's inline inset inside the band. */\nexport const SECTION_INSET = 16;\n\n/**\n * A section: a full-width band of the email — a fill running edge to edge\n * across the reader's window with the content centred in the 600px column\n * inside it — the one layout effect a 600px table cannot produce, and what\n * makes a newsletter read as header band, hero, footer rather than one\n * white sheet. MJML's `mj-section`, rendered our way.\n *\n * **Rendered once, for every client.** MJML renders a section twice — a\n * `<div>` for the clients that read `max-width`, and the same content again\n * in a 600px table inside an Outlook-only conditional comment — because\n * Outlook's Word engine ignores `max-width` and `inline-block`. Gmail drops\n * every comment, and its app strips the head for non-Google accounts, so\n * what both keep is what this emits: one `role=\"presentation\"` table,\n * 100% wide, its one cell carrying the fill as `bgcolor` *and* as an\n * inline `background-color` (Outlook reads the attribute, everyone else\n * the style), and inside it a `<div>` capped at 600px with auto margins.\n * Where that div cannot be honoured (Outlook) the content runs the band's\n * full width — the graceful half of the same bargain the columns block\n * strikes. Nothing here needs a stylesheet or a comment.\n *\n * **The fill pairs its text.** A filled band writes an explicit text colour\n * (`fillTextColor`), since the dark modes that flip default text keep the\n * fill; the swatches are the dual-safe background palette, so both survive\n * a forced inversion. `bgcolor` carries the same colour as hex for Outlook.\n *\n * **A background image, for both clients.** A band may carry an image\n * behind its content (MJML's `background-url`): the cell gets it as a\n * `background` attribute *and* as inline `background-image`, centred,\n * covering, not repeating — Gmail and the rest read those — with the fill\n * colour beneath for the clients that hold images back. Outlook's Word\n * engine reads neither, and draws VML: the cell's content is wrapped in a\n * `v:rect` with a `v:fill` of the image, inside `[if mso]` conditional\n * comments that every other client discards. That is the one place the\n * email carries a comment — MJML's translation of the same idea, and the\n * only way to a picture behind text in Outlook; without it the colour\n * shows, which is the fallback anyway. A band without an image emits no\n * comment at all.\n *\n * **On parse** a section is a one-cell presentation table whose cell holds\n * nothing but elements and carries a fill, an image or a padding — a\n * builder's section (MJML's, with the fill on its table or wrapping div,\n * the image as the table's `background` or a `url()` in a style) as much\n * as our own. A one-cell table with words in it is a table, and stays one.\n * Only an `http(s)` image is taken.\n */\nexport const Section = defineNode({\n name: 'section',\n spec: {\n content: 'block+',\n group: 'block',\n defining: true,\n isolating: true,\n attrs: {\n /** The fill, as hex — null for a band with no colour (a spacer). */\n background: { default: null },\n /** The band's padding, as `parsePadding` normalises it. */\n padding: { default: SECTION_PADDING },\n /** An image behind the content — an `http(s)` URL — or null. */\n image: { default: null },\n /** A fill on the content column alone, as hex — a builder's card\n (MJML's section on a coloured page: the page is the band's fill,\n the card this one) — or null for the column bare on the band. */\n contentBackground: { default: null },\n },\n parseDOM: [\n {\n tag: 'table',\n // Ahead of the table node's own rule (50): a band is a table too.\n priority: 60,\n getAttrs: (dom) => sectionAttrs(dom as HTMLTableElement),\n contentElement: (dom) => sectionContent(dom as HTMLTableElement),\n },\n ],\n // The editor's DOM: a band with the inner column — the layout guides'\n // class on it, which the email never sees.\n toDOM: (node) => [\n 'div',\n { class: 'aee-section', style: bandStyle(node.attrs as SectionAttrs) },\n ['div', { class: 'aee-section__inner', style: innerStyle(node.attrs as SectionAttrs) }, 0],\n ],\n emitDOM: (node: { attrs: Record<string, any> }) => emitBand(node.attrs as SectionAttrs),\n },\n commands: ({ schema }) => ({\n insertSection: (background?: string | null): Command => insertSection(schema, background),\n /** Fill the section the cursor is in (or clear it with `null`). */\n setSectionBackground: (color: string | null): Command => setSectionBackground(color),\n /** Put an image behind the section the cursor is in (or take it away\n with `null`) — an `http(s)` URL; anything else is refused. */\n setSectionImage: (url: string | null): Command => setSectionImage(url),\n /** Take the band away, its content staying where it stood. */\n removeSection: (): Command => removeSection,\n }),\n actions: ({ schema }) => [\n {\n id: 'section',\n section: 'layout',\n title: 'Section',\n keywords: ['section', 'band', 'background', 'fill', 'row', 'block'],\n icon: 'view_agenda',\n // A new band shows itself: the palette's quiet grey.\n command: insertSection(schema, DEFAULT_FILL),\n },\n ],\n});\n\nconst DEFAULT_FILL = emailBackgroundPalette.find((color) => color.name === 'Gray')?.value ?? null;\n\ninterface SectionAttrs {\n background: string | null;\n padding: string | null;\n image: string | null;\n contentBackground: string | null;\n}\n\n/** The band's inline style: its padding, its fill with the text colour\n the fill pairs, and the image behind it — centred at the top, covering\n the band, once — for every client that reads CSS backgrounds. */\nconst bandStyle = ({ background, padding, image, contentBackground }: SectionAttrs): string =>\n [\n // A card's padding is the card's (innerStyle), inside its fill.\n padding && !contentBackground ? `padding: ${padding};` : '',\n background ? `background-color: ${background}; color: ${fillTextColor(background)};` : '',\n image\n ? `background-image: url('${image}'); background-position: center top; ` +\n 'background-size: cover; background-repeat: no-repeat;'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n\nconst TABLE_ATTRS = {\n role: 'presentation',\n width: '100%',\n cellpadding: '0',\n cellspacing: '0',\n border: '0',\n style: 'width: 100%; border-collapse: collapse;',\n};\n\n/** The band as sent: one presentation table. With an image, the content is\n wrapped in VML for Outlook — comment nodes, which a DOMOutputSpec cannot\n express, so the table is then built by hand. */\nfunction emitBand(attrs: SectionAttrs): DOMOutputSpec {\n const style = bandStyle(attrs);\n const cellAttrs = {\n ...(attrs.background && { bgcolor: attrs.background }),\n ...(attrs.image && { background: attrs.image }),\n // A bare band (a card on a page with no colour): no empty style.\n ...(style && { style }),\n };\n if (!attrs.image) {\n return [\n 'table',\n TABLE_ATTRS,\n ['tbody', ['tr', ['td', cellAttrs, ['div', { style: innerStyle(attrs) }, 0]]]],\n ];\n }\n // Styles through the CSSOM, as the spec path writes them (`cssText`), so\n // the two paths print the same colours.\n const table = document.createElement('table');\n for (const [name, value] of Object.entries(TABLE_ATTRS)) setAttribute(table, name, value);\n const td = table.createTBody().insertRow().insertCell();\n for (const [name, value] of Object.entries(cellAttrs)) setAttribute(td, name, value);\n const inner = document.createElement('div');\n inner.style.cssText = innerStyle(attrs);\n td.append(document.createComment(vmlOpen(attrs)), inner, document.createComment(VML_CLOSE));\n return { dom: table, contentDOM: inner };\n}\n\nfunction setAttribute(el: HTMLElement, name: string, value: string): void {\n if (name === 'style') el.style.cssText = value;\n else el.setAttribute(name, value);\n}\n\n/** Outlook's own drawing of a picture behind text: a full-width rectangle\n (`mso-width-percent: 1000` is the Word engine's \"as wide as the page\")\n filled with the image, the fill colour as its base, the content in a\n text box that grows with it. */\nconst vmlOpen = ({ image, background }: SectionAttrs): string =>\n '[if mso]><v:rect xmlns:v=\"urn:schemas-microsoft-com:vml\" fill=\"true\" stroke=\"false\" ' +\n 'style=\"mso-width-percent: 1000;\">' +\n `<v:fill type=\"frame\" src=\"${escapeAttribute(image!)}\"${background ? ` color=\"${background}\"` : ''} />` +\n '<v:textbox inset=\"0,0,0,0\" style=\"mso-fit-shape-to-text: true;\"><![endif]';\n\nconst VML_CLOSE = '[if mso]></v:textbox></v:rect><![endif]';\n\nconst escapeAttribute = (value: string): string =>\n value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<');\n\n/** Whether a URL may stand as a band's image: `http(s)` only — never a\n script, a data URL (Gmail shows nothing for it) or a file. */\nexport function isSectionImageUrl(url: string | null): url is string {\n return !!url && /^https?:\\/\\/\\S+$/i.test(url.trim());\n}\n\n/** The section's content column: the container's width, centred, with the\n surface's inline inset inside it so words never touch the band's edge\n on a phone — `box-sizing` keeps the inset inside the cap. Outlook\n ignores padding on a div and shows the content at the band's edge,\n inside the reading pane's own margins: the graceful half. */\nconst innerStyle = ({ contentBackground, padding }: Partial<SectionAttrs> = {}): string => {\n // A card carries the section's padding itself, inside its fill — a\n // builder's card is padded within, and a page-coloured gap above a card\n // is no card. Its inset stays the same, on the same declaration.\n const inset = `${SECTION_INSET}px`;\n const box =\n contentBackground && padding\n ? `padding: ${vertical(padding, 'top')} ${inset} ${vertical(padding, 'bottom')} ${inset};`\n : `padding-left: ${inset}; padding-right: ${inset};`;\n return (\n `max-width: ${SECTION_CONTENT_MAX}px; margin-left: auto; margin-right: auto; ` +\n `${box} box-sizing: border-box;` +\n (contentBackground\n ? ` background-color: ${contentBackground}; color: ${fillTextColor(contentBackground)};`\n : '')\n );\n};\n\n/** One vertical side of a padding shorthand, as the CSSOM reads it. */\nfunction vertical(padding: string, side: 'top' | 'bottom'): string {\n const probe = document.createElement('div');\n probe.style.padding = padding;\n return (side === 'top' ? probe.style.paddingTop : probe.style.paddingBottom) || '0px';\n}\n\n/** A section's attrs off a table — or false for a table that is a table. */\nfunction sectionAttrs(table: HTMLTableElement): Record<string, unknown> | false {\n if (table.getAttribute('role') !== 'presentation') return false;\n if (table.rows.length !== 1 || table.rows[0].cells.length !== 1) return false;\n const cell = table.rows[0].cells[0];\n const hasWords = Array.from(cell.childNodes).some(\n (node) => node.nodeType === 3 /* text */ && !!node.textContent?.trim(),\n );\n if (hasWords) return false;\n // A band holds blocks; a filled cell round one anchor is a button's box.\n if (!holdsBlock(cell)) return false;\n const parent = table.parentElement;\n const card = parent instanceof HTMLElement && parent.tagName === 'DIV' && capped(parent);\n // Where a fill sits says what it fills. On the cell: the band (ours). On\n // the table, or the div wrapping it: the band too — unless that div is a\n // card, capped at a width (MJML's section on a page): then the card's\n // content column, and the band is the page's colour, where the page has\n // one. On the centring div inside (our own form): the content column.\n const onCell = declaredBackground(cell) || cell.getAttribute('bgcolor') || '';\n const onFrame =\n declaredBackground(table) ||\n table.getAttribute('bgcolor') ||\n (parent instanceof HTMLElement && parent.tagName === 'DIV' ? declaredBackground(parent) : '') ||\n '';\n const content = sectionContent(table);\n const onContent = content !== cell ? declaredBackground(content) : '';\n const hex = (raw: string) => (raw && isSafeColor(raw) ? toEmailSafeColor(raw) : null);\n const page = card || !onCell ? hex(pageBackground(table)) : null;\n const background = hex(onCell) ?? (card ? page : (hex(onFrame) ?? page));\n const contentBackground = hex(onContent) ?? (card ? hex(onFrame) : null);\n // The cell's padding — or, for a card of ours, the card's own vertical\n // padding (its inset sides are the column's, not a padding to keep).\n const padding = parsePadding(cell) ?? (content !== cell ? cardPadding(content) : null);\n const image = declaredImage(table, cell, parent);\n // A padding alone makes a band only round a column: a builder's text\n // block sits in a padded cell too, and is a block, not a section.\n if (!background && !contentBackground && !image && !(isPadded(cell) && holdsColumn(cell))) {\n return false;\n }\n return { background, contentBackground, padding: padding ?? SECTION_PADDING, image };\n}\n\n/** The vertical padding a card's centring div carries, as a section\n padding (`top 0px bottom 0px`, normalised) — null where it says none.\n A zero it says is a padding too: a card written with `0px` above and\n below must read back as one, not as the default band's 20px. */\nfunction cardPadding(div: HTMLElement): string | null {\n // Off the attribute's own text, never the CSSOM's reading (see\n // `inlinePadding`); a side-only padding (`padding-left`/`-right`, our\n // own inset) says nothing about the top or the bottom.\n const sides = inlinePadding(div);\n if (!sides) return null;\n if (!/(?:^|;)\\s*padding(?:-top|-bottom)?\\s*:/i.test(div.getAttribute('style') ?? '')) {\n return null;\n }\n const top = sides[0] === '0' ? '0px' : sides[0];\n const bottom = sides[2] === '0' ? '0px' : sides[2];\n const probe = document.createElement('div');\n probe.style.padding = `${top} 0px ${bottom} 0px`;\n return parsePadding(probe);\n}\n\n/** Whether an element declares a `max-width` — the CSSOM's reading, else\n the attribute's own words (an engine that trips on a `background`\n shorthand before it drops the rest). */\nfunction capped(el: HTMLElement): boolean {\n return !!el.style?.maxWidth || /(?:^|;)\\s*max-width\\s*:/i.test(el.getAttribute('style') ?? '');\n}\n\n/** The colour of the page an email sits on — the body's, or the outermost\n wrapping div's that is not capped at a width (MJML's `role=\"article\"`\n wrapper) — what shows round and between a builder's cards. */\nfunction pageBackground(table: HTMLTableElement): string {\n const body = table.ownerDocument.body;\n const onBody = body ? declaredBackground(body) || body.getAttribute('bgcolor') || '' : '';\n if (onBody) return onBody;\n let found = '';\n for (let el = table.parentElement; el && el !== body; el = el.parentElement) {\n if (el.tagName !== 'DIV' || capped(el as HTMLElement)) continue;\n const fill = declaredBackground(el);\n if (fill) found = fill;\n }\n return found;\n}\n\n/** The image a builder's section carries: the table's `background`\n attribute (ours, MJML's), else a `url()` in the cell's, the table's or\n the wrapping div's `background-image` or `background` — the first\n that is an `http(s)` URL. */\nfunction declaredImage(\n table: HTMLTableElement,\n cell: HTMLTableCellElement,\n parent: Element | null,\n): string | null {\n const candidates = [table.getAttribute('background'), cell.getAttribute('background')];\n for (const el of [\n cell,\n table,\n parent instanceof HTMLElement && parent.tagName === 'DIV' ? parent : null,\n ]) {\n if (!el) continue;\n const style = el.getAttribute('style') ?? '';\n const m = /(?:^|;)\\s*background(?:-image)?\\s*:[^;]*?url\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/i.exec(\n style,\n );\n candidates.push(m?.[2] ?? null);\n }\n const image = candidates.map((url) => url?.trim() ?? null).find(isSectionImageUrl);\n return image ?? null;\n}\n\n/** The background an element declares inline — the CSSOM's reading, else\n the attribute's own words (`background: #fff` as a builder writes it,\n which not every engine expands). */\nexport function declaredBackground(el: Element): string {\n const cssom = (el as HTMLElement).style?.backgroundColor;\n // A `background: url(…)` shorthand leaves the CSSOM's colour transparent\n // — `rgba(0, 0, 0, 0)`, or `initial` — which is no fill, not black.\n if (cssom && /^(rgba\\([^)]*,\\s*0\\)|initial|transparent|inherit|unset)$/i.test(cssom)) return '';\n if (cssom) return cssom;\n const style = el.getAttribute('style') ?? '';\n const m = /(?:^|;)\\s*background(?:-color)?\\s*:\\s*([^;]+)/i.exec(style);\n const value = m?.[1].trim() ?? '';\n return isSafeColor(value) ? value : '';\n}\n\n/** Where a section's content is: the centring div when the cell holds one\n (our own form), else the cell itself (a builder's). */\nfunction sectionContent(table: HTMLTableElement): HTMLElement {\n const cell = table.rows[0].cells[0];\n // A cell written right-to-left (MJML's way to put an image on the right)\n // hands its children over in reverse — the order a client draws them in.\n if (cell.style?.direction === 'rtl') {\n for (const child of Array.from(cell.childNodes).reverse()) cell.appendChild(child);\n cell.style.direction = '';\n }\n const only = cell.children.length === 1 ? cell.children[0] : null;\n if (!(only instanceof HTMLElement) || only.tagName !== 'DIV') return cell;\n const centred =\n !!only.style?.maxWidth &&\n only.style?.marginLeft === 'auto' &&\n !/inline-block/i.test(only.style?.display ?? '');\n return centred ? only : cell;\n}\n\n/** The section around the cursor, innermost. */\nexport function findSectionContext(state: EditorState): { pos: number; node: Node } | null {\n const { $from } = state.selection;\n for (let d = $from.depth; d > 0; d--) {\n if ($from.node(d).type.name === 'section') {\n return { pos: $from.before(d), node: $from.node(d) };\n }\n }\n return null;\n}\n\n/** Inserts a band at the selection and drops the cursor into it. */\nfunction insertSection(schema: Schema, background: string | null = null): Command {\n return (state, dispatch) => {\n if (!dispatch) return true;\n const type = schema.nodes['section'];\n const node = type.createAndFill({ background })!;\n const from = state.selection.from;\n const tr = state.tr.replaceSelectionWith(node);\n let pos = -1;\n tr.doc.descendants((n, p) => {\n if (pos !== -1) return false;\n if (n.type.name === 'section' && p >= from - 1) pos = p;\n return pos === -1;\n });\n // section(pos) → first block(+1) → inline start(+1)\n if (pos >= 0) tr.setSelection(TextSelection.create(tr.doc, pos + 2));\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n\n/** Sets (or clears) the fill of the section the cursor is in. */\nexport function setSectionBackground(color: string | null): Command {\n return (state, dispatch) => {\n const ctx = findSectionContext(state);\n if (!ctx) return false;\n if (dispatch) {\n const background = color ? toEmailSafeColor(color) : null;\n dispatch(\n state.tr\n .setNodeMarkup(ctx.pos, undefined, { ...ctx.node.attrs, background })\n .scrollIntoView(),\n );\n }\n return true;\n };\n}\n\n/** Puts an image behind (or takes it from) the section the cursor is in.\n A URL that is not `http(s)` is refused: the command answers false. */\nexport function setSectionImage(url: string | null): Command {\n return (state, dispatch) => {\n const ctx = findSectionContext(state);\n if (!ctx) return false;\n const image = url ? url.trim() : null;\n if (image && !isSectionImageUrl(image)) return false;\n if (dispatch) {\n dispatch(\n state.tr.setNodeMarkup(ctx.pos, undefined, { ...ctx.node.attrs, image }).scrollIntoView(),\n );\n }\n return true;\n };\n}\n\n/** Lifts the section's content out, in its place. */\nconst removeSection: Command = (state, dispatch) => {\n const ctx = findSectionContext(state);\n if (!ctx) return false;\n if (dispatch) {\n const { from } = state.selection;\n const tr = state.tr.replaceWith(ctx.pos, ctx.pos + ctx.node.nodeSize, ctx.node.content);\n tr.setSelection(TextSelection.near(tr.doc.resolve(Math.max(1, from - 1))));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n","import { Node } from 'prosemirror-model';\nimport { Plugin, PluginKey } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { defineExtension } from '../extension';\nimport { DocumentEnvelope } from '../envelope';\nimport { AttributePairs } from '../preserve';\n\n/** Editor root class while the document carries an envelope — the host's\n hook for rendering a template like a client would (browser typography\n rather than the composer's), see the example app's styles. */\nexport const DOCUMENT_CLASS = 'aee-document';\n\nlet instances = 0;\n\n/**\n * Applies a preserved document's stylesheets to the editor view, so the\n * visual pane renders an MJML-class template exactly as the preview does:\n * the head's `<style>` blocks (media queries included — that is what makes\n * MJML columns responsive), its `<link rel=\"stylesheet\">`s, and any `<style>`\n * in the body. Everything is wrapped in `@scope (.<this editor>) { … }`, so\n * a template's `table, td { … }` or `p { margin: 13px 0 }` reaches this\n * editor's content and nothing else on the page (`body { … }` rules match\n * nothing inside a scope and simply do not apply). `@import`s are hoisted\n * ahead of the scope block, where CSS requires them. The `<body>`'s own\n * inline style and `bgcolor` land on the editor root, the closest thing the\n * editable view has to a body.\n *\n * Behaviour only: the style element sits beside the editor's DOM and is\n * removed with it. No pixels of its own.\n */\nexport const DocumentStyles = defineExtension({\n name: 'documentStyles',\n plugins: () => {\n const scope = `aee-doc-${++instances}`;\n return [\n new Plugin({\n key: new PluginKey('documentStyles'),\n props: {\n attributes: (state) => rootAttributes(scope, state.doc),\n },\n view: (view) => new DocumentStylesView(view, scope),\n }),\n ];\n },\n});\n\nfunction envelopeOf(doc: Node): DocumentEnvelope | null {\n return (doc.attrs['envelope'] as DocumentEnvelope | null | undefined) ?? null;\n}\n\nfunction rootAttributes(scope: string, doc: Node): Record<string, string> {\n const envelope = envelopeOf(doc);\n const attrs: Record<string, string> = {\n class: envelope ? `${scope} ${DOCUMENT_CLASS}` : scope,\n };\n const style = envelope ? bodyStyle(envelope.body) : '';\n if (style) attrs['style'] = style;\n return attrs;\n}\n\n/** The body's inline style plus its legacy `bgcolor`, as one declaration list. */\nfunction bodyStyle(body: AttributePairs): string {\n const declarations: string[] = [];\n for (const [name, value] of body) {\n if (name === 'style' && value.trim()) declarations.push(value.trim().replace(/;$/, ''));\n if (name === 'bgcolor' && value.trim()) declarations.push(`background-color: ${value.trim()}`);\n }\n return declarations.join('; ');\n}\n\ninterface Sheet {\n css: string;\n media: string | null;\n}\n\n/** Every stylesheet the document carries: head styles and links, body styles. */\nfunction stylesheets(doc: Node): Sheet[] {\n const sheets: Sheet[] = [];\n const envelope = envelopeOf(doc);\n if (envelope?.head) {\n const head = new DOMParser().parseFromString(\n `<!doctype html><html><head>${envelope.head}</head><body></body></html>`,\n 'text/html',\n ).head;\n for (const element of Array.from(head.querySelectorAll('style, link[rel~=\"stylesheet\"]'))) {\n const media = element.getAttribute('media');\n if (element.tagName === 'LINK') {\n const href = element.getAttribute('href');\n if (href) sheets.push({ css: `@import url(\"${href.replace(/\"/g, '%22')}\");`, media });\n } else {\n sheets.push({ css: element.textContent ?? '', media });\n }\n }\n }\n doc.descendants((node) => {\n if (node.type.name !== 'htmlRaw') return true;\n const attrs = node.attrs['attrs'] as AttributePairs;\n const media = attrs.find(([name]) => name === 'media')?.[1] ?? null;\n sheets.push({ css: node.attrs['text'] as string, media });\n return false;\n });\n return sheets;\n}\n\n/** One stylesheet text: hoisted imports, then everything else under `@scope`. */\nexport function scopedDocumentCss(doc: Node, scope: string): string {\n const imports: string[] = [];\n const scoped: string[] = [];\n for (const sheet of stylesheets(doc)) {\n let css = sheet.css;\n // `@import`/`@charset` must precede every other rule of a stylesheet.\n css = css.replace(/@(?:import|charset)\\b[^;]*;/g, (statement) => {\n imports.push(sheet.media ? statement.replace(/;$/, ` ${sheet.media};`) : statement);\n return '';\n });\n if (!css.trim()) continue;\n scoped.push(sheet.media ? `@media ${sheet.media} {\\n${css}\\n}` : css);\n }\n if (!imports.length && !scoped.length) return '';\n return [...imports, `@scope (.${scope}) {`, ...scoped, '}'].join('\\n');\n}\n\nclass DocumentStylesView {\n #element: HTMLStyleElement | null = null;\n #last = '';\n\n constructor(\n view: EditorView,\n private readonly scope: string,\n ) {\n this.update(view);\n }\n\n update(view: EditorView): void {\n const css = scopedDocumentCss(view.state.doc, this.scope);\n if (css === this.#last) return;\n this.#last = css;\n\n if (!css) {\n this.#element?.remove();\n this.#element = null;\n return;\n }\n if (!this.#element) {\n this.#element = view.dom.ownerDocument.createElement('style');\n this.#element.className = 'aee-document-styles';\n view.dom.parentNode?.insertBefore(this.#element, view.dom);\n }\n this.#element.textContent = css;\n }\n\n destroy(): void {\n this.#element?.remove();\n this.#element = null;\n }\n}\n","import { Extension, NodeExtension } from '../extension';\nimport { Document } from './nodes/document';\nimport { Paragraph } from './nodes/paragraph';\nimport { EmailParagraph } from './nodes/email-paragraph';\nimport { CodeLine } from './nodes/code-line';\nimport { Text } from './nodes/text';\nimport { HtmlLanguage } from './html-language';\nimport { CodeLineIndent } from './code-line-indent';\nimport { createSourceMarks } from './html-source-marks';\nimport { HardBreak } from './nodes/hard-break';\nimport { MergeTag } from './nodes/merge-tag';\nimport { Heading } from './nodes/heading';\nimport { Blockquote } from './nodes/blockquote';\nimport { BulletList, ListItem, OrderedList } from './nodes/lists';\nimport { Image } from './nodes/image';\nimport { Divider } from './nodes/divider';\nimport { Button } from './nodes/button';\nimport { InlineAtomSelection } from './inline-atom-selection';\nimport { Table, TableRow, TableCell } from './nodes/table';\nimport { Columns, Column } from './nodes/columns';\nimport { Bold } from './marks/bold';\nimport { Italic } from './marks/italic';\nimport { Underline } from './marks/underline';\nimport { Link } from './marks/link';\nimport { Strike } from './marks/strike';\nimport { TextStyle } from './marks/text-style';\nimport { History } from './history';\nimport { LayoutGuides } from './layout-guides';\nimport { Gapcursor } from './gapcursor';\nimport { ColumnResize } from './column-resize';\nimport { ColumnsResize } from './columns-resize';\nimport { NoTextDrag } from './no-text-drag';\nimport { SplitKeepingMarks } from './split-keeping-marks';\nimport { BaseKeymap } from './base-keymap';\nimport { PasteHygiene } from './paste-hygiene';\nimport { ClearFormatting } from './clear-formatting';\nimport { QuotedHistory } from './quoted-history';\nimport { Section } from './nodes/section';\nimport { DocumentStyles } from './document-styles';\nimport { AuthoredEnter, preserveExtensions } from '../preserve';\n\n/** Everything but the paragraph flavour, which is what the kits swap. */\nconst withParagraph = (paragraph: NodeExtension): Extension[] => [\n Document,\n paragraph,\n Text,\n HardBreak,\n // Personalization tokens (`{{firstName}}`): pills in the editor, raw\n // Handlebars-flavoured text in the email.\n MergeTag,\n Heading,\n Blockquote,\n BulletList,\n OrderedList,\n ListItem,\n Image,\n Divider,\n Button,\n // Images and buttons selected like characters: a drag covers them.\n InlineAtomSelection,\n Table,\n TableRow,\n TableCell,\n Columns,\n Column,\n Section,\n // After the layout blocks on purpose: their own arrow escapes must be\n // reached before gap-cursor claims the arrows (see the extension's docs).\n Gapcursor,\n // Table NodeView (scroll wrapper + display colgroup) and the boundary-drag\n // handles. Percentages only — see the extension's docs.\n ColumnResize,\n // The layout block's twin: same drag vocabulary, px-cap model.\n ColumnsResize,\n Bold,\n Italic,\n Underline,\n Link,\n Strike,\n TextStyle,\n History,\n // One editor-only outline mechanism for every layout block (table, columns).\n LayoutGuides,\n NoTextDrag,\n // Enter in a structural text cell (an MJML `<td>`) breaks the line instead\n // of splitting the cell. Before SplitKeepingMarks, which would split it.\n AuthoredEnter,\n // After lists/blockquote (their Enter wins inside those), before BaseKeymap\n // (whose plain splitBlock this replaces): keeps font/colour across Enter.\n SplitKeepingMarks,\n BaseKeymap,\n PasteHygiene,\n ClearFormatting,\n // The structural family: authored layout markup kept verbatim in the\n // `email` and `preserve` modes (the source pane, `setContent`); inert in\n // `repair` mode (paste, seeds). Last, so the canonical nodes stay the\n // defaults of every group.\n ...preserveExtensions,\n];\n\n/** Semantic HTML output (`<p>` paragraphs) for content rendered in the app. */\nexport const richTextExtensions: Extension[] = withParagraph(Paragraph);\n\n/**\n * Email-safe output: `<div>` lines instead of `<p>` (mail clients render\n * paragraph margins as double spacing) and empty lines as `<div><br></div>`.\n */\nexport const emailExtensions: Extension[] = [\n ...withParagraph(EmailParagraph),\n // A preserved document's head styles, applied to the editor view scoped to\n // this editor only — the visual pane renders a template as the recipient\n // sees it.\n DocumentStyles,\n // Reply-specific (so not in the rich-text kit): the quoted history, kept\n // beside the body and folded behind Gmail's `⋯`. A host in another\n // language swaps it for its own `createQuotedHistory({ labels })`.\n QuotedHistory,\n];\n\n/**\n * The parallel source-editor kit: the document is HTML source text, one\n * `codeLine` per line, with highlighting, linting and formatting instead of\n * rich-text nodes. Developed alongside the email kit on the same extension\n * contract — only the extension set differs.\n */\nexport const htmlSourceExtensions: Extension[] = [\n Document,\n CodeLine,\n Text,\n HtmlLanguage,\n // Each line's indentation on it, for a host's VS Code-style soft wrap.\n CodeLineIndent,\n // The email kit's mark shortcuts (Mod-B, Mod-I, ...) work on the source\n // too, by round-tripping the selection through the email schema itself —\n // toggling is identical on both sides by construction.\n createSourceMarks({ extensions: emailExtensions }),\n History,\n NoTextDrag,\n BaseKeymap,\n];\n","import { Fragment, Node, Schema } from 'prosemirror-model';\nimport {\n AddressRules,\n addressKey,\n defaultAddressRules,\n isMailbox,\n} from '@h-k-dev/angular-email-editor/address';\nimport { createSchema } from './schema';\nimport { ParseOptions, parseHTML, serializeToHTML } from './html';\nimport { withQuoted } from './extensions/quoted-history';\nimport { emailExtensions } from './extensions/kits';\nimport { ruleScope } from './parse-mode';\n\n/**\n * The inbound message a reply or forward is built from. Everything here is\n * caller-supplied **data**: the documents render what becomes content — the\n * reply attribution line, the forwarded-message header block — and\n * {@link replyEnvelope} reads the addressing to propose who the answer goes\n * to. Sending stays the host's.\n *\n * Address fields are header form — mailboxes separated by commas, a name\n * holding a comma quoted: `Jane <jane@x>, \"Miller, Bob\" <bob@x>`.\n */\nexport interface InboundMessage {\n /** The inbound body as HTML. Preferred over `text` when both exist. */\n html?: string;\n /** The `text/plain` part — the content when no HTML part exists. */\n text?: string;\n /** Sender, rendered exactly as given (\"Jane Doe\" or \"Jane <jane@x>\"). */\n from?: string;\n /** Sent date: a `Date` (formatted via `locale`) or a preformatted string. */\n date?: Date | string;\n /** The forward header's Subject line, and what a reply's subject answers. */\n subject?: string;\n /** The forward header's To line, and who a reply-all copies. */\n to?: string;\n /** Who a reply-all copies besides `to`. Never rendered. */\n cc?: string;\n /** Where the sender asked answers to go — a reply goes there instead of\n `from` when it is set. Never rendered. */\n replyTo?: string;\n}\n\nexport interface ComposeSeedOptions {\n /** BCP 47 locale for formatting a `Date`-typed `date`. Default `en-US`.\n A string `date` is always used verbatim — pass one for full control. */\n locale?: string;\n /** The words the seeds write into the document, in the host's language.\n Each one left out stays English. */\n labels?: ComposeSeedLabels;\n}\n\n/**\n * The words a reply or forward writes into the document. Plain text, never\n * markup — the seeds put them into text nodes, so a sender's `<` stays a `<`.\n * A host with translation files maps its keys here once:\n *\n * ```ts\n * labels: {\n * attribution: ({ from, date }) =>\n * from ? translate.instant('REPLY.WROTE', { from, date }) : null,\n * forwarded: translate.instant('FORWARD.HEADER'),\n * from: translate.instant('FORWARD.FROM'),\n * }\n * ```\n */\nexport interface ComposeSeedLabels {\n /** The reply's attribution line, from what is known of the message — the\n sender as given, the date already formatted for `locale`; either may be\n missing. A function, not a pattern, because languages order the two\n differently (\"Am {date} schrieb {from}:\") and each decides what a\n partial line says. Null or empty: no line; the quote stands alone.\n Default: \"On {date}, {from} wrote:\", \"{from} wrote:\", \"On {date}:\". */\n attribution?: (known: { from?: string; date?: string }) => string | null;\n /** The prefix a reply's subject starts with, space included. Default \"Re: \". */\n re?: string;\n /** The prefix a forward's subject starts with, space included. Default \"Fwd: \". */\n fwd?: string;\n /** The forward's opening line. Default \"---------- Forwarded message ---------\". */\n forwarded?: string;\n /** The forward header's field names. Default \"From\", \"Date\", \"Subject\", \"To\". */\n from?: string;\n date?: string;\n subject?: string;\n to?: string;\n}\n\nconst ENGLISH: Required<ComposeSeedLabels> = {\n attribution: ({ from, date }) => {\n if (date && from) return `On ${date}, ${from} wrote:`;\n if (from) return `${from} wrote:`;\n if (date) return `On ${date}:`;\n return null;\n },\n re: 'Re: ',\n fwd: 'Fwd: ',\n forwarded: '---------- Forwarded message ---------',\n from: 'From',\n date: 'Date',\n subject: 'Subject',\n to: 'To',\n};\n\nconst labelsOf = (options?: ComposeSeedOptions): Required<ComposeSeedLabels> => ({\n ...ENGLISH,\n ...options?.labels,\n});\n\n/**\n * The shape modern MIME parsers hand back — postal-mime's `Email`, and\n * anything structurally like it. Accepted **duck-typed** so this library\n * never depends on any parser: parsing `.eml` is a solved problem with a\n * decade of edge-case scar tissue (postal-mime, mailparser), and we don't\n * compete with it. {@link toInboundMessage} is the whole integration.\n */\nexport interface ParsedEmailLike {\n html?: string | null;\n text?: string | null;\n subject?: string | null;\n /** ISO string (postal-mime), `Date`, or any human-readable string. */\n date?: string | Date | null;\n from?: ParsedAddressLike | null;\n to?: ParsedAddressLike[] | null;\n cc?: ParsedAddressLike[] | null;\n replyTo?: ParsedAddressLike[] | null;\n}\n\nexport interface ParsedAddressLike {\n name?: string | null;\n address?: string | null;\n /** A group's members (postal-mime's shape): the group's name is no mailbox. */\n group?: ParsedAddressLike[] | null;\n}\n\n/**\n * Bridges a parser result into the seeds — the only glue an `.eml` import\n * needs, front- or backend-parsed alike:\n *\n * ```ts\n * const parsed = await PostalMime.parse(file); // File is a Blob\n * html.set(importedDocument(toInboundMessage(parsed))); // import it\n * // …or replyDocument(toInboundMessage(parsed)) to answer it.\n * ```\n *\n * Every field is optional and null-tolerant, so a partial parse still seeds\n * a sensible document. A parseable date becomes a `Date` (the seeds format\n * it via Intl with your locale); anything else passes through verbatim.\n */\nexport function toInboundMessage(\n parsed: ParsedEmailLike,\n options: { addressRules?: AddressRules } = {},\n): InboundMessage {\n const rules = options.addressRules ?? defaultAddressRules;\n const formatAddresses = (list: ParsedAddressLike[] | null | undefined) => formatList(list, rules);\n return {\n html: parsed.html ?? undefined,\n text: parsed.text ?? undefined,\n subject: parsed.subject ?? undefined,\n date: normalizeDate(parsed.date),\n from: formatAddress(parsed.from, rules),\n to: formatAddresses(parsed.to),\n cc: formatAddresses(parsed.cc),\n replyTo: formatAddresses(parsed.replyTo),\n };\n}\n\n/** One header-form mailbox — the name quoted when it has to be, so\n `Miller, Bob` stays one mailbox in a list. */\nfunction formatAddress(\n address: ParsedAddressLike | null | undefined,\n rules: AddressRules,\n): string | undefined {\n if (!address) return undefined;\n const name = address.name?.trim();\n const email = address.address?.trim();\n if (email) return rules.format({ name: name || undefined, address: email });\n return name || undefined;\n}\n\n/** A list in header form — a group (RFC 5322 §3.4, as a parser hands it\n over) as its members: the group's name addresses nobody. */\nfunction formatList(\n addresses: ParsedAddressLike[] | null | undefined,\n rules: AddressRules,\n): string | undefined {\n return (\n (addresses ?? [])\n .flatMap((address) => (address.group ? address.group : [address]))\n .map((address) => formatAddress(address, rules))\n .filter(Boolean)\n .join(', ') || undefined\n );\n}\n\nfunction normalizeDate(date: string | Date | null | undefined): Date | string | undefined {\n if (date == null) return undefined;\n if (date instanceof Date) return date;\n const parsed = new Date(date);\n return Number.isNaN(parsed.getTime()) ? date : parsed;\n}\n\n// Reply/forward are document *constructors*: pure (inbound data → canonical\n// HTML), so the host seeds the composer through the one `html` signal it\n// already binds — no component API, no second source of truth. The inbound\n// body parses through the email schema like any paste (one law: full strip,\n// which doubles as sanitization), so foreign markup dies on the way in.\nlet seedSchema: Schema | undefined;\nconst getSchema = () => (seedSchema ??= createSchema(emailExtensions));\n\n/**\n * The quoted history of a reply: the attribution line and the inbound\n * message wrapped in a blockquote — what the editor keeps beside the body\n * (`createEditor({ quoted })`, `QuotedHistory`), so no template, import or\n * source edit ever replaces it.\n *\n * The history **is** the schema's blockquote — deliberately not a dedicated\n * node: our output carries no classes, so it would have no honest parse\n * discriminator against a plain blockquote (Gmail's `class=\"gmail_quote\"`\n * drops on parse like every class). Keeping it beside the body is what\n * tells it apart.\n */\nexport function replyQuote(inbound: InboundMessage, options?: ComposeSeedOptions): string {\n const schema = getSchema();\n return serializeToHTML(schema.nodes['doc'].create(null, replyBlocks(inbound, schema, options)), schema);\n}\n\n/**\n * The reply as one document — an empty line to type on, then\n * {@link replyQuote}'s history *in* the body, where it is ordinary text. For\n * a host without the kept history; with it, seed the body empty and pass\n * `replyQuote` as `quoted`.\n */\nexport function replyDocument(inbound: InboundMessage, options?: ComposeSeedOptions): string {\n const schema = getSchema();\n const blocks = [emptyParagraph(schema), ...replyBlocks(inbound, schema, options)];\n return serializeToHTML(schema.nodes['doc'].create(null, blocks), schema);\n}\n\nfunction replyBlocks(inbound: InboundMessage, schema: Schema, options?: ComposeSeedOptions): Node[] {\n const blocks: Node[] = [];\n const attribution = attributionLine(inbound, options);\n if (attribution) blocks.push(textParagraph(schema, attribution));\n const quoted = inboundBlocks(inbound, schema);\n blocks.push(\n schema.nodes['blockquote'].create(null, quoted.childCount ? quoted : emptyParagraph(schema)),\n );\n return blocks;\n}\n\n/**\n * The history of a forward: the conventional forwarded-message header block\n * (only the lines whose data was supplied), a separating empty line, then\n * the inbound message **unquoted** — a forward passes the message along, it\n * doesn't comment on it. Kept beside the body like {@link replyQuote}.\n */\nexport function forwardQuote(inbound: InboundMessage, options?: ComposeSeedOptions): string {\n const schema = getSchema();\n return serializeToHTML(schema.nodes['doc'].create(null, forwardBlocks(inbound, schema, options)), schema);\n}\n\n/** The forward as one document — an empty line, then {@link forwardQuote}'s\n history in the body. See {@link replyDocument}. */\nexport function forwardDocument(inbound: InboundMessage, options?: ComposeSeedOptions): string {\n const schema = getSchema();\n const blocks = [emptyParagraph(schema), ...forwardBlocks(inbound, schema, options)];\n return serializeToHTML(schema.nodes['doc'].create(null, blocks), schema);\n}\n\nfunction forwardBlocks(inbound: InboundMessage, schema: Schema, options?: ComposeSeedOptions): Node[] {\n const labels = labelsOf(options);\n const blocks: Node[] = [textParagraph(schema, labels.forwarded)];\n const header: Array<[string, string | undefined]> = [\n [labels.from, inbound.from],\n [labels.date, inbound.date === undefined ? undefined : formatDate(inbound.date, options)],\n [labels.subject, inbound.subject],\n [labels.to, inbound.to],\n ];\n for (const [label, value] of header) {\n if (value) blocks.push(textParagraph(schema, `${label}: ${value}`));\n }\n blocks.push(emptyParagraph(schema));\n\n const content = inboundBlocks(inbound, schema);\n content.forEach((node) => blocks.push(node));\n if (!content.childCount) blocks.push(emptyParagraph(schema));\n return blocks;\n}\n\n/**\n * A body with its quoted history under it — the message as it goes out,\n * for a host that holds the two as strings (a preview, its own send). A\n * whole document keeps its head; the history lands at the end of its body.\n */\nexport function withQuotedHistory(html: string, quoted: string | null, options?: ParseOptions): string {\n if (!quoted) return html;\n const schema = getSchema();\n const body = parseHTML(html, schema, { mode: 'email', ...options });\n const doc = withQuoted(body.type.create({ ...body.attrs, quoted }, body.content));\n return serializeToHTML(doc, schema);\n}\n\n/** Who an answer is for: the sender, everyone on the message, or — a\n forward — nobody yet. */\nexport type ReplyKind = 'reply' | 'reply-all' | 'forward';\n\nexport interface ReplyEnvelopeOptions extends ComposeSeedOptions {\n /** The account's own addresses. A reply-all never copies them, and a\n reply to one's own message goes to the people it went to. */\n self?: string | readonly string[];\n /** Who the answer goes to instead of the sender — a CRM's customer, say.\n A reply-all then copies the sender with everyone else. */\n to?: readonly string[];\n /** The address rule to read the headers by — the host's, when it has one\n (the same it provides to the address input). Ours by default. */\n addressRules?: AddressRules;\n}\n\n/** The envelope an answer starts with. Addresses in header form, each\n recipient once — what `[email-address-input]` holds. */\nexport interface ReplyEnvelope {\n to: string[];\n cc: string[];\n subject: string;\n}\n\n/**\n * Who an answer goes to and what it is called — the envelope half of the\n * seed, beside {@link replyDocument} / {@link forwardDocument}'s body. Pure;\n * pass the same options to both:\n *\n * ```ts\n * const seed = { locale, labels, self: account.email };\n * const { to, cc, subject } = replyEnvelope(inbound, 'reply-all', seed);\n * html.set(replyDocument(inbound, seed));\n * ```\n *\n * - A reply goes to `replyTo` when the message names one, else to `from`;\n * answering one's own message, to the people it went to.\n * - A reply-all copies everyone else on the message — sender, To, Cc —\n * never `self`, never who it is already to; one entry per address, under\n * the first name it came with.\n * - A forward addresses nobody yet.\n * - The subject takes `labels.re` / `labels.fwd` once. A prefix of the same\n * family the subject already carries is replaced, in any of the languages\n * below or the host's own (\"AW: Re: RE: x\" → \"Re: x\"), numbered repeats\n * (\"Re[2]:\") included; the other family's stays, so a forwarded reply\n * reads \"Fwd: Re: x\", as every major client writes it.\n */\nexport function replyEnvelope(\n inbound: InboundMessage,\n kind: ReplyKind,\n options: ReplyEnvelopeOptions = {},\n): ReplyEnvelope {\n const labels = labelsOf(options);\n if (kind === 'forward') {\n return { to: [], cc: [], subject: prefixed(inbound.subject, labels.fwd, FORWARD_PREFIXES) };\n }\n\n const rules = options.addressRules ?? defaultAddressRules;\n const key = (address: string) => addressKey(address, rules);\n const list = (...lists: Array<string | undefined>) => mailboxes(rules, lists);\n const own = new Set([options.self ?? []].flat().map(key));\n const mine = (address: string) => own.has(key(address));\n const to = options.to ? list(...options.to) : answerTo(inbound, mine, list);\n\n const cc: string[] = [];\n if (kind === 'reply-all') {\n const taken = new Set(to.map(key));\n for (const address of list(inbound.from, inbound.to, inbound.cc)) {\n if (mine(address) || taken.has(key(address))) continue;\n taken.add(key(address));\n cc.push(address);\n }\n }\n return { to, cc, subject: prefixed(inbound.subject, labels.re, REPLY_PREFIXES) };\n}\n\n/** Where a reply goes: Reply-To over From — and one's own message is\n answered to the people it went to. */\nfunction answerTo(\n inbound: InboundMessage,\n mine: (address: string) => boolean,\n list: (...lists: Array<string | undefined>) => string[],\n): string[] {\n const replyTo = list(inbound.replyTo);\n const sender = replyTo.length ? replyTo : list(inbound.from);\n if (sender.length && sender.every(mine)) {\n const recipients = list(inbound.to).filter((address) => !mine(address));\n if (recipients.length) return recipients;\n }\n return sender;\n}\n\n/** The mailboxes in header-form lists, each address once — what is no\n mailbox (a group's `undisclosed-recipients:;`, a bare name) dropped. */\nfunction mailboxes(rules: AddressRules, lists: Array<string | undefined>): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const address of lists.flatMap((list) => (list ? rules.split(list) : []))) {\n if (!isMailbox(address, rules) || seen.has(addressKey(address, rules))) continue;\n seen.add(addressKey(address, rules));\n out.push(address);\n }\n return out;\n}\n\n/** The prefixes a subject may already carry, per family. Across languages\n on purpose: mail arrives from clients in other ones, so a German \"AW: \"\n must recognize the \"Re: \" an English client left behind. English and\n German; the host's own prefix joins them. The long tail (\"R:\", \"I:\") is\n left out — short forms that also open real subjects. */\nconst REPLY_PREFIXES = ['re', 'aw', 'antw', 'antwort'];\nconst FORWARD_PREFIXES = ['fwd', 'fw', 'wg'];\n\n/** `prefix` once, in place of the run of same-family prefixes the subject\n starts with. */\nfunction prefixed(subject = '', prefix: string, family: readonly string[]): string {\n const own = prefix.trim().replace(/:$/, '').trim();\n const words = [...family, own].filter(Boolean).map((word) => word.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'));\n const pattern = new RegExp(`^(?:${words.join('|')})\\\\s*(?:\\\\[\\\\d+\\\\])?\\\\s*:\\\\s*`, 'i');\n let rest = subject.trim();\n while (pattern.test(rest)) rest = rest.replace(pattern, '');\n return prefix + rest;\n}\n\n/**\n * The imported message as the document itself — the `.eml`-drop / paste law:\n * the body parses through the email schema (full strip, which doubles as\n * sanitization) and *becomes* the document; nothing else of the message\n * survives into it. Pair with `parseEml`:\n * `html.set(importedDocument(parseEml(raw)))`.\n */\nexport function importedDocument(inbound: InboundMessage): string {\n const schema = getSchema();\n const blocks = inboundBlocks(inbound, schema);\n const doc = schema.nodes['doc'].create(null, blocks.childCount ? blocks : emptyParagraph(schema));\n return serializeToHTML(doc, schema);\n}\n\n/**\n * What an import will lose — the *legibility of loss* half of the import law.\n * The parse itself never reports (it just repairs); this walks the inbound\n * HTML against the schema's own parse vocabulary and says what won't survive,\n * so the host can tell the user instead of losing content silently.\n */\nexport interface ImportLoss {\n /** Elements whose tag the schema has no parse rule for — the element is\n removed on parse (its text content may still survive, unwrapped). */\n removedElements: number;\n /** The distinct removed tags, most frequent first. */\n removedTags: string[];\n /** Images pointing at `cid:` MIME parts — they parse in, but stay\n unresolvable until the attachments story lands. */\n inlineImages: number;\n}\n\n/** Computes the {@link ImportLoss} for an inbound message — pure, derived\n from the same HTML `importedDocument` consumes:\n `const loss = importLoss(inbound)` alongside the import, then surface it\n (\"3 elements outside the schema removed (o:p, font)…\"). */\nexport function importLoss(inbound: InboundMessage): ImportLoss {\n const none: ImportLoss = { removedElements: 0, removedTags: [], inlineImages: 0 };\n if (!inbound.html) return none;\n\n const known = schemaTags(getSchema());\n const dom = new DOMParser().parseFromString(inbound.html, 'text/html');\n const removedByTag = new Map<string, number>();\n let removedElements = 0;\n let inlineImages = 0;\n\n for (const element of Array.from(dom.body.querySelectorAll('*'))) {\n const tag = element.tagName.toLowerCase();\n if (\n tag === 'img' &&\n (element.getAttribute('src') ?? '').trim().toLowerCase().startsWith('cid:')\n ) {\n inlineImages++;\n }\n if (!known.has(tag)) {\n removedElements++;\n removedByTag.set(tag, (removedByTag.get(tag) ?? 0) + 1);\n }\n }\n\n const removedTags = [...removedByTag.entries()].sort((a, b) => b[1] - a[1]).map(([tag]) => tag);\n return { removedElements, removedTags, inlineImages };\n}\n\n/** Tags with a parse rule somewhere in the schema — the vocabulary of the\n repair-mode parse the import runs. tbody & friends have no rule of their\n own, but the parser walks through them and our serializer emits `<tbody>`,\n so they are structure, not loss. Preserve-only rules (which would claim\n any tag) and refusals (which drop a tag on purpose) are not vocabulary. */\nlet knownTags: Set<string> | undefined;\nfunction schemaTags(schema: Schema): Set<string> {\n if (knownTags) return knownTags;\n const tags = new Set<string>(['tbody', 'thead', 'tfoot']);\n const collect = (parseDOM: unknown) => {\n for (const rule of (parseDOM as Array<{ tag?: string; ignore?: boolean }>) ?? []) {\n if (rule.ignore || ruleScope(rule as never) === 'authored') continue;\n const tag = rule.tag?.split(/[\\s\\[.:,>]/)[0]?.toLowerCase();\n if (tag) tags.add(tag);\n }\n };\n for (const type of Object.values(schema.nodes)) collect(type.spec.parseDOM);\n for (const type of Object.values(schema.marks)) collect(type.spec.parseDOM);\n knownTags = tags;\n return tags;\n}\n\n/** The labels' attribution for what is known — degrading gracefully when\n data is partial, empty when there is none (the quote then stands on its\n own). */\nfunction attributionLine(inbound: InboundMessage, options?: ComposeSeedOptions): string | null {\n const date = inbound.date === undefined ? undefined : formatDate(inbound.date, options);\n return labelsOf(options).attribution({ from: inbound.from || undefined, date: date || undefined });\n}\n\nfunction formatDate(date: Date | string, options?: ComposeSeedOptions): string {\n if (typeof date === 'string') return date;\n return new Intl.DateTimeFormat(options?.locale ?? 'en-US', {\n dateStyle: 'medium',\n timeStyle: 'short',\n }).format(date);\n}\n\n/** The inbound body as schema blocks: HTML parses through the schema (the\n paste law — foreign markup is repaired, unsafe markup dies); plain text\n becomes one paragraph per line, empty lines included. */\nfunction inboundBlocks(inbound: InboundMessage, schema: Schema): Fragment {\n if (inbound.html) return parseHTML(inbound.html, schema).content;\n\n const text = inbound.text ?? '';\n if (!text) return Fragment.empty;\n const paragraphs = text\n .split(/\\r?\\n/)\n .map((line) => (line ? textParagraph(schema, line) : emptyParagraph(schema)));\n return Fragment.from(paragraphs);\n}\n\nconst emptyParagraph = (schema: Schema): Node => schema.nodes['paragraph'].createAndFill()!;\n\nconst textParagraph = (schema: Schema, text: string): Node =>\n schema.nodes['paragraph'].create(null, schema.text(text));\n","import { EditorState, Plugin, PluginKey, TextSelection } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport {\n CompletionContext,\n EMAIL_SAFE_TAGS,\n VOID_TAGS,\n completionContextAt,\n openTags,\n} from '../html-source';\nimport { EMAIL_SAFE_STYLE_PROPERTIES, EMAIL_TAG_ATTRIBUTES } from '../client-support';\nimport { docText, textOffsetAt } from './html-language';\n\nexport interface AutocompleteItem {\n label: string;\n}\n\nexport interface AutocompleteState {\n open: boolean;\n query: string;\n items: AutocompleteItem[];\n activeIndex: number;\n /** Applies an item: replaces the typed query with the completion. */\n select: (item: AutocompleteItem) => void;\n}\n\nexport interface AutocompleteOptions {\n /** The floating listbox; contents rendered by the host app from the state\n received through `onChange`. Needs a `position: relative` ancestor. */\n element: HTMLElement;\n /** Gap between the line and the menu, in px. */\n offset?: number;\n /** Notified when the menu opens, closes, filters, or moves its highlight. */\n onChange?: (state: AutocompleteState) => void;\n}\n\nconst TAG_SUGGESTIONS = [...EMAIL_SAFE_TAGS].sort();\n\ninterface Session {\n context: CompletionContext;\n items: AutocompleteItem[];\n /** Document range of the typed query (always within one line). */\n fromPm: number;\n toPm: number;\n}\n\nfunction itemsFor(context: CompletionContext, source: string, offset: number): AutocompleteItem[] {\n const query = context.query.toLowerCase();\n const labels = (() => {\n switch (context.kind) {\n case 'tag':\n return TAG_SUGGESTIONS;\n case 'closing':\n // Innermost open tag first — the one a closer most likely means.\n return [...new Set(openTags(source.slice(0, offset)).reverse())];\n case 'attribute': {\n const merged = new Set([\n ...(EMAIL_TAG_ATTRIBUTES[context.tag] ?? []),\n ...EMAIL_TAG_ATTRIBUTES['*'],\n ]);\n for (const present of context.existing) merged.delete(present);\n return [...merged].sort();\n }\n case 'style-property':\n return EMAIL_SAFE_STYLE_PROPERTIES;\n }\n })();\n return labels.filter((label) => label.startsWith(query)).map((label) => ({ label }));\n}\n\nfunction findSession(state: EditorState): Session | null {\n const { $from, empty } = state.selection;\n if (!empty || !$from.parent.type.spec['code']) return null;\n\n const source = docText(state.doc);\n const offset = textOffsetAt(state.doc, $from.pos);\n const context = completionContextAt(source, offset);\n if (!context) return null;\n\n return {\n context,\n items: itemsFor(context, source, offset),\n fromPm: $from.pos - context.query.length,\n toPm: $from.pos,\n };\n}\n\n/** The completion text and where the cursor lands inside it. */\nfunction completionFor(\n context: CompletionContext,\n label: string,\n): { text: string; cursor: number } {\n switch (context.kind) {\n case 'tag':\n return VOID_TAGS.has(label)\n ? { text: `${label}>`, cursor: label.length + 1 }\n : { text: `${label}></${label}>`, cursor: label.length + 1 };\n case 'closing':\n return { text: `${label}>`, cursor: label.length + 1 };\n case 'attribute':\n return { text: `${label}=\"\"`, cursor: label.length + 2 };\n case 'style-property':\n return { text: `${label}: `, cursor: label.length + 2 };\n }\n}\n\n/**\n * IDE-style completion for the HTML source editor, offering only the\n * email-safe vocabulary: tags after `<`, the currently open tags after `</`,\n * per-tag attributes inside a tag, and safe style properties inside\n * `style=\"…\"`. Same interaction contract as the slash menu — the host app\n * renders the listbox from the emitted state.\n */\nexport const createHtmlAutocomplete = (options: AutocompleteOptions): FunctionalExtension =>\n defineExtension({\n name: 'htmlAutocomplete',\n plugins: () => [createAutocompletePlugin(options)],\n });\n\nfunction createAutocompletePlugin(options: AutocompleteOptions): Plugin {\n const { element, offset = 4 } = options;\n\n let view: EditorView | undefined;\n let session: Session | null = null;\n let activeIndex = 0;\n /** `fromPm` of a session closed with Escape; suppressed until it moves. */\n let dismissedAt: number | null = null;\n\n const hide = () => {\n element.style.visibility = 'hidden';\n };\n\n const select = (item: AutocompleteItem) => {\n if (!view || !session) return;\n const { text, cursor } = completionFor(session.context, item.label);\n const tr = view.state.tr.insertText(text, session.fromPm, session.toPm);\n tr.setSelection(TextSelection.create(tr.doc, session.fromPm + cursor));\n view.dispatch(tr.scrollIntoView());\n view.focus();\n };\n\n const emit = () =>\n options.onChange?.({\n open: session !== null && session.items.length > 0,\n query: session?.context.query ?? '',\n items: session?.items ?? [],\n activeIndex,\n select,\n });\n\n const position = () => {\n if (!view || !session) return;\n const container = element.offsetParent ?? element.parentElement;\n if (!container) return;\n const containerRect = container.getBoundingClientRect();\n const coords = view.coordsAtPos(session.fromPm);\n\n const left = Math.min(\n Math.max(coords.left - containerRect.left + container.scrollLeft, 0),\n Math.max(container.scrollWidth - element.offsetWidth, 0),\n );\n\n let top = coords.bottom - containerRect.top + container.scrollTop + offset;\n const visibleBottom = container.scrollTop + container.clientHeight;\n if (top + element.offsetHeight > visibleBottom) {\n const above = coords.top - containerRect.top + container.scrollTop;\n if (above - element.offsetHeight - offset >= container.scrollTop) {\n top = above - element.offsetHeight - offset;\n }\n }\n\n element.style.left = `${left}px`;\n element.style.top = `${top}px`;\n };\n\n const refresh = () => {\n if (!view) return;\n const next = findSession(view.state);\n\n if (dismissedAt !== null && next?.fromPm !== dismissedAt) dismissedAt = null;\n const previous = session;\n session = next && next.fromPm !== dismissedAt ? next : null;\n\n if (!session) {\n if (previous) {\n hide();\n emit();\n }\n return;\n }\n\n const sameSpot =\n previous &&\n previous.fromPm === session.fromPm &&\n previous.context.kind === session.context.kind &&\n previous.context.query === session.context.query;\n if (!sameSpot) activeIndex = 0;\n\n if (!session.items.length) {\n hide();\n } else {\n element.style.visibility = 'visible';\n position();\n }\n emit();\n };\n\n const onKeyDown = (event: KeyboardEvent): boolean => {\n if (!session || !session.items.length) return false;\n switch (event.key) {\n case 'ArrowDown':\n activeIndex = (activeIndex + 1) % session.items.length;\n emit();\n return true;\n case 'ArrowUp':\n activeIndex = (activeIndex - 1 + session.items.length) % session.items.length;\n emit();\n return true;\n case 'Enter':\n case 'Tab':\n select(session.items[activeIndex]);\n return true;\n case 'Escape':\n dismiss();\n return true;\n default:\n return false;\n }\n };\n\n const dismiss = () => {\n if (!session) return;\n dismissedAt = session.fromPm;\n session = null;\n hide();\n emit();\n };\n\n const onMenuMousedown = (event: Event) => event.preventDefault();\n const onWindowMousedown = (event: MouseEvent) => {\n if (element.contains(event.target as Node | null)) return;\n dismiss();\n };\n const onBlur = (event: FocusEvent) => {\n if (element.contains(event.relatedTarget as Node | null)) return;\n requestAnimationFrame(() => {\n if (!view) return;\n if (view.hasFocus() || element.contains(element.ownerDocument.activeElement)) return;\n dismiss();\n });\n };\n\n return new Plugin({\n key: new PluginKey('htmlAutocomplete'),\n props: {\n handleKeyDown: (_view, event) => onKeyDown(event),\n },\n view: (editorView) => {\n view = editorView;\n element.style.position = 'absolute';\n hide();\n element.addEventListener('mousedown', onMenuMousedown);\n window.addEventListener('mousedown', onWindowMousedown);\n editorView.dom.addEventListener('blur', onBlur);\n refresh();\n return {\n update: () => refresh(),\n destroy: () => {\n editorView.dom.removeEventListener('blur', onBlur);\n window.removeEventListener('mousedown', onWindowMousedown);\n element.removeEventListener('mousedown', onMenuMousedown);\n view = undefined;\n hide();\n },\n };\n },\n });\n}\n","import { EditorView } from 'prosemirror-view';\n\n/** What a menu lets its scroll behaviour do. */\nexport interface MenuScrollApi {\n /** Report the menu closed; the next selection change brings it back. */\n close(): void;\n /** Report the menu's box afresh, where it is open. */\n refresh(): void;\n}\n\n/**\n * What a floating menu does when what it stands over scrolls — the\n * editor's own scroll container, or the page:\n *\n * - `'close'` (the default): the menu goes. The box it reported is in\n * viewport coordinates, and stale the moment the editor scrolls under it.\n * - `'follow'`: the box is reported afresh, once per frame, so a host that\n * repositions on the box's change keeps the menu over the selection.\n * - `'keep'`: nothing — the menu stays where it was reported.\n * - a function: the host's own say, per event — close for the editor's\n * scroller but follow for the page, or close past a threshold.\n *\n * The listener is the window's, in the capture phase, so every scroll\n * container on the page is heard without being marked (no `cdkScrollable`\n * needed), and only a scroll that moves the editor counts: the document's,\n * or an ancestor's. A scrollable list inside the host's own menu never\n * closes the menu it is in.\n */\nexport type MenuScroll =\n 'close' | 'follow' | 'keep' | ((event: Event, menu: MenuScrollApi) => void);\n\n/** Starts watching for {@link MenuScroll}; returns what stops it. */\nexport function watchMenuScroll(\n view: EditorView,\n scroll: MenuScroll | undefined,\n menu: MenuScrollApi,\n): () => void {\n const mode = scroll ?? 'close';\n if (mode === 'keep') return () => {};\n const doc = view.dom.ownerDocument;\n const win = doc.defaultView ?? window;\n let frame: number | undefined;\n const onScroll = (event: Event) => {\n if (!scrollsEditor(event, view)) return;\n if (typeof mode === 'function') return mode(event, menu);\n if (mode === 'close') return menu.close();\n if (frame !== undefined) return;\n frame = win.requestAnimationFrame(() => {\n frame = undefined;\n menu.refresh();\n });\n };\n win.addEventListener('scroll', onScroll, true);\n return () => {\n win.removeEventListener('scroll', onScroll, true);\n if (frame !== undefined) win.cancelAnimationFrame(frame);\n };\n}\n\n/** Whether a scroll moves the editor: the document's own, or that of an\n element the editor stands in (the editor's element itself included). */\nfunction scrollsEditor(event: Event, view: EditorView): boolean {\n const target = event.target;\n const doc = view.dom.ownerDocument;\n if (target === doc || target === doc.defaultView) return true;\n return target instanceof Node && target.contains(view.dom);\n}\n","import { EditorState, Plugin, PluginKey, TextSelection, AllSelection } from 'prosemirror-state';\nimport { FunctionalExtension, defineExtension } from '../extension'; // Adjust path if needed\nimport { selectionInsideMergeTag } from './nodes/merge-tag';\nimport { selectedImage } from './nodes/image';\nimport { selectedButton } from './nodes/button';\nimport { MenuScroll, watchMenuScroll } from './menu-scroll';\n\nexport interface BubbleMenuState {\n isOpen: boolean;\n boundingBox: DOMRect | null;\n /** What the menu is for: `'image'` when an image is the whole selection\n — clicked, or dragged over with nothing but whitespace beside it\n (`selectedImage`); `'button'` likewise for a button (`selectedButton`)\n — the box is then the node's own; `'text'` otherwise: a range with\n text in it, or with an image and a button both. A host shows each\n one's own tools. Absent while closed. */\n kind?: 'text' | 'image' | 'button';\n}\n\nexport interface BubbleMenuOptions {\n /** How long a selection stands before the menu *opens* over it (150ms):\n a drag's or a Shift-Arrow's intermediate ranges never pop a menu. A\n menu that is already open follows the selection at once — see the\n plugin view. */\n updateDelay?: number;\n onStateChange: (state: BubbleMenuState) => void;\n shouldShow?: (state: EditorState) => boolean;\n /** What the menu does when the editor scrolls under it — closes, by\n default. See {@link MenuScroll}. */\n scroll?: MenuScroll;\n}\n\n// Inside a merge tag the menu stays away: the token is text, but formatting\n// it is all-or-nothing and lives on the keyboard (Ctrl-B bolds the whole).\n// An image alone is the other thing it opens for — clicked or dragged over —\n// and a button alone. Exported, so a host's `shouldShow` can narrow it\n// rather than restate it.\nexport const defaultBubbleShouldShow = (state: EditorState) =>\n !!selectedImage(state) ||\n !!selectedButton(state) ||\n (!state.selection.empty &&\n (state.selection instanceof TextSelection || state.selection instanceof AllSelection) &&\n !selectionInsideMergeTag(state));\n\nexport const createBubbleMenu = (options: BubbleMenuOptions): FunctionalExtension =>\n defineExtension({\n name: 'bubbleMenu',\n plugins: () => [\n new Plugin({\n key: new PluginKey('bubbleMenu'),\n view: (view) => {\n let showTimer: ReturnType<typeof setTimeout> | undefined;\n let mouseSelecting = false;\n let destroyed = false;\n let open = false;\n\n // Closed is said once: a caret moving through the text, or a press\n // elsewhere on the page, is no news to a host that already knows.\n const close = () => {\n if (!open) return;\n open = false;\n options.onStateChange({ isOpen: false, boundingBox: null });\n };\n\n // Whether the menu may show: not mid-drag, the host's say-so, and\n // the editor focused — or the menu would pop up on a click\n // elsewhere on the page.\n const canShow = () =>\n !destroyed &&\n !mouseSelecting &&\n (options.shouldShow || defaultBubbleShouldShow)(view.state) &&\n view.hasFocus();\n\n // Reports the menu open over the current selection.\n const show = () => {\n // Asked again once the delay is over: in between, the host may\n // have opened something of its own there (a click on a button\n // opens its link editor) that its `shouldShow` now says no to.\n if (!canShow()) return close();\n // An image alone, or a button: the menu stands over the node\n // itself.\n const image = selectedImage(view.state);\n const button = image ? null : selectedButton(view.state);\n const node = image ?? button;\n const dom = node && (view.nodeDOM(node.pos) as HTMLElement | null);\n if (dom && typeof dom.getBoundingClientRect === 'function') {\n open = true;\n options.onStateChange({\n isOpen: true,\n boundingBox: dom.getBoundingClientRect(),\n kind: image ? 'image' : 'button',\n });\n return;\n }\n\n const { from, to } = view.state.selection;\n\n // Get coordinates of the selection boundaries\n const start = view.coordsAtPos(from);\n const end = view.coordsAtPos(to, -1);\n\n // Construct a virtual DOMRect representing the text selection.\n // Angular CDK uses this to anchor the overlay!\n const top = Math.min(start.top, end.top);\n const bottom = Math.max(start.bottom, end.bottom);\n const left = Math.min(start.left, end.left);\n const right = Math.max(start.right, end.right);\n\n // Construct a mathematically perfect virtual DOMRect\n const boundingBox = {\n top,\n bottom,\n left,\n right,\n width: right - left,\n height: bottom - top,\n x: left,\n y: top,\n toJSON: () => '',\n } as DOMRect;\n\n open = true;\n options.onStateChange({ isOpen: true, boundingBox, kind: 'text' });\n };\n\n const refresh = () => {\n if (destroyed) return;\n clearTimeout(showTimer);\n\n if (!canShow()) {\n close();\n return;\n }\n\n // Open already: the menu follows the selection *now* — its kind\n // and its box change in the same transaction the selection did,\n // so what a host renders from the state and what it reads live\n // from the editor (an image's alt, an action's enabled) never\n // disagree. Delayed, the image's menu stood over a text range\n // for the delay, showing the alt of an image no longer selected\n // alone — empty — and its image tools disabled, before the\n // text's menu replaced it. The delay is for *opening*: a range\n // passing through, a drag's intermediate selections, never pop\n // a menu of their own.\n if (open) return show();\n showTimer = setTimeout(show, options.updateDelay ?? 150);\n };\n\n // 1. Mouse Tracking: Don't show the menu while the user is actively dragging a selection.\n // Only a mousedown that begins inside the editor starts a text-selection drag. A mousedown\n // elsewhere — above all on the bubble menu itself, which renders in a CDK overlay outside\n // view.dom — must not count, or every button press would hide the menu and tear down the\n // overlay around the very click meant to run the command.\n const onWindowMousedown = (event: MouseEvent) => {\n if (!view.dom.contains(event.target as Node)) return;\n mouseSelecting = true;\n refresh();\n };\n // Only the release of a drag that began in the editor ends one.\n const onMouseup = () => {\n if (!mouseSelecting) return;\n mouseSelecting = false;\n refresh();\n };\n window.addEventListener('mousedown', onWindowMousedown);\n window.addEventListener('mouseup', onMouseup);\n\n // 2. Focus Tracking: Clean up nicely when blurring\n const onBlur = () => requestAnimationFrame(refresh);\n const onFocus = () => refresh();\n view.dom.addEventListener('blur', onBlur);\n view.dom.addEventListener('focus', onFocus);\n\n // 3. Scroll: the box is viewport coordinates, stale once the\n // editor scrolls under the menu — closed by default, see\n // `MenuScroll`. Following re-reports the box of an open menu.\n const stopScrollWatch = watchMenuScroll(view, options.scroll, {\n close,\n refresh: () => {\n if (open) show();\n },\n });\n\n return {\n update(view, prevState) {\n const selectionChanged = !prevState || !prevState.selection.eq(view.state.selection);\n const docChanged = !prevState || !prevState.doc.eq(view.state.doc);\n\n if (selectionChanged || docChanged) {\n refresh();\n }\n },\n destroy() {\n destroyed = true;\n clearTimeout(showTimer);\n\n // Cleanup listeners\n window.removeEventListener('mousedown', onWindowMousedown);\n window.removeEventListener('mouseup', onMouseup);\n view.dom.removeEventListener('blur', onBlur);\n view.dom.removeEventListener('focus', onFocus);\n stopScrollWatch();\n\n close();\n },\n };\n },\n }),\n ],\n });\n","import { Command, Plugin, PluginKey } from 'prosemirror-state';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { LayoutBlockType, layoutBlockAt } from './layout-guides';\nimport { MenuScroll, watchMenuScroll } from './menu-scroll';\n\nexport interface BlockMenuState {\n isOpen: boolean;\n /** The layout block's own rect — the menu anchors to the block, not the caret. */\n boundingBox: DOMRect | null;\n /** Which block the cursor is in, so the app can offer its commands. */\n block: LayoutBlockType | null;\n}\n\nexport interface BlockMenuOptions {\n onStateChange: (state: BlockMenuState) => void;\n /**\n * Resolves the rendered menu element, lazily — it lives in an overlay, so it\n * only exists while the menu is open.\n *\n * Without it the menu is **mouse-only**: it stays open only while the editor\n * has focus, so Tabbing toward it blurs the editor and closes the very thing\n * you were reaching for. Given this, focus landing inside the menu counts as\n * still-active, which is what makes {@link BLOCK_MENU_FOCUS_KEY} usable.\n */\n menuElement?: () => HTMLElement | null | undefined;\n /** What the menu does when the editor scrolls under it — closes, by\n default. See {@link MenuScroll}. */\n scroll?: MenuScroll;\n}\n\n/**\n * Moves focus into the menu — the ARIA \"jump to toolbar\" gesture, and the only\n * way to reach a contextual toolbar that is anchored to the caret's block.\n * Alt-F10 follows CKEditor's convention; bare F10 is out because browsers give\n * it to their own menu bar, and Alt alone would too (a chord is safe).\n */\nexport const BLOCK_MENU_FOCUS_KEY = 'Alt-F10';\n\nconst CLOSED: BlockMenuState = { isOpen: false, boundingBox: null, block: null };\n\n/**\n * The block menu: the bubble menu's sibling for *layout blocks*.\n *\n * The bubble menu answers \"what can I do to this text?\" and anchors to the\n * selection. This answers \"what can I do to this block?\" and anchors to the\n * block itself. It exists because block-level commands kept piling up with\n * nowhere to live — the table's structural commands (`addRowAt`, `deleteColumnAt`,\n * …) have been library-only, and column alignment would have been the third\n * feature to hit the same wall.\n *\n * It opens on a **bare cursor** inside a table/columns block, so it never\n * competes with the text bubble menu (which needs a non-empty selection) —\n * the two are mutually exclusive by construction, never stacked.\n *\n * Reachable by keyboard: press {@link BLOCK_MENU_FOCUS_KEY} to move focus into\n * it, Escape (wired by the app) to come back. See {@link BlockMenuOptions.menuElement}\n * for why that needs the element.\n *\n * Deliberately *not* the reverted Notion-style overlay: no pointer tracking, no\n * hover handles, no steppers. It is one calm toolbar, positioned by the app.\n */\nexport const createBlockMenu = (options: BlockMenuOptions): FunctionalExtension => {\n const menuHasFocus = (): boolean => {\n const el = options.menuElement?.();\n return !!el && el.contains(document.activeElement);\n };\n\n /** Park focus on the menu's first button. */\n const focusBlockMenu: Command = (_state, dispatch) => {\n const first = options.menuElement?.()?.querySelector<HTMLElement>('button:not([disabled])');\n if (!first) return false;\n if (dispatch) first.focus();\n return true;\n };\n\n return defineExtension({\n name: 'blockMenu',\n keymap: () => ({ [BLOCK_MENU_FOCUS_KEY]: focusBlockMenu }),\n plugins: () => [\n new Plugin({\n key: new PluginKey('blockMenu'),\n view: (view) => {\n let destroyed = false;\n let open = false;\n const report = (state: BlockMenuState) => {\n open = state.isOpen;\n options.onStateChange(state);\n };\n\n const refresh = () => {\n if (destroyed) return;\n\n // A non-empty selection belongs to the text bubble menu.\n const block = view.state.selection.empty ? layoutBlockAt(view.state) : null;\n // Focus inside the menu still counts: otherwise reaching for the\n // menu by keyboard would be what closes it. The selection stays put\n // while the editor is blurred, so the block is still resolvable.\n if (!block || !(view.hasFocus() || menuHasFocus())) {\n report(CLOSED);\n return;\n }\n\n const dom = view.nodeDOM(block.pos);\n if (!(dom instanceof HTMLElement)) {\n report(CLOSED);\n return;\n }\n\n report({\n isOpen: true,\n boundingBox: dom.getBoundingClientRect(),\n block: block.type,\n });\n };\n\n // The block's box is viewport coordinates, stale once the editor\n // scrolls under the menu — closed by default, see `MenuScroll`.\n const stopScrollWatch = watchMenuScroll(view, options.scroll, {\n close: () => {\n if (open) report(CLOSED);\n },\n refresh: () => {\n if (open) refresh();\n },\n });\n\n // Clicking a menu button blurs the editor for a tick; re-check on the\n // next frame rather than tearing the overlay down under the click.\n const onBlur = () => requestAnimationFrame(refresh);\n const onFocus = () => refresh();\n // Focus moving anywhere is what decides this menu's fate — into the\n // menu keeps it open, out of both editor and menu closes it.\n const onFocusIn = () => refresh();\n view.dom.addEventListener('blur', onBlur);\n view.dom.addEventListener('focus', onFocus);\n document.addEventListener('focusin', onFocusIn);\n\n refresh();\n\n return {\n update(currentView, prevState) {\n const selectionChanged =\n !prevState || !prevState.selection.eq(currentView.state.selection);\n const docChanged = !prevState || !prevState.doc.eq(currentView.state.doc);\n if (selectionChanged || docChanged) refresh();\n },\n destroy() {\n destroyed = true;\n view.dom.removeEventListener('blur', onBlur);\n view.dom.removeEventListener('focus', onFocus);\n document.removeEventListener('focusin', onFocusIn);\n stopScrollWatch();\n report(CLOSED);\n },\n };\n },\n }),\n ],\n });\n};\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport {\n ExtensionContext,\n FunctionalExtension,\n SuggestionCommandItem,\n SuggestionGroup,\n SuggestionItem,\n SuggestionPage,\n SuggestionRequest,\n SuggestionSource,\n defineExtension,\n} from '../extension';\n\nexport interface SuggestionMenuState {\n open: boolean;\n /** The trigger this state answers to — `/`, `{{`, `@`. A menu of several\n triggers reports the one that is open. */\n trigger: string;\n /** What that trigger's list is called ({@link SuggestionTrigger.label}) —\n the listbox's accessible name on level 1. Null when it was given none. */\n label: string | null;\n /** 1 on the menu's own items; 2 inside a {@link SuggestionGroup} —\n `<trigger><word> <query>`. */\n level: 1 | 2;\n /** The group whose children are listed, at level 2; null at level 1. */\n parent: SuggestionGroup | null;\n /** The search string of the current level: everything after the trigger\n at level 1, everything after `<word> ` at level 2. */\n query: string;\n /** Items matching the query: static matches ranked title-first (given\n order within a tier), then what a source answered for this query — the\n menu's {@link SuggestionMenuOptions.source} at level 1, the group's\n children source at level 2. Titles and keywords are already translated. */\n items: SuggestionItem[];\n /** Index of the keyboard-highlighted item. */\n activeIndex: number;\n /** A source's first page for the current query is in flight (or waiting\n out {@link SuggestionMenuOptions.debounce}) — render a \"Searching…\"\n row. The menu counts as open while loading, even with no items yet. */\n loading: boolean;\n /** The source's items on screen answer the *previous* query: they stay\n until the new page lands, so the list is diffed rather than torn down\n and rebuilt on every keystroke. Enter and Tab pass over a stale row. */\n stale: boolean;\n /** Where the session sits in the document: the trigger's first character\n to the caret. Null while closed. */\n range: { from: number; to: number } | null;\n /** The trigger's box in viewport coordinates, measured when called — for\n the renderer to place the menu after it has rendered its rows. Null\n while closed. */\n clientRect: () => SuggestionRect | null;\n /** A further page is in flight — render a loading row at the list's end. */\n loadingMore: boolean;\n /** The source has more pages: the renderer's scroll should call\n {@link loadMore} near the end (ArrowDown on the last row already does). */\n hasMore: boolean;\n /** Why the source's last answer failed; null while it has not. Cleared by\n the next query. The menu stays open to say so. */\n error: unknown;\n /** The id the listbox element must carry: the editor points at it\n (`aria-controls`) while the menu is open. */\n listboxId: string;\n /** The id the option at `index` must carry (with `role=\"option\"`): the\n editor points at the highlighted one (`aria-activedescendant`), and the\n pointer's highlight finds its row by it. */\n optionId: (index: number) => string;\n /** The heading for a section id (an item's `section`): the trigger's\n `sections` wording, else the library's own ({@link\n suggestionSectionTitles}), else the id itself. Asked as headings are\n rendered, so a function given as `sections` is heard afresh. */\n sectionTitle: (id: string) => string;\n /** Applies an item. A command item removes the trigger and query text,\n then runs its command; a group rewrites the query to `<word> `,\n opening level 2. */\n select: (item: SuggestionItem) => void;\n /** Level 2 back to level 1 with an empty query — the pointer's way; the\n keyboard's is Backspace over the space. A no-op at level 1. */\n back: () => void;\n /** Fetches the next page and appends it. A no-op while anything is loading,\n when no page is left, or when the menu is closed — safe from any scroll\n handler without guards. */\n loadMore: () => void;\n /** Closes the menu as Escape does — for a renderer's own close control. It\n stays shut for this trigger until the caret has been somewhere else. A\n no-op while closed. */\n dismiss: () => void;\n}\n\n/** A box in viewport coordinates. */\nexport interface SuggestionRect {\n left: number;\n right: number;\n top: number;\n bottom: number;\n}\n\n/** A translation for one item, keyed by its id in\n {@link SuggestionMenuOptions.i18n}. */\nexport interface SuggestionItemLabel {\n /** Replaces the item's title — shown, ranked first, and (for a group)\n the word written into the query. The original title stays searchable. */\n title?: string;\n /** Extra search strings, added to the item's own — never replacing them,\n so the original words keep working in every locale. */\n keywords?: string[];\n /** Replaces a group's `placeholder`. */\n placeholder?: string;\n}\n\n/** What a trigger's {@link SuggestionTrigger.allow} is asked about: a session\n that would open. */\nexport interface SuggestionAllowProps {\n state: EditorState;\n /** The trigger's first character to the caret. */\n range: { from: number; to: number };\n /** The text after the trigger, leading whitespace dropped. */\n query: string;\n}\n\n/** One trigger of a suggestion menu: what opens it, what it lists, what its\n query may look like. Any string is a trigger — `'/'`, `'{{'`, `'@'`,\n `'||'`. */\nexport interface SuggestionTrigger {\n /** What opens the menu when typed: `'/'`, `'{{'`, `'@'`. */\n trigger: string;\n /** What this trigger's list is called — \"Insert block\", \"Personalization\n tokens\". Handed on as {@link SuggestionMenuState.label}: the listbox's\n accessible name. A function is asked afresh whenever the menu opens,\n like `i18n`: the words of the language in use. */\n label?: string | (() => string);\n /** Only at the start of a line or after whitespace — `/` in a URL stays\n text. In a script that writes no spaces (Japanese, Chinese) every\n character counts as one: `/` opens right after こんにちは. Default true. Either way a trigger right after its own first\n character never opens: not `//`, not Handlebars' `{{{`. */\n startOfWord?: boolean;\n /** What the text between the trigger and the caret may be. Default: not\n starting with whitespace (typing `/ ` dismisses), spaces inside allowed\n (`/heading 2`), and no trigger character (a later one starts a new\n session). A merge-tag menu narrows it to a path: `/^ ?[\\w.]*$/`. The\n query handed on is that text with its leading whitespace dropped. */\n query?: RegExp;\n /** The longest query that still counts as one. Default 100. */\n maxLength?: number;\n /** The menu's own items — a list, or a function of the editor's extensions\n (`extensionSuggestions` for the kit's `/` commands). Filtered and\n ranked by the query; groups among them open a second level. */\n items?: readonly SuggestionItem[] | ((ctx: ExtensionContext) => readonly SuggestionItem[]);\n /**\n * The menu's dynamic items, asked per query and per page — a server\n * catalogue, a search backend. Its answers are appended after the static\n * matches, **not** re-filtered: the source owns its matching. Stale answers\n * are dropped and their requests aborted (a newer query, a dismissal, a\n * destroyed editor) — the host never race-guards. A group's children\n * source works the same way at level 2.\n */\n source?: SuggestionSource;\n /** Shown after the bare trigger, until a query is typed — \"Type to\n filter…\". It is handed to the session's decoration as\n `data-placeholder`; the host's stylesheet shows it (see\n {@link createSuggestionMenu}, \"Marked in the text\"). Inside a group the\n group's own takes its place: `/templates ` shows\n {@link SuggestionGroup.placeholder}. A function is asked afresh whenever\n the menu opens. */\n placeholder?: string | (() => string);\n /**\n * The host's veto: asked for every session the text would open, and the\n * menu stays shut — for this trigger; one further back may still open —\n * when it says no. For what the text alone cannot tell: a caret that is\n * not typing a query but standing in something already written. The `{{`\n * menu needs one — the braces before a caret *inside* `{{ firstName }}`\n * open that token, and picking a row there would write a second token into\n * the first:\n *\n * allow: ({ state }) => !caretInsideMergeTag(state)\n *\n * Asked once per editor state, so it may look at the document.\n */\n allow?: (props: SuggestionAllowProps) => boolean;\n /** Milliseconds to sit on a keystroke before asking a source for a new\n query — a server should see the settled query, not every letter.\n Default 300; 0 asks at once (an in-memory source). Static matches never\n wait, and neither does a further page. */\n debounce?: number;\n /**\n * Translations by item id, at either level: a title, extra keywords, a\n * group's placeholder. A map — or a function of the id, which is asked\n * afresh every time the menu opens: hand it a translation service's lookup\n * and a language switch reaches the menu, its search included, with\n * nothing to re-create. Whatever it answers is *added* to the item's own\n * words, so the original language keeps matching beside the chosen one.\n */\n i18n?:\n | Readonly<Record<string, SuggestionItemLabel>>\n | ((id: string) => SuggestionItemLabel | undefined);\n /**\n * The headings of the items' sections (`SuggestionItem.section`), by id:\n * a map, or a function of the id, asked whenever a heading is rendered —\n * hand it a translation service's lookup and a language switch reaches\n * the headings too. What it leaves out is worded by the library\n * ({@link suggestionSectionTitles}), and an id neither knows shows as it\n * is.\n */\n sections?: Readonly<Record<string, string>> | ((id: string) => string | undefined);\n /** The listbox id ({@link SuggestionMenuState.listboxId}); unique by default. */\n id?: string;\n}\n\n/** The library's wording of the sections its own actions declare — and of\n the ones a host commonly adds: its palette's rows (`color`), its groups. */\nexport const suggestionSectionTitles: Readonly<Record<string, string>> = {\n ai: 'AI',\n blocks: 'Basic blocks',\n styling: 'Styling',\n color: 'Color',\n media: 'Media',\n layout: 'Layout',\n message: 'Message',\n templates: 'Templates',\n examples: 'Examples',\n};\n\n/**\n * A suggestion menu: the element it shows in, and the triggers that open it\n * — one, written inline, or several in `triggers`:\n *\n * createSuggestionMenu({ element, onChange, trigger: '/', items: extensionSuggestions })\n * createSuggestionMenu({ element, onChange, triggers: [\n * { trigger: '/', label: 'Insert block', items: extensionSuggestions },\n * { trigger: '{{', label: 'Tokens', startOfWord: false, source: fetchMergeTags },\n * { trigger: '||', label: 'Snippets', source: fetchSnippets },\n * ] })\n */\nexport interface SuggestionMenuOptions extends Partial<SuggestionTrigger> {\n /**\n * The menu's element, rendered by the host from the\n * {@link SuggestionMenuState} it receives through `onChange`. The plugin\n * never writes to it — placing and showing it is the renderer's, after its\n * rows are in (see `clientRect`) — it only listens: a press on it keeps the\n * editor's focus, a press anywhere else dismisses.\n */\n element: HTMLElement;\n /** Further triggers that open this same menu — after the inline one, when\n there is one. They never open together (the trigger nearest the caret\n wins), so one element and one `onChange` serve them all: the state says\n whose list it is (`trigger`, `label`, `listboxId`). */\n triggers?: readonly SuggestionTrigger[];\n /** Notified when the menu opens, closes, filters, loads, or moves — with\n the state of the trigger that is open, or of the one that just closed. */\n onChange?: (state: SuggestionMenuState) => void;\n}\n\n/** What the triggers of one menu share. */\ninterface SuggestionMenuHost {\n element: HTMLElement;\n onChange: (state: SuggestionMenuState) => void;\n}\n\n/** What the plugin keeps in the editor's state, so that it moves with the\n text and is there when the decoration is drawn. */\ninterface SessionState {\n /** The session this menu has for the state — none while dismissed, or\n while another menu's trigger sits nearer the caret. */\n session: Session | null;\n /** `from` of the session that was dismissed; held until the caret has been\n anywhere else. */\n dismissed: number | null;\n}\n\ninterface SessionMeta {\n dismiss: true;\n}\n\nconst sameSession = (a: Session | null, b: Session | null): boolean =>\n a === b || (!!a && !!b && a.from === b.from && a.to === b.to && a.text === b.text);\n\ninterface Session {\n /** Position of the trigger's first character. */\n from: number;\n /** Cursor position (end of the query). */\n to: number;\n /** Everything typed after the trigger, leading whitespace dropped. */\n text: string;\n}\n\n/** Where a session's text puts the menu: which level, and its search. */\ninterface Scope {\n parent: SuggestionGroup | null;\n query: string;\n}\n\ntype Answer = SuggestionItem[] | SuggestionPage;\n\nlet nextListboxId = 0;\n\n/** The menus of each editor, as the start of the session each would open\n for a state — so that only the one nearest the caret opens. */\nconst menusOf = new WeakMap<EditorView, Set<(state: EditorState) => number | null>>();\n\n/** What may stand right before a trigger that wants the start of a word:\n whitespace — or a character of a script that writes no spaces between its\n words (kana, CJK ideographs and their punctuation, full-width forms), where\n every character is a place a word may start. */\nconst WORD_BREAK = /[\\s\\u3000-\\u30ff\\u3400-\\u4dbf\\u4e00-\\u9fff\\uff00-\\uffef]/;\n\nconst escapeRegExp = (text: string) => text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/** The word a title becomes in the query: lowercased, spaces as hyphens. */\nconst commandWord = (text: string): string => text.trim().toLowerCase().split(/\\s+/).join('-');\n\n/** A group is entered by its (translated) title, its id, or any keyword —\n the original title among them once translated. */\nconst groupWords = (group: SuggestionGroup): string[] =>\n [group.id, group.title, ...(group.keywords ?? [])].map(commandWord);\n\nfunction localize<T extends SuggestionItem>(item: T, i18n: SuggestionTrigger['i18n']): T {\n const label = typeof i18n === 'function' ? i18n(item.id) : i18n?.[item.id];\n if (!label) return item;\n const keywords = [...(item.keywords ?? []), ...(label.keywords ?? [])];\n if (label.title && label.title !== item.title) keywords.push(item.title);\n return {\n ...item,\n title: label.title ?? item.title,\n keywords,\n ...(item.children && label.placeholder ? { placeholder: label.placeholder } : {}),\n };\n}\n\nfunction filterItems<T extends SuggestionItem>(items: readonly T[], query: string): T[] {\n const words = query.toLowerCase().split(/\\s+/).filter(Boolean);\n if (!words.length) return [...items];\n return items.filter((item) => {\n const haystack = [item.title, ...(item.keywords ?? [])].map((s) => s.toLowerCase());\n return words.every((word) => haystack.some((entry) => entry.includes(word)));\n });\n}\n\n/** Matches, best first: a query naming an item's *title* must beat a\n keyword-only match — typing \"/columns\" should highlight Columns, not the\n table (whose keywords include \"columns\"). Stable within a tier, so the\n given order remains the tiebreak. */\nfunction rankItems<T extends SuggestionItem>(matches: T[], query: string): T[] {\n const q = query.trim().toLowerCase();\n if (!q) return matches;\n const tier = (item: SuggestionItem): number => {\n const title = item.title.toLowerCase();\n if (title === q) return 0;\n if (title.startsWith(q)) return 1;\n if (title.includes(q)) return 2;\n return 3; // matched via keywords only\n };\n return matches\n .map((item, index) => ({ item, index, tier: tier(item) }))\n .sort((a, b) => a.tier - b.tier || a.index - b.index)\n .map((entry) => entry.item);\n}\n\n/**\n * A suggestion menu: typing `trigger` opens a list under the caret, the text\n * after it searches the list, and picking an item replaces trigger and query\n * with what the item does. One factory for every such menu — the `/` command\n * menu and the `{{` merge-tag picker are two triggers with different\n * options, in one menu (one element, one state) or in a menu each:\n *\n * createSuggestionMenu({ element, onChange, triggers: [\n * { trigger: '/', items: extensionSuggestions },\n * { trigger: '{{', startOfWord: false, query: /^ ?[\\w.]*$/, source: fetchMergeTags },\n * ] })\n *\n * The host renders the list from the state (the library's\n * `email-suggestion-menu` pair does it); this plugin does the rest —\n * detection, filtering, the paged and debounced source, keyboard navigation,\n * applying. It never writes to the menu element: showing and placing it are\n * the renderer's, after its rows are in (`clientRect` says where).\n *\n * **Read from the text.** A session is a caret right after\n * `<trigger><query>`, however the text got there, and nothing else is held:\n * undo, paste, and moving the caret back into a query all land right.\n *\n * **Two levels.** A {@link SuggestionGroup} (\"Templates\") picked on level 1\n * rewrites the query to `templates `; from then on the words after that\n * space search the group's children. Backspace over the space is level 1\n * again.\n *\n * **One at a time.** Several menus on one editor never open together: when\n * two sessions overlap (`/templates {{`), the trigger nearest the caret wins\n * and the other stays shut until it is gone.\n *\n * **Marked in the text.** While a session lasts, its trigger and query are\n * wrapped in a decoration — `<span class=\"aee-suggestion\" data-trigger=\"/\">`,\n * with `data-level`, and with `aee-suggestion-empty` and a\n * `data-placeholder` while the level's query is empty (the trigger's after\n * `/`, the group's after `/templates `) — for the host's stylesheet: the\n * library paints nothing.\n * Nothing of it is in the document or the HTML. The session, and the place\n * where Escape dismissed one, live in the plugin's state and move with the\n * text: what a sync writes before a dismissed trigger does not reopen it.\n *\n * **One highlight.** The arrows move it and so does the pointer, over the\n * rows that carry the state's option ids — hover is not a second one.\n *\n * **The editor is the combobox.** Focus never leaves it: while the menu is\n * open the editable carries `aria-controls` (the listbox) and\n * `aria-activedescendant` (the highlighted option), whose ids the state\n * hands the renderer.\n */\nexport const createSuggestionMenu = (options: SuggestionMenuOptions): FunctionalExtension => {\n const { element, onChange, triggers: further = [], ...inline } = options;\n const triggers = [\n ...(inline.trigger !== undefined ? [inline as SuggestionTrigger] : []),\n ...further,\n ];\n if (!triggers.length || triggers.some(({ trigger }) => !trigger)) {\n throw new Error('createSuggestionMenu: trigger must not be empty');\n }\n if (new Set(triggers.map(({ trigger }) => trigger)).size !== triggers.length) {\n throw new Error('createSuggestionMenu: every trigger of a menu must be different');\n }\n\n return defineExtension({\n name: 'suggestionMenu',\n plugins: (ctx) => {\n // One stream of states for the one element. The triggers never open\n // together, but they all report: what reaches the host is the open\n // one's state, and its closing — never the \"still closed\" of another\n // while it shows.\n let showing: string | null = null;\n const host: SuggestionMenuHost = {\n element,\n onChange: (state) => {\n if (state.open) showing = state.trigger;\n else if (showing !== null && showing !== state.trigger) return;\n else showing = null;\n onChange?.(state);\n },\n };\n return triggers.map((trigger) => createSuggestionMenuPlugin(ctx, trigger, host));\n },\n });\n};\n\nfunction createSuggestionMenuPlugin(\n ctx: ExtensionContext,\n options: SuggestionTrigger,\n host: SuggestionMenuHost,\n): Plugin {\n const { element } = host;\n const { trigger, i18n, startOfWord = true, maxLength = 100, debounce = 300 } = options;\n const key = new PluginKey<SessionState>('suggestionMenu');\n\n const first = escapeRegExp(trigger[0]);\n const queryPattern = options.query ?? new RegExp(`^(?:[^\\\\s${first}][^${first}]*)?$`);\n\n const given = typeof options.items === 'function' ? options.items(ctx) : (options.items ?? []);\n /** The menu's items in the words of the moment — relabelled whenever a\n session starts, so an `i18n` function is heard after a language switch. */\n let allItems: SuggestionItem[] = [];\n let groups: SuggestionGroup[] = [];\n let label: string | null = null;\n let placeholder: string | undefined;\n const words = (given: string | (() => string) | undefined) =>\n typeof given === 'function' ? given() : given;\n const relabel = () => {\n label = words(options.label) ?? null;\n placeholder = words(options.placeholder);\n allItems = given.map((item) => localize(item, i18n));\n groups = allItems.filter((item): item is SuggestionGroup => !!item.children);\n };\n relabel();\n\n const listboxId = options.id ?? `email-suggestion-menu-${nextListboxId++}`;\n const optionId = (index: number) => `${listboxId}-option-${index}`;\n const sectionTitle = (id: string): string => {\n const { sections } = options;\n const words = typeof sections === 'function' ? sections(id) : sections?.[id];\n return words ?? suggestionSectionTitles[id] ?? id;\n };\n\n /**\n * An active session is derived from the document, not from keystrokes: a\n * cursor sitting right after `<trigger><query>` is a session.\n */\n const findSession = (state: EditorState): Session | null => {\n const { $from, empty } = state.selection;\n // A selection is no session — except an input method's: while it\n // composes, what is being composed may stand selected, and the query\n // must not close and reopen under every candidate.\n if ((!empty && !view?.composing) || !$from.parent.isTextblock) return null;\n // Only as far back as a session can reach — the trigger, the longest\n // query, and the character before them — so a keystroke at the end of a\n // long paragraph does not serialize all of it. A trigger further back\n // would be turned down for its length anyway, and so is one at the\n // window's very start (its query is one too long): `prefix` is only\n // ever null at the start of the block. Inline leaves count one\n // character, as they do one position.\n const windowStart = Math.max(0, $from.parentOffset - (maxLength + trigger.length + 1));\n const textBefore = $from.parent.textBetween(windowStart, $from.parentOffset, undefined, '');\n const at = textBefore.lastIndexOf(trigger);\n if (at < 0) return null;\n const raw = textBefore.slice(at + trigger.length);\n if (raw.length > maxLength || !queryPattern.test(raw)) return null;\n const prefix = at > 0 ? textBefore[at - 1] : null;\n if (prefix === trigger[0]) return null;\n if (startOfWord && prefix !== null && !WORD_BREAK.test(prefix)) return null;\n const match = { from: $from.start() + windowStart + at, to: $from.pos, text: raw.trimStart() };\n const range = { from: match.from, to: match.to };\n if (options.allow && !options.allow({ state, range, query: match.text })) return null;\n return match;\n };\n\n /** `findSession`, once per state: a transaction asks every menu of the\n editor about every other (see `ownSession`), and each answers from here. */\n let found: { state: EditorState; session: Session | null } | undefined;\n const sessionOf = (state: EditorState): Session | null => {\n if (found?.state !== state) found = { state, session: findSession(state) };\n return found.session;\n };\n\n let view: EditorView | undefined;\n let session: Session | null = null;\n let scope: Scope = { parent: null, query: '' };\n /** Static matches + the source's contribution — what navigation runs over. */\n let filtered: SuggestionItem[] = [];\n let staticMatches: SuggestionItem[] = [];\n let dynamicItems: SuggestionItem[] = [];\n let loading = false;\n let loadingMore = false;\n /** `dynamicItems` answer the previous query; the new one is on its way. */\n let stale = false;\n let error: unknown = null;\n /** The cursor of the source's next page; null when there is none. */\n let nextCursor: string | null = null;\n /** ArrowDown on the last row asked for the page: step onto its first row\n when it lands. */\n let advanceOnLoad = false;\n /** Aborted by a new query or a dismissal: every request still out for the\n old one, first pages and further pages alike, is cancelled and its\n answer dropped. */\n let requests = new AbortController();\n let debounceTimer: ReturnType<typeof setTimeout> | undefined;\n let activeIndex = 0;\n\n /** Level 2 when the text is `<word> <rest>` and the word names a group. */\n const scopeOf = (text: string): Scope => {\n // Any space: an input method for Japanese types a full-width one.\n const space = text.search(/\\s/);\n if (space > 0) {\n const word = commandWord(text.slice(0, space));\n const parent = groups.find((group) => groupWords(group).includes(word));\n if (parent) return { parent, query: text.slice(space + 1) };\n }\n return { parent: null, query: text };\n };\n\n const isOpen = () =>\n session !== null && (filtered.length > 0 || loading || error !== null || scope.parent !== null);\n\n /** Cancels whatever is out. `keep` holds the source's items on screen as\n stale — a new query in the same place — instead of emptying the list. */\n const invalidateSource = (keep = false) => {\n requests.abort();\n requests = new AbortController();\n clearTimeout(debounceTimer);\n stale = keep && dynamicItems.length > 0;\n if (!stale) dynamicItems = [];\n loading = false;\n loadingMore = false;\n error = null;\n nextCursor = null;\n advanceOnLoad = false;\n };\n\n const mergeItems = () => {\n filtered = [...staticMatches, ...dynamicItems];\n if (activeIndex >= filtered.length) activeIndex = Math.max(0, filtered.length - 1);\n };\n\n /** An action that *says* it cannot run right now is not offered: \"Clear\n formatting\" needs a selection a caret's menu never has. Only an explicit\n `isEnabled` counts — a plain command is never asked, since a host's may\n not keep to the dry-run convention and would act on every keystroke. */\n const offered = <T extends SuggestionItem>(items: readonly T[]): readonly T[] => {\n const state = view?.state;\n if (!state) return items;\n return items.filter((item) => item.children || (item.isEnabled?.(state) ?? true));\n };\n\n /** Level 1 matches the menu's items; level 2 a group's list. */\n const matchStatic = (): SuggestionItem[] => {\n const { parent, query } = scope;\n if (!parent) return rankItems(filterItems(offered(allItems), query), query);\n if (typeof parent.children === 'function') return [];\n const children = parent.children.map((child) => localize(child, i18n));\n return rankItems(filterItems(offered(children), query), query);\n };\n\n /** The current level's source: the menu's own, or the group's. */\n const source = (): SuggestionSource | undefined => {\n const { parent } = scope;\n if (!parent) return options.source;\n return typeof parent.children === 'function'\n ? (parent.children as SuggestionSource)\n : undefined;\n };\n\n const pageOf = (answer: Answer) =>\n Array.isArray(answer)\n ? { items: answer, nextCursor: null }\n : { items: answer.items, nextCursor: answer.nextCursor ?? null };\n\n const localized = (items: SuggestionItem[]) => items.map((item) => localize(item, i18n));\n\n /** Asks the source for `cursor`'s page. A synchronous answer lands at\n once; a promise lands (and is emitted) when it resolves, unless its\n request was aborted meanwhile. True while the answer is pending. */\n const ask = (\n cursor: string | null,\n land: (page: { items: SuggestionItem[]; nextCursor: string | null }) => void,\n fail: (reason: unknown) => void,\n ): boolean => {\n const from = source();\n if (!from) return false;\n const { signal } = requests;\n let result: ReturnType<SuggestionSource>;\n try {\n result = from({ query: scope.query, cursor, signal } satisfies SuggestionRequest);\n } catch (reason) {\n fail(reason);\n return false;\n }\n if (typeof (result as PromiseLike<Answer>).then !== 'function') {\n land(pageOf(result as Answer));\n return false;\n }\n Promise.resolve(result).then(\n (answer) => {\n if (signal.aborted || !view) return; // superseded or closed\n land(pageOf(answer));\n emit();\n },\n (reason) => {\n if (signal.aborted || !view) return;\n fail(reason);\n emit();\n },\n );\n return true;\n };\n\n const landFirst = (page: { items: SuggestionItem[]; nextCursor: string | null }) => {\n dynamicItems = localized(page.items);\n nextCursor = page.nextCursor;\n loading = false;\n stale = false;\n mergeItems();\n };\n\n const failFirst = (reason: unknown) => {\n loading = false;\n stale = false;\n dynamicItems = [];\n error = reason ?? new Error('Suggestion source failed');\n mergeItems();\n };\n\n /** A new query: whatever is out is aborted, then the source is asked — at\n once, or after the debounce, `loading` meanwhile. `keep` holds the\n items on screen until the answer replaces them. */\n const querySource = (keep: boolean) => {\n invalidateSource(keep);\n if (!source()) {\n stale = false;\n dynamicItems = [];\n return;\n }\n if (!debounce) {\n loading = ask(null, landFirst, failFirst);\n return;\n }\n loading = true;\n debounceTimer = setTimeout(() => {\n loading = ask(null, landFirst, failFirst);\n // A synchronous answer after the wait has landed but not been emitted.\n if (!loading) emit();\n }, debounce);\n };\n\n const loadMore = () => {\n if (!view || !session || loading || loadingMore || nextCursor === null) return;\n const before = filtered.length;\n loadingMore = ask(\n nextCursor,\n (page) => {\n dynamicItems = [...dynamicItems, ...localized(page.items)];\n nextCursor = page.nextCursor;\n loadingMore = false;\n mergeItems();\n if (advanceOnLoad && filtered.length > before) activeIndex = before;\n advanceOnLoad = false;\n },\n (reason) => {\n loadingMore = false;\n advanceOnLoad = false;\n error = reason ?? new Error('Suggestion source failed');\n },\n );\n emit();\n };\n\n /** Rewrites the session's text after the trigger — the focus stays put. */\n const rewrite = (text: string) => {\n if (!view || !session) return;\n view.dispatch(view.state.tr.insertText(text, session.from + trigger.length, session.to));\n view.focus();\n };\n\n const select = (item: SuggestionItem) => {\n if (!view || !session) return;\n if (item.children) {\n rewrite(`${commandWord(item.title)} `);\n return;\n }\n view.dispatch(view.state.tr.delete(session.from, session.to));\n (item as SuggestionCommandItem).command(view.state, view.dispatch, view);\n view.focus();\n };\n\n const back = () => {\n if (scope.parent) rewrite('');\n };\n\n const clientRect = (): SuggestionRect | null => {\n if (!view || !session) return null;\n const { left, right, top, bottom } = view.coordsAtPos(session.from);\n return { left, right, top, bottom };\n };\n\n /** Sets an attribute on the editor only when its value differs: every\n write is a mutation record ProseMirror's observer has to look at. */\n const setAttr = (dom: HTMLElement, name: string, value: string | null) => {\n if (dom.getAttribute(name) === value) return;\n if (value === null) dom.removeAttribute(name);\n else dom.setAttribute(name, value);\n };\n\n /** The editor as the combobox: which listbox it controls, and which option\n is the active one. Written on the element directly — ProseMirror only\n manages the attributes it was given — and only ever cleared by the menu\n that set them, so a closing menu never wipes an open one's. */\n const describe = () => {\n const dom = view?.dom;\n if (!dom) return;\n if (isOpen()) {\n setAttr(dom, 'aria-controls', listboxId);\n setAttr(dom, 'aria-autocomplete', 'list');\n setAttr(dom, 'aria-activedescendant', filtered.length ? optionId(activeIndex) : null);\n } else if (dom.getAttribute('aria-controls') === listboxId) {\n setAttr(dom, 'aria-controls', null);\n setAttr(dom, 'aria-autocomplete', null);\n setAttr(dom, 'aria-activedescendant', null);\n }\n };\n\n /** The press that dismisses is only listened for while there is something\n to dismiss: a closed menu costs the page's clicks nothing. */\n let watchingOutside = false;\n const watchOutside = (watch: boolean) => {\n if (watch === watchingOutside) return;\n watchingOutside = watch;\n if (watch) window.addEventListener('mousedown', onWindowMousedown);\n else window.removeEventListener('mousedown', onWindowMousedown);\n };\n\n const emit = () => {\n describe();\n watchOutside(isOpen());\n host.onChange({\n open: isOpen(),\n trigger,\n label,\n level: scope.parent ? 2 : 1,\n parent: scope.parent,\n query: scope.query,\n items: filtered,\n activeIndex,\n loading,\n stale,\n loadingMore,\n hasMore: nextCursor !== null,\n error,\n range: session && { from: session.from, to: session.to },\n clientRect,\n listboxId,\n optionId,\n sectionTitle,\n select,\n back,\n loadMore,\n dismiss,\n });\n };\n\n const close = () => {\n session = null;\n scope = { parent: null, query: '' };\n filtered = [];\n staticMatches = [];\n invalidateSource();\n emit();\n };\n\n /** This menu's session for a state — unless another menu's trigger sits\n nearer the caret, in which case that one is the menu that opens. */\n const candidate = (state: EditorState): number | null => sessionOf(state)?.from ?? null;\n\n const ownSession = (state: EditorState): Session | null => {\n const mine = sessionOf(state);\n if (!mine || !view) return mine;\n for (const other of menusOf.get(view) ?? []) {\n if (other === candidate) continue;\n const theirs = other(state);\n if (theirs !== null && theirs > mine.from) return null;\n }\n return mine;\n };\n\n const refresh = () => {\n if (!view) return;\n const previous = session;\n session = key.getState(view.state)?.session ?? null;\n\n if (!session) {\n if (previous) close();\n return;\n }\n\n // A transaction that leaves the session as it was (a mark elsewhere, a\n // sync) changes nothing on screen: no emit, no render.\n if (previous && session.text === previous.text && session.from === previous.from) return;\n\n const previousParent = scope.parent;\n scope = scopeOf(session.text);\n // A new level starts at the top; within a level, a new query too.\n activeIndex = 0;\n staticMatches = matchStatic();\n // The same session on the same level keeps its rows until the new answer\n // replaces them; a new session or a new level starts empty.\n querySource(\n previous !== null && session.from === previous.from && scope.parent === previousParent,\n );\n mergeItems();\n emit();\n };\n\n /** Moves the highlight one row, stopping at the first and last — no wrap.\n At an end nothing changes, so nothing is emitted: a held arrow key\n against the bottom costs no renders. The one exception is the bottom\n of a list with more pages: there the arrow *is* the scroll — the next\n page is fetched (once, however long the key is held) and the highlight\n steps onto its first row when it lands. */\n const move = (step: 1 | -1) => {\n const next = Math.min(Math.max(activeIndex + step, 0), filtered.length - 1);\n if (step === 1 && next === activeIndex && nextCursor !== null && !loadingMore) {\n advanceOnLoad = true;\n loadMore();\n return;\n }\n if (next === activeIndex) return;\n activeIndex = next;\n emit();\n };\n\n const onKeyDown = (event: KeyboardEvent): boolean => {\n // While a source is still loading the menu is open (a \"Searching…\" row),\n // so Escape must dismiss it — but item keys need actual items.\n if (!isOpen()) return false;\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!filtered.length) return scope.parent !== null;\n move(event.key === 'ArrowDown' ? 1 : -1);\n // Taken even at an end: the caret must not leave the query line.\n return true;\n case 'Enter':\n case 'Tab':\n // Inside a group the keys belong to the picker, even with nothing\n // (yet) to pick — no stray line break under a \"Searching…\" row.\n if (!filtered.length) return scope.parent !== null;\n // A stale row answers the last query, not this one: typing \"comp\"\n // and pressing Enter must not insert what \"co\" found. The key waits\n // (taken, nothing applied) until the new page is in.\n if (stale && activeIndex >= staticMatches.length) return true;\n select(filtered[activeIndex]);\n return true;\n case 'Escape':\n dismiss();\n return true;\n default:\n return false;\n }\n };\n\n /** Dismissal is a transaction: the plugin's state takes note of where, the\n decoration goes with it, and the view's update closes the menu. */\n const dismiss = () => {\n if (!view || !session) return;\n view.dispatch(view.state.tr.setMeta(key, { dismiss: true } satisfies SessionMeta));\n };\n\n // Keep clicks on menu items (and its scrollbar) from blurring the editor.\n const onMenuMousedown = (event: Event) => event.preventDefault();\n\n // One highlight, whoever moves it: the pointer over a row takes the\n // keyboard's highlight there, so hover and highlight are never two rows.\n // The row is known by the id this plugin handed out. Only a pointer that\n // really moved counts — a list scrolling (or opening) under a resting one\n // sends moves too, from the same spot. Listened to natively and emitted\n // only when the row changes: crossing the menu renders nothing else.\n let pointer: { x: number; y: number } | undefined;\n const optionPrefix = `${listboxId}-option-`;\n const onMenuMousemove = (event: MouseEvent) => {\n const moved = pointer && (pointer.x !== event.clientX || pointer.y !== event.clientY);\n pointer = { x: event.clientX, y: event.clientY };\n if (!moved || !isOpen()) return;\n const option = (event.target as Element | null)?.closest?.('[role=\"option\"]');\n if (!option?.id.startsWith(optionPrefix)) return;\n const index = Number(option.id.slice(optionPrefix.length));\n if (!Number.isInteger(index) || index >= filtered.length || index === activeIndex) return;\n activeIndex = index;\n emit();\n };\n\n // Any press that is not on the menu dismisses — first click, focus or not.\n // That includes clicks inside the editable: blank space maps to the nearest\n // text position, which can be exactly where the cursor already sits (right\n // after the query), so no selection change would ever close the session.\n // If the cursor lands after the same trigger again, the dismissal keeps it shut.\n const onWindowMousedown = (event: MouseEvent) => {\n if (element.contains(event.target as Node | null)) return;\n dismiss();\n };\n\n // Fallback for focus leaving without a mousedown (e.g. Tab). Deferred a\n // frame to ride out transient blurs (same pattern as the bubble menu).\n const onBlur = (event: FocusEvent) => {\n if (element.contains(event.relatedTarget as Node | null)) return;\n requestAnimationFrame(() => {\n if (!view) return;\n if (view.hasFocus() || element.contains(element.ownerDocument.activeElement)) return;\n dismiss();\n });\n };\n\n return new Plugin<SessionState>({\n key,\n state: {\n init: (_config, state) => ({ session: ownSession(state), dismissed: null }),\n apply: (tr, previous, _oldState, state) => {\n const dismiss = (tr.getMeta(key) as SessionMeta | undefined)?.dismiss === true;\n // A session is read from the text before the caret: a transaction\n // that moved neither (another plugin's meta) has no news.\n if (!dismiss && !tr.docChanged && !tr.selectionSet) return previous;\n\n const next = ownSession(state);\n // A dismissal stays with its trigger as the text moves — what is\n // typed or synced in before it does not make it a new one — and\n // lasts until the caret has been anywhere else.\n const place = dismiss && previous.session ? previous.session.from : previous.dismissed;\n let dismissed = place === null ? null : tr.mapping.map(place, 1);\n if (dismissed !== null && next?.from !== dismissed) dismissed = null;\n const session = next && next.from !== dismissed ? next : null;\n // Before anything reads the labels: the level a text is on (and with\n // it the decoration) depends on what the groups are called now.\n // A new session is one that starts somewhere else — also straight\n // after one that found nothing and so never showed.\n if (session && session.from !== previous.session?.from) relabel();\n\n return sameSession(session, previous.session) && dismissed === previous.dismissed\n ? previous\n : { session, dismissed };\n },\n },\n props: {\n handleKeyDown: (_view, event) => onKeyDown(event),\n // The session, marked in the text — from the state being rendered, so\n // it is never a transaction behind.\n decorations: (state) => {\n const current = key.getState(state)?.session;\n if (!current) return null;\n // Empty is the *level's* query: after the bare trigger, and again\n // after a group's word and its space — each with its own words.\n const level = scopeOf(current.text);\n const empty = level.query === '';\n const hint = level.parent ? level.parent.placeholder : placeholder;\n return DecorationSet.create(state.doc, [\n Decoration.inline(current.from, current.to, {\n nodeName: 'span',\n class: empty ? 'aee-suggestion aee-suggestion-empty' : 'aee-suggestion',\n 'data-trigger': trigger,\n 'data-level': level.parent ? '2' : '1',\n ...(empty && hint ? { 'data-placeholder': hint } : {}),\n }),\n ]);\n },\n },\n view: (editorView) => {\n view = editorView;\n const menus = menusOf.get(editorView) ?? new Set();\n menus.add(candidate);\n menusOf.set(editorView, menus);\n element.addEventListener('mousedown', onMenuMousedown);\n element.addEventListener('mousemove', onMenuMousemove);\n editorView.dom.addEventListener('blur', onBlur);\n refresh();\n return {\n // The plugin's state keeps its identity while the session does.\n update: (updated, previous) => {\n if (key.getState(previous) === key.getState(updated.state)) return;\n refresh();\n },\n destroy: () => {\n editorView.dom.removeEventListener('blur', onBlur);\n watchOutside(false);\n element.removeEventListener('mousemove', onMenuMousemove);\n element.removeEventListener('mousedown', onMenuMousedown);\n menus.delete(candidate);\n invalidateSource();\n session = null;\n describe();\n view = undefined;\n },\n };\n },\n });\n}\n","import {\n Fragment,\n Node as ProseMirrorNode,\n DOMParser as ProseMirrorDOMParser,\n Slice,\n} from 'prosemirror-model';\nimport { EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\n\n/** Where a stream is writing: what it has written so far. */\nexport interface ContentStreamRange {\n from: number;\n to: number;\n}\n\n/** What the extension reports: whether something is streaming in, and where. */\nexport interface ContentStreamState {\n streaming: boolean;\n range: ContentStreamRange | null;\n}\n\n/** How a stream shows what has come in — see {@link ContentStreamOptions.reveal}. */\nexport type ContentStreamReveal = 'block' | 'character' | 'instant';\n\nexport interface ContentStreamOptions {\n /** A caret after the last thing written — a widget, `span.aee-stream-caret`,\n for the host's stylesheet; the library paints nothing. Default true. */\n caret?: boolean;\n /**\n * How what has come in is *revealed*. A model's tokens come in bursts — a\n * word, a pause, three words — and written as they come they read like a\n * slide show.\n *\n * - `'block'` (the default): a block — a paragraph, a list item, a line of\n * plain text — shows *whole*, once all of it is in: when the next one\n * starts, or the stream ends. Nothing types; blocks that land together\n * follow each other a beat apart. The caret waits after the last one.\n * - `'character'`: a steady pace, a character or a few a frame, never\n * splitting one: faster when it falls behind, slower as it catches up.\n * - `'instant'`: each piece the moment it comes.\n *\n * The stream ends — and `done` settles — once all of it shows.\n */\n reveal?: ContentStreamReveal;\n /**\n * How long, in ms, what was just revealed is *fresh*: it carries\n * `aee-stream-fresh` — with `--email-stream-fade-in` set to this duration\n * — for the host's stylesheet to fade it in; the library paints nothing.\n * A block revealed whole carries it *itself* (the `p`, the `li`), so it\n * can be wiped or moved as well as faded; text that joins a line already\n * there, and everything under `'character'`, is wrapped in a `span`.\n * Default 600; 0 marks nothing.\n */\n fadeIn?: number;\n /** Escape stops the stream mid-way. Default true. */\n stopOnEscape?: boolean;\n /** Told when a stream starts, writes, and ends. */\n onChange?: (state: ContentStreamState) => void;\n}\n\n/** What {@link streamContent}'s callback writes with. */\nexport interface ContentStreamWriter {\n /** Appends a piece of the content — a token, a word, a chunk of a\n response body. A no-op once the stream has been stopped. */\n write(partial: string): void;\n /** A `WritableStream` that writes what is piped into it — text, or bytes\n decoded as UTF-8: `response.body.pipeTo(writer.getWritableStream())`. */\n getWritableStream(): WritableStream<string | Uint8Array>;\n /** Aborts when the stream is stopped — Escape, `stop()`, the editor going\n away. Hand it to `fetch` or to the model's client. */\n readonly signal: AbortSignal;\n}\n\nexport interface StreamContentOptions {\n /**\n * What the pieces are. `'text'` (the default) is appended as it comes.\n * `'html'` is *re-read as a whole* on every write: the pieces collect in a\n * buffer, the buffer is parsed through the schema, and what has been\n * written so far is replaced by the result — so a list or a bold word\n * takes shape as it streams, and a tag split over two pieces never shows\n * as text.\n */\n format?: 'text' | 'html';\n /** Rewrites the buffer before it is parsed (`'html'`) — strip a code\n fence, turn Markdown into HTML. Given everything received so far. */\n transform?: (buffer: string) => string;\n /** Whether what is written enters the undo history. Default true: the\n pieces undo as one. `false` keeps the writing out of it — for content\n that is only *proposed* (see `proposeContent`), which is committed or\n taken back as a whole later, so that neither undoes anything else. */\n history?: boolean;\n}\n\n/** A stream in progress. */\nexport interface ContentStreamRun {\n /** Stops it where it is: what shows stays, what has come in but not shown\n yet does not. */\n stop(): void;\n /** True once the callback has finished and all of it shows; false when it\n was stopped first. Rejects with what the callback threw, if it was not\n an abort. */\n readonly done: Promise<boolean>;\n}\n\ninterface StreamPluginState {\n range: ContentStreamRange | null;\n /** The text still fading in — it outlives the stream by a moment. */\n fresh: DecorationSet;\n}\n\n/** What a stream's own transaction says: where it is now (`null`: it has\n ended), and what is fresh. */\ninterface StreamMeta {\n range?: ContentStreamRange | null;\n fresh?: DecorationSet;\n}\n\n/** Freshly revealed, at `at` (`performance.now()`). */\ninterface FreshSpec {\n at: number;\n}\n\nconst key = new PluginKey<StreamPluginState>('contentStream');\n\n/** What a transaction of a stream says about where the stream is now —\n for another plugin (a proposal's) to follow the range as precisely as\n the stream itself does: `undefined` when the transaction is not the\n stream's own, `null` when the stream ended with it. */\nexport const streamedRange = (tr: Transaction): ContentStreamRange | null | undefined =>\n (tr.getMeta(key) as StreamMeta | undefined)?.range;\n\n/** What the running stream of each editor is aborted with. */\nconst running = new WeakMap<EditorView, AbortController>();\n\n/** How each editor's extension was set up — for `streamContent` to read. */\nconst settings = new WeakMap<EditorView, { reveal: ContentStreamReveal; fadeIn: number }>();\n\n/** How far behind the reveal may fall before it hurries: it closes the gap\n with this time constant, in ms — a burst glides in rather than landing. */\nconst CATCH_UP = 180;\n\n/** The slowest it reveals, in characters a second — so a tail finishes. */\nconst MIN_RATE = 45;\n\n/** `'block'`: how long after one block the next may show, in ms — blocks\n that come in together cascade rather than land as one. */\nconst STAGGER = 110;\n\n/** Where a character — or a leaf, a merge tag — would stand in for itself. */\nconst LEAF = '';\n\n/** Whether content is streaming into the editor — for an action that starts\n one to say it cannot run again yet. */\nexport const isStreaming = (state: EditorState): boolean => !!key.getState(state)?.range;\n\n/** Where content is streaming in, if it is. */\nexport const streamingRange = (state: EditorState): ContentStreamRange | null =>\n key.getState(state)?.range ?? null;\n\n/** An HTML fragment as an *open* slice: its first line joins the line it is\n written into, the way typed text would. A tag cut off at the buffer's\n end — `<stro` — is left out until the rest of it arrives. */\nfunction parseFragment(html: string, state: EditorState): Slice {\n const dom = new window.DOMParser().parseFromString(html.replace(/<[^>]*$/, ''), 'text/html');\n return ProseMirrorDOMParser.fromSchema(state.schema).parseSlice(dom.body);\n}\n\n/** What a reveal counts through: each character of text, each inline leaf\n (a merge tag, a line break) as one. */\nfunction unitsOf(fragment: Fragment): string {\n let units = '';\n fragment.descendants((node) => {\n if (node.isText) units += node.text;\n else if (node.isInline && node.isLeaf) units += LEAF;\n });\n return units;\n}\n\n/** Where, counted in units, each block of `fragment` that has any ends. */\nfunction blockEnds(fragment: Fragment): number[] {\n const ends: number[] = [];\n let count = 0;\n fragment.descendants((node) => {\n if (node.isTextblock) {\n const size = unitsOf(node.content).length;\n if (size) ends.push((count += size));\n return false;\n }\n if (node.isText) count += node.text!.length;\n else if (node.isInline && node.isLeaf) count += 1;\n return true;\n });\n // Inline content outside any block is one of its own.\n if (count && ends.at(-1) !== count) ends.push(count);\n return ends;\n}\n\n/** The same for plain text: a block is a line. */\nfunction lineEnds(text: string): number[] {\n const ends: number[] = [];\n for (const match of text.matchAll(/\\n+/g)) {\n if (match.index > 0) ends.push(match.index + match[0].length);\n }\n if (text.length && ends.at(-1) !== text.length) ends.push(text.length);\n return ends;\n}\n\n/**\n * What marks `start`–`end` fresh. With `blocks`, a text block that is fresh\n * through and through is marked *itself* — or what it opens, a list item,\n * if the stream wrote that too — so a stylesheet can wipe or move it;\n * anything less is an inline stretch. Which of the two never changes while\n * a block is fresh: a fade that started is not started again.\n */\nfunction freshDecorations(\n doc: ProseMirrorNode,\n from: number,\n start: number,\n end: number,\n blocks: boolean,\n spec: FreshSpec,\n fadeIn: number,\n): Decoration[] {\n const attrs = { class: 'aee-stream-fresh', style: `--email-stream-fade-in: ${fadeIn}ms` };\n if (!blocks) return end > start ? [Decoration.inline(start, end, attrs, spec)] : [];\n const decorations: Decoration[] = [];\n doc.nodesBetween(start, end, (node, pos, _parent, index) => {\n if (!node.isTextblock) return true;\n const inner = pos + 1;\n const innerEnd = pos + node.nodeSize - 1;\n if (start <= inner && end >= innerEnd) {\n const $pos = doc.resolve(pos);\n const opens = index === 0 && $pos.depth > 0 && $pos.before() >= from;\n if (opens) decorations.push(Decoration.node($pos.before(), $pos.after(), attrs, spec));\n else decorations.push(Decoration.node(pos, pos + node.nodeSize, attrs, spec));\n } else if (Math.min(end, innerEnd) > Math.max(start, inner)) {\n decorations.push(\n Decoration.inline(Math.max(start, inner), Math.min(end, innerEnd), attrs, spec),\n );\n }\n return false;\n });\n return decorations;\n}\n\n/** The position right after the first `count` units between `from` and\n `to` — so a block only shows once its first character does. */\nfunction positionAfter(doc: ProseMirrorNode, from: number, to: number, count: number): number {\n let seen = 0;\n let at = from;\n doc.nodesBetween(from, to, (node, pos) => {\n if (seen >= count) return false;\n if (node.isText) {\n const start = Math.max(from, pos);\n const take = Math.min(Math.min(to, pos + node.nodeSize) - start, count - seen);\n seen += take;\n at = start + take;\n } else if (node.isInline && node.isLeaf && pos >= from && pos + node.nodeSize <= to) {\n seen += 1;\n at = pos + node.nodeSize;\n }\n return true;\n });\n return at;\n}\n\n/** Where the next character ends, from `index` on — so a reveal never\n shows half an emoji or a letter without its accent. */\nconst segmenter =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n : null;\n\nfunction graphemeEnd(units: string, from: number, index: number): number {\n if (index <= from || index >= units.length) return Math.min(index, units.length);\n if (!segmenter) {\n const code = units.charCodeAt(index - 1);\n return code >= 0xd800 && code <= 0xdbff ? index + 1 : index;\n }\n for (const { index: start, segment } of segmenter.segment(units.slice(from))) {\n const end = from + start + segment.length;\n if (end >= index) return end;\n }\n return units.length;\n}\n\nconst now = () => performance.now();\n\n/** Each frame, if the page shows — otherwise on the next task, since a\n hidden tab never paints. */\nconst nextFrame = (callback: () => void) =>\n typeof requestAnimationFrame === 'function' && !document.hidden\n ? requestAnimationFrame(() => callback())\n : setTimeout(callback, 16);\n\n/**\n * Lets content **stream into the document** — a model's answer, a slow\n * import — and owns everything around that: where the next piece goes while\n * the writer keeps typing, how it shows — block by block — a caret, the fade\n * on what is new, `aria-busy` on the editor, Escape to stop, the abort signal,\n * the end. Install it, then call {@link streamContent}:\n *\n * createEditor({ extensions: [...kit, createContentStream()] })\n *\n * streamContent(editor.view, editor.state.selection.from, async ({ write, signal }) => {\n * for await (const token of model.stream(prompt, { signal })) write(token);\n * });\n *\n * One stream at a time per editor. What it writes is ordinary content in\n * ordinary transactions: it is in the document, in the HTML, and in the undo\n * history — pieces that follow each other closely undo as one.\n */\nexport const createContentStream = (options: ContentStreamOptions = {}): FunctionalExtension => {\n const { caret = true, reveal = 'block', fadeIn = 600, stopOnEscape = true } = options;\n\n return defineExtension({\n name: 'contentStream',\n plugins: () => [\n new Plugin<StreamPluginState>({\n key,\n state: {\n init: () => ({ range: null, fresh: DecorationSet.empty }),\n apply: (tr, previous) => {\n const meta = tr.getMeta(key) as StreamMeta | undefined;\n let { range, fresh } = previous;\n if (tr.docChanged) {\n fresh = fresh.map(tr.mapping, tr.doc);\n // Someone else's edit: what is typed right at either edge is\n // theirs, not the stream's — the range closes in, never out,\n // so a re-read (`'html'`) cannot write over it.\n if (range) {\n const from = tr.mapping.map(range.from, 1);\n range = { from, to: Math.max(from, tr.mapping.map(range.to, -1)) };\n }\n }\n if (meta?.range !== undefined) range = meta.range;\n if (meta?.fresh) fresh = meta.fresh;\n return range === previous.range && fresh === previous.fresh\n ? previous\n : { range, fresh };\n },\n },\n props: {\n decorations: (state) => {\n const { range, fresh } = key.getState(state)!;\n if (!range || !caret) return fresh;\n const widget = () => {\n const element = document.createElement('span');\n element.className = 'aee-stream-caret';\n element.setAttribute('aria-hidden', 'true');\n return element;\n };\n return fresh.add(state.doc, [\n Decoration.widget(range.to, widget, { side: 1, key: 'stream-caret' }),\n ]);\n },\n // The editor says it is busy while content comes in.\n attributes: (state): Record<string, string> =>\n isStreaming(state) ? { 'aria-busy': 'true' } : {},\n handleKeyDown: (view, event) => {\n if (!stopOnEscape || event.key !== 'Escape' || !isStreaming(view.state)) return false;\n running.get(view)?.abort();\n return true;\n },\n },\n view: (editorView) => {\n settings.set(editorView, { reveal, fadeIn });\n /** A frame is asked for to let fresh text go stale. */\n let waiting = false;\n const expire = () => {\n waiting = false;\n if (editorView.isDestroyed) return;\n const { fresh } = key.getState(editorView.state)!;\n const time = now();\n const stale = fresh.find(\n undefined,\n undefined,\n (spec: FreshSpec) => time - spec.at >= fadeIn,\n );\n if (stale.length) {\n const meta: StreamMeta = { fresh: fresh.remove(stale) };\n editorView.dispatch(editorView.state.tr.setMeta(key, meta));\n } else if (fresh !== DecorationSet.empty) {\n schedule(fresh);\n }\n };\n const schedule = (fresh: DecorationSet) => {\n if (waiting || fresh === DecorationSet.empty || !fresh.find().length) return;\n waiting = true;\n nextFrame(expire);\n };\n return {\n update: (view, previous) => {\n const state = key.getState(view.state)!;\n schedule(state.fresh);\n const before = key.getState(previous)!;\n if (state.range === before.range) return;\n options.onChange?.({ streaming: state.range !== null, range: state.range });\n },\n // The editor going away stops what was writing into it.\n destroy: () => running.get(editorView)?.abort(),\n };\n },\n }),\n ],\n });\n};\n\n/**\n * Streams content into the document at `target` — a position, or a range\n * that the first piece replaces (\"rewrite this selection\"). `callback` does\n * the writing; the stream ends when it returns and all it wrote shows.\n *\n * Needs {@link createContentStream} among the editor's extensions, and no\n * other stream running (ask {@link isStreaming}).\n */\nexport function streamContent(\n view: EditorView,\n target: number | ContentStreamRange,\n callback: (writer: ContentStreamWriter) => Promise<void> | void,\n options: StreamContentOptions = {},\n): ContentStreamRun {\n if (key.get(view.state) === undefined) {\n throw new Error('streamContent: add createContentStream() to the editor’s extensions');\n }\n if (isStreaming(view.state)) throw new Error('streamContent: a stream is already running');\n\n const { format = 'text', transform, history = true } = options;\n const { reveal: mode, fadeIn } = settings.get(view) ?? { reveal: 'instant', fadeIn: 0 };\n const controller = new AbortController();\n const { signal } = controller;\n running.set(view, controller);\n\n /** A transaction of this stream's own: kept out of the history if asked. */\n const own = (tr: Transaction): Transaction => (history ? tr : tr.setMeta('addToHistory', false));\n\n const start = typeof target === 'number' ? { from: target, to: target } : target;\n // A new stream starts with nothing fresh: what an earlier one left fading\n // is simply done.\n const begin: StreamMeta = { range: start, fresh: DecorationSet.empty };\n view.dispatch(own(view.state.tr).setMeta(key, begin));\n\n let buffer = '';\n /** What there is to reveal: `buffer`'s text, or its HTML's read. */\n let units = '';\n /** `'block'`: where in `units` each block ends — the last is still open\n until the stream has finished. */\n let ends: number[] = [];\n /** `'html'`: the buffer as read, and whether the space it opens with is\n put back (a parser drops it). */\n let parsed: { slice: Slice; space: boolean } | null = null;\n /** How much shows — `progress` is where the pace has got to between two. */\n let shown = 0;\n let progress = 0;\n /** Stretches of what shows that are still fresh, as offsets into `units`. */\n let fresh: Array<{ from: number; to: number; at: number }> = [];\n let finished = false;\n let drained: () => void = () => undefined;\n const drainedAll = new Promise<void>((resolve) => (drained = resolve));\n\n /** Shows `units` up to `count` — and tells which of it is new. */\n const reveal = (count: number) => {\n const range = key.getState(view.state)?.range;\n if (!range || view.isDestroyed) return;\n const time = now();\n const tr = view.state.tr;\n let { from, to } = range;\n\n if (parsed) {\n tr.replaceRange(from, to, parsed.slice);\n if (parsed.space) tr.insertText(' ', from);\n from = tr.mapping.map(from, -1);\n to = tr.mapping.map(to, 1);\n // What has not been revealed yet is cut off again — a block is not\n // there before its first character is.\n if (count < units.length) {\n const mark = tr.steps.length;\n tr.delete(positionAfter(tr.doc, from, to, count), to);\n to = tr.mapping.slice(mark).map(to, 1);\n }\n } else if (count > shown) {\n // Text is appended — but its first piece takes the place of a range.\n if (shown === 0) tr.insertText(units.slice(0, count), from, to);\n else tr.insertText(units.slice(shown, count), to);\n from = tr.mapping.map(from, -1);\n to = tr.mapping.map(to, 1);\n }\n\n const meta: StreamMeta = { range: { from, to } };\n if (fadeIn > 0) {\n if (count > shown) fresh.push({ from: shown, to: count, at: time });\n fresh = fresh.filter((stretch) => time - stretch.at < fadeIn);\n meta.fresh = DecorationSet.create(\n tr.doc,\n fresh.flatMap((stretch) =>\n freshDecorations(\n tr.doc,\n from,\n positionAfter(tr.doc, from, to, stretch.from),\n positionAfter(tr.doc, from, to, stretch.to),\n mode === 'block',\n { at: stretch.at },\n fadeIn,\n ),\n ),\n );\n }\n shown = count;\n view.dispatch(own(tr).setMeta(key, meta));\n };\n\n /** Pacing: a frame's worth more of what has come in — or the next block. */\n let pacing = false;\n let last = 0;\n let lastBlock = -Infinity;\n const pace = () => {\n if (signal.aborted || view.isDestroyed) {\n pacing = false;\n return;\n }\n const time = now();\n if (mode === 'block') {\n // The last block is whole only once nothing more can come.\n const whole = finished ? units.length : (ends.at(-2) ?? 0);\n const next = ends.find((blockEnd) => blockEnd > shown && blockEnd <= whole);\n if (next !== undefined) {\n if (time - lastBlock >= STAGGER) {\n lastBlock = time;\n reveal(next);\n }\n nextFrame(pace);\n return;\n }\n pacing = false;\n if (finished) drained();\n return;\n }\n const elapsed = Math.max(0, time - last) / 1000;\n last = time;\n const behind = units.length - progress;\n const step = Math.max(\n behind * (1 - Math.exp(-elapsed / (CATCH_UP / 1000))),\n MIN_RATE * elapsed,\n );\n progress = Math.min(units.length, progress + step);\n const count = graphemeEnd(units, shown, Math.floor(progress));\n // (Fewer than show: a transform read the buffer anew — `**bo` became\n // bold — and what shows shrinks with it.)\n if (count !== shown) reveal(count);\n progress = Math.max(progress, shown);\n if (shown < units.length) {\n nextFrame(pace);\n return;\n }\n pacing = false;\n if (finished) drained();\n };\n\n const startPacing = () => {\n if (pacing) return;\n pacing = true;\n last = now();\n nextFrame(pace);\n };\n\n const write = (partial: string) => {\n if (signal.aborted || view.isDestroyed || !partial || !isStreaming(view.state)) return;\n buffer += partial;\n if (format === 'html') {\n const html = transform ? transform(buffer) : buffer;\n const range = key.getState(view.state)!.range!;\n const slice = parseFragment(html, view.state);\n // A parser drops the space an answer opens with — the one that keeps\n // it from running into the word it follows.\n const space = /^\\s/.test(html) && view.state.doc.resolve(range.from).parent.isTextblock;\n parsed = { slice, space };\n units = (space ? ' ' : '') + unitsOf(slice.content);\n if (mode === 'block') ends = blockEnds(slice.content).map((at) => at + (space ? 1 : 0));\n } else {\n units = buffer;\n if (mode === 'block') ends = lineEnds(units);\n }\n // A hidden tab never paints: there is nothing to pace.\n if (mode === 'instant' || document.hidden) {\n progress = units.length;\n return reveal(units.length);\n }\n startPacing();\n };\n\n const getWritableStream = () => {\n const decoder = new TextDecoder();\n return new WritableStream<string | Uint8Array>({\n write: (chunk) =>\n write(typeof chunk === 'string' ? chunk : decoder.decode(chunk, { stream: true })),\n });\n };\n\n // A run ends once. It is asked to twice — by the abort, at once, and by\n // `done` settling, later — and by then another run may have started in\n // its place (a host that stops one answer to ask for the next): the\n // second ending must not close *that* one's range.\n let ended = false;\n const end = () => {\n if (ended) return;\n ended = true;\n if (running.get(view) === controller) running.delete(view);\n if (!view.isDestroyed && isStreaming(view.state)) {\n view.dispatch(own(view.state.tr).setMeta(key, { range: null } satisfies StreamMeta));\n }\n };\n\n // Stopped from anywhere — Escape, `stop()` — the stream ends at once, not\n // when the callback next notices.\n signal.addEventListener('abort', end, { once: true });\n\n const work = (async () => callback({ write, getWritableStream, signal }))();\n // Settled by whichever comes first: a stop does not wait for a callback\n // that is slow to notice — or never does.\n const done = Promise.race([\n work.then(async () => {\n // All of it written, not all of it shown: the pace catches up first.\n // (And the last block, whole only now, is still to come.)\n finished = true;\n if (!signal.aborted && shown < units.length) {\n startPacing();\n await drainedAll;\n }\n return !signal.aborted;\n }),\n new Promise<boolean>((resolve) =>\n signal.addEventListener('abort', () => resolve(false), { once: true }),\n ),\n ])\n .catch((reason: unknown) => {\n if (signal.aborted || (reason as { name?: string })?.name === 'AbortError') return false;\n throw reason;\n })\n .finally(end);\n // What a stopped callback throws later is nobody's failure.\n work.catch(() => undefined);\n\n return { stop: () => controller.abort(), done };\n}\n","import { Plugin, PluginKey, TextSelection, Transaction } from 'prosemirror-state';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { closeHistory } from 'prosemirror-history';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport {\n ContentStreamRange,\n ContentStreamRun,\n ContentStreamWriter,\n StreamContentOptions,\n isStreaming,\n streamContent,\n streamedRange,\n} from './content-stream';\n\n/** What the extension reports: whether something is proposed, and where. */\nexport interface ContentProposalState {\n range: ContentStreamRange | null;\n /** The proposal is still being written. */\n streaming: boolean;\n}\n\nexport interface ContentProposalOptions {\n /** The class on what is proposed — `aee-proposal` — for the host's\n stylesheet: the library paints nothing. */\n className?: string;\n /** Told when a proposal starts, grows, and ends — accepted or discarded. */\n onChange?: (state: ContentProposalState) => void;\n}\n\ninterface ProposalMeta {\n range: ContentStreamRange | null;\n /** Whether the range follows the stream's own (a fresh proposal) or only\n maps through it (a revision of a part, streamed inside it). */\n snap?: boolean;\n}\n\ninterface ProposalPluginState {\n range: ContentStreamRange;\n snap: boolean;\n}\n\nconst key = new PluginKey<ProposalPluginState | null>('contentProposal');\n\n/** What each editor's running proposal is stopped with. */\nconst runs = new WeakMap<EditorView, ContentStreamRun>();\n\n/** Whether something is proposed in the editor — written, but not the\n writer's yet. */\nexport const isProposing = (state: EditorView['state']): boolean => !!key.getState(state);\n\n/** Where the proposal stands, if there is one. */\nexport const proposalRange = (state: EditorView['state']): ContentStreamRange | null =>\n key.getState(state)?.range ?? null;\n\n/**\n * Lets content be **proposed** into the document — an assistant's answer,\n * shown in the text where it would go, before the writer decides. It is\n * real content, in the document and in the HTML, so a list forms and a\n * bold phrase arrives bold where they will stand; but it is marked\n * (`aee-proposal`, for the host to paint), it stays out of the undo history,\n * and it ends one of two ways: {@link acceptProposal} commits it, as one\n * change — one undo — and {@link discardProposal} takes it out, leaving the\n * document and its history exactly as they were. Nothing else touches\n * either: a second proposal replaces the first, the editor going away\n * discards.\n *\n * Opt-in, on top of the content stream:\n *\n * createEditor({ extensions: [...kit, createContentStream(), createContentProposal()] })\n *\n * proposeContent(editor.view, editor.state.selection.from, async ({ write, signal }) => {\n * for await (const token of model.stream(prompt, { signal })) write(token);\n * }, { format: 'html' });\n *\n * The Angular side — `injectProposal`, the accept and discard triggers, an\n * input's keys — is `@h-k-dev/angular-email-editor/proposal`, its own entry: a host\n * that brings its own panel imports what it uses.\n */\nexport const createContentProposal = (\n options: ContentProposalOptions = {},\n): FunctionalExtension => {\n const { className = 'aee-proposal' } = options;\n return defineExtension({\n name: 'contentProposal',\n plugins: () => [\n new Plugin<ProposalPluginState | null>({\n key,\n state: {\n init: () => null,\n apply: (tr, previous) => {\n const meta = tr.getMeta(key) as ProposalMeta | undefined;\n if (meta) return meta.range ? { range: meta.range, snap: meta.snap ?? true } : null;\n if (!previous) return null;\n let { range } = previous;\n const { snap } = previous;\n // A fresh proposal follows the stream's own transaction, which\n // says exactly where it has got to. A revision streams *inside*\n // the proposal: the range maps through it like any change —\n // closing in at the edges, as the stream's does, so a stray edit\n // there is not proposed — but never below the stream's end.\n const streamed = streamedRange(tr);\n if (streamed && snap) return { range: streamed, snap };\n if (tr.docChanged) {\n const from = tr.mapping.map(range.from, 1);\n const to = Math.max(from, tr.mapping.map(range.to, -1), streamed?.to ?? from);\n range = { from, to };\n }\n return range === previous.range ? previous : { range, snap };\n },\n },\n props: {\n decorations: (state) => {\n const range = key.getState(state)?.range;\n if (!range || range.to <= range.from) return null;\n return DecorationSet.create(state.doc, [\n Decoration.inline(range.from, range.to, { class: className }),\n ]);\n },\n },\n view: (editorView) => ({\n update: (view, previous) => {\n const range = key.getState(view.state)?.range ?? null;\n const before = key.getState(previous)?.range ?? null;\n const streaming = !!range && isStreaming(view.state);\n const was = !!before && isStreaming(previous);\n if (range === before && streaming === was) return;\n options.onChange?.({ range, streaming });\n },\n // The editor going away takes its proposal with it — nothing is\n // committed by accident.\n destroy: () => runs.get(editorView)?.stop(),\n }),\n }),\n ],\n });\n};\n\n/**\n * Proposes content at `target` — a position, or a range the proposal\n * replaces — streamed in by `callback` (see `streamContent`, whose options\n * these are). A proposal already there is discarded first. Needs\n * {@link createContentProposal} and `createContentStream` in the kit.\n */\nexport function proposeContent(\n view: EditorView,\n target: number | ContentStreamRange,\n callback: (writer: ContentStreamWriter) => Promise<void> | void,\n options: Omit<StreamContentOptions, 'history'> = {},\n): ContentStreamRun {\n if (key.get(view.state) === undefined) {\n throw new Error('proposeContent: add createContentProposal() to the editor’s extensions');\n }\n let start = typeof target === 'number' ? { from: target, to: target } : target;\n // A proposal already there goes first — and the target, given with it\n // still in the text (the caret at its end, say), is mapped through its\n // going: a position inside it lands where it began.\n const discard = discardTransaction(view);\n if (discard) {\n start = {\n from: discard.mapping.map(start.from, -1),\n to: discard.mapping.map(start.to, -1),\n };\n view.dispatch(discard);\n }\n view.dispatch(\n view.state.tr\n .setMeta(key, { range: start } satisfies ProposalMeta)\n .setMeta('addToHistory', false),\n );\n const run = streamContent(view, start, callback, { ...options, history: false });\n runs.set(view, run);\n run.done.finally(() => {\n if (runs.get(view) === run) runs.delete(view);\n });\n return run;\n}\n\n/**\n * Revises a *part* of the proposal: `range`, inside it, is replaced by what\n * `callback` streams — \"rewrite this bit\" — while the rest of the proposal\n * stands, still proposed, and the whole is accepted or discarded together\n * as before. Null (and nothing streamed) when no proposal holds the range.\n */\nexport function reviseProposal(\n view: EditorView,\n range: ContentStreamRange,\n callback: (writer: ContentStreamWriter) => Promise<void> | void,\n options: Omit<StreamContentOptions, 'history'> = {},\n): ContentStreamRun | null {\n const current = key.getState(view.state);\n if (!current || range.from < current.range.from || range.to > current.range.to) return null;\n stopProposal(view);\n // Mapping, not following: the stream's range is the part's, not the\n // proposal's.\n view.dispatch(\n view.state.tr\n .setMeta(key, { range: current.range, snap: false } satisfies ProposalMeta)\n .setMeta('addToHistory', false),\n );\n const run = streamContent(view, range, callback, { ...options, history: false });\n runs.set(view, run);\n run.done.finally(() => {\n if (runs.get(view) === run) runs.delete(view);\n });\n return run;\n}\n\n/** Stops the writing where it is; what is proposed stays proposed. */\nexport function stopProposal(view: EditorView): void {\n runs.get(view)?.stop();\n}\n\n/**\n * Takes the proposal into the document for good: the same content, now\n * the writer's own — one change in the history, so one undo takes all of\n * it back. The caret lands after it. False when nothing is proposed.\n */\nexport function acceptProposal(view: EditorView): boolean {\n const range = key.getState(view.state)?.range;\n if (!range) return false;\n stopProposal(view);\n const { from, to } = range;\n const slice = view.state.doc.slice(from, to);\n // Out, without a trace — and in again as one ordinary change. The same\n // slice at the same place is the same document; only the history knows.\n view.dispatch(\n view.state.tr\n .delete(from, to)\n .setMeta(key, { range: null } satisfies ProposalMeta)\n .setMeta('addToHistory', false),\n );\n const tr = view.state.tr.replace(from, from, slice);\n const end = tr.mapping.map(from + (to - from), 1);\n tr.setSelection(TextSelection.near(tr.doc.resolve(Math.min(end, tr.doc.content.size)), -1));\n view.dispatch(closeHistory(tr).scrollIntoView());\n return true;\n}\n\n/**\n * Takes the proposal out, as if it had never been written: the document\n * and its history are as they were, the caret where the proposal began.\n * False when nothing is proposed.\n */\nexport function discardProposal(view: EditorView): boolean {\n const tr = discardTransaction(view);\n if (!tr) return false;\n view.dispatch(tr);\n return true;\n}\n\n/** The transaction that takes the proposal out — stopping the writing\n first — or null when nothing is proposed. */\nfunction discardTransaction(view: EditorView): Transaction | null {\n const range = key.getState(view.state)?.range;\n if (!range) return null;\n stopProposal(view);\n const tr = view.state.tr\n .delete(range.from, range.to)\n .setMeta(key, { range: null } satisfies ProposalMeta)\n .setMeta('addToHistory', false);\n tr.setSelection(TextSelection.near(tr.doc.resolve(Math.min(range.from, tr.doc.content.size))));\n return tr;\n}\n","/** A box in viewport coordinates — what `coordsAtPos` answers. */\nexport interface MenuAnchor {\n left: number;\n top: number;\n bottom: number;\n}\n\n/**\n * Where a floating menu goes for an anchor line: under it, clamped to its\n * scroll container, flipped above when below would overflow the visible\n * area. Read-only — it measures and returns, and the caller writes `left` /\n * `top` in its own write phase, so measuring never follows a write in the\n * same task. The element must be `position: absolute` inside a\n * `position: relative` scroll container; its size is read as rendered, so\n * call it after its contents are in.\n */\nexport function measureMenuPlacement(\n anchor: MenuAnchor,\n element: HTMLElement,\n offset: number,\n): { left: number; top: number } | null {\n const container = element.offsetParent ?? element.parentElement;\n if (!container) return null;\n const containerRect = container.getBoundingClientRect();\n const { offsetWidth: width, offsetHeight: height } = element;\n const { scrollLeft, scrollTop, scrollWidth, clientHeight } = container;\n\n const left = Math.min(\n Math.max(anchor.left - containerRect.left + scrollLeft, 0),\n Math.max(scrollWidth - width, 0),\n );\n\n // Below the line; flip above when it would overflow the visible part of\n // the scroll container.\n let top = anchor.bottom - containerRect.top + scrollTop + offset;\n if (top + height > scrollTop + clientHeight) {\n const above = anchor.top - containerRect.top + scrollTop;\n if (above - height - offset >= scrollTop) top = above - height - offset;\n }\n\n return { left, top };\n}\n","import { Node } from 'prosemirror-model';\nimport { EditorState, PluginKey } from 'prosemirror-state';\n\n/**\n * An *expression dialect*: what the `{{…}}` tokens mean. The merge-tag mark\n * is dialect-neutral — it finds tokens, keeps the pill honest and formats\n * them whole — and a dialect layers meaning on top, opt-in, one per editor:\n * a parser for the token language, exact required fields from the parse,\n * syntax diagnostics before the template ever reaches a renderer. The first\n * dialect is AngularJS expressions (`createAngularExpressions`); Handlebars\n * follows. Without a dialect the generic lexer in `mergeTagFields` stands in.\n */\nexport interface ExpressionDialect {\n /** A short name, e.g. `angular`. */\n readonly name: string;\n /** The identifiers the document's tokens read — the values the host must\n supply — deduplicated, in first-use order. */\n requiredFields(doc: Node): string[];\n /** Diagnostics for one token's inner expression, positions relative to it. */\n analyze(expr: string): ExpressionIssue[];\n}\n\n/** A problem inside one expression, `[from, to)` relative to its text. */\nexport interface ExpressionIssue {\n from: number;\n to: number;\n message: string;\n}\n\n/** A problem in the document: a token's issue at document positions. */\nexport interface ExpressionDiagnostic extends ExpressionIssue {\n /** The token's inner expression, verbatim. */\n expr: string;\n}\n\n/** The dialect installed on an editor, as plugin state, so the send intent\n and the host read the one the editor was configured with. */\nexport const expressionDialectKey = new PluginKey<{ dialect: ExpressionDialect }>(\n 'expressionDialect',\n);\n\nexport const expressionDialect = (state: EditorState): ExpressionDialect | undefined =>\n expressionDialectKey.getState(state)?.dialect;\n","import { Node } from 'prosemirror-model';\nimport { Plugin } from 'prosemirror-state';\nimport { Decoration, DecorationSet } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../../extension';\nimport { mergeTagRanges } from '../nodes/merge-tag';\nimport {\n ExpressionDialect,\n ExpressionDiagnostic,\n ExpressionIssue,\n expressionDialectKey,\n} from './dialect';\n\n/**\n * The AngularJS expression dialect — `$parse`'s grammar, opt-in\n * (`createAngularExpressions`): literals, identifiers, member access,\n * calls, unary/binary operators, the ternary, filters with `:` arguments,\n * assignments and `;` statements. A hand-written recursive-descent parser\n * over one token's text; from the parse follow the two things the editor\n * needs and the heuristic lexer could only approximate:\n *\n * - **Syntax diagnostics** — an unbalanced quote or paren, a dangling `?`,\n * a stray character — positioned inside the token, surfaced as\n * underlines in the editor and as errors to the host, *before* the\n * template reaches a renderer where it would fail silently.\n * - **Exact required fields** — every identifier read as a value: the root\n * of a member chain (`customer.name` → `customer`), both sides of a\n * computed member (`rows[idx]` → `rows`, `idx`), arguments of calls and\n * filters; never a bare callee (`round(…)` is a helper), a filter name,\n * a property tail, a literal, or a local assigned anywhere in the\n * document (`mwst = …; mwst`).\n *\n * The parser recognises; it never evaluates (that is a later slice, for a\n * preview with sample data) and never rewrites: the token text stays\n * byte-verbatim, as the merge-tag mark guarantees.\n */\n\n// ---------------------------------------------------------------------------\n// Tokens\n\ntype TokenKind = 'identifier' | 'number' | 'string' | 'operator' | 'end';\n\ninterface Token {\n kind: TokenKind;\n text: string;\n from: number;\n to: number;\n}\n\nconst OPERATORS = [\n '===',\n '!==',\n '==',\n '!=',\n '<=',\n '>=',\n '&&',\n '||',\n '+',\n '-',\n '*',\n '/',\n '%',\n '!',\n '=',\n '<',\n '>',\n '?',\n ':',\n '|',\n ';',\n ',',\n '.',\n '(',\n ')',\n '[',\n ']',\n];\n\nclass ExpressionError extends Error {\n constructor(\n message: string,\n readonly from: number,\n readonly to: number,\n ) {\n super(message);\n }\n}\n\nfunction tokenize(source: string): Token[] {\n const tokens: Token[] = [];\n let i = 0;\n while (i < source.length) {\n const ch = source[i];\n if (/\\s/.test(ch)) {\n i++;\n continue;\n }\n if (/[A-Za-z_$]/.test(ch)) {\n const match = /^[A-Za-z_$][\\w$]*/.exec(source.slice(i))!;\n tokens.push({ kind: 'identifier', text: match[0], from: i, to: i + match[0].length });\n i += match[0].length;\n continue;\n }\n if (/[0-9]/.test(ch) || (ch === '.' && /[0-9]/.test(source[i + 1] ?? ''))) {\n const match = /^(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?/.exec(source.slice(i))!;\n tokens.push({ kind: 'number', text: match[0], from: i, to: i + match[0].length });\n i += match[0].length;\n continue;\n }\n if (ch === \"'\" || ch === '\"') {\n let j = i + 1;\n while (j < source.length && source[j] !== ch) j += source[j] === '\\\\' ? 2 : 1;\n if (j >= source.length) throw new ExpressionError('Unterminated string', i, source.length);\n tokens.push({ kind: 'string', text: source.slice(i, j + 1), from: i, to: j + 1 });\n i = j + 1;\n continue;\n }\n const operator = OPERATORS.find((op) => source.startsWith(op, i));\n if (operator) {\n tokens.push({ kind: 'operator', text: operator, from: i, to: i + operator.length });\n i += operator.length;\n continue;\n }\n throw new ExpressionError(`Unexpected character '${ch}'`, i, i + 1);\n }\n tokens.push({ kind: 'end', text: '', from: source.length, to: source.length });\n return tokens;\n}\n\n// ---------------------------------------------------------------------------\n// Syntax tree\n\nexport type AngularNode =\n | { type: 'Literal'; value: string | number | boolean | null | undefined }\n | { type: 'Identifier'; name: string }\n | { type: 'Member'; object: AngularNode; property: AngularNode; computed: boolean }\n | { type: 'Call'; callee: AngularNode; args: AngularNode[] }\n | { type: 'Unary'; operator: string; argument: AngularNode }\n | { type: 'Binary'; operator: string; left: AngularNode; right: AngularNode }\n | { type: 'Conditional'; test: AngularNode; consequent: AngularNode; alternate: AngularNode }\n | { type: 'Assignment'; target: AngularNode; value: AngularNode }\n | { type: 'Filter'; name: string; input: AngularNode; args: AngularNode[] }\n | { type: 'Array'; elements: AngularNode[] }\n | { type: 'Program'; statements: AngularNode[] };\n\nconst LITERALS: Record<string, string | number | boolean | null | undefined> = {\n true: true,\n false: false,\n null: null,\n undefined: undefined,\n};\n\nclass Parser {\n private index = 0;\n\n constructor(private readonly tokens: Token[]) {}\n\n private get token(): Token {\n return this.tokens[this.index];\n }\n\n // A method, not a narrowed property read: the index moves under it.\n private atEnd(): boolean {\n return this.tokens[this.index].kind === 'end';\n }\n\n private is(text: string): boolean {\n return this.token.kind === 'operator' && this.token.text === text;\n }\n\n private eat(text: string): boolean {\n if (!this.is(text)) return false;\n this.index++;\n return true;\n }\n\n private expect(text: string): void {\n if (!this.eat(text)) this.fail(`Expected '${text}'`);\n }\n\n /** A specific expectation wins even at the end of the input (\"Expected\n ')'\" beats \"Unexpected end\"); without one, the end is the message. */\n private fail(message?: string): never {\n const token = this.token;\n if (message) throw new ExpressionError(message, token.from, token.to);\n if (token.kind === 'end') {\n throw new ExpressionError('Unexpected end of expression', token.from, token.to);\n }\n throw new ExpressionError(`Unexpected token '${token.text}'`, token.from, token.to);\n }\n\n program(): AngularNode {\n const statements: AngularNode[] = [];\n while (true) {\n if (this.atEnd() || this.is(';')) {\n if (!this.eat(';')) break;\n continue;\n }\n statements.push(this.filterChain());\n if (this.atEnd()) break;\n if (!this.is(';')) this.fail();\n }\n if (!statements.length) throw new ExpressionError('Empty expression', 0, 0);\n return { type: 'Program', statements };\n }\n\n private filterChain(): AngularNode {\n let left = this.expression();\n while (this.eat('|')) {\n if (this.token.kind !== 'identifier') this.fail('Expected a filter name');\n const name = this.token.text;\n this.index++;\n const args: AngularNode[] = [];\n while (this.eat(':')) args.push(this.expression());\n left = { type: 'Filter', name, input: left, args };\n }\n return left;\n }\n\n private expression(): AngularNode {\n return this.assignment();\n }\n\n private assignment(): AngularNode {\n const target = this.ternary();\n if (this.is('=')) {\n if (target.type !== 'Identifier' && target.type !== 'Member') {\n this.fail('Cannot assign to this expression');\n }\n this.index++;\n return { type: 'Assignment', target, value: this.assignment() };\n }\n return target;\n }\n\n private ternary(): AngularNode {\n const test = this.logicalOr();\n if (this.eat('?')) {\n const consequent = this.expression();\n this.expect(':');\n const alternate = this.expression();\n return { type: 'Conditional', test, consequent, alternate };\n }\n return test;\n }\n\n private binary(next: () => AngularNode, operators: string[]): AngularNode {\n let left = next();\n for (;;) {\n const operator = operators.find((op) => this.is(op));\n if (!operator) return left;\n this.index++;\n left = { type: 'Binary', operator, left, right: next() };\n }\n }\n\n private logicalOr = (): AngularNode => this.binary(this.logicalAnd, ['||']);\n private logicalAnd = (): AngularNode => this.binary(this.equality, ['&&']);\n private equality = (): AngularNode => this.binary(this.relational, ['===', '!==', '==', '!=']);\n private relational = (): AngularNode => this.binary(this.additive, ['<=', '>=', '<', '>']);\n private additive = (): AngularNode => this.binary(this.multiplicative, ['+', '-']);\n private multiplicative = (): AngularNode => this.binary(this.unary, ['*', '/', '%']);\n\n private unary = (): AngularNode => {\n for (const operator of ['+', '-', '!']) {\n if (this.eat(operator)) return { type: 'Unary', operator, argument: this.unary() };\n }\n return this.postfix();\n };\n\n private postfix(): AngularNode {\n let node = this.primary();\n for (;;) {\n if (this.eat('.')) {\n if (this.token.kind !== 'identifier') this.fail('Expected a property name');\n node = {\n type: 'Member',\n object: node,\n property: { type: 'Identifier', name: this.token.text },\n computed: false,\n };\n this.index++;\n } else if (this.eat('[')) {\n const property = this.expression();\n this.expect(']');\n node = { type: 'Member', object: node, property, computed: true };\n } else if (this.eat('(')) {\n const args: AngularNode[] = [];\n if (!this.is(')')) {\n do args.push(this.expression());\n while (this.eat(','));\n }\n this.expect(')');\n node = { type: 'Call', callee: node, args };\n } else {\n return node;\n }\n }\n }\n\n private primary(): AngularNode {\n const token = this.token;\n if (this.eat('(')) {\n const inner = this.filterChain();\n this.expect(')');\n return inner;\n }\n if (this.eat('[')) {\n const elements: AngularNode[] = [];\n if (!this.is(']')) {\n do elements.push(this.expression());\n while (this.eat(','));\n }\n this.expect(']');\n return { type: 'Array', elements };\n }\n if (token.kind === 'number') {\n this.index++;\n return { type: 'Literal', value: Number(token.text) };\n }\n if (token.kind === 'string') {\n this.index++;\n return { type: 'Literal', value: token.text.slice(1, -1) };\n }\n if (token.kind === 'identifier') {\n this.index++;\n if (token.text in LITERALS) return { type: 'Literal', value: LITERALS[token.text] };\n return { type: 'Identifier', name: token.text };\n }\n return this.fail();\n }\n}\n\n/** Parses one token's inner expression. Throws an {@link ExpressionError}\n (message + position) on the first problem. */\nexport function parseAngularExpression(expr: string): AngularNode {\n return new Parser(tokenize(expr)).program();\n}\n\n/** The parse's verdict on one expression: its issues (at most one — the\n first — today), empty when it is a valid program. */\nexport function analyzeAngularExpression(expr: string): ExpressionIssue[] {\n try {\n parseAngularExpression(expr);\n return [];\n } catch (error) {\n if (error instanceof ExpressionError) {\n return [{ from: error.from, to: error.to, message: error.message }];\n }\n throw error;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Required fields\n\n/** Ambient values the evaluator provides — never fetched from the host. */\nconst AMBIENT = new Set(['this', 'now']);\n\nfunction walk(\n node: AngularNode,\n fields: Set<string>,\n locals: Set<string>,\n context: { callee?: boolean; assignTarget?: boolean } = {},\n): void {\n switch (node.type) {\n case 'Program':\n node.statements.forEach((statement) => walk(statement, fields, locals));\n break;\n case 'Identifier':\n if (context.assignTarget) locals.add(node.name);\n else if (!context.callee && !AMBIENT.has(node.name)) fields.add(node.name);\n break;\n case 'Member':\n // The root of a chain is read even when the chain is assigned to\n // (`customer.note = …` reads `customer`); a computed key is a value.\n walk(node.object, fields, locals);\n if (node.computed) walk(node.property, fields, locals);\n break;\n case 'Call':\n // A bare callee is a helper on the scope (`round(…)`), not a field; a\n // member callee reads its object (`customer.getName()`).\n walk(node.callee, fields, locals, { callee: node.callee.type === 'Identifier' });\n node.args.forEach((arg) => walk(arg, fields, locals));\n break;\n case 'Unary':\n walk(node.argument, fields, locals);\n break;\n case 'Binary':\n walk(node.left, fields, locals);\n walk(node.right, fields, locals);\n break;\n case 'Conditional':\n walk(node.test, fields, locals);\n walk(node.consequent, fields, locals);\n walk(node.alternate, fields, locals);\n break;\n case 'Assignment':\n walk(node.target, fields, locals, { assignTarget: true });\n walk(node.value, fields, locals);\n break;\n case 'Filter':\n walk(node.input, fields, locals);\n node.args.forEach((arg) => walk(arg, fields, locals));\n break;\n case 'Array':\n node.elements.forEach((element) => walk(element, fields, locals));\n break;\n case 'Literal':\n break;\n }\n}\n\n/** The required fields of a set of expressions: values read anywhere, minus\n locals assigned anywhere (an assignment is seen across all tokens), in\n first-use order. An expression that does not parse contributes nothing —\n the diagnostic says why. */\nexport function angularRequiredFields(expressions: string[]): string[] {\n const programs: AngularNode[] = [];\n for (const expr of expressions) {\n try {\n programs.push(parseAngularExpression(expr));\n } catch {\n // reported as a diagnostic, not a field\n }\n }\n const fields = new Set<string>();\n const locals = new Set<string>();\n for (const program of programs) walk(program, fields, locals);\n return [...fields].filter((name) => !locals.has(name));\n}\n\n// ---------------------------------------------------------------------------\n// The extension\n\nexport const angularDialect: ExpressionDialect = {\n name: 'angular',\n requiredFields: (doc: Node) => angularRequiredFields(mergeTagRanges(doc).map((t) => t.expr)),\n analyze: analyzeAngularExpression,\n};\n\nexport interface AngularExpressionsOptions {\n /** Called with the document's expression diagnostics whenever they change\n (an empty list when every token parses) — the host's status strip. */\n onDiagnostics?: (diagnostics: ExpressionDiagnostic[]) => void;\n}\n\ninterface DialectState {\n dialect: ExpressionDialect;\n diagnostics: ExpressionDiagnostic[];\n decorations: DecorationSet;\n}\n\nfunction analyzeDocument(doc: Node): Omit<DialectState, 'dialect'> {\n const diagnostics: ExpressionDiagnostic[] = [];\n const decorations: Decoration[] = [];\n for (const tag of mergeTagRanges(doc)) {\n const inner = tag.from + 2; // past the opening braces\n for (const issue of analyzeAngularExpression(tag.expr)) {\n const diagnostic = {\n ...issue,\n from: inner + issue.from,\n to: inner + issue.to,\n expr: tag.expr,\n };\n diagnostics.push(diagnostic);\n // An end-of-input problem has no width: underline the whole token.\n const [from, to] =\n issue.from === issue.to ? [tag.from, tag.to] : [diagnostic.from, diagnostic.to];\n decorations.push(\n Decoration.inline(from, to, { class: 'aee-expr-error', title: issue.message }),\n );\n }\n }\n return { diagnostics, decorations: DecorationSet.create(doc, decorations) };\n}\n\n/**\n * Installs the AngularJS dialect on an editor: the send intent's required\n * fields come from the parse, every token is checked after each change, a\n * problem is underlined in place (`.aee-expr-error`, the app owns the\n * pixels) and reported through `onDiagnostics` with document positions —\n * so a host can count it in its status strip and jump to it. Opt-in: an\n * editor without it keeps the generic lexer and no checking.\n */\nexport const createAngularExpressions = (\n options: AngularExpressionsOptions = {},\n): FunctionalExtension =>\n defineExtension({\n name: 'angularExpressions',\n plugins: () => [\n new Plugin<DialectState>({\n key: expressionDialectKey as never,\n state: {\n init: (_config, state) => ({ dialect: angularDialect, ...analyzeDocument(state.doc) }),\n apply: (tr, value) =>\n tr.docChanged ? { dialect: angularDialect, ...analyzeDocument(tr.doc) } : value,\n },\n props: {\n decorations: (state) => expressionDialectKey.getState(state)?.['decorations' as never],\n },\n view: () => ({\n update: (view, previous) => {\n const now = (expressionDialectKey.getState(view.state) as DialectState | undefined)\n ?.diagnostics;\n const before = (expressionDialectKey.getState(previous) as DialectState | undefined)\n ?.diagnostics;\n if (now && now !== before) options.onDiagnostics?.(now);\n },\n }),\n }),\n ],\n });\n","import { EditorState, Plugin, PluginKey, Selection, Transaction } from 'prosemirror-state';\nimport { Node } from 'prosemirror-model';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { CellSelection, TableMap } from 'prosemirror-tables';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { selectColumn, selectRow } from './nodes/table';\n\n/** Which band — or which cell — of which table a grip stands for, and\n where it is on screen. */\nexport interface TableHandleTarget {\n kind: 'row' | 'column' | 'cell';\n /** The band's index in the grid, counted from the top / the start; a\n cell's column. */\n index: number;\n /** A cell's row. */\n row?: number;\n /** The table's position in the document — what the select commands take. */\n tablePos: number;\n /** The grip's own rect: what the app's menu anchors to. */\n boundingBox: DOMRect;\n}\n\nexport interface TableHandlesOptions {\n /** A grip was pressed (its band is selected by then), or the handles have\n nothing to offer any more (`null`) — the table went away under them. */\n onOpen: (target: TableHandleTarget | null) => void;\n /** What a grip says to assistive tech, translated by the host. Called with\n the band's 1-based number, as a person counts rows; for the caret\n cell's grip, the cell's column. */\n label?: (kind: 'row' | 'column' | 'cell', number: number) => string;\n}\n\ninterface TableHandlesState {\n decorations: DecorationSet;\n /** Every table and the node we last built grips from — identity compare\n tells a later transaction whether the *grid* moved, or only the text\n inside a cell (the common case, and the one that must stay cheap). */\n tables: { pos: number; node: Node }[];\n /** Bumped only when the grip set is rebuilt. Mapping through a keystroke\n keeps this number, so the view can skip the expanded-attribute pass\n — `DecorationSet.map` returns a new set every time, and comparing\n those by identity would redo the DOM walk on every insert. */\n generation: number;\n}\n\nconst tableHandlesKey = new PluginKey<TableHandlesState>('tableHandles');\n\n/**\n * The row and column grips: a handle on each row's flank and above each\n * column, the gesture every table editor has settled on (Notion's, Google\n * Docs', Domternal's). Pressing one selects that whole band and hands the\n * host a target to open a menu at — insert, move, duplicate, fill, align,\n * delete — all of which are the ordinary selection-relative commands once\n * the band is selected.\n *\n * **The grips are widget decorations inside the band's first cell**, not an\n * overlay measured against the table. That is the whole trick: a decoration\n * in a cell is positioned by that cell's own box, so a row grip is exactly\n * as tall as its row and a column grip exactly as wide as its column,\n * through merged cells, wrapped text and a resize drag alike — with no\n * measurement, no ResizeObserver and no pointer tracking, which is the same\n * bargain the boundary lines strike (see column-resize.ts).\n *\n * A band whose first cell is covered by a merge from above (or from the\n * left) has no cell of its own to hang a grip in, and gets none: there is\n * nothing there to grab that would not be a lie about what it selects.\n *\n * What a press *opens* is the host's: the extension reports the band and the\n * grip's rect, and the app renders the menu (see the app's table-menu),\n * exactly as the block menu is arranged.\n *\n * Decorations are built when a table's *grid* changes and then mapped, the\n * way Notion and Tiptap keep their chrome off the keystroke path. Typing\n * inside a cell is not a grid change — the widgets stay the same DOM nodes,\n * so a pointer resting on a grip is never rebuilt out from under itself.\n * The expanded state is a cheap attribute write on those nodes, not a\n * decoration rebuild: `aria-expanded` is what the stylesheet (and a screen\n * reader) already keys off.\n */\nexport const createTableHandles = (options: TableHandlesOptions): FunctionalExtension => {\n const label =\n options.label ??\n ((kind: 'row' | 'column' | 'cell', number: number) =>\n kind === 'cell' ? 'Cell options' : `${kind} ${number} options`);\n\n /** The caret cell's own grip: a dot on the cell's right edge that opens\n the cell's menu — fill, alignment, clearing — the caret staying where\n it is. Selection-driven, so it is built afresh as the caret moves and\n never rebuilt while a cell is typed in (its key is the cell). */\n const cellGrip = (cell: CaretCell): HTMLElement => {\n const el = document.createElement('span');\n el.className = 'aee-grip aee-grip--cell';\n el.setAttribute('role', 'button');\n el.setAttribute('aria-label', label('cell', cell.column + 1));\n el.setAttribute('title', label('cell', cell.column + 1));\n el.setAttribute('aria-haspopup', 'menu');\n el.setAttribute('aria-expanded', 'false');\n el.contentEditable = 'false';\n for (let i = 0; i < 3; i++) el.appendChild(document.createElement('i'));\n el.addEventListener('mousedown', (event) => {\n event.preventDefault();\n event.stopPropagation();\n });\n el.addEventListener('click', (event) => {\n event.preventDefault();\n event.stopPropagation();\n el.setAttribute('aria-expanded', 'true');\n options.onOpen({\n kind: 'cell',\n index: cell.column,\n row: cell.row,\n tablePos: cell.tablePos,\n boundingBox: el.getBoundingClientRect(),\n });\n });\n return el;\n };\n\n const grip = (view: EditorView, kind: 'row' | 'column', index: number): HTMLElement => {\n const el = document.createElement('span');\n el.className = `aee-grip aee-grip--${kind}`;\n el.dataset['index'] = String(index);\n el.setAttribute('role', 'button');\n el.setAttribute('aria-label', label(kind, index + 1));\n el.setAttribute('title', label(kind, index + 1));\n // What the grip *is*, said in ARIA rather than in a class: a button that\n // opens a menu, expanded for as long as that menu has the band — which\n // is what keeps it on screen when the pointer leaves for the menu\n // (styles.scss reads the attribute, nothing else). The plugin view\n // writes this from the selection after every transaction; the widget\n // itself always starts collapsed so a rebuild cannot lie.\n el.setAttribute('aria-haspopup', 'menu');\n el.setAttribute('aria-expanded', 'false');\n el.contentEditable = 'false';\n // Three dots — the handle's face everywhere else: ⋮ on a row's flank, ⋯\n // above a column. The middle one is the element, the other two its\n // pseudo-elements (styles.scss); the box around them is the target.\n el.appendChild(document.createElement('i'));\n // The press must not travel into the editor: a mousedown inside a cell\n // would put the caret there and collapse the band selection the click is\n // about to make.\n el.addEventListener('mousedown', (event) => event.preventDefault());\n el.addEventListener('click', (event) => {\n event.preventDefault();\n // Measured on the element the pointer is on, before the selection\n // transaction runs — even though that transaction no longer remounts\n // the grip, this is still the honest moment: the rect of *this* press.\n const boundingBox = el.getBoundingClientRect();\n // The table's position is read off the document, not closed over when\n // the widget was built: decorations map through edits above the table\n // and the same element stays in the document, so a captured pos would\n // quietly point at the wrong place.\n const tablePos = tablePosOf(view, el);\n if (tablePos < 0) return;\n const select = kind === 'row' ? selectRow : selectColumn;\n if (!select(tablePos, index)(view.state, view.dispatch)) return;\n options.onOpen({ kind, index, tablePos, boundingBox });\n });\n return el;\n };\n\n return defineExtension({\n name: 'tableHandles',\n plugins: () => [\n new Plugin<TableHandlesState>({\n key: tableHandlesKey,\n state: {\n init: (_, state) => buildState(state, grip, 0),\n apply: (tr, prev, _old, state) => applyHandles(tr, prev, state, grip),\n },\n props: {\n decorations: (state) => {\n const set = tableHandlesKey.getState(state)?.decorations ?? DecorationSet.empty;\n const cell = caretCell(state.selection);\n if (!cell) return set;\n return set.add(state.doc, [\n Decoration.widget(cell.pos + 1, () => cellGrip(cell), {\n key: `cell-grip-${cell.pos}`,\n side: -1,\n ignoreSelection: true,\n }),\n ]);\n },\n },\n view: (view) => {\n let lastGeneration = -1;\n let lastBand = '';\n const sync = () => {\n const plugin = tableHandlesKey.getState(view.state);\n const band = selectedBand(view.state.selection);\n const caret = caretCell(view.state.selection);\n const key = [\n band ? `${band.tablePos}:${band.kind}:${band.from}:${band.to}` : '',\n caret ? `${caret.tablePos}:${caret.row}:${caret.column}` : '',\n ].join('|');\n if (plugin?.generation === lastGeneration && key === lastBand) return;\n lastGeneration = plugin?.generation ?? 0;\n lastBand = key;\n view.dom\n .querySelectorAll<HTMLElement>('.aee-grip[aria-expanded=\"true\"]')\n .forEach((el) => {\n el.setAttribute('aria-expanded', 'false');\n });\n view.dom.querySelectorAll<HTMLElement>('.aee-grip[data-caret]').forEach((el) => {\n el.removeAttribute('data-caret');\n });\n // The caret's cell: its row's grip and its column's stay on\n // screen while it is typed in (the stylesheet shows `data-caret`).\n if (caret) {\n const table = view.nodeDOM(caret.tablePos);\n if (table instanceof HTMLElement) {\n table\n .querySelector<HTMLElement>(`.aee-grip--row[data-index=\"${caret.row}\"]`)\n ?.setAttribute('data-caret', '');\n table\n .querySelector<HTMLElement>(`.aee-grip--column[data-index=\"${caret.column}\"]`)\n ?.setAttribute('data-caret', '');\n }\n }\n if (!band) return;\n const table = view.nodeDOM(band.tablePos);\n if (!(table instanceof HTMLElement)) return;\n for (let index = band.from; index < band.to; index++) {\n table\n .querySelector<HTMLElement>(`.aee-grip--${band.kind}[data-index=\"${index}\"]`)\n ?.setAttribute('aria-expanded', 'true');\n }\n };\n sync();\n return { update: sync };\n },\n }),\n ],\n });\n};\n\nfunction applyHandles(\n tr: Transaction,\n prev: TableHandlesState,\n state: EditorState,\n grip: (view: EditorView, kind: 'row' | 'column', index: number) => HTMLElement,\n): TableHandlesState {\n if (!tr.docChanged) return prev;\n\n const mapped: { pos: number; node: Node }[] = [];\n for (const table of prev.tables) {\n const pos = tr.mapping.map(table.pos);\n const node = state.doc.nodeAt(pos);\n if (!node || node.type.name !== 'table' || !sameTableGrid(table.node, node)) {\n return buildState(state, grip, prev.generation + 1);\n }\n mapped.push({ pos, node });\n }\n\n let count = 0;\n forEachTable(state.doc, () => {\n count++;\n });\n if (count !== mapped.length) return buildState(state, grip, prev.generation + 1);\n\n // Typing maps cleanly. A resize commit (`setNodeMarkup` on every cell,\n // so the new widths stick) does not: ProseMirror drops node decorations\n // that sat on the replaced cells, and those are the `data-col` marks the\n // column grips light up from. If the set shrank, the cheap path lied —\n // rebuild. Widget identity is kept by the same keys either way.\n const decorations = prev.decorations.map(tr.mapping, state.doc);\n if (decorations.find().length !== prev.decorations.find().length) {\n return buildState(state, grip, prev.generation + 1);\n }\n return { decorations, tables: mapped, generation: prev.generation };\n}\n\nfunction buildState(\n state: EditorState,\n grip: (view: EditorView, kind: 'row' | 'column', index: number) => HTMLElement,\n generation: number,\n): TableHandlesState {\n const decorations: Decoration[] = [];\n const tables: { pos: number; node: Node }[] = [];\n\n forEachTable(state.doc, (node, tablePos) => {\n tables.push({ pos: tablePos, node });\n const map = TableMap.get(node);\n const start = tablePos + 1;\n\n for (let row = 0; row < map.height; row++) {\n const cell = bandCell(map, 'row', row);\n if (cell === null) continue;\n decorations.push(\n Decoration.widget(start + cell + 1, (view) => grip(view, 'row', row), {\n // Stable across every re-render of the table, so a grip is never\n // rebuilt under the pointer that is on it. The expanded state is\n // not part of the key: that is an attribute write, not a remount.\n key: `row-grip-${tablePos}-${row}`,\n side: -1,\n ignoreSelection: true,\n }),\n );\n }\n\n // Which column each cell stands in — the stylesheet reveals the grip of\n // the column being pointed at, and CSS cannot count a grid through\n // merges on its own.\n for (let row = 0; row < map.height; row++) {\n for (let column = 0; column < map.width; column++) {\n if (!cellStartsAt(map, row, column)) continue;\n const rel = map.map[row * map.width + column];\n const size = node.nodeAt(rel)!.nodeSize;\n decorations.push(\n Decoration.node(start + rel, start + rel + size, {\n 'data-col': String(column),\n }),\n );\n }\n }\n\n for (let column = 0; column < map.width; column++) {\n const cell = bandCell(map, 'column', column);\n if (cell === null) continue;\n decorations.push(\n Decoration.widget(start + cell + 1, (view) => grip(view, 'column', column), {\n key: `column-grip-${tablePos}-${column}`,\n side: -1,\n ignoreSelection: true,\n }),\n );\n }\n });\n\n return {\n decorations: decorations.length\n ? DecorationSet.create(state.doc, decorations)\n : DecorationSet.empty,\n tables,\n generation,\n };\n}\n\n/** The table a grip currently sits in, read from the live document. */\nfunction tablePosOf(view: EditorView, el: HTMLElement): number {\n const from = el.closest('td') ?? el;\n const pos = view.posAtDOM(from, 0);\n const $pos = view.state.doc.resolve(Math.max(pos, 0));\n for (let depth = $pos.depth; depth > 0; depth--) {\n if ($pos.node(depth).type.name === 'table') return $pos.before(depth);\n }\n return -1;\n}\n\nfunction forEachTable(doc: Node, fn: (node: Node, pos: number) => void): void {\n doc.descendants((node, pos) => {\n if (node.type.name !== 'table') return true;\n fn(node, pos);\n return false;\n });\n}\n\n/**\n * Whether two table nodes describe the same grid — same rows, same cells,\n * same spans. ProseMirror's persistent tree keeps unchanged rows as the\n * *same object*, so a keystroke is one new cell and this returns in a\n * handful of identity compares.\n */\nfunction sameTableGrid(a: Node, b: Node): boolean {\n if (a.childCount !== b.childCount) return false;\n for (let row = 0; row < a.childCount; row++) {\n const left = a.child(row);\n const right = b.child(row);\n if (left === right) continue;\n if (left.childCount !== right.childCount) return false;\n for (let column = 0; column < left.childCount; column++) {\n const from = left.child(column);\n const to = right.child(column);\n if (from === to) continue;\n if (from.attrs['colspan'] !== to.attrs['colspan']) return false;\n if (from.attrs['rowspan'] !== to.attrs['rowspan']) return false;\n }\n }\n return true;\n}\n\n/**\n * The band the selection *is*, where it is one of this table's: a whole row\n * (or rows), or a whole column — which is exactly what a grip's press makes,\n * and what the grip then reports as its expanded state. Anything else — a\n * caret, a rectangle of cells, another table's selection — is no band.\n */\n/** The cell the caret is in — a text selection inside one cell — as its\n place in the grid: which row and column, of which table. Null for a\n cell selection (a band's own affair) and outside any table. */\ninterface CaretCell {\n tablePos: number;\n row: number;\n column: number;\n /** The cell node's position in the document. */\n pos: number;\n}\n\nfunction caretCell(selection: Selection): CaretCell | null {\n if (selection instanceof CellSelection) return null;\n const { $from } = selection;\n for (let depth = $from.depth; depth > 0; depth--) {\n if ($from.node(depth).type.spec['tableRole'] !== 'cell') continue;\n if (depth < 2) return null;\n const table = $from.node(depth - 2);\n if (table.type.spec['tableRole'] !== 'table') return null;\n const tableStart = $from.start(depth - 2);\n const pos = $from.before(depth);\n const rect = TableMap.get(table).findCell(pos - tableStart);\n return { tablePos: tableStart - 1, row: rect.top, column: rect.left, pos };\n }\n return null;\n}\n\nfunction selectedBand(\n selection: Selection,\n): { kind: 'row' | 'column'; from: number; to: number; tablePos: number } | null {\n if (!(selection instanceof CellSelection)) return null;\n const table = selection.$anchorCell.node(-1);\n if (table.type.name !== 'table') return null;\n const tableStart = selection.$anchorCell.start(-1);\n const map = TableMap.get(table);\n const rect = map.rectBetween(\n selection.$anchorCell.pos - tableStart,\n selection.$headCell.pos - tableStart,\n );\n // A grid-wide selection is both, and answers as neither: no single band is\n // the one being worked on.\n const isRow = selection.isRowSelection();\n const isColumn = selection.isColSelection();\n if (isRow === isColumn) return null;\n return isRow\n ? { kind: 'row', from: rect.top, to: rect.bottom, tablePos: tableStart - 1 }\n : { kind: 'column', from: rect.left, to: rect.right, tablePos: tableStart - 1 };\n}\n\n/**\n * The cell a band's grip hangs in: the first one along the band that\n * actually *starts* there — a cell merged in from above (or from the left)\n * belongs to an earlier band and would put the grip at the wrong height.\n * `null` where the whole band is covered by such merges.\n */\nfunction bandCell(map: TableMap, kind: 'row' | 'column', index: number): number | null {\n const length = kind === 'row' ? map.width : map.height;\n for (let along = 0; along < length; along++) {\n const row = kind === 'row' ? index : along;\n const column = kind === 'row' ? along : index;\n if (cellStartsAt(map, row, column)) return map.map[row * map.width + column];\n }\n return null;\n}\n\n/** Whether the cell at (`row`, `column`) *begins* there, not merely covers\n it — the same question `TableMap.findCell` answers, without the scan. */\nfunction cellStartsAt(map: TableMap, row: number, column: number): boolean {\n const rel = map.map[row * map.width + column];\n if (column > 0 && map.map[row * map.width + column - 1] === rel) return false;\n if (row > 0 && map.map[(row - 1) * map.width + column] === rel) return false;\n return true;\n}\n","/**\n * Line folding for sending — the HTML as compact as ever, its lines kept\n * short enough to survive any transport.\n *\n * RFC 5322 caps a line at 998 octets. A mailer that sends the HTML part\n * quoted-printable or base64 never meets the cap; one that sends it 7bit or\n * 8bit lets a relay cut a longer line wherever it reaches the cap — inside a\n * tag, inside a word — which is where the stray `!` and the broken layout of\n * a forwarded Exchange mail come from. Our serialized body is one line.\n *\n * **Two edits only**, both whitespace the HTML tokenizer ignores:\n * - a space or tab *between the attributes of a start tag* becomes a line\n * break;\n * - where a line has no such space (MJML's runs of Outlook conditionals and\n * end tags), a line break goes right before the `>` that closes a tag —\n * `</td⏎>` is `</td>`, Prettier prints it — never after a `/`, where it\n * would undo a self-closing slash.\n *\n * Never touched: text (its spaces may be `pre`), attribute values, comments\n * (Outlook's conditional ones are markup to Outlook, kept byte for byte),\n * doctypes, CDATA, processing instructions, the content of raw text\n * elements (`style`, `title`, `textarea`, `noscript`, …) — and *anything*\n * after `<svg>`, `<math>`, `<script>` or `<plaintext>`: in foreign content\n * other elements hold raw text, a script's end hides behind escapes, and\n * where they end takes the parser's whole tree, not a tokenizer. A line with\n * nowhere to fold stays long — a transport encoding carries it.\n *\n * The tokenizer is the HTML standard's (§13.2.5) in every state a fold\n * depends on — tag and attribute states, where `<` opens a tag, the end of\n * a comment, of raw text. Where it is unsure it folds nothing: a missed fold\n * costs a long line, a wrong one the email.\n */\n\n/** Default fold width, in octets: well inside the 998 RFC 5322 allows,\n leaving room for a transport's CR and dot-stuffing. */\nexport const FOLD_WIDTH = 900;\n\n/** HTML elements whose content the tokenizer reads as text (RAWTEXT and\n RCDATA), up to their own end tag. */\nconst RAW_TEXT = new Set([\n 'style',\n 'title',\n 'textarea',\n 'noscript',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n]);\n\n/** Elements past which folding stops for good — see above. */\nconst STOP = new Set(['svg', 'math', 'script', 'plaintext']);\n\ntype State =\n | 'data'\n | 'tagName'\n | 'beforeAttrName'\n | 'attrName'\n | 'afterAttrName'\n | 'beforeValue'\n | 'valueDq'\n | 'valueSq'\n | 'valueUnquoted'\n | 'afterValue'\n | 'selfClosing'\n | 'endTag'\n | 'comment'\n | 'bogus'\n | 'cdata'\n | 'rawText'\n | 'stopped';\n\nconst isAlpha = (char: string | undefined) => !!char && /^[A-Za-z]$/.test(char);\n/** The tokenizer's whitespace: tab, LF, FF, space — CR is LF by then. */\nconst isSpace = (char: string) =>\n char === ' ' || char === '\\t' || char === '\\n' || char === '\\f' || char === '\\r';\nconst asciiLower = (text: string) => text.replace(/[A-Z]/g, (c) => c.toLowerCase());\n\nconst octetsOf = (char: string): number => {\n const code = char.codePointAt(0)!;\n return code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;\n};\n\n/**\n * `html` with its long lines folded — see above. Lines are measured in\n * octets (UTF-8); a line that fits is never touched, and folding twice\n * changes nothing.\n */\nexport function foldHTML(html: string, width = FOLD_WIDTH): string {\n const chars = Array.from(html);\n const out = chars.slice();\n // Widened on purpose: the closures below set it, which the compiler's\n // narrowing does not see.\n let state = 'data' as State;\n let tagName = '';\n let rawName = '';\n let commentStart = 0;\n let cdataClosed = false;\n let lineStart = 0;\n let lineOctets = 0;\n let foldAt = -1; // the last space of this line the tokenizer ignores\n let breakAt = -1; // the last `>` of this line a break may go before\n\n const at = (index: number, text: string) => chars.slice(index, index + text.length).join('') === text;\n\n /** A `>` closing a start tag: where a break may go before, as a last\n resort — not after a `/`, where it would undo the slash. Then the\n content: raw text, markup, or nothing more to fold. */\n const endStartTag = (i: number) => {\n if (chars[i - 1] !== '/') breakAt = i;\n if (STOP.has(tagName)) state = 'stopped';\n else if (RAW_TEXT.has(tagName)) {\n state = 'rawText';\n rawName = tagName;\n } else state = 'data';\n };\n\n for (let i = 0; i < chars.length; i++) {\n const char = chars[i];\n let foldable = false;\n\n switch (state) {\n case 'data':\n if (char !== '<') break;\n if (isAlpha(chars[i + 1])) {\n state = 'tagName';\n tagName = '';\n } else if (chars[i + 1] === '/' && isAlpha(chars[i + 2])) {\n state = 'endTag';\n } else if (at(i, '<!--')) {\n // The `!--` passes through the comment state like any character —\n // counted into the line, and no `>` among them.\n state = 'comment';\n commentStart = i + 4;\n } else if (at(i, '<![CDATA[')) {\n state = 'cdata';\n cdataClosed = chars.slice(i).join('').includes(']]>');\n } else if (chars[i + 1] === '!' || chars[i + 1] === '?' || chars[i + 1] === '/') {\n // A doctype, a processing instruction, `</ x>`, `</>`: to the `>`.\n state = 'bogus';\n }\n break;\n\n case 'tagName':\n if (isSpace(char)) {\n state = 'beforeAttrName';\n foldable = true;\n } else if (char === '/') state = 'selfClosing';\n else if (char === '>') endStartTag(i);\n else tagName += asciiLower(char);\n break;\n\n case 'beforeAttrName':\n if (isSpace(char)) foldable = true;\n else if (char === '/') state = 'selfClosing';\n else if (char === '>') endStartTag(i);\n // Anything else — `=` too — starts an attribute name.\n else state = 'attrName';\n break;\n\n case 'attrName':\n if (isSpace(char)) {\n state = 'afterAttrName';\n foldable = true;\n } else if (char === '/') state = 'selfClosing';\n else if (char === '=') state = 'beforeValue';\n else if (char === '>') endStartTag(i);\n break;\n\n case 'afterAttrName':\n if (isSpace(char)) foldable = true;\n else if (char === '/') state = 'selfClosing';\n else if (char === '=') state = 'beforeValue';\n else if (char === '>') endStartTag(i);\n else state = 'attrName';\n break;\n\n case 'beforeValue':\n if (isSpace(char)) foldable = true;\n else if (char === '\"') state = 'valueDq';\n else if (char === \"'\") state = 'valueSq';\n else if (char === '>') endStartTag(i);\n else state = 'valueUnquoted';\n break;\n\n case 'valueDq':\n if (char === '\"') state = 'afterValue';\n break;\n\n case 'valueSq':\n if (char === \"'\") state = 'afterValue';\n break;\n\n case 'valueUnquoted':\n if (isSpace(char)) {\n state = 'beforeAttrName';\n foldable = true;\n } else if (char === '>') endStartTag(i);\n break;\n\n case 'afterValue':\n if (isSpace(char)) {\n state = 'beforeAttrName';\n foldable = true;\n } else if (char === '/') state = 'selfClosing';\n else if (char === '>') endStartTag(i);\n else state = 'attrName'; // missing whitespace: reconsumed as a name\n break;\n\n case 'selfClosing':\n if (char === '>') endStartTag(i);\n else if (isSpace(char)) {\n state = 'beforeAttrName';\n foldable = true;\n } else state = 'attrName';\n break;\n\n case 'endTag':\n if (char === '>') {\n if (chars[i - 1] !== '/') breakAt = i;\n state = 'data';\n }\n break;\n\n case 'comment': {\n // `-->`, and the early endings: `<!-->`, `<!--->`, `--!>`.\n if (char !== '>') break;\n const inside = i - commentStart;\n if (\n inside === 0 ||\n (inside === 1 && chars[i - 1] === '-') ||\n (inside >= 2 && chars[i - 1] === '-' && chars[i - 2] === '-') ||\n (inside >= 3 && chars[i - 1] === '!' && chars[i - 2] === '-' && chars[i - 3] === '-')\n ) {\n state = 'data';\n }\n break;\n }\n\n case 'bogus':\n if (char === '>') state = 'data';\n break;\n\n case 'cdata':\n // In foreign content a CDATA section runs to `]]>`; in HTML it is a\n // bogus comment ending at the first `>`. Skipping to `]]>` folds less,\n // never wrongly; with no `]]>` at all, the first `>` it is.\n if (char === '>' && ((chars[i - 1] === ']' && chars[i - 2] === ']') || !cdataClosed)) {\n state = 'data';\n }\n break;\n\n case 'rawText': {\n // Only the element's own end tag ends it: `</` and its name, ASCII\n // case-insensitive, then whitespace, `/` or `>` — nothing else.\n if (char !== '<' || chars[i + 1] !== '/') break;\n const name = chars.slice(i + 2, i + 2 + rawName.length).join('');\n const after = chars[i + 2 + rawName.length];\n if (asciiLower(name) === rawName && after !== undefined && (isSpace(after) || after === '/' || after === '>')) {\n state = 'endTag';\n }\n break;\n }\n\n case 'stopped':\n break;\n }\n\n if (char === '\\n') {\n lineStart = i + 1;\n lineOctets = 0;\n foldAt = -1;\n breakAt = -1;\n continue;\n }\n // Only a space or a tab is turned into a break: a form feed or carriage\n // return is ignorable too, but not worth the doubt.\n if (foldable && (char === ' ' || char === '\\t')) foldAt = i;\n lineOctets += octetsOf(char);\n\n // Too wide: fold — and again, while it still is and a point is left. A\n // `>` after the space just folded at is in the new line, and still good.\n while (lineOctets > width) {\n if (foldAt >= lineStart) {\n // A space first: the break takes its place.\n out[foldAt] = '\\n';\n lineStart = foldAt + 1;\n foldAt = -1;\n } else if (breakAt > lineStart) {\n // Else before a tag's `>`, which starts the next line.\n out[breakAt] = '\\n>';\n lineStart = breakAt;\n breakAt = -1;\n } else break;\n lineOctets = 0;\n for (let j = lineStart; j <= i; j++) lineOctets += octetsOf(chars[j]);\n }\n }\n return out.join('');\n}\n","import { Command } from 'prosemirror-state';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { serializeToHTML } from '../html';\nimport { foldHTML } from '../fold';\nimport { emailPlainText } from '../plain-text';\nimport { mergeTagFields } from './nodes/merge-tag';\nimport { expressionDialect } from './dialects/dialect';\nimport { InlineImage, inlineImageRegistry, promoteInlineImages } from './inline-images';\nimport { withQuoted } from './quoted-history';\n\n/**\n * What the composer hands the host when the user asks to send: the canonical\n * HTML, its `text/plain` projection — the two parts of a well-formed\n * `multipart/alternative` body — the inline image parts that HTML references\n * (`multipart/related`, should the host want it), and the personalization\n * fields the body requires. Everything else (addressing, headers, transport)\n * is the host's; nothing network-shaped lives in this library.\n */\nexport interface SendIntent {\n /** The canonical HTML — with every data-URL image already promoted to a\n `cid:` reference (see {@link promoteInlineImages}); the document in the\n editor keeps its data URLs. Folded for the wire (see {@link foldHTML}):\n no line longer than the width wherever a space between a tag's\n attributes allows it, so a relay's 998-octet cut never lands in the\n middle of a tag — the same email to every parser, only line breaks\n where spaces were. */\n html: string;\n text: string;\n /** Every inline image `html` references, in document order: promoted\n data-URL images carry their bytes, pre-existing `cid:` references\n (an imported reply's parts, which the host already owns) carry none.\n Empty when the body has no inline images — plain\n `multipart/alternative` then. */\n inlineImages: InlineImage[];\n /** Every field identifier the body's merge tags read, in first-use order —\n the values the host must resolve before the mail can render. Straight\n off the document's nodes (see `mergeTagFields`), so a host without its\n own template engine never text-parses the HTML to discover them; a host\n with one (an AngularJS-expression evaluator, say) is free to ignore\n this and scan `html` itself. Empty when the body is template-free. */\n requiredFields: string[];\n}\n\nexport interface SendIntentOptions {\n /** Called with the ready payload whenever the user requests a send —\n `/send`, Mod-Enter (Gmail's shortcut), or the `requestSend` command. */\n onSend: (intent: SendIntent) => void;\n}\n\n/**\n * The send affordance — an *intent*, not a transport. The user's \"send\" is\n * just another editor action; what it produces is a payload event the host\n * wires to its own transport, exactly like the seed side (`replyDocument`)\n * feeds the same `html` signal from the other direction.\n *\n * Three ways in, one payload: the `/send` slash item, Mod-Enter, and the\n * `requestSend` command (for a toolbar button). The slash menu deletes the\n * `/send` query text *before* running the item's command, so the emitted\n * HTML is always clean of it.\n */\nexport const createSendIntent = (options: SendIntentOptions): FunctionalExtension => {\n const requestSend: Command = (state, dispatch) => {\n // Probing callers (menu enablement) pass no dispatch — don't send twice.\n if (dispatch) {\n // The promotion lives in the payload only — no transaction, the\n // document is not touched, the editor keeps showing its data URLs.\n // The quoted history goes out under the body, its images promoted too.\n const { doc, images } = promoteInlineImages(withQuoted(state.doc), inlineImageRegistry(state));\n const html = foldHTML(serializeToHTML(doc, state.schema));\n options.onSend({\n html,\n text: emailPlainText(html),\n inlineImages: images,\n // The installed dialect parses; without one the generic lexer guesses.\n requiredFields:\n expressionDialect(state)?.requiredFields(state.doc) ?? mergeTagFields(state.doc),\n });\n }\n return true;\n };\n\n return defineExtension({\n name: 'sendIntent',\n keymap: () => ({ 'Mod-Enter': requestSend }),\n commands: () => ({ requestSend: (): Command => requestSend }),\n actions: () => [\n {\n id: 'send',\n section: 'message',\n title: 'Send',\n keywords: ['send', 'mail', 'deliver', 'submit'],\n icon: 'send',\n command: requestSend,\n },\n ],\n });\n};\n","import { Fragment, Mark, Node, Schema } from 'prosemirror-model';\nimport { Command, EditorState, Plugin, PluginKey, Transaction } from 'prosemirror-state';\nimport { EditorView } from 'prosemirror-view';\nimport { FunctionalExtension, defineExtension } from '../extension';\nimport { AUTHORED_ATTR } from '../authored';\nimport { mergeTagRanges, scanMergeTags } from './nodes/merge-tag';\n\n/**\n * Fills the document's placeholders in with their values — the step a CRM\n * runs before a templated mail goes out (\"Platzhalter einsetzen\").\n *\n * A host whose evaluator takes text (core's TextParser: `parseStrings`)\n * would otherwise push the whole HTML body through it and take new HTML\n * back. That loses three ways: an expression with `&&`, `>` or `<` arrives\n * entity-escaped (`&&`) and fails to compile, a value is spliced\n * into the markup unescaped, and the swapped body takes the undo history\n * with it. Here the tokens are read off the document, where they are text:\n *\n * - the host is asked for each distinct expression **once, raw** —\n * `cf_3 > 0 && cf_4 ? 'x' : ''`, never an entity in sight;\n * - each value goes in **as text**, in the token's place and with its\n * formatting (a bold `{{ customer_lastName }}` becomes the bold name), a\n * line break in a value a hard break;\n * - all of it is **one transaction**: one Mod-Z brings the tokens back.\n *\n * Tokens in running text and in any string attribute of a node or mark — a\n * link's or a button's `href`, a button's label, an image's `src` or `alt`\n * — are filled alike, everywhere a renderer of the HTML would have looked.\n * With a selection holding tokens, only those are filled; else the whole\n * document.\n *\n * The request is asynchronous: the user may go on writing while the host\n * answers. The scope is mapped through every change made meanwhile, tokens\n * are found again when the values arrive, and a token edited in between is\n * left alone (its expression is not the one asked for). One request at a\n * time — {@link mergeTagResolutionPending} says when one is out.\n *\n * Bound to Mod-Shift-Enter — beside Mod-Enter's send, \"fill in, then send\";\n * free in every browser and on every keyboard layout — and declared as the\n * `resolve-placeholders` action, so it is a `/` menu row and a toolbar\n * button with no further wiring.\n */\n\n/** What became of a request — for the host's message (\"3 Platzhalter ohne\n Wert\"). */\nexport interface MergeTagResolutionReport {\n /** Where the request applied. */\n scope: 'selection' | 'document';\n /** How many token occurrences were replaced by a value. */\n filled: number;\n /** Expressions whose value came back empty — a field without a value, or\n one the evaluator could not compute (most say `''` for both). Their\n tokens are gone. */\n empty: string[];\n /** Expressions the host left unresolved (`null`): their tokens stay. */\n kept: string[];\n}\n\nexport interface MergeTagResolutionOptions {\n /**\n * Values for the distinct expressions asked for, in the same order — each\n * the trimmed text between the braces, as written. A string replaces the\n * token (`''` removes it); `null` or `undefined` leaves it as it is. The\n * editor never evaluates anything itself: this is the host's evaluator.\n *\n * ```ts\n * resolve: async (expressions) => {\n * const raw = Object.fromEntries(expressions.map((e, i) => [i, `{{${e}}}`]));\n * const parsed = await textParser.parseStrings(raw, referenceId, {});\n * return expressions.map((_, i) => parsed[i]);\n * }\n * ```\n */\n resolve: (expressions: string[]) => Promise<readonly (string | null | undefined)[]>;\n /** Called once the values are in the document. */\n onResolved?: (report: MergeTagResolutionReport) => void;\n /** Called when `resolve` rejects — the document is left as it was. */\n onError?: (error: unknown) => void;\n /** Called with `true` when a request goes out and `false` when it is\n settled — the host's spinner. */\n onPendingChange?: (pending: boolean) => void;\n}\n\n// ---------------------------------------------------------------------------\n// Where the tokens are\n\n/** One token occurrence: in running text, or in an attribute. */\ntype Occurrence =\n | { kind: 'text'; from: number; to: number; expr: string }\n | { kind: 'node'; pos: number; attr: string; expr: string }\n | { kind: 'mark'; from: number; to: number; mark: Mark; attr: string; expr: string };\n\n/** The expressions a string holds, trimmed — as the host is asked. */\nconst expressionsIn = (text: string): string[] =>\n scanMergeTags(text).map((tag) => text.slice(tag.expr[0], tag.expr[1]).trim());\n\n/** The attributes that can hold a token: strings — never the authored\n markup, which is the element as written and follows the modelled\n attributes on its own. */\nfunction tokenAttrs(attrs: Record<string, unknown>): [string, string][] {\n return Object.entries(attrs).filter(\n (entry): entry is [string, string] =>\n entry[0] !== AUTHORED_ATTR && typeof entry[1] === 'string' && entry[1].includes('{{'),\n );\n}\n\n/** Every token occurrence touching `[from, to)`, in document order. */\nfunction occurrences(doc: Node, from: number, to: number): Occurrence[] {\n const found: Occurrence[] = [];\n for (const tag of mergeTagRanges(doc)) {\n if (tag.to > from && tag.from < to) {\n found.push({ kind: 'text', from: tag.from, to: tag.to, expr: tag.expr.trim() });\n }\n }\n doc.nodesBetween(from, to, (node, pos) => {\n for (const [attr, value] of tokenAttrs(node.attrs)) {\n for (const expr of expressionsIn(value)) found.push({ kind: 'node', pos, attr, expr });\n }\n if (node.isText) {\n for (const mark of node.marks) {\n for (const [attr, value] of tokenAttrs(mark.attrs)) {\n for (const expr of expressionsIn(value)) {\n found.push({ kind: 'mark', from: pos, to: pos + node.nodeSize, mark, attr, expr });\n }\n }\n }\n }\n return true;\n });\n return found;\n}\n\n/** Whether a selection holds a token — then it, not the document, is the\n scope. */\nfunction scopeOf(state: EditorState): { from: number; to: number; selection: boolean } {\n const { from, to, empty } = state.selection;\n if (!empty && occurrences(state.doc, from, to).length) return { from, to, selection: true };\n return { from: 0, to: state.doc.content.size, selection: false };\n}\n\n// ---------------------------------------------------------------------------\n// Putting values in\n\n/** A string with its tokens replaced where `values` has a string. */\nfunction fillString(text: string, values: Map<string, string | null>): string {\n let out = '';\n let last = 0;\n for (const tag of scanMergeTags(text)) {\n const value = values.get(text.slice(tag.expr[0], tag.expr[1]).trim());\n if (typeof value !== 'string') continue;\n out += text.slice(last, tag.from) + value;\n last = tag.to;\n }\n return out + text.slice(last);\n}\n\n/** A value as inline content with `marks`: text, a hard break per line\n break when the schema has one. */\nfunction valueContent(schema: Schema, value: string, marks: readonly Mark[]): Fragment {\n const lines = value.replace(/\\r\\n?/g, '\\n').split('\\n');\n const hardBreak = schema.nodes['hardBreak'];\n const nodes: Node[] = [];\n lines.forEach((line, i) => {\n if (i > 0 && hardBreak) nodes.push(hardBreak.create());\n else if (i > 0) line = ` ${line}`;\n if (line) nodes.push(schema.text(line, marks));\n });\n return Fragment.from(nodes);\n}\n\n/** Applies `values` to every occurrence in `[from, to)`; returns how many\n were filled. Attributes first (they move nothing), then text from the\n end, so every position read off `doc` still holds when it is used. */\nfunction fill(tr: Transaction, from: number, to: number, values: Map<string, string | null>): number {\n const doc = tr.doc;\n const found = occurrences(doc, from, to).filter(\n (occurrence) => typeof values.get(occurrence.expr) === 'string',\n );\n\n const nodes = new Set<number>();\n const marks = new Set<string>();\n for (const occurrence of found) {\n if (occurrence.kind === 'node' && !nodes.has(occurrence.pos)) {\n nodes.add(occurrence.pos);\n const node = doc.nodeAt(occurrence.pos)!;\n const attrs = { ...node.attrs };\n for (const [attr, value] of tokenAttrs(node.attrs)) attrs[attr] = fillString(value, values);\n tr.setNodeMarkup(occurrence.pos, undefined, attrs, node.marks);\n }\n if (occurrence.kind === 'mark') {\n const key = `${occurrence.from}:${occurrence.mark.type.name}`;\n if (marks.has(key)) continue;\n marks.add(key);\n const attrs = { ...occurrence.mark.attrs };\n for (const [attr, value] of tokenAttrs(occurrence.mark.attrs)) {\n attrs[attr] = fillString(value, values);\n }\n tr.addMark(occurrence.from, occurrence.to, occurrence.mark.type.create(attrs));\n }\n }\n\n const mergeTag = doc.type.schema.marks['mergeTag'];\n const texts = found.filter((occurrence) => occurrence.kind === 'text').reverse();\n for (const occurrence of texts) {\n const marks = (tr.doc.nodeAt(occurrence.from)?.marks ?? []).filter((mark) => mark.type !== mergeTag);\n const content = valueContent(tr.doc.type.schema, values.get(occurrence.expr) as string, marks);\n tr.replaceWith(occurrence.from, occurrence.to, content);\n }\n return found.length;\n}\n\n// ---------------------------------------------------------------------------\n// The request\n\ninterface Pending {\n id: number;\n from: number;\n to: number;\n selection: boolean;\n}\n\ninterface ResolutionState {\n pending: Pending | null;\n}\n\ntype ResolutionMeta = { start: Pending } | { settle: number };\n\nconst resolutionKey = new PluginKey<ResolutionState>('mergeTagResolution');\n\n/** Whether a request is out — the action is disabled meanwhile, and a\n host can show it. */\nexport function mergeTagResolutionPending(state: EditorState): boolean {\n return !!resolutionKey.getState(state)?.pending;\n}\n\nlet requests = 0;\n\n/**\n * The placeholder fill: `resolve` asks the host, `onResolved` reports. See\n * the file comment for the contract; the command is `resolveMergeTags`, the\n * action `resolve-placeholders`, the key Mod-Shift-Enter.\n */\nexport const createMergeTagResolution = (options: MergeTagResolutionOptions): FunctionalExtension => {\n /** Ends request `id` — with the values filled in, when given — unless\n the editor is gone; says whether it did. */\n const settle = (\n view: EditorView,\n id: number,\n fillIn?: (tr: Transaction, pending: Pending) => void,\n ): boolean => {\n if (view.isDestroyed) return false;\n const pending = resolutionKey.getState(view.state)?.pending;\n if (!pending || pending.id !== id) return false;\n const tr = view.state.tr.setMeta(resolutionKey, { settle: id } satisfies ResolutionMeta);\n fillIn?.(tr, pending);\n view.dispatch(tr);\n options.onPendingChange?.(false);\n return true;\n };\n\n const resolveMergeTags: Command = (state, dispatch, view) => {\n if (mergeTagResolutionPending(state)) return false;\n const scope = scopeOf(state);\n const found = occurrences(state.doc, scope.from, scope.to);\n if (!found.length) return false;\n if (!dispatch || !view) return true;\n\n const expressions = [...new Set(found.map((occurrence) => occurrence.expr))];\n const id = ++requests;\n dispatch(\n state.tr\n .setMeta(resolutionKey, { start: { id, ...scope } } satisfies ResolutionMeta)\n .setMeta('addToHistory', false),\n );\n options.onPendingChange?.(true);\n\n options.resolve(expressions).then(\n (answers) => {\n const values = new Map(expressions.map((expr, i) => [expr, answers[i] ?? null]));\n let filled = 0;\n const settled = settle(view, id, (tr, pending) => {\n filled = fill(tr, pending.from, pending.to, values);\n if (filled) tr.scrollIntoView();\n });\n if (!settled) return;\n options.onResolved?.({\n scope: scope.selection ? 'selection' : 'document',\n filled,\n empty: expressions.filter((expr) => values.get(expr) === ''),\n kept: expressions.filter((expr) => values.get(expr) === null),\n });\n },\n (error: unknown) => {\n settle(view, id);\n options.onError?.(error);\n },\n );\n return true;\n };\n\n return defineExtension({\n name: 'mergeTagResolution',\n plugins: () => [\n new Plugin<ResolutionState>({\n key: resolutionKey,\n state: {\n init: () => ({ pending: null }),\n apply: (tr, value) => {\n const meta = tr.getMeta(resolutionKey) as ResolutionMeta | undefined;\n if (meta && 'start' in meta) return { pending: meta.start };\n if (meta && 'settle' in meta) return { pending: null };\n if (!value.pending || !tr.docChanged) return value;\n // The scope follows what is written meanwhile.\n const { pending } = value;\n return {\n pending: {\n ...pending,\n from: tr.mapping.map(pending.from, -1),\n to: tr.mapping.map(pending.to, 1),\n },\n };\n },\n },\n }),\n ],\n keymap: () => ({ 'Mod-Shift-Enter': resolveMergeTags }),\n commands: () => ({ resolveMergeTags: (): Command => resolveMergeTags }),\n actions: () => [\n {\n id: 'resolve-placeholders',\n section: 'message',\n title: 'Fill in placeholders',\n keywords: ['placeholders', 'merge tags', 'fill', 'resolve', 'parse', 'variables', 'fields'],\n icon: 'data_object',\n command: resolveMergeTags,\n // Asked on every transaction: a scan, never a request.\n isEnabled: (state) =>\n !mergeTagResolutionPending(state) && occurrences(state.doc, 0, state.doc.content.size).length > 0,\n },\n ],\n });\n};\n","import { DestroyRef, Injectable, inject, signal } from '@angular/core';\nimport {\n InlineImageStore,\n rewriteInlineImageSources,\n} from './prose-mirror/extensions/inline-images';\n\n/** A blob as a data URL — what the preview's opaque-origin sandbox can load. */\nfunction toDataUrl(blob: Blob): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result as string);\n reader.onerror = () => reject(reader.error);\n reader.readAsDataURL(blob);\n });\n}\n\n/**\n * The inline image registry as an Angular service — the wiring around the\n * framework-free {@link InlineImageStore}: one per composer (provide it on\n * the composer component, never in root — two composers must not share\n * parts), a signal that bumps on every change so the preview and the host\n * can react, data URLs for the preview (a sandboxed, opaque-origin frame\n * cannot load the editor's blob URLs), and every URL revoked with the\n * composer. The editor pane hands it to `createInlineImages`; the host feeds\n * it an import's parts and reads the referenced ones for a draft.\n */\n@Injectable()\nexport class InlineImages extends InlineImageStore {\n readonly #version = signal(0);\n readonly #dataUrls = new Map<string, string>();\n\n /** Bumps on every registered part (and again once its data URL is ready);\n read it in a `computed`/`effect` to re-derive from the registry. */\n readonly version = this.#version.asReadonly();\n\n constructor() {\n super();\n this.subscribe(() => this.#version.update((v) => v + 1));\n inject(DestroyRef).onDestroy(() => this.revokeAll());\n }\n\n override add(blob: Blob, cid?: string): string {\n const id = super.add(blob, cid);\n void toDataUrl(blob).then((url) => {\n if (this.blob(id) !== blob) return; // replaced meanwhile\n this.#dataUrls.set(id, url);\n this.#version.update((v) => v + 1);\n });\n return id;\n }\n\n override revokeAll(): void {\n this.#dataUrls.clear();\n super.revokeAll();\n }\n\n /** The part as a data URL, once read; undefined until then. */\n dataUrl(cid: string): string | undefined {\n return this.#dataUrls.get(cid);\n }\n\n /** The preview's projection of the canonical HTML: every `cid:` source the\n registry holds becomes a data URL. Reads {@link version}, so a\n `computed` over it re-runs when a part arrives. */\n previewHtml(html: string): string {\n this.version();\n return rewriteInlineImageSources(html, (cid) => this.dataUrl(cid));\n }\n}\n","/*\n * Public API Surface of angular-email-editor\n */\n\nexport * from './lib/prose-mirror';\nexport * from './lib/inline-images';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["splitDeclarations","parseDeclarations","clamp","addColumn","removeColumn","inlineValue","matchingBrace","alignmentOf","isBlock","BLOCK_TAGS","isSafeUrl","scopeOf","hasBlockChildren","ProseMirrorDOMParser","escapeText","openTag","escapeAttribute","splitStyleExactly","tagString","ENGLISH","Document","pmSplitListItem","toggleMark","key"],"mappings":";;;;;;;;;;;;;;;AAuEA;;;;AAI4B;AACrB,MAAM,eAAe,GAAG,CAAC,MAAoB,EAAE,KAAkB,KACtE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK;MAoFtD,UAAU,GAAG,CAAC,SAAsC,MAAqB;AACpF,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,GAAG,SAAS;AACb,CAAA;MAEY,UAAU,GAAG,CAAC,SAAsC,MAAqB;AACpF,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,GAAG,SAAS;AACb,CAAA;MAEY,eAAe,GAAG,CAC7B,SAA4C,MACnB;AACzB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,GAAG,SAAS;AACb,CAAA;AAED;AACO,MAAM,gBAAgB,GAAG,CAAC,GAAqB,KACpD,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE;AAEtE;AAC0F;AACnF,MAAM,oBAAoB,GAAG,CAAC,GAAqB,KACxD,gBAAgB,CAAC,GAAG;;ACrLtB;;;;;;AAMG;SACa,eAAe,CAC7B,GAAW,EACX,KAAoD,EACpD,OAAgB,EAAA;IAEhB,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,EAAE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