@labnol/email-editor 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +188 -2
- package/dist/index.js +1772 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +744 -0
- package/licenses/material-symbols.txt +202 -0
- package/package.json +81 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["DIRECTIONS","_jsx","_jsxs","_jsxs","_jsx","_jsxs","_Fragment","_jsx","_jsx","_jsx","_jsxs","_Fragment","_jsx","_jsxs"],"sources":["../src/colors.js","../src/direction.js","../src/textDirection.js","../src/uploadPlaceholder.js","../src/extensions.js","../src/icons.jsx","../src/Popover.jsx","../src/FieldsMenu.jsx","../src/html.js","../src/image.js","../src/shortcuts.js","../src/toolbar-items.js","../src/Tooltip.jsx","../src/Toolbar.jsx","../src/EmailEditor.jsx"],"sourcesContent":["// A 35-colour palette: seven hues across five shades, with black, white and greys.\nexport const DEFAULT_COLORS = [\n '#000000',\n '#e60000',\n '#ff9900',\n '#ffff00',\n '#008a00',\n '#0066cc',\n '#9933ff',\n '#ffffff',\n '#facccc',\n '#ffebcc',\n '#ffffcc',\n '#cce8cc',\n '#cce0f5',\n '#ebd6ff',\n '#bbbbbb',\n '#f06666',\n '#ffc266',\n '#ffff66',\n '#66b966',\n '#66a3e0',\n '#c285ff',\n '#888888',\n '#a10000',\n '#b26b00',\n '#b2b200',\n '#006100',\n '#0047b2',\n '#6b24b2',\n '#444444',\n '#5c0000',\n '#663d14',\n '#666600',\n '#003700',\n '#002966',\n '#3d1466',\n];\n","// Right-to-left scripts: Arabic (also Persian and Urdu), Hebrew, Syriac, Thaana (Dhivehi), N'Ko, Adlam, Samaritan,\n// Mandaic, Hanifi Rohingya, Yezidi, Mende Kikakui, Old Hungarian, and the historic RTL scripts.\nconst RTL_SCRIPT =\n /[\\p{Script=Arabic}\\p{Script=Hebrew}\\p{Script=Syriac}\\p{Script=Thaana}\\p{Script=Nko}\\p{Script=Adlam}\\p{Script=Samaritan}\\p{Script=Mandaic}\\p{Script=Hanifi_Rohingya}\\p{Script=Yezidi}\\p{Script=Mende_Kikakui}\\p{Script=Old_Hungarian}\\p{Script=Imperial_Aramaic}\\p{Script=Phoenician}\\p{Script=Avestan}\\p{Script=Kharoshthi}\\p{Script=Old_South_Arabian}\\p{Script=Nabataean}\\p{Script=Palmyrene}\\p{Script=Manichaean}\\p{Script=Psalter_Pahlavi}\\p{Script=Inscriptional_Pahlavi}\\p{Script=Inscriptional_Parthian}\\p{Script=Old_North_Arabian}\\p{Script=Hatran}\\p{Script=Elymaic}\\p{Script=Sogdian}\\p{Script=Old_Sogdian}\\p{Script=Chorasmian}\\p{Script=Lydian}\\p{Script=Cypriot}\\p{Script=Old_Turkic}]/u;\n\n// Letters decide direction; digits, punctuation, spaces and emoji do not\nconst LETTER = /\\p{L}/u;\n\n// Merge fields are column names, often in another language from the email, so they do not decide its direction\nconst FIELDS = /\\{\\{[^{}]*\\}\\}|<<[^<>]*>>/g;\n\n/**\n * The direction of a piece of text, from its first letter: the Unicode bidi rule Gmail and Google Docs use for\n * \"auto\" direction, except that {{merge fields}} are skipped.\n * @param {string | null | undefined} text\n * @returns {'rtl' | 'ltr' | null} null when the text has no letters\n */\nexport const detectDirection = (text) => {\n if (!text) return null;\n for (const char of String(text).replace(FIELDS, ' ')) {\n if (LETTER.test(char)) return RTL_SCRIPT.test(char) ? 'rtl' : 'ltr';\n }\n return null;\n};\n","import { Extension } from '@tiptap/core';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\n\nimport { detectDirection } from './direction';\n\nconst TEXT_BLOCKS = ['paragraph', 'heading'];\nconst CONTAINERS = ['blockquote', 'bulletList', 'orderedList'];\nconst DIRECTIONS = ['ltr', 'rtl'];\n\nconst validDirection = (value) => (DIRECTIONS.includes(value) ? value : null);\n\n/**\n * The dir attribute to write for a direction. In a left-to-right editor, left-to-right blocks get none, so ordinary\n * emails stay free of dir attributes. In a right-to-left editor every block says which way it runs, because the\n * email has no wrapper element to inherit a direction from.\n * @param {'ltr' | 'rtl'} direction\n * @param {'ltr' | 'rtl'} base The editor's direction\n */\nconst attributeFor = (direction, base) => (direction === 'ltr' && base === 'ltr' ? null : direction);\n\n/**\n * Text direction per block, so Arabic, Hebrew, Persian and Urdu paragraphs run right to left in the email.\n *\n * Each paragraph and heading takes its direction from its first letter (merge fields skipped), unless the writer\n * picked one with setDirection. Lists and quotes follow their first paragraph, so bullets and the quote bar sit on\n * the right side. Blocks with no letters take the editor's own direction.\n *\n * The attributes are `dir`, written to the HTML, and `dirAuto`, kept only in the editor: false once the writer has\n * chosen a direction. HTML loaded with a dir that matches its text is treated as automatic, so editing it later\n * still follows the text.\n */\nexport const TextDirection = Extension.create({\n name: 'emailTextDirection',\n\n addOptions() {\n return { direction: 'ltr' };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: [...TEXT_BLOCKS, ...CONTAINERS],\n attributes: {\n dir: {\n default: null,\n parseHTML: (element) => validDirection(element.getAttribute('dir')),\n renderHTML: ({ dir }) => (dir ? { dir } : {}),\n },\n dirAuto: {\n default: true,\n rendered: false,\n parseHTML: (element) => {\n const dir = validDirection(element.getAttribute('dir'));\n if (!dir) return true;\n const detected = detectDirection(element.textContent);\n return detected === null || detected === dir;\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n /**\n * Set the direction of the blocks in the selection: 'auto' follows the text again.\n * @param {'auto' | 'ltr' | 'rtl'} mode\n */\n setDirection:\n (mode) =>\n ({ tr, state, dispatch }) => {\n const { from, to } = state.selection;\n const base = this.options.direction;\n if (dispatch) {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!TEXT_BLOCKS.includes(node.type.name) && !CONTAINERS.includes(node.type.name)) return;\n const attrs =\n mode === 'auto' ? { dirAuto: true } : { dirAuto: false, dir: attributeFor(mode, base) ?? mode };\n tr.setNodeMarkup(pos, undefined, { ...node.attrs, ...attrs });\n });\n }\n return true;\n },\n };\n },\n\n addProseMirrorPlugins() {\n const base = this.options.direction;\n\n const effective = (node) => node.attrs.dir ?? base;\n\n return [\n new Plugin({\n key: new PluginKey('emailTextDirection'),\n appendTransaction: (transactions, _oldState, newState) => {\n if (!transactions.some((transaction) => transaction.docChanged)) return null;\n const { tr } = newState;\n\n // Paragraphs and headings follow their own text\n newState.doc.descendants((node, pos) => {\n if (!TEXT_BLOCKS.includes(node.type.name) || node.attrs.dirAuto === false) return;\n const direction = detectDirection(node.textContent) ?? base;\n const dir = attributeFor(direction, base);\n if (dir !== node.attrs.dir) tr.setNodeMarkup(pos, undefined, { ...node.attrs, dir });\n });\n\n // Lists and quotes follow their first paragraph, innermost first\n const containers = [];\n tr.doc.descendants((node, pos) => {\n if (CONTAINERS.includes(node.type.name) && node.attrs.dirAuto !== false) containers.push({ pos });\n });\n containers.reverse().forEach(({ pos }) => {\n const node = tr.doc.nodeAt(pos);\n let first = null;\n node.descendants((child) => {\n if (first) return false;\n if (child.isTextblock) first = child;\n return !first;\n });\n const dir = attributeFor(first ? effective(first) : base, base);\n if (dir !== node.attrs.dir) tr.setNodeMarkup(pos, undefined, { ...node.attrs, dir });\n });\n\n return tr.docChanged ? tr : null;\n },\n }),\n ];\n },\n});\n","import { Extension } from '@tiptap/core';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\n\nconst key = new PluginKey('emailUploadPlaceholder');\n\nconst widget = (src) => {\n const element = document.createElement('span');\n element.className = 'lee-upload';\n element.setAttribute('contenteditable', 'false');\n element.setAttribute('aria-label', 'Uploading image');\n element.setAttribute('role', 'img');\n if (src) {\n const preview = document.createElement('img');\n preview.src = src;\n preview.alt = '';\n element.append(preview);\n }\n const spinner = document.createElement('span');\n spinner.className = 'lee-upload-spinner';\n element.append(spinner);\n return element;\n};\n\n/**\n * Shows a faded preview with a spinner where an uploading image will go. It is a decoration, not part of the\n * document, so it never reaches onChange or the undo history, and its position moves with edits around it.\n */\nexport const UploadPlaceholder = Extension.create({\n name: 'emailUploadPlaceholder',\n\n addProseMirrorPlugins() {\n return [\n new Plugin({\n key,\n state: {\n init: () => DecorationSet.empty,\n apply(tr, set) {\n let next = set.map(tr.mapping, tr.doc);\n const action = tr.getMeta(key);\n if (action?.add) {\n const { id, pos, src } = action.add;\n // side 1: an image inserted at this spot goes before later placeholders there, so several keep their order\n const deco = Decoration.widget(pos, () => widget(src), { id, side: 1, key: String(id.key) });\n next = next.add(tr.doc, [deco]);\n } else if (action?.remove) {\n next = next.remove(next.find(undefined, undefined, (spec) => spec.id === action.remove.id));\n }\n return next;\n },\n },\n props: {\n decorations(state) {\n return this.getState(state);\n },\n },\n }),\n ];\n },\n});\n\nlet counter = 0;\n\n/**\n * Show a placeholder at a position.\n * @param {import('@tiptap/core').Editor} editor\n * @param {number} pos\n * @param {string} [src] A preview, such as an object URL for the file\n * @returns {object} An id for findPlaceholder and removePlaceholder\n */\nexport const addPlaceholder = (editor, pos, src) => {\n counter += 1;\n const id = { key: counter };\n editor.view.dispatch(editor.state.tr.setMeta(key, { add: { id, pos, src } }));\n return id;\n};\n\n/**\n * Where a placeholder is now, after any edits since it was added, or null when it is gone.\n * @param {import('@tiptap/core').Editor} editor\n * @param {object} id\n */\nexport const findPlaceholder = (editor, id) => {\n const found = key.getState(editor.state)?.find(undefined, undefined, (spec) => spec.id === id);\n return found?.length ? found[0].from : null;\n};\n\n/**\n * @param {import('@tiptap/core').Editor} editor\n * @param {object} id\n */\nexport const removePlaceholder = (editor, id) => {\n editor.view.dispatch(editor.state.tr.setMeta(key, { remove: { id } }));\n};\n","import { FileHandler } from '@tiptap/extension-file-handler';\nimport { Image } from '@tiptap/extension-image';\nimport { TextAlign } from '@tiptap/extension-text-align';\nimport { BackgroundColor, Color, TextStyle } from '@tiptap/extension-text-style';\nimport { Placeholder } from '@tiptap/extensions';\nimport { Markdown } from '@tiptap/markdown';\nimport { StarterKit } from '@tiptap/starter-kit';\n\nimport { TextDirection } from './textDirection';\nimport { UploadPlaceholder } from './uploadPlaceholder';\n\n/**\n * The editor's extensions. Every mark writes inline styles or plain tags, because email clients ignore classes.\n * @param {object} options\n * @param {'html' | 'markdown'} options.format\n * @param {'ltr' | 'rtl'} options.direction The editor's direction, for blocks with no letters\n * @param {string} [options.placeholder]\n * @param {string[]} options.imageTypes MIME types accepted on paste and drop\n * @param {boolean} options.resizableImages\n * @param {(files: File[], pos?: number) => void} [options.onFiles] Called with pasted or dropped images; omit to ignore them\n * @param {import('@tiptap/core').AnyExtension[]} [options.extensions] Extra extensions from the caller\n */\nexport const createExtensions = ({\n format,\n direction,\n placeholder,\n imageTypes,\n resizableImages,\n onFiles,\n extensions = [],\n}) => [\n StarterKit.configure({\n heading: { levels: [1, 2, 3, 4] },\n code: false,\n horizontalRule: false,\n link: {\n openOnClick: false,\n autolink: true,\n defaultProtocol: 'https',\n HTMLAttributes: { target: '_blank', rel: 'noopener noreferrer', class: null },\n },\n }),\n TextStyle,\n Color,\n BackgroundColor,\n TextAlign.configure({ types: ['heading', 'paragraph'] }),\n TextDirection.configure({ direction }),\n Image.configure({\n inline: true,\n // Email clients block data: images, so pasted or stored base64 images are dropped; uploads give hosted URLs\n allowBase64: false,\n HTMLAttributes: { style: 'max-width: 100%; height: auto;' },\n // Markdown cannot store an image size\n resize:\n resizableImages && format !== 'markdown'\n ? { enabled: true, alwaysPreserveAspectRatio: true, minWidth: 24, minHeight: 24 }\n : false,\n }),\n ...(onFiles\n ? [\n UploadPlaceholder,\n FileHandler.configure({\n allowedMimeTypes: imageTypes,\n consumePasteEvent: true,\n onPaste: (_editor, files) => onFiles(files),\n onDrop: (_editor, files, pos) => onFiles(files, pos),\n }),\n ]\n : []),\n ...(format === 'markdown' ? [Markdown] : []),\n ...(placeholder ? [Placeholder.configure({ placeholder })] : []),\n ...extensions,\n];\n","// Material Symbols (Rounded, weight 400) by Google, Apache License 2.0: https://fonts.google.com/icons\n// The license is in licenses/material-symbols.txt. Path data copied from @material-symbols/svg-400.\n\nconst Svg = ({ size = 20, className, children }) => (\n <svg\n viewBox='0 -960 960 960'\n width={size}\n height={size}\n fill='currentColor'\n className={className}\n aria-hidden='true'\n focusable='false'\n >\n {children}\n </svg>\n);\n\nexport const UndoIcon = () => (\n <Svg>\n <path d='M289-200q-13 0-21.5-8.5T259-230q0-13 8.5-21.5T289-260h280q70 0 120.5-46.5T740-422q0-69-50.5-115.5T569-584H274l93 93q9 9 9 21t-9 21q-9 9-21 9t-21-9L181-593q-5-5-7-10t-2-11q0-6 2-11t7-10l144-144q9-9 21-9t21 9q9 9 9 21t-9 21l-93 93h294q95 0 163.5 64T800-422q0 94-68.5 158T568-200H289Z' />\n </Svg>\n);\n\nexport const RedoIcon = () => (\n <Svg>\n <path d='M686-584H391q-70 0-120.5 46.5T220-422q0 69 50.5 115.5T391-260h280q13 0 21.5 8.5T701-230q0 13-8.5 21.5T671-200H392q-95 0-163.5-64T160-422q0-94 68.5-158T392-644h294l-93-93q-9-9-9-21t9-21q9-9 21-9t21 9l144 144q5 5 7 10t2 11q0 6-2 11t-7 10L635-449q-9 9-21 9t-21-9q-9-9-9-21t9-21l93-93Z' />\n </Svg>\n);\n\nexport const Bold = () => (\n <Svg>\n <path d='M335-200q-25 0-42.5-17.5T275-260v-440q0-25 17.5-42.5T335-760h168q66 0 114.5 42T666-612q0 38-21 70t-56 49v6q43 14 69.5 50t26.5 81q0 68-52.5 112T510-200H335Zm26-76h144q38 0 66-25t28-63q0-37-28-62t-66-25H361v175Zm0-247h136q35 0 60.5-23t25.5-58q0-35-25.5-58.5T497-686H361v163Z' />\n </Svg>\n);\n\nexport const Italic = () => (\n <Svg>\n <path d='M264-199q-16.8 0-28.4-11.64-11.6-11.64-11.6-28.5t11.6-28.36Q247.2-279 264-279h94l139-409H378q-16.8 0-28.4-11.64-11.6-11.64-11.6-28.5t11.6-28.36Q361.2-768 378-768h300q16.8 0 28.4 11.64 11.6 11.64 11.6 28.5t-11.6 28.36Q694.8-688 678-688h-94L445-279h119q16.8 0 28.4 11.64 11.6 11.64 11.6 28.5t-11.6 28.36Q580.8-199 564-199H264Z' />\n </Svg>\n);\n\nexport const Underline = () => (\n <Svg>\n <path d='M230-140q-13 0-21.5-8.5T200-170q0-13 8.5-21.5T230-200h500q13 0 21.5 8.5T760-170q0 13-8.5 21.5T730-140H230Zm93.5-198.5Q267-397 267-497v-302q0-17 12.5-29t29.5-12q17 0 29 12t12 29v302q0 63 34 101t96 38q62 0 96-38t34-101v-302q0-17 12.5-29t29.5-12q17 0 29 12t12 29v302q0 100-56.5 158.5T480-280q-100 0-156.5-58.5Z' />\n </Svg>\n);\n\nexport const Strike = () => (\n <Svg>\n <path d='M110-410q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32Q97.25-470 110-470h740q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H110Zm320-120v-170H250q-20.83 0-35.42-14.62Q200-729.24 200-750.12q0-20.88 14.58-35.38Q229.17-800 250-800h460q20.83 0 35.42 14.62Q760-770.76 760-749.88q0 20.88-14.58 35.38Q730.83-700 710-700H530v170H430Zm0 180h100v140q0 20.83-14.62 35.42Q500.76-160 479.88-160q-20.88 0-35.38-14.58Q430-189.17 430-210v-140Z' />\n </Svg>\n);\n\nexport const BulletListIcon = () => (\n <Svg>\n <path d='M407-198q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h403q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H407Zm0-252q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h403q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H407Zm0-253q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h403q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H407ZM189-161q-28.05 0-48.02-19Q121-199 121-227.5t19.5-48q19.5-19.5 48-19.5t47.5 19.98q19 19.97 19 48.02 0 27.23-19.39 46.61Q216.23-161 189-161Zm0-252q-28.05 0-48.02-19.5Q121-452 121-480t19.98-47.5Q160.95-547 189-547q27.23 0 46.61 19.5Q255-508 255-480t-19.39 47.5Q216.23-413 189-413Zm-48.5-272.5Q121-705 121-733t19.5-47.5Q160-800 188-800t47.5 19.5Q255-761 255-733t-19.5 47.5Q216-666 188-666t-47.5-19.5Z' />\n </Svg>\n);\n\nexport const OrderedListIcon = () => (\n <Svg>\n <path d='M150-80q-13 0-21.5-8.5T120-110q0-13 8.5-21.5T150-140h70v-30h-30q-13 0-21.5-8.5T160-200q0-13 8.5-21.5T190-230h30v-30h-70q-13 0-21.5-8.5T120-290q0-13 8.5-21.5T150-320h90q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80h-90Zm-7-280q-9 0-16-7t-7-16v-87q0-17 11.5-28.5T160-510h60v-30h-70q-13 0-21.5-8.5T120-570q0-13 8.5-21.5T150-600h90q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h70q13 0 21.5 8.5T280-390q0 13-8.5 21.5T250-360H143Zm45.5-288.5Q180-657 180-670v-150h-30q-13 0-21.5-8.5T120-850q0-13 8.5-21.5T150-880h68q9 0 15.5 6.5T240-858v188q0 13-8.5 21.5T210-640q-13 0-21.5-8.5ZM399-209q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h411q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H399Zm0-243q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h411q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H399Zm0-243q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h411q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H399Z' />\n </Svg>\n);\n\nexport const AlignLeftIcon = () => (\n <Svg>\n <path d='M150-120q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z' />\n </Svg>\n);\n\nexport const AlignCenterIcon = () => (\n <Svg>\n <path d='M150-120q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm160-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h340q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H310ZM150-450q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm160-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h340q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H310ZM150-780q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z' />\n </Svg>\n);\n\nexport const AlignRightIcon = () => (\n <Svg>\n <path d='M150-780q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm240 165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H390ZM150-450q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm240 165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h420q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H390ZM150-120q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z' />\n </Svg>\n);\n\nexport const AlignJustifyIcon = () => (\n <Svg>\n <path d='M150-120q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Zm0-165q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h660q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H150Z' />\n </Svg>\n);\n\nexport const RtlIcon = () => (\n <Svg>\n <path d='M450-820v430q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-190q-66 0-113-43t-47-106.5q0-63.5 43.5-107T380-880h250q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-60v430q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-430h-60ZM234-196l53 53q9 9 9 21t-9 21q-9 9-21 9t-21-9L141-205q-9-9-9-21t9-21l104-104q9-9 21-9t21 9q9 9 9 21t-9 21l-53 53h576q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H234Zm156-444v-180q-42 0-71 24t-29 66q0 42 29 66t71 24Zm0-90Z' />\n </Svg>\n);\n\nexport const QuoteIcon = () => (\n <Svg>\n <path d='m275-287 67-115q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T458-480L329-255q-4 8-11.5 11.5T302-240q-18 0-27-15.5t0-31.5Zm360 0 67-115q-5 1-11 1.5t-11 .5q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 21-5.5 41T818-480L689-255q-4 8-11.5 11.5T662-240q-18 0-27-15.5t0-31.5ZM376.5-503.5Q400-527 400-560t-23.5-56.5Q353-640 320-640t-56.5 23.5Q240-593 240-560t23.5 56.5Q287-480 320-480t56.5-23.5Zm360 0Q760-527 760-560t-23.5-56.5Q713-640 680-640t-56.5 23.5Q600-593 600-560t23.5 56.5Q647-480 680-480t56.5-23.5ZM680-560Zm-360 0Z' />\n </Svg>\n);\n\nexport const CodeBlockIcon = () => (\n <Svg>\n <path d='m330-480 70-70q9-9 9-22t-9-22q-9-9-21.83-9-12.84 0-22.17 9l-93 93q-5 5-7 10.13-2 5.14-2 11 0 5.87 2 10.87 2 5 7 10l94 94q9.33 9 22.17 9 12.83 0 21.83-9 9-9 9-22t-9-22l-71-71Zm300 0-71 71q-9 9-9 22t9 22q9 9 21.83 9 12.84 0 22.17-9l94-94q5-5 7-10.13 2-5.14 2-11 0-5.87-2-10.87-2-5-7-10l-94-94q-4-5-10-7t-12-2q-6 0-11.5 2t-10.17 6.8q-9.33 9.6-9.33 22.4 0 12.8 9 21.8l71 71ZM180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0-600v600-600Z' />\n </Svg>\n);\n\nexport const LinkIcon = () => (\n <Svg>\n <path d='M280-280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H280q-58.33 0-99.17 40.76-40.83 40.77-40.83 99Q140-422 180.83-381q40.84 41 99.17 41h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H280Zm75-170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h250q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H355Zm185 170q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140q58.33 0 99.17-40.76 40.83-40.77 40.83-99Q820-538 779.17-579q-40.84-41-99.17-41H540q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H540Z' />\n </Svg>\n);\n\nexport const ImageIcon = () => (\n <Svg>\n <path d='M180-120q-24 0-42-18t-18-42v-600q0-24 18-42t42-18h600q24 0 42 18t18 42v600q0 24-18 42t-42 18H180Zm0-60h600v-600H180v600Zm0 0v-600 600Zm86-97h429q8.5 0 12.75-8t-.75-16L590-457q-5-6-12-6t-12 6L446-302l-81-111q-5-6-12-6t-12 6l-86 112q-6 8-1.75 16t12.75 8Zm109.5-307.62q14.5-14.62 14.5-35.5 0-20.88-14.62-35.38-14.62-14.5-35.5-14.5-20.88 0-35.38 14.62-14.5 14.62-14.5 35.5 0 20.88 14.62 35.38 14.62 14.5 35.5 14.5 20.88 0 35.38-14.62Z' />\n </Svg>\n);\n\nexport const ClearIcon = () => (\n <Svg>\n <path d='M678-220h173q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H618l60-60Zm-486 60q-5.91 0-11.46-2-5.54-2-10.54-7l-72-75q-18-17-17.5-41.5T97-327l458-498q16-17 40.57-17 24.56 0 41.43 17l205 215q17 17 18 42t-16 42L512-170q-4.55 5-10.24 7.5T490-160H192Zm288-60 324-352-207-217-455 503 64 66h274Zm0-260Z' />\n </Svg>\n);\n\nexport const FieldIcon = () => (\n <Svg>\n <path d='M600-160q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h90q21.25 0 35.63-14.38Q740-248.75 740-270v-100q0-37 22.5-66t57.5-40v-8q-35-10-57.5-39.5T740-590v-100q0-21.25-14.37-35.63Q711.25-740 690-740h-90q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h90q45.83 0 77.92 32.08Q800-735.83 800-690v100q0 21.25 14.38 35.62Q828.75-540 850-540q12.75 0 21.38 8.65 8.62 8.64 8.62 21.42v60.15q0 12.78-8.62 21.28-8.63 8.5-21.38 8.5-21.25 0-35.62 14.37Q800-391.25 800-370v100q0 45.83-32.08 77.92Q735.83-160 690-160h-90Zm-330 0q-45.83 0-77.92-32.08Q160-224.17 160-270v-100q0-21.25-14.37-35.63Q131.25-420 110-420q-12.75 0-21.37-8.65Q80-437.29 80-450.07v-60.15q0-12.78 8.63-21.28Q97.25-540 110-540q21.25 0 35.63-14.38Q160-568.75 160-590v-100q0-45.83 32.08-77.92Q224.17-800 270-800h90q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-90q-21.25 0-35.62 14.37Q220-711.25 220-690v100q0 37-22.5 66.5T140-484v8q35 11 57.5 40t22.5 66v100q0 21.25 14.38 35.62Q248.75-220 270-220h90q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-90Z' />\n </Svg>\n);\n\nexport const LtrIcon = () => (\n <Svg>\n <path d='M450-820v430q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-190q-66 0-113-43t-47-106.5q0-63.5 43.5-107T380-880h250q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5h-60v430q0 12.75-8.68 21.37-8.67 8.63-21.5 8.63-12.82 0-21.32-8.63-8.5-8.62-8.5-21.37v-430h-60Zm-60 180v-180q-42 0-71 24t-29 66q0 42 29 66t71 24Zm0-90Zm336 534H150q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h576l-53-53q-9-9-9-21t9-21q9-9 21-9t21 9l104 104q9 9 9 21t-9 21L715-101q-9 9-21 9t-21-9q-9-9-9-21t9-21l53-53Z' />\n </Svg>\n);\n\nexport const SearchIcon = () => (\n <Svg size={18}>\n <path d='M378-329q-108.16 0-183.08-75Q120-479 120-585t75-181q75-75 181.5-75t181 75Q632-691 632-584.85 632-542 618-502q-14 40-42 75l242 240q9 8.56 9 21.78T818-143q-9 9-22.22 9-13.22 0-21.78-9L533-384q-30 26-69.96 40.5Q423.08-329 378-329Zm-1-60q81.25 0 138.13-57.5Q572-504 572-585t-56.87-138.5Q458.25-781 377-781q-82.08 0-139.54 57.5Q180-666 180-585t57.46 138.5Q294.92-389 377-389Z' />\n </Svg>\n);\n\nexport const LineBreakIcon = () => (\n <Svg>\n <path d='M190-470q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h505q60 0 102.5 42.5T840-385q0 60-42.5 103T695-239H554l46 45q9 8 8.63 20.29-.38 12.28-8.63 21.5-9 9.21-21.5 9.21t-21.5-9l-96-97q-5-5-7-10.13-2-5.14-2-11 0-5.87 2-10.87 2-5 7-10l97-98q8.8-9 20.9-9 12.1 0 21.1 8.84 8.25 8.84 8.63 21Q609-356 601-347l-47 48h141q35.21 0 60.11-25.5Q780-350 780-385.15t-24.89-60Q730.21-470 695-470H190Zm0 231q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h140q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H190Zm0-461q-12.75 0-21.37-8.68-8.63-8.67-8.63-21.5 0-12.82 8.63-21.32 8.62-8.5 21.37-8.5h580q12.75 0 21.38 8.68 8.62 8.67 8.62 21.5 0 12.82-8.62 21.32-8.63 8.5-21.38 8.5H190Z' />\n </Svg>\n);\n\nexport const MoreIcon = () => (\n <Svg>\n <path d='M207.86-432Q188-432 174-446.14t-14-34Q160-500 174.14-514t34-14Q228-528 242-513.86t14 34Q256-460 241.86-446t-34 14Zm272 0Q460-432 446-446.14t-14-34Q432-500 446.14-514t34-14Q500-528 514-513.86t14 34Q528-460 513.86-446t-34 14Zm272 0Q732-432 718-446.14t-14-34Q704-500 718.14-514t34-14Q772-528 786-513.86t14 34Q800-460 785.86-446t-34 14Z' />\n </Svg>\n);\n\nexport const ChevronIcon = () => (\n <Svg size={16}>\n <path d='M469-358q-5-2-10-7L261-563q-9-9-8.5-21.5T262-606q9-9 21.5-9t21.5 9l175 176 176-176q9-9 21-8.5t21 9.5q9 9 9 21.5t-9 21.5L501-365q-5 5-10 7t-11 2q-6 0-11-2Z' />\n </Svg>\n);\n\nexport const SpinnerIcon = () => (\n <Svg className='lee-spin'>\n <path d='M323-111q-73-31-127-85t-85-127q-31-73-31-157t31-157q31-73 85-127t127-85q73-31 157-31 12 0 21 9t9 21q0 12-9 21t-21 9q-141 0-240.5 99.5T140-480q0 141 99.5 240.5T480-140q141 0 240.5-99.5T820-480q0-12 9-21t21-9q12 0 21 9t9 21q0 84-31 157t-85 127q-54 54-127 85T480-80q-84 0-157-31Z' />\n </Svg>\n);\n\n// The bar under the glyph shows the colour in use\nconst ColorIcon = ({ glyph, bar, color }) => (\n <Svg>\n <path d={glyph} />\n <path d={bar} className='lee-color-bar' style={color ? { fill: color } : undefined} />\n </Svg>\n);\n\nexport const TextColorIcon = ({ color }) => (\n <ColorIcon\n glyph='M271 -280q-19 0-29-15.5t-3-32.5l192-488q5-11 14-17.5t20-6.5h30q11 0 20 6.5t14 17.5l192 489q7 17-3.5 32T689-280q-11 0-20-6t-13-17l-48-127H352l-49 128q-4 10-12.5 16t-19.5 6Zm105-214h208L482-765h-4L376-494Z'\n bar='M110 0Q97 0 88.5-8.5T80-30v-100q0-13 8.5-21.5T110-160h740q13 0 21.5 8.5T880-130v100q0 13-8.5 21.5T850 0H110Z'\n color={color}\n />\n);\n\nexport const BackgroundColorIcon = ({ color }) => (\n <ColorIcon\n glyph='M581 -474L466-589 284-407l115 115 182-182Zm-72-158 115 115 186-186-115-115-186 186Zm-64-21 200 200-194 194q-19 19-52.5 19T346-259l-11-11-25 25q-8 8-19.5 13t-23.5 5h-94q-10 0-13.5-9.5T163-253l94-94-4-4q-22-22-21.5-55.5T254-462l191-191Zm0 0 210-210q17-17 43-17t43 17l112 112q17 17 16.5 45.5T852-660L645-453 445-653Z'\n bar='M140 0q-25 0-42.5-18T80-61q0-25 18-42.5t43-17.5h679q25 0 42.5 17.5T880-61q0 25-18 43T819 0H140Z'\n color={color}\n />\n);\n","import { useEffect, useId, useRef, useState } from 'react';\n\n/**\n * A toolbar button that opens a small panel. Closes on Escape, on a click outside and when the panel calls close().\n * Built in so the package does not depend on a UI library.\n */\nexport const Popover = ({\n label,\n title,\n className = '',\n buttonClassName = 'lee-button',\n buttonContent,\n isActive = false,\n disabled = false,\n align = 'start',\n panelClassName = '',\n children,\n}) => {\n const [open, setOpen] = useState(false);\n const rootRef = useRef(null);\n const buttonRef = useRef(null);\n const panelId = useId();\n\n useEffect(() => {\n if (!open) return undefined;\n const onPointerDown = (event) => {\n if (rootRef.current && !rootRef.current.contains(event.target)) setOpen(false);\n };\n const onKeyDown = (event) => {\n if (event.key === 'Escape') {\n setOpen(false);\n buttonRef.current?.focus();\n }\n };\n document.addEventListener('pointerdown', onPointerDown);\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('pointerdown', onPointerDown);\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [open]);\n\n const close = () => setOpen(false);\n\n return (\n <div className={`lee-popover ${className}`.trim()} ref={rootRef}>\n <button\n ref={buttonRef}\n type='button'\n className={buttonClassName}\n aria-label={label}\n data-tip={title ?? label}\n aria-haspopup='true'\n aria-expanded={open}\n aria-controls={open ? panelId : undefined}\n data-active={isActive || open || undefined}\n disabled={disabled}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setOpen((value) => !value)}\n >\n {buttonContent}\n </button>\n {open && (\n <div\n id={panelId}\n className={`lee-panel ${panelClassName}`.trim()}\n data-align={align}\n role='dialog'\n aria-label={label}\n >\n {typeof children === 'function' ? children({ close }) : children}\n </div>\n )}\n </div>\n );\n};\n","import { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { ChevronIcon, FieldIcon, SearchIcon } from './icons';\nimport { Popover } from './Popover';\n\n// Show a search box once the list is longer than this\nconst SEARCH_THRESHOLD = 6;\n\n/**\n * @param {string | { label: string, value?: string }} field\n * @returns {{ label: string, value: string }}\n */\nconst toField = (field) =>\n typeof field === 'string'\n ? { label: field, value: field }\n : { label: field.label, value: field.value ?? field.label };\n\n// Bold the part of a name that matches the search\nconst Highlight = ({ text, term }) => {\n const at = term ? text.toLowerCase().indexOf(term) : -1;\n if (at < 0) return text;\n return (\n <>\n {text.slice(0, at)}\n <mark className='lee-match'>{text.slice(at, at + term.length)}</mark>\n {text.slice(at + term.length)}\n </>\n );\n};\n\nconst FieldList = ({ fields, onPick }) => {\n const [query, setQuery] = useState('');\n const [active, setActive] = useState(0);\n const listRef = useRef(null);\n const showSearch = fields.length > SEARCH_THRESHOLD;\n const term = query.trim().toLowerCase();\n\n const matches = useMemo(\n () => (term ? fields.filter(({ label }) => label.toLowerCase().includes(term)) : fields),\n [fields, term]\n );\n\n // Keep the highlighted field in view while moving with the arrow keys\n useEffect(() => {\n listRef.current?.children[active]?.scrollIntoView?.({ block: 'nearest' });\n }, [active]);\n\n const onKeyDown = (event) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n setActive((index) => Math.min(index + 1, matches.length - 1));\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n setActive((index) => Math.max(index - 1, 0));\n } else if (event.key === 'Enter' && matches[active]) {\n event.preventDefault();\n onPick(matches[active].value);\n }\n };\n\n return (\n <div className='lee-fields' onKeyDown={onKeyDown}>\n {showSearch && (\n <label className='lee-fields-searchbar'>\n <SearchIcon />\n <input\n autoFocus\n type='text'\n className='lee-fields-search'\n placeholder='Search fields'\n aria-label='Search fields'\n autoComplete='off'\n spellCheck={false}\n value={query}\n onChange={(event) => {\n setQuery(event.target.value);\n setActive(0);\n }}\n />\n </label>\n )}\n <div className='lee-fields-list' role='listbox' aria-label='Fields' ref={listRef}>\n {matches.map(({ label, value }, index) => (\n <button\n // eslint-disable-next-line react/no-array-index-key\n key={`${value}-${index}`}\n title={label}\n type='button'\n role='option'\n aria-selected={index === active}\n className='lee-menu-item lee-field'\n data-active={index === active || undefined}\n onMouseEnter={() => setActive(index)}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => onPick(value)}\n >\n <span className='lee-field-name'>\n <Highlight text={label} term={term} />\n </span>\n {value !== label && <code className='lee-field-code'>{`{{${value}}}`}</code>}\n </button>\n ))}\n </div>\n {!matches.length && <p className='lee-empty'>No fields match “{query.trim()}”</p>}\n </div>\n );\n};\n\n/**\n * The built-in merge-field picker: one toolbar button, however many fields there are.\n */\nexport const FieldsMenu = ({ fields, onInsert, disabled, label = 'Insert field', shortLabel = 'Fields' }) => {\n const list = useMemo(() => fields.map(toField).filter(({ label: name }) => name), [fields]);\n if (!list.length) return null;\n return (\n <Popover\n label={label}\n align='end'\n panelClassName='lee-panel-flush'\n disabled={disabled}\n buttonClassName='lee-button lee-button-text'\n buttonContent={\n <>\n <FieldIcon />\n <span className='lee-button-label lee-field-label'>{shortLabel}</span>\n <ChevronIcon />\n </>\n }\n >\n {({ close }) => (\n <FieldList\n fields={list}\n onPick={(value) => {\n onInsert(value);\n close();\n }}\n />\n )}\n </Popover>\n );\n};\n","/**\n * HTML going into and coming out of the editor.\n *\n * The editor parses HTML with the browser's DOMParser and serializes its own document,\n * so these fix the few places where that round trip would change what an email shows.\n */\n\n// <<First Name>> would be parsed as an unknown <First Name> tag and dropped, so pass angle markers as text\nconst ANGLE_MARKER = /<<([^<>]+)>>/g;\n\n/**\n * Prepare stored HTML for the editor.\n * @param {string | null | undefined} html\n * @returns {string}\n */\nexport const normalizeInput = (html) => {\n if (!html) return '';\n return String(html).replace(ANGLE_MARKER, '<<$1>>');\n};\n\n/**\n * True when the HTML holds no text and no image.\n * @param {string | null | undefined} html\n * @returns {boolean}\n */\nexport const isEmptyHtml = (html) => {\n if (!html) return true;\n const value = String(html);\n if (/<img\\b/i.test(value)) return false;\n return (\n value\n .replace(/<br\\s*\\/?>/gi, '')\n .replace(/<\\/?(p|h[1-6]|div|span)\\b[^>]*>/gi, '')\n .replace(/ /g, '')\n .trim() === ''\n );\n};\n\n/**\n * Merge two attribute strings, joining their style attributes.\n * @param {string} outer Attributes of the <li>, with a leading space or empty\n * @param {string} inner Attributes of the <p>, with a leading space or empty\n */\nconst mergeAttributes = (outer, inner) => {\n const attributes = new Map();\n const styles = [];\n for (const attrs of [outer, inner]) {\n for (const [, name, value] of attrs.matchAll(/\\s([\\w-]+)=\"([^\"]*)\"/g)) {\n if (name === 'style') styles.push(value);\n else attributes.set(name, value);\n }\n }\n if (styles.length) attributes.set('style', styles.join(' '));\n return [...attributes].map(([name, value]) => ` ${name}=\"${value}\"`).join('');\n};\n\n// A list item's text sits in a <p>; the first one, when followed by the end of the item or a nested list\nconst LIST_ITEM_PARAGRAPH = /<li([^>]*)><p([^>]*)>((?:(?!<\\/p>)[\\s\\S])*)<\\/p>(?=<\\/li>|<ul|<ol)/g;\n\n/**\n * Turn the editor's HTML into email-safe HTML.\n * - Empty paragraphs and headings get a <br>, or email clients collapse them and blank lines disappear.\n * - A single becomes a space so lines can wrap. Runs of and one at the end of a block are kept,\n * because a plain space there would collapse.\n * - The <p> inside each list item is removed, or Gmail and other clients give every item paragraph margins.\n * Its alignment and direction move to the <li>.\n * - Empty paragraphs at the end are removed, so the email does not end in blank lines.\n * - An editor with no text returns an empty string instead of \"<p></p>\".\n * @param {string | null | undefined} html\n * @returns {string}\n */\nexport const normalizeOutput = (html) => {\n if (!html) return '';\n const output = String(html)\n .replace(/<(p|h[1-6])([^>]*)><\\/\\1>/g, '<$1$2><br></$1>')\n .replace(LIST_ITEM_PARAGRAPH, (_match, li, para, text) => `<li${mergeAttributes(li, para)}>${text}`)\n // The editor keeps an empty paragraph after a final list, quote or code block; it would be a blank line in the email\n .replace(/(?:<p[^>]*><br><\\/p>)+$/, '')\n .replace(/(?<! ) (?! |$|<\\/(?:p|h[1-6]|li|blockquote|pre)>)/g, ' ');\n return isEmptyHtml(output) ? '' : output;\n};\n\n/**\n * The text to insert for a merge field.\n * @param {string} marker A column name such as \"First Name\", with or without braces\n * @returns {string}\n */\nexport const markerText = (marker) => {\n const name = String(marker ?? '')\n .replace(/^\\s*\\{\\{\\s*|\\s*\\}\\}\\s*$/g, '')\n .trim();\n return name ? `{{${name}}}` : '';\n};\n","export const DEFAULT_MAX_IMAGE_SIZE = 4 * 1024 * 1024; // 4 MB\n\n// The types Gmail and other email clients show. Not SVG: Gmail does not display it.\nexport const DEFAULT_IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif', 'image/webp'];\n\n/**\n * Format a byte count for a size limit message: \"4MB\", \"512KB\".\n * @param {number} bytes\n */\nconst formatSize = (bytes) => {\n if (bytes >= 1024 * 1024) return `${Math.round((bytes / (1024 * 1024)) * 10) / 10}MB`;\n return `${Math.round(bytes / 1024)}KB`;\n};\n\n/**\n * Check a file before it is uploaded.\n * @param {{ type?: string, size?: number } | null | undefined} file\n * @param {{ maxSize?: number, types?: string[] }} [options] types: the MIME types allowed\n * @returns {string | null} An error message, or null when the file can be uploaded\n */\nexport const validateImage = (file, { maxSize = DEFAULT_MAX_IMAGE_SIZE, types = DEFAULT_IMAGE_TYPES } = {}) => {\n if (!file) return 'Please select a file to upload';\n const { type = '', size = 0 } = file;\n if (!types.includes(type.toLowerCase())) return `Please select a valid image file (${type})`;\n if (size > maxSize) return `Please upload a file that is ${formatSize(maxSize)} or smaller.`;\n return null;\n};\n\n/**\n * Read a file as a data: URL, for servers that take images as base64 in a JSON body.\n * @param {Blob} file\n * @returns {Promise<string>}\n */\nexport const readAsDataURL = (file) =>\n new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(new Error('Failed to read file'));\n reader.readAsDataURL(file);\n });\n\n/**\n * True for an http(s) URL. Uploads must resolve to one: email clients block data: images.\n * @param {unknown} url\n */\nexport const isHttpUrl = (url) => typeof url === 'string' && /^https?:\\/\\/\\S+$/i.test(url.trim());\n","// Keyboard shortcuts, written once as 'Mod+Shift+Z', for the buttons' aria-keyshortcuts.\n\n/** True on macOS, iPadOS and iOS, where Mod is ⌘. */\nexport const isApple = () => {\n if (typeof navigator === 'undefined') return false;\n const platform = navigator.userAgentData?.platform || navigator.platform || navigator.userAgent || '';\n return /Mac|iPhone|iPad|iPod/i.test(platform);\n};\n\n/**\n * The value for aria-keyshortcuts: 'Meta+Shift+Z' on Apple platforms, 'Control+Shift+Z' elsewhere.\n * @param {string} keys\n * @param {boolean} [apple]\n */\nexport const ariaShortcut = (keys, apple = isApple()) => {\n if (!keys) return undefined;\n const names = { Mod: apple ? 'Meta' : 'Control', Ctrl: 'Control', Alt: 'Alt', Shift: 'Shift' };\n return keys\n .split('+')\n .map((part) => names[part] ?? part)\n .join('+');\n};\n\n// What each toolbar command's shortcut is; all of them are Tiptap's own\nexport const SHORTCUTS = {\n undo: 'Mod+Z',\n redo: 'Mod+Shift+Z',\n bold: 'Mod+B',\n italic: 'Mod+I',\n underline: 'Mod+U',\n strike: 'Mod+Shift+S',\n bulletList: 'Mod+Shift+8',\n orderedList: 'Mod+Shift+7',\n blockquote: 'Mod+Shift+B',\n codeBlock: 'Mod+Alt+C',\n hardBreak: 'Shift+Enter',\n paragraph: 'Mod+Alt+0',\n heading1: 'Mod+Alt+1',\n heading2: 'Mod+Alt+2',\n heading3: 'Mod+Alt+3',\n heading4: 'Mod+Alt+4',\n alignLeft: 'Mod+Shift+L',\n alignCenter: 'Mod+Shift+E',\n alignRight: 'Mod+Shift+R',\n alignJustify: 'Mod+Shift+J',\n};\n","// Toolbar item ids, in display order and groups. 'spacer' pushes the groups after it to the right-hand end,\n// and 'more' is a menu of the items in MORE_ITEMS (or the editor's moreItems prop).\nexport const DEFAULT_TOOLBAR = [\n ['undo', 'redo'],\n ['heading'],\n ['bold', 'italic', 'underline'],\n ['color', 'backgroundColor'],\n ['bulletList', 'orderedList', 'align', 'more'],\n ['spacer'],\n ['link', 'image'],\n];\n\n// Markdown has no colours, underline, alignment or text direction\nexport const DEFAULT_MARKDOWN_TOOLBAR = [\n ['undo', 'redo'],\n ['heading'],\n ['bold', 'italic'],\n ['bulletList', 'orderedList', 'more'],\n ['spacer'],\n ['link', 'image'],\n];\n\n// What the 'more' menu holds by default\nexport const DEFAULT_MORE_ITEMS = ['hardBreak', 'strike', 'blockquote', 'codeBlock', 'clear'];\n\n// Items the 'more' menu can show\nexport const MORE_MENU_ITEMS = ['hardBreak', 'blockquote', 'codeBlock', 'strike', 'underline', 'rtl', 'clear'];\n\n// Every toolbar item id; 'rtl' is also inside the 'align' menu\nexport const TOOLBAR_ITEMS = [\n ...new Set([...DEFAULT_TOOLBAR.flat(), 'hardBreak', 'strike', 'blockquote', 'rtl', 'codeBlock', 'clear']),\n];\n","import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nconst SHOW_DELAY = 300; // ms before the first tooltip appears\nconst WARM_FOR = 500; // ms after one hides during which the next appears at once\nconst GAP = 6;\nconst EDGE = 4;\n\n/**\n * Tooltips for every element under `rootRef` with a data-tip attribute. One tooltip element, shown on hover and on keyboard focus, hidden on click, Escape and when the element\n * opens a menu. It is aria-hidden: the buttons already carry the same name in aria-label.\n * @param {import('react').RefObject<HTMLElement>} rootRef A positioned element the tooltip is placed in\n */\nexport const useTooltip = (rootRef) => {\n const [tip, setTip] = useState(null);\n const [position, setPosition] = useState(null);\n const tipRef = useRef(null);\n const timer = useRef(null);\n const current = useRef(null);\n const hiddenAt = useRef(0);\n\n const hide = useCallback(() => {\n clearTimeout(timer.current);\n if (current.current) hiddenAt.current = Date.now();\n current.current = null;\n setTip(null);\n }, []);\n\n const show = useCallback((target) => {\n clearTimeout(timer.current);\n const open = () => {\n current.current = target;\n setTip({ target, text: target.dataset.tip });\n };\n if (current.current || Date.now() - hiddenAt.current < WARM_FOR) open();\n else timer.current = setTimeout(open, SHOW_DELAY);\n }, []);\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root) return undefined;\n\n const find = (element) => {\n const target = element?.closest?.('[data-tip]');\n return target && root.contains(target) ? target : null;\n };\n const eligible = (target) => target && !target.disabled && target.getAttribute('aria-expanded') !== 'true';\n\n const onPointerOver = (event) => {\n if (event.pointerType === 'touch') return;\n const target = find(event.target);\n if (target && target === current.current) return;\n if (eligible(target)) show(target);\n else hide();\n };\n const onFocusIn = (event) => {\n const target = find(event.target);\n if (eligible(target) && target.matches(':focus-visible')) show(target);\n };\n const onKeyDown = (event) => {\n if (event.key === 'Escape') hide();\n };\n\n root.addEventListener('pointerover', onPointerOver);\n root.addEventListener('pointerleave', hide);\n root.addEventListener('focusin', onFocusIn);\n root.addEventListener('focusout', hide);\n root.addEventListener('pointerdown', hide, true);\n document.addEventListener('keydown', onKeyDown, true);\n return () => {\n clearTimeout(timer.current);\n root.removeEventListener('pointerover', onPointerOver);\n root.removeEventListener('pointerleave', hide);\n root.removeEventListener('focusin', onFocusIn);\n root.removeEventListener('focusout', hide);\n root.removeEventListener('pointerdown', hide, true);\n document.removeEventListener('keydown', onKeyDown, true);\n };\n }, [rootRef, show, hide]);\n\n // Centre under the element, kept inside the root's edges\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!tip || !root || !tipRef.current) {\n setPosition(null);\n return;\n }\n const bounds = root.getBoundingClientRect();\n const target = tip.target.getBoundingClientRect();\n const width = tipRef.current.offsetWidth;\n const centred = target.left - bounds.left + target.width / 2 - width / 2;\n const left = Math.max(EDGE, Math.min(centred, bounds.width - width - EDGE));\n setPosition({ left, top: target.bottom - bounds.top + GAP });\n }, [tip, rootRef]);\n\n if (!tip?.text) return null;\n\n return (\n <div\n ref={tipRef}\n className='lee-tooltip'\n aria-hidden='true'\n style={position ?? { visibility: 'hidden', left: 0, top: 0 }}\n >\n {tip.text}\n </div>\n );\n};\n","import { useEditorState } from '@tiptap/react';\nimport { useLayoutEffect, useRef, useState } from 'react';\n\nimport {\n AlignCenterIcon,\n AlignJustifyIcon,\n AlignLeftIcon,\n AlignRightIcon,\n BackgroundColorIcon,\n Bold,\n BulletListIcon,\n ChevronIcon,\n ClearIcon,\n CodeBlockIcon,\n ImageIcon,\n Italic,\n LineBreakIcon,\n LinkIcon,\n LtrIcon,\n MoreIcon,\n OrderedListIcon,\n QuoteIcon,\n RedoIcon,\n RtlIcon,\n SpinnerIcon,\n Strike,\n TextColorIcon,\n Underline,\n UndoIcon,\n} from './icons';\nimport { Popover } from './Popover';\nimport { ariaShortcut, SHORTCUTS } from './shortcuts';\nimport { MORE_MENU_ITEMS } from './toolbar-items';\nimport { useTooltip } from './Tooltip';\n\nconst HEADINGS = [\n { level: 0, label: 'Normal', shortcut: SHORTCUTS.paragraph },\n { level: 1, label: 'Heading 1', shortcut: SHORTCUTS.heading1 },\n { level: 2, label: 'Heading 2', shortcut: SHORTCUTS.heading2 },\n { level: 3, label: 'Heading 3', shortcut: SHORTCUTS.heading3 },\n { level: 4, label: 'Heading 4', shortcut: SHORTCUTS.heading4 },\n];\n\nconst ALIGNMENTS = [\n { value: 'left', label: 'Align left', Icon: AlignLeftIcon, shortcut: SHORTCUTS.alignLeft },\n { value: 'center', label: 'Align center', Icon: AlignCenterIcon, shortcut: SHORTCUTS.alignCenter },\n { value: 'right', label: 'Align right', Icon: AlignRightIcon, shortcut: SHORTCUTS.alignRight },\n { value: 'justify', label: 'Justify', Icon: AlignJustifyIcon, shortcut: SHORTCUTS.alignJustify },\n];\n\nconst DIRECTIONS = [\n { value: 'auto', label: 'Text direction: automatic' },\n { value: 'ltr', label: 'Left-to-right text', Icon: LtrIcon },\n { value: 'rtl', label: 'Right-to-left text', Icon: RtlIcon },\n];\n\nconst selectEditorState = ({ editor }) => {\n const level = [1, 2, 3, 4].find((value) => editor.isActive('heading', { level: value })) ?? 0;\n const block = editor.state.selection.$from.parent;\n const base = editor.view.dom.closest('[dir]')?.getAttribute('dir') === 'rtl' ? 'rtl' : 'ltr';\n const rtl = (block.attrs.dir ?? base) === 'rtl';\n // An unset alignment follows the text: right in a right-to-left paragraph\n const natural = rtl ? 'right' : 'left';\n const align = ALIGNMENTS.find(({ value }) => editor.isActive({ textAlign: value }))?.value ?? natural;\n let direction = 'auto';\n if (block.attrs.dirAuto === false) direction = rtl ? 'rtl' : 'ltr';\n const textStyle = editor.getAttributes('textStyle');\n return {\n editable: editor.isEditable,\n heading: level,\n bold: editor.isActive('bold'),\n italic: editor.isActive('italic'),\n underline: editor.isActive('underline'),\n strike: editor.isActive('strike'),\n link: editor.isActive('link'),\n linkHref: editor.getAttributes('link').href ?? '',\n blockquote: editor.isActive('blockquote'),\n codeBlock: editor.isActive('codeBlock'),\n orderedList: editor.isActive('orderedList'),\n bulletList: editor.isActive('bulletList'),\n align,\n naturalAlign: natural,\n rtl,\n direction,\n color: textStyle.color ?? '',\n backgroundColor: textStyle.backgroundColor ?? '',\n canUndo: editor.can().undo(),\n canRedo: editor.can().redo(),\n };\n};\n\n// Items that can sit in the 'more' menu\nconst MENU_ENTRIES = {\n hardBreak: {\n label: 'Line break',\n Icon: LineBreakIcon,\n shortcut: SHORTCUTS.hardBreak,\n command: (c) => c.setHardBreak(),\n },\n blockquote: {\n label: 'Quote',\n Icon: QuoteIcon,\n shortcut: SHORTCUTS.blockquote,\n isActive: (s) => s.blockquote,\n command: (c) => c.toggleBlockquote(),\n },\n codeBlock: {\n label: 'Code block',\n Icon: CodeBlockIcon,\n shortcut: SHORTCUTS.codeBlock,\n isActive: (s) => s.codeBlock,\n command: (c) => c.toggleCodeBlock(),\n },\n strike: {\n label: 'Strikethrough',\n Icon: Strike,\n shortcut: SHORTCUTS.strike,\n isActive: (s) => s.strike,\n command: (c) => c.toggleStrike(),\n },\n underline: {\n label: 'Underline',\n Icon: Underline,\n shortcut: SHORTCUTS.underline,\n isActive: (s) => s.underline,\n command: (c) => c.toggleUnderline(),\n },\n rtl: {\n label: 'Right-to-left text',\n Icon: RtlIcon,\n isActive: (s) => s.direction === 'rtl',\n command: (c, s) => c.setDirection(s.direction === 'rtl' ? 'auto' : 'rtl'),\n },\n clear: {\n label: 'Clear formatting',\n Icon: ClearIcon,\n command: (c) => c.unsetAllMarks().clearNodes().unsetTextAlign().setDirection('auto'),\n },\n};\n\nconst Button = ({ label, shortcut, isActive, disabled, onClick, className = 'lee-button', children }) => (\n <button\n type='button'\n className={className}\n aria-label={label}\n data-tip={label}\n aria-keyshortcuts={ariaShortcut(shortcut)}\n aria-pressed={isActive === undefined ? undefined : isActive}\n data-active={isActive || undefined}\n disabled={disabled}\n // Keep the editor's selection when the button is clicked\n onMouseDown={(event) => event.preventDefault()}\n onClick={onClick}\n >\n {children}\n </button>\n);\n\nconst ColorPanel = ({ colors, value, onPick, onClear, clearLabel }) => (\n <div className='lee-colors'>\n <button type='button' className='lee-menu-item lee-color-default' onClick={onClear}>\n <span className='lee-swatch lee-swatch-none' aria-hidden='true' />\n <span>{clearLabel}</span>\n </button>\n <div className='lee-swatches'>\n {colors.map((color) => (\n <button\n key={color}\n type='button'\n className='lee-swatch'\n style={{ backgroundColor: color }}\n aria-label={color}\n data-tip={color}\n data-active={value?.toLowerCase() === color.toLowerCase() || undefined}\n onClick={() => onPick(color)}\n />\n ))}\n </div>\n </div>\n);\n\nconst withProtocol = (url) => {\n const value = url.trim();\n if (!value) return '';\n if (/^(https?:|mailto:|tel:|\\{\\{)/i.test(value) || value.startsWith('#')) return value;\n if (/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)) return `mailto:${value}`;\n return `https://${value}`;\n};\n\nconst LinkPanel = ({ editor, href, close }) => {\n const [value, setValue] = useState(href);\n\n const apply = (event) => {\n event.preventDefault();\n const url = withProtocol(value);\n const chain = editor.chain().focus().extendMarkRange('link');\n if (!url) {\n chain.unsetLink().run();\n } else if (editor.state.selection.empty && !editor.isActive('link')) {\n chain.insertContent({ type: 'text', text: value.trim(), marks: [{ type: 'link', attrs: { href: url } }] }).run();\n } else {\n chain.setLink({ href: url }).run();\n }\n close();\n };\n\n const remove = () => {\n editor.chain().focus().extendMarkRange('link').unsetLink().run();\n close();\n };\n\n return (\n <form className='lee-link' onSubmit={apply}>\n <input\n autoFocus\n type='text'\n inputMode='url'\n className='lee-input'\n placeholder='https://example.com'\n aria-label='Link URL'\n value={value}\n onChange={(event) => setValue(event.target.value)}\n />\n <button type='submit' className='lee-text-button lee-primary'>\n Apply\n </button>\n {href && (\n <button type='button' className='lee-text-button' onClick={remove}>\n Remove\n </button>\n )}\n </form>\n );\n};\n\n/**\n * How many labels the toolbar can show at its current width: 0 shows all, 1 hides the Link and Image labels,\n * 2 hides the Fields label too. Measured, so it is exact whatever fonts the system uses.\n * @param {import('react').RefObject<HTMLElement>} ref\n */\nconst useCompactLevel = (ref) => {\n const [level, setLevel] = useState(0);\n\n useLayoutEffect(() => {\n const bar = ref.current;\n if (!bar) return undefined;\n\n const measure = () => {\n const current = bar.dataset.compact;\n bar.dataset.compact = '0';\n const style = getComputedStyle(bar);\n const children = [...bar.children].filter(\n (child) => !child.classList.contains('lee-spacer') && !child.classList.contains('lee-tooltip')\n );\n const content = children.reduce((sum, child) => sum + child.getBoundingClientRect().width, 0);\n const spacing = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight) + 4;\n const width = (selector) =>\n [...bar.querySelectorAll(selector)].reduce((sum, el) => sum + el.getBoundingClientRect().width + 4, 0);\n const fieldLabel = width('.lee-field-label');\n const otherLabels = width('.lee-button-label:not(.lee-field-label)');\n bar.dataset.compact = current;\n\n // Link and Image lose their labels first: their icons are familiar, the field icon is not.\n // When even icons alone need a second row, the extra row has room, so every label comes back.\n const needed = content + spacing;\n const available = bar.clientWidth;\n let next = 0;\n if (needed > available) {\n if (needed - otherLabels <= available) next = 1;\n else if (needed - otherLabels - fieldLabel <= available) next = 2;\n }\n setLevel(next);\n };\n\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(bar);\n document.fonts?.ready.then(measure);\n return () => observer.disconnect();\n }, [ref]);\n\n return level;\n};\n\n/**\n * The formatting toolbar. `items` is an array of groups of item ids (see DEFAULT_TOOLBAR).\n */\nexport const Toolbar = ({ editor, items, moreItems, colors, canUploadImages, uploading, onPickImage, end }) => {\n const state = useEditorState({ editor, selector: selectEditorState });\n const barRef = useRef(null);\n const compact = useCompactLevel(barRef);\n const tooltip = useTooltip(barRef);\n const disabled = !state.editable;\n const run = (command) => () => command(editor.chain().focus()).run();\n\n const render = (id) => {\n switch (id) {\n case 'heading': {\n const current = HEADINGS.find(({ level }) => level === state.heading) ?? HEADINGS[0];\n return (\n <Popover\n key={id}\n label='Text style'\n disabled={disabled}\n buttonClassName='lee-button lee-button-text lee-heading-button'\n buttonContent={\n <>\n <span>{current.label}</span>\n <ChevronIcon />\n </>\n }\n >\n {({ close }) => (\n <div className='lee-menu-list' role='menu'>\n {HEADINGS.map(({ level, label }) => (\n <button\n key={level}\n type='button'\n role='menuitemradio'\n aria-checked={level === state.heading}\n className='lee-menu-item'\n data-active={level === state.heading || undefined}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n const chain = editor.chain().focus();\n (level ? chain.setHeading({ level }) : chain.setParagraph()).run();\n close();\n }}\n >\n <span className={`lee-heading-preview lee-h${level}`}>{label}</span>\n </button>\n ))}\n </div>\n )}\n </Popover>\n );\n }\n case 'bold':\n return (\n <Button\n key={id}\n label='Bold'\n shortcut={SHORTCUTS.bold}\n isActive={state.bold}\n disabled={disabled}\n onClick={run((c) => c.toggleBold())}\n >\n <Bold />\n </Button>\n );\n case 'italic':\n return (\n <Button\n key={id}\n label='Italic'\n shortcut={SHORTCUTS.italic}\n isActive={state.italic}\n disabled={disabled}\n onClick={run((c) => c.toggleItalic())}\n >\n <Italic />\n </Button>\n );\n case 'underline':\n return (\n <Button\n key={id}\n label='Underline'\n shortcut={SHORTCUTS.underline}\n isActive={state.underline}\n disabled={disabled}\n onClick={run((c) => c.toggleUnderline())}\n >\n <Underline />\n </Button>\n );\n case 'strike':\n return (\n <Button\n key={id}\n label='Strikethrough'\n shortcut={SHORTCUTS.strike}\n isActive={state.strike}\n disabled={disabled}\n onClick={run((c) => c.toggleStrike())}\n >\n <Strike />\n </Button>\n );\n case 'color':\n return (\n <Popover\n key={id}\n label='Text color'\n disabled={disabled}\n buttonContent={<TextColorIcon color={state.color} />}\n >\n {({ close }) => (\n <ColorPanel\n colors={colors}\n value={state.color}\n clearLabel='Default color'\n onPick={(color) => {\n editor.chain().focus().setColor(color).run();\n close();\n }}\n onClear={() => {\n editor.chain().focus().unsetColor().run();\n close();\n }}\n />\n )}\n </Popover>\n );\n case 'backgroundColor':\n return (\n <Popover\n key={id}\n label='Background color'\n disabled={disabled}\n buttonContent={<BackgroundColorIcon color={state.backgroundColor} />}\n >\n {({ close }) => (\n <ColorPanel\n colors={colors}\n value={state.backgroundColor}\n clearLabel='No background'\n onPick={(color) => {\n editor.chain().focus().setBackgroundColor(color).run();\n close();\n }}\n onClear={() => {\n editor.chain().focus().unsetBackgroundColor().run();\n close();\n }}\n />\n )}\n </Popover>\n );\n case 'link':\n return (\n <Popover\n key={`${id}-${state.linkHref}`}\n label='Insert hyperlink'\n isActive={state.link}\n disabled={disabled}\n buttonClassName='lee-button lee-button-text lee-insert'\n buttonContent={\n <>\n <LinkIcon />\n <span className='lee-button-label'>Link</span>\n </>\n }\n >\n {({ close }) => <LinkPanel editor={editor} href={state.linkHref} close={close} />}\n </Popover>\n );\n case 'image':\n if (!canUploadImages) return null;\n return (\n <Button\n key={id}\n label={uploading ? 'Uploading image' : 'Insert image'}\n className='lee-button lee-button-text lee-insert'\n disabled={disabled}\n onClick={onPickImage}\n >\n {uploading ? <SpinnerIcon /> : <ImageIcon />}\n <span className='lee-button-label'>Image</span>\n </Button>\n );\n case 'hardBreak':\n return (\n <Button\n key={id}\n label='Line break'\n shortcut={SHORTCUTS.hardBreak}\n disabled={disabled}\n onClick={run((c) => c.setHardBreak())}\n >\n <LineBreakIcon />\n </Button>\n );\n case 'blockquote':\n return (\n <Button\n key={id}\n label='Quote'\n shortcut={SHORTCUTS.blockquote}\n isActive={state.blockquote}\n disabled={disabled}\n onClick={run((c) => c.toggleBlockquote())}\n >\n <QuoteIcon />\n </Button>\n );\n case 'codeBlock':\n return (\n <Button\n key={id}\n label='Code block'\n shortcut={SHORTCUTS.codeBlock}\n isActive={state.codeBlock}\n disabled={disabled}\n onClick={run((c) => c.toggleCodeBlock())}\n >\n <CodeBlockIcon />\n </Button>\n );\n case 'orderedList':\n return (\n <Button\n key={id}\n label='Numbered list'\n shortcut={SHORTCUTS.orderedList}\n isActive={state.orderedList}\n disabled={disabled}\n onClick={run((c) => c.toggleOrderedList())}\n >\n <OrderedListIcon />\n </Button>\n );\n case 'bulletList':\n return (\n <Button\n key={id}\n label='Bulleted list'\n shortcut={SHORTCUTS.bulletList}\n isActive={state.bulletList}\n disabled={disabled}\n onClick={run((c) => c.toggleBulletList())}\n >\n <BulletListIcon />\n </Button>\n );\n case 'align': {\n const { Icon } = ALIGNMENTS.find(({ value }) => value === state.align) ?? ALIGNMENTS[0];\n return (\n <Popover\n key={id}\n label='Alignment'\n disabled={disabled}\n buttonClassName='lee-button lee-button-text'\n buttonContent={\n <>\n <Icon />\n <ChevronIcon />\n </>\n }\n >\n {({ close }) => (\n <div className='lee-menu'>\n {ALIGNMENTS.map(({ value, label, Icon: ItemIcon, shortcut }) => (\n <Button\n key={value}\n label={label}\n shortcut={shortcut}\n isActive={state.align === value}\n onClick={() => {\n const chain = editor.chain().focus();\n (value === state.naturalAlign ? chain.unsetTextAlign() : chain.setTextAlign(value)).run();\n close();\n }}\n >\n <ItemIcon />\n </Button>\n ))}\n <span className='lee-divider' aria-hidden='true' />\n {DIRECTIONS.map(({ value, label, Icon: DirIcon }) => (\n <Button\n key={value}\n label={label}\n className={DirIcon ? 'lee-button' : 'lee-button lee-button-text'}\n isActive={state.direction === value}\n onClick={() => {\n editor.chain().focus().setDirection(value).run();\n close();\n }}\n >\n {DirIcon ? <DirIcon /> : 'Auto'}\n </Button>\n ))}\n </div>\n )}\n </Popover>\n );\n }\n case 'rtl':\n return (\n <Button\n key={id}\n label='Right-to-left text'\n isActive={state.direction === 'rtl'}\n disabled={disabled}\n onClick={run((c) => c.setDirection(state.direction === 'rtl' ? 'auto' : 'rtl'))}\n >\n <RtlIcon />\n </Button>\n );\n case 'clear':\n return (\n <Button\n key={id}\n label='Clear formatting'\n disabled={disabled}\n onClick={run((c) => c.unsetAllMarks().clearNodes().unsetTextAlign().setDirection('auto'))}\n >\n <ClearIcon />\n </Button>\n );\n case 'undo':\n return (\n <Button\n className='lee-button lee-flip'\n key={id}\n label='Undo'\n shortcut={SHORTCUTS.undo}\n disabled={disabled || !state.canUndo}\n onClick={run((c) => c.undo())}\n >\n <UndoIcon />\n </Button>\n );\n case 'redo':\n return (\n <Button\n className='lee-button lee-flip'\n key={id}\n label='Redo'\n shortcut={SHORTCUTS.redo}\n disabled={disabled || !state.canRedo}\n onClick={run((c) => c.redo())}\n >\n <RedoIcon />\n </Button>\n );\n case 'more': {\n const entries = moreItems.filter((item) => MORE_MENU_ITEMS.includes(item) && MENU_ENTRIES[item]);\n if (!entries.length) return null;\n return (\n <Popover\n key={id}\n label='More formatting'\n disabled={disabled}\n isActive={entries.some((item) => MENU_ENTRIES[item].isActive?.(state))}\n buttonContent={<MoreIcon />}\n >\n {({ close }) => (\n <div className='lee-menu-list' role='menu'>\n {entries.map((item) => {\n const { label, Icon, isActive, command, shortcut } = MENU_ENTRIES[item];\n const active = isActive?.(state);\n return (\n <button\n key={item}\n type='button'\n role={isActive ? 'menuitemcheckbox' : 'menuitem'}\n aria-checked={isActive ? Boolean(active) : undefined}\n aria-keyshortcuts={ariaShortcut(shortcut)}\n className='lee-menu-item lee-menu-item-icon'\n data-checked={active || undefined}\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n command(editor.chain().focus(), state).run();\n close();\n }}\n >\n <Icon />\n <span>{label}</span>\n </button>\n );\n })}\n </div>\n )}\n </Popover>\n );\n }\n default:\n return null;\n }\n };\n\n return (\n <div className='lee-toolbar' role='toolbar' aria-label='Formatting' ref={barRef} data-compact={compact}>\n {items\n .map((group) => ({\n key: group.join('-'),\n spacer: group.includes('spacer'),\n buttons: group.map(render).filter(Boolean),\n }))\n .filter(({ spacer, buttons }) => spacer || buttons.length)\n .map(({ key, spacer, buttons }, index, groups) =>\n spacer ? (\n <span key={key} className='lee-spacer' aria-hidden='true' />\n ) : (\n <div key={key} className='lee-group'>\n {index > 0 && !groups[index - 1].spacer && <span className='lee-divider' aria-hidden='true' />}\n {buttons}\n </div>\n )\n )}\n {end && <div className='lee-toolbar-end'>{end}</div>}\n {tooltip}\n </div>\n );\n};\n","import { EditorContent, useEditor } from '@tiptap/react';\nimport { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';\n\nimport { DEFAULT_COLORS } from './colors';\nimport { createExtensions } from './extensions';\nimport { FieldsMenu } from './FieldsMenu';\nimport { markerText, normalizeInput, normalizeOutput } from './html';\nimport { DEFAULT_IMAGE_TYPES, DEFAULT_MAX_IMAGE_SIZE, isHttpUrl, validateImage } from './image';\nimport { Toolbar } from './Toolbar';\nimport { DEFAULT_MARKDOWN_TOOLBAR, DEFAULT_MORE_ITEMS, DEFAULT_TOOLBAR } from './toolbar-items';\nimport { addPlaceholder, findPlaceholder, removePlaceholder } from './uploadPlaceholder';\n\n/**\n * Text to insert so a merge field is separated from the words around it.\n * @param {import('@tiptap/core').Editor} editor\n * @param {string} text\n */\nconst spaced = (editor, text) => {\n const { from, to } = editor.state.selection;\n const { doc } = editor.state;\n const before = from > 1 ? doc.textBetween(from - 1, from, '\\n', '\\n') : '';\n const after = to < doc.content.size ? doc.textBetween(to, to + 1, '\\n', '\\n') : '';\n const lead = before && !/\\s/.test(before) ? ' ' : '';\n const trail = !after || !/[\\s.,;:!?)]/.test(after) ? ' ' : '';\n return `${lead}${text}${trail}`;\n};\n\n/**\n * Read the editor's content in the format the caller stores.\n * @param {import('@tiptap/core').Editor} editor\n * @param {'html' | 'markdown'} format\n */\nconst read = (editor, format) => {\n if (format === 'markdown') return editor.isEmpty ? '' : editor.getMarkdown();\n return normalizeOutput(editor.getHTML());\n};\n\n/**\n * Content and options for loading a stored value into the editor.\n * @param {string} value\n * @param {'html' | 'markdown'} format\n */\nconst toContent = (value, format) =>\n format === 'markdown' ? [value ?? '', { contentType: 'markdown' }] : [normalizeInput(value), { contentType: 'html' }];\n\n/**\n * A rich-text editor for email bodies, stored as HTML or Markdown.\n *\n * @param {object} props\n * @param {'html' | 'markdown'} [props.format='html'] What `value` and `onChange` carry. Read once, when the editor is created.\n * Markdown hides the toolbar items it cannot store: colours, underline, alignment and text direction.\n * @param {'ltr' | 'rtl'} [props.dir='ltr'] The editor's direction. 'rtl' mirrors the toolbar and sets the direction of\n * paragraphs with no letters; every paragraph still follows its own text. Read once.\n * @param {string} [props.value] The HTML or Markdown to show. When it changes to something the editor did not send, the editor loads it.\n * @param {(value: string) => void} [props.onChange] Called with email-safe HTML (or Markdown) after the user stops typing for `debounce` ms,\n * and right away when the editor loses focus or unmounts\n * @param {number} [props.debounce=300]\n * @param {(file: File) => Promise<string | null | undefined>} [props.onUploadImage] Upload an image and resolve to its public\n * http(s) URL. Resolve to null when you have already told the user why it failed. Without it the image button is hidden\n * and pasted or dropped images are ignored.\n * @param {(message: string) => void} [props.onError] Show a message to the user, for example with a toast\n * @param {Array<string | { label: string, value?: string }>} [props.fields] Merge fields for the built-in \"Insert field\"\n * menu, such as column names. One toolbar button however many there are; a search box appears past six.\n * @param {(api: { insertMarker: (name: string) => void, insertText: (text: string) => void, editor: import('@tiptap/core').Editor }) => import('react').ReactNode} [props.renderMarkers]\n * Render your own merge-field picker at the end of the toolbar instead of the built-in menu\n * @param {string} [props.placeholder]\n * @param {boolean} [props.editable=true]\n * @param {string[][]} [props.toolbar] Groups of toolbar item ids; see DEFAULT_TOOLBAR and DEFAULT_MARKDOWN_TOOLBAR\n * @param {string[]} [props.moreItems] What the toolbar's More menu holds: any of hardBreak, blockquote, codeBlock, strike, underline,\n * rtl and clear. Default: hardBreak, strike, blockquote, codeBlock and clear.\n * @param {string[]} [props.colors] Swatches for text and background colour\n * @param {number} [props.maxImageSize] Largest image in bytes; 4MB by default\n * @param {string[]} [props.imageTypes] MIME types accepted for images\n * @param {boolean} [props.resizableImages=true] Show drag handles on images; the size is saved as width and height attributes\n * @param {boolean} [props.autofocus=false]\n * @param {import('@tiptap/core').AnyExtension[]} [props.extensions] Extra Tiptap extensions. Read once, when the editor is created.\n * @param {string} [props.className]\n * @param {import('react').CSSProperties} [props.style]\n * @param {string} [props.ariaLabel='Email body']\n */\nexport const EmailEditor = forwardRef(\n (\n {\n format: initialFormat = 'html',\n dir: initialDir = 'ltr',\n value = '',\n onChange,\n debounce = 300,\n onUploadImage,\n onError,\n fields,\n renderMarkers,\n placeholder,\n editable = true,\n toolbar,\n moreItems = DEFAULT_MORE_ITEMS,\n colors = DEFAULT_COLORS,\n maxImageSize = DEFAULT_MAX_IMAGE_SIZE,\n imageTypes = DEFAULT_IMAGE_TYPES,\n resizableImages = true,\n autofocus = false,\n extensions,\n className = '',\n style,\n ariaLabel = 'Email body',\n },\n ref\n ) => {\n // Callbacks live in refs so the editor, created once, always calls the latest ones\n // The format is fixed for the editor's lifetime, like its extensions\n const format = useRef(initialFormat === 'markdown' ? 'markdown' : 'html').current;\n const dir = useRef(initialDir === 'rtl' ? 'rtl' : 'ltr').current;\n const props = useRef({});\n props.current = { onChange, onUploadImage, onError, maxImageSize, imageTypes, debounce };\n\n const fileInputRef = useRef(null);\n const timerRef = useRef(null);\n const pendingRef = useRef(null);\n const lastSentRef = useRef(value ?? '');\n const [uploading, setUploading] = useState(0);\n\n const report = useCallback((message) => {\n if (message) props.current.onError?.(message);\n }, []);\n\n const flush = useCallback(() => {\n clearTimeout(timerRef.current);\n timerRef.current = null;\n if (pendingRef.current === null) return;\n const html = pendingRef.current;\n pendingRef.current = null;\n props.current.onChange?.(html);\n }, []);\n\n const editorRef = useRef(null);\n\n const uploadFiles = useCallback(\n async (files, pos) => {\n const upload = props.current.onUploadImage;\n const editor = editorRef.current;\n if (!upload || !editor) return;\n\n // Check every file first, then show a placeholder for each where its image will go\n const accepted = [];\n files.forEach((file) => {\n const problem = validateImage(file, { maxSize: props.current.maxImageSize, types: props.current.imageTypes });\n if (problem) report(problem);\n else accepted.push(file);\n });\n const at = Math.min(typeof pos === 'number' ? pos : editor.state.selection.from, editor.state.doc.content.size);\n const pending = accepted.map((file) => {\n const preview = typeof URL.createObjectURL === 'function' ? URL.createObjectURL(file) : '';\n return { file, preview, id: addPlaceholder(editor, at, preview) };\n });\n\n for (const { file, preview, id } of pending) {\n setUploading((count) => count + 1);\n try {\n const url = await upload(file);\n const { current } = editorRef;\n if (!current || current.isDestroyed) continue;\n const where = findPlaceholder(current, id);\n removePlaceholder(current, id);\n if (!url) continue;\n if (!isHttpUrl(url)) {\n report('Sorry the file could not be uploaded!');\n continue;\n }\n // Alt text starts empty, not the file name, which means nothing to a reader\n const image = { type: 'image', attrs: { src: url.trim(), alt: '' } };\n current.commands.insertContentAt(where ?? current.state.selection.from, image, { updateSelection: false });\n } catch (error) {\n const { current } = editorRef;\n if (current && !current.isDestroyed) removePlaceholder(current, id);\n report(`Sorry the file could not be uploaded! ${error?.message ?? ''}`.trim());\n } finally {\n if (preview) URL.revokeObjectURL(preview);\n setUploading((count) => count - 1);\n }\n }\n },\n [report]\n );\n\n const allExtensions = useMemo(\n () =>\n createExtensions({\n format,\n direction: dir,\n placeholder,\n imageTypes,\n resizableImages,\n onFiles: onUploadImage ? uploadFiles : undefined,\n extensions,\n }),\n // Extensions are read once; changing them would recreate the editor and lose the undo history\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const [initialContent, { contentType }] = toContent(value, format);\n\n const editor = useEditor({\n extensions: allExtensions,\n content: initialContent,\n contentType,\n editable,\n autofocus,\n immediatelyRender: true,\n shouldRerenderOnTransaction: false,\n editorProps: {\n attributes: { class: 'lee-content', 'aria-label': ariaLabel, 'aria-multiline': 'true', role: 'textbox' },\n },\n onUpdate: ({ editor: current }) => {\n const next = read(current, format);\n lastSentRef.current = next;\n pendingRef.current = next;\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(flush, props.current.debounce);\n },\n onBlur: () => flush(),\n });\n\n editorRef.current = editor;\n\n // Send a pending change when the component unmounts\n useEffect(() => () => flush(), [flush]);\n\n // Load HTML that changed outside the editor, such as an edit in an HTML source view\n useEffect(() => {\n if (!editor || editor.isDestroyed) return;\n const next = value ?? '';\n if (next === lastSentRef.current) return;\n lastSentRef.current = next;\n if (format === 'html' && read(editor, format) === normalizeOutput(next)) return;\n clearTimeout(timerRef.current);\n pendingRef.current = null;\n const [content, options] = toContent(next, format);\n editor.commands.setContent(content, { ...options, emitUpdate: false });\n }, [editor, value, format]);\n\n useEffect(() => {\n if (editor && !editor.isDestroyed && editor.isEditable !== editable) editor.setEditable(editable, false);\n }, [editor, editable]);\n\n const insertText = useCallback(\n (text) => {\n if (!editor || !text) return;\n editor.chain().focus().insertContent(spaced(editor, text)).run();\n // focus() above waits a frame; a picker with its own input (the field search) needs the editor back now\n editor.view.focus();\n },\n [editor]\n );\n\n const insertMarker = useCallback((name) => insertText(markerText(name)), [insertText]);\n\n useImperativeHandle(\n ref,\n () => ({\n editor,\n insertMarker,\n insertText,\n focus: () => editor?.commands.focus(),\n getValue: () => (editor ? read(editor, format) : ''),\n getHTML: () => (editor ? normalizeOutput(editor.getHTML()) : ''),\n flush,\n }),\n [editor, insertMarker, insertText, flush, format]\n );\n\n const pickImage = () => fileInputRef.current?.click();\n\n const onFileInput = async (event) => {\n const files = Array.from(event.target.files ?? []);\n event.target.value = '';\n if (!files.length) return;\n if (editor && !editor.isFocused) editor.commands.focus();\n await uploadFiles(files);\n };\n\n if (!editor) return null;\n\n let toolbarEnd = null;\n if (renderMarkers) toolbarEnd = renderMarkers({ insertMarker, insertText, editor });\n else if (fields?.length) toolbarEnd = <FieldsMenu fields={fields} onInsert={insertMarker} disabled={!editable} />;\n\n return (\n <div className={`lee-editor ${className}`.trim()} dir={dir} style={style} data-disabled={!editable || undefined}>\n <Toolbar\n editor={editor}\n items={toolbar ?? (format === 'markdown' ? DEFAULT_MARKDOWN_TOOLBAR : DEFAULT_TOOLBAR)}\n moreItems={moreItems}\n colors={colors}\n canUploadImages={Boolean(onUploadImage)}\n uploading={uploading > 0}\n onPickImage={pickImage}\n end={toolbarEnd}\n />\n {onUploadImage && (\n <input\n ref={fileInputRef}\n type='file'\n accept={imageTypes.join(',')}\n multiple\n hidden\n tabIndex={-1}\n aria-hidden='true'\n onChange={onFileInput}\n />\n )}\n <EditorContent editor={editor} className='lee-scroll' />\n </div>\n );\n }\n);\n\nEmailEditor.displayName = 'EmailEditor';\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAa,iBAAiB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;ACnCA,IAAM,aACJ;AAGF,IAAM,SAAS;AAGf,IAAM,SAAS;;;;;;;AAQf,IAAa,mBAAmB,SAAS;CACvC,IAAI,CAAC,MAAM,OAAO;CAClB,KAAK,MAAM,QAAQ,OAAO,IAAI,CAAC,CAAC,QAAQ,QAAQ,GAAG,GACjD,IAAI,OAAO,KAAK,IAAI,GAAG,OAAO,WAAW,KAAK,IAAI,IAAI,QAAQ;CAEhE,OAAO;AACT;;AClBA,IAAM,cAAc,CAAC,aAAa,SAAS;AAC3C,IAAM,aAAa;CAAC;CAAc;CAAc;AAAa;AAC7D,IAAMA,eAAa,CAAC,OAAO,KAAK;AAEhC,IAAM,kBAAkB,UAAWA,aAAW,SAAS,KAAK,IAAI,QAAQ;;;;;;;;AASxE,IAAM,gBAAgB,WAAW,SAAU,cAAc,SAAS,SAAS,QAAQ,OAAO;;;;;;;;;;;;AAa1F,IAAa,gBAAgB,UAAU,OAAO;CAC5C,MAAM;CAEN,aAAa;EACX,OAAO,EAAE,WAAW,MAAM;CAC5B;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,CAAC,GAAG,aAAa,GAAG,UAAU;GACrC,YAAY;IACV,KAAK;KACH,SAAS;KACT,YAAY,YAAY,eAAe,QAAQ,aAAa,KAAK,CAAC;KAClE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