/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunknocode_component"] = self["webpackChunknocode_component"] || []).push([[768],{

/***/ "../../node_modules/tinymce/icons/default/icons.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/icons/default/icons.js ***!
  \*********************************************************/
/***/ (function() {

eval("tinymce.IconManager.add('default', {\n  icons: {\n    'accessibility-check': '<svg width=\"24\" height=\"24\"><path d=\"M12 2a2 2 0 012 2 2 2 0 01-2 2 2 2 0 01-2-2c0-1.1.9-2 2-2zm8 7h-5v12c0 .6-.4 1-1 1a1 1 0 01-1-1v-5c0-.6-.4-1-1-1a1 1 0 00-1 1v5c0 .6-.4 1-1 1a1 1 0 01-1-1V9H4a1 1 0 110-2h16c.6 0 1 .4 1 1s-.4 1-1 1z\" fill-rule=\"nonzero\"/></svg>',\n    'action-next': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M5.7 7.3a1 1 0 00-1.4 1.4l7.7 7.7 7.7-7.7a1 1 0 10-1.4-1.4L12 13.6 5.7 7.3z\"/></svg>',\n    'action-prev': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M18.3 15.7a1 1 0 001.4-1.4L12 6.6l-7.7 7.7a1 1 0 001.4 1.4L12 9.4l6.3 6.3z\"/></svg>',\n    'align-center': '<svg width=\"24\" height=\"24\"><path d=\"M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm3 4h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 110-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm-3-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'align-justify': '<svg width=\"24\" height=\"24\"><path d=\"M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'align-left': '<svg width=\"24\" height=\"24\"><path d=\"M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'align-none': '<svg width=\"24\" height=\"24\"><path d=\"M14.2 5L13 7H5a1 1 0 110-2h9.2zm4 0h.8a1 1 0 010 2h-2l1.2-2zm-6.4 4l-1.2 2H5a1 1 0 010-2h6.8zm4 0H19a1 1 0 010 2h-4.4l1.2-2zm-6.4 4l-1.2 2H5a1 1 0 010-2h4.4zm4 0H19a1 1 0 010 2h-6.8l1.2-2zM7 17l-1.2 2H5a1 1 0 010-2h2zm4 0h8a1 1 0 010 2H9.8l1.2-2zm5.2-13.5l1.3.7-9.7 16.3-1.3-.7 9.7-16.3z\" fill-rule=\"evenodd\"/></svg>',\n    'align-right': '<svg width=\"24\" height=\"24\"><path d=\"M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm6 4h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm-6-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'arrow-left': '<svg width=\"24\" height=\"24\"><path d=\"M5.6 13l12 6a1 1 0 001.4-1V6a1 1 0 00-1.4-.9l-12 6a1 1 0 000 1.8z\" fill-rule=\"evenodd\"/></svg>',\n    'arrow-right': '<svg width=\"24\" height=\"24\"><path d=\"M18.5 13l-12 6A1 1 0 015 18V6a1 1 0 011.4-.9l12 6a1 1 0 010 1.8z\" fill-rule=\"evenodd\"/></svg>',\n    'bold': '<svg width=\"24\" height=\"24\"><path d=\"M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 01-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4z\" fill-rule=\"evenodd\"/></svg>',\n    'bookmark': '<svg width=\"24\" height=\"24\"><path d=\"M6 4v17l6-4 6 4V4c0-.6-.4-1-1-1H7a1 1 0 00-1 1z\" fill-rule=\"nonzero\"/></svg>',\n    'border-style': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><rect width=\"18\" height=\"2\" x=\"3\" y=\"6\" rx=\"1\"/><rect width=\"2.8\" height=\"2\" x=\"3\" y=\"16\" rx=\"1\"/><rect width=\"2.8\" height=\"2\" x=\"6.8\" y=\"16\" rx=\"1\"/><rect width=\"2.8\" height=\"2\" x=\"10.6\" y=\"16\" rx=\"1\"/><rect width=\"2.8\" height=\"2\" x=\"14.4\" y=\"16\" rx=\"1\"/><rect width=\"2.8\" height=\"2\" x=\"18.2\" y=\"16\" rx=\"1\"/><rect width=\"8\" height=\"2\" x=\"3\" y=\"11\" rx=\"1\"/><rect width=\"8\" height=\"2\" x=\"13\" y=\"11\" rx=\"1\"/></g></svg>',\n    'border-width': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><rect width=\"18\" height=\"5\" x=\"3\" y=\"5\" rx=\"1\"/><rect width=\"18\" height=\"3.5\" x=\"3\" y=\"11.5\" rx=\"1\"/><rect width=\"18\" height=\"2\" x=\"3\" y=\"17\" rx=\"1\"/></g></svg>',\n    'brightness': '<svg width=\"24\" height=\"24\"><path d=\"M12 17c.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.7-.3 1 1 0 01-.3-.7v-1c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3zm0-10a1 1 0 01-.7-.3A1 1 0 0111 6V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v1c0 .3-.1.5-.3.7a1 1 0 01-.7.3zm7 4c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 01-.7.3h-1a1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1zM7 12c0 .3-.1.5-.3.7a1 1 0 01-.7.3H5a1 1 0 01-.7-.3A1 1 0 014 12c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h1c.3 0 .5.1.7.3.2.2.3.4.3.7zm10 3.5l.7.8c.2.1.3.4.3.6 0 .3-.1.6-.3.8a1 1 0 01-.8.3 1 1 0 01-.6-.3l-.8-.7a1 1 0 01-.3-.8c0-.2.1-.5.3-.7a1 1 0 011.4 0zm-10-7l-.7-.8a1 1 0 01-.3-.6c0-.3.1-.6.3-.8.2-.2.5-.3.8-.3.2 0 .5.1.7.3l.7.7c.2.2.3.5.3.8 0 .2-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.8-.3zm10 0a1 1 0 01-.8.3 1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.6.3-.8l.8-.7c.1-.2.4-.3.6-.3.3 0 .6.1.8.3.2.2.3.5.3.8 0 .2-.1.5-.3.7l-.7.7zm-10 7c.2-.2.5-.3.8-.3.2 0 .5.1.7.3a1 1 0 010 1.4l-.8.8a1 1 0 01-.6.3 1 1 0 01-.8-.3 1 1 0 01-.3-.8c0-.2.1-.5.3-.6l.7-.8zM12 8a4 4 0 013.7 2.4 4 4 0 010 3.2A4 4 0 0112 16a4 4 0 01-3.7-2.4 4 4 0 010-3.2A4 4 0 0112 8zm0 6.5c.7 0 1.3-.2 1.8-.7.5-.5.7-1.1.7-1.8s-.2-1.3-.7-1.8c-.5-.5-1.1-.7-1.8-.7s-1.3.2-1.8.7c-.5.5-.7 1.1-.7 1.8s.2 1.3.7 1.8c.5.5 1.1.7 1.8.7z\" fill-rule=\"evenodd\"/></svg>',\n    'browse': '<svg width=\"24\" height=\"24\"><path d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 9.4l-2.3 2.3a1 1 0 11-1.4-1.4l4-4a1 1 0 011.4 0l4 4a1 1 0 01-1.4 1.4L13 13.4V20a1 1 0 01-2 0v-6.6z\" fill-rule=\"nonzero\"/></svg>',\n    'cancel': '<svg width=\"24\" height=\"24\"><path d=\"M12 4.6a7.4 7.4 0 110 14.8 7.4 7.4 0 010-14.8zM12 3a9 9 0 100 18 9 9 0 000-18zm0 8L14.8 8l1 1.1-2.7 2.8 2.7 2.7-1.1 1.1-2.7-2.7-2.7 2.7-1-1.1 2.6-2.7-2.7-2.7 1-1.1 2.8 2.7z\" fill-rule=\"nonzero\"/></svg>',\n    'cell-background-color': '<svg width=\"24\" height=\"24\"><path d=\"M15.7 2l1.6 1.6-2.7 2.6 5.9 5.8c.7.7.7 1.7 0 2.4l-6.3 6.1a1.7 1.7 0 01-2.4 0l-6.3-6.1c-.7-.7-.7-1.7 0-2.4L15.7 2zM18 12l-4.5-4L9 12h9zM4 16s2 2.4 2 3.8C6 21 5.1 22 4 22s-2-1-2-2.2C2 18.4 4 16 4 16z\"/></svg>',\n    'cell-border-color': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path fill-rule=\"nonzero\" d=\"M5 13v5h2v2H5a2 2 0 01-2-2v-5h2zm8-7V4h6a2 2 0 012 2h-8z\" opacity=\".2\"/><path fill-rule=\"nonzero\" d=\"M13 4v2H5v7H3V6c0-1.1.9-2 2-2h8zm-2.6 14.1l.1-.1.1.1.2.3.2.2.2.2c.4.6.8 1.2.8 1.7 0 .8-.7 1.5-1.5 1.5S9 21.3 9 20.5c0-.5.4-1.1.8-1.7l.2-.2.2-.2.2-.3z\"/><path d=\"M13 11l-2 2H5v-2h6V6h2z\"/><path fill-rule=\"nonzero\" d=\"M18.4 8l1 1-1.8 1.9 4 4c.5.4.5 1.1 0 1.6l-4.3 4.2a1.2 1.2 0 01-1.6 0l-4.4-4.2c-.4-.5-.4-1.2 0-1.7l7-6.8zm1.6 7l-3-3-3 3h6z\"/></g></svg>',\n    'change-case': '<svg width=\"24\" height=\"24\"><path d=\"M18.4 18.2v-.6c-.5.8-1.3 1.2-2.4 1.2-2.2 0-3.3-1.6-3.3-4.8 0-3.1 1-4.7 3.3-4.7 1.1 0 1.8.3 2.4 1.1v-.6c0-.5.4-.8.8-.8s.8.3.8.8v8.4c0 .5-.4.8-.8.8a.8.8 0 01-.8-.8zm-2-7.4c-1.3 0-1.8.9-1.8 3.2 0 2.4.5 3.3 1.7 3.3 1.3 0 1.8-.9 1.8-3.2 0-2.4-.5-3.3-1.7-3.3zM10 15.7H5.5l-.8 2.6a1 1 0 01-1 .7h-.2a.7.7 0 01-.7-1l4-12a1 1 0 012 0l4 12a.7.7 0 01-.8 1h-.2a1 1 0 01-1-.7l-.8-2.6zm-.3-1.5l-2-6.5-1.9 6.5h3.9z\" fill-rule=\"evenodd\"/></svg>',\n    'character-count': '<svg width=\"24\" height=\"24\"><path d=\"M4 11.5h16v1H4v-1zm4.8-6.8V10H7.7V5.8h-1v-1h2zM11 8.3V9h2v1h-3V7.7l2-1v-.9h-2v-1h3v2.4l-2 1zm6.3-3.4V10h-3.1V9h2.1V8h-2.1V6.8h2.1v-1h-2.1v-1h3.1zM5.8 16.4c0-.5.2-.8.5-1 .2-.2.6-.3 1.2-.3l.8.1c.2 0 .4.2.5.3l.4.4v2.8l.2.3H8.2v-.1-.2l-.6.3H7c-.4 0-.7 0-1-.2a1 1 0 01-.3-.9c0-.3 0-.6.3-.8.3-.2.7-.4 1.2-.4l.6-.2h.3v-.2l-.1-.2a.8.8 0 00-.5-.1 1 1 0 00-.4 0l-.3.4h-1zm2.3.8h-.2l-.2.1-.4.1a1 1 0 00-.4.2l-.2.2.1.3.5.1h.4l.4-.4v-.6zm2-3.4h1.2v1.7l.5-.3h.5c.5 0 .9.1 1.2.5.3.4.5.8.5 1.4 0 .6-.2 1.1-.5 1.5-.3.4-.7.6-1.3.6l-.6-.1-.4-.4v.4h-1.1v-5.4zm1.1 3.3c0 .3 0 .6.2.8a.7.7 0 001.2 0l.2-.8c0-.4 0-.6-.2-.8a.7.7 0 00-.6-.3l-.6.3-.2.8zm6.1-.5c0-.2 0-.3-.2-.4a.8.8 0 00-.5-.2c-.3 0-.5.1-.6.3l-.2.9c0 .3 0 .6.2.8.1.2.3.3.6.3.2 0 .4 0 .5-.2l.2-.4h1.1c0 .5-.3.8-.6 1.1a2 2 0 01-1.3.4c-.5 0-1-.2-1.3-.6a2 2 0 01-.5-1.4c0-.6.1-1.1.5-1.5.3-.4.8-.5 1.4-.5.5 0 1 0 1.2.3.4.3.5.7.5 1.2h-1v-.1z\" fill-rule=\"evenodd\"/></svg>',\n    'checklist-rtl': '<svg width=\"24\" height=\"24\"><path d=\"M5 17h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 110-2zm14.2 11c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 8c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z\" fill-rule=\"evenodd\"/></svg>',\n    'checklist': '<svg width=\"24\" height=\"24\"><path d=\"M11 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8a1 1 0 010 2h-8a1 1 0 010-2zM7.2 16c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 8c-.2.3-.7.4-1 0L3.8 6.9a.7.7 0 010-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z\" fill-rule=\"evenodd\"/></svg>',\n    'checkmark': '<svg width=\"24\" height=\"24\"><path d=\"M18.2 5.4a1 1 0 011.6 1.2l-8 12a1 1 0 01-1.5.1l-5-5a1 1 0 111.4-1.4l4.1 4.1 7.4-11z\" fill-rule=\"nonzero\"/></svg>',\n    'chevron-down': '<svg width=\"10\" height=\"10\"><path d=\"M8.7 2.2c.3-.3.8-.3 1 0 .4.4.4.9 0 1.2L5.7 7.8c-.3.3-.9.3-1.2 0L.2 3.4a.8.8 0 010-1.2c.3-.3.8-.3 1.1 0L5 6l3.7-3.8z\" fill-rule=\"nonzero\"/></svg>',\n    'chevron-left': '<svg width=\"10\" height=\"10\"><path d=\"M7.8 1.3L4 5l3.8 3.7c.3.3.3.8 0 1-.4.4-.9.4-1.2 0L2.2 5.7a.8.8 0 010-1.2L6.6.2C7 0 7.4 0 7.8.2c.3.3.3.8 0 1.1z\" fill-rule=\"nonzero\"/></svg>',\n    'chevron-right': '<svg width=\"10\" height=\"10\"><path d=\"M2.2 1.3a.8.8 0 010-1c.4-.4.9-.4 1.2 0l4.4 4.1c.3.4.3.9 0 1.2L3.4 9.8c-.3.3-.8.3-1.2 0a.8.8 0 010-1.1L6 5 2.2 1.3z\" fill-rule=\"nonzero\"/></svg>',\n    'chevron-up': '<svg width=\"10\" height=\"10\"><path d=\"M8.7 7.8L5 4 1.3 7.8c-.3.3-.8.3-1 0a.8.8 0 010-1.2l4.1-4.4c.3-.3.9-.3 1.2 0l4.2 4.4c.3.3.3.9 0 1.2-.3.3-.8.3-1.1 0z\" fill-rule=\"nonzero\"/></svg>',\n    'close': '<svg width=\"24\" height=\"24\"><path d=\"M17.3 8.2L13.4 12l3.9 3.8a1 1 0 01-1.5 1.5L12 13.4l-3.8 3.9a1 1 0 01-1.5-1.5l3.9-3.8-3.9-3.8a1 1 0 011.5-1.5l3.8 3.9 3.8-3.9a1 1 0 011.5 1.5z\" fill-rule=\"evenodd\"/></svg>',\n    'code-sample': '<svg width=\"24\" height=\"26\"><path d=\"M7.1 11a2.8 2.8 0 01-.8 2 2.8 2.8 0 01.8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 01-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 01-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 01-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 01.8-2 2.8 2.8 0 01-.8-2zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2zM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 01-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 01-.5-.5V17a3 3 0 001-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5z\" fill-rule=\"evenodd\"/></svg>',\n    'color-levels': '<svg width=\"24\" height=\"24\"><path d=\"M17.5 11.4A9 9 0 0118 14c0 .5 0 1-.2 1.4 0 .4-.3.9-.5 1.3a6.2 6.2 0 01-3.7 3 5.7 5.7 0 01-3.2 0A5.9 5.9 0 017.6 18a6.2 6.2 0 01-1.4-2.6 6.7 6.7 0 010-2.8c0-.4.1-.9.3-1.3a13.6 13.6 0 012.3-4A20 20 0 0112 4a26.4 26.4 0 013.2 3.4 18.2 18.2 0 012.3 4zm-2 4.5c.4-.7.5-1.4.5-2a7.3 7.3 0 00-1-3.2c.2.6.2 1.2.2 1.9a4.5 4.5 0 01-1.3 3 5.3 5.3 0 01-2.3 1.5 4.9 4.9 0 01-2 .1 4.3 4.3 0 002.4.8 4 4 0 002-.6 4 4 0 001.5-1.5z\" fill-rule=\"evenodd\"/></svg>',\n    'color-picker': '<svg width=\"24\" height=\"24\"><path d=\"M12 3a9 9 0 000 18 1.5 1.5 0 001.1-2.5c-.2-.3-.4-.6-.4-1 0-.8.7-1.5 1.5-1.5H16a5 5 0 005-5c0-4.4-4-8-9-8zm-5.5 9a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm3-4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm5 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm3 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3z\" fill-rule=\"nonzero\"/></svg>',\n    'color-swatch-remove-color': '<svg width=\"24\" height=\"24\"><path stroke=\"#000\" stroke-width=\"2\" d=\"M21 3L3 21\" fill-rule=\"evenodd\"/></svg>',\n    'color-swatch': '<svg width=\"24\" height=\"24\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"1\" fill-rule=\"evenodd\"/></svg>',\n    'comment-add': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M9 19l3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 00-1 1v10c0 .6.4 1 1 1h4v2zm-2 4v-4H5a3 3 0 01-3-3V6a3 3 0 013-3h14a3 3 0 013 3v10a3 3 0 01-3 3h-6.4L7 23z\"/><path d=\"M13 10h2a1 1 0 010 2h-2v2a1 1 0 01-2 0v-2H9a1 1 0 010-2h2V8a1 1 0 012 0v2z\"/></g></svg>',\n    'comment': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M9 19l3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 00-1 1v10c0 .6.4 1 1 1h4v2zm-2 4v-4H5a3 3 0 01-3-3V6a3 3 0 013-3h14a3 3 0 013 3v10a3 3 0 01-3 3h-6.4L7 23z\"/></svg>',\n    'contrast': '<svg width=\"24\" height=\"24\"><path d=\"M12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4zm-6 8a6 6 0 006 6V6a6 6 0 00-6 6z\" fill-rule=\"evenodd\"/></svg>',\n    'copy': '<svg width=\"24\" height=\"24\"><path d=\"M16 3H6a2 2 0 00-2 2v11h2V5h10V3zm1 4a2 2 0 012 2v10a2 2 0 01-2 2h-7a2 2 0 01-2-2V9c0-1.2.9-2 2-2h7zm0 12V9h-7v10h7z\" fill-rule=\"nonzero\"/></svg>',\n    'crop': '<svg width=\"24\" height=\"24\"><path d=\"M17 8v7h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v2c0 .6-.4 1-1 1a1 1 0 01-1-1v-2H7V9H5a1 1 0 110-2h2V5c0-.6.4-1 1-1s1 .4 1 1v2h7l3-3 1 1-3 3zM9 9v5l5-5H9zm1 6h5v-5l-5 5z\" fill-rule=\"evenodd\"/></svg>',\n    'cut-column': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M7.2 4.5c.9 0 1.6.4 2.2 1A3.7 3.7 0 0110.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 012 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 017 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 00-.7.4v.1a2.8 2.8 0 00-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 00.8-.3 2.4 2.4 0 00.7-.7 2.5 2.5 0 00.3-.8 1.5 1.5 0 000-.8 1 1 0 00-.2-.4 1 1 0 00-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 00-.5.3 1 1 0 00-.2.5v.7a2.5 2.5 0 00.3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 000-.8 2.6 2.6 0 00-.3-.8A2.5 2.5 0 007.7 6l-.4-.1H7z\"/></svg>',\n    'cut-row': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 01-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 018.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 010-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 00-.8.4 2.5 2.5 0 00-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 00.8-.3L9 18V18l.4-.4.2-.4.1-.4v-.3-.4a1 1 0 00-.2-.5 1 1 0 00-.4-.2h-.5zm7 0H15a1 1 0 00-.4.3 1 1 0 00-.2.5 1.5 1.5 0 000 .7v.4a2.8 2.8 0 00.5.7h.1a2.8 2.8 0 00.8.6l.4.1h.7l.5-.2.2-.5v-.4-.3a2.6 2.6 0 00-.3-.8 2.4 2.4 0 00-.7-.7 2.5 2.5 0 00-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z\"/></svg>',\n    'cut': '<svg width=\"24\" height=\"24\"><path d=\"M18 15c.6.7 1 1.4 1 2.3 0 .8-.2 1.5-.7 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 01-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 018.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 010-2c0-.4.3-.7.5-1l6 6 6-6 .5 1a3.3 3.3 0 010 2c0 .4-.3.7-.5 1l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8zm-8.5 2.2l.1-.4v-.3-.4a1 1 0 00-.2-.5 1 1 0 00-.4-.2 1.6 1.6 0 00-.8 0 2.6 2.6 0 00-.8.3 2.5 2.5 0 00-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 00.8-.3 2.8 2.8 0 001-1zm2.5-2.8c.4 0 .7-.1 1-.4.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4s-.7.1-1 .4c-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4zm5.4 4l.2-.5v-.4-.3a2.6 2.6 0 00-.3-.8 2.4 2.4 0 00-.7-.7 2.5 2.5 0 00-.8-.3 1.5 1.5 0 00-.8 0 1 1 0 00-.4.2 1 1 0 00-.2.5 1.5 1.5 0 000 .7v.4l.3.4.3.4a2.8 2.8 0 00.8.5l.4.1h.7l.5-.2z\" fill-rule=\"evenodd\"/></svg>',\n    'document-properties': '<svg width=\"24\" height=\"24\"><path d=\"M14.4 3H7a2 2 0 00-2 2v14c0 1.1.9 2 2 2h10a2 2 0 002-2V7.6L14.4 3zM17 19H7V5h6v4h4v10z\" fill-rule=\"nonzero\"/></svg>',\n    'drag': '<svg width=\"24\" height=\"24\"><path d=\"M13 5h2v2h-2V5zm0 4h2v2h-2V9zM9 9h2v2H9V9zm4 4h2v2h-2v-2zm-4 0h2v2H9v-2zm0 4h2v2H9v-2zm4 0h2v2h-2v-2zM9 5h2v2H9V5z\" fill-rule=\"evenodd\"/></svg>',\n    'duplicate-column': '<svg width=\"24\" height=\"24\"><path d=\"M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z\"/></svg>',\n    'duplicate-row': '<svg width=\"24\" height=\"24\"><path d=\"M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z\"/></svg>',\n    'duplicate': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M16 3v2H6v11H4V5c0-1.1.9-2 2-2h10zm3 8h-2V9h-7v10h9a2 2 0 01-2 2h-7a2 2 0 01-2-2V9c0-1.2.9-2 2-2h7a2 2 0 012 2v2z\"/><path d=\"M17 14h1a1 1 0 010 2h-1v1a1 1 0 01-2 0v-1h-1a1 1 0 010-2h1v-1a1 1 0 012 0v1z\"/></g></svg>',\n    'edit-block': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19.8 8.8l-9.4 9.4c-.2.2-.5.4-.9.4l-5.4 1.2 1.2-5.4.5-.8 9.4-9.4c.7-.7 1.8-.7 2.5 0l2.1 2.1c.7.7.7 1.8 0 2.5zm-2-.2l1-.9v-.3l-2.2-2.2a.3.3 0 00-.3 0l-1 1L18 8.5zm-1 1l-2.5-2.4-6 6 2.5 2.5 6-6zm-7 7.1l-2.6-2.4-.3.3-.1.2-.7 3 3.1-.6h.1l.4-.5z\"/></svg>',\n    'edit-image': '<svg width=\"24\" height=\"24\"><path d=\"M18 16h2V7a2 2 0 00-2-2H7v2h11v9zM6 17h15a1 1 0 010 2h-1v1a1 1 0 01-2 0v-1H6a2 2 0 01-2-2V7H3a1 1 0 110-2h1V4a1 1 0 112 0v13zm3-5.3l1.3 2 3-4.7 3.7 6H7l2-3.3z\" fill-rule=\"nonzero\"/></svg>',\n    'embed-page': '<svg width=\"24\" height=\"24\"><path d=\"M19 6V5H5v14h2A13 13 0 0119 6zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 008 19h3zM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 00-4 4.5h2.2zm-3.4 0a12 12 0 012.8-4 12 12 0 00-5 4h2.2z\" fill-rule=\"nonzero\"/></svg>',\n    'embed': '<svg width=\"24\" height=\"24\"><path d=\"M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm1 2v14h14V5H5zm4.8 2.6l5.6 4a.5.5 0 010 .8l-5.6 4A.5.5 0 019 16V8a.5.5 0 01.8-.4z\" fill-rule=\"nonzero\"/></svg>',\n    'emoji': '<svg width=\"24\" height=\"24\"><path d=\"M9 11c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 00-1 1c0 .6.4 1 1 1zm6 0c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 00-1 1c0 .6.4 1 1 1zm-3 5.5c2.1 0 4-1.5 4.4-3.5H7.6c.5 2 2.3 3.5 4.4 3.5zM12 4a8 8 0 100 16 8 8 0 000-16zm0 14.5a6.5 6.5 0 110-13 6.5 6.5 0 010 13z\" fill-rule=\"nonzero\"/></svg>',\n    'export': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M14.4 3L18 7v1h-5V5H7v14h9a1 1 0 012 0c0 1-.8 2-1.9 2H7c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h7.5z\"/><path d=\"M18.1 12c.5 0 .9.4.9 1 0 .5-.3 1-.8 1h-7.3c-.5 0-.9-.4-.9-1 0-.5.3-1 .8-1h7.3z\"/><path d=\"M16.4 9.2a1 1 0 011.4.2l2.4 3.6-2.4 3.6a1 1 0 01-1.7-1v-.2l1.7-2.4-1.6-2.4a1 1 0 01.2-1.4z\"/></g></svg>',\n    'fill': '<svg width=\"24\" height=\"26\"><path d=\"M16.6 12l-9-9-1.4 1.4 2.4 2.4-5.2 5.1c-.5.6-.5 1.6 0 2.2L9 19.6a1.5 1.5 0 002.2 0l5.5-5.5c.5-.6.5-1.6 0-2.2zM5.2 13L10 8.2l4.8 4.8H5.2zM19 14.5s-2 2.2-2 3.5c0 1.1.9 2 2 2a2 2 0 002-2c0-1.3-2-3.5-2-3.5z\" fill-rule=\"nonzero\"/></svg>',\n    'flip-horizontally': '<svg width=\"24\" height=\"24\"><path d=\"M14 19h2v-2h-2v2zm4-8h2V9h-2v2zM4 7v10c0 1.1.9 2 2 2h3v-2H6V7h3V5H6a2 2 0 00-2 2zm14-2v2h2a2 2 0 00-2-2zm-7 16h2V3h-2v18zm7-6h2v-2h-2v2zm-4-8h2V5h-2v2zm4 12a2 2 0 002-2h-2v2z\" fill-rule=\"nonzero\"/></svg>',\n    'flip-vertically': '<svg width=\"24\" height=\"24\"><path d=\"M5 14v2h2v-2H5zm8 4v2h2v-2h-2zm4-14H7a2 2 0 00-2 2v3h2V6h10v3h2V6a2 2 0 00-2-2zm2 14h-2v2a2 2 0 002-2zM3 11v2h18v-2H3zm6 7v2h2v-2H9zm8-4v2h2v-2h-2zM5 18c0 1.1.9 2 2 2v-2H5z\" fill-rule=\"nonzero\"/></svg>',\n    'format-painter': '<svg width=\"24\" height=\"24\"><path d=\"M18 5V4c0-.5-.4-1-1-1H5a1 1 0 00-1 1v4c0 .6.5 1 1 1h12c.6 0 1-.4 1-1V7h1v4H9v9c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-7h8V5h-3z\" fill-rule=\"nonzero\"/></svg>',\n    'format': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M17 5a1 1 0 010 2h-4v11a1 1 0 01-2 0V7H7a1 1 0 110-2h10z\"/></svg>',\n    'fullscreen': '<svg width=\"24\" height=\"24\"><path d=\"M15.3 10l-1.2-1.3 2.9-3h-2.3a.9.9 0 110-1.7H19c.5 0 .9.4.9.9v4.4a.9.9 0 11-1.8 0V7l-2.9 3zm0 4l3 3v-2.3a.9.9 0 111.7 0V19c0 .5-.4.9-.9.9h-4.4a.9.9 0 110-1.8H17l-3-2.9 1.3-1.2zM10 15.4l-2.9 3h2.3a.9.9 0 110 1.7H5a.9.9 0 01-.9-.9v-4.4a.9.9 0 111.8 0V17l2.9-3 1.2 1.3zM8.7 10L5.7 7v2.3a.9.9 0 01-1.7 0V5c0-.5.4-.9.9-.9h4.4a.9.9 0 010 1.8H7l3 2.9-1.3 1.2z\" fill-rule=\"nonzero\"/></svg>',\n    'gallery': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M5 15.7l2.3-2.2c.3-.3.7-.3 1 0L11 16l5.1-5c.3-.4.8-.4 1 0l2 1.9V8H5v7.7zM5 18V19h3l1.8-1.9-2-2L5 17.9zm14-3l-2.5-2.4-6.4 6.5H19v-4zM4 6h16c.6 0 1 .4 1 1v13c0 .6-.4 1-1 1H4a1 1 0 01-1-1V7c0-.6.4-1 1-1zm6 7a2 2 0 110-4 2 2 0 010 4zM4.5 4h15a.5.5 0 110 1h-15a.5.5 0 010-1zm2-2h11a.5.5 0 110 1h-11a.5.5 0 010-1z\"/></svg>',\n    'gamma': '<svg width=\"24\" height=\"24\"><path d=\"M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm1 2v14h14V5H5zm6.5 11.8V14L9.2 8.7a5.1 5.1 0 00-.4-.8l-.1-.2H8 8v-1l.3-.1.3-.1h.7a1 1 0 01.6.5l.1.3a8.5 8.5 0 01.3.6l1.9 4.6 2-5.2a1 1 0 011-.6.5.5 0 01.5.6L13 14v2.8a.7.7 0 01-1.4 0z\" fill-rule=\"nonzero\"/></svg>',\n    'help': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path d=\"M12 5.5a6.5 6.5 0 00-6 9 6.3 6.3 0 001.4 2l1 1a6.3 6.3 0 003.6 1 6.5 6.5 0 006-9 6.3 6.3 0 00-1.4-2l-1-1a6.3 6.3 0 00-3.6-1zM12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4z\"/><path d=\"M9.6 9.7a.7.7 0 01-.7-.8c0-1.1 1.5-1.8 3.2-1.8 1.8 0 3.2.8 3.2 2.4 0 1.4-.4 2.1-1.5 2.8-.2 0-.3.1-.3.2a2 2 0 00-.8.8.8.8 0 01-1.4-.6c.3-.7.8-1 1.3-1.5l.4-.2c.7-.4.8-.6.8-1.5 0-.5-.6-.9-1.7-.9-.5 0-1 .1-1.4.3-.2 0-.3.1-.3.2v-.2c0 .4-.4.8-.8.8z\" fill-rule=\"nonzero\"/><circle cx=\"12\" cy=\"16\" r=\"1\"/></g></svg>',\n    'highlight-bg-color': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path id=\"tox-icon-highlight-bg-color__color\" d=\"M3 18h18v3H3z\"/><path fill-rule=\"nonzero\" d=\"M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 012.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6\"/></g></svg>',\n    'home': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z\"/></svg>',\n    'horizontal-rule': '<svg width=\"24\" height=\"24\"><path d=\"M4 11h16v2H4z\" fill-rule=\"evenodd\"/></svg>',\n    'image-options': '<svg width=\"24\" height=\"24\"><path d=\"M6 10a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm12 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-6 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2z\" fill-rule=\"nonzero\"/></svg>',\n    'image': '<svg width=\"24\" height=\"24\"><path d=\"M5 15.7l3.3-3.2c.3-.3.7-.3 1 0L12 15l4.1-4c.3-.4.8-.4 1 0l2 1.9V5H5v10.7zM5 18V19h3l2.8-2.9-2-2L5 17.9zm14-3l-2.5-2.4-6.4 6.5H19v-4zM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 01-1-1V4c0-.6.4-1 1-1zm6 8a2 2 0 100-4 2 2 0 000 4z\" fill-rule=\"nonzero\"/></svg>',\n    'indent': '<svg width=\"24\" height=\"24\"><path d=\"M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z\" fill-rule=\"evenodd\"/></svg>',\n    'info': '<svg width=\"24\" height=\"24\"><path d=\"M12 4a7.8 7.8 0 015.7 2.3A8 8 0 1112 4zm-1 3v2h2V7h-2zm3 10v-1h-1v-5h-3v1h1v4h-1v1h4z\" fill-rule=\"evenodd\"/></svg>',\n    'insert-character': '<svg width=\"24\" height=\"24\"><path d=\"M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 001.8-2.9 6.3 6.3 0 00-.1-4.1 5.8 5.8 0 00-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 00-3.9 1.8 6.3 6.3 0 00-1.3 6 6.2 6.2 0 001.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 014 11c0-1 .2-1.9.6-2.7A7 7 0 016.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 015.7 2 7 7 0 011.7 2.3 6 6 0 01.2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 01-3.6 2.5v.5z\" fill-rule=\"evenodd\"/></svg>',\n    'insert-time': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M12 19a7 7 0 100-14 7 7 0 000 14zm0 2a9 9 0 110-18 9 9 0 010 18z\"/><path d=\"M16 12h-3V7c0-.6-.4-1-1-1a1 1 0 00-1 1v7h5c.6 0 1-.4 1-1s-.4-1-1-1z\"/></g></svg>',\n    'invert': '<svg width=\"24\" height=\"24\"><path d=\"M18 19.3L16.5 18a5.8 5.8 0 01-3.1 1.9 6.1 6.1 0 01-5.5-1.6A5.8 5.8 0 016 14v-.3l.1-1.2A13.9 13.9 0 017.7 9l-3-3 .7-.8 2.8 2.9 9 8.9 1.5 1.6-.7.6zm0-5.5v.3l-.1 1.1-.4 1-1.2-1.2a4.3 4.3 0 00.2-1v-.2c0-.4 0-.8-.2-1.3l-.5-1.4a14.8 14.8 0 00-3-4.2L12 6a26.1 26.1 0 00-2.2 2.5l-1-1a20.9 20.9 0 012.9-3.3L12 4l1 .8a22.2 22.2 0 014 5.4c.6 1.2 1 2.4 1 3.6z\" fill-rule=\"evenodd\"/></svg>',\n    'italic': '<svg width=\"24\" height=\"24\"><path d=\"M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8z\" fill-rule=\"evenodd\"/></svg>',\n    'language': '<svg width=\"24\" height=\"24\"><path d=\"M12 3a9 9 0 110 18 9 9 0 010-18zm4.3 13.3c-.5 1-1.2 2-2 2.9a7.5 7.5 0 003.2-2.1l-.2-.2a6 6 0 00-1-.6zm-8.6 0c-.5.2-.9.5-1.2.8.9 1 2 1.7 3.2 2a10 10 0 01-2-2.8zm3.6-.8c-.8 0-1.6.1-2.2.3.5 1 1.2 1.9 2.1 2.7zm1.5 0v3c.9-.8 1.6-1.7 2.1-2.7-.6-.2-1.4-.3-2.1-.3zm-6-2.7H4.5c.2 1 .5 2.1 1 3h.3l1.3-1a10 10 0 01-.3-2zm12.7 0h-2.3c0 .7-.1 1.4-.3 2l1.6 1.1c.5-1 .9-2 1-3.1zm-3.8 0h-3V14c1 0 2 .1 2.7.4.2-.5.3-1 .3-1.6zm-4.4 0h-3l.3 1.6c.8-.3 1.7-.4 2.7-.4v-1.3zm-5.5-5c-.7 1-1.1 2.2-1.3 3.5h2.3c0-1 .2-1.8.5-2.6l-1.5-1zm2.9 1.4v.1c-.2.6-.4 1.3-.4 2h3V9.4c-1 0-1.8-.1-2.6-.3zm6.6 0h-.1l-2.4.3v1.8h3l-.5-2.1zm3-1.4l-.3.1-1.3.8c.3.8.5 1.6.5 2.6h2.3a7.5 7.5 0 00-1.3-3.5zm-9 0l2 .2V5.5a9 9 0 00-2 2.2zm3.5-2.3V8c.6 0 1.3 0 1.9-.2a9 9 0 00-2-2.3zm-3-.7h-.1c-1.1.4-2.1 1-3 1.8l1.2.7a10 10 0 011.9-2.5zm4.4 0l.1.1a10 10 0 011.8 2.4l1.1-.7a7.5 7.5 0 00-3-1.8z\"/></svg>',\n    'line-height': '<svg width=\"24\" height=\"24\"><path d=\"M21 5a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zm0 4a1 1 0 01.1 2H13a1 1 0 01-.1-2H21zM7 3.6l3.7 3.7a1 1 0 01-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 011.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 011.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 01-1.3 0h-.1a1 1 0 010-1.3v-.1L7 3.6z\"/></svg>',\n    'line': '<svg width=\"24\" height=\"24\"><path d=\"M15 9l-8 8H4v-3l8-8 3 3zm1-1l-3-3 1-1h1c-.2 0 0 0 0 0l2 2s0 .2 0 0v1l-1 1zM4 18h16v2H4v-2z\" fill-rule=\"evenodd\"/></svg>',\n    'link': '<svg width=\"24\" height=\"24\"><path d=\"M6.2 12.3a1 1 0 011.4 1.4l-2.1 2a2 2 0 102.7 2.8l4.8-4.8a1 1 0 000-1.4 1 1 0 111.4-1.3 2.9 2.9 0 010 4L9.6 20a3.9 3.9 0 01-5.5-5.5l2-2zm11.6-.6a1 1 0 01-1.4-1.4l2-2a2 2 0 10-2.6-2.8L11 10.3a1 1 0 000 1.4A1 1 0 119.6 13a2.9 2.9 0 010-4L14.4 4a3.9 3.9 0 015.5 5.5l-2 2z\" fill-rule=\"nonzero\"/></svg>',\n    'list-bull-circle': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path d=\"M11 16a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6zM11 26a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6zM11 36a2 2 0 100-4 2 2 0 000 4zm0 1a3 3 0 110-6 3 3 0 010 6z\" fill-rule=\"nonzero\"/><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/></g></svg>',\n    'list-bull-default': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><circle cx=\"11\" cy=\"14\" r=\"3\"/><circle cx=\"11\" cy=\"24\" r=\"3\"/><circle cx=\"11\" cy=\"34\" r=\"3\"/><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/></g></svg>',\n    'list-bull-square': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path d=\"M8 11h6v6H8zM8 21h6v6H8zM8 31h6v6H8z\"/><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/></g></svg>',\n    'list-num-default-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M37.4 17v-4.8l-1.6 1v-1.1l1.6-1h1.2V17zM33.3 17.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm1.7 5.7c0-1.2 1-2 2.2-2 1.3 0 2.1.8 2.1 1.8 0 .7-.3 1.2-1.3 2.2l-1.2 1v.2h2.6v1h-4.3v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H35zm-1.7 4.3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm3.2 7.3v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H35c0-1.1 1-1.8 2.2-1.8 1.2 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.7.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .6 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm-3.3 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z\"/></g></svg>',\n    'list-num-default': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M10 17v-4.8l-1.5 1v-1.1l1.6-1h1.2V17h-1.2zm3.6.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm-5 5.7c0-1.2.8-2 2.1-2s2.1.8 2.1 1.8c0 .7-.3 1.2-1.4 2.2l-1.1 1v.2h2.6v1H8.6v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H8.5zm6.3 4.3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM10 34.4v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H8.6c0-1.1 1-1.8 2.2-1.8 1.3 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.8.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .7 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm4.7 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z\"/></g></svg>',\n    'list-num-lower-alpha-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M36.5 16c-.9 0-1.5-.5-1.5-1.3s.6-1.3 1.8-1.4h1v-.4c0-.4-.2-.6-.7-.6-.4 0-.7.1-.8.4h-1.1c0-.8.8-1.4 2-1.4S39 12 39 13V16h-1.2v-.6c-.3.4-.8.7-1.4.7zm.4-.8c.6 0 1-.4 1-.9V14h-1c-.5.1-.7.3-.7.6 0 .4.3.6.7.6zM33.1 16.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zM37.7 26c-.7 0-1.2-.2-1.5-.7v.7H35v-6.3h1.2v2.5c.3-.5.8-.9 1.5-.9 1.1 0 1.8 1 1.8 2.4 0 1.5-.7 2.4-1.8 2.4zm-.5-3.6c-.6 0-1 .5-1 1.3s.4 1.4 1 1.4c.7 0 1-.6 1-1.4 0-.8-.3-1.3-1-1.3zM33.2 26.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm6 7h-1c-.1-.5-.4-.8-1-.8s-1 .5-1 1.4c0 1 .4 1.4 1 1.4.5 0 .9-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm-6.1 3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-lower-alpha': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M10.3 15.2c.5 0 1-.4 1-.9V14h-1c-.5.1-.8.3-.8.6 0 .4.3.6.8.6zm-.4.9c-1 0-1.5-.6-1.5-1.4 0-.8.6-1.3 1.7-1.4h1.1v-.4c0-.4-.2-.6-.7-.6-.5 0-.8.1-.9.4h-1c0-.8.8-1.4 2-1.4 1.1 0 1.8.6 1.8 1.6V16h-1.1v-.6h-.1c-.2.4-.7.7-1.3.7zm4.6 0c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-3.2 10c-.6 0-1.2-.3-1.4-.8v.7H8.5v-6.3H10v2.5c.3-.5.8-.9 1.4-.9 1.2 0 1.9 1 1.9 2.4 0 1.5-.7 2.4-1.9 2.4zm-.4-3.7c-.7 0-1 .5-1 1.3s.3 1.4 1 1.4c.6 0 1-.6 1-1.4 0-.8-.4-1.3-1-1.3zm4 3.7c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-2.2 7h-1.2c0-.5-.4-.8-.9-.8-.6 0-1 .5-1 1.4 0 1 .4 1.4 1 1.4.5 0 .8-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm1.8 3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-lower-greek-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M37.4 16c-1.2 0-2-.8-2-2.3 0-1.5.8-2.4 2-2.4.6 0 1 .4 1.3 1v-.9H40v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1-.7h-.2c-.2.4-.7.8-1.3.8zm.3-1c.6 0 1-.5 1-1.3s-.4-1.3-1-1.3-1 .5-1 1.3.4 1.4 1 1.4zM33.3 16.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM36 21.9c0-1.5.8-2.3 2.1-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.9 1.3.9.3 1.3.8 1.3 1.7 0 1.2-.7 1.9-1.8 1.9-.6 0-1.1-.3-1.4-.8v2.2H36V22zm1.8 1.2v-1h.3c.5 0 .9-.2.9-.7 0-.5-.3-.8-.9-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1 1.3s1-.4 1-1-.4-1-1.2-1h-.3zM33.3 26.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zM37.1 34.6L34.8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.2.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2zm.7 1a2 2 0 00-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1zM33.3 36.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-lower-greek': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M10.5 15c.7 0 1-.5 1-1.3s-.3-1.3-1-1.3c-.5 0-.9.5-.9 1.3s.4 1.4 1 1.4zm-.3 1c-1.1 0-1.8-.8-1.8-2.3 0-1.5.7-2.4 1.8-2.4.7 0 1.1.4 1.3 1h.1v-.9h1.2v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1.1-.7h-.1c-.2.4-.7.8-1.4.8zm5 .1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm-4.9 7v-1h.3c.6 0 1-.2 1-.7 0-.5-.4-.8-1-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1.1 1.3.6 0 1-.4 1-1s-.5-1-1.3-1h-.3zM8.6 22c0-1.5.7-2.3 2-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.8 1.3.8.3 1.3.8 1.3 1.7 0 1.2-.8 1.9-1.9 1.9-.6 0-1.1-.3-1.3-.8v2.2H8.5V22zm6.2 4.2c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm-4.5 8.5L8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.1.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2zm.7 1a2 2 0 00-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1zm4.5.5c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-lower-roman-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M32.9 16v-1.2h-1.3V16H33zm0 10v-1.2h-1.3V26H33zm0 10v-1.2h-1.3V36H33z\"/><path fill-rule=\"nonzero\" d=\"M36 21h-1.5v5H36zM36 31h-1.5v5H36zM39 21h-1.5v5H39zM39 31h-1.5v5H39zM42 31h-1.5v5H42zM36 11h-1.5v5H36zM36 19h-1.5v1H36zM36 29h-1.5v1H36zM39 19h-1.5v1H39zM39 29h-1.5v1H39zM42 29h-1.5v1H42zM36 9h-1.5v1H36z\"/></g></svg>',\n    'list-num-lower-roman': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M15.1 16v-1.2h1.3V16H15zm0 10v-1.2h1.3V26H15zm0 10v-1.2h1.3V36H15z\"/><path fill-rule=\"nonzero\" d=\"M12 21h1.5v5H12zM12 31h1.5v5H12zM9 21h1.5v5H9zM9 31h1.5v5H9zM6 31h1.5v5H6zM12 11h1.5v5H12zM12 19h1.5v1H12zM12 29h1.5v1H12zM9 19h1.5v1H9zM9 29h1.5v1H9zM6 29h1.5v1H6zM12 9h1.5v1H12z\"/></g></svg>',\n    'list-num-upper-alpha-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M39.3 17l-.5-1.4h-2l-.5 1.4H35l2-6h1.6l2 6h-1.3zm-1.6-4.7l-.7 2.3h1.6l-.8-2.3zM33.4 17c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zm4.7 9.9h-2.7v-6H38c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7zm-1.4-5v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1zm0 4h1.1c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9h-1.1V26zM33 27.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm4.9 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2zm-4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-upper-alpha': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M12.6 17l-.5-1.4h-2L9.5 17H8.3l2-6H12l2 6h-1.3zM11 12.3l-.7 2.3h1.6l-.8-2.3zm4.7 4.8c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7zM11.4 27H8.7v-6h2.6c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7zM10 22v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1zm0 4H11c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9H10V26zm5.4 1.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm-4.1 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2zm4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z\"/></g></svg>',\n    'list-num-upper-roman-rtl': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z\"/><path d=\"M31.6 17v-1.2H33V17h-1.3zm0 10v-1.2H33V27h-1.3zm0 10v-1.2H33V37h-1.3z\"/><path fill-rule=\"nonzero\" d=\"M34.5 20H36v7h-1.5zM34.5 30H36v7h-1.5zM37.5 20H39v7h-1.5zM37.5 30H39v7h-1.5zM40.5 30H42v7h-1.5zM34.5 10H36v7h-1.5z\"/></g></svg>',\n    'list-num-upper-roman': '<svg width=\"48\" height=\"48\"><g fill-rule=\"evenodd\"><path opacity=\".2\" d=\"M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z\"/><path d=\"M15.1 17v-1.2h1.3V17H15zm0 10v-1.2h1.3V27H15zm0 10v-1.2h1.3V37H15z\"/><path fill-rule=\"nonzero\" d=\"M12 20h1.5v7H12zM12 30h1.5v7H12zM9 20h1.5v7H9zM9 30h1.5v7H9zM6 30h1.5v7H6zM12 10h1.5v7H12z\"/></g></svg>',\n    'lock': '<svg width=\"24\" height=\"24\"><path d=\"M16.3 11c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H8V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h.3zM10 8v3h4V8a1 1 0 00-.3-.7A1 1 0 0013 7h-2a1 1 0 00-.7.3 1 1 0 00-.3.7z\" fill-rule=\"evenodd\"/></svg>',\n    'ltr': '<svg width=\"24\" height=\"24\"><path d=\"M11 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 017.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L11 5zM4.4 16.2L6.2 15l-1.8-1.2a1 1 0 011.2-1.6l3 2a1 1 0 010 1.6l-3 2a1 1 0 11-1.2-1.6z\" fill-rule=\"evenodd\"/></svg>',\n    'more-drawer': '<svg width=\"24\" height=\"24\"><path d=\"M6 10a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm12 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2zm-6 0a2 2 0 00-2 2c0 1.1.9 2 2 2a2 2 0 002-2 2 2 0 00-2-2z\" fill-rule=\"nonzero\"/></svg>',\n    'new-document': '<svg width=\"24\" height=\"24\"><path d=\"M14.4 3H7a2 2 0 00-2 2v14c0 1.1.9 2 2 2h10a2 2 0 002-2V7.6L14.4 3zM17 19H7V5h6v4h4v10z\" fill-rule=\"nonzero\"/></svg>',\n    'new-tab': '<svg width=\"24\" height=\"24\"><path d=\"M15 13l2-2v8H5V7h8l-2 2H7v8h8v-4zm4-8v5.5l-2-2-5.6 5.5H10v-1.4L15.5 7l-2-2H19z\" fill-rule=\"evenodd\"/></svg>',\n    'non-breaking': '<svg width=\"24\" height=\"24\"><path d=\"M11 11H8a1 1 0 110-2h3V6c0-.6.4-1 1-1s1 .4 1 1v3h3c.6 0 1 .4 1 1s-.4 1-1 1h-3v3c0 .6-.4 1-1 1a1 1 0 01-1-1v-3zm10 4v5H3v-5c0-.6.4-1 1-1s1 .4 1 1v3h14v-3c0-.6.4-1 1-1s1 .4 1 1z\" fill-rule=\"evenodd\"/></svg>',\n    'notice': '<svg width=\"24\" height=\"24\"><path d=\"M17.8 9.8L15.4 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7l2.3 5.8zm0 0l2.2 5.7-2.3-5.8zM13 17v-2h-2v2h2zm0-4V7h-2v6h2z\" fill-rule=\"evenodd\"/></svg>',\n    'ordered-list-rtl': '<svg width=\"24\" height=\"24\"><path d=\"M6 17h8a1 1 0 010 2H6a1 1 0 010-2zm0-6h8a1 1 0 010 2H6a1 1 0 010-2zm0-6h8a1 1 0 010 2H6a1 1 0 110-2zm13-1v3.5a.5.5 0 11-1 0V5h-.5a.5.5 0 110-1H19zm-1 8.8l.2.2h1.3a.5.5 0 110 1h-1.6a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2h-1.3a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zm2 4.2v2c0 .6-.4 1-1 1h-1.5a.5.5 0 010-1h1.2a.3.3 0 100-.6h-1.3a.4.4 0 110-.8h1.3a.3.3 0 000-.6h-1.2a.5.5 0 110-1H19c.6 0 1 .4 1 1z\" fill-rule=\"evenodd\"/></svg>',\n    'ordered-list': '<svg width=\"24\" height=\"24\"><path d=\"M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 110-2zM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 01-.5-.5V5h-.5a.5.5 0 010-1H6zm-1 8.8l.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 01-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 00-.2-.2H4.5a.5.5 0 01-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3zM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 010-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 110-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 110-1H6c.6 0 1 .4 1 1z\" fill-rule=\"evenodd\"/></svg>',\n    'orientation': '<svg width=\"24\" height=\"24\"><path d=\"M7.3 6.4L1 13l6.4 6.5 6.5-6.5-6.5-6.5zM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7zM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 010-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 11-4.3 16.9l1.5-1.5A7 7 0 1013 6h-1z\" fill-rule=\"nonzero\"/></svg>',\n    'outdent': '<svg width=\"24\" height=\"24\"><path d=\"M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 110-2zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 010-2zm-5 4h12a1 1 0 010 2H7a1 1 0 010-2zm1.6-3.8a1 1 0 01-1.2 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 011.2 1.6L6.8 12l1.8 1.2z\" fill-rule=\"evenodd\"/></svg>',\n    'page-break': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path d=\"M5 11c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1h-1a1 1 0 010-2zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zM7 3v5h10V3c0-.6.4-1 1-1s1 .4 1 1v7H5V3c0-.6.4-1 1-1s1 .4 1 1zM6 22a1 1 0 01-1-1v-7h14v7c0 .6-.4 1-1 1a1 1 0 01-1-1v-5H7v5c0 .6-.4 1-1 1z\"/></g></svg>',\n    'paragraph': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M10 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 016.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L10 5z\"/></svg>',\n    'paste-column-after': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 100 2 1 1 0 000-2z\"/></svg>',\n    'paste-column-before': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v2H4V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 100 2 1 1 0 000-2z\"/></svg>',\n    'paste-row-after': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 100 2 1 1 0 000-2z\"/></svg>',\n    'paste-row-before': '<svg width=\"24\" height=\"24\"><path fill-rule=\"evenodd\" d=\"M12 1a3 3 0 012.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0112 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 100 2 1 1 0 000-2z\"/></svg>',\n    'paste-text': '<svg width=\"24\" height=\"24\"><path d=\"M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 01-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0112 1a3 3 0 012.8 2H18a2 2 0 012 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 00-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1zm0 9h6v2h-.5l-.5-1h-1v4h.8v1h-3.6v-1h.8v-4h-1l-.5 1H12v-2z\" fill-rule=\"nonzero\"/></svg>',\n    'paste': '<svg width=\"24\" height=\"24\"><path d=\"M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 01-1-1V5H6v13h3V9h9zM9 20H6a2 2 0 01-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0112 1a3 3 0 012.8 2H18a2 2 0 012 2v4h1v12H9v-1zm1.5-9.5v9h9v-9h-9zM12 3a1 1 0 00-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1z\" fill-rule=\"nonzero\"/></svg>',\n    'permanent-pen': '<svg width=\"24\" height=\"24\"><path d=\"M10.5 17.5L8 20H3v-3l3.5-3.5a2 2 0 010-3L14 3l1 1-7.3 7.3a1 1 0 000 1.4l3.6 3.6c.4.4 1 .4 1.4 0L20 9l1 1-7.6 7.6a2 2 0 01-2.8 0l-.1-.1z\" fill-rule=\"nonzero\"/></svg>',\n    'plus': '<svg width=\"24\" height=\"24\"><path d=\"M12 4c.5 0 1 .4 1 .9V11h6a1 1 0 01.1 2H13v6a1 1 0 01-2 .1V13H5a1 1 0 01-.1-2H11V5c0-.6.4-1 1-1z\"/></svg>',\n    'preferences': '<svg width=\"24\" height=\"24\"><path d=\"M20.1 13.5l-1.9.2a5.8 5.8 0 01-.6 1.5l1.2 1.5c.4.4.3 1 0 1.4l-.7.7a1 1 0 01-1.4 0l-1.5-1.2a6.2 6.2 0 01-1.5.6l-.2 1.9c0 .5-.5.9-1 .9h-1a1 1 0 01-1-.9l-.2-1.9a5.8 5.8 0 01-1.5-.6l-1.5 1.2a1 1 0 01-1.4 0l-.7-.7a1 1 0 010-1.4l1.2-1.5a6.2 6.2 0 01-.6-1.5l-1.9-.2a1 1 0 01-.9-1v-1c0-.5.4-1 .9-1l1.9-.2a5.8 5.8 0 01.6-1.5L5.2 7.3a1 1 0 010-1.4l.7-.7a1 1 0 011.4 0l1.5 1.2a6.2 6.2 0 011.5-.6l.2-1.9c0-.5.5-.9 1-.9h1c.5 0 1 .4 1 .9l.2 1.9a5.8 5.8 0 011.5.6l1.5-1.2a1 1 0 011.4 0l.7.7c.3.4.4 1 0 1.4l-1.2 1.5a6.2 6.2 0 01.6 1.5l1.9.2c.5 0 .9.5.9 1v1c0 .5-.4 1-.9 1zM12 15a3 3 0 100-6 3 3 0 000 6z\" fill-rule=\"evenodd\"/></svg>',\n    'preview': '<svg width=\"24\" height=\"24\"><path d=\"M3.5 12.5c.5.8 1.1 1.6 1.8 2.3 2 2 4.2 3.2 6.7 3.2s4.7-1.2 6.7-3.2a16.2 16.2 0 002.1-2.8 15.7 15.7 0 00-2.1-2.8c-2-2-4.2-3.2-6.7-3.2a9.3 9.3 0 00-6.7 3.2A16.2 16.2 0 003.2 12c0 .2.2.3.3.5zm-2.4-1l.7-1.2L4 7.8C6.2 5.4 8.9 4 12 4c3 0 5.8 1.4 8.1 3.8a18.2 18.2 0 012.8 3.7v1l-.7 1.2-2.1 2.5c-2.3 2.4-5 3.8-8.1 3.8-3 0-5.8-1.4-8.1-3.8a18.2 18.2 0 01-2.8-3.7 1 1 0 010-1zm12-3.3a2 2 0 102.7 2.6 4 4 0 11-2.6-2.6z\" fill-rule=\"nonzero\"/></svg>',\n    'print': '<svg width=\"24\" height=\"24\"><path d=\"M18 8H6a3 3 0 00-3 3v6h2v3h14v-3h2v-6a3 3 0 00-3-3zm-1 10H7v-4h10v4zm.5-5c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5 1.5.7 1.5 1.5-.7 1.5-1.5 1.5zm.5-8H6v2h12V5z\" fill-rule=\"nonzero\"/></svg>',\n    'quote': '<svg width=\"24\" height=\"24\"><path d=\"M7.5 17h.9c.4 0 .7-.2.9-.6L11 13V8c0-.6-.4-1-1-1H6a1 1 0 00-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 00.8 1.3zm8 0h.9c.4 0 .7-.2.9-.6L19 13V8c0-.6-.4-1-1-1h-4a1 1 0 00-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 00.8 1.3z\" fill-rule=\"nonzero\"/></svg>',\n    'redo': '<svg width=\"24\" height=\"24\"><path d=\"M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 11-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 111.4-1.4l5 5a1 1 0 010 1.4l-5 5a1 1 0 01-1.4-1.4l3.3-3.3z\" fill-rule=\"nonzero\"/></svg>',\n    'reload': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M5 22.1l-1.2-4.7v-.2a1 1 0 011-1l5 .4a1 1 0 11-.2 2l-2.2-.2a7.8 7.8 0 008.4.2 7.5 7.5 0 003.5-6.4 1 1 0 112 0 9.5 9.5 0 01-4.5 8 9.9 9.9 0 01-10.2 0l.4 1.4a1 1 0 11-2 .5zM13.6 7.4c0-.5.5-1 1-.9l2.8.2a8 8 0 00-9.5-1 7.5 7.5 0 00-3.6 7 1 1 0 01-2 0 9.5 9.5 0 014.5-8.6 10 10 0 0110.9.3l-.3-1a1 1 0 012-.5l1.1 4.8a1 1 0 01-1 1.2l-5-.4a1 1 0 01-.9-1z\"/></g></svg>',\n    'remove-formatting': '<svg width=\"24\" height=\"24\"><path d=\"M13.2 6a1 1 0 010 .2l-2.6 10a1 1 0 01-1 .8h-.2a.8.8 0 01-.8-1l2.6-10H8a1 1 0 110-2h9a1 1 0 010 2h-3.8zM5 18h7a1 1 0 010 2H5a1 1 0 010-2zm13 1.5L16.5 18 15 19.5a.7.7 0 01-1-1l1.5-1.5-1.5-1.5a.7.7 0 011-1l1.5 1.5 1.5-1.5a.7.7 0 011 1L17.5 17l1.5 1.5a.7.7 0 01-1 1z\" fill-rule=\"evenodd\"/></svg>',\n    'remove': '<svg width=\"24\" height=\"24\"><path d=\"M16 7h3a1 1 0 010 2h-1v9a3 3 0 01-3 3H9a3 3 0 01-3-3V9H5a1 1 0 110-2h3V6a3 3 0 013-3h2a3 3 0 013 3v1zm-2 0V6c0-.6-.4-1-1-1h-2a1 1 0 00-1 1v1h4zm2 2H8v9c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V9zm-7 3a1 1 0 012 0v4a1 1 0 01-2 0v-4zm4 0a1 1 0 012 0v4a1 1 0 01-2 0v-4z\" fill-rule=\"nonzero\"/></svg>',\n    'resize-handle': '<svg width=\"10\" height=\"10\"><g fill-rule=\"nonzero\"><path d=\"M8.1 1.1A.5.5 0 119 2l-7 7A.5.5 0 111 8l7-7zM8.1 5.1A.5.5 0 119 6l-3 3A.5.5 0 115 8l3-3z\"/></g></svg>',\n    'resize': '<svg width=\"24\" height=\"24\"><path d=\"M4 5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h6c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 01-.7.3H7.4L18 16.6V13c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v6c0 .3-.1.5-.3.7a1 1 0 01-.7.3h-6a1 1 0 01-.7-.3 1 1 0 01-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3.6L6 7.4V11c0 .3-.1.5-.3.7a1 1 0 01-.7.3 1 1 0 01-.7-.3A1 1 0 014 11V5z\" fill-rule=\"evenodd\"/></svg>',\n    'restore-draft': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path d=\"M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1z\"/><path d=\"M4.7 10H9a1 1 0 010 2H3a1 1 0 01-1-1V5a1 1 0 112 0v3l2.5-2.4a9.2 9.2 0 0110.8-1.5A9 9 0 0113.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 111.3-1.5 7.2 7.2 0 0011.6-3.7 7 7 0 00-3.5-7.7A7.2 7.2 0 008 7L4.7 10z\" fill-rule=\"nonzero\"/></g></svg>',\n    'rotate-left': '<svg width=\"24\" height=\"24\"><path d=\"M4.7 10H9a1 1 0 010 2H3a1 1 0 01-1-1V5a1 1 0 112 0v3l2.5-2.4a9.2 9.2 0 0110.8-1.5A9 9 0 0113.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 111.3-1.5 7.2 7.2 0 0011.6-3.7 7 7 0 00-3.5-7.7A7.2 7.2 0 008 7L4.7 10z\" fill-rule=\"nonzero\"/></svg>',\n    'rotate-right': '<svg width=\"24\" height=\"24\"><path d=\"M20 8V5a1 1 0 012 0v6c0 .6-.4 1-1 1h-6a1 1 0 010-2h4.3L16 7A7.2 7.2 0 007.7 6a7 7 0 003 13.1c1.9.1 3.7-.5 5-1.7a1 1 0 011.4 1.5A9.2 9.2 0 012.2 14c-.9-3.9 1-8 4.5-9.9 3.5-1.9 8-1.3 10.8 1.5L20 8z\" fill-rule=\"nonzero\"/></svg>',\n    'rtl': '<svg width=\"24\" height=\"24\"><path d=\"M8 5h8v2h-2v12h-2V7h-2v12H8v-7c-.5 0-1 0-1.4-.3A3.4 3.4 0 014.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L8 5zm12 11.2a1 1 0 11-1 1.6l-3-2a1 1 0 010-1.6l3-2a1 1 0 111 1.6L18.4 15l1.8 1.2z\" fill-rule=\"evenodd\"/></svg>',\n    'save': '<svg width=\"24\" height=\"24\"><path d=\"M5 16h14a2 2 0 012 2v2a2 2 0 01-2 2H5a2 2 0 01-2-2v-2c0-1.1.9-2 2-2zm0 2v2h14v-2H5zm10 0h2v2h-2v-2zm-4-6.4L8.7 9.3a1 1 0 10-1.4 1.4l4 4c.4.4 1 .4 1.4 0l4-4a1 1 0 10-1.4-1.4L13 11.6V4a1 1 0 00-2 0v7.6z\" fill-rule=\"nonzero\"/></svg>',\n    'search': '<svg width=\"24\" height=\"24\"><path d=\"M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12z\" fill-rule=\"nonzero\"/></svg>',\n    'select-all': '<svg width=\"24\" height=\"24\"><path d=\"M3 5h2V3a2 2 0 00-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2a2 2 0 00-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8a2 2 0 002-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z\" fill-rule=\"nonzero\"/></svg>',\n    'selected': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6c0-1.1.9-2 2-2zm3.6 10.9L7 12.3a.7.7 0 00-1 1L9.6 17 18 8.6a.7.7 0 000-1 .7.7 0 00-1 0l-7.4 7.3z\"/></svg>',\n    'settings': '<svg width=\"24\" height=\"24\"><path d=\"M11 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V8H5a1 1 0 110-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.5V6zM8 8h2V6H8v2zm9 2.8v.2h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v.3c0 .2 0 .3-.2.5l-.6.2h-2.4c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V13H5a1 1 0 010-2h8v-.3c0-.2 0-.3.2-.5l.6-.2h2.4c.3 0 .4 0 .6.2l.2.6zM14 13h2v-2h-2v2zm-3 2.8v.2h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6V18H5a1 1 0 010-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.6zM8 18h2v-2H8v2z\" fill-rule=\"evenodd\"/></svg>',\n    'sharpen': '<svg width=\"24\" height=\"24\"><path d=\"M16 6l4 4-8 9-8-9 4-4h8zm-4 10.2l5.5-6.2-.1-.1H12v-.3h5.1l-.2-.2H12V9h4.6l-.2-.2H12v-.3h4.1l-.2-.2H12V8h3.6l-.2-.2H8.7L6.5 10l.1.1H12v.3H6.9l.2.2H12v.3H7.3l.2.2H12v.3H7.7l.3.2h4v.3H8.2l.2.2H12v.3H8.6l.3.2H12v.3H9l.3.2H12v.3H9.5l.2.2H12v.3h-2l.2.2H12v.3h-1.6l.2.2H12v.3h-1.1l.2.2h.9v.3h-.7l.2.2h.5v.3h-.3l.3.2z\" fill-rule=\"evenodd\"/></svg>',\n    'sourcecode': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 010-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7zM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 00-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7z\"/></g></svg>',\n    'spell-check': '<svg width=\"24\" height=\"24\"><path d=\"M6 8v3H5V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h2c.3 0 .5.1.7.3.2.2.3.4.3.7v6H8V8H6zm0-3v2h2V5H6zm13 0h-3v5h3v1h-3a1 1 0 01-.7-.3 1 1 0 01-.3-.7V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3v1zm-5 1.5l-.1.7c-.1.2-.3.3-.6.3.3 0 .5.1.6.3l.1.7V10c0 .3-.1.5-.3.7a1 1 0 01-.7.3h-3V4h3c.3 0 .5.1.7.3.2.2.3.4.3.7v1.5zM13 10V8h-2v2h2zm0-3V5h-2v2h2zm3 5l1 1-6.5 7L7 15.5l1.3-1 2.2 2.2L16 12z\" fill-rule=\"evenodd\"/></svg>',\n    'strike-through': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path d=\"M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 017 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1z\"/><path d=\"M5 11h14a1 1 0 010 2H5a1 1 0 010-2z\" fill-rule=\"nonzero\"/></g></svg>',\n    'subscript': '<svg width=\"24\" height=\"24\"><path d=\"M10.4 10l4.6 4.6-1.4 1.4L9 11.4 4.4 16 3 14.6 7.6 10 3 5.4 4.4 4 9 8.6 13.6 4 15 5.4 10.4 10zM21 19h-5v-1l1-.8 1.7-1.6c.3-.4.5-.8.5-1.2 0-.3 0-.6-.2-.7-.2-.2-.5-.3-.9-.3a2 2 0 00-.8.2l-.7.3-.4-1.1 1-.6 1.2-.2c.8 0 1.4.3 1.8.7.4.4.6.9.6 1.5s-.2 1.1-.5 1.6a8 8 0 01-1.3 1.3l-.6.6h2.6V19z\" fill-rule=\"nonzero\"/></svg>',\n    'superscript': '<svg width=\"24\" height=\"24\"><path d=\"M15 9.4L10.4 14l4.6 4.6-1.4 1.4L9 15.4 4.4 20 3 18.6 7.6 14 3 9.4 4.4 8 9 12.6 13.6 8 15 9.4zm5.9 1.6h-5v-1l1-.8 1.7-1.6c.3-.5.5-.9.5-1.3 0-.3 0-.5-.2-.7-.2-.2-.5-.3-.9-.3l-.8.2-.7.4-.4-1.2c.2-.2.5-.4 1-.5.3-.2.8-.2 1.2-.2.8 0 1.4.2 1.8.6.4.4.6 1 .6 1.6 0 .5-.2 1-.5 1.5l-1.3 1.4-.6.5h2.6V11z\" fill-rule=\"nonzero\"/></svg>',\n    'table-caption': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><rect width=\"12\" height=\"2\" x=\"3\" y=\"4\" rx=\"1\"/><path d=\"M19 8a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2v-8c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-5h-6v3h6v-3zM5 13h6v-3H5v3z\"/></g></svg>',\n    'table-cell-classes': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path fill-rule=\"nonzero\" d=\"M13 4v9H3V6c0-1.1.9-2 2-2h8zm-2 2H5v5h6V6z\"/><path fill-rule=\"nonzero\" d=\"M13 4h6a2 2 0 012 2v7h-8v-2h6V6h-6V4z\" opacity=\".2\"/><path d=\"M18 20l-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3 .2-2.3 2 .7 3z\"/><path fill-rule=\"nonzero\" d=\"M3 13v5c0 1.1.9 2 2 2h8v-7h-2v5H5v-5H3z\" opacity=\".2\"/></g></svg>',\n    'table-cell-properties': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z\"/></svg>',\n    'table-cell-select-all': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v12h14V6z\"/><path d=\"M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2z\" opacity=\".2\"/></g></svg>',\n    'table-cell-select-inner': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v12h14V6z\" opacity=\".2\"/><path d=\"M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2z\"/></g></svg>',\n    'table-classes': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v7h-8v7H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 9H5v5h6v-5zm8-7h-6v5h6V6zm-8 0H5v5h6V6z\"/><path d=\"M18 20l-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3 .2-2.3 2 .7 3z\"/></g></svg>',\n    'table-delete-column': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5l1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z\"/></svg>',\n    'table-delete-row': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8l1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z\"/></svg>',\n    'table-delete-table': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><path d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z\"/><path d=\"M14.4 8.6l1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z\"/></g></svg>',\n    'table-insert-column-after': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M20 4c.6 0 1 .4 1 1v2a1 1 0 01-2 0V6h-8v12h8v-1a1 1 0 012 0v2c0 .5-.4 1-.9 1H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 01.1 2H17v2a1 1 0 01-2 .1V13h-2a1 1 0 01-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z\"/></svg>',\n    'table-insert-column-before': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H4a1 1 0 01-1-1v-2a1 1 0 012 0v1h8V6H5v1a1 1 0 11-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 01.1 2H9v2a1 1 0 01-2 .1V13H5a1 1 0 01-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z\"/></svg>',\n    'table-insert-row-above': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M6 4a1 1 0 110 2H5v6h14V6h-1a1 1 0 010-2h2c.6 0 1 .4 1 1v13a2 2 0 01-2 2H5a2 2 0 01-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 010 2h-2v2a1 1 0 01-2 .1V8H9a1 1 0 010-2h2V4c0-.6.4-1 1-1z\"/></svg>',\n    'table-insert-row-after': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 01.1 2H13v2a1 1 0 01-2 .1V18H9a1 1 0 01-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 010-2h1v-6H5v6h1a1 1 0 010 2H4a1 1 0 01-1-1V6c0-1.1.9-2 2-2h14a2 2 0 012 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z\"/></svg>',\n    'table-left-header': '<svg width=\"24\" height=\"24\"><path d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm0 9h-4v5h4v-5zm-6 0H9v5h4v-5zm0-7H9v5h4V6zm6 0h-4v5h4V6z\"/></svg>',\n    'table-merge-cells': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 15.5V18h3v-2.5H5zm14-5h-9V18h9v-7.5zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6zm-8 7.5h3v-3H5v3z\"/></svg>',\n    'table-row-numbering-rtl': '<svg width=\"24\" height=\"24\"><path d=\"M6 4a2 2 0 00-2 2v13c0 1.1.9 2 2 2h12a2 2 0 002-2V6a2 2 0 00-2-2H6zm0 12h8v3H6v-3zm11 0c.6 0 1 .4 1 1v1a1 1 0 01-2 0v-1c0-.6.4-1 1-1zM6 11h8v3H6v-3zm11 0c.6 0 1 .4 1 1v1a1 1 0 01-2 0v-1c0-.6.4-1 1-1zM6 6h8v3H6V6zm11 0c.6 0 1 .4 1 1v1a1 1 0 11-2 0V7c0-.6.4-1 1-1z\"/></svg>',\n    'table-row-numbering': '<svg width=\"24\" height=\"24\"><path d=\"M18 4a2 2 0 012 2v13a2 2 0 01-2 2H6a2 2 0 01-2-2V6c0-1.1.9-2 2-2h12zm0 12h-8v3h8v-3zM7 16a1 1 0 00-1 1v1a1 1 0 002 0v-1c0-.6-.4-1-1-1zm11-5h-8v3h8v-3zM7 11a1 1 0 00-1 1v1a1 1 0 002 0v-1c0-.6-.4-1-1-1zm11-5h-8v3h8V6zM7 6a1 1 0 00-1 1v1a1 1 0 102 0V7c0-.6-.4-1-1-1z\"/></svg>',\n    'table-row-properties': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z\"/></svg>',\n    'table-split-cells': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1l1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z\"/></svg>',\n    'table-top-header': '<svg width=\"24\" height=\"24\"><path d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zm-8 11H5v3h6v-3zm8 0h-6v3h6v-3zm0-5h-6v3h6v-3zM5 13h6v-3H5v3z\"/></svg>',\n    'table': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M19 4a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V6c0-1.1.9-2 2-2h14zM5 14v4h6v-4H5zm14 0h-6v4h6v-4zm0-6h-6v4h6V8zM5 12h6V8H5v4z\"/></svg>',\n    'template': '<svg width=\"24\" height=\"24\"><path d=\"M19 19v-1H5v1h14zM9 16v-4a5 5 0 116 0v4h4a2 2 0 012 2v3H3v-3c0-1.1.9-2 2-2h4zm4 0v-5l.8-.6a3 3 0 10-3.6 0l.8.6v5h2z\" fill-rule=\"nonzero\"/></svg>',\n    'temporary-placeholder': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path d=\"M9 7.6V6h2.5V4.5a.5.5 0 111 0V6H15v1.6a8 8 0 11-6 0zm-2.6 5.3a.5.5 0 00.3.6c.3 0 .6 0 .6-.3l.1-.2a5 5 0 013.3-2.8c.3-.1.4-.4.4-.6-.1-.3-.4-.5-.6-.4a6 6 0 00-4.1 3.7z\"/><circle cx=\"14\" cy=\"4\" r=\"1\"/><circle cx=\"12\" cy=\"2\" r=\"1\"/><circle cx=\"10\" cy=\"4\" r=\"1\"/></g></svg>',\n    'text-color': '<svg width=\"24\" height=\"24\"><g fill-rule=\"evenodd\"><path id=\"tox-icon-text-color__color\" d=\"M3 18h18v3H3z\"/><path d=\"M8.7 16h-.8a.5.5 0 01-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 01-.5.6h-.8a.5.5 0 01-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4zm2.6-7.6l-.6 2a.5.5 0 00.5.6h1.6a.5.5 0 00.5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4z\"/></g></svg>',\n    'toc': '<svg width=\"24\" height=\"24\"><path d=\"M5 5c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 110-2zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 110-2zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2zm0-4c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 110-2zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 010-2zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'translate': '<svg width=\"24\" height=\"24\"><path d=\"M12.7 14.3l-.3.7-.4.7-2.2-2.2-3.1 3c-.3.4-.8.4-1 0a.7.7 0 010-1l3.1-3A12.4 12.4 0 016.7 9H8a10.1 10.1 0 001.7 2.4c.5-.5 1-1.1 1.4-1.8l.9-2H4.7a.7.7 0 110-1.5h4.4v-.7c0-.4.3-.8.7-.8.4 0 .7.4.7.8v.7H15c.4 0 .8.3.8.7 0 .4-.4.8-.8.8h-1.4a12.3 12.3 0 01-1 2.4 13.5 13.5 0 01-1.7 2.3l1.9 1.8zm4.3-3l2.7 7.3a.5.5 0 01-.4.7 1 1 0 01-1-.7l-.6-1.5h-3.4l-.6 1.5a1 1 0 01-1 .7.5.5 0 01-.4-.7l2.7-7.4a1 1 0 012 0zm-2.2 4.4h2.4L16 12.5l-1.2 3.2z\" fill-rule=\"evenodd\"/></svg>',\n    'underline': '<svg width=\"24\" height=\"24\"><path d=\"M16 5c.6 0 1 .4 1 1v5.5a4 4 0 01-.4 1.8l-1 1.4a5.3 5.3 0 01-5.5 1 5 5 0 01-1.6-1c-.5-.4-.8-.9-1.1-1.4a4 4 0 01-.4-1.8V6c0-.6.4-1 1-1s1 .4 1 1v5.5c0 .3 0 .6.2 1l.6.7a3.3 3.3 0 002.2.8 3.4 3.4 0 002.2-.8c.3-.2.4-.5.6-.8l.2-.9V6c0-.6.4-1 1-1zM8 17h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 010-2z\" fill-rule=\"evenodd\"/></svg>',\n    'undo': '<svg width=\"24\" height=\"24\"><path d=\"M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 01-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 11-1.4 1.4l-5-5a1 1 0 010-1.4l5-5a1 1 0 011.4 1.4L6.4 8z\" fill-rule=\"nonzero\"/></svg>',\n    'unlink': '<svg width=\"24\" height=\"24\"><path d=\"M6.2 12.3a1 1 0 011.4 1.4l-2 2a2 2 0 102.6 2.8l4.8-4.8a1 1 0 000-1.4 1 1 0 111.4-1.3 2.9 2.9 0 010 4L9.6 20a3.9 3.9 0 01-5.5-5.5l2-2zm11.6-.6a1 1 0 01-1.4-1.4l2.1-2a2 2 0 10-2.7-2.8L11 10.3a1 1 0 000 1.4A1 1 0 119.6 13a2.9 2.9 0 010-4L14.4 4a3.9 3.9 0 015.5 5.5l-2 2zM7.6 6.3a.8.8 0 01-1 1.1L3.3 4.2a.7.7 0 111-1l3.2 3.1zM5.1 8.6a.8.8 0 010 1.5H3a.8.8 0 010-1.5H5zm5-3.5a.8.8 0 01-1.5 0V3a.8.8 0 011.5 0V5zm6 11.8a.8.8 0 011-1l3.2 3.2a.8.8 0 01-1 1L16 17zm-2.2 2a.8.8 0 011.5 0V21a.8.8 0 01-1.5 0V19zm5-3.5a.7.7 0 110-1.5H21a.8.8 0 010 1.5H19z\" fill-rule=\"nonzero\"/></svg>',\n    'unlock': '<svg width=\"24\" height=\"24\"><path d=\"M16 5c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h-2V8a1 1 0 00-.3-.7A1 1 0 0016 7h-2a1 1 0 00-.7.3 1 1 0 00-.3.7v3h.3c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H4.8c-.3 0-.4 0-.6-.2a.7.7 0 01-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H11V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2z\" fill-rule=\"evenodd\"/></svg>',\n    'unordered-list': '<svg width=\"24\" height=\"24\"><path d=\"M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 010-2zM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1z\" fill-rule=\"evenodd\"/></svg>',\n    'unselected': '<svg width=\"24\" height=\"24\"><path fill-rule=\"nonzero\" d=\"M6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6c0-1.1.9-2 2-2zm0 1a1 1 0 00-1 1v12c0 .6.4 1 1 1h12c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H6z\"/></svg>',\n    'upload': '<svg width=\"24\" height=\"24\"><path d=\"M18 19v-2a1 1 0 012 0v3c0 .6-.4 1-1 1H5a1 1 0 01-1-1v-3a1 1 0 012 0v2h12zM11 6.4L8.7 8.7a1 1 0 01-1.4-1.4l4-4a1 1 0 011.4 0l4 4a1 1 0 11-1.4 1.4L13 6.4V16a1 1 0 01-2 0V6.4z\" fill-rule=\"nonzero\"/></svg>',\n    'user': '<svg width=\"24\" height=\"24\"><path d=\"M12 24a12 12 0 110-24 12 12 0 010 24zm-8.7-5.3a11 11 0 0017.4 0C19.4 16.3 14.6 15 12 15c-2.6 0-7.4 1.3-8.7 3.7zM12 13c2.2 0 4-2 4-4.5S14.2 4 12 4 8 6 8 8.5 9.8 13 12 13z\" fill-rule=\"nonzero\"/></svg>',\n    'vertical-align': '<svg width=\"24\" height=\"24\"><g fill-rule=\"nonzero\"><rect width=\"18\" height=\"2\" x=\"3\" y=\"11\" rx=\"1\"/><path d=\"M12 2c.6 0 1 .4 1 1v4l2-1.3a1 1 0 011.2 1.5l-.1.1-4.1 3-4-3a1 1 0 011-1.7l2 1.5V3c0-.6.4-1 1-1zm0 11.8l4 2.9a1 1 0 01-1 1.7l-2-1.5V21c0 .5-.4 1-.9 1H12a1 1 0 01-1-1v-4l-2 1.3a1 1 0 01-1.2-.1l-.1-.1a1 1 0 01.1-1.3l.1-.1 4.1-3z\"/></g></svg>',\n    'visualblocks': '<svg width=\"24\" height=\"24\"><path d=\"M9 19v2H7v-2h2zm-4 0v2a2 2 0 01-2-2h2zm8 0v2h-2v-2h2zm8 0a2 2 0 01-2 2v-2h2zm-4 0v2h-2v-2h2zM15 7a1 1 0 010 2v7a1 1 0 01-2 0V9h-1v7a1 1 0 01-2 0v-4a2.5 2.5 0 01-.2-5H15zM5 15v2H3v-2h2zm16 0v2h-2v-2h2zM5 11v2H3v-2h2zm16 0v2h-2v-2h2zM5 7v2H3V7h2zm16 0v2h-2V7h2zM5 3v2H3c0-1.1.9-2 2-2zm8 0v2h-2V3h2zm6 0a2 2 0 012 2h-2V3zM9 3v2H7V3h2zm8 0v2h-2V3h2z\" fill-rule=\"evenodd\"/></svg>',\n    'visualchars': '<svg width=\"24\" height=\"24\"><path d=\"M10 5h7a1 1 0 010 2h-1v11a1 1 0 01-2 0V7h-2v11a1 1 0 01-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 016.8 10a3.3 3.3 0 010-2.8 3.4 3.4 0 011.8-1.8L10 5z\" fill-rule=\"evenodd\"/></svg>',\n    'warning': '<svg width=\"24\" height=\"24\"><path d=\"M19.8 18.3c.2.5.3.9 0 1.2-.1.3-.5.5-1 .5H5.2c-.5 0-.9-.2-1-.5-.3-.3-.2-.7 0-1.2L11 4.7l.5-.5.5-.2c.2 0 .3 0 .5.2.2 0 .3.3.5.5l6.8 13.6zM12 18c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7a1 1 0 00-.3-.7 1 1 0 00-.7-.3 1 1 0 00-.7.3 1 1 0 00-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3zm.7-3l.3-4a1 1 0 00-.3-.7 1 1 0 00-.7-.3 1 1 0 00-.7.3 1 1 0 00-.3.7l.3 4h1.4z\" fill-rule=\"evenodd\"/></svg>',\n    'zoom-in': '<svg width=\"24\" height=\"24\"><path d=\"M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12zm-1-9a1 1 0 012 0v6a1 1 0 01-2 0V8zm-2 4a1 1 0 010-2h6a1 1 0 010 2H8z\" fill-rule=\"nonzero\"/></svg>',\n    'zoom-out': '<svg width=\"24\" height=\"24\"><path d=\"M16 17.3a8 8 0 111.4-1.4l4.3 4.4a1 1 0 01-1.4 1.4l-4.4-4.3zm-5-.3a6 6 0 100-12 6 6 0 000 12zm-3-5a1 1 0 010-2h6a1 1 0 010 2H8z\" fill-rule=\"nonzero\"/></svg>',\n  }\n});\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/icons/default/icons.js?");

/***/ }),

/***/ "../../node_modules/tinymce/icons/default/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/icons/default/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"default\" icons for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/icons/default')\n//   ES2015:\n//     import 'tinymce/icons/default'\n__webpack_require__(/*! ./icons.js */ \"../../node_modules/tinymce/icons/default/icons.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/icons/default/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/advlist/index.js":
/*!***********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/advlist/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"advlist\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/advlist')\n//   ES2015:\n//     import 'tinymce/plugins/advlist'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/advlist/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/advlist/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/advlist/plugin.js":
/*!************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/advlist/plugin.js ***!
  \************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var applyListFormat = function (editor, listName, styleValue) {\n      var cmd = listName === 'UL' ? 'InsertUnorderedList' : 'InsertOrderedList';\n      editor.execCommand(cmd, false, styleValue === false ? null : { 'list-style-type': styleValue });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('ApplyUnorderedListStyle', function (ui, value) {\n        applyListFormat(editor, 'UL', value['list-style-type']);\n      });\n      editor.addCommand('ApplyOrderedListStyle', function (ui, value) {\n        applyListFormat(editor, 'OL', value['list-style-type']);\n      });\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getNumberStyles = function (editor) {\n      var styles = editor.getParam('advlist_number_styles', 'default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman');\n      return styles ? styles.split(/[ ,]/) : [];\n    };\n    var getBulletStyles = function (editor) {\n      var styles = editor.getParam('advlist_bullet_styles', 'default,circle,square');\n      return styles ? styles.split(/[ ,]/) : [];\n    };\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var isChildOfBody = function (editor, elm) {\n      return editor.$.contains(editor.getBody(), elm);\n    };\n    var isTableCellNode = function (node) {\n      return node && /^(TH|TD)$/.test(node.nodeName);\n    };\n    var isListNode = function (editor) {\n      return function (node) {\n        return node && /^(OL|UL|DL)$/.test(node.nodeName) && isChildOfBody(editor, node);\n      };\n    };\n    var getSelectedStyleType = function (editor) {\n      var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');\n      var style = editor.dom.getStyle(listElm, 'listStyleType');\n      return Optional.from(style);\n    };\n\n    var findIndex = function (list, predicate) {\n      for (var index = 0; index < list.length; index++) {\n        var element = list[index];\n        if (predicate(element)) {\n          return index;\n        }\n      }\n      return -1;\n    };\n    var styleValueToText = function (styleValue) {\n      return styleValue.replace(/\\-/g, ' ').replace(/\\b\\w/g, function (chr) {\n        return chr.toUpperCase();\n      });\n    };\n    var isWithinList = function (editor, e, nodeName) {\n      var tableCellIndex = findIndex(e.parents, isTableCellNode);\n      var parents = tableCellIndex !== -1 ? e.parents.slice(0, tableCellIndex) : e.parents;\n      var lists = global.grep(parents, isListNode(editor));\n      return lists.length > 0 && lists[0].nodeName === nodeName;\n    };\n    var makeSetupHandler = function (editor, nodeName) {\n      return function (api) {\n        var nodeChangeHandler = function (e) {\n          api.setActive(isWithinList(editor, e, nodeName));\n        };\n        editor.on('NodeChange', nodeChangeHandler);\n        return function () {\n          return editor.off('NodeChange', nodeChangeHandler);\n        };\n      };\n    };\n    var addSplitButton = function (editor, id, tooltip, cmd, nodeName, styles) {\n      editor.ui.registry.addSplitButton(id, {\n        tooltip: tooltip,\n        icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',\n        presets: 'listpreview',\n        columns: 3,\n        fetch: function (callback) {\n          var items = global.map(styles, function (styleValue) {\n            var iconStyle = nodeName === 'OL' ? 'num' : 'bull';\n            var iconName = styleValue === 'disc' || styleValue === 'decimal' ? 'default' : styleValue;\n            var itemValue = styleValue === 'default' ? '' : styleValue;\n            var displayText = styleValueToText(styleValue);\n            return {\n              type: 'choiceitem',\n              value: itemValue,\n              icon: 'list-' + iconStyle + '-' + iconName,\n              text: displayText\n            };\n          });\n          callback(items);\n        },\n        onAction: function () {\n          return editor.execCommand(cmd);\n        },\n        onItemAction: function (_splitButtonApi, value) {\n          applyListFormat(editor, nodeName, value);\n        },\n        select: function (value) {\n          var listStyleType = getSelectedStyleType(editor);\n          return listStyleType.map(function (listStyle) {\n            return value === listStyle;\n          }).getOr(false);\n        },\n        onSetup: makeSetupHandler(editor, nodeName)\n      });\n    };\n    var addButton = function (editor, id, tooltip, cmd, nodeName, _styles) {\n      editor.ui.registry.addToggleButton(id, {\n        active: false,\n        tooltip: tooltip,\n        icon: nodeName === 'OL' ? 'ordered-list' : 'unordered-list',\n        onSetup: makeSetupHandler(editor, nodeName),\n        onAction: function () {\n          return editor.execCommand(cmd);\n        }\n      });\n    };\n    var addControl = function (editor, id, tooltip, cmd, nodeName, styles) {\n      if (styles.length > 1) {\n        addSplitButton(editor, id, tooltip, cmd, nodeName, styles);\n      } else {\n        addButton(editor, id, tooltip, cmd, nodeName);\n      }\n    };\n    var register = function (editor) {\n      addControl(editor, 'numlist', 'Numbered list', 'InsertOrderedList', 'OL', getNumberStyles(editor));\n      addControl(editor, 'bullist', 'Bullet list', 'InsertUnorderedList', 'UL', getBulletStyles(editor));\n    };\n\n    function Plugin () {\n      global$1.add('advlist', function (editor) {\n        if (editor.hasPlugin('lists')) {\n          register(editor);\n          register$1(editor);\n        } else {\n          console.error('Please use the Lists plugin together with the Advanced List plugin.');\n        }\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/advlist/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/anchor/index.js":
/*!**********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/anchor/index.js ***!
  \**********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"anchor\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/anchor')\n//   ES2015:\n//     import 'tinymce/plugins/anchor'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/anchor/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/anchor/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/anchor/plugin.js":
/*!***********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/anchor/plugin.js ***!
  \***********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var allowHtmlInNamedAnchor = function (editor) {\n      return editor.getParam('allow_html_in_named_anchor', false, 'boolean');\n    };\n\n    var namedAnchorSelector = 'a:not([href])';\n    var isEmptyString = function (str) {\n      return !str;\n    };\n    var getIdFromAnchor = function (elm) {\n      var id = elm.getAttribute('id') || elm.getAttribute('name');\n      return id || '';\n    };\n    var isAnchor = function (elm) {\n      return elm && elm.nodeName.toLowerCase() === 'a';\n    };\n    var isNamedAnchor = function (elm) {\n      return isAnchor(elm) && !elm.getAttribute('href') && getIdFromAnchor(elm) !== '';\n    };\n    var isEmptyNamedAnchor = function (elm) {\n      return isNamedAnchor(elm) && !elm.firstChild;\n    };\n\n    var removeEmptyNamedAnchorsInSelection = function (editor) {\n      var dom = editor.dom;\n      global$1(dom).walk(editor.selection.getRng(), function (nodes) {\n        global.each(nodes, function (node) {\n          if (isEmptyNamedAnchor(node)) {\n            dom.remove(node, false);\n          }\n        });\n      });\n    };\n    var isValidId = function (id) {\n      return /^[A-Za-z][A-Za-z0-9\\-:._]*$/.test(id);\n    };\n    var getNamedAnchor = function (editor) {\n      return editor.dom.getParent(editor.selection.getStart(), namedAnchorSelector);\n    };\n    var getId = function (editor) {\n      var anchor = getNamedAnchor(editor);\n      if (anchor) {\n        return getIdFromAnchor(anchor);\n      } else {\n        return '';\n      }\n    };\n    var createAnchor = function (editor, id) {\n      editor.undoManager.transact(function () {\n        if (!allowHtmlInNamedAnchor(editor)) {\n          editor.selection.collapse(true);\n        }\n        if (editor.selection.isCollapsed()) {\n          editor.insertContent(editor.dom.createHTML('a', { id: id }));\n        } else {\n          removeEmptyNamedAnchorsInSelection(editor);\n          editor.formatter.remove('namedAnchor', null, null, true);\n          editor.formatter.apply('namedAnchor', { value: id });\n          editor.addVisual();\n        }\n      });\n    };\n    var updateAnchor = function (editor, id, anchorElement) {\n      anchorElement.removeAttribute('name');\n      anchorElement.id = id;\n      editor.addVisual();\n      editor.undoManager.add();\n    };\n    var insert = function (editor, id) {\n      var anchor = getNamedAnchor(editor);\n      if (anchor) {\n        updateAnchor(editor, id, anchor);\n      } else {\n        createAnchor(editor, id);\n      }\n      editor.focus();\n    };\n\n    var insertAnchor = function (editor, newId) {\n      if (!isValidId(newId)) {\n        editor.windowManager.alert('Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.');\n        return false;\n      } else {\n        insert(editor, newId);\n        return true;\n      }\n    };\n    var open = function (editor) {\n      var currentId = getId(editor);\n      editor.windowManager.open({\n        title: 'Anchor',\n        size: 'normal',\n        body: {\n          type: 'panel',\n          items: [{\n              name: 'id',\n              type: 'input',\n              label: 'ID',\n              placeholder: 'example'\n            }]\n        },\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: { id: currentId },\n        onSubmit: function (api) {\n          if (insertAnchor(editor, api.getData().id)) {\n            api.close();\n          }\n        }\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('mceAnchor', function () {\n        open(editor);\n      });\n    };\n\n    var isNamedAnchorNode = function (node) {\n      return node && isEmptyString(node.attr('href')) && !isEmptyString(node.attr('id') || node.attr('name'));\n    };\n    var isEmptyNamedAnchorNode = function (node) {\n      return isNamedAnchorNode(node) && !node.firstChild;\n    };\n    var setContentEditable = function (state) {\n      return function (nodes) {\n        for (var i = 0; i < nodes.length; i++) {\n          var node = nodes[i];\n          if (isEmptyNamedAnchorNode(node)) {\n            node.attr('contenteditable', state);\n          }\n        }\n      };\n    };\n    var setup = function (editor) {\n      editor.on('PreInit', function () {\n        editor.parser.addNodeFilter('a', setContentEditable('false'));\n        editor.serializer.addNodeFilter('a', setContentEditable(null));\n      });\n    };\n\n    var registerFormats = function (editor) {\n      editor.formatter.register('namedAnchor', {\n        inline: 'a',\n        selector: namedAnchorSelector,\n        remove: 'all',\n        split: true,\n        deep: true,\n        attributes: { id: '%value' },\n        onmatch: function (node, _fmt, _itemName) {\n          return isNamedAnchor(node);\n        }\n      });\n    };\n\n    var register = function (editor) {\n      editor.ui.registry.addToggleButton('anchor', {\n        icon: 'bookmark',\n        tooltip: 'Anchor',\n        onAction: function () {\n          return editor.execCommand('mceAnchor');\n        },\n        onSetup: function (buttonApi) {\n          return editor.selection.selectorChangedWithUnbind('a:not([href])', buttonApi.setActive).unbind;\n        }\n      });\n      editor.ui.registry.addMenuItem('anchor', {\n        icon: 'bookmark',\n        text: 'Anchor...',\n        onAction: function () {\n          return editor.execCommand('mceAnchor');\n        }\n      });\n    };\n\n    function Plugin () {\n      global$2.add('anchor', function (editor) {\n        setup(editor);\n        register$1(editor);\n        register(editor);\n        editor.on('PreInit', function () {\n          registerFormats(editor);\n        });\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/anchor/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autolink/index.js":
/*!************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autolink/index.js ***!
  \************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"autolink\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/autolink')\n//   ES2015:\n//     import 'tinymce/plugins/autolink'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/autolink/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autolink/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autolink/plugin.js":
/*!*************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autolink/plugin.js ***!
  \*************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var checkRange = function (str, substr, start) {\n      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;\n    };\n    var contains = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var startsWith = function (str, prefix) {\n      return checkRange(str, prefix, 0);\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var link = function () {\n      return /(?:[A-Za-z][A-Za-z\\d.+-]{0,14}:\\/\\/(?:[-.~*+=!&;:'%@?^${}(),\\w]+@)?|www\\.|[-;:&=+$,.\\w]+@)[A-Za-z\\d-]+(?:\\.[A-Za-z\\d-]+)*(?::\\d+)?(?:\\/(?:[-.~*+=!;:'%@$(),\\/\\w]*[-~*+=%@$()\\/\\w])?)?(?:\\?(?:[-.~*+=!&;:'%@?^${}(),\\/\\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\\/\\w]+))?/g;\n    };\n\n    var defaultLinkPattern = new RegExp('^' + link().source + '$', 'i');\n    var getAutoLinkPattern = function (editor) {\n      return editor.getParam('autolink_pattern', defaultLinkPattern);\n    };\n    var getDefaultLinkTarget = function (editor) {\n      return editor.getParam('default_link_target', false);\n    };\n    var getDefaultLinkProtocol = function (editor) {\n      return editor.getParam('link_default_protocol', 'http', 'string');\n    };\n\n    var rangeEqualsBracketOrSpace = function (rangeString) {\n      return /^[(\\[{ \\u00a0]$/.test(rangeString);\n    };\n    var isTextNode = function (node) {\n      return node.nodeType === 3;\n    };\n    var isElement = function (node) {\n      return node.nodeType === 1;\n    };\n    var handleBracket = function (editor) {\n      return parseCurrentLine(editor, -1);\n    };\n    var handleSpacebar = function (editor) {\n      return parseCurrentLine(editor, 0);\n    };\n    var handleEnter = function (editor) {\n      return parseCurrentLine(editor, -1);\n    };\n    var scopeIndex = function (container, index) {\n      if (index < 0) {\n        index = 0;\n      }\n      if (isTextNode(container)) {\n        var len = container.data.length;\n        if (index > len) {\n          index = len;\n        }\n      }\n      return index;\n    };\n    var setStart = function (rng, container, offset) {\n      if (!isElement(container) || container.hasChildNodes()) {\n        rng.setStart(container, scopeIndex(container, offset));\n      } else {\n        rng.setStartBefore(container);\n      }\n    };\n    var setEnd = function (rng, container, offset) {\n      if (!isElement(container) || container.hasChildNodes()) {\n        rng.setEnd(container, scopeIndex(container, offset));\n      } else {\n        rng.setEndAfter(container);\n      }\n    };\n    var hasProtocol = function (url) {\n      return /^([A-Za-z][A-Za-z\\d.+-]*:\\/\\/)|mailto:/.test(url);\n    };\n    var isPunctuation = function (char) {\n      return /[?!,.;:]/.test(char);\n    };\n    var parseCurrentLine = function (editor, endOffset) {\n      var end, endContainer, bookmark, text, prev, len, rngText;\n      var autoLinkPattern = getAutoLinkPattern(editor);\n      var defaultLinkTarget = getDefaultLinkTarget(editor);\n      if (editor.dom.getParent(editor.selection.getNode(), 'a[href]') !== null) {\n        return;\n      }\n      var rng = editor.selection.getRng().cloneRange();\n      if (rng.startOffset < 5) {\n        prev = rng.endContainer.previousSibling;\n        if (!prev) {\n          if (!rng.endContainer.firstChild || !rng.endContainer.firstChild.nextSibling) {\n            return;\n          }\n          prev = rng.endContainer.firstChild.nextSibling;\n        }\n        len = prev.length;\n        setStart(rng, prev, len);\n        setEnd(rng, prev, len);\n        if (rng.endOffset < 5) {\n          return;\n        }\n        end = rng.endOffset;\n        endContainer = prev;\n      } else {\n        endContainer = rng.endContainer;\n        if (!isTextNode(endContainer) && endContainer.firstChild) {\n          while (!isTextNode(endContainer) && endContainer.firstChild) {\n            endContainer = endContainer.firstChild;\n          }\n          if (isTextNode(endContainer)) {\n            setStart(rng, endContainer, 0);\n            setEnd(rng, endContainer, endContainer.nodeValue.length);\n          }\n        }\n        if (rng.endOffset === 1) {\n          end = 2;\n        } else {\n          end = rng.endOffset - 1 - endOffset;\n        }\n      }\n      var start = end;\n      do {\n        setStart(rng, endContainer, end >= 2 ? end - 2 : 0);\n        setEnd(rng, endContainer, end >= 1 ? end - 1 : 0);\n        end -= 1;\n        rngText = rng.toString();\n      } while (!rangeEqualsBracketOrSpace(rngText) && end - 2 >= 0);\n      if (rangeEqualsBracketOrSpace(rng.toString())) {\n        setStart(rng, endContainer, end);\n        setEnd(rng, endContainer, start);\n        end += 1;\n      } else if (rng.startOffset === 0) {\n        setStart(rng, endContainer, 0);\n        setEnd(rng, endContainer, start);\n      } else {\n        setStart(rng, endContainer, end);\n        setEnd(rng, endContainer, start);\n      }\n      text = rng.toString();\n      if (isPunctuation(text.charAt(text.length - 1))) {\n        setEnd(rng, endContainer, start - 1);\n      }\n      text = rng.toString().trim();\n      var matches = text.match(autoLinkPattern);\n      var protocol = getDefaultLinkProtocol(editor);\n      if (matches) {\n        var url = matches[0];\n        if (startsWith(url, 'www.')) {\n          url = protocol + '://' + url;\n        } else if (contains(url, '@') && !hasProtocol(url)) {\n          url = 'mailto:' + url;\n        }\n        bookmark = editor.selection.getBookmark();\n        editor.selection.setRng(rng);\n        editor.execCommand('createlink', false, url);\n        if (defaultLinkTarget !== false) {\n          editor.dom.setAttrib(editor.selection.getNode(), 'target', defaultLinkTarget);\n        }\n        editor.selection.moveToBookmark(bookmark);\n        editor.nodeChanged();\n      }\n    };\n    var setup = function (editor) {\n      var autoUrlDetectState;\n      editor.on('keydown', function (e) {\n        if (e.keyCode === 13) {\n          return handleEnter(editor);\n        }\n      });\n      if (global.browser.isIE()) {\n        editor.on('focus', function () {\n          if (!autoUrlDetectState) {\n            autoUrlDetectState = true;\n            try {\n              editor.execCommand('AutoUrlDetect', false, true);\n            } catch (ex) {\n            }\n          }\n        });\n        return;\n      }\n      editor.on('keypress', function (e) {\n        if (e.keyCode === 41 || e.keyCode === 93 || e.keyCode === 125) {\n          return handleBracket(editor);\n        }\n      });\n      editor.on('keyup', function (e) {\n        if (e.keyCode === 32) {\n          return handleSpacebar(editor);\n        }\n      });\n    };\n\n    function Plugin () {\n      global$1.add('autolink', function (editor) {\n        setup(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autolink/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autoresize/index.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autoresize/index.js ***!
  \**************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"autoresize\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/autoresize')\n//   ES2015:\n//     import 'tinymce/plugins/autoresize'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/autoresize/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autoresize/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autoresize/plugin.js":
/*!***************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autoresize/plugin.js ***!
  \***************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var hasOwnProperty = Object.hasOwnProperty;\n    var has = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var fireResizeEditor = function (editor) {\n      return editor.fire('ResizeEditor');\n    };\n\n    var getAutoResizeMinHeight = function (editor) {\n      return editor.getParam('min_height', editor.getElement().offsetHeight, 'number');\n    };\n    var getAutoResizeMaxHeight = function (editor) {\n      return editor.getParam('max_height', 0, 'number');\n    };\n    var getAutoResizeOverflowPadding = function (editor) {\n      return editor.getParam('autoresize_overflow_padding', 1, 'number');\n    };\n    var getAutoResizeBottomMargin = function (editor) {\n      return editor.getParam('autoresize_bottom_margin', 50, 'number');\n    };\n    var shouldAutoResizeOnInit = function (editor) {\n      return editor.getParam('autoresize_on_init', true, 'boolean');\n    };\n\n    var isFullscreen = function (editor) {\n      return editor.plugins.fullscreen && editor.plugins.fullscreen.isFullscreen();\n    };\n    var wait = function (editor, oldSize, times, interval, callback) {\n      global.setEditorTimeout(editor, function () {\n        resize(editor, oldSize);\n        if (times--) {\n          wait(editor, oldSize, times, interval, callback);\n        } else if (callback) {\n          callback();\n        }\n      }, interval);\n    };\n    var toggleScrolling = function (editor, state) {\n      var body = editor.getBody();\n      if (body) {\n        body.style.overflowY = state ? '' : 'hidden';\n        if (!state) {\n          body.scrollTop = 0;\n        }\n      }\n    };\n    var parseCssValueToInt = function (dom, elm, name, computed) {\n      var value = parseInt(dom.getStyle(elm, name, computed), 10);\n      return isNaN(value) ? 0 : value;\n    };\n    var shouldScrollIntoView = function (trigger) {\n      if ((trigger === null || trigger === void 0 ? void 0 : trigger.type.toLowerCase()) === 'setcontent') {\n        var setContentEvent = trigger;\n        return setContentEvent.selection === true || setContentEvent.paste === true;\n      } else {\n        return false;\n      }\n    };\n    var resize = function (editor, oldSize, trigger) {\n      var dom = editor.dom;\n      var doc = editor.getDoc();\n      if (!doc) {\n        return;\n      }\n      if (isFullscreen(editor)) {\n        toggleScrolling(editor, true);\n        return;\n      }\n      var docEle = doc.documentElement;\n      var resizeBottomMargin = getAutoResizeBottomMargin(editor);\n      var resizeHeight = getAutoResizeMinHeight(editor);\n      var marginTop = parseCssValueToInt(dom, docEle, 'margin-top', true);\n      var marginBottom = parseCssValueToInt(dom, docEle, 'margin-bottom', true);\n      var contentHeight = docEle.offsetHeight + marginTop + marginBottom + resizeBottomMargin;\n      if (contentHeight < 0) {\n        contentHeight = 0;\n      }\n      var containerHeight = editor.getContainer().offsetHeight;\n      var contentAreaHeight = editor.getContentAreaContainer().offsetHeight;\n      var chromeHeight = containerHeight - contentAreaHeight;\n      if (contentHeight + chromeHeight > getAutoResizeMinHeight(editor)) {\n        resizeHeight = contentHeight + chromeHeight;\n      }\n      var maxHeight = getAutoResizeMaxHeight(editor);\n      if (maxHeight && resizeHeight > maxHeight) {\n        resizeHeight = maxHeight;\n        toggleScrolling(editor, true);\n      } else {\n        toggleScrolling(editor, false);\n      }\n      if (resizeHeight !== oldSize.get()) {\n        var deltaSize = resizeHeight - oldSize.get();\n        dom.setStyle(editor.getContainer(), 'height', resizeHeight + 'px');\n        oldSize.set(resizeHeight);\n        fireResizeEditor(editor);\n        if (global$1.browser.isSafari() && global$1.mac) {\n          var win = editor.getWin();\n          win.scrollTo(win.pageXOffset, win.pageYOffset);\n        }\n        if (editor.hasFocus() && shouldScrollIntoView(trigger)) {\n          editor.selection.scrollIntoView();\n        }\n        if (global$1.webkit && deltaSize < 0) {\n          resize(editor, oldSize, trigger);\n        }\n      }\n    };\n    var setup = function (editor, oldSize) {\n      editor.on('init', function () {\n        var overflowPadding = getAutoResizeOverflowPadding(editor);\n        var dom = editor.dom;\n        dom.setStyles(editor.getDoc().documentElement, { height: 'auto' });\n        dom.setStyles(editor.getBody(), {\n          'paddingLeft': overflowPadding,\n          'paddingRight': overflowPadding,\n          'min-height': 0\n        });\n      });\n      editor.on('NodeChange SetContent keyup FullscreenStateChanged ResizeContent', function (e) {\n        resize(editor, oldSize, e);\n      });\n      if (shouldAutoResizeOnInit(editor)) {\n        editor.on('init', function () {\n          wait(editor, oldSize, 20, 100, function () {\n            wait(editor, oldSize, 5, 1000);\n          });\n        });\n      }\n    };\n\n    var register = function (editor, oldSize) {\n      editor.addCommand('mceAutoResize', function () {\n        resize(editor, oldSize);\n      });\n    };\n\n    function Plugin () {\n      global$2.add('autoresize', function (editor) {\n        if (!has(editor.settings, 'resize')) {\n          editor.settings.resize = false;\n        }\n        if (!editor.inline) {\n          var oldSize = Cell(0);\n          register(editor, oldSize);\n          setup(editor, oldSize);\n        }\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autoresize/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autosave/index.js":
/*!************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autosave/index.js ***!
  \************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"autosave\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/autosave')\n//   ES2015:\n//     import 'tinymce/plugins/autosave'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/autosave/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autosave/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/autosave/plugin.js":
/*!*************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/autosave/plugin.js ***!
  \*************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var eq = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isUndefined = eq(undefined);\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var fireRestoreDraft = function (editor) {\n      return editor.fire('RestoreDraft');\n    };\n    var fireStoreDraft = function (editor) {\n      return editor.fire('StoreDraft');\n    };\n    var fireRemoveDraft = function (editor) {\n      return editor.fire('RemoveDraft');\n    };\n\n    var parse = function (timeString, defaultTime) {\n      var multiples = {\n        s: 1000,\n        m: 60000\n      };\n      var toParse = timeString || defaultTime;\n      var parsedTime = /^(\\d+)([ms]?)$/.exec('' + toParse);\n      return (parsedTime[2] ? multiples[parsedTime[2]] : 1) * parseInt(toParse, 10);\n    };\n\n    var shouldAskBeforeUnload = function (editor) {\n      return editor.getParam('autosave_ask_before_unload', true);\n    };\n    var getAutoSavePrefix = function (editor) {\n      var location = document.location;\n      return editor.getParam('autosave_prefix', 'tinymce-autosave-{path}{query}{hash}-{id}-').replace(/{path}/g, location.pathname).replace(/{query}/g, location.search).replace(/{hash}/g, location.hash).replace(/{id}/g, editor.id);\n    };\n    var shouldRestoreWhenEmpty = function (editor) {\n      return editor.getParam('autosave_restore_when_empty', false);\n    };\n    var getAutoSaveInterval = function (editor) {\n      return parse(editor.getParam('autosave_interval'), '30s');\n    };\n    var getAutoSaveRetention = function (editor) {\n      return parse(editor.getParam('autosave_retention'), '20m');\n    };\n\n    var isEmpty = function (editor, html) {\n      if (isUndefined(html)) {\n        return editor.dom.isEmpty(editor.getBody());\n      } else {\n        var trimmedHtml = global$1.trim(html);\n        if (trimmedHtml === '') {\n          return true;\n        } else {\n          var fragment = new DOMParser().parseFromString(trimmedHtml, 'text/html');\n          return editor.dom.isEmpty(fragment);\n        }\n      }\n    };\n    var hasDraft = function (editor) {\n      var time = parseInt(global$2.getItem(getAutoSavePrefix(editor) + 'time'), 10) || 0;\n      if (new Date().getTime() - time > getAutoSaveRetention(editor)) {\n        removeDraft(editor, false);\n        return false;\n      }\n      return true;\n    };\n    var removeDraft = function (editor, fire) {\n      var prefix = getAutoSavePrefix(editor);\n      global$2.removeItem(prefix + 'draft');\n      global$2.removeItem(prefix + 'time');\n      if (fire !== false) {\n        fireRemoveDraft(editor);\n      }\n    };\n    var storeDraft = function (editor) {\n      var prefix = getAutoSavePrefix(editor);\n      if (!isEmpty(editor) && editor.isDirty()) {\n        global$2.setItem(prefix + 'draft', editor.getContent({\n          format: 'raw',\n          no_events: true\n        }));\n        global$2.setItem(prefix + 'time', new Date().getTime().toString());\n        fireStoreDraft(editor);\n      }\n    };\n    var restoreDraft = function (editor) {\n      var prefix = getAutoSavePrefix(editor);\n      if (hasDraft(editor)) {\n        editor.setContent(global$2.getItem(prefix + 'draft'), { format: 'raw' });\n        fireRestoreDraft(editor);\n      }\n    };\n    var startStoreDraft = function (editor) {\n      var interval = getAutoSaveInterval(editor);\n      global$3.setEditorInterval(editor, function () {\n        storeDraft(editor);\n      }, interval);\n    };\n    var restoreLastDraft = function (editor) {\n      editor.undoManager.transact(function () {\n        restoreDraft(editor);\n        removeDraft(editor);\n      });\n      editor.focus();\n    };\n\n    var get = function (editor) {\n      return {\n        hasDraft: function () {\n          return hasDraft(editor);\n        },\n        storeDraft: function () {\n          return storeDraft(editor);\n        },\n        restoreDraft: function () {\n          return restoreDraft(editor);\n        },\n        removeDraft: function (fire) {\n          return removeDraft(editor, fire);\n        },\n        isEmpty: function (html) {\n          return isEmpty(editor, html);\n        }\n      };\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.EditorManager');\n\n    var setup = function (editor) {\n      editor.editorManager.on('BeforeUnload', function (e) {\n        var msg;\n        global$1.each(global.get(), function (editor) {\n          if (editor.plugins.autosave) {\n            editor.plugins.autosave.storeDraft();\n          }\n          if (!msg && editor.isDirty() && shouldAskBeforeUnload(editor)) {\n            msg = editor.translate('You have unsaved changes are you sure you want to navigate away?');\n          }\n        });\n        if (msg) {\n          e.preventDefault();\n          e.returnValue = msg;\n        }\n      });\n    };\n\n    var makeSetupHandler = function (editor) {\n      return function (api) {\n        api.setDisabled(!hasDraft(editor));\n        var editorEventCallback = function () {\n          return api.setDisabled(!hasDraft(editor));\n        };\n        editor.on('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);\n        return function () {\n          return editor.off('StoreDraft RestoreDraft RemoveDraft', editorEventCallback);\n        };\n      };\n    };\n    var register = function (editor) {\n      startStoreDraft(editor);\n      editor.ui.registry.addButton('restoredraft', {\n        tooltip: 'Restore last draft',\n        icon: 'restore-draft',\n        onAction: function () {\n          restoreLastDraft(editor);\n        },\n        onSetup: makeSetupHandler(editor)\n      });\n      editor.ui.registry.addMenuItem('restoredraft', {\n        text: 'Restore last draft',\n        icon: 'restore-draft',\n        onAction: function () {\n          restoreLastDraft(editor);\n        },\n        onSetup: makeSetupHandler(editor)\n      });\n    };\n\n    function Plugin () {\n      global$4.add('autosave', function (editor) {\n        setup(editor);\n        register(editor);\n        editor.on('init', function () {\n          if (shouldRestoreWhenEmpty(editor) && editor.dom.isEmpty(editor.getBody())) {\n            restoreDraft(editor);\n          }\n        });\n        return get(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/autosave/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/charmap/index.js":
/*!***********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/charmap/index.js ***!
  \***********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"charmap\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/charmap')\n//   ES2015:\n//     import 'tinymce/plugins/charmap'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/charmap/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/charmap/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/charmap/plugin.js":
/*!************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/charmap/plugin.js ***!
  \************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var fireInsertCustomChar = function (editor, chr) {\n      return editor.fire('insertCustomChar', { chr: chr });\n    };\n\n    var insertChar = function (editor, chr) {\n      var evtChr = fireInsertCustomChar(editor, chr).chr;\n      editor.execCommand('mceInsertContent', false, evtChr);\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var eq = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isArray$1 = isType('array');\n    var isNull = eq(null);\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray$1(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getCharMap$1 = function (editor) {\n      return editor.getParam('charmap');\n    };\n    var getCharMapAppend = function (editor) {\n      return editor.getParam('charmap_append');\n    };\n\n    var isArray = global$1.isArray;\n    var UserDefined = 'User Defined';\n    var getDefaultCharMap = function () {\n      return [\n        {\n          name: 'Currency',\n          characters: [\n            [\n              36,\n              'dollar sign'\n            ],\n            [\n              162,\n              'cent sign'\n            ],\n            [\n              8364,\n              'euro sign'\n            ],\n            [\n              163,\n              'pound sign'\n            ],\n            [\n              165,\n              'yen sign'\n            ],\n            [\n              164,\n              'currency sign'\n            ],\n            [\n              8352,\n              'euro-currency sign'\n            ],\n            [\n              8353,\n              'colon sign'\n            ],\n            [\n              8354,\n              'cruzeiro sign'\n            ],\n            [\n              8355,\n              'french franc sign'\n            ],\n            [\n              8356,\n              'lira sign'\n            ],\n            [\n              8357,\n              'mill sign'\n            ],\n            [\n              8358,\n              'naira sign'\n            ],\n            [\n              8359,\n              'peseta sign'\n            ],\n            [\n              8360,\n              'rupee sign'\n            ],\n            [\n              8361,\n              'won sign'\n            ],\n            [\n              8362,\n              'new sheqel sign'\n            ],\n            [\n              8363,\n              'dong sign'\n            ],\n            [\n              8365,\n              'kip sign'\n            ],\n            [\n              8366,\n              'tugrik sign'\n            ],\n            [\n              8367,\n              'drachma sign'\n            ],\n            [\n              8368,\n              'german penny symbol'\n            ],\n            [\n              8369,\n              'peso sign'\n            ],\n            [\n              8370,\n              'guarani sign'\n            ],\n            [\n              8371,\n              'austral sign'\n            ],\n            [\n              8372,\n              'hryvnia sign'\n            ],\n            [\n              8373,\n              'cedi sign'\n            ],\n            [\n              8374,\n              'livre tournois sign'\n            ],\n            [\n              8375,\n              'spesmilo sign'\n            ],\n            [\n              8376,\n              'tenge sign'\n            ],\n            [\n              8377,\n              'indian rupee sign'\n            ],\n            [\n              8378,\n              'turkish lira sign'\n            ],\n            [\n              8379,\n              'nordic mark sign'\n            ],\n            [\n              8380,\n              'manat sign'\n            ],\n            [\n              8381,\n              'ruble sign'\n            ],\n            [\n              20870,\n              'yen character'\n            ],\n            [\n              20803,\n              'yuan character'\n            ],\n            [\n              22291,\n              'yuan character, in hong kong and taiwan'\n            ],\n            [\n              22278,\n              'yen/yuan character variant one'\n            ]\n          ]\n        },\n        {\n          name: 'Text',\n          characters: [\n            [\n              169,\n              'copyright sign'\n            ],\n            [\n              174,\n              'registered sign'\n            ],\n            [\n              8482,\n              'trade mark sign'\n            ],\n            [\n              8240,\n              'per mille sign'\n            ],\n            [\n              181,\n              'micro sign'\n            ],\n            [\n              183,\n              'middle dot'\n            ],\n            [\n              8226,\n              'bullet'\n            ],\n            [\n              8230,\n              'three dot leader'\n            ],\n            [\n              8242,\n              'minutes / feet'\n            ],\n            [\n              8243,\n              'seconds / inches'\n            ],\n            [\n              167,\n              'section sign'\n            ],\n            [\n              182,\n              'paragraph sign'\n            ],\n            [\n              223,\n              'sharp s / ess-zed'\n            ]\n          ]\n        },\n        {\n          name: 'Quotations',\n          characters: [\n            [\n              8249,\n              'single left-pointing angle quotation mark'\n            ],\n            [\n              8250,\n              'single right-pointing angle quotation mark'\n            ],\n            [\n              171,\n              'left pointing guillemet'\n            ],\n            [\n              187,\n              'right pointing guillemet'\n            ],\n            [\n              8216,\n              'left single quotation mark'\n            ],\n            [\n              8217,\n              'right single quotation mark'\n            ],\n            [\n              8220,\n              'left double quotation mark'\n            ],\n            [\n              8221,\n              'right double quotation mark'\n            ],\n            [\n              8218,\n              'single low-9 quotation mark'\n            ],\n            [\n              8222,\n              'double low-9 quotation mark'\n            ],\n            [\n              60,\n              'less-than sign'\n            ],\n            [\n              62,\n              'greater-than sign'\n            ],\n            [\n              8804,\n              'less-than or equal to'\n            ],\n            [\n              8805,\n              'greater-than or equal to'\n            ],\n            [\n              8211,\n              'en dash'\n            ],\n            [\n              8212,\n              'em dash'\n            ],\n            [\n              175,\n              'macron'\n            ],\n            [\n              8254,\n              'overline'\n            ],\n            [\n              164,\n              'currency sign'\n            ],\n            [\n              166,\n              'broken bar'\n            ],\n            [\n              168,\n              'diaeresis'\n            ],\n            [\n              161,\n              'inverted exclamation mark'\n            ],\n            [\n              191,\n              'turned question mark'\n            ],\n            [\n              710,\n              'circumflex accent'\n            ],\n            [\n              732,\n              'small tilde'\n            ],\n            [\n              176,\n              'degree sign'\n            ],\n            [\n              8722,\n              'minus sign'\n            ],\n            [\n              177,\n              'plus-minus sign'\n            ],\n            [\n              247,\n              'division sign'\n            ],\n            [\n              8260,\n              'fraction slash'\n            ],\n            [\n              215,\n              'multiplication sign'\n            ],\n            [\n              185,\n              'superscript one'\n            ],\n            [\n              178,\n              'superscript two'\n            ],\n            [\n              179,\n              'superscript three'\n            ],\n            [\n              188,\n              'fraction one quarter'\n            ],\n            [\n              189,\n              'fraction one half'\n            ],\n            [\n              190,\n              'fraction three quarters'\n            ]\n          ]\n        },\n        {\n          name: 'Mathematical',\n          characters: [\n            [\n              402,\n              'function / florin'\n            ],\n            [\n              8747,\n              'integral'\n            ],\n            [\n              8721,\n              'n-ary sumation'\n            ],\n            [\n              8734,\n              'infinity'\n            ],\n            [\n              8730,\n              'square root'\n            ],\n            [\n              8764,\n              'similar to'\n            ],\n            [\n              8773,\n              'approximately equal to'\n            ],\n            [\n              8776,\n              'almost equal to'\n            ],\n            [\n              8800,\n              'not equal to'\n            ],\n            [\n              8801,\n              'identical to'\n            ],\n            [\n              8712,\n              'element of'\n            ],\n            [\n              8713,\n              'not an element of'\n            ],\n            [\n              8715,\n              'contains as member'\n            ],\n            [\n              8719,\n              'n-ary product'\n            ],\n            [\n              8743,\n              'logical and'\n            ],\n            [\n              8744,\n              'logical or'\n            ],\n            [\n              172,\n              'not sign'\n            ],\n            [\n              8745,\n              'intersection'\n            ],\n            [\n              8746,\n              'union'\n            ],\n            [\n              8706,\n              'partial differential'\n            ],\n            [\n              8704,\n              'for all'\n            ],\n            [\n              8707,\n              'there exists'\n            ],\n            [\n              8709,\n              'diameter'\n            ],\n            [\n              8711,\n              'backward difference'\n            ],\n            [\n              8727,\n              'asterisk operator'\n            ],\n            [\n              8733,\n              'proportional to'\n            ],\n            [\n              8736,\n              'angle'\n            ]\n          ]\n        },\n        {\n          name: 'Extended Latin',\n          characters: [\n            [\n              192,\n              'A - grave'\n            ],\n            [\n              193,\n              'A - acute'\n            ],\n            [\n              194,\n              'A - circumflex'\n            ],\n            [\n              195,\n              'A - tilde'\n            ],\n            [\n              196,\n              'A - diaeresis'\n            ],\n            [\n              197,\n              'A - ring above'\n            ],\n            [\n              256,\n              'A - macron'\n            ],\n            [\n              198,\n              'ligature AE'\n            ],\n            [\n              199,\n              'C - cedilla'\n            ],\n            [\n              200,\n              'E - grave'\n            ],\n            [\n              201,\n              'E - acute'\n            ],\n            [\n              202,\n              'E - circumflex'\n            ],\n            [\n              203,\n              'E - diaeresis'\n            ],\n            [\n              274,\n              'E - macron'\n            ],\n            [\n              204,\n              'I - grave'\n            ],\n            [\n              205,\n              'I - acute'\n            ],\n            [\n              206,\n              'I - circumflex'\n            ],\n            [\n              207,\n              'I - diaeresis'\n            ],\n            [\n              298,\n              'I - macron'\n            ],\n            [\n              208,\n              'ETH'\n            ],\n            [\n              209,\n              'N - tilde'\n            ],\n            [\n              210,\n              'O - grave'\n            ],\n            [\n              211,\n              'O - acute'\n            ],\n            [\n              212,\n              'O - circumflex'\n            ],\n            [\n              213,\n              'O - tilde'\n            ],\n            [\n              214,\n              'O - diaeresis'\n            ],\n            [\n              216,\n              'O - slash'\n            ],\n            [\n              332,\n              'O - macron'\n            ],\n            [\n              338,\n              'ligature OE'\n            ],\n            [\n              352,\n              'S - caron'\n            ],\n            [\n              217,\n              'U - grave'\n            ],\n            [\n              218,\n              'U - acute'\n            ],\n            [\n              219,\n              'U - circumflex'\n            ],\n            [\n              220,\n              'U - diaeresis'\n            ],\n            [\n              362,\n              'U - macron'\n            ],\n            [\n              221,\n              'Y - acute'\n            ],\n            [\n              376,\n              'Y - diaeresis'\n            ],\n            [\n              562,\n              'Y - macron'\n            ],\n            [\n              222,\n              'THORN'\n            ],\n            [\n              224,\n              'a - grave'\n            ],\n            [\n              225,\n              'a - acute'\n            ],\n            [\n              226,\n              'a - circumflex'\n            ],\n            [\n              227,\n              'a - tilde'\n            ],\n            [\n              228,\n              'a - diaeresis'\n            ],\n            [\n              229,\n              'a - ring above'\n            ],\n            [\n              257,\n              'a - macron'\n            ],\n            [\n              230,\n              'ligature ae'\n            ],\n            [\n              231,\n              'c - cedilla'\n            ],\n            [\n              232,\n              'e - grave'\n            ],\n            [\n              233,\n              'e - acute'\n            ],\n            [\n              234,\n              'e - circumflex'\n            ],\n            [\n              235,\n              'e - diaeresis'\n            ],\n            [\n              275,\n              'e - macron'\n            ],\n            [\n              236,\n              'i - grave'\n            ],\n            [\n              237,\n              'i - acute'\n            ],\n            [\n              238,\n              'i - circumflex'\n            ],\n            [\n              239,\n              'i - diaeresis'\n            ],\n            [\n              299,\n              'i - macron'\n            ],\n            [\n              240,\n              'eth'\n            ],\n            [\n              241,\n              'n - tilde'\n            ],\n            [\n              242,\n              'o - grave'\n            ],\n            [\n              243,\n              'o - acute'\n            ],\n            [\n              244,\n              'o - circumflex'\n            ],\n            [\n              245,\n              'o - tilde'\n            ],\n            [\n              246,\n              'o - diaeresis'\n            ],\n            [\n              248,\n              'o slash'\n            ],\n            [\n              333,\n              'o macron'\n            ],\n            [\n              339,\n              'ligature oe'\n            ],\n            [\n              353,\n              's - caron'\n            ],\n            [\n              249,\n              'u - grave'\n            ],\n            [\n              250,\n              'u - acute'\n            ],\n            [\n              251,\n              'u - circumflex'\n            ],\n            [\n              252,\n              'u - diaeresis'\n            ],\n            [\n              363,\n              'u - macron'\n            ],\n            [\n              253,\n              'y - acute'\n            ],\n            [\n              254,\n              'thorn'\n            ],\n            [\n              255,\n              'y - diaeresis'\n            ],\n            [\n              563,\n              'y - macron'\n            ],\n            [\n              913,\n              'Alpha'\n            ],\n            [\n              914,\n              'Beta'\n            ],\n            [\n              915,\n              'Gamma'\n            ],\n            [\n              916,\n              'Delta'\n            ],\n            [\n              917,\n              'Epsilon'\n            ],\n            [\n              918,\n              'Zeta'\n            ],\n            [\n              919,\n              'Eta'\n            ],\n            [\n              920,\n              'Theta'\n            ],\n            [\n              921,\n              'Iota'\n            ],\n            [\n              922,\n              'Kappa'\n            ],\n            [\n              923,\n              'Lambda'\n            ],\n            [\n              924,\n              'Mu'\n            ],\n            [\n              925,\n              'Nu'\n            ],\n            [\n              926,\n              'Xi'\n            ],\n            [\n              927,\n              'Omicron'\n            ],\n            [\n              928,\n              'Pi'\n            ],\n            [\n              929,\n              'Rho'\n            ],\n            [\n              931,\n              'Sigma'\n            ],\n            [\n              932,\n              'Tau'\n            ],\n            [\n              933,\n              'Upsilon'\n            ],\n            [\n              934,\n              'Phi'\n            ],\n            [\n              935,\n              'Chi'\n            ],\n            [\n              936,\n              'Psi'\n            ],\n            [\n              937,\n              'Omega'\n            ],\n            [\n              945,\n              'alpha'\n            ],\n            [\n              946,\n              'beta'\n            ],\n            [\n              947,\n              'gamma'\n            ],\n            [\n              948,\n              'delta'\n            ],\n            [\n              949,\n              'epsilon'\n            ],\n            [\n              950,\n              'zeta'\n            ],\n            [\n              951,\n              'eta'\n            ],\n            [\n              952,\n              'theta'\n            ],\n            [\n              953,\n              'iota'\n            ],\n            [\n              954,\n              'kappa'\n            ],\n            [\n              955,\n              'lambda'\n            ],\n            [\n              956,\n              'mu'\n            ],\n            [\n              957,\n              'nu'\n            ],\n            [\n              958,\n              'xi'\n            ],\n            [\n              959,\n              'omicron'\n            ],\n            [\n              960,\n              'pi'\n            ],\n            [\n              961,\n              'rho'\n            ],\n            [\n              962,\n              'final sigma'\n            ],\n            [\n              963,\n              'sigma'\n            ],\n            [\n              964,\n              'tau'\n            ],\n            [\n              965,\n              'upsilon'\n            ],\n            [\n              966,\n              'phi'\n            ],\n            [\n              967,\n              'chi'\n            ],\n            [\n              968,\n              'psi'\n            ],\n            [\n              969,\n              'omega'\n            ]\n          ]\n        },\n        {\n          name: 'Symbols',\n          characters: [\n            [\n              8501,\n              'alef symbol'\n            ],\n            [\n              982,\n              'pi symbol'\n            ],\n            [\n              8476,\n              'real part symbol'\n            ],\n            [\n              978,\n              'upsilon - hook symbol'\n            ],\n            [\n              8472,\n              'Weierstrass p'\n            ],\n            [\n              8465,\n              'imaginary part'\n            ]\n          ]\n        },\n        {\n          name: 'Arrows',\n          characters: [\n            [\n              8592,\n              'leftwards arrow'\n            ],\n            [\n              8593,\n              'upwards arrow'\n            ],\n            [\n              8594,\n              'rightwards arrow'\n            ],\n            [\n              8595,\n              'downwards arrow'\n            ],\n            [\n              8596,\n              'left right arrow'\n            ],\n            [\n              8629,\n              'carriage return'\n            ],\n            [\n              8656,\n              'leftwards double arrow'\n            ],\n            [\n              8657,\n              'upwards double arrow'\n            ],\n            [\n              8658,\n              'rightwards double arrow'\n            ],\n            [\n              8659,\n              'downwards double arrow'\n            ],\n            [\n              8660,\n              'left right double arrow'\n            ],\n            [\n              8756,\n              'therefore'\n            ],\n            [\n              8834,\n              'subset of'\n            ],\n            [\n              8835,\n              'superset of'\n            ],\n            [\n              8836,\n              'not a subset of'\n            ],\n            [\n              8838,\n              'subset of or equal to'\n            ],\n            [\n              8839,\n              'superset of or equal to'\n            ],\n            [\n              8853,\n              'circled plus'\n            ],\n            [\n              8855,\n              'circled times'\n            ],\n            [\n              8869,\n              'perpendicular'\n            ],\n            [\n              8901,\n              'dot operator'\n            ],\n            [\n              8968,\n              'left ceiling'\n            ],\n            [\n              8969,\n              'right ceiling'\n            ],\n            [\n              8970,\n              'left floor'\n            ],\n            [\n              8971,\n              'right floor'\n            ],\n            [\n              9001,\n              'left-pointing angle bracket'\n            ],\n            [\n              9002,\n              'right-pointing angle bracket'\n            ],\n            [\n              9674,\n              'lozenge'\n            ],\n            [\n              9824,\n              'black spade suit'\n            ],\n            [\n              9827,\n              'black club suit'\n            ],\n            [\n              9829,\n              'black heart suit'\n            ],\n            [\n              9830,\n              'black diamond suit'\n            ],\n            [\n              8194,\n              'en space'\n            ],\n            [\n              8195,\n              'em space'\n            ],\n            [\n              8201,\n              'thin space'\n            ],\n            [\n              8204,\n              'zero width non-joiner'\n            ],\n            [\n              8205,\n              'zero width joiner'\n            ],\n            [\n              8206,\n              'left-to-right mark'\n            ],\n            [\n              8207,\n              'right-to-left mark'\n            ]\n          ]\n        }\n      ];\n    };\n    var charmapFilter = function (charmap) {\n      return global$1.grep(charmap, function (item) {\n        return isArray(item) && item.length === 2;\n      });\n    };\n    var getCharsFromSetting = function (settingValue) {\n      if (isArray(settingValue)) {\n        return charmapFilter(settingValue);\n      }\n      if (typeof settingValue === 'function') {\n        return settingValue();\n      }\n      return [];\n    };\n    var extendCharMap = function (editor, charmap) {\n      var userCharMap = getCharMap$1(editor);\n      if (userCharMap) {\n        charmap = [{\n            name: UserDefined,\n            characters: getCharsFromSetting(userCharMap)\n          }];\n      }\n      var userCharMapAppend = getCharMapAppend(editor);\n      if (userCharMapAppend) {\n        var userDefinedGroup = global$1.grep(charmap, function (cg) {\n          return cg.name === UserDefined;\n        });\n        if (userDefinedGroup.length) {\n          userDefinedGroup[0].characters = [].concat(userDefinedGroup[0].characters).concat(getCharsFromSetting(userCharMapAppend));\n          return charmap;\n        }\n        return charmap.concat({\n          name: UserDefined,\n          characters: getCharsFromSetting(userCharMapAppend)\n        });\n      }\n      return charmap;\n    };\n    var getCharMap = function (editor) {\n      var groups = extendCharMap(editor, getDefaultCharMap());\n      return groups.length > 1 ? [{\n          name: 'All',\n          characters: bind(groups, function (g) {\n            return g.characters;\n          })\n        }].concat(groups) : groups;\n    };\n\n    var get = function (editor) {\n      var getCharMap$1 = function () {\n        return getCharMap(editor);\n      };\n      var insertChar$1 = function (chr) {\n        insertChar(editor, chr);\n      };\n      return {\n        getCharMap: getCharMap$1,\n        insertChar: insertChar$1\n      };\n    };\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var last = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        cancel();\n        timer = setTimeout(function () {\n          timer = null;\n          fn.apply(null, args);\n        }, rate);\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n\n    var nativeFromCodePoint = String.fromCodePoint;\n    var contains = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var fromCodePoint = function () {\n      var codePoints = [];\n      for (var _i = 0; _i < arguments.length; _i++) {\n        codePoints[_i] = arguments[_i];\n      }\n      if (nativeFromCodePoint) {\n        return nativeFromCodePoint.apply(void 0, codePoints);\n      } else {\n        var codeUnits = [];\n        var codeLen = 0;\n        var result = '';\n        for (var index = 0, len = codePoints.length; index !== len; ++index) {\n          var codePoint = +codePoints[index];\n          if (!(codePoint < 1114111 && codePoint >>> 0 === codePoint)) {\n            throw RangeError('Invalid code point: ' + codePoint);\n          }\n          if (codePoint <= 65535) {\n            codeLen = codeUnits.push(codePoint);\n          } else {\n            codePoint -= 65536;\n            codeLen = codeUnits.push((codePoint >> 10) + 55296, codePoint % 1024 + 56320);\n          }\n          if (codeLen >= 16383) {\n            result += String.fromCharCode.apply(null, codeUnits);\n            codeUnits.length = 0;\n          }\n        }\n        return result + String.fromCharCode.apply(null, codeUnits);\n      }\n    };\n\n    var charMatches = function (charCode, name, lowerCasePattern) {\n      if (contains(fromCodePoint(charCode).toLowerCase(), lowerCasePattern)) {\n        return true;\n      } else {\n        return contains(name.toLowerCase(), lowerCasePattern) || contains(name.toLowerCase().replace(/\\s+/g, ''), lowerCasePattern);\n      }\n    };\n    var scan = function (group, pattern) {\n      var matches = [];\n      var lowerCasePattern = pattern.toLowerCase();\n      each(group.characters, function (g) {\n        if (charMatches(g[0], g[1], lowerCasePattern)) {\n          matches.push(g);\n        }\n      });\n      return map(matches, function (m) {\n        return {\n          text: m[1],\n          value: fromCodePoint(m[0]),\n          icon: fromCodePoint(m[0])\n        };\n      });\n    };\n\n    var patternName = 'pattern';\n    var open = function (editor, charMap) {\n      var makeGroupItems = function () {\n        return [\n          {\n            label: 'Search',\n            type: 'input',\n            name: patternName\n          },\n          {\n            type: 'collection',\n            name: 'results'\n          }\n        ];\n      };\n      var makeTabs = function () {\n        return map(charMap, function (charGroup) {\n          return {\n            title: charGroup.name,\n            name: charGroup.name,\n            items: makeGroupItems()\n          };\n        });\n      };\n      var makePanel = function () {\n        return {\n          type: 'panel',\n          items: makeGroupItems()\n        };\n      };\n      var makeTabPanel = function () {\n        return {\n          type: 'tabpanel',\n          tabs: makeTabs()\n        };\n      };\n      var currentTab = charMap.length === 1 ? Cell(UserDefined) : Cell('All');\n      var scanAndSet = function (dialogApi, pattern) {\n        find(charMap, function (group) {\n          return group.name === currentTab.get();\n        }).each(function (f) {\n          var items = scan(f, pattern);\n          dialogApi.setData({ results: items });\n        });\n      };\n      var SEARCH_DELAY = 40;\n      var updateFilter = last(function (dialogApi) {\n        var pattern = dialogApi.getData().pattern;\n        scanAndSet(dialogApi, pattern);\n      }, SEARCH_DELAY);\n      var body = charMap.length === 1 ? makePanel() : makeTabPanel();\n      var initialData = {\n        pattern: '',\n        results: scan(charMap[0], '')\n      };\n      var bridgeSpec = {\n        title: 'Special Character',\n        size: 'normal',\n        body: body,\n        buttons: [{\n            type: 'cancel',\n            name: 'close',\n            text: 'Close',\n            primary: true\n          }],\n        initialData: initialData,\n        onAction: function (api, details) {\n          if (details.name === 'results') {\n            insertChar(editor, details.value);\n            api.close();\n          }\n        },\n        onTabChange: function (dialogApi, details) {\n          currentTab.set(details.newTabName);\n          updateFilter.throttle(dialogApi);\n        },\n        onChange: function (dialogApi, changeData) {\n          if (changeData.name === patternName) {\n            updateFilter.throttle(dialogApi);\n          }\n        }\n      };\n      var dialogApi = editor.windowManager.open(bridgeSpec);\n      dialogApi.focus(patternName);\n    };\n\n    var register$1 = function (editor, charMap) {\n      editor.addCommand('mceShowCharmap', function () {\n        open(editor, charMap);\n      });\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var init = function (editor, all) {\n      editor.ui.registry.addAutocompleter('charmap', {\n        ch: ':',\n        columns: 'auto',\n        minChars: 2,\n        fetch: function (pattern, _maxResults) {\n          return new global(function (resolve, _reject) {\n            resolve(scan(all, pattern));\n          });\n        },\n        onAction: function (autocompleteApi, rng, value) {\n          editor.selection.setRng(rng);\n          editor.insertContent(value);\n          autocompleteApi.hide();\n        }\n      });\n    };\n\n    var register = function (editor) {\n      editor.ui.registry.addButton('charmap', {\n        icon: 'insert-character',\n        tooltip: 'Special character',\n        onAction: function () {\n          return editor.execCommand('mceShowCharmap');\n        }\n      });\n      editor.ui.registry.addMenuItem('charmap', {\n        icon: 'insert-character',\n        text: 'Special character...',\n        onAction: function () {\n          return editor.execCommand('mceShowCharmap');\n        }\n      });\n    };\n\n    function Plugin () {\n      global$2.add('charmap', function (editor) {\n        var charMap = getCharMap(editor);\n        register$1(editor, charMap);\n        register(editor);\n        init(editor, charMap[0]);\n        return get(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/charmap/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/code/index.js":
/*!********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/code/index.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"code\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/code')\n//   ES2015:\n//     import 'tinymce/plugins/code'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/code/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/code/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/code/plugin.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/code/plugin.js ***!
  \*********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var setContent = function (editor, html) {\n      editor.focus();\n      editor.undoManager.transact(function () {\n        editor.setContent(html);\n      });\n      editor.selection.setCursorLocation();\n      editor.nodeChanged();\n    };\n    var getContent = function (editor) {\n      return editor.getContent({ source_view: true });\n    };\n\n    var open = function (editor) {\n      var editorContent = getContent(editor);\n      editor.windowManager.open({\n        title: 'Source Code',\n        size: 'large',\n        body: {\n          type: 'panel',\n          items: [{\n              type: 'textarea',\n              name: 'code'\n            }]\n        },\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: { code: editorContent },\n        onSubmit: function (api) {\n          setContent(editor, api.getData().code);\n          api.close();\n        }\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('mceCodeEditor', function () {\n        open(editor);\n      });\n    };\n\n    var register = function (editor) {\n      var onAction = function () {\n        return editor.execCommand('mceCodeEditor');\n      };\n      editor.ui.registry.addButton('code', {\n        icon: 'sourcecode',\n        tooltip: 'Source code',\n        onAction: onAction\n      });\n      editor.ui.registry.addMenuItem('code', {\n        icon: 'sourcecode',\n        text: 'Source code',\n        onAction: onAction\n      });\n    };\n\n    function Plugin () {\n      global.add('code', function (editor) {\n        register$1(editor);\n        register(editor);\n        return {};\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/code/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/codesample/index.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/codesample/index.js ***!
  \**************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"codesample\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/codesample')\n//   ES2015:\n//     import 'tinymce/plugins/codesample'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/codesample/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/codesample/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/codesample/plugin.js":
/*!***************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/codesample/plugin.js ***!
  \***************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var get$1 = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$1(xs, 0);\n    };\n\n    var someIf = function (b, a) {\n      return b ? Optional.some(a) : Optional.none();\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var isCodeSample = function (elm) {\n      return elm && elm.nodeName === 'PRE' && elm.className.indexOf('language-') !== -1;\n    };\n    var trimArg = function (predicateFn) {\n      return function (arg1, arg2) {\n        return predicateFn(arg2);\n      };\n    };\n\n    var Global = typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var exports$1 = {}, module = { exports: exports$1 }, global = {};\n    (function (define, exports, module, require) {\n      var oldprism = window.Prism;\n      window.Prism = { manual: true };\n      (function (global, factory) {\n        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());\n      }(this, function () {\n        var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n        var prismCore = { exports: {} };\n        (function (module) {\n          var _self = typeof window !== 'undefined' ? window : typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope ? self : {};\n          var Prism = function (_self) {\n            var lang = /(?:^|\\s)lang(?:uage)?-([\\w-]+)(?=\\s|$)/i;\n            var uniqueId = 0;\n            var plainTextGrammar = {};\n            var _ = {\n              manual: _self.Prism && _self.Prism.manual,\n              disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,\n              util: {\n                encode: function encode(tokens) {\n                  if (tokens instanceof Token) {\n                    return new Token(tokens.type, encode(tokens.content), tokens.alias);\n                  } else if (Array.isArray(tokens)) {\n                    return tokens.map(encode);\n                  } else {\n                    return tokens.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\\u00a0/g, ' ');\n                  }\n                },\n                type: function (o) {\n                  return Object.prototype.toString.call(o).slice(8, -1);\n                },\n                objId: function (obj) {\n                  if (!obj['__id']) {\n                    Object.defineProperty(obj, '__id', { value: ++uniqueId });\n                  }\n                  return obj['__id'];\n                },\n                clone: function deepClone(o, visited) {\n                  visited = visited || {};\n                  var clone;\n                  var id;\n                  switch (_.util.type(o)) {\n                  case 'Object':\n                    id = _.util.objId(o);\n                    if (visited[id]) {\n                      return visited[id];\n                    }\n                    clone = {};\n                    visited[id] = clone;\n                    for (var key in o) {\n                      if (o.hasOwnProperty(key)) {\n                        clone[key] = deepClone(o[key], visited);\n                      }\n                    }\n                    return clone;\n                  case 'Array':\n                    id = _.util.objId(o);\n                    if (visited[id]) {\n                      return visited[id];\n                    }\n                    clone = [];\n                    visited[id] = clone;\n                    o.forEach(function (v, i) {\n                      clone[i] = deepClone(v, visited);\n                    });\n                    return clone;\n                  default:\n                    return o;\n                  }\n                },\n                getLanguage: function (element) {\n                  while (element) {\n                    var m = lang.exec(element.className);\n                    if (m) {\n                      return m[1].toLowerCase();\n                    }\n                    element = element.parentElement;\n                  }\n                  return 'none';\n                },\n                setLanguage: function (element, language) {\n                  element.className = element.className.replace(RegExp(lang.source, 'gi'), '');\n                  element.classList.add('language-' + language);\n                },\n                currentScript: function () {\n                  if (typeof document === 'undefined') {\n                    return null;\n                  }\n                  if ('currentScript' in document && 1 < 2) {\n                    return document.currentScript;\n                  }\n                  try {\n                    throw new Error();\n                  } catch (err) {\n                    var src = (/at [^(\\r\\n]*\\((.*):[^:]+:[^:]+\\)$/i.exec(err.stack) || [])[1];\n                    if (src) {\n                      var scripts = document.getElementsByTagName('script');\n                      for (var i in scripts) {\n                        if (scripts[i].src == src) {\n                          return scripts[i];\n                        }\n                      }\n                    }\n                    return null;\n                  }\n                },\n                isActive: function (element, className, defaultActivation) {\n                  var no = 'no-' + className;\n                  while (element) {\n                    var classList = element.classList;\n                    if (classList.contains(className)) {\n                      return true;\n                    }\n                    if (classList.contains(no)) {\n                      return false;\n                    }\n                    element = element.parentElement;\n                  }\n                  return !!defaultActivation;\n                }\n              },\n              languages: {\n                plain: plainTextGrammar,\n                plaintext: plainTextGrammar,\n                text: plainTextGrammar,\n                txt: plainTextGrammar,\n                extend: function (id, redef) {\n                  var lang = _.util.clone(_.languages[id]);\n                  for (var key in redef) {\n                    lang[key] = redef[key];\n                  }\n                  return lang;\n                },\n                insertBefore: function (inside, before, insert, root) {\n                  root = root || _.languages;\n                  var grammar = root[inside];\n                  var ret = {};\n                  for (var token in grammar) {\n                    if (grammar.hasOwnProperty(token)) {\n                      if (token == before) {\n                        for (var newToken in insert) {\n                          if (insert.hasOwnProperty(newToken)) {\n                            ret[newToken] = insert[newToken];\n                          }\n                        }\n                      }\n                      if (!insert.hasOwnProperty(token)) {\n                        ret[token] = grammar[token];\n                      }\n                    }\n                  }\n                  var old = root[inside];\n                  root[inside] = ret;\n                  _.languages.DFS(_.languages, function (key, value) {\n                    if (value === old && key != inside) {\n                      this[key] = ret;\n                    }\n                  });\n                  return ret;\n                },\n                DFS: function DFS(o, callback, type, visited) {\n                  visited = visited || {};\n                  var objId = _.util.objId;\n                  for (var i in o) {\n                    if (o.hasOwnProperty(i)) {\n                      callback.call(o, i, o[i], type || i);\n                      var property = o[i];\n                      var propertyType = _.util.type(property);\n                      if (propertyType === 'Object' && !visited[objId(property)]) {\n                        visited[objId(property)] = true;\n                        DFS(property, callback, null, visited);\n                      } else if (propertyType === 'Array' && !visited[objId(property)]) {\n                        visited[objId(property)] = true;\n                        DFS(property, callback, i, visited);\n                      }\n                    }\n                  }\n                }\n              },\n              plugins: {},\n              highlightAll: function (async, callback) {\n                _.highlightAllUnder(document, async, callback);\n              },\n              highlightAllUnder: function (container, async, callback) {\n                var env = {\n                  callback: callback,\n                  container: container,\n                  selector: 'code[class*=\"language-\"], [class*=\"language-\"] code, code[class*=\"lang-\"], [class*=\"lang-\"] code'\n                };\n                _.hooks.run('before-highlightall', env);\n                env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));\n                _.hooks.run('before-all-elements-highlight', env);\n                for (var i = 0, element; element = env.elements[i++];) {\n                  _.highlightElement(element, async === true, env.callback);\n                }\n              },\n              highlightElement: function (element, async, callback) {\n                var language = _.util.getLanguage(element);\n                var grammar = _.languages[language];\n                _.util.setLanguage(element, language);\n                var parent = element.parentElement;\n                if (parent && parent.nodeName.toLowerCase() === 'pre') {\n                  _.util.setLanguage(parent, language);\n                }\n                var code = element.textContent;\n                var env = {\n                  element: element,\n                  language: language,\n                  grammar: grammar,\n                  code: code\n                };\n                function insertHighlightedCode(highlightedCode) {\n                  env.highlightedCode = highlightedCode;\n                  _.hooks.run('before-insert', env);\n                  env.element.innerHTML = env.highlightedCode;\n                  _.hooks.run('after-highlight', env);\n                  _.hooks.run('complete', env);\n                  callback && callback.call(env.element);\n                }\n                _.hooks.run('before-sanity-check', env);\n                parent = env.element.parentElement;\n                if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {\n                  parent.setAttribute('tabindex', '0');\n                }\n                if (!env.code) {\n                  _.hooks.run('complete', env);\n                  callback && callback.call(env.element);\n                  return;\n                }\n                _.hooks.run('before-highlight', env);\n                if (!env.grammar) {\n                  insertHighlightedCode(_.util.encode(env.code));\n                  return;\n                }\n                if (async && _self.Worker) {\n                  var worker = new Worker(_.filename);\n                  worker.onmessage = function (evt) {\n                    insertHighlightedCode(evt.data);\n                  };\n                  worker.postMessage(JSON.stringify({\n                    language: env.language,\n                    code: env.code,\n                    immediateClose: true\n                  }));\n                } else {\n                  insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));\n                }\n              },\n              highlight: function (text, grammar, language) {\n                var env = {\n                  code: text,\n                  grammar: grammar,\n                  language: language\n                };\n                _.hooks.run('before-tokenize', env);\n                if (!env.grammar) {\n                  throw new Error('The language \"' + env.language + '\" has no grammar.');\n                }\n                env.tokens = _.tokenize(env.code, env.grammar);\n                _.hooks.run('after-tokenize', env);\n                return Token.stringify(_.util.encode(env.tokens), env.language);\n              },\n              tokenize: function (text, grammar) {\n                var rest = grammar.rest;\n                if (rest) {\n                  for (var token in rest) {\n                    grammar[token] = rest[token];\n                  }\n                  delete grammar.rest;\n                }\n                var tokenList = new LinkedList();\n                addAfter(tokenList, tokenList.head, text);\n                matchGrammar(text, tokenList, grammar, tokenList.head, 0);\n                return toArray(tokenList);\n              },\n              hooks: {\n                all: {},\n                add: function (name, callback) {\n                  var hooks = _.hooks.all;\n                  hooks[name] = hooks[name] || [];\n                  hooks[name].push(callback);\n                },\n                run: function (name, env) {\n                  var callbacks = _.hooks.all[name];\n                  if (!callbacks || !callbacks.length) {\n                    return;\n                  }\n                  for (var i = 0, callback; callback = callbacks[i++];) {\n                    callback(env);\n                  }\n                }\n              },\n              Token: Token\n            };\n            _self.Prism = _;\n            function Token(type, content, alias, matchedStr) {\n              this.type = type;\n              this.content = content;\n              this.alias = alias;\n              this.length = (matchedStr || '').length | 0;\n            }\n            Token.stringify = function stringify(o, language) {\n              if (typeof o == 'string') {\n                return o;\n              }\n              if (Array.isArray(o)) {\n                var s = '';\n                o.forEach(function (e) {\n                  s += stringify(e, language);\n                });\n                return s;\n              }\n              var env = {\n                type: o.type,\n                content: stringify(o.content, language),\n                tag: 'span',\n                classes: [\n                  'token',\n                  o.type\n                ],\n                attributes: {},\n                language: language\n              };\n              var aliases = o.alias;\n              if (aliases) {\n                if (Array.isArray(aliases)) {\n                  Array.prototype.push.apply(env.classes, aliases);\n                } else {\n                  env.classes.push(aliases);\n                }\n              }\n              _.hooks.run('wrap', env);\n              var attributes = '';\n              for (var name in env.attributes) {\n                attributes += ' ' + name + '=\"' + (env.attributes[name] || '').replace(/\"/g, '&quot;') + '\"';\n              }\n              return '<' + env.tag + ' class=\"' + env.classes.join(' ') + '\"' + attributes + '>' + env.content + '</' + env.tag + '>';\n            };\n            function matchPattern(pattern, pos, text, lookbehind) {\n              pattern.lastIndex = pos;\n              var match = pattern.exec(text);\n              if (match && lookbehind && match[1]) {\n                var lookbehindLength = match[1].length;\n                match.index += lookbehindLength;\n                match[0] = match[0].slice(lookbehindLength);\n              }\n              return match;\n            }\n            function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {\n              for (var token in grammar) {\n                if (!grammar.hasOwnProperty(token) || !grammar[token]) {\n                  continue;\n                }\n                var patterns = grammar[token];\n                patterns = Array.isArray(patterns) ? patterns : [patterns];\n                for (var j = 0; j < patterns.length; ++j) {\n                  if (rematch && rematch.cause == token + ',' + j) {\n                    return;\n                  }\n                  var patternObj = patterns[j];\n                  var inside = patternObj.inside;\n                  var lookbehind = !!patternObj.lookbehind;\n                  var greedy = !!patternObj.greedy;\n                  var alias = patternObj.alias;\n                  if (greedy && !patternObj.pattern.global) {\n                    var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];\n                    patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');\n                  }\n                  var pattern = patternObj.pattern || patternObj;\n                  for (var currentNode = startNode.next, pos = startPos; currentNode !== tokenList.tail; pos += currentNode.value.length, currentNode = currentNode.next) {\n                    if (rematch && pos >= rematch.reach) {\n                      break;\n                    }\n                    var str = currentNode.value;\n                    if (tokenList.length > text.length) {\n                      return;\n                    }\n                    if (str instanceof Token) {\n                      continue;\n                    }\n                    var removeCount = 1;\n                    var match;\n                    if (greedy) {\n                      match = matchPattern(pattern, pos, text, lookbehind);\n                      if (!match || match.index >= text.length) {\n                        break;\n                      }\n                      var from = match.index;\n                      var to = match.index + match[0].length;\n                      var p = pos;\n                      p += currentNode.value.length;\n                      while (from >= p) {\n                        currentNode = currentNode.next;\n                        p += currentNode.value.length;\n                      }\n                      p -= currentNode.value.length;\n                      pos = p;\n                      if (currentNode.value instanceof Token) {\n                        continue;\n                      }\n                      for (var k = currentNode; k !== tokenList.tail && (p < to || typeof k.value === 'string'); k = k.next) {\n                        removeCount++;\n                        p += k.value.length;\n                      }\n                      removeCount--;\n                      str = text.slice(pos, p);\n                      match.index -= pos;\n                    } else {\n                      match = matchPattern(pattern, 0, str, lookbehind);\n                      if (!match) {\n                        continue;\n                      }\n                    }\n                    var from = match.index;\n                    var matchStr = match[0];\n                    var before = str.slice(0, from);\n                    var after = str.slice(from + matchStr.length);\n                    var reach = pos + str.length;\n                    if (rematch && reach > rematch.reach) {\n                      rematch.reach = reach;\n                    }\n                    var removeFrom = currentNode.prev;\n                    if (before) {\n                      removeFrom = addAfter(tokenList, removeFrom, before);\n                      pos += before.length;\n                    }\n                    removeRange(tokenList, removeFrom, removeCount);\n                    var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);\n                    currentNode = addAfter(tokenList, removeFrom, wrapped);\n                    if (after) {\n                      addAfter(tokenList, currentNode, after);\n                    }\n                    if (removeCount > 1) {\n                      var nestedRematch = {\n                        cause: token + ',' + j,\n                        reach: reach\n                      };\n                      matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);\n                      if (rematch && nestedRematch.reach > rematch.reach) {\n                        rematch.reach = nestedRematch.reach;\n                      }\n                    }\n                  }\n                }\n              }\n            }\n            function LinkedList() {\n              var head = {\n                value: null,\n                prev: null,\n                next: null\n              };\n              var tail = {\n                value: null,\n                prev: head,\n                next: null\n              };\n              head.next = tail;\n              this.head = head;\n              this.tail = tail;\n              this.length = 0;\n            }\n            function addAfter(list, node, value) {\n              var next = node.next;\n              var newNode = {\n                value: value,\n                prev: node,\n                next: next\n              };\n              node.next = newNode;\n              next.prev = newNode;\n              list.length++;\n              return newNode;\n            }\n            function removeRange(list, node, count) {\n              var next = node.next;\n              for (var i = 0; i < count && next !== list.tail; i++) {\n                next = next.next;\n              }\n              node.next = next;\n              next.prev = node;\n              list.length -= i;\n            }\n            function toArray(list) {\n              var array = [];\n              var node = list.head.next;\n              while (node !== list.tail) {\n                array.push(node.value);\n                node = node.next;\n              }\n              return array;\n            }\n            if (!_self.document) {\n              if (!_self.addEventListener) {\n                return _;\n              }\n              if (!_.disableWorkerMessageHandler) {\n                _self.addEventListener('message', function (evt) {\n                  var message = JSON.parse(evt.data);\n                  var lang = message.language;\n                  var code = message.code;\n                  var immediateClose = message.immediateClose;\n                  _self.postMessage(_.highlight(code, _.languages[lang], lang));\n                  if (immediateClose) {\n                    _self.close();\n                  }\n                }, false);\n              }\n              return _;\n            }\n            var script = _.util.currentScript();\n            if (script) {\n              _.filename = script.src;\n              if (script.hasAttribute('data-manual')) {\n                _.manual = true;\n              }\n            }\n            function highlightAutomaticallyCallback() {\n              if (!_.manual) {\n                _.highlightAll();\n              }\n            }\n            if (!_.manual) {\n              var readyState = document.readyState;\n              if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {\n                document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);\n              } else {\n                if (window.requestAnimationFrame) {\n                  window.requestAnimationFrame(highlightAutomaticallyCallback);\n                } else {\n                  window.setTimeout(highlightAutomaticallyCallback, 16);\n                }\n              }\n            }\n            return _;\n          }(_self);\n          if (module.exports) {\n            module.exports = Prism;\n          }\n          if (typeof commonjsGlobal !== 'undefined') {\n            commonjsGlobal.Prism = Prism;\n          }\n        }(prismCore));\n        Prism.languages.clike = {\n          'comment': [\n            {\n              pattern: /(^|[^\\\\])\\/\\*[\\s\\S]*?(?:\\*\\/|$)/,\n              lookbehind: true,\n              greedy: true\n            },\n            {\n              pattern: /(^|[^\\\\:])\\/\\/.*/,\n              lookbehind: true,\n              greedy: true\n            }\n          ],\n          'string': {\n            pattern: /([\"'])(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\\\r\\n])*\\1/,\n            greedy: true\n          },\n          'class-name': {\n            pattern: /(\\b(?:class|extends|implements|instanceof|interface|new|trait)\\s+|\\bcatch\\s+\\()[\\w.\\\\]+/i,\n            lookbehind: true,\n            inside: { 'punctuation': /[.\\\\]/ }\n          },\n          'keyword': /\\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\\b/,\n          'boolean': /\\b(?:false|true)\\b/,\n          'function': /\\b\\w+(?=\\()/,\n          'number': /\\b0x[\\da-f]+\\b|(?:\\b\\d+(?:\\.\\d*)?|\\B\\.\\d+)(?:e[+-]?\\d+)?/i,\n          'operator': /[<>]=?|[!=]=?=?|--?|\\+\\+?|&&?|\\|\\|?|[?*/~^%]/,\n          'punctuation': /[{}[\\];(),.:]/\n        };\n        (function (Prism) {\n          function getPlaceholder(language, index) {\n            return '___' + language.toUpperCase() + index + '___';\n          }\n          Object.defineProperties(Prism.languages['markup-templating'] = {}, {\n            buildPlaceholders: {\n              value: function (env, language, placeholderPattern, replaceFilter) {\n                if (env.language !== language) {\n                  return;\n                }\n                var tokenStack = env.tokenStack = [];\n                env.code = env.code.replace(placeholderPattern, function (match) {\n                  if (typeof replaceFilter === 'function' && !replaceFilter(match)) {\n                    return match;\n                  }\n                  var i = tokenStack.length;\n                  var placeholder;\n                  while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {\n                    ++i;\n                  }\n                  tokenStack[i] = match;\n                  return placeholder;\n                });\n                env.grammar = Prism.languages.markup;\n              }\n            },\n            tokenizePlaceholders: {\n              value: function (env, language) {\n                if (env.language !== language || !env.tokenStack) {\n                  return;\n                }\n                env.grammar = Prism.languages[language];\n                var j = 0;\n                var keys = Object.keys(env.tokenStack);\n                function walkTokens(tokens) {\n                  for (var i = 0; i < tokens.length; i++) {\n                    if (j >= keys.length) {\n                      break;\n                    }\n                    var token = tokens[i];\n                    if (typeof token === 'string' || token.content && typeof token.content === 'string') {\n                      var k = keys[j];\n                      var t = env.tokenStack[k];\n                      var s = typeof token === 'string' ? token : token.content;\n                      var placeholder = getPlaceholder(language, k);\n                      var index = s.indexOf(placeholder);\n                      if (index > -1) {\n                        ++j;\n                        var before = s.substring(0, index);\n                        var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);\n                        var after = s.substring(index + placeholder.length);\n                        var replacement = [];\n                        if (before) {\n                          replacement.push.apply(replacement, walkTokens([before]));\n                        }\n                        replacement.push(middle);\n                        if (after) {\n                          replacement.push.apply(replacement, walkTokens([after]));\n                        }\n                        if (typeof token === 'string') {\n                          tokens.splice.apply(tokens, [\n                            i,\n                            1\n                          ].concat(replacement));\n                        } else {\n                          token.content = replacement;\n                        }\n                      }\n                    } else if (token.content) {\n                      walkTokens(token.content);\n                    }\n                  }\n                  return tokens;\n                }\n                walkTokens(env.tokens);\n              }\n            }\n          });\n        }(Prism));\n        Prism.languages.c = Prism.languages.extend('clike', {\n          'comment': {\n            pattern: /\\/\\/(?:[^\\r\\n\\\\]|\\\\(?:\\r\\n?|\\n|(?![\\r\\n])))*|\\/\\*[\\s\\S]*?(?:\\*\\/|$)/,\n            greedy: true\n          },\n          'string': {\n            pattern: /\"(?:\\\\(?:\\r\\n|[\\s\\S])|[^\"\\\\\\r\\n])*\"/,\n            greedy: true\n          },\n          'class-name': {\n            pattern: /(\\b(?:enum|struct)\\s+(?:__attribute__\\s*\\(\\([\\s\\S]*?\\)\\)\\s*)?)\\w+|\\b[a-z]\\w*_t\\b/,\n            lookbehind: true\n          },\n          'keyword': /\\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\\b/,\n          'function': /\\b[a-z_]\\w*(?=\\s*\\()/i,\n          'number': /(?:\\b0x(?:[\\da-f]+(?:\\.[\\da-f]*)?|\\.[\\da-f]+)(?:p[+-]?\\d+)?|(?:\\b\\d+(?:\\.\\d*)?|\\B\\.\\d+)(?:e[+-]?\\d+)?)[ful]{0,4}/i,\n          'operator': />>=?|<<=?|->|([-+&|:])\\1|[?:~]|[-+*/%&|^!=<>]=?/\n        });\n        Prism.languages.insertBefore('c', 'string', {\n          'char': {\n            pattern: /'(?:\\\\(?:\\r\\n|[\\s\\S])|[^'\\\\\\r\\n]){0,32}'/,\n            greedy: true\n          }\n        });\n        Prism.languages.insertBefore('c', 'string', {\n          'macro': {\n            pattern: /(^[\\t ]*)#\\s*[a-z](?:[^\\r\\n\\\\/]|\\/(?!\\*)|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\\\\(?:\\r\\n|[\\s\\S]))*/im,\n            lookbehind: true,\n            greedy: true,\n            alias: 'property',\n            inside: {\n              'string': [\n                {\n                  pattern: /^(#\\s*include\\s*)<[^>]+>/,\n                  lookbehind: true\n                },\n                Prism.languages.c['string']\n              ],\n              'char': Prism.languages.c['char'],\n              'comment': Prism.languages.c['comment'],\n              'macro-name': [\n                {\n                  pattern: /(^#\\s*define\\s+)\\w+\\b(?!\\()/i,\n                  lookbehind: true\n                },\n                {\n                  pattern: /(^#\\s*define\\s+)\\w+\\b(?=\\()/i,\n                  lookbehind: true,\n                  alias: 'function'\n                }\n              ],\n              'directive': {\n                pattern: /^(#\\s*)[a-z]+/,\n                lookbehind: true,\n                alias: 'keyword'\n              },\n              'directive-hash': /^#/,\n              'punctuation': /##|\\\\(?=[\\r\\n])/,\n              'expression': {\n                pattern: /\\S[\\s\\S]*/,\n                inside: Prism.languages.c\n              }\n            }\n          }\n        });\n        Prism.languages.insertBefore('c', 'function', { 'constant': /\\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\\b/ });\n        delete Prism.languages.c['boolean'];\n        (function (Prism) {\n          var keyword = /\\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\\b/;\n          var modName = /\\b(?!<keyword>)\\w+(?:\\s*\\.\\s*\\w+)*\\b/.source.replace(/<keyword>/g, function () {\n            return keyword.source;\n          });\n          Prism.languages.cpp = Prism.languages.extend('c', {\n            'class-name': [\n              {\n                pattern: RegExp(/(\\b(?:class|concept|enum|struct|typename)\\s+)(?!<keyword>)\\w+/.source.replace(/<keyword>/g, function () {\n                  return keyword.source;\n                })),\n                lookbehind: true\n              },\n              /\\b[A-Z]\\w*(?=\\s*::\\s*\\w+\\s*\\()/,\n              /\\b[A-Z_]\\w*(?=\\s*::\\s*~\\w+\\s*\\()/i,\n              /\\b\\w+(?=\\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\\s*::\\s*\\w+\\s*\\()/\n            ],\n            'keyword': keyword,\n            'number': {\n              pattern: /(?:\\b0b[01']+|\\b0x(?:[\\da-f']+(?:\\.[\\da-f']*)?|\\.[\\da-f']+)(?:p[+-]?[\\d']+)?|(?:\\b[\\d']+(?:\\.[\\d']*)?|\\B\\.[\\d']+)(?:e[+-]?[\\d']+)?)[ful]{0,4}/i,\n              greedy: true\n            },\n            'operator': />>=?|<<=?|->|--|\\+\\+|&&|\\|\\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\\b/,\n            'boolean': /\\b(?:false|true)\\b/\n          });\n          Prism.languages.insertBefore('cpp', 'string', {\n            'module': {\n              pattern: RegExp(/(\\b(?:import|module)\\s+)/.source + '(?:' + /\"(?:\\\\(?:\\r\\n|[\\s\\S])|[^\"\\\\\\r\\n])*\"|<[^<>\\r\\n]*>/.source + '|' + /<mod-name>(?:\\s*:\\s*<mod-name>)?|:\\s*<mod-name>/.source.replace(/<mod-name>/g, function () {\n                return modName;\n              }) + ')'),\n              lookbehind: true,\n              greedy: true,\n              inside: {\n                'string': /^[<\"][\\s\\S]+/,\n                'operator': /:/,\n                'punctuation': /\\./\n              }\n            },\n            'raw-string': {\n              pattern: /R\"([^()\\\\ ]{0,16})\\([\\s\\S]*?\\)\\1\"/,\n              alias: 'string',\n              greedy: true\n            }\n          });\n          Prism.languages.insertBefore('cpp', 'keyword', {\n            'generic-function': {\n              pattern: /\\b(?!operator\\b)[a-z_]\\w*\\s*<(?:[^<>]|<[^<>]*>)*>(?=\\s*\\()/i,\n              inside: {\n                'function': /^\\w+/,\n                'generic': {\n                  pattern: /<[\\s\\S]+/,\n                  alias: 'class-name',\n                  inside: Prism.languages.cpp\n                }\n              }\n            }\n          });\n          Prism.languages.insertBefore('cpp', 'operator', {\n            'double-colon': {\n              pattern: /::/,\n              alias: 'punctuation'\n            }\n          });\n          Prism.languages.insertBefore('cpp', 'class-name', {\n            'base-clause': {\n              pattern: /(\\b(?:class|struct)\\s+\\w+\\s*:\\s*)[^;{}\"'\\s]+(?:\\s+[^;{}\"'\\s]+)*(?=\\s*[;{])/,\n              lookbehind: true,\n              greedy: true,\n              inside: Prism.languages.extend('cpp', {})\n            }\n          });\n          Prism.languages.insertBefore('inside', 'double-colon', { 'class-name': /\\b[a-z_]\\w*\\b(?!\\s*::)/i }, Prism.languages.cpp['base-clause']);\n        }(Prism));\n        (function (Prism) {\n          function replace(pattern, replacements) {\n            return pattern.replace(/<<(\\d+)>>/g, function (m, index) {\n              return '(?:' + replacements[+index] + ')';\n            });\n          }\n          function re(pattern, replacements, flags) {\n            return RegExp(replace(pattern, replacements), flags || '');\n          }\n          function nested(pattern, depthLog2) {\n            for (var i = 0; i < depthLog2; i++) {\n              pattern = pattern.replace(/<<self>>/g, function () {\n                return '(?:' + pattern + ')';\n              });\n            }\n            return pattern.replace(/<<self>>/g, '[^\\\\s\\\\S]');\n          }\n          var keywordKinds = {\n            type: 'bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void',\n            typeDeclaration: 'class enum interface record struct',\n            contextual: 'add alias and ascending async await by descending from(?=\\\\s*(?:\\\\w|$)) get global group into init(?=\\\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\\\s*{)',\n            other: 'abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield'\n          };\n          function keywordsToPattern(words) {\n            return '\\\\b(?:' + words.trim().replace(/ /g, '|') + ')\\\\b';\n          }\n          var typeDeclarationKeywords = keywordsToPattern(keywordKinds.typeDeclaration);\n          var keywords = RegExp(keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other));\n          var nonTypeKeywords = keywordsToPattern(keywordKinds.typeDeclaration + ' ' + keywordKinds.contextual + ' ' + keywordKinds.other);\n          var nonContextualKeywords = keywordsToPattern(keywordKinds.type + ' ' + keywordKinds.typeDeclaration + ' ' + keywordKinds.other);\n          var generic = nested(/<(?:[^<>;=+\\-*/%&|^]|<<self>>)*>/.source, 2);\n          var nestedRound = nested(/\\((?:[^()]|<<self>>)*\\)/.source, 2);\n          var name = /@?\\b[A-Za-z_]\\w*\\b/.source;\n          var genericName = replace(/<<0>>(?:\\s*<<1>>)?/.source, [\n            name,\n            generic\n          ]);\n          var identifier = replace(/(?!<<0>>)<<1>>(?:\\s*\\.\\s*<<1>>)*/.source, [\n            nonTypeKeywords,\n            genericName\n          ]);\n          var array = /\\[\\s*(?:,\\s*)*\\]/.source;\n          var typeExpressionWithoutTuple = replace(/<<0>>(?:\\s*(?:\\?\\s*)?<<1>>)*(?:\\s*\\?)?/.source, [\n            identifier,\n            array\n          ]);\n          var tupleElement = replace(/[^,()<>[\\];=+\\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source, [\n            generic,\n            nestedRound,\n            array\n          ]);\n          var tuple = replace(/\\(<<0>>+(?:,<<0>>+)+\\)/.source, [tupleElement]);\n          var typeExpression = replace(/(?:<<0>>|<<1>>)(?:\\s*(?:\\?\\s*)?<<2>>)*(?:\\s*\\?)?/.source, [\n            tuple,\n            identifier,\n            array\n          ]);\n          var typeInside = {\n            'keyword': keywords,\n            'punctuation': /[<>()?,.:[\\]]/\n          };\n          var character = /'(?:[^\\r\\n'\\\\]|\\\\.|\\\\[Uux][\\da-fA-F]{1,8})'/.source;\n          var regularString = /\"(?:\\\\.|[^\\\\\"\\r\\n])*\"/.source;\n          var verbatimString = /@\"(?:\"\"|\\\\[\\s\\S]|[^\\\\\"])*\"(?!\")/.source;\n          Prism.languages.csharp = Prism.languages.extend('clike', {\n            'string': [\n              {\n                pattern: re(/(^|[^$\\\\])<<0>>/.source, [verbatimString]),\n                lookbehind: true,\n                greedy: true\n              },\n              {\n                pattern: re(/(^|[^@$\\\\])<<0>>/.source, [regularString]),\n                lookbehind: true,\n                greedy: true\n              }\n            ],\n            'class-name': [\n              {\n                pattern: re(/(\\busing\\s+static\\s+)<<0>>(?=\\s*;)/.source, [identifier]),\n                lookbehind: true,\n                inside: typeInside\n              },\n              {\n                pattern: re(/(\\busing\\s+<<0>>\\s*=\\s*)<<1>>(?=\\s*;)/.source, [\n                  name,\n                  typeExpression\n                ]),\n                lookbehind: true,\n                inside: typeInside\n              },\n              {\n                pattern: re(/(\\busing\\s+)<<0>>(?=\\s*=)/.source, [name]),\n                lookbehind: true\n              },\n              {\n                pattern: re(/(\\b<<0>>\\s+)<<1>>/.source, [\n                  typeDeclarationKeywords,\n                  genericName\n                ]),\n                lookbehind: true,\n                inside: typeInside\n              },\n              {\n                pattern: re(/(\\bcatch\\s*\\(\\s*)<<0>>/.source, [identifier]),\n                lookbehind: true,\n                inside: typeInside\n              },\n              {\n                pattern: re(/(\\bwhere\\s+)<<0>>/.source, [name]),\n                lookbehind: true\n              },\n              {\n                pattern: re(/(\\b(?:is(?:\\s+not)?|as)\\s+)<<0>>/.source, [typeExpressionWithoutTuple]),\n                lookbehind: true,\n                inside: typeInside\n              },\n              {\n                pattern: re(/\\b<<0>>(?=\\s+(?!<<1>>|with\\s*\\{)<<2>>(?:\\s*[=,;:{)\\]]|\\s+(?:in|when)\\b))/.source, [\n                  typeExpression,\n                  nonContextualKeywords,\n                  name\n                ]),\n                inside: typeInside\n              }\n            ],\n            'keyword': keywords,\n            'number': /(?:\\b0(?:x[\\da-f_]*[\\da-f]|b[01_]*[01])|(?:\\B\\.\\d+(?:_+\\d+)*|\\b\\d+(?:_+\\d+)*(?:\\.\\d+(?:_+\\d+)*)?)(?:e[-+]?\\d+(?:_+\\d+)*)?)(?:[dflmu]|lu|ul)?\\b/i,\n            'operator': />>=?|<<=?|[-=]>|([-+&|])\\1|~|\\?\\?=?|[-+*/%&|^!=<>]=?/,\n            'punctuation': /\\?\\.?|::|[{}[\\];(),.:]/\n          });\n          Prism.languages.insertBefore('csharp', 'number', {\n            'range': {\n              pattern: /\\.\\./,\n              alias: 'operator'\n            }\n          });\n          Prism.languages.insertBefore('csharp', 'punctuation', {\n            'named-parameter': {\n              pattern: re(/([(,]\\s*)<<0>>(?=\\s*:)/.source, [name]),\n              lookbehind: true,\n              alias: 'punctuation'\n            }\n          });\n          Prism.languages.insertBefore('csharp', 'class-name', {\n            'namespace': {\n              pattern: re(/(\\b(?:namespace|using)\\s+)<<0>>(?:\\s*\\.\\s*<<0>>)*(?=\\s*[;{])/.source, [name]),\n              lookbehind: true,\n              inside: { 'punctuation': /\\./ }\n            },\n            'type-expression': {\n              pattern: re(/(\\b(?:default|sizeof|typeof)\\s*\\(\\s*(?!\\s))(?:[^()\\s]|\\s(?!\\s)|<<0>>)*(?=\\s*\\))/.source, [nestedRound]),\n              lookbehind: true,\n              alias: 'class-name',\n              inside: typeInside\n            },\n            'return-type': {\n              pattern: re(/<<0>>(?=\\s+(?:<<1>>\\s*(?:=>|[({]|\\.\\s*this\\s*\\[)|this\\s*\\[))/.source, [\n                typeExpression,\n                identifier\n              ]),\n              inside: typeInside,\n              alias: 'class-name'\n            },\n            'constructor-invocation': {\n              pattern: re(/(\\bnew\\s+)<<0>>(?=\\s*[[({])/.source, [typeExpression]),\n              lookbehind: true,\n              inside: typeInside,\n              alias: 'class-name'\n            },\n            'generic-method': {\n              pattern: re(/<<0>>\\s*<<1>>(?=\\s*\\()/.source, [\n                name,\n                generic\n              ]),\n              inside: {\n                'function': re(/^<<0>>/.source, [name]),\n                'generic': {\n                  pattern: RegExp(generic),\n                  alias: 'class-name',\n                  inside: typeInside\n                }\n              }\n            },\n            'type-list': {\n              pattern: re(/\\b((?:<<0>>\\s+<<1>>|record\\s+<<1>>\\s*<<5>>|where\\s+<<2>>)\\s*:\\s*)(?:<<3>>|<<4>>|<<1>>\\s*<<5>>|<<6>>)(?:\\s*,\\s*(?:<<3>>|<<4>>|<<6>>))*(?=\\s*(?:where|[{;]|=>|$))/.source, [\n                typeDeclarationKeywords,\n                genericName,\n                name,\n                typeExpression,\n                keywords.source,\n                nestedRound,\n                /\\bnew\\s*\\(\\s*\\)/.source\n              ]),\n              lookbehind: true,\n              inside: {\n                'record-arguments': {\n                  pattern: re(/(^(?!new\\s*\\()<<0>>\\s*)<<1>>/.source, [\n                    genericName,\n                    nestedRound\n                  ]),\n                  lookbehind: true,\n                  greedy: true,\n                  inside: Prism.languages.csharp\n                },\n                'keyword': keywords,\n                'class-name': {\n                  pattern: RegExp(typeExpression),\n                  greedy: true,\n                  inside: typeInside\n                },\n                'punctuation': /[,()]/\n              }\n            },\n            'preprocessor': {\n              pattern: /(^[\\t ]*)#.*/m,\n              lookbehind: true,\n              alias: 'property',\n              inside: {\n                'directive': {\n                  pattern: /(#)\\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\\b/,\n                  lookbehind: true,\n                  alias: 'keyword'\n                }\n              }\n            }\n          });\n          var regularStringOrCharacter = regularString + '|' + character;\n          var regularStringCharacterOrComment = replace(/\\/(?![*/])|\\/\\/[^\\r\\n]*[\\r\\n]|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>/.source, [regularStringOrCharacter]);\n          var roundExpression = nested(replace(/[^\"'/()]|<<0>>|\\(<<self>>*\\)/.source, [regularStringCharacterOrComment]), 2);\n          var attrTarget = /\\b(?:assembly|event|field|method|module|param|property|return|type)\\b/.source;\n          var attr = replace(/<<0>>(?:\\s*\\(<<1>>*\\))?/.source, [\n            identifier,\n            roundExpression\n          ]);\n          Prism.languages.insertBefore('csharp', 'class-name', {\n            'attribute': {\n              pattern: re(/((?:^|[^\\s\\w>)?])\\s*\\[\\s*)(?:<<0>>\\s*:\\s*)?<<1>>(?:\\s*,\\s*<<1>>)*(?=\\s*\\])/.source, [\n                attrTarget,\n                attr\n              ]),\n              lookbehind: true,\n              greedy: true,\n              inside: {\n                'target': {\n                  pattern: re(/^<<0>>(?=\\s*:)/.source, [attrTarget]),\n                  alias: 'keyword'\n                },\n                'attribute-arguments': {\n                  pattern: re(/\\(<<0>>*\\)/.source, [roundExpression]),\n                  inside: Prism.languages.csharp\n                },\n                'class-name': {\n                  pattern: RegExp(identifier),\n                  inside: { 'punctuation': /\\./ }\n                },\n                'punctuation': /[:,]/\n              }\n            }\n          });\n          var formatString = /:[^}\\r\\n]+/.source;\n          var mInterpolationRound = nested(replace(/[^\"'/()]|<<0>>|\\(<<self>>*\\)/.source, [regularStringCharacterOrComment]), 2);\n          var mInterpolation = replace(/\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}/.source, [\n            mInterpolationRound,\n            formatString\n          ]);\n          var sInterpolationRound = nested(replace(/[^\"'/()]|\\/(?!\\*)|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|<<0>>|\\(<<self>>*\\)/.source, [regularStringOrCharacter]), 2);\n          var sInterpolation = replace(/\\{(?!\\{)(?:(?![}:])<<0>>)*<<1>>?\\}/.source, [\n            sInterpolationRound,\n            formatString\n          ]);\n          function createInterpolationInside(interpolation, interpolationRound) {\n            return {\n              'interpolation': {\n                pattern: re(/((?:^|[^{])(?:\\{\\{)*)<<0>>/.source, [interpolation]),\n                lookbehind: true,\n                inside: {\n                  'format-string': {\n                    pattern: re(/(^\\{(?:(?![}:])<<0>>)*)<<1>>(?=\\}$)/.source, [\n                      interpolationRound,\n                      formatString\n                    ]),\n                    lookbehind: true,\n                    inside: { 'punctuation': /^:/ }\n                  },\n                  'punctuation': /^\\{|\\}$/,\n                  'expression': {\n                    pattern: /[\\s\\S]+/,\n                    alias: 'language-csharp',\n                    inside: Prism.languages.csharp\n                  }\n                }\n              },\n              'string': /[\\s\\S]+/\n            };\n          }\n          Prism.languages.insertBefore('csharp', 'string', {\n            'interpolation-string': [\n              {\n                pattern: re(/(^|[^\\\\])(?:\\$@|@\\$)\"(?:\"\"|\\\\[\\s\\S]|\\{\\{|<<0>>|[^\\\\{\"])*\"/.source, [mInterpolation]),\n                lookbehind: true,\n                greedy: true,\n                inside: createInterpolationInside(mInterpolation, mInterpolationRound)\n              },\n              {\n                pattern: re(/(^|[^@\\\\])\\$\"(?:\\\\.|\\{\\{|<<0>>|[^\\\\\"{])*\"/.source, [sInterpolation]),\n                lookbehind: true,\n                greedy: true,\n                inside: createInterpolationInside(sInterpolation, sInterpolationRound)\n              }\n            ],\n            'char': {\n              pattern: RegExp(character),\n              greedy: true\n            }\n          });\n          Prism.languages.dotnet = Prism.languages.cs = Prism.languages.csharp;\n        }(Prism));\n        (function (Prism) {\n          var string = /(?:\"(?:\\\\(?:\\r\\n|[\\s\\S])|[^\"\\\\\\r\\n])*\"|'(?:\\\\(?:\\r\\n|[\\s\\S])|[^'\\\\\\r\\n])*')/;\n          Prism.languages.css = {\n            'comment': /\\/\\*[\\s\\S]*?\\*\\//,\n            'atrule': {\n              pattern: RegExp('@[\\\\w-](?:' + /[^;{\\s\"']|\\s+(?!\\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\\s*\\{))/.source),\n              inside: {\n                'rule': /^@[\\w-]+/,\n                'selector-function-argument': {\n                  pattern: /(\\bselector\\s*\\(\\s*(?![\\s)]))(?:[^()\\s]|\\s+(?![\\s)])|\\((?:[^()]|\\([^()]*\\))*\\))+(?=\\s*\\))/,\n                  lookbehind: true,\n                  alias: 'selector'\n                },\n                'keyword': {\n                  pattern: /(^|[^\\w-])(?:and|not|only|or)(?![\\w-])/,\n                  lookbehind: true\n                }\n              }\n            },\n            'url': {\n              pattern: RegExp('\\\\burl\\\\((?:' + string.source + '|' + /(?:[^\\\\\\r\\n()\"']|\\\\[\\s\\S])*/.source + ')\\\\)', 'i'),\n              greedy: true,\n              inside: {\n                'function': /^url/i,\n                'punctuation': /^\\(|\\)$/,\n                'string': {\n                  pattern: RegExp('^' + string.source + '$'),\n                  alias: 'url'\n                }\n              }\n            },\n            'selector': {\n              pattern: RegExp('(^|[{}\\\\s])[^{}\\\\s](?:[^{};\"\\'\\\\s]|\\\\s+(?![\\\\s{])|' + string.source + ')*(?=\\\\s*\\\\{)'),\n              lookbehind: true\n            },\n            'string': {\n              pattern: string,\n              greedy: true\n            },\n            'property': {\n              pattern: /(^|[^-\\w\\xA0-\\uFFFF])(?!\\s)[-_a-z\\xA0-\\uFFFF](?:(?!\\s)[-\\w\\xA0-\\uFFFF])*(?=\\s*:)/i,\n              lookbehind: true\n            },\n            'important': /!important\\b/i,\n            'function': {\n              pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\\()/i,\n              lookbehind: true\n            },\n            'punctuation': /[(){};:,]/\n          };\n          Prism.languages.css['atrule'].inside.rest = Prism.languages.css;\n          var markup = Prism.languages.markup;\n          if (markup) {\n            markup.tag.addInlined('style', 'css');\n            markup.tag.addAttribute('style', 'css');\n          }\n        }(Prism));\n        (function (Prism) {\n          var keywords = /\\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\\s*[(){}[\\]<>=%~.:,;?+\\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\\b/;\n          var classNamePrefix = /(?:[a-z]\\w*\\s*\\.\\s*)*(?:[A-Z]\\w*\\s*\\.\\s*)*/.source;\n          var className = {\n            pattern: RegExp(/(^|[^\\w.])/.source + classNamePrefix + /[A-Z](?:[\\d_A-Z]*[a-z]\\w*)?\\b/.source),\n            lookbehind: true,\n            inside: {\n              'namespace': {\n                pattern: /^[a-z]\\w*(?:\\s*\\.\\s*[a-z]\\w*)*(?:\\s*\\.)?/,\n                inside: { 'punctuation': /\\./ }\n              },\n              'punctuation': /\\./\n            }\n          };\n          Prism.languages.java = Prism.languages.extend('clike', {\n            'string': {\n              pattern: /(^|[^\\\\])\"(?:\\\\.|[^\"\\\\\\r\\n])*\"/,\n              lookbehind: true,\n              greedy: true\n            },\n            'class-name': [\n              className,\n              {\n                pattern: RegExp(/(^|[^\\w.])/.source + classNamePrefix + /[A-Z]\\w*(?=\\s+\\w+\\s*[;,=()]|\\s*(?:\\[[\\s,]*\\]\\s*)?::\\s*new\\b)/.source),\n                lookbehind: true,\n                inside: className.inside\n              },\n              {\n                pattern: RegExp(/(\\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\\s+)/.source + classNamePrefix + /[A-Z]\\w*\\b/.source),\n                lookbehind: true,\n                inside: className.inside\n              }\n            ],\n            'keyword': keywords,\n            'function': [\n              Prism.languages.clike.function,\n              {\n                pattern: /(::\\s*)[a-z_]\\w*/,\n                lookbehind: true\n              }\n            ],\n            'number': /\\b0b[01][01_]*L?\\b|\\b0x(?:\\.[\\da-f_p+-]+|[\\da-f_]+(?:\\.[\\da-f_p+-]+)?)\\b|(?:\\b\\d[\\d_]*(?:\\.[\\d_]*)?|\\B\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[dfl]?/i,\n            'operator': {\n              pattern: /(^|[^.])(?:<<=?|>>>?=?|->|--|\\+\\+|&&|\\|\\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,\n              lookbehind: true\n            },\n            'constant': /\\b[A-Z][A-Z_\\d]+\\b/\n          });\n          Prism.languages.insertBefore('java', 'string', {\n            'triple-quoted-string': {\n              pattern: /\"\"\"[ \\t]*[\\r\\n](?:(?:\"|\"\")?(?:\\\\.|[^\"\\\\]))*\"\"\"/,\n              greedy: true,\n              alias: 'string'\n            },\n            'char': {\n              pattern: /'(?:\\\\.|[^'\\\\\\r\\n]){1,6}'/,\n              greedy: true\n            }\n          });\n          Prism.languages.insertBefore('java', 'class-name', {\n            'annotation': {\n              pattern: /(^|[^.])@\\w+(?:\\s*\\.\\s*\\w+)*/,\n              lookbehind: true,\n              alias: 'punctuation'\n            },\n            'generics': {\n              pattern: /<(?:[\\w\\s,.?]|&(?!&)|<(?:[\\w\\s,.?]|&(?!&)|<(?:[\\w\\s,.?]|&(?!&)|<(?:[\\w\\s,.?]|&(?!&))*>)*>)*>)*>/,\n              inside: {\n                'class-name': className,\n                'keyword': keywords,\n                'punctuation': /[<>(),.:]/,\n                'operator': /[?&|]/\n              }\n            },\n            'import': [\n              {\n                pattern: RegExp(/(\\bimport\\s+)/.source + classNamePrefix + /(?:[A-Z]\\w*|\\*)(?=\\s*;)/.source),\n                lookbehind: true,\n                inside: {\n                  'namespace': className.inside.namespace,\n                  'punctuation': /\\./,\n                  'operator': /\\*/,\n                  'class-name': /\\w+/\n                }\n              },\n              {\n                pattern: RegExp(/(\\bimport\\s+static\\s+)/.source + classNamePrefix + /(?:\\w+|\\*)(?=\\s*;)/.source),\n                lookbehind: true,\n                alias: 'static',\n                inside: {\n                  'namespace': className.inside.namespace,\n                  'static': /\\b\\w+$/,\n                  'punctuation': /\\./,\n                  'operator': /\\*/,\n                  'class-name': /\\w+/\n                }\n              }\n            ],\n            'namespace': {\n              pattern: RegExp(/(\\b(?:exports|import(?:\\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\\s+)(?!<keyword>)[a-z]\\w*(?:\\.[a-z]\\w*)*\\.?/.source.replace(/<keyword>/g, function () {\n                return keywords.source;\n              })),\n              lookbehind: true,\n              inside: { 'punctuation': /\\./ }\n            }\n          });\n        }(Prism));\n        Prism.languages.javascript = Prism.languages.extend('clike', {\n          'class-name': [\n            Prism.languages.clike['class-name'],\n            {\n              pattern: /(^|[^$\\w\\xA0-\\uFFFF])(?!\\s)[_$A-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\.(?:constructor|prototype))/,\n              lookbehind: true\n            }\n          ],\n          'keyword': [\n            {\n              pattern: /((?:^|\\})\\s*)catch\\b/,\n              lookbehind: true\n            },\n            {\n              pattern: /(^|[^.]|\\.\\.\\.\\s*)\\b(?:as|assert(?=\\s*\\{)|async(?=\\s*(?:function\\b|\\(|[$\\w\\xA0-\\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\\s*(?:\\{|$))|for|from(?=\\s*(?:['\"]|$))|function|(?:get|set)(?=\\s*(?:[#\\[$\\w\\xA0-\\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\\b/,\n              lookbehind: true\n            }\n          ],\n          'function': /#?(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*(?:\\.\\s*(?:apply|bind|call)\\s*)?\\()/,\n          'number': {\n            pattern: RegExp(/(^|[^\\w$])/.source + '(?:' + (/NaN|Infinity/.source + '|' + /0[bB][01]+(?:_[01]+)*n?/.source + '|' + /0[oO][0-7]+(?:_[0-7]+)*n?/.source + '|' + /0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?/.source + '|' + /\\d+(?:_\\d+)*n/.source + '|' + /(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?/.source) + ')' + /(?![\\w$])/.source),\n            lookbehind: true\n          },\n          'operator': /--|\\+\\+|\\*\\*=?|=>|&&=?|\\|\\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\\.{3}|\\?\\?=?|\\?\\.?|[~:]/\n        });\n        Prism.languages.javascript['class-name'][0].pattern = /(\\b(?:class|extends|implements|instanceof|interface|new)\\s+)[\\w.\\\\]+/;\n        Prism.languages.insertBefore('javascript', 'keyword', {\n          'regex': {\n            pattern: RegExp(/((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/.source + /\\//.source + '(?:' + /(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}/.source + '|' + /(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source + ')' + /(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))/.source),\n            lookbehind: true,\n            greedy: true,\n            inside: {\n              'regex-source': {\n                pattern: /^(\\/)[\\s\\S]+(?=\\/[a-z]*$)/,\n                lookbehind: true,\n                alias: 'language-regex',\n                inside: Prism.languages.regex\n              },\n              'regex-delimiter': /^\\/|\\/$/,\n              'regex-flags': /^[a-z]+$/\n            }\n          },\n          'function-variable': {\n            pattern: /#?(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*[=:]\\s*(?:async\\s*)?(?:\\bfunction\\b|(?:\\((?:[^()]|\\([^()]*\\))*\\)|(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*)\\s*=>))/,\n            alias: 'function'\n          },\n          'parameter': [\n            {\n              pattern: /(function(?:\\s+(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*)?\\s*\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\))/,\n              lookbehind: true,\n              inside: Prism.languages.javascript\n            },\n            {\n              pattern: /(^|[^$\\w\\xA0-\\uFFFF])(?!\\s)[_$a-z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*=>)/i,\n              lookbehind: true,\n              inside: Prism.languages.javascript\n            },\n            {\n              pattern: /(\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\)\\s*=>)/,\n              lookbehind: true,\n              inside: Prism.languages.javascript\n            },\n            {\n              pattern: /((?:\\b|\\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\\w\\xA0-\\uFFFF]))(?:(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*\\s*)\\(\\s*|\\]\\s*\\(\\s*)(?!\\s)(?:[^()\\s]|\\s+(?![\\s)])|\\([^()]*\\))+(?=\\s*\\)\\s*\\{)/,\n              lookbehind: true,\n              inside: Prism.languages.javascript\n            }\n          ],\n          'constant': /\\b[A-Z](?:[A-Z_]|\\dx?)*\\b/\n        });\n        Prism.languages.insertBefore('javascript', 'string', {\n          'hashbang': {\n            pattern: /^#!.*/,\n            greedy: true,\n            alias: 'comment'\n          },\n          'template-string': {\n            pattern: /`(?:\\\\[\\s\\S]|\\$\\{(?:[^{}]|\\{(?:[^{}]|\\{[^}]*\\})*\\})+\\}|(?!\\$\\{)[^\\\\`])*`/,\n            greedy: true,\n            inside: {\n              'template-punctuation': {\n                pattern: /^`|`$/,\n                alias: 'string'\n              },\n              'interpolation': {\n                pattern: /((?:^|[^\\\\])(?:\\\\{2})*)\\$\\{(?:[^{}]|\\{(?:[^{}]|\\{[^}]*\\})*\\})+\\}/,\n                lookbehind: true,\n                inside: {\n                  'interpolation-punctuation': {\n                    pattern: /^\\$\\{|\\}$/,\n                    alias: 'punctuation'\n                  },\n                  rest: Prism.languages.javascript\n                }\n              },\n              'string': /[\\s\\S]+/\n            }\n          },\n          'string-property': {\n            pattern: /((?:^|[,{])[ \\t]*)([\"'])(?:\\\\(?:\\r\\n|[\\s\\S])|(?!\\2)[^\\\\\\r\\n])*\\2(?=\\s*:)/m,\n            lookbehind: true,\n            greedy: true,\n            alias: 'property'\n          }\n        });\n        Prism.languages.insertBefore('javascript', 'operator', {\n          'literal-property': {\n            pattern: /((?:^|[,{])[ \\t]*)(?!\\s)[_$a-zA-Z\\xA0-\\uFFFF](?:(?!\\s)[$\\w\\xA0-\\uFFFF])*(?=\\s*:)/m,\n            lookbehind: true,\n            alias: 'property'\n          }\n        });\n        if (Prism.languages.markup) {\n          Prism.languages.markup.tag.addInlined('script', 'javascript');\n          Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source, 'javascript');\n        }\n        Prism.languages.js = Prism.languages.javascript;\n        Prism.languages.markup = {\n          'comment': {\n            pattern: /<!--(?:(?!<!--)[\\s\\S])*?-->/,\n            greedy: true\n          },\n          'prolog': {\n            pattern: /<\\?[\\s\\S]+?\\?>/,\n            greedy: true\n          },\n          'doctype': {\n            pattern: /<!DOCTYPE(?:[^>\"'[\\]]|\"[^\"]*\"|'[^']*')+(?:\\[(?:[^<\"'\\]]|\"[^\"]*\"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\\]\\s*)?>/i,\n            greedy: true,\n            inside: {\n              'internal-subset': {\n                pattern: /(^[^\\[]*\\[)[\\s\\S]+(?=\\]>$)/,\n                lookbehind: true,\n                greedy: true,\n                inside: null\n              },\n              'string': {\n                pattern: /\"[^\"]*\"|'[^']*'/,\n                greedy: true\n              },\n              'punctuation': /^<!|>$|[[\\]]/,\n              'doctype-tag': /^DOCTYPE/i,\n              'name': /[^\\s<>'\"]+/\n            }\n          },\n          'cdata': {\n            pattern: /<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,\n            greedy: true\n          },\n          'tag': {\n            pattern: /<\\/?(?!\\d)[^\\s>\\/=$<%]+(?:\\s(?:\\s*[^\\s>\\/=]+(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))|(?=[\\s/>])))+)?\\s*\\/?>/,\n            greedy: true,\n            inside: {\n              'tag': {\n                pattern: /^<\\/?[^\\s>\\/]+/,\n                inside: {\n                  'punctuation': /^<\\/?/,\n                  'namespace': /^[^\\s>\\/:]+:/\n                }\n              },\n              'special-attr': [],\n              'attr-value': {\n                pattern: /=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+)/,\n                inside: {\n                  'punctuation': [\n                    {\n                      pattern: /^=/,\n                      alias: 'attr-equals'\n                    },\n                    {\n                      pattern: /^(\\s*)[\"']|[\"']$/,\n                      lookbehind: true\n                    }\n                  ]\n                }\n              },\n              'punctuation': /\\/?>/,\n              'attr-name': {\n                pattern: /[^\\s>\\/]+/,\n                inside: { 'namespace': /^[^\\s>\\/:]+:/ }\n              }\n            }\n          },\n          'entity': [\n            {\n              pattern: /&[\\da-z]{1,8};/i,\n              alias: 'named-entity'\n            },\n            /&#x?[\\da-f]{1,8};/i\n          ]\n        };\n        Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];\n        Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;\n        Prism.hooks.add('wrap', function (env) {\n          if (env.type === 'entity') {\n            env.attributes['title'] = env.content.replace(/&amp;/, '&');\n          }\n        });\n        Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {\n          value: function addInlined(tagName, lang) {\n            var includedCdataInside = {};\n            includedCdataInside['language-' + lang] = {\n              pattern: /(^<!\\[CDATA\\[)[\\s\\S]+?(?=\\]\\]>$)/i,\n              lookbehind: true,\n              inside: Prism.languages[lang]\n            };\n            includedCdataInside['cdata'] = /^<!\\[CDATA\\[|\\]\\]>$/i;\n            var inside = {\n              'included-cdata': {\n                pattern: /<!\\[CDATA\\[[\\s\\S]*?\\]\\]>/i,\n                inside: includedCdataInside\n              }\n            };\n            inside['language-' + lang] = {\n              pattern: /[\\s\\S]+/,\n              inside: Prism.languages[lang]\n            };\n            var def = {};\n            def[tagName] = {\n              pattern: RegExp(/(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)/.source.replace(/__/g, function () {\n                return tagName;\n              }), 'i'),\n              lookbehind: true,\n              greedy: true,\n              inside: inside\n            };\n            Prism.languages.insertBefore('markup', 'cdata', def);\n          }\n        });\n        Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {\n          value: function (attrName, lang) {\n            Prism.languages.markup.tag.inside['special-attr'].push({\n              pattern: RegExp(/(^|[\"'\\s])/.source + '(?:' + attrName + ')' + /\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))/.source, 'i'),\n              lookbehind: true,\n              inside: {\n                'attr-name': /^[^\\s=]+/,\n                'attr-value': {\n                  pattern: /=[\\s\\S]+/,\n                  inside: {\n                    'value': {\n                      pattern: /(^=\\s*([\"']|(?![\"'])))\\S[\\s\\S]*(?=\\2$)/,\n                      lookbehind: true,\n                      alias: [\n                        lang,\n                        'language-' + lang\n                      ],\n                      inside: Prism.languages[lang]\n                    },\n                    'punctuation': [\n                      {\n                        pattern: /^=/,\n                        alias: 'attr-equals'\n                      },\n                      /\"|'/\n                    ]\n                  }\n                }\n              }\n            });\n          }\n        });\n        Prism.languages.html = Prism.languages.markup;\n        Prism.languages.mathml = Prism.languages.markup;\n        Prism.languages.svg = Prism.languages.markup;\n        Prism.languages.xml = Prism.languages.extend('markup', {});\n        Prism.languages.ssml = Prism.languages.xml;\n        Prism.languages.atom = Prism.languages.xml;\n        Prism.languages.rss = Prism.languages.xml;\n        (function (Prism) {\n          var comment = /\\/\\*[\\s\\S]*?\\*\\/|\\/\\/.*|#(?!\\[).*/;\n          var constant = [\n            {\n              pattern: /\\b(?:false|true)\\b/i,\n              alias: 'boolean'\n            },\n            {\n              pattern: /(::\\s*)\\b[a-z_]\\w*\\b(?!\\s*\\()/i,\n              greedy: true,\n              lookbehind: true\n            },\n            {\n              pattern: /(\\b(?:case|const)\\s+)\\b[a-z_]\\w*(?=\\s*[;=])/i,\n              greedy: true,\n              lookbehind: true\n            },\n            /\\b(?:null)\\b/i,\n            /\\b[A-Z_][A-Z0-9_]*\\b(?!\\s*\\()/\n          ];\n          var number = /\\b0b[01]+(?:_[01]+)*\\b|\\b0o[0-7]+(?:_[0-7]+)*\\b|\\b0x[\\da-f]+(?:_[\\da-f]+)*\\b|(?:\\b\\d+(?:_\\d+)*\\.?(?:\\d+(?:_\\d+)*)?|\\B\\.\\d+)(?:e[+-]?\\d+)?/i;\n          var operator = /<?=>|\\?\\?=?|\\.{3}|\\??->|[!=]=?=?|::|\\*\\*=?|--|\\+\\+|&&|\\|\\||<<|>>|[?~]|[/^|%*&<>.+-]=?/;\n          var punctuation = /[{}\\[\\](),:;]/;\n          Prism.languages.php = {\n            'delimiter': {\n              pattern: /\\?>$|^<\\?(?:php(?=\\s)|=)?/i,\n              alias: 'important'\n            },\n            'comment': comment,\n            'variable': /\\$+(?:\\w+\\b|(?=\\{))/,\n            'package': {\n              pattern: /(namespace\\s+|use\\s+(?:function\\s+)?)(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,\n              lookbehind: true,\n              inside: { 'punctuation': /\\\\/ }\n            },\n            'class-name-definition': {\n              pattern: /(\\b(?:class|enum|interface|trait)\\s+)\\b[a-z_]\\w*(?!\\\\)\\b/i,\n              lookbehind: true,\n              alias: 'class-name'\n            },\n            'function-definition': {\n              pattern: /(\\bfunction\\s+)[a-z_]\\w*(?=\\s*\\()/i,\n              lookbehind: true,\n              alias: 'function'\n            },\n            'keyword': [\n              {\n                pattern: /(\\(\\s*)\\b(?:array|bool|boolean|float|int|integer|object|string)\\b(?=\\s*\\))/i,\n                alias: 'type-casting',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /([(,?]\\s*)\\b(?:array(?!\\s*\\()|bool|callable|(?:false|null)(?=\\s*\\|)|float|int|iterable|mixed|object|self|static|string)\\b(?=\\s*\\$)/i,\n                alias: 'type-hint',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /(\\)\\s*:\\s*(?:\\?\\s*)?)\\b(?:array(?!\\s*\\()|bool|callable|(?:false|null)(?=\\s*\\|)|float|int|iterable|mixed|never|object|self|static|string|void)\\b/i,\n                alias: 'return-type',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /\\b(?:array(?!\\s*\\()|bool|float|int|iterable|mixed|object|string|void)\\b/i,\n                alias: 'type-declaration',\n                greedy: true\n              },\n              {\n                pattern: /(\\|\\s*)(?:false|null)\\b|\\b(?:false|null)(?=\\s*\\|)/i,\n                alias: 'type-declaration',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /\\b(?:parent|self|static)(?=\\s*::)/i,\n                alias: 'static-context',\n                greedy: true\n              },\n              {\n                pattern: /(\\byield\\s+)from\\b/i,\n                lookbehind: true\n              },\n              /\\bclass\\b/i,\n              {\n                pattern: /((?:^|[^\\s>:]|(?:^|[^-])>|(?:^|[^:]):)\\s*)\\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\\b/i,\n                lookbehind: true\n              }\n            ],\n            'argument-name': {\n              pattern: /([(,]\\s*)\\b[a-z_]\\w*(?=\\s*:(?!:))/i,\n              lookbehind: true\n            },\n            'class-name': [\n              {\n                pattern: /(\\b(?:extends|implements|instanceof|new(?!\\s+self|\\s+static))\\s+|\\bcatch\\s*\\()\\b[a-z_]\\w*(?!\\\\)\\b/i,\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /(\\|\\s*)\\b[a-z_]\\w*(?!\\\\)\\b/i,\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /\\b[a-z_]\\w*(?!\\\\)\\b(?=\\s*\\|)/i,\n                greedy: true\n              },\n              {\n                pattern: /(\\|\\s*)(?:\\\\?\\b[a-z_]\\w*)+\\b/i,\n                alias: 'class-name-fully-qualified',\n                greedy: true,\n                lookbehind: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /(?:\\\\?\\b[a-z_]\\w*)+\\b(?=\\s*\\|)/i,\n                alias: 'class-name-fully-qualified',\n                greedy: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /(\\b(?:extends|implements|instanceof|new(?!\\s+self\\b|\\s+static\\b))\\s+|\\bcatch\\s*\\()(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,\n                alias: 'class-name-fully-qualified',\n                greedy: true,\n                lookbehind: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /\\b[a-z_]\\w*(?=\\s*\\$)/i,\n                alias: 'type-declaration',\n                greedy: true\n              },\n              {\n                pattern: /(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*\\$)/i,\n                alias: [\n                  'class-name-fully-qualified',\n                  'type-declaration'\n                ],\n                greedy: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /\\b[a-z_]\\w*(?=\\s*::)/i,\n                alias: 'static-context',\n                greedy: true\n              },\n              {\n                pattern: /(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*::)/i,\n                alias: [\n                  'class-name-fully-qualified',\n                  'static-context'\n                ],\n                greedy: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /([(,?]\\s*)[a-z_]\\w*(?=\\s*\\$)/i,\n                alias: 'type-hint',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /([(,?]\\s*)(?:\\\\?\\b[a-z_]\\w*)+(?=\\s*\\$)/i,\n                alias: [\n                  'class-name-fully-qualified',\n                  'type-hint'\n                ],\n                greedy: true,\n                lookbehind: true,\n                inside: { 'punctuation': /\\\\/ }\n              },\n              {\n                pattern: /(\\)\\s*:\\s*(?:\\?\\s*)?)\\b[a-z_]\\w*(?!\\\\)\\b/i,\n                alias: 'return-type',\n                greedy: true,\n                lookbehind: true\n              },\n              {\n                pattern: /(\\)\\s*:\\s*(?:\\?\\s*)?)(?:\\\\?\\b[a-z_]\\w*)+\\b(?!\\\\)/i,\n                alias: [\n                  'class-name-fully-qualified',\n                  'return-type'\n                ],\n                greedy: true,\n                lookbehind: true,\n                inside: { 'punctuation': /\\\\/ }\n              }\n            ],\n            'constant': constant,\n            'function': {\n              pattern: /(^|[^\\\\\\w])\\\\?[a-z_](?:[\\w\\\\]*\\w)?(?=\\s*\\()/i,\n              lookbehind: true,\n              inside: { 'punctuation': /\\\\/ }\n            },\n            'property': {\n              pattern: /(->\\s*)\\w+/,\n              lookbehind: true\n            },\n            'number': number,\n            'operator': operator,\n            'punctuation': punctuation\n          };\n          var string_interpolation = {\n            pattern: /\\{\\$(?:\\{(?:\\{[^{}]+\\}|[^{}]+)\\}|[^{}])+\\}|(^|[^\\\\{])\\$+(?:\\w+(?:\\[[^\\r\\n\\[\\]]+\\]|->\\w+)?)/,\n            lookbehind: true,\n            inside: Prism.languages.php\n          };\n          var string = [\n            {\n              pattern: /<<<'([^']+)'[\\r\\n](?:.*[\\r\\n])*?\\1;/,\n              alias: 'nowdoc-string',\n              greedy: true,\n              inside: {\n                'delimiter': {\n                  pattern: /^<<<'[^']+'|[a-z_]\\w*;$/i,\n                  alias: 'symbol',\n                  inside: { 'punctuation': /^<<<'?|[';]$/ }\n                }\n              }\n            },\n            {\n              pattern: /<<<(?:\"([^\"]+)\"[\\r\\n](?:.*[\\r\\n])*?\\1;|([a-z_]\\w*)[\\r\\n](?:.*[\\r\\n])*?\\2;)/i,\n              alias: 'heredoc-string',\n              greedy: true,\n              inside: {\n                'delimiter': {\n                  pattern: /^<<<(?:\"[^\"]+\"|[a-z_]\\w*)|[a-z_]\\w*;$/i,\n                  alias: 'symbol',\n                  inside: { 'punctuation': /^<<<\"?|[\";]$/ }\n                },\n                'interpolation': string_interpolation\n              }\n            },\n            {\n              pattern: /`(?:\\\\[\\s\\S]|[^\\\\`])*`/,\n              alias: 'backtick-quoted-string',\n              greedy: true\n            },\n            {\n              pattern: /'(?:\\\\[\\s\\S]|[^\\\\'])*'/,\n              alias: 'single-quoted-string',\n              greedy: true\n            },\n            {\n              pattern: /\"(?:\\\\[\\s\\S]|[^\\\\\"])*\"/,\n              alias: 'double-quoted-string',\n              greedy: true,\n              inside: { 'interpolation': string_interpolation }\n            }\n          ];\n          Prism.languages.insertBefore('php', 'variable', {\n            'string': string,\n            'attribute': {\n              pattern: /#\\[(?:[^\"'\\/#]|\\/(?![*/])|\\/\\/.*$|#(?!\\[).*$|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/|\"(?:\\\\[\\s\\S]|[^\\\\\"])*\"|'(?:\\\\[\\s\\S]|[^\\\\'])*')+\\](?=\\s*[a-z$#])/im,\n              greedy: true,\n              inside: {\n                'attribute-content': {\n                  pattern: /^(#\\[)[\\s\\S]+(?=\\]$)/,\n                  lookbehind: true,\n                  inside: {\n                    'comment': comment,\n                    'string': string,\n                    'attribute-class-name': [\n                      {\n                        pattern: /([^:]|^)\\b[a-z_]\\w*(?!\\\\)\\b/i,\n                        alias: 'class-name',\n                        greedy: true,\n                        lookbehind: true\n                      },\n                      {\n                        pattern: /([^:]|^)(?:\\\\?\\b[a-z_]\\w*)+/i,\n                        alias: [\n                          'class-name',\n                          'class-name-fully-qualified'\n                        ],\n                        greedy: true,\n                        lookbehind: true,\n                        inside: { 'punctuation': /\\\\/ }\n                      }\n                    ],\n                    'constant': constant,\n                    'number': number,\n                    'operator': operator,\n                    'punctuation': punctuation\n                  }\n                },\n                'delimiter': {\n                  pattern: /^#\\[|\\]$/,\n                  alias: 'punctuation'\n                }\n              }\n            }\n          });\n          Prism.hooks.add('before-tokenize', function (env) {\n            if (!/<\\?/.test(env.code)) {\n              return;\n            }\n            var phpPattern = /<\\?(?:[^\"'/#]|\\/(?![*/])|(\"|')(?:\\\\[\\s\\S]|(?!\\1)[^\\\\])*\\1|(?:\\/\\/|#(?!\\[))(?:[^?\\n\\r]|\\?(?!>))*(?=$|\\?>|[\\r\\n])|#\\[|\\/\\*(?:[^*]|\\*(?!\\/))*(?:\\*\\/|$))*?(?:\\?>|$)/g;\n            Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);\n          });\n          Prism.hooks.add('after-tokenize', function (env) {\n            Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');\n          });\n        }(Prism));\n        Prism.languages.python = {\n          'comment': {\n            pattern: /(^|[^\\\\])#.*/,\n            lookbehind: true,\n            greedy: true\n          },\n          'string-interpolation': {\n            pattern: /(?:f|fr|rf)(?:(\"\"\"|''')[\\s\\S]*?\\1|(\"|')(?:\\\\.|(?!\\2)[^\\\\\\r\\n])*\\2)/i,\n            greedy: true,\n            inside: {\n              'interpolation': {\n                pattern: /((?:^|[^{])(?:\\{\\{)*)\\{(?!\\{)(?:[^{}]|\\{(?!\\{)(?:[^{}]|\\{(?!\\{)(?:[^{}])+\\})+\\})+\\}/,\n                lookbehind: true,\n                inside: {\n                  'format-spec': {\n                    pattern: /(:)[^:(){}]+(?=\\}$)/,\n                    lookbehind: true\n                  },\n                  'conversion-option': {\n                    pattern: /![sra](?=[:}]$)/,\n                    alias: 'punctuation'\n                  },\n                  rest: null\n                }\n              },\n              'string': /[\\s\\S]+/\n            }\n          },\n          'triple-quoted-string': {\n            pattern: /(?:[rub]|br|rb)?(\"\"\"|''')[\\s\\S]*?\\1/i,\n            greedy: true,\n            alias: 'string'\n          },\n          'string': {\n            pattern: /(?:[rub]|br|rb)?(\"|')(?:\\\\.|(?!\\1)[^\\\\\\r\\n])*\\1/i,\n            greedy: true\n          },\n          'function': {\n            pattern: /((?:^|\\s)def[ \\t]+)[a-zA-Z_]\\w*(?=\\s*\\()/g,\n            lookbehind: true\n          },\n          'class-name': {\n            pattern: /(\\bclass\\s+)\\w+/i,\n            lookbehind: true\n          },\n          'decorator': {\n            pattern: /(^[\\t ]*)@\\w+(?:\\.\\w+)*/m,\n            lookbehind: true,\n            alias: [\n              'annotation',\n              'punctuation'\n            ],\n            inside: { 'punctuation': /\\./ }\n          },\n          'keyword': /\\b(?:_(?=\\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\\b/,\n          'builtin': /\\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\\b/,\n          'boolean': /\\b(?:False|None|True)\\b/,\n          'number': /\\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\\b|(?:\\b\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\B\\.\\d+(?:_\\d+)*)(?:e[+-]?\\d+(?:_\\d+)*)?j?(?!\\w)/i,\n          'operator': /[-+%=]=?|!=|:=|\\*\\*?=?|\\/\\/?=?|<[<=>]?|>[=>]?|[&|^~]/,\n          'punctuation': /[{}[\\];(),.:]/\n        };\n        Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;\n        Prism.languages.py = Prism.languages.python;\n        (function (Prism) {\n          Prism.languages.ruby = Prism.languages.extend('clike', {\n            'comment': {\n              pattern: /#.*|^=begin\\s[\\s\\S]*?^=end/m,\n              greedy: true\n            },\n            'class-name': {\n              pattern: /(\\b(?:class|module)\\s+|\\bcatch\\s+\\()[\\w.\\\\]+|\\b[A-Z_]\\w*(?=\\s*\\.\\s*new\\b)/,\n              lookbehind: true,\n              inside: { 'punctuation': /[.\\\\]/ }\n            },\n            'keyword': /\\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\\b/,\n            'operator': /\\.{2,3}|&\\.|===|<?=>|[!=]?~|(?:&&|\\|\\||<<|>>|\\*\\*|[+\\-*/%<>!^&|=])=?|[?:]/,\n            'punctuation': /[(){}[\\].,;]/\n          });\n          Prism.languages.insertBefore('ruby', 'operator', {\n            'double-colon': {\n              pattern: /::/,\n              alias: 'punctuation'\n            }\n          });\n          var interpolation = {\n            pattern: /((?:^|[^\\\\])(?:\\\\{2})*)#\\{(?:[^{}]|\\{[^{}]*\\})*\\}/,\n            lookbehind: true,\n            inside: {\n              'content': {\n                pattern: /^(#\\{)[\\s\\S]+(?=\\}$)/,\n                lookbehind: true,\n                inside: Prism.languages.ruby\n              },\n              'delimiter': {\n                pattern: /^#\\{|\\}$/,\n                alias: 'punctuation'\n              }\n            }\n          };\n          delete Prism.languages.ruby.function;\n          var percentExpression = '(?:' + [\n            /([^a-zA-Z0-9\\s{(\\[<=])(?:(?!\\1)[^\\\\]|\\\\[\\s\\S])*\\1/.source,\n            /\\((?:[^()\\\\]|\\\\[\\s\\S]|\\((?:[^()\\\\]|\\\\[\\s\\S])*\\))*\\)/.source,\n            /\\{(?:[^{}\\\\]|\\\\[\\s\\S]|\\{(?:[^{}\\\\]|\\\\[\\s\\S])*\\})*\\}/.source,\n            /\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S]|\\[(?:[^\\[\\]\\\\]|\\\\[\\s\\S])*\\])*\\]/.source,\n            /<(?:[^<>\\\\]|\\\\[\\s\\S]|<(?:[^<>\\\\]|\\\\[\\s\\S])*>)*>/.source\n          ].join('|') + ')';\n          var symbolName = /(?:\"(?:\\\\.|[^\"\\\\\\r\\n])*\"|(?:\\b[a-zA-Z_]\\w*|[^\\s\\0-\\x7F]+)[?!]?|\\$.)/.source;\n          Prism.languages.insertBefore('ruby', 'keyword', {\n            'regex-literal': [\n              {\n                pattern: RegExp(/%r/.source + percentExpression + /[egimnosux]{0,6}/.source),\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'regex': /[\\s\\S]+/\n                }\n              },\n              {\n                pattern: /(^|[^/])\\/(?!\\/)(?:\\[[^\\r\\n\\]]+\\]|\\\\.|[^[/\\\\\\r\\n])+\\/[egimnosux]{0,6}(?=\\s*(?:$|[\\r\\n,.;})#]))/,\n                lookbehind: true,\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'regex': /[\\s\\S]+/\n                }\n              }\n            ],\n            'variable': /[@$]+[a-zA-Z_]\\w*(?:[?!]|\\b)/,\n            'symbol': [\n              {\n                pattern: RegExp(/(^|[^:]):/.source + symbolName),\n                lookbehind: true,\n                greedy: true\n              },\n              {\n                pattern: RegExp(/([\\r\\n{(,][ \\t]*)/.source + symbolName + /(?=:(?!:))/.source),\n                lookbehind: true,\n                greedy: true\n              }\n            ],\n            'method-definition': {\n              pattern: /(\\bdef\\s+)\\w+(?:\\s*\\.\\s*\\w+)?/,\n              lookbehind: true,\n              inside: {\n                'function': /\\b\\w+$/,\n                'keyword': /^self\\b/,\n                'class-name': /^\\w+/,\n                'punctuation': /\\./\n              }\n            }\n          });\n          Prism.languages.insertBefore('ruby', 'string', {\n            'string-literal': [\n              {\n                pattern: RegExp(/%[qQiIwWs]?/.source + percentExpression),\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'string': /[\\s\\S]+/\n                }\n              },\n              {\n                pattern: /(\"|')(?:#\\{[^}]+\\}|#(?!\\{)|\\\\(?:\\r\\n|[\\s\\S])|(?!\\1)[^\\\\#\\r\\n])*\\1/,\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'string': /[\\s\\S]+/\n                }\n              },\n              {\n                pattern: /<<[-~]?([a-z_]\\w*)[\\r\\n](?:.*[\\r\\n])*?[\\t ]*\\1/i,\n                alias: 'heredoc-string',\n                greedy: true,\n                inside: {\n                  'delimiter': {\n                    pattern: /^<<[-~]?[a-z_]\\w*|\\b[a-z_]\\w*$/i,\n                    inside: {\n                      'symbol': /\\b\\w+/,\n                      'punctuation': /^<<[-~]?/\n                    }\n                  },\n                  'interpolation': interpolation,\n                  'string': /[\\s\\S]+/\n                }\n              },\n              {\n                pattern: /<<[-~]?'([a-z_]\\w*)'[\\r\\n](?:.*[\\r\\n])*?[\\t ]*\\1/i,\n                alias: 'heredoc-string',\n                greedy: true,\n                inside: {\n                  'delimiter': {\n                    pattern: /^<<[-~]?'[a-z_]\\w*'|\\b[a-z_]\\w*$/i,\n                    inside: {\n                      'symbol': /\\b\\w+/,\n                      'punctuation': /^<<[-~]?'|'$/\n                    }\n                  },\n                  'string': /[\\s\\S]+/\n                }\n              }\n            ],\n            'command-literal': [\n              {\n                pattern: RegExp(/%x/.source + percentExpression),\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'command': {\n                    pattern: /[\\s\\S]+/,\n                    alias: 'string'\n                  }\n                }\n              },\n              {\n                pattern: /`(?:#\\{[^}]+\\}|#(?!\\{)|\\\\(?:\\r\\n|[\\s\\S])|[^\\\\`#\\r\\n])*`/,\n                greedy: true,\n                inside: {\n                  'interpolation': interpolation,\n                  'command': {\n                    pattern: /[\\s\\S]+/,\n                    alias: 'string'\n                  }\n                }\n              }\n            ]\n          });\n          delete Prism.languages.ruby.string;\n          Prism.languages.insertBefore('ruby', 'number', {\n            'builtin': /\\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\\b/,\n            'constant': /\\b[A-Z][A-Z0-9_]*(?:[?!]|\\b)/\n          });\n          Prism.languages.rb = Prism.languages.ruby;\n        }(Prism));\n        var Prism$1 = prismCore.exports;\n        var prismjs = { boltExport: Prism$1 };\n        return prismjs;\n      }));\n      var prism = window.Prism;\n      window.Prism = oldprism;\n      return prism;\n    }(undefined, exports$1, module));\n    var Prism$1 = module.exports.boltExport;\n\n    var getLanguages$1 = function (editor) {\n      return editor.getParam('codesample_languages');\n    };\n    var useGlobalPrismJS = function (editor) {\n      return editor.getParam('codesample_global_prismjs', false, 'boolean');\n    };\n\n    var get = function (editor) {\n      return Global.Prism && useGlobalPrismJS(editor) ? Global.Prism : Prism$1;\n    };\n\n    var getSelectedCodeSample = function (editor) {\n      var node = editor.selection ? editor.selection.getNode() : null;\n      return someIf(isCodeSample(node), node);\n    };\n    var insertCodeSample = function (editor, language, code) {\n      editor.undoManager.transact(function () {\n        var node = getSelectedCodeSample(editor);\n        code = global$1.DOM.encode(code);\n        return node.fold(function () {\n          editor.insertContent('<pre id=\"__new\" class=\"language-' + language + '\">' + code + '</pre>');\n          editor.selection.select(editor.$('#__new').removeAttr('id')[0]);\n        }, function (n) {\n          editor.dom.setAttrib(n, 'class', 'language-' + language);\n          n.innerHTML = code;\n          get(editor).highlightElement(n);\n          editor.selection.select(n);\n        });\n      });\n    };\n    var getCurrentCode = function (editor) {\n      var node = getSelectedCodeSample(editor);\n      return node.fold(constant(''), function (n) {\n        return n.textContent;\n      });\n    };\n\n    var getLanguages = function (editor) {\n      var defaultLanguages = [\n        {\n          text: 'HTML/XML',\n          value: 'markup'\n        },\n        {\n          text: 'JavaScript',\n          value: 'javascript'\n        },\n        {\n          text: 'CSS',\n          value: 'css'\n        },\n        {\n          text: 'PHP',\n          value: 'php'\n        },\n        {\n          text: 'Ruby',\n          value: 'ruby'\n        },\n        {\n          text: 'Python',\n          value: 'python'\n        },\n        {\n          text: 'Java',\n          value: 'java'\n        },\n        {\n          text: 'C',\n          value: 'c'\n        },\n        {\n          text: 'C#',\n          value: 'csharp'\n        },\n        {\n          text: 'C++',\n          value: 'cpp'\n        }\n      ];\n      var customLanguages = getLanguages$1(editor);\n      return customLanguages ? customLanguages : defaultLanguages;\n    };\n    var getCurrentLanguage = function (editor, fallback) {\n      var node = getSelectedCodeSample(editor);\n      return node.fold(function () {\n        return fallback;\n      }, function (n) {\n        var matches = n.className.match(/language-(\\w+)/);\n        return matches ? matches[1] : fallback;\n      });\n    };\n\n    var open = function (editor) {\n      var languages = getLanguages(editor);\n      var defaultLanguage = head(languages).fold(constant(''), function (l) {\n        return l.value;\n      });\n      var currentLanguage = getCurrentLanguage(editor, defaultLanguage);\n      var currentCode = getCurrentCode(editor);\n      editor.windowManager.open({\n        title: 'Insert/Edit Code Sample',\n        size: 'large',\n        body: {\n          type: 'panel',\n          items: [\n            {\n              type: 'selectbox',\n              name: 'language',\n              label: 'Language',\n              items: languages\n            },\n            {\n              type: 'textarea',\n              name: 'code',\n              label: 'Code view'\n            }\n          ]\n        },\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: {\n          language: currentLanguage,\n          code: currentCode\n        },\n        onSubmit: function (api) {\n          var data = api.getData();\n          insertCodeSample(editor, data.language, data.code);\n          api.close();\n        }\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('codesample', function () {\n        var node = editor.selection.getNode();\n        if (editor.selection.isCollapsed() || isCodeSample(node)) {\n          open(editor);\n        } else {\n          editor.formatter.toggle('code');\n        }\n      });\n    };\n\n    var setup = function (editor) {\n      var $ = editor.$;\n      editor.on('PreProcess', function (e) {\n        $('pre[contenteditable=false]', e.node).filter(trimArg(isCodeSample)).each(function (idx, elm) {\n          var $elm = $(elm), code = elm.textContent;\n          $elm.attr('class', $.trim($elm.attr('class')));\n          $elm.removeAttr('contentEditable');\n          $elm.empty().append($('<code></code>').each(function () {\n            this.textContent = code;\n          }));\n        });\n      });\n      editor.on('SetContent', function () {\n        var unprocessedCodeSamples = $('pre').filter(trimArg(isCodeSample)).filter(function (idx, elm) {\n          return elm.contentEditable !== 'false';\n        });\n        if (unprocessedCodeSamples.length) {\n          editor.undoManager.transact(function () {\n            unprocessedCodeSamples.each(function (idx, elm) {\n              $(elm).find('br').each(function (idx, elm) {\n                elm.parentNode.replaceChild(editor.getDoc().createTextNode('\\n'), elm);\n              });\n              elm.contentEditable = 'false';\n              elm.innerHTML = editor.dom.encode(elm.textContent);\n              get(editor).highlightElement(elm);\n              elm.className = $.trim(elm.className);\n            });\n          });\n        }\n      });\n    };\n\n    var isCodeSampleSelection = function (editor) {\n      var node = editor.selection.getStart();\n      return editor.dom.is(node, 'pre[class*=\"language-\"]');\n    };\n    var register = function (editor) {\n      var onAction = function () {\n        return editor.execCommand('codesample');\n      };\n      editor.ui.registry.addToggleButton('codesample', {\n        icon: 'code-sample',\n        tooltip: 'Insert/edit code sample',\n        onAction: onAction,\n        onSetup: function (api) {\n          var nodeChangeHandler = function () {\n            api.setActive(isCodeSampleSelection(editor));\n          };\n          editor.on('NodeChange', nodeChangeHandler);\n          return function () {\n            return editor.off('NodeChange', nodeChangeHandler);\n          };\n        }\n      });\n      editor.ui.registry.addMenuItem('codesample', {\n        text: 'Code sample...',\n        icon: 'code-sample',\n        onAction: onAction\n      });\n    };\n\n    function Plugin () {\n      global$2.add('codesample', function (editor) {\n        setup(editor);\n        register(editor);\n        register$1(editor);\n        editor.on('dblclick', function (ev) {\n          if (isCodeSample(ev.target)) {\n            open(editor);\n          }\n        });\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/codesample/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/fullscreen/index.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/fullscreen/index.js ***!
  \**************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"fullscreen\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/fullscreen')\n//   ES2015:\n//     import 'tinymce/plugins/fullscreen'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/fullscreen/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/fullscreen/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/fullscreen/plugin.js":
/*!***************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/fullscreen/plugin.js ***!
  \***************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var get$5 = function (fullscreenState) {\n      return {\n        isFullscreen: function () {\n          return fullscreenState.get() !== null;\n        }\n      };\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var isString = isType$1('string');\n    var isArray = isType$1('array');\n    var isBoolean = isSimpleType('boolean');\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var compose = function (fa, fb) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return fa(fb.apply(null, args));\n      };\n    };\n    var compose1 = function (fbc, fab) {\n      return function (a) {\n        return fbc(fab(a));\n      };\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    function curry(fn) {\n      var initialArgs = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        initialArgs[_i - 1] = arguments[_i];\n      }\n      return function () {\n        var restArgs = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          restArgs[_i] = arguments[_i];\n        }\n        var all = initialArgs.concat(restArgs);\n        return fn.apply(null, all);\n      };\n    }\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var unbindable = function () {\n      return singleton(function (s) {\n        return s.unbind();\n      });\n    };\n    var value = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$1 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var filter$1 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find$1 = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind$3 = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n    var get$4 = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$4(xs, 0);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var keys = Object.keys;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n\n    var contains = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n\n    var isSupported$1 = function (dom) {\n      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n    };\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var DOCUMENT = 9;\n    var DOCUMENT_FRAGMENT = 11;\n    var ELEMENT = 1;\n    var TEXT = 3;\n\n    var type = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type(element) === t;\n      };\n    };\n    var isElement = isType(ELEMENT);\n    var isText = isType(TEXT);\n    var isDocument = isType(DOCUMENT);\n    var isDocumentFragment = isType(DOCUMENT_FRAGMENT);\n\n    var cached = function (f) {\n      var called = false;\n      var r;\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!called) {\n          called = true;\n          r = f.apply(null, args);\n        }\n        return r;\n      };\n    };\n\n    var DeviceType = function (os, browser, userAgent, mediaMatch) {\n      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n      var isiPhone = os.isiOS() && !isiPad;\n      var isMobile = os.isiOS() || os.isAndroid();\n      var isTouch = isMobile || mediaMatch('(pointer:coarse)');\n      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');\n      var isPhone = isiPhone || isMobile && !isTablet;\n      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n      var isDesktop = !isPhone && !isTablet && !iOSwebview;\n      return {\n        isiPad: constant(isiPad),\n        isiPhone: constant(isiPhone),\n        isTablet: constant(isTablet),\n        isPhone: constant(isPhone),\n        isTouch: constant(isTouch),\n        isAndroid: os.isAndroid,\n        isiOS: os.isiOS,\n        isWebView: constant(iOSwebview),\n        isDesktop: constant(isDesktop)\n      };\n    };\n\n    var firstMatch = function (regexes, s) {\n      for (var i = 0; i < regexes.length; i++) {\n        var x = regexes[i];\n        if (x.test(s)) {\n          return x;\n        }\n      }\n      return undefined;\n    };\n    var find = function (regexes, agent) {\n      var r = firstMatch(regexes, agent);\n      if (!r) {\n        return {\n          major: 0,\n          minor: 0\n        };\n      }\n      var group = function (i) {\n        return Number(agent.replace(r, '$' + i));\n      };\n      return nu$2(group(1), group(2));\n    };\n    var detect$3 = function (versionRegexes, agent) {\n      var cleanedAgent = String(agent).toLowerCase();\n      if (versionRegexes.length === 0) {\n        return unknown$2();\n      }\n      return find(versionRegexes, cleanedAgent);\n    };\n    var unknown$2 = function () {\n      return nu$2(0, 0);\n    };\n    var nu$2 = function (major, minor) {\n      return {\n        major: major,\n        minor: minor\n      };\n    };\n    var Version = {\n      nu: nu$2,\n      detect: detect$3,\n      unknown: unknown$2\n    };\n\n    var detectBrowser$1 = function (browsers, userAgentData) {\n      return findMap(userAgentData.brands, function (uaBrand) {\n        var lcBrand = uaBrand.brand.toLowerCase();\n        return find$1(browsers, function (browser) {\n          var _a;\n          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());\n        }).map(function (info) {\n          return {\n            current: info.name,\n            version: Version.nu(parseInt(uaBrand.version, 10), 0)\n          };\n        });\n      });\n    };\n\n    var detect$2 = function (candidates, userAgent) {\n      var agent = String(userAgent).toLowerCase();\n      return find$1(candidates, function (candidate) {\n        return candidate.search(agent);\n      });\n    };\n    var detectBrowser = function (browsers, userAgent) {\n      return detect$2(browsers, userAgent).map(function (browser) {\n        var version = Version.detect(browser.versionRegexes, userAgent);\n        return {\n          current: browser.name,\n          version: version\n        };\n      });\n    };\n    var detectOs = function (oses, userAgent) {\n      return detect$2(oses, userAgent).map(function (os) {\n        var version = Version.detect(os.versionRegexes, userAgent);\n        return {\n          current: os.name,\n          version: version\n        };\n      });\n    };\n\n    var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n    var checkContains = function (target) {\n      return function (uastring) {\n        return contains(uastring, target);\n      };\n    };\n    var browsers = [\n      {\n        name: 'Edge',\n        versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n        search: function (uastring) {\n          return contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit');\n        }\n      },\n      {\n        name: 'Chrome',\n        brand: 'Chromium',\n        versionRegexes: [\n          /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n          normalVersionRegex\n        ],\n        search: function (uastring) {\n          return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe');\n        }\n      },\n      {\n        name: 'IE',\n        versionRegexes: [\n          /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*?rv:([0-9]+)\\.([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return contains(uastring, 'msie') || contains(uastring, 'trident');\n        }\n      },\n      {\n        name: 'Opera',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n        ],\n        search: checkContains('opera')\n      },\n      {\n        name: 'Firefox',\n        versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n        search: checkContains('firefox')\n      },\n      {\n        name: 'Safari',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?cpu os ([0-9]+)_([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit');\n        }\n      }\n    ];\n    var oses = [\n      {\n        name: 'Windows',\n        search: checkContains('win'),\n        versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'iOS',\n        search: function (uastring) {\n          return contains(uastring, 'iphone') || contains(uastring, 'ipad');\n        },\n        versionRegexes: [\n          /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*cpu os ([0-9]+)_([0-9]+).*/,\n          /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n        ]\n      },\n      {\n        name: 'Android',\n        search: checkContains('android'),\n        versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'OSX',\n        search: checkContains('mac os x'),\n        versionRegexes: [/.*?mac\\ os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n      },\n      {\n        name: 'Linux',\n        search: checkContains('linux'),\n        versionRegexes: []\n      },\n      {\n        name: 'Solaris',\n        search: checkContains('sunos'),\n        versionRegexes: []\n      },\n      {\n        name: 'FreeBSD',\n        search: checkContains('freebsd'),\n        versionRegexes: []\n      },\n      {\n        name: 'ChromeOS',\n        search: checkContains('cros'),\n        versionRegexes: [/.*?chrome\\/([0-9]+)\\.([0-9]+).*/]\n      }\n    ];\n    var PlatformInfo = {\n      browsers: constant(browsers),\n      oses: constant(oses)\n    };\n\n    var edge = 'Edge';\n    var chrome = 'Chrome';\n    var ie = 'IE';\n    var opera = 'Opera';\n    var firefox = 'Firefox';\n    var safari = 'Safari';\n    var unknown$1 = function () {\n      return nu$1({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$1 = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isBrowser = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isEdge: isBrowser(edge),\n        isChrome: isBrowser(chrome),\n        isIE: isBrowser(ie),\n        isOpera: isBrowser(opera),\n        isFirefox: isBrowser(firefox),\n        isSafari: isBrowser(safari)\n      };\n    };\n    var Browser = {\n      unknown: unknown$1,\n      nu: nu$1,\n      edge: constant(edge),\n      chrome: constant(chrome),\n      ie: constant(ie),\n      opera: constant(opera),\n      firefox: constant(firefox),\n      safari: constant(safari)\n    };\n\n    var windows = 'Windows';\n    var ios = 'iOS';\n    var android = 'Android';\n    var linux = 'Linux';\n    var osx = 'OSX';\n    var solaris = 'Solaris';\n    var freebsd = 'FreeBSD';\n    var chromeos = 'ChromeOS';\n    var unknown = function () {\n      return nu({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isOS = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isWindows: isOS(windows),\n        isiOS: isOS(ios),\n        isAndroid: isOS(android),\n        isOSX: isOS(osx),\n        isLinux: isOS(linux),\n        isSolaris: isOS(solaris),\n        isFreeBSD: isOS(freebsd),\n        isChromeOS: isOS(chromeos)\n      };\n    };\n    var OperatingSystem = {\n      unknown: unknown,\n      nu: nu,\n      windows: constant(windows),\n      ios: constant(ios),\n      android: constant(android),\n      linux: constant(linux),\n      osx: constant(osx),\n      solaris: constant(solaris),\n      freebsd: constant(freebsd),\n      chromeos: constant(chromeos)\n    };\n\n    var detect$1 = function (userAgent, userAgentDataOpt, mediaMatch) {\n      var browsers = PlatformInfo.browsers();\n      var oses = PlatformInfo.oses();\n      var browser = userAgentDataOpt.bind(function (userAgentData) {\n        return detectBrowser$1(browsers, userAgentData);\n      }).orThunk(function () {\n        return detectBrowser(browsers, userAgent);\n      }).fold(Browser.unknown, Browser.nu);\n      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);\n      return {\n        browser: browser,\n        os: os,\n        deviceType: deviceType\n      };\n    };\n    var PlatformDetection = { detect: detect$1 };\n\n    var mediaMatch = function (query) {\n      return window.matchMedia(query).matches;\n    };\n    var platform = cached(function () {\n      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);\n    });\n    var detect = function () {\n      return platform();\n    };\n\n    var is = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n    var bypassSelector = function (dom) {\n      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;\n    };\n    var all$1 = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);\n    };\n\n    var eq = function (e1, e2) {\n      return e1.dom === e2.dom;\n    };\n\n    var owner = function (element) {\n      return SugarElement.fromDom(element.dom.ownerDocument);\n    };\n    var documentOrOwner = function (dos) {\n      return isDocument(dos) ? dos : owner(dos);\n    };\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var parents = function (element, isRoot) {\n      var stop = isFunction(isRoot) ? isRoot : never;\n      var dom = element.dom;\n      var ret = [];\n      while (dom.parentNode !== null && dom.parentNode !== undefined) {\n        var rawParent = dom.parentNode;\n        var p = SugarElement.fromDom(rawParent);\n        ret.push(p);\n        if (stop(p) === true) {\n          break;\n        } else {\n          dom = rawParent;\n        }\n      }\n      return ret;\n    };\n    var siblings$2 = function (element) {\n      var filterSelf = function (elements) {\n        return filter$1(elements, function (x) {\n          return !eq(element, x);\n        });\n      };\n      return parent(element).map(children).map(filterSelf).getOr([]);\n    };\n    var children = function (element) {\n      return map(element.dom.childNodes, SugarElement.fromDom);\n    };\n\n    var isShadowRoot = function (dos) {\n      return isDocumentFragment(dos) && isNonNullable(dos.dom.host);\n    };\n    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);\n    var isSupported = constant(supported);\n    var getRootNode = supported ? function (e) {\n      return SugarElement.fromDom(e.dom.getRootNode());\n    } : documentOrOwner;\n    var getShadowRoot = function (e) {\n      var r = getRootNode(e);\n      return isShadowRoot(r) ? Optional.some(r) : Optional.none();\n    };\n    var getShadowHost = function (e) {\n      return SugarElement.fromDom(e.dom.host);\n    };\n    var getOriginalEventTarget = function (event) {\n      if (isSupported() && isNonNullable(event.target)) {\n        var el = SugarElement.fromDom(event.target);\n        if (isElement(el) && isOpenShadowHost(el)) {\n          if (event.composed && event.composedPath) {\n            var composedPath = event.composedPath();\n            if (composedPath) {\n              return head(composedPath);\n            }\n          }\n        }\n      }\n      return Optional.from(event.target);\n    };\n    var isOpenShadowHost = function (element) {\n      return isNonNullable(element.dom.shadowRoot);\n    };\n\n    var inBody = function (element) {\n      var dom = isText(element) ? element.dom.parentNode : element.dom;\n      if (dom === undefined || dom === null || dom.ownerDocument === null) {\n        return false;\n      }\n      var doc = dom.ownerDocument;\n      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {\n        return doc.body.contains(dom);\n      }, compose1(inBody, getShadowHost));\n    };\n    var getBody = function (doc) {\n      var b = doc.dom.body;\n      if (b === null || b === undefined) {\n        throw new Error('Body is not available yet');\n      }\n      return SugarElement.fromDom(b);\n    };\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n    var get$3 = function (element, key) {\n      var v = element.dom.getAttribute(key);\n      return v === null ? undefined : v;\n    };\n    var remove = function (element, key) {\n      element.dom.removeAttribute(key);\n    };\n\n    var internalSet = function (dom, property, value) {\n      if (!isString(value)) {\n        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n        throw new Error('CSS value must be a string: ' + value);\n      }\n      if (isSupported$1(dom)) {\n        dom.style.setProperty(property, value);\n      }\n    };\n    var setAll = function (element, css) {\n      var dom = element.dom;\n      each(css, function (v, k) {\n        internalSet(dom, k, v);\n      });\n    };\n    var get$2 = function (element, property) {\n      var dom = element.dom;\n      var styles = window.getComputedStyle(dom);\n      var r = styles.getPropertyValue(property);\n      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;\n    };\n    var getUnsafeProperty = function (dom, property) {\n      return isSupported$1(dom) ? dom.style.getPropertyValue(property) : '';\n    };\n\n    var mkEvent = function (target, x, y, stop, prevent, kill, raw) {\n      return {\n        target: target,\n        x: x,\n        y: y,\n        stop: stop,\n        prevent: prevent,\n        kill: kill,\n        raw: raw\n      };\n    };\n    var fromRawEvent = function (rawEvent) {\n      var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));\n      var stop = function () {\n        return rawEvent.stopPropagation();\n      };\n      var prevent = function () {\n        return rawEvent.preventDefault();\n      };\n      var kill = compose(prevent, stop);\n      return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);\n    };\n    var handle = function (filter, handler) {\n      return function (rawEvent) {\n        if (filter(rawEvent)) {\n          handler(fromRawEvent(rawEvent));\n        }\n      };\n    };\n    var binder = function (element, event, filter, handler, useCapture) {\n      var wrapped = handle(filter, handler);\n      element.dom.addEventListener(event, wrapped, useCapture);\n      return { unbind: curry(unbind, element, event, wrapped, useCapture) };\n    };\n    var bind$2 = function (element, event, filter, handler) {\n      return binder(element, event, filter, handler, false);\n    };\n    var unbind = function (element, event, handler, useCapture) {\n      element.dom.removeEventListener(event, handler, useCapture);\n    };\n\n    var filter = always;\n    var bind$1 = function (element, event, handler) {\n      return bind$2(element, event, filter, handler);\n    };\n\n    var r = function (left, top) {\n      var translate = function (x, y) {\n        return r(left + x, top + y);\n      };\n      return {\n        left: left,\n        top: top,\n        translate: translate\n      };\n    };\n    var SugarPosition = r;\n\n    var get$1 = function (_DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;\n      var y = doc.body.scrollTop || doc.documentElement.scrollTop;\n      return SugarPosition(x, y);\n    };\n\n    var get = function (_win) {\n      var win = _win === undefined ? window : _win;\n      if (detect().browser.isFirefox()) {\n        return Optional.none();\n      } else {\n        return Optional.from(win['visualViewport']);\n      }\n    };\n    var bounds = function (x, y, width, height) {\n      return {\n        x: x,\n        y: y,\n        width: width,\n        height: height,\n        right: x + width,\n        bottom: y + height\n      };\n    };\n    var getBounds = function (_win) {\n      var win = _win === undefined ? window : _win;\n      var doc = win.document;\n      var scroll = get$1(SugarElement.fromDom(doc));\n      return get(win).fold(function () {\n        var html = win.document.documentElement;\n        var width = html.clientWidth;\n        var height = html.clientHeight;\n        return bounds(scroll.left, scroll.top, width, height);\n      }, function (visualViewport) {\n        return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);\n      });\n    };\n    var bind = function (name, callback, _win) {\n      return get(_win).map(function (visualViewport) {\n        var handler = function (e) {\n          return callback(fromRawEvent(e));\n        };\n        visualViewport.addEventListener(name, handler);\n        return {\n          unbind: function () {\n            return visualViewport.removeEventListener(name, handler);\n          }\n        };\n      }).getOrThunk(function () {\n        return { unbind: noop };\n      });\n    };\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var fireFullscreenStateChanged = function (editor, state) {\n      editor.fire('FullscreenStateChanged', { state: state });\n      editor.fire('ResizeEditor');\n    };\n\n    var getFullscreenNative = function (editor) {\n      return editor.getParam('fullscreen_native', false, 'boolean');\n    };\n\n    var getFullscreenRoot = function (editor) {\n      var elem = SugarElement.fromDom(editor.getElement());\n      return getShadowRoot(elem).map(getShadowHost).getOrThunk(function () {\n        return getBody(owner(elem));\n      });\n    };\n    var getFullscreenElement = function (root) {\n      if (root.fullscreenElement !== undefined) {\n        return root.fullscreenElement;\n      } else if (root.msFullscreenElement !== undefined) {\n        return root.msFullscreenElement;\n      } else if (root.webkitFullscreenElement !== undefined) {\n        return root.webkitFullscreenElement;\n      } else {\n        return null;\n      }\n    };\n    var getFullscreenchangeEventName = function () {\n      if (document.fullscreenElement !== undefined) {\n        return 'fullscreenchange';\n      } else if (document.msFullscreenElement !== undefined) {\n        return 'MSFullscreenChange';\n      } else if (document.webkitFullscreenElement !== undefined) {\n        return 'webkitfullscreenchange';\n      } else {\n        return 'fullscreenchange';\n      }\n    };\n    var requestFullscreen = function (sugarElem) {\n      var elem = sugarElem.dom;\n      if (elem.requestFullscreen) {\n        elem.requestFullscreen();\n      } else if (elem.msRequestFullscreen) {\n        elem.msRequestFullscreen();\n      } else if (elem.webkitRequestFullScreen) {\n        elem.webkitRequestFullScreen();\n      }\n    };\n    var exitFullscreen = function (sugarDoc) {\n      var doc = sugarDoc.dom;\n      if (doc.exitFullscreen) {\n        doc.exitFullscreen();\n      } else if (doc.msExitFullscreen) {\n        doc.msExitFullscreen();\n      } else if (doc.webkitCancelFullScreen) {\n        doc.webkitCancelFullScreen();\n      }\n    };\n    var isFullscreenElement = function (elem) {\n      return elem.dom === getFullscreenElement(owner(elem).dom);\n    };\n\n    var ancestors$1 = function (scope, predicate, isRoot) {\n      return filter$1(parents(scope, isRoot), predicate);\n    };\n    var siblings$1 = function (scope, predicate) {\n      return filter$1(siblings$2(scope), predicate);\n    };\n\n    var all = function (selector) {\n      return all$1(selector);\n    };\n    var ancestors = function (scope, selector, isRoot) {\n      return ancestors$1(scope, function (e) {\n        return is(e, selector);\n      }, isRoot);\n    };\n    var siblings = function (scope, selector) {\n      return siblings$1(scope, function (e) {\n        return is(e, selector);\n      });\n    };\n\n    var attr = 'data-ephox-mobile-fullscreen-style';\n    var siblingStyles = 'display:none!important;';\n    var ancestorPosition = 'position:absolute!important;';\n    var ancestorStyles = 'top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;';\n    var bgFallback = 'background-color:rgb(255,255,255)!important;';\n    var isAndroid = global$1.os.isAndroid();\n    var matchColor = function (editorBody) {\n      var color = get$2(editorBody, 'background-color');\n      return color !== undefined && color !== '' ? 'background-color:' + color + '!important' : bgFallback;\n    };\n    var clobberStyles = function (dom, container, editorBody) {\n      var gatherSiblings = function (element) {\n        return siblings(element, '*:not(.tox-silver-sink)');\n      };\n      var clobber = function (clobberStyle) {\n        return function (element) {\n          var styles = get$3(element, 'style');\n          var backup = styles === undefined ? 'no-styles' : styles.trim();\n          if (backup === clobberStyle) {\n            return;\n          } else {\n            set(element, attr, backup);\n            setAll(element, dom.parseStyle(clobberStyle));\n          }\n        };\n      };\n      var ancestors$1 = ancestors(container, '*');\n      var siblings$1 = bind$3(ancestors$1, gatherSiblings);\n      var bgColor = matchColor(editorBody);\n      each$1(siblings$1, clobber(siblingStyles));\n      each$1(ancestors$1, clobber(ancestorPosition + ancestorStyles + bgColor));\n      var containerStyles = isAndroid === true ? '' : ancestorPosition;\n      clobber(containerStyles + ancestorStyles + bgColor)(container);\n    };\n    var restoreStyles = function (dom) {\n      var clobberedEls = all('[' + attr + ']');\n      each$1(clobberedEls, function (element) {\n        var restore = get$3(element, attr);\n        if (restore !== 'no-styles') {\n          setAll(element, dom.parseStyle(restore));\n        } else {\n          remove(element, 'style');\n        }\n        remove(element, attr);\n      });\n    };\n\n    var DOM = global$2.DOM;\n    var getScrollPos = function () {\n      return getBounds(window);\n    };\n    var setScrollPos = function (pos) {\n      return window.scrollTo(pos.x, pos.y);\n    };\n    var viewportUpdate = get().fold(function () {\n      return {\n        bind: noop,\n        unbind: noop\n      };\n    }, function (visualViewport) {\n      var editorContainer = value();\n      var resizeBinder = unbindable();\n      var scrollBinder = unbindable();\n      var refreshScroll = function () {\n        document.body.scrollTop = 0;\n        document.documentElement.scrollTop = 0;\n      };\n      var refreshVisualViewport = function () {\n        window.requestAnimationFrame(function () {\n          editorContainer.on(function (container) {\n            return setAll(container, {\n              top: visualViewport.offsetTop + 'px',\n              left: visualViewport.offsetLeft + 'px',\n              height: visualViewport.height + 'px',\n              width: visualViewport.width + 'px'\n            });\n          });\n        });\n      };\n      var update = global.throttle(function () {\n        refreshScroll();\n        refreshVisualViewport();\n      }, 50);\n      var bind$1 = function (element) {\n        editorContainer.set(element);\n        update();\n        resizeBinder.set(bind('resize', update));\n        scrollBinder.set(bind('scroll', update));\n      };\n      var unbind = function () {\n        editorContainer.on(function () {\n          resizeBinder.clear();\n          scrollBinder.clear();\n        });\n        editorContainer.clear();\n      };\n      return {\n        bind: bind$1,\n        unbind: unbind\n      };\n    });\n    var toggleFullscreen = function (editor, fullscreenState) {\n      var body = document.body;\n      var documentElement = document.documentElement;\n      var editorContainer = editor.getContainer();\n      var editorContainerS = SugarElement.fromDom(editorContainer);\n      var fullscreenRoot = getFullscreenRoot(editor);\n      var fullscreenInfo = fullscreenState.get();\n      var editorBody = SugarElement.fromDom(editor.getBody());\n      var isTouch = global$1.deviceType.isTouch();\n      var editorContainerStyle = editorContainer.style;\n      var iframe = editor.iframeElement;\n      var iframeStyle = iframe.style;\n      var handleClasses = function (handler) {\n        handler(body, 'tox-fullscreen');\n        handler(documentElement, 'tox-fullscreen');\n        handler(editorContainer, 'tox-fullscreen');\n        getShadowRoot(editorContainerS).map(function (root) {\n          return getShadowHost(root).dom;\n        }).each(function (host) {\n          handler(host, 'tox-fullscreen');\n          handler(host, 'tox-shadowhost');\n        });\n      };\n      var cleanup = function () {\n        if (isTouch) {\n          restoreStyles(editor.dom);\n        }\n        handleClasses(DOM.removeClass);\n        viewportUpdate.unbind();\n        Optional.from(fullscreenState.get()).each(function (info) {\n          return info.fullscreenChangeHandler.unbind();\n        });\n      };\n      if (!fullscreenInfo) {\n        var fullscreenChangeHandler = bind$1(owner(fullscreenRoot), getFullscreenchangeEventName(), function (_evt) {\n          if (getFullscreenNative(editor)) {\n            if (!isFullscreenElement(fullscreenRoot) && fullscreenState.get() !== null) {\n              toggleFullscreen(editor, fullscreenState);\n            }\n          }\n        });\n        var newFullScreenInfo = {\n          scrollPos: getScrollPos(),\n          containerWidth: editorContainerStyle.width,\n          containerHeight: editorContainerStyle.height,\n          containerTop: editorContainerStyle.top,\n          containerLeft: editorContainerStyle.left,\n          iframeWidth: iframeStyle.width,\n          iframeHeight: iframeStyle.height,\n          fullscreenChangeHandler: fullscreenChangeHandler\n        };\n        if (isTouch) {\n          clobberStyles(editor.dom, editorContainerS, editorBody);\n        }\n        iframeStyle.width = iframeStyle.height = '100%';\n        editorContainerStyle.width = editorContainerStyle.height = '';\n        handleClasses(DOM.addClass);\n        viewportUpdate.bind(editorContainerS);\n        editor.on('remove', cleanup);\n        fullscreenState.set(newFullScreenInfo);\n        if (getFullscreenNative(editor)) {\n          requestFullscreen(fullscreenRoot);\n        }\n        fireFullscreenStateChanged(editor, true);\n      } else {\n        fullscreenInfo.fullscreenChangeHandler.unbind();\n        if (getFullscreenNative(editor) && isFullscreenElement(fullscreenRoot)) {\n          exitFullscreen(owner(fullscreenRoot));\n        }\n        iframeStyle.width = fullscreenInfo.iframeWidth;\n        iframeStyle.height = fullscreenInfo.iframeHeight;\n        editorContainerStyle.width = fullscreenInfo.containerWidth;\n        editorContainerStyle.height = fullscreenInfo.containerHeight;\n        editorContainerStyle.top = fullscreenInfo.containerTop;\n        editorContainerStyle.left = fullscreenInfo.containerLeft;\n        cleanup();\n        setScrollPos(fullscreenInfo.scrollPos);\n        fullscreenState.set(null);\n        fireFullscreenStateChanged(editor, false);\n        editor.off('remove', cleanup);\n      }\n    };\n\n    var register$1 = function (editor, fullscreenState) {\n      editor.addCommand('mceFullScreen', function () {\n        toggleFullscreen(editor, fullscreenState);\n      });\n    };\n\n    var makeSetupHandler = function (editor, fullscreenState) {\n      return function (api) {\n        api.setActive(fullscreenState.get() !== null);\n        var editorEventCallback = function (e) {\n          return api.setActive(e.state);\n        };\n        editor.on('FullscreenStateChanged', editorEventCallback);\n        return function () {\n          return editor.off('FullscreenStateChanged', editorEventCallback);\n        };\n      };\n    };\n    var register = function (editor, fullscreenState) {\n      var onAction = function () {\n        return editor.execCommand('mceFullScreen');\n      };\n      editor.ui.registry.addToggleMenuItem('fullscreen', {\n        text: 'Fullscreen',\n        icon: 'fullscreen',\n        shortcut: 'Meta+Shift+F',\n        onAction: onAction,\n        onSetup: makeSetupHandler(editor, fullscreenState)\n      });\n      editor.ui.registry.addToggleButton('fullscreen', {\n        tooltip: 'Fullscreen',\n        icon: 'fullscreen',\n        onAction: onAction,\n        onSetup: makeSetupHandler(editor, fullscreenState)\n      });\n    };\n\n    function Plugin () {\n      global$3.add('fullscreen', function (editor) {\n        var fullscreenState = Cell(null);\n        if (editor.inline) {\n          return get$5(fullscreenState);\n        }\n        register$1(editor, fullscreenState);\n        register(editor, fullscreenState);\n        editor.addShortcut('Meta+Shift+F', '', 'mceFullScreen');\n        return get$5(fullscreenState);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/fullscreen/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/hr/index.js":
/*!******************************************************!*\
  !*** ../../node_modules/tinymce/plugins/hr/index.js ***!
  \******************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"hr\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/hr')\n//   ES2015:\n//     import 'tinymce/plugins/hr'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/hr/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/hr/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/hr/plugin.js":
/*!*******************************************************!*\
  !*** ../../node_modules/tinymce/plugins/hr/plugin.js ***!
  \*******************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var register$1 = function (editor) {\n      editor.addCommand('InsertHorizontalRule', function () {\n        editor.execCommand('mceInsertContent', false, '<hr />');\n      });\n    };\n\n    var register = function (editor) {\n      var onAction = function () {\n        return editor.execCommand('InsertHorizontalRule');\n      };\n      editor.ui.registry.addButton('hr', {\n        icon: 'horizontal-rule',\n        tooltip: 'Horizontal line',\n        onAction: onAction\n      });\n      editor.ui.registry.addMenuItem('hr', {\n        icon: 'horizontal-rule',\n        text: 'Horizontal line',\n        onAction: onAction\n      });\n    };\n\n    function Plugin () {\n      global.add('hr', function (editor) {\n        register$1(editor);\n        register(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/hr/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/image/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/image/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"image\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/image')\n//   ES2015:\n//     import 'tinymce/plugins/image'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/image/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/image/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/image/plugin.js":
/*!**********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/image/plugin.js ***!
  \**********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$6 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var eq = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isString = isType('string');\n    var isObject = isType('object');\n    var isArray = isType('array');\n    var isNull = eq(null);\n    var isBoolean = isSimpleType('boolean');\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var keys = Object.keys;\n    var hasOwnProperty = Object.hasOwnProperty;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var filter = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n    var has = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n    var hasNonNullableKey = function (obj, key) {\n      return has(obj, key) && obj[key] !== undefined && obj[key] !== null;\n    };\n\n    var nativePush = Array.prototype.push;\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var get = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get(xs, 0);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n    var remove = function (element, key) {\n      element.dom.removeAttribute(key);\n    };\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.util.URI');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.XHR');\n\n    var hasDimensions = function (editor) {\n      return editor.getParam('image_dimensions', true, 'boolean');\n    };\n    var hasAdvTab = function (editor) {\n      return editor.getParam('image_advtab', false, 'boolean');\n    };\n    var hasUploadTab = function (editor) {\n      return editor.getParam('image_uploadtab', true, 'boolean');\n    };\n    var getPrependUrl = function (editor) {\n      return editor.getParam('image_prepend_url', '', 'string');\n    };\n    var getClassList = function (editor) {\n      return editor.getParam('image_class_list');\n    };\n    var hasDescription = function (editor) {\n      return editor.getParam('image_description', true, 'boolean');\n    };\n    var hasImageTitle = function (editor) {\n      return editor.getParam('image_title', false, 'boolean');\n    };\n    var hasImageCaption = function (editor) {\n      return editor.getParam('image_caption', false, 'boolean');\n    };\n    var getImageList = function (editor) {\n      return editor.getParam('image_list', false);\n    };\n    var hasUploadUrl = function (editor) {\n      return isNonNullable(editor.getParam('images_upload_url'));\n    };\n    var hasUploadHandler = function (editor) {\n      return isNonNullable(editor.getParam('images_upload_handler'));\n    };\n    var showAccessibilityOptions = function (editor) {\n      return editor.getParam('a11y_advanced_options', false, 'boolean');\n    };\n    var isAutomaticUploadsEnabled = function (editor) {\n      return editor.getParam('automatic_uploads', true, 'boolean');\n    };\n\n    var parseIntAndGetMax = function (val1, val2) {\n      return Math.max(parseInt(val1, 10), parseInt(val2, 10));\n    };\n    var getImageSize = function (url) {\n      return new global$4(function (callback) {\n        var img = document.createElement('img');\n        var done = function (dimensions) {\n          img.onload = img.onerror = null;\n          if (img.parentNode) {\n            img.parentNode.removeChild(img);\n          }\n          callback(dimensions);\n        };\n        img.onload = function () {\n          var width = parseIntAndGetMax(img.width, img.clientWidth);\n          var height = parseIntAndGetMax(img.height, img.clientHeight);\n          var dimensions = {\n            width: width,\n            height: height\n          };\n          done(global$4.resolve(dimensions));\n        };\n        img.onerror = function () {\n          done(global$4.reject('Failed to get image dimensions for: ' + url));\n        };\n        var style = img.style;\n        style.visibility = 'hidden';\n        style.position = 'fixed';\n        style.bottom = style.left = '0px';\n        style.width = style.height = 'auto';\n        document.body.appendChild(img);\n        img.src = url;\n      });\n    };\n    var removePixelSuffix = function (value) {\n      if (value) {\n        value = value.replace(/px$/, '');\n      }\n      return value;\n    };\n    var addPixelSuffix = function (value) {\n      if (value.length > 0 && /^[0-9]+$/.test(value)) {\n        value += 'px';\n      }\n      return value;\n    };\n    var mergeMargins = function (css) {\n      if (css.margin) {\n        var splitMargin = String(css.margin).split(' ');\n        switch (splitMargin.length) {\n        case 1:\n          css['margin-top'] = css['margin-top'] || splitMargin[0];\n          css['margin-right'] = css['margin-right'] || splitMargin[0];\n          css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];\n          css['margin-left'] = css['margin-left'] || splitMargin[0];\n          break;\n        case 2:\n          css['margin-top'] = css['margin-top'] || splitMargin[0];\n          css['margin-right'] = css['margin-right'] || splitMargin[1];\n          css['margin-bottom'] = css['margin-bottom'] || splitMargin[0];\n          css['margin-left'] = css['margin-left'] || splitMargin[1];\n          break;\n        case 3:\n          css['margin-top'] = css['margin-top'] || splitMargin[0];\n          css['margin-right'] = css['margin-right'] || splitMargin[1];\n          css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];\n          css['margin-left'] = css['margin-left'] || splitMargin[1];\n          break;\n        case 4:\n          css['margin-top'] = css['margin-top'] || splitMargin[0];\n          css['margin-right'] = css['margin-right'] || splitMargin[1];\n          css['margin-bottom'] = css['margin-bottom'] || splitMargin[2];\n          css['margin-left'] = css['margin-left'] || splitMargin[3];\n        }\n        delete css.margin;\n      }\n      return css;\n    };\n    var createImageList = function (editor, callback) {\n      var imageList = getImageList(editor);\n      if (isString(imageList)) {\n        global$2.send({\n          url: imageList,\n          success: function (text) {\n            callback(JSON.parse(text));\n          }\n        });\n      } else if (isFunction(imageList)) {\n        imageList(callback);\n      } else {\n        callback(imageList);\n      }\n    };\n    var waitLoadImage = function (editor, data, imgElm) {\n      var selectImage = function () {\n        imgElm.onload = imgElm.onerror = null;\n        if (editor.selection) {\n          editor.selection.select(imgElm);\n          editor.nodeChanged();\n        }\n      };\n      imgElm.onload = function () {\n        if (!data.width && !data.height && hasDimensions(editor)) {\n          editor.dom.setAttribs(imgElm, {\n            width: String(imgElm.clientWidth),\n            height: String(imgElm.clientHeight)\n          });\n        }\n        selectImage();\n      };\n      imgElm.onerror = selectImage;\n    };\n    var blobToDataUri = function (blob) {\n      return new global$4(function (resolve, reject) {\n        var reader = new FileReader();\n        reader.onload = function () {\n          resolve(reader.result);\n        };\n        reader.onerror = function () {\n          reject(reader.error.message);\n        };\n        reader.readAsDataURL(blob);\n      });\n    };\n    var isPlaceholderImage = function (imgElm) {\n      return imgElm.nodeName === 'IMG' && (imgElm.hasAttribute('data-mce-object') || imgElm.hasAttribute('data-mce-placeholder'));\n    };\n    var isSafeImageUrl = function (editor, src) {\n      return global$3.isDomSafe(src, 'img', editor.settings);\n    };\n\n    var DOM = global$5.DOM;\n    var getHspace = function (image) {\n      if (image.style.marginLeft && image.style.marginRight && image.style.marginLeft === image.style.marginRight) {\n        return removePixelSuffix(image.style.marginLeft);\n      } else {\n        return '';\n      }\n    };\n    var getVspace = function (image) {\n      if (image.style.marginTop && image.style.marginBottom && image.style.marginTop === image.style.marginBottom) {\n        return removePixelSuffix(image.style.marginTop);\n      } else {\n        return '';\n      }\n    };\n    var getBorder = function (image) {\n      if (image.style.borderWidth) {\n        return removePixelSuffix(image.style.borderWidth);\n      } else {\n        return '';\n      }\n    };\n    var getAttrib = function (image, name) {\n      if (image.hasAttribute(name)) {\n        return image.getAttribute(name);\n      } else {\n        return '';\n      }\n    };\n    var getStyle = function (image, name) {\n      return image.style[name] ? image.style[name] : '';\n    };\n    var hasCaption = function (image) {\n      return image.parentNode !== null && image.parentNode.nodeName === 'FIGURE';\n    };\n    var updateAttrib = function (image, name, value) {\n      if (value === '') {\n        image.removeAttribute(name);\n      } else {\n        image.setAttribute(name, value);\n      }\n    };\n    var wrapInFigure = function (image) {\n      var figureElm = DOM.create('figure', { class: 'image' });\n      DOM.insertAfter(figureElm, image);\n      figureElm.appendChild(image);\n      figureElm.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));\n      figureElm.contentEditable = 'false';\n    };\n    var removeFigure = function (image) {\n      var figureElm = image.parentNode;\n      DOM.insertAfter(image, figureElm);\n      DOM.remove(figureElm);\n    };\n    var toggleCaption = function (image) {\n      if (hasCaption(image)) {\n        removeFigure(image);\n      } else {\n        wrapInFigure(image);\n      }\n    };\n    var normalizeStyle = function (image, normalizeCss) {\n      var attrValue = image.getAttribute('style');\n      var value = normalizeCss(attrValue !== null ? attrValue : '');\n      if (value.length > 0) {\n        image.setAttribute('style', value);\n        image.setAttribute('data-mce-style', value);\n      } else {\n        image.removeAttribute('style');\n      }\n    };\n    var setSize = function (name, normalizeCss) {\n      return function (image, name, value) {\n        if (image.style[name]) {\n          image.style[name] = addPixelSuffix(value);\n          normalizeStyle(image, normalizeCss);\n        } else {\n          updateAttrib(image, name, value);\n        }\n      };\n    };\n    var getSize = function (image, name) {\n      if (image.style[name]) {\n        return removePixelSuffix(image.style[name]);\n      } else {\n        return getAttrib(image, name);\n      }\n    };\n    var setHspace = function (image, value) {\n      var pxValue = addPixelSuffix(value);\n      image.style.marginLeft = pxValue;\n      image.style.marginRight = pxValue;\n    };\n    var setVspace = function (image, value) {\n      var pxValue = addPixelSuffix(value);\n      image.style.marginTop = pxValue;\n      image.style.marginBottom = pxValue;\n    };\n    var setBorder = function (image, value) {\n      var pxValue = addPixelSuffix(value);\n      image.style.borderWidth = pxValue;\n    };\n    var setBorderStyle = function (image, value) {\n      image.style.borderStyle = value;\n    };\n    var getBorderStyle = function (image) {\n      return getStyle(image, 'borderStyle');\n    };\n    var isFigure = function (elm) {\n      return elm.nodeName === 'FIGURE';\n    };\n    var isImage = function (elm) {\n      return elm.nodeName === 'IMG';\n    };\n    var getIsDecorative = function (image) {\n      return DOM.getAttrib(image, 'alt').length === 0 && DOM.getAttrib(image, 'role') === 'presentation';\n    };\n    var getAlt = function (image) {\n      if (getIsDecorative(image)) {\n        return '';\n      } else {\n        return getAttrib(image, 'alt');\n      }\n    };\n    var defaultData = function () {\n      return {\n        src: '',\n        alt: '',\n        title: '',\n        width: '',\n        height: '',\n        class: '',\n        style: '',\n        caption: false,\n        hspace: '',\n        vspace: '',\n        border: '',\n        borderStyle: '',\n        isDecorative: false\n      };\n    };\n    var getStyleValue = function (normalizeCss, data) {\n      var image = document.createElement('img');\n      updateAttrib(image, 'style', data.style);\n      if (getHspace(image) || data.hspace !== '') {\n        setHspace(image, data.hspace);\n      }\n      if (getVspace(image) || data.vspace !== '') {\n        setVspace(image, data.vspace);\n      }\n      if (getBorder(image) || data.border !== '') {\n        setBorder(image, data.border);\n      }\n      if (getBorderStyle(image) || data.borderStyle !== '') {\n        setBorderStyle(image, data.borderStyle);\n      }\n      return normalizeCss(image.getAttribute('style'));\n    };\n    var create = function (normalizeCss, data) {\n      var image = document.createElement('img');\n      write(normalizeCss, __assign(__assign({}, data), { caption: false }), image);\n      setAlt(image, data.alt, data.isDecorative);\n      if (data.caption) {\n        var figure = DOM.create('figure', { class: 'image' });\n        figure.appendChild(image);\n        figure.appendChild(DOM.create('figcaption', { contentEditable: 'true' }, 'Caption'));\n        figure.contentEditable = 'false';\n        return figure;\n      } else {\n        return image;\n      }\n    };\n    var read = function (normalizeCss, image) {\n      return {\n        src: getAttrib(image, 'src'),\n        alt: getAlt(image),\n        title: getAttrib(image, 'title'),\n        width: getSize(image, 'width'),\n        height: getSize(image, 'height'),\n        class: getAttrib(image, 'class'),\n        style: normalizeCss(getAttrib(image, 'style')),\n        caption: hasCaption(image),\n        hspace: getHspace(image),\n        vspace: getVspace(image),\n        border: getBorder(image),\n        borderStyle: getStyle(image, 'borderStyle'),\n        isDecorative: getIsDecorative(image)\n      };\n    };\n    var updateProp = function (image, oldData, newData, name, set) {\n      if (newData[name] !== oldData[name]) {\n        set(image, name, newData[name]);\n      }\n    };\n    var setAlt = function (image, alt, isDecorative) {\n      if (isDecorative) {\n        DOM.setAttrib(image, 'role', 'presentation');\n        var sugarImage = SugarElement.fromDom(image);\n        set(sugarImage, 'alt', '');\n      } else {\n        if (isNull(alt)) {\n          var sugarImage = SugarElement.fromDom(image);\n          remove(sugarImage, 'alt');\n        } else {\n          var sugarImage = SugarElement.fromDom(image);\n          set(sugarImage, 'alt', alt);\n        }\n        if (DOM.getAttrib(image, 'role') === 'presentation') {\n          DOM.setAttrib(image, 'role', '');\n        }\n      }\n    };\n    var updateAlt = function (image, oldData, newData) {\n      if (newData.alt !== oldData.alt || newData.isDecorative !== oldData.isDecorative) {\n        setAlt(image, newData.alt, newData.isDecorative);\n      }\n    };\n    var normalized = function (set, normalizeCss) {\n      return function (image, name, value) {\n        set(image, value);\n        normalizeStyle(image, normalizeCss);\n      };\n    };\n    var write = function (normalizeCss, newData, image) {\n      var oldData = read(normalizeCss, image);\n      updateProp(image, oldData, newData, 'caption', function (image, _name, _value) {\n        return toggleCaption(image);\n      });\n      updateProp(image, oldData, newData, 'src', updateAttrib);\n      updateProp(image, oldData, newData, 'title', updateAttrib);\n      updateProp(image, oldData, newData, 'width', setSize('width', normalizeCss));\n      updateProp(image, oldData, newData, 'height', setSize('height', normalizeCss));\n      updateProp(image, oldData, newData, 'class', updateAttrib);\n      updateProp(image, oldData, newData, 'style', normalized(function (image, value) {\n        return updateAttrib(image, 'style', value);\n      }, normalizeCss));\n      updateProp(image, oldData, newData, 'hspace', normalized(setHspace, normalizeCss));\n      updateProp(image, oldData, newData, 'vspace', normalized(setVspace, normalizeCss));\n      updateProp(image, oldData, newData, 'border', normalized(setBorder, normalizeCss));\n      updateProp(image, oldData, newData, 'borderStyle', normalized(setBorderStyle, normalizeCss));\n      updateAlt(image, oldData, newData);\n    };\n\n    var normalizeCss$1 = function (editor, cssText) {\n      var css = editor.dom.styles.parse(cssText);\n      var mergedCss = mergeMargins(css);\n      var compressed = editor.dom.styles.parse(editor.dom.styles.serialize(mergedCss));\n      return editor.dom.styles.serialize(compressed);\n    };\n    var getSelectedImage = function (editor) {\n      var imgElm = editor.selection.getNode();\n      var figureElm = editor.dom.getParent(imgElm, 'figure.image');\n      if (figureElm) {\n        return editor.dom.select('img', figureElm)[0];\n      }\n      if (imgElm && (imgElm.nodeName !== 'IMG' || isPlaceholderImage(imgElm))) {\n        return null;\n      }\n      return imgElm;\n    };\n    var splitTextBlock = function (editor, figure) {\n      var dom = editor.dom;\n      var textBlockElements = filter(editor.schema.getTextBlockElements(), function (_, parentElm) {\n        return !editor.schema.isValidChild(parentElm, 'figure');\n      });\n      var textBlock = dom.getParent(figure.parentNode, function (node) {\n        return hasNonNullableKey(textBlockElements, node.nodeName);\n      }, editor.getBody());\n      if (textBlock) {\n        return dom.split(textBlock, figure);\n      } else {\n        return figure;\n      }\n    };\n    var readImageDataFromSelection = function (editor) {\n      var image = getSelectedImage(editor);\n      return image ? read(function (css) {\n        return normalizeCss$1(editor, css);\n      }, image) : defaultData();\n    };\n    var insertImageAtCaret = function (editor, data) {\n      var elm = create(function (css) {\n        return normalizeCss$1(editor, css);\n      }, data);\n      editor.dom.setAttrib(elm, 'data-mce-id', '__mcenew');\n      editor.focus();\n      editor.selection.setContent(elm.outerHTML);\n      var insertedElm = editor.dom.select('*[data-mce-id=\"__mcenew\"]')[0];\n      editor.dom.setAttrib(insertedElm, 'data-mce-id', null);\n      if (isFigure(insertedElm)) {\n        var figure = splitTextBlock(editor, insertedElm);\n        editor.selection.select(figure);\n      } else {\n        editor.selection.select(insertedElm);\n      }\n    };\n    var syncSrcAttr = function (editor, image) {\n      editor.dom.setAttrib(image, 'src', image.getAttribute('src'));\n    };\n    var deleteImage = function (editor, image) {\n      if (image) {\n        var elm = editor.dom.is(image.parentNode, 'figure.image') ? image.parentNode : image;\n        editor.dom.remove(elm);\n        editor.focus();\n        editor.nodeChanged();\n        if (editor.dom.isEmpty(editor.getBody())) {\n          editor.setContent('');\n          editor.selection.setCursorLocation();\n        }\n      }\n    };\n    var writeImageDataToSelection = function (editor, data) {\n      var image = getSelectedImage(editor);\n      write(function (css) {\n        return normalizeCss$1(editor, css);\n      }, data, image);\n      syncSrcAttr(editor, image);\n      if (isFigure(image.parentNode)) {\n        var figure = image.parentNode;\n        splitTextBlock(editor, figure);\n        editor.selection.select(image.parentNode);\n      } else {\n        editor.selection.select(image);\n        waitLoadImage(editor, data, image);\n      }\n    };\n    var sanitizeImageData = function (editor, data) {\n      var src = data.src;\n      return __assign(__assign({}, data), { src: isSafeImageUrl(editor, src) ? src : '' });\n    };\n    var insertOrUpdateImage = function (editor, partialData) {\n      var image = getSelectedImage(editor);\n      if (image) {\n        var selectedImageData = read(function (css) {\n          return normalizeCss$1(editor, css);\n        }, image);\n        var data = __assign(__assign({}, selectedImageData), partialData);\n        var sanitizedData = sanitizeImageData(editor, data);\n        if (data.src) {\n          writeImageDataToSelection(editor, sanitizedData);\n        } else {\n          deleteImage(editor, image);\n        }\n      } else if (partialData.src) {\n        insertImageAtCaret(editor, __assign(__assign({}, defaultData()), partialData));\n      }\n    };\n\n    var deep = function (old, nu) {\n      var bothObjects = isObject(old) && isObject(nu);\n      return bothObjects ? deepMerge(old, nu) : nu;\n    };\n    var baseMerge = function (merger) {\n      return function () {\n        var objects = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          objects[_i] = arguments[_i];\n        }\n        if (objects.length === 0) {\n          throw new Error('Can\\'t merge zero objects');\n        }\n        var ret = {};\n        for (var j = 0; j < objects.length; j++) {\n          var curObject = objects[j];\n          for (var key in curObject) {\n            if (has(curObject, key)) {\n              ret[key] = merger(ret[key], curObject[key]);\n            }\n          }\n        }\n        return ret;\n      };\n    };\n    var deepMerge = baseMerge(deep);\n\n    var isNotEmpty = function (s) {\n      return s.length > 0;\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.ImageUploader');\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getValue = function (item) {\n      return isString(item.value) ? item.value : '';\n    };\n    var getText = function (item) {\n      if (isString(item.text)) {\n        return item.text;\n      } else if (isString(item.title)) {\n        return item.title;\n      } else {\n        return '';\n      }\n    };\n    var sanitizeList = function (list, extractValue) {\n      var out = [];\n      global.each(list, function (item) {\n        var text = getText(item);\n        if (item.menu !== undefined) {\n          var items = sanitizeList(item.menu, extractValue);\n          out.push({\n            text: text,\n            items: items\n          });\n        } else {\n          var value = extractValue(item);\n          out.push({\n            text: text,\n            value: value\n          });\n        }\n      });\n      return out;\n    };\n    var sanitizer = function (extractor) {\n      if (extractor === void 0) {\n        extractor = getValue;\n      }\n      return function (list) {\n        if (list) {\n          return Optional.from(list).map(function (list) {\n            return sanitizeList(list, extractor);\n          });\n        } else {\n          return Optional.none();\n        }\n      };\n    };\n    var sanitize = function (list) {\n      return sanitizer(getValue)(list);\n    };\n    var isGroup = function (item) {\n      return has(item, 'items');\n    };\n    var findEntryDelegate = function (list, value) {\n      return findMap(list, function (item) {\n        if (isGroup(item)) {\n          return findEntryDelegate(item.items, value);\n        } else if (item.value === value) {\n          return Optional.some(item);\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var findEntry = function (optList, value) {\n      return optList.bind(function (list) {\n        return findEntryDelegate(list, value);\n      });\n    };\n    var ListUtils = {\n      sanitizer: sanitizer,\n      sanitize: sanitize,\n      findEntry: findEntry\n    };\n\n    var makeTab$2 = function (_info) {\n      return {\n        title: 'Advanced',\n        name: 'advanced',\n        items: [\n          {\n            type: 'input',\n            label: 'Style',\n            name: 'style'\n          },\n          {\n            type: 'grid',\n            columns: 2,\n            items: [\n              {\n                type: 'input',\n                label: 'Vertical space',\n                name: 'vspace',\n                inputMode: 'numeric'\n              },\n              {\n                type: 'input',\n                label: 'Horizontal space',\n                name: 'hspace',\n                inputMode: 'numeric'\n              },\n              {\n                type: 'input',\n                label: 'Border width',\n                name: 'border',\n                inputMode: 'numeric'\n              },\n              {\n                type: 'listbox',\n                name: 'borderstyle',\n                label: 'Border style',\n                items: [\n                  {\n                    text: 'Select...',\n                    value: ''\n                  },\n                  {\n                    text: 'Solid',\n                    value: 'solid'\n                  },\n                  {\n                    text: 'Dotted',\n                    value: 'dotted'\n                  },\n                  {\n                    text: 'Dashed',\n                    value: 'dashed'\n                  },\n                  {\n                    text: 'Double',\n                    value: 'double'\n                  },\n                  {\n                    text: 'Groove',\n                    value: 'groove'\n                  },\n                  {\n                    text: 'Ridge',\n                    value: 'ridge'\n                  },\n                  {\n                    text: 'Inset',\n                    value: 'inset'\n                  },\n                  {\n                    text: 'Outset',\n                    value: 'outset'\n                  },\n                  {\n                    text: 'None',\n                    value: 'none'\n                  },\n                  {\n                    text: 'Hidden',\n                    value: 'hidden'\n                  }\n                ]\n              }\n            ]\n          }\n        ]\n      };\n    };\n    var AdvTab = { makeTab: makeTab$2 };\n\n    var collect = function (editor) {\n      var urlListSanitizer = ListUtils.sanitizer(function (item) {\n        return editor.convertURL(item.value || item.url, 'src');\n      });\n      var futureImageList = new global$4(function (completer) {\n        createImageList(editor, function (imageList) {\n          completer(urlListSanitizer(imageList).map(function (items) {\n            return flatten([\n              [{\n                  text: 'None',\n                  value: ''\n                }],\n              items\n            ]);\n          }));\n        });\n      });\n      var classList = ListUtils.sanitize(getClassList(editor));\n      var hasAdvTab$1 = hasAdvTab(editor);\n      var hasUploadTab$1 = hasUploadTab(editor);\n      var hasUploadUrl$1 = hasUploadUrl(editor);\n      var hasUploadHandler$1 = hasUploadHandler(editor);\n      var image = readImageDataFromSelection(editor);\n      var hasDescription$1 = hasDescription(editor);\n      var hasImageTitle$1 = hasImageTitle(editor);\n      var hasDimensions$1 = hasDimensions(editor);\n      var hasImageCaption$1 = hasImageCaption(editor);\n      var hasAccessibilityOptions = showAccessibilityOptions(editor);\n      var automaticUploads = isAutomaticUploadsEnabled(editor);\n      var prependURL = Optional.some(getPrependUrl(editor)).filter(function (preUrl) {\n        return isString(preUrl) && preUrl.length > 0;\n      });\n      return futureImageList.then(function (imageList) {\n        return {\n          image: image,\n          imageList: imageList,\n          classList: classList,\n          hasAdvTab: hasAdvTab$1,\n          hasUploadTab: hasUploadTab$1,\n          hasUploadUrl: hasUploadUrl$1,\n          hasUploadHandler: hasUploadHandler$1,\n          hasDescription: hasDescription$1,\n          hasImageTitle: hasImageTitle$1,\n          hasDimensions: hasDimensions$1,\n          hasImageCaption: hasImageCaption$1,\n          prependURL: prependURL,\n          hasAccessibilityOptions: hasAccessibilityOptions,\n          automaticUploads: automaticUploads\n        };\n      });\n    };\n\n    var makeItems = function (info) {\n      var imageUrl = {\n        name: 'src',\n        type: 'urlinput',\n        filetype: 'image',\n        label: 'Source'\n      };\n      var imageList = info.imageList.map(function (items) {\n        return {\n          name: 'images',\n          type: 'listbox',\n          label: 'Image list',\n          items: items\n        };\n      });\n      var imageDescription = {\n        name: 'alt',\n        type: 'input',\n        label: 'Alternative description',\n        disabled: info.hasAccessibilityOptions && info.image.isDecorative\n      };\n      var imageTitle = {\n        name: 'title',\n        type: 'input',\n        label: 'Image title'\n      };\n      var imageDimensions = {\n        name: 'dimensions',\n        type: 'sizeinput'\n      };\n      var isDecorative = {\n        type: 'label',\n        label: 'Accessibility',\n        items: [{\n            name: 'isDecorative',\n            type: 'checkbox',\n            label: 'Image is decorative'\n          }]\n      };\n      var classList = info.classList.map(function (items) {\n        return {\n          name: 'classes',\n          type: 'listbox',\n          label: 'Class',\n          items: items\n        };\n      });\n      var caption = {\n        type: 'label',\n        label: 'Caption',\n        items: [{\n            type: 'checkbox',\n            name: 'caption',\n            label: 'Show caption'\n          }]\n      };\n      var getDialogContainerType = function (useColumns) {\n        return useColumns ? {\n          type: 'grid',\n          columns: 2\n        } : { type: 'panel' };\n      };\n      return flatten([\n        [imageUrl],\n        imageList.toArray(),\n        info.hasAccessibilityOptions && info.hasDescription ? [isDecorative] : [],\n        info.hasDescription ? [imageDescription] : [],\n        info.hasImageTitle ? [imageTitle] : [],\n        info.hasDimensions ? [imageDimensions] : [],\n        [__assign(__assign({}, getDialogContainerType(info.classList.isSome() && info.hasImageCaption)), {\n            items: flatten([\n              classList.toArray(),\n              info.hasImageCaption ? [caption] : []\n            ])\n          })]\n      ]);\n    };\n    var makeTab$1 = function (info) {\n      return {\n        title: 'General',\n        name: 'general',\n        items: makeItems(info)\n      };\n    };\n    var MainTab = {\n      makeTab: makeTab$1,\n      makeItems: makeItems\n    };\n\n    var makeTab = function (_info) {\n      var items = [{\n          type: 'dropzone',\n          name: 'fileinput'\n        }];\n      return {\n        title: 'Upload',\n        name: 'upload',\n        items: items\n      };\n    };\n    var UploadTab = { makeTab: makeTab };\n\n    var createState = function (info) {\n      return {\n        prevImage: ListUtils.findEntry(info.imageList, info.image.src),\n        prevAlt: info.image.alt,\n        open: true\n      };\n    };\n    var fromImageData = function (image) {\n      return {\n        src: {\n          value: image.src,\n          meta: {}\n        },\n        images: image.src,\n        alt: image.alt,\n        title: image.title,\n        dimensions: {\n          width: image.width,\n          height: image.height\n        },\n        classes: image.class,\n        caption: image.caption,\n        style: image.style,\n        vspace: image.vspace,\n        border: image.border,\n        hspace: image.hspace,\n        borderstyle: image.borderStyle,\n        fileinput: [],\n        isDecorative: image.isDecorative\n      };\n    };\n    var toImageData = function (data, removeEmptyAlt) {\n      return {\n        src: data.src.value,\n        alt: data.alt.length === 0 && removeEmptyAlt ? null : data.alt,\n        title: data.title,\n        width: data.dimensions.width,\n        height: data.dimensions.height,\n        class: data.classes,\n        style: data.style,\n        caption: data.caption,\n        hspace: data.hspace,\n        vspace: data.vspace,\n        border: data.border,\n        borderStyle: data.borderstyle,\n        isDecorative: data.isDecorative\n      };\n    };\n    var addPrependUrl2 = function (info, srcURL) {\n      if (!/^(?:[a-zA-Z]+:)?\\/\\//.test(srcURL)) {\n        return info.prependURL.bind(function (prependUrl) {\n          if (srcURL.substring(0, prependUrl.length) !== prependUrl) {\n            return Optional.some(prependUrl + srcURL);\n          }\n          return Optional.none();\n        });\n      }\n      return Optional.none();\n    };\n    var addPrependUrl = function (info, api) {\n      var data = api.getData();\n      addPrependUrl2(info, data.src.value).each(function (srcURL) {\n        api.setData({\n          src: {\n            value: srcURL,\n            meta: data.src.meta\n          }\n        });\n      });\n    };\n    var formFillFromMeta2 = function (info, data, meta) {\n      if (info.hasDescription && isString(meta.alt)) {\n        data.alt = meta.alt;\n      }\n      if (info.hasAccessibilityOptions) {\n        data.isDecorative = meta.isDecorative || data.isDecorative || false;\n      }\n      if (info.hasImageTitle && isString(meta.title)) {\n        data.title = meta.title;\n      }\n      if (info.hasDimensions) {\n        if (isString(meta.width)) {\n          data.dimensions.width = meta.width;\n        }\n        if (isString(meta.height)) {\n          data.dimensions.height = meta.height;\n        }\n      }\n      if (isString(meta.class)) {\n        ListUtils.findEntry(info.classList, meta.class).each(function (entry) {\n          data.classes = entry.value;\n        });\n      }\n      if (info.hasImageCaption) {\n        if (isBoolean(meta.caption)) {\n          data.caption = meta.caption;\n        }\n      }\n      if (info.hasAdvTab) {\n        if (isString(meta.style)) {\n          data.style = meta.style;\n        }\n        if (isString(meta.vspace)) {\n          data.vspace = meta.vspace;\n        }\n        if (isString(meta.border)) {\n          data.border = meta.border;\n        }\n        if (isString(meta.hspace)) {\n          data.hspace = meta.hspace;\n        }\n        if (isString(meta.borderstyle)) {\n          data.borderstyle = meta.borderstyle;\n        }\n      }\n    };\n    var formFillFromMeta = function (info, api) {\n      var data = api.getData();\n      var meta = data.src.meta;\n      if (meta !== undefined) {\n        var newData = deepMerge({}, data);\n        formFillFromMeta2(info, newData, meta);\n        api.setData(newData);\n      }\n    };\n    var calculateImageSize = function (helpers, info, state, api) {\n      var data = api.getData();\n      var url = data.src.value;\n      var meta = data.src.meta || {};\n      if (!meta.width && !meta.height && info.hasDimensions) {\n        if (isNotEmpty(url)) {\n          helpers.imageSize(url).then(function (size) {\n            if (state.open) {\n              api.setData({ dimensions: size });\n            }\n          }).catch(function (e) {\n            return console.error(e);\n          });\n        } else {\n          api.setData({\n            dimensions: {\n              width: '',\n              height: ''\n            }\n          });\n        }\n      }\n    };\n    var updateImagesDropdown = function (info, state, api) {\n      var data = api.getData();\n      var image = ListUtils.findEntry(info.imageList, data.src.value);\n      state.prevImage = image;\n      api.setData({\n        images: image.map(function (entry) {\n          return entry.value;\n        }).getOr('')\n      });\n    };\n    var changeSrc = function (helpers, info, state, api) {\n      addPrependUrl(info, api);\n      formFillFromMeta(info, api);\n      calculateImageSize(helpers, info, state, api);\n      updateImagesDropdown(info, state, api);\n    };\n    var changeImages = function (helpers, info, state, api) {\n      var data = api.getData();\n      var image = ListUtils.findEntry(info.imageList, data.images);\n      image.each(function (img) {\n        var updateAlt = data.alt === '' || state.prevImage.map(function (image) {\n          return image.text === data.alt;\n        }).getOr(false);\n        if (updateAlt) {\n          if (img.value === '') {\n            api.setData({\n              src: img,\n              alt: state.prevAlt\n            });\n          } else {\n            api.setData({\n              src: img,\n              alt: img.text\n            });\n          }\n        } else {\n          api.setData({ src: img });\n        }\n      });\n      state.prevImage = image;\n      changeSrc(helpers, info, state, api);\n    };\n    var calcVSpace = function (css) {\n      var matchingTopBottom = css['margin-top'] && css['margin-bottom'] && css['margin-top'] === css['margin-bottom'];\n      return matchingTopBottom ? removePixelSuffix(String(css['margin-top'])) : '';\n    };\n    var calcHSpace = function (css) {\n      var matchingLeftRight = css['margin-right'] && css['margin-left'] && css['margin-right'] === css['margin-left'];\n      return matchingLeftRight ? removePixelSuffix(String(css['margin-right'])) : '';\n    };\n    var calcBorderWidth = function (css) {\n      return css['border-width'] ? removePixelSuffix(String(css['border-width'])) : '';\n    };\n    var calcBorderStyle = function (css) {\n      return css['border-style'] ? String(css['border-style']) : '';\n    };\n    var calcStyle = function (parseStyle, serializeStyle, css) {\n      return serializeStyle(parseStyle(serializeStyle(css)));\n    };\n    var changeStyle2 = function (parseStyle, serializeStyle, data) {\n      var css = mergeMargins(parseStyle(data.style));\n      var dataCopy = deepMerge({}, data);\n      dataCopy.vspace = calcVSpace(css);\n      dataCopy.hspace = calcHSpace(css);\n      dataCopy.border = calcBorderWidth(css);\n      dataCopy.borderstyle = calcBorderStyle(css);\n      dataCopy.style = calcStyle(parseStyle, serializeStyle, css);\n      return dataCopy;\n    };\n    var changeStyle = function (helpers, api) {\n      var data = api.getData();\n      var newData = changeStyle2(helpers.parseStyle, helpers.serializeStyle, data);\n      api.setData(newData);\n    };\n    var changeAStyle = function (helpers, info, api) {\n      var data = deepMerge(fromImageData(info.image), api.getData());\n      var style = getStyleValue(helpers.normalizeCss, toImageData(data, false));\n      api.setData({ style: style });\n    };\n    var changeFileInput = function (helpers, info, state, api) {\n      var data = api.getData();\n      api.block('Uploading image');\n      head(data.fileinput).fold(function () {\n        api.unblock();\n      }, function (file) {\n        var blobUri = URL.createObjectURL(file);\n        var finalize = function () {\n          api.unblock();\n          URL.revokeObjectURL(blobUri);\n        };\n        var updateSrcAndSwitchTab = function (url) {\n          api.setData({\n            src: {\n              value: url,\n              meta: {}\n            }\n          });\n          api.showTab('general');\n          changeSrc(helpers, info, state, api);\n        };\n        blobToDataUri(file).then(function (dataUrl) {\n          var blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);\n          if (info.automaticUploads) {\n            helpers.uploadImage(blobInfo).then(function (result) {\n              updateSrcAndSwitchTab(result.url);\n              finalize();\n            }).catch(function (err) {\n              finalize();\n              helpers.alertErr(err);\n            });\n          } else {\n            helpers.addToBlobCache(blobInfo);\n            updateSrcAndSwitchTab(blobInfo.blobUri());\n            api.unblock();\n          }\n        });\n      });\n    };\n    var changeHandler = function (helpers, info, state) {\n      return function (api, evt) {\n        if (evt.name === 'src') {\n          changeSrc(helpers, info, state, api);\n        } else if (evt.name === 'images') {\n          changeImages(helpers, info, state, api);\n        } else if (evt.name === 'alt') {\n          state.prevAlt = api.getData().alt;\n        } else if (evt.name === 'style') {\n          changeStyle(helpers, api);\n        } else if (evt.name === 'vspace' || evt.name === 'hspace' || evt.name === 'border' || evt.name === 'borderstyle') {\n          changeAStyle(helpers, info, api);\n        } else if (evt.name === 'fileinput') {\n          changeFileInput(helpers, info, state, api);\n        } else if (evt.name === 'isDecorative') {\n          if (api.getData().isDecorative) {\n            api.disable('alt');\n          } else {\n            api.enable('alt');\n          }\n        }\n      };\n    };\n    var closeHandler = function (state) {\n      return function () {\n        state.open = false;\n      };\n    };\n    var makeDialogBody = function (info) {\n      if (info.hasAdvTab || info.hasUploadUrl || info.hasUploadHandler) {\n        var tabPanel = {\n          type: 'tabpanel',\n          tabs: flatten([\n            [MainTab.makeTab(info)],\n            info.hasAdvTab ? [AdvTab.makeTab(info)] : [],\n            info.hasUploadTab && (info.hasUploadUrl || info.hasUploadHandler) ? [UploadTab.makeTab(info)] : []\n          ])\n        };\n        return tabPanel;\n      } else {\n        var panel = {\n          type: 'panel',\n          items: MainTab.makeItems(info)\n        };\n        return panel;\n      }\n    };\n    var makeDialog = function (helpers) {\n      return function (info) {\n        var state = createState(info);\n        return {\n          title: 'Insert/Edit Image',\n          size: 'normal',\n          body: makeDialogBody(info),\n          buttons: [\n            {\n              type: 'cancel',\n              name: 'cancel',\n              text: 'Cancel'\n            },\n            {\n              type: 'submit',\n              name: 'save',\n              text: 'Save',\n              primary: true\n            }\n          ],\n          initialData: fromImageData(info.image),\n          onSubmit: helpers.onSubmit(info),\n          onChange: changeHandler(helpers, info, state),\n          onClose: closeHandler(state)\n        };\n      };\n    };\n    var submitHandler = function (editor) {\n      return function (info) {\n        return function (api) {\n          var data = deepMerge(fromImageData(info.image), api.getData());\n          editor.execCommand('mceUpdateImage', false, toImageData(data, info.hasAccessibilityOptions));\n          editor.editorUpload.uploadImagesAuto();\n          api.close();\n        };\n      };\n    };\n    var imageSize = function (editor) {\n      return function (url) {\n        if (!isSafeImageUrl(editor, url)) {\n          return global$4.resolve({\n            width: '',\n            height: ''\n          });\n        } else {\n          return getImageSize(editor.documentBaseURI.toAbsolute(url)).then(function (dimensions) {\n            return {\n              width: String(dimensions.width),\n              height: String(dimensions.height)\n            };\n          });\n        }\n      };\n    };\n    var createBlobCache = function (editor) {\n      return function (file, blobUri, dataUrl) {\n        return editor.editorUpload.blobCache.create({\n          blob: file,\n          blobUri: blobUri,\n          name: file.name ? file.name.replace(/\\.[^\\.]+$/, '') : null,\n          filename: file.name,\n          base64: dataUrl.split(',')[1]\n        });\n      };\n    };\n    var addToBlobCache = function (editor) {\n      return function (blobInfo) {\n        editor.editorUpload.blobCache.add(blobInfo);\n      };\n    };\n    var alertErr = function (editor) {\n      return function (message) {\n        editor.windowManager.alert(message);\n      };\n    };\n    var normalizeCss = function (editor) {\n      return function (cssText) {\n        return normalizeCss$1(editor, cssText);\n      };\n    };\n    var parseStyle = function (editor) {\n      return function (cssText) {\n        return editor.dom.parseStyle(cssText);\n      };\n    };\n    var serializeStyle = function (editor) {\n      return function (stylesArg, name) {\n        return editor.dom.serializeStyle(stylesArg, name);\n      };\n    };\n    var uploadImage = function (editor) {\n      return function (blobInfo) {\n        return global$1(editor).upload([blobInfo], false).then(function (results) {\n          if (results.length === 0) {\n            return global$4.reject('Failed to upload image');\n          } else if (results[0].status === false) {\n            return global$4.reject(results[0].error.message);\n          } else {\n            return results[0];\n          }\n        });\n      };\n    };\n    var Dialog = function (editor) {\n      var helpers = {\n        onSubmit: submitHandler(editor),\n        imageSize: imageSize(editor),\n        addToBlobCache: addToBlobCache(editor),\n        createBlobCache: createBlobCache(editor),\n        alertErr: alertErr(editor),\n        normalizeCss: normalizeCss(editor),\n        parseStyle: parseStyle(editor),\n        serializeStyle: serializeStyle(editor),\n        uploadImage: uploadImage(editor)\n      };\n      var open = function () {\n        collect(editor).then(makeDialog(helpers)).then(editor.windowManager.open);\n      };\n      return { open: open };\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('mceImage', Dialog(editor).open);\n      editor.addCommand('mceUpdateImage', function (_ui, data) {\n        editor.undoManager.transact(function () {\n          return insertOrUpdateImage(editor, data);\n        });\n      });\n    };\n\n    var hasImageClass = function (node) {\n      var className = node.attr('class');\n      return className && /\\bimage\\b/.test(className);\n    };\n    var toggleContentEditableState = function (state) {\n      return function (nodes) {\n        var i = nodes.length;\n        var toggleContentEditable = function (node) {\n          node.attr('contenteditable', state ? 'true' : null);\n        };\n        while (i--) {\n          var node = nodes[i];\n          if (hasImageClass(node)) {\n            node.attr('contenteditable', state ? 'false' : null);\n            global.each(node.getAll('figcaption'), toggleContentEditable);\n          }\n        }\n      };\n    };\n    var setup = function (editor) {\n      editor.on('PreInit', function () {\n        editor.parser.addNodeFilter('figure', toggleContentEditableState(true));\n        editor.serializer.addNodeFilter('figure', toggleContentEditableState(false));\n      });\n    };\n\n    var register = function (editor) {\n      editor.ui.registry.addToggleButton('image', {\n        icon: 'image',\n        tooltip: 'Insert/edit image',\n        onAction: Dialog(editor).open,\n        onSetup: function (buttonApi) {\n          buttonApi.setActive(isNonNullable(getSelectedImage(editor)));\n          return editor.selection.selectorChangedWithUnbind('img:not([data-mce-object],[data-mce-placeholder]),figure.image', buttonApi.setActive).unbind;\n        }\n      });\n      editor.ui.registry.addMenuItem('image', {\n        icon: 'image',\n        text: 'Image...',\n        onAction: Dialog(editor).open\n      });\n      editor.ui.registry.addContextMenu('image', {\n        update: function (element) {\n          return isFigure(element) || isImage(element) && !isPlaceholderImage(element) ? ['image'] : [];\n        }\n      });\n    };\n\n    function Plugin () {\n      global$6.add('image', function (editor) {\n        setup(editor);\n        register(editor);\n        register$1(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/image/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/imagetools/index.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/imagetools/index.js ***!
  \**************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"imagetools\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/imagetools')\n//   ES2015:\n//     import 'tinymce/plugins/imagetools'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/imagetools/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/imagetools/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/imagetools/plugin.js":
/*!***************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/imagetools/plugin.js ***!
  \***************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var isArray = isType('array');\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var exports$1 = {}, module = { exports: exports$1 };\n    (function (define, exports, module, require) {\n      (function (global, factory) {\n        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());\n      }(this, function () {\n        var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n        var promise = { exports: {} };\n        (function (module) {\n          (function (root) {\n            var setTimeoutFunc = setTimeout;\n            function noop() {\n            }\n            function bind(fn, thisArg) {\n              return function () {\n                fn.apply(thisArg, arguments);\n              };\n            }\n            function Promise(fn) {\n              if (typeof this !== 'object')\n                throw new TypeError('Promises must be constructed via new');\n              if (typeof fn !== 'function')\n                throw new TypeError('not a function');\n              this._state = 0;\n              this._handled = false;\n              this._value = undefined;\n              this._deferreds = [];\n              doResolve(fn, this);\n            }\n            function handle(self, deferred) {\n              while (self._state === 3) {\n                self = self._value;\n              }\n              if (self._state === 0) {\n                self._deferreds.push(deferred);\n                return;\n              }\n              self._handled = true;\n              Promise._immediateFn(function () {\n                var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n                if (cb === null) {\n                  (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n                  return;\n                }\n                var ret;\n                try {\n                  ret = cb(self._value);\n                } catch (e) {\n                  reject(deferred.promise, e);\n                  return;\n                }\n                resolve(deferred.promise, ret);\n              });\n            }\n            function resolve(self, newValue) {\n              try {\n                if (newValue === self)\n                  throw new TypeError('A promise cannot be resolved with itself.');\n                if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n                  var then = newValue.then;\n                  if (newValue instanceof Promise) {\n                    self._state = 3;\n                    self._value = newValue;\n                    finale(self);\n                    return;\n                  } else if (typeof then === 'function') {\n                    doResolve(bind(then, newValue), self);\n                    return;\n                  }\n                }\n                self._state = 1;\n                self._value = newValue;\n                finale(self);\n              } catch (e) {\n                reject(self, e);\n              }\n            }\n            function reject(self, newValue) {\n              self._state = 2;\n              self._value = newValue;\n              finale(self);\n            }\n            function finale(self) {\n              if (self._state === 2 && self._deferreds.length === 0) {\n                Promise._immediateFn(function () {\n                  if (!self._handled) {\n                    Promise._unhandledRejectionFn(self._value);\n                  }\n                });\n              }\n              for (var i = 0, len = self._deferreds.length; i < len; i++) {\n                handle(self, self._deferreds[i]);\n              }\n              self._deferreds = null;\n            }\n            function Handler(onFulfilled, onRejected, promise) {\n              this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n              this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n              this.promise = promise;\n            }\n            function doResolve(fn, self) {\n              var done = false;\n              try {\n                fn(function (value) {\n                  if (done)\n                    return;\n                  done = true;\n                  resolve(self, value);\n                }, function (reason) {\n                  if (done)\n                    return;\n                  done = true;\n                  reject(self, reason);\n                });\n              } catch (ex) {\n                if (done)\n                  return;\n                done = true;\n                reject(self, ex);\n              }\n            }\n            Promise.prototype['catch'] = function (onRejected) {\n              return this.then(null, onRejected);\n            };\n            Promise.prototype.then = function (onFulfilled, onRejected) {\n              var prom = new this.constructor(noop);\n              handle(this, new Handler(onFulfilled, onRejected, prom));\n              return prom;\n            };\n            Promise.all = function (arr) {\n              var args = Array.prototype.slice.call(arr);\n              return new Promise(function (resolve, reject) {\n                if (args.length === 0)\n                  return resolve([]);\n                var remaining = args.length;\n                function res(i, val) {\n                  try {\n                    if (val && (typeof val === 'object' || typeof val === 'function')) {\n                      var then = val.then;\n                      if (typeof then === 'function') {\n                        then.call(val, function (val) {\n                          res(i, val);\n                        }, reject);\n                        return;\n                      }\n                    }\n                    args[i] = val;\n                    if (--remaining === 0) {\n                      resolve(args);\n                    }\n                  } catch (ex) {\n                    reject(ex);\n                  }\n                }\n                for (var i = 0; i < args.length; i++) {\n                  res(i, args[i]);\n                }\n              });\n            };\n            Promise.resolve = function (value) {\n              if (value && typeof value === 'object' && value.constructor === Promise) {\n                return value;\n              }\n              return new Promise(function (resolve) {\n                resolve(value);\n              });\n            };\n            Promise.reject = function (value) {\n              return new Promise(function (resolve, reject) {\n                reject(value);\n              });\n            };\n            Promise.race = function (values) {\n              return new Promise(function (resolve, reject) {\n                for (var i = 0, len = values.length; i < len; i++) {\n                  values[i].then(resolve, reject);\n                }\n              });\n            };\n            Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) {\n              setImmediate(fn);\n            } : function (fn) {\n              setTimeoutFunc(fn, 0);\n            };\n            Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n              if (typeof console !== 'undefined' && console) {\n                console.warn('Possible Unhandled Promise Rejection:', err);\n              }\n            };\n            Promise._setImmediateFn = function _setImmediateFn(fn) {\n              Promise._immediateFn = fn;\n            };\n            Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {\n              Promise._unhandledRejectionFn = fn;\n            };\n            if (module.exports) {\n              module.exports = Promise;\n            } else if (!root.Promise) {\n              root.Promise = Promise;\n            }\n          }(commonjsGlobal));\n        }(promise));\n        var promisePolyfill = promise.exports;\n        var Global = function () {\n          if (typeof window !== 'undefined') {\n            return window;\n          } else {\n            return Function('return this;')();\n          }\n        }();\n        var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill };\n        return promisePolyfill_1;\n      }));\n    }(undefined, exports$1, module));\n    var Promise$1 = module.exports.boltExport;\n\n    var create$1 = function (width, height) {\n      return resize(document.createElement('canvas'), width, height);\n    };\n    var clone = function (canvas) {\n      var tCanvas = create$1(canvas.width, canvas.height);\n      var ctx = get2dContext(tCanvas);\n      ctx.drawImage(canvas, 0, 0);\n      return tCanvas;\n    };\n    var get2dContext = function (canvas) {\n      return canvas.getContext('2d');\n    };\n    var resize = function (canvas, width, height) {\n      canvas.width = width;\n      canvas.height = height;\n      return canvas;\n    };\n\n    var getWidth = function (image) {\n      return image.naturalWidth || image.width;\n    };\n    var getHeight = function (image) {\n      return image.naturalHeight || image.height;\n    };\n\n    var imageToBlob$2 = function (image) {\n      var src = image.src;\n      if (src.indexOf('data:') === 0) {\n        return dataUriToBlob(src);\n      }\n      return anyUriToBlob(src);\n    };\n    var blobToImage$1 = function (blob) {\n      return new Promise$1(function (resolve, reject) {\n        var blobUrl = URL.createObjectURL(blob);\n        var image = new Image();\n        var removeListeners = function () {\n          image.removeEventListener('load', loaded);\n          image.removeEventListener('error', error);\n        };\n        var loaded = function () {\n          removeListeners();\n          resolve(image);\n        };\n        var error = function () {\n          removeListeners();\n          reject('Unable to load data of type ' + blob.type + ': ' + blobUrl);\n        };\n        image.addEventListener('load', loaded);\n        image.addEventListener('error', error);\n        image.src = blobUrl;\n        if (image.complete) {\n          setTimeout(loaded, 0);\n        }\n      });\n    };\n    var anyUriToBlob = function (url) {\n      return new Promise$1(function (resolve, reject) {\n        var xhr = new XMLHttpRequest();\n        xhr.open('GET', url, true);\n        xhr.responseType = 'blob';\n        xhr.onload = function () {\n          if (this.status === 200) {\n            resolve(this.response);\n          }\n        };\n        xhr.onerror = function () {\n          var _this = this;\n          var corsError = function () {\n            var obj = new Error('No access to download image');\n            obj.code = 18;\n            obj.name = 'SecurityError';\n            return obj;\n          };\n          var genericError = function () {\n            return new Error('Error ' + _this.status + ' downloading image');\n          };\n          reject(this.status === 0 ? corsError() : genericError());\n        };\n        xhr.send();\n      });\n    };\n    var dataUriToBlobSync = function (uri) {\n      var data = uri.split(',');\n      var matches = /data:([^;]+)/.exec(data[0]);\n      if (!matches) {\n        return Optional.none();\n      }\n      var mimetype = matches[1];\n      var base64 = data[1];\n      var sliceSize = 1024;\n      var byteCharacters = atob(base64);\n      var bytesLength = byteCharacters.length;\n      var slicesCount = Math.ceil(bytesLength / sliceSize);\n      var byteArrays = new Array(slicesCount);\n      for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n        var begin = sliceIndex * sliceSize;\n        var end = Math.min(begin + sliceSize, bytesLength);\n        var bytes = new Array(end - begin);\n        for (var offset = begin, i = 0; offset < end; ++i, ++offset) {\n          bytes[i] = byteCharacters[offset].charCodeAt(0);\n        }\n        byteArrays[sliceIndex] = new Uint8Array(bytes);\n      }\n      return Optional.some(new Blob(byteArrays, { type: mimetype }));\n    };\n    var dataUriToBlob = function (uri) {\n      return new Promise$1(function (resolve, reject) {\n        dataUriToBlobSync(uri).fold(function () {\n          reject('uri is not base64: ' + uri);\n        }, resolve);\n      });\n    };\n    var canvasToBlob = function (canvas, type, quality) {\n      type = type || 'image/png';\n      if (isFunction(HTMLCanvasElement.prototype.toBlob)) {\n        return new Promise$1(function (resolve, reject) {\n          canvas.toBlob(function (blob) {\n            if (blob) {\n              resolve(blob);\n            } else {\n              reject();\n            }\n          }, type, quality);\n        });\n      } else {\n        return dataUriToBlob(canvas.toDataURL(type, quality));\n      }\n    };\n    var canvasToDataURL = function (canvas, type, quality) {\n      type = type || 'image/png';\n      return canvas.toDataURL(type, quality);\n    };\n    var blobToCanvas = function (blob) {\n      return blobToImage$1(blob).then(function (image) {\n        revokeImageUrl(image);\n        var canvas = create$1(getWidth(image), getHeight(image));\n        var context = get2dContext(canvas);\n        context.drawImage(image, 0, 0);\n        return canvas;\n      });\n    };\n    var blobToDataUri = function (blob) {\n      return new Promise$1(function (resolve) {\n        var reader = new FileReader();\n        reader.onloadend = function () {\n          resolve(reader.result);\n        };\n        reader.readAsDataURL(blob);\n      });\n    };\n    var revokeImageUrl = function (image) {\n      URL.revokeObjectURL(image.src);\n    };\n\n    var blobToImage = function (blob) {\n      return blobToImage$1(blob);\n    };\n    var imageToBlob$1 = function (image) {\n      return imageToBlob$2(image);\n    };\n\n    var nativeIndexOf = Array.prototype.indexOf;\n    var rawIndexOf = function (ts, t) {\n      return nativeIndexOf.call(ts, t);\n    };\n    var contains = function (xs, x) {\n      return rawIndexOf(xs, x) > -1;\n    };\n    var each$1 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var filter = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var foldl = function (xs, f, acc) {\n      each$1(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var forall = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        var x = xs[i];\n        if (pred(x, i) !== true) {\n          return false;\n        }\n      }\n      return true;\n    };\n\n    var keys = Object.keys;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n\n    var generate = function (cases) {\n      if (!isArray(cases)) {\n        throw new Error('cases must be an array');\n      }\n      if (cases.length === 0) {\n        throw new Error('there must be at least one case');\n      }\n      var constructors = [];\n      var adt = {};\n      each$1(cases, function (acase, count) {\n        var keys$1 = keys(acase);\n        if (keys$1.length !== 1) {\n          throw new Error('one and only one name per case');\n        }\n        var key = keys$1[0];\n        var value = acase[key];\n        if (adt[key] !== undefined) {\n          throw new Error('duplicate key detected:' + key);\n        } else if (key === 'cata') {\n          throw new Error('cannot have a case named cata (sorry)');\n        } else if (!isArray(value)) {\n          throw new Error('case arguments must be an array');\n        }\n        constructors.push(key);\n        adt[key] = function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          var argLength = args.length;\n          if (argLength !== value.length) {\n            throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);\n          }\n          var match = function (branches) {\n            var branchKeys = keys(branches);\n            if (constructors.length !== branchKeys.length) {\n              throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\\nActual: ' + branchKeys.join(','));\n            }\n            var allReqd = forall(constructors, function (reqKey) {\n              return contains(branchKeys, reqKey);\n            });\n            if (!allReqd) {\n              throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\\nRequired: ' + constructors.join(', '));\n            }\n            return branches[key].apply(null, args);\n          };\n          return {\n            fold: function () {\n              var foldArgs = [];\n              for (var _i = 0; _i < arguments.length; _i++) {\n                foldArgs[_i] = arguments[_i];\n              }\n              if (foldArgs.length !== cases.length) {\n                throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length);\n              }\n              var target = foldArgs[count];\n              return target.apply(null, args);\n            },\n            match: match,\n            log: function (label) {\n              console.log(label, {\n                constructors: constructors,\n                constructor: key,\n                params: args\n              });\n            }\n          };\n        };\n      });\n      return adt;\n    };\n    var Adt = { generate: generate };\n\n    Adt.generate([\n      {\n        bothErrors: [\n          'error1',\n          'error2'\n        ]\n      },\n      {\n        firstError: [\n          'error1',\n          'value2'\n        ]\n      },\n      {\n        secondError: [\n          'value1',\n          'error2'\n        ]\n      },\n      {\n        bothValues: [\n          'value1',\n          'value2'\n        ]\n      }\n    ]);\n\n    var create = function (getCanvas, blob, uri) {\n      var initialType = blob.type;\n      var getType = constant(initialType);\n      var toBlob = function () {\n        return Promise$1.resolve(blob);\n      };\n      var toDataURL = constant(uri);\n      var toBase64 = function () {\n        return uri.split(',')[1];\n      };\n      var toAdjustedBlob = function (type, quality) {\n        return getCanvas.then(function (canvas) {\n          return canvasToBlob(canvas, type, quality);\n        });\n      };\n      var toAdjustedDataURL = function (type, quality) {\n        return getCanvas.then(function (canvas) {\n          return canvasToDataURL(canvas, type, quality);\n        });\n      };\n      var toAdjustedBase64 = function (type, quality) {\n        return toAdjustedDataURL(type, quality).then(function (dataurl) {\n          return dataurl.split(',')[1];\n        });\n      };\n      var toCanvas = function () {\n        return getCanvas.then(clone);\n      };\n      return {\n        getType: getType,\n        toBlob: toBlob,\n        toDataURL: toDataURL,\n        toBase64: toBase64,\n        toAdjustedBlob: toAdjustedBlob,\n        toAdjustedDataURL: toAdjustedDataURL,\n        toAdjustedBase64: toAdjustedBase64,\n        toCanvas: toCanvas\n      };\n    };\n    var fromBlob = function (blob) {\n      return blobToDataUri(blob).then(function (uri) {\n        return create(blobToCanvas(blob), blob, uri);\n      });\n    };\n    var fromCanvas = function (canvas, type) {\n      return canvasToBlob(canvas, type).then(function (blob) {\n        return create(Promise$1.resolve(canvas), blob, canvas.toDataURL());\n      });\n    };\n\n    var ceilWithPrecision = function (num, precision) {\n      if (precision === void 0) {\n        precision = 2;\n      }\n      var mul = Math.pow(10, precision);\n      var upper = Math.round(num * mul);\n      return Math.ceil(upper / mul);\n    };\n    var rotate$2 = function (ir, angle) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyRotate(canvas, ir.getType(), angle);\n      });\n    };\n    var applyRotate = function (image, type, angle) {\n      var degrees = angle < 0 ? 360 + angle : angle;\n      var rad = degrees * Math.PI / 180;\n      var width = image.width;\n      var height = image.height;\n      var sin = Math.sin(rad);\n      var cos = Math.cos(rad);\n      var newWidth = ceilWithPrecision(Math.abs(width * cos) + Math.abs(height * sin));\n      var newHeight = ceilWithPrecision(Math.abs(width * sin) + Math.abs(height * cos));\n      var canvas = create$1(newWidth, newHeight);\n      var context = get2dContext(canvas);\n      context.translate(newWidth / 2, newHeight / 2);\n      context.rotate(rad);\n      context.drawImage(image, -width / 2, -height / 2);\n      return fromCanvas(canvas, type);\n    };\n    var flip$2 = function (ir, axis) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyFlip(canvas, ir.getType(), axis);\n      });\n    };\n    var applyFlip = function (image, type, axis) {\n      var canvas = create$1(image.width, image.height);\n      var context = get2dContext(canvas);\n      if (axis === 'v') {\n        context.scale(1, -1);\n        context.drawImage(image, 0, -canvas.height);\n      } else {\n        context.scale(-1, 1);\n        context.drawImage(image, -canvas.width, 0);\n      }\n      return fromCanvas(canvas, type);\n    };\n\n    var flip$1 = function (ir, axis) {\n      return flip$2(ir, axis);\n    };\n    var rotate$1 = function (ir, angle) {\n      return rotate$2(ir, angle);\n    };\n\n    var sendRequest = function (url, headers, withCredentials) {\n      if (withCredentials === void 0) {\n        withCredentials = false;\n      }\n      return new Promise$1(function (resolve) {\n        var xhr = new XMLHttpRequest();\n        xhr.onreadystatechange = function () {\n          if (xhr.readyState === 4) {\n            resolve({\n              status: xhr.status,\n              blob: xhr.response\n            });\n          }\n        };\n        xhr.open('GET', url, true);\n        xhr.withCredentials = withCredentials;\n        each(headers, function (value, key) {\n          xhr.setRequestHeader(key, value);\n        });\n        xhr.responseType = 'blob';\n        xhr.send();\n      });\n    };\n    var readBlobText = function (blob) {\n      return new Promise$1(function (resolve, reject) {\n        var reader = new FileReader();\n        reader.onload = function () {\n          resolve(reader.result);\n        };\n        reader.onerror = function (e) {\n          reject(e);\n        };\n        reader.readAsText(blob);\n      });\n    };\n    var parseJson = function (text) {\n      try {\n        return Optional.some(JSON.parse(text));\n      } catch (ex) {\n        return Optional.none();\n      }\n    };\n\n    var friendlyHttpErrors = [\n      {\n        code: 404,\n        message: 'Could not find Image Proxy'\n      },\n      {\n        code: 403,\n        message: 'Rejected request'\n      },\n      {\n        code: 0,\n        message: 'Incorrect Image Proxy URL'\n      }\n    ];\n    var friendlyServiceErrors = [\n      {\n        type: 'not_found',\n        message: 'Failed to load image.'\n      },\n      {\n        type: 'key_missing',\n        message: 'The request did not include an api key.'\n      },\n      {\n        type: 'key_not_found',\n        message: 'The provided api key could not be found.'\n      },\n      {\n        type: 'domain_not_trusted',\n        message: 'The api key is not valid for the request origins.'\n      }\n    ];\n    var traverseJson = function (json, path) {\n      var value = foldl(path, function (result, key) {\n        return isNonNullable(result) ? result[key] : undefined;\n      }, json);\n      return Optional.from(value);\n    };\n    var isServiceErrorCode = function (code, blob) {\n      return (blob === null || blob === void 0 ? void 0 : blob.type) === 'application/json' && (code === 400 || code === 403 || code === 404 || code === 500);\n    };\n    var getHttpErrorMsg = function (status) {\n      var message = find(friendlyHttpErrors, function (error) {\n        return status === error.code;\n      }).fold(constant('Unknown ImageProxy error'), function (error) {\n        return error.message;\n      });\n      return 'ImageProxy HTTP error: ' + message;\n    };\n    var handleHttpError = function (status) {\n      var message = getHttpErrorMsg(status);\n      return Promise$1.reject(message);\n    };\n    var getServiceErrorMsg = function (type) {\n      return find(friendlyServiceErrors, function (error) {\n        return error.type === type;\n      }).fold(constant('Unknown service error'), function (error) {\n        return error.message;\n      });\n    };\n    var getServiceError = function (text) {\n      var serviceError = parseJson(text);\n      var errorMsg = serviceError.bind(function (err) {\n        return traverseJson(err, [\n          'error',\n          'type'\n        ]).map(getServiceErrorMsg);\n      }).getOr('Invalid JSON in service error message');\n      return 'ImageProxy Service error: ' + errorMsg;\n    };\n    var handleServiceError = function (blob) {\n      return readBlobText(blob).then(function (text) {\n        var serviceError = getServiceError(text);\n        return Promise$1.reject(serviceError);\n      });\n    };\n    var handleServiceErrorResponse = function (status, blob) {\n      return isServiceErrorCode(status, blob) ? handleServiceError(blob) : handleHttpError(status);\n    };\n\n    var appendApiKey = function (url, apiKey) {\n      var separator = url.indexOf('?') === -1 ? '?' : '&';\n      if (/[?&]apiKey=/.test(url)) {\n        return url;\n      } else {\n        return url + separator + 'apiKey=' + encodeURIComponent(apiKey);\n      }\n    };\n    var isError = function (status) {\n      return status < 200 || status >= 300;\n    };\n    var requestServiceBlob = function (url, apiKey) {\n      var headers = {\n        'Content-Type': 'application/json;charset=UTF-8',\n        'tiny-api-key': apiKey\n      };\n      return sendRequest(appendApiKey(url, apiKey), headers).then(function (result) {\n        return isError(result.status) ? handleServiceErrorResponse(result.status, result.blob) : Promise$1.resolve(result.blob);\n      });\n    };\n    var requestBlob = function (url, withCredentials) {\n      return sendRequest(url, {}, withCredentials).then(function (result) {\n        return isError(result.status) ? handleHttpError(result.status) : Promise$1.resolve(result.blob);\n      });\n    };\n    var getUrl = function (url, apiKey, withCredentials) {\n      if (withCredentials === void 0) {\n        withCredentials = false;\n      }\n      return apiKey ? requestServiceBlob(url, apiKey) : requestBlob(url, withCredentials);\n    };\n\n    var blobToImageResult = function (blob) {\n      return fromBlob(blob);\n    };\n\n    var ELEMENT = 1;\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    var is = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var child$1 = function (scope, predicate) {\n      var pred = function (node) {\n        return predicate(SugarElement.fromDom(node));\n      };\n      var result = find(scope.dom.childNodes, pred);\n      return result.map(SugarElement.fromDom);\n    };\n\n    var child = function (scope, selector) {\n      return child$1(scope, function (e) {\n        return is(e, selector);\n      });\n    };\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.URI');\n\n    var getToolbarItems = function (editor) {\n      return editor.getParam('imagetools_toolbar', 'rotateleft rotateright flipv fliph editimage imageoptions');\n    };\n    var getProxyUrl = function (editor) {\n      return editor.getParam('imagetools_proxy');\n    };\n    var getCorsHosts = function (editor) {\n      return editor.getParam('imagetools_cors_hosts', [], 'string[]');\n    };\n    var getCredentialsHosts = function (editor) {\n      return editor.getParam('imagetools_credentials_hosts', [], 'string[]');\n    };\n    var getFetchImage = function (editor) {\n      return Optional.from(editor.getParam('imagetools_fetch_image', null, 'function'));\n    };\n    var getApiKey = function (editor) {\n      return editor.getParam('api_key', editor.getParam('imagetools_api_key', '', 'string'), 'string');\n    };\n    var getUploadTimeout = function (editor) {\n      return editor.getParam('images_upload_timeout', 30000, 'number');\n    };\n    var shouldReuseFilename = function (editor) {\n      return editor.getParam('images_reuse_filename', false, 'boolean');\n    };\n\n    var getImageSize = function (img) {\n      var width, height;\n      var isPxValue = function (value) {\n        return /^[0-9\\.]+px$/.test(value);\n      };\n      width = img.style.width;\n      height = img.style.height;\n      if (width || height) {\n        if (isPxValue(width) && isPxValue(height)) {\n          return {\n            w: parseInt(width, 10),\n            h: parseInt(height, 10)\n          };\n        }\n        return null;\n      }\n      width = img.width;\n      height = img.height;\n      if (width && height) {\n        return {\n          w: parseInt(width, 10),\n          h: parseInt(height, 10)\n        };\n      }\n      return null;\n    };\n    var setImageSize = function (img, size) {\n      var width, height;\n      if (size) {\n        width = img.style.width;\n        height = img.style.height;\n        if (width || height) {\n          img.style.width = size.w + 'px';\n          img.style.height = size.h + 'px';\n          img.removeAttribute('data-mce-style');\n        }\n        width = img.width;\n        height = img.height;\n        if (width || height) {\n          img.setAttribute('width', String(size.w));\n          img.setAttribute('height', String(size.h));\n        }\n      }\n    };\n    var getNaturalImageSize = function (img) {\n      return {\n        w: img.naturalWidth,\n        h: img.naturalHeight\n      };\n    };\n\n    var count = 0;\n    var getFigureImg = function (elem) {\n      return child(SugarElement.fromDom(elem), 'img');\n    };\n    var isFigure = function (editor, elem) {\n      return editor.dom.is(elem, 'figure');\n    };\n    var isImage = function (editor, imgNode) {\n      return editor.dom.is(imgNode, 'img:not([data-mce-object],[data-mce-placeholder])');\n    };\n    var getEditableImage = function (editor, node) {\n      var isEditable = function (imgNode) {\n        return isImage(editor, imgNode) && (isLocalImage(editor, imgNode) || isCorsImage(editor, imgNode) || isNonNullable(getProxyUrl(editor)));\n      };\n      if (isFigure(editor, node)) {\n        return getFigureImg(node).bind(function (img) {\n          return isEditable(img.dom) ? Optional.some(img.dom) : Optional.none();\n        });\n      } else {\n        return isEditable(node) ? Optional.some(node) : Optional.none();\n      }\n    };\n    var displayError = function (editor, error) {\n      editor.notificationManager.open({\n        text: error,\n        type: 'error'\n      });\n    };\n    var getSelectedImage = function (editor) {\n      var elem = editor.selection.getNode();\n      var figureElm = editor.dom.getParent(elem, 'figure.image');\n      if (figureElm !== null && isFigure(editor, figureElm)) {\n        return getFigureImg(figureElm);\n      } else if (isImage(editor, elem)) {\n        return Optional.some(SugarElement.fromDom(elem));\n      } else {\n        return Optional.none();\n      }\n    };\n    var extractFilename = function (editor, url, group) {\n      var m = url.match(/(?:\\/|^)(([^\\/\\?]+)\\.(?:[a-z0-9.]+))(?:\\?|$)/i);\n      return isNonNullable(m) ? editor.dom.encode(m[group]) : null;\n    };\n    var createId = function () {\n      return 'imagetools' + count++;\n    };\n    var isLocalImage = function (editor, img) {\n      var url = img.src;\n      return url.indexOf('data:') === 0 || url.indexOf('blob:') === 0 || new global$1(url).host === editor.documentBaseURI.host;\n    };\n    var isCorsImage = function (editor, img) {\n      return global$4.inArray(getCorsHosts(editor), new global$1(img.src).host) !== -1;\n    };\n    var isCorsWithCredentialsImage = function (editor, img) {\n      return global$4.inArray(getCredentialsHosts(editor), new global$1(img.src).host) !== -1;\n    };\n    var defaultFetchImage = function (editor, img) {\n      if (isCorsImage(editor, img)) {\n        return getUrl(img.src, null, isCorsWithCredentialsImage(editor, img));\n      }\n      if (!isLocalImage(editor, img)) {\n        var proxyUrl = getProxyUrl(editor);\n        var src = proxyUrl + (proxyUrl.indexOf('?') === -1 ? '?' : '&') + 'url=' + encodeURIComponent(img.src);\n        var apiKey = getApiKey(editor);\n        return getUrl(src, apiKey, false);\n      }\n      return imageToBlob$1(img);\n    };\n    var imageToBlob = function (editor, img) {\n      return getFetchImage(editor).fold(function () {\n        return defaultFetchImage(editor, img);\n      }, function (customFetchImage) {\n        return customFetchImage(img);\n      });\n    };\n    var findBlob = function (editor, img) {\n      var blobInfo = editor.editorUpload.blobCache.getByUri(img.src);\n      if (blobInfo) {\n        return global$2.resolve(blobInfo.blob());\n      }\n      return imageToBlob(editor, img);\n    };\n    var startTimedUpload = function (editor, imageUploadTimerState) {\n      var imageUploadTimer = global$3.setEditorTimeout(editor, function () {\n        editor.editorUpload.uploadImagesAuto();\n      }, getUploadTimeout(editor));\n      imageUploadTimerState.set(imageUploadTimer);\n    };\n    var cancelTimedUpload = function (imageUploadTimerState) {\n      global$3.clearTimeout(imageUploadTimerState.get());\n    };\n    var updateSelectedImage = function (editor, origBlob, ir, uploadImmediately, imageUploadTimerState, selectedImage, size) {\n      return ir.toBlob().then(function (blob) {\n        var uri, name, filename, blobInfo;\n        var blobCache = editor.editorUpload.blobCache;\n        uri = selectedImage.src;\n        var useFilename = origBlob.type === blob.type;\n        if (shouldReuseFilename(editor)) {\n          blobInfo = blobCache.getByUri(uri);\n          if (isNonNullable(blobInfo)) {\n            uri = blobInfo.uri();\n            name = blobInfo.name();\n            filename = blobInfo.filename();\n          } else {\n            name = extractFilename(editor, uri, 2);\n            filename = extractFilename(editor, uri, 1);\n          }\n        }\n        blobInfo = blobCache.create({\n          id: createId(),\n          blob: blob,\n          base64: ir.toBase64(),\n          uri: uri,\n          name: name,\n          filename: useFilename ? filename : undefined\n        });\n        blobCache.add(blobInfo);\n        editor.undoManager.transact(function () {\n          var imageLoadedHandler = function () {\n            editor.$(selectedImage).off('load', imageLoadedHandler);\n            editor.nodeChanged();\n            if (uploadImmediately) {\n              editor.editorUpload.uploadImagesAuto();\n            } else {\n              cancelTimedUpload(imageUploadTimerState);\n              startTimedUpload(editor, imageUploadTimerState);\n            }\n          };\n          editor.$(selectedImage).on('load', imageLoadedHandler);\n          if (size) {\n            editor.$(selectedImage).attr({\n              width: size.w,\n              height: size.h\n            });\n          }\n          editor.$(selectedImage).attr({ src: blobInfo.blobUri() }).removeAttr('data-mce-src');\n        });\n        return blobInfo;\n      });\n    };\n    var selectedImageOperation = function (editor, imageUploadTimerState, fn, size) {\n      return function () {\n        var imgOpt = getSelectedImage(editor);\n        return imgOpt.fold(function () {\n          displayError(editor, 'Could not find selected image');\n        }, function (img) {\n          return editor._scanForImages().then(function () {\n            return findBlob(editor, img.dom);\n          }).then(function (blob) {\n            return blobToImageResult(blob).then(fn).then(function (imageResult) {\n              return updateSelectedImage(editor, blob, imageResult, false, imageUploadTimerState, img.dom, size);\n            });\n          }).catch(function (error) {\n            displayError(editor, error);\n          });\n        });\n      };\n    };\n    var rotate = function (editor, imageUploadTimerState, angle) {\n      return function () {\n        var imgOpt = getSelectedImage(editor);\n        var flippedSize = imgOpt.map(function (img) {\n          var size = getImageSize(img.dom);\n          return size ? {\n            w: size.h,\n            h: size.w\n          } : null;\n        }).getOrNull();\n        return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {\n          return rotate$1(imageResult, angle);\n        }, flippedSize)();\n      };\n    };\n    var flip = function (editor, imageUploadTimerState, axis) {\n      return function () {\n        return selectedImageOperation(editor, imageUploadTimerState, function (imageResult) {\n          return flip$1(imageResult, axis);\n        })();\n      };\n    };\n    var handleDialogBlob = function (editor, imageUploadTimerState, img, originalSize, blob) {\n      return blobToImage(blob).then(function (newImage) {\n        var newSize = getNaturalImageSize(newImage);\n        if (originalSize.w !== newSize.w || originalSize.h !== newSize.h) {\n          if (getImageSize(img)) {\n            setImageSize(img, newSize);\n          }\n        }\n        URL.revokeObjectURL(newImage.src);\n        return blob;\n      }).then(blobToImageResult).then(function (imageResult) {\n        return updateSelectedImage(editor, blob, imageResult, true, imageUploadTimerState, img);\n      });\n    };\n\n    var saveState = 'save-state';\n    var disable = 'disable';\n    var enable = 'enable';\n\n    var createState = function (blob) {\n      return {\n        blob: blob,\n        url: URL.createObjectURL(blob)\n      };\n    };\n    var makeOpen = function (editor, imageUploadTimerState) {\n      return function () {\n        var getLoadedSpec = function (currentState) {\n          return {\n            title: 'Edit Image',\n            size: 'large',\n            body: {\n              type: 'panel',\n              items: [{\n                  type: 'imagetools',\n                  name: 'imagetools',\n                  label: 'Edit Image',\n                  currentState: currentState\n                }]\n            },\n            buttons: [\n              {\n                type: 'cancel',\n                name: 'cancel',\n                text: 'Cancel'\n              },\n              {\n                type: 'submit',\n                name: 'save',\n                text: 'Save',\n                primary: true,\n                disabled: true\n              }\n            ],\n            onSubmit: function (api) {\n              var blob = api.getData().imagetools.blob;\n              originalImgOpt.each(function (originalImg) {\n                originalSizeOpt.each(function (originalSize) {\n                  handleDialogBlob(editor, imageUploadTimerState, originalImg.dom, originalSize, blob);\n                });\n              });\n              api.close();\n            },\n            onCancel: noop,\n            onAction: function (api, details) {\n              switch (details.name) {\n              case saveState:\n                if (details.value) {\n                  api.enable('save');\n                } else {\n                  api.disable('save');\n                }\n                break;\n              case disable:\n                api.disable('save');\n                api.disable('cancel');\n                break;\n              case enable:\n                api.enable('cancel');\n                break;\n              }\n            }\n          };\n        };\n        var originalImgOpt = getSelectedImage(editor);\n        var originalSizeOpt = originalImgOpt.map(function (origImg) {\n          return getNaturalImageSize(origImg.dom);\n        });\n        originalImgOpt.each(function (img) {\n          getEditableImage(editor, img.dom).each(function (_) {\n            findBlob(editor, img.dom).then(function (blob) {\n              var state = createState(blob);\n              editor.windowManager.open(getLoadedSpec(state));\n            });\n          });\n        });\n      };\n    };\n\n    var register$2 = function (editor, imageUploadTimerState) {\n      global$4.each({\n        mceImageRotateLeft: rotate(editor, imageUploadTimerState, -90),\n        mceImageRotateRight: rotate(editor, imageUploadTimerState, 90),\n        mceImageFlipVertical: flip(editor, imageUploadTimerState, 'v'),\n        mceImageFlipHorizontal: flip(editor, imageUploadTimerState, 'h'),\n        mceEditImage: makeOpen(editor, imageUploadTimerState)\n      }, function (fn, cmd) {\n        editor.addCommand(cmd, fn);\n      });\n    };\n\n    var setup = function (editor, imageUploadTimerState, lastSelectedImageState) {\n      editor.on('NodeChange', function (e) {\n        var lastSelectedImage = lastSelectedImageState.get();\n        var selectedImage = getEditableImage(editor, e.element);\n        if (lastSelectedImage && !selectedImage.exists(function (img) {\n            return lastSelectedImage.src === img.src;\n          })) {\n          cancelTimedUpload(imageUploadTimerState);\n          editor.editorUpload.uploadImagesAuto();\n          lastSelectedImageState.set(null);\n        }\n        selectedImage.each(lastSelectedImageState.set);\n      });\n    };\n\n    var register$1 = function (editor) {\n      var changeHandlers = [];\n      var cmd = function (command) {\n        return function () {\n          return editor.execCommand(command);\n        };\n      };\n      var isEditableImage = function () {\n        return getSelectedImage(editor).exists(function (element) {\n          return getEditableImage(editor, element.dom).isSome();\n        });\n      };\n      var onSetup = function (api) {\n        var handler = function (isEditableImage) {\n          return api.setDisabled(!isEditableImage);\n        };\n        handler(isEditableImage());\n        changeHandlers = changeHandlers.concat([handler]);\n        return function () {\n          changeHandlers = filter(changeHandlers, function (h) {\n            return h !== handler;\n          });\n        };\n      };\n      editor.on('NodeChange', function () {\n        var isEditable = isEditableImage();\n        each$1(changeHandlers, function (handler) {\n          return handler(isEditable);\n        });\n      });\n      editor.ui.registry.addButton('rotateleft', {\n        tooltip: 'Rotate counterclockwise',\n        icon: 'rotate-left',\n        onAction: cmd('mceImageRotateLeft'),\n        onSetup: onSetup\n      });\n      editor.ui.registry.addButton('rotateright', {\n        tooltip: 'Rotate clockwise',\n        icon: 'rotate-right',\n        onAction: cmd('mceImageRotateRight'),\n        onSetup: onSetup\n      });\n      editor.ui.registry.addButton('flipv', {\n        tooltip: 'Flip vertically',\n        icon: 'flip-vertically',\n        onAction: cmd('mceImageFlipVertical'),\n        onSetup: onSetup\n      });\n      editor.ui.registry.addButton('fliph', {\n        tooltip: 'Flip horizontally',\n        icon: 'flip-horizontally',\n        onAction: cmd('mceImageFlipHorizontal'),\n        onSetup: onSetup\n      });\n      editor.ui.registry.addButton('editimage', {\n        tooltip: 'Edit image',\n        icon: 'edit-image',\n        onAction: cmd('mceEditImage'),\n        onSetup: onSetup\n      });\n      editor.ui.registry.addButton('imageoptions', {\n        tooltip: 'Image options',\n        icon: 'image',\n        onAction: cmd('mceImage')\n      });\n      editor.ui.registry.addContextMenu('imagetools', {\n        update: function (element) {\n          return getEditableImage(editor, element).map(function (_) {\n            return {\n              text: 'Edit image',\n              icon: 'edit-image',\n              onAction: cmd('mceEditImage')\n            };\n          }).toArray();\n        }\n      });\n    };\n\n    var register = function (editor) {\n      editor.ui.registry.addContextToolbar('imagetools', {\n        items: getToolbarItems(editor),\n        predicate: function (elem) {\n          return getEditableImage(editor, elem).isSome();\n        },\n        position: 'node',\n        scope: 'node'\n      });\n    };\n\n    function Plugin () {\n      global$5.add('imagetools', function (editor) {\n        var imageUploadTimerState = Cell(0);\n        var lastSelectedImageState = Cell(null);\n        register$2(editor, imageUploadTimerState);\n        register$1(editor);\n        register(editor);\n        setup(editor, imageUploadTimerState, lastSelectedImageState);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/imagetools/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/importcss/index.js":
/*!*************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/importcss/index.js ***!
  \*************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"importcss\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/importcss')\n//   ES2015:\n//     import 'tinymce/plugins/importcss'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/importcss/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/importcss/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/importcss/plugin.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/importcss/plugin.js ***!
  \**************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isString = isType('string');\n    var isArray = isType('array');\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.EditorManager');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var shouldMergeClasses = function (editor) {\n      return editor.getParam('importcss_merge_classes');\n    };\n    var shouldImportExclusive = function (editor) {\n      return editor.getParam('importcss_exclusive');\n    };\n    var getSelectorConverter = function (editor) {\n      return editor.getParam('importcss_selector_converter');\n    };\n    var getSelectorFilter = function (editor) {\n      return editor.getParam('importcss_selector_filter');\n    };\n    var getCssGroups = function (editor) {\n      return editor.getParam('importcss_groups');\n    };\n    var shouldAppend = function (editor) {\n      return editor.getParam('importcss_append');\n    };\n    var getFileFilter = function (editor) {\n      return editor.getParam('importcss_file_filter');\n    };\n    var getSkin = function (editor) {\n      var skin = editor.getParam('skin');\n      return skin !== false ? skin || 'oxide' : false;\n    };\n    var getSkinUrl = function (editor) {\n      return editor.getParam('skin_url');\n    };\n\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n\n    var generate = function () {\n      var ungroupedOrder = [];\n      var groupOrder = [];\n      var groups = {};\n      var addItemToGroup = function (groupTitle, itemInfo) {\n        if (groups[groupTitle]) {\n          groups[groupTitle].push(itemInfo);\n        } else {\n          groupOrder.push(groupTitle);\n          groups[groupTitle] = [itemInfo];\n        }\n      };\n      var addItem = function (itemInfo) {\n        ungroupedOrder.push(itemInfo);\n      };\n      var toFormats = function () {\n        var groupItems = bind(groupOrder, function (g) {\n          var items = groups[g];\n          return items.length === 0 ? [] : [{\n              title: g,\n              items: items\n            }];\n        });\n        return groupItems.concat(ungroupedOrder);\n      };\n      return {\n        addItemToGroup: addItemToGroup,\n        addItem: addItem,\n        toFormats: toFormats\n      };\n    };\n\n    var internalEditorStyle = /^\\.(?:ephox|tiny-pageembed|mce)(?:[.-]+\\w+)+$/;\n    var removeCacheSuffix = function (url) {\n      var cacheSuffix = global$1.cacheSuffix;\n      if (isString(url)) {\n        url = url.replace('?' + cacheSuffix, '').replace('&' + cacheSuffix, '');\n      }\n      return url;\n    };\n    var isSkinContentCss = function (editor, href) {\n      var skin = getSkin(editor);\n      if (skin) {\n        var skinUrlBase = getSkinUrl(editor);\n        var skinUrl = skinUrlBase ? editor.documentBaseURI.toAbsolute(skinUrlBase) : global$2.baseURL + '/skins/ui/' + skin;\n        var contentSkinUrlPart = global$2.baseURL + '/skins/content/';\n        return href === skinUrl + '/content' + (editor.inline ? '.inline' : '') + '.min.css' || href.indexOf(contentSkinUrlPart) !== -1;\n      }\n      return false;\n    };\n    var compileFilter = function (filter) {\n      if (isString(filter)) {\n        return function (value) {\n          return value.indexOf(filter) !== -1;\n        };\n      } else if (filter instanceof RegExp) {\n        return function (value) {\n          return filter.test(value);\n        };\n      }\n      return filter;\n    };\n    var isCssImportRule = function (rule) {\n      return rule.styleSheet;\n    };\n    var isCssPageRule = function (rule) {\n      return rule.selectorText;\n    };\n    var getSelectors = function (editor, doc, fileFilter) {\n      var selectors = [];\n      var contentCSSUrls = {};\n      var append = function (styleSheet, imported) {\n        var href = styleSheet.href, rules;\n        href = removeCacheSuffix(href);\n        if (!href || !fileFilter(href, imported) || isSkinContentCss(editor, href)) {\n          return;\n        }\n        global.each(styleSheet.imports, function (styleSheet) {\n          append(styleSheet, true);\n        });\n        try {\n          rules = styleSheet.cssRules || styleSheet.rules;\n        } catch (e) {\n        }\n        global.each(rules, function (cssRule) {\n          if (isCssImportRule(cssRule)) {\n            append(cssRule.styleSheet, true);\n          } else if (isCssPageRule(cssRule)) {\n            global.each(cssRule.selectorText.split(','), function (selector) {\n              selectors.push(global.trim(selector));\n            });\n          }\n        });\n      };\n      global.each(editor.contentCSS, function (url) {\n        contentCSSUrls[url] = true;\n      });\n      if (!fileFilter) {\n        fileFilter = function (href, imported) {\n          return imported || contentCSSUrls[href];\n        };\n      }\n      try {\n        global.each(doc.styleSheets, function (styleSheet) {\n          append(styleSheet);\n        });\n      } catch (e) {\n      }\n      return selectors;\n    };\n    var defaultConvertSelectorToFormat = function (editor, selectorText) {\n      var format;\n      var selector = /^(?:([a-z0-9\\-_]+))?(\\.[a-z0-9_\\-\\.]+)$/i.exec(selectorText);\n      if (!selector) {\n        return;\n      }\n      var elementName = selector[1];\n      var classes = selector[2].substr(1).split('.').join(' ');\n      var inlineSelectorElements = global.makeMap('a,img');\n      if (selector[1]) {\n        format = { title: selectorText };\n        if (editor.schema.getTextBlockElements()[elementName]) {\n          format.block = elementName;\n        } else if (editor.schema.getBlockElements()[elementName] || inlineSelectorElements[elementName.toLowerCase()]) {\n          format.selector = elementName;\n        } else {\n          format.inline = elementName;\n        }\n      } else if (selector[2]) {\n        format = {\n          inline: 'span',\n          title: selectorText.substr(1),\n          classes: classes\n        };\n      }\n      if (shouldMergeClasses(editor) !== false) {\n        format.classes = classes;\n      } else {\n        format.attributes = { class: classes };\n      }\n      return format;\n    };\n    var getGroupsBySelector = function (groups, selector) {\n      return global.grep(groups, function (group) {\n        return !group.filter || group.filter(selector);\n      });\n    };\n    var compileUserDefinedGroups = function (groups) {\n      return global.map(groups, function (group) {\n        return global.extend({}, group, {\n          original: group,\n          selectors: {},\n          filter: compileFilter(group.filter)\n        });\n      });\n    };\n    var isExclusiveMode = function (editor, group) {\n      return group === null || shouldImportExclusive(editor) !== false;\n    };\n    var isUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {\n      return !(isExclusiveMode(editor, group) ? selector in globallyUniqueSelectors : selector in group.selectors);\n    };\n    var markUniqueSelector = function (editor, selector, group, globallyUniqueSelectors) {\n      if (isExclusiveMode(editor, group)) {\n        globallyUniqueSelectors[selector] = true;\n      } else {\n        group.selectors[selector] = true;\n      }\n    };\n    var convertSelectorToFormat = function (editor, plugin, selector, group) {\n      var selectorConverter;\n      if (group && group.selector_converter) {\n        selectorConverter = group.selector_converter;\n      } else if (getSelectorConverter(editor)) {\n        selectorConverter = getSelectorConverter(editor);\n      } else {\n        selectorConverter = function () {\n          return defaultConvertSelectorToFormat(editor, selector);\n        };\n      }\n      return selectorConverter.call(plugin, selector, group);\n    };\n    var setup = function (editor) {\n      editor.on('init', function () {\n        var model = generate();\n        var globallyUniqueSelectors = {};\n        var selectorFilter = compileFilter(getSelectorFilter(editor));\n        var groups = compileUserDefinedGroups(getCssGroups(editor));\n        var processSelector = function (selector, group) {\n          if (isUniqueSelector(editor, selector, group, globallyUniqueSelectors)) {\n            markUniqueSelector(editor, selector, group, globallyUniqueSelectors);\n            var format = convertSelectorToFormat(editor, editor.plugins.importcss, selector, group);\n            if (format) {\n              var formatName = format.name || global$3.DOM.uniqueId();\n              editor.formatter.register(formatName, format);\n              return {\n                title: format.title,\n                format: formatName\n              };\n            }\n          }\n          return null;\n        };\n        global.each(getSelectors(editor, editor.getDoc(), compileFilter(getFileFilter(editor))), function (selector) {\n          if (!internalEditorStyle.test(selector)) {\n            if (!selectorFilter || selectorFilter(selector)) {\n              var selectorGroups = getGroupsBySelector(groups, selector);\n              if (selectorGroups.length > 0) {\n                global.each(selectorGroups, function (group) {\n                  var menuItem = processSelector(selector, group);\n                  if (menuItem) {\n                    model.addItemToGroup(group.title, menuItem);\n                  }\n                });\n              } else {\n                var menuItem = processSelector(selector, null);\n                if (menuItem) {\n                  model.addItem(menuItem);\n                }\n              }\n            }\n          }\n        });\n        var items = model.toFormats();\n        editor.fire('addStyleModifications', {\n          items: items,\n          replace: !shouldAppend(editor)\n        });\n      });\n    };\n\n    var get = function (editor) {\n      var convertSelectorToFormat = function (selectorText) {\n        return defaultConvertSelectorToFormat(editor, selectorText);\n      };\n      return { convertSelectorToFormat: convertSelectorToFormat };\n    };\n\n    function Plugin () {\n      global$4.add('importcss', function (editor) {\n        setup(editor);\n        return get(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/importcss/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/link/index.js":
/*!********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/link/index.js ***!
  \********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"link\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/link')\n//   ES2015:\n//     import 'tinymce/plugins/link'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/link/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/link/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/link/plugin.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/link/plugin.js ***!
  \*********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$7 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var global$6 = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var eq = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isString = isType('string');\n    var isArray = isType('array');\n    var isNull = eq(null);\n    var isBoolean = isSimpleType('boolean');\n    var isFunction = isSimpleType('function');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var tripleEquals = function (a, b) {\n      return a === b;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var nativeIndexOf = Array.prototype.indexOf;\n    var nativePush = Array.prototype.push;\n    var rawIndexOf = function (ts, t) {\n      return nativeIndexOf.call(ts, t);\n    };\n    var contains = function (xs, x) {\n      return rawIndexOf(xs, x) > -1;\n    };\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$1 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var foldl = function (xs, f, acc) {\n      each$1(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var is = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lhs.exists(function (left) {\n        return comparator(left, rhs);\n      });\n    };\n    var cat = function (arr) {\n      var r = [];\n      var push = function (x) {\n        r.push(x);\n      };\n      for (var i = 0; i < arr.length; i++) {\n        arr[i].each(push);\n      }\n      return r;\n    };\n    var someIf = function (b, a) {\n      return b ? Optional.some(a) : Optional.none();\n    };\n\n    var assumeExternalTargets = function (editor) {\n      var externalTargets = editor.getParam('link_assume_external_targets', false);\n      if (isBoolean(externalTargets) && externalTargets) {\n        return 1;\n      } else if (isString(externalTargets) && (externalTargets === 'http' || externalTargets === 'https')) {\n        return externalTargets;\n      }\n      return 0;\n    };\n    var hasContextToolbar = function (editor) {\n      return editor.getParam('link_context_toolbar', false, 'boolean');\n    };\n    var getLinkList = function (editor) {\n      return editor.getParam('link_list');\n    };\n    var getDefaultLinkTarget = function (editor) {\n      return editor.getParam('default_link_target');\n    };\n    var getTargetList = function (editor) {\n      return editor.getParam('target_list', true);\n    };\n    var getRelList = function (editor) {\n      return editor.getParam('rel_list', [], 'array');\n    };\n    var getLinkClassList = function (editor) {\n      return editor.getParam('link_class_list', [], 'array');\n    };\n    var shouldShowLinkTitle = function (editor) {\n      return editor.getParam('link_title', true, 'boolean');\n    };\n    var allowUnsafeLinkTarget = function (editor) {\n      return editor.getParam('allow_unsafe_link_target', false, 'boolean');\n    };\n    var useQuickLink = function (editor) {\n      return editor.getParam('link_quicklink', false, 'boolean');\n    };\n    var getDefaultLinkProtocol = function (editor) {\n      return editor.getParam('link_default_protocol', 'http', 'string');\n    };\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getValue = function (item) {\n      return isString(item.value) ? item.value : '';\n    };\n    var getText = function (item) {\n      if (isString(item.text)) {\n        return item.text;\n      } else if (isString(item.title)) {\n        return item.title;\n      } else {\n        return '';\n      }\n    };\n    var sanitizeList = function (list, extractValue) {\n      var out = [];\n      global$5.each(list, function (item) {\n        var text = getText(item);\n        if (item.menu !== undefined) {\n          var items = sanitizeList(item.menu, extractValue);\n          out.push({\n            text: text,\n            items: items\n          });\n        } else {\n          var value = extractValue(item);\n          out.push({\n            text: text,\n            value: value\n          });\n        }\n      });\n      return out;\n    };\n    var sanitizeWith = function (extracter) {\n      if (extracter === void 0) {\n        extracter = getValue;\n      }\n      return function (list) {\n        return Optional.from(list).map(function (list) {\n          return sanitizeList(list, extracter);\n        });\n      };\n    };\n    var sanitize = function (list) {\n      return sanitizeWith(getValue)(list);\n    };\n    var createUi = function (name, label) {\n      return function (items) {\n        return {\n          name: name,\n          type: 'listbox',\n          label: label,\n          items: items\n        };\n      };\n    };\n    var ListOptions = {\n      sanitize: sanitize,\n      sanitizeWith: sanitizeWith,\n      createUi: createUi,\n      getValue: getValue\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n\n    var keys = Object.keys;\n    var hasOwnProperty = Object.hasOwnProperty;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var filter = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n    var has = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n    var hasNonNullableKey = function (obj, key) {\n      return has(obj, key) && obj[key] !== undefined && obj[key] !== null;\n    };\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.util.URI');\n\n    var isAnchor = function (elm) {\n      return elm && elm.nodeName.toLowerCase() === 'a';\n    };\n    var isLink = function (elm) {\n      return isAnchor(elm) && !!getHref(elm);\n    };\n    var collectNodesInRange = function (rng, predicate) {\n      if (rng.collapsed) {\n        return [];\n      } else {\n        var contents = rng.cloneContents();\n        var walker = new global$4(contents.firstChild, contents);\n        var elements = [];\n        var current = contents.firstChild;\n        do {\n          if (predicate(current)) {\n            elements.push(current);\n          }\n        } while (current = walker.next());\n        return elements;\n      }\n    };\n    var hasProtocol = function (url) {\n      return /^\\w+:/i.test(url);\n    };\n    var getHref = function (elm) {\n      var href = elm.getAttribute('data-mce-href');\n      return href ? href : elm.getAttribute('href');\n    };\n    var applyRelTargetRules = function (rel, isUnsafe) {\n      var rules = ['noopener'];\n      var rels = rel ? rel.split(/\\s+/) : [];\n      var toString = function (rels) {\n        return global$5.trim(rels.sort().join(' '));\n      };\n      var addTargetRules = function (rels) {\n        rels = removeTargetRules(rels);\n        return rels.length > 0 ? rels.concat(rules) : rules;\n      };\n      var removeTargetRules = function (rels) {\n        return rels.filter(function (val) {\n          return global$5.inArray(rules, val) === -1;\n        });\n      };\n      var newRels = isUnsafe ? addTargetRules(rels) : removeTargetRules(rels);\n      return newRels.length > 0 ? toString(newRels) : '';\n    };\n    var trimCaretContainers = function (text) {\n      return text.replace(/\\uFEFF/g, '');\n    };\n    var getAnchorElement = function (editor, selectedElm) {\n      selectedElm = selectedElm || editor.selection.getNode();\n      if (isImageFigure(selectedElm)) {\n        return editor.dom.select('a[href]', selectedElm)[0];\n      } else {\n        return editor.dom.getParent(selectedElm, 'a[href]');\n      }\n    };\n    var getAnchorText = function (selection, anchorElm) {\n      var text = anchorElm ? anchorElm.innerText || anchorElm.textContent : selection.getContent({ format: 'text' });\n      return trimCaretContainers(text);\n    };\n    var hasLinks = function (elements) {\n      return global$5.grep(elements, isLink).length > 0;\n    };\n    var hasLinksInSelection = function (rng) {\n      return collectNodesInRange(rng, isLink).length > 0;\n    };\n    var isOnlyTextSelected = function (editor) {\n      var inlineTextElements = editor.schema.getTextInlineElements();\n      var isElement = function (elm) {\n        return elm.nodeType === 1 && !isAnchor(elm) && !has(inlineTextElements, elm.nodeName.toLowerCase());\n      };\n      var elements = collectNodesInRange(editor.selection.getRng(), isElement);\n      return elements.length === 0;\n    };\n    var isImageFigure = function (elm) {\n      return elm && elm.nodeName === 'FIGURE' && /\\bimage\\b/i.test(elm.className);\n    };\n    var getLinkAttrs = function (data) {\n      var attrs = [\n        'title',\n        'rel',\n        'class',\n        'target'\n      ];\n      return foldl(attrs, function (acc, key) {\n        data[key].each(function (value) {\n          acc[key] = value.length > 0 ? value : null;\n        });\n        return acc;\n      }, { href: data.href });\n    };\n    var handleExternalTargets = function (href, assumeExternalTargets) {\n      if ((assumeExternalTargets === 'http' || assumeExternalTargets === 'https') && !hasProtocol(href)) {\n        return assumeExternalTargets + '://' + href;\n      }\n      return href;\n    };\n    var applyLinkOverrides = function (editor, linkAttrs) {\n      var newLinkAttrs = __assign({}, linkAttrs);\n      if (!(getRelList(editor).length > 0) && allowUnsafeLinkTarget(editor) === false) {\n        var newRel = applyRelTargetRules(newLinkAttrs.rel, newLinkAttrs.target === '_blank');\n        newLinkAttrs.rel = newRel ? newRel : null;\n      }\n      if (Optional.from(newLinkAttrs.target).isNone() && getTargetList(editor) === false) {\n        newLinkAttrs.target = getDefaultLinkTarget(editor);\n      }\n      newLinkAttrs.href = handleExternalTargets(newLinkAttrs.href, assumeExternalTargets(editor));\n      return newLinkAttrs;\n    };\n    var updateLink = function (editor, anchorElm, text, linkAttrs) {\n      text.each(function (text) {\n        if (has(anchorElm, 'innerText')) {\n          anchorElm.innerText = text;\n        } else {\n          anchorElm.textContent = text;\n        }\n      });\n      editor.dom.setAttribs(anchorElm, linkAttrs);\n      editor.selection.select(anchorElm);\n    };\n    var createLink = function (editor, selectedElm, text, linkAttrs) {\n      if (isImageFigure(selectedElm)) {\n        linkImageFigure(editor, selectedElm, linkAttrs);\n      } else {\n        text.fold(function () {\n          editor.execCommand('mceInsertLink', false, linkAttrs);\n        }, function (text) {\n          editor.insertContent(editor.dom.createHTML('a', linkAttrs, editor.dom.encode(text)));\n        });\n      }\n    };\n    var linkDomMutation = function (editor, attachState, data) {\n      var selectedElm = editor.selection.getNode();\n      var anchorElm = getAnchorElement(editor, selectedElm);\n      var linkAttrs = applyLinkOverrides(editor, getLinkAttrs(data));\n      editor.undoManager.transact(function () {\n        if (data.href === attachState.href) {\n          attachState.attach();\n        }\n        if (anchorElm) {\n          editor.focus();\n          updateLink(editor, anchorElm, data.text, linkAttrs);\n        } else {\n          createLink(editor, selectedElm, data.text, linkAttrs);\n        }\n      });\n    };\n    var unlinkSelection = function (editor) {\n      var dom = editor.dom, selection = editor.selection;\n      var bookmark = selection.getBookmark();\n      var rng = selection.getRng().cloneRange();\n      var startAnchorElm = dom.getParent(rng.startContainer, 'a[href]', editor.getBody());\n      var endAnchorElm = dom.getParent(rng.endContainer, 'a[href]', editor.getBody());\n      if (startAnchorElm) {\n        rng.setStartBefore(startAnchorElm);\n      }\n      if (endAnchorElm) {\n        rng.setEndAfter(endAnchorElm);\n      }\n      selection.setRng(rng);\n      editor.execCommand('unlink');\n      selection.moveToBookmark(bookmark);\n    };\n    var unlinkDomMutation = function (editor) {\n      editor.undoManager.transact(function () {\n        var node = editor.selection.getNode();\n        if (isImageFigure(node)) {\n          unlinkImageFigure(editor, node);\n        } else {\n          unlinkSelection(editor);\n        }\n        editor.focus();\n      });\n    };\n    var unwrapOptions = function (data) {\n      var cls = data.class, href = data.href, rel = data.rel, target = data.target, text = data.text, title = data.title;\n      return filter({\n        class: cls.getOrNull(),\n        href: href,\n        rel: rel.getOrNull(),\n        target: target.getOrNull(),\n        text: text.getOrNull(),\n        title: title.getOrNull()\n      }, function (v, _k) {\n        return isNull(v) === false;\n      });\n    };\n    var sanitizeData = function (editor, data) {\n      var href = data.href;\n      return __assign(__assign({}, data), { href: global$3.isDomSafe(href, 'a', editor.settings) ? href : '' });\n    };\n    var link = function (editor, attachState, data) {\n      var sanitizedData = sanitizeData(editor, data);\n      editor.hasPlugin('rtc', true) ? editor.execCommand('createlink', false, unwrapOptions(sanitizedData)) : linkDomMutation(editor, attachState, sanitizedData);\n    };\n    var unlink = function (editor) {\n      editor.hasPlugin('rtc', true) ? editor.execCommand('unlink') : unlinkDomMutation(editor);\n    };\n    var unlinkImageFigure = function (editor, fig) {\n      var img = editor.dom.select('img', fig)[0];\n      if (img) {\n        var a = editor.dom.getParents(img, 'a[href]', fig)[0];\n        if (a) {\n          a.parentNode.insertBefore(img, a);\n          editor.dom.remove(a);\n        }\n      }\n    };\n    var linkImageFigure = function (editor, fig, attrs) {\n      var img = editor.dom.select('img', fig)[0];\n      if (img) {\n        var a = editor.dom.create('a', attrs);\n        img.parentNode.insertBefore(a, img);\n        a.appendChild(img);\n      }\n    };\n\n    var isListGroup = function (item) {\n      return hasNonNullableKey(item, 'items');\n    };\n    var findTextByValue = function (value, catalog) {\n      return findMap(catalog, function (item) {\n        if (isListGroup(item)) {\n          return findTextByValue(value, item.items);\n        } else {\n          return someIf(item.value === value, item);\n        }\n      });\n    };\n    var getDelta = function (persistentText, fieldName, catalog, data) {\n      var value = data[fieldName];\n      var hasPersistentText = persistentText.length > 0;\n      return value !== undefined ? findTextByValue(value, catalog).map(function (i) {\n        return {\n          url: {\n            value: i.value,\n            meta: {\n              text: hasPersistentText ? persistentText : i.text,\n              attach: noop\n            }\n          },\n          text: hasPersistentText ? persistentText : i.text\n        };\n      }) : Optional.none();\n    };\n    var findCatalog = function (catalogs, fieldName) {\n      if (fieldName === 'link') {\n        return catalogs.link;\n      } else if (fieldName === 'anchor') {\n        return catalogs.anchor;\n      } else {\n        return Optional.none();\n      }\n    };\n    var init = function (initialData, linkCatalog) {\n      var persistentData = {\n        text: initialData.text,\n        title: initialData.title\n      };\n      var getTitleFromUrlChange = function (url) {\n        return someIf(persistentData.title.length <= 0, Optional.from(url.meta.title).getOr(''));\n      };\n      var getTextFromUrlChange = function (url) {\n        return someIf(persistentData.text.length <= 0, Optional.from(url.meta.text).getOr(url.value));\n      };\n      var onUrlChange = function (data) {\n        var text = getTextFromUrlChange(data.url);\n        var title = getTitleFromUrlChange(data.url);\n        if (text.isSome() || title.isSome()) {\n          return Optional.some(__assign(__assign({}, text.map(function (text) {\n            return { text: text };\n          }).getOr({})), title.map(function (title) {\n            return { title: title };\n          }).getOr({})));\n        } else {\n          return Optional.none();\n        }\n      };\n      var onCatalogChange = function (data, change) {\n        var catalog = findCatalog(linkCatalog, change.name).getOr([]);\n        return getDelta(persistentData.text, change.name, catalog, data);\n      };\n      var onChange = function (getData, change) {\n        var name = change.name;\n        if (name === 'url') {\n          return onUrlChange(getData());\n        } else if (contains([\n            'anchor',\n            'link'\n          ], name)) {\n          return onCatalogChange(getData(), change);\n        } else if (name === 'text' || name === 'title') {\n          persistentData[name] = getData()[name];\n          return Optional.none();\n        } else {\n          return Optional.none();\n        }\n      };\n      return { onChange: onChange };\n    };\n    var DialogChanges = {\n      init: init,\n      getDelta: getDelta\n    };\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var delayedConfirm = function (editor, message, callback) {\n      var rng = editor.selection.getRng();\n      global$2.setEditorTimeout(editor, function () {\n        editor.windowManager.confirm(message, function (state) {\n          editor.selection.setRng(rng);\n          callback(state);\n        });\n      });\n    };\n    var tryEmailTransform = function (data) {\n      var url = data.href;\n      var suggestMailTo = url.indexOf('@') > 0 && url.indexOf('/') === -1 && url.indexOf('mailto:') === -1;\n      return suggestMailTo ? Optional.some({\n        message: 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?',\n        preprocess: function (oldData) {\n          return __assign(__assign({}, oldData), { href: 'mailto:' + url });\n        }\n      }) : Optional.none();\n    };\n    var tryProtocolTransform = function (assumeExternalTargets, defaultLinkProtocol) {\n      return function (data) {\n        var url = data.href;\n        var suggestProtocol = assumeExternalTargets === 1 && !hasProtocol(url) || assumeExternalTargets === 0 && /^\\s*www(\\.|\\d\\.)/i.test(url);\n        return suggestProtocol ? Optional.some({\n          message: 'The URL you entered seems to be an external link. Do you want to add the required ' + defaultLinkProtocol + ':// prefix?',\n          preprocess: function (oldData) {\n            return __assign(__assign({}, oldData), { href: defaultLinkProtocol + '://' + url });\n          }\n        }) : Optional.none();\n      };\n    };\n    var preprocess = function (editor, data) {\n      return findMap([\n        tryEmailTransform,\n        tryProtocolTransform(assumeExternalTargets(editor), getDefaultLinkProtocol(editor))\n      ], function (f) {\n        return f(data);\n      }).fold(function () {\n        return global$1.resolve(data);\n      }, function (transform) {\n        return new global$1(function (callback) {\n          delayedConfirm(editor, transform.message, function (state) {\n            callback(state ? transform.preprocess(data) : data);\n          });\n        });\n      });\n    };\n    var DialogConfirms = { preprocess: preprocess };\n\n    var getAnchors = function (editor) {\n      var anchorNodes = editor.dom.select('a:not([href])');\n      var anchors = bind(anchorNodes, function (anchor) {\n        var id = anchor.name || anchor.id;\n        return id ? [{\n            text: id,\n            value: '#' + id\n          }] : [];\n      });\n      return anchors.length > 0 ? Optional.some([{\n          text: 'None',\n          value: ''\n        }].concat(anchors)) : Optional.none();\n    };\n    var AnchorListOptions = { getAnchors: getAnchors };\n\n    var getClasses = function (editor) {\n      var list = getLinkClassList(editor);\n      if (list.length > 0) {\n        return ListOptions.sanitize(list);\n      }\n      return Optional.none();\n    };\n    var ClassListOptions = { getClasses: getClasses };\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.XHR');\n\n    var parseJson = function (text) {\n      try {\n        return Optional.some(JSON.parse(text));\n      } catch (err) {\n        return Optional.none();\n      }\n    };\n    var getLinks = function (editor) {\n      var extractor = function (item) {\n        return editor.convertURL(item.value || item.url, 'href');\n      };\n      var linkList = getLinkList(editor);\n      return new global$1(function (callback) {\n        if (isString(linkList)) {\n          global.send({\n            url: linkList,\n            success: function (text) {\n              return callback(parseJson(text));\n            },\n            error: function (_) {\n              return callback(Optional.none());\n            }\n          });\n        } else if (isFunction(linkList)) {\n          linkList(function (output) {\n            return callback(Optional.some(output));\n          });\n        } else {\n          callback(Optional.from(linkList));\n        }\n      }).then(function (optItems) {\n        return optItems.bind(ListOptions.sanitizeWith(extractor)).map(function (items) {\n          if (items.length > 0) {\n            var noneItem = [{\n                text: 'None',\n                value: ''\n              }];\n            return noneItem.concat(items);\n          } else {\n            return items;\n          }\n        });\n      });\n    };\n    var LinkListOptions = { getLinks: getLinks };\n\n    var getRels = function (editor, initialTarget) {\n      var list = getRelList(editor);\n      if (list.length > 0) {\n        var isTargetBlank_1 = is(initialTarget, '_blank');\n        var enforceSafe = allowUnsafeLinkTarget(editor) === false;\n        var safeRelExtractor = function (item) {\n          return applyRelTargetRules(ListOptions.getValue(item), isTargetBlank_1);\n        };\n        var sanitizer = enforceSafe ? ListOptions.sanitizeWith(safeRelExtractor) : ListOptions.sanitize;\n        return sanitizer(list);\n      }\n      return Optional.none();\n    };\n    var RelOptions = { getRels: getRels };\n\n    var fallbacks = [\n      {\n        text: 'Current window',\n        value: ''\n      },\n      {\n        text: 'New window',\n        value: '_blank'\n      }\n    ];\n    var getTargets = function (editor) {\n      var list = getTargetList(editor);\n      if (isArray(list)) {\n        return ListOptions.sanitize(list).orThunk(function () {\n          return Optional.some(fallbacks);\n        });\n      } else if (list === false) {\n        return Optional.none();\n      }\n      return Optional.some(fallbacks);\n    };\n    var TargetOptions = { getTargets: getTargets };\n\n    var nonEmptyAttr = function (dom, elem, name) {\n      var val = dom.getAttrib(elem, name);\n      return val !== null && val.length > 0 ? Optional.some(val) : Optional.none();\n    };\n    var extractFromAnchor = function (editor, anchor) {\n      var dom = editor.dom;\n      var onlyText = isOnlyTextSelected(editor);\n      var text = onlyText ? Optional.some(getAnchorText(editor.selection, anchor)) : Optional.none();\n      var url = anchor ? Optional.some(dom.getAttrib(anchor, 'href')) : Optional.none();\n      var target = anchor ? Optional.from(dom.getAttrib(anchor, 'target')) : Optional.none();\n      var rel = nonEmptyAttr(dom, anchor, 'rel');\n      var linkClass = nonEmptyAttr(dom, anchor, 'class');\n      var title = nonEmptyAttr(dom, anchor, 'title');\n      return {\n        url: url,\n        text: text,\n        title: title,\n        target: target,\n        rel: rel,\n        linkClass: linkClass\n      };\n    };\n    var collect = function (editor, linkNode) {\n      return LinkListOptions.getLinks(editor).then(function (links) {\n        var anchor = extractFromAnchor(editor, linkNode);\n        return {\n          anchor: anchor,\n          catalogs: {\n            targets: TargetOptions.getTargets(editor),\n            rels: RelOptions.getRels(editor, anchor.target),\n            classes: ClassListOptions.getClasses(editor),\n            anchor: AnchorListOptions.getAnchors(editor),\n            link: links\n          },\n          optNode: Optional.from(linkNode),\n          flags: { titleEnabled: shouldShowLinkTitle(editor) }\n        };\n      });\n    };\n    var DialogInfo = { collect: collect };\n\n    var handleSubmit = function (editor, info) {\n      return function (api) {\n        var data = api.getData();\n        if (!data.url.value) {\n          unlink(editor);\n          api.close();\n          return;\n        }\n        var getChangedValue = function (key) {\n          return Optional.from(data[key]).filter(function (value) {\n            return !is(info.anchor[key], value);\n          });\n        };\n        var changedData = {\n          href: data.url.value,\n          text: getChangedValue('text'),\n          target: getChangedValue('target'),\n          rel: getChangedValue('rel'),\n          class: getChangedValue('linkClass'),\n          title: getChangedValue('title')\n        };\n        var attachState = {\n          href: data.url.value,\n          attach: data.url.meta !== undefined && data.url.meta.attach ? data.url.meta.attach : noop\n        };\n        DialogConfirms.preprocess(editor, changedData).then(function (pData) {\n          link(editor, attachState, pData);\n        });\n        api.close();\n      };\n    };\n    var collectData = function (editor) {\n      var anchorNode = getAnchorElement(editor);\n      return DialogInfo.collect(editor, anchorNode);\n    };\n    var getInitialData = function (info, defaultTarget) {\n      var anchor = info.anchor;\n      var url = anchor.url.getOr('');\n      return {\n        url: {\n          value: url,\n          meta: { original: { value: url } }\n        },\n        text: anchor.text.getOr(''),\n        title: anchor.title.getOr(''),\n        anchor: url,\n        link: url,\n        rel: anchor.rel.getOr(''),\n        target: anchor.target.or(defaultTarget).getOr(''),\n        linkClass: anchor.linkClass.getOr('')\n      };\n    };\n    var makeDialog = function (settings, onSubmit, editor) {\n      var urlInput = [{\n          name: 'url',\n          type: 'urlinput',\n          filetype: 'file',\n          label: 'URL'\n        }];\n      var displayText = settings.anchor.text.map(function () {\n        return {\n          name: 'text',\n          type: 'input',\n          label: 'Text to display'\n        };\n      }).toArray();\n      var titleText = settings.flags.titleEnabled ? [{\n          name: 'title',\n          type: 'input',\n          label: 'Title'\n        }] : [];\n      var defaultTarget = Optional.from(getDefaultLinkTarget(editor));\n      var initialData = getInitialData(settings, defaultTarget);\n      var catalogs = settings.catalogs;\n      var dialogDelta = DialogChanges.init(initialData, catalogs);\n      var body = {\n        type: 'panel',\n        items: flatten([\n          urlInput,\n          displayText,\n          titleText,\n          cat([\n            catalogs.anchor.map(ListOptions.createUi('anchor', 'Anchors')),\n            catalogs.rels.map(ListOptions.createUi('rel', 'Rel')),\n            catalogs.targets.map(ListOptions.createUi('target', 'Open link in...')),\n            catalogs.link.map(ListOptions.createUi('link', 'Link list')),\n            catalogs.classes.map(ListOptions.createUi('linkClass', 'Class'))\n          ])\n        ])\n      };\n      return {\n        title: 'Insert/Edit Link',\n        size: 'normal',\n        body: body,\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: initialData,\n        onChange: function (api, _a) {\n          var name = _a.name;\n          dialogDelta.onChange(api.getData, { name: name }).each(function (newData) {\n            api.setData(newData);\n          });\n        },\n        onSubmit: onSubmit\n      };\n    };\n    var open$1 = function (editor) {\n      var data = collectData(editor);\n      data.then(function (info) {\n        var onSubmit = handleSubmit(editor, info);\n        return makeDialog(info, onSubmit, editor);\n      }).then(function (spec) {\n        editor.windowManager.open(spec);\n      });\n    };\n\n    var appendClickRemove = function (link, evt) {\n      document.body.appendChild(link);\n      link.dispatchEvent(evt);\n      document.body.removeChild(link);\n    };\n    var open = function (url) {\n      var link = document.createElement('a');\n      link.target = '_blank';\n      link.href = url;\n      link.rel = 'noreferrer noopener';\n      var evt = document.createEvent('MouseEvents');\n      evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\n      appendClickRemove(link, evt);\n    };\n\n    var getLink = function (editor, elm) {\n      return editor.dom.getParent(elm, 'a[href]');\n    };\n    var getSelectedLink = function (editor) {\n      return getLink(editor, editor.selection.getStart());\n    };\n    var hasOnlyAltModifier = function (e) {\n      return e.altKey === true && e.shiftKey === false && e.ctrlKey === false && e.metaKey === false;\n    };\n    var gotoLink = function (editor, a) {\n      if (a) {\n        var href = getHref(a);\n        if (/^#/.test(href)) {\n          var targetEl = editor.$(href);\n          if (targetEl.length) {\n            editor.selection.scrollIntoView(targetEl[0], true);\n          }\n        } else {\n          open(a.href);\n        }\n      }\n    };\n    var openDialog = function (editor) {\n      return function () {\n        open$1(editor);\n      };\n    };\n    var gotoSelectedLink = function (editor) {\n      return function () {\n        gotoLink(editor, getSelectedLink(editor));\n      };\n    };\n    var setupGotoLinks = function (editor) {\n      editor.on('click', function (e) {\n        var link = getLink(editor, e.target);\n        if (link && global$6.metaKeyPressed(e)) {\n          e.preventDefault();\n          gotoLink(editor, link);\n        }\n      });\n      editor.on('keydown', function (e) {\n        var link = getSelectedLink(editor);\n        if (link && e.keyCode === 13 && hasOnlyAltModifier(e)) {\n          e.preventDefault();\n          gotoLink(editor, link);\n        }\n      });\n    };\n    var toggleState = function (editor, toggler) {\n      editor.on('NodeChange', toggler);\n      return function () {\n        return editor.off('NodeChange', toggler);\n      };\n    };\n    var toggleActiveState = function (editor) {\n      return function (api) {\n        var updateState = function () {\n          return api.setActive(!editor.mode.isReadOnly() && getAnchorElement(editor, editor.selection.getNode()) !== null);\n        };\n        updateState();\n        return toggleState(editor, updateState);\n      };\n    };\n    var toggleEnabledState = function (editor) {\n      return function (api) {\n        var updateState = function () {\n          return api.setDisabled(getAnchorElement(editor, editor.selection.getNode()) === null);\n        };\n        updateState();\n        return toggleState(editor, updateState);\n      };\n    };\n    var toggleUnlinkState = function (editor) {\n      return function (api) {\n        var hasLinks$1 = function (parents) {\n          return hasLinks(parents) || hasLinksInSelection(editor.selection.getRng());\n        };\n        var parents = editor.dom.getParents(editor.selection.getStart());\n        api.setDisabled(!hasLinks$1(parents));\n        return toggleState(editor, function (e) {\n          return api.setDisabled(!hasLinks$1(e.parents));\n        });\n      };\n    };\n\n    var register = function (editor) {\n      editor.addCommand('mceLink', function () {\n        if (useQuickLink(editor)) {\n          editor.fire('contexttoolbar-show', { toolbarKey: 'quicklink' });\n        } else {\n          openDialog(editor)();\n        }\n      });\n    };\n\n    var setup = function (editor) {\n      editor.addShortcut('Meta+K', '', function () {\n        editor.execCommand('mceLink');\n      });\n    };\n\n    var setupButtons = function (editor) {\n      editor.ui.registry.addToggleButton('link', {\n        icon: 'link',\n        tooltip: 'Insert/edit link',\n        onAction: openDialog(editor),\n        onSetup: toggleActiveState(editor)\n      });\n      editor.ui.registry.addButton('openlink', {\n        icon: 'new-tab',\n        tooltip: 'Open link',\n        onAction: gotoSelectedLink(editor),\n        onSetup: toggleEnabledState(editor)\n      });\n      editor.ui.registry.addButton('unlink', {\n        icon: 'unlink',\n        tooltip: 'Remove link',\n        onAction: function () {\n          return unlink(editor);\n        },\n        onSetup: toggleUnlinkState(editor)\n      });\n    };\n    var setupMenuItems = function (editor) {\n      editor.ui.registry.addMenuItem('openlink', {\n        text: 'Open link',\n        icon: 'new-tab',\n        onAction: gotoSelectedLink(editor),\n        onSetup: toggleEnabledState(editor)\n      });\n      editor.ui.registry.addMenuItem('link', {\n        icon: 'link',\n        text: 'Link...',\n        shortcut: 'Meta+K',\n        onAction: openDialog(editor)\n      });\n      editor.ui.registry.addMenuItem('unlink', {\n        icon: 'unlink',\n        text: 'Remove link',\n        onAction: function () {\n          return unlink(editor);\n        },\n        onSetup: toggleUnlinkState(editor)\n      });\n    };\n    var setupContextMenu = function (editor) {\n      var inLink = 'link unlink openlink';\n      var noLink = 'link';\n      editor.ui.registry.addContextMenu('link', {\n        update: function (element) {\n          return hasLinks(editor.dom.getParents(element, 'a')) ? inLink : noLink;\n        }\n      });\n    };\n    var setupContextToolbars = function (editor) {\n      var collapseSelectionToEnd = function (editor) {\n        editor.selection.collapse(false);\n      };\n      var onSetupLink = function (buttonApi) {\n        var node = editor.selection.getNode();\n        buttonApi.setDisabled(!getAnchorElement(editor, node));\n        return noop;\n      };\n      var getLinkText = function (value) {\n        var anchor = getAnchorElement(editor);\n        var onlyText = isOnlyTextSelected(editor);\n        if (!anchor && onlyText) {\n          var text = getAnchorText(editor.selection, anchor);\n          return Optional.some(text.length > 0 ? text : value);\n        } else {\n          return Optional.none();\n        }\n      };\n      editor.ui.registry.addContextForm('quicklink', {\n        launch: {\n          type: 'contextformtogglebutton',\n          icon: 'link',\n          tooltip: 'Link',\n          onSetup: toggleActiveState(editor)\n        },\n        label: 'Link',\n        predicate: function (node) {\n          return !!getAnchorElement(editor, node) && hasContextToolbar(editor);\n        },\n        initValue: function () {\n          var elm = getAnchorElement(editor);\n          return !!elm ? getHref(elm) : '';\n        },\n        commands: [\n          {\n            type: 'contextformtogglebutton',\n            icon: 'link',\n            tooltip: 'Link',\n            primary: true,\n            onSetup: function (buttonApi) {\n              var node = editor.selection.getNode();\n              buttonApi.setActive(!!getAnchorElement(editor, node));\n              return toggleActiveState(editor)(buttonApi);\n            },\n            onAction: function (formApi) {\n              var value = formApi.getValue();\n              var text = getLinkText(value);\n              var attachState = {\n                href: value,\n                attach: noop\n              };\n              link(editor, attachState, {\n                href: value,\n                text: text,\n                title: Optional.none(),\n                rel: Optional.none(),\n                target: Optional.none(),\n                class: Optional.none()\n              });\n              collapseSelectionToEnd(editor);\n              formApi.hide();\n            }\n          },\n          {\n            type: 'contextformbutton',\n            icon: 'unlink',\n            tooltip: 'Remove link',\n            onSetup: onSetupLink,\n            onAction: function (formApi) {\n              unlink(editor);\n              formApi.hide();\n            }\n          },\n          {\n            type: 'contextformbutton',\n            icon: 'new-tab',\n            tooltip: 'Open link',\n            onSetup: onSetupLink,\n            onAction: function (formApi) {\n              gotoSelectedLink(editor)();\n              formApi.hide();\n            }\n          }\n        ]\n      });\n    };\n\n    function Plugin () {\n      global$7.add('link', function (editor) {\n        setupButtons(editor);\n        setupMenuItems(editor);\n        setupContextMenu(editor);\n        setupContextToolbars(editor);\n        setupGotoLinks(editor);\n        register(editor);\n        setup(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/link/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/lists/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/lists/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"lists\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/lists')\n//   ES2015:\n//     import 'tinymce/plugins/lists'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/lists/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/lists/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/lists/plugin.js":
/*!**********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/lists/plugin.js ***!
  \**********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$7 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var isString = isType$1('string');\n    var isObject = isType$1('object');\n    var isArray = isType$1('array');\n    var isBoolean = isSimpleType('boolean');\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var tripleEquals = function (a, b) {\n      return a === b;\n    };\n    var not = function (f) {\n      return function (t) {\n        return !f(t);\n      };\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var nativeSlice = Array.prototype.slice;\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$1 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var filter$1 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var groupBy = function (xs, f) {\n      if (xs.length === 0) {\n        return [];\n      } else {\n        var wasType = f(xs[0]);\n        var r = [];\n        var group = [];\n        for (var i = 0, len = xs.length; i < len; i++) {\n          var x = xs[i];\n          var type = f(x);\n          if (type !== wasType) {\n            r.push(group);\n            group = [];\n          }\n          wasType = type;\n          group.push(x);\n        }\n        if (group.length !== 0) {\n          r.push(group);\n        }\n        return r;\n      }\n    };\n    var foldl = function (xs, f, acc) {\n      each$1(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find$1 = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n    var reverse = function (xs) {\n      var r = nativeSlice.call(xs, 0);\n      r.reverse();\n      return r;\n    };\n    var get$1 = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$1(xs, 0);\n    };\n    var last = function (xs) {\n      return get$1(xs, xs.length - 1);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n    function __spreadArray(to, from, pack) {\n      if (pack || arguments.length === 2)\n        for (var i = 0, l = from.length, ar; i < l; i++) {\n          if (ar || !(i in from)) {\n            if (!ar)\n              ar = Array.prototype.slice.call(from, 0, i);\n            ar[i] = from[i];\n          }\n        }\n      return to.concat(ar || Array.prototype.slice.call(from));\n    }\n\n    var cached = function (f) {\n      var called = false;\n      var r;\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!called) {\n          called = true;\n          r = f.apply(null, args);\n        }\n        return r;\n      };\n    };\n\n    var DeviceType = function (os, browser, userAgent, mediaMatch) {\n      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n      var isiPhone = os.isiOS() && !isiPad;\n      var isMobile = os.isiOS() || os.isAndroid();\n      var isTouch = isMobile || mediaMatch('(pointer:coarse)');\n      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');\n      var isPhone = isiPhone || isMobile && !isTablet;\n      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n      var isDesktop = !isPhone && !isTablet && !iOSwebview;\n      return {\n        isiPad: constant(isiPad),\n        isiPhone: constant(isiPhone),\n        isTablet: constant(isTablet),\n        isPhone: constant(isPhone),\n        isTouch: constant(isTouch),\n        isAndroid: os.isAndroid,\n        isiOS: os.isiOS,\n        isWebView: constant(iOSwebview),\n        isDesktop: constant(isDesktop)\n      };\n    };\n\n    var firstMatch = function (regexes, s) {\n      for (var i = 0; i < regexes.length; i++) {\n        var x = regexes[i];\n        if (x.test(s)) {\n          return x;\n        }\n      }\n      return undefined;\n    };\n    var find = function (regexes, agent) {\n      var r = firstMatch(regexes, agent);\n      if (!r) {\n        return {\n          major: 0,\n          minor: 0\n        };\n      }\n      var group = function (i) {\n        return Number(agent.replace(r, '$' + i));\n      };\n      return nu$2(group(1), group(2));\n    };\n    var detect$3 = function (versionRegexes, agent) {\n      var cleanedAgent = String(agent).toLowerCase();\n      if (versionRegexes.length === 0) {\n        return unknown$2();\n      }\n      return find(versionRegexes, cleanedAgent);\n    };\n    var unknown$2 = function () {\n      return nu$2(0, 0);\n    };\n    var nu$2 = function (major, minor) {\n      return {\n        major: major,\n        minor: minor\n      };\n    };\n    var Version = {\n      nu: nu$2,\n      detect: detect$3,\n      unknown: unknown$2\n    };\n\n    var detectBrowser$1 = function (browsers, userAgentData) {\n      return findMap(userAgentData.brands, function (uaBrand) {\n        var lcBrand = uaBrand.brand.toLowerCase();\n        return find$1(browsers, function (browser) {\n          var _a;\n          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());\n        }).map(function (info) {\n          return {\n            current: info.name,\n            version: Version.nu(parseInt(uaBrand.version, 10), 0)\n          };\n        });\n      });\n    };\n\n    var detect$2 = function (candidates, userAgent) {\n      var agent = String(userAgent).toLowerCase();\n      return find$1(candidates, function (candidate) {\n        return candidate.search(agent);\n      });\n    };\n    var detectBrowser = function (browsers, userAgent) {\n      return detect$2(browsers, userAgent).map(function (browser) {\n        var version = Version.detect(browser.versionRegexes, userAgent);\n        return {\n          current: browser.name,\n          version: version\n        };\n      });\n    };\n    var detectOs = function (oses, userAgent) {\n      return detect$2(oses, userAgent).map(function (os) {\n        var version = Version.detect(os.versionRegexes, userAgent);\n        return {\n          current: os.name,\n          version: version\n        };\n      });\n    };\n\n    var contains$1 = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var blank = function (r) {\n      return function (s) {\n        return s.replace(r, '');\n      };\n    };\n    var trim = blank(/^\\s+|\\s+$/g);\n    var isNotEmpty = function (s) {\n      return s.length > 0;\n    };\n    var isEmpty$1 = function (s) {\n      return !isNotEmpty(s);\n    };\n\n    var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n    var checkContains = function (target) {\n      return function (uastring) {\n        return contains$1(uastring, target);\n      };\n    };\n    var browsers = [\n      {\n        name: 'Edge',\n        versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n        search: function (uastring) {\n          return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');\n        }\n      },\n      {\n        name: 'Chrome',\n        brand: 'Chromium',\n        versionRegexes: [\n          /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n          normalVersionRegex\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');\n        }\n      },\n      {\n        name: 'IE',\n        versionRegexes: [\n          /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*?rv:([0-9]+)\\.([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');\n        }\n      },\n      {\n        name: 'Opera',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n        ],\n        search: checkContains('opera')\n      },\n      {\n        name: 'Firefox',\n        versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n        search: checkContains('firefox')\n      },\n      {\n        name: 'Safari',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?cpu os ([0-9]+)_([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');\n        }\n      }\n    ];\n    var oses = [\n      {\n        name: 'Windows',\n        search: checkContains('win'),\n        versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'iOS',\n        search: function (uastring) {\n          return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');\n        },\n        versionRegexes: [\n          /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*cpu os ([0-9]+)_([0-9]+).*/,\n          /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n        ]\n      },\n      {\n        name: 'Android',\n        search: checkContains('android'),\n        versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'OSX',\n        search: checkContains('mac os x'),\n        versionRegexes: [/.*?mac\\ os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n      },\n      {\n        name: 'Linux',\n        search: checkContains('linux'),\n        versionRegexes: []\n      },\n      {\n        name: 'Solaris',\n        search: checkContains('sunos'),\n        versionRegexes: []\n      },\n      {\n        name: 'FreeBSD',\n        search: checkContains('freebsd'),\n        versionRegexes: []\n      },\n      {\n        name: 'ChromeOS',\n        search: checkContains('cros'),\n        versionRegexes: [/.*?chrome\\/([0-9]+)\\.([0-9]+).*/]\n      }\n    ];\n    var PlatformInfo = {\n      browsers: constant(browsers),\n      oses: constant(oses)\n    };\n\n    var edge = 'Edge';\n    var chrome = 'Chrome';\n    var ie = 'IE';\n    var opera = 'Opera';\n    var firefox = 'Firefox';\n    var safari = 'Safari';\n    var unknown$1 = function () {\n      return nu$1({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$1 = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isBrowser = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isEdge: isBrowser(edge),\n        isChrome: isBrowser(chrome),\n        isIE: isBrowser(ie),\n        isOpera: isBrowser(opera),\n        isFirefox: isBrowser(firefox),\n        isSafari: isBrowser(safari)\n      };\n    };\n    var Browser = {\n      unknown: unknown$1,\n      nu: nu$1,\n      edge: constant(edge),\n      chrome: constant(chrome),\n      ie: constant(ie),\n      opera: constant(opera),\n      firefox: constant(firefox),\n      safari: constant(safari)\n    };\n\n    var windows = 'Windows';\n    var ios = 'iOS';\n    var android = 'Android';\n    var linux = 'Linux';\n    var osx = 'OSX';\n    var solaris = 'Solaris';\n    var freebsd = 'FreeBSD';\n    var chromeos = 'ChromeOS';\n    var unknown = function () {\n      return nu({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isOS = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isWindows: isOS(windows),\n        isiOS: isOS(ios),\n        isAndroid: isOS(android),\n        isOSX: isOS(osx),\n        isLinux: isOS(linux),\n        isSolaris: isOS(solaris),\n        isFreeBSD: isOS(freebsd),\n        isChromeOS: isOS(chromeos)\n      };\n    };\n    var OperatingSystem = {\n      unknown: unknown,\n      nu: nu,\n      windows: constant(windows),\n      ios: constant(ios),\n      android: constant(android),\n      linux: constant(linux),\n      osx: constant(osx),\n      solaris: constant(solaris),\n      freebsd: constant(freebsd),\n      chromeos: constant(chromeos)\n    };\n\n    var detect$1 = function (userAgent, userAgentDataOpt, mediaMatch) {\n      var browsers = PlatformInfo.browsers();\n      var oses = PlatformInfo.oses();\n      var browser = userAgentDataOpt.bind(function (userAgentData) {\n        return detectBrowser$1(browsers, userAgentData);\n      }).orThunk(function () {\n        return detectBrowser(browsers, userAgent);\n      }).fold(Browser.unknown, Browser.nu);\n      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);\n      return {\n        browser: browser,\n        os: os,\n        deviceType: deviceType\n      };\n    };\n    var PlatformDetection = { detect: detect$1 };\n\n    var mediaMatch = function (query) {\n      return window.matchMedia(query).matches;\n    };\n    var platform = cached(function () {\n      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);\n    });\n    var detect = function () {\n      return platform();\n    };\n\n    var compareDocumentPosition = function (a, b, match) {\n      return (a.compareDocumentPosition(b) & match) !== 0;\n    };\n    var documentPositionContainedBy = function (a, b) {\n      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);\n    };\n\n    var ELEMENT = 1;\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    var is$2 = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n\n    var eq = function (e1, e2) {\n      return e1.dom === e2.dom;\n    };\n    var regularContains = function (e1, e2) {\n      var d1 = e1.dom;\n      var d2 = e2.dom;\n      return d1 === d2 ? false : d1.contains(d2);\n    };\n    var ieContains = function (e1, e2) {\n      return documentPositionContainedBy(e1.dom, e2.dom);\n    };\n    var contains = function (e1, e2) {\n      return detect().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);\n    };\n    var is$1 = is$2;\n\n    var global$6 = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var keys = Object.keys;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var filter = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var name = function (element) {\n      var r = element.dom.nodeName;\n      return r.toLowerCase();\n    };\n    var type = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type(element) === t;\n      };\n    };\n    var isElement = isType(ELEMENT);\n    var isTag = function (tag) {\n      return function (e) {\n        return isElement(e) && name(e) === tag;\n      };\n    };\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var setAll = function (element, attrs) {\n      var dom = element.dom;\n      each(attrs, function (v, k) {\n        rawSet(dom, k, v);\n      });\n    };\n    var clone$1 = function (element) {\n      return foldl(element.dom.attributes, function (acc, attr) {\n        acc[attr.name] = attr.value;\n        return acc;\n      }, {});\n    };\n\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var children = function (element) {\n      return map(element.dom.childNodes, SugarElement.fromDom);\n    };\n    var child = function (element, index) {\n      var cs = element.dom.childNodes;\n      return Optional.from(cs[index]).map(SugarElement.fromDom);\n    };\n    var firstChild = function (element) {\n      return child(element, 0);\n    };\n    var lastChild = function (element) {\n      return child(element, element.dom.childNodes.length - 1);\n    };\n\n    var before$1 = function (marker, element) {\n      var parent$1 = parent(marker);\n      parent$1.each(function (v) {\n        v.dom.insertBefore(element.dom, marker.dom);\n      });\n    };\n    var append$1 = function (parent, element) {\n      parent.dom.appendChild(element.dom);\n    };\n\n    var before = function (marker, elements) {\n      each$1(elements, function (x) {\n        before$1(marker, x);\n      });\n    };\n    var append = function (parent, elements) {\n      each$1(elements, function (x) {\n        append$1(parent, x);\n      });\n    };\n\n    var remove = function (element) {\n      var dom = element.dom;\n      if (dom.parentNode !== null) {\n        dom.parentNode.removeChild(dom);\n      }\n    };\n\n    var clone = function (original, isDeep) {\n      return SugarElement.fromDom(original.dom.cloneNode(isDeep));\n    };\n    var deep = function (original) {\n      return clone(original, true);\n    };\n    var shallowAs = function (original, tag) {\n      var nu = SugarElement.fromTag(tag);\n      var attributes = clone$1(original);\n      setAll(nu, attributes);\n      return nu;\n    };\n    var mutate = function (original, tag) {\n      var nu = shallowAs(original, tag);\n      before$1(original, nu);\n      var children$1 = children(original);\n      append(nu, children$1);\n      remove(original);\n      return nu;\n    };\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var matchNodeName = function (name) {\n      return function (node) {\n        return node && node.nodeName.toLowerCase() === name;\n      };\n    };\n    var matchNodeNames = function (regex) {\n      return function (node) {\n        return node && regex.test(node.nodeName);\n      };\n    };\n    var isTextNode = function (node) {\n      return node && node.nodeType === 3;\n    };\n    var isListNode = matchNodeNames(/^(OL|UL|DL)$/);\n    var isOlUlNode = matchNodeNames(/^(OL|UL)$/);\n    var isOlNode = matchNodeName('ol');\n    var isListItemNode = matchNodeNames(/^(LI|DT|DD)$/);\n    var isDlItemNode = matchNodeNames(/^(DT|DD)$/);\n    var isTableCellNode = matchNodeNames(/^(TH|TD)$/);\n    var isBr = matchNodeName('br');\n    var isFirstChild = function (node) {\n      return node.parentNode.firstChild === node;\n    };\n    var isTextBlock = function (editor, node) {\n      return node && !!editor.schema.getTextBlockElements()[node.nodeName];\n    };\n    var isBlock = function (node, blockElements) {\n      return node && node.nodeName in blockElements;\n    };\n    var isBogusBr = function (dom, node) {\n      if (!isBr(node)) {\n        return false;\n      }\n      return dom.isBlock(node.nextSibling) && !isBr(node.previousSibling);\n    };\n    var isEmpty = function (dom, elm, keepBookmarks) {\n      var empty = dom.isEmpty(elm);\n      if (keepBookmarks && dom.select('span[data-mce-type=bookmark]', elm).length > 0) {\n        return false;\n      }\n      return empty;\n    };\n    var isChildOfBody = function (dom, elm) {\n      return dom.isChildOf(elm, dom.getRoot());\n    };\n\n    var shouldIndentOnTab = function (editor) {\n      return editor.getParam('lists_indent_on_tab', true);\n    };\n    var getForcedRootBlock = function (editor) {\n      var block = editor.getParam('forced_root_block', 'p');\n      if (block === false) {\n        return '';\n      } else if (block === true) {\n        return 'p';\n      } else {\n        return block;\n      }\n    };\n    var getForcedRootBlockAttrs = function (editor) {\n      return editor.getParam('forced_root_block_attrs', {});\n    };\n\n    var createTextBlock = function (editor, contentNode) {\n      var dom = editor.dom;\n      var blockElements = editor.schema.getBlockElements();\n      var fragment = dom.createFragment();\n      var blockName = getForcedRootBlock(editor);\n      var node, textBlock, hasContentNode;\n      if (blockName) {\n        textBlock = dom.create(blockName);\n        if (textBlock.tagName === blockName.toUpperCase()) {\n          dom.setAttribs(textBlock, getForcedRootBlockAttrs(editor));\n        }\n        if (!isBlock(contentNode.firstChild, blockElements)) {\n          fragment.appendChild(textBlock);\n        }\n      }\n      if (contentNode) {\n        while (node = contentNode.firstChild) {\n          var nodeName = node.nodeName;\n          if (!hasContentNode && (nodeName !== 'SPAN' || node.getAttribute('data-mce-type') !== 'bookmark')) {\n            hasContentNode = true;\n          }\n          if (isBlock(node, blockElements)) {\n            fragment.appendChild(node);\n            textBlock = null;\n          } else {\n            if (blockName) {\n              if (!textBlock) {\n                textBlock = dom.create(blockName);\n                fragment.appendChild(textBlock);\n              }\n              textBlock.appendChild(node);\n            } else {\n              fragment.appendChild(node);\n            }\n          }\n        }\n      }\n      if (!blockName) {\n        fragment.appendChild(dom.create('br'));\n      } else {\n        if (!hasContentNode) {\n          textBlock.appendChild(dom.create('br', { 'data-mce-bogus': '1' }));\n        }\n      }\n      return fragment;\n    };\n\n    var DOM$2 = global$3.DOM;\n    var splitList = function (editor, list, li) {\n      var removeAndKeepBookmarks = function (targetNode) {\n        global$2.each(bookmarks, function (node) {\n          targetNode.parentNode.insertBefore(node, li.parentNode);\n        });\n        DOM$2.remove(targetNode);\n      };\n      var bookmarks = DOM$2.select('span[data-mce-type=\"bookmark\"]', list);\n      var newBlock = createTextBlock(editor, li);\n      var tmpRng = DOM$2.createRng();\n      tmpRng.setStartAfter(li);\n      tmpRng.setEndAfter(list);\n      var fragment = tmpRng.extractContents();\n      for (var node = fragment.firstChild; node; node = node.firstChild) {\n        if (node.nodeName === 'LI' && editor.dom.isEmpty(node)) {\n          DOM$2.remove(node);\n          break;\n        }\n      }\n      if (!editor.dom.isEmpty(fragment)) {\n        DOM$2.insertAfter(fragment, list);\n      }\n      DOM$2.insertAfter(newBlock, list);\n      if (isEmpty(editor.dom, li.parentNode)) {\n        removeAndKeepBookmarks(li.parentNode);\n      }\n      DOM$2.remove(li);\n      if (isEmpty(editor.dom, list)) {\n        DOM$2.remove(list);\n      }\n    };\n\n    var isDescriptionDetail = isTag('dd');\n    var isDescriptionTerm = isTag('dt');\n    var outdentDlItem = function (editor, item) {\n      if (isDescriptionDetail(item)) {\n        mutate(item, 'dt');\n      } else if (isDescriptionTerm(item)) {\n        parent(item).each(function (dl) {\n          return splitList(editor, dl.dom, item.dom);\n        });\n      }\n    };\n    var indentDlItem = function (item) {\n      if (isDescriptionTerm(item)) {\n        mutate(item, 'dd');\n      }\n    };\n    var dlIndentation = function (editor, indentation, dlItems) {\n      if (indentation === 'Indent') {\n        each$1(dlItems, indentDlItem);\n      } else {\n        each$1(dlItems, function (item) {\n          return outdentDlItem(editor, item);\n        });\n      }\n    };\n\n    var getNormalizedPoint = function (container, offset) {\n      if (isTextNode(container)) {\n        return {\n          container: container,\n          offset: offset\n        };\n      }\n      var node = global$6.getNode(container, offset);\n      if (isTextNode(node)) {\n        return {\n          container: node,\n          offset: offset >= container.childNodes.length ? node.data.length : 0\n        };\n      } else if (node.previousSibling && isTextNode(node.previousSibling)) {\n        return {\n          container: node.previousSibling,\n          offset: node.previousSibling.data.length\n        };\n      } else if (node.nextSibling && isTextNode(node.nextSibling)) {\n        return {\n          container: node.nextSibling,\n          offset: 0\n        };\n      }\n      return {\n        container: container,\n        offset: offset\n      };\n    };\n    var normalizeRange = function (rng) {\n      var outRng = rng.cloneRange();\n      var rangeStart = getNormalizedPoint(rng.startContainer, rng.startOffset);\n      outRng.setStart(rangeStart.container, rangeStart.offset);\n      var rangeEnd = getNormalizedPoint(rng.endContainer, rng.endOffset);\n      outRng.setEnd(rangeEnd.container, rangeEnd.offset);\n      return outRng;\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.dom.DomQuery');\n\n    var getParentList = function (editor, node) {\n      var selectionStart = node || editor.selection.getStart(true);\n      return editor.dom.getParent(selectionStart, 'OL,UL,DL', getClosestListRootElm(editor, selectionStart));\n    };\n    var isParentListSelected = function (parentList, selectedBlocks) {\n      return parentList && selectedBlocks.length === 1 && selectedBlocks[0] === parentList;\n    };\n    var findSubLists = function (parentList) {\n      return filter$1(parentList.querySelectorAll('ol,ul,dl'), isListNode);\n    };\n    var getSelectedSubLists = function (editor) {\n      var parentList = getParentList(editor);\n      var selectedBlocks = editor.selection.getSelectedBlocks();\n      if (isParentListSelected(parentList, selectedBlocks)) {\n        return findSubLists(parentList);\n      } else {\n        return filter$1(selectedBlocks, function (elm) {\n          return isListNode(elm) && parentList !== elm;\n        });\n      }\n    };\n    var findParentListItemsNodes = function (editor, elms) {\n      var listItemsElms = global$2.map(elms, function (elm) {\n        var parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));\n        return parentLi ? parentLi : elm;\n      });\n      return global$1.unique(listItemsElms);\n    };\n    var getSelectedListItems = function (editor) {\n      var selectedBlocks = editor.selection.getSelectedBlocks();\n      return filter$1(findParentListItemsNodes(editor, selectedBlocks), isListItemNode);\n    };\n    var getSelectedDlItems = function (editor) {\n      return filter$1(getSelectedListItems(editor), isDlItemNode);\n    };\n    var getClosestListRootElm = function (editor, elm) {\n      var parentTableCell = editor.dom.getParents(elm, 'TD,TH');\n      return parentTableCell.length > 0 ? parentTableCell[0] : editor.getBody();\n    };\n    var findLastParentListNode = function (editor, elm) {\n      var parentLists = editor.dom.getParents(elm, 'ol,ul', getClosestListRootElm(editor, elm));\n      return last(parentLists);\n    };\n    var getSelectedLists = function (editor) {\n      var firstList = findLastParentListNode(editor, editor.selection.getStart());\n      var subsequentLists = filter$1(editor.selection.getSelectedBlocks(), isOlUlNode);\n      return firstList.toArray().concat(subsequentLists);\n    };\n    var getSelectedListRoots = function (editor) {\n      var selectedLists = getSelectedLists(editor);\n      return getUniqueListRoots(editor, selectedLists);\n    };\n    var getUniqueListRoots = function (editor, lists) {\n      var listRoots = map(lists, function (list) {\n        return findLastParentListNode(editor, list).getOr(list);\n      });\n      return global$1.unique(listRoots);\n    };\n\n    var is = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lhs.exists(function (left) {\n        return comparator(left, rhs);\n      });\n    };\n    var lift2 = function (oa, ob, f) {\n      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();\n    };\n\n    var fromElements = function (elements, scope) {\n      var doc = scope || document;\n      var fragment = doc.createDocumentFragment();\n      each$1(elements, function (element) {\n        fragment.appendChild(element.dom);\n      });\n      return SugarElement.fromDom(fragment);\n    };\n\n    var fireListEvent = function (editor, action, element) {\n      return editor.fire('ListMutation', {\n        action: action,\n        element: element\n      });\n    };\n\n    var isSupported = function (dom) {\n      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n    };\n\n    var internalSet = function (dom, property, value) {\n      if (!isString(value)) {\n        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n        throw new Error('CSS value must be a string: ' + value);\n      }\n      if (isSupported(dom)) {\n        dom.style.setProperty(property, value);\n      }\n    };\n    var set = function (element, property, value) {\n      var dom = element.dom;\n      internalSet(dom, property, value);\n    };\n\n    var joinSegment = function (parent, child) {\n      append$1(parent.item, child.list);\n    };\n    var joinSegments = function (segments) {\n      for (var i = 1; i < segments.length; i++) {\n        joinSegment(segments[i - 1], segments[i]);\n      }\n    };\n    var appendSegments = function (head$1, tail) {\n      lift2(last(head$1), head(tail), joinSegment);\n    };\n    var createSegment = function (scope, listType) {\n      var segment = {\n        list: SugarElement.fromTag(listType, scope),\n        item: SugarElement.fromTag('li', scope)\n      };\n      append$1(segment.list, segment.item);\n      return segment;\n    };\n    var createSegments = function (scope, entry, size) {\n      var segments = [];\n      for (var i = 0; i < size; i++) {\n        segments.push(createSegment(scope, entry.listType));\n      }\n      return segments;\n    };\n    var populateSegments = function (segments, entry) {\n      for (var i = 0; i < segments.length - 1; i++) {\n        set(segments[i].item, 'list-style-type', 'none');\n      }\n      last(segments).each(function (segment) {\n        setAll(segment.list, entry.listAttributes);\n        setAll(segment.item, entry.itemAttributes);\n        append(segment.item, entry.content);\n      });\n    };\n    var normalizeSegment = function (segment, entry) {\n      if (name(segment.list) !== entry.listType) {\n        segment.list = mutate(segment.list, entry.listType);\n      }\n      setAll(segment.list, entry.listAttributes);\n    };\n    var createItem = function (scope, attr, content) {\n      var item = SugarElement.fromTag('li', scope);\n      setAll(item, attr);\n      append(item, content);\n      return item;\n    };\n    var appendItem = function (segment, item) {\n      append$1(segment.list, item);\n      segment.item = item;\n    };\n    var writeShallow = function (scope, cast, entry) {\n      var newCast = cast.slice(0, entry.depth);\n      last(newCast).each(function (segment) {\n        var item = createItem(scope, entry.itemAttributes, entry.content);\n        appendItem(segment, item);\n        normalizeSegment(segment, entry);\n      });\n      return newCast;\n    };\n    var writeDeep = function (scope, cast, entry) {\n      var segments = createSegments(scope, entry, entry.depth - cast.length);\n      joinSegments(segments);\n      populateSegments(segments, entry);\n      appendSegments(cast, segments);\n      return cast.concat(segments);\n    };\n    var composeList = function (scope, entries) {\n      var cast = foldl(entries, function (cast, entry) {\n        return entry.depth > cast.length ? writeDeep(scope, cast, entry) : writeShallow(scope, cast, entry);\n      }, []);\n      return head(cast).map(function (segment) {\n        return segment.list;\n      });\n    };\n\n    var isList = function (el) {\n      return is$1(el, 'OL,UL');\n    };\n    var hasFirstChildList = function (el) {\n      return firstChild(el).exists(isList);\n    };\n    var hasLastChildList = function (el) {\n      return lastChild(el).exists(isList);\n    };\n\n    var isIndented = function (entry) {\n      return entry.depth > 0;\n    };\n    var isSelected = function (entry) {\n      return entry.isSelected;\n    };\n    var cloneItemContent = function (li) {\n      var children$1 = children(li);\n      var content = hasLastChildList(li) ? children$1.slice(0, -1) : children$1;\n      return map(content, deep);\n    };\n    var createEntry = function (li, depth, isSelected) {\n      return parent(li).filter(isElement).map(function (list) {\n        return {\n          depth: depth,\n          dirty: false,\n          isSelected: isSelected,\n          content: cloneItemContent(li),\n          itemAttributes: clone$1(li),\n          listAttributes: clone$1(list),\n          listType: name(list)\n        };\n      });\n    };\n\n    var indentEntry = function (indentation, entry) {\n      switch (indentation) {\n      case 'Indent':\n        entry.depth++;\n        break;\n      case 'Outdent':\n        entry.depth--;\n        break;\n      case 'Flatten':\n        entry.depth = 0;\n      }\n      entry.dirty = true;\n    };\n\n    var cloneListProperties = function (target, source) {\n      target.listType = source.listType;\n      target.listAttributes = __assign({}, source.listAttributes);\n    };\n    var cleanListProperties = function (entry) {\n      entry.listAttributes = filter(entry.listAttributes, function (_value, key) {\n        return key !== 'start';\n      });\n    };\n    var closestSiblingEntry = function (entries, start) {\n      var depth = entries[start].depth;\n      var matches = function (entry) {\n        return entry.depth === depth && !entry.dirty;\n      };\n      var until = function (entry) {\n        return entry.depth < depth;\n      };\n      return findUntil(reverse(entries.slice(0, start)), matches, until).orThunk(function () {\n        return findUntil(entries.slice(start + 1), matches, until);\n      });\n    };\n    var normalizeEntries = function (entries) {\n      each$1(entries, function (entry, i) {\n        closestSiblingEntry(entries, i).fold(function () {\n          if (entry.dirty) {\n            cleanListProperties(entry);\n          }\n        }, function (matchingEntry) {\n          return cloneListProperties(entry, matchingEntry);\n        });\n      });\n      return entries;\n    };\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var parseItem = function (depth, itemSelection, selectionState, item) {\n      return firstChild(item).filter(isList).fold(function () {\n        itemSelection.each(function (selection) {\n          if (eq(selection.start, item)) {\n            selectionState.set(true);\n          }\n        });\n        var currentItemEntry = createEntry(item, depth, selectionState.get());\n        itemSelection.each(function (selection) {\n          if (eq(selection.end, item)) {\n            selectionState.set(false);\n          }\n        });\n        var childListEntries = lastChild(item).filter(isList).map(function (list) {\n          return parseList(depth, itemSelection, selectionState, list);\n        }).getOr([]);\n        return currentItemEntry.toArray().concat(childListEntries);\n      }, function (list) {\n        return parseList(depth, itemSelection, selectionState, list);\n      });\n    };\n    var parseList = function (depth, itemSelection, selectionState, list) {\n      return bind(children(list), function (element) {\n        var parser = isList(element) ? parseList : parseItem;\n        var newDepth = depth + 1;\n        return parser(newDepth, itemSelection, selectionState, element);\n      });\n    };\n    var parseLists = function (lists, itemSelection) {\n      var selectionState = Cell(false);\n      var initialDepth = 0;\n      return map(lists, function (list) {\n        return {\n          sourceList: list,\n          entries: parseList(initialDepth, itemSelection, selectionState, list)\n        };\n      });\n    };\n\n    var outdentedComposer = function (editor, entries) {\n      var normalizedEntries = normalizeEntries(entries);\n      return map(normalizedEntries, function (entry) {\n        var content = fromElements(entry.content);\n        return SugarElement.fromDom(createTextBlock(editor, content.dom));\n      });\n    };\n    var indentedComposer = function (editor, entries) {\n      var normalizedEntries = normalizeEntries(entries);\n      return composeList(editor.contentDocument, normalizedEntries).toArray();\n    };\n    var composeEntries = function (editor, entries) {\n      return bind(groupBy(entries, isIndented), function (entries) {\n        var groupIsIndented = head(entries).exists(isIndented);\n        return groupIsIndented ? indentedComposer(editor, entries) : outdentedComposer(editor, entries);\n      });\n    };\n    var indentSelectedEntries = function (entries, indentation) {\n      each$1(filter$1(entries, isSelected), function (entry) {\n        return indentEntry(indentation, entry);\n      });\n    };\n    var getItemSelection = function (editor) {\n      var selectedListItems = map(getSelectedListItems(editor), SugarElement.fromDom);\n      return lift2(find$1(selectedListItems, not(hasFirstChildList)), find$1(reverse(selectedListItems), not(hasFirstChildList)), function (start, end) {\n        return {\n          start: start,\n          end: end\n        };\n      });\n    };\n    var listIndentation = function (editor, lists, indentation) {\n      var entrySets = parseLists(lists, getItemSelection(editor));\n      each$1(entrySets, function (entrySet) {\n        indentSelectedEntries(entrySet.entries, indentation);\n        var composedLists = composeEntries(editor, entrySet.entries);\n        each$1(composedLists, function (composedList) {\n          fireListEvent(editor, indentation === 'Indent' ? 'IndentList' : 'OutdentList', composedList.dom);\n        });\n        before(entrySet.sourceList, composedLists);\n        remove(entrySet.sourceList);\n      });\n    };\n\n    var selectionIndentation = function (editor, indentation) {\n      var lists = map(getSelectedListRoots(editor), SugarElement.fromDom);\n      var dlItems = map(getSelectedDlItems(editor), SugarElement.fromDom);\n      var isHandled = false;\n      if (lists.length || dlItems.length) {\n        var bookmark = editor.selection.getBookmark();\n        listIndentation(editor, lists, indentation);\n        dlIndentation(editor, indentation, dlItems);\n        editor.selection.moveToBookmark(bookmark);\n        editor.selection.setRng(normalizeRange(editor.selection.getRng()));\n        editor.nodeChanged();\n        isHandled = true;\n      }\n      return isHandled;\n    };\n    var indentListSelection = function (editor) {\n      return selectionIndentation(editor, 'Indent');\n    };\n    var outdentListSelection = function (editor) {\n      return selectionIndentation(editor, 'Outdent');\n    };\n    var flattenListSelection = function (editor) {\n      return selectionIndentation(editor, 'Flatten');\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.dom.BookmarkManager');\n\n    var DOM$1 = global$3.DOM;\n    var createBookmark = function (rng) {\n      var bookmark = {};\n      var setupEndPoint = function (start) {\n        var container = rng[start ? 'startContainer' : 'endContainer'];\n        var offset = rng[start ? 'startOffset' : 'endOffset'];\n        if (container.nodeType === 1) {\n          var offsetNode = DOM$1.create('span', { 'data-mce-type': 'bookmark' });\n          if (container.hasChildNodes()) {\n            offset = Math.min(offset, container.childNodes.length - 1);\n            if (start) {\n              container.insertBefore(offsetNode, container.childNodes[offset]);\n            } else {\n              DOM$1.insertAfter(offsetNode, container.childNodes[offset]);\n            }\n          } else {\n            container.appendChild(offsetNode);\n          }\n          container = offsetNode;\n          offset = 0;\n        }\n        bookmark[start ? 'startContainer' : 'endContainer'] = container;\n        bookmark[start ? 'startOffset' : 'endOffset'] = offset;\n      };\n      setupEndPoint(true);\n      if (!rng.collapsed) {\n        setupEndPoint();\n      }\n      return bookmark;\n    };\n    var resolveBookmark = function (bookmark) {\n      var restoreEndPoint = function (start) {\n        var node;\n        var nodeIndex = function (container) {\n          var node = container.parentNode.firstChild, idx = 0;\n          while (node) {\n            if (node === container) {\n              return idx;\n            }\n            if (node.nodeType !== 1 || node.getAttribute('data-mce-type') !== 'bookmark') {\n              idx++;\n            }\n            node = node.nextSibling;\n          }\n          return -1;\n        };\n        var container = node = bookmark[start ? 'startContainer' : 'endContainer'];\n        var offset = bookmark[start ? 'startOffset' : 'endOffset'];\n        if (!container) {\n          return;\n        }\n        if (container.nodeType === 1) {\n          offset = nodeIndex(container);\n          container = container.parentNode;\n          DOM$1.remove(node);\n          if (!container.hasChildNodes() && DOM$1.isBlock(container)) {\n            container.appendChild(DOM$1.create('br'));\n          }\n        }\n        bookmark[start ? 'startContainer' : 'endContainer'] = container;\n        bookmark[start ? 'startOffset' : 'endOffset'] = offset;\n      };\n      restoreEndPoint(true);\n      restoreEndPoint();\n      var rng = DOM$1.createRng();\n      rng.setStart(bookmark.startContainer, bookmark.startOffset);\n      if (bookmark.endContainer) {\n        rng.setEnd(bookmark.endContainer, bookmark.endOffset);\n      }\n      return normalizeRange(rng);\n    };\n\n    var listToggleActionFromListName = function (listName) {\n      switch (listName) {\n      case 'UL':\n        return 'ToggleUlList';\n      case 'OL':\n        return 'ToggleOlList';\n      case 'DL':\n        return 'ToggleDLList';\n      }\n    };\n\n    var isCustomList = function (list) {\n      return /\\btox\\-/.test(list.className);\n    };\n    var listState = function (editor, listName, activate) {\n      var nodeChangeHandler = function (e) {\n        var inList = findUntil(e.parents, isListNode, isTableCellNode).filter(function (list) {\n          return list.nodeName === listName && !isCustomList(list);\n        }).isSome();\n        activate(inList);\n      };\n      var parents = editor.dom.getParents(editor.selection.getNode());\n      nodeChangeHandler({ parents: parents });\n      editor.on('NodeChange', nodeChangeHandler);\n      return function () {\n        return editor.off('NodeChange', nodeChangeHandler);\n      };\n    };\n\n    var updateListStyle = function (dom, el, detail) {\n      var type = detail['list-style-type'] ? detail['list-style-type'] : null;\n      dom.setStyle(el, 'list-style-type', type);\n    };\n    var setAttribs = function (elm, attrs) {\n      global$2.each(attrs, function (value, key) {\n        elm.setAttribute(key, value);\n      });\n    };\n    var updateListAttrs = function (dom, el, detail) {\n      setAttribs(el, detail['list-attributes']);\n      global$2.each(dom.select('li', el), function (li) {\n        setAttribs(li, detail['list-item-attributes']);\n      });\n    };\n    var updateListWithDetails = function (dom, el, detail) {\n      updateListStyle(dom, el, detail);\n      updateListAttrs(dom, el, detail);\n    };\n    var removeStyles = function (dom, element, styles) {\n      global$2.each(styles, function (style) {\n        var _a;\n        return dom.setStyle(element, (_a = {}, _a[style] = '', _a));\n      });\n    };\n    var getEndPointNode = function (editor, rng, start, root) {\n      var container = rng[start ? 'startContainer' : 'endContainer'];\n      var offset = rng[start ? 'startOffset' : 'endOffset'];\n      if (container.nodeType === 1) {\n        container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\n      }\n      if (!start && isBr(container.nextSibling)) {\n        container = container.nextSibling;\n      }\n      while (container.parentNode !== root) {\n        if (isTextBlock(editor, container)) {\n          return container;\n        }\n        if (/^(TD|TH)$/.test(container.parentNode.nodeName)) {\n          return container;\n        }\n        container = container.parentNode;\n      }\n      return container;\n    };\n    var getSelectedTextBlocks = function (editor, rng, root) {\n      var textBlocks = [];\n      var dom = editor.dom;\n      var startNode = getEndPointNode(editor, rng, true, root);\n      var endNode = getEndPointNode(editor, rng, false, root);\n      var block;\n      var siblings = [];\n      for (var node = startNode; node; node = node.nextSibling) {\n        siblings.push(node);\n        if (node === endNode) {\n          break;\n        }\n      }\n      global$2.each(siblings, function (node) {\n        if (isTextBlock(editor, node)) {\n          textBlocks.push(node);\n          block = null;\n          return;\n        }\n        if (dom.isBlock(node) || isBr(node)) {\n          if (isBr(node)) {\n            dom.remove(node);\n          }\n          block = null;\n          return;\n        }\n        var nextSibling = node.nextSibling;\n        if (global.isBookmarkNode(node)) {\n          if (isListNode(nextSibling) || isTextBlock(editor, nextSibling) || !nextSibling && node.parentNode === root) {\n            block = null;\n            return;\n          }\n        }\n        if (!block) {\n          block = dom.create('p');\n          node.parentNode.insertBefore(block, node);\n          textBlocks.push(block);\n        }\n        block.appendChild(node);\n      });\n      return textBlocks;\n    };\n    var hasCompatibleStyle = function (dom, sib, detail) {\n      var sibStyle = dom.getStyle(sib, 'list-style-type');\n      var detailStyle = detail ? detail['list-style-type'] : '';\n      detailStyle = detailStyle === null ? '' : detailStyle;\n      return sibStyle === detailStyle;\n    };\n    var applyList = function (editor, listName, detail) {\n      var rng = editor.selection.getRng();\n      var listItemName = 'LI';\n      var root = getClosestListRootElm(editor, editor.selection.getStart(true));\n      var dom = editor.dom;\n      if (dom.getContentEditable(editor.selection.getNode()) === 'false') {\n        return;\n      }\n      listName = listName.toUpperCase();\n      if (listName === 'DL') {\n        listItemName = 'DT';\n      }\n      var bookmark = createBookmark(rng);\n      var selectedTextBlocks = getSelectedTextBlocks(editor, rng, root);\n      global$2.each(selectedTextBlocks, function (block) {\n        var listBlock;\n        var sibling = block.previousSibling;\n        var parent = block.parentNode;\n        if (!isListItemNode(parent)) {\n          if (sibling && isListNode(sibling) && sibling.nodeName === listName && hasCompatibleStyle(dom, sibling, detail)) {\n            listBlock = sibling;\n            block = dom.rename(block, listItemName);\n            sibling.appendChild(block);\n          } else {\n            listBlock = dom.create(listName);\n            block.parentNode.insertBefore(listBlock, block);\n            listBlock.appendChild(block);\n            block = dom.rename(block, listItemName);\n          }\n          removeStyles(dom, block, [\n            'margin',\n            'margin-right',\n            'margin-bottom',\n            'margin-left',\n            'margin-top',\n            'padding',\n            'padding-right',\n            'padding-bottom',\n            'padding-left',\n            'padding-top'\n          ]);\n          updateListWithDetails(dom, listBlock, detail);\n          mergeWithAdjacentLists(editor.dom, listBlock);\n        }\n      });\n      editor.selection.setRng(resolveBookmark(bookmark));\n    };\n    var isValidLists = function (list1, list2) {\n      return list1 && list2 && isListNode(list1) && list1.nodeName === list2.nodeName;\n    };\n    var hasSameListStyle = function (dom, list1, list2) {\n      var targetStyle = dom.getStyle(list1, 'list-style-type', true);\n      var style = dom.getStyle(list2, 'list-style-type', true);\n      return targetStyle === style;\n    };\n    var hasSameClasses = function (elm1, elm2) {\n      return elm1.className === elm2.className;\n    };\n    var shouldMerge = function (dom, list1, list2) {\n      return isValidLists(list1, list2) && hasSameListStyle(dom, list1, list2) && hasSameClasses(list1, list2);\n    };\n    var mergeWithAdjacentLists = function (dom, listBlock) {\n      var sibling, node;\n      sibling = listBlock.nextSibling;\n      if (shouldMerge(dom, listBlock, sibling)) {\n        while (node = sibling.firstChild) {\n          listBlock.appendChild(node);\n        }\n        dom.remove(sibling);\n      }\n      sibling = listBlock.previousSibling;\n      if (shouldMerge(dom, listBlock, sibling)) {\n        while (node = sibling.lastChild) {\n          listBlock.insertBefore(node, listBlock.firstChild);\n        }\n        dom.remove(sibling);\n      }\n    };\n    var updateList$1 = function (editor, list, listName, detail) {\n      if (list.nodeName !== listName) {\n        var newList = editor.dom.rename(list, listName);\n        updateListWithDetails(editor.dom, newList, detail);\n        fireListEvent(editor, listToggleActionFromListName(listName), newList);\n      } else {\n        updateListWithDetails(editor.dom, list, detail);\n        fireListEvent(editor, listToggleActionFromListName(listName), list);\n      }\n    };\n    var toggleMultipleLists = function (editor, parentList, lists, listName, detail) {\n      var parentIsList = isListNode(parentList);\n      if (parentIsList && parentList.nodeName === listName && !hasListStyleDetail(detail)) {\n        flattenListSelection(editor);\n      } else {\n        applyList(editor, listName, detail);\n        var bookmark = createBookmark(editor.selection.getRng());\n        var allLists = parentIsList ? __spreadArray([parentList], lists, true) : lists;\n        global$2.each(allLists, function (elm) {\n          updateList$1(editor, elm, listName, detail);\n        });\n        editor.selection.setRng(resolveBookmark(bookmark));\n      }\n    };\n    var hasListStyleDetail = function (detail) {\n      return 'list-style-type' in detail;\n    };\n    var toggleSingleList = function (editor, parentList, listName, detail) {\n      if (parentList === editor.getBody()) {\n        return;\n      }\n      if (parentList) {\n        if (parentList.nodeName === listName && !hasListStyleDetail(detail) && !isCustomList(parentList)) {\n          flattenListSelection(editor);\n        } else {\n          var bookmark = createBookmark(editor.selection.getRng());\n          updateListWithDetails(editor.dom, parentList, detail);\n          var newList = editor.dom.rename(parentList, listName);\n          mergeWithAdjacentLists(editor.dom, newList);\n          editor.selection.setRng(resolveBookmark(bookmark));\n          applyList(editor, listName, detail);\n          fireListEvent(editor, listToggleActionFromListName(listName), newList);\n        }\n      } else {\n        applyList(editor, listName, detail);\n        fireListEvent(editor, listToggleActionFromListName(listName), parentList);\n      }\n    };\n    var toggleList = function (editor, listName, _detail) {\n      var parentList = getParentList(editor);\n      var selectedSubLists = getSelectedSubLists(editor);\n      var detail = isObject(_detail) ? _detail : {};\n      if (selectedSubLists.length > 0) {\n        toggleMultipleLists(editor, parentList, selectedSubLists, listName, detail);\n      } else {\n        toggleSingleList(editor, parentList, listName, detail);\n      }\n    };\n\n    var DOM = global$3.DOM;\n    var normalizeList = function (dom, list) {\n      var parentNode = list.parentNode;\n      if (parentNode.nodeName === 'LI' && parentNode.firstChild === list) {\n        var sibling = parentNode.previousSibling;\n        if (sibling && sibling.nodeName === 'LI') {\n          sibling.appendChild(list);\n          if (isEmpty(dom, parentNode)) {\n            DOM.remove(parentNode);\n          }\n        } else {\n          DOM.setStyle(parentNode, 'listStyleType', 'none');\n        }\n      }\n      if (isListNode(parentNode)) {\n        var sibling = parentNode.previousSibling;\n        if (sibling && sibling.nodeName === 'LI') {\n          sibling.appendChild(list);\n        }\n      }\n    };\n    var normalizeLists = function (dom, element) {\n      var lists = global$2.grep(dom.select('ol,ul', element));\n      global$2.each(lists, function (list) {\n        normalizeList(dom, list);\n      });\n    };\n\n    var findNextCaretContainer = function (editor, rng, isForward, root) {\n      var node = rng.startContainer;\n      var offset = rng.startOffset;\n      if (isTextNode(node) && (isForward ? offset < node.data.length : offset > 0)) {\n        return node;\n      }\n      var nonEmptyBlocks = editor.schema.getNonEmptyElements();\n      if (node.nodeType === 1) {\n        node = global$6.getNode(node, offset);\n      }\n      var walker = new global$5(node, root);\n      if (isForward) {\n        if (isBogusBr(editor.dom, node)) {\n          walker.next();\n        }\n      }\n      while (node = walker[isForward ? 'next' : 'prev2']()) {\n        if (node.nodeName === 'LI' && !node.hasChildNodes()) {\n          return node;\n        }\n        if (nonEmptyBlocks[node.nodeName]) {\n          return node;\n        }\n        if (isTextNode(node) && node.data.length > 0) {\n          return node;\n        }\n      }\n    };\n    var hasOnlyOneBlockChild = function (dom, elm) {\n      var childNodes = elm.childNodes;\n      return childNodes.length === 1 && !isListNode(childNodes[0]) && dom.isBlock(childNodes[0]);\n    };\n    var unwrapSingleBlockChild = function (dom, elm) {\n      if (hasOnlyOneBlockChild(dom, elm)) {\n        dom.remove(elm.firstChild, true);\n      }\n    };\n    var moveChildren = function (dom, fromElm, toElm) {\n      var node;\n      var targetElm = hasOnlyOneBlockChild(dom, toElm) ? toElm.firstChild : toElm;\n      unwrapSingleBlockChild(dom, fromElm);\n      if (!isEmpty(dom, fromElm, true)) {\n        while (node = fromElm.firstChild) {\n          targetElm.appendChild(node);\n        }\n      }\n    };\n    var mergeLiElements = function (dom, fromElm, toElm) {\n      var listNode;\n      var ul = fromElm.parentNode;\n      if (!isChildOfBody(dom, fromElm) || !isChildOfBody(dom, toElm)) {\n        return;\n      }\n      if (isListNode(toElm.lastChild)) {\n        listNode = toElm.lastChild;\n      }\n      if (ul === toElm.lastChild) {\n        if (isBr(ul.previousSibling)) {\n          dom.remove(ul.previousSibling);\n        }\n      }\n      var node = toElm.lastChild;\n      if (node && isBr(node) && fromElm.hasChildNodes()) {\n        dom.remove(node);\n      }\n      if (isEmpty(dom, toElm, true)) {\n        dom.$(toElm).empty();\n      }\n      moveChildren(dom, fromElm, toElm);\n      if (listNode) {\n        toElm.appendChild(listNode);\n      }\n      var contains$1 = contains(SugarElement.fromDom(toElm), SugarElement.fromDom(fromElm));\n      var nestedLists = contains$1 ? dom.getParents(fromElm, isListNode, toElm) : [];\n      dom.remove(fromElm);\n      each$1(nestedLists, function (list) {\n        if (isEmpty(dom, list) && list !== dom.getRoot()) {\n          dom.remove(list);\n        }\n      });\n    };\n    var mergeIntoEmptyLi = function (editor, fromLi, toLi) {\n      editor.dom.$(toLi).empty();\n      mergeLiElements(editor.dom, fromLi, toLi);\n      editor.selection.setCursorLocation(toLi, 0);\n    };\n    var mergeForward = function (editor, rng, fromLi, toLi) {\n      var dom = editor.dom;\n      if (dom.isEmpty(toLi)) {\n        mergeIntoEmptyLi(editor, fromLi, toLi);\n      } else {\n        var bookmark = createBookmark(rng);\n        mergeLiElements(dom, fromLi, toLi);\n        editor.selection.setRng(resolveBookmark(bookmark));\n      }\n    };\n    var mergeBackward = function (editor, rng, fromLi, toLi) {\n      var bookmark = createBookmark(rng);\n      mergeLiElements(editor.dom, fromLi, toLi);\n      var resolvedBookmark = resolveBookmark(bookmark);\n      editor.selection.setRng(resolvedBookmark);\n    };\n    var backspaceDeleteFromListToListCaret = function (editor, isForward) {\n      var dom = editor.dom, selection = editor.selection;\n      var selectionStartElm = selection.getStart();\n      var root = getClosestListRootElm(editor, selectionStartElm);\n      var li = dom.getParent(selection.getStart(), 'LI', root);\n      if (li) {\n        var ul = li.parentNode;\n        if (ul === editor.getBody() && isEmpty(dom, ul)) {\n          return true;\n        }\n        var rng_1 = normalizeRange(selection.getRng());\n        var otherLi_1 = dom.getParent(findNextCaretContainer(editor, rng_1, isForward, root), 'LI', root);\n        if (otherLi_1 && otherLi_1 !== li) {\n          editor.undoManager.transact(function () {\n            if (isForward) {\n              mergeForward(editor, rng_1, otherLi_1, li);\n            } else {\n              if (isFirstChild(li)) {\n                outdentListSelection(editor);\n              } else {\n                mergeBackward(editor, rng_1, li, otherLi_1);\n              }\n            }\n          });\n          return true;\n        } else if (!otherLi_1) {\n          if (!isForward && rng_1.startOffset === 0 && rng_1.endOffset === 0) {\n            editor.undoManager.transact(function () {\n              flattenListSelection(editor);\n            });\n            return true;\n          }\n        }\n      }\n      return false;\n    };\n    var removeBlock = function (dom, block, root) {\n      var parentBlock = dom.getParent(block.parentNode, dom.isBlock, root);\n      dom.remove(block);\n      if (parentBlock && dom.isEmpty(parentBlock)) {\n        dom.remove(parentBlock);\n      }\n    };\n    var backspaceDeleteIntoListCaret = function (editor, isForward) {\n      var dom = editor.dom;\n      var selectionStartElm = editor.selection.getStart();\n      var root = getClosestListRootElm(editor, selectionStartElm);\n      var block = dom.getParent(selectionStartElm, dom.isBlock, root);\n      if (block && dom.isEmpty(block)) {\n        var rng = normalizeRange(editor.selection.getRng());\n        var otherLi_2 = dom.getParent(findNextCaretContainer(editor, rng, isForward, root), 'LI', root);\n        if (otherLi_2) {\n          editor.undoManager.transact(function () {\n            removeBlock(dom, block, root);\n            mergeWithAdjacentLists(dom, otherLi_2.parentNode);\n            editor.selection.select(otherLi_2, true);\n            editor.selection.collapse(isForward);\n          });\n          return true;\n        }\n      }\n      return false;\n    };\n    var backspaceDeleteCaret = function (editor, isForward) {\n      return backspaceDeleteFromListToListCaret(editor, isForward) || backspaceDeleteIntoListCaret(editor, isForward);\n    };\n    var backspaceDeleteRange = function (editor) {\n      var selectionStartElm = editor.selection.getStart();\n      var root = getClosestListRootElm(editor, selectionStartElm);\n      var startListParent = editor.dom.getParent(selectionStartElm, 'LI,DT,DD', root);\n      if (startListParent || getSelectedListItems(editor).length > 0) {\n        editor.undoManager.transact(function () {\n          editor.execCommand('Delete');\n          normalizeLists(editor.dom, editor.getBody());\n        });\n        return true;\n      }\n      return false;\n    };\n    var backspaceDelete = function (editor, isForward) {\n      return editor.selection.isCollapsed() ? backspaceDeleteCaret(editor, isForward) : backspaceDeleteRange(editor);\n    };\n    var setup$1 = function (editor) {\n      editor.on('keydown', function (e) {\n        if (e.keyCode === global$4.BACKSPACE) {\n          if (backspaceDelete(editor, false)) {\n            e.preventDefault();\n          }\n        } else if (e.keyCode === global$4.DELETE) {\n          if (backspaceDelete(editor, true)) {\n            e.preventDefault();\n          }\n        }\n      });\n    };\n\n    var get = function (editor) {\n      return {\n        backspaceDelete: function (isForward) {\n          backspaceDelete(editor, isForward);\n        }\n      };\n    };\n\n    var updateList = function (editor, update) {\n      var parentList = getParentList(editor);\n      editor.undoManager.transact(function () {\n        if (isObject(update.styles)) {\n          editor.dom.setStyles(parentList, update.styles);\n        }\n        if (isObject(update.attrs)) {\n          each(update.attrs, function (v, k) {\n            return editor.dom.setAttrib(parentList, k, v);\n          });\n        }\n      });\n    };\n\n    var parseAlphabeticBase26 = function (str) {\n      var chars = reverse(trim(str).split(''));\n      var values = map(chars, function (char, i) {\n        var charValue = char.toUpperCase().charCodeAt(0) - 'A'.charCodeAt(0) + 1;\n        return Math.pow(26, i) * charValue;\n      });\n      return foldl(values, function (sum, v) {\n        return sum + v;\n      }, 0);\n    };\n    var composeAlphabeticBase26 = function (value) {\n      value--;\n      if (value < 0) {\n        return '';\n      } else {\n        var remainder = value % 26;\n        var quotient = Math.floor(value / 26);\n        var rest = composeAlphabeticBase26(quotient);\n        var char = String.fromCharCode('A'.charCodeAt(0) + remainder);\n        return rest + char;\n      }\n    };\n    var isUppercase = function (str) {\n      return /^[A-Z]+$/.test(str);\n    };\n    var isLowercase = function (str) {\n      return /^[a-z]+$/.test(str);\n    };\n    var isNumeric = function (str) {\n      return /^[0-9]+$/.test(str);\n    };\n    var deduceListType = function (start) {\n      if (isNumeric(start)) {\n        return 2;\n      } else if (isUppercase(start)) {\n        return 0;\n      } else if (isLowercase(start)) {\n        return 1;\n      } else if (isEmpty$1(start)) {\n        return 3;\n      } else {\n        return 4;\n      }\n    };\n    var parseStartValue = function (start) {\n      switch (deduceListType(start)) {\n      case 2:\n        return Optional.some({\n          listStyleType: Optional.none(),\n          start: start\n        });\n      case 0:\n        return Optional.some({\n          listStyleType: Optional.some('upper-alpha'),\n          start: parseAlphabeticBase26(start).toString()\n        });\n      case 1:\n        return Optional.some({\n          listStyleType: Optional.some('lower-alpha'),\n          start: parseAlphabeticBase26(start).toString()\n        });\n      case 3:\n        return Optional.some({\n          listStyleType: Optional.none(),\n          start: ''\n        });\n      case 4:\n        return Optional.none();\n      }\n    };\n    var parseDetail = function (detail) {\n      var start = parseInt(detail.start, 10);\n      if (is(detail.listStyleType, 'upper-alpha')) {\n        return composeAlphabeticBase26(start);\n      } else if (is(detail.listStyleType, 'lower-alpha')) {\n        return composeAlphabeticBase26(start).toLowerCase();\n      } else {\n        return detail.start;\n      }\n    };\n\n    var open = function (editor) {\n      var currentList = getParentList(editor);\n      if (!isOlNode(currentList)) {\n        return;\n      }\n      editor.windowManager.open({\n        title: 'List Properties',\n        body: {\n          type: 'panel',\n          items: [{\n              type: 'input',\n              name: 'start',\n              label: 'Start list at number',\n              inputMode: 'numeric'\n            }]\n        },\n        initialData: {\n          start: parseDetail({\n            start: editor.dom.getAttrib(currentList, 'start', '1'),\n            listStyleType: Optional.some(editor.dom.getStyle(currentList, 'list-style-type'))\n          })\n        },\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        onSubmit: function (api) {\n          var data = api.getData();\n          parseStartValue(data.start).each(function (detail) {\n            editor.execCommand('mceListUpdate', false, {\n              attrs: { start: detail.start === '1' ? '' : detail.start },\n              styles: { 'list-style-type': detail.listStyleType.getOr('') }\n            });\n          });\n          api.close();\n        }\n      });\n    };\n\n    var queryListCommandState = function (editor, listName) {\n      return function () {\n        var parentList = getParentList(editor);\n        return parentList && parentList.nodeName === listName;\n      };\n    };\n    var registerDialog = function (editor) {\n      editor.addCommand('mceListProps', function () {\n        open(editor);\n      });\n    };\n    var register$2 = function (editor) {\n      editor.on('BeforeExecCommand', function (e) {\n        var cmd = e.command.toLowerCase();\n        if (cmd === 'indent') {\n          indentListSelection(editor);\n        } else if (cmd === 'outdent') {\n          outdentListSelection(editor);\n        }\n      });\n      editor.addCommand('InsertUnorderedList', function (ui, detail) {\n        toggleList(editor, 'UL', detail);\n      });\n      editor.addCommand('InsertOrderedList', function (ui, detail) {\n        toggleList(editor, 'OL', detail);\n      });\n      editor.addCommand('InsertDefinitionList', function (ui, detail) {\n        toggleList(editor, 'DL', detail);\n      });\n      editor.addCommand('RemoveList', function () {\n        flattenListSelection(editor);\n      });\n      registerDialog(editor);\n      editor.addCommand('mceListUpdate', function (ui, detail) {\n        if (isObject(detail)) {\n          updateList(editor, detail);\n        }\n      });\n      editor.addQueryStateHandler('InsertUnorderedList', queryListCommandState(editor, 'UL'));\n      editor.addQueryStateHandler('InsertOrderedList', queryListCommandState(editor, 'OL'));\n      editor.addQueryStateHandler('InsertDefinitionList', queryListCommandState(editor, 'DL'));\n    };\n\n    var setupTabKey = function (editor) {\n      editor.on('keydown', function (e) {\n        if (e.keyCode !== global$4.TAB || global$4.metaKeyPressed(e)) {\n          return;\n        }\n        editor.undoManager.transact(function () {\n          if (e.shiftKey ? outdentListSelection(editor) : indentListSelection(editor)) {\n            e.preventDefault();\n          }\n        });\n      });\n    };\n    var setup = function (editor) {\n      if (shouldIndentOnTab(editor)) {\n        setupTabKey(editor);\n      }\n      setup$1(editor);\n    };\n\n    var register$1 = function (editor) {\n      var exec = function (command) {\n        return function () {\n          return editor.execCommand(command);\n        };\n      };\n      if (!editor.hasPlugin('advlist')) {\n        editor.ui.registry.addToggleButton('numlist', {\n          icon: 'ordered-list',\n          active: false,\n          tooltip: 'Numbered list',\n          onAction: exec('InsertOrderedList'),\n          onSetup: function (api) {\n            return listState(editor, 'OL', api.setActive);\n          }\n        });\n        editor.ui.registry.addToggleButton('bullist', {\n          icon: 'unordered-list',\n          active: false,\n          tooltip: 'Bullet list',\n          onAction: exec('InsertUnorderedList'),\n          onSetup: function (api) {\n            return listState(editor, 'UL', api.setActive);\n          }\n        });\n      }\n    };\n\n    var register = function (editor) {\n      var listProperties = {\n        text: 'List properties...',\n        icon: 'ordered-list',\n        onAction: function () {\n          return editor.execCommand('mceListProps');\n        },\n        onSetup: function (api) {\n          return listState(editor, 'OL', function (active) {\n            return api.setDisabled(!active);\n          });\n        }\n      };\n      editor.ui.registry.addMenuItem('listprops', listProperties);\n      editor.ui.registry.addContextMenu('lists', {\n        update: function (node) {\n          var parentList = getParentList(editor, node);\n          return isOlNode(parentList) ? ['listprops'] : [];\n        }\n      });\n    };\n\n    function Plugin () {\n      global$7.add('lists', function (editor) {\n        if (editor.hasPlugin('rtc', true) === false) {\n          setup(editor);\n          register$2(editor);\n        } else {\n          registerDialog(editor);\n        }\n        register$1(editor);\n        register(editor);\n        return get(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/lists/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/nonbreaking/index.js":
/*!***************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/nonbreaking/index.js ***!
  \***************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"nonbreaking\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/nonbreaking')\n//   ES2015:\n//     import 'tinymce/plugins/nonbreaking'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/nonbreaking/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/nonbreaking/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/nonbreaking/plugin.js":
/*!****************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/nonbreaking/plugin.js ***!
  \****************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var getKeyboardSpaces = function (editor) {\n      var spaces = editor.getParam('nonbreaking_force_tab', 0);\n      if (typeof spaces === 'boolean') {\n        return spaces === true ? 3 : 0;\n      } else {\n        return spaces;\n      }\n    };\n    var wrapNbsps = function (editor) {\n      return editor.getParam('nonbreaking_wrap', true, 'boolean');\n    };\n\n    var stringRepeat = function (string, repeats) {\n      var str = '';\n      for (var index = 0; index < repeats; index++) {\n        str += string;\n      }\n      return str;\n    };\n    var isVisualCharsEnabled = function (editor) {\n      return editor.plugins.visualchars ? editor.plugins.visualchars.isEnabled() : false;\n    };\n    var insertNbsp = function (editor, times) {\n      var classes = function () {\n        return isVisualCharsEnabled(editor) ? 'mce-nbsp-wrap mce-nbsp' : 'mce-nbsp-wrap';\n      };\n      var nbspSpan = function () {\n        return '<span class=\"' + classes() + '\" contenteditable=\"false\">' + stringRepeat('&nbsp;', times) + '</span>';\n      };\n      var shouldWrap = wrapNbsps(editor);\n      var html = shouldWrap || editor.plugins.visualchars ? nbspSpan() : stringRepeat('&nbsp;', times);\n      editor.undoManager.transact(function () {\n        return editor.insertContent(html);\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('mceNonBreaking', function () {\n        insertNbsp(editor, 1);\n      });\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var setup = function (editor) {\n      var spaces = getKeyboardSpaces(editor);\n      if (spaces > 0) {\n        editor.on('keydown', function (e) {\n          if (e.keyCode === global.TAB && !e.isDefaultPrevented()) {\n            if (e.shiftKey) {\n              return;\n            }\n            e.preventDefault();\n            e.stopImmediatePropagation();\n            insertNbsp(editor, spaces);\n          }\n        });\n      }\n    };\n\n    var register = function (editor) {\n      var onAction = function () {\n        return editor.execCommand('mceNonBreaking');\n      };\n      editor.ui.registry.addButton('nonbreaking', {\n        icon: 'non-breaking',\n        tooltip: 'Nonbreaking space',\n        onAction: onAction\n      });\n      editor.ui.registry.addMenuItem('nonbreaking', {\n        icon: 'non-breaking',\n        text: 'Nonbreaking space',\n        onAction: onAction\n      });\n    };\n\n    function Plugin () {\n      global$1.add('nonbreaking', function (editor) {\n        register$1(editor);\n        register(editor);\n        setup(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/nonbreaking/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/pagebreak/index.js":
/*!*************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/pagebreak/index.js ***!
  \*************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"pagebreak\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/pagebreak')\n//   ES2015:\n//     import 'tinymce/plugins/pagebreak'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/pagebreak/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/pagebreak/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/pagebreak/plugin.js":
/*!**************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/pagebreak/plugin.js ***!
  \**************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var global = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var getSeparatorHtml = function (editor) {\n      return editor.getParam('pagebreak_separator', '<!-- pagebreak -->');\n    };\n    var shouldSplitBlock = function (editor) {\n      return editor.getParam('pagebreak_split_block', false);\n    };\n\n    var pageBreakClass = 'mce-pagebreak';\n    var getPlaceholderHtml = function (shouldSplitBlock) {\n      var html = '<img src=\"' + global.transparentSrc + '\" class=\"' + pageBreakClass + '\" data-mce-resize=\"false\" data-mce-placeholder />';\n      return shouldSplitBlock ? '<p>' + html + '</p>' : html;\n    };\n    var setup$1 = function (editor) {\n      var separatorHtml = getSeparatorHtml(editor);\n      var shouldSplitBlock$1 = function () {\n        return shouldSplitBlock(editor);\n      };\n      var pageBreakSeparatorRegExp = new RegExp(separatorHtml.replace(/[\\?\\.\\*\\[\\]\\(\\)\\{\\}\\+\\^\\$\\:]/g, function (a) {\n        return '\\\\' + a;\n      }), 'gi');\n      editor.on('BeforeSetContent', function (e) {\n        e.content = e.content.replace(pageBreakSeparatorRegExp, getPlaceholderHtml(shouldSplitBlock$1()));\n      });\n      editor.on('PreInit', function () {\n        editor.serializer.addNodeFilter('img', function (nodes) {\n          var i = nodes.length, node, className;\n          while (i--) {\n            node = nodes[i];\n            className = node.attr('class');\n            if (className && className.indexOf(pageBreakClass) !== -1) {\n              var parentNode = node.parent;\n              if (editor.schema.getBlockElements()[parentNode.name] && shouldSplitBlock$1()) {\n                parentNode.type = 3;\n                parentNode.value = separatorHtml;\n                parentNode.raw = true;\n                node.remove();\n                continue;\n              }\n              node.type = 3;\n              node.value = separatorHtml;\n              node.raw = true;\n            }\n          }\n        });\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.addCommand('mcePageBreak', function () {\n        editor.insertContent(getPlaceholderHtml(shouldSplitBlock(editor)));\n      });\n    };\n\n    var setup = function (editor) {\n      editor.on('ResolveName', function (e) {\n        if (e.target.nodeName === 'IMG' && editor.dom.hasClass(e.target, pageBreakClass)) {\n          e.name = 'pagebreak';\n        }\n      });\n    };\n\n    var register = function (editor) {\n      var onAction = function () {\n        return editor.execCommand('mcePageBreak');\n      };\n      editor.ui.registry.addButton('pagebreak', {\n        icon: 'page-break',\n        tooltip: 'Page break',\n        onAction: onAction\n      });\n      editor.ui.registry.addMenuItem('pagebreak', {\n        text: 'Page break',\n        icon: 'page-break',\n        onAction: onAction\n      });\n    };\n\n    function Plugin () {\n      global$1.add('pagebreak', function (editor) {\n        register$1(editor);\n        register(editor);\n        setup$1(editor);\n        setup(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/pagebreak/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/paste/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/paste/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"paste\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/paste')\n//   ES2015:\n//     import 'tinymce/plugins/paste'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/paste/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/paste/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/paste/plugin.js":
/*!**********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/paste/plugin.js ***!
  \**********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var global$b = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var hasProPlugin = function (editor) {\n      if (editor.hasPlugin('powerpaste', true)) {\n        if (typeof window.console !== 'undefined' && window.console.log) {\n          window.console.log('PowerPaste is incompatible with Paste plugin! Remove \\'paste\\' from the \\'plugins\\' option.');\n        }\n        return true;\n      } else {\n        return false;\n      }\n    };\n\n    var get = function (clipboard) {\n      return { clipboard: clipboard };\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var isArray = isType('array');\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from$1 = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from$1\n    };\n\n    var nativeSlice = Array.prototype.slice;\n    var nativePush = Array.prototype.push;\n    var exists = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var filter$1 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var foldl = function (xs, f, acc) {\n      each(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n    var from = isFunction(Array.from) ? Array.from : function (x) {\n      return nativeSlice.call(x);\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var value = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var checkRange = function (str, substr, start) {\n      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;\n    };\n    var startsWith = function (str, prefix) {\n      return checkRange(str, prefix, 0);\n    };\n    var endsWith = function (str, suffix) {\n      return checkRange(str, suffix, str.length - suffix.length);\n    };\n    var repeat = function (s, count) {\n      return count <= 0 ? '' : new Array(count + 1).join(s);\n    };\n\n    var global$a = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var global$9 = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var global$8 = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var global$7 = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var firePastePreProcess = function (editor, html, internal, isWordHtml) {\n      return editor.fire('PastePreProcess', {\n        content: html,\n        internal: internal,\n        wordContent: isWordHtml\n      });\n    };\n    var firePastePostProcess = function (editor, node, internal, isWordHtml) {\n      return editor.fire('PastePostProcess', {\n        node: node,\n        internal: internal,\n        wordContent: isWordHtml\n      });\n    };\n    var firePastePlainTextToggle = function (editor, state) {\n      return editor.fire('PastePlainTextToggle', { state: state });\n    };\n    var firePaste = function (editor, ieFake) {\n      return editor.fire('paste', { ieFake: ieFake });\n    };\n\n    var global$6 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var shouldBlockDrop = function (editor) {\n      return editor.getParam('paste_block_drop', false);\n    };\n    var shouldPasteDataImages = function (editor) {\n      return editor.getParam('paste_data_images', false);\n    };\n    var shouldFilterDrop = function (editor) {\n      return editor.getParam('paste_filter_drop', true);\n    };\n    var getPreProcess = function (editor) {\n      return editor.getParam('paste_preprocess');\n    };\n    var getPostProcess = function (editor) {\n      return editor.getParam('paste_postprocess');\n    };\n    var getWebkitStyles = function (editor) {\n      return editor.getParam('paste_webkit_styles');\n    };\n    var shouldRemoveWebKitStyles = function (editor) {\n      return editor.getParam('paste_remove_styles_if_webkit', true);\n    };\n    var shouldMergeFormats = function (editor) {\n      return editor.getParam('paste_merge_formats', true);\n    };\n    var isSmartPasteEnabled = function (editor) {\n      return editor.getParam('smart_paste', true);\n    };\n    var isPasteAsTextEnabled = function (editor) {\n      return editor.getParam('paste_as_text', false);\n    };\n    var getRetainStyleProps = function (editor) {\n      return editor.getParam('paste_retain_style_properties');\n    };\n    var getWordValidElements = function (editor) {\n      var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody';\n      return editor.getParam('paste_word_valid_elements', defaultValidElements);\n    };\n    var shouldConvertWordFakeLists = function (editor) {\n      return editor.getParam('paste_convert_word_fake_lists', true);\n    };\n    var shouldUseDefaultFilters = function (editor) {\n      return editor.getParam('paste_enable_default_filters', true);\n    };\n    var getValidate = function (editor) {\n      return editor.getParam('validate');\n    };\n    var getAllowHtmlDataUrls = function (editor) {\n      return editor.getParam('allow_html_data_urls', false, 'boolean');\n    };\n    var getPasteDataImages = function (editor) {\n      return editor.getParam('paste_data_images', false, 'boolean');\n    };\n    var getImagesDataImgFilter = function (editor) {\n      return editor.getParam('images_dataimg_filter');\n    };\n    var getImagesReuseFilename = function (editor) {\n      return editor.getParam('images_reuse_filename');\n    };\n    var getForcedRootBlock = function (editor) {\n      return editor.getParam('forced_root_block');\n    };\n    var getForcedRootBlockAttrs = function (editor) {\n      return editor.getParam('forced_root_block_attrs');\n    };\n    var getTabSpaces = function (editor) {\n      return editor.getParam('paste_tab_spaces', 4, 'number');\n    };\n    var getAllowedImageFileTypes = function (editor) {\n      var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp';\n      return global$6.explode(editor.getParam('images_file_types', defaultImageFileTypes, 'string'));\n    };\n\n    var internalMimeType = 'x-tinymce/html';\n    var internalMark = '<!-- ' + internalMimeType + ' -->';\n    var mark = function (html) {\n      return internalMark + html;\n    };\n    var unmark = function (html) {\n      return html.replace(internalMark, '');\n    };\n    var isMarked = function (html) {\n      return html.indexOf(internalMark) !== -1;\n    };\n    var internalHtmlMime = constant(internalMimeType);\n\n    var hasOwnProperty = Object.hasOwnProperty;\n    var has = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.html.Entities');\n\n    var isPlainText = function (text) {\n      return !/<(?:\\/?(?!(?:div|p|br|span)>)\\w+|(?:(?!(?:span style=\"white-space:\\s?pre;?\">)|br\\s?\\/>))\\w+\\s[^>]+)>/i.test(text);\n    };\n    var toBRs = function (text) {\n      return text.replace(/\\r?\\n/g, '<br>');\n    };\n    var openContainer = function (rootTag, rootAttrs) {\n      var attrs = [];\n      var tag = '<' + rootTag;\n      if (typeof rootAttrs === 'object') {\n        for (var key in rootAttrs) {\n          if (has(rootAttrs, key)) {\n            attrs.push(key + '=\"' + global$5.encodeAllRaw(rootAttrs[key]) + '\"');\n          }\n        }\n        if (attrs.length) {\n          tag += ' ' + attrs.join(' ');\n        }\n      }\n      return tag + '>';\n    };\n    var toBlockElements = function (text, rootTag, rootAttrs) {\n      var blocks = text.split(/\\n\\n/);\n      var tagOpen = openContainer(rootTag, rootAttrs);\n      var tagClose = '</' + rootTag + '>';\n      var paragraphs = global$6.map(blocks, function (p) {\n        return p.split(/\\n/).join('<br />');\n      });\n      var stitch = function (p) {\n        return tagOpen + p + tagClose;\n      };\n      return paragraphs.length === 1 ? paragraphs[0] : global$6.map(paragraphs, stitch).join('');\n    };\n    var convert = function (text, rootTag, rootAttrs) {\n      return rootTag ? toBlockElements(text, rootTag === true ? 'p' : rootTag, rootAttrs) : toBRs(text);\n    };\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.html.DomParser');\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.html.Serializer');\n\n    var nbsp = '\\xA0';\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.html.Schema');\n\n    var isRegExp = function (val) {\n      return val.constructor === RegExp;\n    };\n    var filter = function (content, items) {\n      global$6.each(items, function (v) {\n        if (isRegExp(v)) {\n          content = content.replace(v, '');\n        } else {\n          content = content.replace(v[0], v[1]);\n        }\n      });\n      return content;\n    };\n    var innerText = function (html) {\n      var schema = global$1();\n      var domParser = global$4({}, schema);\n      var text = '';\n      var shortEndedElements = schema.getShortEndedElements();\n      var ignoreElements = global$6.makeMap('script noscript style textarea video audio iframe object', ' ');\n      var blockElements = schema.getBlockElements();\n      var walk = function (node) {\n        var name = node.name, currentNode = node;\n        if (name === 'br') {\n          text += '\\n';\n          return;\n        }\n        if (name === 'wbr') {\n          return;\n        }\n        if (shortEndedElements[name]) {\n          text += ' ';\n        }\n        if (ignoreElements[name]) {\n          text += ' ';\n          return;\n        }\n        if (node.type === 3) {\n          text += node.value;\n        }\n        if (!node.shortEnded) {\n          if (node = node.firstChild) {\n            do {\n              walk(node);\n            } while (node = node.next);\n          }\n        }\n        if (blockElements[name] && currentNode.next) {\n          text += '\\n';\n          if (name === 'p') {\n            text += '\\n';\n          }\n        }\n      };\n      html = filter(html, [/<!\\[[^\\]]+\\]>/g]);\n      walk(domParser.parse(html));\n      return text;\n    };\n    var trimHtml = function (html) {\n      var trimSpaces = function (all, s1, s2) {\n        if (!s1 && !s2) {\n          return ' ';\n        }\n        return nbsp;\n      };\n      html = filter(html, [\n        /^[\\s\\S]*<body[^>]*>\\s*|\\s*<\\/body[^>]*>[\\s\\S]*$/ig,\n        /<!--StartFragment-->|<!--EndFragment-->/g,\n        [\n          /( ?)<span class=\"Apple-converted-space\">\\u00a0<\\/span>( ?)/g,\n          trimSpaces\n        ],\n        /<br class=\"Apple-interchange-newline\">/g,\n        /<br>$/i\n      ]);\n      return html;\n    };\n    var createIdGenerator = function (prefix) {\n      var count = 0;\n      return function () {\n        return prefix + count++;\n      };\n    };\n    var getImageMimeType = function (ext) {\n      var lowerExt = ext.toLowerCase();\n      var mimeOverrides = {\n        jpg: 'jpeg',\n        jpe: 'jpeg',\n        jfi: 'jpeg',\n        jif: 'jpeg',\n        jfif: 'jpeg',\n        pjpeg: 'jpeg',\n        pjp: 'jpeg',\n        svg: 'svg+xml'\n      };\n      return global$6.hasOwn(mimeOverrides, lowerExt) ? 'image/' + mimeOverrides[lowerExt] : 'image/' + lowerExt;\n    };\n\n    var isWordContent = function (content) {\n      return /<font face=\"Times New Roman\"|class=\"?Mso|style=\"[^\"]*\\bmso-|style='[^']*\\bmso-|w:WordDocument/i.test(content) || /class=\"OutlineElement/.test(content) || /id=\"?docs\\-internal\\-guid\\-/.test(content);\n    };\n    var isNumericList = function (text) {\n      var found = false;\n      var patterns = [\n        /^[IVXLMCD]+\\.[ \\u00a0]/,\n        /^[ivxlmcd]+\\.[ \\u00a0]/,\n        /^[a-z]{1,2}[\\.\\)][ \\u00a0]/,\n        /^[A-Z]{1,2}[\\.\\)][ \\u00a0]/,\n        /^[0-9]+\\.[ \\u00a0]/,\n        /^[\\u3007\\u4e00\\u4e8c\\u4e09\\u56db\\u4e94\\u516d\\u4e03\\u516b\\u4e5d]+\\.[ \\u00a0]/,\n        /^[\\u58f1\\u5f10\\u53c2\\u56db\\u4f0d\\u516d\\u4e03\\u516b\\u4e5d\\u62fe]+\\.[ \\u00a0]/\n      ];\n      text = text.replace(/^[\\u00a0 ]+/, '');\n      global$6.each(patterns, function (pattern) {\n        if (pattern.test(text)) {\n          found = true;\n          return false;\n        }\n      });\n      return found;\n    };\n    var isBulletList = function (text) {\n      return /^[\\s\\u00a0]*[\\u2022\\u00b7\\u00a7\\u25CF]\\s*/.test(text);\n    };\n    var convertFakeListsToProperLists = function (node) {\n      var currentListNode, prevListNode, lastLevel = 1;\n      var getText = function (node) {\n        var txt = '';\n        if (node.type === 3) {\n          return node.value;\n        }\n        if (node = node.firstChild) {\n          do {\n            txt += getText(node);\n          } while (node = node.next);\n        }\n        return txt;\n      };\n      var trimListStart = function (node, regExp) {\n        if (node.type === 3) {\n          if (regExp.test(node.value)) {\n            node.value = node.value.replace(regExp, '');\n            return false;\n          }\n        }\n        if (node = node.firstChild) {\n          do {\n            if (!trimListStart(node, regExp)) {\n              return false;\n            }\n          } while (node = node.next);\n        }\n        return true;\n      };\n      var removeIgnoredNodes = function (node) {\n        if (node._listIgnore) {\n          node.remove();\n          return;\n        }\n        if (node = node.firstChild) {\n          do {\n            removeIgnoredNodes(node);\n          } while (node = node.next);\n        }\n      };\n      var convertParagraphToLi = function (paragraphNode, listName, start) {\n        var level = paragraphNode._listLevel || lastLevel;\n        if (level !== lastLevel) {\n          if (level < lastLevel) {\n            if (currentListNode) {\n              currentListNode = currentListNode.parent.parent;\n            }\n          } else {\n            prevListNode = currentListNode;\n            currentListNode = null;\n          }\n        }\n        if (!currentListNode || currentListNode.name !== listName) {\n          prevListNode = prevListNode || currentListNode;\n          currentListNode = new global$2(listName, 1);\n          if (start > 1) {\n            currentListNode.attr('start', '' + start);\n          }\n          paragraphNode.wrap(currentListNode);\n        } else {\n          currentListNode.append(paragraphNode);\n        }\n        paragraphNode.name = 'li';\n        if (level > lastLevel && prevListNode) {\n          prevListNode.lastChild.append(currentListNode);\n        }\n        lastLevel = level;\n        removeIgnoredNodes(paragraphNode);\n        trimListStart(paragraphNode, /^\\u00a0+/);\n        trimListStart(paragraphNode, /^\\s*([\\u2022\\u00b7\\u00a7\\u25CF]|\\w+\\.)/);\n        trimListStart(paragraphNode, /^\\u00a0+/);\n      };\n      var elements = [];\n      var child = node.firstChild;\n      while (typeof child !== 'undefined' && child !== null) {\n        elements.push(child);\n        child = child.walk();\n        if (child !== null) {\n          while (typeof child !== 'undefined' && child.parent !== node) {\n            child = child.walk();\n          }\n        }\n      }\n      for (var i = 0; i < elements.length; i++) {\n        node = elements[i];\n        if (node.name === 'p' && node.firstChild) {\n          var nodeText = getText(node);\n          if (isBulletList(nodeText)) {\n            convertParagraphToLi(node, 'ul');\n            continue;\n          }\n          if (isNumericList(nodeText)) {\n            var matches = /([0-9]+)\\./.exec(nodeText);\n            var start = 1;\n            if (matches) {\n              start = parseInt(matches[1], 10);\n            }\n            convertParagraphToLi(node, 'ol', start);\n            continue;\n          }\n          if (node._listLevel) {\n            convertParagraphToLi(node, 'ul', 1);\n            continue;\n          }\n          currentListNode = null;\n        } else {\n          prevListNode = currentListNode;\n          currentListNode = null;\n        }\n      }\n    };\n    var filterStyles = function (editor, validStyles, node, styleValue) {\n      var outputStyles = {};\n      var styles = editor.dom.parseStyle(styleValue);\n      global$6.each(styles, function (value, name) {\n        switch (name) {\n        case 'mso-list':\n          var matches = /\\w+ \\w+([0-9]+)/i.exec(styleValue);\n          if (matches) {\n            node._listLevel = parseInt(matches[1], 10);\n          }\n          if (/Ignore/i.test(value) && node.firstChild) {\n            node._listIgnore = true;\n            node.firstChild._listIgnore = true;\n          }\n          break;\n        case 'horiz-align':\n          name = 'text-align';\n          break;\n        case 'vert-align':\n          name = 'vertical-align';\n          break;\n        case 'font-color':\n        case 'mso-foreground':\n          name = 'color';\n          break;\n        case 'mso-background':\n        case 'mso-highlight':\n          name = 'background';\n          break;\n        case 'font-weight':\n        case 'font-style':\n          if (value !== 'normal') {\n            outputStyles[name] = value;\n          }\n          return;\n        case 'mso-element':\n          if (/^(comment|comment-list)$/i.test(value)) {\n            node.remove();\n            return;\n          }\n          break;\n        }\n        if (name.indexOf('mso-comment') === 0) {\n          node.remove();\n          return;\n        }\n        if (name.indexOf('mso-') === 0) {\n          return;\n        }\n        if (getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) {\n          outputStyles[name] = value;\n        }\n      });\n      if (/(bold)/i.test(outputStyles['font-weight'])) {\n        delete outputStyles['font-weight'];\n        node.wrap(new global$2('b', 1));\n      }\n      if (/(italic)/i.test(outputStyles['font-style'])) {\n        delete outputStyles['font-style'];\n        node.wrap(new global$2('i', 1));\n      }\n      var outputStyle = editor.dom.serializeStyle(outputStyles, node.name);\n      if (outputStyle) {\n        return outputStyle;\n      }\n      return null;\n    };\n    var filterWordContent = function (editor, content) {\n      var validStyles;\n      var retainStyleProperties = getRetainStyleProps(editor);\n      if (retainStyleProperties) {\n        validStyles = global$6.makeMap(retainStyleProperties.split(/[, ]/));\n      }\n      content = filter(content, [\n        /<br class=\"?Apple-interchange-newline\"?>/gi,\n        /<b[^>]+id=\"?docs-internal-[^>]*>/gi,\n        /<!--[\\s\\S]+?-->/gi,\n        /<(!|script[^>]*>.*?<\\/script(?=[>\\s])|\\/?(\\?xml(:\\w+)?|img|meta|link|style|\\w:\\w+)(?=[\\s\\/>]))[^>]*>/gi,\n        [\n          /<(\\/?)s>/gi,\n          '<$1strike>'\n        ],\n        [\n          /&nbsp;/gi,\n          nbsp\n        ],\n        [\n          /<span\\s+style\\s*=\\s*\"\\s*mso-spacerun\\s*:\\s*yes\\s*;?\\s*\"\\s*>([\\s\\u00a0]*)<\\/span>/gi,\n          function (str, spaces) {\n            return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join(nbsp) : '';\n          }\n        ]\n      ]);\n      var validElements = getWordValidElements(editor);\n      var schema = global$1({\n        valid_elements: validElements,\n        valid_children: '-li[p]'\n      });\n      global$6.each(schema.elements, function (rule) {\n        if (!rule.attributes.class) {\n          rule.attributes.class = {};\n          rule.attributesOrder.push('class');\n        }\n        if (!rule.attributes.style) {\n          rule.attributes.style = {};\n          rule.attributesOrder.push('style');\n        }\n      });\n      var domParser = global$4({}, schema);\n      domParser.addAttributeFilter('style', function (nodes) {\n        var i = nodes.length, node;\n        while (i--) {\n          node = nodes[i];\n          node.attr('style', filterStyles(editor, validStyles, node, node.attr('style')));\n          if (node.name === 'span' && node.parent && !node.attributes.length) {\n            node.unwrap();\n          }\n        }\n      });\n      domParser.addAttributeFilter('class', function (nodes) {\n        var i = nodes.length, node, className;\n        while (i--) {\n          node = nodes[i];\n          className = node.attr('class');\n          if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) {\n            node.remove();\n          }\n          node.attr('class', null);\n        }\n      });\n      domParser.addNodeFilter('del', function (nodes) {\n        var i = nodes.length;\n        while (i--) {\n          nodes[i].remove();\n        }\n      });\n      domParser.addNodeFilter('a', function (nodes) {\n        var i = nodes.length, node, href, name;\n        while (i--) {\n          node = nodes[i];\n          href = node.attr('href');\n          name = node.attr('name');\n          if (href && href.indexOf('#_msocom_') !== -1) {\n            node.remove();\n            continue;\n          }\n          if (href && href.indexOf('file://') === 0) {\n            href = href.split('#')[1];\n            if (href) {\n              href = '#' + href;\n            }\n          }\n          if (!href && !name) {\n            node.unwrap();\n          } else {\n            if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) {\n              node.unwrap();\n              continue;\n            }\n            node.attr({\n              href: href,\n              name: name\n            });\n          }\n        }\n      });\n      var rootNode = domParser.parse(content);\n      if (shouldConvertWordFakeLists(editor)) {\n        convertFakeListsToProperLists(rootNode);\n      }\n      content = global$3({ validate: getValidate(editor) }, schema).serialize(rootNode);\n      return content;\n    };\n    var preProcess$1 = function (editor, content) {\n      return shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content;\n    };\n\n    var preProcess = function (editor, html) {\n      var parser = global$4({}, editor.schema);\n      parser.addNodeFilter('meta', function (nodes) {\n        global$6.each(nodes, function (node) {\n          node.remove();\n        });\n      });\n      var fragment = parser.parse(html, {\n        forced_root_block: false,\n        isRootContent: true\n      });\n      return global$3({ validate: getValidate(editor) }, editor.schema).serialize(fragment);\n    };\n    var processResult = function (content, cancelled) {\n      return {\n        content: content,\n        cancelled: cancelled\n      };\n    };\n    var postProcessFilter = function (editor, html, internal, isWordHtml) {\n      var tempBody = editor.dom.create('div', { style: 'display:none' }, html);\n      var postProcessArgs = firePastePostProcess(editor, tempBody, internal, isWordHtml);\n      return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented());\n    };\n    var filterContent = function (editor, content, internal, isWordHtml) {\n      var preProcessArgs = firePastePreProcess(editor, content, internal, isWordHtml);\n      var filteredContent = preProcess(editor, preProcessArgs.content);\n      if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) {\n        return postProcessFilter(editor, filteredContent, internal, isWordHtml);\n      } else {\n        return processResult(filteredContent, preProcessArgs.isDefaultPrevented());\n      }\n    };\n    var process = function (editor, html, internal) {\n      var isWordHtml = isWordContent(html);\n      var content = isWordHtml ? preProcess$1(editor, html) : html;\n      return filterContent(editor, content, internal, isWordHtml);\n    };\n\n    var pasteHtml$1 = function (editor, html) {\n      editor.insertContent(html, {\n        merge: shouldMergeFormats(editor),\n        paste: true\n      });\n      return true;\n    };\n    var isAbsoluteUrl = function (url) {\n      return /^https?:\\/\\/[\\w\\-\\/+=.,!;:&%@^~(){}?#]+$/i.test(url);\n    };\n    var isImageUrl = function (editor, url) {\n      return isAbsoluteUrl(url) && exists(getAllowedImageFileTypes(editor), function (type) {\n        return endsWith(url.toLowerCase(), '.' + type.toLowerCase());\n      });\n    };\n    var createImage = function (editor, url, pasteHtmlFn) {\n      editor.undoManager.extra(function () {\n        pasteHtmlFn(editor, url);\n      }, function () {\n        editor.insertContent('<img src=\"' + url + '\">');\n      });\n      return true;\n    };\n    var createLink = function (editor, url, pasteHtmlFn) {\n      editor.undoManager.extra(function () {\n        pasteHtmlFn(editor, url);\n      }, function () {\n        editor.execCommand('mceInsertLink', false, url);\n      });\n      return true;\n    };\n    var linkSelection = function (editor, html, pasteHtmlFn) {\n      return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false;\n    };\n    var insertImage = function (editor, html, pasteHtmlFn) {\n      return isImageUrl(editor, html) ? createImage(editor, html, pasteHtmlFn) : false;\n    };\n    var smartInsertContent = function (editor, html) {\n      global$6.each([\n        linkSelection,\n        insertImage,\n        pasteHtml$1\n      ], function (action) {\n        return action(editor, html, pasteHtml$1) !== true;\n      });\n    };\n    var insertContent = function (editor, html, pasteAsText) {\n      if (pasteAsText || isSmartPasteEnabled(editor) === false) {\n        pasteHtml$1(editor, html);\n      } else {\n        smartInsertContent(editor, html);\n      }\n    };\n\n    var isCollapsibleWhitespace = function (c) {\n      return ' \\f\\t\\x0B'.indexOf(c) !== -1;\n    };\n    var isNewLineChar = function (c) {\n      return c === '\\n' || c === '\\r';\n    };\n    var isNewline = function (text, idx) {\n      return idx < text.length && idx >= 0 ? isNewLineChar(text[idx]) : false;\n    };\n    var normalizeWhitespace = function (editor, text) {\n      var tabSpace = repeat(' ', getTabSpaces(editor));\n      var normalizedText = text.replace(/\\t/g, tabSpace);\n      var result = foldl(normalizedText, function (acc, c) {\n        if (isCollapsibleWhitespace(c) || c === nbsp) {\n          if (acc.pcIsSpace || acc.str === '' || acc.str.length === normalizedText.length - 1 || isNewline(normalizedText, acc.str.length + 1)) {\n            return {\n              pcIsSpace: false,\n              str: acc.str + nbsp\n            };\n          } else {\n            return {\n              pcIsSpace: true,\n              str: acc.str + ' '\n            };\n          }\n        } else {\n          return {\n            pcIsSpace: isNewLineChar(c),\n            str: acc.str + c\n          };\n        }\n      }, {\n        pcIsSpace: false,\n        str: ''\n      });\n      return result.str;\n    };\n\n    var doPaste = function (editor, content, internal, pasteAsText) {\n      var args = process(editor, content, internal);\n      if (args.cancelled === false) {\n        insertContent(editor, args.content, pasteAsText);\n      }\n    };\n    var pasteHtml = function (editor, html, internalFlag) {\n      var internal = internalFlag ? internalFlag : isMarked(html);\n      doPaste(editor, unmark(html), internal, false);\n    };\n    var pasteText = function (editor, text) {\n      var encodedText = editor.dom.encode(text).replace(/\\r\\n/g, '\\n');\n      var normalizedText = normalizeWhitespace(editor, encodedText);\n      var html = convert(normalizedText, getForcedRootBlock(editor), getForcedRootBlockAttrs(editor));\n      doPaste(editor, html, false, true);\n    };\n    var getDataTransferItems = function (dataTransfer) {\n      var items = {};\n      var mceInternalUrlPrefix = 'data:text/mce-internal,';\n      if (dataTransfer) {\n        if (dataTransfer.getData) {\n          var legacyText = dataTransfer.getData('Text');\n          if (legacyText && legacyText.length > 0) {\n            if (legacyText.indexOf(mceInternalUrlPrefix) === -1) {\n              items['text/plain'] = legacyText;\n            }\n          }\n        }\n        if (dataTransfer.types) {\n          for (var i = 0; i < dataTransfer.types.length; i++) {\n            var contentType = dataTransfer.types[i];\n            try {\n              items[contentType] = dataTransfer.getData(contentType);\n            } catch (ex) {\n              items[contentType] = '';\n            }\n          }\n        }\n      }\n      return items;\n    };\n    var getClipboardContent = function (editor, clipboardEvent) {\n      return getDataTransferItems(clipboardEvent.clipboardData || editor.getDoc().dataTransfer);\n    };\n    var hasContentType = function (clipboardContent, mimeType) {\n      return mimeType in clipboardContent && clipboardContent[mimeType].length > 0;\n    };\n    var hasHtmlOrText = function (content) {\n      return hasContentType(content, 'text/html') || hasContentType(content, 'text/plain');\n    };\n    var parseDataUri = function (uri) {\n      var matches = /data:([^;]+);base64,([a-z0-9\\+\\/=]+)/i.exec(uri);\n      if (matches) {\n        return {\n          type: matches[1],\n          data: decodeURIComponent(matches[2])\n        };\n      } else {\n        return {\n          type: null,\n          data: null\n        };\n      }\n    };\n    var isValidDataUriImage = function (editor, imgElm) {\n      var filter = getImagesDataImgFilter(editor);\n      return filter ? filter(imgElm) : true;\n    };\n    var extractFilename = function (editor, str) {\n      var m = str.match(/([\\s\\S]+?)(?:\\.[a-z0-9.]+)$/i);\n      return isNonNullable(m) ? editor.dom.encode(m[1]) : null;\n    };\n    var uniqueId = createIdGenerator('mceclip');\n    var pasteImage = function (editor, imageItem) {\n      var _a = parseDataUri(imageItem.uri), base64 = _a.data, type = _a.type;\n      var id = uniqueId();\n      var file = imageItem.blob;\n      var img = new Image();\n      img.src = imageItem.uri;\n      if (isValidDataUriImage(editor, img)) {\n        var blobCache = editor.editorUpload.blobCache;\n        var blobInfo = void 0;\n        var existingBlobInfo = blobCache.getByData(base64, type);\n        if (!existingBlobInfo) {\n          var useFileName = getImagesReuseFilename(editor) && isNonNullable(file.name);\n          var name_1 = useFileName ? extractFilename(editor, file.name) : id;\n          var filename = useFileName ? file.name : undefined;\n          blobInfo = blobCache.create(id, file, base64, name_1, filename);\n          blobCache.add(blobInfo);\n        } else {\n          blobInfo = existingBlobInfo;\n        }\n        pasteHtml(editor, '<img src=\"' + blobInfo.blobUri() + '\">', false);\n      } else {\n        pasteHtml(editor, '<img src=\"' + imageItem.uri + '\">', false);\n      }\n    };\n    var isClipboardEvent = function (event) {\n      return event.type === 'paste';\n    };\n    var isDataTransferItem = function (item) {\n      return isNonNullable(item.getAsFile);\n    };\n    var readFilesAsDataUris = function (items) {\n      return global$8.all(map(items, function (item) {\n        return new global$8(function (resolve) {\n          var blob = isDataTransferItem(item) ? item.getAsFile() : item;\n          var reader = new window.FileReader();\n          reader.onload = function () {\n            resolve({\n              blob: blob,\n              uri: reader.result\n            });\n          };\n          reader.readAsDataURL(blob);\n        });\n      }));\n    };\n    var isImage = function (editor) {\n      var allowedExtensions = getAllowedImageFileTypes(editor);\n      return function (file) {\n        return startsWith(file.type, 'image/') && exists(allowedExtensions, function (extension) {\n          return getImageMimeType(extension) === file.type;\n        });\n      };\n    };\n    var getImagesFromDataTransfer = function (editor, dataTransfer) {\n      var items = dataTransfer.items ? bind(from(dataTransfer.items), function (item) {\n        return item.kind === 'file' ? [item.getAsFile()] : [];\n      }) : [];\n      var files = dataTransfer.files ? from(dataTransfer.files) : [];\n      return filter$1(items.length > 0 ? items : files, isImage(editor));\n    };\n    var pasteImageData = function (editor, e, rng) {\n      var dataTransfer = isClipboardEvent(e) ? e.clipboardData : e.dataTransfer;\n      if (getPasteDataImages(editor) && dataTransfer) {\n        var images = getImagesFromDataTransfer(editor, dataTransfer);\n        if (images.length > 0) {\n          e.preventDefault();\n          readFilesAsDataUris(images).then(function (fileResults) {\n            if (rng) {\n              editor.selection.setRng(rng);\n            }\n            each(fileResults, function (result) {\n              pasteImage(editor, result);\n            });\n          });\n          return true;\n        }\n      }\n      return false;\n    };\n    var isBrokenAndroidClipboardEvent = function (e) {\n      var clipboardData = e.clipboardData;\n      return navigator.userAgent.indexOf('Android') !== -1 && clipboardData && clipboardData.items && clipboardData.items.length === 0;\n    };\n    var isKeyboardPasteEvent = function (e) {\n      return global$7.metaKeyPressed(e) && e.keyCode === 86 || e.shiftKey && e.keyCode === 45;\n    };\n    var registerEventHandlers = function (editor, pasteBin, pasteFormat) {\n      var keyboardPasteEvent = value();\n      var keyboardPastePressed = value();\n      var keyboardPastePlainTextState;\n      editor.on('keyup', keyboardPastePressed.clear);\n      editor.on('keydown', function (e) {\n        var removePasteBinOnKeyUp = function (e) {\n          if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {\n            pasteBin.remove();\n          }\n        };\n        if (isKeyboardPasteEvent(e) && !e.isDefaultPrevented()) {\n          keyboardPastePlainTextState = e.shiftKey && e.keyCode === 86;\n          if (keyboardPastePlainTextState && global$a.webkit && navigator.userAgent.indexOf('Version/') !== -1) {\n            return;\n          }\n          e.stopImmediatePropagation();\n          keyboardPasteEvent.set(e);\n          keyboardPastePressed.set(true);\n          if (global$a.ie && keyboardPastePlainTextState) {\n            e.preventDefault();\n            firePaste(editor, true);\n            return;\n          }\n          pasteBin.remove();\n          pasteBin.create();\n          editor.once('keyup', removePasteBinOnKeyUp);\n          editor.once('paste', function () {\n            editor.off('keyup', removePasteBinOnKeyUp);\n          });\n        }\n      });\n      var insertClipboardContent = function (editor, clipboardContent, isKeyBoardPaste, plainTextMode, internal) {\n        var content;\n        if (hasContentType(clipboardContent, 'text/html')) {\n          content = clipboardContent['text/html'];\n        } else {\n          content = pasteBin.getHtml();\n          internal = internal ? internal : isMarked(content);\n          if (pasteBin.isDefaultContent(content)) {\n            plainTextMode = true;\n          }\n        }\n        content = trimHtml(content);\n        pasteBin.remove();\n        var isPlainTextHtml = internal === false && isPlainText(content);\n        var isAbsoluteUrl$1 = isAbsoluteUrl(content);\n        if (!content.length || isPlainTextHtml && !isAbsoluteUrl$1) {\n          plainTextMode = true;\n        }\n        if (plainTextMode || isAbsoluteUrl$1) {\n          if (hasContentType(clipboardContent, 'text/plain') && isPlainTextHtml) {\n            content = clipboardContent['text/plain'];\n          } else {\n            content = innerText(content);\n          }\n        }\n        if (pasteBin.isDefaultContent(content)) {\n          if (!isKeyBoardPaste) {\n            editor.windowManager.alert('Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.');\n          }\n          return;\n        }\n        if (plainTextMode) {\n          pasteText(editor, content);\n        } else {\n          pasteHtml(editor, content, internal);\n        }\n      };\n      var getLastRng = function () {\n        return pasteBin.getLastRng() || editor.selection.getRng();\n      };\n      editor.on('paste', function (e) {\n        var isKeyboardPaste = keyboardPasteEvent.isSet() || keyboardPastePressed.isSet();\n        if (isKeyboardPaste) {\n          keyboardPasteEvent.clear();\n        }\n        var clipboardContent = getClipboardContent(editor, e);\n        var plainTextMode = pasteFormat.get() === 'text' || keyboardPastePlainTextState;\n        var internal = hasContentType(clipboardContent, internalHtmlMime());\n        keyboardPastePlainTextState = false;\n        if (e.isDefaultPrevented() || isBrokenAndroidClipboardEvent(e)) {\n          pasteBin.remove();\n          return;\n        }\n        if (!hasHtmlOrText(clipboardContent) && pasteImageData(editor, e, getLastRng())) {\n          pasteBin.remove();\n          return;\n        }\n        if (!isKeyboardPaste) {\n          e.preventDefault();\n        }\n        if (global$a.ie && (!isKeyboardPaste || e.ieFake) && !hasContentType(clipboardContent, 'text/html')) {\n          pasteBin.create();\n          editor.dom.bind(pasteBin.getEl(), 'paste', function (e) {\n            e.stopPropagation();\n          });\n          editor.getDoc().execCommand('Paste', false, null);\n          clipboardContent['text/html'] = pasteBin.getHtml();\n        }\n        if (hasContentType(clipboardContent, 'text/html')) {\n          e.preventDefault();\n          if (!internal) {\n            internal = isMarked(clipboardContent['text/html']);\n          }\n          insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal);\n        } else {\n          global$9.setEditorTimeout(editor, function () {\n            insertClipboardContent(editor, clipboardContent, isKeyboardPaste, plainTextMode, internal);\n          }, 0);\n        }\n      });\n    };\n    var registerEventsAndFilters = function (editor, pasteBin, pasteFormat) {\n      registerEventHandlers(editor, pasteBin, pasteFormat);\n      var src;\n      editor.parser.addNodeFilter('img', function (nodes, name, args) {\n        var isPasteInsert = function (args) {\n          return args.data && args.data.paste === true;\n        };\n        var remove = function (node) {\n          if (!node.attr('data-mce-object') && src !== global$a.transparentSrc) {\n            node.remove();\n          }\n        };\n        var isWebKitFakeUrl = function (src) {\n          return src.indexOf('webkit-fake-url') === 0;\n        };\n        var isDataUri = function (src) {\n          return src.indexOf('data:') === 0;\n        };\n        if (!getPasteDataImages(editor) && isPasteInsert(args)) {\n          var i = nodes.length;\n          while (i--) {\n            src = nodes[i].attr('src');\n            if (!src) {\n              continue;\n            }\n            if (isWebKitFakeUrl(src)) {\n              remove(nodes[i]);\n            } else if (!getAllowHtmlDataUrls(editor) && isDataUri(src)) {\n              remove(nodes[i]);\n            }\n          }\n        }\n      });\n    };\n\n    var getPasteBinParent = function (editor) {\n      return global$a.ie && editor.inline ? document.body : editor.getBody();\n    };\n    var isExternalPasteBin = function (editor) {\n      return getPasteBinParent(editor) !== editor.getBody();\n    };\n    var delegatePasteEvents = function (editor, pasteBinElm, pasteBinDefaultContent) {\n      if (isExternalPasteBin(editor)) {\n        editor.dom.bind(pasteBinElm, 'paste keyup', function (_e) {\n          if (!isDefault(editor, pasteBinDefaultContent)) {\n            editor.fire('paste');\n          }\n        });\n      }\n    };\n    var create = function (editor, lastRngCell, pasteBinDefaultContent) {\n      var dom = editor.dom, body = editor.getBody();\n      lastRngCell.set(editor.selection.getRng());\n      var pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {\n        'id': 'mcepastebin',\n        'class': 'mce-pastebin',\n        'contentEditable': true,\n        'data-mce-bogus': 'all',\n        'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'\n      }, pasteBinDefaultContent);\n      if (global$a.ie || global$a.gecko) {\n        dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 65535 : -65535);\n      }\n      dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {\n        e.stopPropagation();\n      });\n      delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);\n      pasteBinElm.focus();\n      editor.selection.select(pasteBinElm, true);\n    };\n    var remove = function (editor, lastRngCell) {\n      if (getEl(editor)) {\n        var pasteBinClone = void 0;\n        var lastRng = lastRngCell.get();\n        while (pasteBinClone = editor.dom.get('mcepastebin')) {\n          editor.dom.remove(pasteBinClone);\n          editor.dom.unbind(pasteBinClone);\n        }\n        if (lastRng) {\n          editor.selection.setRng(lastRng);\n        }\n      }\n      lastRngCell.set(null);\n    };\n    var getEl = function (editor) {\n      return editor.dom.get('mcepastebin');\n    };\n    var getHtml = function (editor) {\n      var copyAndRemove = function (toElm, fromElm) {\n        toElm.appendChild(fromElm);\n        editor.dom.remove(fromElm, true);\n      };\n      var pasteBinClones = global$6.grep(getPasteBinParent(editor).childNodes, function (elm) {\n        return elm.id === 'mcepastebin';\n      });\n      var pasteBinElm = pasteBinClones.shift();\n      global$6.each(pasteBinClones, function (pasteBinClone) {\n        copyAndRemove(pasteBinElm, pasteBinClone);\n      });\n      var dirtyWrappers = editor.dom.select('div[id=mcepastebin]', pasteBinElm);\n      for (var i = dirtyWrappers.length - 1; i >= 0; i--) {\n        var cleanWrapper = editor.dom.create('div');\n        pasteBinElm.insertBefore(cleanWrapper, dirtyWrappers[i]);\n        copyAndRemove(cleanWrapper, dirtyWrappers[i]);\n      }\n      return pasteBinElm ? pasteBinElm.innerHTML : '';\n    };\n    var isDefaultContent = function (pasteBinDefaultContent, content) {\n      return content === pasteBinDefaultContent;\n    };\n    var isPasteBin = function (elm) {\n      return elm && elm.id === 'mcepastebin';\n    };\n    var isDefault = function (editor, pasteBinDefaultContent) {\n      var pasteBinElm = getEl(editor);\n      return isPasteBin(pasteBinElm) && isDefaultContent(pasteBinDefaultContent, pasteBinElm.innerHTML);\n    };\n    var PasteBin = function (editor) {\n      var lastRng = Cell(null);\n      var pasteBinDefaultContent = '%MCEPASTEBIN%';\n      return {\n        create: function () {\n          return create(editor, lastRng, pasteBinDefaultContent);\n        },\n        remove: function () {\n          return remove(editor, lastRng);\n        },\n        getEl: function () {\n          return getEl(editor);\n        },\n        getHtml: function () {\n          return getHtml(editor);\n        },\n        getLastRng: lastRng.get,\n        isDefault: function () {\n          return isDefault(editor, pasteBinDefaultContent);\n        },\n        isDefaultContent: function (content) {\n          return isDefaultContent(pasteBinDefaultContent, content);\n        }\n      };\n    };\n\n    var Clipboard = function (editor, pasteFormat) {\n      var pasteBin = PasteBin(editor);\n      editor.on('PreInit', function () {\n        return registerEventsAndFilters(editor, pasteBin, pasteFormat);\n      });\n      return {\n        pasteFormat: pasteFormat,\n        pasteHtml: function (html, internalFlag) {\n          return pasteHtml(editor, html, internalFlag);\n        },\n        pasteText: function (text) {\n          return pasteText(editor, text);\n        },\n        pasteImageData: function (e, rng) {\n          return pasteImageData(editor, e, rng);\n        },\n        getDataTransferItems: getDataTransferItems,\n        hasHtmlOrText: hasHtmlOrText,\n        hasContentType: hasContentType\n      };\n    };\n\n    var togglePlainTextPaste = function (editor, clipboard) {\n      if (clipboard.pasteFormat.get() === 'text') {\n        clipboard.pasteFormat.set('html');\n        firePastePlainTextToggle(editor, false);\n      } else {\n        clipboard.pasteFormat.set('text');\n        firePastePlainTextToggle(editor, true);\n      }\n      editor.focus();\n    };\n\n    var register$2 = function (editor, clipboard) {\n      editor.addCommand('mceTogglePlainTextPaste', function () {\n        togglePlainTextPaste(editor, clipboard);\n      });\n      editor.addCommand('mceInsertClipboardContent', function (ui, value) {\n        if (value.content) {\n          clipboard.pasteHtml(value.content, value.internal);\n        }\n        if (value.text) {\n          clipboard.pasteText(value.text);\n        }\n      });\n    };\n\n    var hasWorkingClipboardApi = function (clipboardData) {\n      return global$a.iOS === false && typeof (clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.setData) === 'function';\n    };\n    var setHtml5Clipboard = function (clipboardData, html, text) {\n      if (hasWorkingClipboardApi(clipboardData)) {\n        try {\n          clipboardData.clearData();\n          clipboardData.setData('text/html', html);\n          clipboardData.setData('text/plain', text);\n          clipboardData.setData(internalHtmlMime(), html);\n          return true;\n        } catch (e) {\n          return false;\n        }\n      } else {\n        return false;\n      }\n    };\n    var setClipboardData = function (evt, data, fallback, done) {\n      if (setHtml5Clipboard(evt.clipboardData, data.html, data.text)) {\n        evt.preventDefault();\n        done();\n      } else {\n        fallback(data.html, done);\n      }\n    };\n    var fallback = function (editor) {\n      return function (html, done) {\n        var markedHtml = mark(html);\n        var outer = editor.dom.create('div', {\n          'contenteditable': 'false',\n          'data-mce-bogus': 'all'\n        });\n        var inner = editor.dom.create('div', { contenteditable: 'true' }, markedHtml);\n        editor.dom.setStyles(outer, {\n          position: 'fixed',\n          top: '0',\n          left: '-3000px',\n          width: '1000px',\n          overflow: 'hidden'\n        });\n        outer.appendChild(inner);\n        editor.dom.add(editor.getBody(), outer);\n        var range = editor.selection.getRng();\n        inner.focus();\n        var offscreenRange = editor.dom.createRng();\n        offscreenRange.selectNodeContents(inner);\n        editor.selection.setRng(offscreenRange);\n        global$9.setTimeout(function () {\n          editor.selection.setRng(range);\n          outer.parentNode.removeChild(outer);\n          done();\n        }, 0);\n      };\n    };\n    var getData = function (editor) {\n      return {\n        html: editor.selection.getContent({ contextual: true }),\n        text: editor.selection.getContent({ format: 'text' })\n      };\n    };\n    var isTableSelection = function (editor) {\n      return !!editor.dom.getParent(editor.selection.getStart(), 'td[data-mce-selected],th[data-mce-selected]', editor.getBody());\n    };\n    var hasSelectedContent = function (editor) {\n      return !editor.selection.isCollapsed() || isTableSelection(editor);\n    };\n    var cut = function (editor) {\n      return function (evt) {\n        if (hasSelectedContent(editor)) {\n          setClipboardData(evt, getData(editor), fallback(editor), function () {\n            if (global$a.browser.isChrome() || global$a.browser.isFirefox()) {\n              var rng_1 = editor.selection.getRng();\n              global$9.setEditorTimeout(editor, function () {\n                editor.selection.setRng(rng_1);\n                editor.execCommand('Delete');\n              }, 0);\n            } else {\n              editor.execCommand('Delete');\n            }\n          });\n        }\n      };\n    };\n    var copy = function (editor) {\n      return function (evt) {\n        if (hasSelectedContent(editor)) {\n          setClipboardData(evt, getData(editor), fallback(editor), noop);\n        }\n      };\n    };\n    var register$1 = function (editor) {\n      editor.on('cut', cut(editor));\n      editor.on('copy', copy(editor));\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.dom.RangeUtils');\n\n    var getCaretRangeFromEvent = function (editor, e) {\n      return global.getCaretRangeFromPoint(e.clientX, e.clientY, editor.getDoc());\n    };\n    var isPlainTextFileUrl = function (content) {\n      var plainTextContent = content['text/plain'];\n      return plainTextContent ? plainTextContent.indexOf('file://') === 0 : false;\n    };\n    var setFocusedRange = function (editor, rng) {\n      editor.focus();\n      editor.selection.setRng(rng);\n    };\n    var setup$2 = function (editor, clipboard, draggingInternallyState) {\n      if (shouldBlockDrop(editor)) {\n        editor.on('dragend dragover draggesture dragdrop drop drag', function (e) {\n          e.preventDefault();\n          e.stopPropagation();\n        });\n      }\n      if (!shouldPasteDataImages(editor)) {\n        editor.on('drop', function (e) {\n          var dataTransfer = e.dataTransfer;\n          if (dataTransfer && dataTransfer.files && dataTransfer.files.length > 0) {\n            e.preventDefault();\n          }\n        });\n      }\n      editor.on('drop', function (e) {\n        var rng = getCaretRangeFromEvent(editor, e);\n        if (e.isDefaultPrevented() || draggingInternallyState.get()) {\n          return;\n        }\n        var dropContent = clipboard.getDataTransferItems(e.dataTransfer);\n        var internal = clipboard.hasContentType(dropContent, internalHtmlMime());\n        if ((!clipboard.hasHtmlOrText(dropContent) || isPlainTextFileUrl(dropContent)) && clipboard.pasteImageData(e, rng)) {\n          return;\n        }\n        if (rng && shouldFilterDrop(editor)) {\n          var content_1 = dropContent['mce-internal'] || dropContent['text/html'] || dropContent['text/plain'];\n          if (content_1) {\n            e.preventDefault();\n            global$9.setEditorTimeout(editor, function () {\n              editor.undoManager.transact(function () {\n                if (dropContent['mce-internal']) {\n                  editor.execCommand('Delete');\n                }\n                setFocusedRange(editor, rng);\n                content_1 = trimHtml(content_1);\n                if (!dropContent['text/html']) {\n                  clipboard.pasteText(content_1);\n                } else {\n                  clipboard.pasteHtml(content_1, internal);\n                }\n              });\n            });\n          }\n        }\n      });\n      editor.on('dragstart', function (_e) {\n        draggingInternallyState.set(true);\n      });\n      editor.on('dragover dragend', function (e) {\n        if (shouldPasteDataImages(editor) && draggingInternallyState.get() === false) {\n          e.preventDefault();\n          setFocusedRange(editor, getCaretRangeFromEvent(editor, e));\n        }\n        if (e.type === 'dragend') {\n          draggingInternallyState.set(false);\n        }\n      });\n    };\n\n    var setup$1 = function (editor) {\n      var plugin = editor.plugins.paste;\n      var preProcess = getPreProcess(editor);\n      if (preProcess) {\n        editor.on('PastePreProcess', function (e) {\n          preProcess.call(plugin, plugin, e);\n        });\n      }\n      var postProcess = getPostProcess(editor);\n      if (postProcess) {\n        editor.on('PastePostProcess', function (e) {\n          postProcess.call(plugin, plugin, e);\n        });\n      }\n    };\n\n    var addPreProcessFilter = function (editor, filterFunc) {\n      editor.on('PastePreProcess', function (e) {\n        e.content = filterFunc(editor, e.content, e.internal, e.wordContent);\n      });\n    };\n    var addPostProcessFilter = function (editor, filterFunc) {\n      editor.on('PastePostProcess', function (e) {\n        filterFunc(editor, e.node);\n      });\n    };\n    var removeExplorerBrElementsAfterBlocks = function (editor, html) {\n      if (!isWordContent(html)) {\n        return html;\n      }\n      var blockElements = [];\n      global$6.each(editor.schema.getBlockElements(), function (block, blockName) {\n        blockElements.push(blockName);\n      });\n      var explorerBlocksRegExp = new RegExp('(?:<br>&nbsp;[\\\\s\\\\r\\\\n]+|<br>)*(<\\\\/?(' + blockElements.join('|') + ')[^>]*>)(?:<br>&nbsp;[\\\\s\\\\r\\\\n]+|<br>)*', 'g');\n      html = filter(html, [[\n          explorerBlocksRegExp,\n          '$1'\n        ]]);\n      html = filter(html, [\n        [\n          /<br><br>/g,\n          '<BR><BR>'\n        ],\n        [\n          /<br>/g,\n          ' '\n        ],\n        [\n          /<BR><BR>/g,\n          '<br>'\n        ]\n      ]);\n      return html;\n    };\n    var removeWebKitStyles = function (editor, content, internal, isWordHtml) {\n      if (isWordHtml || internal) {\n        return content;\n      }\n      var webKitStylesSetting = getWebkitStyles(editor);\n      var webKitStyles;\n      if (shouldRemoveWebKitStyles(editor) === false || webKitStylesSetting === 'all') {\n        return content;\n      }\n      if (webKitStylesSetting) {\n        webKitStyles = webKitStylesSetting.split(/[, ]/);\n      }\n      if (webKitStyles) {\n        var dom_1 = editor.dom, node_1 = editor.selection.getNode();\n        content = content.replace(/(<[^>]+) style=\"([^\"]*)\"([^>]*>)/gi, function (all, before, value, after) {\n          var inputStyles = dom_1.parseStyle(dom_1.decode(value));\n          var outputStyles = {};\n          if (webKitStyles === 'none') {\n            return before + after;\n          }\n          for (var i = 0; i < webKitStyles.length; i++) {\n            var inputValue = inputStyles[webKitStyles[i]], currentValue = dom_1.getStyle(node_1, webKitStyles[i], true);\n            if (/color/.test(webKitStyles[i])) {\n              inputValue = dom_1.toHex(inputValue);\n              currentValue = dom_1.toHex(currentValue);\n            }\n            if (currentValue !== inputValue) {\n              outputStyles[webKitStyles[i]] = inputValue;\n            }\n          }\n          var outputStyle = dom_1.serializeStyle(outputStyles, 'span');\n          if (outputStyle) {\n            return before + ' style=\"' + outputStyle + '\"' + after;\n          }\n          return before + after;\n        });\n      } else {\n        content = content.replace(/(<[^>]+) style=\"([^\"]*)\"([^>]*>)/gi, '$1$3');\n      }\n      content = content.replace(/(<[^>]+) data-mce-style=\"([^\"]+)\"([^>]*>)/gi, function (all, before, value, after) {\n        return before + ' style=\"' + value + '\"' + after;\n      });\n      return content;\n    };\n    var removeUnderlineAndFontInAnchor = function (editor, root) {\n      editor.$('a', root).find('font,u').each(function (i, node) {\n        editor.dom.remove(node, true);\n      });\n    };\n    var setup = function (editor) {\n      if (global$a.webkit) {\n        addPreProcessFilter(editor, removeWebKitStyles);\n      }\n      if (global$a.ie) {\n        addPreProcessFilter(editor, removeExplorerBrElementsAfterBlocks);\n        addPostProcessFilter(editor, removeUnderlineAndFontInAnchor);\n      }\n    };\n\n    var makeSetupHandler = function (editor, clipboard) {\n      return function (api) {\n        api.setActive(clipboard.pasteFormat.get() === 'text');\n        var pastePlainTextToggleHandler = function (e) {\n          return api.setActive(e.state);\n        };\n        editor.on('PastePlainTextToggle', pastePlainTextToggleHandler);\n        return function () {\n          return editor.off('PastePlainTextToggle', pastePlainTextToggleHandler);\n        };\n      };\n    };\n    var register = function (editor, clipboard) {\n      var onAction = function () {\n        return editor.execCommand('mceTogglePlainTextPaste');\n      };\n      editor.ui.registry.addToggleButton('pastetext', {\n        active: false,\n        icon: 'paste-text',\n        tooltip: 'Paste as text',\n        onAction: onAction,\n        onSetup: makeSetupHandler(editor, clipboard)\n      });\n      editor.ui.registry.addToggleMenuItem('pastetext', {\n        text: 'Paste as text',\n        icon: 'paste-text',\n        onAction: onAction,\n        onSetup: makeSetupHandler(editor, clipboard)\n      });\n    };\n\n    function Plugin () {\n      global$b.add('paste', function (editor) {\n        if (hasProPlugin(editor) === false) {\n          var draggingInternallyState = Cell(false);\n          var pasteFormat = Cell(isPasteAsTextEnabled(editor) ? 'text' : 'html');\n          var clipboard = Clipboard(editor, pasteFormat);\n          setup(editor);\n          register(editor, clipboard);\n          register$2(editor, clipboard);\n          setup$1(editor);\n          register$1(editor);\n          setup$2(editor, clipboard, draggingInternallyState);\n          return get(clipboard);\n        }\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/paste/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/searchreplace/index.js":
/*!*****************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/searchreplace/index.js ***!
  \*****************************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"searchreplace\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/searchreplace')\n//   ES2015:\n//     import 'tinymce/plugins/searchreplace'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/searchreplace/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/searchreplace/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/searchreplace/plugin.js":
/*!******************************************************************!*\
  !*** ../../node_modules/tinymce/plugins/searchreplace/plugin.js ***!
  \******************************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var isString = isType$1('string');\n    var isArray = isType$1('array');\n    var isBoolean = isSimpleType('boolean');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var punctuationStr = '[!-#%-*,-\\\\/:;?@\\\\[-\\\\]_{}\\xA1\\xAB\\xB7\\xBB\\xBF;\\xB7\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1361-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u3008\\u3009\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30\\u2E31\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uff3f\\uFF5B\\uFF5D\\uFF5F-\\uFF65]';\n\n    var punctuation$1 = constant(punctuationStr);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var punctuation = punctuation$1;\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var nativeSlice = Array.prototype.slice;\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var eachr = function (xs, f) {\n      for (var i = xs.length - 1; i >= 0; i--) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var groupBy = function (xs, f) {\n      if (xs.length === 0) {\n        return [];\n      } else {\n        var wasType = f(xs[0]);\n        var r = [];\n        var group = [];\n        for (var i = 0, len = xs.length; i < len; i++) {\n          var x = xs[i];\n          var type = f(x);\n          if (type !== wasType) {\n            r.push(group);\n            group = [];\n          }\n          wasType = type;\n          group.push(x);\n        }\n        if (group.length !== 0) {\n          r.push(group);\n        }\n        return r;\n      }\n    };\n    var foldl = function (xs, f, acc) {\n      each(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n    var sort = function (xs, comparator) {\n      var copy = nativeSlice.call(xs, 0);\n      copy.sort(comparator);\n      return copy;\n    };\n\n    var hasOwnProperty = Object.hasOwnProperty;\n    var has = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var DOCUMENT = 9;\n    var DOCUMENT_FRAGMENT = 11;\n    var ELEMENT = 1;\n    var TEXT = 3;\n\n    var type = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type(element) === t;\n      };\n    };\n    var isText$1 = isType(TEXT);\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n\n    var compareDocumentPosition = function (a, b, match) {\n      return (a.compareDocumentPosition(b) & match) !== 0;\n    };\n    var documentPositionPreceding = function (a, b) {\n      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_PRECEDING);\n    };\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    var bypassSelector = function (dom) {\n      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;\n    };\n    var all = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);\n    };\n\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var children = function (element) {\n      return map(element.dom.childNodes, SugarElement.fromDom);\n    };\n    var spot = function (element, offset) {\n      return {\n        element: element,\n        offset: offset\n      };\n    };\n    var leaf = function (element, offset) {\n      var cs = children(element);\n      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);\n    };\n\n    var before = function (marker, element) {\n      var parent$1 = parent(marker);\n      parent$1.each(function (v) {\n        v.dom.insertBefore(element.dom, marker.dom);\n      });\n    };\n    var append = function (parent, element) {\n      parent.dom.appendChild(element.dom);\n    };\n    var wrap = function (element, wrapper) {\n      before(element, wrapper);\n      append(wrapper, element);\n    };\n\n    var NodeValue = function (is, name) {\n      var get = function (element) {\n        if (!is(element)) {\n          throw new Error('Can only get ' + name + ' value of a ' + name + ' node');\n        }\n        return getOption(element).getOr('');\n      };\n      var getOption = function (element) {\n        return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();\n      };\n      var set = function (element, value) {\n        if (!is(element)) {\n          throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');\n        }\n        element.dom.nodeValue = value;\n      };\n      return {\n        get: get,\n        getOption: getOption,\n        set: set\n      };\n    };\n\n    var api = NodeValue(isText$1, 'text');\n    var get$1 = function (element) {\n      return api.get(element);\n    };\n\n    var descendants = function (scope, selector) {\n      return all(selector, scope);\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.dom.TreeWalker');\n\n    var isSimpleBoundary = function (dom, node) {\n      return dom.isBlock(node) || has(dom.schema.getShortEndedElements(), node.nodeName);\n    };\n    var isContentEditableFalse = function (dom, node) {\n      return dom.getContentEditable(node) === 'false';\n    };\n    var isContentEditableTrueInCef = function (dom, node) {\n      return dom.getContentEditable(node) === 'true' && dom.getContentEditableParent(node.parentNode) === 'false';\n    };\n    var isHidden = function (dom, node) {\n      return !dom.isBlock(node) && has(dom.schema.getWhiteSpaceElements(), node.nodeName);\n    };\n    var isBoundary = function (dom, node) {\n      return isSimpleBoundary(dom, node) || isContentEditableFalse(dom, node) || isHidden(dom, node) || isContentEditableTrueInCef(dom, node);\n    };\n    var isText = function (node) {\n      return node.nodeType === 3;\n    };\n    var nuSection = function () {\n      return {\n        sOffset: 0,\n        fOffset: 0,\n        elements: []\n      };\n    };\n    var toLeaf = function (node, offset) {\n      return leaf(SugarElement.fromDom(node), offset);\n    };\n    var walk = function (dom, walkerFn, startNode, callbacks, endNode, skipStart) {\n      if (skipStart === void 0) {\n        skipStart = true;\n      }\n      var next = skipStart ? walkerFn(false) : startNode;\n      while (next) {\n        var isCefNode = isContentEditableFalse(dom, next);\n        if (isCefNode || isHidden(dom, next)) {\n          var stopWalking = isCefNode ? callbacks.cef(next) : callbacks.boundary(next);\n          if (stopWalking) {\n            break;\n          } else {\n            next = walkerFn(true);\n            continue;\n          }\n        } else if (isSimpleBoundary(dom, next)) {\n          if (callbacks.boundary(next)) {\n            break;\n          }\n        } else if (isText(next)) {\n          callbacks.text(next);\n        }\n        if (next === endNode) {\n          break;\n        } else {\n          next = walkerFn(false);\n        }\n      }\n    };\n    var collectTextToBoundary = function (dom, section, node, rootNode, forwards) {\n      if (isBoundary(dom, node)) {\n        return;\n      }\n      var rootBlock = dom.getParent(rootNode, dom.isBlock);\n      var walker = new global(node, rootBlock);\n      var walkerFn = forwards ? walker.next.bind(walker) : walker.prev.bind(walker);\n      walk(dom, walkerFn, node, {\n        boundary: always,\n        cef: always,\n        text: function (next) {\n          if (forwards) {\n            section.fOffset += next.length;\n          } else {\n            section.sOffset += next.length;\n          }\n          section.elements.push(SugarElement.fromDom(next));\n        }\n      });\n    };\n    var collect = function (dom, rootNode, startNode, endNode, callbacks, skipStart) {\n      if (skipStart === void 0) {\n        skipStart = true;\n      }\n      var walker = new global(startNode, rootNode);\n      var sections = [];\n      var current = nuSection();\n      collectTextToBoundary(dom, current, startNode, rootNode, false);\n      var finishSection = function () {\n        if (current.elements.length > 0) {\n          sections.push(current);\n          current = nuSection();\n        }\n        return false;\n      };\n      walk(dom, walker.next.bind(walker), startNode, {\n        boundary: finishSection,\n        cef: function (node) {\n          finishSection();\n          if (callbacks) {\n            sections.push.apply(sections, callbacks.cef(node));\n          }\n          return false;\n        },\n        text: function (next) {\n          current.elements.push(SugarElement.fromDom(next));\n          if (callbacks) {\n            callbacks.text(next, current);\n          }\n        }\n      }, endNode, skipStart);\n      if (endNode) {\n        collectTextToBoundary(dom, current, endNode, rootNode, true);\n      }\n      finishSection();\n      return sections;\n    };\n    var collectRangeSections = function (dom, rng) {\n      var start = toLeaf(rng.startContainer, rng.startOffset);\n      var startNode = start.element.dom;\n      var end = toLeaf(rng.endContainer, rng.endOffset);\n      var endNode = end.element.dom;\n      return collect(dom, rng.commonAncestorContainer, startNode, endNode, {\n        text: function (node, section) {\n          if (node === endNode) {\n            section.fOffset += node.length - end.offset;\n          } else if (node === startNode) {\n            section.sOffset += start.offset;\n          }\n        },\n        cef: function (node) {\n          var sections = bind(descendants(SugarElement.fromDom(node), '*[contenteditable=true]'), function (e) {\n            var ceTrueNode = e.dom;\n            return collect(dom, ceTrueNode, ceTrueNode);\n          });\n          return sort(sections, function (a, b) {\n            return documentPositionPreceding(a.elements[0].dom, b.elements[0].dom) ? 1 : -1;\n          });\n        }\n      }, false);\n    };\n    var fromRng = function (dom, rng) {\n      return rng.collapsed ? [] : collectRangeSections(dom, rng);\n    };\n    var fromNode = function (dom, node) {\n      var rng = dom.createRng();\n      rng.selectNode(node);\n      return fromRng(dom, rng);\n    };\n    var fromNodes = function (dom, nodes) {\n      return bind(nodes, function (node) {\n        return fromNode(dom, node);\n      });\n    };\n\n    var find$2 = function (text, pattern, start, finish) {\n      if (start === void 0) {\n        start = 0;\n      }\n      if (finish === void 0) {\n        finish = text.length;\n      }\n      var regex = pattern.regex;\n      regex.lastIndex = start;\n      var results = [];\n      var match;\n      while (match = regex.exec(text)) {\n        var matchedText = match[pattern.matchIndex];\n        var matchStart = match.index + match[0].indexOf(matchedText);\n        var matchFinish = matchStart + matchedText.length;\n        if (matchFinish > finish) {\n          break;\n        }\n        results.push({\n          start: matchStart,\n          finish: matchFinish\n        });\n        regex.lastIndex = matchFinish;\n      }\n      return results;\n    };\n    var extract = function (elements, matches) {\n      var nodePositions = foldl(elements, function (acc, element) {\n        var content = get$1(element);\n        var start = acc.last;\n        var finish = start + content.length;\n        var positions = bind(matches, function (match, matchIdx) {\n          if (match.start < finish && match.finish > start) {\n            return [{\n                element: element,\n                start: Math.max(start, match.start) - start,\n                finish: Math.min(finish, match.finish) - start,\n                matchId: matchIdx\n              }];\n          } else {\n            return [];\n          }\n        });\n        return {\n          results: acc.results.concat(positions),\n          last: finish\n        };\n      }, {\n        results: [],\n        last: 0\n      }).results;\n      return groupBy(nodePositions, function (position) {\n        return position.matchId;\n      });\n    };\n\n    var find$1 = function (pattern, sections) {\n      return bind(sections, function (section) {\n        var elements = section.elements;\n        var content = map(elements, get$1).join('');\n        var positions = find$2(content, pattern, section.sOffset, content.length - section.fOffset);\n        return extract(elements, positions);\n      });\n    };\n    var mark = function (matches, replacementNode) {\n      eachr(matches, function (match, idx) {\n        eachr(match, function (pos) {\n          var wrapper = SugarElement.fromDom(replacementNode.cloneNode(false));\n          set(wrapper, 'data-mce-index', idx);\n          var textNode = pos.element.dom;\n          if (textNode.length === pos.finish && pos.start === 0) {\n            wrap(pos.element, wrapper);\n          } else {\n            if (textNode.length !== pos.finish) {\n              textNode.splitText(pos.finish);\n            }\n            var matchNode = textNode.splitText(pos.start);\n            wrap(SugarElement.fromDom(matchNode), wrapper);\n          }\n        });\n      });\n    };\n    var findAndMark = function (dom, pattern, node, replacementNode) {\n      var textSections = fromNode(dom, node);\n      var matches = find$1(pattern, textSections);\n      mark(matches, replacementNode);\n      return matches.length;\n    };\n    var findAndMarkInSelection = function (dom, pattern, selection, replacementNode) {\n      var bookmark = selection.getBookmark();\n      var nodes = dom.select('td[data-mce-selected],th[data-mce-selected]');\n      var textSections = nodes.length > 0 ? fromNodes(dom, nodes) : fromRng(dom, selection.getRng());\n      var matches = find$1(pattern, textSections);\n      mark(matches, replacementNode);\n      selection.moveToBookmark(bookmark);\n      return matches.length;\n    };\n\n    var getElmIndex = function (elm) {\n      var value = elm.getAttribute('data-mce-index');\n      if (typeof value === 'number') {\n        return '' + value;\n      }\n      return value;\n    };\n    var markAllMatches = function (editor, currentSearchState, pattern, inSelection) {\n      var marker = editor.dom.create('span', { 'data-mce-bogus': 1 });\n      marker.className = 'mce-match-marker';\n      var node = editor.getBody();\n      done(editor, currentSearchState, false);\n      if (inSelection) {\n        return findAndMarkInSelection(editor.dom, pattern, editor.selection, marker);\n      } else {\n        return findAndMark(editor.dom, pattern, node, marker);\n      }\n    };\n    var unwrap = function (node) {\n      var parentNode = node.parentNode;\n      if (node.firstChild) {\n        parentNode.insertBefore(node.firstChild, node);\n      }\n      node.parentNode.removeChild(node);\n    };\n    var findSpansByIndex = function (editor, index) {\n      var spans = [];\n      var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));\n      if (nodes.length) {\n        for (var i = 0; i < nodes.length; i++) {\n          var nodeIndex = getElmIndex(nodes[i]);\n          if (nodeIndex === null || !nodeIndex.length) {\n            continue;\n          }\n          if (nodeIndex === index.toString()) {\n            spans.push(nodes[i]);\n          }\n        }\n      }\n      return spans;\n    };\n    var moveSelection = function (editor, currentSearchState, forward) {\n      var searchState = currentSearchState.get();\n      var testIndex = searchState.index;\n      var dom = editor.dom;\n      forward = forward !== false;\n      if (forward) {\n        if (testIndex + 1 === searchState.count) {\n          testIndex = 0;\n        } else {\n          testIndex++;\n        }\n      } else {\n        if (testIndex - 1 === -1) {\n          testIndex = searchState.count - 1;\n        } else {\n          testIndex--;\n        }\n      }\n      dom.removeClass(findSpansByIndex(editor, searchState.index), 'mce-match-marker-selected');\n      var spans = findSpansByIndex(editor, testIndex);\n      if (spans.length) {\n        dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');\n        editor.selection.scrollIntoView(spans[0]);\n        return testIndex;\n      }\n      return -1;\n    };\n    var removeNode = function (dom, node) {\n      var parent = node.parentNode;\n      dom.remove(node);\n      if (dom.isEmpty(parent)) {\n        dom.remove(parent);\n      }\n    };\n    var escapeSearchText = function (text, wholeWord) {\n      var escapedText = text.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&').replace(/\\s/g, '[^\\\\S\\\\r\\\\n\\\\uFEFF]');\n      var wordRegex = '(' + escapedText + ')';\n      return wholeWord ? '(?:^|\\\\s|' + punctuation() + ')' + wordRegex + ('(?=$|\\\\s|' + punctuation() + ')') : wordRegex;\n    };\n    var find = function (editor, currentSearchState, text, matchCase, wholeWord, inSelection) {\n      var selection = editor.selection;\n      var escapedText = escapeSearchText(text, wholeWord);\n      var isForwardSelection = selection.isForward();\n      var pattern = {\n        regex: new RegExp(escapedText, matchCase ? 'g' : 'gi'),\n        matchIndex: 1\n      };\n      var count = markAllMatches(editor, currentSearchState, pattern, inSelection);\n      if (global$2.browser.isSafari()) {\n        selection.setRng(selection.getRng(), isForwardSelection);\n      }\n      if (count) {\n        var newIndex = moveSelection(editor, currentSearchState, true);\n        currentSearchState.set({\n          index: newIndex,\n          count: count,\n          text: text,\n          matchCase: matchCase,\n          wholeWord: wholeWord,\n          inSelection: inSelection\n        });\n      }\n      return count;\n    };\n    var next = function (editor, currentSearchState) {\n      var index = moveSelection(editor, currentSearchState, true);\n      currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index }));\n    };\n    var prev = function (editor, currentSearchState) {\n      var index = moveSelection(editor, currentSearchState, false);\n      currentSearchState.set(__assign(__assign({}, currentSearchState.get()), { index: index }));\n    };\n    var isMatchSpan = function (node) {\n      var matchIndex = getElmIndex(node);\n      return matchIndex !== null && matchIndex.length > 0;\n    };\n    var replace = function (editor, currentSearchState, text, forward, all) {\n      var searchState = currentSearchState.get();\n      var currentIndex = searchState.index;\n      var currentMatchIndex, nextIndex = currentIndex;\n      forward = forward !== false;\n      var node = editor.getBody();\n      var nodes = global$1.grep(global$1.toArray(node.getElementsByTagName('span')), isMatchSpan);\n      for (var i = 0; i < nodes.length; i++) {\n        var nodeIndex = getElmIndex(nodes[i]);\n        var matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);\n        if (all || matchIndex === searchState.index) {\n          if (text.length) {\n            nodes[i].firstChild.nodeValue = text;\n            unwrap(nodes[i]);\n          } else {\n            removeNode(editor.dom, nodes[i]);\n          }\n          while (nodes[++i]) {\n            matchIndex = parseInt(getElmIndex(nodes[i]), 10);\n            if (matchIndex === currentMatchIndex) {\n              removeNode(editor.dom, nodes[i]);\n            } else {\n              i--;\n              break;\n            }\n          }\n          if (forward) {\n            nextIndex--;\n          }\n        } else if (currentMatchIndex > currentIndex) {\n          nodes[i].setAttribute('data-mce-index', String(currentMatchIndex - 1));\n        }\n      }\n      currentSearchState.set(__assign(__assign({}, searchState), {\n        count: all ? 0 : searchState.count - 1,\n        index: nextIndex\n      }));\n      if (forward) {\n        next(editor, currentSearchState);\n      } else {\n        prev(editor, currentSearchState);\n      }\n      return !all && currentSearchState.get().count > 0;\n    };\n    var done = function (editor, currentSearchState, keepEditorSelection) {\n      var startContainer, endContainer;\n      var searchState = currentSearchState.get();\n      var nodes = global$1.toArray(editor.getBody().getElementsByTagName('span'));\n      for (var i = 0; i < nodes.length; i++) {\n        var nodeIndex = getElmIndex(nodes[i]);\n        if (nodeIndex !== null && nodeIndex.length) {\n          if (nodeIndex === searchState.index.toString()) {\n            if (!startContainer) {\n              startContainer = nodes[i].firstChild;\n            }\n            endContainer = nodes[i].firstChild;\n          }\n          unwrap(nodes[i]);\n        }\n      }\n      currentSearchState.set(__assign(__assign({}, searchState), {\n        index: -1,\n        count: 0,\n        text: ''\n      }));\n      if (startContainer && endContainer) {\n        var rng = editor.dom.createRng();\n        rng.setStart(startContainer, 0);\n        rng.setEnd(endContainer, endContainer.data.length);\n        if (keepEditorSelection !== false) {\n          editor.selection.setRng(rng);\n        }\n        return rng;\n      }\n    };\n    var hasNext = function (editor, currentSearchState) {\n      return currentSearchState.get().count > 1;\n    };\n    var hasPrev = function (editor, currentSearchState) {\n      return currentSearchState.get().count > 1;\n    };\n\n    var get = function (editor, currentState) {\n      var done$1 = function (keepEditorSelection) {\n        return done(editor, currentState, keepEditorSelection);\n      };\n      var find$1 = function (text, matchCase, wholeWord, inSelection) {\n        if (inSelection === void 0) {\n          inSelection = false;\n        }\n        return find(editor, currentState, text, matchCase, wholeWord, inSelection);\n      };\n      var next$1 = function () {\n        return next(editor, currentState);\n      };\n      var prev$1 = function () {\n        return prev(editor, currentState);\n      };\n      var replace$1 = function (text, forward, all) {\n        return replace(editor, currentState, text, forward, all);\n      };\n      return {\n        done: done$1,\n        find: find$1,\n        next: next$1,\n        prev: prev$1,\n        replace: replace$1\n      };\n    };\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var value = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var open = function (editor, currentSearchState) {\n      var dialogApi = value();\n      editor.undoManager.add();\n      var selectedText = global$1.trim(editor.selection.getContent({ format: 'text' }));\n      var updateButtonStates = function (api) {\n        var updateNext = hasNext(editor, currentSearchState) ? api.enable : api.disable;\n        updateNext('next');\n        var updatePrev = hasPrev(editor, currentSearchState) ? api.enable : api.disable;\n        updatePrev('prev');\n      };\n      var updateSearchState = function (api) {\n        var data = api.getData();\n        var current = currentSearchState.get();\n        currentSearchState.set(__assign(__assign({}, current), {\n          matchCase: data.matchcase,\n          wholeWord: data.wholewords,\n          inSelection: data.inselection\n        }));\n      };\n      var disableAll = function (api, disable) {\n        var buttons = [\n          'replace',\n          'replaceall',\n          'prev',\n          'next'\n        ];\n        var toggle = disable ? api.disable : api.enable;\n        each(buttons, toggle);\n      };\n      var notFoundAlert = function (api) {\n        editor.windowManager.alert('Could not find the specified string.', function () {\n          api.focus('findtext');\n        });\n      };\n      var focusButtonIfRequired = function (api, name) {\n        if (global$2.browser.isSafari() && global$2.deviceType.isTouch() && (name === 'find' || name === 'replace' || name === 'replaceall')) {\n          api.focus(name);\n        }\n      };\n      var reset = function (api) {\n        done(editor, currentSearchState, false);\n        disableAll(api, true);\n        updateButtonStates(api);\n      };\n      var doFind = function (api) {\n        var data = api.getData();\n        var last = currentSearchState.get();\n        if (!data.findtext.length) {\n          reset(api);\n          return;\n        }\n        if (last.text === data.findtext && last.matchCase === data.matchcase && last.wholeWord === data.wholewords) {\n          next(editor, currentSearchState);\n        } else {\n          var count = find(editor, currentSearchState, data.findtext, data.matchcase, data.wholewords, data.inselection);\n          if (count <= 0) {\n            notFoundAlert(api);\n          }\n          disableAll(api, count === 0);\n        }\n        updateButtonStates(api);\n      };\n      var initialState = currentSearchState.get();\n      var initialData = {\n        findtext: selectedText,\n        replacetext: '',\n        wholewords: initialState.wholeWord,\n        matchcase: initialState.matchCase,\n        inselection: initialState.inSelection\n      };\n      var spec = {\n        title: 'Find and Replace',\n        size: 'normal',\n        body: {\n          type: 'panel',\n          items: [\n            {\n              type: 'bar',\n              items: [\n                {\n                  type: 'input',\n                  name: 'findtext',\n                  placeholder: 'Find',\n                  maximized: true,\n                  inputMode: 'search'\n                },\n                {\n                  type: 'button',\n                  name: 'prev',\n                  text: 'Previous',\n                  icon: 'action-prev',\n                  disabled: true,\n                  borderless: true\n                },\n                {\n                  type: 'button',\n                  name: 'next',\n                  text: 'Next',\n                  icon: 'action-next',\n                  disabled: true,\n                  borderless: true\n                }\n              ]\n            },\n            {\n              type: 'input',\n              name: 'replacetext',\n              placeholder: 'Replace with',\n              inputMode: 'search'\n            }\n          ]\n        },\n        buttons: [\n          {\n            type: 'menu',\n            name: 'options',\n            icon: 'preferences',\n            tooltip: 'Preferences',\n            align: 'start',\n            items: [\n              {\n                type: 'togglemenuitem',\n                name: 'matchcase',\n                text: 'Match case'\n              },\n              {\n                type: 'togglemenuitem',\n                name: 'wholewords',\n                text: 'Find whole words only'\n              },\n              {\n                type: 'togglemenuitem',\n                name: 'inselection',\n                text: 'Find in selection'\n              }\n            ]\n          },\n          {\n            type: 'custom',\n            name: 'find',\n            text: 'Find',\n            primary: true\n          },\n          {\n            type: 'custom',\n            name: 'replace',\n            text: 'Replace',\n            disabled: true\n          },\n          {\n            type: 'custom',\n            name: 'replaceall',\n            text: 'Replace all',\n            disabled: true\n          }\n        ],\n        initialData: initialData,\n        onChange: function (api, details) {\n          if (details.name === 'findtext' && currentSearchState.get().count > 0) {\n            reset(api);\n          }\n        },\n        onAction: function (api, details) {\n          var data = api.getData();\n          switch (details.name) {\n          case 'find':\n            doFind(api);\n            break;\n          case 'replace':\n            if (!replace(editor, currentSearchState, data.replacetext)) {\n              reset(api);\n            } else {\n              updateButtonStates(api);\n            }\n            break;\n          case 'replaceall':\n            replace(editor, currentSearchState, data.replacetext, true, true);\n            reset(api);\n            break;\n          case 'prev':\n            prev(editor, currentSearchState);\n            updateButtonStates(api);\n            break;\n          case 'next':\n            next(editor, currentSearchState);\n            updateButtonStates(api);\n            break;\n          case 'matchcase':\n          case 'wholewords':\n          case 'inselection':\n            updateSearchState(api);\n            reset(api);\n            break;\n          }\n          focusButtonIfRequired(api, details.name);\n        },\n        onSubmit: function (api) {\n          doFind(api);\n          focusButtonIfRequired(api, 'find');\n        },\n        onClose: function () {\n          editor.focus();\n          done(editor, currentSearchState);\n          editor.undoManager.add();\n        }\n      };\n      dialogApi.set(editor.windowManager.open(spec, { inline: 'toolbar' }));\n    };\n\n    var register$1 = function (editor, currentSearchState) {\n      editor.addCommand('SearchReplace', function () {\n        open(editor, currentSearchState);\n      });\n    };\n\n    var showDialog = function (editor, currentSearchState) {\n      return function () {\n        open(editor, currentSearchState);\n      };\n    };\n    var register = function (editor, currentSearchState) {\n      editor.ui.registry.addMenuItem('searchreplace', {\n        text: 'Find and replace...',\n        shortcut: 'Meta+F',\n        onAction: showDialog(editor, currentSearchState),\n        icon: 'search'\n      });\n      editor.ui.registry.addButton('searchreplace', {\n        tooltip: 'Find and replace',\n        onAction: showDialog(editor, currentSearchState),\n        icon: 'search'\n      });\n      editor.shortcuts.add('Meta+F', '', showDialog(editor, currentSearchState));\n    };\n\n    function Plugin () {\n      global$3.add('searchreplace', function (editor) {\n        var currentSearchState = Cell({\n          index: -1,\n          count: 0,\n          text: '',\n          matchCase: false,\n          wholeWord: false,\n          inSelection: false\n        });\n        register$1(editor, currentSearchState);\n        register(editor, currentSearchState);\n        return get(editor, currentSearchState);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/searchreplace/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/table/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/table/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"table\" plugin for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/plugins/table')\n//   ES2015:\n//     import 'tinymce/plugins/table'\n__webpack_require__(/*! ./plugin.js */ \"../../node_modules/tinymce/plugins/table/plugin.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/table/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/plugins/table/plugin.js":
/*!**********************************************************!*\
  !*** ../../node_modules/tinymce/plugins/table/plugin.js ***!
  \**********************************************************/
/***/ (function() {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var eq$2 = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isString = isType$1('string');\n    var isObject = isType$1('object');\n    var isArray = isType$1('array');\n    var isNull = eq$2(null);\n    var isBoolean = isSimpleType('boolean');\n    var isUndefined = eq$2(undefined);\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var compose = function (fa, fb) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return fa(fb.apply(null, args));\n      };\n    };\n    var compose1 = function (fbc, fab) {\n      return function (a) {\n        return fbc(fab(a));\n      };\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var tripleEquals = function (a, b) {\n      return a === b;\n    };\n    function curry(fn) {\n      var initialArgs = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        initialArgs[_i - 1] = arguments[_i];\n      }\n      return function () {\n        var restArgs = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          restArgs[_i] = arguments[_i];\n        }\n        var all = initialArgs.concat(restArgs);\n        return fn.apply(null, all);\n      };\n    }\n    var not = function (f) {\n      return function (t) {\n        return !f(t);\n      };\n    };\n    var die = function (msg) {\n      return function () {\n        throw new Error(msg);\n      };\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none$2 = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none$2,\n        each: noop,\n        bind: none$2,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none$2();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from$1 = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none$2,\n      from: from$1\n    };\n\n    var nativeSlice = Array.prototype.slice;\n    var nativeIndexOf = Array.prototype.indexOf;\n    var nativePush = Array.prototype.push;\n    var rawIndexOf = function (ts, t) {\n      return nativeIndexOf.call(ts, t);\n    };\n    var contains$2 = function (xs, x) {\n      return rawIndexOf(xs, x) > -1;\n    };\n    var exists = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var range$1 = function (num, f) {\n      var r = [];\n      for (var i = 0; i < num; i++) {\n        r.push(f(i));\n      }\n      return r;\n    };\n    var map$1 = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$2 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var eachr = function (xs, f) {\n      for (var i = xs.length - 1; i >= 0; i--) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var partition = function (xs, pred) {\n      var pass = [];\n      var fail = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        var arr = pred(x, i) ? pass : fail;\n        arr.push(x);\n      }\n      return {\n        pass: pass,\n        fail: fail\n      };\n    };\n    var filter$2 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var foldr = function (xs, f, acc) {\n      eachr(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var foldl = function (xs, f, acc) {\n      each$2(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find$1 = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var findIndex = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(i);\n        }\n      }\n      return Optional.none();\n    };\n    var flatten$1 = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind$2 = function (xs, f) {\n      return flatten$1(map$1(xs, f));\n    };\n    var forall = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        var x = xs[i];\n        if (pred(x, i) !== true) {\n          return false;\n        }\n      }\n      return true;\n    };\n    var reverse = function (xs) {\n      var r = nativeSlice.call(xs, 0);\n      r.reverse();\n      return r;\n    };\n    var mapToObject = function (xs, f) {\n      var r = {};\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        r[String(x)] = f(x, i);\n      }\n      return r;\n    };\n    var pure = function (x) {\n      return [x];\n    };\n    var sort$1 = function (xs, comparator) {\n      var copy = nativeSlice.call(xs, 0);\n      copy.sort(comparator);\n      return copy;\n    };\n    var get$d = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$d(xs, 0);\n    };\n    var last$2 = function (xs) {\n      return get$d(xs, xs.length - 1);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n    function __spreadArray(to, from, pack) {\n      if (pack || arguments.length === 2)\n        for (var i = 0, l = from.length, ar; i < l; i++) {\n          if (ar || !(i in from)) {\n            if (!ar)\n              ar = Array.prototype.slice.call(from, 0, i);\n            ar[i] = from[i];\n          }\n        }\n      return to.concat(ar || Array.prototype.slice.call(from));\n    }\n\n    var cached = function (f) {\n      var called = false;\n      var r;\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!called) {\n          called = true;\n          r = f.apply(null, args);\n        }\n        return r;\n      };\n    };\n\n    var DeviceType = function (os, browser, userAgent, mediaMatch) {\n      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n      var isiPhone = os.isiOS() && !isiPad;\n      var isMobile = os.isiOS() || os.isAndroid();\n      var isTouch = isMobile || mediaMatch('(pointer:coarse)');\n      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');\n      var isPhone = isiPhone || isMobile && !isTablet;\n      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n      var isDesktop = !isPhone && !isTablet && !iOSwebview;\n      return {\n        isiPad: constant(isiPad),\n        isiPhone: constant(isiPhone),\n        isTablet: constant(isTablet),\n        isPhone: constant(isPhone),\n        isTouch: constant(isTouch),\n        isAndroid: os.isAndroid,\n        isiOS: os.isiOS,\n        isWebView: constant(iOSwebview),\n        isDesktop: constant(isDesktop)\n      };\n    };\n\n    var firstMatch = function (regexes, s) {\n      for (var i = 0; i < regexes.length; i++) {\n        var x = regexes[i];\n        if (x.test(s)) {\n          return x;\n        }\n      }\n      return undefined;\n    };\n    var find = function (regexes, agent) {\n      var r = firstMatch(regexes, agent);\n      if (!r) {\n        return {\n          major: 0,\n          minor: 0\n        };\n      }\n      var group = function (i) {\n        return Number(agent.replace(r, '$' + i));\n      };\n      return nu$2(group(1), group(2));\n    };\n    var detect$6 = function (versionRegexes, agent) {\n      var cleanedAgent = String(agent).toLowerCase();\n      if (versionRegexes.length === 0) {\n        return unknown$2();\n      }\n      return find(versionRegexes, cleanedAgent);\n    };\n    var unknown$2 = function () {\n      return nu$2(0, 0);\n    };\n    var nu$2 = function (major, minor) {\n      return {\n        major: major,\n        minor: minor\n      };\n    };\n    var Version = {\n      nu: nu$2,\n      detect: detect$6,\n      unknown: unknown$2\n    };\n\n    var detectBrowser$1 = function (browsers, userAgentData) {\n      return findMap(userAgentData.brands, function (uaBrand) {\n        var lcBrand = uaBrand.brand.toLowerCase();\n        return find$1(browsers, function (browser) {\n          var _a;\n          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());\n        }).map(function (info) {\n          return {\n            current: info.name,\n            version: Version.nu(parseInt(uaBrand.version, 10), 0)\n          };\n        });\n      });\n    };\n\n    var detect$5 = function (candidates, userAgent) {\n      var agent = String(userAgent).toLowerCase();\n      return find$1(candidates, function (candidate) {\n        return candidate.search(agent);\n      });\n    };\n    var detectBrowser = function (browsers, userAgent) {\n      return detect$5(browsers, userAgent).map(function (browser) {\n        var version = Version.detect(browser.versionRegexes, userAgent);\n        return {\n          current: browser.name,\n          version: version\n        };\n      });\n    };\n    var detectOs = function (oses, userAgent) {\n      return detect$5(oses, userAgent).map(function (os) {\n        var version = Version.detect(os.versionRegexes, userAgent);\n        return {\n          current: os.name,\n          version: version\n        };\n      });\n    };\n\n    var removeFromStart = function (str, numChars) {\n      return str.substring(numChars);\n    };\n\n    var checkRange = function (str, substr, start) {\n      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;\n    };\n    var removeLeading = function (str, prefix) {\n      return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str;\n    };\n    var contains$1 = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var startsWith = function (str, prefix) {\n      return checkRange(str, prefix, 0);\n    };\n    var endsWith = function (str, suffix) {\n      return checkRange(str, suffix, str.length - suffix.length);\n    };\n    var blank = function (r) {\n      return function (s) {\n        return s.replace(r, '');\n      };\n    };\n    var trim = blank(/^\\s+|\\s+$/g);\n    var isNotEmpty = function (s) {\n      return s.length > 0;\n    };\n    var isEmpty$1 = function (s) {\n      return !isNotEmpty(s);\n    };\n    var toFloat = function (value) {\n      var num = parseFloat(value);\n      return isNaN(num) ? Optional.none() : Optional.some(num);\n    };\n\n    var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n    var checkContains = function (target) {\n      return function (uastring) {\n        return contains$1(uastring, target);\n      };\n    };\n    var browsers = [\n      {\n        name: 'Edge',\n        versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n        search: function (uastring) {\n          return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');\n        }\n      },\n      {\n        name: 'Chrome',\n        brand: 'Chromium',\n        versionRegexes: [\n          /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n          normalVersionRegex\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');\n        }\n      },\n      {\n        name: 'IE',\n        versionRegexes: [\n          /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*?rv:([0-9]+)\\.([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');\n        }\n      },\n      {\n        name: 'Opera',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n        ],\n        search: checkContains('opera')\n      },\n      {\n        name: 'Firefox',\n        versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n        search: checkContains('firefox')\n      },\n      {\n        name: 'Safari',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?cpu os ([0-9]+)_([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');\n        }\n      }\n    ];\n    var oses = [\n      {\n        name: 'Windows',\n        search: checkContains('win'),\n        versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'iOS',\n        search: function (uastring) {\n          return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');\n        },\n        versionRegexes: [\n          /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*cpu os ([0-9]+)_([0-9]+).*/,\n          /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n        ]\n      },\n      {\n        name: 'Android',\n        search: checkContains('android'),\n        versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'OSX',\n        search: checkContains('mac os x'),\n        versionRegexes: [/.*?mac\\ os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n      },\n      {\n        name: 'Linux',\n        search: checkContains('linux'),\n        versionRegexes: []\n      },\n      {\n        name: 'Solaris',\n        search: checkContains('sunos'),\n        versionRegexes: []\n      },\n      {\n        name: 'FreeBSD',\n        search: checkContains('freebsd'),\n        versionRegexes: []\n      },\n      {\n        name: 'ChromeOS',\n        search: checkContains('cros'),\n        versionRegexes: [/.*?chrome\\/([0-9]+)\\.([0-9]+).*/]\n      }\n    ];\n    var PlatformInfo = {\n      browsers: constant(browsers),\n      oses: constant(oses)\n    };\n\n    var edge = 'Edge';\n    var chrome = 'Chrome';\n    var ie = 'IE';\n    var opera = 'Opera';\n    var firefox = 'Firefox';\n    var safari = 'Safari';\n    var unknown$1 = function () {\n      return nu$1({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$1 = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isBrowser = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isEdge: isBrowser(edge),\n        isChrome: isBrowser(chrome),\n        isIE: isBrowser(ie),\n        isOpera: isBrowser(opera),\n        isFirefox: isBrowser(firefox),\n        isSafari: isBrowser(safari)\n      };\n    };\n    var Browser = {\n      unknown: unknown$1,\n      nu: nu$1,\n      edge: constant(edge),\n      chrome: constant(chrome),\n      ie: constant(ie),\n      opera: constant(opera),\n      firefox: constant(firefox),\n      safari: constant(safari)\n    };\n\n    var windows = 'Windows';\n    var ios = 'iOS';\n    var android = 'Android';\n    var linux = 'Linux';\n    var osx = 'OSX';\n    var solaris = 'Solaris';\n    var freebsd = 'FreeBSD';\n    var chromeos = 'ChromeOS';\n    var unknown = function () {\n      return nu({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isOS = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isWindows: isOS(windows),\n        isiOS: isOS(ios),\n        isAndroid: isOS(android),\n        isOSX: isOS(osx),\n        isLinux: isOS(linux),\n        isSolaris: isOS(solaris),\n        isFreeBSD: isOS(freebsd),\n        isChromeOS: isOS(chromeos)\n      };\n    };\n    var OperatingSystem = {\n      unknown: unknown,\n      nu: nu,\n      windows: constant(windows),\n      ios: constant(ios),\n      android: constant(android),\n      linux: constant(linux),\n      osx: constant(osx),\n      solaris: constant(solaris),\n      freebsd: constant(freebsd),\n      chromeos: constant(chromeos)\n    };\n\n    var detect$4 = function (userAgent, userAgentDataOpt, mediaMatch) {\n      var browsers = PlatformInfo.browsers();\n      var oses = PlatformInfo.oses();\n      var browser = userAgentDataOpt.bind(function (userAgentData) {\n        return detectBrowser$1(browsers, userAgentData);\n      }).orThunk(function () {\n        return detectBrowser(browsers, userAgent);\n      }).fold(Browser.unknown, Browser.nu);\n      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);\n      return {\n        browser: browser,\n        os: os,\n        deviceType: deviceType\n      };\n    };\n    var PlatformDetection = { detect: detect$4 };\n\n    var mediaMatch = function (query) {\n      return window.matchMedia(query).matches;\n    };\n    var platform = cached(function () {\n      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);\n    });\n    var detect$3 = function () {\n      return platform();\n    };\n\n    var compareDocumentPosition = function (a, b, match) {\n      return (a.compareDocumentPosition(b) & match) !== 0;\n    };\n    var documentPositionContainedBy = function (a, b) {\n      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);\n    };\n\n    var COMMENT = 8;\n    var DOCUMENT = 9;\n    var DOCUMENT_FRAGMENT = 11;\n    var ELEMENT = 1;\n    var TEXT = 3;\n\n    var fromHtml$1 = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom$1(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom$1(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom$1(node);\n    };\n    var fromDom$1 = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint$1 = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$1);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml$1,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom$1,\n      fromPoint: fromPoint$1\n    };\n\n    var is$2 = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n    var bypassSelector = function (dom) {\n      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;\n    };\n    var all$1 = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? [] : map$1(base.querySelectorAll(selector), SugarElement.fromDom);\n    };\n    var one = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom);\n    };\n\n    var eq$1 = function (e1, e2) {\n      return e1.dom === e2.dom;\n    };\n    var regularContains = function (e1, e2) {\n      var d1 = e1.dom;\n      var d2 = e2.dom;\n      return d1 === d2 ? false : d1.contains(d2);\n    };\n    var ieContains = function (e1, e2) {\n      return documentPositionContainedBy(e1.dom, e2.dom);\n    };\n    var contains = function (e1, e2) {\n      return detect$3().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);\n    };\n    var is$1 = is$2;\n\n    var keys = Object.keys;\n    var hasOwnProperty = Object.hasOwnProperty;\n    var each$1 = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var map = function (obj, f) {\n      return tupleMap(obj, function (x, i) {\n        return {\n          k: i,\n          v: f(x, i)\n        };\n      });\n    };\n    var tupleMap = function (obj, f) {\n      var r = {};\n      each$1(obj, function (x, i) {\n        var tuple = f(x, i);\n        r[tuple.k] = tuple.v;\n      });\n      return r;\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each$1(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var filter$1 = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n    var mapToArray = function (obj, f) {\n      var r = [];\n      each$1(obj, function (value, name) {\n        r.push(f(value, name));\n      });\n      return r;\n    };\n    var values = function (obj) {\n      return mapToArray(obj, identity);\n    };\n    var size = function (obj) {\n      return keys(obj).length;\n    };\n    var get$c = function (obj, key) {\n      return has$1(obj, key) ? Optional.from(obj[key]) : Optional.none();\n    };\n    var has$1 = function (obj, key) {\n      return hasOwnProperty.call(obj, key);\n    };\n    var hasNonNullableKey = function (obj, key) {\n      return has$1(obj, key) && obj[key] !== undefined && obj[key] !== null;\n    };\n    var isEmpty = function (r) {\n      for (var x in r) {\n        if (hasOwnProperty.call(r, x)) {\n          return false;\n        }\n      }\n      return true;\n    };\n\n    var validSectionList = [\n      'tfoot',\n      'thead',\n      'tbody',\n      'colgroup'\n    ];\n    var isValidSection = function (parentName) {\n      return contains$2(validSectionList, parentName);\n    };\n    var grid = function (rows, columns) {\n      return {\n        rows: rows,\n        columns: columns\n      };\n    };\n    var address = function (row, column) {\n      return {\n        row: row,\n        column: column\n      };\n    };\n    var detail = function (element, rowspan, colspan) {\n      return {\n        element: element,\n        rowspan: rowspan,\n        colspan: colspan\n      };\n    };\n    var detailnew = function (element, rowspan, colspan, isNew) {\n      return {\n        element: element,\n        rowspan: rowspan,\n        colspan: colspan,\n        isNew: isNew\n      };\n    };\n    var extended = function (element, rowspan, colspan, row, column, isLocked) {\n      return {\n        element: element,\n        rowspan: rowspan,\n        colspan: colspan,\n        row: row,\n        column: column,\n        isLocked: isLocked\n      };\n    };\n    var rowdetail = function (element, cells, section) {\n      return {\n        element: element,\n        cells: cells,\n        section: section\n      };\n    };\n    var rowdetailnew = function (element, cells, section, isNew) {\n      return {\n        element: element,\n        cells: cells,\n        section: section,\n        isNew: isNew\n      };\n    };\n    var elementnew = function (element, isNew, isLocked) {\n      return {\n        element: element,\n        isNew: isNew,\n        isLocked: isLocked\n      };\n    };\n    var rowcells = function (element, cells, section, isNew) {\n      return {\n        element: element,\n        cells: cells,\n        section: section,\n        isNew: isNew\n      };\n    };\n    var bounds = function (startRow, startCol, finishRow, finishCol) {\n      return {\n        startRow: startRow,\n        startCol: startCol,\n        finishRow: finishRow,\n        finishCol: finishCol\n      };\n    };\n    var columnext = function (element, colspan, column) {\n      return {\n        element: element,\n        colspan: colspan,\n        column: column\n      };\n    };\n    var colgroup = function (element, columns) {\n      return {\n        element: element,\n        columns: columns\n      };\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var name = function (element) {\n      var r = element.dom.nodeName;\n      return r.toLowerCase();\n    };\n    var type$1 = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type$1(element) === t;\n      };\n    };\n    var isComment = function (element) {\n      return type$1(element) === COMMENT || name(element) === '#comment';\n    };\n    var isElement = isType(ELEMENT);\n    var isText = isType(TEXT);\n    var isDocument = isType(DOCUMENT);\n    var isDocumentFragment = isType(DOCUMENT_FRAGMENT);\n    var isTag = function (tag) {\n      return function (e) {\n        return isElement(e) && name(e) === tag;\n      };\n    };\n\n    var owner = function (element) {\n      return SugarElement.fromDom(element.dom.ownerDocument);\n    };\n    var documentOrOwner = function (dos) {\n      return isDocument(dos) ? dos : owner(dos);\n    };\n    var defaultView = function (element) {\n      return SugarElement.fromDom(documentOrOwner(element).dom.defaultView);\n    };\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var parentElement = function (element) {\n      return Optional.from(element.dom.parentElement).map(SugarElement.fromDom);\n    };\n    var parents = function (element, isRoot) {\n      var stop = isFunction(isRoot) ? isRoot : never;\n      var dom = element.dom;\n      var ret = [];\n      while (dom.parentNode !== null && dom.parentNode !== undefined) {\n        var rawParent = dom.parentNode;\n        var p = SugarElement.fromDom(rawParent);\n        ret.push(p);\n        if (stop(p) === true) {\n          break;\n        } else {\n          dom = rawParent;\n        }\n      }\n      return ret;\n    };\n    var prevSibling = function (element) {\n      return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom);\n    };\n    var nextSibling = function (element) {\n      return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);\n    };\n    var children$3 = function (element) {\n      return map$1(element.dom.childNodes, SugarElement.fromDom);\n    };\n    var child$3 = function (element, index) {\n      var cs = element.dom.childNodes;\n      return Optional.from(cs[index]).map(SugarElement.fromDom);\n    };\n    var firstChild = function (element) {\n      return child$3(element, 0);\n    };\n\n    var isShadowRoot = function (dos) {\n      return isDocumentFragment(dos) && isNonNullable(dos.dom.host);\n    };\n    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);\n    var isSupported$1 = constant(supported);\n    var getRootNode = supported ? function (e) {\n      return SugarElement.fromDom(e.dom.getRootNode());\n    } : documentOrOwner;\n    var getShadowRoot = function (e) {\n      var r = getRootNode(e);\n      return isShadowRoot(r) ? Optional.some(r) : Optional.none();\n    };\n    var getShadowHost = function (e) {\n      return SugarElement.fromDom(e.dom.host);\n    };\n    var getOriginalEventTarget = function (event) {\n      if (isSupported$1() && isNonNullable(event.target)) {\n        var el = SugarElement.fromDom(event.target);\n        if (isElement(el) && isOpenShadowHost(el)) {\n          if (event.composed && event.composedPath) {\n            var composedPath = event.composedPath();\n            if (composedPath) {\n              return head(composedPath);\n            }\n          }\n        }\n      }\n      return Optional.from(event.target);\n    };\n    var isOpenShadowHost = function (element) {\n      return isNonNullable(element.dom.shadowRoot);\n    };\n\n    var inBody = function (element) {\n      var dom = isText(element) ? element.dom.parentNode : element.dom;\n      if (dom === undefined || dom === null || dom.ownerDocument === null) {\n        return false;\n      }\n      var doc = dom.ownerDocument;\n      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {\n        return doc.body.contains(dom);\n      }, compose1(inBody, getShadowHost));\n    };\n    var body$1 = function () {\n      return getBody$1(SugarElement.fromDom(document));\n    };\n    var getBody$1 = function (doc) {\n      var b = doc.dom.body;\n      if (b === null || b === undefined) {\n        throw new Error('Body is not available yet');\n      }\n      return SugarElement.fromDom(b);\n    };\n\n    var ancestors$4 = function (scope, predicate, isRoot) {\n      return filter$2(parents(scope, isRoot), predicate);\n    };\n    var children$2 = function (scope, predicate) {\n      return filter$2(children$3(scope), predicate);\n    };\n    var descendants$1 = function (scope, predicate) {\n      var result = [];\n      each$2(children$3(scope), function (x) {\n        if (predicate(x)) {\n          result = result.concat([x]);\n        }\n        result = result.concat(descendants$1(x, predicate));\n      });\n      return result;\n    };\n\n    var ancestors$3 = function (scope, selector, isRoot) {\n      return ancestors$4(scope, function (e) {\n        return is$2(e, selector);\n      }, isRoot);\n    };\n    var children$1 = function (scope, selector) {\n      return children$2(scope, function (e) {\n        return is$2(e, selector);\n      });\n    };\n    var descendants = function (scope, selector) {\n      return all$1(selector, scope);\n    };\n\n    function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {\n      if (is(scope, a)) {\n        return Optional.some(scope);\n      } else if (isFunction(isRoot) && isRoot(scope)) {\n        return Optional.none();\n      } else {\n        return ancestor(scope, a, isRoot);\n      }\n    }\n\n    var ancestor$2 = function (scope, predicate, isRoot) {\n      var element = scope.dom;\n      var stop = isFunction(isRoot) ? isRoot : never;\n      while (element.parentNode) {\n        element = element.parentNode;\n        var el = SugarElement.fromDom(element);\n        if (predicate(el)) {\n          return Optional.some(el);\n        } else if (stop(el)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var closest$2 = function (scope, predicate, isRoot) {\n      var is = function (s, test) {\n        return test(s);\n      };\n      return ClosestOrAncestor(is, ancestor$2, scope, predicate, isRoot);\n    };\n    var child$2 = function (scope, predicate) {\n      var pred = function (node) {\n        return predicate(SugarElement.fromDom(node));\n      };\n      var result = find$1(scope.dom.childNodes, pred);\n      return result.map(SugarElement.fromDom);\n    };\n    var descendant$1 = function (scope, predicate) {\n      var descend = function (node) {\n        for (var i = 0; i < node.childNodes.length; i++) {\n          var child_1 = SugarElement.fromDom(node.childNodes[i]);\n          if (predicate(child_1)) {\n            return Optional.some(child_1);\n          }\n          var res = descend(node.childNodes[i]);\n          if (res.isSome()) {\n            return res;\n          }\n        }\n        return Optional.none();\n      };\n      return descend(scope.dom);\n    };\n\n    var ancestor$1 = function (scope, selector, isRoot) {\n      return ancestor$2(scope, function (e) {\n        return is$2(e, selector);\n      }, isRoot);\n    };\n    var child$1 = function (scope, selector) {\n      return child$2(scope, function (e) {\n        return is$2(e, selector);\n      });\n    };\n    var descendant = function (scope, selector) {\n      return one(selector, scope);\n    };\n    var closest$1 = function (scope, selector, isRoot) {\n      var is = function (element, selector) {\n        return is$2(element, selector);\n      };\n      return ClosestOrAncestor(is, ancestor$1, scope, selector, isRoot);\n    };\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set$2 = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n    var setAll$1 = function (element, attrs) {\n      var dom = element.dom;\n      each$1(attrs, function (v, k) {\n        rawSet(dom, k, v);\n      });\n    };\n    var setOptions = function (element, attrs) {\n      each$1(attrs, function (v, k) {\n        v.fold(function () {\n          remove$7(element, k);\n        }, function (value) {\n          rawSet(element.dom, k, value);\n        });\n      });\n    };\n    var get$b = function (element, key) {\n      var v = element.dom.getAttribute(key);\n      return v === null ? undefined : v;\n    };\n    var getOpt = function (element, key) {\n      return Optional.from(get$b(element, key));\n    };\n    var remove$7 = function (element, key) {\n      element.dom.removeAttribute(key);\n    };\n    var clone$2 = function (element) {\n      return foldl(element.dom.attributes, function (acc, attr) {\n        acc[attr.name] = attr.value;\n        return acc;\n      }, {});\n    };\n\n    var is = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lhs.exists(function (left) {\n        return comparator(left, rhs);\n      });\n    };\n    var cat = function (arr) {\n      var r = [];\n      var push = function (x) {\n        r.push(x);\n      };\n      for (var i = 0; i < arr.length; i++) {\n        arr[i].each(push);\n      }\n      return r;\n    };\n    var lift2 = function (oa, ob, f) {\n      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();\n    };\n    var bindFrom = function (a, f) {\n      return a !== undefined && a !== null ? f(a) : Optional.none();\n    };\n    var flatten = function (oot) {\n      return oot.bind(identity);\n    };\n    var someIf = function (b, a) {\n      return b ? Optional.some(a) : Optional.none();\n    };\n\n    var isSupported = function (dom) {\n      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n    };\n\n    var internalSet = function (dom, property, value) {\n      if (!isString(value)) {\n        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n        throw new Error('CSS value must be a string: ' + value);\n      }\n      if (isSupported(dom)) {\n        dom.style.setProperty(property, value);\n      }\n    };\n    var internalRemove = function (dom, property) {\n      if (isSupported(dom)) {\n        dom.style.removeProperty(property);\n      }\n    };\n    var set$1 = function (element, property, value) {\n      var dom = element.dom;\n      internalSet(dom, property, value);\n    };\n    var setAll = function (element, css) {\n      var dom = element.dom;\n      each$1(css, function (v, k) {\n        internalSet(dom, k, v);\n      });\n    };\n    var get$a = function (element, property) {\n      var dom = element.dom;\n      var styles = window.getComputedStyle(dom);\n      var r = styles.getPropertyValue(property);\n      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;\n    };\n    var getUnsafeProperty = function (dom, property) {\n      return isSupported(dom) ? dom.style.getPropertyValue(property) : '';\n    };\n    var getRaw$2 = function (element, property) {\n      var dom = element.dom;\n      var raw = getUnsafeProperty(dom, property);\n      return Optional.from(raw).filter(function (r) {\n        return r.length > 0;\n      });\n    };\n    var remove$6 = function (element, property) {\n      var dom = element.dom;\n      internalRemove(dom, property);\n      if (is(getOpt(element, 'style').map(trim), '')) {\n        remove$7(element, 'style');\n      }\n    };\n    var copy$2 = function (source, target) {\n      var sourceDom = source.dom;\n      var targetDom = target.dom;\n      if (isSupported(sourceDom) && isSupported(targetDom)) {\n        targetDom.style.cssText = sourceDom.style.cssText;\n      }\n    };\n\n    var getAttrValue = function (cell, name, fallback) {\n      if (fallback === void 0) {\n        fallback = 0;\n      }\n      return getOpt(cell, name).map(function (value) {\n        return parseInt(value, 10);\n      }).getOr(fallback);\n    };\n    var getSpan = function (cell, type) {\n      return getAttrValue(cell, type, 1);\n    };\n    var hasColspan = function (cellOrCol) {\n      if (isTag('col')(cellOrCol)) {\n        return getAttrValue(cellOrCol, 'span', 1) > 1;\n      } else {\n        return getSpan(cellOrCol, 'colspan') > 1;\n      }\n    };\n    var hasRowspan = function (cell) {\n      return getSpan(cell, 'rowspan') > 1;\n    };\n    var getCssValue = function (element, property) {\n      return parseInt(get$a(element, property), 10);\n    };\n    var minWidth = constant(10);\n    var minHeight = constant(10);\n\n    var firstLayer = function (scope, selector) {\n      return filterFirstLayer(scope, selector, always);\n    };\n    var filterFirstLayer = function (scope, selector, predicate) {\n      return bind$2(children$3(scope), function (x) {\n        if (is$2(x, selector)) {\n          return predicate(x) ? [x] : [];\n        } else {\n          return filterFirstLayer(x, selector, predicate);\n        }\n      });\n    };\n\n    var lookup = function (tags, element, isRoot) {\n      if (isRoot === void 0) {\n        isRoot = never;\n      }\n      if (isRoot(element)) {\n        return Optional.none();\n      }\n      if (contains$2(tags, name(element))) {\n        return Optional.some(element);\n      }\n      var isRootOrUpperTable = function (elm) {\n        return is$2(elm, 'table') || isRoot(elm);\n      };\n      return ancestor$1(element, tags.join(','), isRootOrUpperTable);\n    };\n    var cell = function (element, isRoot) {\n      return lookup([\n        'td',\n        'th'\n      ], element, isRoot);\n    };\n    var cells$1 = function (ancestor) {\n      return firstLayer(ancestor, 'th,td');\n    };\n    var columns$1 = function (ancestor) {\n      if (is$2(ancestor, 'colgroup')) {\n        return children$1(ancestor, 'col');\n      } else {\n        return bind$2(columnGroups(ancestor), function (columnGroup) {\n          return children$1(columnGroup, 'col');\n        });\n      }\n    };\n    var table = function (element, isRoot) {\n      return closest$1(element, 'table', isRoot);\n    };\n    var rows$1 = function (ancestor) {\n      return firstLayer(ancestor, 'tr');\n    };\n    var columnGroups = function (ancestor) {\n      return table(ancestor).fold(constant([]), function (table) {\n        return children$1(table, 'colgroup');\n      });\n    };\n\n    var fromRowsOrColGroups = function (elems, getSection) {\n      return map$1(elems, function (row) {\n        if (name(row) === 'colgroup') {\n          var cells = map$1(columns$1(row), function (column) {\n            var colspan = getAttrValue(column, 'span', 1);\n            return detail(column, 1, colspan);\n          });\n          return rowdetail(row, cells, 'colgroup');\n        } else {\n          var cells = map$1(cells$1(row), function (cell) {\n            var rowspan = getAttrValue(cell, 'rowspan', 1);\n            var colspan = getAttrValue(cell, 'colspan', 1);\n            return detail(cell, rowspan, colspan);\n          });\n          return rowdetail(row, cells, getSection(row));\n        }\n      });\n    };\n    var getParentSection = function (group) {\n      return parent(group).map(function (parent) {\n        var parentName = name(parent);\n        return isValidSection(parentName) ? parentName : 'tbody';\n      }).getOr('tbody');\n    };\n    var fromTable$1 = function (table) {\n      var rows = rows$1(table);\n      var columnGroups$1 = columnGroups(table);\n      var elems = __spreadArray(__spreadArray([], columnGroups$1, true), rows, true);\n      return fromRowsOrColGroups(elems, getParentSection);\n    };\n    var fromPastedRows = function (elems, section) {\n      return fromRowsOrColGroups(elems, function () {\n        return section;\n      });\n    };\n\n    var addCells = function (gridRow, index, cells) {\n      var existingCells = gridRow.cells;\n      var before = existingCells.slice(0, index);\n      var after = existingCells.slice(index);\n      var newCells = before.concat(cells).concat(after);\n      return setCells(gridRow, newCells);\n    };\n    var addCell = function (gridRow, index, cell) {\n      return addCells(gridRow, index, [cell]);\n    };\n    var mutateCell = function (gridRow, index, cell) {\n      var cells = gridRow.cells;\n      cells[index] = cell;\n    };\n    var setCells = function (gridRow, cells) {\n      return rowcells(gridRow.element, cells, gridRow.section, gridRow.isNew);\n    };\n    var mapCells = function (gridRow, f) {\n      var cells = gridRow.cells;\n      var r = map$1(cells, f);\n      return rowcells(gridRow.element, r, gridRow.section, gridRow.isNew);\n    };\n    var getCell = function (gridRow, index) {\n      return gridRow.cells[index];\n    };\n    var getCellElement = function (gridRow, index) {\n      return getCell(gridRow, index).element;\n    };\n    var cellLength = function (gridRow) {\n      return gridRow.cells.length;\n    };\n    var extractGridDetails = function (grid) {\n      var result = partition(grid, function (row) {\n        return row.section === 'colgroup';\n      });\n      return {\n        rows: result.fail,\n        cols: result.pass\n      };\n    };\n    var clone$1 = function (gridRow, cloneRow, cloneCell) {\n      var newCells = map$1(gridRow.cells, cloneCell);\n      return rowcells(cloneRow(gridRow.element), newCells, gridRow.section, true);\n    };\n\n    var LOCKED_COL_ATTR = 'data-snooker-locked-cols';\n    var getLockedColumnsFromTable = function (table) {\n      return getOpt(table, LOCKED_COL_ATTR).bind(function (lockedColStr) {\n        return Optional.from(lockedColStr.match(/\\d+/g));\n      }).map(function (lockedCols) {\n        return mapToObject(lockedCols, always);\n      });\n    };\n    var getLockedColumnsFromGrid = function (grid) {\n      var locked = foldl(extractGridDetails(grid).rows, function (acc, row) {\n        each$2(row.cells, function (cell, idx) {\n          if (cell.isLocked) {\n            acc[idx] = true;\n          }\n        });\n        return acc;\n      }, {});\n      var lockedArr = mapToArray(locked, function (_val, key) {\n        return parseInt(key, 10);\n      });\n      return sort$1(lockedArr);\n    };\n\n    var key = function (row, column) {\n      return row + ',' + column;\n    };\n    var getAt = function (warehouse, row, column) {\n      return Optional.from(warehouse.access[key(row, column)]);\n    };\n    var findItem = function (warehouse, item, comparator) {\n      var filtered = filterItems(warehouse, function (detail) {\n        return comparator(item, detail.element);\n      });\n      return filtered.length > 0 ? Optional.some(filtered[0]) : Optional.none();\n    };\n    var filterItems = function (warehouse, predicate) {\n      var all = bind$2(warehouse.all, function (r) {\n        return r.cells;\n      });\n      return filter$2(all, predicate);\n    };\n    var generateColumns = function (rowData) {\n      var columnsGroup = {};\n      var index = 0;\n      each$2(rowData.cells, function (column) {\n        var colspan = column.colspan;\n        range$1(colspan, function (columnIndex) {\n          var colIndex = index + columnIndex;\n          columnsGroup[colIndex] = columnext(column.element, colspan, colIndex);\n        });\n        index += colspan;\n      });\n      return columnsGroup;\n    };\n    var generate$1 = function (list) {\n      var access = {};\n      var cells = [];\n      var tableOpt = head(list).map(function (rowData) {\n        return rowData.element;\n      }).bind(table);\n      var lockedColumns = tableOpt.bind(getLockedColumnsFromTable).getOr({});\n      var maxRows = 0;\n      var maxColumns = 0;\n      var rowCount = 0;\n      var _a = partition(list, function (rowData) {\n          return rowData.section === 'colgroup';\n        }), colgroupRows = _a.pass, rows = _a.fail;\n      each$2(rows, function (rowData) {\n        var currentRow = [];\n        each$2(rowData.cells, function (rowCell) {\n          var start = 0;\n          while (access[key(rowCount, start)] !== undefined) {\n            start++;\n          }\n          var isLocked = hasNonNullableKey(lockedColumns, start.toString());\n          var current = extended(rowCell.element, rowCell.rowspan, rowCell.colspan, rowCount, start, isLocked);\n          for (var occupiedColumnPosition = 0; occupiedColumnPosition < rowCell.colspan; occupiedColumnPosition++) {\n            for (var occupiedRowPosition = 0; occupiedRowPosition < rowCell.rowspan; occupiedRowPosition++) {\n              var rowPosition = rowCount + occupiedRowPosition;\n              var columnPosition = start + occupiedColumnPosition;\n              var newpos = key(rowPosition, columnPosition);\n              access[newpos] = current;\n              maxColumns = Math.max(maxColumns, columnPosition + 1);\n            }\n          }\n          currentRow.push(current);\n        });\n        maxRows++;\n        cells.push(rowdetail(rowData.element, currentRow, rowData.section));\n        rowCount++;\n      });\n      var _b = last$2(colgroupRows).map(function (rowData) {\n          var columns = generateColumns(rowData);\n          var colgroup$1 = colgroup(rowData.element, values(columns));\n          return {\n            colgroups: [colgroup$1],\n            columns: columns\n          };\n        }).getOrThunk(function () {\n          return {\n            colgroups: [],\n            columns: {}\n          };\n        }), columns = _b.columns, colgroups = _b.colgroups;\n      var grid$1 = grid(maxRows, maxColumns);\n      return {\n        grid: grid$1,\n        access: access,\n        all: cells,\n        columns: columns,\n        colgroups: colgroups\n      };\n    };\n    var fromTable = function (table) {\n      var list = fromTable$1(table);\n      return generate$1(list);\n    };\n    var justCells = function (warehouse) {\n      return bind$2(warehouse.all, function (w) {\n        return w.cells;\n      });\n    };\n    var justColumns = function (warehouse) {\n      return values(warehouse.columns);\n    };\n    var hasColumns = function (warehouse) {\n      return keys(warehouse.columns).length > 0;\n    };\n    var getColumnAt = function (warehouse, columnIndex) {\n      return Optional.from(warehouse.columns[columnIndex]);\n    };\n    var Warehouse = {\n      fromTable: fromTable,\n      generate: generate$1,\n      getAt: getAt,\n      findItem: findItem,\n      filterItems: filterItems,\n      justCells: justCells,\n      justColumns: justColumns,\n      hasColumns: hasColumns,\n      getColumnAt: getColumnAt\n    };\n\n    var inSelection = function (bounds, detail) {\n      var leftEdge = detail.column;\n      var rightEdge = detail.column + detail.colspan - 1;\n      var topEdge = detail.row;\n      var bottomEdge = detail.row + detail.rowspan - 1;\n      return leftEdge <= bounds.finishCol && rightEdge >= bounds.startCol && (topEdge <= bounds.finishRow && bottomEdge >= bounds.startRow);\n    };\n    var isWithin = function (bounds, detail) {\n      return detail.column >= bounds.startCol && detail.column + detail.colspan - 1 <= bounds.finishCol && detail.row >= bounds.startRow && detail.row + detail.rowspan - 1 <= bounds.finishRow;\n    };\n    var isRectangular = function (warehouse, bounds) {\n      var isRect = true;\n      var detailIsWithin = curry(isWithin, bounds);\n      for (var i = bounds.startRow; i <= bounds.finishRow; i++) {\n        for (var j = bounds.startCol; j <= bounds.finishCol; j++) {\n          isRect = isRect && Warehouse.getAt(warehouse, i, j).exists(detailIsWithin);\n        }\n      }\n      return isRect ? Optional.some(bounds) : Optional.none();\n    };\n\n    var getBounds = function (detailA, detailB) {\n      return bounds(Math.min(detailA.row, detailB.row), Math.min(detailA.column, detailB.column), Math.max(detailA.row + detailA.rowspan - 1, detailB.row + detailB.rowspan - 1), Math.max(detailA.column + detailA.colspan - 1, detailB.column + detailB.colspan - 1));\n    };\n    var getAnyBox = function (warehouse, startCell, finishCell) {\n      var startCoords = Warehouse.findItem(warehouse, startCell, eq$1);\n      var finishCoords = Warehouse.findItem(warehouse, finishCell, eq$1);\n      return startCoords.bind(function (sc) {\n        return finishCoords.map(function (fc) {\n          return getBounds(sc, fc);\n        });\n      });\n    };\n    var getBox$1 = function (warehouse, startCell, finishCell) {\n      return getAnyBox(warehouse, startCell, finishCell).bind(function (bounds) {\n        return isRectangular(warehouse, bounds);\n      });\n    };\n\n    var moveBy$1 = function (warehouse, cell, row, column) {\n      return Warehouse.findItem(warehouse, cell, eq$1).bind(function (detail) {\n        var startRow = row > 0 ? detail.row + detail.rowspan - 1 : detail.row;\n        var startCol = column > 0 ? detail.column + detail.colspan - 1 : detail.column;\n        var dest = Warehouse.getAt(warehouse, startRow + row, startCol + column);\n        return dest.map(function (d) {\n          return d.element;\n        });\n      });\n    };\n    var intercepts$1 = function (warehouse, start, finish) {\n      return getAnyBox(warehouse, start, finish).map(function (bounds) {\n        var inside = Warehouse.filterItems(warehouse, curry(inSelection, bounds));\n        return map$1(inside, function (detail) {\n          return detail.element;\n        });\n      });\n    };\n    var parentCell = function (warehouse, innerCell) {\n      var isContainedBy = function (c1, c2) {\n        return contains(c2, c1);\n      };\n      return Warehouse.findItem(warehouse, innerCell, isContainedBy).map(function (detail) {\n        return detail.element;\n      });\n    };\n\n    var moveBy = function (cell, deltaRow, deltaColumn) {\n      return table(cell).bind(function (table) {\n        var warehouse = getWarehouse(table);\n        return moveBy$1(warehouse, cell, deltaRow, deltaColumn);\n      });\n    };\n    var intercepts = function (table, first, last) {\n      var warehouse = getWarehouse(table);\n      return intercepts$1(warehouse, first, last);\n    };\n    var nestedIntercepts = function (table, first, firstTable, last, lastTable) {\n      var warehouse = getWarehouse(table);\n      var optStartCell = eq$1(table, firstTable) ? Optional.some(first) : parentCell(warehouse, first);\n      var optLastCell = eq$1(table, lastTable) ? Optional.some(last) : parentCell(warehouse, last);\n      return optStartCell.bind(function (startCell) {\n        return optLastCell.bind(function (lastCell) {\n          return intercepts$1(warehouse, startCell, lastCell);\n        });\n      });\n    };\n    var getBox = function (table, first, last) {\n      var warehouse = getWarehouse(table);\n      return getBox$1(warehouse, first, last);\n    };\n    var getWarehouse = Warehouse.fromTable;\n\n    var before$4 = function (marker, element) {\n      var parent$1 = parent(marker);\n      parent$1.each(function (v) {\n        v.dom.insertBefore(element.dom, marker.dom);\n      });\n    };\n    var after$5 = function (marker, element) {\n      var sibling = nextSibling(marker);\n      sibling.fold(function () {\n        var parent$1 = parent(marker);\n        parent$1.each(function (v) {\n          append$1(v, element);\n        });\n      }, function (v) {\n        before$4(v, element);\n      });\n    };\n    var prepend = function (parent, element) {\n      var firstChild$1 = firstChild(parent);\n      firstChild$1.fold(function () {\n        append$1(parent, element);\n      }, function (v) {\n        parent.dom.insertBefore(element.dom, v.dom);\n      });\n    };\n    var append$1 = function (parent, element) {\n      parent.dom.appendChild(element.dom);\n    };\n    var appendAt = function (parent, element, index) {\n      child$3(parent, index).fold(function () {\n        append$1(parent, element);\n      }, function (v) {\n        before$4(v, element);\n      });\n    };\n    var wrap = function (element, wrapper) {\n      before$4(element, wrapper);\n      append$1(wrapper, element);\n    };\n\n    var before$3 = function (marker, elements) {\n      each$2(elements, function (x) {\n        before$4(marker, x);\n      });\n    };\n    var after$4 = function (marker, elements) {\n      each$2(elements, function (x, i) {\n        var e = i === 0 ? marker : elements[i - 1];\n        after$5(e, x);\n      });\n    };\n    var append = function (parent, elements) {\n      each$2(elements, function (x) {\n        append$1(parent, x);\n      });\n    };\n\n    var empty = function (element) {\n      element.dom.textContent = '';\n      each$2(children$3(element), function (rogue) {\n        remove$5(rogue);\n      });\n    };\n    var remove$5 = function (element) {\n      var dom = element.dom;\n      if (dom.parentNode !== null) {\n        dom.parentNode.removeChild(dom);\n      }\n    };\n    var unwrap = function (wrapper) {\n      var children = children$3(wrapper);\n      if (children.length > 0) {\n        before$3(wrapper, children);\n      }\n      remove$5(wrapper);\n    };\n\n    var NodeValue = function (is, name) {\n      var get = function (element) {\n        if (!is(element)) {\n          throw new Error('Can only get ' + name + ' value of a ' + name + ' node');\n        }\n        return getOption(element).getOr('');\n      };\n      var getOption = function (element) {\n        return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();\n      };\n      var set = function (element, value) {\n        if (!is(element)) {\n          throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');\n        }\n        element.dom.nodeValue = value;\n      };\n      return {\n        get: get,\n        getOption: getOption,\n        set: set\n      };\n    };\n\n    var api$2 = NodeValue(isText, 'text');\n    var get$9 = function (element) {\n      return api$2.get(element);\n    };\n    var getOption = function (element) {\n      return api$2.getOption(element);\n    };\n    var set = function (element, value) {\n      return api$2.set(element, value);\n    };\n\n    var TagBoundaries = [\n      'body',\n      'p',\n      'div',\n      'article',\n      'aside',\n      'figcaption',\n      'figure',\n      'footer',\n      'header',\n      'nav',\n      'section',\n      'ol',\n      'ul',\n      'li',\n      'table',\n      'thead',\n      'tbody',\n      'tfoot',\n      'caption',\n      'tr',\n      'td',\n      'th',\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6',\n      'blockquote',\n      'pre',\n      'address'\n    ];\n\n    function DomUniverse () {\n      var clone = function (element) {\n        return SugarElement.fromDom(element.dom.cloneNode(false));\n      };\n      var document = function (element) {\n        return documentOrOwner(element).dom;\n      };\n      var isBoundary = function (element) {\n        if (!isElement(element)) {\n          return false;\n        }\n        if (name(element) === 'body') {\n          return true;\n        }\n        return contains$2(TagBoundaries, name(element));\n      };\n      var isEmptyTag = function (element) {\n        if (!isElement(element)) {\n          return false;\n        }\n        return contains$2([\n          'br',\n          'img',\n          'hr',\n          'input'\n        ], name(element));\n      };\n      var isNonEditable = function (element) {\n        return isElement(element) && get$b(element, 'contenteditable') === 'false';\n      };\n      var comparePosition = function (element, other) {\n        return element.dom.compareDocumentPosition(other.dom);\n      };\n      var copyAttributesTo = function (source, destination) {\n        var as = clone$2(source);\n        setAll$1(destination, as);\n      };\n      var isSpecial = function (element) {\n        var tag = name(element);\n        return contains$2([\n          'script',\n          'noscript',\n          'iframe',\n          'noframes',\n          'noembed',\n          'title',\n          'style',\n          'textarea',\n          'xmp'\n        ], tag);\n      };\n      var getLanguage = function (element) {\n        return isElement(element) ? getOpt(element, 'lang') : Optional.none();\n      };\n      return {\n        up: constant({\n          selector: ancestor$1,\n          closest: closest$1,\n          predicate: ancestor$2,\n          all: parents\n        }),\n        down: constant({\n          selector: descendants,\n          predicate: descendants$1\n        }),\n        styles: constant({\n          get: get$a,\n          getRaw: getRaw$2,\n          set: set$1,\n          remove: remove$6\n        }),\n        attrs: constant({\n          get: get$b,\n          set: set$2,\n          remove: remove$7,\n          copyTo: copyAttributesTo\n        }),\n        insert: constant({\n          before: before$4,\n          after: after$5,\n          afterAll: after$4,\n          append: append$1,\n          appendAll: append,\n          prepend: prepend,\n          wrap: wrap\n        }),\n        remove: constant({\n          unwrap: unwrap,\n          remove: remove$5\n        }),\n        create: constant({\n          nu: SugarElement.fromTag,\n          clone: clone,\n          text: SugarElement.fromText\n        }),\n        query: constant({\n          comparePosition: comparePosition,\n          prevSibling: prevSibling,\n          nextSibling: nextSibling\n        }),\n        property: constant({\n          children: children$3,\n          name: name,\n          parent: parent,\n          document: document,\n          isText: isText,\n          isComment: isComment,\n          isElement: isElement,\n          isSpecial: isSpecial,\n          getLanguage: getLanguage,\n          getText: get$9,\n          setText: set,\n          isBoundary: isBoundary,\n          isEmptyTag: isEmptyTag,\n          isNonEditable: isNonEditable\n        }),\n        eq: eq$1,\n        is: is$1\n      };\n    }\n\n    var all = function (universe, look, elements, f) {\n      var head = elements[0];\n      var tail = elements.slice(1);\n      return f(universe, look, head, tail);\n    };\n    var oneAll = function (universe, look, elements) {\n      return elements.length > 0 ? all(universe, look, elements, unsafeOne) : Optional.none();\n    };\n    var unsafeOne = function (universe, look, head, tail) {\n      var start = look(universe, head);\n      return foldr(tail, function (b, a) {\n        var current = look(universe, a);\n        return commonElement(universe, b, current);\n      }, start);\n    };\n    var commonElement = function (universe, start, end) {\n      return start.bind(function (s) {\n        return end.filter(curry(universe.eq, s));\n      });\n    };\n\n    var eq = function (universe, item) {\n      return curry(universe.eq, item);\n    };\n    var ancestors$2 = function (universe, start, end, isRoot) {\n      if (isRoot === void 0) {\n        isRoot = never;\n      }\n      var ps1 = [start].concat(universe.up().all(start));\n      var ps2 = [end].concat(universe.up().all(end));\n      var prune = function (path) {\n        var index = findIndex(path, isRoot);\n        return index.fold(function () {\n          return path;\n        }, function (ind) {\n          return path.slice(0, ind + 1);\n        });\n      };\n      var pruned1 = prune(ps1);\n      var pruned2 = prune(ps2);\n      var shared = find$1(pruned1, function (x) {\n        return exists(pruned2, eq(universe, x));\n      });\n      return {\n        firstpath: pruned1,\n        secondpath: pruned2,\n        shared: shared\n      };\n    };\n\n    var sharedOne$1 = oneAll;\n    var ancestors$1 = ancestors$2;\n\n    var universe$3 = DomUniverse();\n    var sharedOne = function (look, elements) {\n      return sharedOne$1(universe$3, function (_universe, element) {\n        return look(element);\n      }, elements);\n    };\n    var ancestors = function (start, finish, isRoot) {\n      return ancestors$1(universe$3, start, finish, isRoot);\n    };\n\n    var lookupTable = function (container) {\n      return ancestor$1(container, 'table');\n    };\n    var identify = function (start, finish, isRoot) {\n      var getIsRoot = function (rootTable) {\n        return function (element) {\n          return isRoot !== undefined && isRoot(element) || eq$1(element, rootTable);\n        };\n      };\n      if (eq$1(start, finish)) {\n        return Optional.some({\n          boxes: Optional.some([start]),\n          start: start,\n          finish: finish\n        });\n      } else {\n        return lookupTable(start).bind(function (startTable) {\n          return lookupTable(finish).bind(function (finishTable) {\n            if (eq$1(startTable, finishTable)) {\n              return Optional.some({\n                boxes: intercepts(startTable, start, finish),\n                start: start,\n                finish: finish\n              });\n            } else if (contains(startTable, finishTable)) {\n              var ancestorCells = ancestors$3(finish, 'td,th', getIsRoot(startTable));\n              var finishCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : finish;\n              return Optional.some({\n                boxes: nestedIntercepts(startTable, start, startTable, finish, finishTable),\n                start: start,\n                finish: finishCell\n              });\n            } else if (contains(finishTable, startTable)) {\n              var ancestorCells = ancestors$3(start, 'td,th', getIsRoot(finishTable));\n              var startCell = ancestorCells.length > 0 ? ancestorCells[ancestorCells.length - 1] : start;\n              return Optional.some({\n                boxes: nestedIntercepts(finishTable, start, startTable, finish, finishTable),\n                start: start,\n                finish: startCell\n              });\n            } else {\n              return ancestors(start, finish).shared.bind(function (lca) {\n                return closest$1(lca, 'table', isRoot).bind(function (lcaTable) {\n                  var finishAncestorCells = ancestors$3(finish, 'td,th', getIsRoot(lcaTable));\n                  var finishCell = finishAncestorCells.length > 0 ? finishAncestorCells[finishAncestorCells.length - 1] : finish;\n                  var startAncestorCells = ancestors$3(start, 'td,th', getIsRoot(lcaTable));\n                  var startCell = startAncestorCells.length > 0 ? startAncestorCells[startAncestorCells.length - 1] : start;\n                  return Optional.some({\n                    boxes: nestedIntercepts(lcaTable, start, startTable, finish, finishTable),\n                    start: startCell,\n                    finish: finishCell\n                  });\n                });\n              });\n            }\n          });\n        });\n      }\n    };\n    var retrieve$1 = function (container, selector) {\n      var sels = descendants(container, selector);\n      return sels.length > 0 ? Optional.some(sels) : Optional.none();\n    };\n    var getLast = function (boxes, lastSelectedSelector) {\n      return find$1(boxes, function (box) {\n        return is$2(box, lastSelectedSelector);\n      });\n    };\n    var getEdges = function (container, firstSelectedSelector, lastSelectedSelector) {\n      return descendant(container, firstSelectedSelector).bind(function (first) {\n        return descendant(container, lastSelectedSelector).bind(function (last) {\n          return sharedOne(lookupTable, [\n            first,\n            last\n          ]).map(function (table) {\n            return {\n              first: first,\n              last: last,\n              table: table\n            };\n          });\n        });\n      });\n    };\n    var expandTo = function (finish, firstSelectedSelector) {\n      return ancestor$1(finish, 'table').bind(function (table) {\n        return descendant(table, firstSelectedSelector).bind(function (start) {\n          return identify(start, finish).bind(function (identified) {\n            return identified.boxes.map(function (boxes) {\n              return {\n                boxes: boxes,\n                start: identified.start,\n                finish: identified.finish\n              };\n            });\n          });\n        });\n      });\n    };\n    var shiftSelection = function (boxes, deltaRow, deltaColumn, firstSelectedSelector, lastSelectedSelector) {\n      return getLast(boxes, lastSelectedSelector).bind(function (last) {\n        return moveBy(last, deltaRow, deltaColumn).bind(function (finish) {\n          return expandTo(finish, firstSelectedSelector);\n        });\n      });\n    };\n\n    var retrieve = function (container, selector) {\n      return retrieve$1(container, selector);\n    };\n    var retrieveBox = function (container, firstSelectedSelector, lastSelectedSelector) {\n      return getEdges(container, firstSelectedSelector, lastSelectedSelector).bind(function (edges) {\n        var isRoot = function (ancestor) {\n          return eq$1(container, ancestor);\n        };\n        var sectionSelector = 'thead,tfoot,tbody,table';\n        var firstAncestor = ancestor$1(edges.first, sectionSelector, isRoot);\n        var lastAncestor = ancestor$1(edges.last, sectionSelector, isRoot);\n        return firstAncestor.bind(function (fA) {\n          return lastAncestor.bind(function (lA) {\n            return eq$1(fA, lA) ? getBox(edges.table, edges.first, edges.last) : Optional.none();\n          });\n        });\n      });\n    };\n\n    var generate = function (cases) {\n      if (!isArray(cases)) {\n        throw new Error('cases must be an array');\n      }\n      if (cases.length === 0) {\n        throw new Error('there must be at least one case');\n      }\n      var constructors = [];\n      var adt = {};\n      each$2(cases, function (acase, count) {\n        var keys$1 = keys(acase);\n        if (keys$1.length !== 1) {\n          throw new Error('one and only one name per case');\n        }\n        var key = keys$1[0];\n        var value = acase[key];\n        if (adt[key] !== undefined) {\n          throw new Error('duplicate key detected:' + key);\n        } else if (key === 'cata') {\n          throw new Error('cannot have a case named cata (sorry)');\n        } else if (!isArray(value)) {\n          throw new Error('case arguments must be an array');\n        }\n        constructors.push(key);\n        adt[key] = function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          var argLength = args.length;\n          if (argLength !== value.length) {\n            throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);\n          }\n          var match = function (branches) {\n            var branchKeys = keys(branches);\n            if (constructors.length !== branchKeys.length) {\n              throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\\nActual: ' + branchKeys.join(','));\n            }\n            var allReqd = forall(constructors, function (reqKey) {\n              return contains$2(branchKeys, reqKey);\n            });\n            if (!allReqd) {\n              throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\\nRequired: ' + constructors.join(', '));\n            }\n            return branches[key].apply(null, args);\n          };\n          return {\n            fold: function () {\n              var foldArgs = [];\n              for (var _i = 0; _i < arguments.length; _i++) {\n                foldArgs[_i] = arguments[_i];\n              }\n              if (foldArgs.length !== cases.length) {\n                throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length);\n              }\n              var target = foldArgs[count];\n              return target.apply(null, args);\n            },\n            match: match,\n            log: function (label) {\n              console.log(label, {\n                constructors: constructors,\n                constructor: key,\n                params: args\n              });\n            }\n          };\n        };\n      });\n      return adt;\n    };\n    var Adt = { generate: generate };\n\n    var type = Adt.generate([\n      { none: [] },\n      { multiple: ['elements'] },\n      { single: ['element'] }\n    ]);\n    var cata$2 = function (subject, onNone, onMultiple, onSingle) {\n      return subject.fold(onNone, onMultiple, onSingle);\n    };\n    var none$1 = type.none;\n    var multiple = type.multiple;\n    var single = type.single;\n\n    var Selections = function (lazyRoot, getStart, selectedSelector) {\n      var get = function () {\n        return retrieve(lazyRoot(), selectedSelector).fold(function () {\n          return getStart().fold(none$1, single);\n        }, function (cells) {\n          return multiple(cells);\n        });\n      };\n      return { get: get };\n    };\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var clone = function (original, isDeep) {\n      return SugarElement.fromDom(original.dom.cloneNode(isDeep));\n    };\n    var shallow = function (original) {\n      return clone(original, false);\n    };\n    var deep = function (original) {\n      return clone(original, true);\n    };\n    var shallowAs = function (original, tag) {\n      var nu = SugarElement.fromTag(tag);\n      var attributes = clone$2(original);\n      setAll$1(nu, attributes);\n      return nu;\n    };\n    var copy$1 = function (original, tag) {\n      var nu = shallowAs(original, tag);\n      var cloneChildren = children$3(deep(original));\n      append(nu, cloneChildren);\n      return nu;\n    };\n    var mutate$1 = function (original, tag) {\n      var nu = shallowAs(original, tag);\n      before$4(original, nu);\n      var children = children$3(original);\n      append(nu, children);\n      remove$5(original);\n      return nu;\n    };\n\n    var Dimension = function (name, getOffset) {\n      var set = function (element, h) {\n        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {\n          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);\n        }\n        var dom = element.dom;\n        if (isSupported(dom)) {\n          dom.style[name] = h + 'px';\n        }\n      };\n      var get = function (element) {\n        var r = getOffset(element);\n        if (r <= 0 || r === null) {\n          var css = get$a(element, name);\n          return parseFloat(css) || 0;\n        }\n        return r;\n      };\n      var getOuter = get;\n      var aggregate = function (element, properties) {\n        return foldl(properties, function (acc, property) {\n          var val = get$a(element, property);\n          var value = val === undefined ? 0 : parseInt(val, 10);\n          return isNaN(value) ? acc : acc + value;\n        }, 0);\n      };\n      var max = function (element, value, properties) {\n        var cumulativeInclusions = aggregate(element, properties);\n        var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;\n        return absoluteMax;\n      };\n      return {\n        set: set,\n        get: get,\n        getOuter: getOuter,\n        aggregate: aggregate,\n        max: max\n      };\n    };\n\n    var needManualCalc = function () {\n      var browser = detect$3().browser;\n      return browser.isIE() || browser.isEdge();\n    };\n    var toNumber = function (px, fallback) {\n      return toFloat(px).getOr(fallback);\n    };\n    var getProp = function (element, name, fallback) {\n      return toNumber(get$a(element, name), fallback);\n    };\n    var getBoxSizing = function (element) {\n      return get$a(element, 'box-sizing');\n    };\n    var calcContentBoxSize = function (element, size, upper, lower) {\n      var paddingUpper = getProp(element, 'padding-' + upper, 0);\n      var paddingLower = getProp(element, 'padding-' + lower, 0);\n      var borderUpper = getProp(element, 'border-' + upper + '-width', 0);\n      var borderLower = getProp(element, 'border-' + lower + '-width', 0);\n      return size - paddingUpper - paddingLower - borderUpper - borderLower;\n    };\n    var getCalculatedHeight = function (element, boxSizing) {\n      var dom = element.dom;\n      var height = dom.getBoundingClientRect().height || dom.offsetHeight;\n      return boxSizing === 'border-box' ? height : calcContentBoxSize(element, height, 'top', 'bottom');\n    };\n    var getCalculatedWidth = function (element, boxSizing) {\n      var dom = element.dom;\n      var width = dom.getBoundingClientRect().width || dom.offsetWidth;\n      return boxSizing === 'border-box' ? width : calcContentBoxSize(element, width, 'left', 'right');\n    };\n    var getHeight$1 = function (element) {\n      return needManualCalc() ? getCalculatedHeight(element, getBoxSizing(element)) : getProp(element, 'height', element.dom.offsetHeight);\n    };\n    var getWidth = function (element) {\n      return needManualCalc() ? getCalculatedWidth(element, getBoxSizing(element)) : getProp(element, 'width', element.dom.offsetWidth);\n    };\n    var getInnerWidth = function (element) {\n      return getCalculatedWidth(element, 'content-box');\n    };\n\n    var api$1 = Dimension('width', function (element) {\n      return element.dom.offsetWidth;\n    });\n    var get$8 = function (element) {\n      return api$1.get(element);\n    };\n    var getOuter$2 = function (element) {\n      return api$1.getOuter(element);\n    };\n    var getInner = getInnerWidth;\n    var getRuntime$1 = getWidth;\n\n    var columns = function (warehouse, isValidCell) {\n      if (isValidCell === void 0) {\n        isValidCell = always;\n      }\n      var grid = warehouse.grid;\n      var cols = range$1(grid.columns, identity);\n      var rowsArr = range$1(grid.rows, identity);\n      return map$1(cols, function (col) {\n        var getBlock = function () {\n          return bind$2(rowsArr, function (r) {\n            return Warehouse.getAt(warehouse, r, col).filter(function (detail) {\n              return detail.column === col;\n            }).toArray();\n          });\n        };\n        var isValid = function (detail) {\n          return detail.colspan === 1 && isValidCell(detail.element);\n        };\n        var getFallback = function () {\n          return Warehouse.getAt(warehouse, 0, col);\n        };\n        return decide(getBlock, isValid, getFallback);\n      });\n    };\n    var decide = function (getBlock, isValid, getFallback) {\n      var inBlock = getBlock();\n      var validInBlock = find$1(inBlock, isValid);\n      var detailOption = validInBlock.orThunk(function () {\n        return Optional.from(inBlock[0]).orThunk(getFallback);\n      });\n      return detailOption.map(function (detail) {\n        return detail.element;\n      });\n    };\n    var rows = function (warehouse) {\n      var grid = warehouse.grid;\n      var rowsArr = range$1(grid.rows, identity);\n      var cols = range$1(grid.columns, identity);\n      return map$1(rowsArr, function (row) {\n        var getBlock = function () {\n          return bind$2(cols, function (c) {\n            return Warehouse.getAt(warehouse, row, c).filter(function (detail) {\n              return detail.row === row;\n            }).fold(constant([]), function (detail) {\n              return [detail];\n            });\n          });\n        };\n        var isSingle = function (detail) {\n          return detail.rowspan === 1;\n        };\n        var getFallback = function () {\n          return Warehouse.getAt(warehouse, row, 0);\n        };\n        return decide(getBlock, isSingle, getFallback);\n      });\n    };\n\n    var deduce = function (xs, index) {\n      if (index < 0 || index >= xs.length - 1) {\n        return Optional.none();\n      }\n      var current = xs[index].fold(function () {\n        var rest = reverse(xs.slice(0, index));\n        return findMap(rest, function (a, i) {\n          return a.map(function (aa) {\n            return {\n              value: aa,\n              delta: i + 1\n            };\n          });\n        });\n      }, function (c) {\n        return Optional.some({\n          value: c,\n          delta: 0\n        });\n      });\n      var next = xs[index + 1].fold(function () {\n        var rest = xs.slice(index + 1);\n        return findMap(rest, function (a, i) {\n          return a.map(function (aa) {\n            return {\n              value: aa,\n              delta: i + 1\n            };\n          });\n        });\n      }, function (n) {\n        return Optional.some({\n          value: n,\n          delta: 1\n        });\n      });\n      return current.bind(function (c) {\n        return next.map(function (n) {\n          var extras = n.delta + c.delta;\n          return Math.abs(n.value - c.value) / extras;\n        });\n      });\n    };\n\n    var onDirection = function (isLtr, isRtl) {\n      return function (element) {\n        return getDirection(element) === 'rtl' ? isRtl : isLtr;\n      };\n    };\n    var getDirection = function (element) {\n      return get$a(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';\n    };\n\n    var api = Dimension('height', function (element) {\n      var dom = element.dom;\n      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;\n    });\n    var get$7 = function (element) {\n      return api.get(element);\n    };\n    var getOuter$1 = function (element) {\n      return api.getOuter(element);\n    };\n    var getRuntime = getHeight$1;\n\n    var r = function (left, top) {\n      var translate = function (x, y) {\n        return r(left + x, top + y);\n      };\n      return {\n        left: left,\n        top: top,\n        translate: translate\n      };\n    };\n    var SugarPosition = r;\n\n    var boxPosition = function (dom) {\n      var box = dom.getBoundingClientRect();\n      return SugarPosition(box.left, box.top);\n    };\n    var firstDefinedOrZero = function (a, b) {\n      if (a !== undefined) {\n        return a;\n      } else {\n        return b !== undefined ? b : 0;\n      }\n    };\n    var absolute = function (element) {\n      var doc = element.dom.ownerDocument;\n      var body = doc.body;\n      var win = doc.defaultView;\n      var html = doc.documentElement;\n      if (body === element.dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop);\n      var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft);\n      var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);\n      var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);\n      return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);\n    };\n    var viewport = function (element) {\n      var dom = element.dom;\n      var doc = dom.ownerDocument;\n      var body = doc.body;\n      if (body === dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      if (!inBody(element)) {\n        return SugarPosition(0, 0);\n      }\n      return boxPosition(dom);\n    };\n\n    var rowInfo = function (row, y) {\n      return {\n        row: row,\n        y: y\n      };\n    };\n    var colInfo = function (col, x) {\n      return {\n        col: col,\n        x: x\n      };\n    };\n    var rtlEdge = function (cell) {\n      var pos = absolute(cell);\n      return pos.left + getOuter$2(cell);\n    };\n    var ltrEdge = function (cell) {\n      return absolute(cell).left;\n    };\n    var getLeftEdge = function (index, cell) {\n      return colInfo(index, ltrEdge(cell));\n    };\n    var getRightEdge = function (index, cell) {\n      return colInfo(index, rtlEdge(cell));\n    };\n    var getTop$1 = function (cell) {\n      return absolute(cell).top;\n    };\n    var getTopEdge = function (index, cell) {\n      return rowInfo(index, getTop$1(cell));\n    };\n    var getBottomEdge = function (index, cell) {\n      return rowInfo(index, getTop$1(cell) + getOuter$1(cell));\n    };\n    var findPositions = function (getInnerEdge, getOuterEdge, array) {\n      if (array.length === 0) {\n        return [];\n      }\n      var lines = map$1(array.slice(1), function (cellOption, index) {\n        return cellOption.map(function (cell) {\n          return getInnerEdge(index, cell);\n        });\n      });\n      var lastLine = array[array.length - 1].map(function (cell) {\n        return getOuterEdge(array.length - 1, cell);\n      });\n      return lines.concat([lastLine]);\n    };\n    var negate = function (step) {\n      return -step;\n    };\n    var height = {\n      delta: identity,\n      positions: function (optElements) {\n        return findPositions(getTopEdge, getBottomEdge, optElements);\n      },\n      edge: getTop$1\n    };\n    var ltr$1 = {\n      delta: identity,\n      edge: ltrEdge,\n      positions: function (optElements) {\n        return findPositions(getLeftEdge, getRightEdge, optElements);\n      }\n    };\n    var rtl$1 = {\n      delta: negate,\n      edge: rtlEdge,\n      positions: function (optElements) {\n        return findPositions(getRightEdge, getLeftEdge, optElements);\n      }\n    };\n    var detect$2 = onDirection(ltr$1, rtl$1);\n    var width = {\n      delta: function (amount, table) {\n        return detect$2(table).delta(amount, table);\n      },\n      positions: function (cols, table) {\n        return detect$2(table).positions(cols, table);\n      },\n      edge: function (cell) {\n        return detect$2(cell).edge(cell);\n      }\n    };\n\n    var units = {\n      unsupportedLength: [\n        'em',\n        'ex',\n        'cap',\n        'ch',\n        'ic',\n        'rem',\n        'lh',\n        'rlh',\n        'vw',\n        'vh',\n        'vi',\n        'vb',\n        'vmin',\n        'vmax',\n        'cm',\n        'mm',\n        'Q',\n        'in',\n        'pc',\n        'pt',\n        'px'\n      ],\n      fixed: [\n        'px',\n        'pt'\n      ],\n      relative: ['%'],\n      empty: ['']\n    };\n    var pattern = function () {\n      var decimalDigits = '[0-9]+';\n      var signedInteger = '[+-]?' + decimalDigits;\n      var exponentPart = '[eE]' + signedInteger;\n      var dot = '\\\\.';\n      var opt = function (input) {\n        return '(?:' + input + ')?';\n      };\n      var unsignedDecimalLiteral = [\n        'Infinity',\n        decimalDigits + dot + opt(decimalDigits) + opt(exponentPart),\n        dot + decimalDigits + opt(exponentPart),\n        decimalDigits + opt(exponentPart)\n      ].join('|');\n      var float = '[+-]?(?:' + unsignedDecimalLiteral + ')';\n      return new RegExp('^(' + float + ')(.*)$');\n    }();\n    var isUnit = function (unit, accepted) {\n      return exists(accepted, function (acc) {\n        return exists(units[acc], function (check) {\n          return unit === check;\n        });\n      });\n    };\n    var parse = function (input, accepted) {\n      var match = Optional.from(pattern.exec(input));\n      return match.bind(function (array) {\n        var value = Number(array[1]);\n        var unitRaw = array[2];\n        if (isUnit(unitRaw, accepted)) {\n          return Optional.some({\n            value: value,\n            unit: unitRaw\n          });\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n\n    var rPercentageBasedSizeRegex = /(\\d+(\\.\\d+)?)%/;\n    var rPixelBasedSizeRegex = /(\\d+(\\.\\d+)?)px|em/;\n    var isCol$2 = isTag('col');\n    var getPercentSize = function (elm, outerGetter, innerGetter) {\n      var relativeParent = parentElement(elm).getOrThunk(function () {\n        return getBody$1(owner(elm));\n      });\n      return outerGetter(elm) / innerGetter(relativeParent) * 100;\n    };\n    var setPixelWidth = function (cell, amount) {\n      set$1(cell, 'width', amount + 'px');\n    };\n    var setPercentageWidth = function (cell, amount) {\n      set$1(cell, 'width', amount + '%');\n    };\n    var setHeight = function (cell, amount) {\n      set$1(cell, 'height', amount + 'px');\n    };\n    var getHeightValue = function (cell) {\n      return getRuntime(cell) + 'px';\n    };\n    var convert = function (cell, number, getter, setter) {\n      var newSize = table(cell).map(function (table) {\n        var total = getter(table);\n        return Math.floor(number / 100 * total);\n      }).getOr(number);\n      setter(cell, newSize);\n      return newSize;\n    };\n    var normalizePixelSize = function (value, cell, getter, setter) {\n      var number = parseFloat(value);\n      return endsWith(value, '%') && name(cell) !== 'table' ? convert(cell, number, getter, setter) : number;\n    };\n    var getTotalHeight = function (cell) {\n      var value = getHeightValue(cell);\n      if (!value) {\n        return get$7(cell);\n      }\n      return normalizePixelSize(value, cell, get$7, setHeight);\n    };\n    var get$6 = function (cell, type, f) {\n      var v = f(cell);\n      var span = getSpan(cell, type);\n      return v / span;\n    };\n    var getRaw$1 = function (element, prop) {\n      return getRaw$2(element, prop).orThunk(function () {\n        return getOpt(element, prop).map(function (val) {\n          return val + 'px';\n        });\n      });\n    };\n    var getRawWidth$1 = function (element) {\n      return getRaw$1(element, 'width');\n    };\n    var getRawHeight = function (element) {\n      return getRaw$1(element, 'height');\n    };\n    var getPercentageWidth = function (cell) {\n      return getPercentSize(cell, get$8, getInner);\n    };\n    var getPixelWidth$1 = function (cell) {\n      return isCol$2(cell) ? get$8(cell) : getRuntime$1(cell);\n    };\n    var getHeight = function (cell) {\n      return get$6(cell, 'rowspan', getTotalHeight);\n    };\n    var getGenericWidth = function (cell) {\n      var width = getRawWidth$1(cell);\n      return width.bind(function (w) {\n        return parse(w, [\n          'fixed',\n          'relative',\n          'empty'\n        ]);\n      });\n    };\n    var setGenericWidth = function (cell, amount, unit) {\n      set$1(cell, 'width', amount + unit);\n    };\n    var getPixelTableWidth = function (table) {\n      return get$8(table) + 'px';\n    };\n    var getPercentTableWidth = function (table) {\n      return getPercentSize(table, get$8, getInner) + '%';\n    };\n    var isPercentSizing$1 = function (table) {\n      return getRawWidth$1(table).exists(function (size) {\n        return rPercentageBasedSizeRegex.test(size);\n      });\n    };\n    var isPixelSizing$1 = function (table) {\n      return getRawWidth$1(table).exists(function (size) {\n        return rPixelBasedSizeRegex.test(size);\n      });\n    };\n    var isNoneSizing$1 = function (table) {\n      return getRawWidth$1(table).isNone();\n    };\n    var percentageBasedSizeRegex = constant(rPercentageBasedSizeRegex);\n\n    var isCol$1 = isTag('col');\n    var getRawW = function (cell) {\n      return getRawWidth$1(cell).getOrThunk(function () {\n        return getPixelWidth$1(cell) + 'px';\n      });\n    };\n    var getRawH = function (cell) {\n      return getRawHeight(cell).getOrThunk(function () {\n        return getHeight(cell) + 'px';\n      });\n    };\n    var justCols = function (warehouse) {\n      return map$1(Warehouse.justColumns(warehouse), function (column) {\n        return Optional.from(column.element);\n      });\n    };\n    var isValidColumn = function (cell) {\n      var browser = detect$3().browser;\n      var supportsColWidths = browser.isChrome() || browser.isFirefox();\n      return isCol$1(cell) ? supportsColWidths : true;\n    };\n    var getDimension = function (cellOpt, index, backups, filter, getter, fallback) {\n      return cellOpt.filter(filter).fold(function () {\n        return fallback(deduce(backups, index));\n      }, function (cell) {\n        return getter(cell);\n      });\n    };\n    var getWidthFrom = function (warehouse, table, getWidth, fallback) {\n      var columnCells = columns(warehouse);\n      var columns$1 = Warehouse.hasColumns(warehouse) ? justCols(warehouse) : columnCells;\n      var backups = [Optional.some(width.edge(table))].concat(map$1(width.positions(columnCells, table), function (pos) {\n        return pos.map(function (p) {\n          return p.x;\n        });\n      }));\n      var colFilter = not(hasColspan);\n      return map$1(columns$1, function (cellOption, c) {\n        return getDimension(cellOption, c, backups, colFilter, function (column) {\n          if (isValidColumn(column)) {\n            return getWidth(column);\n          } else {\n            var cell = bindFrom(columnCells[c], identity);\n            return getDimension(cell, c, backups, colFilter, function (cell) {\n              return fallback(Optional.some(get$8(cell)));\n            }, fallback);\n          }\n        }, fallback);\n      });\n    };\n    var getDeduced = function (deduced) {\n      return deduced.map(function (d) {\n        return d + 'px';\n      }).getOr('');\n    };\n    var getRawWidths = function (warehouse, table) {\n      return getWidthFrom(warehouse, table, getRawW, getDeduced);\n    };\n    var getPercentageWidths = function (warehouse, table, tableSize) {\n      return getWidthFrom(warehouse, table, getPercentageWidth, function (deduced) {\n        return deduced.fold(function () {\n          return tableSize.minCellWidth();\n        }, function (cellWidth) {\n          return cellWidth / tableSize.pixelWidth() * 100;\n        });\n      });\n    };\n    var getPixelWidths = function (warehouse, table, tableSize) {\n      return getWidthFrom(warehouse, table, getPixelWidth$1, function (deduced) {\n        return deduced.getOrThunk(tableSize.minCellWidth);\n      });\n    };\n    var getHeightFrom = function (warehouse, table, direction, getHeight, fallback) {\n      var rows$1 = rows(warehouse);\n      var backups = [Optional.some(direction.edge(table))].concat(map$1(direction.positions(rows$1, table), function (pos) {\n        return pos.map(function (p) {\n          return p.y;\n        });\n      }));\n      return map$1(rows$1, function (cellOption, c) {\n        return getDimension(cellOption, c, backups, not(hasRowspan), getHeight, fallback);\n      });\n    };\n    var getPixelHeights = function (warehouse, table, direction) {\n      return getHeightFrom(warehouse, table, direction, getHeight, function (deduced) {\n        return deduced.getOrThunk(minHeight);\n      });\n    };\n    var getRawHeights = function (warehouse, table, direction) {\n      return getHeightFrom(warehouse, table, direction, getRawH, getDeduced);\n    };\n\n    var widthLookup = function (table, getter) {\n      return function () {\n        if (inBody(table)) {\n          return getter(table);\n        } else {\n          return parseFloat(getRaw$2(table, 'width').getOr('0'));\n        }\n      };\n    };\n    var noneSize = function (table) {\n      var getWidth = widthLookup(table, get$8);\n      var zero = constant(0);\n      var getWidths = function (warehouse, tableSize) {\n        return getPixelWidths(warehouse, table, tableSize);\n      };\n      return {\n        width: getWidth,\n        pixelWidth: getWidth,\n        getWidths: getWidths,\n        getCellDelta: zero,\n        singleColumnWidth: constant([0]),\n        minCellWidth: zero,\n        setElementWidth: noop,\n        adjustTableWidth: noop,\n        isRelative: true,\n        label: 'none'\n      };\n    };\n    var percentageSize = function (table) {\n      var getFloatWidth = widthLookup(table, function (elem) {\n        return parseFloat(getPercentTableWidth(elem));\n      });\n      var getWidth = widthLookup(table, get$8);\n      var getCellDelta = function (delta) {\n        return delta / getWidth() * 100;\n      };\n      var singleColumnWidth = function (w, _delta) {\n        return [100 - w];\n      };\n      var minCellWidth = function () {\n        return minWidth() / getWidth() * 100;\n      };\n      var adjustTableWidth = function (delta) {\n        var currentWidth = getFloatWidth();\n        var change = delta / 100 * currentWidth;\n        var newWidth = currentWidth + change;\n        setPercentageWidth(table, newWidth);\n      };\n      var getWidths = function (warehouse, tableSize) {\n        return getPercentageWidths(warehouse, table, tableSize);\n      };\n      return {\n        width: getFloatWidth,\n        pixelWidth: getWidth,\n        getWidths: getWidths,\n        getCellDelta: getCellDelta,\n        singleColumnWidth: singleColumnWidth,\n        minCellWidth: minCellWidth,\n        setElementWidth: setPercentageWidth,\n        adjustTableWidth: adjustTableWidth,\n        isRelative: true,\n        label: 'percent'\n      };\n    };\n    var pixelSize = function (table) {\n      var getWidth = widthLookup(table, get$8);\n      var getCellDelta = identity;\n      var singleColumnWidth = function (w, delta) {\n        var newNext = Math.max(minWidth(), w + delta);\n        return [newNext - w];\n      };\n      var adjustTableWidth = function (delta) {\n        var newWidth = getWidth() + delta;\n        setPixelWidth(table, newWidth);\n      };\n      var getWidths = function (warehouse, tableSize) {\n        return getPixelWidths(warehouse, table, tableSize);\n      };\n      return {\n        width: getWidth,\n        pixelWidth: getWidth,\n        getWidths: getWidths,\n        getCellDelta: getCellDelta,\n        singleColumnWidth: singleColumnWidth,\n        minCellWidth: minWidth,\n        setElementWidth: setPixelWidth,\n        adjustTableWidth: adjustTableWidth,\n        isRelative: false,\n        label: 'pixel'\n      };\n    };\n    var chooseSize = function (element, width) {\n      var percentMatch = percentageBasedSizeRegex().exec(width);\n      if (percentMatch !== null) {\n        return percentageSize(element);\n      } else {\n        return pixelSize(element);\n      }\n    };\n    var getTableSize = function (table) {\n      var width = getRawWidth$1(table);\n      return width.fold(function () {\n        return noneSize(table);\n      }, function (w) {\n        return chooseSize(table, w);\n      });\n    };\n    var TableSize = {\n      getTableSize: getTableSize,\n      pixelSize: pixelSize,\n      percentageSize: percentageSize,\n      noneSize: noneSize\n    };\n\n    var statsStruct = function (minRow, minCol, maxRow, maxCol, allCells, selectedCells) {\n      return {\n        minRow: minRow,\n        minCol: minCol,\n        maxRow: maxRow,\n        maxCol: maxCol,\n        allCells: allCells,\n        selectedCells: selectedCells\n      };\n    };\n    var findSelectedStats = function (house, isSelected) {\n      var totalColumns = house.grid.columns;\n      var totalRows = house.grid.rows;\n      var minRow = totalRows;\n      var minCol = totalColumns;\n      var maxRow = 0;\n      var maxCol = 0;\n      var allCells = [];\n      var selectedCells = [];\n      each$1(house.access, function (detail) {\n        allCells.push(detail);\n        if (isSelected(detail)) {\n          selectedCells.push(detail);\n          var startRow = detail.row;\n          var endRow = startRow + detail.rowspan - 1;\n          var startCol = detail.column;\n          var endCol = startCol + detail.colspan - 1;\n          if (startRow < minRow) {\n            minRow = startRow;\n          } else if (endRow > maxRow) {\n            maxRow = endRow;\n          }\n          if (startCol < minCol) {\n            minCol = startCol;\n          } else if (endCol > maxCol) {\n            maxCol = endCol;\n          }\n        }\n      });\n      return statsStruct(minRow, minCol, maxRow, maxCol, allCells, selectedCells);\n    };\n    var makeCell = function (list, seenSelected, rowIndex) {\n      var row = list[rowIndex].element;\n      var td = SugarElement.fromTag('td');\n      append$1(td, SugarElement.fromTag('br'));\n      var f = seenSelected ? append$1 : prepend;\n      f(row, td);\n    };\n    var fillInGaps = function (list, house, stats, isSelected) {\n      var totalColumns = house.grid.columns;\n      var totalRows = house.grid.rows;\n      for (var i = 0; i < totalRows; i++) {\n        var seenSelected = false;\n        for (var j = 0; j < totalColumns; j++) {\n          if (!(i < stats.minRow || i > stats.maxRow || j < stats.minCol || j > stats.maxCol)) {\n            var needCell = Warehouse.getAt(house, i, j).filter(isSelected).isNone();\n            if (needCell) {\n              makeCell(list, seenSelected, i);\n            } else {\n              seenSelected = true;\n            }\n          }\n        }\n      }\n    };\n    var clean = function (replica, stats, house, widthDelta) {\n      each$1(house.columns, function (col) {\n        if (col.column < stats.minCol || col.column > stats.maxCol) {\n          remove$5(col.element);\n        }\n      });\n      var emptyRows = filter$2(firstLayer(replica, 'tr'), function (row) {\n        return row.dom.childElementCount === 0;\n      });\n      each$2(emptyRows, remove$5);\n      if (stats.minCol === stats.maxCol || stats.minRow === stats.maxRow) {\n        each$2(firstLayer(replica, 'th,td'), function (cell) {\n          remove$7(cell, 'rowspan');\n          remove$7(cell, 'colspan');\n        });\n      }\n      remove$7(replica, LOCKED_COL_ATTR);\n      remove$7(replica, 'data-snooker-col-series');\n      var tableSize = TableSize.getTableSize(replica);\n      tableSize.adjustTableWidth(widthDelta);\n    };\n    var getTableWidthDelta = function (table, warehouse, tableSize, stats) {\n      if (stats.minCol === 0 && warehouse.grid.columns === stats.maxCol + 1) {\n        return 0;\n      }\n      var colWidths = getPixelWidths(warehouse, table, tableSize);\n      var allColsWidth = foldl(colWidths, function (acc, width) {\n        return acc + width;\n      }, 0);\n      var selectedColsWidth = foldl(colWidths.slice(stats.minCol, stats.maxCol + 1), function (acc, width) {\n        return acc + width;\n      }, 0);\n      var newWidth = selectedColsWidth / allColsWidth * tableSize.pixelWidth();\n      var delta = newWidth - tableSize.pixelWidth();\n      return tableSize.getCellDelta(delta);\n    };\n    var extract$1 = function (table, selectedSelector) {\n      var isSelected = function (detail) {\n        return is$2(detail.element, selectedSelector);\n      };\n      var replica = deep(table);\n      var list = fromTable$1(replica);\n      var tableSize = TableSize.getTableSize(table);\n      var replicaHouse = Warehouse.generate(list);\n      var replicaStats = findSelectedStats(replicaHouse, isSelected);\n      var selector = 'th:not(' + selectedSelector + ')' + ',td:not(' + selectedSelector + ')';\n      var unselectedCells = filterFirstLayer(replica, 'th,td', function (cell) {\n        return is$2(cell, selector);\n      });\n      each$2(unselectedCells, remove$5);\n      fillInGaps(list, replicaHouse, replicaStats, isSelected);\n      var house = Warehouse.fromTable(table);\n      var widthDelta = getTableWidthDelta(table, house, tableSize, replicaStats);\n      clean(replica, replicaStats, replicaHouse, widthDelta);\n      return replica;\n    };\n\n    var nbsp = '\\xA0';\n\n    var getEnd = function (element) {\n      return name(element) === 'img' ? 1 : getOption(element).fold(function () {\n        return children$3(element).length;\n      }, function (v) {\n        return v.length;\n      });\n    };\n    var isTextNodeWithCursorPosition = function (el) {\n      return getOption(el).filter(function (text) {\n        return text.trim().length !== 0 || text.indexOf(nbsp) > -1;\n      }).isSome();\n    };\n    var elementsWithCursorPosition = [\n      'img',\n      'br'\n    ];\n    var isCursorPosition = function (elem) {\n      var hasCursorPosition = isTextNodeWithCursorPosition(elem);\n      return hasCursorPosition || contains$2(elementsWithCursorPosition, name(elem));\n    };\n\n    var first = function (element) {\n      return descendant$1(element, isCursorPosition);\n    };\n    var last$1 = function (element) {\n      return descendantRtl(element, isCursorPosition);\n    };\n    var descendantRtl = function (scope, predicate) {\n      var descend = function (element) {\n        var children = children$3(element);\n        for (var i = children.length - 1; i >= 0; i--) {\n          var child = children[i];\n          if (predicate(child)) {\n            return Optional.some(child);\n          }\n          var res = descend(child);\n          if (res.isSome()) {\n            return res;\n          }\n        }\n        return Optional.none();\n      };\n      return descend(scope);\n    };\n\n    var transferableAttributes = {\n      scope: [\n        'row',\n        'col'\n      ]\n    };\n    var createCell = function (doc) {\n      return function () {\n        var td = SugarElement.fromTag('td', doc.dom);\n        append$1(td, SugarElement.fromTag('br', doc.dom));\n        return td;\n      };\n    };\n    var createCol = function (doc) {\n      return function () {\n        return SugarElement.fromTag('col', doc.dom);\n      };\n    };\n    var createColgroup = function (doc) {\n      return function () {\n        return SugarElement.fromTag('colgroup', doc.dom);\n      };\n    };\n    var createRow$1 = function (doc) {\n      return function () {\n        return SugarElement.fromTag('tr', doc.dom);\n      };\n    };\n    var replace$1 = function (cell, tag, attrs) {\n      var replica = copy$1(cell, tag);\n      each$1(attrs, function (v, k) {\n        if (v === null) {\n          remove$7(replica, k);\n        } else {\n          set$2(replica, k, v);\n        }\n      });\n      return replica;\n    };\n    var pasteReplace = function (cell) {\n      return cell;\n    };\n    var cloneFormats = function (oldCell, newCell, formats) {\n      var first$1 = first(oldCell);\n      return first$1.map(function (firstText) {\n        var formatSelector = formats.join(',');\n        var parents = ancestors$3(firstText, formatSelector, function (element) {\n          return eq$1(element, oldCell);\n        });\n        return foldr(parents, function (last, parent) {\n          var clonedFormat = shallow(parent);\n          remove$7(clonedFormat, 'contenteditable');\n          append$1(last, clonedFormat);\n          return clonedFormat;\n        }, newCell);\n      }).getOr(newCell);\n    };\n    var cloneAppropriateAttributes = function (original, clone) {\n      each$1(transferableAttributes, function (validAttributes, attributeName) {\n        return getOpt(original, attributeName).filter(function (attribute) {\n          return contains$2(validAttributes, attribute);\n        }).each(function (attribute) {\n          return set$2(clone, attributeName, attribute);\n        });\n      });\n    };\n    var cellOperations = function (mutate, doc, formatsToClone) {\n      var cloneCss = function (prev, clone) {\n        copy$2(prev.element, clone);\n        remove$6(clone, 'height');\n        if (prev.colspan !== 1) {\n          remove$6(clone, 'width');\n        }\n      };\n      var newCell = function (prev) {\n        var td = SugarElement.fromTag(name(prev.element), doc.dom);\n        var formats = formatsToClone.getOr([\n          'strong',\n          'em',\n          'b',\n          'i',\n          'span',\n          'font',\n          'h1',\n          'h2',\n          'h3',\n          'h4',\n          'h5',\n          'h6',\n          'p',\n          'div'\n        ]);\n        var lastNode = formats.length > 0 ? cloneFormats(prev.element, td, formats) : td;\n        append$1(lastNode, SugarElement.fromTag('br'));\n        cloneCss(prev, td);\n        cloneAppropriateAttributes(prev.element, td);\n        mutate(prev.element, td);\n        return td;\n      };\n      var newCol = function (prev) {\n        var col = SugarElement.fromTag(name(prev.element), doc.dom);\n        cloneCss(prev, col);\n        mutate(prev.element, col);\n        return col;\n      };\n      return {\n        col: newCol,\n        colgroup: createColgroup(doc),\n        row: createRow$1(doc),\n        cell: newCell,\n        replace: replace$1,\n        colGap: createCol(doc),\n        gap: createCell(doc)\n      };\n    };\n    var paste$1 = function (doc) {\n      return {\n        col: createCol(doc),\n        colgroup: createColgroup(doc),\n        row: createRow$1(doc),\n        cell: createCell(doc),\n        replace: pasteReplace,\n        colGap: createCol(doc),\n        gap: createCell(doc)\n      };\n    };\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      return children$3(SugarElement.fromDom(div));\n    };\n    var fromDom = function (nodes) {\n      return map$1(nodes, SugarElement.fromDom);\n    };\n\n    var getNodeName = function (elm) {\n      return elm.nodeName.toLowerCase();\n    };\n    var getBody = function (editor) {\n      return SugarElement.fromDom(editor.getBody());\n    };\n    var getPixelWidth = function (elm) {\n      return elm.getBoundingClientRect().width;\n    };\n    var getPixelHeight = function (elm) {\n      return elm.getBoundingClientRect().height;\n    };\n    var getIsRoot = function (editor) {\n      return function (element) {\n        return eq$1(element, getBody(editor));\n      };\n    };\n    var removePxSuffix = function (size) {\n      return size ? size.replace(/px$/, '') : '';\n    };\n    var addPxSuffix = function (size) {\n      return /^\\d+(\\.\\d+)?$/.test(size) ? size + 'px' : size;\n    };\n    var removeDataStyle = function (table) {\n      remove$7(table, 'data-mce-style');\n      var removeStyleAttribute = function (element) {\n        return remove$7(element, 'data-mce-style');\n      };\n      each$2(cells$1(table), removeStyleAttribute);\n      each$2(columns$1(table), removeStyleAttribute);\n      each$2(rows$1(table), removeStyleAttribute);\n    };\n    var getRawWidth = function (editor, elm) {\n      var raw = editor.dom.getStyle(elm, 'width') || editor.dom.getAttrib(elm, 'width');\n      return Optional.from(raw).filter(isNotEmpty);\n    };\n    var isPercentage$1 = function (value) {\n      return /^(\\d+(\\.\\d+)?)%$/.test(value);\n    };\n    var isPixel = function (value) {\n      return /^(\\d+(\\.\\d+)?)px$/.test(value);\n    };\n    var getSelectionStart = function (editor) {\n      return SugarElement.fromDom(editor.selection.getStart());\n    };\n    var getSelectionEnd = function (editor) {\n      return SugarElement.fromDom(editor.selection.getEnd());\n    };\n\n    var selection = function (selections) {\n      return cata$2(selections.get(), constant([]), identity, pure);\n    };\n    var unmergable = function (selections) {\n      var hasSpan = function (elem, type) {\n        return getOpt(elem, type).exists(function (span) {\n          return parseInt(span, 10) > 1;\n        });\n      };\n      var hasRowOrColSpan = function (elem) {\n        return hasSpan(elem, 'rowspan') || hasSpan(elem, 'colspan');\n      };\n      var candidates = selection(selections);\n      return candidates.length > 0 && forall(candidates, hasRowOrColSpan) ? Optional.some(candidates) : Optional.none();\n    };\n    var mergable = function (table, selections, ephemera) {\n      return cata$2(selections.get(), Optional.none, function (cells) {\n        if (cells.length <= 1) {\n          return Optional.none();\n        } else {\n          return retrieveBox(table, ephemera.firstSelectedSelector, ephemera.lastSelectedSelector).map(function (bounds) {\n            return {\n              bounds: bounds,\n              cells: cells\n            };\n          });\n        }\n      }, Optional.none);\n    };\n\n    var strSelected = 'data-mce-selected';\n    var strSelectedSelector = 'td[' + strSelected + '],th[' + strSelected + ']';\n    var strAttributeSelector = '[' + strSelected + ']';\n    var strFirstSelected = 'data-mce-first-selected';\n    var strFirstSelectedSelector = 'td[' + strFirstSelected + '],th[' + strFirstSelected + ']';\n    var strLastSelected = 'data-mce-last-selected';\n    var strLastSelectedSelector = 'td[' + strLastSelected + '],th[' + strLastSelected + ']';\n    var attributeSelector = strAttributeSelector;\n    var ephemera = {\n      selected: strSelected,\n      selectedSelector: strSelectedSelector,\n      firstSelected: strFirstSelected,\n      firstSelectedSelector: strFirstSelectedSelector,\n      lastSelected: strLastSelected,\n      lastSelectedSelector: strLastSelectedSelector\n    };\n\n    var noMenu = function (cell) {\n      return {\n        element: cell,\n        mergable: Optional.none(),\n        unmergable: Optional.none(),\n        selection: [cell]\n      };\n    };\n    var forMenu = function (selections, table, cell) {\n      return {\n        element: cell,\n        mergable: mergable(table, selections, ephemera),\n        unmergable: unmergable(selections),\n        selection: selection(selections)\n      };\n    };\n    var paste = function (element, clipboard, generators) {\n      return {\n        element: element,\n        clipboard: clipboard,\n        generators: generators\n      };\n    };\n    var pasteRows = function (selections, cell, clipboard, generators) {\n      return {\n        selection: selection(selections),\n        clipboard: clipboard,\n        generators: generators\n      };\n    };\n\n    var getSelectionCellFallback = function (element) {\n      return table(element).bind(function (table) {\n        return retrieve(table, ephemera.firstSelectedSelector);\n      }).fold(constant(element), function (cells) {\n        return cells[0];\n      });\n    };\n    var getSelectionFromSelector = function (selector) {\n      return function (initCell, isRoot) {\n        var cellName = name(initCell);\n        var cell = cellName === 'col' || cellName === 'colgroup' ? getSelectionCellFallback(initCell) : initCell;\n        return closest$1(cell, selector, isRoot);\n      };\n    };\n    var getSelectionCellOrCaption = getSelectionFromSelector('th,td,caption');\n    var getSelectionCell = getSelectionFromSelector('th,td');\n    var getCellsFromSelection = function (selections) {\n      return selection(selections);\n    };\n    var getRowsFromSelection = function (selected, selector) {\n      var cellOpt = getSelectionCell(selected);\n      var rowsOpt = cellOpt.bind(function (cell) {\n        return table(cell);\n      }).map(function (table) {\n        return rows$1(table);\n      });\n      return lift2(cellOpt, rowsOpt, function (cell, rows) {\n        return filter$2(rows, function (row) {\n          return exists(fromDom(row.dom.cells), function (rowCell) {\n            return get$b(rowCell, selector) === '1' || eq$1(rowCell, cell);\n          });\n        });\n      }).getOr([]);\n    };\n\n    var extractSelected = function (cells) {\n      return table(cells[0]).map(function (table) {\n        var replica = extract$1(table, attributeSelector);\n        removeDataStyle(replica);\n        return [replica];\n      });\n    };\n    var serializeElements = function (editor, elements) {\n      return map$1(elements, function (elm) {\n        return editor.selection.serializer.serialize(elm.dom, {});\n      }).join('');\n    };\n    var getTextContent = function (elements) {\n      return map$1(elements, function (element) {\n        return element.dom.innerText;\n      }).join('');\n    };\n    var registerEvents = function (editor, selections, actions) {\n      editor.on('BeforeGetContent', function (e) {\n        var multiCellContext = function (cells) {\n          e.preventDefault();\n          extractSelected(cells).each(function (elements) {\n            e.content = e.format === 'text' ? getTextContent(elements) : serializeElements(editor, elements);\n          });\n        };\n        if (e.selection === true) {\n          cata$2(selections.get(), noop, multiCellContext, noop);\n        }\n      });\n      editor.on('BeforeSetContent', function (e) {\n        if (e.selection === true && e.paste === true) {\n          var selectedCells = getCellsFromSelection(selections);\n          head(selectedCells).each(function (cell) {\n            table(cell).each(function (table) {\n              var elements = filter$2(fromHtml(e.content), function (content) {\n                return name(content) !== 'meta';\n              });\n              var isTable = isTag('table');\n              if (elements.length === 1 && isTable(elements[0])) {\n                e.preventDefault();\n                var doc = SugarElement.fromDom(editor.getDoc());\n                var generators = paste$1(doc);\n                var targets = paste(cell, elements[0], generators);\n                actions.pasteCells(table, targets).each(function () {\n                  editor.focus();\n                });\n              }\n            });\n          });\n        }\n      });\n    };\n\n    var adt$7 = Adt.generate([\n      { none: [] },\n      { only: ['index'] },\n      {\n        left: [\n          'index',\n          'next'\n        ]\n      },\n      {\n        middle: [\n          'prev',\n          'index',\n          'next'\n        ]\n      },\n      {\n        right: [\n          'prev',\n          'index'\n        ]\n      }\n    ]);\n    var ColumnContext = __assign({}, adt$7);\n\n    var neighbours = function (input, index) {\n      if (input.length === 0) {\n        return ColumnContext.none();\n      }\n      if (input.length === 1) {\n        return ColumnContext.only(0);\n      }\n      if (index === 0) {\n        return ColumnContext.left(0, 1);\n      }\n      if (index === input.length - 1) {\n        return ColumnContext.right(index - 1, index);\n      }\n      if (index > 0 && index < input.length - 1) {\n        return ColumnContext.middle(index - 1, index, index + 1);\n      }\n      return ColumnContext.none();\n    };\n    var determine = function (input, column, step, tableSize, resize) {\n      var result = input.slice(0);\n      var context = neighbours(input, column);\n      var onNone = constant(map$1(result, constant(0)));\n      var onOnly = function (index) {\n        return tableSize.singleColumnWidth(result[index], step);\n      };\n      var onLeft = function (index, next) {\n        return resize.calcLeftEdgeDeltas(result, index, next, step, tableSize.minCellWidth(), tableSize.isRelative);\n      };\n      var onMiddle = function (prev, index, next) {\n        return resize.calcMiddleDeltas(result, prev, index, next, step, tableSize.minCellWidth(), tableSize.isRelative);\n      };\n      var onRight = function (prev, index) {\n        return resize.calcRightEdgeDeltas(result, prev, index, step, tableSize.minCellWidth(), tableSize.isRelative);\n      };\n      return context.fold(onNone, onOnly, onLeft, onMiddle, onRight);\n    };\n\n    var total = function (start, end, measures) {\n      var r = 0;\n      for (var i = start; i < end; i++) {\n        r += measures[i] !== undefined ? measures[i] : 0;\n      }\n      return r;\n    };\n    var recalculateWidthForCells = function (warehouse, widths) {\n      var all = Warehouse.justCells(warehouse);\n      return map$1(all, function (cell) {\n        var width = total(cell.column, cell.column + cell.colspan, widths);\n        return {\n          element: cell.element,\n          width: width,\n          colspan: cell.colspan\n        };\n      });\n    };\n    var recalculateWidthForColumns = function (warehouse, widths) {\n      var groups = Warehouse.justColumns(warehouse);\n      return map$1(groups, function (column, index) {\n        return {\n          element: column.element,\n          width: widths[index],\n          colspan: column.colspan\n        };\n      });\n    };\n    var recalculateHeightForCells = function (warehouse, heights) {\n      var all = Warehouse.justCells(warehouse);\n      return map$1(all, function (cell) {\n        var height = total(cell.row, cell.row + cell.rowspan, heights);\n        return {\n          element: cell.element,\n          height: height,\n          rowspan: cell.rowspan\n        };\n      });\n    };\n    var matchRowHeight = function (warehouse, heights) {\n      return map$1(warehouse.all, function (row, i) {\n        return {\n          element: row.element,\n          height: heights[i]\n        };\n      });\n    };\n\n    var sumUp = function (newSize) {\n      return foldr(newSize, function (b, a) {\n        return b + a;\n      }, 0);\n    };\n    var recalculate = function (warehouse, widths) {\n      if (Warehouse.hasColumns(warehouse)) {\n        return recalculateWidthForColumns(warehouse, widths);\n      } else {\n        return recalculateWidthForCells(warehouse, widths);\n      }\n    };\n    var recalculateAndApply = function (warehouse, widths, tableSize) {\n      var newSizes = recalculate(warehouse, widths);\n      each$2(newSizes, function (cell) {\n        tableSize.setElementWidth(cell.element, cell.width);\n      });\n    };\n    var adjustWidth = function (table, delta, index, resizing, tableSize) {\n      var warehouse = Warehouse.fromTable(table);\n      var step = tableSize.getCellDelta(delta);\n      var widths = tableSize.getWidths(warehouse, tableSize);\n      var isLastColumn = index === warehouse.grid.columns - 1;\n      var clampedStep = resizing.clampTableDelta(widths, index, step, tableSize.minCellWidth(), isLastColumn);\n      var deltas = determine(widths, index, clampedStep, tableSize, resizing);\n      var newWidths = map$1(deltas, function (dx, i) {\n        return dx + widths[i];\n      });\n      recalculateAndApply(warehouse, newWidths, tableSize);\n      resizing.resizeTable(tableSize.adjustTableWidth, clampedStep, isLastColumn);\n    };\n    var adjustHeight = function (table, delta, index, direction) {\n      var warehouse = Warehouse.fromTable(table);\n      var heights = getPixelHeights(warehouse, table, direction);\n      var newHeights = map$1(heights, function (dy, i) {\n        return index === i ? Math.max(delta + dy, minHeight()) : dy;\n      });\n      var newCellSizes = recalculateHeightForCells(warehouse, newHeights);\n      var newRowSizes = matchRowHeight(warehouse, newHeights);\n      each$2(newRowSizes, function (row) {\n        setHeight(row.element, row.height);\n      });\n      each$2(newCellSizes, function (cell) {\n        setHeight(cell.element, cell.height);\n      });\n      var total = sumUp(newHeights);\n      setHeight(table, total);\n    };\n    var adjustAndRedistributeWidths$1 = function (_table, list, details, tableSize, resizeBehaviour) {\n      var warehouse = Warehouse.generate(list);\n      var sizes = tableSize.getWidths(warehouse, tableSize);\n      var tablePixelWidth = tableSize.pixelWidth();\n      var _a = resizeBehaviour.calcRedestributedWidths(sizes, tablePixelWidth, details.pixelDelta, tableSize.isRelative), newSizes = _a.newSizes, delta = _a.delta;\n      recalculateAndApply(warehouse, newSizes, tableSize);\n      tableSize.adjustTableWidth(delta);\n    };\n    var adjustWidthTo = function (_table, list, _info, tableSize) {\n      var warehouse = Warehouse.generate(list);\n      var widths = tableSize.getWidths(warehouse, tableSize);\n      recalculateAndApply(warehouse, widths, tableSize);\n    };\n\n    var zero = function (array) {\n      return map$1(array, constant(0));\n    };\n    var surround = function (sizes, startIndex, endIndex, results, f) {\n      return f(sizes.slice(0, startIndex)).concat(results).concat(f(sizes.slice(endIndex)));\n    };\n    var clampDeltaHelper = function (predicate) {\n      return function (sizes, index, delta, minCellSize) {\n        if (!predicate(delta)) {\n          return delta;\n        } else {\n          var newSize = Math.max(minCellSize, sizes[index] - Math.abs(delta));\n          var diff = Math.abs(newSize - sizes[index]);\n          return delta >= 0 ? diff : -diff;\n        }\n      };\n    };\n    var clampNegativeDelta = clampDeltaHelper(function (delta) {\n      return delta < 0;\n    });\n    var clampDelta = clampDeltaHelper(always);\n    var resizeTable = function () {\n      var calcFixedDeltas = function (sizes, index, next, delta, minCellSize) {\n        var clampedDelta = clampNegativeDelta(sizes, index, delta, minCellSize);\n        return surround(sizes, index, next + 1, [\n          clampedDelta,\n          0\n        ], zero);\n      };\n      var calcRelativeDeltas = function (sizes, index, delta, minCellSize) {\n        var ratio = (100 + delta) / 100;\n        var newThis = Math.max(minCellSize, (sizes[index] + delta) / ratio);\n        return map$1(sizes, function (size, idx) {\n          var newSize = idx === index ? newThis : size / ratio;\n          return newSize - size;\n        });\n      };\n      var calcLeftEdgeDeltas = function (sizes, index, next, delta, minCellSize, isRelative) {\n        if (isRelative) {\n          return calcRelativeDeltas(sizes, index, delta, minCellSize);\n        } else {\n          return calcFixedDeltas(sizes, index, next, delta, minCellSize);\n        }\n      };\n      var calcMiddleDeltas = function (sizes, _prev, index, next, delta, minCellSize, isRelative) {\n        return calcLeftEdgeDeltas(sizes, index, next, delta, minCellSize, isRelative);\n      };\n      var resizeTable = function (resizer, delta) {\n        return resizer(delta);\n      };\n      var calcRightEdgeDeltas = function (sizes, _prev, index, delta, minCellSize, isRelative) {\n        if (isRelative) {\n          return calcRelativeDeltas(sizes, index, delta, minCellSize);\n        } else {\n          var clampedDelta = clampNegativeDelta(sizes, index, delta, minCellSize);\n          return zero(sizes.slice(0, index)).concat([clampedDelta]);\n        }\n      };\n      var calcRedestributedWidths = function (sizes, totalWidth, pixelDelta, isRelative) {\n        if (isRelative) {\n          var tableWidth = totalWidth + pixelDelta;\n          var ratio_1 = tableWidth / totalWidth;\n          var newSizes = map$1(sizes, function (size) {\n            return size / ratio_1;\n          });\n          return {\n            delta: ratio_1 * 100 - 100,\n            newSizes: newSizes\n          };\n        } else {\n          return {\n            delta: pixelDelta,\n            newSizes: sizes\n          };\n        }\n      };\n      return {\n        resizeTable: resizeTable,\n        clampTableDelta: clampNegativeDelta,\n        calcLeftEdgeDeltas: calcLeftEdgeDeltas,\n        calcMiddleDeltas: calcMiddleDeltas,\n        calcRightEdgeDeltas: calcRightEdgeDeltas,\n        calcRedestributedWidths: calcRedestributedWidths\n      };\n    };\n    var preserveTable = function () {\n      var calcLeftEdgeDeltas = function (sizes, index, next, delta, minCellSize) {\n        var idx = delta >= 0 ? next : index;\n        var clampedDelta = clampDelta(sizes, idx, delta, minCellSize);\n        return surround(sizes, index, next + 1, [\n          clampedDelta,\n          -clampedDelta\n        ], zero);\n      };\n      var calcMiddleDeltas = function (sizes, _prev, index, next, delta, minCellSize) {\n        return calcLeftEdgeDeltas(sizes, index, next, delta, minCellSize);\n      };\n      var resizeTable = function (resizer, delta, isLastColumn) {\n        if (isLastColumn) {\n          resizer(delta);\n        }\n      };\n      var calcRightEdgeDeltas = function (sizes, _prev, _index, delta, _minCellSize, isRelative) {\n        if (isRelative) {\n          return zero(sizes);\n        } else {\n          var diff = delta / sizes.length;\n          return map$1(sizes, constant(diff));\n        }\n      };\n      var clampTableDelta = function (sizes, index, delta, minCellSize, isLastColumn) {\n        if (isLastColumn) {\n          if (delta >= 0) {\n            return delta;\n          } else {\n            var maxDelta = foldl(sizes, function (a, b) {\n              return a + b - minCellSize;\n            }, 0);\n            return Math.max(-maxDelta, delta);\n          }\n        } else {\n          return clampNegativeDelta(sizes, index, delta, minCellSize);\n        }\n      };\n      var calcRedestributedWidths = function (sizes, _totalWidth, _pixelDelta, _isRelative) {\n        return {\n          delta: 0,\n          newSizes: sizes\n        };\n      };\n      return {\n        resizeTable: resizeTable,\n        clampTableDelta: clampTableDelta,\n        calcLeftEdgeDeltas: calcLeftEdgeDeltas,\n        calcMiddleDeltas: calcMiddleDeltas,\n        calcRightEdgeDeltas: calcRightEdgeDeltas,\n        calcRedestributedWidths: calcRedestributedWidths\n      };\n    };\n\n    var only = function (element, isResizable) {\n      var parent = Optional.from(element.dom.documentElement).map(SugarElement.fromDom).getOr(element);\n      return {\n        parent: constant(parent),\n        view: constant(element),\n        origin: constant(SugarPosition(0, 0)),\n        isResizable: isResizable\n      };\n    };\n    var detached = function (editable, chrome, isResizable) {\n      var origin = function () {\n        return absolute(chrome);\n      };\n      return {\n        parent: constant(chrome),\n        view: constant(editable),\n        origin: origin,\n        isResizable: isResizable\n      };\n    };\n    var body = function (editable, chrome, isResizable) {\n      return {\n        parent: constant(chrome),\n        view: constant(editable),\n        origin: constant(SugarPosition(0, 0)),\n        isResizable: isResizable\n      };\n    };\n    var ResizeWire = {\n      only: only,\n      detached: detached,\n      body: body\n    };\n\n    var adt$6 = Adt.generate([\n      { invalid: ['raw'] },\n      { pixels: ['value'] },\n      { percent: ['value'] }\n    ]);\n    var validateFor = function (suffix, type, value) {\n      var rawAmount = value.substring(0, value.length - suffix.length);\n      var amount = parseFloat(rawAmount);\n      return rawAmount === amount.toString() ? type(amount) : adt$6.invalid(value);\n    };\n    var from = function (value) {\n      if (endsWith(value, '%')) {\n        return validateFor('%', adt$6.percent, value);\n      }\n      if (endsWith(value, 'px')) {\n        return validateFor('px', adt$6.pixels, value);\n      }\n      return adt$6.invalid(value);\n    };\n    var Size = __assign(__assign({}, adt$6), { from: from });\n\n    var redistributeToPercent = function (widths, totalWidth) {\n      return map$1(widths, function (w) {\n        var colType = Size.from(w);\n        return colType.fold(function () {\n          return w;\n        }, function (px) {\n          var ratio = px / totalWidth * 100;\n          return ratio + '%';\n        }, function (pc) {\n          return pc + '%';\n        });\n      });\n    };\n    var redistributeToPx = function (widths, totalWidth, newTotalWidth) {\n      var scale = newTotalWidth / totalWidth;\n      return map$1(widths, function (w) {\n        var colType = Size.from(w);\n        return colType.fold(function () {\n          return w;\n        }, function (px) {\n          return px * scale + 'px';\n        }, function (pc) {\n          return pc / 100 * newTotalWidth + 'px';\n        });\n      });\n    };\n    var redistributeEmpty = function (newWidthType, columns) {\n      var f = newWidthType.fold(function () {\n        return constant('');\n      }, function (pixels) {\n        var num = pixels / columns;\n        return constant(num + 'px');\n      }, function () {\n        var num = 100 / columns;\n        return constant(num + '%');\n      });\n      return range$1(columns, f);\n    };\n    var redistributeValues = function (newWidthType, widths, totalWidth) {\n      return newWidthType.fold(function () {\n        return widths;\n      }, function (px) {\n        return redistributeToPx(widths, totalWidth, px);\n      }, function (_pc) {\n        return redistributeToPercent(widths, totalWidth);\n      });\n    };\n    var redistribute$1 = function (widths, totalWidth, newWidth) {\n      var newType = Size.from(newWidth);\n      var floats = forall(widths, function (s) {\n        return s === '0px';\n      }) ? redistributeEmpty(newType, widths.length) : redistributeValues(newType, widths, totalWidth);\n      return normalize(floats);\n    };\n    var sum = function (values, fallback) {\n      if (values.length === 0) {\n        return fallback;\n      }\n      return foldr(values, function (rest, v) {\n        return Size.from(v).fold(constant(0), identity, identity) + rest;\n      }, 0);\n    };\n    var roundDown = function (num, unit) {\n      var floored = Math.floor(num);\n      return {\n        value: floored + unit,\n        remainder: num - floored\n      };\n    };\n    var add$3 = function (value, amount) {\n      return Size.from(value).fold(constant(value), function (px) {\n        return px + amount + 'px';\n      }, function (pc) {\n        return pc + amount + '%';\n      });\n    };\n    var normalize = function (values) {\n      if (values.length === 0) {\n        return values;\n      }\n      var scan = foldr(values, function (rest, value) {\n        var info = Size.from(value).fold(function () {\n          return {\n            value: value,\n            remainder: 0\n          };\n        }, function (num) {\n          return roundDown(num, 'px');\n        }, function (num) {\n          return {\n            value: num + '%',\n            remainder: 0\n          };\n        });\n        return {\n          output: [info.value].concat(rest.output),\n          remainder: rest.remainder + info.remainder\n        };\n      }, {\n        output: [],\n        remainder: 0\n      });\n      var r = scan.output;\n      return r.slice(0, r.length - 1).concat([add$3(r[r.length - 1], Math.round(scan.remainder))]);\n    };\n    var validate = Size.from;\n\n    var redistributeToW = function (newWidths, cells, unit) {\n      each$2(cells, function (cell) {\n        var widths = newWidths.slice(cell.column, cell.colspan + cell.column);\n        var w = sum(widths, minWidth());\n        set$1(cell.element, 'width', w + unit);\n      });\n    };\n    var redistributeToColumns = function (newWidths, columns, unit) {\n      each$2(columns, function (column, index) {\n        var width = sum([newWidths[index]], minWidth());\n        set$1(column.element, 'width', width + unit);\n      });\n    };\n    var redistributeToH = function (newHeights, rows, cells, unit) {\n      each$2(cells, function (cell) {\n        var heights = newHeights.slice(cell.row, cell.rowspan + cell.row);\n        var h = sum(heights, minHeight());\n        set$1(cell.element, 'height', h + unit);\n      });\n      each$2(rows, function (row, i) {\n        set$1(row.element, 'height', newHeights[i]);\n      });\n    };\n    var getUnit = function (newSize) {\n      return validate(newSize).fold(constant('px'), constant('px'), constant('%'));\n    };\n    var redistribute = function (table, optWidth, optHeight) {\n      var warehouse = Warehouse.fromTable(table);\n      var rows = warehouse.all;\n      var cells = Warehouse.justCells(warehouse);\n      var columns = Warehouse.justColumns(warehouse);\n      optWidth.each(function (newWidth) {\n        var widthUnit = getUnit(newWidth);\n        var totalWidth = get$8(table);\n        var oldWidths = getRawWidths(warehouse, table);\n        var nuWidths = redistribute$1(oldWidths, totalWidth, newWidth);\n        if (Warehouse.hasColumns(warehouse)) {\n          redistributeToColumns(nuWidths, columns, widthUnit);\n        } else {\n          redistributeToW(nuWidths, cells, widthUnit);\n        }\n        set$1(table, 'width', newWidth);\n      });\n      optHeight.each(function (newHeight) {\n        var hUnit = getUnit(newHeight);\n        var totalHeight = get$7(table);\n        var oldHeights = getRawHeights(warehouse, table, height);\n        var nuHeights = redistribute$1(oldHeights, totalHeight, newHeight);\n        redistributeToH(nuHeights, rows, cells, hUnit);\n        set$1(table, 'height', newHeight);\n      });\n    };\n    var isPercentSizing = isPercentSizing$1;\n    var isPixelSizing = isPixelSizing$1;\n    var isNoneSizing = isNoneSizing$1;\n\n    var getGridSize = function (table) {\n      var warehouse = Warehouse.fromTable(table);\n      return warehouse.grid;\n    };\n\n    var Event = function (fields) {\n      var handlers = [];\n      var bind = function (handler) {\n        if (handler === undefined) {\n          throw new Error('Event bind error: undefined handler');\n        }\n        handlers.push(handler);\n      };\n      var unbind = function (handler) {\n        handlers = filter$2(handlers, function (h) {\n          return h !== handler;\n        });\n      };\n      var trigger = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        var event = {};\n        each$2(fields, function (name, i) {\n          event[name] = args[i];\n        });\n        each$2(handlers, function (handler) {\n          handler(event);\n        });\n      };\n      return {\n        bind: bind,\n        unbind: unbind,\n        trigger: trigger\n      };\n    };\n\n    var create$4 = function (typeDefs) {\n      var registry = map(typeDefs, function (event) {\n        return {\n          bind: event.bind,\n          unbind: event.unbind\n        };\n      });\n      var trigger = map(typeDefs, function (event) {\n        return event.trigger;\n      });\n      return {\n        registry: registry,\n        trigger: trigger\n      };\n    };\n\n    var last = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        cancel();\n        timer = setTimeout(function () {\n          timer = null;\n          fn.apply(null, args);\n        }, rate);\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n\n    var sort = function (arr) {\n      return arr.slice(0).sort();\n    };\n    var reqMessage = function (required, keys) {\n      throw new Error('All required keys (' + sort(required).join(', ') + ') were not specified. Specified keys were: ' + sort(keys).join(', ') + '.');\n    };\n    var unsuppMessage = function (unsupported) {\n      throw new Error('Unsupported keys for object: ' + sort(unsupported).join(', '));\n    };\n    var validateStrArr = function (label, array) {\n      if (!isArray(array)) {\n        throw new Error('The ' + label + ' fields must be an array. Was: ' + array + '.');\n      }\n      each$2(array, function (a) {\n        if (!isString(a)) {\n          throw new Error('The value ' + a + ' in the ' + label + ' fields was not a string.');\n        }\n      });\n    };\n    var invalidTypeMessage = function (incorrect, type) {\n      throw new Error('All values need to be of type: ' + type + '. Keys (' + sort(incorrect).join(', ') + ') were not.');\n    };\n    var checkDupes = function (everything) {\n      var sorted = sort(everything);\n      var dupe = find$1(sorted, function (s, i) {\n        return i < sorted.length - 1 && s === sorted[i + 1];\n      });\n      dupe.each(function (d) {\n        throw new Error('The field: ' + d + ' occurs more than once in the combined fields: [' + sorted.join(', ') + '].');\n      });\n    };\n\n    var base = function (handleUnsupported, required) {\n      return baseWith(handleUnsupported, required, {\n        validate: isFunction,\n        label: 'function'\n      });\n    };\n    var baseWith = function (handleUnsupported, required, pred) {\n      if (required.length === 0) {\n        throw new Error('You must specify at least one required field.');\n      }\n      validateStrArr('required', required);\n      checkDupes(required);\n      return function (obj) {\n        var keys$1 = keys(obj);\n        var allReqd = forall(required, function (req) {\n          return contains$2(keys$1, req);\n        });\n        if (!allReqd) {\n          reqMessage(required, keys$1);\n        }\n        handleUnsupported(required, keys$1);\n        var invalidKeys = filter$2(required, function (key) {\n          return !pred.validate(obj[key], key);\n        });\n        if (invalidKeys.length > 0) {\n          invalidTypeMessage(invalidKeys, pred.label);\n        }\n        return obj;\n      };\n    };\n    var handleExact = function (required, keys) {\n      var unsupported = filter$2(keys, function (key) {\n        return !contains$2(required, key);\n      });\n      if (unsupported.length > 0) {\n        unsuppMessage(unsupported);\n      }\n    };\n    var exactly = function (required) {\n      return base(handleExact, required);\n    };\n\n    var DragMode = exactly([\n      'compare',\n      'extract',\n      'mutate',\n      'sink'\n    ]);\n    var DragSink = exactly([\n      'element',\n      'start',\n      'stop',\n      'destroy'\n    ]);\n    var DragApi = exactly([\n      'forceDrop',\n      'drop',\n      'move',\n      'delayDrop'\n    ]);\n\n    var InDrag = function () {\n      var previous = Optional.none();\n      var reset = function () {\n        previous = Optional.none();\n      };\n      var update = function (mode, nu) {\n        var result = previous.map(function (old) {\n          return mode.compare(old, nu);\n        });\n        previous = Optional.some(nu);\n        return result;\n      };\n      var onEvent = function (event, mode) {\n        var dataOption = mode.extract(event);\n        dataOption.each(function (data) {\n          var offset = update(mode, data);\n          offset.each(function (d) {\n            events.trigger.move(d);\n          });\n        });\n      };\n      var events = create$4({ move: Event(['info']) });\n      return {\n        onEvent: onEvent,\n        reset: reset,\n        events: events.registry\n      };\n    };\n\n    var NoDrag = function () {\n      var events = create$4({ move: Event(['info']) });\n      return {\n        onEvent: noop,\n        reset: noop,\n        events: events.registry\n      };\n    };\n\n    var Movement = function () {\n      var noDragState = NoDrag();\n      var inDragState = InDrag();\n      var dragState = noDragState;\n      var on = function () {\n        dragState.reset();\n        dragState = inDragState;\n      };\n      var off = function () {\n        dragState.reset();\n        dragState = noDragState;\n      };\n      var onEvent = function (event, mode) {\n        dragState.onEvent(event, mode);\n      };\n      var isOn = function () {\n        return dragState === inDragState;\n      };\n      return {\n        on: on,\n        off: off,\n        isOn: isOn,\n        onEvent: onEvent,\n        events: inDragState.events\n      };\n    };\n\n    var setup = function (mutation, mode, settings) {\n      var active = false;\n      var events = create$4({\n        start: Event([]),\n        stop: Event([])\n      });\n      var movement = Movement();\n      var drop = function () {\n        sink.stop();\n        if (movement.isOn()) {\n          movement.off();\n          events.trigger.stop();\n        }\n      };\n      var throttledDrop = last(drop, 200);\n      var go = function (parent) {\n        sink.start(parent);\n        movement.on();\n        events.trigger.start();\n      };\n      var mousemove = function (event) {\n        throttledDrop.cancel();\n        movement.onEvent(event, mode);\n      };\n      movement.events.move.bind(function (event) {\n        mode.mutate(mutation, event.info);\n      });\n      var on = function () {\n        active = true;\n      };\n      var off = function () {\n        active = false;\n      };\n      var runIfActive = function (f) {\n        return function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          if (active) {\n            f.apply(null, args);\n          }\n        };\n      };\n      var sink = mode.sink(DragApi({\n        forceDrop: drop,\n        drop: runIfActive(drop),\n        move: runIfActive(mousemove),\n        delayDrop: runIfActive(throttledDrop.throttle)\n      }), settings);\n      var destroy = function () {\n        sink.destroy();\n      };\n      return {\n        element: sink.element,\n        go: go,\n        on: on,\n        off: off,\n        destroy: destroy,\n        events: events.registry\n      };\n    };\n\n    var mkEvent = function (target, x, y, stop, prevent, kill, raw) {\n      return {\n        target: target,\n        x: x,\n        y: y,\n        stop: stop,\n        prevent: prevent,\n        kill: kill,\n        raw: raw\n      };\n    };\n    var fromRawEvent$1 = function (rawEvent) {\n      var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));\n      var stop = function () {\n        return rawEvent.stopPropagation();\n      };\n      var prevent = function () {\n        return rawEvent.preventDefault();\n      };\n      var kill = compose(prevent, stop);\n      return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);\n    };\n    var handle$2 = function (filter, handler) {\n      return function (rawEvent) {\n        if (filter(rawEvent)) {\n          handler(fromRawEvent$1(rawEvent));\n        }\n      };\n    };\n    var binder = function (element, event, filter, handler, useCapture) {\n      var wrapped = handle$2(filter, handler);\n      element.dom.addEventListener(event, wrapped, useCapture);\n      return { unbind: curry(unbind, element, event, wrapped, useCapture) };\n    };\n    var bind$1 = function (element, event, filter, handler) {\n      return binder(element, event, filter, handler, false);\n    };\n    var unbind = function (element, event, handler, useCapture) {\n      element.dom.removeEventListener(event, handler, useCapture);\n    };\n\n    var filter = always;\n    var bind = function (element, event, handler) {\n      return bind$1(element, event, filter, handler);\n    };\n    var fromRawEvent = fromRawEvent$1;\n\n    var read = function (element, attr) {\n      var value = get$b(element, attr);\n      return value === undefined || value === '' ? [] : value.split(' ');\n    };\n    var add$2 = function (element, attr, id) {\n      var old = read(element, attr);\n      var nu = old.concat([id]);\n      set$2(element, attr, nu.join(' '));\n      return true;\n    };\n    var remove$4 = function (element, attr, id) {\n      var nu = filter$2(read(element, attr), function (v) {\n        return v !== id;\n      });\n      if (nu.length > 0) {\n        set$2(element, attr, nu.join(' '));\n      } else {\n        remove$7(element, attr);\n      }\n      return false;\n    };\n\n    var supports = function (element) {\n      return element.dom.classList !== undefined;\n    };\n    var get$5 = function (element) {\n      return read(element, 'class');\n    };\n    var add$1 = function (element, clazz) {\n      return add$2(element, 'class', clazz);\n    };\n    var remove$3 = function (element, clazz) {\n      return remove$4(element, 'class', clazz);\n    };\n\n    var add = function (element, clazz) {\n      if (supports(element)) {\n        element.dom.classList.add(clazz);\n      } else {\n        add$1(element, clazz);\n      }\n    };\n    var cleanClass = function (element) {\n      var classList = supports(element) ? element.dom.classList : get$5(element);\n      if (classList.length === 0) {\n        remove$7(element, 'class');\n      }\n    };\n    var remove$2 = function (element, clazz) {\n      if (supports(element)) {\n        var classList = element.dom.classList;\n        classList.remove(clazz);\n      } else {\n        remove$3(element, clazz);\n      }\n      cleanClass(element);\n    };\n    var has = function (element, clazz) {\n      return supports(element) && element.dom.classList.contains(clazz);\n    };\n\n    var css = function (namespace) {\n      var dashNamespace = namespace.replace(/\\./g, '-');\n      var resolve = function (str) {\n        return dashNamespace + '-' + str;\n      };\n      return { resolve: resolve };\n    };\n\n    var styles$1 = css('ephox-dragster');\n    var resolve$1 = styles$1.resolve;\n\n    var Blocker = function (options) {\n      var settings = __assign({ layerClass: resolve$1('blocker') }, options);\n      var div = SugarElement.fromTag('div');\n      set$2(div, 'role', 'presentation');\n      setAll(div, {\n        position: 'fixed',\n        left: '0px',\n        top: '0px',\n        width: '100%',\n        height: '100%'\n      });\n      add(div, resolve$1('blocker'));\n      add(div, settings.layerClass);\n      var element = constant(div);\n      var destroy = function () {\n        remove$5(div);\n      };\n      return {\n        element: element,\n        destroy: destroy\n      };\n    };\n\n    var compare = function (old, nu) {\n      return SugarPosition(nu.left - old.left, nu.top - old.top);\n    };\n    var extract = function (event) {\n      return Optional.some(SugarPosition(event.x, event.y));\n    };\n    var mutate = function (mutation, info) {\n      mutation.mutate(info.left, info.top);\n    };\n    var sink = function (dragApi, settings) {\n      var blocker = Blocker(settings);\n      var mdown = bind(blocker.element(), 'mousedown', dragApi.forceDrop);\n      var mup = bind(blocker.element(), 'mouseup', dragApi.drop);\n      var mmove = bind(blocker.element(), 'mousemove', dragApi.move);\n      var mout = bind(blocker.element(), 'mouseout', dragApi.delayDrop);\n      var destroy = function () {\n        blocker.destroy();\n        mup.unbind();\n        mmove.unbind();\n        mout.unbind();\n        mdown.unbind();\n      };\n      var start = function (parent) {\n        append$1(parent, blocker.element());\n      };\n      var stop = function () {\n        remove$5(blocker.element());\n      };\n      return DragSink({\n        element: blocker.element,\n        start: start,\n        stop: stop,\n        destroy: destroy\n      });\n    };\n    var MouseDrag = DragMode({\n      compare: compare,\n      extract: extract,\n      sink: sink,\n      mutate: mutate\n    });\n\n    var transform$1 = function (mutation, settings) {\n      if (settings === void 0) {\n        settings = {};\n      }\n      var mode = settings.mode !== undefined ? settings.mode : MouseDrag;\n      return setup(mutation, mode, settings);\n    };\n\n    var closest = function (target) {\n      return closest$1(target, '[contenteditable]');\n    };\n    var isEditable$1 = function (element, assumeEditable) {\n      if (assumeEditable === void 0) {\n        assumeEditable = false;\n      }\n      if (!detect$3().browser.isIE() && inBody(element)) {\n        return element.dom.isContentEditable;\n      } else {\n        return closest(element).fold(constant(assumeEditable), function (editable) {\n          return getRaw(editable) === 'true';\n        });\n      }\n    };\n    var getRaw = function (element) {\n      return element.dom.contentEditable;\n    };\n\n    var styles = css('ephox-snooker');\n    var resolve = styles.resolve;\n\n    var Mutation = function () {\n      var events = create$4({\n        drag: Event([\n          'xDelta',\n          'yDelta'\n        ])\n      });\n      var mutate = function (x, y) {\n        events.trigger.drag(x, y);\n      };\n      return {\n        mutate: mutate,\n        events: events.registry\n      };\n    };\n\n    var BarMutation = function () {\n      var events = create$4({\n        drag: Event([\n          'xDelta',\n          'yDelta',\n          'target'\n        ])\n      });\n      var target = Optional.none();\n      var delegate = Mutation();\n      delegate.events.drag.bind(function (event) {\n        target.each(function (t) {\n          events.trigger.drag(event.xDelta, event.yDelta, t);\n        });\n      });\n      var assign = function (t) {\n        target = Optional.some(t);\n      };\n      var get = function () {\n        return target;\n      };\n      return {\n        assign: assign,\n        get: get,\n        mutate: delegate.mutate,\n        events: events.registry\n      };\n    };\n\n    var col = function (column, x, y, w, h) {\n      var bar = SugarElement.fromTag('div');\n      setAll(bar, {\n        position: 'absolute',\n        left: x - w / 2 + 'px',\n        top: y + 'px',\n        height: h + 'px',\n        width: w + 'px'\n      });\n      setAll$1(bar, {\n        'data-column': column,\n        'role': 'presentation'\n      });\n      return bar;\n    };\n    var row = function (r, x, y, w, h) {\n      var bar = SugarElement.fromTag('div');\n      setAll(bar, {\n        position: 'absolute',\n        left: x + 'px',\n        top: y - h / 2 + 'px',\n        height: h + 'px',\n        width: w + 'px'\n      });\n      setAll$1(bar, {\n        'data-row': r,\n        'role': 'presentation'\n      });\n      return bar;\n    };\n\n    var resizeBar = resolve('resizer-bar');\n    var resizeRowBar = resolve('resizer-rows');\n    var resizeColBar = resolve('resizer-cols');\n    var BAR_THICKNESS = 7;\n    var resizableRows = function (warehouse, isResizable) {\n      return bind$2(warehouse.all, function (row, i) {\n        return isResizable(row.element) ? [i] : [];\n      });\n    };\n    var resizableColumns = function (warehouse, isResizable) {\n      var resizableCols = [];\n      range$1(warehouse.grid.columns, function (index) {\n        var colElmOpt = Warehouse.getColumnAt(warehouse, index).map(function (col) {\n          return col.element;\n        });\n        if (colElmOpt.forall(isResizable)) {\n          resizableCols.push(index);\n        }\n      });\n      return filter$2(resizableCols, function (colIndex) {\n        var columnCells = Warehouse.filterItems(warehouse, function (cell) {\n          return cell.column === colIndex;\n        });\n        return forall(columnCells, function (cell) {\n          return isResizable(cell.element);\n        });\n      });\n    };\n    var destroy = function (wire) {\n      var previous = descendants(wire.parent(), '.' + resizeBar);\n      each$2(previous, remove$5);\n    };\n    var drawBar = function (wire, positions, create) {\n      var origin = wire.origin();\n      each$2(positions, function (cpOption) {\n        cpOption.each(function (cp) {\n          var bar = create(origin, cp);\n          add(bar, resizeBar);\n          append$1(wire.parent(), bar);\n        });\n      });\n    };\n    var refreshCol = function (wire, colPositions, position, tableHeight) {\n      drawBar(wire, colPositions, function (origin, cp) {\n        var colBar = col(cp.col, cp.x - origin.left, position.top - origin.top, BAR_THICKNESS, tableHeight);\n        add(colBar, resizeColBar);\n        return colBar;\n      });\n    };\n    var refreshRow = function (wire, rowPositions, position, tableWidth) {\n      drawBar(wire, rowPositions, function (origin, cp) {\n        var rowBar = row(cp.row, position.left - origin.left, cp.y - origin.top, tableWidth, BAR_THICKNESS);\n        add(rowBar, resizeRowBar);\n        return rowBar;\n      });\n    };\n    var refreshGrid = function (warhouse, wire, table, rows, cols) {\n      var position = absolute(table);\n      var isResizable = wire.isResizable;\n      var rowPositions = rows.length > 0 ? height.positions(rows, table) : [];\n      var resizableRowBars = rowPositions.length > 0 ? resizableRows(warhouse, isResizable) : [];\n      var resizableRowPositions = filter$2(rowPositions, function (_pos, i) {\n        return exists(resizableRowBars, function (barIndex) {\n          return i === barIndex;\n        });\n      });\n      refreshRow(wire, resizableRowPositions, position, getOuter$2(table));\n      var colPositions = cols.length > 0 ? width.positions(cols, table) : [];\n      var resizableColBars = colPositions.length > 0 ? resizableColumns(warhouse, isResizable) : [];\n      var resizableColPositions = filter$2(colPositions, function (_pos, i) {\n        return exists(resizableColBars, function (barIndex) {\n          return i === barIndex;\n        });\n      });\n      refreshCol(wire, resizableColPositions, position, getOuter$1(table));\n    };\n    var refresh = function (wire, table) {\n      destroy(wire);\n      if (wire.isResizable(table)) {\n        var warehouse = Warehouse.fromTable(table);\n        var rows$1 = rows(warehouse);\n        var cols = columns(warehouse);\n        refreshGrid(warehouse, wire, table, rows$1, cols);\n      }\n    };\n    var each = function (wire, f) {\n      var bars = descendants(wire.parent(), '.' + resizeBar);\n      each$2(bars, f);\n    };\n    var hide = function (wire) {\n      each(wire, function (bar) {\n        set$1(bar, 'display', 'none');\n      });\n    };\n    var show = function (wire) {\n      each(wire, function (bar) {\n        set$1(bar, 'display', 'block');\n      });\n    };\n    var isRowBar = function (element) {\n      return has(element, resizeRowBar);\n    };\n    var isColBar = function (element) {\n      return has(element, resizeColBar);\n    };\n\n    var resizeBarDragging = resolve('resizer-bar-dragging');\n    var BarManager = function (wire) {\n      var mutation = BarMutation();\n      var resizing = transform$1(mutation, {});\n      var hoverTable = Optional.none();\n      var getResizer = function (element, type) {\n        return Optional.from(get$b(element, type));\n      };\n      mutation.events.drag.bind(function (event) {\n        getResizer(event.target, 'data-row').each(function (_dataRow) {\n          var currentRow = getCssValue(event.target, 'top');\n          set$1(event.target, 'top', currentRow + event.yDelta + 'px');\n        });\n        getResizer(event.target, 'data-column').each(function (_dataCol) {\n          var currentCol = getCssValue(event.target, 'left');\n          set$1(event.target, 'left', currentCol + event.xDelta + 'px');\n        });\n      });\n      var getDelta = function (target, dir) {\n        var newX = getCssValue(target, dir);\n        var oldX = getAttrValue(target, 'data-initial-' + dir, 0);\n        return newX - oldX;\n      };\n      resizing.events.stop.bind(function () {\n        mutation.get().each(function (target) {\n          hoverTable.each(function (table) {\n            getResizer(target, 'data-row').each(function (row) {\n              var delta = getDelta(target, 'top');\n              remove$7(target, 'data-initial-top');\n              events.trigger.adjustHeight(table, delta, parseInt(row, 10));\n            });\n            getResizer(target, 'data-column').each(function (column) {\n              var delta = getDelta(target, 'left');\n              remove$7(target, 'data-initial-left');\n              events.trigger.adjustWidth(table, delta, parseInt(column, 10));\n            });\n            refresh(wire, table);\n          });\n        });\n      });\n      var handler = function (target, dir) {\n        events.trigger.startAdjust();\n        mutation.assign(target);\n        set$2(target, 'data-initial-' + dir, getCssValue(target, dir));\n        add(target, resizeBarDragging);\n        set$1(target, 'opacity', '0.2');\n        resizing.go(wire.parent());\n      };\n      var mousedown = bind(wire.parent(), 'mousedown', function (event) {\n        if (isRowBar(event.target)) {\n          handler(event.target, 'top');\n        }\n        if (isColBar(event.target)) {\n          handler(event.target, 'left');\n        }\n      });\n      var isRoot = function (e) {\n        return eq$1(e, wire.view());\n      };\n      var findClosestEditableTable = function (target) {\n        return closest$1(target, 'table', isRoot).filter(isEditable$1);\n      };\n      var mouseover = bind(wire.view(), 'mouseover', function (event) {\n        findClosestEditableTable(event.target).fold(function () {\n          if (inBody(event.target)) {\n            destroy(wire);\n          }\n        }, function (table) {\n          hoverTable = Optional.some(table);\n          refresh(wire, table);\n        });\n      });\n      var destroy$1 = function () {\n        mousedown.unbind();\n        mouseover.unbind();\n        resizing.destroy();\n        destroy(wire);\n      };\n      var refresh$1 = function (tbl) {\n        refresh(wire, tbl);\n      };\n      var events = create$4({\n        adjustHeight: Event([\n          'table',\n          'delta',\n          'row'\n        ]),\n        adjustWidth: Event([\n          'table',\n          'delta',\n          'column'\n        ]),\n        startAdjust: Event([])\n      });\n      return {\n        destroy: destroy$1,\n        refresh: refresh$1,\n        on: resizing.on,\n        off: resizing.off,\n        hideBars: curry(hide, wire),\n        showBars: curry(show, wire),\n        events: events.registry\n      };\n    };\n\n    var create$3 = function (wire, resizing, lazySizing) {\n      var hdirection = height;\n      var vdirection = width;\n      var manager = BarManager(wire);\n      var events = create$4({\n        beforeResize: Event([\n          'table',\n          'type'\n        ]),\n        afterResize: Event([\n          'table',\n          'type'\n        ]),\n        startDrag: Event([])\n      });\n      manager.events.adjustHeight.bind(function (event) {\n        var table = event.table;\n        events.trigger.beforeResize(table, 'row');\n        var delta = hdirection.delta(event.delta, table);\n        adjustHeight(table, delta, event.row, hdirection);\n        events.trigger.afterResize(table, 'row');\n      });\n      manager.events.startAdjust.bind(function (_event) {\n        events.trigger.startDrag();\n      });\n      manager.events.adjustWidth.bind(function (event) {\n        var table = event.table;\n        events.trigger.beforeResize(table, 'col');\n        var delta = vdirection.delta(event.delta, table);\n        var tableSize = lazySizing(table);\n        adjustWidth(table, delta, event.column, resizing, tableSize);\n        events.trigger.afterResize(table, 'col');\n      });\n      return {\n        on: manager.on,\n        off: manager.off,\n        hideBars: manager.hideBars,\n        showBars: manager.showBars,\n        destroy: manager.destroy,\n        events: events.registry\n      };\n    };\n    var TableResize = { create: create$3 };\n\n    var fireNewRow = function (editor, row) {\n      return editor.fire('newrow', { node: row });\n    };\n    var fireNewCell = function (editor, cell) {\n      return editor.fire('newcell', { node: cell });\n    };\n    var fireObjectResizeStart = function (editor, target, width, height, origin) {\n      editor.fire('ObjectResizeStart', {\n        target: target,\n        width: width,\n        height: height,\n        origin: origin\n      });\n    };\n    var fireObjectResized = function (editor, target, width, height, origin) {\n      editor.fire('ObjectResized', {\n        target: target,\n        width: width,\n        height: height,\n        origin: origin\n      });\n    };\n    var fireTableSelectionChange = function (editor, cells, start, finish, otherCells) {\n      editor.fire('TableSelectionChange', {\n        cells: cells,\n        start: start,\n        finish: finish,\n        otherCells: otherCells\n      });\n    };\n    var fireTableSelectionClear = function (editor) {\n      editor.fire('TableSelectionClear');\n    };\n    var fireTableModified = function (editor, table, data) {\n      editor.fire('TableModified', __assign(__assign({}, data), { table: table }));\n    };\n    var styleModified = {\n      structure: false,\n      style: true\n    };\n    var structureModified = {\n      structure: true,\n      style: false\n    };\n    var styleAndStructureModified = {\n      structure: true,\n      style: true\n    };\n\n    var defaultTableToolbar = 'tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol';\n    var defaultStyles = {\n      'border-collapse': 'collapse',\n      'width': '100%'\n    };\n    var defaultCellBorderWidths = range$1(5, function (i) {\n      var size = i + 1 + 'px';\n      return {\n        title: size,\n        value: size\n      };\n    });\n    var defaultCellBorderStyles = map$1([\n      'Solid',\n      'Dotted',\n      'Dashed',\n      'Double',\n      'Groove',\n      'Ridge',\n      'Inset',\n      'Outset',\n      'None',\n      'Hidden'\n    ], function (type) {\n      return {\n        title: type,\n        value: type.toLowerCase()\n      };\n    });\n    var determineDefaultStyles = function (editor) {\n      var _a;\n      if (isPixelsForced(editor)) {\n        var dom = editor.dom;\n        var parentBlock = (_a = dom.getParent(editor.selection.getStart(), dom.isBlock)) !== null && _a !== void 0 ? _a : editor.getBody();\n        var contentWidth = getInner(SugarElement.fromDom(parentBlock));\n        return __assign(__assign({}, defaultStyles), { width: contentWidth + 'px' });\n      } else if (isResponsiveForced(editor)) {\n        return filter$1(defaultStyles, function (_value, key) {\n          return key !== 'width';\n        });\n      } else {\n        return defaultStyles;\n      }\n    };\n    var defaultAttributes = { border: '1' };\n    var defaultColumnResizingBehaviour = 'preservetable';\n    var getTableSizingMode = function (editor) {\n      return editor.getParam('table_sizing_mode', 'auto');\n    };\n    var getTableResponseWidth = function (editor) {\n      return editor.getParam('table_responsive_width');\n    };\n    var getTableBorderWidths = function (editor) {\n      return editor.getParam('table_border_widths', defaultCellBorderWidths, 'array');\n    };\n    var getTableBorderStyles = function (editor) {\n      return editor.getParam('table_border_styles', defaultCellBorderStyles, 'array');\n    };\n    var getDefaultAttributes = function (editor) {\n      return editor.getParam('table_default_attributes', defaultAttributes, 'object');\n    };\n    var getDefaultStyles = function (editor) {\n      return editor.getParam('table_default_styles', determineDefaultStyles(editor), 'object');\n    };\n    var hasTableResizeBars = function (editor) {\n      return editor.getParam('table_resize_bars', true, 'boolean');\n    };\n    var hasTabNavigation = function (editor) {\n      return editor.getParam('table_tab_navigation', true, 'boolean');\n    };\n    var hasAdvancedCellTab = function (editor) {\n      return editor.getParam('table_cell_advtab', true, 'boolean');\n    };\n    var hasAdvancedRowTab = function (editor) {\n      return editor.getParam('table_row_advtab', true, 'boolean');\n    };\n    var hasAdvancedTableTab = function (editor) {\n      return editor.getParam('table_advtab', true, 'boolean');\n    };\n    var hasAppearanceOptions = function (editor) {\n      return editor.getParam('table_appearance_options', true, 'boolean');\n    };\n    var hasTableGrid = function (editor) {\n      return editor.getParam('table_grid', true, 'boolean');\n    };\n    var shouldStyleWithCss = function (editor) {\n      return editor.getParam('table_style_by_css', false, 'boolean');\n    };\n    var getCellClassList = function (editor) {\n      return editor.getParam('table_cell_class_list', [], 'array');\n    };\n    var getRowClassList = function (editor) {\n      return editor.getParam('table_row_class_list', [], 'array');\n    };\n    var getTableClassList = function (editor) {\n      return editor.getParam('table_class_list', [], 'array');\n    };\n    var isPercentagesForced = function (editor) {\n      return getTableSizingMode(editor) === 'relative' || getTableResponseWidth(editor) === true;\n    };\n    var isPixelsForced = function (editor) {\n      return getTableSizingMode(editor) === 'fixed' || getTableResponseWidth(editor) === false;\n    };\n    var isResponsiveForced = function (editor) {\n      return getTableSizingMode(editor) === 'responsive';\n    };\n    var getToolbar = function (editor) {\n      return editor.getParam('table_toolbar', defaultTableToolbar);\n    };\n    var useColumnGroup = function (editor) {\n      return editor.getParam('table_use_colgroups', false, 'boolean');\n    };\n    var getTableHeaderType = function (editor) {\n      var defaultValue = 'section';\n      var value = editor.getParam('table_header_type', defaultValue, 'string');\n      var validValues = [\n        'section',\n        'cells',\n        'sectionCells',\n        'auto'\n      ];\n      if (!contains$2(validValues, value)) {\n        return defaultValue;\n      } else {\n        return value;\n      }\n    };\n    var getColumnResizingBehaviour = function (editor) {\n      var validModes = [\n        'preservetable',\n        'resizetable'\n      ];\n      var givenMode = editor.getParam('table_column_resizing', defaultColumnResizingBehaviour, 'string');\n      return find$1(validModes, function (mode) {\n        return mode === givenMode;\n      }).getOr(defaultColumnResizingBehaviour);\n    };\n    var isPreserveTableColumnResizing = function (editor) {\n      return getColumnResizingBehaviour(editor) === 'preservetable';\n    };\n    var isResizeTableColumnResizing = function (editor) {\n      return getColumnResizingBehaviour(editor) === 'resizetable';\n    };\n    var getCloneElements = function (editor) {\n      var cloneElements = editor.getParam('table_clone_elements');\n      if (isString(cloneElements)) {\n        return Optional.some(cloneElements.split(/[ ,]/));\n      } else if (Array.isArray(cloneElements)) {\n        return Optional.some(cloneElements);\n      } else {\n        return Optional.none();\n      }\n    };\n    var hasObjectResizing = function (editor) {\n      var objectResizing = editor.getParam('object_resizing', true);\n      return isString(objectResizing) ? objectResizing === 'table' : objectResizing;\n    };\n    var getTableBackgroundColorMap = function (editor) {\n      return editor.getParam('table_background_color_map', [], 'array');\n    };\n    var getTableBorderColorMap = function (editor) {\n      return editor.getParam('table_border_color_map', [], 'array');\n    };\n\n    var get$4 = function (editor, table) {\n      if (isPercentagesForced(editor)) {\n        return TableSize.percentageSize(table);\n      } else if (isPixelsForced(editor)) {\n        return TableSize.pixelSize(table);\n      } else {\n        return TableSize.getTableSize(table);\n      }\n    };\n\n    var cleanupLegacyAttributes = function (element) {\n      remove$7(element, 'width');\n    };\n    var convertToPercentSize = function (table) {\n      var newWidth = getPercentTableWidth(table);\n      redistribute(table, Optional.some(newWidth), Optional.none());\n      cleanupLegacyAttributes(table);\n    };\n    var convertToPixelSize = function (table) {\n      var newWidth = getPixelTableWidth(table);\n      redistribute(table, Optional.some(newWidth), Optional.none());\n      cleanupLegacyAttributes(table);\n    };\n    var convertToNoneSize = function (table) {\n      remove$6(table, 'width');\n      var columns = columns$1(table);\n      var rowElements = columns.length > 0 ? columns : cells$1(table);\n      each$2(rowElements, function (cell) {\n        remove$6(cell, 'width');\n        cleanupLegacyAttributes(cell);\n      });\n      cleanupLegacyAttributes(table);\n    };\n\n    var enforcePercentage = convertToPercentSize;\n    var enforcePixels = convertToPixelSize;\n    var enforceNone = convertToNoneSize;\n    var syncPixels = function (table) {\n      var warehouse = Warehouse.fromTable(table);\n      if (!Warehouse.hasColumns(warehouse)) {\n        each$2(cells$1(table), function (cell) {\n          var computedWidth = get$a(cell, 'width');\n          set$1(cell, 'width', computedWidth);\n          remove$7(cell, 'width');\n        });\n      }\n    };\n\n    var createContainer = function () {\n      var container = SugarElement.fromTag('div');\n      setAll(container, {\n        position: 'static',\n        height: '0',\n        width: '0',\n        padding: '0',\n        margin: '0',\n        border: '0'\n      });\n      append$1(body$1(), container);\n      return container;\n    };\n    var get$3 = function (editor, isResizable) {\n      return editor.inline ? ResizeWire.body(getBody(editor), createContainer(), isResizable) : ResizeWire.only(SugarElement.fromDom(editor.getDoc()), isResizable);\n    };\n    var remove$1 = function (editor, wire) {\n      if (editor.inline) {\n        remove$5(wire.parent());\n      }\n    };\n\n    var barResizerPrefix = 'bar-';\n    var isResizable = function (elm) {\n      return get$b(elm, 'data-mce-resize') !== 'false';\n    };\n    var getResizeHandler = function (editor) {\n      var selectionRng = Optional.none();\n      var resize = Optional.none();\n      var wire = Optional.none();\n      var startW;\n      var startRawW;\n      var isTable = function (elm) {\n        return elm.nodeName === 'TABLE';\n      };\n      var lazyResize = function () {\n        return resize;\n      };\n      var lazyWire = function () {\n        return wire.getOr(ResizeWire.only(SugarElement.fromDom(editor.getBody()), isResizable));\n      };\n      var lazySizing = function (table) {\n        return get$4(editor, table);\n      };\n      var lazyResizingBehaviour = function () {\n        return isPreserveTableColumnResizing(editor) ? preserveTable() : resizeTable();\n      };\n      var getNumColumns = function (table) {\n        return getGridSize(table).columns;\n      };\n      var afterCornerResize = function (table, origin, width) {\n        var isRightEdgeResize = endsWith(origin, 'e');\n        if (startRawW === '') {\n          enforcePercentage(table);\n        }\n        if (width !== startW && startRawW !== '') {\n          set$1(table, 'width', startRawW);\n          var resizing = lazyResizingBehaviour();\n          var tableSize = lazySizing(table);\n          var col = isPreserveTableColumnResizing(editor) || isRightEdgeResize ? getNumColumns(table) - 1 : 0;\n          adjustWidth(table, width - startW, col, resizing, tableSize);\n        } else if (isPercentage$1(startRawW)) {\n          var percentW = parseFloat(startRawW.replace('%', ''));\n          var targetPercentW = width * percentW / startW;\n          set$1(table, 'width', targetPercentW + '%');\n        }\n        if (isPixel(startRawW)) {\n          syncPixels(table);\n        }\n      };\n      var destroy = function () {\n        resize.each(function (sz) {\n          sz.destroy();\n        });\n        wire.each(function (w) {\n          remove$1(editor, w);\n        });\n      };\n      editor.on('init', function () {\n        var rawWire = get$3(editor, isResizable);\n        wire = Optional.some(rawWire);\n        if (hasObjectResizing(editor) && hasTableResizeBars(editor)) {\n          var resizing = lazyResizingBehaviour();\n          var sz = TableResize.create(rawWire, resizing, lazySizing);\n          sz.on();\n          sz.events.startDrag.bind(function (_event) {\n            selectionRng = Optional.some(editor.selection.getRng());\n          });\n          sz.events.beforeResize.bind(function (event) {\n            var rawTable = event.table.dom;\n            fireObjectResizeStart(editor, rawTable, getPixelWidth(rawTable), getPixelHeight(rawTable), barResizerPrefix + event.type);\n          });\n          sz.events.afterResize.bind(function (event) {\n            var table = event.table;\n            var rawTable = table.dom;\n            removeDataStyle(table);\n            selectionRng.each(function (rng) {\n              editor.selection.setRng(rng);\n              editor.focus();\n            });\n            fireObjectResized(editor, rawTable, getPixelWidth(rawTable), getPixelHeight(rawTable), barResizerPrefix + event.type);\n            editor.undoManager.add();\n          });\n          resize = Optional.some(sz);\n        }\n      });\n      editor.on('ObjectResizeStart', function (e) {\n        var targetElm = e.target;\n        if (isTable(targetElm)) {\n          var table = SugarElement.fromDom(targetElm);\n          each$2(editor.dom.select('.mce-clonedresizable'), function (clone) {\n            editor.dom.addClass(clone, 'mce-' + getColumnResizingBehaviour(editor) + '-columns');\n          });\n          if (!isPixelSizing(table) && isPixelsForced(editor)) {\n            enforcePixels(table);\n          } else if (!isPercentSizing(table) && isPercentagesForced(editor)) {\n            enforcePercentage(table);\n          }\n          if (isNoneSizing(table) && startsWith(e.origin, barResizerPrefix)) {\n            enforcePercentage(table);\n          }\n          startW = e.width;\n          startRawW = isResponsiveForced(editor) ? '' : getRawWidth(editor, targetElm).getOr('');\n        }\n      });\n      editor.on('ObjectResized', function (e) {\n        var targetElm = e.target;\n        if (isTable(targetElm)) {\n          var table = SugarElement.fromDom(targetElm);\n          var origin_1 = e.origin;\n          if (startsWith(origin_1, 'corner-')) {\n            afterCornerResize(table, origin_1, e.width);\n          }\n          removeDataStyle(table);\n          fireTableModified(editor, table.dom, styleModified);\n        }\n      });\n      editor.on('SwitchMode', function () {\n        lazyResize().each(function (resize) {\n          if (editor.mode.isReadOnly()) {\n            resize.hideBars();\n          } else {\n            resize.showBars();\n          }\n        });\n      });\n      return {\n        lazyResize: lazyResize,\n        lazyWire: lazyWire,\n        destroy: destroy\n      };\n    };\n\n    var point = function (element, offset) {\n      return {\n        element: element,\n        offset: offset\n      };\n    };\n\n    var scan$1 = function (universe, element, direction) {\n      if (universe.property().isText(element) && universe.property().getText(element).trim().length === 0 || universe.property().isComment(element)) {\n        return direction(element).bind(function (elem) {\n          return scan$1(universe, elem, direction).orThunk(function () {\n            return Optional.some(elem);\n          });\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n    var toEnd = function (universe, element) {\n      if (universe.property().isText(element)) {\n        return universe.property().getText(element).length;\n      }\n      var children = universe.property().children(element);\n      return children.length;\n    };\n    var freefallRtl$2 = function (universe, element) {\n      var candidate = scan$1(universe, element, universe.query().prevSibling).getOr(element);\n      if (universe.property().isText(candidate)) {\n        return point(candidate, toEnd(universe, candidate));\n      }\n      var children = universe.property().children(candidate);\n      return children.length > 0 ? freefallRtl$2(universe, children[children.length - 1]) : point(candidate, toEnd(universe, candidate));\n    };\n\n    var freefallRtl$1 = freefallRtl$2;\n\n    var universe$2 = DomUniverse();\n    var freefallRtl = function (element) {\n      return freefallRtl$1(universe$2, element);\n    };\n\n    var halve = function (main, other) {\n      var colspan = getSpan(main, 'colspan');\n      if (colspan === 1) {\n        var width = getGenericWidth(main);\n        width.each(function (w) {\n          var newWidth = w.value / 2;\n          setGenericWidth(main, newWidth, w.unit);\n          setGenericWidth(other, newWidth, w.unit);\n        });\n      }\n    };\n\n    var isHeaderCell = isTag('th');\n    var isHeaderCells = function (cells) {\n      return forall(cells, function (cell) {\n        return isHeaderCell(cell.element);\n      });\n    };\n    var getRowHeaderType = function (isHeaderRow, isHeaderCells) {\n      if (isHeaderRow && isHeaderCells) {\n        return 'sectionCells';\n      } else if (isHeaderRow) {\n        return 'section';\n      } else {\n        return 'cells';\n      }\n    };\n    var getRowType$1 = function (row) {\n      var isHeaderRow = row.section === 'thead';\n      var isHeaderCells = is(findCommonCellType(row.cells), 'th');\n      if (isHeaderRow || isHeaderCells) {\n        return {\n          type: 'header',\n          subType: getRowHeaderType(isHeaderRow, isHeaderCells)\n        };\n      } else if (row.section === 'tfoot') {\n        return { type: 'footer' };\n      } else {\n        return { type: 'body' };\n      }\n    };\n    var findCommonCellType = function (cells) {\n      var headerCells = filter$2(cells, function (cell) {\n        return isHeaderCell(cell.element);\n      });\n      if (headerCells.length === 0) {\n        return Optional.some('td');\n      } else if (headerCells.length === cells.length) {\n        return Optional.some('th');\n      } else {\n        return Optional.none();\n      }\n    };\n    var findCommonRowType = function (rows) {\n      var rowTypes = map$1(rows, function (row) {\n        return getRowType$1(row).type;\n      });\n      var hasHeader = contains$2(rowTypes, 'header');\n      var hasFooter = contains$2(rowTypes, 'footer');\n      if (!hasHeader && !hasFooter) {\n        return Optional.some('body');\n      } else {\n        var hasBody = contains$2(rowTypes, 'body');\n        if (hasHeader && !hasBody && !hasFooter) {\n          return Optional.some('header');\n        } else if (!hasHeader && !hasBody && hasFooter) {\n          return Optional.some('footer');\n        } else {\n          return Optional.none();\n        }\n      }\n    };\n    var findTableRowHeaderType = function (warehouse) {\n      return findMap(warehouse.all, function (row) {\n        var rowType = getRowType$1(row);\n        return rowType.type === 'header' ? Optional.from(rowType.subType) : Optional.none();\n      });\n    };\n\n    var transformCell = function (cell, comparator, substitution) {\n      return elementnew(substitution(cell.element, comparator), true, cell.isLocked);\n    };\n    var transformRow = function (row, section) {\n      return row.section !== section ? rowcells(row.element, row.cells, section, row.isNew) : row;\n    };\n    var section = function () {\n      return {\n        transformRow: transformRow,\n        transformCell: function (cell, comparator, substitution) {\n          var newCell = substitution(cell.element, comparator);\n          var fixedCell = name(newCell) !== 'td' ? mutate$1(newCell, 'td') : newCell;\n          return elementnew(fixedCell, cell.isNew, cell.isLocked);\n        }\n      };\n    };\n    var sectionCells = function () {\n      return {\n        transformRow: transformRow,\n        transformCell: transformCell\n      };\n    };\n    var cells = function () {\n      return {\n        transformRow: function (row, section) {\n          var newSection = section === 'thead' ? 'tbody' : section;\n          return transformRow(row, newSection);\n        },\n        transformCell: transformCell\n      };\n    };\n    var fallback = function () {\n      return {\n        transformRow: identity,\n        transformCell: transformCell\n      };\n    };\n    var getTableSectionType = function (table, fallback) {\n      var warehouse = Warehouse.fromTable(table);\n      var type = findTableRowHeaderType(warehouse).getOr(fallback);\n      switch (type) {\n      case 'section':\n        return section();\n      case 'sectionCells':\n        return sectionCells();\n      case 'cells':\n        return cells();\n      }\n    };\n    var TableSection = {\n      getTableSectionType: getTableSectionType,\n      section: section,\n      sectionCells: sectionCells,\n      cells: cells,\n      fallback: fallback\n    };\n\n    var setIfNot = function (element, property, value, ignore) {\n      if (value === ignore) {\n        remove$7(element, property);\n      } else {\n        set$2(element, property, value);\n      }\n    };\n    var insert$1 = function (table, selector, element) {\n      last$2(children$1(table, selector)).fold(function () {\n        return prepend(table, element);\n      }, function (child) {\n        return after$5(child, element);\n      });\n    };\n    var generateSection = function (table, sectionName) {\n      var section = child$1(table, sectionName).getOrThunk(function () {\n        var newSection = SugarElement.fromTag(sectionName, owner(table).dom);\n        if (sectionName === 'thead') {\n          insert$1(table, 'caption,colgroup', newSection);\n        } else if (sectionName === 'colgroup') {\n          insert$1(table, 'caption', newSection);\n        } else {\n          append$1(table, newSection);\n        }\n        return newSection;\n      });\n      empty(section);\n      return section;\n    };\n    var render$1 = function (table, grid) {\n      var newRows = [];\n      var newCells = [];\n      var syncRows = function (gridSection) {\n        return map$1(gridSection, function (row) {\n          if (row.isNew) {\n            newRows.push(row.element);\n          }\n          var tr = row.element;\n          empty(tr);\n          each$2(row.cells, function (cell) {\n            if (cell.isNew) {\n              newCells.push(cell.element);\n            }\n            setIfNot(cell.element, 'colspan', cell.colspan, 1);\n            setIfNot(cell.element, 'rowspan', cell.rowspan, 1);\n            append$1(tr, cell.element);\n          });\n          return tr;\n        });\n      };\n      var syncColGroup = function (gridSection) {\n        return bind$2(gridSection, function (colGroup) {\n          return map$1(colGroup.cells, function (col) {\n            setIfNot(col.element, 'span', col.colspan, 1);\n            return col.element;\n          });\n        });\n      };\n      var renderSection = function (gridSection, sectionName) {\n        var section = generateSection(table, sectionName);\n        var sync = sectionName === 'colgroup' ? syncColGroup : syncRows;\n        var sectionElems = sync(gridSection);\n        append(section, sectionElems);\n      };\n      var removeSection = function (sectionName) {\n        child$1(table, sectionName).each(remove$5);\n      };\n      var renderOrRemoveSection = function (gridSection, sectionName) {\n        if (gridSection.length > 0) {\n          renderSection(gridSection, sectionName);\n        } else {\n          removeSection(sectionName);\n        }\n      };\n      var headSection = [];\n      var bodySection = [];\n      var footSection = [];\n      var columnGroupsSection = [];\n      each$2(grid, function (row) {\n        switch (row.section) {\n        case 'thead':\n          headSection.push(row);\n          break;\n        case 'tbody':\n          bodySection.push(row);\n          break;\n        case 'tfoot':\n          footSection.push(row);\n          break;\n        case 'colgroup':\n          columnGroupsSection.push(row);\n          break;\n        }\n      });\n      renderOrRemoveSection(columnGroupsSection, 'colgroup');\n      renderOrRemoveSection(headSection, 'thead');\n      renderOrRemoveSection(bodySection, 'tbody');\n      renderOrRemoveSection(footSection, 'tfoot');\n      return {\n        newRows: newRows,\n        newCells: newCells\n      };\n    };\n    var copy = function (grid) {\n      return map$1(grid, function (row) {\n        var tr = shallow(row.element);\n        each$2(row.cells, function (cell) {\n          var clonedCell = deep(cell.element);\n          setIfNot(clonedCell, 'colspan', cell.colspan, 1);\n          setIfNot(clonedCell, 'rowspan', cell.rowspan, 1);\n          append$1(tr, clonedCell);\n        });\n        return tr;\n      });\n    };\n\n    var getColumn = function (grid, index) {\n      return map$1(grid, function (row) {\n        return getCell(row, index);\n      });\n    };\n    var getRow = function (grid, index) {\n      return grid[index];\n    };\n    var findDiff = function (xs, comp) {\n      if (xs.length === 0) {\n        return 0;\n      }\n      var first = xs[0];\n      var index = findIndex(xs, function (x) {\n        return !comp(first.element, x.element);\n      });\n      return index.getOr(xs.length);\n    };\n    var subgrid = function (grid, row, column, comparator) {\n      var gridRow = getRow(grid, row);\n      var isColRow = gridRow.section === 'colgroup';\n      var colspan = findDiff(gridRow.cells.slice(column), comparator);\n      var rowspan = isColRow ? 1 : findDiff(getColumn(grid.slice(row), column), comparator);\n      return {\n        colspan: colspan,\n        rowspan: rowspan\n      };\n    };\n\n    var toDetails = function (grid, comparator) {\n      var seen = map$1(grid, function (row) {\n        return map$1(row.cells, never);\n      });\n      var updateSeen = function (rowIndex, columnIndex, rowspan, colspan) {\n        for (var row = rowIndex; row < rowIndex + rowspan; row++) {\n          for (var column = columnIndex; column < columnIndex + colspan; column++) {\n            seen[row][column] = true;\n          }\n        }\n      };\n      return map$1(grid, function (row, rowIndex) {\n        var details = bind$2(row.cells, function (cell, columnIndex) {\n          if (seen[rowIndex][columnIndex] === false) {\n            var result = subgrid(grid, rowIndex, columnIndex, comparator);\n            updateSeen(rowIndex, columnIndex, result.rowspan, result.colspan);\n            return [detailnew(cell.element, result.rowspan, result.colspan, cell.isNew)];\n          } else {\n            return [];\n          }\n        });\n        return rowdetailnew(row.element, details, row.section, row.isNew);\n      });\n    };\n    var toGrid = function (warehouse, generators, isNew) {\n      var grid = [];\n      each$2(warehouse.colgroups, function (colgroup) {\n        var colgroupCols = [];\n        for (var columnIndex = 0; columnIndex < warehouse.grid.columns; columnIndex++) {\n          var element = Warehouse.getColumnAt(warehouse, columnIndex).map(function (column) {\n            return elementnew(column.element, isNew, false);\n          }).getOrThunk(function () {\n            return elementnew(generators.colGap(), true, false);\n          });\n          colgroupCols.push(element);\n        }\n        grid.push(rowcells(colgroup.element, colgroupCols, 'colgroup', isNew));\n      });\n      for (var rowIndex = 0; rowIndex < warehouse.grid.rows; rowIndex++) {\n        var rowCells = [];\n        for (var columnIndex = 0; columnIndex < warehouse.grid.columns; columnIndex++) {\n          var element = Warehouse.getAt(warehouse, rowIndex, columnIndex).map(function (item) {\n            return elementnew(item.element, isNew, item.isLocked);\n          }).getOrThunk(function () {\n            return elementnew(generators.gap(), true, false);\n          });\n          rowCells.push(element);\n        }\n        var rowDetail = warehouse.all[rowIndex];\n        var row = rowcells(rowDetail.element, rowCells, rowDetail.section, isNew);\n        grid.push(row);\n      }\n      return grid;\n    };\n\n    var fromWarehouse = function (warehouse, generators) {\n      return toGrid(warehouse, generators, false);\n    };\n    var toDetailList = function (grid) {\n      return toDetails(grid, eq$1);\n    };\n    var findInWarehouse = function (warehouse, element) {\n      return findMap(warehouse.all, function (r) {\n        return find$1(r.cells, function (e) {\n          return eq$1(element, e.element);\n        });\n      });\n    };\n    var extractCells = function (warehouse, target, predicate) {\n      var details = map$1(target.selection, function (cell$1) {\n        return cell(cell$1).bind(function (lc) {\n          return findInWarehouse(warehouse, lc);\n        }).filter(predicate);\n      });\n      var cells = cat(details);\n      return someIf(cells.length > 0, cells);\n    };\n    var run = function (operation, extract, adjustment, postAction, genWrappers) {\n      return function (wire, table, target, generators, behaviours) {\n        var warehouse = Warehouse.fromTable(table);\n        var tableSection = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.section).getOrThunk(TableSection.fallback);\n        var output = extract(warehouse, target).map(function (info) {\n          var model = fromWarehouse(warehouse, generators);\n          var result = operation(model, info, eq$1, genWrappers(generators), tableSection);\n          var lockedColumns = getLockedColumnsFromGrid(result.grid);\n          var grid = toDetailList(result.grid);\n          return {\n            info: info,\n            grid: grid,\n            cursor: result.cursor,\n            lockedColumns: lockedColumns\n          };\n        });\n        return output.bind(function (out) {\n          var newElements = render$1(table, out.grid);\n          var tableSizing = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.sizing).getOrThunk(function () {\n            return TableSize.getTableSize(table);\n          });\n          var resizing = Optional.from(behaviours === null || behaviours === void 0 ? void 0 : behaviours.resize).getOrThunk(preserveTable);\n          adjustment(table, out.grid, out.info, {\n            sizing: tableSizing,\n            resize: resizing,\n            section: tableSection\n          });\n          postAction(table);\n          refresh(wire, table);\n          remove$7(table, LOCKED_COL_ATTR);\n          if (out.lockedColumns.length > 0) {\n            set$2(table, LOCKED_COL_ATTR, out.lockedColumns.join(','));\n          }\n          return Optional.some({\n            cursor: out.cursor,\n            newRows: newElements.newRows,\n            newCells: newElements.newCells\n          });\n        });\n      };\n    };\n    var onPaste = function (warehouse, target) {\n      return cell(target.element).bind(function (cell) {\n        return findInWarehouse(warehouse, cell).map(function (details) {\n          var value = __assign(__assign({}, details), {\n            generators: target.generators,\n            clipboard: target.clipboard\n          });\n          return value;\n        });\n      });\n    };\n    var onPasteByEditor = function (warehouse, target) {\n      return extractCells(warehouse, target, always).map(function (cells) {\n        return {\n          cells: cells,\n          generators: target.generators,\n          clipboard: target.clipboard\n        };\n      });\n    };\n    var onMergable = function (_warehouse, target) {\n      return target.mergable;\n    };\n    var onUnmergable = function (_warehouse, target) {\n      return target.unmergable;\n    };\n    var onCells = function (warehouse, target) {\n      return extractCells(warehouse, target, always);\n    };\n    var onUnlockedCells = function (warehouse, target) {\n      return extractCells(warehouse, target, function (detail) {\n        return !detail.isLocked;\n      });\n    };\n    var isUnlockedTableCell = function (warehouse, cell) {\n      return findInWarehouse(warehouse, cell).exists(function (detail) {\n        return !detail.isLocked;\n      });\n    };\n    var allUnlocked = function (warehouse, cells) {\n      return forall(cells, function (cell) {\n        return isUnlockedTableCell(warehouse, cell);\n      });\n    };\n    var onUnlockedMergable = function (warehouse, target) {\n      return onMergable(warehouse, target).filter(function (mergeable) {\n        return allUnlocked(warehouse, mergeable.cells);\n      });\n    };\n    var onUnlockedUnmergable = function (warehouse, target) {\n      return onUnmergable(warehouse, target).filter(function (cells) {\n        return allUnlocked(warehouse, cells);\n      });\n    };\n\n    var merge$2 = function (grid, bounds, comparator, substitution) {\n      var rows = extractGridDetails(grid).rows;\n      if (rows.length === 0) {\n        return grid;\n      }\n      for (var i = bounds.startRow; i <= bounds.finishRow; i++) {\n        for (var j = bounds.startCol; j <= bounds.finishCol; j++) {\n          var row = rows[i];\n          var isLocked = getCell(row, j).isLocked;\n          mutateCell(row, j, elementnew(substitution(), false, isLocked));\n        }\n      }\n      return grid;\n    };\n    var unmerge = function (grid, target, comparator, substitution) {\n      var rows = extractGridDetails(grid).rows;\n      var first = true;\n      for (var i = 0; i < rows.length; i++) {\n        for (var j = 0; j < cellLength(rows[0]); j++) {\n          var row = rows[i];\n          var currentCell = getCell(row, j);\n          var currentCellElm = currentCell.element;\n          var isToReplace = comparator(currentCellElm, target);\n          if (isToReplace === true && first === false) {\n            mutateCell(row, j, elementnew(substitution(), true, currentCell.isLocked));\n          } else if (isToReplace === true) {\n            first = false;\n          }\n        }\n      }\n      return grid;\n    };\n    var uniqueCells = function (row, comparator) {\n      return foldl(row, function (rest, cell) {\n        return exists(rest, function (currentCell) {\n          return comparator(currentCell.element, cell.element);\n        }) ? rest : rest.concat([cell]);\n      }, []);\n    };\n    var splitCols = function (grid, index, comparator, substitution) {\n      if (index > 0 && index < grid[0].cells.length) {\n        each$2(grid, function (row) {\n          var prevCell = row.cells[index - 1];\n          var current = row.cells[index];\n          var isToReplace = comparator(current.element, prevCell.element);\n          if (isToReplace) {\n            mutateCell(row, index, elementnew(substitution(), true, current.isLocked));\n          }\n        });\n      }\n      return grid;\n    };\n    var splitRows = function (grid, index, comparator, substitution) {\n      var rows = extractGridDetails(grid).rows;\n      if (index > 0 && index < rows.length) {\n        var rowPrevCells = rows[index - 1].cells;\n        var cells = uniqueCells(rowPrevCells, comparator);\n        each$2(cells, function (cell) {\n          var replacement = Optional.none();\n          for (var i = index; i < rows.length; i++) {\n            var _loop_1 = function (j) {\n              var row = rows[i];\n              var current = getCell(row, j);\n              var isToReplace = comparator(current.element, cell.element);\n              if (isToReplace) {\n                if (replacement.isNone()) {\n                  replacement = Optional.some(substitution());\n                }\n                replacement.each(function (sub) {\n                  mutateCell(row, j, elementnew(sub, true, current.isLocked));\n                });\n              }\n            };\n            for (var j = 0; j < cellLength(rows[0]); j++) {\n              _loop_1(j);\n            }\n          }\n        });\n      }\n      return grid;\n    };\n\n    var value$1 = function (o) {\n      var or = function (_opt) {\n        return value$1(o);\n      };\n      var orThunk = function (_f) {\n        return value$1(o);\n      };\n      var map = function (f) {\n        return value$1(f(o));\n      };\n      var mapError = function (_f) {\n        return value$1(o);\n      };\n      var each = function (f) {\n        f(o);\n      };\n      var bind = function (f) {\n        return f(o);\n      };\n      var fold = function (_, onValue) {\n        return onValue(o);\n      };\n      var exists = function (f) {\n        return f(o);\n      };\n      var forall = function (f) {\n        return f(o);\n      };\n      var toOptional = function () {\n        return Optional.some(o);\n      };\n      return {\n        isValue: always,\n        isError: never,\n        getOr: constant(o),\n        getOrThunk: constant(o),\n        getOrDie: constant(o),\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: each,\n        bind: bind,\n        exists: exists,\n        forall: forall,\n        toOptional: toOptional\n      };\n    };\n    var error = function (message) {\n      var getOrThunk = function (f) {\n        return f();\n      };\n      var getOrDie = function () {\n        return die(String(message))();\n      };\n      var or = identity;\n      var orThunk = function (f) {\n        return f();\n      };\n      var map = function (_f) {\n        return error(message);\n      };\n      var mapError = function (f) {\n        return error(f(message));\n      };\n      var bind = function (_f) {\n        return error(message);\n      };\n      var fold = function (onError, _) {\n        return onError(message);\n      };\n      return {\n        isValue: never,\n        isError: always,\n        getOr: identity,\n        getOrThunk: getOrThunk,\n        getOrDie: getOrDie,\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: noop,\n        bind: bind,\n        exists: never,\n        forall: always,\n        toOptional: Optional.none\n      };\n    };\n    var fromOption = function (opt, err) {\n      return opt.fold(function () {\n        return error(err);\n      }, value$1);\n    };\n    var Result = {\n      value: value$1,\n      error: error,\n      fromOption: fromOption\n    };\n\n    var measure = function (startAddress, gridA, gridB) {\n      if (startAddress.row >= gridA.length || startAddress.column > cellLength(gridA[0])) {\n        return Result.error('invalid start address out of table bounds, row: ' + startAddress.row + ', column: ' + startAddress.column);\n      }\n      var rowRemainder = gridA.slice(startAddress.row);\n      var colRemainder = rowRemainder[0].cells.slice(startAddress.column);\n      var colRequired = cellLength(gridB[0]);\n      var rowRequired = gridB.length;\n      return Result.value({\n        rowDelta: rowRemainder.length - rowRequired,\n        colDelta: colRemainder.length - colRequired\n      });\n    };\n    var measureWidth = function (gridA, gridB) {\n      var colLengthA = cellLength(gridA[0]);\n      var colLengthB = cellLength(gridB[0]);\n      return {\n        rowDelta: 0,\n        colDelta: colLengthA - colLengthB\n      };\n    };\n    var measureHeight = function (gridA, gridB) {\n      var rowLengthA = gridA.length;\n      var rowLengthB = gridB.length;\n      return {\n        rowDelta: rowLengthA - rowLengthB,\n        colDelta: 0\n      };\n    };\n    var generateElements = function (amount, row, generators, isLocked) {\n      var generator = row.section === 'colgroup' ? generators.col : generators.cell;\n      return range$1(amount, function (idx) {\n        return elementnew(generator(), true, isLocked(idx));\n      });\n    };\n    var rowFill = function (grid, amount, generators, lockedColumns) {\n      var exampleRow = grid[grid.length - 1];\n      return grid.concat(range$1(amount, function () {\n        var generator = exampleRow.section === 'colgroup' ? generators.colgroup : generators.row;\n        var row = clone$1(exampleRow, generator, identity);\n        var elements = generateElements(row.cells.length, row, generators, function (idx) {\n          return has$1(lockedColumns, idx.toString());\n        });\n        return setCells(row, elements);\n      }));\n    };\n    var colFill = function (grid, amount, generators, startIndex) {\n      return map$1(grid, function (row) {\n        var newChildren = generateElements(amount, row, generators, never);\n        return addCells(row, startIndex, newChildren);\n      });\n    };\n    var lockedColFill = function (grid, generators, lockedColumns) {\n      return map$1(grid, function (row) {\n        return foldl(lockedColumns, function (acc, colNum) {\n          var newChild = generateElements(1, row, generators, always)[0];\n          return addCell(acc, colNum, newChild);\n        }, row);\n      });\n    };\n    var tailor = function (gridA, delta, generators) {\n      var fillCols = delta.colDelta < 0 ? colFill : identity;\n      var fillRows = delta.rowDelta < 0 ? rowFill : identity;\n      var lockedColumns = getLockedColumnsFromGrid(gridA);\n      var gridWidth = cellLength(gridA[0]);\n      var isLastColLocked = exists(lockedColumns, function (locked) {\n        return locked === gridWidth - 1;\n      });\n      var modifiedCols = fillCols(gridA, Math.abs(delta.colDelta), generators, isLastColLocked ? gridWidth - 1 : gridWidth);\n      var newLockedColumns = getLockedColumnsFromGrid(modifiedCols);\n      return fillRows(modifiedCols, Math.abs(delta.rowDelta), generators, mapToObject(newLockedColumns, always));\n    };\n\n    var isSpanning = function (grid, row, col, comparator) {\n      var candidate = getCell(grid[row], col);\n      var matching = curry(comparator, candidate.element);\n      var currentRow = grid[row];\n      return grid.length > 1 && cellLength(currentRow) > 1 && (col > 0 && matching(getCellElement(currentRow, col - 1)) || col < currentRow.cells.length - 1 && matching(getCellElement(currentRow, col + 1)) || row > 0 && matching(getCellElement(grid[row - 1], col)) || row < grid.length - 1 && matching(getCellElement(grid[row + 1], col)));\n    };\n    var mergeTables = function (startAddress, gridA, gridB, generator, comparator, lockedColumns) {\n      var startRow = startAddress.row;\n      var startCol = startAddress.column;\n      var mergeHeight = gridB.length;\n      var mergeWidth = cellLength(gridB[0]);\n      var endRow = startRow + mergeHeight;\n      var endCol = startCol + mergeWidth + lockedColumns.length;\n      var lockedColumnObj = mapToObject(lockedColumns, always);\n      for (var r = startRow; r < endRow; r++) {\n        var skippedCol = 0;\n        for (var c = startCol; c < endCol; c++) {\n          if (lockedColumnObj[c]) {\n            skippedCol++;\n            continue;\n          }\n          if (isSpanning(gridA, r, c, comparator)) {\n            unmerge(gridA, getCellElement(gridA[r], c), comparator, generator.cell);\n          }\n          var gridBColIndex = c - startCol - skippedCol;\n          var newCell = getCell(gridB[r - startRow], gridBColIndex);\n          var newCellElm = newCell.element;\n          var replacement = generator.replace(newCellElm);\n          mutateCell(gridA[r], c, elementnew(replacement, true, newCell.isLocked));\n        }\n      }\n      return gridA;\n    };\n    var getValidStartAddress = function (currentStartAddress, grid, lockedColumns) {\n      var gridColLength = cellLength(grid[0]);\n      var adjustedRowAddress = extractGridDetails(grid).cols.length + currentStartAddress.row;\n      var possibleColAddresses = range$1(gridColLength - currentStartAddress.column, function (num) {\n        return num + currentStartAddress.column;\n      });\n      var validColAddress = find$1(possibleColAddresses, function (num) {\n        return forall(lockedColumns, function (col) {\n          return col !== num;\n        });\n      }).getOr(gridColLength - 1);\n      return {\n        row: adjustedRowAddress,\n        column: validColAddress\n      };\n    };\n    var getLockedColumnsWithinBounds = function (startAddress, grid, lockedColumns) {\n      return filter$2(lockedColumns, function (colNum) {\n        return colNum >= startAddress.column && colNum <= cellLength(grid[0]) + startAddress.column;\n      });\n    };\n    var merge$1 = function (startAddress, gridA, gridB, generator, comparator) {\n      var lockedColumns = getLockedColumnsFromGrid(gridA);\n      var validStartAddress = getValidStartAddress(startAddress, gridA, lockedColumns);\n      var gridBRows = extractGridDetails(gridB).rows;\n      var lockedColumnsWithinBounds = getLockedColumnsWithinBounds(validStartAddress, gridBRows, lockedColumns);\n      var result = measure(validStartAddress, gridA, gridBRows);\n      return result.map(function (diff) {\n        var delta = __assign(__assign({}, diff), { colDelta: diff.colDelta - lockedColumnsWithinBounds.length });\n        var fittedGrid = tailor(gridA, delta, generator);\n        var newLockedColumns = getLockedColumnsFromGrid(fittedGrid);\n        var newLockedColumnsWithinBounds = getLockedColumnsWithinBounds(validStartAddress, gridBRows, newLockedColumns);\n        return mergeTables(validStartAddress, fittedGrid, gridBRows, generator, comparator, newLockedColumnsWithinBounds);\n      });\n    };\n    var insertCols = function (index, gridA, gridB, generator, comparator) {\n      splitCols(gridA, index, comparator, generator.cell);\n      var delta = measureHeight(gridB, gridA);\n      var fittedNewGrid = tailor(gridB, delta, generator);\n      var secondDelta = measureHeight(gridA, fittedNewGrid);\n      var fittedOldGrid = tailor(gridA, secondDelta, generator);\n      return map$1(fittedOldGrid, function (gridRow, i) {\n        return addCells(gridRow, index, fittedNewGrid[i].cells);\n      });\n    };\n    var insertRows = function (index, gridA, gridB, generator, comparator) {\n      splitRows(gridA, index, comparator, generator.cell);\n      var locked = getLockedColumnsFromGrid(gridA);\n      var diff = measureWidth(gridA, gridB);\n      var delta = __assign(__assign({}, diff), { colDelta: diff.colDelta - locked.length });\n      var fittedOldGrid = tailor(gridA, delta, generator);\n      var _a = extractGridDetails(fittedOldGrid), oldCols = _a.cols, oldRows = _a.rows;\n      var newLocked = getLockedColumnsFromGrid(fittedOldGrid);\n      var secondDiff = measureWidth(gridB, gridA);\n      var secondDelta = __assign(__assign({}, secondDiff), { colDelta: secondDiff.colDelta + newLocked.length });\n      var fittedGridB = lockedColFill(gridB, generator, newLocked);\n      var fittedNewGrid = tailor(fittedGridB, secondDelta, generator);\n      return oldCols.concat(oldRows.slice(0, index)).concat(fittedNewGrid).concat(oldRows.slice(index, oldRows.length));\n    };\n\n    var cloneRow = function (row, cloneCell, comparator, substitution) {\n      return clone$1(row, function (elem) {\n        return substitution(elem, comparator);\n      }, cloneCell);\n    };\n    var insertRowAt = function (grid, index, example, comparator, substitution) {\n      var _a = extractGridDetails(grid), rows = _a.rows, cols = _a.cols;\n      var before = rows.slice(0, index);\n      var after = rows.slice(index);\n      var newRow = cloneRow(rows[example], function (ex, c) {\n        var withinSpan = index > 0 && index < rows.length && comparator(getCellElement(rows[index - 1], c), getCellElement(rows[index], c));\n        var ret = withinSpan ? getCell(rows[index], c) : elementnew(substitution(ex.element, comparator), true, ex.isLocked);\n        return ret;\n      }, comparator, substitution);\n      return cols.concat(before).concat([newRow]).concat(after);\n    };\n    var getElementFor = function (row, column, section, withinSpan, example, comparator, substitution) {\n      if (section === 'colgroup' || !withinSpan) {\n        var cell = getCell(row, example);\n        return elementnew(substitution(cell.element, comparator), true, false);\n      } else {\n        return getCell(row, column);\n      }\n    };\n    var insertColumnAt = function (grid, index, example, comparator, substitution) {\n      return map$1(grid, function (row) {\n        var withinSpan = index > 0 && index < cellLength(row) && comparator(getCellElement(row, index - 1), getCellElement(row, index));\n        var sub = getElementFor(row, index, row.section, withinSpan, example, comparator, substitution);\n        return addCell(row, index, sub);\n      });\n    };\n    var deleteColumnsAt = function (grid, columns) {\n      return bind$2(grid, function (row) {\n        var existingCells = row.cells;\n        var cells = foldr(columns, function (acc, column) {\n          return column >= 0 && column < acc.length ? acc.slice(0, column).concat(acc.slice(column + 1)) : acc;\n        }, existingCells);\n        return cells.length > 0 ? [rowcells(row.element, cells, row.section, row.isNew)] : [];\n      });\n    };\n    var deleteRowsAt = function (grid, start, finish) {\n      var _a = extractGridDetails(grid), rows = _a.rows, cols = _a.cols;\n      return cols.concat(rows.slice(0, start)).concat(rows.slice(finish + 1));\n    };\n\n    var notInStartRow = function (grid, rowIndex, colIndex, comparator) {\n      return getCellElement(grid[rowIndex], colIndex) !== undefined && (rowIndex > 0 && comparator(getCellElement(grid[rowIndex - 1], colIndex), getCellElement(grid[rowIndex], colIndex)));\n    };\n    var notInStartColumn = function (row, index, comparator) {\n      return index > 0 && comparator(getCellElement(row, index - 1), getCellElement(row, index));\n    };\n    var isDuplicatedCell = function (grid, rowIndex, colIndex, comparator) {\n      return notInStartRow(grid, rowIndex, colIndex, comparator) || notInStartColumn(grid[rowIndex], colIndex, comparator);\n    };\n    var rowReplacerPredicate = function (targetRow, columnHeaders) {\n      var entireTableIsHeader = forall(columnHeaders, identity) && isHeaderCells(targetRow.cells);\n      return entireTableIsHeader ? always : function (cell, _rowIndex, colIndex) {\n        var type = name(cell.element);\n        return !(type === 'th' && columnHeaders[colIndex]);\n      };\n    };\n    var columnReplacePredicate = function (targetColumn, rowHeaders) {\n      var entireTableIsHeader = forall(rowHeaders, identity) && isHeaderCells(targetColumn);\n      return entireTableIsHeader ? always : function (cell, rowIndex, _colIndex) {\n        var type = name(cell.element);\n        return !(type === 'th' && rowHeaders[rowIndex]);\n      };\n    };\n    var determineScope = function (applyScope, element, newScope, isInHeader) {\n      var hasSpan = function (scope) {\n        return scope === 'row' ? hasRowspan(element) : hasColspan(element);\n      };\n      var getScope = function (scope) {\n        return hasSpan(scope) ? scope + 'group' : scope;\n      };\n      if (applyScope) {\n        return isHeaderCell(element) ? getScope(newScope) : null;\n      } else if (isInHeader && isHeaderCell(element)) {\n        var oppositeScope = newScope === 'row' ? 'col' : 'row';\n        return getScope(oppositeScope);\n      } else {\n        return null;\n      }\n    };\n    var rowScopeGenerator = function (applyScope, columnHeaders) {\n      return function (cell, rowIndex, columnIndex) {\n        return Optional.some(determineScope(applyScope, cell.element, 'col', columnHeaders[columnIndex]));\n      };\n    };\n    var columnScopeGenerator = function (applyScope, rowHeaders) {\n      return function (cell, rowIndex) {\n        return Optional.some(determineScope(applyScope, cell.element, 'row', rowHeaders[rowIndex]));\n      };\n    };\n    var replace = function (cell, comparator, substitute) {\n      return elementnew(substitute(cell.element, comparator), true, cell.isLocked);\n    };\n    var replaceIn = function (grid, targets, comparator, substitute, replacer, genScope, shouldReplace) {\n      var isTarget = function (cell) {\n        return exists(targets, function (target) {\n          return comparator(cell.element, target.element);\n        });\n      };\n      return map$1(grid, function (row, rowIndex) {\n        return mapCells(row, function (cell, colIndex) {\n          if (isTarget(cell)) {\n            var newCell_1 = shouldReplace(cell, rowIndex, colIndex) ? replacer(cell, comparator, substitute) : cell;\n            genScope(newCell_1, rowIndex, colIndex).each(function (scope) {\n              setOptions(newCell_1.element, { scope: Optional.from(scope) });\n            });\n            return newCell_1;\n          } else {\n            return cell;\n          }\n        });\n      });\n    };\n    var getColumnCells = function (rows, columnIndex, comparator) {\n      return bind$2(rows, function (row, i) {\n        return isDuplicatedCell(rows, i, columnIndex, comparator) ? [] : [getCell(row, columnIndex)];\n      });\n    };\n    var getRowCells = function (rows, rowIndex, comparator) {\n      var targetRow = rows[rowIndex];\n      return bind$2(targetRow.cells, function (item, i) {\n        return isDuplicatedCell(rows, rowIndex, i, comparator) ? [] : [item];\n      });\n    };\n    var replaceColumns = function (grid, indexes, applyScope, comparator, substitution) {\n      var rows = extractGridDetails(grid).rows;\n      var targets = bind$2(indexes, function (index) {\n        return getColumnCells(rows, index, comparator);\n      });\n      var rowHeaders = map$1(grid, function (row) {\n        return isHeaderCells(row.cells);\n      });\n      var shouldReplaceCell = columnReplacePredicate(targets, rowHeaders);\n      var scopeGenerator = columnScopeGenerator(applyScope, rowHeaders);\n      return replaceIn(grid, targets, comparator, substitution, replace, scopeGenerator, shouldReplaceCell);\n    };\n    var replaceRows = function (grid, indexes, section, applyScope, comparator, substitution, tableSection) {\n      var _a = extractGridDetails(grid), cols = _a.cols, rows = _a.rows;\n      var targetRow = rows[indexes[0]];\n      var targets = bind$2(indexes, function (index) {\n        return getRowCells(rows, index, comparator);\n      });\n      var columnHeaders = map$1(targetRow.cells, function (_cell, index) {\n        return isHeaderCells(getColumnCells(rows, index, comparator));\n      });\n      var newRows = __spreadArray([], rows, true);\n      each$2(indexes, function (index) {\n        newRows[index] = tableSection.transformRow(rows[index], section);\n      });\n      var newGrid = cols.concat(newRows);\n      var shouldReplaceCell = rowReplacerPredicate(targetRow, columnHeaders);\n      var scopeGenerator = rowScopeGenerator(applyScope, columnHeaders);\n      return replaceIn(newGrid, targets, comparator, substitution, tableSection.transformCell, scopeGenerator, shouldReplaceCell);\n    };\n    var replaceCells = function (grid, details, comparator, substitution) {\n      var rows = extractGridDetails(grid).rows;\n      var targetCells = map$1(details, function (detail) {\n        return getCell(rows[detail.row], detail.column);\n      });\n      return replaceIn(grid, targetCells, comparator, substitution, replace, Optional.none, always);\n    };\n\n    var uniqueColumns = function (details) {\n      var uniqueCheck = function (rest, detail) {\n        var columnExists = exists(rest, function (currentDetail) {\n          return currentDetail.column === detail.column;\n        });\n        return columnExists ? rest : rest.concat([detail]);\n      };\n      return foldl(details, uniqueCheck, []).sort(function (detailA, detailB) {\n        return detailA.column - detailB.column;\n      });\n    };\n\n    var isCol = isTag('col');\n    var isColgroup = isTag('colgroup');\n    var isRow$1 = function (element) {\n      return name(element) === 'tr' || isColgroup(element);\n    };\n    var elementToData = function (element) {\n      var colspan = getAttrValue(element, 'colspan', 1);\n      var rowspan = getAttrValue(element, 'rowspan', 1);\n      return {\n        element: element,\n        colspan: colspan,\n        rowspan: rowspan\n      };\n    };\n    var modification = function (generators, toData) {\n      if (toData === void 0) {\n        toData = elementToData;\n      }\n      var nuCell = function (data) {\n        return isCol(data.element) ? generators.col(data) : generators.cell(data);\n      };\n      var nuRow = function (data) {\n        return isColgroup(data.element) ? generators.colgroup(data) : generators.row(data);\n      };\n      var add = function (element) {\n        if (isRow$1(element)) {\n          return nuRow({ element: element });\n        } else {\n          var replacement = nuCell(toData(element));\n          recent = Optional.some({\n            item: element,\n            replacement: replacement\n          });\n          return replacement;\n        }\n      };\n      var recent = Optional.none();\n      var getOrInit = function (element, comparator) {\n        return recent.fold(function () {\n          return add(element);\n        }, function (p) {\n          return comparator(element, p.item) ? p.replacement : add(element);\n        });\n      };\n      return { getOrInit: getOrInit };\n    };\n    var transform = function (tag) {\n      return function (generators) {\n        var list = [];\n        var find = function (element, comparator) {\n          return find$1(list, function (x) {\n            return comparator(x.item, element);\n          });\n        };\n        var makeNew = function (element) {\n          var attrs = tag === 'td' ? { scope: null } : {};\n          var cell = generators.replace(element, tag, attrs);\n          list.push({\n            item: element,\n            sub: cell\n          });\n          return cell;\n        };\n        var replaceOrInit = function (element, comparator) {\n          if (isRow$1(element) || isCol(element)) {\n            return element;\n          } else {\n            return find(element, comparator).fold(function () {\n              return makeNew(element);\n            }, function (p) {\n              return comparator(element, p.item) ? p.sub : makeNew(element);\n            });\n          }\n        };\n        return { replaceOrInit: replaceOrInit };\n      };\n    };\n    var getScopeAttribute = function (cell) {\n      return getOpt(cell, 'scope').map(function (attribute) {\n        return attribute.substr(0, 3);\n      });\n    };\n    var merging = function (generators) {\n      var unmerge = function (cell) {\n        var scope = getScopeAttribute(cell);\n        scope.each(function (attribute) {\n          return set$2(cell, 'scope', attribute);\n        });\n        return function () {\n          var raw = generators.cell({\n            element: cell,\n            colspan: 1,\n            rowspan: 1\n          });\n          remove$6(raw, 'width');\n          remove$6(cell, 'width');\n          scope.each(function (attribute) {\n            return set$2(raw, 'scope', attribute);\n          });\n          return raw;\n        };\n      };\n      var merge = function (cells) {\n        var getScopeProperty = function () {\n          var stringAttributes = cat(map$1(cells, getScopeAttribute));\n          if (stringAttributes.length === 0) {\n            return Optional.none();\n          } else {\n            var baseScope_1 = stringAttributes[0];\n            var scopes_1 = [\n              'row',\n              'col'\n            ];\n            var isMixed = exists(stringAttributes, function (attribute) {\n              return attribute !== baseScope_1 && contains$2(scopes_1, attribute);\n            });\n            return isMixed ? Optional.none() : Optional.from(baseScope_1);\n          }\n        };\n        remove$6(cells[0], 'width');\n        getScopeProperty().fold(function () {\n          return remove$7(cells[0], 'scope');\n        }, function (attribute) {\n          return set$2(cells[0], 'scope', attribute + 'group');\n        });\n        return constant(cells[0]);\n      };\n      return {\n        unmerge: unmerge,\n        merge: merge\n      };\n    };\n    var Generators = {\n      modification: modification,\n      transform: transform,\n      merging: merging\n    };\n\n    var blockList = [\n      'body',\n      'p',\n      'div',\n      'article',\n      'aside',\n      'figcaption',\n      'figure',\n      'footer',\n      'header',\n      'nav',\n      'section',\n      'ol',\n      'ul',\n      'table',\n      'thead',\n      'tfoot',\n      'tbody',\n      'caption',\n      'tr',\n      'td',\n      'th',\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6',\n      'blockquote',\n      'pre',\n      'address'\n    ];\n    var isList$1 = function (universe, item) {\n      var tagName = universe.property().name(item);\n      return contains$2([\n        'ol',\n        'ul'\n      ], tagName);\n    };\n    var isBlock$1 = function (universe, item) {\n      var tagName = universe.property().name(item);\n      return contains$2(blockList, tagName);\n    };\n    var isEmptyTag$1 = function (universe, item) {\n      return contains$2([\n        'br',\n        'img',\n        'hr',\n        'input'\n      ], universe.property().name(item));\n    };\n\n    var universe$1 = DomUniverse();\n    var isBlock = function (element) {\n      return isBlock$1(universe$1, element);\n    };\n    var isList = function (element) {\n      return isList$1(universe$1, element);\n    };\n    var isEmptyTag = function (element) {\n      return isEmptyTag$1(universe$1, element);\n    };\n\n    var merge = function (cells) {\n      var isBr = function (el) {\n        return name(el) === 'br';\n      };\n      var advancedBr = function (children) {\n        return forall(children, function (c) {\n          return isBr(c) || isText(c) && get$9(c).trim().length === 0;\n        });\n      };\n      var isListItem = function (el) {\n        return name(el) === 'li' || ancestor$2(el, isList).isSome();\n      };\n      var siblingIsBlock = function (el) {\n        return nextSibling(el).map(function (rightSibling) {\n          if (isBlock(rightSibling)) {\n            return true;\n          }\n          if (isEmptyTag(rightSibling)) {\n            return name(rightSibling) === 'img' ? false : true;\n          }\n          return false;\n        }).getOr(false);\n      };\n      var markCell = function (cell) {\n        return last$1(cell).bind(function (rightEdge) {\n          var rightSiblingIsBlock = siblingIsBlock(rightEdge);\n          return parent(rightEdge).map(function (parent) {\n            return rightSiblingIsBlock === true || isListItem(parent) || isBr(rightEdge) || isBlock(parent) && !eq$1(cell, parent) ? [] : [SugarElement.fromTag('br')];\n          });\n        }).getOr([]);\n      };\n      var markContent = function () {\n        var content = bind$2(cells, function (cell) {\n          var children = children$3(cell);\n          return advancedBr(children) ? [] : children.concat(markCell(cell));\n        });\n        return content.length === 0 ? [SugarElement.fromTag('br')] : content;\n      };\n      var contents = markContent();\n      empty(cells[0]);\n      append(cells[0], contents);\n    };\n\n    var isEditable = function (elem) {\n      return isEditable$1(elem, true);\n    };\n    var prune = function (table) {\n      var cells = cells$1(table);\n      if (cells.length === 0) {\n        remove$5(table);\n      }\n    };\n    var outcome = function (grid, cursor) {\n      return {\n        grid: grid,\n        cursor: cursor\n      };\n    };\n    var findEditableCursorPosition = function (rows) {\n      return findMap(rows, function (row) {\n        return findMap(row.cells, function (cell) {\n          var elem = cell.element;\n          return someIf(isEditable(elem), elem);\n        });\n      });\n    };\n    var elementFromGrid = function (grid, row, column) {\n      var _a, _b;\n      var rows = extractGridDetails(grid).rows;\n      return Optional.from((_b = (_a = rows[row]) === null || _a === void 0 ? void 0 : _a.cells[column]) === null || _b === void 0 ? void 0 : _b.element).filter(isEditable).orThunk(function () {\n        return findEditableCursorPosition(rows);\n      });\n    };\n    var bundle = function (grid, row, column) {\n      var cursorElement = elementFromGrid(grid, row, column);\n      return outcome(grid, cursorElement);\n    };\n    var uniqueRows = function (details) {\n      var rowCompilation = function (rest, detail) {\n        var rowExists = exists(rest, function (currentDetail) {\n          return currentDetail.row === detail.row;\n        });\n        return rowExists ? rest : rest.concat([detail]);\n      };\n      return foldl(details, rowCompilation, []).sort(function (detailA, detailB) {\n        return detailA.row - detailB.row;\n      });\n    };\n    var opInsertRowsBefore = function (grid, details, comparator, genWrappers) {\n      var targetIndex = details[0].row;\n      var rows = uniqueRows(details);\n      var newGrid = foldr(rows, function (acc, row) {\n        var newG = insertRowAt(acc.grid, targetIndex, row.row + acc.delta, comparator, genWrappers.getOrInit);\n        return {\n          grid: newG,\n          delta: acc.delta + 1\n        };\n      }, {\n        grid: grid,\n        delta: 0\n      }).grid;\n      return bundle(newGrid, targetIndex, details[0].column);\n    };\n    var opInsertRowsAfter = function (grid, details, comparator, genWrappers) {\n      var rows = uniqueRows(details);\n      var target = rows[rows.length - 1];\n      var targetIndex = target.row + target.rowspan;\n      var newGrid = foldr(rows, function (newG, row) {\n        return insertRowAt(newG, targetIndex, row.row, comparator, genWrappers.getOrInit);\n      }, grid);\n      return bundle(newGrid, targetIndex, details[0].column);\n    };\n    var opInsertColumnsBefore = function (grid, extractDetail, comparator, genWrappers) {\n      var details = extractDetail.details;\n      var columns = uniqueColumns(details);\n      var targetIndex = columns[0].column;\n      var newGrid = foldr(columns, function (acc, col) {\n        var newG = insertColumnAt(acc.grid, targetIndex, col.column + acc.delta, comparator, genWrappers.getOrInit);\n        return {\n          grid: newG,\n          delta: acc.delta + 1\n        };\n      }, {\n        grid: grid,\n        delta: 0\n      }).grid;\n      return bundle(newGrid, details[0].row, targetIndex);\n    };\n    var opInsertColumnsAfter = function (grid, extractDetail, comparator, genWrappers) {\n      var details = extractDetail.details;\n      var target = details[details.length - 1];\n      var targetIndex = target.column + target.colspan;\n      var columns = uniqueColumns(details);\n      var newGrid = foldr(columns, function (newG, col) {\n        return insertColumnAt(newG, targetIndex, col.column, comparator, genWrappers.getOrInit);\n      }, grid);\n      return bundle(newGrid, details[0].row, targetIndex);\n    };\n    var opMakeColumnsHeader = function (initialGrid, details, comparator, genWrappers) {\n      var columns = uniqueColumns(details);\n      var columnIndexes = map$1(columns, function (detail) {\n        return detail.column;\n      });\n      var newGrid = replaceColumns(initialGrid, columnIndexes, true, comparator, genWrappers.replaceOrInit);\n      return bundle(newGrid, details[0].row, details[0].column);\n    };\n    var opMakeCellsHeader = function (initialGrid, details, comparator, genWrappers) {\n      var newGrid = replaceCells(initialGrid, details, comparator, genWrappers.replaceOrInit);\n      return bundle(newGrid, details[0].row, details[0].column);\n    };\n    var opUnmakeColumnsHeader = function (initialGrid, details, comparator, genWrappers) {\n      var columns = uniqueColumns(details);\n      var columnIndexes = map$1(columns, function (detail) {\n        return detail.column;\n      });\n      var newGrid = replaceColumns(initialGrid, columnIndexes, false, comparator, genWrappers.replaceOrInit);\n      return bundle(newGrid, details[0].row, details[0].column);\n    };\n    var opUnmakeCellsHeader = function (initialGrid, details, comparator, genWrappers) {\n      var newGrid = replaceCells(initialGrid, details, comparator, genWrappers.replaceOrInit);\n      return bundle(newGrid, details[0].row, details[0].column);\n    };\n    var makeRowsSection = function (section, applyScope) {\n      return function (initialGrid, details, comparator, genWrappers, tableSection) {\n        var rows = uniqueRows(details);\n        var rowIndexes = map$1(rows, function (detail) {\n          return detail.row;\n        });\n        var newGrid = replaceRows(initialGrid, rowIndexes, section, applyScope, comparator, genWrappers.replaceOrInit, tableSection);\n        return bundle(newGrid, details[0].row, details[0].column);\n      };\n    };\n    var opMakeRowsHeader = makeRowsSection('thead', true);\n    var opMakeRowsBody = makeRowsSection('tbody', false);\n    var opMakeRowsFooter = makeRowsSection('tfoot', false);\n    var opEraseColumns = function (grid, extractDetail, _comparator, _genWrappers) {\n      var columns = uniqueColumns(extractDetail.details);\n      var newGrid = deleteColumnsAt(grid, map$1(columns, function (column) {\n        return column.column;\n      }));\n      var maxColIndex = newGrid.length > 0 ? newGrid[0].cells.length - 1 : 0;\n      return bundle(newGrid, columns[0].row, Math.min(columns[0].column, maxColIndex));\n    };\n    var opEraseRows = function (grid, details, _comparator, _genWrappers) {\n      var rows = uniqueRows(details);\n      var newGrid = deleteRowsAt(grid, rows[0].row, rows[rows.length - 1].row);\n      var maxRowIndex = newGrid.length > 0 ? newGrid.length - 1 : 0;\n      return bundle(newGrid, Math.min(details[0].row, maxRowIndex), details[0].column);\n    };\n    var opMergeCells = function (grid, mergable, comparator, genWrappers) {\n      var cells = mergable.cells;\n      merge(cells);\n      var newGrid = merge$2(grid, mergable.bounds, comparator, genWrappers.merge(cells));\n      return outcome(newGrid, Optional.from(cells[0]));\n    };\n    var opUnmergeCells = function (grid, unmergable, comparator, genWrappers) {\n      var unmerge$1 = function (b, cell) {\n        return unmerge(b, cell, comparator, genWrappers.unmerge(cell));\n      };\n      var newGrid = foldr(unmergable, unmerge$1, grid);\n      return outcome(newGrid, Optional.from(unmergable[0]));\n    };\n    var opPasteCells = function (grid, pasteDetails, comparator, _genWrappers) {\n      var gridify = function (table, generators) {\n        var wh = Warehouse.fromTable(table);\n        return toGrid(wh, generators, true);\n      };\n      var gridB = gridify(pasteDetails.clipboard, pasteDetails.generators);\n      var startAddress = address(pasteDetails.row, pasteDetails.column);\n      var mergedGrid = merge$1(startAddress, grid, gridB, pasteDetails.generators, comparator);\n      return mergedGrid.fold(function () {\n        return outcome(grid, Optional.some(pasteDetails.element));\n      }, function (newGrid) {\n        return bundle(newGrid, pasteDetails.row, pasteDetails.column);\n      });\n    };\n    var gridifyRows = function (rows, generators, context) {\n      var pasteDetails = fromPastedRows(rows, context.section);\n      var wh = Warehouse.generate(pasteDetails);\n      return toGrid(wh, generators, true);\n    };\n    var opPasteColsBefore = function (grid, pasteDetails, comparator, _genWrappers) {\n      var rows = extractGridDetails(grid).rows;\n      var index = pasteDetails.cells[0].column;\n      var context = rows[pasteDetails.cells[0].row];\n      var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context);\n      var mergedGrid = insertCols(index, grid, gridB, pasteDetails.generators, comparator);\n      return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column);\n    };\n    var opPasteColsAfter = function (grid, pasteDetails, comparator, _genWrappers) {\n      var rows = extractGridDetails(grid).rows;\n      var index = pasteDetails.cells[pasteDetails.cells.length - 1].column + pasteDetails.cells[pasteDetails.cells.length - 1].colspan;\n      var context = rows[pasteDetails.cells[0].row];\n      var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context);\n      var mergedGrid = insertCols(index, grid, gridB, pasteDetails.generators, comparator);\n      return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column);\n    };\n    var opPasteRowsBefore = function (grid, pasteDetails, comparator, _genWrappers) {\n      var rows = extractGridDetails(grid).rows;\n      var index = pasteDetails.cells[0].row;\n      var context = rows[index];\n      var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context);\n      var mergedGrid = insertRows(index, grid, gridB, pasteDetails.generators, comparator);\n      return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column);\n    };\n    var opPasteRowsAfter = function (grid, pasteDetails, comparator, _genWrappers) {\n      var rows = extractGridDetails(grid).rows;\n      var index = pasteDetails.cells[pasteDetails.cells.length - 1].row + pasteDetails.cells[pasteDetails.cells.length - 1].rowspan;\n      var context = rows[pasteDetails.cells[0].row];\n      var gridB = gridifyRows(pasteDetails.clipboard, pasteDetails.generators, context);\n      var mergedGrid = insertRows(index, grid, gridB, pasteDetails.generators, comparator);\n      return bundle(mergedGrid, pasteDetails.cells[0].row, pasteDetails.cells[0].column);\n    };\n    var opGetColumnsType = function (table, target) {\n      var house = Warehouse.fromTable(table);\n      var details = onCells(house, target);\n      return details.bind(function (selectedCells) {\n        var lastSelectedCell = selectedCells[selectedCells.length - 1];\n        var minColRange = selectedCells[0].column;\n        var maxColRange = lastSelectedCell.column + lastSelectedCell.colspan;\n        var selectedColumnCells = flatten$1(map$1(house.all, function (row) {\n          return filter$2(row.cells, function (cell) {\n            return cell.column >= minColRange && cell.column < maxColRange;\n          });\n        }));\n        return findCommonCellType(selectedColumnCells);\n      }).getOr('');\n    };\n    var opGetCellsType = function (table, target) {\n      var house = Warehouse.fromTable(table);\n      var details = onCells(house, target);\n      return details.bind(findCommonCellType).getOr('');\n    };\n    var opGetRowsType = function (table, target) {\n      var house = Warehouse.fromTable(table);\n      var details = onCells(house, target);\n      return details.bind(function (selectedCells) {\n        var lastSelectedCell = selectedCells[selectedCells.length - 1];\n        var minRowRange = selectedCells[0].row;\n        var maxRowRange = lastSelectedCell.row + lastSelectedCell.rowspan;\n        var selectedRows = house.all.slice(minRowRange, maxRowRange);\n        return findCommonRowType(selectedRows);\n      }).getOr('');\n    };\n    var resize = function (table, list, details, behaviours) {\n      return adjustWidthTo(table, list, details, behaviours.sizing);\n    };\n    var adjustAndRedistributeWidths = function (table, list, details, behaviours) {\n      return adjustAndRedistributeWidths$1(table, list, details, behaviours.sizing, behaviours.resize);\n    };\n    var firstColumnIsLocked = function (_warehouse, details) {\n      return exists(details, function (detail) {\n        return detail.column === 0 && detail.isLocked;\n      });\n    };\n    var lastColumnIsLocked = function (warehouse, details) {\n      return exists(details, function (detail) {\n        return detail.column + detail.colspan >= warehouse.grid.columns && detail.isLocked;\n      });\n    };\n    var getColumnsWidth = function (warehouse, details) {\n      var columns$1 = columns(warehouse);\n      var uniqueCols = uniqueColumns(details);\n      return foldl(uniqueCols, function (acc, detail) {\n        var column = columns$1[detail.column];\n        var colWidth = column.map(getOuter$2).getOr(0);\n        return acc + colWidth;\n      }, 0);\n    };\n    var insertColumnsExtractor = function (before) {\n      return function (warehouse, target) {\n        return onCells(warehouse, target).filter(function (details) {\n          var checkLocked = before ? firstColumnIsLocked : lastColumnIsLocked;\n          return !checkLocked(warehouse, details);\n        }).map(function (details) {\n          return {\n            details: details,\n            pixelDelta: getColumnsWidth(warehouse, details)\n          };\n        });\n      };\n    };\n    var eraseColumnsExtractor = function (warehouse, target) {\n      return onUnlockedCells(warehouse, target).map(function (details) {\n        return {\n          details: details,\n          pixelDelta: -getColumnsWidth(warehouse, details)\n        };\n      });\n    };\n    var pasteColumnsExtractor = function (before) {\n      return function (warehouse, target) {\n        return onPasteByEditor(warehouse, target).filter(function (details) {\n          var checkLocked = before ? firstColumnIsLocked : lastColumnIsLocked;\n          return !checkLocked(warehouse, details.cells);\n        });\n      };\n    };\n    var headerCellGenerator = Generators.transform('th');\n    var bodyCellGenerator = Generators.transform('td');\n    var insertRowsBefore = run(opInsertRowsBefore, onCells, noop, noop, Generators.modification);\n    var insertRowsAfter = run(opInsertRowsAfter, onCells, noop, noop, Generators.modification);\n    var insertColumnsBefore = run(opInsertColumnsBefore, insertColumnsExtractor(true), adjustAndRedistributeWidths, noop, Generators.modification);\n    var insertColumnsAfter = run(opInsertColumnsAfter, insertColumnsExtractor(false), adjustAndRedistributeWidths, noop, Generators.modification);\n    var eraseColumns = run(opEraseColumns, eraseColumnsExtractor, adjustAndRedistributeWidths, prune, Generators.modification);\n    var eraseRows = run(opEraseRows, onCells, noop, prune, Generators.modification);\n    var makeColumnsHeader = run(opMakeColumnsHeader, onUnlockedCells, noop, noop, headerCellGenerator);\n    var unmakeColumnsHeader = run(opUnmakeColumnsHeader, onUnlockedCells, noop, noop, bodyCellGenerator);\n    var makeRowsHeader = run(opMakeRowsHeader, onUnlockedCells, noop, noop, headerCellGenerator);\n    var makeRowsBody = run(opMakeRowsBody, onUnlockedCells, noop, noop, bodyCellGenerator);\n    var makeRowsFooter = run(opMakeRowsFooter, onUnlockedCells, noop, noop, bodyCellGenerator);\n    var makeCellsHeader = run(opMakeCellsHeader, onUnlockedCells, noop, noop, headerCellGenerator);\n    var unmakeCellsHeader = run(opUnmakeCellsHeader, onUnlockedCells, noop, noop, bodyCellGenerator);\n    var mergeCells = run(opMergeCells, onUnlockedMergable, resize, noop, Generators.merging);\n    var unmergeCells = run(opUnmergeCells, onUnlockedUnmergable, resize, noop, Generators.merging);\n    var pasteCells = run(opPasteCells, onPaste, resize, noop, Generators.modification);\n    var pasteColsBefore = run(opPasteColsBefore, pasteColumnsExtractor(true), noop, noop, Generators.modification);\n    var pasteColsAfter = run(opPasteColsAfter, pasteColumnsExtractor(false), noop, noop, Generators.modification);\n    var pasteRowsBefore = run(opPasteRowsBefore, onPasteByEditor, noop, noop, Generators.modification);\n    var pasteRowsAfter = run(opPasteRowsAfter, onPasteByEditor, noop, noop, Generators.modification);\n    var getColumnsType = opGetColumnsType;\n    var getCellsType = opGetCellsType;\n    var getRowsType = opGetRowsType;\n\n    var TableActions = function (editor, cellSelection, lazyWire) {\n      var isTableBody = function (editor) {\n        return name(getBody(editor)) === 'table';\n      };\n      var lastRowGuard = function (table) {\n        return isTableBody(editor) === false || getGridSize(table).rows > 1;\n      };\n      var lastColumnGuard = function (table) {\n        return isTableBody(editor) === false || getGridSize(table).columns > 1;\n      };\n      var cloneFormats = getCloneElements(editor);\n      var colMutationOp = isResizeTableColumnResizing(editor) ? noop : halve;\n      var getTableSectionType = function (table) {\n        switch (getTableHeaderType(editor)) {\n        case 'section':\n          return TableSection.section();\n        case 'sectionCells':\n          return TableSection.sectionCells();\n        case 'cells':\n          return TableSection.cells();\n        default:\n          return TableSection.getTableSectionType(table, 'section');\n        }\n      };\n      var setSelectionFromAction = function (table, result) {\n        return result.cursor.fold(function () {\n          var cells = cells$1(table);\n          return head(cells).filter(inBody).map(function (firstCell) {\n            cellSelection.clear(table);\n            var rng = editor.dom.createRng();\n            rng.selectNode(firstCell.dom);\n            editor.selection.setRng(rng);\n            set$2(firstCell, 'data-mce-selected', '1');\n            return rng;\n          });\n        }, function (cell) {\n          var des = freefallRtl(cell);\n          var rng = editor.dom.createRng();\n          rng.setStart(des.element.dom, des.offset);\n          rng.setEnd(des.element.dom, des.offset);\n          editor.selection.setRng(rng);\n          cellSelection.clear(table);\n          return Optional.some(rng);\n        });\n      };\n      var execute = function (operation, guard, mutate, lazyWire, effect) {\n        return function (table, target, noEvents) {\n          if (noEvents === void 0) {\n            noEvents = false;\n          }\n          removeDataStyle(table);\n          var wire = lazyWire();\n          var doc = SugarElement.fromDom(editor.getDoc());\n          var generators = cellOperations(mutate, doc, cloneFormats);\n          var behaviours = {\n            sizing: get$4(editor, table),\n            resize: isResizeTableColumnResizing(editor) ? resizeTable() : preserveTable(),\n            section: getTableSectionType(table)\n          };\n          return guard(table) ? operation(wire, table, target, generators, behaviours).bind(function (result) {\n            each$2(result.newRows, function (row) {\n              fireNewRow(editor, row.dom);\n            });\n            each$2(result.newCells, function (cell) {\n              fireNewCell(editor, cell.dom);\n            });\n            var range = setSelectionFromAction(table, result);\n            if (inBody(table)) {\n              removeDataStyle(table);\n              if (!noEvents) {\n                fireTableModified(editor, table.dom, effect);\n              }\n            }\n            return range.map(function (rng) {\n              return {\n                rng: rng,\n                effect: effect\n              };\n            });\n          }) : Optional.none();\n        };\n      };\n      var deleteRow = execute(eraseRows, lastRowGuard, noop, lazyWire, structureModified);\n      var deleteColumn = execute(eraseColumns, lastColumnGuard, noop, lazyWire, structureModified);\n      var insertRowsBefore$1 = execute(insertRowsBefore, always, noop, lazyWire, structureModified);\n      var insertRowsAfter$1 = execute(insertRowsAfter, always, noop, lazyWire, structureModified);\n      var insertColumnsBefore$1 = execute(insertColumnsBefore, always, colMutationOp, lazyWire, structureModified);\n      var insertColumnsAfter$1 = execute(insertColumnsAfter, always, colMutationOp, lazyWire, structureModified);\n      var mergeCells$1 = execute(mergeCells, always, noop, lazyWire, structureModified);\n      var unmergeCells$1 = execute(unmergeCells, always, noop, lazyWire, structureModified);\n      var pasteColsBefore$1 = execute(pasteColsBefore, always, noop, lazyWire, structureModified);\n      var pasteColsAfter$1 = execute(pasteColsAfter, always, noop, lazyWire, structureModified);\n      var pasteRowsBefore$1 = execute(pasteRowsBefore, always, noop, lazyWire, structureModified);\n      var pasteRowsAfter$1 = execute(pasteRowsAfter, always, noop, lazyWire, structureModified);\n      var pasteCells$1 = execute(pasteCells, always, noop, lazyWire, styleAndStructureModified);\n      var makeCellsHeader$1 = execute(makeCellsHeader, always, noop, lazyWire, structureModified);\n      var unmakeCellsHeader$1 = execute(unmakeCellsHeader, always, noop, lazyWire, structureModified);\n      var makeColumnsHeader$1 = execute(makeColumnsHeader, always, noop, lazyWire, structureModified);\n      var unmakeColumnsHeader$1 = execute(unmakeColumnsHeader, always, noop, lazyWire, structureModified);\n      var makeRowsHeader$1 = execute(makeRowsHeader, always, noop, lazyWire, structureModified);\n      var makeRowsBody$1 = execute(makeRowsBody, always, noop, lazyWire, structureModified);\n      var makeRowsFooter$1 = execute(makeRowsFooter, always, noop, lazyWire, structureModified);\n      var getTableCellType = getCellsType;\n      var getTableColType = getColumnsType;\n      var getTableRowType = getRowsType;\n      return {\n        deleteRow: deleteRow,\n        deleteColumn: deleteColumn,\n        insertRowsBefore: insertRowsBefore$1,\n        insertRowsAfter: insertRowsAfter$1,\n        insertColumnsBefore: insertColumnsBefore$1,\n        insertColumnsAfter: insertColumnsAfter$1,\n        mergeCells: mergeCells$1,\n        unmergeCells: unmergeCells$1,\n        pasteColsBefore: pasteColsBefore$1,\n        pasteColsAfter: pasteColsAfter$1,\n        pasteRowsBefore: pasteRowsBefore$1,\n        pasteRowsAfter: pasteRowsAfter$1,\n        pasteCells: pasteCells$1,\n        makeCellsHeader: makeCellsHeader$1,\n        unmakeCellsHeader: unmakeCellsHeader$1,\n        makeColumnsHeader: makeColumnsHeader$1,\n        unmakeColumnsHeader: unmakeColumnsHeader$1,\n        makeRowsHeader: makeRowsHeader$1,\n        makeRowsBody: makeRowsBody$1,\n        makeRowsFooter: makeRowsFooter$1,\n        getTableRowType: getTableRowType,\n        getTableCellType: getTableCellType,\n        getTableColType: getTableColType\n      };\n    };\n\n    var DefaultRenderOptions = {\n      styles: {\n        'border-collapse': 'collapse',\n        'width': '100%'\n      },\n      attributes: { border: '1' },\n      colGroups: false\n    };\n    var tableHeaderCell = function () {\n      return SugarElement.fromTag('th');\n    };\n    var tableCell = function () {\n      return SugarElement.fromTag('td');\n    };\n    var tableColumn = function () {\n      return SugarElement.fromTag('col');\n    };\n    var createRow = function (columns, rowHeaders, columnHeaders, rowIndex) {\n      var tr = SugarElement.fromTag('tr');\n      for (var j = 0; j < columns; j++) {\n        var td = rowIndex < rowHeaders || j < columnHeaders ? tableHeaderCell() : tableCell();\n        if (j < columnHeaders) {\n          set$2(td, 'scope', 'row');\n        }\n        if (rowIndex < rowHeaders) {\n          set$2(td, 'scope', 'col');\n        }\n        append$1(td, SugarElement.fromTag('br'));\n        append$1(tr, td);\n      }\n      return tr;\n    };\n    var createGroupRow = function (columns) {\n      var columnGroup = SugarElement.fromTag('colgroup');\n      range$1(columns, function () {\n        return append$1(columnGroup, tableColumn());\n      });\n      return columnGroup;\n    };\n    var createRows = function (rows, columns, rowHeaders, columnHeaders) {\n      return range$1(rows, function (r) {\n        return createRow(columns, rowHeaders, columnHeaders, r);\n      });\n    };\n    var render = function (rows, columns, rowHeaders, columnHeaders, headerType, renderOpts) {\n      if (renderOpts === void 0) {\n        renderOpts = DefaultRenderOptions;\n      }\n      var table = SugarElement.fromTag('table');\n      var rowHeadersGoInThead = headerType !== 'cells';\n      setAll(table, renderOpts.styles);\n      setAll$1(table, renderOpts.attributes);\n      if (renderOpts.colGroups) {\n        append$1(table, createGroupRow(columns));\n      }\n      var actualRowHeaders = Math.min(rows, rowHeaders);\n      if (rowHeadersGoInThead && rowHeaders > 0) {\n        var thead = SugarElement.fromTag('thead');\n        append$1(table, thead);\n        var theadRowHeaders = headerType === 'sectionCells' ? actualRowHeaders : 0;\n        var theadRows = createRows(rowHeaders, columns, theadRowHeaders, columnHeaders);\n        append(thead, theadRows);\n      }\n      var tbody = SugarElement.fromTag('tbody');\n      append$1(table, tbody);\n      var numRows = rowHeadersGoInThead ? rows - actualRowHeaders : rows;\n      var numRowHeaders = rowHeadersGoInThead ? 0 : rowHeaders;\n      var tbodyRows = createRows(numRows, columns, numRowHeaders, columnHeaders);\n      append(tbody, tbodyRows);\n      return table;\n    };\n\n    var get$2 = function (element) {\n      return element.dom.innerHTML;\n    };\n    var getOuter = function (element) {\n      var container = SugarElement.fromTag('div');\n      var clone = SugarElement.fromDom(element.dom.cloneNode(true));\n      append$1(container, clone);\n      return get$2(container);\n    };\n\n    var placeCaretInCell = function (editor, cell) {\n      editor.selection.select(cell.dom, true);\n      editor.selection.collapse(true);\n    };\n    var selectFirstCellInTable = function (editor, tableElm) {\n      descendant(tableElm, 'td,th').each(curry(placeCaretInCell, editor));\n    };\n    var fireEvents = function (editor, table) {\n      each$2(descendants(table, 'tr'), function (row) {\n        fireNewRow(editor, row.dom);\n        each$2(descendants(row, 'th,td'), function (cell) {\n          fireNewCell(editor, cell.dom);\n        });\n      });\n    };\n    var isPercentage = function (width) {\n      return isString(width) && width.indexOf('%') !== -1;\n    };\n    var insert = function (editor, columns, rows, colHeaders, rowHeaders) {\n      var defaultStyles = getDefaultStyles(editor);\n      var options = {\n        styles: defaultStyles,\n        attributes: getDefaultAttributes(editor),\n        colGroups: useColumnGroup(editor)\n      };\n      editor.undoManager.ignore(function () {\n        var table = render(rows, columns, rowHeaders, colHeaders, getTableHeaderType(editor), options);\n        set$2(table, 'data-mce-id', '__mce');\n        var html = getOuter(table);\n        editor.insertContent(html);\n        editor.addVisual();\n      });\n      return descendant(getBody(editor), 'table[data-mce-id=\"__mce\"]').map(function (table) {\n        if (isPixelsForced(editor)) {\n          enforcePixels(table);\n        } else if (isResponsiveForced(editor)) {\n          enforceNone(table);\n        } else if (isPercentagesForced(editor) || isPercentage(defaultStyles.width)) {\n          enforcePercentage(table);\n        }\n        removeDataStyle(table);\n        remove$7(table, 'data-mce-id');\n        fireEvents(editor, table);\n        selectFirstCellInTable(editor, table);\n        return table.dom;\n      }).getOr(null);\n    };\n    var insertTableWithDataValidation = function (editor, rows, columns, options, errorMsg) {\n      if (options === void 0) {\n        options = {};\n      }\n      var checkInput = function (val) {\n        return isNumber(val) && val > 0;\n      };\n      if (checkInput(rows) && checkInput(columns)) {\n        var headerRows = options.headerRows || 0;\n        var headerColumns = options.headerColumns || 0;\n        return insert(editor, columns, rows, headerColumns, headerRows);\n      } else {\n        console.error(errorMsg);\n        return null;\n      }\n    };\n\n    var getClipboardElements = function (getClipboard) {\n      return function () {\n        return getClipboard().fold(function () {\n          return [];\n        }, function (elems) {\n          return map$1(elems, function (e) {\n            return e.dom;\n          });\n        });\n      };\n    };\n    var setClipboardElements = function (setClipboard) {\n      return function (elems) {\n        var elmsOpt = elems.length > 0 ? Optional.some(fromDom(elems)) : Optional.none();\n        setClipboard(elmsOpt);\n      };\n    };\n    var insertTable = function (editor) {\n      return function (columns, rows, options) {\n        if (options === void 0) {\n          options = {};\n        }\n        var table = insertTableWithDataValidation(editor, rows, columns, options, 'Invalid values for insertTable - rows and columns values are required to insert a table.');\n        editor.undoManager.add();\n        return table;\n      };\n    };\n    var getApi = function (editor, clipboard, resizeHandler, selectionTargets) {\n      return {\n        insertTable: insertTable(editor),\n        setClipboardRows: setClipboardElements(clipboard.setRows),\n        getClipboardRows: getClipboardElements(clipboard.getRows),\n        setClipboardCols: setClipboardElements(clipboard.setColumns),\n        getClipboardCols: getClipboardElements(clipboard.getColumns),\n        resizeHandler: resizeHandler,\n        selectionTargets: selectionTargets\n      };\n    };\n\n    var constrainSpan = function (element, property, value) {\n      var currentColspan = getAttrValue(element, property, 1);\n      if (value === 1 || currentColspan <= 1) {\n        remove$7(element, property);\n      } else {\n        set$2(element, property, Math.min(value, currentColspan));\n      }\n    };\n    var generateColGroup = function (house, minColRange, maxColRange) {\n      if (Warehouse.hasColumns(house)) {\n        var colsToCopy = filter$2(Warehouse.justColumns(house), function (col) {\n          return col.column >= minColRange && col.column < maxColRange;\n        });\n        var copiedCols = map$1(colsToCopy, function (c) {\n          var clonedCol = deep(c.element);\n          constrainSpan(clonedCol, 'span', maxColRange - minColRange);\n          return clonedCol;\n        });\n        var fakeColgroup = SugarElement.fromTag('colgroup');\n        append(fakeColgroup, copiedCols);\n        return [fakeColgroup];\n      } else {\n        return [];\n      }\n    };\n    var generateRows = function (house, minColRange, maxColRange) {\n      return map$1(house.all, function (row) {\n        var cellsToCopy = filter$2(row.cells, function (cell) {\n          return cell.column >= minColRange && cell.column < maxColRange;\n        });\n        var copiedCells = map$1(cellsToCopy, function (cell) {\n          var clonedCell = deep(cell.element);\n          constrainSpan(clonedCell, 'colspan', maxColRange - minColRange);\n          return clonedCell;\n        });\n        var fakeTR = SugarElement.fromTag('tr');\n        append(fakeTR, copiedCells);\n        return fakeTR;\n      });\n    };\n    var copyCols = function (table, target) {\n      var house = Warehouse.fromTable(table);\n      var details = onUnlockedCells(house, target);\n      return details.map(function (selectedCells) {\n        var lastSelectedCell = selectedCells[selectedCells.length - 1];\n        var minColRange = selectedCells[0].column;\n        var maxColRange = lastSelectedCell.column + lastSelectedCell.colspan;\n        var fakeColGroups = generateColGroup(house, minColRange, maxColRange);\n        var fakeRows = generateRows(house, minColRange, maxColRange);\n        return __spreadArray(__spreadArray([], fakeColGroups, true), fakeRows, true);\n      });\n    };\n\n    var copyRows = function (table, target, generators) {\n      var warehouse = Warehouse.fromTable(table);\n      var details = onCells(warehouse, target);\n      return details.bind(function (selectedCells) {\n        var grid = toGrid(warehouse, generators, false);\n        var rows = extractGridDetails(grid).rows;\n        var slicedGrid = rows.slice(selectedCells[0].row, selectedCells[selectedCells.length - 1].row + selectedCells[selectedCells.length - 1].rowspan);\n        var filteredGrid = bind$2(slicedGrid, function (row) {\n          var newCells = filter$2(row.cells, function (cell) {\n            return !cell.isLocked;\n          });\n          return newCells.length > 0 ? [__assign(__assign({}, row), { cells: newCells })] : [];\n        });\n        var slicedDetails = toDetailList(filteredGrid);\n        return someIf(slicedDetails.length > 0, slicedDetails);\n      }).map(function (slicedDetails) {\n        return copy(slicedDetails);\n      });\n    };\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getTDTHOverallStyle = function (dom, elm, name) {\n      var cells = dom.select('td,th', elm);\n      var firstChildStyle;\n      var checkChildren = function (firstChildStyle, elms) {\n        for (var i = 0; i < elms.length; i++) {\n          var currentStyle = dom.getStyle(elms[i], name);\n          if (typeof firstChildStyle === 'undefined') {\n            firstChildStyle = currentStyle;\n          }\n          if (firstChildStyle !== currentStyle) {\n            return '';\n          }\n        }\n        return firstChildStyle;\n      };\n      return checkChildren(firstChildStyle, cells);\n    };\n    var applyAlign = function (editor, elm, name) {\n      if (name) {\n        editor.formatter.apply('align' + name, {}, elm);\n      }\n    };\n    var applyVAlign = function (editor, elm, name) {\n      if (name) {\n        editor.formatter.apply('valign' + name, {}, elm);\n      }\n    };\n    var unApplyAlign = function (editor, elm) {\n      global$2.each('left center right'.split(' '), function (name) {\n        editor.formatter.remove('align' + name, {}, elm);\n      });\n    };\n    var unApplyVAlign = function (editor, elm) {\n      global$2.each('top middle bottom'.split(' '), function (name) {\n        editor.formatter.remove('valign' + name, {}, elm);\n      });\n    };\n\n    var verticalAlignValues = [\n      {\n        text: 'None',\n        value: ''\n      },\n      {\n        text: 'Top',\n        value: 'top'\n      },\n      {\n        text: 'Middle',\n        value: 'middle'\n      },\n      {\n        text: 'Bottom',\n        value: 'bottom'\n      }\n    ];\n\n    var hexColour = function (value) {\n      return { value: value };\n    };\n    var shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n    var longformRegex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i;\n    var isHexString = function (hex) {\n      return shorthandRegex.test(hex) || longformRegex.test(hex);\n    };\n    var normalizeHex = function (hex) {\n      return removeLeading(hex, '#').toUpperCase();\n    };\n    var fromString$1 = function (hex) {\n      return isHexString(hex) ? Optional.some({ value: normalizeHex(hex) }) : Optional.none();\n    };\n    var toHex = function (component) {\n      var hex = component.toString(16);\n      return (hex.length === 1 ? '0' + hex : hex).toUpperCase();\n    };\n    var fromRgba = function (rgbaColour) {\n      var value = toHex(rgbaColour.red) + toHex(rgbaColour.green) + toHex(rgbaColour.blue);\n      return hexColour(value);\n    };\n\n    var rgbRegex = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/;\n    var rgbaRegex = /^rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*(\\d?(?:\\.\\d+)?)\\)/;\n    var rgbaColour = function (red, green, blue, alpha) {\n      return {\n        red: red,\n        green: green,\n        blue: blue,\n        alpha: alpha\n      };\n    };\n    var fromStringValues = function (red, green, blue, alpha) {\n      var r = parseInt(red, 10);\n      var g = parseInt(green, 10);\n      var b = parseInt(blue, 10);\n      var a = parseFloat(alpha);\n      return rgbaColour(r, g, b, a);\n    };\n    var fromString = function (rgbaString) {\n      if (rgbaString === 'transparent') {\n        return Optional.some(rgbaColour(0, 0, 0, 0));\n      }\n      var rgbMatch = rgbRegex.exec(rgbaString);\n      if (rgbMatch !== null) {\n        return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1'));\n      }\n      var rgbaMatch = rgbaRegex.exec(rgbaString);\n      if (rgbaMatch !== null) {\n        return Optional.some(fromStringValues(rgbaMatch[1], rgbaMatch[2], rgbaMatch[3], rgbaMatch[4]));\n      }\n      return Optional.none();\n    };\n\n    var anyToHex = function (color) {\n      return fromString$1(color).orThunk(function () {\n        return fromString(color).map(fromRgba);\n      }).getOrThunk(function () {\n        var canvas = document.createElement('canvas');\n        canvas.height = 1;\n        canvas.width = 1;\n        var canvasContext = canvas.getContext('2d');\n        canvasContext.clearRect(0, 0, canvas.width, canvas.height);\n        canvasContext.fillStyle = '#FFFFFF';\n        canvasContext.fillStyle = color;\n        canvasContext.fillRect(0, 0, 1, 1);\n        var rgba = canvasContext.getImageData(0, 0, 1, 1).data;\n        var r = rgba[0];\n        var g = rgba[1];\n        var b = rgba[2];\n        var a = rgba[3];\n        return fromRgba(rgbaColour(r, g, b, a));\n      });\n    };\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var unbindable = function () {\n      return singleton(function (s) {\n        return s.unbind();\n      });\n    };\n    var value = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var onSetupToggle = function (editor, selections, formatName, formatValue) {\n      return function (api) {\n        var boundCallback = unbindable();\n        var isNone = isEmpty$1(formatValue);\n        var init = function () {\n          var selectedCells = getCellsFromSelection(selections);\n          var checkNode = function (cell) {\n            return editor.formatter.match(formatName, { value: formatValue }, cell.dom, isNone);\n          };\n          if (isNone) {\n            api.setActive(!exists(selectedCells, checkNode));\n            boundCallback.set(editor.formatter.formatChanged(formatName, function (match) {\n              return api.setActive(!match);\n            }, true));\n          } else {\n            api.setActive(forall(selectedCells, checkNode));\n            boundCallback.set(editor.formatter.formatChanged(formatName, api.setActive, false, { value: formatValue }));\n          }\n        };\n        editor.initialized ? init() : editor.on('init', init);\n        return boundCallback.clear;\n      };\n    };\n    var isListGroup = function (item) {\n      return hasNonNullableKey(item, 'menu');\n    };\n    var buildListItems = function (items) {\n      return map$1(items, function (item) {\n        var text = item.text || item.title;\n        if (isListGroup(item)) {\n          return {\n            text: text,\n            items: buildListItems(item.menu)\n          };\n        } else {\n          return {\n            text: text,\n            value: item.value\n          };\n        }\n      });\n    };\n    var buildMenuItems = function (editor, selections, items, format, onAction) {\n      return map$1(items, function (item) {\n        var text = item.text || item.title;\n        if (isListGroup(item)) {\n          return {\n            type: 'nestedmenuitem',\n            text: text,\n            getSubmenuItems: function () {\n              return buildMenuItems(editor, selections, item.menu, format, onAction);\n            }\n          };\n        } else {\n          return {\n            text: text,\n            type: 'togglemenuitem',\n            onAction: function () {\n              return onAction(item.value);\n            },\n            onSetup: onSetupToggle(editor, selections, format, item.value)\n          };\n        }\n      });\n    };\n    var applyTableCellStyle = function (editor, style) {\n      return function (value) {\n        var _a;\n        editor.execCommand('mceTableApplyCellStyle', false, (_a = {}, _a[style] = value, _a));\n      };\n    };\n    var filterNoneItem = function (list) {\n      return bind$2(list, function (item) {\n        if (isListGroup(item)) {\n          return [__assign(__assign({}, item), { menu: filterNoneItem(item.menu) })];\n        } else {\n          return isNotEmpty(item.value) ? [item] : [];\n        }\n      });\n    };\n    var generateMenuItemsCallback = function (editor, selections, items, format, onAction) {\n      return function (callback) {\n        return callback(buildMenuItems(editor, selections, items, format, onAction));\n      };\n    };\n    var buildColorMenu = function (editor, colorList, style) {\n      var colorMap = map$1(colorList, function (entry) {\n        return {\n          text: entry.title,\n          value: '#' + anyToHex(entry.value).value,\n          type: 'choiceitem'\n        };\n      });\n      return [{\n          type: 'fancymenuitem',\n          fancytype: 'colorswatch',\n          initData: {\n            colors: colorMap.length > 0 ? colorMap : undefined,\n            allowCustomColors: false\n          },\n          onAction: function (data) {\n            var _a;\n            var value = data.value === 'remove' ? '' : data.value;\n            editor.execCommand('mceTableApplyCellStyle', false, (_a = {}, _a[style] = value, _a));\n          }\n        }];\n    };\n    var changeRowHeader = function (editor) {\n      return function () {\n        var currentType = editor.queryCommandValue('mceTableRowType');\n        var newType = currentType === 'header' ? 'body' : 'header';\n        editor.execCommand('mceTableRowType', false, { type: newType });\n      };\n    };\n    var changeColumnHeader = function (editor) {\n      return function () {\n        var currentType = editor.queryCommandValue('mceTableColType');\n        var newType = currentType === 'th' ? 'td' : 'th';\n        editor.execCommand('mceTableColType', false, { type: newType });\n      };\n    };\n\n    var getClassList$1 = function (editor) {\n      var classes = buildListItems(getCellClassList(editor));\n      if (classes.length > 0) {\n        return Optional.some({\n          name: 'class',\n          type: 'listbox',\n          label: 'Class',\n          items: classes\n        });\n      }\n      return Optional.none();\n    };\n    var children = [\n      {\n        name: 'width',\n        type: 'input',\n        label: 'Width'\n      },\n      {\n        name: 'height',\n        type: 'input',\n        label: 'Height'\n      },\n      {\n        name: 'celltype',\n        type: 'listbox',\n        label: 'Cell type',\n        items: [\n          {\n            text: 'Cell',\n            value: 'td'\n          },\n          {\n            text: 'Header cell',\n            value: 'th'\n          }\n        ]\n      },\n      {\n        name: 'scope',\n        type: 'listbox',\n        label: 'Scope',\n        items: [\n          {\n            text: 'None',\n            value: ''\n          },\n          {\n            text: 'Row',\n            value: 'row'\n          },\n          {\n            text: 'Column',\n            value: 'col'\n          },\n          {\n            text: 'Row group',\n            value: 'rowgroup'\n          },\n          {\n            text: 'Column group',\n            value: 'colgroup'\n          }\n        ]\n      },\n      {\n        name: 'halign',\n        type: 'listbox',\n        label: 'Horizontal align',\n        items: [\n          {\n            text: 'None',\n            value: ''\n          },\n          {\n            text: 'Left',\n            value: 'left'\n          },\n          {\n            text: 'Center',\n            value: 'center'\n          },\n          {\n            text: 'Right',\n            value: 'right'\n          }\n        ]\n      },\n      {\n        name: 'valign',\n        type: 'listbox',\n        label: 'Vertical align',\n        items: verticalAlignValues\n      }\n    ];\n    var getItems$2 = function (editor) {\n      return children.concat(getClassList$1(editor).toArray());\n    };\n\n    var getAdvancedTab = function (editor, dialogName) {\n      var emptyBorderStyle = [{\n          text: 'Select...',\n          value: ''\n        }];\n      var advTabItems = [\n        {\n          name: 'borderstyle',\n          type: 'listbox',\n          label: 'Border style',\n          items: emptyBorderStyle.concat(buildListItems(getTableBorderStyles(editor)))\n        },\n        {\n          name: 'bordercolor',\n          type: 'colorinput',\n          label: 'Border color'\n        },\n        {\n          name: 'backgroundcolor',\n          type: 'colorinput',\n          label: 'Background color'\n        }\n      ];\n      var borderWidth = {\n        name: 'borderwidth',\n        type: 'input',\n        label: 'Border width'\n      };\n      var items = dialogName === 'cell' ? [borderWidth].concat(advTabItems) : advTabItems;\n      return {\n        title: 'Advanced',\n        name: 'advanced',\n        items: items\n      };\n    };\n\n    var modifiers = function (testTruthy) {\n      return function (editor, node) {\n        var dom = editor.dom;\n        var setAttrib = function (attr, value) {\n          if (!testTruthy || value) {\n            dom.setAttrib(node, attr, value);\n          }\n        };\n        var setStyle = function (prop, value) {\n          if (!testTruthy || value) {\n            dom.setStyle(node, prop, value);\n          }\n        };\n        var setFormat = function (formatName, value) {\n          if (!testTruthy || value) {\n            if (value === '') {\n              editor.formatter.remove(formatName, { value: null }, node, true);\n            } else {\n              editor.formatter.apply(formatName, { value: value }, node);\n            }\n          }\n        };\n        return {\n          setAttrib: setAttrib,\n          setStyle: setStyle,\n          setFormat: setFormat\n        };\n      };\n    };\n    var DomModifier = {\n      normal: modifiers(false),\n      ifTruthy: modifiers(true)\n    };\n\n    var rgbToHex = function (dom) {\n      return function (value) {\n        return startsWith(value, 'rgb') ? dom.toHex(value) : value;\n      };\n    };\n    var extractAdvancedStyles = function (dom, elm) {\n      var element = SugarElement.fromDom(elm);\n      return {\n        borderwidth: getRaw$2(element, 'border-width').getOr(''),\n        borderstyle: getRaw$2(element, 'border-style').getOr(''),\n        bordercolor: getRaw$2(element, 'border-color').map(rgbToHex(dom)).getOr(''),\n        backgroundcolor: getRaw$2(element, 'background-color').map(rgbToHex(dom)).getOr('')\n      };\n    };\n    var getSharedValues = function (data) {\n      var baseData = data[0];\n      var comparisonData = data.slice(1);\n      each$2(comparisonData, function (items) {\n        each$2(keys(baseData), function (key) {\n          each$1(items, function (itemValue, itemKey) {\n            var comparisonValue = baseData[key];\n            if (comparisonValue !== '' && key === itemKey) {\n              if (comparisonValue !== itemValue) {\n                baseData[key] = '';\n              }\n            }\n          });\n        });\n      });\n      return baseData;\n    };\n    var getAlignment = function (formats, formatName, editor, elm) {\n      return find$1(formats, function (name) {\n        return !isUndefined(editor.formatter.matchNode(elm, formatName + name));\n      }).getOr('');\n    };\n    var getHAlignment = curry(getAlignment, [\n      'left',\n      'center',\n      'right'\n    ], 'align');\n    var getVAlignment = curry(getAlignment, [\n      'top',\n      'middle',\n      'bottom'\n    ], 'valign');\n    var extractDataFromSettings = function (editor, hasAdvTableTab) {\n      var style = getDefaultStyles(editor);\n      var attrs = getDefaultAttributes(editor);\n      var extractAdvancedStyleData = function (dom) {\n        return {\n          borderstyle: get$c(style, 'border-style').getOr(''),\n          bordercolor: rgbToHex(dom)(get$c(style, 'border-color').getOr('')),\n          backgroundcolor: rgbToHex(dom)(get$c(style, 'background-color').getOr(''))\n        };\n      };\n      var defaultData = {\n        height: '',\n        width: '100%',\n        cellspacing: '',\n        cellpadding: '',\n        caption: false,\n        class: '',\n        align: '',\n        border: ''\n      };\n      var getBorder = function () {\n        var borderWidth = style['border-width'];\n        if (shouldStyleWithCss(editor) && borderWidth) {\n          return { border: borderWidth };\n        }\n        return get$c(attrs, 'border').fold(function () {\n          return {};\n        }, function (border) {\n          return { border: border };\n        });\n      };\n      var advStyle = hasAdvTableTab ? extractAdvancedStyleData(editor.dom) : {};\n      var getCellPaddingCellSpacing = function () {\n        var spacing = get$c(style, 'border-spacing').or(get$c(attrs, 'cellspacing')).fold(function () {\n          return {};\n        }, function (cellspacing) {\n          return { cellspacing: cellspacing };\n        });\n        var padding = get$c(style, 'border-padding').or(get$c(attrs, 'cellpadding')).fold(function () {\n          return {};\n        }, function (cellpadding) {\n          return { cellpadding: cellpadding };\n        });\n        return __assign(__assign({}, spacing), padding);\n      };\n      var data = __assign(__assign(__assign(__assign(__assign(__assign({}, defaultData), style), attrs), advStyle), getBorder()), getCellPaddingCellSpacing());\n      return data;\n    };\n    var getRowType = function (elm) {\n      return table(SugarElement.fromDom(elm)).map(function (table) {\n        var target = { selection: fromDom(elm.cells) };\n        return getRowsType(table, target);\n      }).getOr('');\n    };\n    var extractDataFromTableElement = function (editor, elm, hasAdvTableTab) {\n      var getBorder = function (dom, elm) {\n        var optBorderWidth = getRaw$2(SugarElement.fromDom(elm), 'border-width');\n        if (shouldStyleWithCss(editor) && optBorderWidth.isSome()) {\n          return optBorderWidth.getOr('');\n        }\n        return dom.getAttrib(elm, 'border') || getTDTHOverallStyle(editor.dom, elm, 'border-width') || getTDTHOverallStyle(editor.dom, elm, 'border');\n      };\n      var dom = editor.dom;\n      var cellspacing = shouldStyleWithCss(editor) ? dom.getStyle(elm, 'border-spacing') || dom.getAttrib(elm, 'cellspacing') : dom.getAttrib(elm, 'cellspacing') || dom.getStyle(elm, 'border-spacing');\n      var cellpadding = shouldStyleWithCss(editor) ? getTDTHOverallStyle(dom, elm, 'padding') || dom.getAttrib(elm, 'cellpadding') : dom.getAttrib(elm, 'cellpadding') || getTDTHOverallStyle(dom, elm, 'padding');\n      return __assign({\n        width: dom.getStyle(elm, 'width') || dom.getAttrib(elm, 'width'),\n        height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),\n        cellspacing: cellspacing,\n        cellpadding: cellpadding,\n        border: getBorder(dom, elm),\n        caption: !!dom.select('caption', elm)[0],\n        class: dom.getAttrib(elm, 'class', ''),\n        align: getHAlignment(editor, elm)\n      }, hasAdvTableTab ? extractAdvancedStyles(dom, elm) : {});\n    };\n    var extractDataFromRowElement = function (editor, elm, hasAdvancedRowTab) {\n      var dom = editor.dom;\n      return __assign({\n        height: dom.getStyle(elm, 'height') || dom.getAttrib(elm, 'height'),\n        class: dom.getAttrib(elm, 'class', ''),\n        type: getRowType(elm),\n        align: getHAlignment(editor, elm)\n      }, hasAdvancedRowTab ? extractAdvancedStyles(dom, elm) : {});\n    };\n    var extractDataFromCellElement = function (editor, cell, hasAdvancedCellTab, column) {\n      var dom = editor.dom;\n      var colElm = column.getOr(cell);\n      var getStyle = function (element, style) {\n        return dom.getStyle(element, style) || dom.getAttrib(element, style);\n      };\n      return __assign({\n        width: getStyle(colElm, 'width'),\n        height: getStyle(cell, 'height'),\n        scope: dom.getAttrib(cell, 'scope'),\n        celltype: getNodeName(cell),\n        class: dom.getAttrib(cell, 'class', ''),\n        halign: getHAlignment(editor, cell),\n        valign: getVAlignment(editor, cell)\n      }, hasAdvancedCellTab ? extractAdvancedStyles(dom, cell) : {});\n    };\n\n    var getSelectedCells = function (table, cells) {\n      var warehouse = Warehouse.fromTable(table);\n      var allCells = Warehouse.justCells(warehouse);\n      var filtered = filter$2(allCells, function (cellA) {\n        return exists(cells, function (cellB) {\n          return eq$1(cellA.element, cellB);\n        });\n      });\n      return map$1(filtered, function (cell) {\n        return {\n          element: cell.element.dom,\n          column: Warehouse.getColumnAt(warehouse, cell.column).map(function (col) {\n            return col.element.dom;\n          })\n        };\n      });\n    };\n    var updateSimpleProps$1 = function (modifier, colModifier, data) {\n      modifier.setAttrib('scope', data.scope);\n      modifier.setAttrib('class', data.class);\n      modifier.setStyle('height', addPxSuffix(data.height));\n      colModifier.setStyle('width', addPxSuffix(data.width));\n    };\n    var updateAdvancedProps$1 = function (modifier, data) {\n      modifier.setFormat('tablecellbackgroundcolor', data.backgroundcolor);\n      modifier.setFormat('tablecellbordercolor', data.bordercolor);\n      modifier.setFormat('tablecellborderstyle', data.borderstyle);\n      modifier.setFormat('tablecellborderwidth', addPxSuffix(data.borderwidth));\n    };\n    var applyStyleData$1 = function (editor, cells, data) {\n      var isSingleCell = cells.length === 1;\n      each$2(cells, function (item) {\n        var cellElm = item.element;\n        var modifier = isSingleCell ? DomModifier.normal(editor, cellElm) : DomModifier.ifTruthy(editor, cellElm);\n        var colModifier = item.column.map(function (col) {\n          return isSingleCell ? DomModifier.normal(editor, col) : DomModifier.ifTruthy(editor, col);\n        }).getOr(modifier);\n        updateSimpleProps$1(modifier, colModifier, data);\n        if (hasAdvancedCellTab(editor)) {\n          updateAdvancedProps$1(modifier, data);\n        }\n        if (isSingleCell) {\n          unApplyAlign(editor, cellElm);\n          unApplyVAlign(editor, cellElm);\n        }\n        if (data.halign) {\n          applyAlign(editor, cellElm, data.halign);\n        }\n        if (data.valign) {\n          applyVAlign(editor, cellElm, data.valign);\n        }\n      });\n    };\n    var applyStructureData$1 = function (editor, data) {\n      editor.execCommand('mceTableCellType', false, {\n        type: data.celltype,\n        no_events: true\n      });\n    };\n    var applyCellData = function (editor, cells, oldData, data) {\n      var modifiedData = filter$1(data, function (value, key) {\n        return oldData[key] !== value;\n      });\n      if (size(modifiedData) > 0 && cells.length >= 1) {\n        table(cells[0]).each(function (table) {\n          var selectedCells = getSelectedCells(table, cells);\n          var styleModified = size(filter$1(modifiedData, function (_value, key) {\n            return key !== 'scope' && key !== 'celltype';\n          })) > 0;\n          var structureModified = has$1(modifiedData, 'celltype');\n          if (styleModified || has$1(modifiedData, 'scope')) {\n            applyStyleData$1(editor, selectedCells, data);\n          }\n          if (structureModified) {\n            applyStructureData$1(editor, data);\n          }\n          fireTableModified(editor, table.dom, {\n            structure: structureModified,\n            style: styleModified\n          });\n        });\n      }\n    };\n    var onSubmitCellForm = function (editor, cells, oldData, api) {\n      var data = api.getData();\n      api.close();\n      editor.undoManager.transact(function () {\n        applyCellData(editor, cells, oldData, data);\n        editor.focus();\n      });\n    };\n    var getData = function (editor, cells) {\n      var cellsData = table(cells[0]).map(function (table) {\n        return map$1(getSelectedCells(table, cells), function (item) {\n          return extractDataFromCellElement(editor, item.element, hasAdvancedCellTab(editor), item.column);\n        });\n      });\n      return getSharedValues(cellsData.getOrDie());\n    };\n    var open$2 = function (editor, selections) {\n      var cells = getCellsFromSelection(selections);\n      if (cells.length === 0) {\n        return;\n      }\n      var data = getData(editor, cells);\n      var dialogTabPanel = {\n        type: 'tabpanel',\n        tabs: [\n          {\n            title: 'General',\n            name: 'general',\n            items: getItems$2(editor)\n          },\n          getAdvancedTab(editor, 'cell')\n        ]\n      };\n      var dialogPanel = {\n        type: 'panel',\n        items: [{\n            type: 'grid',\n            columns: 2,\n            items: getItems$2(editor)\n          }]\n      };\n      editor.windowManager.open({\n        title: 'Cell Properties',\n        size: 'normal',\n        body: hasAdvancedCellTab(editor) ? dialogTabPanel : dialogPanel,\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: data,\n        onSubmit: curry(onSubmitCellForm, editor, cells, data)\n      });\n    };\n\n    var getClassList = function (editor) {\n      var classes = buildListItems(getRowClassList(editor));\n      if (classes.length > 0) {\n        return Optional.some({\n          name: 'class',\n          type: 'listbox',\n          label: 'Class',\n          items: classes\n        });\n      }\n      return Optional.none();\n    };\n    var formChildren = [\n      {\n        type: 'listbox',\n        name: 'type',\n        label: 'Row type',\n        items: [\n          {\n            text: 'Header',\n            value: 'header'\n          },\n          {\n            text: 'Body',\n            value: 'body'\n          },\n          {\n            text: 'Footer',\n            value: 'footer'\n          }\n        ]\n      },\n      {\n        type: 'listbox',\n        name: 'align',\n        label: 'Alignment',\n        items: [\n          {\n            text: 'None',\n            value: ''\n          },\n          {\n            text: 'Left',\n            value: 'left'\n          },\n          {\n            text: 'Center',\n            value: 'center'\n          },\n          {\n            text: 'Right',\n            value: 'right'\n          }\n        ]\n      },\n      {\n        label: 'Height',\n        name: 'height',\n        type: 'input'\n      }\n    ];\n    var getItems$1 = function (editor) {\n      return formChildren.concat(getClassList(editor).toArray());\n    };\n\n    var updateSimpleProps = function (modifier, data) {\n      modifier.setAttrib('class', data.class);\n      modifier.setStyle('height', addPxSuffix(data.height));\n    };\n    var updateAdvancedProps = function (modifier, data) {\n      modifier.setStyle('background-color', data.backgroundcolor);\n      modifier.setStyle('border-color', data.bordercolor);\n      modifier.setStyle('border-style', data.borderstyle);\n    };\n    var applyStyleData = function (editor, rows, data, oldData) {\n      var isSingleRow = rows.length === 1;\n      each$2(rows, function (rowElm) {\n        var modifier = isSingleRow ? DomModifier.normal(editor, rowElm) : DomModifier.ifTruthy(editor, rowElm);\n        updateSimpleProps(modifier, data);\n        if (hasAdvancedRowTab(editor)) {\n          updateAdvancedProps(modifier, data);\n        }\n        if (data.align !== oldData.align) {\n          unApplyAlign(editor, rowElm);\n          applyAlign(editor, rowElm, data.align);\n        }\n      });\n    };\n    var applyStructureData = function (editor, data) {\n      editor.execCommand('mceTableRowType', false, {\n        type: data.type,\n        no_events: true\n      });\n    };\n    var applyRowData = function (editor, rows, oldData, data) {\n      var modifiedData = filter$1(data, function (value, key) {\n        return oldData[key] !== value;\n      });\n      if (size(modifiedData) > 0) {\n        var typeModified_1 = has$1(modifiedData, 'type');\n        var styleModified_1 = typeModified_1 ? size(modifiedData) > 1 : true;\n        if (styleModified_1) {\n          applyStyleData(editor, rows, data, oldData);\n        }\n        if (typeModified_1) {\n          applyStructureData(editor, data);\n        }\n        table(SugarElement.fromDom(rows[0])).each(function (table) {\n          return fireTableModified(editor, table.dom, {\n            structure: typeModified_1,\n            style: styleModified_1\n          });\n        });\n      }\n    };\n    var onSubmitRowForm = function (editor, rows, oldData, api) {\n      var data = api.getData();\n      api.close();\n      editor.undoManager.transact(function () {\n        applyRowData(editor, rows, oldData, data);\n        editor.focus();\n      });\n    };\n    var open$1 = function (editor) {\n      var rows = getRowsFromSelection(getSelectionStart(editor), ephemera.selected);\n      if (rows.length === 0) {\n        return;\n      }\n      var rowsData = map$1(rows, function (rowElm) {\n        return extractDataFromRowElement(editor, rowElm.dom, hasAdvancedRowTab(editor));\n      });\n      var data = getSharedValues(rowsData);\n      var dialogTabPanel = {\n        type: 'tabpanel',\n        tabs: [\n          {\n            title: 'General',\n            name: 'general',\n            items: getItems$1(editor)\n          },\n          getAdvancedTab(editor, 'row')\n        ]\n      };\n      var dialogPanel = {\n        type: 'panel',\n        items: [{\n            type: 'grid',\n            columns: 2,\n            items: getItems$1(editor)\n          }]\n      };\n      editor.windowManager.open({\n        title: 'Row Properties',\n        size: 'normal',\n        body: hasAdvancedRowTab(editor) ? dialogTabPanel : dialogPanel,\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: data,\n        onSubmit: curry(onSubmitRowForm, editor, map$1(rows, function (r) {\n          return r.dom;\n        }), data)\n      });\n    };\n\n    var getItems = function (editor, classes, insertNewTable) {\n      var rowColCountItems = !insertNewTable ? [] : [\n        {\n          type: 'input',\n          name: 'cols',\n          label: 'Cols',\n          inputMode: 'numeric'\n        },\n        {\n          type: 'input',\n          name: 'rows',\n          label: 'Rows',\n          inputMode: 'numeric'\n        }\n      ];\n      var alwaysItems = [\n        {\n          type: 'input',\n          name: 'width',\n          label: 'Width'\n        },\n        {\n          type: 'input',\n          name: 'height',\n          label: 'Height'\n        }\n      ];\n      var appearanceItems = hasAppearanceOptions(editor) ? [\n        {\n          type: 'input',\n          name: 'cellspacing',\n          label: 'Cell spacing',\n          inputMode: 'numeric'\n        },\n        {\n          type: 'input',\n          name: 'cellpadding',\n          label: 'Cell padding',\n          inputMode: 'numeric'\n        },\n        {\n          type: 'input',\n          name: 'border',\n          label: 'Border width'\n        },\n        {\n          type: 'label',\n          label: 'Caption',\n          items: [{\n              type: 'checkbox',\n              name: 'caption',\n              label: 'Show caption'\n            }]\n        }\n      ] : [];\n      var alignmentItem = [{\n          type: 'listbox',\n          name: 'align',\n          label: 'Alignment',\n          items: [\n            {\n              text: 'None',\n              value: ''\n            },\n            {\n              text: 'Left',\n              value: 'left'\n            },\n            {\n              text: 'Center',\n              value: 'center'\n            },\n            {\n              text: 'Right',\n              value: 'right'\n            }\n          ]\n        }];\n      var classListItem = classes.length > 0 ? [{\n          type: 'listbox',\n          name: 'class',\n          label: 'Class',\n          items: classes\n        }] : [];\n      return rowColCountItems.concat(alwaysItems).concat(appearanceItems).concat(alignmentItem).concat(classListItem);\n    };\n\n    var styleTDTH = function (dom, elm, name, value) {\n      if (elm.tagName === 'TD' || elm.tagName === 'TH') {\n        if (isString(name)) {\n          dom.setStyle(elm, name, value);\n        } else {\n          dom.setStyle(elm, name);\n        }\n      } else {\n        if (elm.children) {\n          for (var i = 0; i < elm.children.length; i++) {\n            styleTDTH(dom, elm.children[i], name, value);\n          }\n        }\n      }\n    };\n    var applyDataToElement = function (editor, tableElm, data) {\n      var dom = editor.dom;\n      var attrs = {};\n      var styles = {};\n      attrs.class = data.class;\n      styles.height = addPxSuffix(data.height);\n      if (dom.getAttrib(tableElm, 'width') && !shouldStyleWithCss(editor)) {\n        attrs.width = removePxSuffix(data.width);\n      } else {\n        styles.width = addPxSuffix(data.width);\n      }\n      if (shouldStyleWithCss(editor)) {\n        styles['border-width'] = addPxSuffix(data.border);\n        styles['border-spacing'] = addPxSuffix(data.cellspacing);\n      } else {\n        attrs.border = data.border;\n        attrs.cellpadding = data.cellpadding;\n        attrs.cellspacing = data.cellspacing;\n      }\n      if (shouldStyleWithCss(editor) && tableElm.children) {\n        for (var i = 0; i < tableElm.children.length; i++) {\n          styleTDTH(dom, tableElm.children[i], {\n            'border-width': addPxSuffix(data.border),\n            'padding': addPxSuffix(data.cellpadding)\n          });\n          if (hasAdvancedTableTab(editor)) {\n            styleTDTH(dom, tableElm.children[i], { 'border-color': data.bordercolor });\n          }\n        }\n      }\n      if (hasAdvancedTableTab(editor)) {\n        styles['background-color'] = data.backgroundcolor;\n        styles['border-color'] = data.bordercolor;\n        styles['border-style'] = data.borderstyle;\n      }\n      attrs.style = dom.serializeStyle(__assign(__assign({}, getDefaultStyles(editor)), styles));\n      dom.setAttribs(tableElm, __assign(__assign({}, getDefaultAttributes(editor)), attrs));\n    };\n    var onSubmitTableForm = function (editor, tableElm, oldData, api) {\n      var dom = editor.dom;\n      var data = api.getData();\n      var modifiedData = filter$1(data, function (value, key) {\n        return oldData[key] !== value;\n      });\n      api.close();\n      if (data.class === '') {\n        delete data.class;\n      }\n      editor.undoManager.transact(function () {\n        if (!tableElm) {\n          var cols = parseInt(data.cols, 10) || 1;\n          var rows = parseInt(data.rows, 10) || 1;\n          tableElm = insert(editor, cols, rows, 0, 0);\n        }\n        if (size(modifiedData) > 0) {\n          applyDataToElement(editor, tableElm, data);\n          var captionElm = dom.select('caption', tableElm)[0];\n          if (captionElm && !data.caption || !captionElm && data.caption) {\n            editor.execCommand('mceTableToggleCaption');\n          }\n          if (data.align === '') {\n            unApplyAlign(editor, tableElm);\n          } else {\n            applyAlign(editor, tableElm, data.align);\n          }\n        }\n        editor.focus();\n        editor.addVisual();\n        if (size(modifiedData) > 0) {\n          var captionModified = has$1(modifiedData, 'caption');\n          var styleModified = captionModified ? size(modifiedData) > 1 : true;\n          fireTableModified(editor, tableElm, {\n            structure: captionModified,\n            style: styleModified\n          });\n        }\n      });\n    };\n    var open = function (editor, insertNewTable) {\n      var dom = editor.dom;\n      var tableElm;\n      var data = extractDataFromSettings(editor, hasAdvancedTableTab(editor));\n      if (insertNewTable === false) {\n        tableElm = dom.getParent(editor.selection.getStart(), 'table', editor.getBody());\n        if (tableElm) {\n          data = extractDataFromTableElement(editor, tableElm, hasAdvancedTableTab(editor));\n        } else {\n          if (hasAdvancedTableTab(editor)) {\n            data.borderstyle = '';\n            data.bordercolor = '';\n            data.backgroundcolor = '';\n          }\n        }\n      } else {\n        data.cols = '1';\n        data.rows = '1';\n        if (hasAdvancedTableTab(editor)) {\n          data.borderstyle = '';\n          data.bordercolor = '';\n          data.backgroundcolor = '';\n        }\n      }\n      var classes = buildListItems(getTableClassList(editor));\n      if (classes.length > 0) {\n        if (data.class) {\n          data.class = data.class.replace(/\\s*mce\\-item\\-table\\s*/g, '');\n        }\n      }\n      var generalPanel = {\n        type: 'grid',\n        columns: 2,\n        items: getItems(editor, classes, insertNewTable)\n      };\n      var nonAdvancedForm = function () {\n        return {\n          type: 'panel',\n          items: [generalPanel]\n        };\n      };\n      var advancedForm = function () {\n        return {\n          type: 'tabpanel',\n          tabs: [\n            {\n              title: 'General',\n              name: 'general',\n              items: [generalPanel]\n            },\n            getAdvancedTab(editor, 'table')\n          ]\n        };\n      };\n      var dialogBody = hasAdvancedTableTab(editor) ? advancedForm() : nonAdvancedForm();\n      editor.windowManager.open({\n        title: 'Table Properties',\n        size: 'normal',\n        body: dialogBody,\n        onSubmit: curry(onSubmitTableForm, editor, tableElm, data),\n        buttons: [\n          {\n            type: 'cancel',\n            name: 'cancel',\n            text: 'Cancel'\n          },\n          {\n            type: 'submit',\n            name: 'save',\n            text: 'Save',\n            primary: true\n          }\n        ],\n        initialData: data\n      });\n    };\n\n    var getSelectionStartCellOrCaption = function (editor) {\n      return getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor));\n    };\n    var getSelectionStartCell = function (editor) {\n      return getSelectionCell(getSelectionStart(editor), getIsRoot(editor));\n    };\n    var registerCommands = function (editor, actions, cellSelection, selections, clipboard) {\n      var isRoot = getIsRoot(editor);\n      var eraseTable = function () {\n        return getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) {\n          table(cellOrCaption, isRoot).filter(not(isRoot)).each(function (table) {\n            var cursor = SugarElement.fromText('');\n            after$5(table, cursor);\n            remove$5(table);\n            if (editor.dom.isEmpty(editor.getBody())) {\n              editor.setContent('');\n              editor.selection.setCursorLocation();\n            } else {\n              var rng = editor.dom.createRng();\n              rng.setStart(cursor.dom, 0);\n              rng.setEnd(cursor.dom, 0);\n              editor.selection.setRng(rng);\n              editor.nodeChanged();\n            }\n          });\n        });\n      };\n      var setSizingMode = function (sizing) {\n        return getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) {\n          var isForcedSizing = isResponsiveForced(editor) || isPixelsForced(editor) || isPercentagesForced(editor);\n          if (!isForcedSizing) {\n            table(cellOrCaption, isRoot).each(function (table) {\n              if (sizing === 'relative' && !isPercentSizing(table)) {\n                enforcePercentage(table);\n              } else if (sizing === 'fixed' && !isPixelSizing(table)) {\n                enforcePixels(table);\n              } else if (sizing === 'responsive' && !isNoneSizing(table)) {\n                enforceNone(table);\n              }\n              removeDataStyle(table);\n              fireTableModified(editor, table.dom, structureModified);\n            });\n          }\n        });\n      };\n      var getTableFromCell = function (cell) {\n        return table(cell, isRoot);\n      };\n      var performActionOnSelection = function (action) {\n        return getSelectionStartCell(editor).bind(function (cell) {\n          return getTableFromCell(cell).map(function (table) {\n            return action(table, cell);\n          });\n        });\n      };\n      var toggleTableClass = function (_ui, clazz) {\n        performActionOnSelection(function (table) {\n          editor.formatter.toggle('tableclass', { value: clazz }, table.dom);\n          fireTableModified(editor, table.dom, styleModified);\n        });\n      };\n      var toggleTableCellClass = function (_ui, clazz) {\n        performActionOnSelection(function (table) {\n          var selectedCells = getCellsFromSelection(selections);\n          var allHaveClass = forall(selectedCells, function (cell) {\n            return editor.formatter.match('tablecellclass', { value: clazz }, cell.dom);\n          });\n          var formatterAction = allHaveClass ? editor.formatter.remove : editor.formatter.apply;\n          each$2(selectedCells, function (cell) {\n            return formatterAction('tablecellclass', { value: clazz }, cell.dom);\n          });\n          fireTableModified(editor, table.dom, styleModified);\n        });\n      };\n      var toggleCaption = function () {\n        getSelectionStartCellOrCaption(editor).each(function (cellOrCaption) {\n          table(cellOrCaption, isRoot).each(function (table) {\n            child$1(table, 'caption').fold(function () {\n              var caption = SugarElement.fromTag('caption');\n              append$1(caption, SugarElement.fromText('Caption'));\n              appendAt(table, caption, 0);\n              editor.selection.setCursorLocation(caption.dom, 0);\n            }, function (caption) {\n              if (isTag('caption')(cellOrCaption)) {\n                one('td', table).each(function (td) {\n                  return editor.selection.setCursorLocation(td.dom, 0);\n                });\n              }\n              remove$5(caption);\n            });\n            fireTableModified(editor, table.dom, structureModified);\n          });\n        });\n      };\n      var postExecute = function (_data) {\n        editor.focus();\n      };\n      var actOnSelection = function (execute, noEvents) {\n        if (noEvents === void 0) {\n          noEvents = false;\n        }\n        return performActionOnSelection(function (table, startCell) {\n          var targets = forMenu(selections, table, startCell);\n          execute(table, targets, noEvents).each(postExecute);\n        });\n      };\n      var copyRowSelection = function () {\n        return performActionOnSelection(function (table, startCell) {\n          var targets = forMenu(selections, table, startCell);\n          var generators = cellOperations(noop, SugarElement.fromDom(editor.getDoc()), Optional.none());\n          return copyRows(table, targets, generators);\n        });\n      };\n      var copyColSelection = function () {\n        return performActionOnSelection(function (table, startCell) {\n          var targets = forMenu(selections, table, startCell);\n          return copyCols(table, targets);\n        });\n      };\n      var pasteOnSelection = function (execute, getRows) {\n        return getRows().each(function (rows) {\n          var clonedRows = map$1(rows, function (row) {\n            return deep(row);\n          });\n          performActionOnSelection(function (table, startCell) {\n            var generators = paste$1(SugarElement.fromDom(editor.getDoc()));\n            var targets = pasteRows(selections, startCell, clonedRows, generators);\n            execute(table, targets).each(postExecute);\n          });\n        });\n      };\n      var actOnType = function (getAction) {\n        return function (_ui, args) {\n          return get$c(args, 'type').each(function (type) {\n            actOnSelection(getAction(type), args.no_events);\n          });\n        };\n      };\n      each$1({\n        mceTableSplitCells: function () {\n          return actOnSelection(actions.unmergeCells);\n        },\n        mceTableMergeCells: function () {\n          return actOnSelection(actions.mergeCells);\n        },\n        mceTableInsertRowBefore: function () {\n          return actOnSelection(actions.insertRowsBefore);\n        },\n        mceTableInsertRowAfter: function () {\n          return actOnSelection(actions.insertRowsAfter);\n        },\n        mceTableInsertColBefore: function () {\n          return actOnSelection(actions.insertColumnsBefore);\n        },\n        mceTableInsertColAfter: function () {\n          return actOnSelection(actions.insertColumnsAfter);\n        },\n        mceTableDeleteCol: function () {\n          return actOnSelection(actions.deleteColumn);\n        },\n        mceTableDeleteRow: function () {\n          return actOnSelection(actions.deleteRow);\n        },\n        mceTableCutCol: function () {\n          return copyColSelection().each(function (selection) {\n            clipboard.setColumns(selection);\n            actOnSelection(actions.deleteColumn);\n          });\n        },\n        mceTableCutRow: function () {\n          return copyRowSelection().each(function (selection) {\n            clipboard.setRows(selection);\n            actOnSelection(actions.deleteRow);\n          });\n        },\n        mceTableCopyCol: function () {\n          return copyColSelection().each(function (selection) {\n            return clipboard.setColumns(selection);\n          });\n        },\n        mceTableCopyRow: function () {\n          return copyRowSelection().each(function (selection) {\n            return clipboard.setRows(selection);\n          });\n        },\n        mceTablePasteColBefore: function () {\n          return pasteOnSelection(actions.pasteColsBefore, clipboard.getColumns);\n        },\n        mceTablePasteColAfter: function () {\n          return pasteOnSelection(actions.pasteColsAfter, clipboard.getColumns);\n        },\n        mceTablePasteRowBefore: function () {\n          return pasteOnSelection(actions.pasteRowsBefore, clipboard.getRows);\n        },\n        mceTablePasteRowAfter: function () {\n          return pasteOnSelection(actions.pasteRowsAfter, clipboard.getRows);\n        },\n        mceTableDelete: eraseTable,\n        mceTableCellToggleClass: toggleTableCellClass,\n        mceTableToggleClass: toggleTableClass,\n        mceTableToggleCaption: toggleCaption,\n        mceTableSizingMode: function (_ui, sizing) {\n          return setSizingMode(sizing);\n        },\n        mceTableCellType: actOnType(function (type) {\n          return type === 'th' ? actions.makeCellsHeader : actions.unmakeCellsHeader;\n        }),\n        mceTableColType: actOnType(function (type) {\n          return type === 'th' ? actions.makeColumnsHeader : actions.unmakeColumnsHeader;\n        }),\n        mceTableRowType: actOnType(function (type) {\n          switch (type) {\n          case 'header':\n            return actions.makeRowsHeader;\n          case 'footer':\n            return actions.makeRowsFooter;\n          default:\n            return actions.makeRowsBody;\n          }\n        })\n      }, function (func, name) {\n        return editor.addCommand(name, func);\n      });\n      each$1({\n        mceTableProps: curry(open, editor, false),\n        mceTableRowProps: curry(open$1, editor),\n        mceTableCellProps: curry(open$2, editor, selections)\n      }, function (func, name) {\n        return editor.addCommand(name, function () {\n          return func();\n        });\n      });\n      editor.addCommand('mceInsertTable', function (_ui, args) {\n        if (isObject(args) && keys(args).length > 0) {\n          insertTableWithDataValidation(editor, args.rows, args.columns, args.options, 'Invalid values for mceInsertTable - rows and columns values are required to insert a table.');\n        } else {\n          open(editor, true);\n        }\n      });\n      editor.addCommand('mceTableApplyCellStyle', function (_ui, args) {\n        var getFormatName = function (style) {\n          return 'tablecell' + style.toLowerCase().replace('-', '');\n        };\n        if (!isObject(args)) {\n          return;\n        }\n        var cells = getCellsFromSelection(selections);\n        if (cells.length === 0) {\n          return;\n        }\n        var validArgs = filter$1(args, function (value, style) {\n          return editor.formatter.has(getFormatName(style)) && isString(value);\n        });\n        if (isEmpty(validArgs)) {\n          return;\n        }\n        each$1(validArgs, function (value, style) {\n          each$2(cells, function (cell) {\n            DomModifier.normal(editor, cell.dom).setFormat(getFormatName(style), value);\n          });\n        });\n        getTableFromCell(cells[0]).each(function (table) {\n          return fireTableModified(editor, table.dom, styleModified);\n        });\n      });\n    };\n\n    var registerQueryCommands = function (editor, actions, selections) {\n      var isRoot = getIsRoot(editor);\n      var lookupOnSelection = function (action) {\n        return getSelectionCell(getSelectionStart(editor)).bind(function (cell) {\n          return table(cell, isRoot).map(function (table) {\n            var targets = forMenu(selections, table, cell);\n            return action(table, targets);\n          });\n        }).getOr('');\n      };\n      each$1({\n        mceTableRowType: function () {\n          return lookupOnSelection(actions.getTableRowType);\n        },\n        mceTableCellType: function () {\n          return lookupOnSelection(actions.getTableCellType);\n        },\n        mceTableColType: function () {\n          return lookupOnSelection(actions.getTableColType);\n        }\n      }, function (func, name) {\n        return editor.addQueryValueHandler(name, func);\n      });\n    };\n\n    var Clipboard = function () {\n      var rows = value();\n      var cols = value();\n      return {\n        getRows: rows.get,\n        setRows: function (r) {\n          r.fold(rows.clear, rows.set);\n          cols.clear();\n        },\n        clearRows: rows.clear,\n        getColumns: cols.get,\n        setColumns: function (c) {\n          c.fold(cols.clear, cols.set);\n          rows.clear();\n        },\n        clearColumns: cols.clear\n      };\n    };\n\n    var genericBase = {\n      remove_similar: true,\n      inherit: false\n    };\n    var cellBase = __assign({ selector: 'td,th' }, genericBase);\n    var cellFormats = {\n      tablecellbackgroundcolor: __assign({ styles: { backgroundColor: '%value' } }, cellBase),\n      tablecellverticalalign: __assign({ styles: { 'vertical-align': '%value' } }, cellBase),\n      tablecellbordercolor: __assign({ styles: { borderColor: '%value' } }, cellBase),\n      tablecellclass: __assign({ classes: ['%value'] }, cellBase),\n      tableclass: __assign({\n        selector: 'table',\n        classes: ['%value']\n      }, genericBase),\n      tablecellborderstyle: __assign({ styles: { borderStyle: '%value' } }, cellBase),\n      tablecellborderwidth: __assign({ styles: { borderWidth: '%value' } }, cellBase)\n    };\n    var registerFormats = function (editor) {\n      editor.formatter.register(cellFormats);\n    };\n\n    var adt$5 = Adt.generate([\n      { none: ['current'] },\n      { first: ['current'] },\n      {\n        middle: [\n          'current',\n          'target'\n        ]\n      },\n      { last: ['current'] }\n    ]);\n    var none = function (current) {\n      if (current === void 0) {\n        current = undefined;\n      }\n      return adt$5.none(current);\n    };\n    var CellLocation = __assign(__assign({}, adt$5), { none: none });\n\n    var walk = function (all, current, index, direction, isEligible) {\n      if (isEligible === void 0) {\n        isEligible = always;\n      }\n      var forwards = direction === 1;\n      if (!forwards && index <= 0) {\n        return CellLocation.first(all[0]);\n      } else if (forwards && index >= all.length - 1) {\n        return CellLocation.last(all[all.length - 1]);\n      } else {\n        var newIndex = index + direction;\n        var elem = all[newIndex];\n        return isEligible(elem) ? CellLocation.middle(current, elem) : walk(all, current, newIndex, direction, isEligible);\n      }\n    };\n    var detect$1 = function (current, isRoot) {\n      return table(current, isRoot).bind(function (table) {\n        var all = cells$1(table);\n        var index = findIndex(all, function (x) {\n          return eq$1(current, x);\n        });\n        return index.map(function (index) {\n          return {\n            index: index,\n            all: all\n          };\n        });\n      });\n    };\n    var next = function (current, isEligible, isRoot) {\n      var detection = detect$1(current, isRoot);\n      return detection.fold(function () {\n        return CellLocation.none(current);\n      }, function (info) {\n        return walk(info.all, current, info.index, 1, isEligible);\n      });\n    };\n    var prev = function (current, isEligible, isRoot) {\n      var detection = detect$1(current, isRoot);\n      return detection.fold(function () {\n        return CellLocation.none();\n      }, function (info) {\n        return walk(info.all, current, info.index, -1, isEligible);\n      });\n    };\n\n    var create$2 = function (start, soffset, finish, foffset) {\n      return {\n        start: start,\n        soffset: soffset,\n        finish: finish,\n        foffset: foffset\n      };\n    };\n    var SimRange = { create: create$2 };\n\n    var adt$4 = Adt.generate([\n      { before: ['element'] },\n      {\n        on: [\n          'element',\n          'offset'\n        ]\n      },\n      { after: ['element'] }\n    ]);\n    var cata$1 = function (subject, onBefore, onOn, onAfter) {\n      return subject.fold(onBefore, onOn, onAfter);\n    };\n    var getStart$1 = function (situ) {\n      return situ.fold(identity, identity, identity);\n    };\n    var before$2 = adt$4.before;\n    var on = adt$4.on;\n    var after$3 = adt$4.after;\n    var Situ = {\n      before: before$2,\n      on: on,\n      after: after$3,\n      cata: cata$1,\n      getStart: getStart$1\n    };\n\n    var adt$3 = Adt.generate([\n      { domRange: ['rng'] },\n      {\n        relative: [\n          'startSitu',\n          'finishSitu'\n        ]\n      },\n      {\n        exact: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      }\n    ]);\n    var exactFromRange = function (simRange) {\n      return adt$3.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset);\n    };\n    var getStart = function (selection) {\n      return selection.match({\n        domRange: function (rng) {\n          return SugarElement.fromDom(rng.startContainer);\n        },\n        relative: function (startSitu, _finishSitu) {\n          return Situ.getStart(startSitu);\n        },\n        exact: function (start, _soffset, _finish, _foffset) {\n          return start;\n        }\n      });\n    };\n    var domRange = adt$3.domRange;\n    var relative = adt$3.relative;\n    var exact = adt$3.exact;\n    var getWin = function (selection) {\n      var start = getStart(selection);\n      return defaultView(start);\n    };\n    var range = SimRange.create;\n    var SimSelection = {\n      domRange: domRange,\n      relative: relative,\n      exact: exact,\n      exactFromRange: exactFromRange,\n      getWin: getWin,\n      range: range\n    };\n\n    var selectNode = function (win, element) {\n      var rng = win.document.createRange();\n      rng.selectNode(element.dom);\n      return rng;\n    };\n    var selectNodeContents = function (win, element) {\n      var rng = win.document.createRange();\n      selectNodeContentsUsing(rng, element);\n      return rng;\n    };\n    var selectNodeContentsUsing = function (rng, element) {\n      return rng.selectNodeContents(element.dom);\n    };\n    var setStart = function (rng, situ) {\n      situ.fold(function (e) {\n        rng.setStartBefore(e.dom);\n      }, function (e, o) {\n        rng.setStart(e.dom, o);\n      }, function (e) {\n        rng.setStartAfter(e.dom);\n      });\n    };\n    var setFinish = function (rng, situ) {\n      situ.fold(function (e) {\n        rng.setEndBefore(e.dom);\n      }, function (e, o) {\n        rng.setEnd(e.dom, o);\n      }, function (e) {\n        rng.setEndAfter(e.dom);\n      });\n    };\n    var relativeToNative = function (win, startSitu, finishSitu) {\n      var range = win.document.createRange();\n      setStart(range, startSitu);\n      setFinish(range, finishSitu);\n      return range;\n    };\n    var exactToNative = function (win, start, soffset, finish, foffset) {\n      var rng = win.document.createRange();\n      rng.setStart(start.dom, soffset);\n      rng.setEnd(finish.dom, foffset);\n      return rng;\n    };\n    var toRect = function (rect) {\n      return {\n        left: rect.left,\n        top: rect.top,\n        right: rect.right,\n        bottom: rect.bottom,\n        width: rect.width,\n        height: rect.height\n      };\n    };\n    var getFirstRect$1 = function (rng) {\n      var rects = rng.getClientRects();\n      var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect();\n      return rect.width > 0 || rect.height > 0 ? Optional.some(rect).map(toRect) : Optional.none();\n    };\n\n    var adt$2 = Adt.generate([\n      {\n        ltr: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      },\n      {\n        rtl: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      }\n    ]);\n    var fromRange = function (win, type, range) {\n      return type(SugarElement.fromDom(range.startContainer), range.startOffset, SugarElement.fromDom(range.endContainer), range.endOffset);\n    };\n    var getRanges = function (win, selection) {\n      return selection.match({\n        domRange: function (rng) {\n          return {\n            ltr: constant(rng),\n            rtl: Optional.none\n          };\n        },\n        relative: function (startSitu, finishSitu) {\n          return {\n            ltr: cached(function () {\n              return relativeToNative(win, startSitu, finishSitu);\n            }),\n            rtl: cached(function () {\n              return Optional.some(relativeToNative(win, finishSitu, startSitu));\n            })\n          };\n        },\n        exact: function (start, soffset, finish, foffset) {\n          return {\n            ltr: cached(function () {\n              return exactToNative(win, start, soffset, finish, foffset);\n            }),\n            rtl: cached(function () {\n              return Optional.some(exactToNative(win, finish, foffset, start, soffset));\n            })\n          };\n        }\n      });\n    };\n    var doDiagnose = function (win, ranges) {\n      var rng = ranges.ltr();\n      if (rng.collapsed) {\n        var reversed = ranges.rtl().filter(function (rev) {\n          return rev.collapsed === false;\n        });\n        return reversed.map(function (rev) {\n          return adt$2.rtl(SugarElement.fromDom(rev.endContainer), rev.endOffset, SugarElement.fromDom(rev.startContainer), rev.startOffset);\n        }).getOrThunk(function () {\n          return fromRange(win, adt$2.ltr, rng);\n        });\n      } else {\n        return fromRange(win, adt$2.ltr, rng);\n      }\n    };\n    var diagnose = function (win, selection) {\n      var ranges = getRanges(win, selection);\n      return doDiagnose(win, ranges);\n    };\n    var asLtrRange = function (win, selection) {\n      var diagnosis = diagnose(win, selection);\n      return diagnosis.match({\n        ltr: function (start, soffset, finish, foffset) {\n          var rng = win.document.createRange();\n          rng.setStart(start.dom, soffset);\n          rng.setEnd(finish.dom, foffset);\n          return rng;\n        },\n        rtl: function (start, soffset, finish, foffset) {\n          var rng = win.document.createRange();\n          rng.setStart(finish.dom, foffset);\n          rng.setEnd(start.dom, soffset);\n          return rng;\n        }\n      });\n    };\n    adt$2.ltr;\n    adt$2.rtl;\n\n    var searchForPoint = function (rectForOffset, x, y, maxX, length) {\n      if (length === 0) {\n        return 0;\n      } else if (x === maxX) {\n        return length - 1;\n      }\n      var xDelta = maxX;\n      for (var i = 1; i < length; i++) {\n        var rect = rectForOffset(i);\n        var curDeltaX = Math.abs(x - rect.left);\n        if (y <= rect.bottom) {\n          if (y < rect.top || curDeltaX > xDelta) {\n            return i - 1;\n          } else {\n            xDelta = curDeltaX;\n          }\n        }\n      }\n      return 0;\n    };\n    var inRect = function (rect, x, y) {\n      return x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom;\n    };\n\n    var locateOffset = function (doc, textnode, x, y, rect) {\n      var rangeForOffset = function (o) {\n        var r = doc.dom.createRange();\n        r.setStart(textnode.dom, o);\n        r.collapse(true);\n        return r;\n      };\n      var rectForOffset = function (o) {\n        var r = rangeForOffset(o);\n        return r.getBoundingClientRect();\n      };\n      var length = get$9(textnode).length;\n      var offset = searchForPoint(rectForOffset, x, y, rect.right, length);\n      return rangeForOffset(offset);\n    };\n    var locate$1 = function (doc, node, x, y) {\n      var r = doc.dom.createRange();\n      r.selectNode(node.dom);\n      var rects = r.getClientRects();\n      var foundRect = findMap(rects, function (rect) {\n        return inRect(rect, x, y) ? Optional.some(rect) : Optional.none();\n      });\n      return foundRect.map(function (rect) {\n        return locateOffset(doc, node, x, y, rect);\n      });\n    };\n\n    var searchInChildren = function (doc, node, x, y) {\n      var r = doc.dom.createRange();\n      var nodes = children$3(node);\n      return findMap(nodes, function (n) {\n        r.selectNode(n.dom);\n        return inRect(r.getBoundingClientRect(), x, y) ? locateNode(doc, n, x, y) : Optional.none();\n      });\n    };\n    var locateNode = function (doc, node, x, y) {\n      return isText(node) ? locate$1(doc, node, x, y) : searchInChildren(doc, node, x, y);\n    };\n    var locate = function (doc, node, x, y) {\n      var r = doc.dom.createRange();\n      r.selectNode(node.dom);\n      var rect = r.getBoundingClientRect();\n      var boundedX = Math.max(rect.left, Math.min(rect.right, x));\n      var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));\n      return locateNode(doc, node, boundedX, boundedY);\n    };\n\n    var COLLAPSE_TO_LEFT = true;\n    var COLLAPSE_TO_RIGHT = false;\n    var getCollapseDirection = function (rect, x) {\n      return x - rect.left < rect.right - x ? COLLAPSE_TO_LEFT : COLLAPSE_TO_RIGHT;\n    };\n    var createCollapsedNode = function (doc, target, collapseDirection) {\n      var r = doc.dom.createRange();\n      r.selectNode(target.dom);\n      r.collapse(collapseDirection);\n      return r;\n    };\n    var locateInElement = function (doc, node, x) {\n      var cursorRange = doc.dom.createRange();\n      cursorRange.selectNode(node.dom);\n      var rect = cursorRange.getBoundingClientRect();\n      var collapseDirection = getCollapseDirection(rect, x);\n      var f = collapseDirection === COLLAPSE_TO_LEFT ? first : last$1;\n      return f(node).map(function (target) {\n        return createCollapsedNode(doc, target, collapseDirection);\n      });\n    };\n    var locateInEmpty = function (doc, node, x) {\n      var rect = node.dom.getBoundingClientRect();\n      var collapseDirection = getCollapseDirection(rect, x);\n      return Optional.some(createCollapsedNode(doc, node, collapseDirection));\n    };\n    var search = function (doc, node, x) {\n      var f = children$3(node).length === 0 ? locateInEmpty : locateInElement;\n      return f(doc, node, x);\n    };\n\n    var caretPositionFromPoint = function (doc, x, y) {\n      var _a, _b;\n      return Optional.from((_b = (_a = doc.dom).caretPositionFromPoint) === null || _b === void 0 ? void 0 : _b.call(_a, x, y)).bind(function (pos) {\n        if (pos.offsetNode === null) {\n          return Optional.none();\n        }\n        var r = doc.dom.createRange();\n        r.setStart(pos.offsetNode, pos.offset);\n        r.collapse();\n        return Optional.some(r);\n      });\n    };\n    var caretRangeFromPoint = function (doc, x, y) {\n      var _a, _b;\n      return Optional.from((_b = (_a = doc.dom).caretRangeFromPoint) === null || _b === void 0 ? void 0 : _b.call(_a, x, y));\n    };\n    var searchTextNodes = function (doc, node, x, y) {\n      var r = doc.dom.createRange();\n      r.selectNode(node.dom);\n      var rect = r.getBoundingClientRect();\n      var boundedX = Math.max(rect.left, Math.min(rect.right, x));\n      var boundedY = Math.max(rect.top, Math.min(rect.bottom, y));\n      return locate(doc, node, boundedX, boundedY);\n    };\n    var searchFromPoint = function (doc, x, y) {\n      return SugarElement.fromPoint(doc, x, y).bind(function (elem) {\n        var fallback = function () {\n          return search(doc, elem, x);\n        };\n        return children$3(elem).length === 0 ? fallback() : searchTextNodes(doc, elem, x, y).orThunk(fallback);\n      });\n    };\n    var availableSearch = function () {\n      if (document.caretPositionFromPoint) {\n        return caretPositionFromPoint;\n      } else if (document.caretRangeFromPoint) {\n        return caretRangeFromPoint;\n      } else {\n        return searchFromPoint;\n      }\n    }();\n    var fromPoint = function (win, x, y) {\n      var doc = SugarElement.fromDom(win.document);\n      return availableSearch(doc, x, y).map(function (rng) {\n        return SimRange.create(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset);\n      });\n    };\n\n    var beforeSpecial = function (element, offset) {\n      var name$1 = name(element);\n      if ('input' === name$1) {\n        return Situ.after(element);\n      } else if (!contains$2([\n          'br',\n          'img'\n        ], name$1)) {\n        return Situ.on(element, offset);\n      } else {\n        return offset === 0 ? Situ.before(element) : Situ.after(element);\n      }\n    };\n    var preprocessRelative = function (startSitu, finishSitu) {\n      var start = startSitu.fold(Situ.before, beforeSpecial, Situ.after);\n      var finish = finishSitu.fold(Situ.before, beforeSpecial, Situ.after);\n      return SimSelection.relative(start, finish);\n    };\n    var preprocessExact = function (start, soffset, finish, foffset) {\n      var startSitu = beforeSpecial(start, soffset);\n      var finishSitu = beforeSpecial(finish, foffset);\n      return SimSelection.relative(startSitu, finishSitu);\n    };\n    var preprocess = function (selection) {\n      return selection.match({\n        domRange: function (rng) {\n          var start = SugarElement.fromDom(rng.startContainer);\n          var finish = SugarElement.fromDom(rng.endContainer);\n          return preprocessExact(start, rng.startOffset, finish, rng.endOffset);\n        },\n        relative: preprocessRelative,\n        exact: preprocessExact\n      });\n    };\n\n    var makeRange = function (start, soffset, finish, foffset) {\n      var doc = owner(start);\n      var rng = doc.dom.createRange();\n      rng.setStart(start.dom, soffset);\n      rng.setEnd(finish.dom, foffset);\n      return rng;\n    };\n    var after$2 = function (start, soffset, finish, foffset) {\n      var r = makeRange(start, soffset, finish, foffset);\n      var same = eq$1(start, finish) && soffset === foffset;\n      return r.collapsed && !same;\n    };\n\n    var getNativeSelection = function (win) {\n      return Optional.from(win.getSelection());\n    };\n    var doSetNativeRange = function (win, rng) {\n      getNativeSelection(win).each(function (selection) {\n        selection.removeAllRanges();\n        selection.addRange(rng);\n      });\n    };\n    var doSetRange = function (win, start, soffset, finish, foffset) {\n      var rng = exactToNative(win, start, soffset, finish, foffset);\n      doSetNativeRange(win, rng);\n    };\n    var setLegacyRtlRange = function (win, selection, start, soffset, finish, foffset) {\n      selection.collapse(start.dom, soffset);\n      selection.extend(finish.dom, foffset);\n    };\n    var setRangeFromRelative = function (win, relative) {\n      return diagnose(win, relative).match({\n        ltr: function (start, soffset, finish, foffset) {\n          doSetRange(win, start, soffset, finish, foffset);\n        },\n        rtl: function (start, soffset, finish, foffset) {\n          getNativeSelection(win).each(function (selection) {\n            if (selection.setBaseAndExtent) {\n              selection.setBaseAndExtent(start.dom, soffset, finish.dom, foffset);\n            } else if (selection.extend) {\n              try {\n                setLegacyRtlRange(win, selection, start, soffset, finish, foffset);\n              } catch (e) {\n                doSetRange(win, finish, foffset, start, soffset);\n              }\n            } else {\n              doSetRange(win, finish, foffset, start, soffset);\n            }\n          });\n        }\n      });\n    };\n    var setExact = function (win, start, soffset, finish, foffset) {\n      var relative = preprocessExact(start, soffset, finish, foffset);\n      setRangeFromRelative(win, relative);\n    };\n    var setRelative = function (win, startSitu, finishSitu) {\n      var relative = preprocessRelative(startSitu, finishSitu);\n      setRangeFromRelative(win, relative);\n    };\n    var toNative = function (selection) {\n      var win = SimSelection.getWin(selection).dom;\n      var getDomRange = function (start, soffset, finish, foffset) {\n        return exactToNative(win, start, soffset, finish, foffset);\n      };\n      var filtered = preprocess(selection);\n      return diagnose(win, filtered).match({\n        ltr: getDomRange,\n        rtl: getDomRange\n      });\n    };\n    var readRange = function (selection) {\n      if (selection.rangeCount > 0) {\n        var firstRng = selection.getRangeAt(0);\n        var lastRng = selection.getRangeAt(selection.rangeCount - 1);\n        return Optional.some(SimRange.create(SugarElement.fromDom(firstRng.startContainer), firstRng.startOffset, SugarElement.fromDom(lastRng.endContainer), lastRng.endOffset));\n      } else {\n        return Optional.none();\n      }\n    };\n    var doGetExact = function (selection) {\n      if (selection.anchorNode === null || selection.focusNode === null) {\n        return readRange(selection);\n      } else {\n        var anchor = SugarElement.fromDom(selection.anchorNode);\n        var focus_1 = SugarElement.fromDom(selection.focusNode);\n        return after$2(anchor, selection.anchorOffset, focus_1, selection.focusOffset) ? Optional.some(SimRange.create(anchor, selection.anchorOffset, focus_1, selection.focusOffset)) : readRange(selection);\n      }\n    };\n    var setToElement = function (win, element, selectNodeContents$1) {\n      if (selectNodeContents$1 === void 0) {\n        selectNodeContents$1 = true;\n      }\n      var rngGetter = selectNodeContents$1 ? selectNodeContents : selectNode;\n      var rng = rngGetter(win, element);\n      doSetNativeRange(win, rng);\n    };\n    var getExact = function (win) {\n      return getNativeSelection(win).filter(function (sel) {\n        return sel.rangeCount > 0;\n      }).bind(doGetExact);\n    };\n    var get$1 = function (win) {\n      return getExact(win).map(function (range) {\n        return SimSelection.exact(range.start, range.soffset, range.finish, range.foffset);\n      });\n    };\n    var getFirstRect = function (win, selection) {\n      var rng = asLtrRange(win, selection);\n      return getFirstRect$1(rng);\n    };\n    var getAtPoint = function (win, x, y) {\n      return fromPoint(win, x, y);\n    };\n    var clear = function (win) {\n      getNativeSelection(win).each(function (selection) {\n        return selection.removeAllRanges();\n      });\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var forward = function (editor, isRoot, cell) {\n      return go$1(editor, isRoot, next(cell, isEditable$1));\n    };\n    var backward = function (editor, isRoot, cell) {\n      return go$1(editor, isRoot, prev(cell, isEditable$1));\n    };\n    var getCellFirstCursorPosition = function (editor, cell) {\n      var selection = SimSelection.exact(cell, 0, cell, 0);\n      return toNative(selection);\n    };\n    var go$1 = function (editor, isRoot, cell) {\n      return cell.fold(Optional.none, Optional.none, function (current, next) {\n        return first(next).map(function (cell) {\n          return getCellFirstCursorPosition(editor, cell);\n        });\n      }, function (current) {\n        editor.execCommand('mceTableInsertRowAfter');\n        return forward(editor, isRoot, current);\n      });\n    };\n    var rootElements = [\n      'table',\n      'li',\n      'dl'\n    ];\n    var handle$1 = function (event, editor, cellSelection) {\n      if (event.keyCode === global$1.TAB) {\n        var body_1 = getBody(editor);\n        var isRoot_1 = function (element) {\n          var name$1 = name(element);\n          return eq$1(element, body_1) || contains$2(rootElements, name$1);\n        };\n        var rng = editor.selection.getRng();\n        var container = SugarElement.fromDom(event.shiftKey ? rng.startContainer : rng.endContainer);\n        cell(container, isRoot_1).each(function (cell) {\n          event.preventDefault();\n          table(cell, isRoot_1).each(cellSelection.clear);\n          editor.selection.collapse(event.shiftKey);\n          var navigation = event.shiftKey ? backward : forward;\n          var rng = navigation(editor, isRoot_1, cell);\n          rng.each(function (range) {\n            editor.selection.setRng(range);\n          });\n        });\n      }\n    };\n\n    var create$1 = function (selection, kill) {\n      return {\n        selection: selection,\n        kill: kill\n      };\n    };\n    var Response = { create: create$1 };\n\n    var create = function (start, soffset, finish, foffset) {\n      return {\n        start: Situ.on(start, soffset),\n        finish: Situ.on(finish, foffset)\n      };\n    };\n    var Situs = { create: create };\n\n    var convertToRange = function (win, selection) {\n      var rng = asLtrRange(win, selection);\n      return SimRange.create(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset);\n    };\n    var makeSitus = Situs.create;\n\n    var sync = function (container, isRoot, start, soffset, finish, foffset, selectRange) {\n      if (!(eq$1(start, finish) && soffset === foffset)) {\n        return closest$1(start, 'td,th', isRoot).bind(function (s) {\n          return closest$1(finish, 'td,th', isRoot).bind(function (f) {\n            return detect(container, isRoot, s, f, selectRange);\n          });\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n    var detect = function (container, isRoot, start, finish, selectRange) {\n      if (!eq$1(start, finish)) {\n        return identify(start, finish, isRoot).bind(function (cellSel) {\n          var boxes = cellSel.boxes.getOr([]);\n          if (boxes.length > 1) {\n            selectRange(container, boxes, cellSel.start, cellSel.finish);\n            return Optional.some(Response.create(Optional.some(makeSitus(start, 0, start, getEnd(start))), true));\n          } else {\n            return Optional.none();\n          }\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n    var update = function (rows, columns, container, selected, annotations) {\n      var updateSelection = function (newSels) {\n        annotations.clearBeforeUpdate(container);\n        annotations.selectRange(container, newSels.boxes, newSels.start, newSels.finish);\n        return newSels.boxes;\n      };\n      return shiftSelection(selected, rows, columns, annotations.firstSelectedSelector, annotations.lastSelectedSelector).map(updateSelection);\n    };\n\n    var traverse = function (item, mode) {\n      return {\n        item: item,\n        mode: mode\n      };\n    };\n    var backtrack = function (universe, item, _direction, transition) {\n      if (transition === void 0) {\n        transition = sidestep;\n      }\n      return universe.property().parent(item).map(function (p) {\n        return traverse(p, transition);\n      });\n    };\n    var sidestep = function (universe, item, direction, transition) {\n      if (transition === void 0) {\n        transition = advance;\n      }\n      return direction.sibling(universe, item).map(function (p) {\n        return traverse(p, transition);\n      });\n    };\n    var advance = function (universe, item, direction, transition) {\n      if (transition === void 0) {\n        transition = advance;\n      }\n      var children = universe.property().children(item);\n      var result = direction.first(children);\n      return result.map(function (r) {\n        return traverse(r, transition);\n      });\n    };\n    var successors = [\n      {\n        current: backtrack,\n        next: sidestep,\n        fallback: Optional.none()\n      },\n      {\n        current: sidestep,\n        next: advance,\n        fallback: Optional.some(backtrack)\n      },\n      {\n        current: advance,\n        next: advance,\n        fallback: Optional.some(sidestep)\n      }\n    ];\n    var go = function (universe, item, mode, direction, rules) {\n      if (rules === void 0) {\n        rules = successors;\n      }\n      var ruleOpt = find$1(rules, function (succ) {\n        return succ.current === mode;\n      });\n      return ruleOpt.bind(function (rule) {\n        return rule.current(universe, item, direction, rule.next).orThunk(function () {\n          return rule.fallback.bind(function (fb) {\n            return go(universe, item, fb, direction);\n          });\n        });\n      });\n    };\n\n    var left$1 = function () {\n      var sibling = function (universe, item) {\n        return universe.query().prevSibling(item);\n      };\n      var first = function (children) {\n        return children.length > 0 ? Optional.some(children[children.length - 1]) : Optional.none();\n      };\n      return {\n        sibling: sibling,\n        first: first\n      };\n    };\n    var right$1 = function () {\n      var sibling = function (universe, item) {\n        return universe.query().nextSibling(item);\n      };\n      var first = function (children) {\n        return children.length > 0 ? Optional.some(children[0]) : Optional.none();\n      };\n      return {\n        sibling: sibling,\n        first: first\n      };\n    };\n    var Walkers = {\n      left: left$1,\n      right: right$1\n    };\n\n    var hone = function (universe, item, predicate, mode, direction, isRoot) {\n      var next = go(universe, item, mode, direction);\n      return next.bind(function (n) {\n        if (isRoot(n.item)) {\n          return Optional.none();\n        } else {\n          return predicate(n.item) ? Optional.some(n.item) : hone(universe, n.item, predicate, n.mode, direction, isRoot);\n        }\n      });\n    };\n    var left = function (universe, item, predicate, isRoot) {\n      return hone(universe, item, predicate, sidestep, Walkers.left(), isRoot);\n    };\n    var right = function (universe, item, predicate, isRoot) {\n      return hone(universe, item, predicate, sidestep, Walkers.right(), isRoot);\n    };\n\n    var isLeaf = function (universe) {\n      return function (element) {\n        return universe.property().children(element).length === 0;\n      };\n    };\n    var before$1 = function (universe, item, isRoot) {\n      return seekLeft$1(universe, item, isLeaf(universe), isRoot);\n    };\n    var after$1 = function (universe, item, isRoot) {\n      return seekRight$1(universe, item, isLeaf(universe), isRoot);\n    };\n    var seekLeft$1 = left;\n    var seekRight$1 = right;\n\n    var universe = DomUniverse();\n    var before = function (element, isRoot) {\n      return before$1(universe, element, isRoot);\n    };\n    var after = function (element, isRoot) {\n      return after$1(universe, element, isRoot);\n    };\n    var seekLeft = function (element, predicate, isRoot) {\n      return seekLeft$1(universe, element, predicate, isRoot);\n    };\n    var seekRight = function (element, predicate, isRoot) {\n      return seekRight$1(universe, element, predicate, isRoot);\n    };\n\n    var ancestor = function (scope, predicate, isRoot) {\n      return ancestor$2(scope, predicate, isRoot).isSome();\n    };\n\n    var adt$1 = Adt.generate([\n      { none: ['message'] },\n      { success: [] },\n      { failedUp: ['cell'] },\n      { failedDown: ['cell'] }\n    ]);\n    var isOverlapping = function (bridge, before, after) {\n      var beforeBounds = bridge.getRect(before);\n      var afterBounds = bridge.getRect(after);\n      return afterBounds.right > beforeBounds.left && afterBounds.left < beforeBounds.right;\n    };\n    var isRow = function (elem) {\n      return closest$1(elem, 'tr');\n    };\n    var verify = function (bridge, before, beforeOffset, after, afterOffset, failure, isRoot) {\n      return closest$1(after, 'td,th', isRoot).bind(function (afterCell) {\n        return closest$1(before, 'td,th', isRoot).map(function (beforeCell) {\n          if (!eq$1(afterCell, beforeCell)) {\n            return sharedOne(isRow, [\n              afterCell,\n              beforeCell\n            ]).fold(function () {\n              return isOverlapping(bridge, beforeCell, afterCell) ? adt$1.success() : failure(beforeCell);\n            }, function (_sharedRow) {\n              return failure(beforeCell);\n            });\n          } else {\n            return eq$1(after, afterCell) && getEnd(afterCell) === afterOffset ? failure(beforeCell) : adt$1.none('in same cell');\n          }\n        });\n      }).getOr(adt$1.none('default'));\n    };\n    var cata = function (subject, onNone, onSuccess, onFailedUp, onFailedDown) {\n      return subject.fold(onNone, onSuccess, onFailedUp, onFailedDown);\n    };\n    var BeforeAfter = __assign(__assign({}, adt$1), {\n      verify: verify,\n      cata: cata\n    });\n\n    var inParent = function (parent, children, element, index) {\n      return {\n        parent: parent,\n        children: children,\n        element: element,\n        index: index\n      };\n    };\n    var indexInParent = function (element) {\n      return parent(element).bind(function (parent) {\n        var children = children$3(parent);\n        return indexOf(children, element).map(function (index) {\n          return inParent(parent, children, element, index);\n        });\n      });\n    };\n    var indexOf = function (elements, element) {\n      return findIndex(elements, curry(eq$1, element));\n    };\n\n    var isBr = function (elem) {\n      return name(elem) === 'br';\n    };\n    var gatherer = function (cand, gather, isRoot) {\n      return gather(cand, isRoot).bind(function (target) {\n        return isText(target) && get$9(target).trim().length === 0 ? gatherer(target, gather, isRoot) : Optional.some(target);\n      });\n    };\n    var handleBr = function (isRoot, element, direction) {\n      return direction.traverse(element).orThunk(function () {\n        return gatherer(element, direction.gather, isRoot);\n      }).map(direction.relative);\n    };\n    var findBr = function (element, offset) {\n      return child$3(element, offset).filter(isBr).orThunk(function () {\n        return child$3(element, offset - 1).filter(isBr);\n      });\n    };\n    var handleParent = function (isRoot, element, offset, direction) {\n      return findBr(element, offset).bind(function (br) {\n        return direction.traverse(br).fold(function () {\n          return gatherer(br, direction.gather, isRoot).map(direction.relative);\n        }, function (adjacent) {\n          return indexInParent(adjacent).map(function (info) {\n            return Situ.on(info.parent, info.index);\n          });\n        });\n      });\n    };\n    var tryBr = function (isRoot, element, offset, direction) {\n      var target = isBr(element) ? handleBr(isRoot, element, direction) : handleParent(isRoot, element, offset, direction);\n      return target.map(function (tgt) {\n        return {\n          start: tgt,\n          finish: tgt\n        };\n      });\n    };\n    var process = function (analysis) {\n      return BeforeAfter.cata(analysis, function (_message) {\n        return Optional.none();\n      }, function () {\n        return Optional.none();\n      }, function (cell) {\n        return Optional.some(point(cell, 0));\n      }, function (cell) {\n        return Optional.some(point(cell, getEnd(cell)));\n      });\n    };\n\n    var moveDown = function (caret, amount) {\n      return {\n        left: caret.left,\n        top: caret.top + amount,\n        right: caret.right,\n        bottom: caret.bottom + amount\n      };\n    };\n    var moveUp = function (caret, amount) {\n      return {\n        left: caret.left,\n        top: caret.top - amount,\n        right: caret.right,\n        bottom: caret.bottom - amount\n      };\n    };\n    var translate = function (caret, xDelta, yDelta) {\n      return {\n        left: caret.left + xDelta,\n        top: caret.top + yDelta,\n        right: caret.right + xDelta,\n        bottom: caret.bottom + yDelta\n      };\n    };\n    var getTop = function (caret) {\n      return caret.top;\n    };\n    var getBottom = function (caret) {\n      return caret.bottom;\n    };\n\n    var getPartialBox = function (bridge, element, offset) {\n      if (offset >= 0 && offset < getEnd(element)) {\n        return bridge.getRangedRect(element, offset, element, offset + 1);\n      } else if (offset > 0) {\n        return bridge.getRangedRect(element, offset - 1, element, offset);\n      }\n      return Optional.none();\n    };\n    var toCaret = function (rect) {\n      return {\n        left: rect.left,\n        top: rect.top,\n        right: rect.right,\n        bottom: rect.bottom\n      };\n    };\n    var getElemBox = function (bridge, element) {\n      return Optional.some(bridge.getRect(element));\n    };\n    var getBoxAt = function (bridge, element, offset) {\n      if (isElement(element)) {\n        return getElemBox(bridge, element).map(toCaret);\n      } else if (isText(element)) {\n        return getPartialBox(bridge, element, offset).map(toCaret);\n      } else {\n        return Optional.none();\n      }\n    };\n    var getEntireBox = function (bridge, element) {\n      if (isElement(element)) {\n        return getElemBox(bridge, element).map(toCaret);\n      } else if (isText(element)) {\n        return bridge.getRangedRect(element, 0, element, getEnd(element)).map(toCaret);\n      } else {\n        return Optional.none();\n      }\n    };\n\n    var JUMP_SIZE = 5;\n    var NUM_RETRIES = 100;\n    var adt = Adt.generate([\n      { none: [] },\n      { retry: ['caret'] }\n    ]);\n    var isOutside = function (caret, box) {\n      return caret.left < box.left || Math.abs(box.right - caret.left) < 1 || caret.left > box.right;\n    };\n    var inOutsideBlock = function (bridge, element, caret) {\n      return closest$2(element, isBlock).fold(never, function (cell) {\n        return getEntireBox(bridge, cell).exists(function (box) {\n          return isOutside(caret, box);\n        });\n      });\n    };\n    var adjustDown = function (bridge, element, guessBox, original, caret) {\n      var lowerCaret = moveDown(caret, JUMP_SIZE);\n      if (Math.abs(guessBox.bottom - original.bottom) < 1) {\n        return adt.retry(lowerCaret);\n      } else if (guessBox.top > caret.bottom) {\n        return adt.retry(lowerCaret);\n      } else if (guessBox.top === caret.bottom) {\n        return adt.retry(moveDown(caret, 1));\n      } else {\n        return inOutsideBlock(bridge, element, caret) ? adt.retry(translate(lowerCaret, JUMP_SIZE, 0)) : adt.none();\n      }\n    };\n    var adjustUp = function (bridge, element, guessBox, original, caret) {\n      var higherCaret = moveUp(caret, JUMP_SIZE);\n      if (Math.abs(guessBox.top - original.top) < 1) {\n        return adt.retry(higherCaret);\n      } else if (guessBox.bottom < caret.top) {\n        return adt.retry(higherCaret);\n      } else if (guessBox.bottom === caret.top) {\n        return adt.retry(moveUp(caret, 1));\n      } else {\n        return inOutsideBlock(bridge, element, caret) ? adt.retry(translate(higherCaret, JUMP_SIZE, 0)) : adt.none();\n      }\n    };\n    var upMovement = {\n      point: getTop,\n      adjuster: adjustUp,\n      move: moveUp,\n      gather: before\n    };\n    var downMovement = {\n      point: getBottom,\n      adjuster: adjustDown,\n      move: moveDown,\n      gather: after\n    };\n    var isAtTable = function (bridge, x, y) {\n      return bridge.elementFromPoint(x, y).filter(function (elm) {\n        return name(elm) === 'table';\n      }).isSome();\n    };\n    var adjustForTable = function (bridge, movement, original, caret, numRetries) {\n      return adjustTil(bridge, movement, original, movement.move(caret, JUMP_SIZE), numRetries);\n    };\n    var adjustTil = function (bridge, movement, original, caret, numRetries) {\n      if (numRetries === 0) {\n        return Optional.some(caret);\n      }\n      if (isAtTable(bridge, caret.left, movement.point(caret))) {\n        return adjustForTable(bridge, movement, original, caret, numRetries - 1);\n      }\n      return bridge.situsFromPoint(caret.left, movement.point(caret)).bind(function (guess) {\n        return guess.start.fold(Optional.none, function (element) {\n          return getEntireBox(bridge, element).bind(function (guessBox) {\n            return movement.adjuster(bridge, element, guessBox, original, caret).fold(Optional.none, function (newCaret) {\n              return adjustTil(bridge, movement, original, newCaret, numRetries - 1);\n            });\n          }).orThunk(function () {\n            return Optional.some(caret);\n          });\n        }, Optional.none);\n      });\n    };\n    var ieTryDown = function (bridge, caret) {\n      return bridge.situsFromPoint(caret.left, caret.bottom + JUMP_SIZE);\n    };\n    var ieTryUp = function (bridge, caret) {\n      return bridge.situsFromPoint(caret.left, caret.top - JUMP_SIZE);\n    };\n    var checkScroll = function (movement, adjusted, bridge) {\n      if (movement.point(adjusted) > bridge.getInnerHeight()) {\n        return Optional.some(movement.point(adjusted) - bridge.getInnerHeight());\n      } else if (movement.point(adjusted) < 0) {\n        return Optional.some(-movement.point(adjusted));\n      } else {\n        return Optional.none();\n      }\n    };\n    var retry = function (movement, bridge, caret) {\n      var moved = movement.move(caret, JUMP_SIZE);\n      var adjusted = adjustTil(bridge, movement, caret, moved, NUM_RETRIES).getOr(moved);\n      return checkScroll(movement, adjusted, bridge).fold(function () {\n        return bridge.situsFromPoint(adjusted.left, movement.point(adjusted));\n      }, function (delta) {\n        bridge.scrollBy(0, delta);\n        return bridge.situsFromPoint(adjusted.left, movement.point(adjusted) - delta);\n      });\n    };\n    var Retries = {\n      tryUp: curry(retry, upMovement),\n      tryDown: curry(retry, downMovement),\n      ieTryUp: ieTryUp,\n      ieTryDown: ieTryDown,\n      getJumpSize: constant(JUMP_SIZE)\n    };\n\n    var MAX_RETRIES = 20;\n    var findSpot = function (bridge, isRoot, direction) {\n      return bridge.getSelection().bind(function (sel) {\n        return tryBr(isRoot, sel.finish, sel.foffset, direction).fold(function () {\n          return Optional.some(point(sel.finish, sel.foffset));\n        }, function (brNeighbour) {\n          var range = bridge.fromSitus(brNeighbour);\n          var analysis = BeforeAfter.verify(bridge, sel.finish, sel.foffset, range.finish, range.foffset, direction.failure, isRoot);\n          return process(analysis);\n        });\n      });\n    };\n    var scan = function (bridge, isRoot, element, offset, direction, numRetries) {\n      if (numRetries === 0) {\n        return Optional.none();\n      }\n      return tryCursor(bridge, isRoot, element, offset, direction).bind(function (situs) {\n        var range = bridge.fromSitus(situs);\n        var analysis = BeforeAfter.verify(bridge, element, offset, range.finish, range.foffset, direction.failure, isRoot);\n        return BeforeAfter.cata(analysis, function () {\n          return Optional.none();\n        }, function () {\n          return Optional.some(situs);\n        }, function (cell) {\n          if (eq$1(element, cell) && offset === 0) {\n            return tryAgain(bridge, element, offset, moveUp, direction);\n          } else {\n            return scan(bridge, isRoot, cell, 0, direction, numRetries - 1);\n          }\n        }, function (cell) {\n          if (eq$1(element, cell) && offset === getEnd(cell)) {\n            return tryAgain(bridge, element, offset, moveDown, direction);\n          } else {\n            return scan(bridge, isRoot, cell, getEnd(cell), direction, numRetries - 1);\n          }\n        });\n      });\n    };\n    var tryAgain = function (bridge, element, offset, move, direction) {\n      return getBoxAt(bridge, element, offset).bind(function (box) {\n        return tryAt(bridge, direction, move(box, Retries.getJumpSize()));\n      });\n    };\n    var tryAt = function (bridge, direction, box) {\n      var browser = detect$3().browser;\n      if (browser.isChrome() || browser.isSafari() || browser.isFirefox() || browser.isEdge()) {\n        return direction.otherRetry(bridge, box);\n      } else if (browser.isIE()) {\n        return direction.ieRetry(bridge, box);\n      } else {\n        return Optional.none();\n      }\n    };\n    var tryCursor = function (bridge, isRoot, element, offset, direction) {\n      return getBoxAt(bridge, element, offset).bind(function (box) {\n        return tryAt(bridge, direction, box);\n      });\n    };\n    var handle = function (bridge, isRoot, direction) {\n      return findSpot(bridge, isRoot, direction).bind(function (spot) {\n        return scan(bridge, isRoot, spot.element, spot.offset, direction, MAX_RETRIES).map(bridge.fromSitus);\n      });\n    };\n\n    var inSameTable = function (elem, table) {\n      return ancestor(elem, function (e) {\n        return parent(e).exists(function (p) {\n          return eq$1(p, table);\n        });\n      });\n    };\n    var simulate = function (bridge, isRoot, direction, initial, anchor) {\n      return closest$1(initial, 'td,th', isRoot).bind(function (start) {\n        return closest$1(start, 'table', isRoot).bind(function (table) {\n          if (!inSameTable(anchor, table)) {\n            return Optional.none();\n          }\n          return handle(bridge, isRoot, direction).bind(function (range) {\n            return closest$1(range.finish, 'td,th', isRoot).map(function (finish) {\n              return {\n                start: start,\n                finish: finish,\n                range: range\n              };\n            });\n          });\n        });\n      });\n    };\n    var navigate = function (bridge, isRoot, direction, initial, anchor, precheck) {\n      if (detect$3().browser.isIE()) {\n        return Optional.none();\n      } else {\n        return precheck(initial, isRoot).orThunk(function () {\n          return simulate(bridge, isRoot, direction, initial, anchor).map(function (info) {\n            var range = info.range;\n            return Response.create(Optional.some(makeSitus(range.start, range.soffset, range.finish, range.foffset)), true);\n          });\n        });\n      }\n    };\n    var firstUpCheck = function (initial, isRoot) {\n      return closest$1(initial, 'tr', isRoot).bind(function (startRow) {\n        return closest$1(startRow, 'table', isRoot).bind(function (table) {\n          var rows = descendants(table, 'tr');\n          if (eq$1(startRow, rows[0])) {\n            return seekLeft(table, function (element) {\n              return last$1(element).isSome();\n            }, isRoot).map(function (last) {\n              var lastOffset = getEnd(last);\n              return Response.create(Optional.some(makeSitus(last, lastOffset, last, lastOffset)), true);\n            });\n          } else {\n            return Optional.none();\n          }\n        });\n      });\n    };\n    var lastDownCheck = function (initial, isRoot) {\n      return closest$1(initial, 'tr', isRoot).bind(function (startRow) {\n        return closest$1(startRow, 'table', isRoot).bind(function (table) {\n          var rows = descendants(table, 'tr');\n          if (eq$1(startRow, rows[rows.length - 1])) {\n            return seekRight(table, function (element) {\n              return first(element).isSome();\n            }, isRoot).map(function (first) {\n              return Response.create(Optional.some(makeSitus(first, 0, first, 0)), true);\n            });\n          } else {\n            return Optional.none();\n          }\n        });\n      });\n    };\n    var select = function (bridge, container, isRoot, direction, initial, anchor, selectRange) {\n      return simulate(bridge, isRoot, direction, initial, anchor).bind(function (info) {\n        return detect(container, isRoot, info.start, info.finish, selectRange);\n      });\n    };\n\n    var findCell = function (target, isRoot) {\n      return closest$1(target, 'td,th', isRoot);\n    };\n    var MouseSelection = function (bridge, container, isRoot, annotations) {\n      var cursor = value();\n      var clearstate = cursor.clear;\n      var applySelection = function (event) {\n        cursor.on(function (start) {\n          annotations.clearBeforeUpdate(container);\n          findCell(event.target, isRoot).each(function (finish) {\n            identify(start, finish, isRoot).each(function (cellSel) {\n              var boxes = cellSel.boxes.getOr([]);\n              if (boxes.length === 1) {\n                var singleCell = boxes[0];\n                var isNonEditableCell = getRaw(singleCell) === 'false';\n                var isCellClosestContentEditable = is(closest(event.target), singleCell, eq$1);\n                if (isNonEditableCell && isCellClosestContentEditable) {\n                  annotations.selectRange(container, boxes, singleCell, singleCell);\n                  bridge.selectContents(singleCell);\n                }\n              } else if (boxes.length > 1) {\n                annotations.selectRange(container, boxes, cellSel.start, cellSel.finish);\n                bridge.selectContents(finish);\n              }\n            });\n          });\n        });\n      };\n      var mousedown = function (event) {\n        annotations.clear(container);\n        findCell(event.target, isRoot).each(cursor.set);\n      };\n      var mouseover = function (event) {\n        applySelection(event);\n      };\n      var mouseup = function (event) {\n        applySelection(event);\n        clearstate();\n      };\n      return {\n        clearstate: clearstate,\n        mousedown: mousedown,\n        mouseover: mouseover,\n        mouseup: mouseup\n      };\n    };\n\n    var down = {\n      traverse: nextSibling,\n      gather: after,\n      relative: Situ.before,\n      otherRetry: Retries.tryDown,\n      ieRetry: Retries.ieTryDown,\n      failure: BeforeAfter.failedDown\n    };\n    var up = {\n      traverse: prevSibling,\n      gather: before,\n      relative: Situ.before,\n      otherRetry: Retries.tryUp,\n      ieRetry: Retries.ieTryUp,\n      failure: BeforeAfter.failedUp\n    };\n\n    var isKey = function (key) {\n      return function (keycode) {\n        return keycode === key;\n      };\n    };\n    var isUp = isKey(38);\n    var isDown = isKey(40);\n    var isNavigation = function (keycode) {\n      return keycode >= 37 && keycode <= 40;\n    };\n    var ltr = {\n      isBackward: isKey(37),\n      isForward: isKey(39)\n    };\n    var rtl = {\n      isBackward: isKey(39),\n      isForward: isKey(37)\n    };\n\n    var get = function (_DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;\n      var y = doc.body.scrollTop || doc.documentElement.scrollTop;\n      return SugarPosition(x, y);\n    };\n    var by = function (x, y, _DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var win = doc.defaultView;\n      if (win) {\n        win.scrollBy(x, y);\n      }\n    };\n\n    var WindowBridge = function (win) {\n      var elementFromPoint = function (x, y) {\n        return SugarElement.fromPoint(SugarElement.fromDom(win.document), x, y);\n      };\n      var getRect = function (element) {\n        return element.dom.getBoundingClientRect();\n      };\n      var getRangedRect = function (start, soffset, finish, foffset) {\n        var sel = SimSelection.exact(start, soffset, finish, foffset);\n        return getFirstRect(win, sel);\n      };\n      var getSelection = function () {\n        return get$1(win).map(function (exactAdt) {\n          return convertToRange(win, exactAdt);\n        });\n      };\n      var fromSitus = function (situs) {\n        var relative = SimSelection.relative(situs.start, situs.finish);\n        return convertToRange(win, relative);\n      };\n      var situsFromPoint = function (x, y) {\n        return getAtPoint(win, x, y).map(function (exact) {\n          return Situs.create(exact.start, exact.soffset, exact.finish, exact.foffset);\n        });\n      };\n      var clearSelection = function () {\n        clear(win);\n      };\n      var collapseSelection = function (toStart) {\n        if (toStart === void 0) {\n          toStart = false;\n        }\n        get$1(win).each(function (sel) {\n          return sel.fold(function (rng) {\n            return rng.collapse(toStart);\n          }, function (startSitu, finishSitu) {\n            var situ = toStart ? startSitu : finishSitu;\n            setRelative(win, situ, situ);\n          }, function (start, soffset, finish, foffset) {\n            var node = toStart ? start : finish;\n            var offset = toStart ? soffset : foffset;\n            setExact(win, node, offset, node, offset);\n          });\n        });\n      };\n      var selectNode = function (element) {\n        setToElement(win, element, false);\n      };\n      var selectContents = function (element) {\n        setToElement(win, element);\n      };\n      var setSelection = function (sel) {\n        setExact(win, sel.start, sel.soffset, sel.finish, sel.foffset);\n      };\n      var setRelativeSelection = function (start, finish) {\n        setRelative(win, start, finish);\n      };\n      var getInnerHeight = function () {\n        return win.innerHeight;\n      };\n      var getScrollY = function () {\n        var pos = get(SugarElement.fromDom(win.document));\n        return pos.top;\n      };\n      var scrollBy = function (x, y) {\n        by(x, y, SugarElement.fromDom(win.document));\n      };\n      return {\n        elementFromPoint: elementFromPoint,\n        getRect: getRect,\n        getRangedRect: getRangedRect,\n        getSelection: getSelection,\n        fromSitus: fromSitus,\n        situsFromPoint: situsFromPoint,\n        clearSelection: clearSelection,\n        collapseSelection: collapseSelection,\n        setSelection: setSelection,\n        setRelativeSelection: setRelativeSelection,\n        selectNode: selectNode,\n        selectContents: selectContents,\n        getInnerHeight: getInnerHeight,\n        getScrollY: getScrollY,\n        scrollBy: scrollBy\n      };\n    };\n\n    var rc = function (rows, cols) {\n      return {\n        rows: rows,\n        cols: cols\n      };\n    };\n    var mouse = function (win, container, isRoot, annotations) {\n      var bridge = WindowBridge(win);\n      var handlers = MouseSelection(bridge, container, isRoot, annotations);\n      return {\n        clearstate: handlers.clearstate,\n        mousedown: handlers.mousedown,\n        mouseover: handlers.mouseover,\n        mouseup: handlers.mouseup\n      };\n    };\n    var keyboard = function (win, container, isRoot, annotations) {\n      var bridge = WindowBridge(win);\n      var clearToNavigate = function () {\n        annotations.clear(container);\n        return Optional.none();\n      };\n      var keydown = function (event, start, soffset, finish, foffset, direction) {\n        var realEvent = event.raw;\n        var keycode = realEvent.which;\n        var shiftKey = realEvent.shiftKey === true;\n        var handler = retrieve$1(container, annotations.selectedSelector).fold(function () {\n          if (isNavigation(keycode) && !shiftKey) {\n            annotations.clearBeforeUpdate(container);\n          }\n          if (isDown(keycode) && shiftKey) {\n            return curry(select, bridge, container, isRoot, down, finish, start, annotations.selectRange);\n          } else if (isUp(keycode) && shiftKey) {\n            return curry(select, bridge, container, isRoot, up, finish, start, annotations.selectRange);\n          } else if (isDown(keycode)) {\n            return curry(navigate, bridge, isRoot, down, finish, start, lastDownCheck);\n          } else if (isUp(keycode)) {\n            return curry(navigate, bridge, isRoot, up, finish, start, firstUpCheck);\n          } else {\n            return Optional.none;\n          }\n        }, function (selected) {\n          var update$1 = function (attempts) {\n            return function () {\n              var navigation = findMap(attempts, function (delta) {\n                return update(delta.rows, delta.cols, container, selected, annotations);\n              });\n              return navigation.fold(function () {\n                return getEdges(container, annotations.firstSelectedSelector, annotations.lastSelectedSelector).map(function (edges) {\n                  var relative = isDown(keycode) || direction.isForward(keycode) ? Situ.after : Situ.before;\n                  bridge.setRelativeSelection(Situ.on(edges.first, 0), relative(edges.table));\n                  annotations.clear(container);\n                  return Response.create(Optional.none(), true);\n                });\n              }, function (_) {\n                return Optional.some(Response.create(Optional.none(), true));\n              });\n            };\n          };\n          if (isDown(keycode) && shiftKey) {\n            return update$1([rc(+1, 0)]);\n          } else if (isUp(keycode) && shiftKey) {\n            return update$1([rc(-1, 0)]);\n          } else if (direction.isBackward(keycode) && shiftKey) {\n            return update$1([\n              rc(0, -1),\n              rc(-1, 0)\n            ]);\n          } else if (direction.isForward(keycode) && shiftKey) {\n            return update$1([\n              rc(0, +1),\n              rc(+1, 0)\n            ]);\n          } else if (isNavigation(keycode) && !shiftKey) {\n            return clearToNavigate;\n          } else {\n            return Optional.none;\n          }\n        });\n        return handler();\n      };\n      var keyup = function (event, start, soffset, finish, foffset) {\n        return retrieve$1(container, annotations.selectedSelector).fold(function () {\n          var realEvent = event.raw;\n          var keycode = realEvent.which;\n          var shiftKey = realEvent.shiftKey === true;\n          if (!shiftKey) {\n            return Optional.none();\n          }\n          if (isNavigation(keycode)) {\n            return sync(container, isRoot, start, soffset, finish, foffset, annotations.selectRange);\n          } else {\n            return Optional.none();\n          }\n        }, Optional.none);\n      };\n      return {\n        keydown: keydown,\n        keyup: keyup\n      };\n    };\n    var external = function (win, container, isRoot, annotations) {\n      var bridge = WindowBridge(win);\n      return function (start, finish) {\n        annotations.clearBeforeUpdate(container);\n        identify(start, finish, isRoot).each(function (cellSel) {\n          var boxes = cellSel.boxes.getOr([]);\n          annotations.selectRange(container, boxes, cellSel.start, cellSel.finish);\n          bridge.selectContents(finish);\n          bridge.collapseSelection();\n        });\n      };\n    };\n\n    var remove = function (element, classes) {\n      each$2(classes, function (x) {\n        remove$2(element, x);\n      });\n    };\n\n    var addClass = function (clazz) {\n      return function (element) {\n        add(element, clazz);\n      };\n    };\n    var removeClasses = function (classes) {\n      return function (element) {\n        remove(element, classes);\n      };\n    };\n\n    var byClass = function (ephemera) {\n      var addSelectionClass = addClass(ephemera.selected);\n      var removeSelectionClasses = removeClasses([\n        ephemera.selected,\n        ephemera.lastSelected,\n        ephemera.firstSelected\n      ]);\n      var clear = function (container) {\n        var sels = descendants(container, ephemera.selectedSelector);\n        each$2(sels, removeSelectionClasses);\n      };\n      var selectRange = function (container, cells, start, finish) {\n        clear(container);\n        each$2(cells, addSelectionClass);\n        add(start, ephemera.firstSelected);\n        add(finish, ephemera.lastSelected);\n      };\n      return {\n        clearBeforeUpdate: clear,\n        clear: clear,\n        selectRange: selectRange,\n        selectedSelector: ephemera.selectedSelector,\n        firstSelectedSelector: ephemera.firstSelectedSelector,\n        lastSelectedSelector: ephemera.lastSelectedSelector\n      };\n    };\n    var byAttr = function (ephemera, onSelection, onClear) {\n      var removeSelectionAttributes = function (element) {\n        remove$7(element, ephemera.selected);\n        remove$7(element, ephemera.firstSelected);\n        remove$7(element, ephemera.lastSelected);\n      };\n      var addSelectionAttribute = function (element) {\n        set$2(element, ephemera.selected, '1');\n      };\n      var clear = function (container) {\n        clearBeforeUpdate(container);\n        onClear();\n      };\n      var clearBeforeUpdate = function (container) {\n        var sels = descendants(container, ephemera.selectedSelector + ',' + ephemera.firstSelectedSelector + ',' + ephemera.lastSelectedSelector);\n        each$2(sels, removeSelectionAttributes);\n      };\n      var selectRange = function (container, cells, start, finish) {\n        clear(container);\n        each$2(cells, addSelectionAttribute);\n        set$2(start, ephemera.firstSelected, '1');\n        set$2(finish, ephemera.lastSelected, '1');\n        onSelection(cells, start, finish);\n      };\n      return {\n        clearBeforeUpdate: clearBeforeUpdate,\n        clear: clear,\n        selectRange: selectRange,\n        selectedSelector: ephemera.selectedSelector,\n        firstSelectedSelector: ephemera.firstSelectedSelector,\n        lastSelectedSelector: ephemera.lastSelectedSelector\n      };\n    };\n    var SelectionAnnotation = {\n      byClass: byClass,\n      byAttr: byAttr\n    };\n\n    var getUpOrLeftCells = function (grid, selectedCells) {\n      var upGrid = grid.slice(0, selectedCells[selectedCells.length - 1].row + 1);\n      var upDetails = toDetailList(upGrid);\n      return bind$2(upDetails, function (detail) {\n        var slicedCells = detail.cells.slice(0, selectedCells[selectedCells.length - 1].column + 1);\n        return map$1(slicedCells, function (cell) {\n          return cell.element;\n        });\n      });\n    };\n    var getDownOrRightCells = function (grid, selectedCells) {\n      var downGrid = grid.slice(selectedCells[0].row + selectedCells[0].rowspan - 1, grid.length);\n      var downDetails = toDetailList(downGrid);\n      return bind$2(downDetails, function (detail) {\n        var slicedCells = detail.cells.slice(selectedCells[0].column + selectedCells[0].colspan - 1, detail.cells.length);\n        return map$1(slicedCells, function (cell) {\n          return cell.element;\n        });\n      });\n    };\n    var getOtherCells = function (table, target, generators) {\n      var warehouse = Warehouse.fromTable(table);\n      var details = onCells(warehouse, target);\n      return details.map(function (selectedCells) {\n        var grid = toGrid(warehouse, generators, false);\n        var upOrLeftCells = getUpOrLeftCells(grid, selectedCells);\n        var downOrRightCells = getDownOrRightCells(grid, selectedCells);\n        return {\n          upOrLeftCells: upOrLeftCells,\n          downOrRightCells: downOrRightCells\n        };\n      });\n    };\n\n    var global = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var hasInternalTarget = function (e) {\n      return has(SugarElement.fromDom(e.target), 'ephox-snooker-resizer-bar') === false;\n    };\n    function CellSelection (editor, lazyResize, selectionTargets) {\n      var onSelection = function (cells, start, finish) {\n        selectionTargets.targets().each(function (targets) {\n          var tableOpt = table(start);\n          tableOpt.each(function (table) {\n            var cloneFormats = getCloneElements(editor);\n            var generators = cellOperations(noop, SugarElement.fromDom(editor.getDoc()), cloneFormats);\n            var otherCells = getOtherCells(table, targets, generators);\n            fireTableSelectionChange(editor, cells, start, finish, otherCells);\n          });\n        });\n      };\n      var onClear = function () {\n        return fireTableSelectionClear(editor);\n      };\n      var annotations = SelectionAnnotation.byAttr(ephemera, onSelection, onClear);\n      editor.on('init', function (_e) {\n        var win = editor.getWin();\n        var body = getBody(editor);\n        var isRoot = getIsRoot(editor);\n        var syncSelection = function () {\n          var sel = editor.selection;\n          var start = SugarElement.fromDom(sel.getStart());\n          var end = SugarElement.fromDom(sel.getEnd());\n          var shared = sharedOne(table, [\n            start,\n            end\n          ]);\n          shared.fold(function () {\n            return annotations.clear(body);\n          }, noop);\n        };\n        var mouseHandlers = mouse(win, body, isRoot, annotations);\n        var keyHandlers = keyboard(win, body, isRoot, annotations);\n        var external$1 = external(win, body, isRoot, annotations);\n        var hasShiftKey = function (event) {\n          return event.raw.shiftKey === true;\n        };\n        editor.on('TableSelectorChange', function (e) {\n          return external$1(e.start, e.finish);\n        });\n        var handleResponse = function (event, response) {\n          if (!hasShiftKey(event)) {\n            return;\n          }\n          if (response.kill) {\n            event.kill();\n          }\n          response.selection.each(function (ns) {\n            var relative = SimSelection.relative(ns.start, ns.finish);\n            var rng = asLtrRange(win, relative);\n            editor.selection.setRng(rng);\n          });\n        };\n        var keyup = function (event) {\n          var wrappedEvent = fromRawEvent(event);\n          if (wrappedEvent.raw.shiftKey && isNavigation(wrappedEvent.raw.which)) {\n            var rng = editor.selection.getRng();\n            var start = SugarElement.fromDom(rng.startContainer);\n            var end = SugarElement.fromDom(rng.endContainer);\n            keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) {\n              handleResponse(wrappedEvent, response);\n            });\n          }\n        };\n        var keydown = function (event) {\n          var wrappedEvent = fromRawEvent(event);\n          lazyResize().each(function (resize) {\n            return resize.hideBars();\n          });\n          var rng = editor.selection.getRng();\n          var start = SugarElement.fromDom(rng.startContainer);\n          var end = SugarElement.fromDom(rng.endContainer);\n          var direction = onDirection(ltr, rtl)(SugarElement.fromDom(editor.selection.getStart()));\n          keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) {\n            handleResponse(wrappedEvent, response);\n          });\n          lazyResize().each(function (resize) {\n            return resize.showBars();\n          });\n        };\n        var isLeftMouse = function (raw) {\n          return raw.button === 0;\n        };\n        var isLeftButtonPressed = function (raw) {\n          if (raw.buttons === undefined) {\n            return true;\n          }\n          if (global.browser.isEdge() && raw.buttons === 0) {\n            return true;\n          }\n          return (raw.buttons & 1) !== 0;\n        };\n        var dragStart = function (_e) {\n          mouseHandlers.clearstate();\n        };\n        var mouseDown = function (e) {\n          if (isLeftMouse(e) && hasInternalTarget(e)) {\n            mouseHandlers.mousedown(fromRawEvent(e));\n          }\n        };\n        var mouseOver = function (e) {\n          if (isLeftButtonPressed(e) && hasInternalTarget(e)) {\n            mouseHandlers.mouseover(fromRawEvent(e));\n          }\n        };\n        var mouseUp = function (e) {\n          if (isLeftMouse(e) && hasInternalTarget(e)) {\n            mouseHandlers.mouseup(fromRawEvent(e));\n          }\n        };\n        var getDoubleTap = function () {\n          var lastTarget = Cell(SugarElement.fromDom(body));\n          var lastTimeStamp = Cell(0);\n          var touchEnd = function (t) {\n            var target = SugarElement.fromDom(t.target);\n            if (name(target) === 'td' || name(target) === 'th') {\n              var lT = lastTarget.get();\n              var lTS = lastTimeStamp.get();\n              if (eq$1(lT, target) && t.timeStamp - lTS < 300) {\n                t.preventDefault();\n                external$1(target, target);\n              }\n            }\n            lastTarget.set(target);\n            lastTimeStamp.set(t.timeStamp);\n          };\n          return { touchEnd: touchEnd };\n        };\n        var doubleTap = getDoubleTap();\n        editor.on('dragstart', dragStart);\n        editor.on('mousedown', mouseDown);\n        editor.on('mouseover', mouseOver);\n        editor.on('mouseup', mouseUp);\n        editor.on('touchend', doubleTap.touchEnd);\n        editor.on('keyup', keyup);\n        editor.on('keydown', keydown);\n        editor.on('NodeChange', syncSelection);\n      });\n      return { clear: annotations.clear };\n    }\n\n    var child = function (scope, selector) {\n      return child$1(scope, selector).isSome();\n    };\n\n    var getSelectionTargets = function (editor, selections) {\n      var targets = Cell(Optional.none());\n      var changeHandlers = Cell([]);\n      var selectionDetails = Optional.none();\n      var isCaption = isTag('caption');\n      var isDisabledForSelection = function (key) {\n        return selectionDetails.forall(function (details) {\n          return !details[key];\n        });\n      };\n      var getStart = function () {\n        return getSelectionCellOrCaption(getSelectionStart(editor), getIsRoot(editor));\n      };\n      var getEnd = function () {\n        return getSelectionCellOrCaption(getSelectionEnd(editor), getIsRoot(editor));\n      };\n      var findTargets = function () {\n        return getStart().bind(function (startCellOrCaption) {\n          return flatten(lift2(table(startCellOrCaption), getEnd().bind(table), function (startTable, endTable) {\n            if (eq$1(startTable, endTable)) {\n              if (isCaption(startCellOrCaption)) {\n                return Optional.some(noMenu(startCellOrCaption));\n              } else {\n                return Optional.some(forMenu(selections, startTable, startCellOrCaption));\n              }\n            }\n            return Optional.none();\n          }));\n        });\n      };\n      var getExtractedDetails = function (targets) {\n        var tableOpt = table(targets.element);\n        return tableOpt.map(function (table) {\n          var warehouse = Warehouse.fromTable(table);\n          var selectedCells = onCells(warehouse, targets).getOr([]);\n          var locked = foldl(selectedCells, function (acc, cell) {\n            if (cell.isLocked) {\n              acc.onAny = true;\n              if (cell.column === 0) {\n                acc.onFirst = true;\n              } else if (cell.column + cell.colspan >= warehouse.grid.columns) {\n                acc.onLast = true;\n              }\n            }\n            return acc;\n          }, {\n            onAny: false,\n            onFirst: false,\n            onLast: false\n          });\n          return {\n            mergeable: onUnlockedMergable(warehouse, targets).isSome(),\n            unmergeable: onUnlockedUnmergable(warehouse, targets).isSome(),\n            locked: locked\n          };\n        });\n      };\n      var resetTargets = function () {\n        targets.set(cached(findTargets)());\n        selectionDetails = targets.get().bind(getExtractedDetails);\n        each$2(changeHandlers.get(), function (handler) {\n          return handler();\n        });\n      };\n      var setupHandler = function (handler) {\n        handler();\n        changeHandlers.set(changeHandlers.get().concat([handler]));\n        return function () {\n          changeHandlers.set(filter$2(changeHandlers.get(), function (h) {\n            return h !== handler;\n          }));\n        };\n      };\n      var onSetup = function (api, isDisabled) {\n        return setupHandler(function () {\n          return targets.get().fold(function () {\n            api.setDisabled(true);\n          }, function (targets) {\n            api.setDisabled(isDisabled(targets));\n          });\n        });\n      };\n      var onSetupWithToggle = function (api, isDisabled, isActive) {\n        return setupHandler(function () {\n          return targets.get().fold(function () {\n            api.setDisabled(true);\n            api.setActive(false);\n          }, function (targets) {\n            api.setDisabled(isDisabled(targets));\n            api.setActive(isActive(targets));\n          });\n        });\n      };\n      var isDisabledFromLocked = function (lockedDisable) {\n        return selectionDetails.exists(function (details) {\n          return details.locked[lockedDisable];\n        });\n      };\n      var onSetupTable = function (api) {\n        return onSetup(api, function (_) {\n          return false;\n        });\n      };\n      var onSetupCellOrRow = function (api) {\n        return onSetup(api, function (targets) {\n          return isCaption(targets.element);\n        });\n      };\n      var onSetupColumn = function (lockedDisable) {\n        return function (api) {\n          return onSetup(api, function (targets) {\n            return isCaption(targets.element) || isDisabledFromLocked(lockedDisable);\n          });\n        };\n      };\n      var onSetupPasteable = function (getClipboardData) {\n        return function (api) {\n          return onSetup(api, function (targets) {\n            return isCaption(targets.element) || getClipboardData().isNone();\n          });\n        };\n      };\n      var onSetupPasteableColumn = function (getClipboardData, lockedDisable) {\n        return function (api) {\n          return onSetup(api, function (targets) {\n            return isCaption(targets.element) || getClipboardData().isNone() || isDisabledFromLocked(lockedDisable);\n          });\n        };\n      };\n      var onSetupMergeable = function (api) {\n        return onSetup(api, function (_targets) {\n          return isDisabledForSelection('mergeable');\n        });\n      };\n      var onSetupUnmergeable = function (api) {\n        return onSetup(api, function (_targets) {\n          return isDisabledForSelection('unmergeable');\n        });\n      };\n      var onSetupTableWithCaption = function (api) {\n        return onSetupWithToggle(api, never, function (targets) {\n          var tableOpt = table(targets.element, getIsRoot(editor));\n          return tableOpt.exists(function (table) {\n            return child(table, 'caption');\n          });\n        });\n      };\n      var onSetupTableHeaders = function (command, headerType) {\n        return function (api) {\n          return onSetupWithToggle(api, function (targets) {\n            return isCaption(targets.element);\n          }, function () {\n            return editor.queryCommandValue(command) === headerType;\n          });\n        };\n      };\n      var onSetupTableRowHeaders = onSetupTableHeaders('mceTableRowType', 'header');\n      var onSetupTableColumnHeaders = onSetupTableHeaders('mceTableColType', 'th');\n      editor.on('NodeChange ExecCommand TableSelectorChange', resetTargets);\n      return {\n        onSetupTable: onSetupTable,\n        onSetupCellOrRow: onSetupCellOrRow,\n        onSetupColumn: onSetupColumn,\n        onSetupPasteable: onSetupPasteable,\n        onSetupPasteableColumn: onSetupPasteableColumn,\n        onSetupMergeable: onSetupMergeable,\n        onSetupUnmergeable: onSetupUnmergeable,\n        resetTargets: resetTargets,\n        onSetupTableWithCaption: onSetupTableWithCaption,\n        onSetupTableRowHeaders: onSetupTableRowHeaders,\n        onSetupTableColumnHeaders: onSetupTableColumnHeaders,\n        targets: targets.get\n      };\n    };\n\n    var addButtons = function (editor, selections, selectionTargets, clipboard) {\n      editor.ui.registry.addMenuButton('table', {\n        tooltip: 'Table',\n        icon: 'table',\n        fetch: function (callback) {\n          return callback('inserttable | cell row column | advtablesort | tableprops deletetable');\n        }\n      });\n      var cmd = function (command) {\n        return function () {\n          return editor.execCommand(command);\n        };\n      };\n      editor.ui.registry.addButton('tableprops', {\n        tooltip: 'Table properties',\n        onAction: cmd('mceTableProps'),\n        icon: 'table',\n        onSetup: selectionTargets.onSetupTable\n      });\n      editor.ui.registry.addButton('tabledelete', {\n        tooltip: 'Delete table',\n        onAction: cmd('mceTableDelete'),\n        icon: 'table-delete-table',\n        onSetup: selectionTargets.onSetupTable\n      });\n      editor.ui.registry.addButton('tablecellprops', {\n        tooltip: 'Cell properties',\n        onAction: cmd('mceTableCellProps'),\n        icon: 'table-cell-properties',\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tablemergecells', {\n        tooltip: 'Merge cells',\n        onAction: cmd('mceTableMergeCells'),\n        icon: 'table-merge-cells',\n        onSetup: selectionTargets.onSetupMergeable\n      });\n      editor.ui.registry.addButton('tablesplitcells', {\n        tooltip: 'Split cell',\n        onAction: cmd('mceTableSplitCells'),\n        icon: 'table-split-cells',\n        onSetup: selectionTargets.onSetupUnmergeable\n      });\n      editor.ui.registry.addButton('tableinsertrowbefore', {\n        tooltip: 'Insert row before',\n        onAction: cmd('mceTableInsertRowBefore'),\n        icon: 'table-insert-row-above',\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tableinsertrowafter', {\n        tooltip: 'Insert row after',\n        onAction: cmd('mceTableInsertRowAfter'),\n        icon: 'table-insert-row-after',\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tabledeleterow', {\n        tooltip: 'Delete row',\n        onAction: cmd('mceTableDeleteRow'),\n        icon: 'table-delete-row',\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tablerowprops', {\n        tooltip: 'Row properties',\n        onAction: cmd('mceTableRowProps'),\n        icon: 'table-row-properties',\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tableinsertcolbefore', {\n        tooltip: 'Insert column before',\n        onAction: cmd('mceTableInsertColBefore'),\n        icon: 'table-insert-column-before',\n        onSetup: selectionTargets.onSetupColumn('onFirst')\n      });\n      editor.ui.registry.addButton('tableinsertcolafter', {\n        tooltip: 'Insert column after',\n        onAction: cmd('mceTableInsertColAfter'),\n        icon: 'table-insert-column-after',\n        onSetup: selectionTargets.onSetupColumn('onLast')\n      });\n      editor.ui.registry.addButton('tabledeletecol', {\n        tooltip: 'Delete column',\n        onAction: cmd('mceTableDeleteCol'),\n        icon: 'table-delete-column',\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addButton('tablecutrow', {\n        tooltip: 'Cut row',\n        icon: 'cut-row',\n        onAction: cmd('mceTableCutRow'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tablecopyrow', {\n        tooltip: 'Copy row',\n        icon: 'duplicate-row',\n        onAction: cmd('mceTableCopyRow'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addButton('tablepasterowbefore', {\n        tooltip: 'Paste row before',\n        icon: 'paste-row-before',\n        onAction: cmd('mceTablePasteRowBefore'),\n        onSetup: selectionTargets.onSetupPasteable(clipboard.getRows)\n      });\n      editor.ui.registry.addButton('tablepasterowafter', {\n        tooltip: 'Paste row after',\n        icon: 'paste-row-after',\n        onAction: cmd('mceTablePasteRowAfter'),\n        onSetup: selectionTargets.onSetupPasteable(clipboard.getRows)\n      });\n      editor.ui.registry.addButton('tablecutcol', {\n        tooltip: 'Cut column',\n        icon: 'cut-column',\n        onAction: cmd('mceTableCutCol'),\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addButton('tablecopycol', {\n        tooltip: 'Copy column',\n        icon: 'duplicate-column',\n        onAction: cmd('mceTableCopyCol'),\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addButton('tablepastecolbefore', {\n        tooltip: 'Paste column before',\n        icon: 'paste-column-before',\n        onAction: cmd('mceTablePasteColBefore'),\n        onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onFirst')\n      });\n      editor.ui.registry.addButton('tablepastecolafter', {\n        tooltip: 'Paste column after',\n        icon: 'paste-column-after',\n        onAction: cmd('mceTablePasteColAfter'),\n        onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onLast')\n      });\n      editor.ui.registry.addButton('tableinsertdialog', {\n        tooltip: 'Insert table',\n        onAction: cmd('mceInsertTable'),\n        icon: 'table'\n      });\n      var tableClassList = filterNoneItem(getTableClassList(editor));\n      if (tableClassList.length !== 0) {\n        editor.ui.registry.addMenuButton('tableclass', {\n          icon: 'table-classes',\n          tooltip: 'Table styles',\n          fetch: generateMenuItemsCallback(editor, selections, tableClassList, 'tableclass', function (value) {\n            return editor.execCommand('mceTableToggleClass', false, value);\n          }),\n          onSetup: selectionTargets.onSetupTable\n        });\n      }\n      var tableCellClassList = filterNoneItem(getCellClassList(editor));\n      if (tableCellClassList.length !== 0) {\n        editor.ui.registry.addMenuButton('tablecellclass', {\n          icon: 'table-cell-classes',\n          tooltip: 'Cell styles',\n          fetch: generateMenuItemsCallback(editor, selections, tableCellClassList, 'tablecellclass', function (value) {\n            return editor.execCommand('mceTableCellToggleClass', false, value);\n          }),\n          onSetup: selectionTargets.onSetupCellOrRow\n        });\n      }\n      editor.ui.registry.addMenuButton('tablecellvalign', {\n        icon: 'vertical-align',\n        tooltip: 'Vertical align',\n        fetch: generateMenuItemsCallback(editor, selections, verticalAlignValues, 'tablecellverticalalign', applyTableCellStyle(editor, 'vertical-align')),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuButton('tablecellborderwidth', {\n        icon: 'border-width',\n        tooltip: 'Border width',\n        fetch: generateMenuItemsCallback(editor, selections, getTableBorderWidths(editor), 'tablecellborderwidth', applyTableCellStyle(editor, 'border-width')),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuButton('tablecellborderstyle', {\n        icon: 'border-style',\n        tooltip: 'Border style',\n        fetch: generateMenuItemsCallback(editor, selections, getTableBorderStyles(editor), 'tablecellborderstyle', applyTableCellStyle(editor, 'border-style')),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addToggleButton('tablecaption', {\n        tooltip: 'Table caption',\n        onAction: cmd('mceTableToggleCaption'),\n        icon: 'table-caption',\n        onSetup: selectionTargets.onSetupTableWithCaption\n      });\n      editor.ui.registry.addMenuButton('tablecellbackgroundcolor', {\n        icon: 'cell-background-color',\n        tooltip: 'Background color',\n        fetch: function (callback) {\n          return callback(buildColorMenu(editor, getTableBackgroundColorMap(editor), 'background-color'));\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuButton('tablecellbordercolor', {\n        icon: 'cell-border-color',\n        tooltip: 'Border color',\n        fetch: function (callback) {\n          return callback(buildColorMenu(editor, getTableBorderColorMap(editor), 'border-color'));\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addToggleButton('tablerowheader', {\n        tooltip: 'Row header',\n        icon: 'table-top-header',\n        onAction: changeRowHeader(editor),\n        onSetup: selectionTargets.onSetupTableRowHeaders\n      });\n      editor.ui.registry.addToggleButton('tablecolheader', {\n        tooltip: 'Column header',\n        icon: 'table-left-header',\n        onAction: changeColumnHeader(editor),\n        onSetup: selectionTargets.onSetupTableColumnHeaders\n      });\n    };\n    var addToolbars = function (editor) {\n      var isTable = function (table) {\n        return editor.dom.is(table, 'table') && editor.getBody().contains(table);\n      };\n      var toolbar = getToolbar(editor);\n      if (toolbar.length > 0) {\n        editor.ui.registry.addContextToolbar('table', {\n          predicate: isTable,\n          items: toolbar,\n          scope: 'node',\n          position: 'node'\n        });\n      }\n    };\n\n    var addMenuItems = function (editor, selections, selectionTargets, clipboard) {\n      var cmd = function (command) {\n        return function () {\n          return editor.execCommand(command);\n        };\n      };\n      var insertTableAction = function (data) {\n        editor.execCommand('mceInsertTable', false, {\n          rows: data.numRows,\n          columns: data.numColumns\n        });\n      };\n      var tableProperties = {\n        text: 'Table properties',\n        onSetup: selectionTargets.onSetupTable,\n        onAction: cmd('mceTableProps')\n      };\n      var deleteTable = {\n        text: 'Delete table',\n        icon: 'table-delete-table',\n        onSetup: selectionTargets.onSetupTable,\n        onAction: cmd('mceTableDelete')\n      };\n      editor.ui.registry.addMenuItem('tableinsertrowbefore', {\n        text: 'Insert row before',\n        icon: 'table-insert-row-above',\n        onAction: cmd('mceTableInsertRowBefore'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tableinsertrowafter', {\n        text: 'Insert row after',\n        icon: 'table-insert-row-after',\n        onAction: cmd('mceTableInsertRowAfter'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tabledeleterow', {\n        text: 'Delete row',\n        icon: 'table-delete-row',\n        onAction: cmd('mceTableDeleteRow'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tablerowprops', {\n        text: 'Row properties',\n        icon: 'table-row-properties',\n        onAction: cmd('mceTableRowProps'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tablecutrow', {\n        text: 'Cut row',\n        icon: 'cut-row',\n        onAction: cmd('mceTableCutRow'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tablecopyrow', {\n        text: 'Copy row',\n        icon: 'duplicate-row',\n        onAction: cmd('mceTableCopyRow'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tablepasterowbefore', {\n        text: 'Paste row before',\n        icon: 'paste-row-before',\n        onAction: cmd('mceTablePasteRowBefore'),\n        onSetup: selectionTargets.onSetupPasteable(clipboard.getRows)\n      });\n      editor.ui.registry.addMenuItem('tablepasterowafter', {\n        text: 'Paste row after',\n        icon: 'paste-row-after',\n        onAction: cmd('mceTablePasteRowAfter'),\n        onSetup: selectionTargets.onSetupPasteable(clipboard.getRows)\n      });\n      var row = {\n        type: 'nestedmenuitem',\n        text: 'Row',\n        getSubmenuItems: constant('tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter')\n      };\n      editor.ui.registry.addMenuItem('tableinsertcolumnbefore', {\n        text: 'Insert column before',\n        icon: 'table-insert-column-before',\n        onAction: cmd('mceTableInsertColBefore'),\n        onSetup: selectionTargets.onSetupColumn('onFirst')\n      });\n      editor.ui.registry.addMenuItem('tableinsertcolumnafter', {\n        text: 'Insert column after',\n        icon: 'table-insert-column-after',\n        onAction: cmd('mceTableInsertColAfter'),\n        onSetup: selectionTargets.onSetupColumn('onLast')\n      });\n      editor.ui.registry.addMenuItem('tabledeletecolumn', {\n        text: 'Delete column',\n        icon: 'table-delete-column',\n        onAction: cmd('mceTableDeleteCol'),\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addMenuItem('tablecutcolumn', {\n        text: 'Cut column',\n        icon: 'cut-column',\n        onAction: cmd('mceTableCutCol'),\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addMenuItem('tablecopycolumn', {\n        text: 'Copy column',\n        icon: 'duplicate-column',\n        onAction: cmd('mceTableCopyCol'),\n        onSetup: selectionTargets.onSetupColumn('onAny')\n      });\n      editor.ui.registry.addMenuItem('tablepastecolumnbefore', {\n        text: 'Paste column before',\n        icon: 'paste-column-before',\n        onAction: cmd('mceTablePasteColBefore'),\n        onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onFirst')\n      });\n      editor.ui.registry.addMenuItem('tablepastecolumnafter', {\n        text: 'Paste column after',\n        icon: 'paste-column-after',\n        onAction: cmd('mceTablePasteColAfter'),\n        onSetup: selectionTargets.onSetupPasteableColumn(clipboard.getColumns, 'onLast')\n      });\n      var column = {\n        type: 'nestedmenuitem',\n        text: 'Column',\n        getSubmenuItems: constant('tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter')\n      };\n      editor.ui.registry.addMenuItem('tablecellprops', {\n        text: 'Cell properties',\n        icon: 'table-cell-properties',\n        onAction: cmd('mceTableCellProps'),\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addMenuItem('tablemergecells', {\n        text: 'Merge cells',\n        icon: 'table-merge-cells',\n        onAction: cmd('mceTableMergeCells'),\n        onSetup: selectionTargets.onSetupMergeable\n      });\n      editor.ui.registry.addMenuItem('tablesplitcells', {\n        text: 'Split cell',\n        icon: 'table-split-cells',\n        onAction: cmd('mceTableSplitCells'),\n        onSetup: selectionTargets.onSetupUnmergeable\n      });\n      var cell = {\n        type: 'nestedmenuitem',\n        text: 'Cell',\n        getSubmenuItems: constant('tablecellprops tablemergecells tablesplitcells')\n      };\n      if (hasTableGrid(editor) === false) {\n        editor.ui.registry.addMenuItem('inserttable', {\n          text: 'Table',\n          icon: 'table',\n          onAction: cmd('mceInsertTable')\n        });\n      } else {\n        editor.ui.registry.addNestedMenuItem('inserttable', {\n          text: 'Table',\n          icon: 'table',\n          getSubmenuItems: function () {\n            return [{\n                type: 'fancymenuitem',\n                fancytype: 'inserttable',\n                onAction: insertTableAction\n              }];\n          }\n        });\n      }\n      editor.ui.registry.addMenuItem('inserttabledialog', {\n        text: 'Insert table',\n        icon: 'table',\n        onAction: cmd('mceInsertTable')\n      });\n      editor.ui.registry.addMenuItem('tableprops', tableProperties);\n      editor.ui.registry.addMenuItem('deletetable', deleteTable);\n      editor.ui.registry.addNestedMenuItem('row', row);\n      editor.ui.registry.addNestedMenuItem('column', column);\n      editor.ui.registry.addNestedMenuItem('cell', cell);\n      editor.ui.registry.addContextMenu('table', {\n        update: function () {\n          selectionTargets.resetTargets();\n          return selectionTargets.targets().fold(constant(''), function (targets) {\n            if (name(targets.element) === 'caption') {\n              return 'tableprops deletetable';\n            } else {\n              return 'cell row column | advtablesort | tableprops deletetable';\n            }\n          });\n        }\n      });\n      var tableClassList = filterNoneItem(getTableClassList(editor));\n      if (tableClassList.length !== 0) {\n        editor.ui.registry.addNestedMenuItem('tableclass', {\n          icon: 'table-classes',\n          text: 'Table styles',\n          getSubmenuItems: function () {\n            return buildMenuItems(editor, selections, tableClassList, 'tableclass', function (value) {\n              return editor.execCommand('mceTableToggleClass', false, value);\n            });\n          },\n          onSetup: selectionTargets.onSetupTable\n        });\n      }\n      var tableCellClassList = filterNoneItem(getCellClassList(editor));\n      if (tableCellClassList.length !== 0) {\n        editor.ui.registry.addNestedMenuItem('tablecellclass', {\n          icon: 'table-cell-classes',\n          text: 'Cell styles',\n          getSubmenuItems: function () {\n            return buildMenuItems(editor, selections, tableCellClassList, 'tablecellclass', function (value) {\n              return editor.execCommand('mceTableCellToggleClass', false, value);\n            });\n          },\n          onSetup: selectionTargets.onSetupCellOrRow\n        });\n      }\n      editor.ui.registry.addNestedMenuItem('tablecellvalign', {\n        icon: 'vertical-align',\n        text: 'Vertical align',\n        getSubmenuItems: function () {\n          return buildMenuItems(editor, selections, verticalAlignValues, 'tablecellverticalalign', applyTableCellStyle(editor, 'vertical-align'));\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addNestedMenuItem('tablecellborderwidth', {\n        icon: 'border-width',\n        text: 'Border width',\n        getSubmenuItems: function () {\n          return buildMenuItems(editor, selections, getTableBorderWidths(editor), 'tablecellborderwidth', applyTableCellStyle(editor, 'border-width'));\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addNestedMenuItem('tablecellborderstyle', {\n        icon: 'border-style',\n        text: 'Border style',\n        getSubmenuItems: function () {\n          return buildMenuItems(editor, selections, getTableBorderStyles(editor), 'tablecellborderstyle', applyTableCellStyle(editor, 'border-style'));\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addToggleMenuItem('tablecaption', {\n        icon: 'table-caption',\n        text: 'Table caption',\n        onAction: cmd('mceTableToggleCaption'),\n        onSetup: selectionTargets.onSetupTableWithCaption\n      });\n      editor.ui.registry.addNestedMenuItem('tablecellbackgroundcolor', {\n        icon: 'cell-background-color',\n        text: 'Background color',\n        getSubmenuItems: function () {\n          return buildColorMenu(editor, getTableBackgroundColorMap(editor), 'background-color');\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addNestedMenuItem('tablecellbordercolor', {\n        icon: 'cell-border-color',\n        text: 'Border color',\n        getSubmenuItems: function () {\n          return buildColorMenu(editor, getTableBorderColorMap(editor), 'border-color');\n        },\n        onSetup: selectionTargets.onSetupCellOrRow\n      });\n      editor.ui.registry.addToggleMenuItem('tablerowheader', {\n        text: 'Row header',\n        icon: 'table-top-header',\n        onAction: changeRowHeader(editor),\n        onSetup: selectionTargets.onSetupTableRowHeaders\n      });\n      editor.ui.registry.addToggleMenuItem('tablecolheader', {\n        text: 'Column header',\n        icon: 'table-left-header',\n        onAction: changeColumnHeader(editor),\n        onSetup: selectionTargets.onSetupTableColumnHeaders\n      });\n    };\n\n    var Plugin = function (editor) {\n      var selections = Selections(function () {\n        return getBody(editor);\n      }, function () {\n        return getSelectionCell(getSelectionStart(editor), getIsRoot(editor));\n      }, ephemera.selectedSelector);\n      var selectionTargets = getSelectionTargets(editor, selections);\n      var resizeHandler = getResizeHandler(editor);\n      var cellSelection = CellSelection(editor, resizeHandler.lazyResize, selectionTargets);\n      var actions = TableActions(editor, cellSelection, resizeHandler.lazyWire);\n      var clipboard = Clipboard();\n      registerCommands(editor, actions, cellSelection, selections, clipboard);\n      registerQueryCommands(editor, actions, selections);\n      registerEvents(editor, selections, actions);\n      addMenuItems(editor, selections, selectionTargets, clipboard);\n      addButtons(editor, selections, selectionTargets, clipboard);\n      addToolbars(editor);\n      editor.on('PreInit', function () {\n        editor.serializer.addTempAttr(ephemera.firstSelected);\n        editor.serializer.addTempAttr(ephemera.lastSelected);\n        registerFormats(editor);\n      });\n      if (hasTabNavigation(editor)) {\n        editor.on('keydown', function (e) {\n          handle$1(e, editor, cellSelection);\n        });\n      }\n      editor.on('remove', function () {\n        resizeHandler.destroy();\n      });\n      return getApi(editor, clipboard, resizeHandler, selectionTargets);\n    };\n    function Plugin$1 () {\n      global$3.add('table', Plugin);\n    }\n\n    Plugin$1();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/plugins/table/plugin.js?");

/***/ }),

/***/ "../../node_modules/tinymce/themes/silver/index.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/themes/silver/index.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("// Exports the \"silver\" theme for usage with module loaders\n// Usage:\n//   CommonJS:\n//     require('tinymce/themes/silver')\n//   ES2015:\n//     import 'tinymce/themes/silver'\n__webpack_require__(/*! ./theme.js */ \"../../node_modules/tinymce/themes/silver/theme.js\");\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/themes/silver/index.js?");

/***/ }),

/***/ "../../node_modules/tinymce/themes/silver/theme.js":
/*!*********************************************************!*\
  !*** ../../node_modules/tinymce/themes/silver/theme.js ***!
  \*********************************************************/
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var eq$1 = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isString = isType$1('string');\n    var isObject = isType$1('object');\n    var isArray = isType$1('array');\n    var isNull = eq$1(null);\n    var isBoolean = isSimpleType('boolean');\n    var isUndefined = eq$1(undefined);\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n    var isArrayOf = function (value, pred) {\n      if (isArray(value)) {\n        for (var i = 0, len = value.length; i < len; ++i) {\n          if (!pred(value[i])) {\n            return false;\n          }\n        }\n        return true;\n      }\n      return false;\n    };\n\n    var noop = function () {\n    };\n    var noarg = function (f) {\n      return function () {\n        return f();\n      };\n    };\n    var compose = function (fa, fb) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return fa(fb.apply(null, args));\n      };\n    };\n    var compose1 = function (fbc, fab) {\n      return function (a) {\n        return fbc(fab(a));\n      };\n    };\n    var constant$1 = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity$1 = function (x) {\n      return x;\n    };\n    var tripleEquals = function (a, b) {\n      return a === b;\n    };\n    function curry(fn) {\n      var initialArgs = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        initialArgs[_i - 1] = arguments[_i];\n      }\n      return function () {\n        var restArgs = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          restArgs[_i] = arguments[_i];\n        }\n        var all = initialArgs.concat(restArgs);\n        return fn.apply(null, all);\n      };\n    }\n    var not = function (f) {\n      return function (t) {\n        return !f(t);\n      };\n    };\n    var die = function (msg) {\n      return function () {\n        throw new Error(msg);\n      };\n    };\n    var never = constant$1(false);\n    var always = constant$1(true);\n\n    var global$g = tinymce.util.Tools.resolve('tinymce.ThemeManager');\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n    function __rest(s, e) {\n      var t = {};\n      for (var p in s)\n        if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n          t[p] = s[p];\n      if (s != null && typeof Object.getOwnPropertySymbols === 'function')\n        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n          if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n            t[p[i]] = s[p[i]];\n        }\n      return t;\n    }\n    function __spreadArray(to, from, pack) {\n      if (pack || arguments.length === 2)\n        for (var i = 0, l = from.length, ar; i < l; i++) {\n          if (ar || !(i in from)) {\n            if (!ar)\n              ar = Array.prototype.slice.call(from, 0, i);\n            ar[i] = from[i];\n          }\n        }\n      return to.concat(ar || Array.prototype.slice.call(from));\n    }\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity$1;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant$1(null),\n        getOrUndefined: constant$1(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant$1('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant$1(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from$1 = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from$1\n    };\n\n    var nativeSlice = Array.prototype.slice;\n    var nativeIndexOf = Array.prototype.indexOf;\n    var nativePush = Array.prototype.push;\n    var rawIndexOf = function (ts, t) {\n      return nativeIndexOf.call(ts, t);\n    };\n    var indexOf = function (xs, x) {\n      var r = rawIndexOf(xs, x);\n      return r === -1 ? Optional.none() : Optional.some(r);\n    };\n    var contains$2 = function (xs, x) {\n      return rawIndexOf(xs, x) > -1;\n    };\n    var exists = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var range$2 = function (num, f) {\n      var r = [];\n      for (var i = 0; i < num; i++) {\n        r.push(f(i));\n      }\n      return r;\n    };\n    var chunk$1 = function (array, size) {\n      var r = [];\n      for (var i = 0; i < array.length; i += size) {\n        var s = nativeSlice.call(array, i, i + size);\n        r.push(s);\n      }\n      return r;\n    };\n    var map$2 = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$1 = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var eachr = function (xs, f) {\n      for (var i = xs.length - 1; i >= 0; i--) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var partition$3 = function (xs, pred) {\n      var pass = [];\n      var fail = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        var arr = pred(x, i) ? pass : fail;\n        arr.push(x);\n      }\n      return {\n        pass: pass,\n        fail: fail\n      };\n    };\n    var filter$2 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var foldr = function (xs, f, acc) {\n      eachr(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var foldl = function (xs, f, acc) {\n      each$1(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find$5 = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var findIndex$1 = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(i);\n        }\n      }\n      return Optional.none();\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind$3 = function (xs, f) {\n      return flatten(map$2(xs, f));\n    };\n    var forall = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        var x = xs[i];\n        if (pred(x, i) !== true) {\n          return false;\n        }\n      }\n      return true;\n    };\n    var reverse = function (xs) {\n      var r = nativeSlice.call(xs, 0);\n      r.reverse();\n      return r;\n    };\n    var difference = function (a1, a2) {\n      return filter$2(a1, function (x) {\n        return !contains$2(a2, x);\n      });\n    };\n    var mapToObject = function (xs, f) {\n      var r = {};\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        r[String(x)] = f(x, i);\n      }\n      return r;\n    };\n    var pure$2 = function (x) {\n      return [x];\n    };\n    var sort = function (xs, comparator) {\n      var copy = nativeSlice.call(xs, 0);\n      copy.sort(comparator);\n      return copy;\n    };\n    var get$f = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$f(xs, 0);\n    };\n    var last$2 = function (xs) {\n      return get$f(xs, xs.length - 1);\n    };\n    var from = isFunction(Array.from) ? Array.from : function (x) {\n      return nativeSlice.call(x);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var keys = Object.keys;\n    var hasOwnProperty$1 = Object.hasOwnProperty;\n    var each = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var map$1 = function (obj, f) {\n      return tupleMap(obj, function (x, i) {\n        return {\n          k: i,\n          v: f(x, i)\n        };\n      });\n    };\n    var tupleMap = function (obj, f) {\n      var r = {};\n      each(obj, function (x, i) {\n        var tuple = f(x, i);\n        r[tuple.k] = tuple.v;\n      });\n      return r;\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var filter$1 = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n    var mapToArray = function (obj, f) {\n      var r = [];\n      each(obj, function (value, name) {\n        r.push(f(value, name));\n      });\n      return r;\n    };\n    var find$4 = function (obj, pred) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        if (pred(x, i, obj)) {\n          return Optional.some(x);\n        }\n      }\n      return Optional.none();\n    };\n    var values = function (obj) {\n      return mapToArray(obj, identity$1);\n    };\n    var get$e = function (obj, key) {\n      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();\n    };\n    var has$2 = function (obj, key) {\n      return hasOwnProperty$1.call(obj, key);\n    };\n    var hasNonNullableKey = function (obj, key) {\n      return has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;\n    };\n\n    var is$1 = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lhs.exists(function (left) {\n        return comparator(left, rhs);\n      });\n    };\n    var equals = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lift2(lhs, rhs, comparator).getOr(lhs.isNone() && rhs.isNone());\n    };\n    var cat = function (arr) {\n      var r = [];\n      var push = function (x) {\n        r.push(x);\n      };\n      for (var i = 0; i < arr.length; i++) {\n        arr[i].each(push);\n      }\n      return r;\n    };\n    var sequence = function (arr) {\n      var r = [];\n      for (var i = 0; i < arr.length; i++) {\n        var x = arr[i];\n        if (x.isSome()) {\n          r.push(x.getOrDie());\n        } else {\n          return Optional.none();\n        }\n      }\n      return Optional.some(r);\n    };\n    var lift2 = function (oa, ob, f) {\n      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();\n    };\n    var lift3 = function (oa, ob, oc, f) {\n      return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none();\n    };\n    var mapFrom = function (a, f) {\n      return a !== undefined && a !== null ? Optional.some(f(a)) : Optional.none();\n    };\n    var someIf = function (b, a) {\n      return b ? Optional.some(a) : Optional.none();\n    };\n\n    var addToEnd = function (str, suffix) {\n      return str + suffix;\n    };\n    var removeFromStart = function (str, numChars) {\n      return str.substring(numChars);\n    };\n\n    var checkRange = function (str, substr, start) {\n      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;\n    };\n    var removeLeading = function (str, prefix) {\n      return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str;\n    };\n    var ensureTrailing = function (str, suffix) {\n      return endsWith(str, suffix) ? str : addToEnd(str, suffix);\n    };\n    var contains$1 = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var startsWith = function (str, prefix) {\n      return checkRange(str, prefix, 0);\n    };\n    var endsWith = function (str, suffix) {\n      return checkRange(str, suffix, str.length - suffix.length);\n    };\n    var blank = function (r) {\n      return function (s) {\n        return s.replace(r, '');\n      };\n    };\n    var trim$1 = blank(/^\\s+|\\s+$/g);\n    var isNotEmpty = function (s) {\n      return s.length > 0;\n    };\n    var isEmpty = function (s) {\n      return !isNotEmpty(s);\n    };\n\n    var isSupported$1 = function (dom) {\n      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n    };\n\n    var fromHtml$2 = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom(node);\n    };\n    var fromDom = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml$2,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom,\n      fromPoint: fromPoint\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var DOCUMENT = 9;\n    var DOCUMENT_FRAGMENT = 11;\n    var ELEMENT = 1;\n    var TEXT = 3;\n\n    var name$2 = function (element) {\n      var r = element.dom.nodeName;\n      return r.toLowerCase();\n    };\n    var type = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type(element) === t;\n      };\n    };\n    var isElement$2 = isType(ELEMENT);\n    var isText$1 = isType(TEXT);\n    var isDocument = isType(DOCUMENT);\n    var isDocumentFragment = isType(DOCUMENT_FRAGMENT);\n\n    var cached = function (f) {\n      var called = false;\n      var r;\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!called) {\n          called = true;\n          r = f.apply(null, args);\n        }\n        return r;\n      };\n    };\n\n    var DeviceType = function (os, browser, userAgent, mediaMatch) {\n      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n      var isiPhone = os.isiOS() && !isiPad;\n      var isMobile = os.isiOS() || os.isAndroid();\n      var isTouch = isMobile || mediaMatch('(pointer:coarse)');\n      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');\n      var isPhone = isiPhone || isMobile && !isTablet;\n      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n      var isDesktop = !isPhone && !isTablet && !iOSwebview;\n      return {\n        isiPad: constant$1(isiPad),\n        isiPhone: constant$1(isiPhone),\n        isTablet: constant$1(isTablet),\n        isPhone: constant$1(isPhone),\n        isTouch: constant$1(isTouch),\n        isAndroid: os.isAndroid,\n        isiOS: os.isiOS,\n        isWebView: constant$1(iOSwebview),\n        isDesktop: constant$1(isDesktop)\n      };\n    };\n\n    var firstMatch = function (regexes, s) {\n      for (var i = 0; i < regexes.length; i++) {\n        var x = regexes[i];\n        if (x.test(s)) {\n          return x;\n        }\n      }\n      return undefined;\n    };\n    var find$3 = function (regexes, agent) {\n      var r = firstMatch(regexes, agent);\n      if (!r) {\n        return {\n          major: 0,\n          minor: 0\n        };\n      }\n      var group = function (i) {\n        return Number(agent.replace(r, '$' + i));\n      };\n      return nu$d(group(1), group(2));\n    };\n    var detect$4 = function (versionRegexes, agent) {\n      var cleanedAgent = String(agent).toLowerCase();\n      if (versionRegexes.length === 0) {\n        return unknown$3();\n      }\n      return find$3(versionRegexes, cleanedAgent);\n    };\n    var unknown$3 = function () {\n      return nu$d(0, 0);\n    };\n    var nu$d = function (major, minor) {\n      return {\n        major: major,\n        minor: minor\n      };\n    };\n    var Version = {\n      nu: nu$d,\n      detect: detect$4,\n      unknown: unknown$3\n    };\n\n    var detectBrowser$1 = function (browsers, userAgentData) {\n      return findMap(userAgentData.brands, function (uaBrand) {\n        var lcBrand = uaBrand.brand.toLowerCase();\n        return find$5(browsers, function (browser) {\n          var _a;\n          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());\n        }).map(function (info) {\n          return {\n            current: info.name,\n            version: Version.nu(parseInt(uaBrand.version, 10), 0)\n          };\n        });\n      });\n    };\n\n    var detect$3 = function (candidates, userAgent) {\n      var agent = String(userAgent).toLowerCase();\n      return find$5(candidates, function (candidate) {\n        return candidate.search(agent);\n      });\n    };\n    var detectBrowser = function (browsers, userAgent) {\n      return detect$3(browsers, userAgent).map(function (browser) {\n        var version = Version.detect(browser.versionRegexes, userAgent);\n        return {\n          current: browser.name,\n          version: version\n        };\n      });\n    };\n    var detectOs = function (oses, userAgent) {\n      return detect$3(oses, userAgent).map(function (os) {\n        var version = Version.detect(os.versionRegexes, userAgent);\n        return {\n          current: os.name,\n          version: version\n        };\n      });\n    };\n\n    var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n    var checkContains = function (target) {\n      return function (uastring) {\n        return contains$1(uastring, target);\n      };\n    };\n    var browsers = [\n      {\n        name: 'Edge',\n        versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n        search: function (uastring) {\n          return contains$1(uastring, 'edge/') && contains$1(uastring, 'chrome') && contains$1(uastring, 'safari') && contains$1(uastring, 'applewebkit');\n        }\n      },\n      {\n        name: 'Chrome',\n        brand: 'Chromium',\n        versionRegexes: [\n          /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n          normalVersionRegex\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'chrome') && !contains$1(uastring, 'chromeframe');\n        }\n      },\n      {\n        name: 'IE',\n        versionRegexes: [\n          /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*?rv:([0-9]+)\\.([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return contains$1(uastring, 'msie') || contains$1(uastring, 'trident');\n        }\n      },\n      {\n        name: 'Opera',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n        ],\n        search: checkContains('opera')\n      },\n      {\n        name: 'Firefox',\n        versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n        search: checkContains('firefox')\n      },\n      {\n        name: 'Safari',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?cpu os ([0-9]+)_([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return (contains$1(uastring, 'safari') || contains$1(uastring, 'mobile/')) && contains$1(uastring, 'applewebkit');\n        }\n      }\n    ];\n    var oses = [\n      {\n        name: 'Windows',\n        search: checkContains('win'),\n        versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'iOS',\n        search: function (uastring) {\n          return contains$1(uastring, 'iphone') || contains$1(uastring, 'ipad');\n        },\n        versionRegexes: [\n          /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*cpu os ([0-9]+)_([0-9]+).*/,\n          /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n        ]\n      },\n      {\n        name: 'Android',\n        search: checkContains('android'),\n        versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'OSX',\n        search: checkContains('mac os x'),\n        versionRegexes: [/.*?mac\\ os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n      },\n      {\n        name: 'Linux',\n        search: checkContains('linux'),\n        versionRegexes: []\n      },\n      {\n        name: 'Solaris',\n        search: checkContains('sunos'),\n        versionRegexes: []\n      },\n      {\n        name: 'FreeBSD',\n        search: checkContains('freebsd'),\n        versionRegexes: []\n      },\n      {\n        name: 'ChromeOS',\n        search: checkContains('cros'),\n        versionRegexes: [/.*?chrome\\/([0-9]+)\\.([0-9]+).*/]\n      }\n    ];\n    var PlatformInfo = {\n      browsers: constant$1(browsers),\n      oses: constant$1(oses)\n    };\n\n    var edge = 'Edge';\n    var chrome = 'Chrome';\n    var ie = 'IE';\n    var opera = 'Opera';\n    var firefox = 'Firefox';\n    var safari = 'Safari';\n    var unknown$2 = function () {\n      return nu$c({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$c = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isBrowser = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isEdge: isBrowser(edge),\n        isChrome: isBrowser(chrome),\n        isIE: isBrowser(ie),\n        isOpera: isBrowser(opera),\n        isFirefox: isBrowser(firefox),\n        isSafari: isBrowser(safari)\n      };\n    };\n    var Browser = {\n      unknown: unknown$2,\n      nu: nu$c,\n      edge: constant$1(edge),\n      chrome: constant$1(chrome),\n      ie: constant$1(ie),\n      opera: constant$1(opera),\n      firefox: constant$1(firefox),\n      safari: constant$1(safari)\n    };\n\n    var windows = 'Windows';\n    var ios = 'iOS';\n    var android = 'Android';\n    var linux = 'Linux';\n    var osx = 'OSX';\n    var solaris = 'Solaris';\n    var freebsd = 'FreeBSD';\n    var chromeos = 'ChromeOS';\n    var unknown$1 = function () {\n      return nu$b({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$b = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isOS = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isWindows: isOS(windows),\n        isiOS: isOS(ios),\n        isAndroid: isOS(android),\n        isOSX: isOS(osx),\n        isLinux: isOS(linux),\n        isSolaris: isOS(solaris),\n        isFreeBSD: isOS(freebsd),\n        isChromeOS: isOS(chromeos)\n      };\n    };\n    var OperatingSystem = {\n      unknown: unknown$1,\n      nu: nu$b,\n      windows: constant$1(windows),\n      ios: constant$1(ios),\n      android: constant$1(android),\n      linux: constant$1(linux),\n      osx: constant$1(osx),\n      solaris: constant$1(solaris),\n      freebsd: constant$1(freebsd),\n      chromeos: constant$1(chromeos)\n    };\n\n    var detect$2 = function (userAgent, userAgentDataOpt, mediaMatch) {\n      var browsers = PlatformInfo.browsers();\n      var oses = PlatformInfo.oses();\n      var browser = userAgentDataOpt.bind(function (userAgentData) {\n        return detectBrowser$1(browsers, userAgentData);\n      }).orThunk(function () {\n        return detectBrowser(browsers, userAgent);\n      }).fold(Browser.unknown, Browser.nu);\n      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);\n      return {\n        browser: browser,\n        os: os,\n        deviceType: deviceType\n      };\n    };\n    var PlatformDetection = { detect: detect$2 };\n\n    var mediaMatch = function (query) {\n      return window.matchMedia(query).matches;\n    };\n    var platform = cached(function () {\n      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);\n    });\n    var detect$1 = function () {\n      return platform();\n    };\n\n    var compareDocumentPosition = function (a, b, match) {\n      return (a.compareDocumentPosition(b) & match) !== 0;\n    };\n    var documentPositionContainedBy = function (a, b) {\n      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);\n    };\n\n    var is = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n    var bypassSelector = function (dom) {\n      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;\n    };\n    var all$3 = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? [] : map$2(base.querySelectorAll(selector), SugarElement.fromDom);\n    };\n    var one = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom);\n    };\n\n    var eq = function (e1, e2) {\n      return e1.dom === e2.dom;\n    };\n    var regularContains = function (e1, e2) {\n      var d1 = e1.dom;\n      var d2 = e2.dom;\n      return d1 === d2 ? false : d1.contains(d2);\n    };\n    var ieContains = function (e1, e2) {\n      return documentPositionContainedBy(e1.dom, e2.dom);\n    };\n    var contains = function (e1, e2) {\n      return detect$1().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);\n    };\n\n    var owner$4 = function (element) {\n      return SugarElement.fromDom(element.dom.ownerDocument);\n    };\n    var documentOrOwner = function (dos) {\n      return isDocument(dos) ? dos : owner$4(dos);\n    };\n    var documentElement = function (element) {\n      return SugarElement.fromDom(documentOrOwner(element).dom.documentElement);\n    };\n    var defaultView = function (element) {\n      return SugarElement.fromDom(documentOrOwner(element).dom.defaultView);\n    };\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var parentNode = function (element) {\n      return parent(element);\n    };\n    var offsetParent = function (element) {\n      return Optional.from(element.dom.offsetParent).map(SugarElement.fromDom);\n    };\n    var nextSibling = function (element) {\n      return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);\n    };\n    var children = function (element) {\n      return map$2(element.dom.childNodes, SugarElement.fromDom);\n    };\n    var child$2 = function (element, index) {\n      var cs = element.dom.childNodes;\n      return Optional.from(cs[index]).map(SugarElement.fromDom);\n    };\n    var firstChild = function (element) {\n      return child$2(element, 0);\n    };\n    var spot = function (element, offset) {\n      return {\n        element: element,\n        offset: offset\n      };\n    };\n    var leaf = function (element, offset) {\n      var cs = children(element);\n      return cs.length > 0 && offset < cs.length ? spot(cs[offset], 0) : spot(element, offset);\n    };\n\n    var isShadowRoot = function (dos) {\n      return isDocumentFragment(dos) && isNonNullable(dos.dom.host);\n    };\n    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);\n    var isSupported = constant$1(supported);\n    var getRootNode = supported ? function (e) {\n      return SugarElement.fromDom(e.dom.getRootNode());\n    } : documentOrOwner;\n    var getContentContainer = function (dos) {\n      return isShadowRoot(dos) ? dos : SugarElement.fromDom(documentOrOwner(dos).dom.body);\n    };\n    var isInShadowRoot = function (e) {\n      return getShadowRoot(e).isSome();\n    };\n    var getShadowRoot = function (e) {\n      var r = getRootNode(e);\n      return isShadowRoot(r) ? Optional.some(r) : Optional.none();\n    };\n    var getShadowHost = function (e) {\n      return SugarElement.fromDom(e.dom.host);\n    };\n    var getOriginalEventTarget = function (event) {\n      if (isSupported() && isNonNullable(event.target)) {\n        var el = SugarElement.fromDom(event.target);\n        if (isElement$2(el) && isOpenShadowHost(el)) {\n          if (event.composed && event.composedPath) {\n            var composedPath = event.composedPath();\n            if (composedPath) {\n              return head(composedPath);\n            }\n          }\n        }\n      }\n      return Optional.from(event.target);\n    };\n    var isOpenShadowHost = function (element) {\n      return isNonNullable(element.dom.shadowRoot);\n    };\n\n    var inBody = function (element) {\n      var dom = isText$1(element) ? element.dom.parentNode : element.dom;\n      if (dom === undefined || dom === null || dom.ownerDocument === null) {\n        return false;\n      }\n      var doc = dom.ownerDocument;\n      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {\n        return doc.body.contains(dom);\n      }, compose1(inBody, getShadowHost));\n    };\n    var body = function () {\n      return getBody(SugarElement.fromDom(document));\n    };\n    var getBody = function (doc) {\n      var b = doc.dom.body;\n      if (b === null || b === undefined) {\n        throw new Error('Body is not available yet');\n      }\n      return SugarElement.fromDom(b);\n    };\n\n    var rawSet = function (dom, key, value) {\n      if (isString(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set$8 = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n    var setAll$1 = function (element, attrs) {\n      var dom = element.dom;\n      each(attrs, function (v, k) {\n        rawSet(dom, k, v);\n      });\n    };\n    var get$d = function (element, key) {\n      var v = element.dom.getAttribute(key);\n      return v === null ? undefined : v;\n    };\n    var getOpt = function (element, key) {\n      return Optional.from(get$d(element, key));\n    };\n    var has$1 = function (element, key) {\n      var dom = element.dom;\n      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;\n    };\n    var remove$7 = function (element, key) {\n      element.dom.removeAttribute(key);\n    };\n\n    var internalSet = function (dom, property, value) {\n      if (!isString(value)) {\n        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n        throw new Error('CSS value must be a string: ' + value);\n      }\n      if (isSupported$1(dom)) {\n        dom.style.setProperty(property, value);\n      }\n    };\n    var internalRemove = function (dom, property) {\n      if (isSupported$1(dom)) {\n        dom.style.removeProperty(property);\n      }\n    };\n    var set$7 = function (element, property, value) {\n      var dom = element.dom;\n      internalSet(dom, property, value);\n    };\n    var setAll = function (element, css) {\n      var dom = element.dom;\n      each(css, function (v, k) {\n        internalSet(dom, k, v);\n      });\n    };\n    var setOptions = function (element, css) {\n      var dom = element.dom;\n      each(css, function (v, k) {\n        v.fold(function () {\n          internalRemove(dom, k);\n        }, function (value) {\n          internalSet(dom, k, value);\n        });\n      });\n    };\n    var get$c = function (element, property) {\n      var dom = element.dom;\n      var styles = window.getComputedStyle(dom);\n      var r = styles.getPropertyValue(property);\n      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;\n    };\n    var getUnsafeProperty = function (dom, property) {\n      return isSupported$1(dom) ? dom.style.getPropertyValue(property) : '';\n    };\n    var getRaw = function (element, property) {\n      var dom = element.dom;\n      var raw = getUnsafeProperty(dom, property);\n      return Optional.from(raw).filter(function (r) {\n        return r.length > 0;\n      });\n    };\n    var getAllRaw = function (element) {\n      var css = {};\n      var dom = element.dom;\n      if (isSupported$1(dom)) {\n        for (var i = 0; i < dom.style.length; i++) {\n          var ruleName = dom.style.item(i);\n          css[ruleName] = dom.style[ruleName];\n        }\n      }\n      return css;\n    };\n    var isValidValue = function (tag, property, value) {\n      var element = SugarElement.fromTag(tag);\n      set$7(element, property, value);\n      var style = getRaw(element, property);\n      return style.isSome();\n    };\n    var remove$6 = function (element, property) {\n      var dom = element.dom;\n      internalRemove(dom, property);\n      if (is$1(getOpt(element, 'style').map(trim$1), '')) {\n        remove$7(element, 'style');\n      }\n    };\n    var reflow = function (e) {\n      return e.dom.offsetWidth;\n    };\n\n    var Dimension = function (name, getOffset) {\n      var set = function (element, h) {\n        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {\n          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);\n        }\n        var dom = element.dom;\n        if (isSupported$1(dom)) {\n          dom.style[name] = h + 'px';\n        }\n      };\n      var get = function (element) {\n        var r = getOffset(element);\n        if (r <= 0 || r === null) {\n          var css = get$c(element, name);\n          return parseFloat(css) || 0;\n        }\n        return r;\n      };\n      var getOuter = get;\n      var aggregate = function (element, properties) {\n        return foldl(properties, function (acc, property) {\n          var val = get$c(element, property);\n          var value = val === undefined ? 0 : parseInt(val, 10);\n          return isNaN(value) ? acc : acc + value;\n        }, 0);\n      };\n      var max = function (element, value, properties) {\n        var cumulativeInclusions = aggregate(element, properties);\n        var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;\n        return absoluteMax;\n      };\n      return {\n        set: set,\n        get: get,\n        getOuter: getOuter,\n        aggregate: aggregate,\n        max: max\n      };\n    };\n\n    var api$3 = Dimension('height', function (element) {\n      var dom = element.dom;\n      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;\n    });\n    var get$b = function (element) {\n      return api$3.get(element);\n    };\n    var getOuter$2 = function (element) {\n      return api$3.getOuter(element);\n    };\n    var setMax$1 = function (element, value) {\n      var inclusions = [\n        'margin-top',\n        'border-top-width',\n        'padding-top',\n        'padding-bottom',\n        'border-bottom-width',\n        'margin-bottom'\n      ];\n      var absMax = api$3.max(element, value, inclusions);\n      set$7(element, 'max-height', absMax + 'px');\n    };\n\n    var r$1 = function (left, top) {\n      var translate = function (x, y) {\n        return r$1(left + x, top + y);\n      };\n      return {\n        left: left,\n        top: top,\n        translate: translate\n      };\n    };\n    var SugarPosition = r$1;\n\n    var boxPosition = function (dom) {\n      var box = dom.getBoundingClientRect();\n      return SugarPosition(box.left, box.top);\n    };\n    var firstDefinedOrZero = function (a, b) {\n      if (a !== undefined) {\n        return a;\n      } else {\n        return b !== undefined ? b : 0;\n      }\n    };\n    var absolute$3 = function (element) {\n      var doc = element.dom.ownerDocument;\n      var body = doc.body;\n      var win = doc.defaultView;\n      var html = doc.documentElement;\n      if (body === element.dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop);\n      var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft);\n      var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);\n      var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);\n      return viewport$1(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);\n    };\n    var viewport$1 = function (element) {\n      var dom = element.dom;\n      var doc = dom.ownerDocument;\n      var body = doc.body;\n      if (body === dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      if (!inBody(element)) {\n        return SugarPosition(0, 0);\n      }\n      return boxPosition(dom);\n    };\n\n    var api$2 = Dimension('width', function (element) {\n      return element.dom.offsetWidth;\n    });\n    var set$6 = function (element, h) {\n      return api$2.set(element, h);\n    };\n    var get$a = function (element) {\n      return api$2.get(element);\n    };\n    var getOuter$1 = function (element) {\n      return api$2.getOuter(element);\n    };\n    var setMax = function (element, value) {\n      var inclusions = [\n        'margin-left',\n        'border-left-width',\n        'padding-left',\n        'padding-right',\n        'border-right-width',\n        'margin-right'\n      ];\n      var absMax = api$2.max(element, value, inclusions);\n      set$7(element, 'max-width', absMax + 'px');\n    };\n\n    var mkEvent = function (target, x, y, stop, prevent, kill, raw) {\n      return {\n        target: target,\n        x: x,\n        y: y,\n        stop: stop,\n        prevent: prevent,\n        kill: kill,\n        raw: raw\n      };\n    };\n    var fromRawEvent$1 = function (rawEvent) {\n      var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));\n      var stop = function () {\n        return rawEvent.stopPropagation();\n      };\n      var prevent = function () {\n        return rawEvent.preventDefault();\n      };\n      var kill = compose(prevent, stop);\n      return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);\n    };\n    var handle = function (filter, handler) {\n      return function (rawEvent) {\n        if (filter(rawEvent)) {\n          handler(fromRawEvent$1(rawEvent));\n        }\n      };\n    };\n    var binder = function (element, event, filter, handler, useCapture) {\n      var wrapped = handle(filter, handler);\n      element.dom.addEventListener(event, wrapped, useCapture);\n      return { unbind: curry(unbind, element, event, wrapped, useCapture) };\n    };\n    var bind$2 = function (element, event, filter, handler) {\n      return binder(element, event, filter, handler, false);\n    };\n    var capture$1 = function (element, event, filter, handler) {\n      return binder(element, event, filter, handler, true);\n    };\n    var unbind = function (element, event, handler, useCapture) {\n      element.dom.removeEventListener(event, handler, useCapture);\n    };\n\n    var before$2 = function (marker, element) {\n      var parent$1 = parent(marker);\n      parent$1.each(function (v) {\n        v.dom.insertBefore(element.dom, marker.dom);\n      });\n    };\n    var after$2 = function (marker, element) {\n      var sibling = nextSibling(marker);\n      sibling.fold(function () {\n        var parent$1 = parent(marker);\n        parent$1.each(function (v) {\n          append$2(v, element);\n        });\n      }, function (v) {\n        before$2(v, element);\n      });\n    };\n    var prepend$1 = function (parent, element) {\n      var firstChild$1 = firstChild(parent);\n      firstChild$1.fold(function () {\n        append$2(parent, element);\n      }, function (v) {\n        parent.dom.insertBefore(element.dom, v.dom);\n      });\n    };\n    var append$2 = function (parent, element) {\n      parent.dom.appendChild(element.dom);\n    };\n    var appendAt = function (parent, element, index) {\n      child$2(parent, index).fold(function () {\n        append$2(parent, element);\n      }, function (v) {\n        before$2(v, element);\n      });\n    };\n\n    var before$1 = function (marker, elements) {\n      each$1(elements, function (x) {\n        before$2(marker, x);\n      });\n    };\n    var append$1 = function (parent, elements) {\n      each$1(elements, function (x) {\n        append$2(parent, x);\n      });\n    };\n\n    var empty = function (element) {\n      element.dom.textContent = '';\n      each$1(children(element), function (rogue) {\n        remove$5(rogue);\n      });\n    };\n    var remove$5 = function (element) {\n      var dom = element.dom;\n      if (dom.parentNode !== null) {\n        dom.parentNode.removeChild(dom);\n      }\n    };\n    var unwrap = function (wrapper) {\n      var children$1 = children(wrapper);\n      if (children$1.length > 0) {\n        before$1(wrapper, children$1);\n      }\n      remove$5(wrapper);\n    };\n\n    var get$9 = function (_DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;\n      var y = doc.body.scrollTop || doc.documentElement.scrollTop;\n      return SugarPosition(x, y);\n    };\n    var to = function (x, y, _DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var win = doc.defaultView;\n      if (win) {\n        win.scrollTo(x, y);\n      }\n    };\n\n    var get$8 = function (_win) {\n      var win = _win === undefined ? window : _win;\n      if (detect$1().browser.isFirefox()) {\n        return Optional.none();\n      } else {\n        return Optional.from(win['visualViewport']);\n      }\n    };\n    var bounds$1 = function (x, y, width, height) {\n      return {\n        x: x,\n        y: y,\n        width: width,\n        height: height,\n        right: x + width,\n        bottom: y + height\n      };\n    };\n    var getBounds$3 = function (_win) {\n      var win = _win === undefined ? window : _win;\n      var doc = win.document;\n      var scroll = get$9(SugarElement.fromDom(doc));\n      return get$8(win).fold(function () {\n        var html = win.document.documentElement;\n        var width = html.clientWidth;\n        var height = html.clientHeight;\n        return bounds$1(scroll.left, scroll.top, width, height);\n      }, function (visualViewport) {\n        return bounds$1(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);\n      });\n    };\n\n    var walkUp = function (navigation, doc) {\n      var frame = navigation.view(doc);\n      return frame.fold(constant$1([]), function (f) {\n        var parent = navigation.owner(f);\n        var rest = walkUp(navigation, parent);\n        return [f].concat(rest);\n      });\n    };\n    var pathTo = function (element, navigation) {\n      var d = navigation.owner(element);\n      var paths = walkUp(navigation, d);\n      return Optional.some(paths);\n    };\n\n    var view = function (doc) {\n      var _a;\n      var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement);\n      return element.map(SugarElement.fromDom);\n    };\n    var owner$3 = function (element) {\n      return owner$4(element);\n    };\n\n    var Navigation = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        view: view,\n        owner: owner$3\n    });\n\n    var find$2 = function (element) {\n      var doc = SugarElement.fromDom(document);\n      var scroll = get$9(doc);\n      var path = pathTo(element, Navigation);\n      return path.fold(curry(absolute$3, element), function (frames) {\n        var offset = viewport$1(element);\n        var r = foldr(frames, function (b, a) {\n          var loc = viewport$1(a);\n          return {\n            left: b.left + loc.left,\n            top: b.top + loc.top\n          };\n        }, {\n          left: 0,\n          top: 0\n        });\n        return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top);\n      });\n    };\n\n    var pointed = function (point, width, height) {\n      return {\n        point: point,\n        width: width,\n        height: height\n      };\n    };\n    var rect = function (x, y, width, height) {\n      return {\n        x: x,\n        y: y,\n        width: width,\n        height: height\n      };\n    };\n    var bounds = function (x, y, width, height) {\n      return {\n        x: x,\n        y: y,\n        width: width,\n        height: height,\n        right: x + width,\n        bottom: y + height\n      };\n    };\n    var box$1 = function (element) {\n      var xy = absolute$3(element);\n      var w = getOuter$1(element);\n      var h = getOuter$2(element);\n      return bounds(xy.left, xy.top, w, h);\n    };\n    var absolute$2 = function (element) {\n      var position = find$2(element);\n      var width = getOuter$1(element);\n      var height = getOuter$2(element);\n      return bounds(position.left, position.top, width, height);\n    };\n    var win = function () {\n      return getBounds$3(window);\n    };\n\n    var value$3 = function (o) {\n      var or = function (_opt) {\n        return value$3(o);\n      };\n      var orThunk = function (_f) {\n        return value$3(o);\n      };\n      var map = function (f) {\n        return value$3(f(o));\n      };\n      var mapError = function (_f) {\n        return value$3(o);\n      };\n      var each = function (f) {\n        f(o);\n      };\n      var bind = function (f) {\n        return f(o);\n      };\n      var fold = function (_, onValue) {\n        return onValue(o);\n      };\n      var exists = function (f) {\n        return f(o);\n      };\n      var forall = function (f) {\n        return f(o);\n      };\n      var toOptional = function () {\n        return Optional.some(o);\n      };\n      return {\n        isValue: always,\n        isError: never,\n        getOr: constant$1(o),\n        getOrThunk: constant$1(o),\n        getOrDie: constant$1(o),\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: each,\n        bind: bind,\n        exists: exists,\n        forall: forall,\n        toOptional: toOptional\n      };\n    };\n    var error$1 = function (message) {\n      var getOrThunk = function (f) {\n        return f();\n      };\n      var getOrDie = function () {\n        return die(String(message))();\n      };\n      var or = identity$1;\n      var orThunk = function (f) {\n        return f();\n      };\n      var map = function (_f) {\n        return error$1(message);\n      };\n      var mapError = function (f) {\n        return error$1(f(message));\n      };\n      var bind = function (_f) {\n        return error$1(message);\n      };\n      var fold = function (onError, _) {\n        return onError(message);\n      };\n      return {\n        isValue: never,\n        isError: always,\n        getOr: identity$1,\n        getOrThunk: getOrThunk,\n        getOrDie: getOrDie,\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: noop,\n        bind: bind,\n        exists: never,\n        forall: always,\n        toOptional: Optional.none\n      };\n    };\n    var fromOption = function (opt, err) {\n      return opt.fold(function () {\n        return error$1(err);\n      }, value$3);\n    };\n    var Result = {\n      value: value$3,\n      error: error$1,\n      fromOption: fromOption\n    };\n\n    var SimpleResultType;\n    (function (SimpleResultType) {\n      SimpleResultType[SimpleResultType['Error'] = 0] = 'Error';\n      SimpleResultType[SimpleResultType['Value'] = 1] = 'Value';\n    }(SimpleResultType || (SimpleResultType = {})));\n    var fold$1 = function (res, onError, onValue) {\n      return res.stype === SimpleResultType.Error ? onError(res.serror) : onValue(res.svalue);\n    };\n    var partition$2 = function (results) {\n      var values = [];\n      var errors = [];\n      each$1(results, function (obj) {\n        fold$1(obj, function (err) {\n          return errors.push(err);\n        }, function (val) {\n          return values.push(val);\n        });\n      });\n      return {\n        values: values,\n        errors: errors\n      };\n    };\n    var mapError = function (res, f) {\n      if (res.stype === SimpleResultType.Error) {\n        return {\n          stype: SimpleResultType.Error,\n          serror: f(res.serror)\n        };\n      } else {\n        return res;\n      }\n    };\n    var map = function (res, f) {\n      if (res.stype === SimpleResultType.Value) {\n        return {\n          stype: SimpleResultType.Value,\n          svalue: f(res.svalue)\n        };\n      } else {\n        return res;\n      }\n    };\n    var bind$1 = function (res, f) {\n      if (res.stype === SimpleResultType.Value) {\n        return f(res.svalue);\n      } else {\n        return res;\n      }\n    };\n    var bindError = function (res, f) {\n      if (res.stype === SimpleResultType.Error) {\n        return f(res.serror);\n      } else {\n        return res;\n      }\n    };\n    var svalue = function (v) {\n      return {\n        stype: SimpleResultType.Value,\n        svalue: v\n      };\n    };\n    var serror = function (e) {\n      return {\n        stype: SimpleResultType.Error,\n        serror: e\n      };\n    };\n    var toResult$1 = function (res) {\n      return fold$1(res, Result.error, Result.value);\n    };\n    var fromResult$1 = function (res) {\n      return res.fold(serror, svalue);\n    };\n    var SimpleResult = {\n      fromResult: fromResult$1,\n      toResult: toResult$1,\n      svalue: svalue,\n      partition: partition$2,\n      serror: serror,\n      bind: bind$1,\n      bindError: bindError,\n      map: map,\n      mapError: mapError,\n      fold: fold$1\n    };\n\n    var field$2 = function (key, newKey, presence, prop) {\n      return {\n        tag: 'field',\n        key: key,\n        newKey: newKey,\n        presence: presence,\n        prop: prop\n      };\n    };\n    var customField$1 = function (newKey, instantiator) {\n      return {\n        tag: 'custom',\n        newKey: newKey,\n        instantiator: instantiator\n      };\n    };\n    var fold = function (value, ifField, ifCustom) {\n      switch (value.tag) {\n      case 'field':\n        return ifField(value.key, value.newKey, value.presence, value.prop);\n      case 'custom':\n        return ifCustom(value.newKey, value.instantiator);\n      }\n    };\n\n    var shallow$1 = function (old, nu) {\n      return nu;\n    };\n    var deep = function (old, nu) {\n      var bothObjects = isObject(old) && isObject(nu);\n      return bothObjects ? deepMerge(old, nu) : nu;\n    };\n    var baseMerge = function (merger) {\n      return function () {\n        var objects = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          objects[_i] = arguments[_i];\n        }\n        if (objects.length === 0) {\n          throw new Error('Can\\'t merge zero objects');\n        }\n        var ret = {};\n        for (var j = 0; j < objects.length; j++) {\n          var curObject = objects[j];\n          for (var key in curObject) {\n            if (has$2(curObject, key)) {\n              ret[key] = merger(ret[key], curObject[key]);\n            }\n          }\n        }\n        return ret;\n      };\n    };\n    var deepMerge = baseMerge(deep);\n    var merge$1 = baseMerge(shallow$1);\n\n    var required$2 = function () {\n      return {\n        tag: 'required',\n        process: {}\n      };\n    };\n    var defaultedThunk = function (fallbackThunk) {\n      return {\n        tag: 'defaultedThunk',\n        process: fallbackThunk\n      };\n    };\n    var defaulted$1 = function (fallback) {\n      return defaultedThunk(constant$1(fallback));\n    };\n    var asOption = function () {\n      return {\n        tag: 'option',\n        process: {}\n      };\n    };\n    var mergeWithThunk = function (baseThunk) {\n      return {\n        tag: 'mergeWithThunk',\n        process: baseThunk\n      };\n    };\n    var mergeWith = function (base) {\n      return mergeWithThunk(constant$1(base));\n    };\n\n    var mergeValues$1 = function (values, base) {\n      return values.length > 0 ? SimpleResult.svalue(deepMerge(base, merge$1.apply(undefined, values))) : SimpleResult.svalue(base);\n    };\n    var mergeErrors$1 = function (errors) {\n      return compose(SimpleResult.serror, flatten)(errors);\n    };\n    var consolidateObj = function (objects, base) {\n      var partition = SimpleResult.partition(objects);\n      return partition.errors.length > 0 ? mergeErrors$1(partition.errors) : mergeValues$1(partition.values, base);\n    };\n    var consolidateArr = function (objects) {\n      var partitions = SimpleResult.partition(objects);\n      return partitions.errors.length > 0 ? mergeErrors$1(partitions.errors) : SimpleResult.svalue(partitions.values);\n    };\n    var ResultCombine = {\n      consolidateObj: consolidateObj,\n      consolidateArr: consolidateArr\n    };\n\n    var formatObj = function (input) {\n      return isObject(input) && keys(input).length > 100 ? ' removed due to size' : JSON.stringify(input, null, 2);\n    };\n    var formatErrors = function (errors) {\n      var es = errors.length > 10 ? errors.slice(0, 10).concat([{\n          path: [],\n          getErrorInfo: constant$1('... (only showing first ten failures)')\n        }]) : errors;\n      return map$2(es, function (e) {\n        return 'Failed path: (' + e.path.join(' > ') + ')\\n' + e.getErrorInfo();\n      });\n    };\n\n    var nu$a = function (path, getErrorInfo) {\n      return SimpleResult.serror([{\n          path: path,\n          getErrorInfo: getErrorInfo\n        }]);\n    };\n    var missingRequired = function (path, key, obj) {\n      return nu$a(path, function () {\n        return 'Could not find valid *required* value for \"' + key + '\" in ' + formatObj(obj);\n      });\n    };\n    var missingKey = function (path, key) {\n      return nu$a(path, function () {\n        return 'Choice schema did not contain choice key: \"' + key + '\"';\n      });\n    };\n    var missingBranch = function (path, branches, branch) {\n      return nu$a(path, function () {\n        return 'The chosen schema: \"' + branch + '\" did not exist in branches: ' + formatObj(branches);\n      });\n    };\n    var unsupportedFields = function (path, unsupported) {\n      return nu$a(path, function () {\n        return 'There are unsupported fields: [' + unsupported.join(', ') + '] specified';\n      });\n    };\n    var custom = function (path, err) {\n      return nu$a(path, constant$1(err));\n    };\n\n    var value$2 = function (validator) {\n      var extract = function (path, val) {\n        return SimpleResult.bindError(validator(val), function (err) {\n          return custom(path, err);\n        });\n      };\n      var toString = constant$1('val');\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var anyValue$1 = value$2(SimpleResult.svalue);\n\n    var requiredAccess = function (path, obj, key, bundle) {\n      return get$e(obj, key).fold(function () {\n        return missingRequired(path, key, obj);\n      }, bundle);\n    };\n    var fallbackAccess = function (obj, key, fallback, bundle) {\n      var v = get$e(obj, key).getOrThunk(function () {\n        return fallback(obj);\n      });\n      return bundle(v);\n    };\n    var optionAccess = function (obj, key, bundle) {\n      return bundle(get$e(obj, key));\n    };\n    var optionDefaultedAccess = function (obj, key, fallback, bundle) {\n      var opt = get$e(obj, key).map(function (val) {\n        return val === true ? fallback(obj) : val;\n      });\n      return bundle(opt);\n    };\n    var extractField = function (field, path, obj, key, prop) {\n      var bundle = function (av) {\n        return prop.extract(path.concat([key]), av);\n      };\n      var bundleAsOption = function (optValue) {\n        return optValue.fold(function () {\n          return SimpleResult.svalue(Optional.none());\n        }, function (ov) {\n          var result = prop.extract(path.concat([key]), ov);\n          return SimpleResult.map(result, Optional.some);\n        });\n      };\n      switch (field.tag) {\n      case 'required':\n        return requiredAccess(path, obj, key, bundle);\n      case 'defaultedThunk':\n        return fallbackAccess(obj, key, field.process, bundle);\n      case 'option':\n        return optionAccess(obj, key, bundleAsOption);\n      case 'defaultedOptionThunk':\n        return optionDefaultedAccess(obj, key, field.process, bundleAsOption);\n      case 'mergeWithThunk': {\n          return fallbackAccess(obj, key, constant$1({}), function (v) {\n            var result = deepMerge(field.process(obj), v);\n            return bundle(result);\n          });\n        }\n      }\n    };\n    var extractFields = function (path, obj, fields) {\n      var success = {};\n      var errors = [];\n      for (var _i = 0, fields_1 = fields; _i < fields_1.length; _i++) {\n        var field = fields_1[_i];\n        fold(field, function (key, newKey, presence, prop) {\n          var result = extractField(presence, path, obj, key, prop);\n          SimpleResult.fold(result, function (err) {\n            errors.push.apply(errors, err);\n          }, function (res) {\n            success[newKey] = res;\n          });\n        }, function (newKey, instantiator) {\n          success[newKey] = instantiator(obj);\n        });\n      }\n      return errors.length > 0 ? SimpleResult.serror(errors) : SimpleResult.svalue(success);\n    };\n    var valueThunk = function (getDelegate) {\n      var extract = function (path, val) {\n        return getDelegate().extract(path, val);\n      };\n      var toString = function () {\n        return getDelegate().toString();\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var getSetKeys = function (obj) {\n      return keys(filter$1(obj, isNonNullable));\n    };\n    var objOfOnly = function (fields) {\n      var delegate = objOf(fields);\n      var fieldNames = foldr(fields, function (acc, value) {\n        return fold(value, function (key) {\n          var _a;\n          return deepMerge(acc, (_a = {}, _a[key] = true, _a));\n        }, constant$1(acc));\n      }, {});\n      var extract = function (path, o) {\n        var keys = isBoolean(o) ? [] : getSetKeys(o);\n        var extra = filter$2(keys, function (k) {\n          return !hasNonNullableKey(fieldNames, k);\n        });\n        return extra.length === 0 ? delegate.extract(path, o) : unsupportedFields(path, extra);\n      };\n      return {\n        extract: extract,\n        toString: delegate.toString\n      };\n    };\n    var objOf = function (values) {\n      var extract = function (path, o) {\n        return extractFields(path, o, values);\n      };\n      var toString = function () {\n        var fieldStrings = map$2(values, function (value) {\n          return fold(value, function (key, _okey, _presence, prop) {\n            return key + ' -> ' + prop.toString();\n          }, function (newKey, _instantiator) {\n            return 'state(' + newKey + ')';\n          });\n        });\n        return 'obj{\\n' + fieldStrings.join('\\n') + '}';\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var arrOf = function (prop) {\n      var extract = function (path, array) {\n        var results = map$2(array, function (a, i) {\n          return prop.extract(path.concat(['[' + i + ']']), a);\n        });\n        return ResultCombine.consolidateArr(results);\n      };\n      var toString = function () {\n        return 'array(' + prop.toString() + ')';\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var oneOf = function (props) {\n      var extract = function (path, val) {\n        var errors = [];\n        for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {\n          var prop = props_1[_i];\n          var res = prop.extract(path, val);\n          if (res.stype === SimpleResultType.Value) {\n            return res;\n          }\n          errors.push(res);\n        }\n        return ResultCombine.consolidateArr(errors);\n      };\n      var toString = function () {\n        return 'oneOf(' + map$2(props, function (prop) {\n          return prop.toString();\n        }).join(', ') + ')';\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var setOf$1 = function (validator, prop) {\n      var validateKeys = function (path, keys) {\n        return arrOf(value$2(validator)).extract(path, keys);\n      };\n      var extract = function (path, o) {\n        var keys$1 = keys(o);\n        var validatedKeys = validateKeys(path, keys$1);\n        return SimpleResult.bind(validatedKeys, function (validKeys) {\n          var schema = map$2(validKeys, function (vk) {\n            return field$2(vk, vk, required$2(), prop);\n          });\n          return objOf(schema).extract(path, o);\n        });\n      };\n      var toString = function () {\n        return 'setOf(' + prop.toString() + ')';\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var thunk = function (_desc, processor) {\n      var getP = cached(processor);\n      var extract = function (path, val) {\n        return getP().extract(path, val);\n      };\n      var toString = function () {\n        return getP().toString();\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n    var arrOfObj = compose(arrOf, objOf);\n\n    var anyValue = constant$1(anyValue$1);\n    var typedValue = function (validator, expectedType) {\n      return value$2(function (a) {\n        var actualType = typeof a;\n        return validator(a) ? SimpleResult.svalue(a) : SimpleResult.serror('Expected type: ' + expectedType + ' but got: ' + actualType);\n      });\n    };\n    var number = typedValue(isNumber, 'number');\n    var string = typedValue(isString, 'string');\n    var boolean = typedValue(isBoolean, 'boolean');\n    var functionProcessor = typedValue(isFunction, 'function');\n    var isPostMessageable = function (val) {\n      if (Object(val) !== val) {\n        return true;\n      }\n      switch ({}.toString.call(val).slice(8, -1)) {\n      case 'Boolean':\n      case 'Number':\n      case 'String':\n      case 'Date':\n      case 'RegExp':\n      case 'Blob':\n      case 'FileList':\n      case 'ImageData':\n      case 'ImageBitmap':\n      case 'ArrayBuffer':\n        return true;\n      case 'Array':\n      case 'Object':\n        return Object.keys(val).every(function (prop) {\n          return isPostMessageable(val[prop]);\n        });\n      default:\n        return false;\n      }\n    };\n    var postMessageable = value$2(function (a) {\n      if (isPostMessageable(a)) {\n        return SimpleResult.svalue(a);\n      } else {\n        return SimpleResult.serror('Expected value to be acceptable for sending via postMessage');\n      }\n    });\n\n    var chooseFrom = function (path, input, branches, ch) {\n      var fields = get$e(branches, ch);\n      return fields.fold(function () {\n        return missingBranch(path, branches, ch);\n      }, function (vp) {\n        return vp.extract(path.concat(['branch: ' + ch]), input);\n      });\n    };\n    var choose$2 = function (key, branches) {\n      var extract = function (path, input) {\n        var choice = get$e(input, key);\n        return choice.fold(function () {\n          return missingKey(path, key);\n        }, function (chosen) {\n          return chooseFrom(path, input, branches, chosen);\n        });\n      };\n      var toString = function () {\n        return 'chooseOn(' + key + '). Possible values: ' + keys(branches);\n      };\n      return {\n        extract: extract,\n        toString: toString\n      };\n    };\n\n    var arrOfVal = function () {\n      return arrOf(anyValue$1);\n    };\n    var valueOf = function (validator) {\n      return value$2(function (v) {\n        return validator(v).fold(SimpleResult.serror, SimpleResult.svalue);\n      });\n    };\n    var setOf = function (validator, prop) {\n      return setOf$1(function (v) {\n        return SimpleResult.fromResult(validator(v));\n      }, prop);\n    };\n    var extractValue = function (label, prop, obj) {\n      var res = prop.extract([label], obj);\n      return SimpleResult.mapError(res, function (errs) {\n        return {\n          input: obj,\n          errors: errs\n        };\n      });\n    };\n    var asRaw = function (label, prop, obj) {\n      return SimpleResult.toResult(extractValue(label, prop, obj));\n    };\n    var getOrDie = function (extraction) {\n      return extraction.fold(function (errInfo) {\n        throw new Error(formatError(errInfo));\n      }, identity$1);\n    };\n    var asRawOrDie$1 = function (label, prop, obj) {\n      return getOrDie(asRaw(label, prop, obj));\n    };\n    var formatError = function (errInfo) {\n      return 'Errors: \\n' + formatErrors(errInfo.errors).join('\\n') + '\\n\\nInput object: ' + formatObj(errInfo.input);\n    };\n    var choose$1 = function (key, branches) {\n      return choose$2(key, map$1(branches, objOf));\n    };\n    var thunkOf = function (desc, schema) {\n      return thunk(desc, schema);\n    };\n\n    var field$1 = field$2;\n    var customField = customField$1;\n    var validateEnum = function (values) {\n      return valueOf(function (value) {\n        return contains$2(values, value) ? Result.value(value) : Result.error('Unsupported value: \"' + value + '\", choose one of \"' + values.join(', ') + '\".');\n      });\n    };\n    var required$1 = function (key) {\n      return field$1(key, key, required$2(), anyValue());\n    };\n    var requiredOf = function (key, schema) {\n      return field$1(key, key, required$2(), schema);\n    };\n    var requiredNumber = function (key) {\n      return requiredOf(key, number);\n    };\n    var requiredString = function (key) {\n      return requiredOf(key, string);\n    };\n    var requiredStringEnum = function (key, values) {\n      return field$1(key, key, required$2(), validateEnum(values));\n    };\n    var requiredBoolean = function (key) {\n      return requiredOf(key, boolean);\n    };\n    var requiredFunction = function (key) {\n      return requiredOf(key, functionProcessor);\n    };\n    var forbid = function (key, message) {\n      return field$1(key, key, asOption(), value$2(function (_v) {\n        return SimpleResult.serror('The field: ' + key + ' is forbidden. ' + message);\n      }));\n    };\n    var requiredObjOf = function (key, objSchema) {\n      return field$1(key, key, required$2(), objOf(objSchema));\n    };\n    var requiredArrayOfObj = function (key, objFields) {\n      return field$1(key, key, required$2(), arrOfObj(objFields));\n    };\n    var requiredArrayOf = function (key, schema) {\n      return field$1(key, key, required$2(), arrOf(schema));\n    };\n    var option = function (key) {\n      return field$1(key, key, asOption(), anyValue());\n    };\n    var optionOf = function (key, schema) {\n      return field$1(key, key, asOption(), schema);\n    };\n    var optionNumber = function (key) {\n      return optionOf(key, number);\n    };\n    var optionString = function (key) {\n      return optionOf(key, string);\n    };\n    var optionFunction = function (key) {\n      return optionOf(key, functionProcessor);\n    };\n    var optionArrayOf = function (key, schema) {\n      return optionOf(key, arrOf(schema));\n    };\n    var optionObjOf = function (key, objSchema) {\n      return optionOf(key, objOf(objSchema));\n    };\n    var optionObjOfOnly = function (key, objSchema) {\n      return optionOf(key, objOfOnly(objSchema));\n    };\n    var defaulted = function (key, fallback) {\n      return field$1(key, key, defaulted$1(fallback), anyValue());\n    };\n    var defaultedOf = function (key, fallback, schema) {\n      return field$1(key, key, defaulted$1(fallback), schema);\n    };\n    var defaultedNumber = function (key, fallback) {\n      return defaultedOf(key, fallback, number);\n    };\n    var defaultedString = function (key, fallback) {\n      return defaultedOf(key, fallback, string);\n    };\n    var defaultedStringEnum = function (key, fallback, values) {\n      return defaultedOf(key, fallback, validateEnum(values));\n    };\n    var defaultedBoolean = function (key, fallback) {\n      return defaultedOf(key, fallback, boolean);\n    };\n    var defaultedFunction = function (key, fallback) {\n      return defaultedOf(key, fallback, functionProcessor);\n    };\n    var defaultedPostMsg = function (key, fallback) {\n      return defaultedOf(key, fallback, postMessageable);\n    };\n    var defaultedArrayOf = function (key, fallback, schema) {\n      return defaultedOf(key, fallback, arrOf(schema));\n    };\n    var defaultedObjOf = function (key, fallback, objSchema) {\n      return defaultedOf(key, fallback, objOf(objSchema));\n    };\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var generate$7 = function (cases) {\n      if (!isArray(cases)) {\n        throw new Error('cases must be an array');\n      }\n      if (cases.length === 0) {\n        throw new Error('there must be at least one case');\n      }\n      var constructors = [];\n      var adt = {};\n      each$1(cases, function (acase, count) {\n        var keys$1 = keys(acase);\n        if (keys$1.length !== 1) {\n          throw new Error('one and only one name per case');\n        }\n        var key = keys$1[0];\n        var value = acase[key];\n        if (adt[key] !== undefined) {\n          throw new Error('duplicate key detected:' + key);\n        } else if (key === 'cata') {\n          throw new Error('cannot have a case named cata (sorry)');\n        } else if (!isArray(value)) {\n          throw new Error('case arguments must be an array');\n        }\n        constructors.push(key);\n        adt[key] = function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          var argLength = args.length;\n          if (argLength !== value.length) {\n            throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);\n          }\n          var match = function (branches) {\n            var branchKeys = keys(branches);\n            if (constructors.length !== branchKeys.length) {\n              throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\\nActual: ' + branchKeys.join(','));\n            }\n            var allReqd = forall(constructors, function (reqKey) {\n              return contains$2(branchKeys, reqKey);\n            });\n            if (!allReqd) {\n              throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\\nRequired: ' + constructors.join(', '));\n            }\n            return branches[key].apply(null, args);\n          };\n          return {\n            fold: function () {\n              var foldArgs = [];\n              for (var _i = 0; _i < arguments.length; _i++) {\n                foldArgs[_i] = arguments[_i];\n              }\n              if (foldArgs.length !== cases.length) {\n                throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length);\n              }\n              var target = foldArgs[count];\n              return target.apply(null, args);\n            },\n            match: match,\n            log: function (label) {\n              console.log(label, {\n                constructors: constructors,\n                constructor: key,\n                params: args\n              });\n            }\n          };\n        };\n      });\n      return adt;\n    };\n    var Adt = { generate: generate$7 };\n\n    Adt.generate([\n      {\n        bothErrors: [\n          'error1',\n          'error2'\n        ]\n      },\n      {\n        firstError: [\n          'error1',\n          'value2'\n        ]\n      },\n      {\n        secondError: [\n          'value1',\n          'error2'\n        ]\n      },\n      {\n        bothValues: [\n          'value1',\n          'value2'\n        ]\n      }\n    ]);\n    var partition$1 = function (results) {\n      var errors = [];\n      var values = [];\n      each$1(results, function (result) {\n        result.fold(function (err) {\n          errors.push(err);\n        }, function (value) {\n          values.push(value);\n        });\n      });\n      return {\n        errors: errors,\n        values: values\n      };\n    };\n\n    var exclude$1 = function (obj, fields) {\n      var r = {};\n      each(obj, function (v, k) {\n        if (!contains$2(fields, k)) {\n          r[k] = v;\n        }\n      });\n      return r;\n    };\n\n    var wrap$2 = function (key, value) {\n      var _a;\n      return _a = {}, _a[key] = value, _a;\n    };\n    var wrapAll$1 = function (keyvalues) {\n      var r = {};\n      each$1(keyvalues, function (kv) {\n        r[kv.key] = kv.value;\n      });\n      return r;\n    };\n\n    var exclude = function (obj, fields) {\n      return exclude$1(obj, fields);\n    };\n    var wrap$1 = function (key, value) {\n      return wrap$2(key, value);\n    };\n    var wrapAll = function (keyvalues) {\n      return wrapAll$1(keyvalues);\n    };\n    var mergeValues = function (values, base) {\n      return values.length === 0 ? Result.value(base) : Result.value(deepMerge(base, merge$1.apply(undefined, values)));\n    };\n    var mergeErrors = function (errors) {\n      return Result.error(flatten(errors));\n    };\n    var consolidate = function (objs, base) {\n      var partitions = partition$1(objs);\n      return partitions.errors.length > 0 ? mergeErrors(partitions.errors) : mergeValues(partitions.values, base);\n    };\n\n    var ensureIsRoot = function (isRoot) {\n      return isFunction(isRoot) ? isRoot : never;\n    };\n    var ancestor$2 = function (scope, transform, isRoot) {\n      var element = scope.dom;\n      var stop = ensureIsRoot(isRoot);\n      while (element.parentNode) {\n        element = element.parentNode;\n        var el = SugarElement.fromDom(element);\n        var transformed = transform(el);\n        if (transformed.isSome()) {\n          return transformed;\n        } else if (stop(el)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var closest$4 = function (scope, transform, isRoot) {\n      var current = transform(scope);\n      var stop = ensureIsRoot(isRoot);\n      return current.orThunk(function () {\n        return stop(scope) ? Optional.none() : ancestor$2(scope, transform, stop);\n      });\n    };\n\n    var isSource = function (component, simulatedEvent) {\n      return eq(component.element, simulatedEvent.event.target);\n    };\n\n    var defaultEventHandler = {\n      can: always,\n      abort: never,\n      run: noop\n    };\n    var nu$9 = function (parts) {\n      if (!hasNonNullableKey(parts, 'can') && !hasNonNullableKey(parts, 'abort') && !hasNonNullableKey(parts, 'run')) {\n        throw new Error('EventHandler defined by: ' + JSON.stringify(parts, null, 2) + ' does not have can, abort, or run!');\n      }\n      return __assign(__assign({}, defaultEventHandler), parts);\n    };\n    var all$2 = function (handlers, f) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return foldl(handlers, function (acc, handler) {\n          return acc && f(handler).apply(undefined, args);\n        }, true);\n      };\n    };\n    var any = function (handlers, f) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return foldl(handlers, function (acc, handler) {\n          return acc || f(handler).apply(undefined, args);\n        }, false);\n      };\n    };\n    var read$2 = function (handler) {\n      return isFunction(handler) ? {\n        can: always,\n        abort: never,\n        run: handler\n      } : handler;\n    };\n    var fuse$1 = function (handlers) {\n      var can = all$2(handlers, function (handler) {\n        return handler.can;\n      });\n      var abort = any(handlers, function (handler) {\n        return handler.abort;\n      });\n      var run = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        each$1(handlers, function (handler) {\n          handler.run.apply(undefined, args);\n        });\n      };\n      return {\n        can: can,\n        abort: abort,\n        run: run\n      };\n    };\n\n    var constant = constant$1;\n    var touchstart = constant('touchstart');\n    var touchmove = constant('touchmove');\n    var touchend = constant('touchend');\n    var touchcancel = constant('touchcancel');\n    var mousedown = constant('mousedown');\n    var mousemove = constant('mousemove');\n    var mouseout = constant('mouseout');\n    var mouseup = constant('mouseup');\n    var mouseover = constant('mouseover');\n    var focusin = constant('focusin');\n    var focusout = constant('focusout');\n    var keydown = constant('keydown');\n    var keyup = constant('keyup');\n    var input = constant('input');\n    var change = constant('change');\n    var click = constant('click');\n    var transitioncancel = constant('transitioncancel');\n    var transitionend = constant('transitionend');\n    var transitionstart = constant('transitionstart');\n    var selectstart = constant('selectstart');\n\n    var prefixName = function (name) {\n      return constant$1('alloy.' + name);\n    };\n    var alloy = { tap: prefixName('tap') };\n    var focus$4 = prefixName('focus');\n    var postBlur = prefixName('blur.post');\n    var postPaste = prefixName('paste.post');\n    var receive = prefixName('receive');\n    var execute$5 = prefixName('execute');\n    var focusItem = prefixName('focus.item');\n    var tap = alloy.tap;\n    var longpress = prefixName('longpress');\n    var sandboxClose = prefixName('sandbox.close');\n    var typeaheadCancel = prefixName('typeahead.cancel');\n    var systemInit = prefixName('system.init');\n    var documentTouchmove = prefixName('system.touchmove');\n    var documentTouchend = prefixName('system.touchend');\n    var windowScroll = prefixName('system.scroll');\n    var windowResize = prefixName('system.resize');\n    var attachedToDom = prefixName('system.attached');\n    var detachedFromDom = prefixName('system.detached');\n    var dismissRequested = prefixName('system.dismissRequested');\n    var repositionRequested = prefixName('system.repositionRequested');\n    var focusShifted = prefixName('focusmanager.shifted');\n    var slotVisibility = prefixName('slotcontainer.visibility');\n    var changeTab = prefixName('change.tab');\n    var dismissTab = prefixName('dismiss.tab');\n    var highlight$1 = prefixName('highlight');\n    var dehighlight$1 = prefixName('dehighlight');\n\n    var emit = function (component, event) {\n      dispatchWith(component, component.element, event, {});\n    };\n    var emitWith = function (component, event, properties) {\n      dispatchWith(component, component.element, event, properties);\n    };\n    var emitExecute = function (component) {\n      emit(component, execute$5());\n    };\n    var dispatch = function (component, target, event) {\n      dispatchWith(component, target, event, {});\n    };\n    var dispatchWith = function (component, target, event, properties) {\n      var data = __assign({ target: target }, properties);\n      component.getSystem().triggerEvent(event, target, data);\n    };\n    var dispatchEvent = function (component, target, event, simulatedEvent) {\n      component.getSystem().triggerEvent(event, target, simulatedEvent.event);\n    };\n\n    var derive$2 = function (configs) {\n      return wrapAll(configs);\n    };\n    var abort = function (name, predicate) {\n      return {\n        key: name,\n        value: nu$9({ abort: predicate })\n      };\n    };\n    var can = function (name, predicate) {\n      return {\n        key: name,\n        value: nu$9({ can: predicate })\n      };\n    };\n    var preventDefault = function (name) {\n      return {\n        key: name,\n        value: nu$9({\n          run: function (component, simulatedEvent) {\n            simulatedEvent.event.prevent();\n          }\n        })\n      };\n    };\n    var run$1 = function (name, handler) {\n      return {\n        key: name,\n        value: nu$9({ run: handler })\n      };\n    };\n    var runActionExtra = function (name, action, extra) {\n      return {\n        key: name,\n        value: nu$9({\n          run: function (component, simulatedEvent) {\n            action.apply(undefined, [\n              component,\n              simulatedEvent\n            ].concat(extra));\n          }\n        })\n      };\n    };\n    var runOnName = function (name) {\n      return function (handler) {\n        return run$1(name, handler);\n      };\n    };\n    var runOnSourceName = function (name) {\n      return function (handler) {\n        return {\n          key: name,\n          value: nu$9({\n            run: function (component, simulatedEvent) {\n              if (isSource(component, simulatedEvent)) {\n                handler(component, simulatedEvent);\n              }\n            }\n          })\n        };\n      };\n    };\n    var redirectToUid = function (name, uid) {\n      return run$1(name, function (component, simulatedEvent) {\n        component.getSystem().getByUid(uid).each(function (redirectee) {\n          dispatchEvent(redirectee, redirectee.element, name, simulatedEvent);\n        });\n      });\n    };\n    var redirectToPart = function (name, detail, partName) {\n      var uid = detail.partUids[partName];\n      return redirectToUid(name, uid);\n    };\n    var runWithTarget = function (name, f) {\n      return run$1(name, function (component, simulatedEvent) {\n        var ev = simulatedEvent.event;\n        var target = component.getSystem().getByDom(ev.target).getOrThunk(function () {\n          var closest = closest$4(ev.target, function (el) {\n            return component.getSystem().getByDom(el).toOptional();\n          }, never);\n          return closest.getOr(component);\n        });\n        f(component, target, simulatedEvent);\n      });\n    };\n    var cutter = function (name) {\n      return run$1(name, function (component, simulatedEvent) {\n        simulatedEvent.cut();\n      });\n    };\n    var stopper = function (name) {\n      return run$1(name, function (component, simulatedEvent) {\n        simulatedEvent.stop();\n      });\n    };\n    var runOnSource = function (name, f) {\n      return runOnSourceName(name)(f);\n    };\n    var runOnAttached = runOnSourceName(attachedToDom());\n    var runOnDetached = runOnSourceName(detachedFromDom());\n    var runOnInit = runOnSourceName(systemInit());\n    var runOnExecute$1 = runOnName(execute$5());\n\n    var fromHtml$1 = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      return children(SugarElement.fromDom(div));\n    };\n\n    var get$7 = function (element) {\n      return element.dom.innerHTML;\n    };\n    var set$5 = function (element, content) {\n      var owner = owner$4(element);\n      var docDom = owner.dom;\n      var fragment = SugarElement.fromDom(docDom.createDocumentFragment());\n      var contentElements = fromHtml$1(content, docDom);\n      append$1(fragment, contentElements);\n      empty(element);\n      append$2(element, fragment);\n    };\n    var getOuter = function (element) {\n      var container = SugarElement.fromTag('div');\n      var clone = SugarElement.fromDom(element.dom.cloneNode(true));\n      append$2(container, clone);\n      return get$7(container);\n    };\n\n    var clone$2 = function (original, isDeep) {\n      return SugarElement.fromDom(original.dom.cloneNode(isDeep));\n    };\n    var shallow = function (original) {\n      return clone$2(original, false);\n    };\n\n    var getHtml = function (element) {\n      if (isShadowRoot(element)) {\n        return '#shadow-root';\n      } else {\n        var clone = shallow(element);\n        return getOuter(clone);\n      }\n    };\n\n    var element = function (elem) {\n      return getHtml(elem);\n    };\n\n    var isRecursive = function (component, originator, target) {\n      return eq(originator, component.element) && !eq(originator, target);\n    };\n    var events$i = derive$2([can(focus$4(), function (component, simulatedEvent) {\n        var event = simulatedEvent.event;\n        var originator = event.originator;\n        var target = event.target;\n        if (isRecursive(component, originator, target)) {\n          console.warn(focus$4() + ' did not get interpreted by the desired target. ' + '\\nOriginator: ' + element(originator) + '\\nTarget: ' + element(target) + '\\nCheck the ' + focus$4() + ' event handlers');\n          return false;\n        } else {\n          return true;\n        }\n      })]);\n\n    var DefaultEvents = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$i\n    });\n\n    var unique = 0;\n    var generate$6 = function (prefix) {\n      var date = new Date();\n      var time = date.getTime();\n      var random = Math.floor(Math.random() * 1000000000);\n      unique++;\n      return prefix + '_' + random + unique + String(time);\n    };\n\n    var prefix$1 = constant$1('alloy-id-');\n    var idAttr$1 = constant$1('data-alloy-id');\n\n    var prefix = prefix$1();\n    var idAttr = idAttr$1();\n    var write = function (label, elem) {\n      var id = generate$6(prefix + label);\n      writeOnly(elem, id);\n      return id;\n    };\n    var writeOnly = function (elem, uid) {\n      Object.defineProperty(elem.dom, idAttr, {\n        value: uid,\n        writable: true\n      });\n    };\n    var read$1 = function (elem) {\n      var id = isElement$2(elem) ? elem.dom[idAttr] : null;\n      return Optional.from(id);\n    };\n    var generate$5 = function (prefix) {\n      return generate$6(prefix);\n    };\n\n    var make$8 = identity$1;\n\n    var NoContextApi = function (getComp) {\n      var getMessage = function (event) {\n        return 'The component must be in a context to execute: ' + event + (getComp ? '\\n' + element(getComp().element) + ' is not in context.' : '');\n      };\n      var fail = function (event) {\n        return function () {\n          throw new Error(getMessage(event));\n        };\n      };\n      var warn = function (event) {\n        return function () {\n          console.warn(getMessage(event));\n        };\n      };\n      return {\n        debugInfo: constant$1('fake'),\n        triggerEvent: warn('triggerEvent'),\n        triggerFocus: warn('triggerFocus'),\n        triggerEscape: warn('triggerEscape'),\n        broadcast: warn('broadcast'),\n        broadcastOn: warn('broadcastOn'),\n        broadcastEvent: warn('broadcastEvent'),\n        build: fail('build'),\n        addToWorld: fail('addToWorld'),\n        removeFromWorld: fail('removeFromWorld'),\n        addToGui: fail('addToGui'),\n        removeFromGui: fail('removeFromGui'),\n        getByUid: fail('getByUid'),\n        getByDom: fail('getByDom'),\n        isConnected: never\n      };\n    };\n    var singleton$1 = NoContextApi();\n\n    var markAsBehaviourApi = function (f, apiName, apiFunction) {\n      var delegate = apiFunction.toString();\n      var endIndex = delegate.indexOf(')') + 1;\n      var openBracketIndex = delegate.indexOf('(');\n      var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\\s*/);\n      f.toFunctionAnnotation = function () {\n        return {\n          name: apiName,\n          parameters: cleanParameters(parameters.slice(0, 1).concat(parameters.slice(3)))\n        };\n      };\n      return f;\n    };\n    var cleanParameters = function (parameters) {\n      return map$2(parameters, function (p) {\n        return endsWith(p, '/*') ? p.substring(0, p.length - '/*'.length) : p;\n      });\n    };\n    var markAsExtraApi = function (f, extraName) {\n      var delegate = f.toString();\n      var endIndex = delegate.indexOf(')') + 1;\n      var openBracketIndex = delegate.indexOf('(');\n      var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\\s*/);\n      f.toFunctionAnnotation = function () {\n        return {\n          name: extraName,\n          parameters: cleanParameters(parameters)\n        };\n      };\n      return f;\n    };\n    var markAsSketchApi = function (f, apiFunction) {\n      var delegate = apiFunction.toString();\n      var endIndex = delegate.indexOf(')') + 1;\n      var openBracketIndex = delegate.indexOf('(');\n      var parameters = delegate.substring(openBracketIndex + 1, endIndex - 1).split(/,\\s*/);\n      f.toFunctionAnnotation = function () {\n        return {\n          name: 'OVERRIDE',\n          parameters: cleanParameters(parameters.slice(1))\n        };\n      };\n      return f;\n    };\n\n    var premadeTag = generate$6('alloy-premade');\n    var premade$1 = function (comp) {\n      return wrap$1(premadeTag, comp);\n    };\n    var getPremade = function (spec) {\n      return get$e(spec, premadeTag);\n    };\n    var makeApi = function (f) {\n      return markAsSketchApi(function (component) {\n        var rest = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n          rest[_i - 1] = arguments[_i];\n        }\n        return f.apply(void 0, __spreadArray([\n          component.getApis(),\n          component\n        ], rest, false));\n      }, f);\n    };\n\n    var NoState = {\n      init: function () {\n        return nu$8({ readState: constant$1('No State required') });\n      }\n    };\n    var nu$8 = function (spec) {\n      return spec;\n    };\n\n    var generateFrom$1 = function (spec, all) {\n      var schema = map$2(all, function (a) {\n        return optionObjOf(a.name(), [\n          required$1('config'),\n          defaulted('state', NoState)\n        ]);\n      });\n      var validated = asRaw('component.behaviours', objOf(schema), spec.behaviours).fold(function (errInfo) {\n        throw new Error(formatError(errInfo) + '\\nComplete spec:\\n' + JSON.stringify(spec, null, 2));\n      }, identity$1);\n      return {\n        list: all,\n        data: map$1(validated, function (optBlobThunk) {\n          var output = optBlobThunk.map(function (blob) {\n            return {\n              config: blob.config,\n              state: blob.state.init(blob.config)\n            };\n          });\n          return constant$1(output);\n        })\n      };\n    };\n    var getBehaviours$3 = function (bData) {\n      return bData.list;\n    };\n    var getData$2 = function (bData) {\n      return bData.data;\n    };\n\n    var byInnerKey = function (data, tuple) {\n      var r = {};\n      each(data, function (detail, key) {\n        each(detail, function (value, indexKey) {\n          var chain = get$e(r, indexKey).getOr([]);\n          r[indexKey] = chain.concat([tuple(key, value)]);\n        });\n      });\n      return r;\n    };\n\n    var nu$7 = function (s) {\n      return {\n        classes: isUndefined(s.classes) ? [] : s.classes,\n        attributes: isUndefined(s.attributes) ? {} : s.attributes,\n        styles: isUndefined(s.styles) ? {} : s.styles\n      };\n    };\n    var merge = function (defnA, mod) {\n      return __assign(__assign({}, defnA), {\n        attributes: __assign(__assign({}, defnA.attributes), mod.attributes),\n        styles: __assign(__assign({}, defnA.styles), mod.styles),\n        classes: defnA.classes.concat(mod.classes)\n      });\n    };\n\n    var combine$2 = function (info, baseMod, behaviours, base) {\n      var modsByBehaviour = __assign({}, baseMod);\n      each$1(behaviours, function (behaviour) {\n        modsByBehaviour[behaviour.name()] = behaviour.exhibit(info, base);\n      });\n      var byAspect = byInnerKey(modsByBehaviour, function (name, modification) {\n        return {\n          name: name,\n          modification: modification\n        };\n      });\n      var combineObjects = function (objects) {\n        return foldr(objects, function (b, a) {\n          return __assign(__assign({}, a.modification), b);\n        }, {});\n      };\n      var combinedClasses = foldr(byAspect.classes, function (b, a) {\n        return a.modification.concat(b);\n      }, []);\n      var combinedAttributes = combineObjects(byAspect.attributes);\n      var combinedStyles = combineObjects(byAspect.styles);\n      return nu$7({\n        classes: combinedClasses,\n        attributes: combinedAttributes,\n        styles: combinedStyles\n      });\n    };\n\n    var sortKeys = function (label, keyName, array, order) {\n      try {\n        var sorted = sort(array, function (a, b) {\n          var aKey = a[keyName];\n          var bKey = b[keyName];\n          var aIndex = order.indexOf(aKey);\n          var bIndex = order.indexOf(bKey);\n          if (aIndex === -1) {\n            throw new Error('The ordering for ' + label + ' does not have an entry for ' + aKey + '.\\nOrder specified: ' + JSON.stringify(order, null, 2));\n          }\n          if (bIndex === -1) {\n            throw new Error('The ordering for ' + label + ' does not have an entry for ' + bKey + '.\\nOrder specified: ' + JSON.stringify(order, null, 2));\n          }\n          if (aIndex < bIndex) {\n            return -1;\n          } else if (bIndex < aIndex) {\n            return 1;\n          } else {\n            return 0;\n          }\n        });\n        return Result.value(sorted);\n      } catch (err) {\n        return Result.error([err]);\n      }\n    };\n\n    var uncurried = function (handler, purpose) {\n      return {\n        handler: handler,\n        purpose: purpose\n      };\n    };\n    var curried = function (handler, purpose) {\n      return {\n        cHandler: handler,\n        purpose: purpose\n      };\n    };\n    var curryArgs = function (descHandler, extraArgs) {\n      return curried(curry.apply(undefined, [descHandler.handler].concat(extraArgs)), descHandler.purpose);\n    };\n    var getCurried = function (descHandler) {\n      return descHandler.cHandler;\n    };\n\n    var behaviourTuple = function (name, handler) {\n      return {\n        name: name,\n        handler: handler\n      };\n    };\n    var nameToHandlers = function (behaviours, info) {\n      var r = {};\n      each$1(behaviours, function (behaviour) {\n        r[behaviour.name()] = behaviour.handlers(info);\n      });\n      return r;\n    };\n    var groupByEvents = function (info, behaviours, base) {\n      var behaviourEvents = __assign(__assign({}, base), nameToHandlers(behaviours, info));\n      return byInnerKey(behaviourEvents, behaviourTuple);\n    };\n    var combine$1 = function (info, eventOrder, behaviours, base) {\n      var byEventName = groupByEvents(info, behaviours, base);\n      return combineGroups(byEventName, eventOrder);\n    };\n    var assemble = function (rawHandler) {\n      var handler = read$2(rawHandler);\n      return function (component, simulatedEvent) {\n        var rest = [];\n        for (var _i = 2; _i < arguments.length; _i++) {\n          rest[_i - 2] = arguments[_i];\n        }\n        var args = [\n          component,\n          simulatedEvent\n        ].concat(rest);\n        if (handler.abort.apply(undefined, args)) {\n          simulatedEvent.stop();\n        } else if (handler.can.apply(undefined, args)) {\n          handler.run.apply(undefined, args);\n        }\n      };\n    };\n    var missingOrderError = function (eventName, tuples) {\n      return Result.error(['The event (' + eventName + ') has more than one behaviour that listens to it.\\nWhen this occurs, you must ' + 'specify an event ordering for the behaviours in your spec (e.g. [ \"listing\", \"toggling\" ]).\\nThe behaviours that ' + 'can trigger it are: ' + JSON.stringify(map$2(tuples, function (c) {\n          return c.name;\n        }), null, 2)]);\n    };\n    var fuse = function (tuples, eventOrder, eventName) {\n      var order = eventOrder[eventName];\n      if (!order) {\n        return missingOrderError(eventName, tuples);\n      } else {\n        return sortKeys('Event: ' + eventName, 'name', tuples, order).map(function (sortedTuples) {\n          var handlers = map$2(sortedTuples, function (tuple) {\n            return tuple.handler;\n          });\n          return fuse$1(handlers);\n        });\n      }\n    };\n    var combineGroups = function (byEventName, eventOrder) {\n      var r = mapToArray(byEventName, function (tuples, eventName) {\n        var combined = tuples.length === 1 ? Result.value(tuples[0].handler) : fuse(tuples, eventOrder, eventName);\n        return combined.map(function (handler) {\n          var assembled = assemble(handler);\n          var purpose = tuples.length > 1 ? filter$2(eventOrder[eventName], function (o) {\n            return exists(tuples, function (t) {\n              return t.name === o;\n            });\n          }).join(' > ') : tuples[0].name;\n          return wrap$1(eventName, uncurried(assembled, purpose));\n        });\n      });\n      return consolidate(r, {});\n    };\n\n    var _a$2;\n    var baseBehaviour = 'alloy.base.behaviour';\n    var schema$z = objOf([\n      field$1('dom', 'dom', required$2(), objOf([\n        required$1('tag'),\n        defaulted('styles', {}),\n        defaulted('classes', []),\n        defaulted('attributes', {}),\n        option('value'),\n        option('innerHtml')\n      ])),\n      required$1('components'),\n      required$1('uid'),\n      defaulted('events', {}),\n      defaulted('apis', {}),\n      field$1('eventOrder', 'eventOrder', mergeWith((_a$2 = {}, _a$2[execute$5()] = [\n        'disabling',\n        baseBehaviour,\n        'toggling',\n        'typeaheadevents'\n      ], _a$2[focus$4()] = [\n        baseBehaviour,\n        'focusing',\n        'keying'\n      ], _a$2[systemInit()] = [\n        baseBehaviour,\n        'disabling',\n        'toggling',\n        'representing'\n      ], _a$2[input()] = [\n        baseBehaviour,\n        'representing',\n        'streaming',\n        'invalidating'\n      ], _a$2[detachedFromDom()] = [\n        baseBehaviour,\n        'representing',\n        'item-events',\n        'tooltipping'\n      ], _a$2[mousedown()] = [\n        'focusing',\n        baseBehaviour,\n        'item-type-events'\n      ], _a$2[touchstart()] = [\n        'focusing',\n        baseBehaviour,\n        'item-type-events'\n      ], _a$2[mouseover()] = [\n        'item-type-events',\n        'tooltipping'\n      ], _a$2[receive()] = [\n        'receiving',\n        'reflecting',\n        'tooltipping'\n      ], _a$2)), anyValue()),\n      option('domModification')\n    ]);\n    var toInfo = function (spec) {\n      return asRaw('custom.definition', schema$z, spec);\n    };\n    var toDefinition = function (detail) {\n      return __assign(__assign({}, detail.dom), {\n        uid: detail.uid,\n        domChildren: map$2(detail.components, function (comp) {\n          return comp.element;\n        })\n      });\n    };\n    var toModification = function (detail) {\n      return detail.domModification.fold(function () {\n        return nu$7({});\n      }, nu$7);\n    };\n    var toEvents = function (info) {\n      return info.events;\n    };\n\n    var read = function (element, attr) {\n      var value = get$d(element, attr);\n      return value === undefined || value === '' ? [] : value.split(' ');\n    };\n    var add$4 = function (element, attr, id) {\n      var old = read(element, attr);\n      var nu = old.concat([id]);\n      set$8(element, attr, nu.join(' '));\n      return true;\n    };\n    var remove$4 = function (element, attr, id) {\n      var nu = filter$2(read(element, attr), function (v) {\n        return v !== id;\n      });\n      if (nu.length > 0) {\n        set$8(element, attr, nu.join(' '));\n      } else {\n        remove$7(element, attr);\n      }\n      return false;\n    };\n\n    var supports = function (element) {\n      return element.dom.classList !== undefined;\n    };\n    var get$6 = function (element) {\n      return read(element, 'class');\n    };\n    var add$3 = function (element, clazz) {\n      return add$4(element, 'class', clazz);\n    };\n    var remove$3 = function (element, clazz) {\n      return remove$4(element, 'class', clazz);\n    };\n\n    var add$2 = function (element, clazz) {\n      if (supports(element)) {\n        element.dom.classList.add(clazz);\n      } else {\n        add$3(element, clazz);\n      }\n    };\n    var cleanClass = function (element) {\n      var classList = supports(element) ? element.dom.classList : get$6(element);\n      if (classList.length === 0) {\n        remove$7(element, 'class');\n      }\n    };\n    var remove$2 = function (element, clazz) {\n      if (supports(element)) {\n        var classList = element.dom.classList;\n        classList.remove(clazz);\n      } else {\n        remove$3(element, clazz);\n      }\n      cleanClass(element);\n    };\n    var has = function (element, clazz) {\n      return supports(element) && element.dom.classList.contains(clazz);\n    };\n\n    var add$1 = function (element, classes) {\n      each$1(classes, function (x) {\n        add$2(element, x);\n      });\n    };\n    var remove$1 = function (element, classes) {\n      each$1(classes, function (x) {\n        remove$2(element, x);\n      });\n    };\n    var hasAll = function (element, classes) {\n      return forall(classes, function (clazz) {\n        return has(element, clazz);\n      });\n    };\n\n    var get$5 = function (element) {\n      return element.dom.value;\n    };\n    var set$4 = function (element, value) {\n      if (value === undefined) {\n        throw new Error('Value.set was undefined');\n      }\n      element.dom.value = value;\n    };\n\n    var renderToDom = function (definition) {\n      var subject = SugarElement.fromTag(definition.tag);\n      setAll$1(subject, definition.attributes);\n      add$1(subject, definition.classes);\n      setAll(subject, definition.styles);\n      definition.innerHtml.each(function (html) {\n        return set$5(subject, html);\n      });\n      var children = definition.domChildren;\n      append$1(subject, children);\n      definition.value.each(function (value) {\n        set$4(subject, value);\n      });\n      if (!definition.uid) {\n        debugger;\n      }\n      writeOnly(subject, definition.uid);\n      return subject;\n    };\n\n    var getBehaviours$2 = function (spec) {\n      var behaviours = get$e(spec, 'behaviours').getOr({});\n      return bind$3(keys(behaviours), function (name) {\n        var behaviour = behaviours[name];\n        return isNonNullable(behaviour) ? [behaviour.me] : [];\n      });\n    };\n    var generateFrom = function (spec, all) {\n      return generateFrom$1(spec, all);\n    };\n    var generate$4 = function (spec) {\n      var all = getBehaviours$2(spec);\n      return generateFrom(spec, all);\n    };\n\n    var getDomDefinition = function (info, bList, bData) {\n      var definition = toDefinition(info);\n      var infoModification = toModification(info);\n      var baseModification = { 'alloy.base.modification': infoModification };\n      var modification = bList.length > 0 ? combine$2(bData, baseModification, bList, definition) : infoModification;\n      return merge(definition, modification);\n    };\n    var getEvents = function (info, bList, bData) {\n      var baseEvents = { 'alloy.base.behaviour': toEvents(info) };\n      return combine$1(bData, info.eventOrder, bList, baseEvents).getOrDie();\n    };\n    var build$2 = function (spec) {\n      var getMe = function () {\n        return me;\n      };\n      var systemApi = Cell(singleton$1);\n      var info = getOrDie(toInfo(spec));\n      var bBlob = generate$4(spec);\n      var bList = getBehaviours$3(bBlob);\n      var bData = getData$2(bBlob);\n      var modDefinition = getDomDefinition(info, bList, bData);\n      var item = renderToDom(modDefinition);\n      var events = getEvents(info, bList, bData);\n      var subcomponents = Cell(info.components);\n      var connect = function (newApi) {\n        systemApi.set(newApi);\n      };\n      var disconnect = function () {\n        systemApi.set(NoContextApi(getMe));\n      };\n      var syncComponents = function () {\n        var children$1 = children(item);\n        var subs = bind$3(children$1, function (child) {\n          return systemApi.get().getByDom(child).fold(function () {\n            return [];\n          }, pure$2);\n        });\n        subcomponents.set(subs);\n      };\n      var config = function (behaviour) {\n        var b = bData;\n        var f = isFunction(b[behaviour.name()]) ? b[behaviour.name()] : function () {\n          throw new Error('Could not find ' + behaviour.name() + ' in ' + JSON.stringify(spec, null, 2));\n        };\n        return f();\n      };\n      var hasConfigured = function (behaviour) {\n        return isFunction(bData[behaviour.name()]);\n      };\n      var getApis = function () {\n        return info.apis;\n      };\n      var readState = function (behaviourName) {\n        return bData[behaviourName]().map(function (b) {\n          return b.state.readState();\n        }).getOr('not enabled');\n      };\n      var me = {\n        uid: spec.uid,\n        getSystem: systemApi.get,\n        config: config,\n        hasConfigured: hasConfigured,\n        spec: spec,\n        readState: readState,\n        getApis: getApis,\n        connect: connect,\n        disconnect: disconnect,\n        element: item,\n        syncComponents: syncComponents,\n        components: subcomponents.get,\n        events: events\n      };\n      return me;\n    };\n\n    var buildSubcomponents = function (spec) {\n      var components = get$e(spec, 'components').getOr([]);\n      return map$2(components, build$1);\n    };\n    var buildFromSpec = function (userSpec) {\n      var _a = make$8(userSpec), specEvents = _a.events, spec = __rest(_a, ['events']);\n      var components = buildSubcomponents(spec);\n      var completeSpec = __assign(__assign({}, spec), {\n        events: __assign(__assign({}, DefaultEvents), specEvents),\n        components: components\n      });\n      return Result.value(build$2(completeSpec));\n    };\n    var text$1 = function (textContent) {\n      var element = SugarElement.fromText(textContent);\n      return external$2({ element: element });\n    };\n    var external$2 = function (spec) {\n      var extSpec = asRawOrDie$1('external.component', objOfOnly([\n        required$1('element'),\n        option('uid')\n      ]), spec);\n      var systemApi = Cell(NoContextApi());\n      var connect = function (newApi) {\n        systemApi.set(newApi);\n      };\n      var disconnect = function () {\n        systemApi.set(NoContextApi(function () {\n          return me;\n        }));\n      };\n      var uid = extSpec.uid.getOrThunk(function () {\n        return generate$5('external');\n      });\n      writeOnly(extSpec.element, uid);\n      var me = {\n        uid: uid,\n        getSystem: systemApi.get,\n        config: Optional.none,\n        hasConfigured: never,\n        connect: connect,\n        disconnect: disconnect,\n        getApis: function () {\n          return {};\n        },\n        element: extSpec.element,\n        spec: spec,\n        readState: constant$1('No state'),\n        syncComponents: noop,\n        components: constant$1([]),\n        events: {}\n      };\n      return premade$1(me);\n    };\n    var uids = generate$5;\n    var isSketchSpec$1 = function (spec) {\n      return has$2(spec, 'uid');\n    };\n    var build$1 = function (spec) {\n      return getPremade(spec).getOrThunk(function () {\n        var userSpecWithUid = isSketchSpec$1(spec) ? spec : __assign({ uid: uids('') }, spec);\n        return buildFromSpec(userSpecWithUid).getOrDie();\n      });\n    };\n    var premade = premade$1;\n\n    function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {\n      if (is(scope, a)) {\n        return Optional.some(scope);\n      } else if (isFunction(isRoot) && isRoot(scope)) {\n        return Optional.none();\n      } else {\n        return ancestor(scope, a, isRoot);\n      }\n    }\n\n    var ancestor$1 = function (scope, predicate, isRoot) {\n      var element = scope.dom;\n      var stop = isFunction(isRoot) ? isRoot : never;\n      while (element.parentNode) {\n        element = element.parentNode;\n        var el = SugarElement.fromDom(element);\n        if (predicate(el)) {\n          return Optional.some(el);\n        } else if (stop(el)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var closest$3 = function (scope, predicate, isRoot) {\n      var is = function (s, test) {\n        return test(s);\n      };\n      return ClosestOrAncestor(is, ancestor$1, scope, predicate, isRoot);\n    };\n    var child$1 = function (scope, predicate) {\n      var pred = function (node) {\n        return predicate(SugarElement.fromDom(node));\n      };\n      var result = find$5(scope.dom.childNodes, pred);\n      return result.map(SugarElement.fromDom);\n    };\n    var descendant$1 = function (scope, predicate) {\n      var descend = function (node) {\n        for (var i = 0; i < node.childNodes.length; i++) {\n          var child_1 = SugarElement.fromDom(node.childNodes[i]);\n          if (predicate(child_1)) {\n            return Optional.some(child_1);\n          }\n          var res = descend(node.childNodes[i]);\n          if (res.isSome()) {\n            return res;\n          }\n        }\n        return Optional.none();\n      };\n      return descend(scope.dom);\n    };\n\n    var closest$2 = function (scope, predicate, isRoot) {\n      return closest$3(scope, predicate, isRoot).isSome();\n    };\n\n    var ancestor = function (scope, selector, isRoot) {\n      return ancestor$1(scope, function (e) {\n        return is(e, selector);\n      }, isRoot);\n    };\n    var child = function (scope, selector) {\n      return child$1(scope, function (e) {\n        return is(e, selector);\n      });\n    };\n    var descendant = function (scope, selector) {\n      return one(selector, scope);\n    };\n    var closest$1 = function (scope, selector, isRoot) {\n      var is$1 = function (element, selector) {\n        return is(element, selector);\n      };\n      return ClosestOrAncestor(is$1, ancestor, scope, selector, isRoot);\n    };\n\n    var find$1 = function (queryElem) {\n      var dependent = closest$3(queryElem, function (elem) {\n        if (!isElement$2(elem)) {\n          return false;\n        }\n        var id = get$d(elem, 'id');\n        return id !== undefined && id.indexOf('aria-owns') > -1;\n      });\n      return dependent.bind(function (dep) {\n        var id = get$d(dep, 'id');\n        var dos = getRootNode(dep);\n        return descendant(dos, '[aria-owns=\"' + id + '\"]');\n      });\n    };\n    var manager = function () {\n      var ariaId = generate$6('aria-owns');\n      var link = function (elem) {\n        set$8(elem, 'aria-owns', ariaId);\n      };\n      var unlink = function (elem) {\n        remove$7(elem, 'aria-owns');\n      };\n      return {\n        id: ariaId,\n        link: link,\n        unlink: unlink\n      };\n    };\n\n    var isAriaPartOf = function (component, queryElem) {\n      return find$1(queryElem).exists(function (owner) {\n        return isPartOf$1(component, owner);\n      });\n    };\n    var isPartOf$1 = function (component, queryElem) {\n      return closest$2(queryElem, function (el) {\n        return eq(el, component.element);\n      }, never) || isAriaPartOf(component, queryElem);\n    };\n\n    var unknown = 'unknown';\n    var EventConfiguration;\n    (function (EventConfiguration) {\n      EventConfiguration[EventConfiguration['STOP'] = 0] = 'STOP';\n      EventConfiguration[EventConfiguration['NORMAL'] = 1] = 'NORMAL';\n      EventConfiguration[EventConfiguration['LOGGING'] = 2] = 'LOGGING';\n    }(EventConfiguration || (EventConfiguration = {})));\n    var eventConfig = Cell({});\n    var makeEventLogger = function (eventName, initialTarget) {\n      var sequence = [];\n      var startTime = new Date().getTime();\n      return {\n        logEventCut: function (_name, target, purpose) {\n          sequence.push({\n            outcome: 'cut',\n            target: target,\n            purpose: purpose\n          });\n        },\n        logEventStopped: function (_name, target, purpose) {\n          sequence.push({\n            outcome: 'stopped',\n            target: target,\n            purpose: purpose\n          });\n        },\n        logNoParent: function (_name, target, purpose) {\n          sequence.push({\n            outcome: 'no-parent',\n            target: target,\n            purpose: purpose\n          });\n        },\n        logEventNoHandlers: function (_name, target) {\n          sequence.push({\n            outcome: 'no-handlers-left',\n            target: target\n          });\n        },\n        logEventResponse: function (_name, target, purpose) {\n          sequence.push({\n            outcome: 'response',\n            purpose: purpose,\n            target: target\n          });\n        },\n        write: function () {\n          var finishTime = new Date().getTime();\n          if (contains$2([\n              'mousemove',\n              'mouseover',\n              'mouseout',\n              systemInit()\n            ], eventName)) {\n            return;\n          }\n          console.log(eventName, {\n            event: eventName,\n            time: finishTime - startTime,\n            target: initialTarget.dom,\n            sequence: map$2(sequence, function (s) {\n              if (!contains$2([\n                  'cut',\n                  'stopped',\n                  'response'\n                ], s.outcome)) {\n                return s.outcome;\n              } else {\n                return '{' + s.purpose + '} ' + s.outcome + ' at (' + element(s.target) + ')';\n              }\n            })\n          });\n        }\n      };\n    };\n    var processEvent = function (eventName, initialTarget, f) {\n      var status = get$e(eventConfig.get(), eventName).orThunk(function () {\n        var patterns = keys(eventConfig.get());\n        return findMap(patterns, function (p) {\n          return eventName.indexOf(p) > -1 ? Optional.some(eventConfig.get()[p]) : Optional.none();\n        });\n      }).getOr(EventConfiguration.NORMAL);\n      switch (status) {\n      case EventConfiguration.NORMAL:\n        return f(noLogger());\n      case EventConfiguration.LOGGING: {\n          var logger = makeEventLogger(eventName, initialTarget);\n          var output = f(logger);\n          logger.write();\n          return output;\n        }\n      case EventConfiguration.STOP:\n        return true;\n      }\n    };\n    var path = [\n      'alloy/data/Fields',\n      'alloy/debugging/Debugging'\n    ];\n    var getTrace = function () {\n      var err = new Error();\n      if (err.stack !== undefined) {\n        var lines = err.stack.split('\\n');\n        return find$5(lines, function (line) {\n          return line.indexOf('alloy') > 0 && !exists(path, function (p) {\n            return line.indexOf(p) > -1;\n          });\n        }).getOr(unknown);\n      } else {\n        return unknown;\n      }\n    };\n    var ignoreEvent = {\n      logEventCut: noop,\n      logEventStopped: noop,\n      logNoParent: noop,\n      logEventNoHandlers: noop,\n      logEventResponse: noop,\n      write: noop\n    };\n    var monitorEvent = function (eventName, initialTarget, f) {\n      return processEvent(eventName, initialTarget, f);\n    };\n    var noLogger = constant$1(ignoreEvent);\n\n    var menuFields = constant$1([\n      required$1('menu'),\n      required$1('selectedMenu')\n    ]);\n    var itemFields = constant$1([\n      required$1('item'),\n      required$1('selectedItem')\n    ]);\n    constant$1(objOf(itemFields().concat(menuFields())));\n    var itemSchema$3 = constant$1(objOf(itemFields()));\n\n    var _initSize = requiredObjOf('initSize', [\n      required$1('numColumns'),\n      required$1('numRows')\n    ]);\n    var itemMarkers = function () {\n      return requiredOf('markers', itemSchema$3());\n    };\n    var tieredMenuMarkers = function () {\n      return requiredObjOf('markers', [required$1('backgroundMenu')].concat(menuFields()).concat(itemFields()));\n    };\n    var markers$1 = function (required) {\n      return requiredObjOf('markers', map$2(required, required$1));\n    };\n    var onPresenceHandler = function (label, fieldName, presence) {\n      getTrace();\n      return field$1(fieldName, fieldName, presence, valueOf(function (f) {\n        return Result.value(function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          return f.apply(undefined, args);\n        });\n      }));\n    };\n    var onHandler = function (fieldName) {\n      return onPresenceHandler('onHandler', fieldName, defaulted$1(noop));\n    };\n    var onKeyboardHandler = function (fieldName) {\n      return onPresenceHandler('onKeyboardHandler', fieldName, defaulted$1(Optional.none));\n    };\n    var onStrictHandler = function (fieldName) {\n      return onPresenceHandler('onHandler', fieldName, required$2());\n    };\n    var onStrictKeyboardHandler = function (fieldName) {\n      return onPresenceHandler('onKeyboardHandler', fieldName, required$2());\n    };\n    var output$1 = function (name, value) {\n      return customField(name, constant$1(value));\n    };\n    var snapshot = function (name) {\n      return customField(name, identity$1);\n    };\n    var initSize = constant$1(_initSize);\n\n    var nu$6 = function (x, y, bubble, direction, placement, boundsRestriction, labelPrefix, alwaysFit) {\n      if (alwaysFit === void 0) {\n        alwaysFit = false;\n      }\n      return {\n        x: x,\n        y: y,\n        bubble: bubble,\n        direction: direction,\n        placement: placement,\n        restriction: boundsRestriction,\n        label: labelPrefix + '-' + placement,\n        alwaysFit: alwaysFit\n      };\n    };\n\n    var adt$a = Adt.generate([\n      { southeast: [] },\n      { southwest: [] },\n      { northeast: [] },\n      { northwest: [] },\n      { south: [] },\n      { north: [] },\n      { east: [] },\n      { west: [] }\n    ]);\n    var cata$2 = function (subject, southeast, southwest, northeast, northwest, south, north, east, west) {\n      return subject.fold(southeast, southwest, northeast, northwest, south, north, east, west);\n    };\n    var cataVertical = function (subject, south, middle, north) {\n      return subject.fold(south, south, north, north, south, north, middle, middle);\n    };\n    var cataHorizontal = function (subject, east, middle, west) {\n      return subject.fold(east, west, east, west, middle, middle, east, west);\n    };\n    var southeast$3 = adt$a.southeast;\n    var southwest$3 = adt$a.southwest;\n    var northeast$3 = adt$a.northeast;\n    var northwest$3 = adt$a.northwest;\n    var south$3 = adt$a.south;\n    var north$3 = adt$a.north;\n    var east$3 = adt$a.east;\n    var west$3 = adt$a.west;\n\n    var cycleBy = function (value, delta, min, max) {\n      var r = value + delta;\n      if (r > max) {\n        return min;\n      } else if (r < min) {\n        return max;\n      } else {\n        return r;\n      }\n    };\n    var clamp$1 = function (value, min, max) {\n      return Math.min(Math.max(value, min), max);\n    };\n\n    var getRestriction = function (anchor, restriction) {\n      switch (restriction) {\n      case 1:\n        return anchor.x;\n      case 0:\n        return anchor.x + anchor.width;\n      case 2:\n        return anchor.y;\n      case 3:\n        return anchor.y + anchor.height;\n      }\n    };\n    var boundsRestriction = function (anchor, restrictions) {\n      return mapToObject([\n        'left',\n        'right',\n        'top',\n        'bottom'\n      ], function (dir) {\n        return get$e(restrictions, dir).map(function (restriction) {\n          return getRestriction(anchor, restriction);\n        });\n      });\n    };\n    var adjustBounds = function (bounds$1, restriction, bubbleOffset) {\n      var applyRestriction = function (dir, current) {\n        return restriction[dir].map(function (pos) {\n          var isVerticalAxis = dir === 'top' || dir === 'bottom';\n          var offset = isVerticalAxis ? bubbleOffset.top : bubbleOffset.left;\n          var comparator = dir === 'left' || dir === 'top' ? Math.max : Math.min;\n          var newPos = comparator(pos, current) + offset;\n          return isVerticalAxis ? clamp$1(newPos, bounds$1.y, bounds$1.bottom) : clamp$1(newPos, bounds$1.x, bounds$1.right);\n        }).getOr(current);\n      };\n      var adjustedLeft = applyRestriction('left', bounds$1.x);\n      var adjustedTop = applyRestriction('top', bounds$1.y);\n      var adjustedRight = applyRestriction('right', bounds$1.right);\n      var adjustedBottom = applyRestriction('bottom', bounds$1.bottom);\n      return bounds(adjustedLeft, adjustedTop, adjustedRight - adjustedLeft, adjustedBottom - adjustedTop);\n    };\n\n    var labelPrefix$2 = 'layout';\n    var eastX$1 = function (anchor) {\n      return anchor.x;\n    };\n    var middleX$1 = function (anchor, element) {\n      return anchor.x + anchor.width / 2 - element.width / 2;\n    };\n    var westX$1 = function (anchor, element) {\n      return anchor.x + anchor.width - element.width;\n    };\n    var northY$2 = function (anchor, element) {\n      return anchor.y - element.height;\n    };\n    var southY$2 = function (anchor) {\n      return anchor.y + anchor.height;\n    };\n    var centreY$1 = function (anchor, element) {\n      return anchor.y + anchor.height / 2 - element.height / 2;\n    };\n    var eastEdgeX$1 = function (anchor) {\n      return anchor.x + anchor.width;\n    };\n    var westEdgeX$1 = function (anchor, element) {\n      return anchor.x - element.width;\n    };\n    var southeast$2 = function (anchor, element, bubbles) {\n      return nu$6(eastX$1(anchor), southY$2(anchor), bubbles.southeast(), southeast$3(), 'southeast', boundsRestriction(anchor, {\n        left: 1,\n        top: 3\n      }), labelPrefix$2);\n    };\n    var southwest$2 = function (anchor, element, bubbles) {\n      return nu$6(westX$1(anchor, element), southY$2(anchor), bubbles.southwest(), southwest$3(), 'southwest', boundsRestriction(anchor, {\n        right: 0,\n        top: 3\n      }), labelPrefix$2);\n    };\n    var northeast$2 = function (anchor, element, bubbles) {\n      return nu$6(eastX$1(anchor), northY$2(anchor, element), bubbles.northeast(), northeast$3(), 'northeast', boundsRestriction(anchor, {\n        left: 1,\n        bottom: 2\n      }), labelPrefix$2);\n    };\n    var northwest$2 = function (anchor, element, bubbles) {\n      return nu$6(westX$1(anchor, element), northY$2(anchor, element), bubbles.northwest(), northwest$3(), 'northwest', boundsRestriction(anchor, {\n        right: 0,\n        bottom: 2\n      }), labelPrefix$2);\n    };\n    var north$2 = function (anchor, element, bubbles) {\n      return nu$6(middleX$1(anchor, element), northY$2(anchor, element), bubbles.north(), north$3(), 'north', boundsRestriction(anchor, { bottom: 2 }), labelPrefix$2);\n    };\n    var south$2 = function (anchor, element, bubbles) {\n      return nu$6(middleX$1(anchor, element), southY$2(anchor), bubbles.south(), south$3(), 'south', boundsRestriction(anchor, { top: 3 }), labelPrefix$2);\n    };\n    var east$2 = function (anchor, element, bubbles) {\n      return nu$6(eastEdgeX$1(anchor), centreY$1(anchor, element), bubbles.east(), east$3(), 'east', boundsRestriction(anchor, { left: 0 }), labelPrefix$2);\n    };\n    var west$2 = function (anchor, element, bubbles) {\n      return nu$6(westEdgeX$1(anchor, element), centreY$1(anchor, element), bubbles.west(), west$3(), 'west', boundsRestriction(anchor, { right: 1 }), labelPrefix$2);\n    };\n    var all$1 = function () {\n      return [\n        southeast$2,\n        southwest$2,\n        northeast$2,\n        northwest$2,\n        south$2,\n        north$2,\n        east$2,\n        west$2\n      ];\n    };\n    var allRtl$1 = function () {\n      return [\n        southwest$2,\n        southeast$2,\n        northwest$2,\n        northeast$2,\n        south$2,\n        north$2,\n        east$2,\n        west$2\n      ];\n    };\n    var aboveOrBelow = function () {\n      return [\n        northeast$2,\n        northwest$2,\n        southeast$2,\n        southwest$2,\n        north$2,\n        south$2\n      ];\n    };\n    var aboveOrBelowRtl = function () {\n      return [\n        northwest$2,\n        northeast$2,\n        southwest$2,\n        southeast$2,\n        north$2,\n        south$2\n      ];\n    };\n    var belowOrAbove = function () {\n      return [\n        southeast$2,\n        southwest$2,\n        northeast$2,\n        northwest$2,\n        south$2,\n        north$2\n      ];\n    };\n    var belowOrAboveRtl = function () {\n      return [\n        southwest$2,\n        southeast$2,\n        northwest$2,\n        northeast$2,\n        south$2,\n        north$2\n      ];\n    };\n\n    var chooseChannels = function (channels, message) {\n      return message.universal ? channels : filter$2(channels, function (ch) {\n        return contains$2(message.channels, ch);\n      });\n    };\n    var events$h = function (receiveConfig) {\n      return derive$2([run$1(receive(), function (component, message) {\n          var channelMap = receiveConfig.channels;\n          var channels = keys(channelMap);\n          var receivingData = message;\n          var targetChannels = chooseChannels(channels, receivingData);\n          each$1(targetChannels, function (ch) {\n            var channelInfo = channelMap[ch];\n            var channelSchema = channelInfo.schema;\n            var data = asRawOrDie$1('channel[' + ch + '] data\\nReceiver: ' + element(component.element), channelSchema, receivingData.data);\n            channelInfo.onReceive(component, data);\n          });\n        })]);\n    };\n\n    var ActiveReceiving = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$h\n    });\n\n    var ReceivingSchema = [requiredOf('channels', setOf(Result.value, objOfOnly([\n        onStrictHandler('onReceive'),\n        defaulted('schema', anyValue())\n      ])))];\n\n    var executeEvent = function (bConfig, bState, executor) {\n      return runOnExecute$1(function (component) {\n        executor(component, bConfig, bState);\n      });\n    };\n    var loadEvent = function (bConfig, bState, f) {\n      return runOnInit(function (component, _simulatedEvent) {\n        f(component, bConfig, bState);\n      });\n    };\n    var create$9 = function (schema, name, active, apis, extra, state) {\n      var configSchema = objOfOnly(schema);\n      var schemaSchema = optionObjOf(name, [optionObjOfOnly('config', schema)]);\n      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);\n    };\n    var createModes$1 = function (modes, name, active, apis, extra, state) {\n      var configSchema = modes;\n      var schemaSchema = optionObjOf(name, [optionOf('config', modes)]);\n      return doCreate(configSchema, schemaSchema, name, active, apis, extra, state);\n    };\n    var wrapApi = function (bName, apiFunction, apiName) {\n      var f = function (component) {\n        var rest = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n          rest[_i - 1] = arguments[_i];\n        }\n        var args = [component].concat(rest);\n        return component.config({ name: constant$1(bName) }).fold(function () {\n          throw new Error('We could not find any behaviour configuration for: ' + bName + '. Using API: ' + apiName);\n        }, function (info) {\n          var rest = Array.prototype.slice.call(args, 1);\n          return apiFunction.apply(undefined, [\n            component,\n            info.config,\n            info.state\n          ].concat(rest));\n        });\n      };\n      return markAsBehaviourApi(f, apiName, apiFunction);\n    };\n    var revokeBehaviour = function (name) {\n      return {\n        key: name,\n        value: undefined\n      };\n    };\n    var doCreate = function (configSchema, schemaSchema, name, active, apis, extra, state) {\n      var getConfig = function (info) {\n        return hasNonNullableKey(info, name) ? info[name]() : Optional.none();\n      };\n      var wrappedApis = map$1(apis, function (apiF, apiName) {\n        return wrapApi(name, apiF, apiName);\n      });\n      var wrappedExtra = map$1(extra, function (extraF, extraName) {\n        return markAsExtraApi(extraF, extraName);\n      });\n      var me = __assign(__assign(__assign({}, wrappedExtra), wrappedApis), {\n        revoke: curry(revokeBehaviour, name),\n        config: function (spec) {\n          var prepared = asRawOrDie$1(name + '-config', configSchema, spec);\n          return {\n            key: name,\n            value: {\n              config: prepared,\n              me: me,\n              configAsRaw: cached(function () {\n                return asRawOrDie$1(name + '-config', configSchema, spec);\n              }),\n              initialConfig: spec,\n              state: state\n            }\n          };\n        },\n        schema: constant$1(schemaSchema),\n        exhibit: function (info, base) {\n          return lift2(getConfig(info), get$e(active, 'exhibit'), function (behaviourInfo, exhibitor) {\n            return exhibitor(base, behaviourInfo.config, behaviourInfo.state);\n          }).getOrThunk(function () {\n            return nu$7({});\n          });\n        },\n        name: constant$1(name),\n        handlers: function (info) {\n          return getConfig(info).map(function (behaviourInfo) {\n            var getEvents = get$e(active, 'events').getOr(function () {\n              return {};\n            });\n            return getEvents(behaviourInfo.config, behaviourInfo.state);\n          }).getOr({});\n        }\n      });\n      return me;\n    };\n\n    var derive$1 = function (capabilities) {\n      return wrapAll(capabilities);\n    };\n    var simpleSchema = objOfOnly([\n      required$1('fields'),\n      required$1('name'),\n      defaulted('active', {}),\n      defaulted('apis', {}),\n      defaulted('state', NoState),\n      defaulted('extra', {})\n    ]);\n    var create$8 = function (data) {\n      var value = asRawOrDie$1('Creating behaviour: ' + data.name, simpleSchema, data);\n      return create$9(value.fields, value.name, value.active, value.apis, value.extra, value.state);\n    };\n    var modeSchema = objOfOnly([\n      required$1('branchKey'),\n      required$1('branches'),\n      required$1('name'),\n      defaulted('active', {}),\n      defaulted('apis', {}),\n      defaulted('state', NoState),\n      defaulted('extra', {})\n    ]);\n    var createModes = function (data) {\n      var value = asRawOrDie$1('Creating behaviour: ' + data.name, modeSchema, data);\n      return createModes$1(choose$1(value.branchKey, value.branches), value.name, value.active, value.apis, value.extra, value.state);\n    };\n    var revoke = constant$1(undefined);\n\n    var Receiving = create$8({\n      fields: ReceivingSchema,\n      name: 'receiving',\n      active: ActiveReceiving\n    });\n\n    var exhibit$6 = function (base, posConfig) {\n      return nu$7({\n        classes: [],\n        styles: posConfig.useFixed() ? {} : { position: 'relative' }\n      });\n    };\n\n    var ActivePosition = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit$6\n    });\n\n    var getDocument = function () {\n      return SugarElement.fromDom(document);\n    };\n\n    var focus$3 = function (element) {\n      return element.dom.focus();\n    };\n    var blur$1 = function (element) {\n      return element.dom.blur();\n    };\n    var hasFocus = function (element) {\n      var root = getRootNode(element).dom;\n      return element.dom === root.activeElement;\n    };\n    var active = function (root) {\n      if (root === void 0) {\n        root = getDocument();\n      }\n      return Optional.from(root.dom.activeElement).map(SugarElement.fromDom);\n    };\n    var search = function (element) {\n      return active(getRootNode(element)).filter(function (e) {\n        return element.dom.contains(e.dom);\n      });\n    };\n\n    var preserve$1 = function (f, container) {\n      var dos = getRootNode(container);\n      var refocus = active(dos).bind(function (focused) {\n        var hasFocus = function (elem) {\n          return eq(focused, elem);\n        };\n        return hasFocus(container) ? Optional.some(container) : descendant$1(container, hasFocus);\n      });\n      var result = f(container);\n      refocus.each(function (oldFocus) {\n        active(dos).filter(function (newFocus) {\n          return eq(newFocus, oldFocus);\n        }).fold(function () {\n          focus$3(oldFocus);\n        }, noop);\n      });\n      return result;\n    };\n\n    var NuPositionCss = function (position, left, top, right, bottom) {\n      var toPx = function (num) {\n        return num + 'px';\n      };\n      return {\n        position: position,\n        left: left.map(toPx),\n        top: top.map(toPx),\n        right: right.map(toPx),\n        bottom: bottom.map(toPx)\n      };\n    };\n    var toOptions = function (position) {\n      return __assign(__assign({}, position), { position: Optional.some(position.position) });\n    };\n    var applyPositionCss = function (element, position) {\n      setOptions(element, toOptions(position));\n    };\n\n    var adt$9 = Adt.generate([\n      { none: [] },\n      {\n        relative: [\n          'x',\n          'y',\n          'width',\n          'height'\n        ]\n      },\n      {\n        fixed: [\n          'x',\n          'y',\n          'width',\n          'height'\n        ]\n      }\n    ]);\n    var positionWithDirection = function (posName, decision, x, y, width, height) {\n      var decisionRect = decision.rect;\n      var decisionX = decisionRect.x - x;\n      var decisionY = decisionRect.y - y;\n      var decisionWidth = decisionRect.width;\n      var decisionHeight = decisionRect.height;\n      var decisionRight = width - (decisionX + decisionWidth);\n      var decisionBottom = height - (decisionY + decisionHeight);\n      var left = Optional.some(decisionX);\n      var top = Optional.some(decisionY);\n      var right = Optional.some(decisionRight);\n      var bottom = Optional.some(decisionBottom);\n      var none = Optional.none();\n      return cata$2(decision.direction, function () {\n        return NuPositionCss(posName, left, top, none, none);\n      }, function () {\n        return NuPositionCss(posName, none, top, right, none);\n      }, function () {\n        return NuPositionCss(posName, left, none, none, bottom);\n      }, function () {\n        return NuPositionCss(posName, none, none, right, bottom);\n      }, function () {\n        return NuPositionCss(posName, left, top, none, none);\n      }, function () {\n        return NuPositionCss(posName, left, none, none, bottom);\n      }, function () {\n        return NuPositionCss(posName, left, top, none, none);\n      }, function () {\n        return NuPositionCss(posName, none, top, right, none);\n      });\n    };\n    var reposition = function (origin, decision) {\n      return origin.fold(function () {\n        var decisionRect = decision.rect;\n        return NuPositionCss('absolute', Optional.some(decisionRect.x), Optional.some(decisionRect.y), Optional.none(), Optional.none());\n      }, function (x, y, width, height) {\n        return positionWithDirection('absolute', decision, x, y, width, height);\n      }, function (x, y, width, height) {\n        return positionWithDirection('fixed', decision, x, y, width, height);\n      });\n    };\n    var toBox = function (origin, element) {\n      var rel = curry(find$2, element);\n      var position = origin.fold(rel, rel, function () {\n        var scroll = get$9();\n        return find$2(element).translate(-scroll.left, -scroll.top);\n      });\n      var width = getOuter$1(element);\n      var height = getOuter$2(element);\n      return bounds(position.left, position.top, width, height);\n    };\n    var viewport = function (origin, getBounds) {\n      return getBounds.fold(function () {\n        return origin.fold(win, win, bounds);\n      }, function (b) {\n        return origin.fold(b, b, function () {\n          var bounds$1 = b();\n          var pos = translate$2(origin, bounds$1.x, bounds$1.y);\n          return bounds(pos.left, pos.top, bounds$1.width, bounds$1.height);\n        });\n      });\n    };\n    var translate$2 = function (origin, x, y) {\n      var pos = SugarPosition(x, y);\n      var removeScroll = function () {\n        var outerScroll = get$9();\n        return pos.translate(-outerScroll.left, -outerScroll.top);\n      };\n      return origin.fold(constant$1(pos), constant$1(pos), removeScroll);\n    };\n    var cata$1 = function (subject, onNone, onRelative, onFixed) {\n      return subject.fold(onNone, onRelative, onFixed);\n    };\n    adt$9.none;\n    var relative$1 = adt$9.relative;\n    var fixed$1 = adt$9.fixed;\n\n    var anchor = function (anchorBox, origin) {\n      return {\n        anchorBox: anchorBox,\n        origin: origin\n      };\n    };\n    var box = function (anchorBox, origin) {\n      return anchor(anchorBox, origin);\n    };\n\n    var placementAttribute = 'data-alloy-placement';\n    var setPlacement$1 = function (element, placement) {\n      set$8(element, placementAttribute, placement);\n    };\n    var getPlacement = function (element) {\n      return getOpt(element, placementAttribute);\n    };\n    var reset$2 = function (element) {\n      return remove$7(element, placementAttribute);\n    };\n\n    var adt$8 = Adt.generate([\n      { fit: ['reposition'] },\n      {\n        nofit: [\n          'reposition',\n          'visibleW',\n          'visibleH',\n          'isVisible'\n        ]\n      }\n    ]);\n    var determinePosition = function (box, bounds) {\n      var boundsX = bounds.x, boundsY = bounds.y, boundsRight = bounds.right, boundsBottom = bounds.bottom;\n      var x = box.x, y = box.y, right = box.right, bottom = box.bottom, width = box.width, height = box.height;\n      var xInBounds = x >= boundsX && x <= boundsRight;\n      var yInBounds = y >= boundsY && y <= boundsBottom;\n      var originInBounds = xInBounds && yInBounds;\n      var rightInBounds = right <= boundsRight && right >= boundsX;\n      var bottomInBounds = bottom <= boundsBottom && bottom >= boundsY;\n      var sizeInBounds = rightInBounds && bottomInBounds;\n      var visibleW = Math.min(width, x >= boundsX ? boundsRight - x : right - boundsX);\n      var visibleH = Math.min(height, y >= boundsY ? boundsBottom - y : bottom - boundsY);\n      return {\n        originInBounds: originInBounds,\n        sizeInBounds: sizeInBounds,\n        visibleW: visibleW,\n        visibleH: visibleH\n      };\n    };\n    var calcReposition = function (box, bounds$1) {\n      var boundsX = bounds$1.x, boundsY = bounds$1.y, boundsRight = bounds$1.right, boundsBottom = bounds$1.bottom;\n      var x = box.x, y = box.y, width = box.width, height = box.height;\n      var maxX = Math.max(boundsX, boundsRight - width);\n      var maxY = Math.max(boundsY, boundsBottom - height);\n      var restrictedX = clamp$1(x, boundsX, maxX);\n      var restrictedY = clamp$1(y, boundsY, maxY);\n      var restrictedWidth = Math.min(restrictedX + width, boundsRight) - restrictedX;\n      var restrictedHeight = Math.min(restrictedY + height, boundsBottom) - restrictedY;\n      return bounds(restrictedX, restrictedY, restrictedWidth, restrictedHeight);\n    };\n    var calcMaxSizes = function (direction, box, bounds) {\n      var upAvailable = constant$1(box.bottom - bounds.y);\n      var downAvailable = constant$1(bounds.bottom - box.y);\n      var maxHeight = cataVertical(direction, downAvailable, downAvailable, upAvailable);\n      var westAvailable = constant$1(box.right - bounds.x);\n      var eastAvailable = constant$1(bounds.right - box.x);\n      var maxWidth = cataHorizontal(direction, eastAvailable, eastAvailable, westAvailable);\n      return {\n        maxWidth: maxWidth,\n        maxHeight: maxHeight\n      };\n    };\n    var attempt = function (candidate, width, height, bounds$1) {\n      var bubble = candidate.bubble;\n      var bubbleOffset = bubble.offset;\n      var adjustedBounds = adjustBounds(bounds$1, candidate.restriction, bubbleOffset);\n      var newX = candidate.x + bubbleOffset.left;\n      var newY = candidate.y + bubbleOffset.top;\n      var box = bounds(newX, newY, width, height);\n      var _a = determinePosition(box, adjustedBounds), originInBounds = _a.originInBounds, sizeInBounds = _a.sizeInBounds, visibleW = _a.visibleW, visibleH = _a.visibleH;\n      var fits = originInBounds && sizeInBounds;\n      var fittedBox = fits ? box : calcReposition(box, adjustedBounds);\n      var isPartlyVisible = fittedBox.width > 0 && fittedBox.height > 0;\n      var _b = calcMaxSizes(candidate.direction, fittedBox, bounds$1), maxWidth = _b.maxWidth, maxHeight = _b.maxHeight;\n      var reposition = {\n        rect: fittedBox,\n        maxHeight: maxHeight,\n        maxWidth: maxWidth,\n        direction: candidate.direction,\n        placement: candidate.placement,\n        classes: {\n          on: bubble.classesOn,\n          off: bubble.classesOff\n        },\n        layout: candidate.label,\n        testY: newY\n      };\n      return fits || candidate.alwaysFit ? adt$8.fit(reposition) : adt$8.nofit(reposition, visibleW, visibleH, isPartlyVisible);\n    };\n    var attempts = function (element, candidates, anchorBox, elementBox, bubbles, bounds) {\n      var panelWidth = elementBox.width;\n      var panelHeight = elementBox.height;\n      var attemptBestFit = function (layout, reposition, visibleW, visibleH, isVisible) {\n        var next = layout(anchorBox, elementBox, bubbles, element, bounds);\n        var attemptLayout = attempt(next, panelWidth, panelHeight, bounds);\n        return attemptLayout.fold(constant$1(attemptLayout), function (newReposition, newVisibleW, newVisibleH, newIsVisible) {\n          var improved = isVisible === newIsVisible ? newVisibleH > visibleH || newVisibleW > visibleW : !isVisible && newIsVisible;\n          return improved ? attemptLayout : adt$8.nofit(reposition, visibleW, visibleH, isVisible);\n        });\n      };\n      var abc = foldl(candidates, function (b, a) {\n        var bestNext = curry(attemptBestFit, a);\n        return b.fold(constant$1(b), bestNext);\n      }, adt$8.nofit({\n        rect: anchorBox,\n        maxHeight: elementBox.height,\n        maxWidth: elementBox.width,\n        direction: southeast$3(),\n        placement: 'southeast',\n        classes: {\n          on: [],\n          off: []\n        },\n        layout: 'none',\n        testY: anchorBox.y\n      }, -1, -1, false));\n      return abc.fold(identity$1, identity$1);\n    };\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var destroyable = function () {\n      return singleton(function (s) {\n        return s.destroy();\n      });\n    };\n    var unbindable = function () {\n      return singleton(function (s) {\n        return s.unbind();\n      });\n    };\n    var api$1 = function () {\n      var subject = destroyable();\n      var run = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { run: run });\n    };\n    var value$1 = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var filter = always;\n    var bind = function (element, event, handler) {\n      return bind$2(element, event, filter, handler);\n    };\n    var capture = function (element, event, handler) {\n      return capture$1(element, event, filter, handler);\n    };\n    var fromRawEvent = fromRawEvent$1;\n\n    var properties = [\n      'top',\n      'bottom',\n      'right',\n      'left'\n    ];\n    var timerAttr = 'data-alloy-transition-timer';\n    var isTransitioning$1 = function (element, transition) {\n      return hasAll(element, transition.classes);\n    };\n    var shouldApplyTransitionCss = function (transition, decision, lastPlacement) {\n      return lastPlacement.exists(function (placer) {\n        var mode = transition.mode;\n        return mode === 'all' ? true : placer[mode] !== decision[mode];\n      });\n    };\n    var hasChanges = function (position, intermediate) {\n      var round = function (value) {\n        return parseFloat(value).toFixed(3);\n      };\n      return find$4(intermediate, function (value, key) {\n        var newValue = position[key].map(round);\n        var val = value.map(round);\n        return !equals(newValue, val);\n      }).isSome();\n    };\n    var getTransitionDuration = function (element) {\n      var get = function (name) {\n        var style = get$c(element, name);\n        var times = isString(style) ? style.split(/\\s*,\\s*/) : [];\n        return filter$2(times, isNotEmpty);\n      };\n      var parse = function (value) {\n        if (isString(value) && /^[\\d.]+/.test(value)) {\n          var num = parseFloat(value);\n          return endsWith(value, 'ms') ? num : num * 1000;\n        } else {\n          return 0;\n        }\n      };\n      var delay = get('transition-delay');\n      var duration = get('transition-duration');\n      return foldl(duration, function (acc, dur, i) {\n        var time = parse(delay[i]) + parse(dur);\n        return Math.max(acc, time);\n      }, 0);\n    };\n    var setupTransitionListeners = function (element, transition) {\n      var transitionEnd = unbindable();\n      var transitionCancel = unbindable();\n      var timer;\n      var isSourceTransition = function (e) {\n        var _a;\n        var pseudoElement = (_a = e.raw.pseudoElement) !== null && _a !== void 0 ? _a : '';\n        return eq(e.target, element) && isEmpty(pseudoElement) && contains$2(properties, e.raw.propertyName);\n      };\n      var transitionDone = function (e) {\n        if (isNullable(e) || isSourceTransition(e)) {\n          transitionEnd.clear();\n          transitionCancel.clear();\n          var type = e === null || e === void 0 ? void 0 : e.raw.type;\n          if (isNullable(type) || type === transitionend()) {\n            clearTimeout(timer);\n            remove$7(element, timerAttr);\n            remove$1(element, transition.classes);\n          }\n        }\n      };\n      var transitionStarted = function () {\n        transitionEnd.set(bind(element, transitionend(), transitionDone));\n        transitionCancel.set(bind(element, transitioncancel(), transitionDone));\n      };\n      if ('ontransitionstart' in element.dom) {\n        var transitionStart_1 = bind(element, transitionstart(), function (e) {\n          if (isSourceTransition(e)) {\n            transitionStart_1.unbind();\n            transitionStarted();\n          }\n        });\n      } else {\n        transitionStarted();\n      }\n      var duration = getTransitionDuration(element);\n      requestAnimationFrame(function () {\n        timer = setTimeout(transitionDone, duration + 17);\n        set$8(element, timerAttr, timer);\n      });\n    };\n    var startTransitioning = function (element, transition) {\n      add$1(element, transition.classes);\n      getOpt(element, timerAttr).each(function (timerId) {\n        clearTimeout(parseInt(timerId, 10));\n        remove$7(element, timerAttr);\n      });\n      setupTransitionListeners(element, transition);\n    };\n    var applyTransitionCss = function (element, origin, position, transition, decision, lastPlacement) {\n      var shouldTransition = shouldApplyTransitionCss(transition, decision, lastPlacement);\n      if (shouldTransition || isTransitioning$1(element, transition)) {\n        set$7(element, 'position', position.position);\n        var rect = toBox(origin, element);\n        var intermediatePosition_1 = reposition(origin, __assign(__assign({}, decision), { rect: rect }));\n        var intermediateCssOptions = mapToObject(properties, function (prop) {\n          return intermediatePosition_1[prop];\n        });\n        if (hasChanges(position, intermediateCssOptions)) {\n          setOptions(element, intermediateCssOptions);\n          if (shouldTransition) {\n            startTransitioning(element, transition);\n          }\n          reflow(element);\n        }\n      } else {\n        remove$1(element, transition.classes);\n      }\n    };\n\n    var elementSize = function (p) {\n      return {\n        width: getOuter$1(p),\n        height: getOuter$2(p)\n      };\n    };\n    var layout = function (anchorBox, element, bubbles, options) {\n      remove$6(element, 'max-height');\n      remove$6(element, 'max-width');\n      var elementBox = elementSize(element);\n      return attempts(element, options.preference, anchorBox, elementBox, bubbles, options.bounds);\n    };\n    var setClasses = function (element, decision) {\n      var classInfo = decision.classes;\n      remove$1(element, classInfo.off);\n      add$1(element, classInfo.on);\n    };\n    var setHeight = function (element, decision, options) {\n      var maxHeightFunction = options.maxHeightFunction;\n      maxHeightFunction(element, decision.maxHeight);\n    };\n    var setWidth = function (element, decision, options) {\n      var maxWidthFunction = options.maxWidthFunction;\n      maxWidthFunction(element, decision.maxWidth);\n    };\n    var position$2 = function (element, decision, options) {\n      var positionCss = reposition(options.origin, decision);\n      options.transition.each(function (transition) {\n        applyTransitionCss(element, options.origin, positionCss, transition, decision, options.lastPlacement);\n      });\n      applyPositionCss(element, positionCss);\n    };\n    var setPlacement = function (element, decision) {\n      setPlacement$1(element, decision.placement);\n    };\n\n    var setMaxHeight = function (element, maxHeight) {\n      setMax$1(element, Math.floor(maxHeight));\n    };\n    var anchored = constant$1(function (element, available) {\n      setMaxHeight(element, available);\n      setAll(element, {\n        'overflow-x': 'hidden',\n        'overflow-y': 'auto'\n      });\n    });\n    var expandable$1 = constant$1(function (element, available) {\n      setMaxHeight(element, available);\n    });\n\n    var defaultOr = function (options, key, dephault) {\n      return options[key] === undefined ? dephault : options[key];\n    };\n    var simple = function (anchor, element, bubble, layouts, lastPlacement, getBounds, overrideOptions, transition) {\n      var maxHeightFunction = defaultOr(overrideOptions, 'maxHeightFunction', anchored());\n      var maxWidthFunction = defaultOr(overrideOptions, 'maxWidthFunction', noop);\n      var anchorBox = anchor.anchorBox;\n      var origin = anchor.origin;\n      var options = {\n        bounds: viewport(origin, getBounds),\n        origin: origin,\n        preference: layouts,\n        maxHeightFunction: maxHeightFunction,\n        maxWidthFunction: maxWidthFunction,\n        lastPlacement: lastPlacement,\n        transition: transition\n      };\n      return go(anchorBox, element, bubble, options);\n    };\n    var go = function (anchorBox, element, bubble, options) {\n      var decision = layout(anchorBox, element, bubble, options);\n      position$2(element, decision, options);\n      setPlacement(element, decision);\n      setClasses(element, decision);\n      setHeight(element, decision, options);\n      setWidth(element, decision, options);\n      return {\n        layout: decision.layout,\n        placement: decision.placement\n      };\n    };\n\n    var allAlignments = [\n      'valignCentre',\n      'alignLeft',\n      'alignRight',\n      'alignCentre',\n      'top',\n      'bottom',\n      'left',\n      'right',\n      'inset'\n    ];\n    var nu$5 = function (xOffset, yOffset, classes, insetModifier) {\n      if (insetModifier === void 0) {\n        insetModifier = 1;\n      }\n      var insetXOffset = xOffset * insetModifier;\n      var insetYOffset = yOffset * insetModifier;\n      var getClasses = function (prop) {\n        return get$e(classes, prop).getOr([]);\n      };\n      var make = function (xDelta, yDelta, alignmentsOn) {\n        var alignmentsOff = difference(allAlignments, alignmentsOn);\n        return {\n          offset: SugarPosition(xDelta, yDelta),\n          classesOn: bind$3(alignmentsOn, getClasses),\n          classesOff: bind$3(alignmentsOff, getClasses)\n        };\n      };\n      return {\n        southeast: function () {\n          return make(-xOffset, yOffset, [\n            'top',\n            'alignLeft'\n          ]);\n        },\n        southwest: function () {\n          return make(xOffset, yOffset, [\n            'top',\n            'alignRight'\n          ]);\n        },\n        south: function () {\n          return make(-xOffset / 2, yOffset, [\n            'top',\n            'alignCentre'\n          ]);\n        },\n        northeast: function () {\n          return make(-xOffset, -yOffset, [\n            'bottom',\n            'alignLeft'\n          ]);\n        },\n        northwest: function () {\n          return make(xOffset, -yOffset, [\n            'bottom',\n            'alignRight'\n          ]);\n        },\n        north: function () {\n          return make(-xOffset / 2, -yOffset, [\n            'bottom',\n            'alignCentre'\n          ]);\n        },\n        east: function () {\n          return make(xOffset, -yOffset / 2, [\n            'valignCentre',\n            'left'\n          ]);\n        },\n        west: function () {\n          return make(-xOffset, -yOffset / 2, [\n            'valignCentre',\n            'right'\n          ]);\n        },\n        insetNortheast: function () {\n          return make(insetXOffset, insetYOffset, [\n            'top',\n            'alignLeft',\n            'inset'\n          ]);\n        },\n        insetNorthwest: function () {\n          return make(-insetXOffset, insetYOffset, [\n            'top',\n            'alignRight',\n            'inset'\n          ]);\n        },\n        insetNorth: function () {\n          return make(-insetXOffset / 2, insetYOffset, [\n            'top',\n            'alignCentre',\n            'inset'\n          ]);\n        },\n        insetSoutheast: function () {\n          return make(insetXOffset, -insetYOffset, [\n            'bottom',\n            'alignLeft',\n            'inset'\n          ]);\n        },\n        insetSouthwest: function () {\n          return make(-insetXOffset, -insetYOffset, [\n            'bottom',\n            'alignRight',\n            'inset'\n          ]);\n        },\n        insetSouth: function () {\n          return make(-insetXOffset / 2, -insetYOffset, [\n            'bottom',\n            'alignCentre',\n            'inset'\n          ]);\n        },\n        insetEast: function () {\n          return make(-insetXOffset, -insetYOffset / 2, [\n            'valignCentre',\n            'right',\n            'inset'\n          ]);\n        },\n        insetWest: function () {\n          return make(insetXOffset, -insetYOffset / 2, [\n            'valignCentre',\n            'left',\n            'inset'\n          ]);\n        }\n      };\n    };\n    var fallback = function () {\n      return nu$5(0, 0, {});\n    };\n\n    var nu$4 = identity$1;\n\n    var onDirection = function (isLtr, isRtl) {\n      return function (element) {\n        return getDirection(element) === 'rtl' ? isRtl : isLtr;\n      };\n    };\n    var getDirection = function (element) {\n      return get$c(element, 'direction') === 'rtl' ? 'rtl' : 'ltr';\n    };\n\n    var AttributeValue;\n    (function (AttributeValue) {\n      AttributeValue['TopToBottom'] = 'toptobottom';\n      AttributeValue['BottomToTop'] = 'bottomtotop';\n    }(AttributeValue || (AttributeValue = {})));\n    var Attribute = 'data-alloy-vertical-dir';\n    var isBottomToTopDir = function (el) {\n      return closest$2(el, function (current) {\n        return isElement$2(current) && get$d(current, 'data-alloy-vertical-dir') === AttributeValue.BottomToTop;\n      });\n    };\n\n    var schema$y = function () {\n      return optionObjOf('layouts', [\n        required$1('onLtr'),\n        required$1('onRtl'),\n        option('onBottomLtr'),\n        option('onBottomRtl')\n      ]);\n    };\n    var get$4 = function (elem, info, defaultLtr, defaultRtl, defaultBottomLtr, defaultBottomRtl, dirElement) {\n      var isBottomToTop = dirElement.map(isBottomToTopDir).getOr(false);\n      var customLtr = info.layouts.map(function (ls) {\n        return ls.onLtr(elem);\n      });\n      var customRtl = info.layouts.map(function (ls) {\n        return ls.onRtl(elem);\n      });\n      var ltr = isBottomToTop ? info.layouts.bind(function (ls) {\n        return ls.onBottomLtr.map(function (f) {\n          return f(elem);\n        });\n      }).or(customLtr).getOr(defaultBottomLtr) : customLtr.getOr(defaultLtr);\n      var rtl = isBottomToTop ? info.layouts.bind(function (ls) {\n        return ls.onBottomRtl.map(function (f) {\n          return f(elem);\n        });\n      }).or(customRtl).getOr(defaultBottomRtl) : customRtl.getOr(defaultRtl);\n      var f = onDirection(ltr, rtl);\n      return f(elem);\n    };\n\n    var placement$4 = function (component, anchorInfo, origin) {\n      var hotspot = anchorInfo.hotspot;\n      var anchorBox = toBox(origin, hotspot.element);\n      var layouts = get$4(component.element, anchorInfo, belowOrAbove(), belowOrAboveRtl(), aboveOrBelow(), aboveOrBelowRtl(), Optional.some(anchorInfo.hotspot.element));\n      return Optional.some(nu$4({\n        anchorBox: anchorBox,\n        bubble: anchorInfo.bubble.getOr(fallback()),\n        overrides: anchorInfo.overrides,\n        layouts: layouts,\n        placer: Optional.none()\n      }));\n    };\n    var HotspotAnchor = [\n      required$1('hotspot'),\n      option('bubble'),\n      defaulted('overrides', {}),\n      schema$y(),\n      output$1('placement', placement$4)\n    ];\n\n    var placement$3 = function (component, anchorInfo, origin) {\n      var pos = translate$2(origin, anchorInfo.x, anchorInfo.y);\n      var anchorBox = bounds(pos.left, pos.top, anchorInfo.width, anchorInfo.height);\n      var layouts = get$4(component.element, anchorInfo, all$1(), allRtl$1(), all$1(), allRtl$1(), Optional.none());\n      return Optional.some(nu$4({\n        anchorBox: anchorBox,\n        bubble: anchorInfo.bubble,\n        overrides: anchorInfo.overrides,\n        layouts: layouts,\n        placer: Optional.none()\n      }));\n    };\n    var MakeshiftAnchor = [\n      required$1('x'),\n      required$1('y'),\n      defaulted('height', 0),\n      defaulted('width', 0),\n      defaulted('bubble', fallback()),\n      defaulted('overrides', {}),\n      schema$y(),\n      output$1('placement', placement$3)\n    ];\n\n    var adt$7 = Adt.generate([\n      { screen: ['point'] },\n      {\n        absolute: [\n          'point',\n          'scrollLeft',\n          'scrollTop'\n        ]\n      }\n    ]);\n    var toFixed = function (pos) {\n      return pos.fold(identity$1, function (point, scrollLeft, scrollTop) {\n        return point.translate(-scrollLeft, -scrollTop);\n      });\n    };\n    var toAbsolute = function (pos) {\n      return pos.fold(identity$1, identity$1);\n    };\n    var sum = function (points) {\n      return foldl(points, function (b, a) {\n        return b.translate(a.left, a.top);\n      }, SugarPosition(0, 0));\n    };\n    var sumAsFixed = function (positions) {\n      var points = map$2(positions, toFixed);\n      return sum(points);\n    };\n    var sumAsAbsolute = function (positions) {\n      var points = map$2(positions, toAbsolute);\n      return sum(points);\n    };\n    var screen = adt$7.screen;\n    var absolute$1 = adt$7.absolute;\n\n    var getOffset = function (component, origin, anchorInfo) {\n      var win = defaultView(anchorInfo.root).dom;\n      var hasSameOwner = function (frame) {\n        var frameOwner = owner$4(frame);\n        var compOwner = owner$4(component.element);\n        return eq(frameOwner, compOwner);\n      };\n      return Optional.from(win.frameElement).map(SugarElement.fromDom).filter(hasSameOwner).map(absolute$3);\n    };\n    var getRootPoint = function (component, origin, anchorInfo) {\n      var doc = owner$4(component.element);\n      var outerScroll = get$9(doc);\n      var offset = getOffset(component, origin, anchorInfo).getOr(outerScroll);\n      return absolute$1(offset, outerScroll.left, outerScroll.top);\n    };\n\n    var getBox = function (left, top, width, height) {\n      var point = screen(SugarPosition(left, top));\n      return Optional.some(pointed(point, width, height));\n    };\n    var calcNewAnchor = function (optBox, rootPoint, anchorInfo, origin, elem) {\n      return optBox.map(function (box) {\n        var points = [\n          rootPoint,\n          box.point\n        ];\n        var topLeft = cata$1(origin, function () {\n          return sumAsAbsolute(points);\n        }, function () {\n          return sumAsAbsolute(points);\n        }, function () {\n          return sumAsFixed(points);\n        });\n        var anchorBox = rect(topLeft.left, topLeft.top, box.width, box.height);\n        var layoutsLtr = anchorInfo.showAbove ? aboveOrBelow() : belowOrAbove();\n        var layoutsRtl = anchorInfo.showAbove ? aboveOrBelowRtl() : belowOrAboveRtl();\n        var layouts = get$4(elem, anchorInfo, layoutsLtr, layoutsRtl, layoutsLtr, layoutsRtl, Optional.none());\n        return nu$4({\n          anchorBox: anchorBox,\n          bubble: anchorInfo.bubble.getOr(fallback()),\n          overrides: anchorInfo.overrides,\n          layouts: layouts,\n          placer: Optional.none()\n        });\n      });\n    };\n\n    var placement$2 = function (component, anchorInfo, origin) {\n      var rootPoint = getRootPoint(component, origin, anchorInfo);\n      return anchorInfo.node.filter(inBody).bind(function (target) {\n        var rect = target.dom.getBoundingClientRect();\n        var nodeBox = getBox(rect.left, rect.top, rect.width, rect.height);\n        var elem = anchorInfo.node.getOr(component.element);\n        return calcNewAnchor(nodeBox, rootPoint, anchorInfo, origin, elem);\n      });\n    };\n    var NodeAnchor = [\n      required$1('node'),\n      required$1('root'),\n      option('bubble'),\n      schema$y(),\n      defaulted('overrides', {}),\n      defaulted('showAbove', false),\n      output$1('placement', placement$2)\n    ];\n\n    var zeroWidth = '\\uFEFF';\n    var nbsp = '\\xA0';\n\n    var create$7 = function (start, soffset, finish, foffset) {\n      return {\n        start: start,\n        soffset: soffset,\n        finish: finish,\n        foffset: foffset\n      };\n    };\n    var SimRange = { create: create$7 };\n\n    var adt$6 = Adt.generate([\n      { before: ['element'] },\n      {\n        on: [\n          'element',\n          'offset'\n        ]\n      },\n      { after: ['element'] }\n    ]);\n    var cata = function (subject, onBefore, onOn, onAfter) {\n      return subject.fold(onBefore, onOn, onAfter);\n    };\n    var getStart$1 = function (situ) {\n      return situ.fold(identity$1, identity$1, identity$1);\n    };\n    var before = adt$6.before;\n    var on$1 = adt$6.on;\n    var after$1 = adt$6.after;\n    var Situ = {\n      before: before,\n      on: on$1,\n      after: after$1,\n      cata: cata,\n      getStart: getStart$1\n    };\n\n    var adt$5 = Adt.generate([\n      { domRange: ['rng'] },\n      {\n        relative: [\n          'startSitu',\n          'finishSitu'\n        ]\n      },\n      {\n        exact: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      }\n    ]);\n    var exactFromRange = function (simRange) {\n      return adt$5.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset);\n    };\n    var getStart = function (selection) {\n      return selection.match({\n        domRange: function (rng) {\n          return SugarElement.fromDom(rng.startContainer);\n        },\n        relative: function (startSitu, _finishSitu) {\n          return Situ.getStart(startSitu);\n        },\n        exact: function (start, _soffset, _finish, _foffset) {\n          return start;\n        }\n      });\n    };\n    var domRange = adt$5.domRange;\n    var relative = adt$5.relative;\n    var exact = adt$5.exact;\n    var getWin = function (selection) {\n      var start = getStart(selection);\n      return defaultView(start);\n    };\n    var range$1 = SimRange.create;\n    var SimSelection = {\n      domRange: domRange,\n      relative: relative,\n      exact: exact,\n      exactFromRange: exactFromRange,\n      getWin: getWin,\n      range: range$1\n    };\n\n    var setStart = function (rng, situ) {\n      situ.fold(function (e) {\n        rng.setStartBefore(e.dom);\n      }, function (e, o) {\n        rng.setStart(e.dom, o);\n      }, function (e) {\n        rng.setStartAfter(e.dom);\n      });\n    };\n    var setFinish = function (rng, situ) {\n      situ.fold(function (e) {\n        rng.setEndBefore(e.dom);\n      }, function (e, o) {\n        rng.setEnd(e.dom, o);\n      }, function (e) {\n        rng.setEndAfter(e.dom);\n      });\n    };\n    var relativeToNative = function (win, startSitu, finishSitu) {\n      var range = win.document.createRange();\n      setStart(range, startSitu);\n      setFinish(range, finishSitu);\n      return range;\n    };\n    var exactToNative = function (win, start, soffset, finish, foffset) {\n      var rng = win.document.createRange();\n      rng.setStart(start.dom, soffset);\n      rng.setEnd(finish.dom, foffset);\n      return rng;\n    };\n    var toRect = function (rect) {\n      return {\n        left: rect.left,\n        top: rect.top,\n        right: rect.right,\n        bottom: rect.bottom,\n        width: rect.width,\n        height: rect.height\n      };\n    };\n    var getFirstRect$1 = function (rng) {\n      var rects = rng.getClientRects();\n      var rect = rects.length > 0 ? rects[0] : rng.getBoundingClientRect();\n      return rect.width > 0 || rect.height > 0 ? Optional.some(rect).map(toRect) : Optional.none();\n    };\n    var getBounds$2 = function (rng) {\n      var rect = rng.getBoundingClientRect();\n      return rect.width > 0 || rect.height > 0 ? Optional.some(rect).map(toRect) : Optional.none();\n    };\n\n    var adt$4 = Adt.generate([\n      {\n        ltr: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      },\n      {\n        rtl: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      }\n    ]);\n    var fromRange = function (win, type, range) {\n      return type(SugarElement.fromDom(range.startContainer), range.startOffset, SugarElement.fromDom(range.endContainer), range.endOffset);\n    };\n    var getRanges = function (win, selection) {\n      return selection.match({\n        domRange: function (rng) {\n          return {\n            ltr: constant$1(rng),\n            rtl: Optional.none\n          };\n        },\n        relative: function (startSitu, finishSitu) {\n          return {\n            ltr: cached(function () {\n              return relativeToNative(win, startSitu, finishSitu);\n            }),\n            rtl: cached(function () {\n              return Optional.some(relativeToNative(win, finishSitu, startSitu));\n            })\n          };\n        },\n        exact: function (start, soffset, finish, foffset) {\n          return {\n            ltr: cached(function () {\n              return exactToNative(win, start, soffset, finish, foffset);\n            }),\n            rtl: cached(function () {\n              return Optional.some(exactToNative(win, finish, foffset, start, soffset));\n            })\n          };\n        }\n      });\n    };\n    var doDiagnose = function (win, ranges) {\n      var rng = ranges.ltr();\n      if (rng.collapsed) {\n        var reversed = ranges.rtl().filter(function (rev) {\n          return rev.collapsed === false;\n        });\n        return reversed.map(function (rev) {\n          return adt$4.rtl(SugarElement.fromDom(rev.endContainer), rev.endOffset, SugarElement.fromDom(rev.startContainer), rev.startOffset);\n        }).getOrThunk(function () {\n          return fromRange(win, adt$4.ltr, rng);\n        });\n      } else {\n        return fromRange(win, adt$4.ltr, rng);\n      }\n    };\n    var diagnose = function (win, selection) {\n      var ranges = getRanges(win, selection);\n      return doDiagnose(win, ranges);\n    };\n    var asLtrRange = function (win, selection) {\n      var diagnosis = diagnose(win, selection);\n      return diagnosis.match({\n        ltr: function (start, soffset, finish, foffset) {\n          var rng = win.document.createRange();\n          rng.setStart(start.dom, soffset);\n          rng.setEnd(finish.dom, foffset);\n          return rng;\n        },\n        rtl: function (start, soffset, finish, foffset) {\n          var rng = win.document.createRange();\n          rng.setStart(finish.dom, foffset);\n          rng.setEnd(start.dom, soffset);\n          return rng;\n        }\n      });\n    };\n    adt$4.ltr;\n    adt$4.rtl;\n\n    var NodeValue = function (is, name) {\n      var get = function (element) {\n        if (!is(element)) {\n          throw new Error('Can only get ' + name + ' value of a ' + name + ' node');\n        }\n        return getOption(element).getOr('');\n      };\n      var getOption = function (element) {\n        return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();\n      };\n      var set = function (element, value) {\n        if (!is(element)) {\n          throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');\n        }\n        element.dom.nodeValue = value;\n      };\n      return {\n        get: get,\n        getOption: getOption,\n        set: set\n      };\n    };\n\n    var api = NodeValue(isText$1, 'text');\n    var get$3 = function (element) {\n      return api.get(element);\n    };\n    var getOption = function (element) {\n      return api.getOption(element);\n    };\n\n    var getEnd = function (element) {\n      return name$2(element) === 'img' ? 1 : getOption(element).fold(function () {\n        return children(element).length;\n      }, function (v) {\n        return v.length;\n      });\n    };\n    var isTextNodeWithCursorPosition = function (el) {\n      return getOption(el).filter(function (text) {\n        return text.trim().length !== 0 || text.indexOf(nbsp) > -1;\n      }).isSome();\n    };\n    var elementsWithCursorPosition = [\n      'img',\n      'br'\n    ];\n    var isCursorPosition = function (elem) {\n      var hasCursorPosition = isTextNodeWithCursorPosition(elem);\n      return hasCursorPosition || contains$2(elementsWithCursorPosition, name$2(elem));\n    };\n\n    var last$1 = function (element) {\n      return descendantRtl(element, isCursorPosition);\n    };\n    var descendantRtl = function (scope, predicate) {\n      var descend = function (element) {\n        var children$1 = children(element);\n        for (var i = children$1.length - 1; i >= 0; i--) {\n          var child = children$1[i];\n          if (predicate(child)) {\n            return Optional.some(child);\n          }\n          var res = descend(child);\n          if (res.isSome()) {\n            return res;\n          }\n        }\n        return Optional.none();\n      };\n      return descend(scope);\n    };\n\n    var descendants = function (scope, selector) {\n      return all$3(selector, scope);\n    };\n\n    var makeRange = function (start, soffset, finish, foffset) {\n      var doc = owner$4(start);\n      var rng = doc.dom.createRange();\n      rng.setStart(start.dom, soffset);\n      rng.setEnd(finish.dom, foffset);\n      return rng;\n    };\n    var after = function (start, soffset, finish, foffset) {\n      var r = makeRange(start, soffset, finish, foffset);\n      var same = eq(start, finish) && soffset === foffset;\n      return r.collapsed && !same;\n    };\n\n    var getNativeSelection = function (win) {\n      return Optional.from(win.getSelection());\n    };\n    var readRange = function (selection) {\n      if (selection.rangeCount > 0) {\n        var firstRng = selection.getRangeAt(0);\n        var lastRng = selection.getRangeAt(selection.rangeCount - 1);\n        return Optional.some(SimRange.create(SugarElement.fromDom(firstRng.startContainer), firstRng.startOffset, SugarElement.fromDom(lastRng.endContainer), lastRng.endOffset));\n      } else {\n        return Optional.none();\n      }\n    };\n    var doGetExact = function (selection) {\n      if (selection.anchorNode === null || selection.focusNode === null) {\n        return readRange(selection);\n      } else {\n        var anchor = SugarElement.fromDom(selection.anchorNode);\n        var focus_1 = SugarElement.fromDom(selection.focusNode);\n        return after(anchor, selection.anchorOffset, focus_1, selection.focusOffset) ? Optional.some(SimRange.create(anchor, selection.anchorOffset, focus_1, selection.focusOffset)) : readRange(selection);\n      }\n    };\n    var getExact = function (win) {\n      return getNativeSelection(win).filter(function (sel) {\n        return sel.rangeCount > 0;\n      }).bind(doGetExact);\n    };\n    var getFirstRect = function (win, selection) {\n      var rng = asLtrRange(win, selection);\n      return getFirstRect$1(rng);\n    };\n    var getBounds$1 = function (win, selection) {\n      var rng = asLtrRange(win, selection);\n      return getBounds$2(rng);\n    };\n\n    var point$1 = function (element, offset) {\n      return {\n        element: element,\n        offset: offset\n      };\n    };\n    var descendOnce$1 = function (element, offset) {\n      var children$1 = children(element);\n      if (children$1.length === 0) {\n        return point$1(element, offset);\n      } else if (offset < children$1.length) {\n        return point$1(children$1[offset], 0);\n      } else {\n        var last = children$1[children$1.length - 1];\n        var len = isText$1(last) ? get$3(last).length : children(last).length;\n        return point$1(last, len);\n      }\n    };\n\n    var descendOnce = function (element, offset) {\n      return isText$1(element) ? point$1(element, offset) : descendOnce$1(element, offset);\n    };\n    var getAnchorSelection = function (win, anchorInfo) {\n      var getSelection = anchorInfo.getSelection.getOrThunk(function () {\n        return function () {\n          return getExact(win);\n        };\n      });\n      return getSelection().map(function (sel) {\n        var modStart = descendOnce(sel.start, sel.soffset);\n        var modFinish = descendOnce(sel.finish, sel.foffset);\n        return SimSelection.range(modStart.element, modStart.offset, modFinish.element, modFinish.offset);\n      });\n    };\n    var placement$1 = function (component, anchorInfo, origin) {\n      var win = defaultView(anchorInfo.root).dom;\n      var rootPoint = getRootPoint(component, origin, anchorInfo);\n      var selectionBox = getAnchorSelection(win, anchorInfo).bind(function (sel) {\n        var optRect = getBounds$1(win, SimSelection.exactFromRange(sel)).orThunk(function () {\n          var x = SugarElement.fromText(zeroWidth);\n          before$2(sel.start, x);\n          var rect = getFirstRect(win, SimSelection.exact(x, 0, x, 1));\n          remove$5(x);\n          return rect;\n        });\n        return optRect.bind(function (rawRect) {\n          return getBox(rawRect.left, rawRect.top, rawRect.width, rawRect.height);\n        });\n      });\n      var targetElement = getAnchorSelection(win, anchorInfo).bind(function (sel) {\n        return isElement$2(sel.start) ? Optional.some(sel.start) : parentNode(sel.start);\n      });\n      var elem = targetElement.getOr(component.element);\n      return calcNewAnchor(selectionBox, rootPoint, anchorInfo, origin, elem);\n    };\n    var SelectionAnchor = [\n      option('getSelection'),\n      required$1('root'),\n      option('bubble'),\n      schema$y(),\n      defaulted('overrides', {}),\n      defaulted('showAbove', false),\n      output$1('placement', placement$1)\n    ];\n\n    var labelPrefix$1 = 'link-layout';\n    var eastX = function (anchor) {\n      return anchor.x + anchor.width;\n    };\n    var westX = function (anchor, element) {\n      return anchor.x - element.width;\n    };\n    var northY$1 = function (anchor, element) {\n      return anchor.y - element.height + anchor.height;\n    };\n    var southY$1 = function (anchor) {\n      return anchor.y;\n    };\n    var southeast$1 = function (anchor, element, bubbles) {\n      return nu$6(eastX(anchor), southY$1(anchor), bubbles.southeast(), southeast$3(), 'southeast', boundsRestriction(anchor, {\n        left: 0,\n        top: 2\n      }), labelPrefix$1);\n    };\n    var southwest$1 = function (anchor, element, bubbles) {\n      return nu$6(westX(anchor, element), southY$1(anchor), bubbles.southwest(), southwest$3(), 'southwest', boundsRestriction(anchor, {\n        right: 1,\n        top: 2\n      }), labelPrefix$1);\n    };\n    var northeast$1 = function (anchor, element, bubbles) {\n      return nu$6(eastX(anchor), northY$1(anchor, element), bubbles.northeast(), northeast$3(), 'northeast', boundsRestriction(anchor, {\n        left: 0,\n        bottom: 3\n      }), labelPrefix$1);\n    };\n    var northwest$1 = function (anchor, element, bubbles) {\n      return nu$6(westX(anchor, element), northY$1(anchor, element), bubbles.northwest(), northwest$3(), 'northwest', boundsRestriction(anchor, {\n        right: 1,\n        bottom: 3\n      }), labelPrefix$1);\n    };\n    var all = function () {\n      return [\n        southeast$1,\n        southwest$1,\n        northeast$1,\n        northwest$1\n      ];\n    };\n    var allRtl = function () {\n      return [\n        southwest$1,\n        southeast$1,\n        northwest$1,\n        northeast$1\n      ];\n    };\n\n    var placement = function (component, submenuInfo, origin) {\n      var anchorBox = toBox(origin, submenuInfo.item.element);\n      var layouts = get$4(component.element, submenuInfo, all(), allRtl(), all(), allRtl(), Optional.none());\n      return Optional.some(nu$4({\n        anchorBox: anchorBox,\n        bubble: fallback(),\n        overrides: submenuInfo.overrides,\n        layouts: layouts,\n        placer: Optional.none()\n      }));\n    };\n    var SubmenuAnchor = [\n      required$1('item'),\n      schema$y(),\n      defaulted('overrides', {}),\n      output$1('placement', placement)\n    ];\n\n    var AnchorSchema = choose$1('type', {\n      selection: SelectionAnchor,\n      node: NodeAnchor,\n      hotspot: HotspotAnchor,\n      submenu: SubmenuAnchor,\n      makeshift: MakeshiftAnchor\n    });\n\n    var TransitionSchema = [\n      requiredArrayOf('classes', string),\n      defaultedStringEnum('mode', 'all', [\n        'all',\n        'layout',\n        'placement'\n      ])\n    ];\n    var PositionSchema = [\n      defaulted('useFixed', never),\n      option('getBounds')\n    ];\n    var PlacementSchema = [\n      requiredOf('anchor', AnchorSchema),\n      optionObjOf('transition', TransitionSchema)\n    ];\n\n    var getFixedOrigin = function () {\n      var html = document.documentElement;\n      return fixed$1(0, 0, html.clientWidth, html.clientHeight);\n    };\n    var getRelativeOrigin = function (component) {\n      var position = absolute$3(component.element);\n      var bounds = component.element.dom.getBoundingClientRect();\n      return relative$1(position.left, position.top, bounds.width, bounds.height);\n    };\n    var place = function (component, origin, anchoring, getBounds, placee, lastPlace, transition) {\n      var anchor = box(anchoring.anchorBox, origin);\n      return simple(anchor, placee.element, anchoring.bubble, anchoring.layouts, lastPlace, getBounds, anchoring.overrides, transition);\n    };\n    var position$1 = function (component, posConfig, posState, placee, placementSpec) {\n      positionWithin(component, posConfig, posState, placee, placementSpec, Optional.none());\n    };\n    var positionWithin = function (component, posConfig, posState, placee, placementSpec, boxElement) {\n      var boundsBox = boxElement.map(box$1);\n      return positionWithinBounds(component, posConfig, posState, placee, placementSpec, boundsBox);\n    };\n    var positionWithinBounds = function (component, posConfig, posState, placee, placementSpec, bounds) {\n      var placeeDetail = asRawOrDie$1('placement.info', objOf(PlacementSchema), placementSpec);\n      var anchorage = placeeDetail.anchor;\n      var element = placee.element;\n      var placeeState = posState.get(placee.uid);\n      preserve$1(function () {\n        set$7(element, 'position', 'fixed');\n        var oldVisibility = getRaw(element, 'visibility');\n        set$7(element, 'visibility', 'hidden');\n        var origin = posConfig.useFixed() ? getFixedOrigin() : getRelativeOrigin(component);\n        var placer = anchorage.placement;\n        var getBounds = bounds.map(constant$1).or(posConfig.getBounds);\n        placer(component, anchorage, origin).each(function (anchoring) {\n          var doPlace = anchoring.placer.getOr(place);\n          var newState = doPlace(component, origin, anchoring, getBounds, placee, placeeState, placeeDetail.transition);\n          posState.set(placee.uid, newState);\n        });\n        oldVisibility.fold(function () {\n          remove$6(element, 'visibility');\n        }, function (vis) {\n          set$7(element, 'visibility', vis);\n        });\n        if (getRaw(element, 'left').isNone() && getRaw(element, 'top').isNone() && getRaw(element, 'right').isNone() && getRaw(element, 'bottom').isNone() && is$1(getRaw(element, 'position'), 'fixed')) {\n          remove$6(element, 'position');\n        }\n      }, element);\n    };\n    var getMode = function (component, pConfig, _pState) {\n      return pConfig.useFixed() ? 'fixed' : 'absolute';\n    };\n    var reset$1 = function (component, pConfig, posState, placee) {\n      var element = placee.element;\n      each$1([\n        'position',\n        'left',\n        'right',\n        'top',\n        'bottom'\n      ], function (prop) {\n        return remove$6(element, prop);\n      });\n      reset$2(element);\n      posState.clear(placee.uid);\n    };\n\n    var PositionApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        position: position$1,\n        positionWithin: positionWithin,\n        positionWithinBounds: positionWithinBounds,\n        getMode: getMode,\n        reset: reset$1\n    });\n\n    var init$g = function () {\n      var state = {};\n      var set = function (id, data) {\n        state[id] = data;\n      };\n      var get = function (id) {\n        return get$e(state, id);\n      };\n      var clear = function (id) {\n        if (isNonNullable(id)) {\n          delete state[id];\n        } else {\n          state = {};\n        }\n      };\n      return nu$8({\n        readState: function () {\n          return state;\n        },\n        clear: clear,\n        set: set,\n        get: get\n      });\n    };\n\n    var PositioningState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$g\n    });\n\n    var Positioning = create$8({\n      fields: PositionSchema,\n      name: 'positioning',\n      active: ActivePosition,\n      apis: PositionApis,\n      state: PositioningState\n    });\n\n    var fireDetaching = function (component) {\n      emit(component, detachedFromDom());\n      var children = component.components();\n      each$1(children, fireDetaching);\n    };\n    var fireAttaching = function (component) {\n      var children = component.components();\n      each$1(children, fireAttaching);\n      emit(component, attachedToDom());\n    };\n    var attach$1 = function (parent, child) {\n      append$2(parent.element, child.element);\n    };\n    var detachChildren$1 = function (component) {\n      each$1(component.components(), function (childComp) {\n        return remove$5(childComp.element);\n      });\n      empty(component.element);\n      component.syncComponents();\n    };\n    var replaceChildren = function (component, newChildren) {\n      var subs = component.components();\n      detachChildren$1(component);\n      var deleted = difference(subs, newChildren);\n      each$1(deleted, function (comp) {\n        fireDetaching(comp);\n        component.getSystem().removeFromWorld(comp);\n      });\n      each$1(newChildren, function (childComp) {\n        if (!childComp.getSystem().isConnected()) {\n          component.getSystem().addToWorld(childComp);\n          attach$1(component, childComp);\n          if (inBody(component.element)) {\n            fireAttaching(childComp);\n          }\n        } else {\n          attach$1(component, childComp);\n        }\n        component.syncComponents();\n      });\n    };\n\n    var attach = function (parent, child) {\n      attachWith(parent, child, append$2);\n    };\n    var attachWith = function (parent, child, insertion) {\n      parent.getSystem().addToWorld(child);\n      insertion(parent.element, child.element);\n      if (inBody(parent.element)) {\n        fireAttaching(child);\n      }\n      parent.syncComponents();\n    };\n    var doDetach = function (component) {\n      fireDetaching(component);\n      remove$5(component.element);\n      component.getSystem().removeFromWorld(component);\n    };\n    var detach = function (component) {\n      var parent$1 = parent(component.element).bind(function (p) {\n        return component.getSystem().getByDom(p).toOptional();\n      });\n      doDetach(component);\n      parent$1.each(function (p) {\n        p.syncComponents();\n      });\n    };\n    var detachChildren = function (component) {\n      var subs = component.components();\n      each$1(subs, doDetach);\n      empty(component.element);\n      component.syncComponents();\n    };\n    var attachSystem = function (element, guiSystem) {\n      attachSystemWith(element, guiSystem, append$2);\n    };\n    var attachSystemAfter = function (element, guiSystem) {\n      attachSystemWith(element, guiSystem, after$2);\n    };\n    var attachSystemWith = function (element, guiSystem, inserter) {\n      inserter(element, guiSystem.element);\n      var children$1 = children(guiSystem.element);\n      each$1(children$1, function (child) {\n        guiSystem.getByDom(child).each(fireAttaching);\n      });\n    };\n    var detachSystem = function (guiSystem) {\n      var children$1 = children(guiSystem.element);\n      each$1(children$1, function (child) {\n        guiSystem.getByDom(child).each(fireDetaching);\n      });\n      remove$5(guiSystem.element);\n    };\n\n    var rebuild = function (sandbox, sConfig, sState, data) {\n      sState.get().each(function (_data) {\n        detachChildren(sandbox);\n      });\n      var point = sConfig.getAttachPoint(sandbox);\n      attach(point, sandbox);\n      var built = sandbox.getSystem().build(data);\n      attach(sandbox, built);\n      sState.set(built);\n      return built;\n    };\n    var open$1 = function (sandbox, sConfig, sState, data) {\n      var newState = rebuild(sandbox, sConfig, sState, data);\n      sConfig.onOpen(sandbox, newState);\n      return newState;\n    };\n    var setContent = function (sandbox, sConfig, sState, data) {\n      return sState.get().map(function () {\n        return rebuild(sandbox, sConfig, sState, data);\n      });\n    };\n    var openWhileCloaked = function (sandbox, sConfig, sState, data, transaction) {\n      cloak(sandbox, sConfig);\n      open$1(sandbox, sConfig, sState, data);\n      transaction();\n      decloak(sandbox, sConfig);\n    };\n    var close$1 = function (sandbox, sConfig, sState) {\n      sState.get().each(function (data) {\n        detachChildren(sandbox);\n        detach(sandbox);\n        sConfig.onClose(sandbox, data);\n        sState.clear();\n      });\n    };\n    var isOpen$1 = function (_sandbox, _sConfig, sState) {\n      return sState.isOpen();\n    };\n    var isPartOf = function (sandbox, sConfig, sState, queryElem) {\n      return isOpen$1(sandbox, sConfig, sState) && sState.get().exists(function (data) {\n        return sConfig.isPartOf(sandbox, data, queryElem);\n      });\n    };\n    var getState$2 = function (_sandbox, _sConfig, sState) {\n      return sState.get();\n    };\n    var store = function (sandbox, cssKey, attr, newValue) {\n      getRaw(sandbox.element, cssKey).fold(function () {\n        remove$7(sandbox.element, attr);\n      }, function (v) {\n        set$8(sandbox.element, attr, v);\n      });\n      set$7(sandbox.element, cssKey, newValue);\n    };\n    var restore = function (sandbox, cssKey, attr) {\n      getOpt(sandbox.element, attr).fold(function () {\n        return remove$6(sandbox.element, cssKey);\n      }, function (oldValue) {\n        return set$7(sandbox.element, cssKey, oldValue);\n      });\n    };\n    var cloak = function (sandbox, sConfig, _sState) {\n      var sink = sConfig.getAttachPoint(sandbox);\n      set$7(sandbox.element, 'position', Positioning.getMode(sink));\n      store(sandbox, 'visibility', sConfig.cloakVisibilityAttr, 'hidden');\n    };\n    var hasPosition = function (element) {\n      return exists([\n        'top',\n        'left',\n        'right',\n        'bottom'\n      ], function (pos) {\n        return getRaw(element, pos).isSome();\n      });\n    };\n    var decloak = function (sandbox, sConfig, _sState) {\n      if (!hasPosition(sandbox.element)) {\n        remove$6(sandbox.element, 'position');\n      }\n      restore(sandbox, 'visibility', sConfig.cloakVisibilityAttr);\n    };\n\n    var SandboxApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        cloak: cloak,\n        decloak: decloak,\n        open: open$1,\n        openWhileCloaked: openWhileCloaked,\n        close: close$1,\n        isOpen: isOpen$1,\n        isPartOf: isPartOf,\n        getState: getState$2,\n        setContent: setContent\n    });\n\n    var events$g = function (sandboxConfig, sandboxState) {\n      return derive$2([run$1(sandboxClose(), function (sandbox, _simulatedEvent) {\n          close$1(sandbox, sandboxConfig, sandboxState);\n        })]);\n    };\n\n    var ActiveSandbox = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$g\n    });\n\n    var SandboxSchema = [\n      onHandler('onOpen'),\n      onHandler('onClose'),\n      required$1('isPartOf'),\n      required$1('getAttachPoint'),\n      defaulted('cloakVisibilityAttr', 'data-precloak-visibility')\n    ];\n\n    var init$f = function () {\n      var contents = value$1();\n      var readState = constant$1('not-implemented');\n      return nu$8({\n        readState: readState,\n        isOpen: contents.isSet,\n        clear: contents.clear,\n        set: contents.set,\n        get: contents.get\n      });\n    };\n\n    var SandboxState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$f\n    });\n\n    var Sandboxing = create$8({\n      fields: SandboxSchema,\n      name: 'sandboxing',\n      active: ActiveSandbox,\n      apis: SandboxApis,\n      state: SandboxState\n    });\n\n    var dismissPopups = constant$1('dismiss.popups');\n    var repositionPopups = constant$1('reposition.popups');\n    var mouseReleased = constant$1('mouse.released');\n\n    var schema$x = objOfOnly([\n      defaulted('isExtraPart', never),\n      optionObjOf('fireEventInstead', [defaulted('event', dismissRequested())])\n    ]);\n    var receivingChannel$1 = function (rawSpec) {\n      var _a;\n      var detail = asRawOrDie$1('Dismissal', schema$x, rawSpec);\n      return _a = {}, _a[dismissPopups()] = {\n        schema: objOfOnly([required$1('target')]),\n        onReceive: function (sandbox, data) {\n          if (Sandboxing.isOpen(sandbox)) {\n            var isPart = Sandboxing.isPartOf(sandbox, data.target) || detail.isExtraPart(sandbox, data.target);\n            if (!isPart) {\n              detail.fireEventInstead.fold(function () {\n                return Sandboxing.close(sandbox);\n              }, function (fe) {\n                return emit(sandbox, fe.event);\n              });\n            }\n          }\n        }\n      }, _a;\n    };\n\n    var schema$w = objOfOnly([\n      optionObjOf('fireEventInstead', [defaulted('event', repositionRequested())]),\n      requiredFunction('doReposition')\n    ]);\n    var receivingChannel = function (rawSpec) {\n      var _a;\n      var detail = asRawOrDie$1('Reposition', schema$w, rawSpec);\n      return _a = {}, _a[repositionPopups()] = {\n        onReceive: function (sandbox) {\n          if (Sandboxing.isOpen(sandbox)) {\n            detail.fireEventInstead.fold(function () {\n              return detail.doReposition(sandbox);\n            }, function (fe) {\n              return emit(sandbox, fe.event);\n            });\n          }\n        }\n      }, _a;\n    };\n\n    var onLoad$5 = function (component, repConfig, repState) {\n      repConfig.store.manager.onLoad(component, repConfig, repState);\n    };\n    var onUnload$2 = function (component, repConfig, repState) {\n      repConfig.store.manager.onUnload(component, repConfig, repState);\n    };\n    var setValue$3 = function (component, repConfig, repState, data) {\n      repConfig.store.manager.setValue(component, repConfig, repState, data);\n    };\n    var getValue$3 = function (component, repConfig, repState) {\n      return repConfig.store.manager.getValue(component, repConfig, repState);\n    };\n    var getState$1 = function (component, repConfig, repState) {\n      return repState;\n    };\n\n    var RepresentApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        onLoad: onLoad$5,\n        onUnload: onUnload$2,\n        setValue: setValue$3,\n        getValue: getValue$3,\n        getState: getState$1\n    });\n\n    var events$f = function (repConfig, repState) {\n      var es = repConfig.resetOnDom ? [\n        runOnAttached(function (comp, _se) {\n          onLoad$5(comp, repConfig, repState);\n        }),\n        runOnDetached(function (comp, _se) {\n          onUnload$2(comp, repConfig, repState);\n        })\n      ] : [loadEvent(repConfig, repState, onLoad$5)];\n      return derive$2(es);\n    };\n\n    var ActiveRepresenting = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$f\n    });\n\n    var memory$1 = function () {\n      var data = Cell(null);\n      var readState = function () {\n        return {\n          mode: 'memory',\n          value: data.get()\n        };\n      };\n      var isNotSet = function () {\n        return data.get() === null;\n      };\n      var clear = function () {\n        data.set(null);\n      };\n      return nu$8({\n        set: data.set,\n        get: data.get,\n        isNotSet: isNotSet,\n        clear: clear,\n        readState: readState\n      });\n    };\n    var manual = function () {\n      var readState = noop;\n      return nu$8({ readState: readState });\n    };\n    var dataset = function () {\n      var dataByValue = Cell({});\n      var dataByText = Cell({});\n      var readState = function () {\n        return {\n          mode: 'dataset',\n          dataByValue: dataByValue.get(),\n          dataByText: dataByText.get()\n        };\n      };\n      var clear = function () {\n        dataByValue.set({});\n        dataByText.set({});\n      };\n      var lookup = function (itemString) {\n        return get$e(dataByValue.get(), itemString).orThunk(function () {\n          return get$e(dataByText.get(), itemString);\n        });\n      };\n      var update = function (items) {\n        var currentDataByValue = dataByValue.get();\n        var currentDataByText = dataByText.get();\n        var newDataByValue = {};\n        var newDataByText = {};\n        each$1(items, function (item) {\n          newDataByValue[item.value] = item;\n          get$e(item, 'meta').each(function (meta) {\n            get$e(meta, 'text').each(function (text) {\n              newDataByText[text] = item;\n            });\n          });\n        });\n        dataByValue.set(__assign(__assign({}, currentDataByValue), newDataByValue));\n        dataByText.set(__assign(__assign({}, currentDataByText), newDataByText));\n      };\n      return nu$8({\n        readState: readState,\n        lookup: lookup,\n        update: update,\n        clear: clear\n      });\n    };\n    var init$e = function (spec) {\n      return spec.store.manager.state(spec);\n    };\n\n    var RepresentState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        memory: memory$1,\n        dataset: dataset,\n        manual: manual,\n        init: init$e\n    });\n\n    var setValue$2 = function (component, repConfig, repState, data) {\n      var store = repConfig.store;\n      repState.update([data]);\n      store.setValue(component, data);\n      repConfig.onSetValue(component, data);\n    };\n    var getValue$2 = function (component, repConfig, repState) {\n      var store = repConfig.store;\n      var key = store.getDataKey(component);\n      return repState.lookup(key).getOrThunk(function () {\n        return store.getFallbackEntry(key);\n      });\n    };\n    var onLoad$4 = function (component, repConfig, repState) {\n      var store = repConfig.store;\n      store.initialValue.each(function (data) {\n        setValue$2(component, repConfig, repState, data);\n      });\n    };\n    var onUnload$1 = function (component, repConfig, repState) {\n      repState.clear();\n    };\n    var DatasetStore = [\n      option('initialValue'),\n      required$1('getFallbackEntry'),\n      required$1('getDataKey'),\n      required$1('setValue'),\n      output$1('manager', {\n        setValue: setValue$2,\n        getValue: getValue$2,\n        onLoad: onLoad$4,\n        onUnload: onUnload$1,\n        state: dataset\n      })\n    ];\n\n    var getValue$1 = function (component, repConfig, _repState) {\n      return repConfig.store.getValue(component);\n    };\n    var setValue$1 = function (component, repConfig, _repState, data) {\n      repConfig.store.setValue(component, data);\n      repConfig.onSetValue(component, data);\n    };\n    var onLoad$3 = function (component, repConfig, _repState) {\n      repConfig.store.initialValue.each(function (data) {\n        repConfig.store.setValue(component, data);\n      });\n    };\n    var ManualStore = [\n      required$1('getValue'),\n      defaulted('setValue', noop),\n      option('initialValue'),\n      output$1('manager', {\n        setValue: setValue$1,\n        getValue: getValue$1,\n        onLoad: onLoad$3,\n        onUnload: noop,\n        state: NoState.init\n      })\n    ];\n\n    var setValue = function (component, repConfig, repState, data) {\n      repState.set(data);\n      repConfig.onSetValue(component, data);\n    };\n    var getValue = function (component, repConfig, repState) {\n      return repState.get();\n    };\n    var onLoad$2 = function (component, repConfig, repState) {\n      repConfig.store.initialValue.each(function (initVal) {\n        if (repState.isNotSet()) {\n          repState.set(initVal);\n        }\n      });\n    };\n    var onUnload = function (component, repConfig, repState) {\n      repState.clear();\n    };\n    var MemoryStore = [\n      option('initialValue'),\n      output$1('manager', {\n        setValue: setValue,\n        getValue: getValue,\n        onLoad: onLoad$2,\n        onUnload: onUnload,\n        state: memory$1\n      })\n    ];\n\n    var RepresentSchema = [\n      defaultedOf('store', { mode: 'memory' }, choose$1('mode', {\n        memory: MemoryStore,\n        manual: ManualStore,\n        dataset: DatasetStore\n      })),\n      onHandler('onSetValue'),\n      defaulted('resetOnDom', false)\n    ];\n\n    var Representing = create$8({\n      fields: RepresentSchema,\n      name: 'representing',\n      active: ActiveRepresenting,\n      apis: RepresentApis,\n      extra: {\n        setValueFrom: function (component, source) {\n          var value = Representing.getValue(source);\n          Representing.setValue(component, value);\n        }\n      },\n      state: RepresentState\n    });\n\n    var field = function (name, forbidden) {\n      return defaultedObjOf(name, {}, map$2(forbidden, function (f) {\n        return forbid(f.name(), 'Cannot configure ' + f.name() + ' for ' + name);\n      }).concat([customField('dump', identity$1)]));\n    };\n    var get$2 = function (data) {\n      return data.dump;\n    };\n    var augment = function (data, original) {\n      return __assign(__assign({}, derive$1(original)), data.dump);\n    };\n    var SketchBehaviours = {\n      field: field,\n      augment: augment,\n      get: get$2\n    };\n\n    var _placeholder = 'placeholder';\n    var adt$3 = Adt.generate([\n      {\n        single: [\n          'required',\n          'valueThunk'\n        ]\n      },\n      {\n        multiple: [\n          'required',\n          'valueThunks'\n        ]\n      }\n    ]);\n    var isSubstituted = function (spec) {\n      return has$2(spec, 'uiType');\n    };\n    var subPlaceholder = function (owner, detail, compSpec, placeholders) {\n      if (owner.exists(function (o) {\n          return o !== compSpec.owner;\n        })) {\n        return adt$3.single(true, constant$1(compSpec));\n      }\n      return get$e(placeholders, compSpec.name).fold(function () {\n        throw new Error('Unknown placeholder component: ' + compSpec.name + '\\nKnown: [' + keys(placeholders) + ']\\nNamespace: ' + owner.getOr('none') + '\\nSpec: ' + JSON.stringify(compSpec, null, 2));\n      }, function (newSpec) {\n        return newSpec.replace();\n      });\n    };\n    var scan = function (owner, detail, compSpec, placeholders) {\n      if (isSubstituted(compSpec) && compSpec.uiType === _placeholder) {\n        return subPlaceholder(owner, detail, compSpec, placeholders);\n      } else {\n        return adt$3.single(false, constant$1(compSpec));\n      }\n    };\n    var substitute = function (owner, detail, compSpec, placeholders) {\n      var base = scan(owner, detail, compSpec, placeholders);\n      return base.fold(function (req, valueThunk) {\n        var value = isSubstituted(compSpec) ? valueThunk(detail, compSpec.config, compSpec.validated) : valueThunk(detail);\n        var childSpecs = get$e(value, 'components').getOr([]);\n        var substituted = bind$3(childSpecs, function (c) {\n          return substitute(owner, detail, c, placeholders);\n        });\n        return [__assign(__assign({}, value), { components: substituted })];\n      }, function (req, valuesThunk) {\n        if (isSubstituted(compSpec)) {\n          var values = valuesThunk(detail, compSpec.config, compSpec.validated);\n          var preprocessor = compSpec.validated.preprocess.getOr(identity$1);\n          return preprocessor(values);\n        } else {\n          return valuesThunk(detail);\n        }\n      });\n    };\n    var substituteAll = function (owner, detail, components, placeholders) {\n      return bind$3(components, function (c) {\n        return substitute(owner, detail, c, placeholders);\n      });\n    };\n    var oneReplace = function (label, replacements) {\n      var called = false;\n      var used = function () {\n        return called;\n      };\n      var replace = function () {\n        if (called) {\n          throw new Error('Trying to use the same placeholder more than once: ' + label);\n        }\n        called = true;\n        return replacements;\n      };\n      var required = function () {\n        return replacements.fold(function (req, _) {\n          return req;\n        }, function (req, _) {\n          return req;\n        });\n      };\n      return {\n        name: constant$1(label),\n        required: required,\n        used: used,\n        replace: replace\n      };\n    };\n    var substitutePlaces = function (owner, detail, components, placeholders) {\n      var ps = map$1(placeholders, function (ph, name) {\n        return oneReplace(name, ph);\n      });\n      var outcome = substituteAll(owner, detail, components, ps);\n      each(ps, function (p) {\n        if (p.used() === false && p.required()) {\n          throw new Error('Placeholder: ' + p.name() + ' was not found in components list\\nNamespace: ' + owner.getOr('none') + '\\nComponents: ' + JSON.stringify(detail.components, null, 2));\n        }\n      });\n      return outcome;\n    };\n    var single$2 = adt$3.single;\n    var multiple = adt$3.multiple;\n    var placeholder = constant$1(_placeholder);\n\n    var adt$2 = Adt.generate([\n      { required: ['data'] },\n      { external: ['data'] },\n      { optional: ['data'] },\n      { group: ['data'] }\n    ]);\n    var fFactory = defaulted('factory', { sketch: identity$1 });\n    var fSchema = defaulted('schema', []);\n    var fName = required$1('name');\n    var fPname = field$1('pname', 'pname', defaultedThunk(function (typeSpec) {\n      return '<alloy.' + generate$6(typeSpec.name) + '>';\n    }), anyValue());\n    var fGroupSchema = customField('schema', function () {\n      return [option('preprocess')];\n    });\n    var fDefaults = defaulted('defaults', constant$1({}));\n    var fOverrides = defaulted('overrides', constant$1({}));\n    var requiredSpec = objOf([\n      fFactory,\n      fSchema,\n      fName,\n      fPname,\n      fDefaults,\n      fOverrides\n    ]);\n    var externalSpec = objOf([\n      fFactory,\n      fSchema,\n      fName,\n      fDefaults,\n      fOverrides\n    ]);\n    var optionalSpec = objOf([\n      fFactory,\n      fSchema,\n      fName,\n      fPname,\n      fDefaults,\n      fOverrides\n    ]);\n    var groupSpec = objOf([\n      fFactory,\n      fGroupSchema,\n      fName,\n      required$1('unit'),\n      fPname,\n      fDefaults,\n      fOverrides\n    ]);\n    var asNamedPart = function (part) {\n      return part.fold(Optional.some, Optional.none, Optional.some, Optional.some);\n    };\n    var name$1 = function (part) {\n      var get = function (data) {\n        return data.name;\n      };\n      return part.fold(get, get, get, get);\n    };\n    var asCommon = function (part) {\n      return part.fold(identity$1, identity$1, identity$1, identity$1);\n    };\n    var convert = function (adtConstructor, partSchema) {\n      return function (spec) {\n        var data = asRawOrDie$1('Converting part type', partSchema, spec);\n        return adtConstructor(data);\n      };\n    };\n    var required = convert(adt$2.required, requiredSpec);\n    var external$1 = convert(adt$2.external, externalSpec);\n    var optional = convert(adt$2.optional, optionalSpec);\n    var group = convert(adt$2.group, groupSpec);\n    var original = constant$1('entirety');\n\n    var PartType = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        required: required,\n        external: external$1,\n        optional: optional,\n        group: group,\n        asNamedPart: asNamedPart,\n        name: name$1,\n        asCommon: asCommon,\n        original: original\n    });\n\n    var combine = function (detail, data, partSpec, partValidated) {\n      return deepMerge(data.defaults(detail, partSpec, partValidated), partSpec, { uid: detail.partUids[data.name] }, data.overrides(detail, partSpec, partValidated));\n    };\n    var subs = function (owner, detail, parts) {\n      var internals = {};\n      var externals = {};\n      each$1(parts, function (part) {\n        part.fold(function (data) {\n          internals[data.pname] = single$2(true, function (detail, partSpec, partValidated) {\n            return data.factory.sketch(combine(detail, data, partSpec, partValidated));\n          });\n        }, function (data) {\n          var partSpec = detail.parts[data.name];\n          externals[data.name] = constant$1(data.factory.sketch(combine(detail, data, partSpec[original()]), partSpec));\n        }, function (data) {\n          internals[data.pname] = single$2(false, function (detail, partSpec, partValidated) {\n            return data.factory.sketch(combine(detail, data, partSpec, partValidated));\n          });\n        }, function (data) {\n          internals[data.pname] = multiple(true, function (detail, _partSpec, _partValidated) {\n            var units = detail[data.name];\n            return map$2(units, function (u) {\n              return data.factory.sketch(deepMerge(data.defaults(detail, u, _partValidated), u, data.overrides(detail, u)));\n            });\n          });\n        });\n      });\n      return {\n        internals: constant$1(internals),\n        externals: constant$1(externals)\n      };\n    };\n\n    var generate$3 = function (owner, parts) {\n      var r = {};\n      each$1(parts, function (part) {\n        asNamedPart(part).each(function (np) {\n          var g = doGenerateOne(owner, np.pname);\n          r[np.name] = function (config) {\n            var validated = asRawOrDie$1('Part: ' + np.name + ' in ' + owner, objOf(np.schema), config);\n            return __assign(__assign({}, g), {\n              config: config,\n              validated: validated\n            });\n          };\n        });\n      });\n      return r;\n    };\n    var doGenerateOne = function (owner, pname) {\n      return {\n        uiType: placeholder(),\n        owner: owner,\n        name: pname\n      };\n    };\n    var generateOne$1 = function (owner, pname, config) {\n      return {\n        uiType: placeholder(),\n        owner: owner,\n        name: pname,\n        config: config,\n        validated: {}\n      };\n    };\n    var schemas = function (parts) {\n      return bind$3(parts, function (part) {\n        return part.fold(Optional.none, Optional.some, Optional.none, Optional.none).map(function (data) {\n          return requiredObjOf(data.name, data.schema.concat([snapshot(original())]));\n        }).toArray();\n      });\n    };\n    var names = function (parts) {\n      return map$2(parts, name$1);\n    };\n    var substitutes = function (owner, detail, parts) {\n      return subs(owner, detail, parts);\n    };\n    var components$1 = function (owner, detail, internals) {\n      return substitutePlaces(Optional.some(owner), detail, detail.components, internals);\n    };\n    var getPart = function (component, detail, partKey) {\n      var uid = detail.partUids[partKey];\n      return component.getSystem().getByUid(uid).toOptional();\n    };\n    var getPartOrDie = function (component, detail, partKey) {\n      return getPart(component, detail, partKey).getOrDie('Could not find part: ' + partKey);\n    };\n    var getParts = function (component, detail, partKeys) {\n      var r = {};\n      var uids = detail.partUids;\n      var system = component.getSystem();\n      each$1(partKeys, function (pk) {\n        r[pk] = constant$1(system.getByUid(uids[pk]));\n      });\n      return r;\n    };\n    var getAllParts = function (component, detail) {\n      var system = component.getSystem();\n      return map$1(detail.partUids, function (pUid, _k) {\n        return constant$1(system.getByUid(pUid));\n      });\n    };\n    var getAllPartNames = function (detail) {\n      return keys(detail.partUids);\n    };\n    var getPartsOrDie = function (component, detail, partKeys) {\n      var r = {};\n      var uids = detail.partUids;\n      var system = component.getSystem();\n      each$1(partKeys, function (pk) {\n        r[pk] = constant$1(system.getByUid(uids[pk]).getOrDie());\n      });\n      return r;\n    };\n    var defaultUids = function (baseUid, partTypes) {\n      var partNames = names(partTypes);\n      return wrapAll(map$2(partNames, function (pn) {\n        return {\n          key: pn,\n          value: baseUid + '-' + pn\n        };\n      }));\n    };\n    var defaultUidsSchema = function (partTypes) {\n      return field$1('partUids', 'partUids', mergeWithThunk(function (spec) {\n        return defaultUids(spec.uid, partTypes);\n      }), anyValue());\n    };\n\n    var AlloyParts = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        generate: generate$3,\n        generateOne: generateOne$1,\n        schemas: schemas,\n        names: names,\n        substitutes: substitutes,\n        components: components$1,\n        defaultUids: defaultUids,\n        defaultUidsSchema: defaultUidsSchema,\n        getAllParts: getAllParts,\n        getAllPartNames: getAllPartNames,\n        getPart: getPart,\n        getPartOrDie: getPartOrDie,\n        getParts: getParts,\n        getPartsOrDie: getPartsOrDie\n    });\n\n    var base = function (partSchemas, partUidsSchemas) {\n      var ps = partSchemas.length > 0 ? [requiredObjOf('parts', partSchemas)] : [];\n      return ps.concat([\n        required$1('uid'),\n        defaulted('dom', {}),\n        defaulted('components', []),\n        snapshot('originalSpec'),\n        defaulted('debug.sketcher', {})\n      ]).concat(partUidsSchemas);\n    };\n    var asRawOrDie = function (label, schema, spec, partSchemas, partUidsSchemas) {\n      var baseS = base(partSchemas, partUidsSchemas);\n      return asRawOrDie$1(label + ' [SpecSchema]', objOfOnly(baseS.concat(schema)), spec);\n    };\n\n    var single$1 = function (owner, schema, factory, spec) {\n      var specWithUid = supplyUid(spec);\n      var detail = asRawOrDie(owner, schema, specWithUid, [], []);\n      return factory(detail, specWithUid);\n    };\n    var composite$1 = function (owner, schema, partTypes, factory, spec) {\n      var specWithUid = supplyUid(spec);\n      var partSchemas = schemas(partTypes);\n      var partUidsSchema = defaultUidsSchema(partTypes);\n      var detail = asRawOrDie(owner, schema, specWithUid, partSchemas, [partUidsSchema]);\n      var subs = substitutes(owner, detail, partTypes);\n      var components = components$1(owner, detail, subs.internals());\n      return factory(detail, components, specWithUid, subs.externals());\n    };\n    var hasUid = function (spec) {\n      return has$2(spec, 'uid');\n    };\n    var supplyUid = function (spec) {\n      return hasUid(spec) ? spec : __assign(__assign({}, spec), { uid: generate$5('uid') });\n    };\n\n    var isSketchSpec = function (spec) {\n      return spec.uid !== undefined;\n    };\n    var singleSchema = objOfOnly([\n      required$1('name'),\n      required$1('factory'),\n      required$1('configFields'),\n      defaulted('apis', {}),\n      defaulted('extraApis', {})\n    ]);\n    var compositeSchema = objOfOnly([\n      required$1('name'),\n      required$1('factory'),\n      required$1('configFields'),\n      required$1('partFields'),\n      defaulted('apis', {}),\n      defaulted('extraApis', {})\n    ]);\n    var single = function (rawConfig) {\n      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, singleSchema, rawConfig);\n      var sketch = function (spec) {\n        return single$1(config.name, config.configFields, config.factory, spec);\n      };\n      var apis = map$1(config.apis, makeApi);\n      var extraApis = map$1(config.extraApis, function (f, k) {\n        return markAsExtraApi(f, k);\n      });\n      return __assign(__assign({\n        name: config.name,\n        configFields: config.configFields,\n        sketch: sketch\n      }, apis), extraApis);\n    };\n    var composite = function (rawConfig) {\n      var config = asRawOrDie$1('Sketcher for ' + rawConfig.name, compositeSchema, rawConfig);\n      var sketch = function (spec) {\n        return composite$1(config.name, config.configFields, config.partFields, config.factory, spec);\n      };\n      var parts = generate$3(config.name, config.partFields);\n      var apis = map$1(config.apis, makeApi);\n      var extraApis = map$1(config.extraApis, function (f, k) {\n        return markAsExtraApi(f, k);\n      });\n      return __assign(__assign({\n        name: config.name,\n        partFields: config.partFields,\n        configFields: config.configFields,\n        sketch: sketch,\n        parts: parts\n      }, apis), extraApis);\n    };\n\n    var inside = function (target) {\n      return name$2(target) === 'input' && get$d(target, 'type') !== 'radio' || name$2(target) === 'textarea';\n    };\n\n    var getCurrent = function (component, composeConfig, _composeState) {\n      return composeConfig.find(component);\n    };\n\n    var ComposeApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        getCurrent: getCurrent\n    });\n\n    var ComposeSchema = [required$1('find')];\n\n    var Composing = create$8({\n      fields: ComposeSchema,\n      name: 'composing',\n      apis: ComposeApis\n    });\n\n    var nativeDisabled = [\n      'input',\n      'button',\n      'textarea',\n      'select'\n    ];\n    var onLoad$1 = function (component, disableConfig, disableState) {\n      var f = disableConfig.disabled() ? disable$1 : enable$1;\n      f(component, disableConfig);\n    };\n    var hasNative = function (component, config) {\n      return config.useNative === true && contains$2(nativeDisabled, name$2(component.element));\n    };\n    var nativeIsDisabled = function (component) {\n      return has$1(component.element, 'disabled');\n    };\n    var nativeDisable = function (component) {\n      set$8(component.element, 'disabled', 'disabled');\n    };\n    var nativeEnable = function (component) {\n      remove$7(component.element, 'disabled');\n    };\n    var ariaIsDisabled = function (component) {\n      return get$d(component.element, 'aria-disabled') === 'true';\n    };\n    var ariaDisable = function (component) {\n      set$8(component.element, 'aria-disabled', 'true');\n    };\n    var ariaEnable = function (component) {\n      set$8(component.element, 'aria-disabled', 'false');\n    };\n    var disable$1 = function (component, disableConfig, _disableState) {\n      disableConfig.disableClass.each(function (disableClass) {\n        add$2(component.element, disableClass);\n      });\n      var f = hasNative(component, disableConfig) ? nativeDisable : ariaDisable;\n      f(component);\n      disableConfig.onDisabled(component);\n    };\n    var enable$1 = function (component, disableConfig, _disableState) {\n      disableConfig.disableClass.each(function (disableClass) {\n        remove$2(component.element, disableClass);\n      });\n      var f = hasNative(component, disableConfig) ? nativeEnable : ariaEnable;\n      f(component);\n      disableConfig.onEnabled(component);\n    };\n    var isDisabled = function (component, disableConfig) {\n      return hasNative(component, disableConfig) ? nativeIsDisabled(component) : ariaIsDisabled(component);\n    };\n    var set$3 = function (component, disableConfig, disableState, disabled) {\n      var f = disabled ? disable$1 : enable$1;\n      f(component, disableConfig);\n    };\n\n    var DisableApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        enable: enable$1,\n        disable: disable$1,\n        isDisabled: isDisabled,\n        onLoad: onLoad$1,\n        set: set$3\n    });\n\n    var exhibit$5 = function (base, disableConfig) {\n      return nu$7({ classes: disableConfig.disabled() ? disableConfig.disableClass.toArray() : [] });\n    };\n    var events$e = function (disableConfig, disableState) {\n      return derive$2([\n        abort(execute$5(), function (component, _simulatedEvent) {\n          return isDisabled(component, disableConfig);\n        }),\n        loadEvent(disableConfig, disableState, onLoad$1)\n      ]);\n    };\n\n    var ActiveDisable = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit$5,\n        events: events$e\n    });\n\n    var DisableSchema = [\n      defaultedFunction('disabled', never),\n      defaulted('useNative', true),\n      option('disableClass'),\n      onHandler('onDisabled'),\n      onHandler('onEnabled')\n    ];\n\n    var Disabling = create$8({\n      fields: DisableSchema,\n      name: 'disabling',\n      active: ActiveDisable,\n      apis: DisableApis\n    });\n\n    var dehighlightAllExcept = function (component, hConfig, hState, skip) {\n      var highlighted = descendants(component.element, '.' + hConfig.highlightClass);\n      each$1(highlighted, function (h) {\n        if (!exists(skip, function (skipComp) {\n            return skipComp.element === h;\n          })) {\n          remove$2(h, hConfig.highlightClass);\n          component.getSystem().getByDom(h).each(function (target) {\n            hConfig.onDehighlight(component, target);\n            emit(target, dehighlight$1());\n          });\n        }\n      });\n    };\n    var dehighlightAll = function (component, hConfig, hState) {\n      return dehighlightAllExcept(component, hConfig, hState, []);\n    };\n    var dehighlight = function (component, hConfig, hState, target) {\n      if (isHighlighted(component, hConfig, hState, target)) {\n        remove$2(target.element, hConfig.highlightClass);\n        hConfig.onDehighlight(component, target);\n        emit(target, dehighlight$1());\n      }\n    };\n    var highlight = function (component, hConfig, hState, target) {\n      dehighlightAllExcept(component, hConfig, hState, [target]);\n      if (!isHighlighted(component, hConfig, hState, target)) {\n        add$2(target.element, hConfig.highlightClass);\n        hConfig.onHighlight(component, target);\n        emit(target, highlight$1());\n      }\n    };\n    var highlightFirst = function (component, hConfig, hState) {\n      getFirst(component, hConfig).each(function (firstComp) {\n        highlight(component, hConfig, hState, firstComp);\n      });\n    };\n    var highlightLast = function (component, hConfig, hState) {\n      getLast(component, hConfig).each(function (lastComp) {\n        highlight(component, hConfig, hState, lastComp);\n      });\n    };\n    var highlightAt = function (component, hConfig, hState, index) {\n      getByIndex(component, hConfig, hState, index).fold(function (err) {\n        throw err;\n      }, function (firstComp) {\n        highlight(component, hConfig, hState, firstComp);\n      });\n    };\n    var highlightBy = function (component, hConfig, hState, predicate) {\n      var candidates = getCandidates(component, hConfig);\n      var targetComp = find$5(candidates, predicate);\n      targetComp.each(function (c) {\n        highlight(component, hConfig, hState, c);\n      });\n    };\n    var isHighlighted = function (component, hConfig, hState, queryTarget) {\n      return has(queryTarget.element, hConfig.highlightClass);\n    };\n    var getHighlighted = function (component, hConfig, _hState) {\n      return descendant(component.element, '.' + hConfig.highlightClass).bind(function (e) {\n        return component.getSystem().getByDom(e).toOptional();\n      });\n    };\n    var getByIndex = function (component, hConfig, hState, index) {\n      var items = descendants(component.element, '.' + hConfig.itemClass);\n      return Optional.from(items[index]).fold(function () {\n        return Result.error(new Error('No element found with index ' + index));\n      }, component.getSystem().getByDom);\n    };\n    var getFirst = function (component, hConfig, _hState) {\n      return descendant(component.element, '.' + hConfig.itemClass).bind(function (e) {\n        return component.getSystem().getByDom(e).toOptional();\n      });\n    };\n    var getLast = function (component, hConfig, _hState) {\n      var items = descendants(component.element, '.' + hConfig.itemClass);\n      var last = items.length > 0 ? Optional.some(items[items.length - 1]) : Optional.none();\n      return last.bind(function (c) {\n        return component.getSystem().getByDom(c).toOptional();\n      });\n    };\n    var getDelta$2 = function (component, hConfig, hState, delta) {\n      var items = descendants(component.element, '.' + hConfig.itemClass);\n      var current = findIndex$1(items, function (item) {\n        return has(item, hConfig.highlightClass);\n      });\n      return current.bind(function (selected) {\n        var dest = cycleBy(selected, delta, 0, items.length - 1);\n        return component.getSystem().getByDom(items[dest]).toOptional();\n      });\n    };\n    var getPrevious = function (component, hConfig, hState) {\n      return getDelta$2(component, hConfig, hState, -1);\n    };\n    var getNext = function (component, hConfig, hState) {\n      return getDelta$2(component, hConfig, hState, +1);\n    };\n    var getCandidates = function (component, hConfig, _hState) {\n      var items = descendants(component.element, '.' + hConfig.itemClass);\n      return cat(map$2(items, function (i) {\n        return component.getSystem().getByDom(i).toOptional();\n      }));\n    };\n\n    var HighlightApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        dehighlightAll: dehighlightAll,\n        dehighlight: dehighlight,\n        highlight: highlight,\n        highlightFirst: highlightFirst,\n        highlightLast: highlightLast,\n        highlightAt: highlightAt,\n        highlightBy: highlightBy,\n        isHighlighted: isHighlighted,\n        getHighlighted: getHighlighted,\n        getFirst: getFirst,\n        getLast: getLast,\n        getPrevious: getPrevious,\n        getNext: getNext,\n        getCandidates: getCandidates\n    });\n\n    var HighlightSchema = [\n      required$1('highlightClass'),\n      required$1('itemClass'),\n      onHandler('onHighlight'),\n      onHandler('onDehighlight')\n    ];\n\n    var Highlighting = create$8({\n      fields: HighlightSchema,\n      name: 'highlighting',\n      apis: HighlightApis\n    });\n\n    var BACKSPACE = [8];\n    var TAB = [9];\n    var ENTER = [13];\n    var ESCAPE = [27];\n    var SPACE = [32];\n    var LEFT = [37];\n    var UP = [38];\n    var RIGHT = [39];\n    var DOWN = [40];\n\n    var cyclePrev = function (values, index, predicate) {\n      var before = reverse(values.slice(0, index));\n      var after = reverse(values.slice(index + 1));\n      return find$5(before.concat(after), predicate);\n    };\n    var tryPrev = function (values, index, predicate) {\n      var before = reverse(values.slice(0, index));\n      return find$5(before, predicate);\n    };\n    var cycleNext = function (values, index, predicate) {\n      var before = values.slice(0, index);\n      var after = values.slice(index + 1);\n      return find$5(after.concat(before), predicate);\n    };\n    var tryNext = function (values, index, predicate) {\n      var after = values.slice(index + 1);\n      return find$5(after, predicate);\n    };\n\n    var inSet = function (keys) {\n      return function (event) {\n        var raw = event.raw;\n        return contains$2(keys, raw.which);\n      };\n    };\n    var and = function (preds) {\n      return function (event) {\n        return forall(preds, function (pred) {\n          return pred(event);\n        });\n      };\n    };\n    var isShift = function (event) {\n      var raw = event.raw;\n      return raw.shiftKey === true;\n    };\n    var isControl = function (event) {\n      var raw = event.raw;\n      return raw.ctrlKey === true;\n    };\n    var isNotShift = not(isShift);\n\n    var rule = function (matches, action) {\n      return {\n        matches: matches,\n        classification: action\n      };\n    };\n    var choose = function (transitions, event) {\n      var transition = find$5(transitions, function (t) {\n        return t.matches(event);\n      });\n      return transition.map(function (t) {\n        return t.classification;\n      });\n    };\n\n    var reportFocusShifting = function (component, prevFocus, newFocus) {\n      var noChange = prevFocus.exists(function (p) {\n        return newFocus.exists(function (n) {\n          return eq(n, p);\n        });\n      });\n      if (!noChange) {\n        emitWith(component, focusShifted(), {\n          prevFocus: prevFocus,\n          newFocus: newFocus\n        });\n      }\n    };\n    var dom$2 = function () {\n      var get = function (component) {\n        return search(component.element);\n      };\n      var set = function (component, focusee) {\n        var prevFocus = get(component);\n        component.getSystem().triggerFocus(focusee, component.element);\n        var newFocus = get(component);\n        reportFocusShifting(component, prevFocus, newFocus);\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n    var highlights = function () {\n      var get = function (component) {\n        return Highlighting.getHighlighted(component).map(function (item) {\n          return item.element;\n        });\n      };\n      var set = function (component, element) {\n        var prevFocus = get(component);\n        component.getSystem().getByDom(element).fold(noop, function (item) {\n          Highlighting.highlight(component, item);\n        });\n        var newFocus = get(component);\n        reportFocusShifting(component, prevFocus, newFocus);\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var FocusInsideModes;\n    (function (FocusInsideModes) {\n      FocusInsideModes['OnFocusMode'] = 'onFocus';\n      FocusInsideModes['OnEnterOrSpaceMode'] = 'onEnterOrSpace';\n      FocusInsideModes['OnApiMode'] = 'onApi';\n    }(FocusInsideModes || (FocusInsideModes = {})));\n\n    var typical = function (infoSchema, stateInit, getKeydownRules, getKeyupRules, optFocusIn) {\n      var schema = function () {\n        return infoSchema.concat([\n          defaulted('focusManager', dom$2()),\n          defaultedOf('focusInside', 'onFocus', valueOf(function (val) {\n            return contains$2([\n              'onFocus',\n              'onEnterOrSpace',\n              'onApi'\n            ], val) ? Result.value(val) : Result.error('Invalid value for focusInside');\n          })),\n          output$1('handler', me),\n          output$1('state', stateInit),\n          output$1('sendFocusIn', optFocusIn)\n        ]);\n      };\n      var processKey = function (component, simulatedEvent, getRules, keyingConfig, keyingState) {\n        var rules = getRules(component, simulatedEvent, keyingConfig, keyingState);\n        return choose(rules, simulatedEvent.event).bind(function (rule) {\n          return rule(component, simulatedEvent, keyingConfig, keyingState);\n        });\n      };\n      var toEvents = function (keyingConfig, keyingState) {\n        var onFocusHandler = keyingConfig.focusInside !== FocusInsideModes.OnFocusMode ? Optional.none() : optFocusIn(keyingConfig).map(function (focusIn) {\n          return run$1(focus$4(), function (component, simulatedEvent) {\n            focusIn(component, keyingConfig, keyingState);\n            simulatedEvent.stop();\n          });\n        });\n        var tryGoInsideComponent = function (component, simulatedEvent) {\n          var isEnterOrSpace = inSet(SPACE.concat(ENTER))(simulatedEvent.event);\n          if (keyingConfig.focusInside === FocusInsideModes.OnEnterOrSpaceMode && isEnterOrSpace && isSource(component, simulatedEvent)) {\n            optFocusIn(keyingConfig).each(function (focusIn) {\n              focusIn(component, keyingConfig, keyingState);\n              simulatedEvent.stop();\n            });\n          }\n        };\n        var keyboardEvents = [\n          run$1(keydown(), function (component, simulatedEvent) {\n            processKey(component, simulatedEvent, getKeydownRules, keyingConfig, keyingState).fold(function () {\n              tryGoInsideComponent(component, simulatedEvent);\n            }, function (_) {\n              simulatedEvent.stop();\n            });\n          }),\n          run$1(keyup(), function (component, simulatedEvent) {\n            processKey(component, simulatedEvent, getKeyupRules, keyingConfig, keyingState).each(function (_) {\n              simulatedEvent.stop();\n            });\n          })\n        ];\n        return derive$2(onFocusHandler.toArray().concat(keyboardEvents));\n      };\n      var me = {\n        schema: schema,\n        processKey: processKey,\n        toEvents: toEvents\n      };\n      return me;\n    };\n\n    var create$6 = function (cyclicField) {\n      var schema = [\n        option('onEscape'),\n        option('onEnter'),\n        defaulted('selector', '[data-alloy-tabstop=\"true\"]:not(:disabled)'),\n        defaulted('firstTabstop', 0),\n        defaulted('useTabstopAt', always),\n        option('visibilitySelector')\n      ].concat([cyclicField]);\n      var isVisible = function (tabbingConfig, element) {\n        var target = tabbingConfig.visibilitySelector.bind(function (sel) {\n          return closest$1(element, sel);\n        }).getOr(element);\n        return get$b(target) > 0;\n      };\n      var findInitial = function (component, tabbingConfig) {\n        var tabstops = descendants(component.element, tabbingConfig.selector);\n        var visibles = filter$2(tabstops, function (elem) {\n          return isVisible(tabbingConfig, elem);\n        });\n        return Optional.from(visibles[tabbingConfig.firstTabstop]);\n      };\n      var findCurrent = function (component, tabbingConfig) {\n        return tabbingConfig.focusManager.get(component).bind(function (elem) {\n          return closest$1(elem, tabbingConfig.selector);\n        });\n      };\n      var isTabstop = function (tabbingConfig, element) {\n        return isVisible(tabbingConfig, element) && tabbingConfig.useTabstopAt(element);\n      };\n      var focusIn = function (component, tabbingConfig, _tabbingState) {\n        findInitial(component, tabbingConfig).each(function (target) {\n          tabbingConfig.focusManager.set(component, target);\n        });\n      };\n      var goFromTabstop = function (component, tabstops, stopIndex, tabbingConfig, cycle) {\n        return cycle(tabstops, stopIndex, function (elem) {\n          return isTabstop(tabbingConfig, elem);\n        }).fold(function () {\n          return tabbingConfig.cyclic ? Optional.some(true) : Optional.none();\n        }, function (target) {\n          tabbingConfig.focusManager.set(component, target);\n          return Optional.some(true);\n        });\n      };\n      var go = function (component, _simulatedEvent, tabbingConfig, cycle) {\n        var tabstops = descendants(component.element, tabbingConfig.selector);\n        return findCurrent(component, tabbingConfig).bind(function (tabstop) {\n          var optStopIndex = findIndex$1(tabstops, curry(eq, tabstop));\n          return optStopIndex.bind(function (stopIndex) {\n            return goFromTabstop(component, tabstops, stopIndex, tabbingConfig, cycle);\n          });\n        });\n      };\n      var goBackwards = function (component, simulatedEvent, tabbingConfig) {\n        var navigate = tabbingConfig.cyclic ? cyclePrev : tryPrev;\n        return go(component, simulatedEvent, tabbingConfig, navigate);\n      };\n      var goForwards = function (component, simulatedEvent, tabbingConfig) {\n        var navigate = tabbingConfig.cyclic ? cycleNext : tryNext;\n        return go(component, simulatedEvent, tabbingConfig, navigate);\n      };\n      var execute = function (component, simulatedEvent, tabbingConfig) {\n        return tabbingConfig.onEnter.bind(function (f) {\n          return f(component, simulatedEvent);\n        });\n      };\n      var exit = function (component, simulatedEvent, tabbingConfig) {\n        return tabbingConfig.onEscape.bind(function (f) {\n          return f(component, simulatedEvent);\n        });\n      };\n      var getKeydownRules = constant$1([\n        rule(and([\n          isShift,\n          inSet(TAB)\n        ]), goBackwards),\n        rule(inSet(TAB), goForwards),\n        rule(inSet(ESCAPE), exit),\n        rule(and([\n          isNotShift,\n          inSet(ENTER)\n        ]), execute)\n      ]);\n      var getKeyupRules = constant$1([]);\n      return typical(schema, NoState.init, getKeydownRules, getKeyupRules, function () {\n        return Optional.some(focusIn);\n      });\n    };\n\n    var AcyclicType = create$6(customField('cyclic', never));\n\n    var CyclicType = create$6(customField('cyclic', always));\n\n    var doDefaultExecute = function (component, _simulatedEvent, focused) {\n      dispatch(component, focused, execute$5());\n      return Optional.some(true);\n    };\n    var defaultExecute = function (component, simulatedEvent, focused) {\n      var isComplex = inside(focused) && inSet(SPACE)(simulatedEvent.event);\n      return isComplex ? Optional.none() : doDefaultExecute(component, simulatedEvent, focused);\n    };\n    var stopEventForFirefox = function (_component, _simulatedEvent) {\n      return Optional.some(true);\n    };\n\n    var schema$v = [\n      defaulted('execute', defaultExecute),\n      defaulted('useSpace', false),\n      defaulted('useEnter', true),\n      defaulted('useControlEnter', false),\n      defaulted('useDown', false)\n    ];\n    var execute$4 = function (component, simulatedEvent, executeConfig) {\n      return executeConfig.execute(component, simulatedEvent, component.element);\n    };\n    var getKeydownRules$5 = function (component, _simulatedEvent, executeConfig, _executeState) {\n      var spaceExec = executeConfig.useSpace && !inside(component.element) ? SPACE : [];\n      var enterExec = executeConfig.useEnter ? ENTER : [];\n      var downExec = executeConfig.useDown ? DOWN : [];\n      var execKeys = spaceExec.concat(enterExec).concat(downExec);\n      return [rule(inSet(execKeys), execute$4)].concat(executeConfig.useControlEnter ? [rule(and([\n          isControl,\n          inSet(ENTER)\n        ]), execute$4)] : []);\n    };\n    var getKeyupRules$5 = function (component, _simulatedEvent, executeConfig, _executeState) {\n      return executeConfig.useSpace && !inside(component.element) ? [rule(inSet(SPACE), stopEventForFirefox)] : [];\n    };\n    var ExecutionType = typical(schema$v, NoState.init, getKeydownRules$5, getKeyupRules$5, function () {\n      return Optional.none();\n    });\n\n    var flatgrid$1 = function () {\n      var dimensions = value$1();\n      var setGridSize = function (numRows, numColumns) {\n        dimensions.set({\n          numRows: numRows,\n          numColumns: numColumns\n        });\n      };\n      var getNumRows = function () {\n        return dimensions.get().map(function (d) {\n          return d.numRows;\n        });\n      };\n      var getNumColumns = function () {\n        return dimensions.get().map(function (d) {\n          return d.numColumns;\n        });\n      };\n      return nu$8({\n        readState: function () {\n          return dimensions.get().map(function (d) {\n            return {\n              numRows: String(d.numRows),\n              numColumns: String(d.numColumns)\n            };\n          }).getOr({\n            numRows: '?',\n            numColumns: '?'\n          });\n        },\n        setGridSize: setGridSize,\n        getNumRows: getNumRows,\n        getNumColumns: getNumColumns\n      });\n    };\n    var init$d = function (spec) {\n      return spec.state(spec);\n    };\n\n    var KeyingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        flatgrid: flatgrid$1,\n        init: init$d\n    });\n\n    var useH = function (movement) {\n      return function (component, simulatedEvent, config, state) {\n        var move = movement(component.element);\n        return use(move, component, simulatedEvent, config, state);\n      };\n    };\n    var west$1 = function (moveLeft, moveRight) {\n      var movement = onDirection(moveLeft, moveRight);\n      return useH(movement);\n    };\n    var east$1 = function (moveLeft, moveRight) {\n      var movement = onDirection(moveRight, moveLeft);\n      return useH(movement);\n    };\n    var useV = function (move) {\n      return function (component, simulatedEvent, config, state) {\n        return use(move, component, simulatedEvent, config, state);\n      };\n    };\n    var use = function (move, component, simulatedEvent, config, state) {\n      var outcome = config.focusManager.get(component).bind(function (focused) {\n        return move(component.element, focused, config, state);\n      });\n      return outcome.map(function (newFocus) {\n        config.focusManager.set(component, newFocus);\n        return true;\n      });\n    };\n    var north$1 = useV;\n    var south$1 = useV;\n    var move$1 = useV;\n\n    var isHidden$1 = function (dom) {\n      return dom.offsetWidth <= 0 && dom.offsetHeight <= 0;\n    };\n    var isVisible = function (element) {\n      return !isHidden$1(element.dom);\n    };\n\n    var locate = function (candidates, predicate) {\n      return findIndex$1(candidates, predicate).map(function (index) {\n        return {\n          index: index,\n          candidates: candidates\n        };\n      });\n    };\n\n    var locateVisible = function (container, current, selector) {\n      var predicate = function (x) {\n        return eq(x, current);\n      };\n      var candidates = descendants(container, selector);\n      var visible = filter$2(candidates, isVisible);\n      return locate(visible, predicate);\n    };\n    var findIndex = function (elements, target) {\n      return findIndex$1(elements, function (elem) {\n        return eq(target, elem);\n      });\n    };\n\n    var withGrid = function (values, index, numCols, f) {\n      var oldRow = Math.floor(index / numCols);\n      var oldColumn = index % numCols;\n      return f(oldRow, oldColumn).bind(function (address) {\n        var newIndex = address.row * numCols + address.column;\n        return newIndex >= 0 && newIndex < values.length ? Optional.some(values[newIndex]) : Optional.none();\n      });\n    };\n    var cycleHorizontal$1 = function (values, index, numRows, numCols, delta) {\n      return withGrid(values, index, numCols, function (oldRow, oldColumn) {\n        var onLastRow = oldRow === numRows - 1;\n        var colsInRow = onLastRow ? values.length - oldRow * numCols : numCols;\n        var newColumn = cycleBy(oldColumn, delta, 0, colsInRow - 1);\n        return Optional.some({\n          row: oldRow,\n          column: newColumn\n        });\n      });\n    };\n    var cycleVertical$1 = function (values, index, numRows, numCols, delta) {\n      return withGrid(values, index, numCols, function (oldRow, oldColumn) {\n        var newRow = cycleBy(oldRow, delta, 0, numRows - 1);\n        var onLastRow = newRow === numRows - 1;\n        var colsInRow = onLastRow ? values.length - newRow * numCols : numCols;\n        var newCol = clamp$1(oldColumn, 0, colsInRow - 1);\n        return Optional.some({\n          row: newRow,\n          column: newCol\n        });\n      });\n    };\n    var cycleRight$1 = function (values, index, numRows, numCols) {\n      return cycleHorizontal$1(values, index, numRows, numCols, +1);\n    };\n    var cycleLeft$1 = function (values, index, numRows, numCols) {\n      return cycleHorizontal$1(values, index, numRows, numCols, -1);\n    };\n    var cycleUp$1 = function (values, index, numRows, numCols) {\n      return cycleVertical$1(values, index, numRows, numCols, -1);\n    };\n    var cycleDown$1 = function (values, index, numRows, numCols) {\n      return cycleVertical$1(values, index, numRows, numCols, +1);\n    };\n\n    var schema$u = [\n      required$1('selector'),\n      defaulted('execute', defaultExecute),\n      onKeyboardHandler('onEscape'),\n      defaulted('captureTab', false),\n      initSize()\n    ];\n    var focusIn$3 = function (component, gridConfig, _gridState) {\n      descendant(component.element, gridConfig.selector).each(function (first) {\n        gridConfig.focusManager.set(component, first);\n      });\n    };\n    var findCurrent$1 = function (component, gridConfig) {\n      return gridConfig.focusManager.get(component).bind(function (elem) {\n        return closest$1(elem, gridConfig.selector);\n      });\n    };\n    var execute$3 = function (component, simulatedEvent, gridConfig, _gridState) {\n      return findCurrent$1(component, gridConfig).bind(function (focused) {\n        return gridConfig.execute(component, simulatedEvent, focused);\n      });\n    };\n    var doMove$2 = function (cycle) {\n      return function (element, focused, gridConfig, gridState) {\n        return locateVisible(element, focused, gridConfig.selector).bind(function (identified) {\n          return cycle(identified.candidates, identified.index, gridState.getNumRows().getOr(gridConfig.initSize.numRows), gridState.getNumColumns().getOr(gridConfig.initSize.numColumns));\n        });\n      };\n    };\n    var handleTab = function (_component, _simulatedEvent, gridConfig) {\n      return gridConfig.captureTab ? Optional.some(true) : Optional.none();\n    };\n    var doEscape$1 = function (component, simulatedEvent, gridConfig) {\n      return gridConfig.onEscape(component, simulatedEvent);\n    };\n    var moveLeft$3 = doMove$2(cycleLeft$1);\n    var moveRight$3 = doMove$2(cycleRight$1);\n    var moveNorth$1 = doMove$2(cycleUp$1);\n    var moveSouth$1 = doMove$2(cycleDown$1);\n    var getKeydownRules$4 = constant$1([\n      rule(inSet(LEFT), west$1(moveLeft$3, moveRight$3)),\n      rule(inSet(RIGHT), east$1(moveLeft$3, moveRight$3)),\n      rule(inSet(UP), north$1(moveNorth$1)),\n      rule(inSet(DOWN), south$1(moveSouth$1)),\n      rule(and([\n        isShift,\n        inSet(TAB)\n      ]), handleTab),\n      rule(and([\n        isNotShift,\n        inSet(TAB)\n      ]), handleTab),\n      rule(inSet(ESCAPE), doEscape$1),\n      rule(inSet(SPACE.concat(ENTER)), execute$3)\n    ]);\n    var getKeyupRules$4 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);\n    var FlatgridType = typical(schema$u, flatgrid$1, getKeydownRules$4, getKeyupRules$4, function () {\n      return Optional.some(focusIn$3);\n    });\n\n    var horizontal = function (container, selector, current, delta) {\n      var isDisabledButton = function (candidate) {\n        return name$2(candidate) === 'button' && get$d(candidate, 'disabled') === 'disabled';\n      };\n      var tryCycle = function (initial, index, candidates) {\n        var newIndex = cycleBy(index, delta, 0, candidates.length - 1);\n        if (newIndex === initial) {\n          return Optional.none();\n        } else {\n          return isDisabledButton(candidates[newIndex]) ? tryCycle(initial, newIndex, candidates) : Optional.from(candidates[newIndex]);\n        }\n      };\n      return locateVisible(container, current, selector).bind(function (identified) {\n        var index = identified.index;\n        var candidates = identified.candidates;\n        return tryCycle(index, index, candidates);\n      });\n    };\n\n    var schema$t = [\n      required$1('selector'),\n      defaulted('getInitial', Optional.none),\n      defaulted('execute', defaultExecute),\n      onKeyboardHandler('onEscape'),\n      defaulted('executeOnMove', false),\n      defaulted('allowVertical', true)\n    ];\n    var findCurrent = function (component, flowConfig) {\n      return flowConfig.focusManager.get(component).bind(function (elem) {\n        return closest$1(elem, flowConfig.selector);\n      });\n    };\n    var execute$2 = function (component, simulatedEvent, flowConfig) {\n      return findCurrent(component, flowConfig).bind(function (focused) {\n        return flowConfig.execute(component, simulatedEvent, focused);\n      });\n    };\n    var focusIn$2 = function (component, flowConfig, _state) {\n      flowConfig.getInitial(component).orThunk(function () {\n        return descendant(component.element, flowConfig.selector);\n      }).each(function (first) {\n        flowConfig.focusManager.set(component, first);\n      });\n    };\n    var moveLeft$2 = function (element, focused, info) {\n      return horizontal(element, info.selector, focused, -1);\n    };\n    var moveRight$2 = function (element, focused, info) {\n      return horizontal(element, info.selector, focused, +1);\n    };\n    var doMove$1 = function (movement) {\n      return function (component, simulatedEvent, flowConfig, flowState) {\n        return movement(component, simulatedEvent, flowConfig, flowState).bind(function () {\n          return flowConfig.executeOnMove ? execute$2(component, simulatedEvent, flowConfig) : Optional.some(true);\n        });\n      };\n    };\n    var doEscape = function (component, simulatedEvent, flowConfig) {\n      return flowConfig.onEscape(component, simulatedEvent);\n    };\n    var getKeydownRules$3 = function (_component, _se, flowConfig, _flowState) {\n      var westMovers = LEFT.concat(flowConfig.allowVertical ? UP : []);\n      var eastMovers = RIGHT.concat(flowConfig.allowVertical ? DOWN : []);\n      return [\n        rule(inSet(westMovers), doMove$1(west$1(moveLeft$2, moveRight$2))),\n        rule(inSet(eastMovers), doMove$1(east$1(moveLeft$2, moveRight$2))),\n        rule(inSet(ENTER), execute$2),\n        rule(inSet(SPACE), execute$2),\n        rule(inSet(ESCAPE), doEscape)\n      ];\n    };\n    var getKeyupRules$3 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);\n    var FlowType = typical(schema$t, NoState.init, getKeydownRules$3, getKeyupRules$3, function () {\n      return Optional.some(focusIn$2);\n    });\n\n    var toCell = function (matrix, rowIndex, columnIndex) {\n      return Optional.from(matrix[rowIndex]).bind(function (row) {\n        return Optional.from(row[columnIndex]).map(function (cell) {\n          return {\n            rowIndex: rowIndex,\n            columnIndex: columnIndex,\n            cell: cell\n          };\n        });\n      });\n    };\n    var cycleHorizontal = function (matrix, rowIndex, startCol, deltaCol) {\n      var row = matrix[rowIndex];\n      var colsInRow = row.length;\n      var newColIndex = cycleBy(startCol, deltaCol, 0, colsInRow - 1);\n      return toCell(matrix, rowIndex, newColIndex);\n    };\n    var cycleVertical = function (matrix, colIndex, startRow, deltaRow) {\n      var nextRowIndex = cycleBy(startRow, deltaRow, 0, matrix.length - 1);\n      var colsInNextRow = matrix[nextRowIndex].length;\n      var nextColIndex = clamp$1(colIndex, 0, colsInNextRow - 1);\n      return toCell(matrix, nextRowIndex, nextColIndex);\n    };\n    var moveHorizontal = function (matrix, rowIndex, startCol, deltaCol) {\n      var row = matrix[rowIndex];\n      var colsInRow = row.length;\n      var newColIndex = clamp$1(startCol + deltaCol, 0, colsInRow - 1);\n      return toCell(matrix, rowIndex, newColIndex);\n    };\n    var moveVertical = function (matrix, colIndex, startRow, deltaRow) {\n      var nextRowIndex = clamp$1(startRow + deltaRow, 0, matrix.length - 1);\n      var colsInNextRow = matrix[nextRowIndex].length;\n      var nextColIndex = clamp$1(colIndex, 0, colsInNextRow - 1);\n      return toCell(matrix, nextRowIndex, nextColIndex);\n    };\n    var cycleRight = function (matrix, startRow, startCol) {\n      return cycleHorizontal(matrix, startRow, startCol, +1);\n    };\n    var cycleLeft = function (matrix, startRow, startCol) {\n      return cycleHorizontal(matrix, startRow, startCol, -1);\n    };\n    var cycleUp = function (matrix, startRow, startCol) {\n      return cycleVertical(matrix, startCol, startRow, -1);\n    };\n    var cycleDown = function (matrix, startRow, startCol) {\n      return cycleVertical(matrix, startCol, startRow, +1);\n    };\n    var moveLeft$1 = function (matrix, startRow, startCol) {\n      return moveHorizontal(matrix, startRow, startCol, -1);\n    };\n    var moveRight$1 = function (matrix, startRow, startCol) {\n      return moveHorizontal(matrix, startRow, startCol, +1);\n    };\n    var moveUp$1 = function (matrix, startRow, startCol) {\n      return moveVertical(matrix, startCol, startRow, -1);\n    };\n    var moveDown$1 = function (matrix, startRow, startCol) {\n      return moveVertical(matrix, startCol, startRow, +1);\n    };\n\n    var schema$s = [\n      requiredObjOf('selectors', [\n        required$1('row'),\n        required$1('cell')\n      ]),\n      defaulted('cycles', true),\n      defaulted('previousSelector', Optional.none),\n      defaulted('execute', defaultExecute)\n    ];\n    var focusIn$1 = function (component, matrixConfig, _state) {\n      var focused = matrixConfig.previousSelector(component).orThunk(function () {\n        var selectors = matrixConfig.selectors;\n        return descendant(component.element, selectors.cell);\n      });\n      focused.each(function (cell) {\n        matrixConfig.focusManager.set(component, cell);\n      });\n    };\n    var execute$1 = function (component, simulatedEvent, matrixConfig) {\n      return search(component.element).bind(function (focused) {\n        return matrixConfig.execute(component, simulatedEvent, focused);\n      });\n    };\n    var toMatrix = function (rows, matrixConfig) {\n      return map$2(rows, function (row) {\n        return descendants(row, matrixConfig.selectors.cell);\n      });\n    };\n    var doMove = function (ifCycle, ifMove) {\n      return function (element, focused, matrixConfig) {\n        var move = matrixConfig.cycles ? ifCycle : ifMove;\n        return closest$1(focused, matrixConfig.selectors.row).bind(function (inRow) {\n          var cellsInRow = descendants(inRow, matrixConfig.selectors.cell);\n          return findIndex(cellsInRow, focused).bind(function (colIndex) {\n            var allRows = descendants(element, matrixConfig.selectors.row);\n            return findIndex(allRows, inRow).bind(function (rowIndex) {\n              var matrix = toMatrix(allRows, matrixConfig);\n              return move(matrix, rowIndex, colIndex).map(function (next) {\n                return next.cell;\n              });\n            });\n          });\n        });\n      };\n    };\n    var moveLeft = doMove(cycleLeft, moveLeft$1);\n    var moveRight = doMove(cycleRight, moveRight$1);\n    var moveNorth = doMove(cycleUp, moveUp$1);\n    var moveSouth = doMove(cycleDown, moveDown$1);\n    var getKeydownRules$2 = constant$1([\n      rule(inSet(LEFT), west$1(moveLeft, moveRight)),\n      rule(inSet(RIGHT), east$1(moveLeft, moveRight)),\n      rule(inSet(UP), north$1(moveNorth)),\n      rule(inSet(DOWN), south$1(moveSouth)),\n      rule(inSet(SPACE.concat(ENTER)), execute$1)\n    ]);\n    var getKeyupRules$2 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);\n    var MatrixType = typical(schema$s, NoState.init, getKeydownRules$2, getKeyupRules$2, function () {\n      return Optional.some(focusIn$1);\n    });\n\n    var schema$r = [\n      required$1('selector'),\n      defaulted('execute', defaultExecute),\n      defaulted('moveOnTab', false)\n    ];\n    var execute = function (component, simulatedEvent, menuConfig) {\n      return menuConfig.focusManager.get(component).bind(function (focused) {\n        return menuConfig.execute(component, simulatedEvent, focused);\n      });\n    };\n    var focusIn = function (component, menuConfig, _state) {\n      descendant(component.element, menuConfig.selector).each(function (first) {\n        menuConfig.focusManager.set(component, first);\n      });\n    };\n    var moveUp = function (element, focused, info) {\n      return horizontal(element, info.selector, focused, -1);\n    };\n    var moveDown = function (element, focused, info) {\n      return horizontal(element, info.selector, focused, +1);\n    };\n    var fireShiftTab = function (component, simulatedEvent, menuConfig, menuState) {\n      return menuConfig.moveOnTab ? move$1(moveUp)(component, simulatedEvent, menuConfig, menuState) : Optional.none();\n    };\n    var fireTab = function (component, simulatedEvent, menuConfig, menuState) {\n      return menuConfig.moveOnTab ? move$1(moveDown)(component, simulatedEvent, menuConfig, menuState) : Optional.none();\n    };\n    var getKeydownRules$1 = constant$1([\n      rule(inSet(UP), move$1(moveUp)),\n      rule(inSet(DOWN), move$1(moveDown)),\n      rule(and([\n        isShift,\n        inSet(TAB)\n      ]), fireShiftTab),\n      rule(and([\n        isNotShift,\n        inSet(TAB)\n      ]), fireTab),\n      rule(inSet(ENTER), execute),\n      rule(inSet(SPACE), execute)\n    ]);\n    var getKeyupRules$1 = constant$1([rule(inSet(SPACE), stopEventForFirefox)]);\n    var MenuType = typical(schema$r, NoState.init, getKeydownRules$1, getKeyupRules$1, function () {\n      return Optional.some(focusIn);\n    });\n\n    var schema$q = [\n      onKeyboardHandler('onSpace'),\n      onKeyboardHandler('onEnter'),\n      onKeyboardHandler('onShiftEnter'),\n      onKeyboardHandler('onLeft'),\n      onKeyboardHandler('onRight'),\n      onKeyboardHandler('onTab'),\n      onKeyboardHandler('onShiftTab'),\n      onKeyboardHandler('onUp'),\n      onKeyboardHandler('onDown'),\n      onKeyboardHandler('onEscape'),\n      defaulted('stopSpaceKeyup', false),\n      option('focusIn')\n    ];\n    var getKeydownRules = function (component, simulatedEvent, specialInfo) {\n      return [\n        rule(inSet(SPACE), specialInfo.onSpace),\n        rule(and([\n          isNotShift,\n          inSet(ENTER)\n        ]), specialInfo.onEnter),\n        rule(and([\n          isShift,\n          inSet(ENTER)\n        ]), specialInfo.onShiftEnter),\n        rule(and([\n          isShift,\n          inSet(TAB)\n        ]), specialInfo.onShiftTab),\n        rule(and([\n          isNotShift,\n          inSet(TAB)\n        ]), specialInfo.onTab),\n        rule(inSet(UP), specialInfo.onUp),\n        rule(inSet(DOWN), specialInfo.onDown),\n        rule(inSet(LEFT), specialInfo.onLeft),\n        rule(inSet(RIGHT), specialInfo.onRight),\n        rule(inSet(SPACE), specialInfo.onSpace),\n        rule(inSet(ESCAPE), specialInfo.onEscape)\n      ];\n    };\n    var getKeyupRules = function (component, simulatedEvent, specialInfo) {\n      return specialInfo.stopSpaceKeyup ? [rule(inSet(SPACE), stopEventForFirefox)] : [];\n    };\n    var SpecialType = typical(schema$q, NoState.init, getKeydownRules, getKeyupRules, function (specialInfo) {\n      return specialInfo.focusIn;\n    });\n\n    var acyclic = AcyclicType.schema();\n    var cyclic = CyclicType.schema();\n    var flow = FlowType.schema();\n    var flatgrid = FlatgridType.schema();\n    var matrix = MatrixType.schema();\n    var execution = ExecutionType.schema();\n    var menu = MenuType.schema();\n    var special = SpecialType.schema();\n\n    var KeyboardBranches = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        acyclic: acyclic,\n        cyclic: cyclic,\n        flow: flow,\n        flatgrid: flatgrid,\n        matrix: matrix,\n        execution: execution,\n        menu: menu,\n        special: special\n    });\n\n    var isFlatgridState = function (keyState) {\n      return hasNonNullableKey(keyState, 'setGridSize');\n    };\n    var Keying = createModes({\n      branchKey: 'mode',\n      branches: KeyboardBranches,\n      name: 'keying',\n      active: {\n        events: function (keyingConfig, keyingState) {\n          var handler = keyingConfig.handler;\n          return handler.toEvents(keyingConfig, keyingState);\n        }\n      },\n      apis: {\n        focusIn: function (component, keyConfig, keyState) {\n          keyConfig.sendFocusIn(keyConfig).fold(function () {\n            component.getSystem().triggerFocus(component.element, component.element);\n          }, function (sendFocusIn) {\n            sendFocusIn(component, keyConfig, keyState);\n          });\n        },\n        setGridSize: function (component, keyConfig, keyState, numRows, numColumns) {\n          if (!isFlatgridState(keyState)) {\n            console.error('Layout does not support setGridSize');\n          } else {\n            keyState.setGridSize(numRows, numColumns);\n          }\n        }\n      },\n      state: KeyingState\n    });\n\n    var set$2 = function (component, replaceConfig, replaceState, data) {\n      preserve$1(function () {\n        var newChildren = map$2(data, component.getSystem().build);\n        replaceChildren(component, newChildren);\n      }, component.element);\n    };\n    var insert = function (component, replaceConfig, insertion, childSpec) {\n      var child = component.getSystem().build(childSpec);\n      attachWith(component, child, insertion);\n    };\n    var append = function (component, replaceConfig, replaceState, appendee) {\n      insert(component, replaceConfig, append$2, appendee);\n    };\n    var prepend = function (component, replaceConfig, replaceState, prependee) {\n      insert(component, replaceConfig, prepend$1, prependee);\n    };\n    var remove = function (component, replaceConfig, replaceState, removee) {\n      var children = contents(component);\n      var foundChild = find$5(children, function (child) {\n        return eq(removee.element, child.element);\n      });\n      foundChild.each(detach);\n    };\n    var contents = function (component, _replaceConfig) {\n      return component.components();\n    };\n    var replaceAt = function (component, replaceConfig, replaceState, replaceeIndex, replacer) {\n      var children = contents(component);\n      return Optional.from(children[replaceeIndex]).map(function (replacee) {\n        remove(component, replaceConfig, replaceState, replacee);\n        replacer.each(function (r) {\n          insert(component, replaceConfig, function (p, c) {\n            appendAt(p, c, replaceeIndex);\n          }, r);\n        });\n        return replacee;\n      });\n    };\n    var replaceBy = function (component, replaceConfig, replaceState, replaceePred, replacer) {\n      var children = contents(component);\n      return findIndex$1(children, replaceePred).bind(function (replaceeIndex) {\n        return replaceAt(component, replaceConfig, replaceState, replaceeIndex, replacer);\n      });\n    };\n\n    var ReplaceApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        append: append,\n        prepend: prepend,\n        remove: remove,\n        replaceAt: replaceAt,\n        replaceBy: replaceBy,\n        set: set$2,\n        contents: contents\n    });\n\n    var Replacing = create$8({\n      fields: [],\n      name: 'replacing',\n      apis: ReplaceApis\n    });\n\n    var events$d = function (name, eventHandlers) {\n      var events = derive$2(eventHandlers);\n      return create$8({\n        fields: [required$1('enabled')],\n        name: name,\n        active: { events: constant$1(events) }\n      });\n    };\n    var config = function (name, eventHandlers) {\n      var me = events$d(name, eventHandlers);\n      return {\n        key: name,\n        value: {\n          config: {},\n          me: me,\n          configAsRaw: constant$1({}),\n          initialConfig: {},\n          state: NoState\n        }\n      };\n    };\n\n    var focus$2 = function (component, focusConfig) {\n      if (!focusConfig.ignore) {\n        focus$3(component.element);\n        focusConfig.onFocus(component);\n      }\n    };\n    var blur = function (component, focusConfig) {\n      if (!focusConfig.ignore) {\n        blur$1(component.element);\n      }\n    };\n    var isFocused = function (component) {\n      return hasFocus(component.element);\n    };\n\n    var FocusApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        focus: focus$2,\n        blur: blur,\n        isFocused: isFocused\n    });\n\n    var exhibit$4 = function (base, focusConfig) {\n      var mod = focusConfig.ignore ? {} : { attributes: { tabindex: '-1' } };\n      return nu$7(mod);\n    };\n    var events$c = function (focusConfig) {\n      return derive$2([run$1(focus$4(), function (component, simulatedEvent) {\n          focus$2(component, focusConfig);\n          simulatedEvent.stop();\n        })].concat(focusConfig.stopMousedown ? [run$1(mousedown(), function (_, simulatedEvent) {\n          simulatedEvent.event.prevent();\n        })] : []));\n    };\n\n    var ActiveFocus = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit$4,\n        events: events$c\n    });\n\n    var FocusSchema = [\n      onHandler('onFocus'),\n      defaulted('stopMousedown', false),\n      defaulted('ignore', false)\n    ];\n\n    var Focusing = create$8({\n      fields: FocusSchema,\n      name: 'focusing',\n      active: ActiveFocus,\n      apis: FocusApis\n    });\n\n    var SetupBehaviourCellState = function (initialState) {\n      var init = function () {\n        var cell = Cell(initialState);\n        var get = function () {\n          return cell.get();\n        };\n        var set = function (newState) {\n          return cell.set(newState);\n        };\n        var clear = function () {\n          return cell.set(initialState);\n        };\n        var readState = function () {\n          return cell.get();\n        };\n        return {\n          get: get,\n          set: set,\n          clear: clear,\n          readState: readState\n        };\n      };\n      return { init: init };\n    };\n\n    var updateAriaState = function (component, toggleConfig, toggleState) {\n      var ariaInfo = toggleConfig.aria;\n      ariaInfo.update(component, ariaInfo, toggleState.get());\n    };\n    var updateClass = function (component, toggleConfig, toggleState) {\n      toggleConfig.toggleClass.each(function (toggleClass) {\n        if (toggleState.get()) {\n          add$2(component.element, toggleClass);\n        } else {\n          remove$2(component.element, toggleClass);\n        }\n      });\n    };\n    var toggle$2 = function (component, toggleConfig, toggleState) {\n      set$1(component, toggleConfig, toggleState, !toggleState.get());\n    };\n    var on = function (component, toggleConfig, toggleState) {\n      toggleState.set(true);\n      updateClass(component, toggleConfig, toggleState);\n      updateAriaState(component, toggleConfig, toggleState);\n    };\n    var off = function (component, toggleConfig, toggleState) {\n      toggleState.set(false);\n      updateClass(component, toggleConfig, toggleState);\n      updateAriaState(component, toggleConfig, toggleState);\n    };\n    var set$1 = function (component, toggleConfig, toggleState, state) {\n      var action = state ? on : off;\n      action(component, toggleConfig, toggleState);\n    };\n    var isOn = function (component, toggleConfig, toggleState) {\n      return toggleState.get();\n    };\n    var onLoad = function (component, toggleConfig, toggleState) {\n      set$1(component, toggleConfig, toggleState, toggleConfig.selected);\n    };\n\n    var ToggleApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        onLoad: onLoad,\n        toggle: toggle$2,\n        isOn: isOn,\n        on: on,\n        off: off,\n        set: set$1\n    });\n\n    var exhibit$3 = function () {\n      return nu$7({});\n    };\n    var events$b = function (toggleConfig, toggleState) {\n      var execute = executeEvent(toggleConfig, toggleState, toggle$2);\n      var load = loadEvent(toggleConfig, toggleState, onLoad);\n      return derive$2(flatten([\n        toggleConfig.toggleOnExecute ? [execute] : [],\n        [load]\n      ]));\n    };\n\n    var ActiveToggle = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit$3,\n        events: events$b\n    });\n\n    var updatePressed = function (component, ariaInfo, status) {\n      set$8(component.element, 'aria-pressed', status);\n      if (ariaInfo.syncWithExpanded) {\n        updateExpanded(component, ariaInfo, status);\n      }\n    };\n    var updateSelected = function (component, ariaInfo, status) {\n      set$8(component.element, 'aria-selected', status);\n    };\n    var updateChecked = function (component, ariaInfo, status) {\n      set$8(component.element, 'aria-checked', status);\n    };\n    var updateExpanded = function (component, ariaInfo, status) {\n      set$8(component.element, 'aria-expanded', status);\n    };\n\n    var ToggleSchema = [\n      defaulted('selected', false),\n      option('toggleClass'),\n      defaulted('toggleOnExecute', true),\n      defaultedOf('aria', { mode: 'none' }, choose$1('mode', {\n        pressed: [\n          defaulted('syncWithExpanded', false),\n          output$1('update', updatePressed)\n        ],\n        checked: [output$1('update', updateChecked)],\n        expanded: [output$1('update', updateExpanded)],\n        selected: [output$1('update', updateSelected)],\n        none: [output$1('update', noop)]\n      }))\n    ];\n\n    var Toggling = create$8({\n      fields: ToggleSchema,\n      name: 'toggling',\n      active: ActiveToggle,\n      apis: ToggleApis,\n      state: SetupBehaviourCellState(false)\n    });\n\n    var pointerEvents = function () {\n      var onClick = function (component, simulatedEvent) {\n        simulatedEvent.stop();\n        emitExecute(component);\n      };\n      return [\n        run$1(click(), onClick),\n        run$1(tap(), onClick),\n        cutter(touchstart()),\n        cutter(mousedown())\n      ];\n    };\n    var events$a = function (optAction) {\n      var executeHandler = function (action) {\n        return runOnExecute$1(function (component, simulatedEvent) {\n          action(component);\n          simulatedEvent.stop();\n        });\n      };\n      return derive$2(flatten([\n        optAction.map(executeHandler).toArray(),\n        pointerEvents()\n      ]));\n    };\n\n    var hoverEvent = 'alloy.item-hover';\n    var focusEvent = 'alloy.item-focus';\n    var onHover = function (item) {\n      if (search(item.element).isNone() || Focusing.isFocused(item)) {\n        if (!Focusing.isFocused(item)) {\n          Focusing.focus(item);\n        }\n        emitWith(item, hoverEvent, { item: item });\n      }\n    };\n    var onFocus$1 = function (item) {\n      emitWith(item, focusEvent, { item: item });\n    };\n    var hover = constant$1(hoverEvent);\n    var focus$1 = constant$1(focusEvent);\n\n    var builder$2 = function (detail) {\n      return {\n        dom: detail.dom,\n        domModification: __assign(__assign({}, detail.domModification), { attributes: __assign(__assign(__assign({ 'role': detail.toggling.isSome() ? 'menuitemcheckbox' : 'menuitem' }, detail.domModification.attributes), { 'aria-haspopup': detail.hasSubmenu }), detail.hasSubmenu ? { 'aria-expanded': false } : {}) }),\n        behaviours: SketchBehaviours.augment(detail.itemBehaviours, [\n          detail.toggling.fold(Toggling.revoke, function (tConfig) {\n            return Toggling.config(__assign({ aria: { mode: 'checked' } }, tConfig));\n          }),\n          Focusing.config({\n            ignore: detail.ignoreFocus,\n            stopMousedown: detail.ignoreFocus,\n            onFocus: function (component) {\n              onFocus$1(component);\n            }\n          }),\n          Keying.config({ mode: 'execution' }),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: detail.data\n            }\n          }),\n          config('item-type-events', __spreadArray(__spreadArray([], pointerEvents(), true), [\n            run$1(mouseover(), onHover),\n            run$1(focusItem(), Focusing.focus)\n          ], false))\n        ]),\n        components: detail.components,\n        eventOrder: detail.eventOrder\n      };\n    };\n    var schema$p = [\n      required$1('data'),\n      required$1('components'),\n      required$1('dom'),\n      defaulted('hasSubmenu', false),\n      option('toggling'),\n      SketchBehaviours.field('itemBehaviours', [\n        Toggling,\n        Focusing,\n        Keying,\n        Representing\n      ]),\n      defaulted('ignoreFocus', false),\n      defaulted('domModification', {}),\n      output$1('builder', builder$2),\n      defaulted('eventOrder', {})\n    ];\n\n    var builder$1 = function (detail) {\n      return {\n        dom: detail.dom,\n        components: detail.components,\n        events: derive$2([stopper(focusItem())])\n      };\n    };\n    var schema$o = [\n      required$1('dom'),\n      required$1('components'),\n      output$1('builder', builder$1)\n    ];\n\n    var owner$2 = constant$1('item-widget');\n    var parts$h = constant$1([required({\n        name: 'widget',\n        overrides: function (detail) {\n          return {\n            behaviours: derive$1([Representing.config({\n                store: {\n                  mode: 'manual',\n                  getValue: function (_component) {\n                    return detail.data;\n                  },\n                  setValue: noop\n                }\n              })])\n          };\n        }\n      })]);\n\n    var builder = function (detail) {\n      var subs = substitutes(owner$2(), detail, parts$h());\n      var components = components$1(owner$2(), detail, subs.internals());\n      var focusWidget = function (component) {\n        return getPart(component, detail, 'widget').map(function (widget) {\n          Keying.focusIn(widget);\n          return widget;\n        });\n      };\n      var onHorizontalArrow = function (component, simulatedEvent) {\n        return inside(simulatedEvent.event.target) ? Optional.none() : function () {\n          if (detail.autofocus) {\n            simulatedEvent.setSource(component.element);\n            return Optional.none();\n          } else {\n            return Optional.none();\n          }\n        }();\n      };\n      return {\n        dom: detail.dom,\n        components: components,\n        domModification: detail.domModification,\n        events: derive$2([\n          runOnExecute$1(function (component, simulatedEvent) {\n            focusWidget(component).each(function (_widget) {\n              simulatedEvent.stop();\n            });\n          }),\n          run$1(mouseover(), onHover),\n          run$1(focusItem(), function (component, _simulatedEvent) {\n            if (detail.autofocus) {\n              focusWidget(component);\n            } else {\n              Focusing.focus(component);\n            }\n          })\n        ]),\n        behaviours: SketchBehaviours.augment(detail.widgetBehaviours, [\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: detail.data\n            }\n          }),\n          Focusing.config({\n            ignore: detail.ignoreFocus,\n            onFocus: function (component) {\n              onFocus$1(component);\n            }\n          }),\n          Keying.config({\n            mode: 'special',\n            focusIn: detail.autofocus ? function (component) {\n              focusWidget(component);\n            } : revoke(),\n            onLeft: onHorizontalArrow,\n            onRight: onHorizontalArrow,\n            onEscape: function (component, simulatedEvent) {\n              if (!Focusing.isFocused(component) && !detail.autofocus) {\n                Focusing.focus(component);\n                return Optional.some(true);\n              } else if (detail.autofocus) {\n                simulatedEvent.setSource(component.element);\n                return Optional.none();\n              } else {\n                return Optional.none();\n              }\n            }\n          })\n        ])\n      };\n    };\n    var schema$n = [\n      required$1('uid'),\n      required$1('data'),\n      required$1('components'),\n      required$1('dom'),\n      defaulted('autofocus', false),\n      defaulted('ignoreFocus', false),\n      SketchBehaviours.field('widgetBehaviours', [\n        Representing,\n        Focusing,\n        Keying\n      ]),\n      defaulted('domModification', {}),\n      defaultUidsSchema(parts$h()),\n      output$1('builder', builder)\n    ];\n\n    var itemSchema$2 = choose$1('type', {\n      widget: schema$n,\n      item: schema$p,\n      separator: schema$o\n    });\n    var configureGrid = function (detail, movementInfo) {\n      return {\n        mode: 'flatgrid',\n        selector: '.' + detail.markers.item,\n        initSize: {\n          numColumns: movementInfo.initSize.numColumns,\n          numRows: movementInfo.initSize.numRows\n        },\n        focusManager: detail.focusManager\n      };\n    };\n    var configureMatrix = function (detail, movementInfo) {\n      return {\n        mode: 'matrix',\n        selectors: {\n          row: movementInfo.rowSelector,\n          cell: '.' + detail.markers.item\n        },\n        focusManager: detail.focusManager\n      };\n    };\n    var configureMenu = function (detail, movementInfo) {\n      return {\n        mode: 'menu',\n        selector: '.' + detail.markers.item,\n        moveOnTab: movementInfo.moveOnTab,\n        focusManager: detail.focusManager\n      };\n    };\n    var parts$g = constant$1([group({\n        factory: {\n          sketch: function (spec) {\n            var itemInfo = asRawOrDie$1('menu.spec item', itemSchema$2, spec);\n            return itemInfo.builder(itemInfo);\n          }\n        },\n        name: 'items',\n        unit: 'item',\n        defaults: function (detail, u) {\n          return has$2(u, 'uid') ? u : __assign(__assign({}, u), { uid: generate$5('item') });\n        },\n        overrides: function (detail, u) {\n          return {\n            type: u.type,\n            ignoreFocus: detail.fakeFocus,\n            domModification: { classes: [detail.markers.item] }\n          };\n        }\n      })]);\n    var schema$m = constant$1([\n      required$1('value'),\n      required$1('items'),\n      required$1('dom'),\n      required$1('components'),\n      defaulted('eventOrder', {}),\n      field('menuBehaviours', [\n        Highlighting,\n        Representing,\n        Composing,\n        Keying\n      ]),\n      defaultedOf('movement', {\n        mode: 'menu',\n        moveOnTab: true\n      }, choose$1('mode', {\n        grid: [\n          initSize(),\n          output$1('config', configureGrid)\n        ],\n        matrix: [\n          output$1('config', configureMatrix),\n          required$1('rowSelector')\n        ],\n        menu: [\n          defaulted('moveOnTab', true),\n          output$1('config', configureMenu)\n        ]\n      })),\n      itemMarkers(),\n      defaulted('fakeFocus', false),\n      defaulted('focusManager', dom$2()),\n      onHandler('onHighlight')\n    ]);\n\n    var focus = constant$1('alloy.menu-focus');\n\n    var make$7 = function (detail, components, _spec, _externals) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        markers: detail.markers,\n        behaviours: augment(detail.menuBehaviours, [\n          Highlighting.config({\n            highlightClass: detail.markers.selectedItem,\n            itemClass: detail.markers.item,\n            onHighlight: detail.onHighlight\n          }),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: detail.value\n            }\n          }),\n          Composing.config({ find: Optional.some }),\n          Keying.config(detail.movement.config(detail, detail.movement))\n        ]),\n        events: derive$2([\n          run$1(focus$1(), function (menu, simulatedEvent) {\n            var event = simulatedEvent.event;\n            menu.getSystem().getByDom(event.target).each(function (item) {\n              Highlighting.highlight(menu, item);\n              simulatedEvent.stop();\n              emitWith(menu, focus(), {\n                menu: menu,\n                item: item\n              });\n            });\n          }),\n          run$1(hover(), function (menu, simulatedEvent) {\n            var item = simulatedEvent.event.item;\n            Highlighting.highlight(menu, item);\n          })\n        ]),\n        components: components,\n        eventOrder: detail.eventOrder,\n        domModification: { attributes: { role: 'menu' } }\n      };\n    };\n\n    var Menu = composite({\n      name: 'Menu',\n      configFields: schema$m(),\n      partFields: parts$g(),\n      factory: make$7\n    });\n\n    var transpose$1 = function (obj) {\n      return tupleMap(obj, function (v, k) {\n        return {\n          k: v,\n          v: k\n        };\n      });\n    };\n    var trace = function (items, byItem, byMenu, finish) {\n      return get$e(byMenu, finish).bind(function (triggerItem) {\n        return get$e(items, triggerItem).bind(function (triggerMenu) {\n          var rest = trace(items, byItem, byMenu, triggerMenu);\n          return Optional.some([triggerMenu].concat(rest));\n        });\n      }).getOr([]);\n    };\n    var generate$2 = function (menus, expansions) {\n      var items = {};\n      each(menus, function (menuItems, menu) {\n        each$1(menuItems, function (item) {\n          items[item] = menu;\n        });\n      });\n      var byItem = expansions;\n      var byMenu = transpose$1(expansions);\n      var menuPaths = map$1(byMenu, function (_triggerItem, submenu) {\n        return [submenu].concat(trace(items, byItem, byMenu, submenu));\n      });\n      return map$1(items, function (menu) {\n        return get$e(menuPaths, menu).getOr([menu]);\n      });\n    };\n\n    var init$c = function () {\n      var expansions = Cell({});\n      var menus = Cell({});\n      var paths = Cell({});\n      var primary = value$1();\n      var directory = Cell({});\n      var clear = function () {\n        expansions.set({});\n        menus.set({});\n        paths.set({});\n        primary.clear();\n      };\n      var isClear = function () {\n        return primary.get().isNone();\n      };\n      var setMenuBuilt = function (menuName, built) {\n        var _a;\n        menus.set(__assign(__assign({}, menus.get()), (_a = {}, _a[menuName] = {\n          type: 'prepared',\n          menu: built\n        }, _a)));\n      };\n      var setContents = function (sPrimary, sMenus, sExpansions, dir) {\n        primary.set(sPrimary);\n        expansions.set(sExpansions);\n        menus.set(sMenus);\n        directory.set(dir);\n        var sPaths = generate$2(dir, sExpansions);\n        paths.set(sPaths);\n      };\n      var getTriggeringItem = function (menuValue) {\n        return find$4(expansions.get(), function (v, _k) {\n          return v === menuValue;\n        });\n      };\n      var getTriggerData = function (menuValue, getItemByValue, path) {\n        return getPreparedMenu(menuValue).bind(function (menu) {\n          return getTriggeringItem(menuValue).bind(function (triggeringItemValue) {\n            return getItemByValue(triggeringItemValue).map(function (triggeredItem) {\n              return {\n                triggeredMenu: menu,\n                triggeringItem: triggeredItem,\n                triggeringPath: path\n              };\n            });\n          });\n        });\n      };\n      var getTriggeringPath = function (itemValue, getItemByValue) {\n        var extraPath = filter$2(lookupItem(itemValue).toArray(), function (menuValue) {\n          return getPreparedMenu(menuValue).isSome();\n        });\n        return get$e(paths.get(), itemValue).bind(function (path) {\n          var revPath = reverse(extraPath.concat(path));\n          var triggers = bind$3(revPath, function (menuValue, menuIndex) {\n            return getTriggerData(menuValue, getItemByValue, revPath.slice(0, menuIndex + 1)).fold(function () {\n              return is$1(primary.get(), menuValue) ? [] : [Optional.none()];\n            }, function (data) {\n              return [Optional.some(data)];\n            });\n          });\n          return sequence(triggers);\n        });\n      };\n      var expand = function (itemValue) {\n        return get$e(expansions.get(), itemValue).map(function (menu) {\n          var current = get$e(paths.get(), itemValue).getOr([]);\n          return [menu].concat(current);\n        });\n      };\n      var collapse = function (itemValue) {\n        return get$e(paths.get(), itemValue).bind(function (path) {\n          return path.length > 1 ? Optional.some(path.slice(1)) : Optional.none();\n        });\n      };\n      var refresh = function (itemValue) {\n        return get$e(paths.get(), itemValue);\n      };\n      var getPreparedMenu = function (menuValue) {\n        return lookupMenu(menuValue).bind(extractPreparedMenu);\n      };\n      var lookupMenu = function (menuValue) {\n        return get$e(menus.get(), menuValue);\n      };\n      var lookupItem = function (itemValue) {\n        return get$e(expansions.get(), itemValue);\n      };\n      var otherMenus = function (path) {\n        var menuValues = directory.get();\n        return difference(keys(menuValues), path);\n      };\n      var getPrimary = function () {\n        return primary.get().bind(getPreparedMenu);\n      };\n      var getMenus = function () {\n        return menus.get();\n      };\n      return {\n        setMenuBuilt: setMenuBuilt,\n        setContents: setContents,\n        expand: expand,\n        refresh: refresh,\n        collapse: collapse,\n        lookupMenu: lookupMenu,\n        lookupItem: lookupItem,\n        otherMenus: otherMenus,\n        getPrimary: getPrimary,\n        getMenus: getMenus,\n        clear: clear,\n        isClear: isClear,\n        getTriggeringPath: getTriggeringPath\n      };\n    };\n    var extractPreparedMenu = function (prep) {\n      return prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none();\n    };\n    var LayeredState = {\n      init: init$c,\n      extractPreparedMenu: extractPreparedMenu\n    };\n\n    var make$6 = function (detail, _rawUiSpec) {\n      var submenuParentItems = value$1();\n      var buildMenus = function (container, primaryName, menus) {\n        return map$1(menus, function (spec, name) {\n          var makeSketch = function () {\n            return Menu.sketch(__assign(__assign({}, spec), {\n              value: name,\n              markers: detail.markers,\n              fakeFocus: detail.fakeFocus,\n              onHighlight: detail.onHighlight,\n              focusManager: detail.fakeFocus ? highlights() : dom$2()\n            }));\n          };\n          return name === primaryName ? {\n            type: 'prepared',\n            menu: container.getSystem().build(makeSketch())\n          } : {\n            type: 'notbuilt',\n            nbMenu: makeSketch\n          };\n        });\n      };\n      var layeredState = LayeredState.init();\n      var setup = function (container) {\n        var componentMap = buildMenus(container, detail.data.primary, detail.data.menus);\n        var directory = toDirectory();\n        layeredState.setContents(detail.data.primary, componentMap, detail.data.expansions, directory);\n        return layeredState.getPrimary();\n      };\n      var getItemValue = function (item) {\n        return Representing.getValue(item).value;\n      };\n      var getItemByValue = function (_container, menus, itemValue) {\n        return findMap(menus, function (menu) {\n          if (!menu.getSystem().isConnected()) {\n            return Optional.none();\n          }\n          var candidates = Highlighting.getCandidates(menu);\n          return find$5(candidates, function (c) {\n            return getItemValue(c) === itemValue;\n          });\n        });\n      };\n      var toDirectory = function (_container) {\n        return map$1(detail.data.menus, function (data, _menuName) {\n          return bind$3(data.items, function (item) {\n            return item.type === 'separator' ? [] : [item.data.value];\n          });\n        });\n      };\n      var setActiveMenu = function (container, menu) {\n        Highlighting.highlight(container, menu);\n        Highlighting.getHighlighted(menu).orThunk(function () {\n          return Highlighting.getFirst(menu);\n        }).each(function (item) {\n          dispatch(container, item.element, focusItem());\n        });\n      };\n      var getMenus = function (state, menuValues) {\n        return cat(map$2(menuValues, function (mv) {\n          return state.lookupMenu(mv).bind(function (prep) {\n            return prep.type === 'prepared' ? Optional.some(prep.menu) : Optional.none();\n          });\n        }));\n      };\n      var closeOthers = function (container, state, path) {\n        var others = getMenus(state, state.otherMenus(path));\n        each$1(others, function (o) {\n          remove$1(o.element, [detail.markers.backgroundMenu]);\n          if (!detail.stayInDom) {\n            Replacing.remove(container, o);\n          }\n        });\n      };\n      var getSubmenuParents = function (container) {\n        return submenuParentItems.get().getOrThunk(function () {\n          var r = {};\n          var items = descendants(container.element, '.' + detail.markers.item);\n          var parentItems = filter$2(items, function (i) {\n            return get$d(i, 'aria-haspopup') === 'true';\n          });\n          each$1(parentItems, function (i) {\n            container.getSystem().getByDom(i).each(function (itemComp) {\n              var key = getItemValue(itemComp);\n              r[key] = itemComp;\n            });\n          });\n          submenuParentItems.set(r);\n          return r;\n        });\n      };\n      var updateAriaExpansions = function (container, path) {\n        var parentItems = getSubmenuParents(container);\n        each(parentItems, function (v, k) {\n          var expanded = contains$2(path, k);\n          set$8(v.element, 'aria-expanded', expanded);\n        });\n      };\n      var updateMenuPath = function (container, state, path) {\n        return Optional.from(path[0]).bind(function (latestMenuName) {\n          return state.lookupMenu(latestMenuName).bind(function (menuPrep) {\n            if (menuPrep.type === 'notbuilt') {\n              return Optional.none();\n            } else {\n              var activeMenu = menuPrep.menu;\n              var rest = getMenus(state, path.slice(1));\n              each$1(rest, function (r) {\n                add$2(r.element, detail.markers.backgroundMenu);\n              });\n              if (!inBody(activeMenu.element)) {\n                Replacing.append(container, premade(activeMenu));\n              }\n              remove$1(activeMenu.element, [detail.markers.backgroundMenu]);\n              setActiveMenu(container, activeMenu);\n              closeOthers(container, state, path);\n              return Optional.some(activeMenu);\n            }\n          });\n        });\n      };\n      var ExpandHighlightDecision;\n      (function (ExpandHighlightDecision) {\n        ExpandHighlightDecision[ExpandHighlightDecision['HighlightSubmenu'] = 0] = 'HighlightSubmenu';\n        ExpandHighlightDecision[ExpandHighlightDecision['HighlightParent'] = 1] = 'HighlightParent';\n      }(ExpandHighlightDecision || (ExpandHighlightDecision = {})));\n      var buildIfRequired = function (container, menuName, menuPrep) {\n        if (menuPrep.type === 'notbuilt') {\n          var menu = container.getSystem().build(menuPrep.nbMenu());\n          layeredState.setMenuBuilt(menuName, menu);\n          return menu;\n        } else {\n          return menuPrep.menu;\n        }\n      };\n      var expandRight = function (container, item, decision) {\n        if (decision === void 0) {\n          decision = ExpandHighlightDecision.HighlightSubmenu;\n        }\n        if (item.hasConfigured(Disabling) && Disabling.isDisabled(item)) {\n          return Optional.some(item);\n        } else {\n          var value = getItemValue(item);\n          return layeredState.expand(value).bind(function (path) {\n            updateAriaExpansions(container, path);\n            return Optional.from(path[0]).bind(function (menuName) {\n              return layeredState.lookupMenu(menuName).bind(function (activeMenuPrep) {\n                var activeMenu = buildIfRequired(container, menuName, activeMenuPrep);\n                if (!inBody(activeMenu.element)) {\n                  Replacing.append(container, premade(activeMenu));\n                }\n                detail.onOpenSubmenu(container, item, activeMenu, reverse(path));\n                if (decision === ExpandHighlightDecision.HighlightSubmenu) {\n                  Highlighting.highlightFirst(activeMenu);\n                  return updateMenuPath(container, layeredState, path);\n                } else {\n                  Highlighting.dehighlightAll(activeMenu);\n                  return Optional.some(item);\n                }\n              });\n            });\n          });\n        }\n      };\n      var collapseLeft = function (container, item) {\n        var value = getItemValue(item);\n        return layeredState.collapse(value).bind(function (path) {\n          updateAriaExpansions(container, path);\n          return updateMenuPath(container, layeredState, path).map(function (activeMenu) {\n            detail.onCollapseMenu(container, item, activeMenu);\n            return activeMenu;\n          });\n        });\n      };\n      var updateView = function (container, item) {\n        var value = getItemValue(item);\n        return layeredState.refresh(value).bind(function (path) {\n          updateAriaExpansions(container, path);\n          return updateMenuPath(container, layeredState, path);\n        });\n      };\n      var onRight = function (container, item) {\n        return inside(item.element) ? Optional.none() : expandRight(container, item, ExpandHighlightDecision.HighlightSubmenu);\n      };\n      var onLeft = function (container, item) {\n        return inside(item.element) ? Optional.none() : collapseLeft(container, item);\n      };\n      var onEscape = function (container, item) {\n        return collapseLeft(container, item).orThunk(function () {\n          return detail.onEscape(container, item).map(function () {\n            return container;\n          });\n        });\n      };\n      var keyOnItem = function (f) {\n        return function (container, simulatedEvent) {\n          return closest$1(simulatedEvent.getSource(), '.' + detail.markers.item).bind(function (target) {\n            return container.getSystem().getByDom(target).toOptional().bind(function (item) {\n              return f(container, item).map(always);\n            });\n          });\n        };\n      };\n      var events = derive$2([\n        run$1(focus(), function (sandbox, simulatedEvent) {\n          var item = simulatedEvent.event.item;\n          layeredState.lookupItem(getItemValue(item)).each(function () {\n            var menu = simulatedEvent.event.menu;\n            Highlighting.highlight(sandbox, menu);\n            var value = getItemValue(simulatedEvent.event.item);\n            layeredState.refresh(value).each(function (path) {\n              return closeOthers(sandbox, layeredState, path);\n            });\n          });\n        }),\n        runOnExecute$1(function (component, simulatedEvent) {\n          var target = simulatedEvent.event.target;\n          component.getSystem().getByDom(target).each(function (item) {\n            var itemValue = getItemValue(item);\n            if (itemValue.indexOf('collapse-item') === 0) {\n              collapseLeft(component, item);\n            }\n            expandRight(component, item, ExpandHighlightDecision.HighlightSubmenu).fold(function () {\n              detail.onExecute(component, item);\n            }, noop);\n          });\n        }),\n        runOnAttached(function (container, _simulatedEvent) {\n          setup(container).each(function (primary) {\n            Replacing.append(container, premade(primary));\n            detail.onOpenMenu(container, primary);\n            if (detail.highlightImmediately) {\n              setActiveMenu(container, primary);\n            }\n          });\n        })\n      ].concat(detail.navigateOnHover ? [run$1(hover(), function (sandbox, simulatedEvent) {\n          var item = simulatedEvent.event.item;\n          updateView(sandbox, item);\n          expandRight(sandbox, item, ExpandHighlightDecision.HighlightParent);\n          detail.onHover(sandbox, item);\n        })] : []));\n      var getActiveItem = function (container) {\n        return Highlighting.getHighlighted(container).bind(Highlighting.getHighlighted);\n      };\n      var collapseMenuApi = function (container) {\n        getActiveItem(container).each(function (currentItem) {\n          collapseLeft(container, currentItem);\n        });\n      };\n      var highlightPrimary = function (container) {\n        layeredState.getPrimary().each(function (primary) {\n          setActiveMenu(container, primary);\n        });\n      };\n      var extractMenuFromContainer = function (container) {\n        return Optional.from(container.components()[0]).filter(function (comp) {\n          return get$d(comp.element, 'role') === 'menu';\n        });\n      };\n      var repositionMenus = function (container) {\n        var maybeActivePrimary = layeredState.getPrimary().bind(function (primary) {\n          return getActiveItem(container).bind(function (currentItem) {\n            var itemValue = getItemValue(currentItem);\n            var allMenus = values(layeredState.getMenus());\n            var preparedMenus = cat(map$2(allMenus, LayeredState.extractPreparedMenu));\n            return layeredState.getTriggeringPath(itemValue, function (v) {\n              return getItemByValue(container, preparedMenus, v);\n            });\n          }).map(function (triggeringPath) {\n            return {\n              primary: primary,\n              triggeringPath: triggeringPath\n            };\n          });\n        });\n        maybeActivePrimary.fold(function () {\n          extractMenuFromContainer(container).each(function (primaryMenu) {\n            detail.onRepositionMenu(container, primaryMenu, []);\n          });\n        }, function (_a) {\n          var primary = _a.primary, triggeringPath = _a.triggeringPath;\n          detail.onRepositionMenu(container, primary, triggeringPath);\n        });\n      };\n      var apis = {\n        collapseMenu: collapseMenuApi,\n        highlightPrimary: highlightPrimary,\n        repositionMenus: repositionMenus\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        markers: detail.markers,\n        behaviours: augment(detail.tmenuBehaviours, [\n          Keying.config({\n            mode: 'special',\n            onRight: keyOnItem(onRight),\n            onLeft: keyOnItem(onLeft),\n            onEscape: keyOnItem(onEscape),\n            focusIn: function (container, _keyInfo) {\n              layeredState.getPrimary().each(function (primary) {\n                dispatch(container, primary.element, focusItem());\n              });\n            }\n          }),\n          Highlighting.config({\n            highlightClass: detail.markers.selectedMenu,\n            itemClass: detail.markers.menu\n          }),\n          Composing.config({\n            find: function (container) {\n              return Highlighting.getHighlighted(container);\n            }\n          }),\n          Replacing.config({})\n        ]),\n        eventOrder: detail.eventOrder,\n        apis: apis,\n        events: events\n      };\n    };\n    var collapseItem$1 = constant$1('collapse-item');\n\n    var tieredData = function (primary, menus, expansions) {\n      return {\n        primary: primary,\n        menus: menus,\n        expansions: expansions\n      };\n    };\n    var singleData = function (name, menu) {\n      return {\n        primary: name,\n        menus: wrap$1(name, menu),\n        expansions: {}\n      };\n    };\n    var collapseItem = function (text) {\n      return {\n        value: generate$6(collapseItem$1()),\n        meta: { text: text }\n      };\n    };\n    var tieredMenu = single({\n      name: 'TieredMenu',\n      configFields: [\n        onStrictKeyboardHandler('onExecute'),\n        onStrictKeyboardHandler('onEscape'),\n        onStrictHandler('onOpenMenu'),\n        onStrictHandler('onOpenSubmenu'),\n        onHandler('onRepositionMenu'),\n        onHandler('onCollapseMenu'),\n        defaulted('highlightImmediately', true),\n        requiredObjOf('data', [\n          required$1('primary'),\n          required$1('menus'),\n          required$1('expansions')\n        ]),\n        defaulted('fakeFocus', false),\n        onHandler('onHighlight'),\n        onHandler('onHover'),\n        tieredMenuMarkers(),\n        required$1('dom'),\n        defaulted('navigateOnHover', true),\n        defaulted('stayInDom', false),\n        field('tmenuBehaviours', [\n          Keying,\n          Highlighting,\n          Composing,\n          Replacing\n        ]),\n        defaulted('eventOrder', {})\n      ],\n      apis: {\n        collapseMenu: function (apis, tmenu) {\n          apis.collapseMenu(tmenu);\n        },\n        highlightPrimary: function (apis, tmenu) {\n          apis.highlightPrimary(tmenu);\n        },\n        repositionMenus: function (apis, tmenu) {\n          apis.repositionMenus(tmenu);\n        }\n      },\n      factory: make$6,\n      extraApis: {\n        tieredData: tieredData,\n        singleData: singleData,\n        collapseItem: collapseItem\n      }\n    });\n\n    var makeMenu = function (detail, menuSandbox, placementSpec, menuSpec, getBounds) {\n      var lazySink = function () {\n        return detail.lazySink(menuSandbox);\n      };\n      var layouts = menuSpec.type === 'horizontal' ? {\n        layouts: {\n          onLtr: function () {\n            return belowOrAbove();\n          },\n          onRtl: function () {\n            return belowOrAboveRtl();\n          }\n        }\n      } : {};\n      var isFirstTierSubmenu = function (triggeringPaths) {\n        return triggeringPaths.length === 2;\n      };\n      var getSubmenuLayouts = function (triggeringPaths) {\n        return isFirstTierSubmenu(triggeringPaths) ? layouts : {};\n      };\n      return tieredMenu.sketch({\n        dom: { tag: 'div' },\n        data: menuSpec.data,\n        markers: menuSpec.menu.markers,\n        highlightImmediately: menuSpec.menu.highlightImmediately,\n        onEscape: function () {\n          Sandboxing.close(menuSandbox);\n          detail.onEscape.map(function (handler) {\n            return handler(menuSandbox);\n          });\n          return Optional.some(true);\n        },\n        onExecute: function () {\n          return Optional.some(true);\n        },\n        onOpenMenu: function (tmenu, menu) {\n          Positioning.positionWithinBounds(lazySink().getOrDie(), menu, placementSpec, getBounds());\n        },\n        onOpenSubmenu: function (tmenu, item, submenu, triggeringPaths) {\n          var sink = lazySink().getOrDie();\n          Positioning.position(sink, submenu, {\n            anchor: __assign({\n              type: 'submenu',\n              item: item\n            }, getSubmenuLayouts(triggeringPaths))\n          });\n        },\n        onRepositionMenu: function (tmenu, primaryMenu, submenuTriggers) {\n          var sink = lazySink().getOrDie();\n          Positioning.positionWithinBounds(sink, primaryMenu, placementSpec, getBounds());\n          each$1(submenuTriggers, function (st) {\n            var submenuLayouts = getSubmenuLayouts(st.triggeringPath);\n            Positioning.position(sink, st.triggeredMenu, {\n              anchor: __assign({\n                type: 'submenu',\n                item: st.triggeringItem\n              }, submenuLayouts)\n            });\n          });\n        }\n      });\n    };\n    var factory$m = function (detail, spec) {\n      var isPartOfRelated = function (sandbox, queryElem) {\n        var related = detail.getRelated(sandbox);\n        return related.exists(function (rel) {\n          return isPartOf$1(rel, queryElem);\n        });\n      };\n      var setContent = function (sandbox, thing) {\n        Sandboxing.setContent(sandbox, thing);\n      };\n      var showAt = function (sandbox, thing, placementSpec) {\n        showWithin(sandbox, thing, placementSpec, Optional.none());\n      };\n      var showWithin = function (sandbox, thing, placementSpec, boxElement) {\n        showWithinBounds(sandbox, thing, placementSpec, function () {\n          return boxElement.map(function (elem) {\n            return box$1(elem);\n          });\n        });\n      };\n      var showWithinBounds = function (sandbox, thing, placementSpec, getBounds) {\n        var sink = detail.lazySink(sandbox).getOrDie();\n        Sandboxing.openWhileCloaked(sandbox, thing, function () {\n          return Positioning.positionWithinBounds(sink, sandbox, placementSpec, getBounds());\n        });\n        Representing.setValue(sandbox, Optional.some({\n          mode: 'position',\n          config: placementSpec,\n          getBounds: getBounds\n        }));\n      };\n      var showMenuAt = function (sandbox, placementSpec, menuSpec) {\n        showMenuWithinBounds(sandbox, placementSpec, menuSpec, Optional.none);\n      };\n      var showMenuWithinBounds = function (sandbox, placementSpec, menuSpec, getBounds) {\n        var menu = makeMenu(detail, sandbox, placementSpec, menuSpec, getBounds);\n        Sandboxing.open(sandbox, menu);\n        Representing.setValue(sandbox, Optional.some({\n          mode: 'menu',\n          menu: menu\n        }));\n      };\n      var hide = function (sandbox) {\n        if (Sandboxing.isOpen(sandbox)) {\n          Representing.setValue(sandbox, Optional.none());\n          Sandboxing.close(sandbox);\n        }\n      };\n      var getContent = function (sandbox) {\n        return Sandboxing.getState(sandbox);\n      };\n      var reposition = function (sandbox) {\n        if (Sandboxing.isOpen(sandbox)) {\n          Representing.getValue(sandbox).each(function (state) {\n            switch (state.mode) {\n            case 'menu':\n              Sandboxing.getState(sandbox).each(tieredMenu.repositionMenus);\n              break;\n            case 'position':\n              var sink = detail.lazySink(sandbox).getOrDie();\n              Positioning.positionWithinBounds(sink, sandbox, state.config, state.getBounds());\n              break;\n            }\n          });\n        }\n      };\n      var apis = {\n        setContent: setContent,\n        showAt: showAt,\n        showWithin: showWithin,\n        showWithinBounds: showWithinBounds,\n        showMenuAt: showMenuAt,\n        showMenuWithinBounds: showMenuWithinBounds,\n        hide: hide,\n        getContent: getContent,\n        reposition: reposition,\n        isOpen: Sandboxing.isOpen\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        behaviours: augment(detail.inlineBehaviours, [\n          Sandboxing.config({\n            isPartOf: function (sandbox, data, queryElem) {\n              return isPartOf$1(data, queryElem) || isPartOfRelated(sandbox, queryElem);\n            },\n            getAttachPoint: function (sandbox) {\n              return detail.lazySink(sandbox).getOrDie();\n            },\n            onOpen: function (sandbox) {\n              detail.onShow(sandbox);\n            },\n            onClose: function (sandbox) {\n              detail.onHide(sandbox);\n            }\n          }),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: Optional.none()\n            }\n          }),\n          Receiving.config({\n            channels: __assign(__assign({}, receivingChannel$1(__assign({ isExtraPart: spec.isExtraPart }, detail.fireDismissalEventInstead.map(function (fe) {\n              return { fireEventInstead: { event: fe.event } };\n            }).getOr({})))), receivingChannel(__assign(__assign({}, detail.fireRepositionEventInstead.map(function (fe) {\n              return { fireEventInstead: { event: fe.event } };\n            }).getOr({})), { doReposition: reposition })))\n          })\n        ]),\n        eventOrder: detail.eventOrder,\n        apis: apis\n      };\n    };\n    var InlineView = single({\n      name: 'InlineView',\n      configFields: [\n        required$1('lazySink'),\n        onHandler('onShow'),\n        onHandler('onHide'),\n        optionFunction('onEscape'),\n        field('inlineBehaviours', [\n          Sandboxing,\n          Representing,\n          Receiving\n        ]),\n        optionObjOf('fireDismissalEventInstead', [defaulted('event', dismissRequested())]),\n        optionObjOf('fireRepositionEventInstead', [defaulted('event', repositionRequested())]),\n        defaulted('getRelated', Optional.none),\n        defaulted('isExtraPart', never),\n        defaulted('eventOrder', Optional.none)\n      ],\n      factory: factory$m,\n      apis: {\n        showAt: function (apis, component, anchor, thing) {\n          apis.showAt(component, anchor, thing);\n        },\n        showWithin: function (apis, component, anchor, thing, boxElement) {\n          apis.showWithin(component, anchor, thing, boxElement);\n        },\n        showWithinBounds: function (apis, component, anchor, thing, bounds) {\n          apis.showWithinBounds(component, anchor, thing, bounds);\n        },\n        showMenuAt: function (apis, component, anchor, menuSpec) {\n          apis.showMenuAt(component, anchor, menuSpec);\n        },\n        showMenuWithinBounds: function (apis, component, anchor, menuSpec, bounds) {\n          apis.showMenuWithinBounds(component, anchor, menuSpec, bounds);\n        },\n        hide: function (apis, component) {\n          apis.hide(component);\n        },\n        isOpen: function (apis, component) {\n          return apis.isOpen(component);\n        },\n        getContent: function (apis, component) {\n          return apis.getContent(component);\n        },\n        setContent: function (apis, component, thing) {\n          apis.setContent(component, thing);\n        },\n        reposition: function (apis, component) {\n          apis.reposition(component);\n        }\n      }\n    });\n\n    var labelPrefix = 'layout-inset';\n    var westEdgeX = function (anchor) {\n      return anchor.x;\n    };\n    var middleX = function (anchor, element) {\n      return anchor.x + anchor.width / 2 - element.width / 2;\n    };\n    var eastEdgeX = function (anchor, element) {\n      return anchor.x + anchor.width - element.width;\n    };\n    var northY = function (anchor) {\n      return anchor.y;\n    };\n    var southY = function (anchor, element) {\n      return anchor.y + anchor.height - element.height;\n    };\n    var centreY = function (anchor, element) {\n      return anchor.y + anchor.height / 2 - element.height / 2;\n    };\n    var southwest = function (anchor, element, bubbles) {\n      return nu$6(eastEdgeX(anchor, element), southY(anchor, element), bubbles.insetSouthwest(), northwest$3(), 'southwest', boundsRestriction(anchor, {\n        right: 0,\n        bottom: 3\n      }), labelPrefix);\n    };\n    var southeast = function (anchor, element, bubbles) {\n      return nu$6(westEdgeX(anchor), southY(anchor, element), bubbles.insetSoutheast(), northeast$3(), 'southeast', boundsRestriction(anchor, {\n        left: 1,\n        bottom: 3\n      }), labelPrefix);\n    };\n    var northwest = function (anchor, element, bubbles) {\n      return nu$6(eastEdgeX(anchor, element), northY(anchor), bubbles.insetNorthwest(), southwest$3(), 'northwest', boundsRestriction(anchor, {\n        right: 0,\n        top: 2\n      }), labelPrefix);\n    };\n    var northeast = function (anchor, element, bubbles) {\n      return nu$6(westEdgeX(anchor), northY(anchor), bubbles.insetNortheast(), southeast$3(), 'northeast', boundsRestriction(anchor, {\n        left: 1,\n        top: 2\n      }), labelPrefix);\n    };\n    var north = function (anchor, element, bubbles) {\n      return nu$6(middleX(anchor, element), northY(anchor), bubbles.insetNorth(), south$3(), 'north', boundsRestriction(anchor, { top: 2 }), labelPrefix);\n    };\n    var south = function (anchor, element, bubbles) {\n      return nu$6(middleX(anchor, element), southY(anchor, element), bubbles.insetSouth(), north$3(), 'south', boundsRestriction(anchor, { bottom: 3 }), labelPrefix);\n    };\n    var east = function (anchor, element, bubbles) {\n      return nu$6(eastEdgeX(anchor, element), centreY(anchor, element), bubbles.insetEast(), west$3(), 'east', boundsRestriction(anchor, { right: 0 }), labelPrefix);\n    };\n    var west = function (anchor, element, bubbles) {\n      return nu$6(westEdgeX(anchor), centreY(anchor, element), bubbles.insetWest(), east$3(), 'west', boundsRestriction(anchor, { left: 1 }), labelPrefix);\n    };\n    var lookupPreserveLayout = function (lastPlacement) {\n      switch (lastPlacement) {\n      case 'north':\n        return north;\n      case 'northeast':\n        return northeast;\n      case 'northwest':\n        return northwest;\n      case 'south':\n        return south;\n      case 'southeast':\n        return southeast;\n      case 'southwest':\n        return southwest;\n      case 'east':\n        return east;\n      case 'west':\n        return west;\n      }\n    };\n    var preserve = function (anchor, element, bubbles, placee, bounds) {\n      var layout = getPlacement(placee).map(lookupPreserveLayout).getOr(north);\n      return layout(anchor, element, bubbles, placee, bounds);\n    };\n    var lookupFlippedLayout = function (lastPlacement) {\n      switch (lastPlacement) {\n      case 'north':\n        return south;\n      case 'northeast':\n        return southeast;\n      case 'northwest':\n        return southwest;\n      case 'south':\n        return north;\n      case 'southeast':\n        return northeast;\n      case 'southwest':\n        return northwest;\n      case 'east':\n        return west;\n      case 'west':\n        return east;\n      }\n    };\n    var flip$2 = function (anchor, element, bubbles, placee, bounds) {\n      var layout = getPlacement(placee).map(lookupFlippedLayout).getOr(north);\n      return layout(anchor, element, bubbles, placee, bounds);\n    };\n\n    var global$f = tinymce.util.Tools.resolve('tinymce.util.Delay');\n\n    var factory$l = function (detail) {\n      var events = events$a(detail.action);\n      var tag = detail.dom.tag;\n      var lookupAttr = function (attr) {\n        return get$e(detail.dom, 'attributes').bind(function (attrs) {\n          return get$e(attrs, attr);\n        });\n      };\n      var getModAttributes = function () {\n        if (tag === 'button') {\n          var type = lookupAttr('type').getOr('button');\n          var roleAttrs = lookupAttr('role').map(function (role) {\n            return { role: role };\n          }).getOr({});\n          return __assign({ type: type }, roleAttrs);\n        } else {\n          var role = lookupAttr('role').getOr('button');\n          return { role: role };\n        }\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: detail.components,\n        events: events,\n        behaviours: SketchBehaviours.augment(detail.buttonBehaviours, [\n          Focusing.config({}),\n          Keying.config({\n            mode: 'execution',\n            useSpace: true,\n            useEnter: true\n          })\n        ]),\n        domModification: { attributes: getModAttributes() },\n        eventOrder: detail.eventOrder\n      };\n    };\n    var Button = single({\n      name: 'Button',\n      factory: factory$l,\n      configFields: [\n        defaulted('uid', undefined),\n        required$1('dom'),\n        defaulted('components', []),\n        SketchBehaviours.field('buttonBehaviours', [\n          Focusing,\n          Keying\n        ]),\n        option('action'),\n        option('role'),\n        defaulted('eventOrder', {})\n      ]\n    });\n\n    var getAttrs = function (elem) {\n      var attributes = elem.dom.attributes !== undefined ? elem.dom.attributes : [];\n      return foldl(attributes, function (b, attr) {\n        var _a;\n        if (attr.name === 'class') {\n          return b;\n        } else {\n          return __assign(__assign({}, b), (_a = {}, _a[attr.name] = attr.value, _a));\n        }\n      }, {});\n    };\n    var getClasses = function (elem) {\n      return Array.prototype.slice.call(elem.dom.classList, 0);\n    };\n    var fromHtml = function (html) {\n      var elem = SugarElement.fromHtml(html);\n      var children$1 = children(elem);\n      var attrs = getAttrs(elem);\n      var classes = getClasses(elem);\n      var contents = children$1.length === 0 ? {} : { innerHtml: get$7(elem) };\n      return __assign({\n        tag: name$2(elem),\n        classes: classes,\n        attributes: attrs\n      }, contents);\n    };\n\n    var record = function (spec) {\n      var uid = isSketchSpec(spec) && hasNonNullableKey(spec, 'uid') ? spec.uid : generate$5('memento');\n      var get = function (anyInSystem) {\n        return anyInSystem.getSystem().getByUid(uid).getOrDie();\n      };\n      var getOpt = function (anyInSystem) {\n        return anyInSystem.getSystem().getByUid(uid).toOptional();\n      };\n      var asSpec = function () {\n        return __assign(__assign({}, spec), { uid: uid });\n      };\n      return {\n        get: get,\n        getOpt: getOpt,\n        asSpec: asSpec\n      };\n    };\n\n    function _typeof(obj) {\n      '@babel/helpers - typeof';\n      return _typeof = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (obj) {\n        return typeof obj;\n      } : function (obj) {\n        return obj && 'function' == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj;\n      }, _typeof(obj);\n    }\n    function _setPrototypeOf(o, p) {\n      _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n        o.__proto__ = p;\n        return o;\n      };\n      return _setPrototypeOf(o, p);\n    }\n    function _isNativeReflectConstruct() {\n      if (typeof Reflect === 'undefined' || !Reflect.construct)\n        return false;\n      if (Reflect.construct.sham)\n        return false;\n      if (typeof Proxy === 'function')\n        return true;\n      try {\n        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {\n        }));\n        return true;\n      } catch (e) {\n        return false;\n      }\n    }\n    function _construct(Parent, args, Class) {\n      if (_isNativeReflectConstruct()) {\n        _construct = Reflect.construct;\n      } else {\n        _construct = function _construct(Parent, args, Class) {\n          var a = [null];\n          a.push.apply(a, args);\n          var Constructor = Function.bind.apply(Parent, a);\n          var instance = new Constructor();\n          if (Class)\n            _setPrototypeOf(instance, Class.prototype);\n          return instance;\n        };\n      }\n      return _construct.apply(null, arguments);\n    }\n    function _toConsumableArray(arr) {\n      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n    }\n    function _arrayWithoutHoles(arr) {\n      if (Array.isArray(arr))\n        return _arrayLikeToArray(arr);\n    }\n    function _iterableToArray(iter) {\n      if (typeof Symbol !== 'undefined' && iter[Symbol.iterator] != null || iter['@@iterator'] != null)\n        return Array.from(iter);\n    }\n    function _unsupportedIterableToArray(o, minLen) {\n      if (!o)\n        return;\n      if (typeof o === 'string')\n        return _arrayLikeToArray(o, minLen);\n      var n = Object.prototype.toString.call(o).slice(8, -1);\n      if (n === 'Object' && o.constructor)\n        n = o.constructor.name;\n      if (n === 'Map' || n === 'Set')\n        return Array.from(o);\n      if (n === 'Arguments' || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))\n        return _arrayLikeToArray(o, minLen);\n    }\n    function _arrayLikeToArray(arr, len) {\n      if (len == null || len > arr.length)\n        len = arr.length;\n      for (var i = 0, arr2 = new Array(len); i < len; i++)\n        arr2[i] = arr[i];\n      return arr2;\n    }\n    function _nonIterableSpread() {\n      throw new TypeError('Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');\n    }\n    var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n    var freeze = Object.freeze, seal = Object.seal, create$5 = Object.create;\n    var _ref = typeof Reflect !== 'undefined' && Reflect, apply$1 = _ref.apply, construct = _ref.construct;\n    if (!apply$1) {\n      apply$1 = function apply(fun, thisValue, args) {\n        return fun.apply(thisValue, args);\n      };\n    }\n    if (!freeze) {\n      freeze = function freeze(x) {\n        return x;\n      };\n    }\n    if (!seal) {\n      seal = function seal(x) {\n        return x;\n      };\n    }\n    if (!construct) {\n      construct = function construct(Func, args) {\n        return _construct(Func, _toConsumableArray(args));\n      };\n    }\n    var arrayForEach = unapply(Array.prototype.forEach);\n    var arrayPop = unapply(Array.prototype.pop);\n    var arrayPush = unapply(Array.prototype.push);\n    var stringToLowerCase = unapply(String.prototype.toLowerCase);\n    var stringMatch = unapply(String.prototype.match);\n    var stringReplace = unapply(String.prototype.replace);\n    var stringIndexOf = unapply(String.prototype.indexOf);\n    var stringTrim = unapply(String.prototype.trim);\n    var regExpTest = unapply(RegExp.prototype.test);\n    var typeErrorCreate = unconstruct(TypeError);\n    function unapply(func) {\n      return function (thisArg) {\n        for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n          args[_key - 1] = arguments[_key];\n        }\n        return apply$1(func, thisArg, args);\n      };\n    }\n    function unconstruct(func) {\n      return function () {\n        for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n          args[_key2] = arguments[_key2];\n        }\n        return construct(func, args);\n      };\n    }\n    function addToSet(set, array) {\n      if (setPrototypeOf) {\n        setPrototypeOf(set, null);\n      }\n      var l = array.length;\n      while (l--) {\n        var element = array[l];\n        if (typeof element === 'string') {\n          var lcElement = stringToLowerCase(element);\n          if (lcElement !== element) {\n            if (!isFrozen(array)) {\n              array[l] = lcElement;\n            }\n            element = lcElement;\n          }\n        }\n        set[element] = true;\n      }\n      return set;\n    }\n    function clone$1(object) {\n      var newObject = create$5(null);\n      var property;\n      for (property in object) {\n        if (apply$1(hasOwnProperty, object, [property])) {\n          newObject[property] = object[property];\n        }\n      }\n      return newObject;\n    }\n    function lookupGetter(object, prop) {\n      while (object !== null) {\n        var desc = getOwnPropertyDescriptor(object, prop);\n        if (desc) {\n          if (desc.get) {\n            return unapply(desc.get);\n          }\n          if (typeof desc.value === 'function') {\n            return unapply(desc.value);\n          }\n        }\n        object = getPrototypeOf(object);\n      }\n      function fallbackValue(element) {\n        console.warn('fallback value for', element);\n        return null;\n      }\n      return fallbackValue;\n    }\n    var html$1 = freeze([\n      'a',\n      'abbr',\n      'acronym',\n      'address',\n      'area',\n      'article',\n      'aside',\n      'audio',\n      'b',\n      'bdi',\n      'bdo',\n      'big',\n      'blink',\n      'blockquote',\n      'body',\n      'br',\n      'button',\n      'canvas',\n      'caption',\n      'center',\n      'cite',\n      'code',\n      'col',\n      'colgroup',\n      'content',\n      'data',\n      'datalist',\n      'dd',\n      'decorator',\n      'del',\n      'details',\n      'dfn',\n      'dialog',\n      'dir',\n      'div',\n      'dl',\n      'dt',\n      'element',\n      'em',\n      'fieldset',\n      'figcaption',\n      'figure',\n      'font',\n      'footer',\n      'form',\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6',\n      'head',\n      'header',\n      'hgroup',\n      'hr',\n      'html',\n      'i',\n      'img',\n      'input',\n      'ins',\n      'kbd',\n      'label',\n      'legend',\n      'li',\n      'main',\n      'map',\n      'mark',\n      'marquee',\n      'menu',\n      'menuitem',\n      'meter',\n      'nav',\n      'nobr',\n      'ol',\n      'optgroup',\n      'option',\n      'output',\n      'p',\n      'picture',\n      'pre',\n      'progress',\n      'q',\n      'rp',\n      'rt',\n      'ruby',\n      's',\n      'samp',\n      'section',\n      'select',\n      'shadow',\n      'small',\n      'source',\n      'spacer',\n      'span',\n      'strike',\n      'strong',\n      'style',\n      'sub',\n      'summary',\n      'sup',\n      'table',\n      'tbody',\n      'td',\n      'template',\n      'textarea',\n      'tfoot',\n      'th',\n      'thead',\n      'time',\n      'tr',\n      'track',\n      'tt',\n      'u',\n      'ul',\n      'var',\n      'video',\n      'wbr'\n    ]);\n    var svg$1 = freeze([\n      'svg',\n      'a',\n      'altglyph',\n      'altglyphdef',\n      'altglyphitem',\n      'animatecolor',\n      'animatemotion',\n      'animatetransform',\n      'circle',\n      'clippath',\n      'defs',\n      'desc',\n      'ellipse',\n      'filter',\n      'font',\n      'g',\n      'glyph',\n      'glyphref',\n      'hkern',\n      'image',\n      'line',\n      'lineargradient',\n      'marker',\n      'mask',\n      'metadata',\n      'mpath',\n      'path',\n      'pattern',\n      'polygon',\n      'polyline',\n      'radialgradient',\n      'rect',\n      'stop',\n      'style',\n      'switch',\n      'symbol',\n      'text',\n      'textpath',\n      'title',\n      'tref',\n      'tspan',\n      'view',\n      'vkern'\n    ]);\n    var svgFilters = freeze([\n      'feBlend',\n      'feColorMatrix',\n      'feComponentTransfer',\n      'feComposite',\n      'feConvolveMatrix',\n      'feDiffuseLighting',\n      'feDisplacementMap',\n      'feDistantLight',\n      'feFlood',\n      'feFuncA',\n      'feFuncB',\n      'feFuncG',\n      'feFuncR',\n      'feGaussianBlur',\n      'feImage',\n      'feMerge',\n      'feMergeNode',\n      'feMorphology',\n      'feOffset',\n      'fePointLight',\n      'feSpecularLighting',\n      'feSpotLight',\n      'feTile',\n      'feTurbulence'\n    ]);\n    var svgDisallowed = freeze([\n      'animate',\n      'color-profile',\n      'cursor',\n      'discard',\n      'fedropshadow',\n      'font-face',\n      'font-face-format',\n      'font-face-name',\n      'font-face-src',\n      'font-face-uri',\n      'foreignobject',\n      'hatch',\n      'hatchpath',\n      'mesh',\n      'meshgradient',\n      'meshpatch',\n      'meshrow',\n      'missing-glyph',\n      'script',\n      'set',\n      'solidcolor',\n      'unknown',\n      'use'\n    ]);\n    var mathMl$1 = freeze([\n      'math',\n      'menclose',\n      'merror',\n      'mfenced',\n      'mfrac',\n      'mglyph',\n      'mi',\n      'mlabeledtr',\n      'mmultiscripts',\n      'mn',\n      'mo',\n      'mover',\n      'mpadded',\n      'mphantom',\n      'mroot',\n      'mrow',\n      'ms',\n      'mspace',\n      'msqrt',\n      'mstyle',\n      'msub',\n      'msup',\n      'msubsup',\n      'mtable',\n      'mtd',\n      'mtext',\n      'mtr',\n      'munder',\n      'munderover'\n    ]);\n    var mathMlDisallowed = freeze([\n      'maction',\n      'maligngroup',\n      'malignmark',\n      'mlongdiv',\n      'mscarries',\n      'mscarry',\n      'msgroup',\n      'mstack',\n      'msline',\n      'msrow',\n      'semantics',\n      'annotation',\n      'annotation-xml',\n      'mprescripts',\n      'none'\n    ]);\n    var text = freeze(['#text']);\n    var html = freeze([\n      'accept',\n      'action',\n      'align',\n      'alt',\n      'autocapitalize',\n      'autocomplete',\n      'autopictureinpicture',\n      'autoplay',\n      'background',\n      'bgcolor',\n      'border',\n      'capture',\n      'cellpadding',\n      'cellspacing',\n      'checked',\n      'cite',\n      'class',\n      'clear',\n      'color',\n      'cols',\n      'colspan',\n      'controls',\n      'controlslist',\n      'coords',\n      'crossorigin',\n      'datetime',\n      'decoding',\n      'default',\n      'dir',\n      'disabled',\n      'disablepictureinpicture',\n      'disableremoteplayback',\n      'download',\n      'draggable',\n      'enctype',\n      'enterkeyhint',\n      'face',\n      'for',\n      'headers',\n      'height',\n      'hidden',\n      'high',\n      'href',\n      'hreflang',\n      'id',\n      'inputmode',\n      'integrity',\n      'ismap',\n      'kind',\n      'label',\n      'lang',\n      'list',\n      'loading',\n      'loop',\n      'low',\n      'max',\n      'maxlength',\n      'media',\n      'method',\n      'min',\n      'minlength',\n      'multiple',\n      'muted',\n      'name',\n      'nonce',\n      'noshade',\n      'novalidate',\n      'nowrap',\n      'open',\n      'optimum',\n      'pattern',\n      'placeholder',\n      'playsinline',\n      'poster',\n      'preload',\n      'pubdate',\n      'radiogroup',\n      'readonly',\n      'rel',\n      'required',\n      'rev',\n      'reversed',\n      'role',\n      'rows',\n      'rowspan',\n      'spellcheck',\n      'scope',\n      'selected',\n      'shape',\n      'size',\n      'sizes',\n      'span',\n      'srclang',\n      'start',\n      'src',\n      'srcset',\n      'step',\n      'style',\n      'summary',\n      'tabindex',\n      'title',\n      'translate',\n      'type',\n      'usemap',\n      'valign',\n      'value',\n      'width',\n      'xmlns',\n      'slot'\n    ]);\n    var svg = freeze([\n      'accent-height',\n      'accumulate',\n      'additive',\n      'alignment-baseline',\n      'ascent',\n      'attributename',\n      'attributetype',\n      'azimuth',\n      'basefrequency',\n      'baseline-shift',\n      'begin',\n      'bias',\n      'by',\n      'class',\n      'clip',\n      'clippathunits',\n      'clip-path',\n      'clip-rule',\n      'color',\n      'color-interpolation',\n      'color-interpolation-filters',\n      'color-profile',\n      'color-rendering',\n      'cx',\n      'cy',\n      'd',\n      'dx',\n      'dy',\n      'diffuseconstant',\n      'direction',\n      'display',\n      'divisor',\n      'dur',\n      'edgemode',\n      'elevation',\n      'end',\n      'fill',\n      'fill-opacity',\n      'fill-rule',\n      'filter',\n      'filterunits',\n      'flood-color',\n      'flood-opacity',\n      'font-family',\n      'font-size',\n      'font-size-adjust',\n      'font-stretch',\n      'font-style',\n      'font-variant',\n      'font-weight',\n      'fx',\n      'fy',\n      'g1',\n      'g2',\n      'glyph-name',\n      'glyphref',\n      'gradientunits',\n      'gradienttransform',\n      'height',\n      'href',\n      'id',\n      'image-rendering',\n      'in',\n      'in2',\n      'k',\n      'k1',\n      'k2',\n      'k3',\n      'k4',\n      'kerning',\n      'keypoints',\n      'keysplines',\n      'keytimes',\n      'lang',\n      'lengthadjust',\n      'letter-spacing',\n      'kernelmatrix',\n      'kernelunitlength',\n      'lighting-color',\n      'local',\n      'marker-end',\n      'marker-mid',\n      'marker-start',\n      'markerheight',\n      'markerunits',\n      'markerwidth',\n      'maskcontentunits',\n      'maskunits',\n      'max',\n      'mask',\n      'media',\n      'method',\n      'mode',\n      'min',\n      'name',\n      'numoctaves',\n      'offset',\n      'operator',\n      'opacity',\n      'order',\n      'orient',\n      'orientation',\n      'origin',\n      'overflow',\n      'paint-order',\n      'path',\n      'pathlength',\n      'patterncontentunits',\n      'patterntransform',\n      'patternunits',\n      'points',\n      'preservealpha',\n      'preserveaspectratio',\n      'primitiveunits',\n      'r',\n      'rx',\n      'ry',\n      'radius',\n      'refx',\n      'refy',\n      'repeatcount',\n      'repeatdur',\n      'restart',\n      'result',\n      'rotate',\n      'scale',\n      'seed',\n      'shape-rendering',\n      'specularconstant',\n      'specularexponent',\n      'spreadmethod',\n      'startoffset',\n      'stddeviation',\n      'stitchtiles',\n      'stop-color',\n      'stop-opacity',\n      'stroke-dasharray',\n      'stroke-dashoffset',\n      'stroke-linecap',\n      'stroke-linejoin',\n      'stroke-miterlimit',\n      'stroke-opacity',\n      'stroke',\n      'stroke-width',\n      'style',\n      'surfacescale',\n      'systemlanguage',\n      'tabindex',\n      'targetx',\n      'targety',\n      'transform',\n      'transform-origin',\n      'text-anchor',\n      'text-decoration',\n      'text-rendering',\n      'textlength',\n      'type',\n      'u1',\n      'u2',\n      'unicode',\n      'values',\n      'viewbox',\n      'visibility',\n      'version',\n      'vert-adv-y',\n      'vert-origin-x',\n      'vert-origin-y',\n      'width',\n      'word-spacing',\n      'wrap',\n      'writing-mode',\n      'xchannelselector',\n      'ychannelselector',\n      'x',\n      'x1',\n      'x2',\n      'xmlns',\n      'y',\n      'y1',\n      'y2',\n      'z',\n      'zoomandpan'\n    ]);\n    var mathMl = freeze([\n      'accent',\n      'accentunder',\n      'align',\n      'bevelled',\n      'close',\n      'columnsalign',\n      'columnlines',\n      'columnspan',\n      'denomalign',\n      'depth',\n      'dir',\n      'display',\n      'displaystyle',\n      'encoding',\n      'fence',\n      'frame',\n      'height',\n      'href',\n      'id',\n      'largeop',\n      'length',\n      'linethickness',\n      'lspace',\n      'lquote',\n      'mathbackground',\n      'mathcolor',\n      'mathsize',\n      'mathvariant',\n      'maxsize',\n      'minsize',\n      'movablelimits',\n      'notation',\n      'numalign',\n      'open',\n      'rowalign',\n      'rowlines',\n      'rowspacing',\n      'rowspan',\n      'rspace',\n      'rquote',\n      'scriptlevel',\n      'scriptminsize',\n      'scriptsizemultiplier',\n      'selection',\n      'separator',\n      'separators',\n      'stretchy',\n      'subscriptshift',\n      'supscriptshift',\n      'symmetric',\n      'voffset',\n      'width',\n      'xmlns'\n    ]);\n    var xml = freeze([\n      'xlink:href',\n      'xml:id',\n      'xlink:title',\n      'xml:space',\n      'xmlns:xlink'\n    ]);\n    var MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm);\n    var ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\n    var DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]/);\n    var ARIA_ATTR = seal(/^aria-[\\-\\w]+$/);\n    var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i);\n    var IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\n    var ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g);\n    var DOCTYPE_NAME = seal(/^html$/i);\n    var getGlobal = function getGlobal() {\n      return typeof window === 'undefined' ? null : window;\n    };\n    var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {\n      if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n        return null;\n      }\n      var suffix = null;\n      var ATTR_NAME = 'data-tt-policy-suffix';\n      if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {\n        suffix = document.currentScript.getAttribute(ATTR_NAME);\n      }\n      var policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n      try {\n        return trustedTypes.createPolicy(policyName, {\n          createHTML: function createHTML(html) {\n            return html;\n          }\n        });\n      } catch (_) {\n        console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n        return null;\n      }\n    };\n    function createDOMPurify() {\n      var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n      var DOMPurify = function DOMPurify(root) {\n        return createDOMPurify(root);\n      };\n      DOMPurify.version = '2.3.8';\n      DOMPurify.removed = [];\n      if (!window || !window.document || window.document.nodeType !== 9) {\n        DOMPurify.isSupported = false;\n        return DOMPurify;\n      }\n      var originalDocument = window.document;\n      var document = window.document;\n      var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window.HTMLFormElement, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes;\n      var ElementPrototype = Element.prototype;\n      var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n      var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n      var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n      var getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n      if (typeof HTMLTemplateElement === 'function') {\n        var template = document.createElement('template');\n        if (template.content && template.content.ownerDocument) {\n          document = template.content.ownerDocument;\n        }\n      }\n      var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);\n      var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';\n      var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;\n      var importNode = originalDocument.importNode;\n      var documentMode = {};\n      try {\n        documentMode = clone$1(document).documentMode ? document.documentMode : {};\n      } catch (_) {\n      }\n      var hooks = {};\n      DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;\n      var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE;\n      var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;\n      var ALLOWED_TAGS = null;\n      var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));\n      var ALLOWED_ATTR = null;\n      var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));\n      var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {\n        tagNameCheck: {\n          writable: true,\n          configurable: false,\n          enumerable: true,\n          value: null\n        },\n        attributeNameCheck: {\n          writable: true,\n          configurable: false,\n          enumerable: true,\n          value: null\n        },\n        allowCustomizedBuiltInElements: {\n          writable: true,\n          configurable: false,\n          enumerable: true,\n          value: false\n        }\n      }));\n      var FORBID_TAGS = null;\n      var FORBID_ATTR = null;\n      var ALLOW_ARIA_ATTR = true;\n      var ALLOW_DATA_ATTR = true;\n      var ALLOW_UNKNOWN_PROTOCOLS = false;\n      var SAFE_FOR_TEMPLATES = false;\n      var WHOLE_DOCUMENT = false;\n      var SET_CONFIG = false;\n      var FORCE_BODY = false;\n      var RETURN_DOM = false;\n      var RETURN_DOM_FRAGMENT = false;\n      var RETURN_TRUSTED_TYPE = false;\n      var SANITIZE_DOM = true;\n      var KEEP_CONTENT = true;\n      var IN_PLACE = false;\n      var USE_PROFILES = {};\n      var FORBID_CONTENTS = null;\n      var DEFAULT_FORBID_CONTENTS = addToSet({}, [\n        'annotation-xml',\n        'audio',\n        'colgroup',\n        'desc',\n        'foreignobject',\n        'head',\n        'iframe',\n        'math',\n        'mi',\n        'mn',\n        'mo',\n        'ms',\n        'mtext',\n        'noembed',\n        'noframes',\n        'noscript',\n        'plaintext',\n        'script',\n        'style',\n        'svg',\n        'template',\n        'thead',\n        'title',\n        'video',\n        'xmp'\n      ]);\n      var DATA_URI_TAGS = null;\n      var DEFAULT_DATA_URI_TAGS = addToSet({}, [\n        'audio',\n        'video',\n        'img',\n        'source',\n        'image',\n        'track'\n      ]);\n      var URI_SAFE_ATTRIBUTES = null;\n      var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [\n        'alt',\n        'class',\n        'for',\n        'id',\n        'label',\n        'name',\n        'pattern',\n        'placeholder',\n        'role',\n        'summary',\n        'title',\n        'value',\n        'style',\n        'xmlns'\n      ]);\n      var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n      var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n      var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n      var NAMESPACE = HTML_NAMESPACE;\n      var IS_EMPTY_INPUT = false;\n      var PARSER_MEDIA_TYPE;\n      var SUPPORTED_PARSER_MEDIA_TYPES = [\n        'application/xhtml+xml',\n        'text/html'\n      ];\n      var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n      var transformCaseFunc;\n      var CONFIG = null;\n      var formElement = document.createElement('form');\n      var isRegexOrFunction = function isRegexOrFunction(testValue) {\n        return testValue instanceof RegExp || testValue instanceof Function;\n      };\n      var _parseConfig = function _parseConfig(cfg) {\n        if (CONFIG && CONFIG === cfg) {\n          return;\n        }\n        if (!cfg || _typeof(cfg) !== 'object') {\n          cfg = {};\n        }\n        cfg = clone$1(cfg);\n        ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;\n        ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;\n        URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone$1(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;\n        DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone$1(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;\n        FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;\n        FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};\n        FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};\n        USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;\n        ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;\n        ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;\n        ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;\n        SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;\n        WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;\n        RETURN_DOM = cfg.RETURN_DOM || false;\n        RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;\n        RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;\n        FORCE_BODY = cfg.FORCE_BODY || false;\n        SANITIZE_DOM = cfg.SANITIZE_DOM !== false;\n        KEEP_CONTENT = cfg.KEEP_CONTENT !== false;\n        IN_PLACE = cfg.IN_PLACE || false;\n        IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;\n        NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n          CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n        }\n        if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n          CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n        }\n        if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n          CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n        }\n        PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;\n        transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {\n          return x;\n        } : stringToLowerCase;\n        if (SAFE_FOR_TEMPLATES) {\n          ALLOW_DATA_ATTR = false;\n        }\n        if (RETURN_DOM_FRAGMENT) {\n          RETURN_DOM = true;\n        }\n        if (USE_PROFILES) {\n          ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));\n          ALLOWED_ATTR = [];\n          if (USE_PROFILES.html === true) {\n            addToSet(ALLOWED_TAGS, html$1);\n            addToSet(ALLOWED_ATTR, html);\n          }\n          if (USE_PROFILES.svg === true) {\n            addToSet(ALLOWED_TAGS, svg$1);\n            addToSet(ALLOWED_ATTR, svg);\n            addToSet(ALLOWED_ATTR, xml);\n          }\n          if (USE_PROFILES.svgFilters === true) {\n            addToSet(ALLOWED_TAGS, svgFilters);\n            addToSet(ALLOWED_ATTR, svg);\n            addToSet(ALLOWED_ATTR, xml);\n          }\n          if (USE_PROFILES.mathMl === true) {\n            addToSet(ALLOWED_TAGS, mathMl$1);\n            addToSet(ALLOWED_ATTR, mathMl);\n            addToSet(ALLOWED_ATTR, xml);\n          }\n        }\n        if (cfg.ADD_TAGS) {\n          if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n            ALLOWED_TAGS = clone$1(ALLOWED_TAGS);\n          }\n          addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);\n        }\n        if (cfg.ADD_ATTR) {\n          if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n            ALLOWED_ATTR = clone$1(ALLOWED_ATTR);\n          }\n          addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);\n        }\n        if (cfg.ADD_URI_SAFE_ATTR) {\n          addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);\n        }\n        if (cfg.FORBID_CONTENTS) {\n          if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n            FORBID_CONTENTS = clone$1(FORBID_CONTENTS);\n          }\n          addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);\n        }\n        if (KEEP_CONTENT) {\n          ALLOWED_TAGS['#text'] = true;\n        }\n        if (WHOLE_DOCUMENT) {\n          addToSet(ALLOWED_TAGS, [\n            'html',\n            'head',\n            'body'\n          ]);\n        }\n        if (ALLOWED_TAGS.table) {\n          addToSet(ALLOWED_TAGS, ['tbody']);\n          delete FORBID_TAGS.tbody;\n        }\n        if (freeze) {\n          freeze(cfg);\n        }\n        CONFIG = cfg;\n      };\n      var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [\n        'mi',\n        'mo',\n        'mn',\n        'ms',\n        'mtext'\n      ]);\n      var HTML_INTEGRATION_POINTS = addToSet({}, [\n        'foreignobject',\n        'desc',\n        'title',\n        'annotation-xml'\n      ]);\n      var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [\n        'title',\n        'style',\n        'font',\n        'a',\n        'script'\n      ]);\n      var ALL_SVG_TAGS = addToSet({}, svg$1);\n      addToSet(ALL_SVG_TAGS, svgFilters);\n      addToSet(ALL_SVG_TAGS, svgDisallowed);\n      var ALL_MATHML_TAGS = addToSet({}, mathMl$1);\n      addToSet(ALL_MATHML_TAGS, mathMlDisallowed);\n      var _checkValidNamespace = function _checkValidNamespace(element) {\n        var parent = getParentNode(element);\n        if (!parent || !parent.tagName) {\n          parent = {\n            namespaceURI: HTML_NAMESPACE,\n            tagName: 'template'\n          };\n        }\n        var tagName = stringToLowerCase(element.tagName);\n        var parentTagName = stringToLowerCase(parent.tagName);\n        if (element.namespaceURI === SVG_NAMESPACE) {\n          if (parent.namespaceURI === HTML_NAMESPACE) {\n            return tagName === 'svg';\n          }\n          if (parent.namespaceURI === MATHML_NAMESPACE) {\n            return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n          }\n          return Boolean(ALL_SVG_TAGS[tagName]);\n        }\n        if (element.namespaceURI === MATHML_NAMESPACE) {\n          if (parent.namespaceURI === HTML_NAMESPACE) {\n            return tagName === 'math';\n          }\n          if (parent.namespaceURI === SVG_NAMESPACE) {\n            return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n          }\n          return Boolean(ALL_MATHML_TAGS[tagName]);\n        }\n        if (element.namespaceURI === HTML_NAMESPACE) {\n          if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n            return false;\n          }\n          if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n            return false;\n          }\n          return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n        }\n        return false;\n      };\n      var _forceRemove = function _forceRemove(node) {\n        arrayPush(DOMPurify.removed, { element: node });\n        try {\n          node.parentNode.removeChild(node);\n        } catch (_) {\n          try {\n            node.outerHTML = emptyHTML;\n          } catch (_) {\n            node.remove();\n          }\n        }\n      };\n      var _removeAttribute = function _removeAttribute(name, node) {\n        try {\n          arrayPush(DOMPurify.removed, {\n            attribute: node.getAttributeNode(name),\n            from: node\n          });\n        } catch (_) {\n          arrayPush(DOMPurify.removed, {\n            attribute: null,\n            from: node\n          });\n        }\n        node.removeAttribute(name);\n        if (name === 'is' && !ALLOWED_ATTR[name]) {\n          if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n            try {\n              _forceRemove(node);\n            } catch (_) {\n            }\n          } else {\n            try {\n              node.setAttribute(name, '');\n            } catch (_) {\n            }\n          }\n        }\n      };\n      var _initDocument = function _initDocument(dirty) {\n        var doc;\n        var leadingWhitespace;\n        if (FORCE_BODY) {\n          dirty = '<remove></remove>' + dirty;\n        } else {\n          var matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n          leadingWhitespace = matches && matches[0];\n        }\n        if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {\n          dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n        }\n        var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n        if (NAMESPACE === HTML_NAMESPACE) {\n          try {\n            doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n          } catch (_) {\n          }\n        }\n        if (!doc || !doc.documentElement) {\n          doc = implementation.createDocument(NAMESPACE, 'template', null);\n          try {\n            doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;\n          } catch (_) {\n          }\n        }\n        var body = doc.body || doc.documentElement;\n        if (dirty && leadingWhitespace) {\n          body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n        }\n        if (NAMESPACE === HTML_NAMESPACE) {\n          return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n        }\n        return WHOLE_DOCUMENT ? doc.documentElement : body;\n      };\n      var _createIterator = function _createIterator(root) {\n        return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);\n      };\n      var _isClobbered = function _isClobbered(elm) {\n        return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');\n      };\n      var _isNode = function _isNode(object) {\n        return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';\n      };\n      var _executeHook = function _executeHook(entryPoint, currentNode, data) {\n        if (!hooks[entryPoint]) {\n          return;\n        }\n        arrayForEach(hooks[entryPoint], function (hook) {\n          hook.call(DOMPurify, currentNode, data, CONFIG);\n        });\n      };\n      var _sanitizeElements = function _sanitizeElements(currentNode) {\n        var content;\n        _executeHook('beforeSanitizeElements', currentNode, null);\n        if (_isClobbered(currentNode)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        if (regExpTest(/[\\u0080-\\uFFFF]/, currentNode.nodeName)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        var tagName = transformCaseFunc(currentNode.nodeName);\n        _executeHook('uponSanitizeElement', currentNode, {\n          tagName: tagName,\n          allowedTags: ALLOWED_TAGS\n        });\n        if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\\w]/g, currentNode.innerHTML) && regExpTest(/<[/\\w]/g, currentNode.textContent)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n          if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {\n            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))\n              return false;\n            if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))\n              return false;\n          }\n          if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n            var parentNode = getParentNode(currentNode) || currentNode.parentNode;\n            var childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n            if (childNodes && parentNode) {\n              var childCount = childNodes.length;\n              for (var i = childCount - 1; i >= 0; --i) {\n                parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));\n              }\n            }\n          }\n          _forceRemove(currentNode);\n          return true;\n        }\n        if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\\/no(script|embed)/i, currentNode.innerHTML)) {\n          _forceRemove(currentNode);\n          return true;\n        }\n        if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {\n          content = currentNode.textContent;\n          content = stringReplace(content, MUSTACHE_EXPR$1, ' ');\n          content = stringReplace(content, ERB_EXPR$1, ' ');\n          if (currentNode.textContent !== content) {\n            arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });\n            currentNode.textContent = content;\n          }\n        }\n        _executeHook('afterSanitizeElements', currentNode, null);\n        return false;\n      };\n      var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n        if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n          return false;\n        }\n        if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName));\n        else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));\n        else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n          if (_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));\n          else {\n            return false;\n          }\n        } else if (URI_SAFE_ATTRIBUTES[lcName]);\n        else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, '')));\n        else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]);\n        else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, '')));\n        else if (!value);\n        else {\n          return false;\n        }\n        return true;\n      };\n      var _basicCustomElementTest = function _basicCustomElementTest(tagName) {\n        return tagName.indexOf('-') > 0;\n      };\n      var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n        var attr;\n        var value;\n        var lcName;\n        var l;\n        _executeHook('beforeSanitizeAttributes', currentNode, null);\n        var attributes = currentNode.attributes;\n        if (!attributes) {\n          return;\n        }\n        var hookEvent = {\n          attrName: '',\n          attrValue: '',\n          keepAttr: true,\n          allowedAttributes: ALLOWED_ATTR\n        };\n        l = attributes.length;\n        while (l--) {\n          attr = attributes[l];\n          var _attr = attr, name = _attr.name, namespaceURI = _attr.namespaceURI;\n          value = name === 'value' ? attr.value : stringTrim(attr.value);\n          lcName = transformCaseFunc(name);\n          hookEvent.attrName = lcName;\n          hookEvent.attrValue = value;\n          hookEvent.keepAttr = true;\n          hookEvent.forceKeepAttr = undefined;\n          _executeHook('uponSanitizeAttribute', currentNode, hookEvent);\n          value = hookEvent.attrValue;\n          if (hookEvent.forceKeepAttr) {\n            continue;\n          }\n          _removeAttribute(name, currentNode);\n          if (!hookEvent.keepAttr) {\n            continue;\n          }\n          if (regExpTest(/\\/>/i, value)) {\n            _removeAttribute(name, currentNode);\n            continue;\n          }\n          if (SAFE_FOR_TEMPLATES) {\n            value = stringReplace(value, MUSTACHE_EXPR$1, ' ');\n            value = stringReplace(value, ERB_EXPR$1, ' ');\n          }\n          var lcTag = transformCaseFunc(currentNode.nodeName);\n          if (!_isValidAttribute(lcTag, lcName, value)) {\n            continue;\n          }\n          try {\n            if (namespaceURI) {\n              currentNode.setAttributeNS(namespaceURI, name, value);\n            } else {\n              currentNode.setAttribute(name, value);\n            }\n            arrayPop(DOMPurify.removed);\n          } catch (_) {\n          }\n        }\n        _executeHook('afterSanitizeAttributes', currentNode, null);\n      };\n      var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n        var shadowNode;\n        var shadowIterator = _createIterator(fragment);\n        _executeHook('beforeSanitizeShadowDOM', fragment, null);\n        while (shadowNode = shadowIterator.nextNode()) {\n          _executeHook('uponSanitizeShadowNode', shadowNode, null);\n          if (_sanitizeElements(shadowNode)) {\n            continue;\n          }\n          if (shadowNode.content instanceof DocumentFragment) {\n            _sanitizeShadowDOM(shadowNode.content);\n          }\n          _sanitizeAttributes(shadowNode);\n        }\n        _executeHook('afterSanitizeShadowDOM', fragment, null);\n      };\n      DOMPurify.sanitize = function (dirty, cfg) {\n        var body;\n        var importedNode;\n        var currentNode;\n        var oldNode;\n        var returnNode;\n        IS_EMPTY_INPUT = !dirty;\n        if (IS_EMPTY_INPUT) {\n          dirty = '<!-->';\n        }\n        if (typeof dirty !== 'string' && !_isNode(dirty)) {\n          if (typeof dirty.toString !== 'function') {\n            throw typeErrorCreate('toString is not a function');\n          } else {\n            dirty = dirty.toString();\n            if (typeof dirty !== 'string') {\n              throw typeErrorCreate('dirty is not a string, aborting');\n            }\n          }\n        }\n        if (!DOMPurify.isSupported) {\n          if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {\n            if (typeof dirty === 'string') {\n              return window.toStaticHTML(dirty);\n            }\n            if (_isNode(dirty)) {\n              return window.toStaticHTML(dirty.outerHTML);\n            }\n          }\n          return dirty;\n        }\n        if (!SET_CONFIG) {\n          _parseConfig(cfg);\n        }\n        DOMPurify.removed = [];\n        if (typeof dirty === 'string') {\n          IN_PLACE = false;\n        }\n        if (IN_PLACE) {\n          if (dirty.nodeName) {\n            var tagName = transformCaseFunc(dirty.nodeName);\n            if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n              throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n            }\n          }\n        } else if (dirty instanceof Node) {\n          body = _initDocument('<!---->');\n          importedNode = body.ownerDocument.importNode(dirty, true);\n          if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {\n            body = importedNode;\n          } else if (importedNode.nodeName === 'HTML') {\n            body = importedNode;\n          } else {\n            body.appendChild(importedNode);\n          }\n        } else {\n          if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf('<') === -1) {\n            return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n          }\n          body = _initDocument(dirty);\n          if (!body) {\n            return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n          }\n        }\n        if (body && FORCE_BODY) {\n          _forceRemove(body.firstChild);\n        }\n        var nodeIterator = _createIterator(IN_PLACE ? dirty : body);\n        while (currentNode = nodeIterator.nextNode()) {\n          if (currentNode.nodeType === 3 && currentNode === oldNode) {\n            continue;\n          }\n          if (_sanitizeElements(currentNode)) {\n            continue;\n          }\n          if (currentNode.content instanceof DocumentFragment) {\n            _sanitizeShadowDOM(currentNode.content);\n          }\n          _sanitizeAttributes(currentNode);\n          oldNode = currentNode;\n        }\n        oldNode = null;\n        if (IN_PLACE) {\n          return dirty;\n        }\n        if (RETURN_DOM) {\n          if (RETURN_DOM_FRAGMENT) {\n            returnNode = createDocumentFragment.call(body.ownerDocument);\n            while (body.firstChild) {\n              returnNode.appendChild(body.firstChild);\n            }\n          } else {\n            returnNode = body;\n          }\n          if (ALLOWED_ATTR.shadowroot) {\n            returnNode = importNode.call(originalDocument, returnNode, true);\n          }\n          return returnNode;\n        }\n        var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n        if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n          serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n        }\n        if (SAFE_FOR_TEMPLATES) {\n          serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');\n          serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');\n        }\n        return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n      };\n      DOMPurify.setConfig = function (cfg) {\n        _parseConfig(cfg);\n        SET_CONFIG = true;\n      };\n      DOMPurify.clearConfig = function () {\n        CONFIG = null;\n        SET_CONFIG = false;\n      };\n      DOMPurify.isValidAttribute = function (tag, attr, value) {\n        if (!CONFIG) {\n          _parseConfig({});\n        }\n        var lcTag = transformCaseFunc(tag);\n        var lcName = transformCaseFunc(attr);\n        return _isValidAttribute(lcTag, lcName, value);\n      };\n      DOMPurify.addHook = function (entryPoint, hookFunction) {\n        if (typeof hookFunction !== 'function') {\n          return;\n        }\n        hooks[entryPoint] = hooks[entryPoint] || [];\n        arrayPush(hooks[entryPoint], hookFunction);\n      };\n      DOMPurify.removeHook = function (entryPoint) {\n        if (hooks[entryPoint]) {\n          return arrayPop(hooks[entryPoint]);\n        }\n      };\n      DOMPurify.removeHooks = function (entryPoint) {\n        if (hooks[entryPoint]) {\n          hooks[entryPoint] = [];\n        }\n      };\n      DOMPurify.removeAllHooks = function () {\n        hooks = {};\n      };\n      return DOMPurify;\n    }\n    var purify = createDOMPurify();\n\n    var sanitizeHtmlString = function (html) {\n      return purify().sanitize(html);\n    };\n\n    var global$e = tinymce.util.Tools.resolve('tinymce.util.I18n');\n\n    var rtlTransform = {\n      'indent': true,\n      'outdent': true,\n      'table-insert-column-after': true,\n      'table-insert-column-before': true,\n      'paste-column-after': true,\n      'paste-column-before': true,\n      'unordered-list': true,\n      'list-bull-circle': true,\n      'list-bull-default': true,\n      'list-bull-square': true\n    };\n    var defaultIconName = 'temporary-placeholder';\n    var defaultIcon = function (icons) {\n      return function () {\n        return get$e(icons, defaultIconName).getOr('!not found!');\n      };\n    };\n    var getIconName = function (name, icons) {\n      var lcName = name.toLowerCase();\n      if (global$e.isRtl()) {\n        var rtlName = ensureTrailing(lcName, '-rtl');\n        return has$2(icons, rtlName) ? rtlName : lcName;\n      } else {\n        return lcName;\n      }\n    };\n    var lookupIcon = function (name, icons) {\n      return get$e(icons, getIconName(name, icons));\n    };\n    var get$1 = function (name, iconProvider) {\n      var icons = iconProvider();\n      return lookupIcon(name, icons).getOrThunk(defaultIcon(icons));\n    };\n    var getOr = function (name, iconProvider, fallbackIcon) {\n      var icons = iconProvider();\n      return lookupIcon(name, icons).or(fallbackIcon).getOrThunk(defaultIcon(icons));\n    };\n    var needsRtlTransform = function (iconName) {\n      return global$e.isRtl() ? has$2(rtlTransform, iconName) : false;\n    };\n    var addFocusableBehaviour = function () {\n      return config('add-focusable', [runOnAttached(function (comp) {\n          child(comp.element, 'svg').each(function (svg) {\n            return set$8(svg, 'focusable', 'false');\n          });\n        })]);\n    };\n    var renderIcon$2 = function (spec, iconName, icons, fallbackIcon) {\n      var _a, _b;\n      var rtlIconClasses = needsRtlTransform(iconName) ? ['tox-icon--flip'] : [];\n      var iconHtml = get$e(icons, getIconName(iconName, icons)).or(fallbackIcon).getOrThunk(defaultIcon(icons));\n      return {\n        dom: {\n          tag: spec.tag,\n          attributes: (_a = spec.attributes) !== null && _a !== void 0 ? _a : {},\n          classes: spec.classes.concat(rtlIconClasses),\n          innerHtml: iconHtml\n        },\n        behaviours: derive$1(__spreadArray(__spreadArray([], (_b = spec.behaviours) !== null && _b !== void 0 ? _b : [], true), [addFocusableBehaviour()], false))\n      };\n    };\n    var render$3 = function (iconName, spec, iconProvider, fallbackIcon) {\n      if (fallbackIcon === void 0) {\n        fallbackIcon = Optional.none();\n      }\n      return renderIcon$2(spec, iconName, iconProvider(), fallbackIcon);\n    };\n    var renderFirst = function (iconNames, spec, iconProvider) {\n      var icons = iconProvider();\n      var iconName = find$5(iconNames, function (name) {\n        return has$2(icons, getIconName(name, icons));\n      });\n      return renderIcon$2(spec, iconName.getOr(defaultIconName), icons, Optional.none());\n    };\n\n    var notificationIconMap = {\n      success: 'checkmark',\n      error: 'warning',\n      err: 'error',\n      warning: 'warning',\n      warn: 'warning',\n      info: 'info'\n    };\n    var factory$k = function (detail) {\n      var memBannerText = record({\n        dom: fromHtml('<p>' + sanitizeHtmlString(detail.translationProvider(detail.text)) + '</p>'),\n        behaviours: derive$1([Replacing.config({})])\n      });\n      var renderPercentBar = function (percent) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-bar'],\n            attributes: { style: 'width: ' + percent + '%' }\n          }\n        };\n      };\n      var renderPercentText = function (percent) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-text'],\n            innerHtml: percent + '%'\n          }\n        };\n      };\n      var memBannerProgress = record({\n        dom: {\n          tag: 'div',\n          classes: detail.progress ? [\n            'tox-progress-bar',\n            'tox-progress-indicator'\n          ] : ['tox-progress-bar']\n        },\n        components: [\n          {\n            dom: {\n              tag: 'div',\n              classes: ['tox-bar-container']\n            },\n            components: [renderPercentBar(0)]\n          },\n          renderPercentText(0)\n        ],\n        behaviours: derive$1([Replacing.config({})])\n      });\n      var updateProgress = function (comp, percent) {\n        if (comp.getSystem().isConnected()) {\n          memBannerProgress.getOpt(comp).each(function (progress) {\n            Replacing.set(progress, [\n              {\n                dom: {\n                  tag: 'div',\n                  classes: ['tox-bar-container']\n                },\n                components: [renderPercentBar(percent)]\n              },\n              renderPercentText(percent)\n            ]);\n          });\n        }\n      };\n      var updateText = function (comp, text) {\n        if (comp.getSystem().isConnected()) {\n          var banner = memBannerText.get(comp);\n          Replacing.set(banner, [text$1(text)]);\n        }\n      };\n      var apis = {\n        updateProgress: updateProgress,\n        updateText: updateText\n      };\n      var iconChoices = flatten([\n        detail.icon.toArray(),\n        detail.level.toArray(),\n        detail.level.bind(function (level) {\n          return Optional.from(notificationIconMap[level]);\n        }).toArray()\n      ]);\n      var memButton = record(Button.sketch({\n        dom: {\n          tag: 'button',\n          classes: [\n            'tox-notification__dismiss',\n            'tox-button',\n            'tox-button--naked',\n            'tox-button--icon'\n          ]\n        },\n        components: [render$3('close', {\n            tag: 'div',\n            classes: ['tox-icon'],\n            attributes: { 'aria-label': detail.translationProvider('Close') }\n          }, detail.iconProvider)],\n        action: function (comp) {\n          detail.onAction(comp);\n        }\n      }));\n      var notificationIconSpec = renderFirst(iconChoices, {\n        tag: 'div',\n        classes: ['tox-notification__icon']\n      }, detail.iconProvider);\n      var notificationBodySpec = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-notification__body']\n        },\n        components: [memBannerText.asSpec()],\n        behaviours: derive$1([Replacing.config({})])\n      };\n      var components = [\n        notificationIconSpec,\n        notificationBodySpec\n      ];\n      return {\n        uid: detail.uid,\n        dom: {\n          tag: 'div',\n          attributes: { role: 'alert' },\n          classes: detail.level.map(function (level) {\n            return [\n              'tox-notification',\n              'tox-notification--in',\n              'tox-notification--' + level\n            ];\n          }).getOr([\n            'tox-notification',\n            'tox-notification--in'\n          ])\n        },\n        behaviours: derive$1([\n          Focusing.config({}),\n          config('notification-events', [run$1(focusin(), function (comp) {\n              memButton.getOpt(comp).each(Focusing.focus);\n            })])\n        ]),\n        components: components.concat(detail.progress ? [memBannerProgress.asSpec()] : []).concat(!detail.closeButton ? [] : [memButton.asSpec()]),\n        apis: apis\n      };\n    };\n    var Notification = single({\n      name: 'Notification',\n      factory: factory$k,\n      configFields: [\n        option('level'),\n        required$1('progress'),\n        required$1('icon'),\n        required$1('onAction'),\n        required$1('text'),\n        required$1('iconProvider'),\n        required$1('translationProvider'),\n        defaultedBoolean('closeButton', true)\n      ],\n      apis: {\n        updateProgress: function (apis, comp, percent) {\n          apis.updateProgress(comp, percent);\n        },\n        updateText: function (apis, comp, text) {\n          apis.updateText(comp, text);\n        }\n      }\n    });\n\n    function NotificationManagerImpl (editor, extras, uiMothership) {\n      var sharedBackstage = extras.backstage.shared;\n      var getLayoutDirection = function (rel) {\n        switch (rel) {\n        case 'bc-bc':\n          return south;\n        case 'tc-tc':\n          return north;\n        case 'tc-bc':\n          return north$2;\n        case 'bc-tc':\n        default:\n          return south$2;\n        }\n      };\n      var reposition = function (notifications) {\n        if (notifications.length > 0) {\n          each$1(notifications, function (notification, index) {\n            if (index === 0) {\n              notification.moveRel(null, 'banner');\n            } else {\n              notification.moveRel(notifications[index - 1].getEl(), 'bc-tc');\n            }\n          });\n        }\n      };\n      var open = function (settings, closeCallback) {\n        var hideCloseButton = !settings.closeButton && settings.timeout && (settings.timeout > 0 || settings.timeout < 0);\n        var close = function () {\n          closeCallback();\n          InlineView.hide(notificationWrapper);\n        };\n        var notification = build$1(Notification.sketch({\n          text: settings.text,\n          level: contains$2([\n            'success',\n            'error',\n            'warning',\n            'warn',\n            'info'\n          ], settings.type) ? settings.type : undefined,\n          progress: settings.progressBar === true,\n          icon: Optional.from(settings.icon),\n          closeButton: !hideCloseButton,\n          onAction: close,\n          iconProvider: sharedBackstage.providers.icons,\n          translationProvider: sharedBackstage.providers.translate\n        }));\n        var notificationWrapper = build$1(InlineView.sketch(__assign({\n          dom: {\n            tag: 'div',\n            classes: ['tox-notifications-container']\n          },\n          lazySink: sharedBackstage.getSink,\n          fireDismissalEventInstead: {}\n        }, sharedBackstage.header.isPositionedAtTop() ? {} : { fireRepositionEventInstead: {} })));\n        uiMothership.add(notificationWrapper);\n        if (settings.timeout > 0) {\n          global$f.setTimeout(function () {\n            close();\n          }, settings.timeout);\n        }\n        var getBounds = function () {\n          var contentArea = box$1(SugarElement.fromDom(editor.getContentAreaContainer()));\n          var win$1 = win();\n          var x = clamp$1(win$1.x, contentArea.x, contentArea.right);\n          var y = clamp$1(win$1.y, contentArea.y, contentArea.bottom);\n          var right = Math.max(contentArea.right, win$1.right);\n          var bottom = Math.max(contentArea.bottom, win$1.bottom);\n          return Optional.some(bounds(x, y, right - x, bottom - y));\n        };\n        return {\n          close: close,\n          moveTo: function (x, y) {\n            InlineView.showAt(notificationWrapper, premade(notification), {\n              anchor: {\n                type: 'makeshift',\n                x: x,\n                y: y\n              }\n            });\n          },\n          moveRel: function (element, rel) {\n            var notificationSpec = premade(notification);\n            var anchorOverrides = { maxHeightFunction: expandable$1() };\n            if (rel !== 'banner' && isNonNullable(element)) {\n              var layoutDirection_1 = getLayoutDirection(rel);\n              var nodeAnchor = {\n                type: 'node',\n                root: body(),\n                node: Optional.some(SugarElement.fromDom(element)),\n                overrides: anchorOverrides,\n                layouts: {\n                  onRtl: function () {\n                    return [layoutDirection_1];\n                  },\n                  onLtr: function () {\n                    return [layoutDirection_1];\n                  }\n                }\n              };\n              InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: nodeAnchor }, getBounds);\n            } else {\n              var anchor = __assign(__assign({}, sharedBackstage.anchors.banner()), { overrides: anchorOverrides });\n              InlineView.showWithinBounds(notificationWrapper, notificationSpec, { anchor: anchor }, getBounds);\n            }\n          },\n          text: function (nuText) {\n            Notification.updateText(notification, nuText);\n          },\n          settings: settings,\n          getEl: function () {\n            return notification.element.dom;\n          },\n          progressBar: {\n            value: function (percent) {\n              Notification.updateProgress(notification, percent);\n            }\n          }\n        };\n      };\n      var close = function (notification) {\n        notification.close();\n      };\n      var getArgs = function (notification) {\n        return notification.settings;\n      };\n      return {\n        open: open,\n        close: close,\n        reposition: reposition,\n        getArgs: getArgs\n      };\n    }\n\n    var first = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (isNull(timer)) {\n          timer = setTimeout(function () {\n            timer = null;\n            fn.apply(null, args);\n          }, rate);\n        }\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n    var last = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        cancel();\n        timer = setTimeout(function () {\n          timer = null;\n          fn.apply(null, args);\n        }, rate);\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n\n    var global$d = tinymce.util.Tools.resolve('tinymce.dom.TextSeeker');\n\n    var isBoundary = function (dom, node) {\n      return dom.isBlock(node) || contains$2([\n        'BR',\n        'IMG',\n        'HR',\n        'INPUT'\n      ], node.nodeName) || dom.getContentEditable(node) === 'false';\n    };\n    var repeatLeft = function (dom, node, offset, process, rootNode) {\n      var search = global$d(dom, function (node) {\n        return isBoundary(dom, node);\n      });\n      return Optional.from(search.backwards(node, offset, process, rootNode));\n    };\n\n    var autocompleteSelector = '[data-mce-autocompleter]';\n    var create$4 = function (editor, range) {\n      return detect(SugarElement.fromDom(editor.selection.getNode())).getOrThunk(function () {\n        var wrapper = SugarElement.fromHtml('<span data-mce-autocompleter=\"1\" data-mce-bogus=\"1\"></span>', editor.getDoc());\n        append$2(wrapper, SugarElement.fromDom(range.extractContents()));\n        range.insertNode(wrapper.dom);\n        parent(wrapper).each(function (elm) {\n          return elm.dom.normalize();\n        });\n        last$1(wrapper).map(function (last) {\n          editor.selection.setCursorLocation(last.dom, getEnd(last));\n        });\n        return wrapper;\n      });\n    };\n    var detect = function (elm) {\n      return closest$1(elm, autocompleteSelector);\n    };\n\n    var isValidTextRange = function (rng) {\n      return rng.collapsed && rng.startContainer.nodeType === 3;\n    };\n    var getText = function (rng) {\n      return rng.toString().replace(/\\u00A0/g, ' ').replace(/\\uFEFF/g, '');\n    };\n    var isWhitespace = function (chr) {\n      return chr !== '' && ' \\xA0\\f\\n\\r\\t\\x0B'.indexOf(chr) !== -1;\n    };\n\n    var stripTriggerChar = function (text, triggerCh) {\n      return text.substring(triggerCh.length);\n    };\n    var findChar = function (text, index, ch) {\n      var i;\n      for (i = index - 1; i >= 0; i--) {\n        var char = text.charAt(i);\n        if (isWhitespace(char)) {\n          return Optional.none();\n        }\n        if (char === ch) {\n          break;\n        }\n      }\n      return Optional.some(i);\n    };\n    var findStart = function (dom, initRange, ch, minChars) {\n      if (minChars === void 0) {\n        minChars = 0;\n      }\n      if (!isValidTextRange(initRange)) {\n        return Optional.none();\n      }\n      var findTriggerChIndex = function (element, offset, text) {\n        return findChar(text, offset, ch).getOr(offset);\n      };\n      var root = dom.getParent(initRange.startContainer, dom.isBlock) || dom.getRoot();\n      return repeatLeft(dom, initRange.startContainer, initRange.startOffset, findTriggerChIndex, root).bind(function (spot) {\n        var range = initRange.cloneRange();\n        range.setStart(spot.container, spot.offset);\n        range.setEnd(initRange.endContainer, initRange.endOffset);\n        if (range.collapsed) {\n          return Optional.none();\n        }\n        var text = getText(range);\n        var triggerCharIndex = text.lastIndexOf(ch);\n        if (triggerCharIndex !== 0 || stripTriggerChar(text, ch).length < minChars) {\n          return Optional.none();\n        } else {\n          return Optional.some({\n            text: stripTriggerChar(text, ch),\n            range: range,\n            triggerChar: ch\n          });\n        }\n      });\n    };\n    var getContext = function (dom, initRange, ch, minChars) {\n      if (minChars === void 0) {\n        minChars = 0;\n      }\n      return detect(SugarElement.fromDom(initRange.startContainer)).fold(function () {\n        return findStart(dom, initRange, ch, minChars);\n      }, function (elm) {\n        var range = dom.createRng();\n        range.selectNode(elm.dom);\n        var text = getText(range);\n        return Optional.some({\n          range: range,\n          text: stripTriggerChar(text, ch),\n          triggerChar: ch\n        });\n      });\n    };\n\n    var setup$e = function (api, editor) {\n      editor.on('keypress compositionend', api.onKeypress.throttle);\n      editor.on('remove', api.onKeypress.cancel);\n      var redirectKeyToItem = function (item, e) {\n        emitWith(item, keydown(), { raw: e });\n      };\n      editor.on('keydown', function (e) {\n        var getItem = function () {\n          return api.getView().bind(Highlighting.getHighlighted);\n        };\n        if (e.which === 8) {\n          api.onKeypress.throttle(e);\n        }\n        if (api.isActive()) {\n          if (e.which === 27) {\n            api.cancelIfNecessary();\n          }\n          if (api.isMenuOpen()) {\n            if (e.which === 13) {\n              getItem().each(emitExecute);\n              e.preventDefault();\n            } else if (e.which === 40) {\n              getItem().fold(function () {\n                api.getView().each(Highlighting.highlightFirst);\n              }, function (item) {\n                redirectKeyToItem(item, e);\n              });\n              e.preventDefault();\n              e.stopImmediatePropagation();\n            } else if (e.which === 37 || e.which === 38 || e.which === 39) {\n              getItem().each(function (item) {\n                redirectKeyToItem(item, e);\n                e.preventDefault();\n                e.stopImmediatePropagation();\n              });\n            }\n          } else {\n            if (e.which === 13 || e.which === 38 || e.which === 40) {\n              api.cancelIfNecessary();\n            }\n          }\n        }\n      });\n      editor.on('NodeChange', function (e) {\n        if (api.isActive() && !api.isProcessingAction() && detect(SugarElement.fromDom(e.element)).isNone()) {\n          api.cancelIfNecessary();\n        }\n      });\n    };\n    var AutocompleterEditorEvents = { setup: setup$e };\n\n    var global$c = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var point = function (container, offset) {\n      return {\n        container: container,\n        offset: offset\n      };\n    };\n\n    var isText = function (node) {\n      return node.nodeType === TEXT;\n    };\n    var isElement$1 = function (node) {\n      return node.nodeType === ELEMENT;\n    };\n    var toLast = function (node) {\n      if (isText(node)) {\n        return point(node, node.data.length);\n      } else {\n        var children = node.childNodes;\n        return children.length > 0 ? toLast(children[children.length - 1]) : point(node, children.length);\n      }\n    };\n    var toLeaf = function (node, offset) {\n      var children = node.childNodes;\n      if (children.length > 0 && offset < children.length) {\n        return toLeaf(children[offset], 0);\n      } else if (children.length > 0 && isElement$1(node) && children.length === offset) {\n        return toLast(children[children.length - 1]);\n      } else {\n        return point(node, offset);\n      }\n    };\n\n    var isPreviousCharContent = function (dom, leaf) {\n      return repeatLeft(dom, leaf.container, leaf.offset, function (element, offset) {\n        return offset === 0 ? -1 : offset;\n      }, dom.getRoot()).filter(function (spot) {\n        var char = spot.container.data.charAt(spot.offset - 1);\n        return !isWhitespace(char);\n      }).isSome();\n    };\n    var isStartOfWord = function (dom) {\n      return function (rng) {\n        var leaf = toLeaf(rng.startContainer, rng.startOffset);\n        return !isPreviousCharContent(dom, leaf);\n      };\n    };\n    var getTriggerContext = function (dom, initRange, database) {\n      return findMap(database.triggerChars, function (ch) {\n        return getContext(dom, initRange, ch);\n      });\n    };\n    var lookup$2 = function (editor, getDatabase) {\n      var database = getDatabase();\n      var rng = editor.selection.getRng();\n      return getTriggerContext(editor.dom, rng, database).bind(function (context) {\n        return lookupWithContext(editor, getDatabase, context);\n      });\n    };\n    var lookupWithContext = function (editor, getDatabase, context, fetchOptions) {\n      if (fetchOptions === void 0) {\n        fetchOptions = {};\n      }\n      var database = getDatabase();\n      var rng = editor.selection.getRng();\n      var startText = rng.startContainer.nodeValue;\n      var autocompleters = filter$2(database.lookupByChar(context.triggerChar), function (autocompleter) {\n        return context.text.length >= autocompleter.minChars && autocompleter.matches.getOrThunk(function () {\n          return isStartOfWord(editor.dom);\n        })(context.range, startText, context.text);\n      });\n      if (autocompleters.length === 0) {\n        return Optional.none();\n      }\n      var lookupData = global$c.all(map$2(autocompleters, function (ac) {\n        var fetchResult = ac.fetch(context.text, ac.maxResults, fetchOptions);\n        return fetchResult.then(function (results) {\n          return {\n            matchText: context.text,\n            items: results,\n            columns: ac.columns,\n            onAction: ac.onAction,\n            highlightOn: ac.highlightOn\n          };\n        });\n      }));\n      return Optional.some({\n        lookupData: lookupData,\n        context: context\n      });\n    };\n\n    var separatorMenuItemSchema = objOf([\n      requiredString('type'),\n      optionString('text')\n    ]);\n    var createSeparatorMenuItem = function (spec) {\n      return asRaw('separatormenuitem', separatorMenuItemSchema, spec);\n    };\n\n    var autocompleterItemSchema = objOf([\n      defaulted('type', 'autocompleteitem'),\n      defaulted('active', false),\n      defaulted('disabled', false),\n      defaulted('meta', {}),\n      requiredString('value'),\n      optionString('text'),\n      optionString('icon')\n    ]);\n    var autocompleterSchema = objOf([\n      requiredString('type'),\n      requiredString('ch'),\n      defaultedNumber('minChars', 1),\n      defaulted('columns', 1),\n      defaultedNumber('maxResults', 10),\n      optionFunction('matches'),\n      requiredFunction('fetch'),\n      requiredFunction('onAction'),\n      defaultedArrayOf('highlightOn', [], string)\n    ]);\n    var createSeparatorItem = function (spec) {\n      return asRaw('Autocompleter.Separator', separatorMenuItemSchema, spec);\n    };\n    var createAutocompleterItem = function (spec) {\n      return asRaw('Autocompleter.Item', autocompleterItemSchema, spec);\n    };\n    var createAutocompleter = function (spec) {\n      return asRaw('Autocompleter', autocompleterSchema, spec);\n    };\n\n    var baseToolbarButtonFields = [\n      defaultedBoolean('disabled', false),\n      optionString('tooltip'),\n      optionString('icon'),\n      optionString('text'),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      })\n    ];\n    var toolbarButtonSchema = objOf([\n      requiredString('type'),\n      requiredFunction('onAction')\n    ].concat(baseToolbarButtonFields));\n    var createToolbarButton = function (spec) {\n      return asRaw('toolbarbutton', toolbarButtonSchema, spec);\n    };\n\n    var baseToolbarToggleButtonFields = [defaultedBoolean('active', false)].concat(baseToolbarButtonFields);\n    var toggleButtonSchema = objOf(baseToolbarToggleButtonFields.concat([\n      requiredString('type'),\n      requiredFunction('onAction')\n    ]));\n    var createToggleButton = function (spec) {\n      return asRaw('ToggleButton', toggleButtonSchema, spec);\n    };\n\n    var contextBarFields = [\n      defaultedFunction('predicate', never),\n      defaultedStringEnum('scope', 'node', [\n        'node',\n        'editor'\n      ]),\n      defaultedStringEnum('position', 'selection', [\n        'node',\n        'selection',\n        'line'\n      ])\n    ];\n\n    var contextButtonFields = baseToolbarButtonFields.concat([\n      defaulted('type', 'contextformbutton'),\n      defaulted('primary', false),\n      requiredFunction('onAction'),\n      customField('original', identity$1)\n    ]);\n    var contextToggleButtonFields = baseToolbarToggleButtonFields.concat([\n      defaulted('type', 'contextformbutton'),\n      defaulted('primary', false),\n      requiredFunction('onAction'),\n      customField('original', identity$1)\n    ]);\n    var launchButtonFields = baseToolbarButtonFields.concat([defaulted('type', 'contextformbutton')]);\n    var launchToggleButtonFields = baseToolbarToggleButtonFields.concat([defaulted('type', 'contextformtogglebutton')]);\n    var toggleOrNormal = choose$1('type', {\n      contextformbutton: contextButtonFields,\n      contextformtogglebutton: contextToggleButtonFields\n    });\n    var contextFormSchema = objOf([\n      defaulted('type', 'contextform'),\n      defaultedFunction('initValue', constant$1('')),\n      optionString('label'),\n      requiredArrayOf('commands', toggleOrNormal),\n      optionOf('launch', choose$1('type', {\n        contextformbutton: launchButtonFields,\n        contextformtogglebutton: launchToggleButtonFields\n      }))\n    ].concat(contextBarFields));\n    var createContextForm = function (spec) {\n      return asRaw('ContextForm', contextFormSchema, spec);\n    };\n\n    var contextToolbarSchema = objOf([\n      defaulted('type', 'contexttoolbar'),\n      requiredString('items')\n    ].concat(contextBarFields));\n    var createContextToolbar = function (spec) {\n      return asRaw('ContextToolbar', contextToolbarSchema, spec);\n    };\n\n    var stringArray = function (a) {\n      var all = {};\n      each$1(a, function (key) {\n        all[key] = {};\n      });\n      return keys(all);\n    };\n\n    var register$b = function (editor) {\n      var popups = editor.ui.registry.getAll().popups;\n      var dataset = map$1(popups, function (popup) {\n        return createAutocompleter(popup).fold(function (err) {\n          throw new Error(formatError(err));\n        }, identity$1);\n      });\n      var triggerChars = stringArray(mapToArray(dataset, function (v) {\n        return v.ch;\n      }));\n      var datasetValues = values(dataset);\n      var lookupByChar = function (ch) {\n        return filter$2(datasetValues, function (dv) {\n          return dv.ch === ch;\n        });\n      };\n      return {\n        dataset: dataset,\n        triggerChars: triggerChars,\n        lookupByChar: lookupByChar\n      };\n    };\n\n    var ItemResponse;\n    (function (ItemResponse) {\n      ItemResponse[ItemResponse['CLOSE_ON_EXECUTE'] = 0] = 'CLOSE_ON_EXECUTE';\n      ItemResponse[ItemResponse['BUBBLE_TO_SANDBOX'] = 1] = 'BUBBLE_TO_SANDBOX';\n    }(ItemResponse || (ItemResponse = {})));\n    var ItemResponse$1 = ItemResponse;\n\n    var navClass = 'tox-menu-nav__js';\n    var selectableClass = 'tox-collection__item';\n    var colorClass = 'tox-swatch';\n    var presetClasses = {\n      normal: navClass,\n      color: colorClass\n    };\n    var tickedClass = 'tox-collection__item--enabled';\n    var groupHeadingClass = 'tox-collection__group-heading';\n    var iconClass = 'tox-collection__item-icon';\n    var textClass = 'tox-collection__item-label';\n    var accessoryClass = 'tox-collection__item-accessory';\n    var caretClass = 'tox-collection__item-caret';\n    var checkmarkClass = 'tox-collection__item-checkmark';\n    var activeClass = 'tox-collection__item--active';\n    var containerClass = 'tox-collection__item-container';\n    var containerColumnClass = 'tox-collection__item-container--column';\n    var containerRowClass = 'tox-collection__item-container--row';\n    var containerAlignRightClass = 'tox-collection__item-container--align-right';\n    var containerAlignLeftClass = 'tox-collection__item-container--align-left';\n    var containerValignTopClass = 'tox-collection__item-container--valign-top';\n    var containerValignMiddleClass = 'tox-collection__item-container--valign-middle';\n    var containerValignBottomClass = 'tox-collection__item-container--valign-bottom';\n    var classForPreset = function (presets) {\n      return get$e(presetClasses, presets).getOr(navClass);\n    };\n\n    var forMenu = function (presets) {\n      if (presets === 'color') {\n        return 'tox-swatches';\n      } else {\n        return 'tox-menu';\n      }\n    };\n    var classes = function (presets) {\n      return {\n        backgroundMenu: 'tox-background-menu',\n        selectedMenu: 'tox-selected-menu',\n        selectedItem: 'tox-collection__item--active',\n        hasIcons: 'tox-menu--has-icons',\n        menu: forMenu(presets),\n        tieredMenu: 'tox-tiered-menu'\n      };\n    };\n\n    var markers = function (presets) {\n      var menuClasses = classes(presets);\n      return {\n        backgroundMenu: menuClasses.backgroundMenu,\n        selectedMenu: menuClasses.selectedMenu,\n        menu: menuClasses.menu,\n        selectedItem: menuClasses.selectedItem,\n        item: classForPreset(presets)\n      };\n    };\n    var dom$1 = function (hasIcons, columns, presets) {\n      var menuClasses = classes(presets);\n      return {\n        tag: 'div',\n        classes: flatten([\n          [\n            menuClasses.menu,\n            'tox-menu-' + columns + '-column'\n          ],\n          hasIcons ? [menuClasses.hasIcons] : []\n        ])\n      };\n    };\n    var components = [Menu.parts.items({})];\n    var part = function (hasIcons, columns, presets) {\n      var menuClasses = classes(presets);\n      var d = {\n        tag: 'div',\n        classes: flatten([[menuClasses.tieredMenu]])\n      };\n      return {\n        dom: d,\n        markers: markers(presets)\n      };\n    };\n\n    var chunk = function (rowDom, numColumns) {\n      return function (items) {\n        var chunks = chunk$1(items, numColumns);\n        return map$2(chunks, function (c) {\n          return {\n            dom: rowDom,\n            components: c\n          };\n        });\n      };\n    };\n    var forSwatch = function (columns) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-menu',\n            'tox-swatches-menu'\n          ]\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-swatches']\n            },\n            components: [Menu.parts.items({\n                preprocess: columns !== 'auto' ? chunk({\n                  tag: 'div',\n                  classes: ['tox-swatches__row']\n                }, columns) : identity$1\n              })]\n          }]\n      };\n    };\n    var forToolbar = function (columns) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-menu',\n            'tox-collection',\n            'tox-collection--toolbar',\n            'tox-collection--toolbar-lg'\n          ]\n        },\n        components: [Menu.parts.items({\n            preprocess: chunk({\n              tag: 'div',\n              classes: ['tox-collection__group']\n            }, columns)\n          })]\n      };\n    };\n    var preprocessCollection = function (items, isSeparator) {\n      var allSplits = [];\n      var currentSplit = [];\n      each$1(items, function (item, i) {\n        if (isSeparator(item, i)) {\n          if (currentSplit.length > 0) {\n            allSplits.push(currentSplit);\n          }\n          currentSplit = [];\n          if (has$2(item.dom, 'innerHtml')) {\n            currentSplit.push(item);\n          }\n        } else {\n          currentSplit.push(item);\n        }\n      });\n      if (currentSplit.length > 0) {\n        allSplits.push(currentSplit);\n      }\n      return map$2(allSplits, function (s) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-collection__group']\n          },\n          components: s\n        };\n      });\n    };\n    var forCollection = function (columns, initItems, _hasIcons) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-menu',\n            'tox-collection'\n          ].concat(columns === 1 ? ['tox-collection--list'] : ['tox-collection--grid'])\n        },\n        components: [Menu.parts.items({\n            preprocess: function (items) {\n              if (columns !== 'auto' && columns > 1) {\n                return chunk({\n                  tag: 'div',\n                  classes: ['tox-collection__group']\n                }, columns)(items);\n              } else {\n                return preprocessCollection(items, function (_item, i) {\n                  return initItems[i].type === 'separator';\n                });\n              }\n            }\n          })]\n      };\n    };\n    var forHorizontalCollection = function (initItems, _hasIcons) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-collection',\n            'tox-collection--horizontal'\n          ]\n        },\n        components: [Menu.parts.items({\n            preprocess: function (items) {\n              return preprocessCollection(items, function (_item, i) {\n                return initItems[i].type === 'separator';\n              });\n            }\n          })]\n      };\n    };\n\n    var menuHasIcons = function (xs) {\n      return exists(xs, function (item) {\n        return 'icon' in item && item.icon !== undefined;\n      });\n    };\n    var handleError = function (error) {\n      console.error(formatError(error));\n      console.log(error);\n      return Optional.none();\n    };\n    var createHorizontalPartialMenuWithAlloyItems = function (value, _hasIcons, items, _columns, _presets) {\n      var structure = forHorizontalCollection(items);\n      return {\n        value: value,\n        dom: structure.dom,\n        components: structure.components,\n        items: items\n      };\n    };\n    var createPartialMenuWithAlloyItems = function (value, hasIcons, items, columns, presets) {\n      if (presets === 'color') {\n        var structure = forSwatch(columns);\n        return {\n          value: value,\n          dom: structure.dom,\n          components: structure.components,\n          items: items\n        };\n      }\n      if (presets === 'normal' && columns === 'auto') {\n        var structure = forCollection(columns, items);\n        return {\n          value: value,\n          dom: structure.dom,\n          components: structure.components,\n          items: items\n        };\n      }\n      if (presets === 'normal' && columns === 1) {\n        var structure = forCollection(1, items);\n        return {\n          value: value,\n          dom: structure.dom,\n          components: structure.components,\n          items: items\n        };\n      }\n      if (presets === 'normal') {\n        var structure = forCollection(columns, items);\n        return {\n          value: value,\n          dom: structure.dom,\n          components: structure.components,\n          items: items\n        };\n      }\n      if (presets === 'listpreview' && columns !== 'auto') {\n        var structure = forToolbar(columns);\n        return {\n          value: value,\n          dom: structure.dom,\n          components: structure.components,\n          items: items\n        };\n      }\n      return {\n        value: value,\n        dom: dom$1(hasIcons, columns, presets),\n        components: components,\n        items: items\n      };\n    };\n\n    var cardImageFields = [\n      requiredString('type'),\n      requiredString('src'),\n      optionString('alt'),\n      defaultedArrayOf('classes', [], string)\n    ];\n    var cardImageSchema = objOf(cardImageFields);\n\n    var cardTextFields = [\n      requiredString('type'),\n      requiredString('text'),\n      optionString('name'),\n      defaultedArrayOf('classes', ['tox-collection__item-label'], string)\n    ];\n    var cardTextSchema = objOf(cardTextFields);\n\n    var itemSchema$1 = valueThunk(function () {\n      return choose$2('type', {\n        cardimage: cardImageSchema,\n        cardtext: cardTextSchema,\n        cardcontainer: cardContainerSchema\n      });\n    });\n    var cardContainerSchema = objOf([\n      requiredString('type'),\n      defaultedString('direction', 'horizontal'),\n      defaultedString('align', 'left'),\n      defaultedString('valign', 'middle'),\n      requiredArrayOf('items', itemSchema$1)\n    ]);\n\n    var commonMenuItemFields = [\n      defaultedBoolean('disabled', false),\n      optionString('text'),\n      optionString('shortcut'),\n      field$1('value', 'value', defaultedThunk(function () {\n        return generate$6('menuitem-value');\n      }), anyValue()),\n      defaulted('meta', {})\n    ];\n\n    var cardMenuItemSchema = objOf([\n      requiredString('type'),\n      optionString('label'),\n      requiredArrayOf('items', itemSchema$1),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      }),\n      defaultedFunction('onAction', noop)\n    ].concat(commonMenuItemFields));\n    var createCardMenuItem = function (spec) {\n      return asRaw('cardmenuitem', cardMenuItemSchema, spec);\n    };\n\n    var choiceMenuItemSchema = objOf([\n      requiredString('type'),\n      defaultedBoolean('active', false),\n      optionString('icon')\n    ].concat(commonMenuItemFields));\n    var createChoiceMenuItem = function (spec) {\n      return asRaw('choicemenuitem', choiceMenuItemSchema, spec);\n    };\n\n    var baseFields = [\n      requiredString('type'),\n      requiredString('fancytype'),\n      defaultedFunction('onAction', noop)\n    ];\n    var insertTableFields = [defaulted('initData', {})].concat(baseFields);\n    var colorSwatchFields = [defaultedObjOf('initData', {}, [\n        defaultedBoolean('allowCustomColors', true),\n        optionArrayOf('colors', anyValue())\n      ])].concat(baseFields);\n    var fancyMenuItemSchema = choose$1('fancytype', {\n      inserttable: insertTableFields,\n      colorswatch: colorSwatchFields\n    });\n    var createFancyMenuItem = function (spec) {\n      return asRaw('fancymenuitem', fancyMenuItemSchema, spec);\n    };\n\n    var menuItemSchema = objOf([\n      requiredString('type'),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      }),\n      defaultedFunction('onAction', noop),\n      optionString('icon')\n    ].concat(commonMenuItemFields));\n    var createMenuItem = function (spec) {\n      return asRaw('menuitem', menuItemSchema, spec);\n    };\n\n    var nestedMenuItemSchema = objOf([\n      requiredString('type'),\n      requiredFunction('getSubmenuItems'),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      }),\n      optionString('icon')\n    ].concat(commonMenuItemFields));\n    var createNestedMenuItem = function (spec) {\n      return asRaw('nestedmenuitem', nestedMenuItemSchema, spec);\n    };\n\n    var toggleMenuItemSchema = objOf([\n      requiredString('type'),\n      optionString('icon'),\n      defaultedBoolean('active', false),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      }),\n      requiredFunction('onAction')\n    ].concat(commonMenuItemFields));\n    var createToggleMenuItem = function (spec) {\n      return asRaw('togglemenuitem', toggleMenuItemSchema, spec);\n    };\n\n    var detectSize = function (comp, margin, selectorClass) {\n      var descendants$1 = descendants(comp.element, '.' + selectorClass);\n      if (descendants$1.length > 0) {\n        var columnLength = findIndex$1(descendants$1, function (c) {\n          var thisTop = c.dom.getBoundingClientRect().top;\n          var cTop = descendants$1[0].dom.getBoundingClientRect().top;\n          return Math.abs(thisTop - cTop) > margin;\n        }).getOr(descendants$1.length);\n        return Optional.some({\n          numColumns: columnLength,\n          numRows: Math.ceil(descendants$1.length / columnLength)\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n\n    var namedEvents = function (name, handlers) {\n      return derive$1([config(name, handlers)]);\n    };\n    var unnamedEvents = function (handlers) {\n      return namedEvents(generate$6('unnamed-events'), handlers);\n    };\n    var SimpleBehaviours = {\n      namedEvents: namedEvents,\n      unnamedEvents: unnamedEvents\n    };\n\n    var ExclusivityChannel = generate$6('tooltip.exclusive');\n    var ShowTooltipEvent = generate$6('tooltip.show');\n    var HideTooltipEvent = generate$6('tooltip.hide');\n\n    var hideAllExclusive = function (component, _tConfig, _tState) {\n      component.getSystem().broadcastOn([ExclusivityChannel], {});\n    };\n    var setComponents = function (component, tConfig, tState, specs) {\n      tState.getTooltip().each(function (tooltip) {\n        if (tooltip.getSystem().isConnected()) {\n          Replacing.set(tooltip, specs);\n        }\n      });\n    };\n\n    var TooltippingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        hideAllExclusive: hideAllExclusive,\n        setComponents: setComponents\n    });\n\n    var events$9 = function (tooltipConfig, state) {\n      var hide = function (comp) {\n        state.getTooltip().each(function (p) {\n          detach(p);\n          tooltipConfig.onHide(comp, p);\n          state.clearTooltip();\n        });\n        state.clearTimer();\n      };\n      var show = function (comp) {\n        if (!state.isShowing()) {\n          hideAllExclusive(comp);\n          var sink = tooltipConfig.lazySink(comp).getOrDie();\n          var popup = comp.getSystem().build({\n            dom: tooltipConfig.tooltipDom,\n            components: tooltipConfig.tooltipComponents,\n            events: derive$2(tooltipConfig.mode === 'normal' ? [\n              run$1(mouseover(), function (_) {\n                emit(comp, ShowTooltipEvent);\n              }),\n              run$1(mouseout(), function (_) {\n                emit(comp, HideTooltipEvent);\n              })\n            ] : []),\n            behaviours: derive$1([Replacing.config({})])\n          });\n          state.setTooltip(popup);\n          attach(sink, popup);\n          tooltipConfig.onShow(comp, popup);\n          Positioning.position(sink, popup, { anchor: tooltipConfig.anchor(comp) });\n        }\n      };\n      return derive$2(flatten([\n        [\n          run$1(ShowTooltipEvent, function (comp) {\n            state.resetTimer(function () {\n              show(comp);\n            }, tooltipConfig.delay);\n          }),\n          run$1(HideTooltipEvent, function (comp) {\n            state.resetTimer(function () {\n              hide(comp);\n            }, tooltipConfig.delay);\n          }),\n          run$1(receive(), function (comp, message) {\n            var receivingData = message;\n            if (!receivingData.universal) {\n              if (contains$2(receivingData.channels, ExclusivityChannel)) {\n                hide(comp);\n              }\n            }\n          }),\n          runOnDetached(function (comp) {\n            hide(comp);\n          })\n        ],\n        tooltipConfig.mode === 'normal' ? [\n          run$1(focusin(), function (comp) {\n            emit(comp, ShowTooltipEvent);\n          }),\n          run$1(postBlur(), function (comp) {\n            emit(comp, HideTooltipEvent);\n          }),\n          run$1(mouseover(), function (comp) {\n            emit(comp, ShowTooltipEvent);\n          }),\n          run$1(mouseout(), function (comp) {\n            emit(comp, HideTooltipEvent);\n          })\n        ] : [\n          run$1(highlight$1(), function (comp, _se) {\n            emit(comp, ShowTooltipEvent);\n          }),\n          run$1(dehighlight$1(), function (comp) {\n            emit(comp, HideTooltipEvent);\n          })\n        ]\n      ]));\n    };\n\n    var ActiveTooltipping = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$9\n    });\n\n    var TooltippingSchema = [\n      required$1('lazySink'),\n      required$1('tooltipDom'),\n      defaulted('exclusive', true),\n      defaulted('tooltipComponents', []),\n      defaulted('delay', 300),\n      defaultedStringEnum('mode', 'normal', [\n        'normal',\n        'follow-highlight'\n      ]),\n      defaulted('anchor', function (comp) {\n        return {\n          type: 'hotspot',\n          hotspot: comp,\n          layouts: {\n            onLtr: constant$1([\n              south$2,\n              north$2,\n              southeast$2,\n              northeast$2,\n              southwest$2,\n              northwest$2\n            ]),\n            onRtl: constant$1([\n              south$2,\n              north$2,\n              southeast$2,\n              northeast$2,\n              southwest$2,\n              northwest$2\n            ])\n          }\n        };\n      }),\n      onHandler('onHide'),\n      onHandler('onShow')\n    ];\n\n    var init$b = function () {\n      var timer = value$1();\n      var popup = value$1();\n      var clearTimer = function () {\n        timer.on(clearTimeout);\n      };\n      var resetTimer = function (f, delay) {\n        clearTimer();\n        timer.set(setTimeout(f, delay));\n      };\n      var readState = constant$1('not-implemented');\n      return nu$8({\n        getTooltip: popup.get,\n        isShowing: popup.isSet,\n        setTooltip: popup.set,\n        clearTooltip: popup.clear,\n        clearTimer: clearTimer,\n        resetTimer: resetTimer,\n        readState: readState\n      });\n    };\n\n    var TooltippingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$b\n    });\n\n    var Tooltipping = create$8({\n      fields: TooltippingSchema,\n      name: 'tooltipping',\n      active: ActiveTooltipping,\n      state: TooltippingState,\n      apis: TooltippingApis\n    });\n\n    var escape = function (text) {\n      return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n    };\n\n    var global$b = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');\n\n    var global$a = tinymce.util.Tools.resolve('tinymce.EditorManager');\n\n    var getSkinUrl = function (editor) {\n      var skin = editor.getParam('skin');\n      var skinUrl = editor.getParam('skin_url');\n      if (skin !== false) {\n        var skinName = skin ? skin : 'oxide';\n        if (skinUrl) {\n          skinUrl = editor.documentBaseURI.toAbsolute(skinUrl);\n        } else {\n          skinUrl = global$a.baseURL + '/skins/ui/' + skinName;\n        }\n      }\n      return skinUrl;\n    };\n    var isReadOnly = function (editor) {\n      return editor.getParam('readonly', false, 'boolean');\n    };\n    var isSkinDisabled = function (editor) {\n      return editor.getParam('skin') === false;\n    };\n    var getHeightSetting = function (editor) {\n      return editor.getParam('height', Math.max(editor.getElement().offsetHeight, 200));\n    };\n    var getWidthSetting = function (editor) {\n      return editor.getParam('width', global$b.DOM.getStyle(editor.getElement(), 'width'));\n    };\n    var getMinWidthSetting = function (editor) {\n      return Optional.from(editor.getParam('min_width')).filter(isNumber);\n    };\n    var getMinHeightSetting = function (editor) {\n      return Optional.from(editor.getParam('min_height')).filter(isNumber);\n    };\n    var getMaxWidthSetting = function (editor) {\n      return Optional.from(editor.getParam('max_width')).filter(isNumber);\n    };\n    var getMaxHeightSetting = function (editor) {\n      return Optional.from(editor.getParam('max_height')).filter(isNumber);\n    };\n    var getUserStyleFormats = function (editor) {\n      return Optional.from(editor.getParam('style_formats')).filter(isArray);\n    };\n    var isMergeStyleFormats = function (editor) {\n      return editor.getParam('style_formats_merge', false, 'boolean');\n    };\n    var getLineHeightFormats = function (editor) {\n      return editor.getParam('lineheight_formats', '1 1.1 1.2 1.3 1.4 1.5 2', 'string').split(' ');\n    };\n    var getContentLanguages = function (editor) {\n      return editor.getParam('content_langs', undefined, 'array');\n    };\n    var getRemovedMenuItems = function (editor) {\n      return editor.getParam('removed_menuitems', '');\n    };\n    var isMenubarEnabled = function (editor) {\n      return editor.getParam('menubar', true, 'boolean') !== false;\n    };\n    var isToolbarEnabled = function (editor) {\n      var toolbar = editor.getParam('toolbar', true);\n      var isToolbarTrue = toolbar === true;\n      var isToolbarString = isString(toolbar);\n      var isToolbarObjectArray = isArray(toolbar) && toolbar.length > 0;\n      return !isMultipleToolbars(editor) && (isToolbarObjectArray || isToolbarString || isToolbarTrue);\n    };\n    var getMultipleToolbarsSetting = function (editor) {\n      var toolbars = range$2(9, function (num) {\n        return editor.getParam('toolbar' + (num + 1), false, 'string');\n      });\n      var toolbarArray = filter$2(toolbars, function (toolbar) {\n        return typeof toolbar === 'string';\n      });\n      return toolbarArray.length > 0 ? Optional.some(toolbarArray) : Optional.none();\n    };\n    var isMultipleToolbars = function (editor) {\n      return getMultipleToolbarsSetting(editor).fold(function () {\n        var toolbar = editor.getParam('toolbar', [], 'string[]');\n        return toolbar.length > 0;\n      }, always);\n    };\n    var ToolbarMode;\n    (function (ToolbarMode) {\n      ToolbarMode['default'] = 'wrap';\n      ToolbarMode['floating'] = 'floating';\n      ToolbarMode['sliding'] = 'sliding';\n      ToolbarMode['scrolling'] = 'scrolling';\n    }(ToolbarMode || (ToolbarMode = {})));\n    var getToolbarMode = function (editor) {\n      return editor.getParam('toolbar_mode', '', 'string');\n    };\n    var ToolbarLocation;\n    (function (ToolbarLocation) {\n      ToolbarLocation['auto'] = 'auto';\n      ToolbarLocation['top'] = 'top';\n      ToolbarLocation['bottom'] = 'bottom';\n    }(ToolbarLocation || (ToolbarLocation = {})));\n    var getToolbarGroups = function (editor) {\n      return editor.getParam('toolbar_groups', {}, 'object');\n    };\n    var getToolbarLocation = function (editor) {\n      return editor.getParam('toolbar_location', ToolbarLocation.auto, 'string');\n    };\n    var isToolbarLocationBottom = function (editor) {\n      return getToolbarLocation(editor) === ToolbarLocation.bottom;\n    };\n    var fixedContainerSelector = function (editor) {\n      return editor.getParam('fixed_toolbar_container', '', 'string');\n    };\n    var fixedToolbarContainerTarget = function (editor) {\n      return editor.getParam('fixed_toolbar_container_target');\n    };\n    var isToolbarPersist = function (editor) {\n      return editor.getParam('toolbar_persist', false, 'boolean');\n    };\n    var fixedContainerTarget = function (editor) {\n      if (!editor.inline) {\n        return Optional.none();\n      }\n      var selector = fixedContainerSelector(editor);\n      if (selector.length > 0) {\n        return descendant(body(), selector);\n      }\n      var element = fixedToolbarContainerTarget(editor);\n      if (isNonNullable(element)) {\n        return Optional.some(SugarElement.fromDom(element));\n      }\n      return Optional.none();\n    };\n    var useFixedContainer = function (editor) {\n      return editor.inline && fixedContainerTarget(editor).isSome();\n    };\n    var getUiContainer = function (editor) {\n      var fixedContainer = fixedContainerTarget(editor);\n      return fixedContainer.getOrThunk(function () {\n        return getContentContainer(getRootNode(SugarElement.fromDom(editor.getElement())));\n      });\n    };\n    var isDistractionFree = function (editor) {\n      return editor.inline && !isMenubarEnabled(editor) && !isToolbarEnabled(editor) && !isMultipleToolbars(editor);\n    };\n    var isStickyToolbar = function (editor) {\n      var isStickyToolbar = editor.getParam('toolbar_sticky', false, 'boolean');\n      return (isStickyToolbar || editor.inline) && !useFixedContainer(editor) && !isDistractionFree(editor);\n    };\n    var getStickyToolbarOffset = function (editor) {\n      return editor.getParam('toolbar_sticky_offset', 0, 'number');\n    };\n    var isDraggableModal$1 = function (editor) {\n      return editor.getParam('draggable_modal', false, 'boolean');\n    };\n    var getMenus = function (editor) {\n      var menu = editor.getParam('menu');\n      if (menu) {\n        return map$1(menu, function (menu) {\n          return __assign(__assign({}, menu), { items: menu.items });\n        });\n      } else {\n        return {};\n      }\n    };\n    var getMenubar = function (editor) {\n      return editor.getParam('menubar');\n    };\n    var getToolbar = function (editor) {\n      return editor.getParam('toolbar', true);\n    };\n    var getFilePickerCallback = function (editor) {\n      return editor.getParam('file_picker_callback');\n    };\n    var getFilePickerTypes = function (editor) {\n      return editor.getParam('file_picker_types');\n    };\n    var getFileBrowserCallbackTypes = function (editor) {\n      return editor.getParam('file_browser_callback_types');\n    };\n    var noTypeaheadUrls = function (editor) {\n      return editor.getParam('typeahead_urls') === false;\n    };\n    var getAnchorTop = function (editor) {\n      return editor.getParam('anchor_top', '#top');\n    };\n    var getAnchorBottom = function (editor) {\n      return editor.getParam('anchor_bottom', '#bottom');\n    };\n    var getFilePickerValidatorHandler = function (editor) {\n      var handler = editor.getParam('file_picker_validator_handler', undefined, 'function');\n      if (handler === undefined) {\n        return editor.getParam('filepicker_validator_handler', undefined, 'function');\n      } else {\n        return handler;\n      }\n    };\n\n    var ReadOnlyChannel = 'silver.readonly';\n    var ReadOnlyDataSchema = objOf([requiredBoolean('readonly')]);\n    var broadcastReadonly = function (uiComponents, readonly) {\n      var outerContainer = uiComponents.outerContainer;\n      var target = outerContainer.element;\n      if (readonly) {\n        uiComponents.mothership.broadcastOn([dismissPopups()], { target: target });\n        uiComponents.uiMothership.broadcastOn([dismissPopups()], { target: target });\n      }\n      uiComponents.mothership.broadcastOn([ReadOnlyChannel], { readonly: readonly });\n      uiComponents.uiMothership.broadcastOn([ReadOnlyChannel], { readonly: readonly });\n    };\n    var setupReadonlyModeSwitch = function (editor, uiComponents) {\n      editor.on('init', function () {\n        if (editor.mode.isReadOnly()) {\n          broadcastReadonly(uiComponents, true);\n        }\n      });\n      editor.on('SwitchMode', function () {\n        return broadcastReadonly(uiComponents, editor.mode.isReadOnly());\n      });\n      if (isReadOnly(editor)) {\n        editor.setMode('readonly');\n      }\n    };\n    var receivingConfig = function () {\n      var _a;\n      return Receiving.config({\n        channels: (_a = {}, _a[ReadOnlyChannel] = {\n          schema: ReadOnlyDataSchema,\n          onReceive: function (comp, data) {\n            Disabling.set(comp, data.readonly);\n          }\n        }, _a)\n      });\n    };\n\n    var item = function (disabled) {\n      return Disabling.config({\n        disabled: disabled,\n        disableClass: 'tox-collection__item--state-disabled'\n      });\n    };\n    var button = function (disabled) {\n      return Disabling.config({ disabled: disabled });\n    };\n    var splitButton = function (disabled) {\n      return Disabling.config({\n        disabled: disabled,\n        disableClass: 'tox-tbtn--disabled'\n      });\n    };\n    var toolbarButton = function (disabled) {\n      return Disabling.config({\n        disabled: disabled,\n        disableClass: 'tox-tbtn--disabled',\n        useNative: false\n      });\n    };\n    var DisablingConfigs = {\n      item: item,\n      button: button,\n      splitButton: splitButton,\n      toolbarButton: toolbarButton\n    };\n\n    var runWithApi = function (info, comp) {\n      var api = info.getApi(comp);\n      return function (f) {\n        f(api);\n      };\n    };\n    var onControlAttached = function (info, editorOffCell) {\n      return runOnAttached(function (comp) {\n        var run = runWithApi(info, comp);\n        run(function (api) {\n          var onDestroy = info.onSetup(api);\n          if (isFunction(onDestroy)) {\n            editorOffCell.set(onDestroy);\n          }\n        });\n      });\n    };\n    var onControlDetached = function (getApi, editorOffCell) {\n      return runOnDetached(function (comp) {\n        return runWithApi(getApi, comp)(editorOffCell.get());\n      });\n    };\n\n    var _a$1;\n    var onMenuItemExecute = function (info, itemResponse) {\n      return runOnExecute$1(function (comp, simulatedEvent) {\n        runWithApi(info, comp)(info.onAction);\n        if (!info.triggersSubmenu && itemResponse === ItemResponse$1.CLOSE_ON_EXECUTE) {\n          emit(comp, sandboxClose());\n          simulatedEvent.stop();\n        }\n      });\n    };\n    var menuItemEventOrder = (_a$1 = {}, _a$1[execute$5()] = [\n      'disabling',\n      'alloy.base.behaviour',\n      'toggling',\n      'item-events'\n    ], _a$1);\n\n    var componentRenderPipeline = cat;\n    var renderCommonItem = function (spec, structure, itemResponse, providersbackstage) {\n      var editorOffCell = Cell(noop);\n      return {\n        type: 'item',\n        dom: structure.dom,\n        components: componentRenderPipeline(structure.optComponents),\n        data: spec.data,\n        eventOrder: menuItemEventOrder,\n        hasSubmenu: spec.triggersSubmenu,\n        itemBehaviours: derive$1([\n          config('item-events', [\n            onMenuItemExecute(spec, itemResponse),\n            onControlAttached(spec, editorOffCell),\n            onControlDetached(spec, editorOffCell)\n          ]),\n          DisablingConfigs.item(function () {\n            return spec.disabled || providersbackstage.isDisabled();\n          }),\n          receivingConfig(),\n          Replacing.config({})\n        ].concat(spec.itemBehaviours))\n      };\n    };\n    var buildData = function (source) {\n      return {\n        value: source.value,\n        meta: __assign({ text: source.text.getOr('') }, source.meta)\n      };\n    };\n\n    var global$9 = tinymce.util.Tools.resolve('tinymce.Env');\n\n    var convertText = function (source) {\n      var mac = {\n        alt: '&#x2325;',\n        ctrl: '&#x2303;',\n        shift: '&#x21E7;',\n        meta: '&#x2318;',\n        access: '&#x2303;&#x2325;'\n      };\n      var other = {\n        meta: 'Ctrl',\n        access: 'Shift+Alt'\n      };\n      var replace = global$9.mac ? mac : other;\n      var shortcut = source.split('+');\n      var updated = map$2(shortcut, function (segment) {\n        var search = segment.toLowerCase().trim();\n        return has$2(replace, search) ? replace[search] : segment;\n      });\n      return global$9.mac ? updated.join('') : updated.join('+');\n    };\n\n    var renderIcon$1 = function (name, icons, classes) {\n      if (classes === void 0) {\n        classes = [iconClass];\n      }\n      return render$3(name, {\n        tag: 'div',\n        classes: classes\n      }, icons);\n    };\n    var renderText = function (text) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [textClass]\n        },\n        components: [text$1(global$e.translate(text))]\n      };\n    };\n    var renderHtml = function (html, classes) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: classes,\n          innerHtml: html\n        }\n      };\n    };\n    var renderStyledText = function (style, text) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [textClass]\n        },\n        components: [{\n            dom: {\n              tag: style.tag,\n              styles: style.styles\n            },\n            components: [text$1(global$e.translate(text))]\n          }]\n      };\n    };\n    var renderShortcut = function (shortcut) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [accessoryClass],\n          innerHtml: convertText(shortcut)\n        }\n      };\n    };\n    var renderCheckmark = function (icons) {\n      return renderIcon$1('checkmark', icons, [checkmarkClass]);\n    };\n    var renderSubmenuCaret = function (icons) {\n      return renderIcon$1('chevron-right', icons, [caretClass]);\n    };\n    var renderDownwardsCaret = function (icons) {\n      return renderIcon$1('chevron-down', icons, [caretClass]);\n    };\n    var renderContainer = function (container, components) {\n      var directionClass = container.direction === 'vertical' ? containerColumnClass : containerRowClass;\n      var alignClass = container.align === 'left' ? containerAlignLeftClass : containerAlignRightClass;\n      var getValignClass = function () {\n        switch (container.valign) {\n        case 'top':\n          return containerValignTopClass;\n        case 'middle':\n          return containerValignMiddleClass;\n        case 'bottom':\n          return containerValignBottomClass;\n        }\n      };\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            containerClass,\n            directionClass,\n            alignClass,\n            getValignClass()\n          ]\n        },\n        components: components\n      };\n    };\n    var renderImage = function (src, classes, alt) {\n      return {\n        dom: {\n          tag: 'img',\n          classes: classes,\n          attributes: {\n            src: src,\n            alt: alt.getOr('')\n          }\n        }\n      };\n    };\n\n    var renderColorStructure = function (item, providerBackstage, fallbackIcon) {\n      var colorPickerCommand = 'custom';\n      var removeColorCommand = 'remove';\n      var itemText = item.ariaLabel;\n      var itemValue = item.value;\n      var iconSvg = item.iconContent.map(function (name) {\n        return getOr(name, providerBackstage.icons, fallbackIcon);\n      });\n      var getDom = function () {\n        var common = colorClass;\n        var icon = iconSvg.getOr('');\n        var attributes = itemText.map(function (text) {\n          return { title: providerBackstage.translate(text) };\n        }).getOr({});\n        var baseDom = {\n          tag: 'div',\n          attributes: attributes,\n          classes: [common]\n        };\n        if (itemValue === colorPickerCommand) {\n          return __assign(__assign({}, baseDom), {\n            tag: 'button',\n            classes: __spreadArray(__spreadArray([], baseDom.classes, true), ['tox-swatches__picker-btn'], false),\n            innerHtml: icon\n          });\n        } else if (itemValue === removeColorCommand) {\n          return __assign(__assign({}, baseDom), {\n            classes: __spreadArray(__spreadArray([], baseDom.classes, true), ['tox-swatch--remove'], false),\n            innerHtml: icon\n          });\n        } else {\n          return __assign(__assign({}, baseDom), {\n            attributes: __assign(__assign({}, baseDom.attributes), { 'data-mce-color': itemValue }),\n            styles: { 'background-color': itemValue }\n          });\n        }\n      };\n      return {\n        dom: getDom(),\n        optComponents: []\n      };\n    };\n    var renderItemDomStructure = function (ariaLabel) {\n      var domTitle = ariaLabel.map(function (label) {\n        return { attributes: { title: global$e.translate(label) } };\n      }).getOr({});\n      return __assign({\n        tag: 'div',\n        classes: [\n          navClass,\n          selectableClass\n        ]\n      }, domTitle);\n    };\n    var renderNormalItemStructure = function (info, providersBackstage, renderIcons, fallbackIcon) {\n      var iconSpec = {\n        tag: 'div',\n        classes: [iconClass]\n      };\n      var renderIcon = function (iconName) {\n        return render$3(iconName, iconSpec, providersBackstage.icons, fallbackIcon);\n      };\n      var renderEmptyIcon = function () {\n        return Optional.some({ dom: iconSpec });\n      };\n      var leftIcon = renderIcons ? info.iconContent.map(renderIcon).orThunk(renderEmptyIcon) : Optional.none();\n      var checkmark = info.checkMark;\n      var textRender = Optional.from(info.meta).fold(function () {\n        return renderText;\n      }, function (meta) {\n        return has$2(meta, 'style') ? curry(renderStyledText, meta.style) : renderText;\n      });\n      var content = info.htmlContent.fold(function () {\n        return info.textContent.map(textRender);\n      }, function (html) {\n        return Optional.some(renderHtml(html, [textClass]));\n      });\n      var menuItem = {\n        dom: renderItemDomStructure(info.ariaLabel),\n        optComponents: [\n          leftIcon,\n          content,\n          info.shortcutContent.map(renderShortcut),\n          checkmark,\n          info.caret\n        ]\n      };\n      return menuItem;\n    };\n    var renderItemStructure = function (info, providersBackstage, renderIcons, fallbackIcon) {\n      if (fallbackIcon === void 0) {\n        fallbackIcon = Optional.none();\n      }\n      if (info.presets === 'color') {\n        return renderColorStructure(info, providersBackstage, fallbackIcon);\n      } else {\n        return renderNormalItemStructure(info, providersBackstage, renderIcons, fallbackIcon);\n      }\n    };\n\n    var tooltipBehaviour = function (meta, sharedBackstage) {\n      return get$e(meta, 'tooltipWorker').map(function (tooltipWorker) {\n        return [Tooltipping.config({\n            lazySink: sharedBackstage.getSink,\n            tooltipDom: {\n              tag: 'div',\n              classes: ['tox-tooltip-worker-container']\n            },\n            tooltipComponents: [],\n            anchor: function (comp) {\n              return {\n                type: 'submenu',\n                item: comp,\n                overrides: { maxHeightFunction: expandable$1 }\n              };\n            },\n            mode: 'follow-highlight',\n            onShow: function (component, _tooltip) {\n              tooltipWorker(function (elm) {\n                Tooltipping.setComponents(component, [external$2({ element: SugarElement.fromDom(elm) })]);\n              });\n            }\n          })];\n      }).getOr([]);\n    };\n    var encodeText = function (text) {\n      return global$b.DOM.encode(text);\n    };\n    var replaceText = function (text, matchText) {\n      var translated = global$e.translate(text);\n      var encoded = encodeText(translated);\n      if (matchText.length > 0) {\n        var escapedMatchRegex = new RegExp(escape(matchText), 'gi');\n        return encoded.replace(escapedMatchRegex, function (match) {\n          return '<span class=\"tox-autocompleter-highlight\">' + match + '</span>';\n        });\n      } else {\n        return encoded;\n      }\n    };\n    var renderAutocompleteItem = function (spec, matchText, useText, presets, onItemValueHandler, itemResponse, sharedBackstage, renderIcons) {\n      if (renderIcons === void 0) {\n        renderIcons = true;\n      }\n      var structure = renderItemStructure({\n        presets: presets,\n        textContent: Optional.none(),\n        htmlContent: useText ? spec.text.map(function (text) {\n          return replaceText(text, matchText);\n        }) : Optional.none(),\n        ariaLabel: spec.text,\n        iconContent: spec.icon,\n        shortcutContent: Optional.none(),\n        checkMark: Optional.none(),\n        caret: Optional.none(),\n        value: spec.value\n      }, sharedBackstage.providers, renderIcons, spec.icon);\n      return renderCommonItem({\n        data: buildData(spec),\n        disabled: spec.disabled,\n        getApi: constant$1({}),\n        onAction: function (_api) {\n          return onItemValueHandler(spec.value, spec.meta);\n        },\n        onSetup: constant$1(noop),\n        triggersSubmenu: false,\n        itemBehaviours: tooltipBehaviour(spec.meta, sharedBackstage)\n      }, structure, itemResponse, sharedBackstage.providers);\n    };\n\n    var render$2 = function (items, extras) {\n      return map$2(items, function (item) {\n        switch (item.type) {\n        case 'cardcontainer':\n          return renderContainer(item, render$2(item.items, extras));\n        case 'cardimage':\n          return renderImage(item.src, item.classes, item.alt);\n        case 'cardtext':\n          var shouldHighlight = item.name.exists(function (name) {\n            return contains$2(extras.cardText.highlightOn, name);\n          });\n          var matchText = shouldHighlight ? Optional.from(extras.cardText.matchText).getOr('') : '';\n          return renderHtml(replaceText(item.text, matchText), item.classes);\n        }\n      });\n    };\n    var renderCardMenuItem = function (spec, itemResponse, sharedBackstage, extras) {\n      var getApi = function (component) {\n        return {\n          isDisabled: function () {\n            return Disabling.isDisabled(component);\n          },\n          setDisabled: function (state) {\n            Disabling.set(component, state);\n            each$1(descendants(component.element, '*'), function (elm) {\n              component.getSystem().getByDom(elm).each(function (comp) {\n                if (comp.hasConfigured(Disabling)) {\n                  Disabling.set(comp, state);\n                }\n              });\n            });\n          }\n        };\n      };\n      var structure = {\n        dom: renderItemDomStructure(spec.label),\n        optComponents: [Optional.some({\n            dom: {\n              tag: 'div',\n              classes: [\n                containerClass,\n                containerRowClass\n              ]\n            },\n            components: render$2(spec.items, extras)\n          })]\n      };\n      return renderCommonItem({\n        data: buildData(__assign({ text: Optional.none() }, spec)),\n        disabled: spec.disabled,\n        getApi: getApi,\n        onAction: spec.onAction,\n        onSetup: spec.onSetup,\n        triggersSubmenu: false,\n        itemBehaviours: Optional.from(extras.itemBehaviours).getOr([])\n      }, structure, itemResponse, sharedBackstage.providers);\n    };\n\n    var renderChoiceItem = function (spec, useText, presets, onItemValueHandler, isSelected, itemResponse, providersBackstage, renderIcons) {\n      if (renderIcons === void 0) {\n        renderIcons = true;\n      }\n      var getApi = function (component) {\n        return {\n          setActive: function (state) {\n            Toggling.set(component, state);\n          },\n          isActive: function () {\n            return Toggling.isOn(component);\n          },\n          isDisabled: function () {\n            return Disabling.isDisabled(component);\n          },\n          setDisabled: function (state) {\n            return Disabling.set(component, state);\n          }\n        };\n      };\n      var structure = renderItemStructure({\n        presets: presets,\n        textContent: useText ? spec.text : Optional.none(),\n        htmlContent: Optional.none(),\n        ariaLabel: spec.text,\n        iconContent: spec.icon,\n        shortcutContent: useText ? spec.shortcut : Optional.none(),\n        checkMark: useText ? Optional.some(renderCheckmark(providersBackstage.icons)) : Optional.none(),\n        caret: Optional.none(),\n        value: spec.value\n      }, providersBackstage, renderIcons);\n      return deepMerge(renderCommonItem({\n        data: buildData(spec),\n        disabled: spec.disabled,\n        getApi: getApi,\n        onAction: function (_api) {\n          return onItemValueHandler(spec.value);\n        },\n        onSetup: function (api) {\n          api.setActive(isSelected);\n          return noop;\n        },\n        triggersSubmenu: false,\n        itemBehaviours: []\n      }, structure, itemResponse, providersBackstage), {\n        toggling: {\n          toggleClass: tickedClass,\n          toggleOnExecute: false,\n          selected: spec.active\n        }\n      });\n    };\n\n    var parts$f = generate$3(owner$2(), parts$h());\n\n    var hexColour = function (value) {\n      return { value: value };\n    };\n    var shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\n    var longformRegex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i;\n    var isHexString = function (hex) {\n      return shorthandRegex.test(hex) || longformRegex.test(hex);\n    };\n    var normalizeHex = function (hex) {\n      return removeLeading(hex, '#').toUpperCase();\n    };\n    var fromString$1 = function (hex) {\n      return isHexString(hex) ? Optional.some({ value: normalizeHex(hex) }) : Optional.none();\n    };\n    var getLongForm = function (hex) {\n      var hexString = hex.value.replace(shorthandRegex, function (m, r, g, b) {\n        return r + r + g + g + b + b;\n      });\n      return { value: hexString };\n    };\n    var extractValues = function (hex) {\n      var longForm = getLongForm(hex);\n      var splitForm = longformRegex.exec(longForm.value);\n      return splitForm === null ? [\n        'FFFFFF',\n        'FF',\n        'FF',\n        'FF'\n      ] : splitForm;\n    };\n    var toHex = function (component) {\n      var hex = component.toString(16);\n      return (hex.length === 1 ? '0' + hex : hex).toUpperCase();\n    };\n    var fromRgba = function (rgbaColour) {\n      var value = toHex(rgbaColour.red) + toHex(rgbaColour.green) + toHex(rgbaColour.blue);\n      return hexColour(value);\n    };\n\n    var min = Math.min;\n    var max = Math.max;\n    var round$1 = Math.round;\n    var rgbRegex = /^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)/;\n    var rgbaRegex = /^rgba\\((\\d+),\\s*(\\d+),\\s*(\\d+),\\s*(\\d?(?:\\.\\d+)?)\\)/;\n    var rgbaColour = function (red, green, blue, alpha) {\n      return {\n        red: red,\n        green: green,\n        blue: blue,\n        alpha: alpha\n      };\n    };\n    var isRgbaComponent = function (value) {\n      var num = parseInt(value, 10);\n      return num.toString() === value && num >= 0 && num <= 255;\n    };\n    var fromHsv = function (hsv) {\n      var r;\n      var g;\n      var b;\n      var hue = (hsv.hue || 0) % 360;\n      var saturation = hsv.saturation / 100;\n      var brightness = hsv.value / 100;\n      saturation = max(0, min(saturation, 1));\n      brightness = max(0, min(brightness, 1));\n      if (saturation === 0) {\n        r = g = b = round$1(255 * brightness);\n        return rgbaColour(r, g, b, 1);\n      }\n      var side = hue / 60;\n      var chroma = brightness * saturation;\n      var x = chroma * (1 - Math.abs(side % 2 - 1));\n      var match = brightness - chroma;\n      switch (Math.floor(side)) {\n      case 0:\n        r = chroma;\n        g = x;\n        b = 0;\n        break;\n      case 1:\n        r = x;\n        g = chroma;\n        b = 0;\n        break;\n      case 2:\n        r = 0;\n        g = chroma;\n        b = x;\n        break;\n      case 3:\n        r = 0;\n        g = x;\n        b = chroma;\n        break;\n      case 4:\n        r = x;\n        g = 0;\n        b = chroma;\n        break;\n      case 5:\n        r = chroma;\n        g = 0;\n        b = x;\n        break;\n      default:\n        r = g = b = 0;\n      }\n      r = round$1(255 * (r + match));\n      g = round$1(255 * (g + match));\n      b = round$1(255 * (b + match));\n      return rgbaColour(r, g, b, 1);\n    };\n    var fromHex = function (hexColour) {\n      var result = extractValues(hexColour);\n      var red = parseInt(result[1], 16);\n      var green = parseInt(result[2], 16);\n      var blue = parseInt(result[3], 16);\n      return rgbaColour(red, green, blue, 1);\n    };\n    var fromStringValues = function (red, green, blue, alpha) {\n      var r = parseInt(red, 10);\n      var g = parseInt(green, 10);\n      var b = parseInt(blue, 10);\n      var a = parseFloat(alpha);\n      return rgbaColour(r, g, b, a);\n    };\n    var fromString = function (rgbaString) {\n      if (rgbaString === 'transparent') {\n        return Optional.some(rgbaColour(0, 0, 0, 0));\n      }\n      var rgbMatch = rgbRegex.exec(rgbaString);\n      if (rgbMatch !== null) {\n        return Optional.some(fromStringValues(rgbMatch[1], rgbMatch[2], rgbMatch[3], '1'));\n      }\n      var rgbaMatch = rgbaRegex.exec(rgbaString);\n      if (rgbaMatch !== null) {\n        return Optional.some(fromStringValues(rgbaMatch[1], rgbaMatch[2], rgbaMatch[3], rgbaMatch[4]));\n      }\n      return Optional.none();\n    };\n    var toString = function (rgba) {\n      return 'rgba(' + rgba.red + ',' + rgba.green + ',' + rgba.blue + ',' + rgba.alpha + ')';\n    };\n    var red = rgbaColour(255, 0, 0, 1);\n\n    var fireSkinLoaded$1 = function (editor) {\n      return editor.fire('SkinLoaded');\n    };\n    var fireSkinLoadError$1 = function (editor, error) {\n      return editor.fire('SkinLoadError', error);\n    };\n    var fireResizeEditor = function (editor) {\n      return editor.fire('ResizeEditor');\n    };\n    var fireResizeContent = function (editor, e) {\n      return editor.fire('ResizeContent', e);\n    };\n    var fireScrollContent = function (editor, e) {\n      return editor.fire('ScrollContent', e);\n    };\n    var fireTextColorChange = function (editor, data) {\n      return editor.fire('TextColorChange', data);\n    };\n\n    var hsvColour = function (hue, saturation, value) {\n      return {\n        hue: hue,\n        saturation: saturation,\n        value: value\n      };\n    };\n    var fromRgb = function (rgbaColour) {\n      var h = 0;\n      var s = 0;\n      var v = 0;\n      var r = rgbaColour.red / 255;\n      var g = rgbaColour.green / 255;\n      var b = rgbaColour.blue / 255;\n      var minRGB = Math.min(r, Math.min(g, b));\n      var maxRGB = Math.max(r, Math.max(g, b));\n      if (minRGB === maxRGB) {\n        v = minRGB;\n        return hsvColour(0, 0, v * 100);\n      }\n      var d = r === minRGB ? g - b : b === minRGB ? r - g : b - r;\n      h = r === minRGB ? 3 : b === minRGB ? 1 : 5;\n      h = 60 * (h - d / (maxRGB - minRGB));\n      s = (maxRGB - minRGB) / maxRGB;\n      v = maxRGB;\n      return hsvColour(Math.round(h), Math.round(s * 100), Math.round(v * 100));\n    };\n\n    var hexToHsv = function (hex) {\n      return fromRgb(fromHex(hex));\n    };\n    var hsvToHex = function (hsv) {\n      return fromRgba(fromHsv(hsv));\n    };\n    var anyToHex = function (color) {\n      return fromString$1(color).orThunk(function () {\n        return fromString(color).map(fromRgba);\n      }).getOrThunk(function () {\n        var canvas = document.createElement('canvas');\n        canvas.height = 1;\n        canvas.width = 1;\n        var canvasContext = canvas.getContext('2d');\n        canvasContext.clearRect(0, 0, canvas.width, canvas.height);\n        canvasContext.fillStyle = '#FFFFFF';\n        canvasContext.fillStyle = color;\n        canvasContext.fillRect(0, 0, 1, 1);\n        var rgba = canvasContext.getImageData(0, 0, 1, 1).data;\n        var r = rgba[0];\n        var g = rgba[1];\n        var b = rgba[2];\n        var a = rgba[3];\n        return fromRgba(rgbaColour(r, g, b, a));\n      });\n    };\n\n    var global$8 = tinymce.util.Tools.resolve('tinymce.util.LocalStorage');\n\n    var storageName = 'tinymce-custom-colors';\n    function ColorCache (max) {\n      if (max === void 0) {\n        max = 10;\n      }\n      var storageString = global$8.getItem(storageName);\n      var localstorage = isString(storageString) ? JSON.parse(storageString) : [];\n      var prune = function (list) {\n        var diff = max - list.length;\n        return diff < 0 ? list.slice(0, max) : list;\n      };\n      var cache = prune(localstorage);\n      var add = function (key) {\n        indexOf(cache, key).each(remove);\n        cache.unshift(key);\n        if (cache.length > max) {\n          cache.pop();\n        }\n        global$8.setItem(storageName, JSON.stringify(cache));\n      };\n      var remove = function (idx) {\n        cache.splice(idx, 1);\n      };\n      var state = function () {\n        return cache.slice(0);\n      };\n      return {\n        add: add,\n        state: state\n      };\n    }\n\n    var choiceItem = 'choiceitem';\n    var defaultColors = [\n      {\n        type: choiceItem,\n        text: 'Light Green',\n        value: '#BFEDD2'\n      },\n      {\n        type: choiceItem,\n        text: 'Light Yellow',\n        value: '#FBEEB8'\n      },\n      {\n        type: choiceItem,\n        text: 'Light Red',\n        value: '#F8CAC6'\n      },\n      {\n        type: choiceItem,\n        text: 'Light Purple',\n        value: '#ECCAFA'\n      },\n      {\n        type: choiceItem,\n        text: 'Light Blue',\n        value: '#C2E0F4'\n      },\n      {\n        type: choiceItem,\n        text: 'Green',\n        value: '#2DC26B'\n      },\n      {\n        type: choiceItem,\n        text: 'Yellow',\n        value: '#F1C40F'\n      },\n      {\n        type: choiceItem,\n        text: 'Red',\n        value: '#E03E2D'\n      },\n      {\n        type: choiceItem,\n        text: 'Purple',\n        value: '#B96AD9'\n      },\n      {\n        type: choiceItem,\n        text: 'Blue',\n        value: '#3598DB'\n      },\n      {\n        type: choiceItem,\n        text: 'Dark Turquoise',\n        value: '#169179'\n      },\n      {\n        type: choiceItem,\n        text: 'Orange',\n        value: '#E67E23'\n      },\n      {\n        type: choiceItem,\n        text: 'Dark Red',\n        value: '#BA372A'\n      },\n      {\n        type: choiceItem,\n        text: 'Dark Purple',\n        value: '#843FA1'\n      },\n      {\n        type: choiceItem,\n        text: 'Dark Blue',\n        value: '#236FA1'\n      },\n      {\n        type: choiceItem,\n        text: 'Light Gray',\n        value: '#ECF0F1'\n      },\n      {\n        type: choiceItem,\n        text: 'Medium Gray',\n        value: '#CED4D9'\n      },\n      {\n        type: choiceItem,\n        text: 'Gray',\n        value: '#95A5A6'\n      },\n      {\n        type: choiceItem,\n        text: 'Dark Gray',\n        value: '#7E8C8D'\n      },\n      {\n        type: choiceItem,\n        text: 'Navy Blue',\n        value: '#34495E'\n      },\n      {\n        type: choiceItem,\n        text: 'Black',\n        value: '#000000'\n      },\n      {\n        type: choiceItem,\n        text: 'White',\n        value: '#ffffff'\n      }\n    ];\n    var colorCache = ColorCache(10);\n    var mapColors = function (colorMap) {\n      var colors = [];\n      for (var i = 0; i < colorMap.length; i += 2) {\n        colors.push({\n          text: colorMap[i + 1],\n          value: '#' + anyToHex(colorMap[i]).value,\n          type: 'choiceitem'\n        });\n      }\n      return colors;\n    };\n    var getColorCols$2 = function (editor, defaultCols) {\n      return editor.getParam('color_cols', defaultCols, 'number');\n    };\n    var hasCustomColors$1 = function (editor) {\n      return editor.getParam('custom_colors') !== false;\n    };\n    var getColorMap = function (editor) {\n      return editor.getParam('color_map');\n    };\n    var getColors$2 = function (editor) {\n      var unmapped = getColorMap(editor);\n      return unmapped !== undefined ? mapColors(unmapped) : defaultColors;\n    };\n    var getCurrentColors = function () {\n      return map$2(colorCache.state(), function (color) {\n        return {\n          type: choiceItem,\n          text: color,\n          value: color\n        };\n      });\n    };\n    var addColor = function (color) {\n      colorCache.add(color);\n    };\n\n    var fallbackColor = '#000000';\n    var getCurrentColor = function (editor, format) {\n      var color;\n      editor.dom.getParents(editor.selection.getStart(), function (elm) {\n        var value;\n        if (value = elm.style[format === 'forecolor' ? 'color' : 'background-color']) {\n          color = color ? color : value;\n        }\n      });\n      return Optional.from(color);\n    };\n    var applyFormat = function (editor, format, value) {\n      editor.undoManager.transact(function () {\n        editor.focus();\n        editor.formatter.apply(format, { value: value });\n        editor.nodeChanged();\n      });\n    };\n    var removeFormat = function (editor, format) {\n      editor.undoManager.transact(function () {\n        editor.focus();\n        editor.formatter.remove(format, { value: null }, null, true);\n        editor.nodeChanged();\n      });\n    };\n    var registerCommands = function (editor) {\n      editor.addCommand('mceApplyTextcolor', function (format, value) {\n        applyFormat(editor, format, value);\n      });\n      editor.addCommand('mceRemoveTextcolor', function (format) {\n        removeFormat(editor, format);\n      });\n    };\n    var calcCols = function (colors) {\n      return Math.max(5, Math.ceil(Math.sqrt(colors)));\n    };\n    var getColorCols$1 = function (editor) {\n      var colors = getColors$2(editor);\n      var defaultCols = calcCols(colors.length);\n      return getColorCols$2(editor, defaultCols);\n    };\n    var getAdditionalColors = function (hasCustom) {\n      var type = 'choiceitem';\n      var remove = {\n        type: type,\n        text: 'Remove color',\n        icon: 'color-swatch-remove-color',\n        value: 'remove'\n      };\n      var custom = {\n        type: type,\n        text: 'Custom color',\n        icon: 'color-picker',\n        value: 'custom'\n      };\n      return hasCustom ? [\n        remove,\n        custom\n      ] : [remove];\n    };\n    var applyColor = function (editor, format, value, onChoice) {\n      if (value === 'custom') {\n        var dialog = colorPickerDialog(editor);\n        dialog(function (colorOpt) {\n          colorOpt.each(function (color) {\n            addColor(color);\n            editor.execCommand('mceApplyTextcolor', format, color);\n            onChoice(color);\n          });\n        }, fallbackColor);\n      } else if (value === 'remove') {\n        onChoice('');\n        editor.execCommand('mceRemoveTextcolor', format);\n      } else {\n        onChoice(value);\n        editor.execCommand('mceApplyTextcolor', format, value);\n      }\n    };\n    var getColors$1 = function (colors, hasCustom) {\n      return colors.concat(getCurrentColors().concat(getAdditionalColors(hasCustom)));\n    };\n    var getFetch$1 = function (colors, hasCustom) {\n      return function (callback) {\n        callback(getColors$1(colors, hasCustom));\n      };\n    };\n    var setIconColor = function (splitButtonApi, name, newColor) {\n      var id = name === 'forecolor' ? 'tox-icon-text-color__color' : 'tox-icon-highlight-bg-color__color';\n      splitButtonApi.setIconFill(id, newColor);\n    };\n    var registerTextColorButton = function (editor, name, format, tooltip, lastColor) {\n      editor.ui.registry.addSplitButton(name, {\n        tooltip: tooltip,\n        presets: 'color',\n        icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color',\n        select: function (value) {\n          var optCurrentRgb = getCurrentColor(editor, format);\n          return optCurrentRgb.bind(function (currentRgb) {\n            return fromString(currentRgb).map(function (rgba) {\n              var currentHex = fromRgba(rgba).value;\n              return contains$1(value.toLowerCase(), currentHex);\n            });\n          }).getOr(false);\n        },\n        columns: getColorCols$1(editor),\n        fetch: getFetch$1(getColors$2(editor), hasCustomColors$1(editor)),\n        onAction: function (_splitButtonApi) {\n          applyColor(editor, format, lastColor.get(), noop);\n        },\n        onItemAction: function (_splitButtonApi, value) {\n          applyColor(editor, format, value, function (newColor) {\n            lastColor.set(newColor);\n            fireTextColorChange(editor, {\n              name: name,\n              color: newColor\n            });\n          });\n        },\n        onSetup: function (splitButtonApi) {\n          setIconColor(splitButtonApi, name, lastColor.get());\n          var handler = function (e) {\n            if (e.name === name) {\n              setIconColor(splitButtonApi, e.name, e.color);\n            }\n          };\n          editor.on('TextColorChange', handler);\n          return function () {\n            editor.off('TextColorChange', handler);\n          };\n        }\n      });\n    };\n    var registerTextColorMenuItem = function (editor, name, format, text) {\n      editor.ui.registry.addNestedMenuItem(name, {\n        text: text,\n        icon: name === 'forecolor' ? 'text-color' : 'highlight-bg-color',\n        getSubmenuItems: function () {\n          return [{\n              type: 'fancymenuitem',\n              fancytype: 'colorswatch',\n              onAction: function (data) {\n                applyColor(editor, format, data.value, noop);\n              }\n            }];\n        }\n      });\n    };\n    var colorPickerDialog = function (editor) {\n      return function (callback, value) {\n        var isValid = false;\n        var onSubmit = function (api) {\n          var data = api.getData();\n          var hex = data.colorpicker;\n          if (isValid) {\n            callback(Optional.from(hex));\n            api.close();\n          } else {\n            editor.windowManager.alert(editor.translate([\n              'Invalid hex color code: {0}',\n              hex\n            ]));\n          }\n        };\n        var onAction = function (_api, details) {\n          if (details.name === 'hex-valid') {\n            isValid = details.value;\n          }\n        };\n        var initialData = { colorpicker: value };\n        editor.windowManager.open({\n          title: 'Color Picker',\n          size: 'normal',\n          body: {\n            type: 'panel',\n            items: [{\n                type: 'colorpicker',\n                name: 'colorpicker',\n                label: 'Color'\n              }]\n          },\n          buttons: [\n            {\n              type: 'cancel',\n              name: 'cancel',\n              text: 'Cancel'\n            },\n            {\n              type: 'submit',\n              name: 'save',\n              text: 'Save',\n              primary: true\n            }\n          ],\n          initialData: initialData,\n          onAction: onAction,\n          onSubmit: onSubmit,\n          onClose: noop,\n          onCancel: function () {\n            callback(Optional.none());\n          }\n        });\n      };\n    };\n    var register$a = function (editor) {\n      registerCommands(editor);\n      var lastForeColor = Cell(fallbackColor);\n      var lastBackColor = Cell(fallbackColor);\n      registerTextColorButton(editor, 'forecolor', 'forecolor', 'Text color', lastForeColor);\n      registerTextColorButton(editor, 'backcolor', 'hilitecolor', 'Background color', lastBackColor);\n      registerTextColorMenuItem(editor, 'forecolor', 'forecolor', 'Text color');\n      registerTextColorMenuItem(editor, 'backcolor', 'hilitecolor', 'Background color');\n    };\n\n    var createPartialChoiceMenu = function (value, items, onItemValueHandler, columns, presets, itemResponse, select, providersBackstage) {\n      var hasIcons = menuHasIcons(items);\n      var presetItemTypes = presets !== 'color' ? 'normal' : 'color';\n      var alloyItems = createChoiceItems(items, onItemValueHandler, columns, presetItemTypes, itemResponse, select, providersBackstage);\n      return createPartialMenuWithAlloyItems(value, hasIcons, alloyItems, columns, presets);\n    };\n    var createChoiceItems = function (items, onItemValueHandler, columns, itemPresets, itemResponse, select, providersBackstage) {\n      return cat(map$2(items, function (item) {\n        if (item.type === 'choiceitem') {\n          return createChoiceMenuItem(item).fold(handleError, function (d) {\n            return Optional.some(renderChoiceItem(d, columns === 1, itemPresets, onItemValueHandler, select(item.value), itemResponse, providersBackstage, menuHasIcons(items)));\n          });\n        } else {\n          return Optional.none();\n        }\n      }));\n    };\n\n    var deriveMenuMovement = function (columns, presets) {\n      var menuMarkers = markers(presets);\n      if (columns === 1) {\n        return {\n          mode: 'menu',\n          moveOnTab: true\n        };\n      } else if (columns === 'auto') {\n        return {\n          mode: 'grid',\n          selector: '.' + menuMarkers.item,\n          initSize: {\n            numColumns: 1,\n            numRows: 1\n          }\n        };\n      } else {\n        var rowClass = presets === 'color' ? 'tox-swatches__row' : 'tox-collection__group';\n        return {\n          mode: 'matrix',\n          rowSelector: '.' + rowClass\n        };\n      }\n    };\n    var deriveCollectionMovement = function (columns, presets) {\n      if (columns === 1) {\n        return {\n          mode: 'menu',\n          moveOnTab: false,\n          selector: '.tox-collection__item'\n        };\n      } else if (columns === 'auto') {\n        return {\n          mode: 'flatgrid',\n          selector: '.' + 'tox-collection__item',\n          initSize: {\n            numColumns: 1,\n            numRows: 1\n          }\n        };\n      } else {\n        return {\n          mode: 'matrix',\n          selectors: {\n            row: presets === 'color' ? '.tox-swatches__row' : '.tox-collection__group',\n            cell: presets === 'color' ? '.' + colorClass : '.' + selectableClass\n          }\n        };\n      }\n    };\n\n    var renderColorSwatchItem = function (spec, backstage) {\n      var items = getColorItems(spec, backstage);\n      var columns = backstage.colorinput.getColorCols();\n      var presets = 'color';\n      var menuSpec = createPartialChoiceMenu(generate$6('menu-value'), items, function (value) {\n        spec.onAction({ value: value });\n      }, columns, presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, backstage.shared.providers);\n      var widgetSpec = __assign(__assign({}, menuSpec), {\n        markers: markers(presets),\n        movement: deriveMenuMovement(columns, presets)\n      });\n      return {\n        type: 'widget',\n        data: { value: generate$6('widget-id') },\n        dom: {\n          tag: 'div',\n          classes: ['tox-fancymenuitem']\n        },\n        autofocus: true,\n        components: [parts$f.widget(Menu.sketch(widgetSpec))]\n      };\n    };\n    var getColorItems = function (spec, backstage) {\n      var useCustomColors = spec.initData.allowCustomColors && backstage.colorinput.hasCustomColors();\n      return spec.initData.colors.fold(function () {\n        return getColors$1(backstage.colorinput.getColors(), useCustomColors);\n      }, function (colors) {\n        return colors.concat(getAdditionalColors(useCustomColors));\n      });\n    };\n\n    var cellOverEvent = generate$6('cell-over');\n    var cellExecuteEvent = generate$6('cell-execute');\n    var makeCell = function (row, col, labelId) {\n      var _a;\n      var emitCellOver = function (c) {\n        return emitWith(c, cellOverEvent, {\n          row: row,\n          col: col\n        });\n      };\n      var emitExecute = function (c) {\n        return emitWith(c, cellExecuteEvent, {\n          row: row,\n          col: col\n        });\n      };\n      var onClick = function (c, se) {\n        se.stop();\n        emitExecute(c);\n      };\n      return build$1({\n        dom: {\n          tag: 'div',\n          attributes: (_a = { role: 'button' }, _a['aria-labelledby'] = labelId, _a)\n        },\n        behaviours: derive$1([\n          config('insert-table-picker-cell', [\n            run$1(mouseover(), Focusing.focus),\n            run$1(execute$5(), emitExecute),\n            run$1(click(), onClick),\n            run$1(tap(), onClick)\n          ]),\n          Toggling.config({\n            toggleClass: 'tox-insert-table-picker__selected',\n            toggleOnExecute: false\n          }),\n          Focusing.config({ onFocus: emitCellOver })\n        ])\n      });\n    };\n    var makeCells = function (labelId, numRows, numCols) {\n      var cells = [];\n      for (var i = 0; i < numRows; i++) {\n        var row = [];\n        for (var j = 0; j < numCols; j++) {\n          row.push(makeCell(i, j, labelId));\n        }\n        cells.push(row);\n      }\n      return cells;\n    };\n    var selectCells = function (cells, selectedRow, selectedColumn, numRows, numColumns) {\n      for (var i = 0; i < numRows; i++) {\n        for (var j = 0; j < numColumns; j++) {\n          Toggling.set(cells[i][j], i <= selectedRow && j <= selectedColumn);\n        }\n      }\n    };\n    var makeComponents = function (cells) {\n      return bind$3(cells, function (cellRow) {\n        return map$2(cellRow, premade);\n      });\n    };\n    var makeLabelText = function (row, col) {\n      return text$1(col + 'x' + row);\n    };\n    var renderInsertTableMenuItem = function (spec) {\n      var numRows = 10;\n      var numColumns = 10;\n      var sizeLabelId = generate$6('size-label');\n      var cells = makeCells(sizeLabelId, numRows, numColumns);\n      var emptyLabelText = makeLabelText(0, 0);\n      var memLabel = record({\n        dom: {\n          tag: 'span',\n          classes: ['tox-insert-table-picker__label'],\n          attributes: { id: sizeLabelId }\n        },\n        components: [emptyLabelText],\n        behaviours: derive$1([Replacing.config({})])\n      });\n      return {\n        type: 'widget',\n        data: { value: generate$6('widget-id') },\n        dom: {\n          tag: 'div',\n          classes: ['tox-fancymenuitem']\n        },\n        autofocus: true,\n        components: [parts$f.widget({\n            dom: {\n              tag: 'div',\n              classes: ['tox-insert-table-picker']\n            },\n            components: makeComponents(cells).concat(memLabel.asSpec()),\n            behaviours: derive$1([\n              config('insert-table-picker', [\n                runOnAttached(function (c) {\n                  Replacing.set(memLabel.get(c), [emptyLabelText]);\n                }),\n                runWithTarget(cellOverEvent, function (c, t, e) {\n                  var _a = e.event, row = _a.row, col = _a.col;\n                  selectCells(cells, row, col, numRows, numColumns);\n                  Replacing.set(memLabel.get(c), [makeLabelText(row + 1, col + 1)]);\n                }),\n                runWithTarget(cellExecuteEvent, function (c, _, e) {\n                  var _a = e.event, row = _a.row, col = _a.col;\n                  spec.onAction({\n                    numRows: row + 1,\n                    numColumns: col + 1\n                  });\n                  emit(c, sandboxClose());\n                })\n              ]),\n              Keying.config({\n                initSize: {\n                  numRows: numRows,\n                  numColumns: numColumns\n                },\n                mode: 'flatgrid',\n                selector: '[role=\"button\"]'\n              })\n            ])\n          })]\n      };\n    };\n\n    var fancyMenuItems = {\n      inserttable: renderInsertTableMenuItem,\n      colorswatch: renderColorSwatchItem\n    };\n    var renderFancyMenuItem = function (spec, backstage) {\n      return get$e(fancyMenuItems, spec.fancytype).map(function (render) {\n        return render(spec, backstage);\n      });\n    };\n\n    var renderNestedItem = function (spec, itemResponse, providersBackstage, renderIcons, downwardsCaret) {\n      if (renderIcons === void 0) {\n        renderIcons = true;\n      }\n      if (downwardsCaret === void 0) {\n        downwardsCaret = false;\n      }\n      var caret = downwardsCaret ? renderDownwardsCaret(providersBackstage.icons) : renderSubmenuCaret(providersBackstage.icons);\n      var getApi = function (component) {\n        return {\n          isDisabled: function () {\n            return Disabling.isDisabled(component);\n          },\n          setDisabled: function (state) {\n            return Disabling.set(component, state);\n          }\n        };\n      };\n      var structure = renderItemStructure({\n        presets: 'normal',\n        iconContent: spec.icon,\n        textContent: spec.text,\n        htmlContent: Optional.none(),\n        ariaLabel: spec.text,\n        caret: Optional.some(caret),\n        checkMark: Optional.none(),\n        shortcutContent: spec.shortcut\n      }, providersBackstage, renderIcons);\n      return renderCommonItem({\n        data: buildData(spec),\n        getApi: getApi,\n        disabled: spec.disabled,\n        onAction: noop,\n        onSetup: spec.onSetup,\n        triggersSubmenu: true,\n        itemBehaviours: []\n      }, structure, itemResponse, providersBackstage);\n    };\n\n    var renderNormalItem = function (spec, itemResponse, providersBackstage, renderIcons) {\n      if (renderIcons === void 0) {\n        renderIcons = true;\n      }\n      var getApi = function (component) {\n        return {\n          isDisabled: function () {\n            return Disabling.isDisabled(component);\n          },\n          setDisabled: function (state) {\n            return Disabling.set(component, state);\n          }\n        };\n      };\n      var structure = renderItemStructure({\n        presets: 'normal',\n        iconContent: spec.icon,\n        textContent: spec.text,\n        htmlContent: Optional.none(),\n        ariaLabel: spec.text,\n        caret: Optional.none(),\n        checkMark: Optional.none(),\n        shortcutContent: spec.shortcut\n      }, providersBackstage, renderIcons);\n      return renderCommonItem({\n        data: buildData(spec),\n        getApi: getApi,\n        disabled: spec.disabled,\n        onAction: spec.onAction,\n        onSetup: spec.onSetup,\n        triggersSubmenu: false,\n        itemBehaviours: []\n      }, structure, itemResponse, providersBackstage);\n    };\n\n    var renderSeparatorItem = function (spec) {\n      var innerHtml = spec.text.fold(function () {\n        return {};\n      }, function (text) {\n        return { innerHtml: text };\n      });\n      return {\n        type: 'separator',\n        dom: __assign({\n          tag: 'div',\n          classes: [\n            selectableClass,\n            groupHeadingClass\n          ]\n        }, innerHtml),\n        components: []\n      };\n    };\n\n    var renderToggleMenuItem = function (spec, itemResponse, providersBackstage, renderIcons) {\n      if (renderIcons === void 0) {\n        renderIcons = true;\n      }\n      var getApi = function (component) {\n        return {\n          setActive: function (state) {\n            Toggling.set(component, state);\n          },\n          isActive: function () {\n            return Toggling.isOn(component);\n          },\n          isDisabled: function () {\n            return Disabling.isDisabled(component);\n          },\n          setDisabled: function (state) {\n            return Disabling.set(component, state);\n          }\n        };\n      };\n      var structure = renderItemStructure({\n        iconContent: spec.icon,\n        textContent: spec.text,\n        htmlContent: Optional.none(),\n        ariaLabel: spec.text,\n        checkMark: Optional.some(renderCheckmark(providersBackstage.icons)),\n        caret: Optional.none(),\n        shortcutContent: spec.shortcut,\n        presets: 'normal',\n        meta: spec.meta\n      }, providersBackstage, renderIcons);\n      return deepMerge(renderCommonItem({\n        data: buildData(spec),\n        disabled: spec.disabled,\n        getApi: getApi,\n        onAction: spec.onAction,\n        onSetup: spec.onSetup,\n        triggersSubmenu: false,\n        itemBehaviours: []\n      }, structure, itemResponse, providersBackstage), {\n        toggling: {\n          toggleClass: tickedClass,\n          toggleOnExecute: false,\n          selected: spec.active\n        }\n      });\n    };\n\n    var autocomplete = renderAutocompleteItem;\n    var separator$3 = renderSeparatorItem;\n    var normal = renderNormalItem;\n    var nested = renderNestedItem;\n    var toggle$1 = renderToggleMenuItem;\n    var fancy = renderFancyMenuItem;\n    var card = renderCardMenuItem;\n\n    var FocusMode;\n    (function (FocusMode) {\n      FocusMode[FocusMode['ContentFocus'] = 0] = 'ContentFocus';\n      FocusMode[FocusMode['UiFocus'] = 1] = 'UiFocus';\n    }(FocusMode || (FocusMode = {})));\n    var createMenuItemFromBridge = function (item, itemResponse, backstage, menuHasIcons, isHorizontalMenu) {\n      var providersBackstage = backstage.shared.providers;\n      var parseForHorizontalMenu = function (menuitem) {\n        return !isHorizontalMenu ? menuitem : __assign(__assign({}, menuitem), {\n          shortcut: Optional.none(),\n          icon: menuitem.text.isSome() ? Optional.none() : menuitem.icon\n        });\n      };\n      switch (item.type) {\n      case 'menuitem':\n        return createMenuItem(item).fold(handleError, function (d) {\n          return Optional.some(normal(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons));\n        });\n      case 'nestedmenuitem':\n        return createNestedMenuItem(item).fold(handleError, function (d) {\n          return Optional.some(nested(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons, isHorizontalMenu));\n        });\n      case 'togglemenuitem':\n        return createToggleMenuItem(item).fold(handleError, function (d) {\n          return Optional.some(toggle$1(parseForHorizontalMenu(d), itemResponse, providersBackstage, menuHasIcons));\n        });\n      case 'separator':\n        return createSeparatorMenuItem(item).fold(handleError, function (d) {\n          return Optional.some(separator$3(d));\n        });\n      case 'fancymenuitem':\n        return createFancyMenuItem(item).fold(handleError, function (d) {\n          return fancy(parseForHorizontalMenu(d), backstage);\n        });\n      default: {\n          console.error('Unknown item in general menu', item);\n          return Optional.none();\n        }\n      }\n    };\n    var createAutocompleteItems = function (items, matchText, onItemValueHandler, columns, itemResponse, sharedBackstage, highlightOn) {\n      var renderText = columns === 1;\n      var renderIcons = !renderText || menuHasIcons(items);\n      return cat(map$2(items, function (item) {\n        switch (item.type) {\n        case 'separator':\n          return createSeparatorItem(item).fold(handleError, function (d) {\n            return Optional.some(separator$3(d));\n          });\n        case 'cardmenuitem':\n          return createCardMenuItem(item).fold(handleError, function (d) {\n            return Optional.some(card(__assign(__assign({}, d), {\n              onAction: function (api) {\n                d.onAction(api);\n                onItemValueHandler(d.value, d.meta);\n              }\n            }), itemResponse, sharedBackstage, {\n              itemBehaviours: tooltipBehaviour(d.meta, sharedBackstage),\n              cardText: {\n                matchText: matchText,\n                highlightOn: highlightOn\n              }\n            }));\n          });\n        case 'autocompleteitem':\n        default:\n          return createAutocompleterItem(item).fold(handleError, function (d) {\n            return Optional.some(autocomplete(d, matchText, renderText, 'normal', onItemValueHandler, itemResponse, sharedBackstage, renderIcons));\n          });\n        }\n      }));\n    };\n    var createPartialMenu = function (value, items, itemResponse, backstage, isHorizontalMenu) {\n      var hasIcons = menuHasIcons(items);\n      var alloyItems = cat(map$2(items, function (item) {\n        var itemHasIcon = function (i) {\n          return isHorizontalMenu ? !has$2(i, 'text') : hasIcons;\n        };\n        var createItem = function (i) {\n          return createMenuItemFromBridge(i, itemResponse, backstage, itemHasIcon(i), isHorizontalMenu);\n        };\n        if (item.type === 'nestedmenuitem' && item.getSubmenuItems().length <= 0) {\n          return createItem(__assign(__assign({}, item), { disabled: true }));\n        } else {\n          return createItem(item);\n        }\n      }));\n      var createPartial = isHorizontalMenu ? createHorizontalPartialMenuWithAlloyItems : createPartialMenuWithAlloyItems;\n      return createPartial(value, hasIcons, alloyItems, 1, 'normal');\n    };\n    var createTieredDataFrom = function (partialMenu) {\n      return tieredMenu.singleData(partialMenu.value, partialMenu);\n    };\n    var createMenuFrom = function (partialMenu, columns, focusMode, presets) {\n      var focusManager = focusMode === FocusMode.ContentFocus ? highlights() : dom$2();\n      var movement = deriveMenuMovement(columns, presets);\n      var menuMarkers = markers(presets);\n      return {\n        dom: partialMenu.dom,\n        components: partialMenu.components,\n        items: partialMenu.items,\n        value: partialMenu.value,\n        markers: {\n          selectedItem: menuMarkers.selectedItem,\n          item: menuMarkers.item\n        },\n        movement: movement,\n        fakeFocus: focusMode === FocusMode.ContentFocus,\n        focusManager: focusManager,\n        menuBehaviours: SimpleBehaviours.unnamedEvents(columns !== 'auto' ? [] : [runOnAttached(function (comp, _se) {\n            detectSize(comp, 4, menuMarkers.item).each(function (_a) {\n              var numColumns = _a.numColumns, numRows = _a.numRows;\n              Keying.setGridSize(comp, numRows, numColumns);\n            });\n          })])\n      };\n    };\n\n    var register$9 = function (editor, sharedBackstage) {\n      var activeAutocompleter = value$1();\n      var processingAction = Cell(false);\n      var autocompleter = build$1(InlineView.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-autocompleter']\n        },\n        components: [],\n        fireDismissalEventInstead: {},\n        inlineBehaviours: derive$1([config('dismissAutocompleter', [run$1(dismissRequested(), function () {\n              return cancelIfNecessary();\n            })])]),\n        lazySink: sharedBackstage.getSink\n      }));\n      var isMenuOpen = function () {\n        return InlineView.isOpen(autocompleter);\n      };\n      var isActive = function () {\n        return activeAutocompleter.get().isSome();\n      };\n      var hideIfNecessary = function () {\n        if (isActive()) {\n          InlineView.hide(autocompleter);\n        }\n      };\n      var cancelIfNecessary = function () {\n        if (isActive()) {\n          var lastElement = activeAutocompleter.get().map(function (ac) {\n            return ac.element;\n          });\n          detect(lastElement.getOr(SugarElement.fromDom(editor.selection.getNode()))).each(unwrap);\n          hideIfNecessary();\n          activeAutocompleter.clear();\n          processingAction.set(false);\n        }\n      };\n      var getAutocompleters = cached(function () {\n        return register$b(editor);\n      });\n      var getCombinedItems = function (triggerChar, matches) {\n        var columns = findMap(matches, function (m) {\n          return Optional.from(m.columns);\n        }).getOr(1);\n        return bind$3(matches, function (match) {\n          var choices = match.items;\n          return createAutocompleteItems(choices, match.matchText, function (itemValue, itemMeta) {\n            var nr = editor.selection.getRng();\n            getContext(editor.dom, nr, triggerChar).fold(function () {\n              return console.error('Lost context. Cursor probably moved');\n            }, function (_a) {\n              var range = _a.range;\n              var autocompleterApi = {\n                hide: function () {\n                  cancelIfNecessary();\n                },\n                reload: function (fetchOptions) {\n                  hideIfNecessary();\n                  load(fetchOptions);\n                }\n              };\n              processingAction.set(true);\n              match.onAction(autocompleterApi, range, itemValue, itemMeta);\n              processingAction.set(false);\n            });\n          }, columns, ItemResponse$1.BUBBLE_TO_SANDBOX, sharedBackstage, match.highlightOn);\n        });\n      };\n      var commenceIfNecessary = function (context) {\n        if (!isActive()) {\n          var wrapper = create$4(editor, context.range);\n          activeAutocompleter.set({\n            triggerChar: context.triggerChar,\n            element: wrapper,\n            matchLength: context.text.length\n          });\n          processingAction.set(false);\n        }\n      };\n      var display = function (ac, context, lookupData, items) {\n        ac.matchLength = context.text.length;\n        var columns = findMap(lookupData, function (ld) {\n          return Optional.from(ld.columns);\n        }).getOr(1);\n        InlineView.showAt(autocompleter, Menu.sketch(createMenuFrom(createPartialMenuWithAlloyItems('autocompleter-value', true, items, columns, 'normal'), columns, FocusMode.ContentFocus, 'normal')), {\n          anchor: {\n            type: 'node',\n            root: SugarElement.fromDom(editor.getBody()),\n            node: Optional.from(ac.element)\n          }\n        });\n        InlineView.getContent(autocompleter).each(Highlighting.highlightFirst);\n      };\n      var doLookup = function (fetchOptions) {\n        return activeAutocompleter.get().map(function (ac) {\n          return getContext(editor.dom, editor.selection.getRng(), ac.triggerChar).bind(function (newContext) {\n            return lookupWithContext(editor, getAutocompleters, newContext, fetchOptions);\n          });\n        }).getOrThunk(function () {\n          return lookup$2(editor, getAutocompleters);\n        });\n      };\n      var load = function (fetchOptions) {\n        doLookup(fetchOptions).fold(cancelIfNecessary, function (lookupInfo) {\n          commenceIfNecessary(lookupInfo.context);\n          lookupInfo.lookupData.then(function (lookupData) {\n            activeAutocompleter.get().map(function (ac) {\n              var context = lookupInfo.context;\n              if (ac.triggerChar === context.triggerChar) {\n                var combinedItems = getCombinedItems(context.triggerChar, lookupData);\n                if (combinedItems.length > 0) {\n                  display(ac, context, lookupData, combinedItems);\n                } else if (context.text.length - ac.matchLength >= 10) {\n                  cancelIfNecessary();\n                } else {\n                  hideIfNecessary();\n                }\n              }\n            });\n          });\n        });\n      };\n      var onKeypress = last(function (e) {\n        if (e.which === 27) {\n          return;\n        }\n        load();\n      }, 50);\n      var autocompleterUiApi = {\n        onKeypress: onKeypress,\n        cancelIfNecessary: cancelIfNecessary,\n        isMenuOpen: isMenuOpen,\n        isActive: isActive,\n        isProcessingAction: processingAction.get,\n        getView: function () {\n          return InlineView.getContent(autocompleter);\n        }\n      };\n      if (editor.hasPlugin('rtc') === false) {\n        AutocompleterEditorEvents.setup(autocompleterUiApi, editor);\n      }\n    };\n    var Autocompleter = { register: register$9 };\n\n    var closest = function (scope, selector, isRoot) {\n      return closest$1(scope, selector, isRoot).isSome();\n    };\n\n    var DelayedFunction = function (fun, delay) {\n      var ref = null;\n      var schedule = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        ref = setTimeout(function () {\n          fun.apply(null, args);\n          ref = null;\n        }, delay);\n      };\n      var cancel = function () {\n        if (ref !== null) {\n          clearTimeout(ref);\n          ref = null;\n        }\n      };\n      return {\n        cancel: cancel,\n        schedule: schedule\n      };\n    };\n\n    var SIGNIFICANT_MOVE = 5;\n    var LONGPRESS_DELAY = 400;\n    var getTouch = function (event) {\n      var raw = event.raw;\n      if (raw.touches === undefined || raw.touches.length !== 1) {\n        return Optional.none();\n      }\n      return Optional.some(raw.touches[0]);\n    };\n    var isFarEnough = function (touch, data) {\n      var distX = Math.abs(touch.clientX - data.x);\n      var distY = Math.abs(touch.clientY - data.y);\n      return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE;\n    };\n    var monitor = function (settings) {\n      var startData = value$1();\n      var longpressFired = Cell(false);\n      var longpress$1 = DelayedFunction(function (event) {\n        settings.triggerEvent(longpress(), event);\n        longpressFired.set(true);\n      }, LONGPRESS_DELAY);\n      var handleTouchstart = function (event) {\n        getTouch(event).each(function (touch) {\n          longpress$1.cancel();\n          var data = {\n            x: touch.clientX,\n            y: touch.clientY,\n            target: event.target\n          };\n          longpress$1.schedule(event);\n          longpressFired.set(false);\n          startData.set(data);\n        });\n        return Optional.none();\n      };\n      var handleTouchmove = function (event) {\n        longpress$1.cancel();\n        getTouch(event).each(function (touch) {\n          startData.on(function (data) {\n            if (isFarEnough(touch, data)) {\n              startData.clear();\n            }\n          });\n        });\n        return Optional.none();\n      };\n      var handleTouchend = function (event) {\n        longpress$1.cancel();\n        var isSame = function (data) {\n          return eq(data.target, event.target);\n        };\n        return startData.get().filter(isSame).map(function (_data) {\n          if (longpressFired.get()) {\n            event.prevent();\n            return false;\n          } else {\n            return settings.triggerEvent(tap(), event);\n          }\n        });\n      };\n      var handlers = wrapAll([\n        {\n          key: touchstart(),\n          value: handleTouchstart\n        },\n        {\n          key: touchmove(),\n          value: handleTouchmove\n        },\n        {\n          key: touchend(),\n          value: handleTouchend\n        }\n      ]);\n      var fireIfReady = function (event, type) {\n        return get$e(handlers, type).bind(function (handler) {\n          return handler(event);\n        });\n      };\n      return { fireIfReady: fireIfReady };\n    };\n\n    var isDangerous = function (event) {\n      var keyEv = event.raw;\n      return keyEv.which === BACKSPACE[0] && !contains$2([\n        'input',\n        'textarea'\n      ], name$2(event.target)) && !closest(event.target, '[contenteditable=\"true\"]');\n    };\n    var isFirefox = function () {\n      return detect$1().browser.isFirefox();\n    };\n    var bindFocus = function (container, handler) {\n      if (isFirefox()) {\n        return capture(container, 'focus', handler);\n      } else {\n        return bind(container, 'focusin', handler);\n      }\n    };\n    var bindBlur = function (container, handler) {\n      if (isFirefox()) {\n        return capture(container, 'blur', handler);\n      } else {\n        return bind(container, 'focusout', handler);\n      }\n    };\n    var setup$d = function (container, rawSettings) {\n      var settings = __assign({ stopBackspace: true }, rawSettings);\n      var pointerEvents = [\n        'touchstart',\n        'touchmove',\n        'touchend',\n        'touchcancel',\n        'gesturestart',\n        'mousedown',\n        'mouseup',\n        'mouseover',\n        'mousemove',\n        'mouseout',\n        'click'\n      ];\n      var tapEvent = monitor(settings);\n      var simpleEvents = map$2(pointerEvents.concat([\n        'selectstart',\n        'input',\n        'contextmenu',\n        'change',\n        'transitionend',\n        'transitioncancel',\n        'drag',\n        'dragstart',\n        'dragend',\n        'dragenter',\n        'dragleave',\n        'dragover',\n        'drop',\n        'keyup'\n      ]), function (type) {\n        return bind(container, type, function (event) {\n          tapEvent.fireIfReady(event, type).each(function (tapStopped) {\n            if (tapStopped) {\n              event.kill();\n            }\n          });\n          var stopped = settings.triggerEvent(type, event);\n          if (stopped) {\n            event.kill();\n          }\n        });\n      });\n      var pasteTimeout = value$1();\n      var onPaste = bind(container, 'paste', function (event) {\n        tapEvent.fireIfReady(event, 'paste').each(function (tapStopped) {\n          if (tapStopped) {\n            event.kill();\n          }\n        });\n        var stopped = settings.triggerEvent('paste', event);\n        if (stopped) {\n          event.kill();\n        }\n        pasteTimeout.set(setTimeout(function () {\n          settings.triggerEvent(postPaste(), event);\n        }, 0));\n      });\n      var onKeydown = bind(container, 'keydown', function (event) {\n        var stopped = settings.triggerEvent('keydown', event);\n        if (stopped) {\n          event.kill();\n        } else if (settings.stopBackspace && isDangerous(event)) {\n          event.prevent();\n        }\n      });\n      var onFocusIn = bindFocus(container, function (event) {\n        var stopped = settings.triggerEvent('focusin', event);\n        if (stopped) {\n          event.kill();\n        }\n      });\n      var focusoutTimeout = value$1();\n      var onFocusOut = bindBlur(container, function (event) {\n        var stopped = settings.triggerEvent('focusout', event);\n        if (stopped) {\n          event.kill();\n        }\n        focusoutTimeout.set(setTimeout(function () {\n          settings.triggerEvent(postBlur(), event);\n        }, 0));\n      });\n      var unbind = function () {\n        each$1(simpleEvents, function (e) {\n          e.unbind();\n        });\n        onKeydown.unbind();\n        onFocusIn.unbind();\n        onFocusOut.unbind();\n        onPaste.unbind();\n        pasteTimeout.on(clearTimeout);\n        focusoutTimeout.on(clearTimeout);\n      };\n      return { unbind: unbind };\n    };\n\n    var derive = function (rawEvent, rawTarget) {\n      var source = get$e(rawEvent, 'target').getOr(rawTarget);\n      return Cell(source);\n    };\n\n    var fromSource = function (event, source) {\n      var stopper = Cell(false);\n      var cutter = Cell(false);\n      var stop = function () {\n        stopper.set(true);\n      };\n      var cut = function () {\n        cutter.set(true);\n      };\n      return {\n        stop: stop,\n        cut: cut,\n        isStopped: stopper.get,\n        isCut: cutter.get,\n        event: event,\n        setSource: source.set,\n        getSource: source.get\n      };\n    };\n    var fromExternal = function (event) {\n      var stopper = Cell(false);\n      var stop = function () {\n        stopper.set(true);\n      };\n      return {\n        stop: stop,\n        cut: noop,\n        isStopped: stopper.get,\n        isCut: never,\n        event: event,\n        setSource: die('Cannot set source of a broadcasted event'),\n        getSource: die('Cannot get source of a broadcasted event')\n      };\n    };\n\n    var adt$1 = Adt.generate([\n      { stopped: [] },\n      { resume: ['element'] },\n      { complete: [] }\n    ]);\n    var doTriggerHandler = function (lookup, eventType, rawEvent, target, source, logger) {\n      var handler = lookup(eventType, target);\n      var simulatedEvent = fromSource(rawEvent, source);\n      return handler.fold(function () {\n        logger.logEventNoHandlers(eventType, target);\n        return adt$1.complete();\n      }, function (handlerInfo) {\n        var descHandler = handlerInfo.descHandler;\n        var eventHandler = getCurried(descHandler);\n        eventHandler(simulatedEvent);\n        if (simulatedEvent.isStopped()) {\n          logger.logEventStopped(eventType, handlerInfo.element, descHandler.purpose);\n          return adt$1.stopped();\n        } else if (simulatedEvent.isCut()) {\n          logger.logEventCut(eventType, handlerInfo.element, descHandler.purpose);\n          return adt$1.complete();\n        } else {\n          return parent(handlerInfo.element).fold(function () {\n            logger.logNoParent(eventType, handlerInfo.element, descHandler.purpose);\n            return adt$1.complete();\n          }, function (parent) {\n            logger.logEventResponse(eventType, handlerInfo.element, descHandler.purpose);\n            return adt$1.resume(parent);\n          });\n        }\n      });\n    };\n    var doTriggerOnUntilStopped = function (lookup, eventType, rawEvent, rawTarget, source, logger) {\n      return doTriggerHandler(lookup, eventType, rawEvent, rawTarget, source, logger).fold(always, function (parent) {\n        return doTriggerOnUntilStopped(lookup, eventType, rawEvent, parent, source, logger);\n      }, never);\n    };\n    var triggerHandler = function (lookup, eventType, rawEvent, target, logger) {\n      var source = derive(rawEvent, target);\n      return doTriggerHandler(lookup, eventType, rawEvent, target, source, logger);\n    };\n    var broadcast = function (listeners, rawEvent, _logger) {\n      var simulatedEvent = fromExternal(rawEvent);\n      each$1(listeners, function (listener) {\n        var descHandler = listener.descHandler;\n        var handler = getCurried(descHandler);\n        handler(simulatedEvent);\n      });\n      return simulatedEvent.isStopped();\n    };\n    var triggerUntilStopped = function (lookup, eventType, rawEvent, logger) {\n      return triggerOnUntilStopped(lookup, eventType, rawEvent, rawEvent.target, logger);\n    };\n    var triggerOnUntilStopped = function (lookup, eventType, rawEvent, rawTarget, logger) {\n      var source = derive(rawEvent, rawTarget);\n      return doTriggerOnUntilStopped(lookup, eventType, rawEvent, rawTarget, source, logger);\n    };\n\n    var eventHandler = function (element, descHandler) {\n      return {\n        element: element,\n        descHandler: descHandler\n      };\n    };\n    var broadcastHandler = function (id, handler) {\n      return {\n        id: id,\n        descHandler: handler\n      };\n    };\n    var EventRegistry = function () {\n      var registry = {};\n      var registerId = function (extraArgs, id, events) {\n        each(events, function (v, k) {\n          var handlers = registry[k] !== undefined ? registry[k] : {};\n          handlers[id] = curryArgs(v, extraArgs);\n          registry[k] = handlers;\n        });\n      };\n      var findHandler = function (handlers, elem) {\n        return read$1(elem).bind(function (id) {\n          return get$e(handlers, id);\n        }).map(function (descHandler) {\n          return eventHandler(elem, descHandler);\n        });\n      };\n      var filterByType = function (type) {\n        return get$e(registry, type).map(function (handlers) {\n          return mapToArray(handlers, function (f, id) {\n            return broadcastHandler(id, f);\n          });\n        }).getOr([]);\n      };\n      var find = function (isAboveRoot, type, target) {\n        return get$e(registry, type).bind(function (handlers) {\n          return closest$4(target, function (elem) {\n            return findHandler(handlers, elem);\n          }, isAboveRoot);\n        });\n      };\n      var unregisterId = function (id) {\n        each(registry, function (handlersById, _eventName) {\n          if (has$2(handlersById, id)) {\n            delete handlersById[id];\n          }\n        });\n      };\n      return {\n        registerId: registerId,\n        unregisterId: unregisterId,\n        filterByType: filterByType,\n        find: find\n      };\n    };\n\n    var Registry = function () {\n      var events = EventRegistry();\n      var components = {};\n      var readOrTag = function (component) {\n        var elem = component.element;\n        return read$1(elem).getOrThunk(function () {\n          return write('uid-', component.element);\n        });\n      };\n      var failOnDuplicate = function (component, tagId) {\n        var conflict = components[tagId];\n        if (conflict === component) {\n          unregister(component);\n        } else {\n          throw new Error('The tagId \"' + tagId + '\" is already used by: ' + element(conflict.element) + '\\nCannot use it for: ' + element(component.element) + '\\n' + 'The conflicting element is' + (inBody(conflict.element) ? ' ' : ' not ') + 'already in the DOM');\n        }\n      };\n      var register = function (component) {\n        var tagId = readOrTag(component);\n        if (hasNonNullableKey(components, tagId)) {\n          failOnDuplicate(component, tagId);\n        }\n        var extraArgs = [component];\n        events.registerId(extraArgs, tagId, component.events);\n        components[tagId] = component;\n      };\n      var unregister = function (component) {\n        read$1(component.element).each(function (tagId) {\n          delete components[tagId];\n          events.unregisterId(tagId);\n        });\n      };\n      var filter = function (type) {\n        return events.filterByType(type);\n      };\n      var find = function (isAboveRoot, type, target) {\n        return events.find(isAboveRoot, type, target);\n      };\n      var getById = function (id) {\n        return get$e(components, id);\n      };\n      return {\n        find: find,\n        filter: filter,\n        register: register,\n        unregister: unregister,\n        getById: getById\n      };\n    };\n\n    var factory$j = function (detail) {\n      var _a = detail.dom, attributes = _a.attributes, domWithoutAttributes = __rest(_a, ['attributes']);\n      return {\n        uid: detail.uid,\n        dom: __assign({\n          tag: 'div',\n          attributes: __assign({ role: 'presentation' }, attributes)\n        }, domWithoutAttributes),\n        components: detail.components,\n        behaviours: get$2(detail.containerBehaviours),\n        events: detail.events,\n        domModification: detail.domModification,\n        eventOrder: detail.eventOrder\n      };\n    };\n    var Container = single({\n      name: 'Container',\n      factory: factory$j,\n      configFields: [\n        defaulted('components', []),\n        field('containerBehaviours', []),\n        defaulted('events', {}),\n        defaulted('domModification', {}),\n        defaulted('eventOrder', {})\n      ]\n    });\n\n    var takeover = function (root) {\n      var isAboveRoot = function (el) {\n        return parent(root.element).fold(always, function (parent) {\n          return eq(el, parent);\n        });\n      };\n      var registry = Registry();\n      var lookup = function (eventName, target) {\n        return registry.find(isAboveRoot, eventName, target);\n      };\n      var domEvents = setup$d(root.element, {\n        triggerEvent: function (eventName, event) {\n          return monitorEvent(eventName, event.target, function (logger) {\n            return triggerUntilStopped(lookup, eventName, event, logger);\n          });\n        }\n      });\n      var systemApi = {\n        debugInfo: constant$1('real'),\n        triggerEvent: function (eventName, target, data) {\n          monitorEvent(eventName, target, function (logger) {\n            return triggerOnUntilStopped(lookup, eventName, data, target, logger);\n          });\n        },\n        triggerFocus: function (target, originator) {\n          read$1(target).fold(function () {\n            focus$3(target);\n          }, function (_alloyId) {\n            monitorEvent(focus$4(), target, function (logger) {\n              triggerHandler(lookup, focus$4(), {\n                originator: originator,\n                kill: noop,\n                prevent: noop,\n                target: target\n              }, target, logger);\n              return false;\n            });\n          });\n        },\n        triggerEscape: function (comp, simulatedEvent) {\n          systemApi.triggerEvent('keydown', comp.element, simulatedEvent.event);\n        },\n        getByUid: function (uid) {\n          return getByUid(uid);\n        },\n        getByDom: function (elem) {\n          return getByDom(elem);\n        },\n        build: build$1,\n        addToGui: function (c) {\n          add(c);\n        },\n        removeFromGui: function (c) {\n          remove(c);\n        },\n        addToWorld: function (c) {\n          addToWorld(c);\n        },\n        removeFromWorld: function (c) {\n          removeFromWorld(c);\n        },\n        broadcast: function (message) {\n          broadcast$1(message);\n        },\n        broadcastOn: function (channels, message) {\n          broadcastOn(channels, message);\n        },\n        broadcastEvent: function (eventName, event) {\n          broadcastEvent(eventName, event);\n        },\n        isConnected: always\n      };\n      var addToWorld = function (component) {\n        component.connect(systemApi);\n        if (!isText$1(component.element)) {\n          registry.register(component);\n          each$1(component.components(), addToWorld);\n          systemApi.triggerEvent(systemInit(), component.element, { target: component.element });\n        }\n      };\n      var removeFromWorld = function (component) {\n        if (!isText$1(component.element)) {\n          each$1(component.components(), removeFromWorld);\n          registry.unregister(component);\n        }\n        component.disconnect();\n      };\n      var add = function (component) {\n        attach(root, component);\n      };\n      var remove = function (component) {\n        detach(component);\n      };\n      var destroy = function () {\n        domEvents.unbind();\n        remove$5(root.element);\n      };\n      var broadcastData = function (data) {\n        var receivers = registry.filter(receive());\n        each$1(receivers, function (receiver) {\n          var descHandler = receiver.descHandler;\n          var handler = getCurried(descHandler);\n          handler(data);\n        });\n      };\n      var broadcast$1 = function (message) {\n        broadcastData({\n          universal: true,\n          data: message\n        });\n      };\n      var broadcastOn = function (channels, message) {\n        broadcastData({\n          universal: false,\n          channels: channels,\n          data: message\n        });\n      };\n      var broadcastEvent = function (eventName, event) {\n        var listeners = registry.filter(eventName);\n        return broadcast(listeners, event);\n      };\n      var getByUid = function (uid) {\n        return registry.getById(uid).fold(function () {\n          return Result.error(new Error('Could not find component with uid: \"' + uid + '\" in system.'));\n        }, Result.value);\n      };\n      var getByDom = function (elem) {\n        var uid = read$1(elem).getOr('not found');\n        return getByUid(uid);\n      };\n      addToWorld(root);\n      return {\n        root: root,\n        element: root.element,\n        destroy: destroy,\n        add: add,\n        remove: remove,\n        getByUid: getByUid,\n        getByDom: getByDom,\n        addToWorld: addToWorld,\n        removeFromWorld: removeFromWorld,\n        broadcast: broadcast$1,\n        broadcastOn: broadcastOn,\n        broadcastEvent: broadcastEvent\n      };\n    };\n\n    var renderBar = function (spec, backstage) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-bar',\n            'tox-form__controls-h-stack'\n          ]\n        },\n        components: map$2(spec.items, backstage.interpreter)\n      };\n    };\n\n    var schema$l = constant$1([\n      defaulted('prefix', 'form-field'),\n      field('fieldBehaviours', [\n        Composing,\n        Representing\n      ])\n    ]);\n    var parts$e = constant$1([\n      optional({\n        schema: [required$1('dom')],\n        name: 'label'\n      }),\n      optional({\n        factory: {\n          sketch: function (spec) {\n            return {\n              uid: spec.uid,\n              dom: {\n                tag: 'span',\n                styles: { display: 'none' },\n                attributes: { 'aria-hidden': 'true' },\n                innerHtml: spec.text\n              }\n            };\n          }\n        },\n        schema: [required$1('text')],\n        name: 'aria-descriptor'\n      }),\n      required({\n        factory: {\n          sketch: function (spec) {\n            var excludeFactory = exclude(spec, ['factory']);\n            return spec.factory.sketch(excludeFactory);\n          }\n        },\n        schema: [required$1('factory')],\n        name: 'field'\n      })\n    ]);\n\n    var factory$i = function (detail, components, _spec, _externals) {\n      var behaviours = augment(detail.fieldBehaviours, [\n        Composing.config({\n          find: function (container) {\n            return getPart(container, detail, 'field');\n          }\n        }),\n        Representing.config({\n          store: {\n            mode: 'manual',\n            getValue: function (field) {\n              return Composing.getCurrent(field).bind(Representing.getValue);\n            },\n            setValue: function (field, value) {\n              Composing.getCurrent(field).each(function (current) {\n                Representing.setValue(current, value);\n              });\n            }\n          }\n        })\n      ]);\n      var events = derive$2([runOnAttached(function (component, _simulatedEvent) {\n          var ps = getParts(component, detail, [\n            'label',\n            'field',\n            'aria-descriptor'\n          ]);\n          ps.field().each(function (field) {\n            var id = generate$6(detail.prefix);\n            ps.label().each(function (label) {\n              set$8(label.element, 'for', id);\n              set$8(field.element, 'id', id);\n            });\n            ps['aria-descriptor']().each(function (descriptor) {\n              var descriptorId = generate$6(detail.prefix);\n              set$8(descriptor.element, 'id', descriptorId);\n              set$8(field.element, 'aria-describedby', descriptorId);\n            });\n          });\n        })]);\n      var apis = {\n        getField: function (container) {\n          return getPart(container, detail, 'field');\n        },\n        getLabel: function (container) {\n          return getPart(container, detail, 'label');\n        }\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: behaviours,\n        events: events,\n        apis: apis\n      };\n    };\n    var FormField = composite({\n      name: 'FormField',\n      configFields: schema$l(),\n      partFields: parts$e(),\n      factory: factory$i,\n      apis: {\n        getField: function (apis, comp) {\n          return apis.getField(comp);\n        },\n        getLabel: function (apis, comp) {\n          return apis.getLabel(comp);\n        }\n      }\n    });\n\n    var exhibit$2 = function (base, tabConfig) {\n      return nu$7({\n        attributes: wrapAll([{\n            key: tabConfig.tabAttr,\n            value: 'true'\n          }])\n      });\n    };\n\n    var ActiveTabstopping = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit$2\n    });\n\n    var TabstopSchema = [defaulted('tabAttr', 'data-alloy-tabstop')];\n\n    var Tabstopping = create$8({\n      fields: TabstopSchema,\n      name: 'tabstopping',\n      active: ActiveTabstopping\n    });\n\n    var global$7 = tinymce.util.Tools.resolve('tinymce.html.Entities');\n\n    var renderFormFieldWith = function (pLabel, pField, extraClasses, extraBehaviours) {\n      var spec = renderFormFieldSpecWith(pLabel, pField, extraClasses, extraBehaviours);\n      return FormField.sketch(spec);\n    };\n    var renderFormField = function (pLabel, pField) {\n      return renderFormFieldWith(pLabel, pField, [], []);\n    };\n    var renderFormFieldSpecWith = function (pLabel, pField, extraClasses, extraBehaviours) {\n      return {\n        dom: renderFormFieldDomWith(extraClasses),\n        components: pLabel.toArray().concat([pField]),\n        fieldBehaviours: derive$1(extraBehaviours)\n      };\n    };\n    var renderFormFieldDom = function () {\n      return renderFormFieldDomWith([]);\n    };\n    var renderFormFieldDomWith = function (extraClasses) {\n      return {\n        tag: 'div',\n        classes: ['tox-form__group'].concat(extraClasses)\n      };\n    };\n    var renderLabel$2 = function (label, providersBackstage) {\n      return FormField.parts.label({\n        dom: {\n          tag: 'label',\n          classes: ['tox-label'],\n          innerHtml: providersBackstage.translate(label)\n        }\n      });\n    };\n\n    var formChangeEvent = generate$6('form-component-change');\n    var formCloseEvent = generate$6('form-close');\n    var formCancelEvent = generate$6('form-cancel');\n    var formActionEvent = generate$6('form-action');\n    var formSubmitEvent = generate$6('form-submit');\n    var formBlockEvent = generate$6('form-block');\n    var formUnblockEvent = generate$6('form-unblock');\n    var formTabChangeEvent = generate$6('form-tabchange');\n    var formResizeEvent = generate$6('form-resize');\n\n    var renderCollection = function (spec, providersBackstage) {\n      var _a;\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var runOnItem = function (f) {\n        return function (comp, se) {\n          closest$1(se.event.target, '[data-collection-item-value]').each(function (target) {\n            f(comp, se, target, get$d(target, 'data-collection-item-value'));\n          });\n        };\n      };\n      var setContents = function (comp, items) {\n        var htmlLines = map$2(items, function (item) {\n          var itemText = global$e.translate(item.text);\n          var textContent = spec.columns === 1 ? '<div class=\"tox-collection__item-label\">' + itemText + '</div>' : '';\n          var iconContent = '<div class=\"tox-collection__item-icon\">' + item.icon + '</div>';\n          var mapItemName = {\n            '_': ' ',\n            ' - ': ' ',\n            '-': ' '\n          };\n          var ariaLabel = itemText.replace(/\\_| \\- |\\-/g, function (match) {\n            return mapItemName[match];\n          });\n          var disabledClass = providersBackstage.isDisabled() ? ' tox-collection__item--state-disabled' : '';\n          return '<div class=\"tox-collection__item' + disabledClass + '\" tabindex=\"-1\" data-collection-item-value=\"' + global$7.encodeAllRaw(item.value) + '\" title=\"' + ariaLabel + '\" aria-label=\"' + ariaLabel + '\">' + iconContent + textContent + '</div>';\n        });\n        var chunks = spec.columns !== 'auto' && spec.columns > 1 ? chunk$1(htmlLines, spec.columns) : [htmlLines];\n        var html = map$2(chunks, function (ch) {\n          return '<div class=\"tox-collection__group\">' + ch.join('') + '</div>';\n        });\n        set$5(comp.element, html.join(''));\n      };\n      var onClick = runOnItem(function (comp, se, tgt, itemValue) {\n        se.stop();\n        if (!providersBackstage.isDisabled()) {\n          emitWith(comp, formActionEvent, {\n            name: spec.name,\n            value: itemValue\n          });\n        }\n      });\n      var collectionEvents = [\n        run$1(mouseover(), runOnItem(function (comp, se, tgt) {\n          focus$3(tgt);\n        })),\n        run$1(click(), onClick),\n        run$1(tap(), onClick),\n        run$1(focusin(), runOnItem(function (comp, se, tgt) {\n          descendant(comp.element, '.' + activeClass).each(function (currentActive) {\n            remove$2(currentActive, activeClass);\n          });\n          add$2(tgt, activeClass);\n        })),\n        run$1(focusout(), runOnItem(function (comp) {\n          descendant(comp.element, '.' + activeClass).each(function (currentActive) {\n            remove$2(currentActive, activeClass);\n          });\n        })),\n        runOnExecute$1(runOnItem(function (comp, se, tgt, itemValue) {\n          emitWith(comp, formActionEvent, {\n            name: spec.name,\n            value: itemValue\n          });\n        }))\n      ];\n      var iterCollectionItems = function (comp, applyAttributes) {\n        return map$2(descendants(comp.element, '.tox-collection__item'), applyAttributes);\n      };\n      var pField = FormField.parts.field({\n        dom: {\n          tag: 'div',\n          classes: ['tox-collection'].concat(spec.columns !== 1 ? ['tox-collection--grid'] : ['tox-collection--list'])\n        },\n        components: [],\n        factory: { sketch: identity$1 },\n        behaviours: derive$1([\n          Disabling.config({\n            disabled: providersBackstage.isDisabled,\n            onDisabled: function (comp) {\n              iterCollectionItems(comp, function (childElm) {\n                add$2(childElm, 'tox-collection__item--state-disabled');\n                set$8(childElm, 'aria-disabled', true);\n              });\n            },\n            onEnabled: function (comp) {\n              iterCollectionItems(comp, function (childElm) {\n                remove$2(childElm, 'tox-collection__item--state-disabled');\n                remove$7(childElm, 'aria-disabled');\n              });\n            }\n          }),\n          receivingConfig(),\n          Replacing.config({}),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: []\n            },\n            onSetValue: function (comp, items) {\n              setContents(comp, items);\n              if (spec.columns === 'auto') {\n                detectSize(comp, 5, 'tox-collection__item').each(function (_a) {\n                  var numRows = _a.numRows, numColumns = _a.numColumns;\n                  Keying.setGridSize(comp, numRows, numColumns);\n                });\n              }\n              emit(comp, formResizeEvent);\n            }\n          }),\n          Tabstopping.config({}),\n          Keying.config(deriveCollectionMovement(spec.columns, 'normal')),\n          config('collection-events', collectionEvents)\n        ]),\n        eventOrder: (_a = {}, _a[execute$5()] = [\n          'disabling',\n          'alloy.base.behaviour',\n          'collection-events'\n        ], _a)\n      });\n      var extraClasses = ['tox-form__group--collection'];\n      return renderFormFieldWith(pLabel, pField, extraClasses, []);\n    };\n\n    var schema$k = constant$1([\n      option('data'),\n      defaulted('inputAttributes', {}),\n      defaulted('inputStyles', {}),\n      defaulted('tag', 'input'),\n      defaulted('inputClasses', []),\n      onHandler('onSetValue'),\n      defaulted('styles', {}),\n      defaulted('eventOrder', {}),\n      field('inputBehaviours', [\n        Representing,\n        Focusing\n      ]),\n      defaulted('selectOnFocus', true)\n    ]);\n    var focusBehaviours = function (detail) {\n      return derive$1([Focusing.config({\n          onFocus: !detail.selectOnFocus ? noop : function (component) {\n            var input = component.element;\n            var value = get$5(input);\n            input.dom.setSelectionRange(0, value.length);\n          }\n        })]);\n    };\n    var behaviours = function (detail) {\n      return __assign(__assign({}, focusBehaviours(detail)), augment(detail.inputBehaviours, [Representing.config({\n          store: __assign(__assign({ mode: 'manual' }, detail.data.map(function (data) {\n            return { initialValue: data };\n          }).getOr({})), {\n            getValue: function (input) {\n              return get$5(input.element);\n            },\n            setValue: function (input, data) {\n              var current = get$5(input.element);\n              if (current !== data) {\n                set$4(input.element, data);\n              }\n            }\n          }),\n          onSetValue: detail.onSetValue\n        })]));\n    };\n    var dom = function (detail) {\n      return {\n        tag: detail.tag,\n        attributes: __assign({ type: 'text' }, detail.inputAttributes),\n        styles: detail.inputStyles,\n        classes: detail.inputClasses\n      };\n    };\n\n    var factory$h = function (detail, _spec) {\n      return {\n        uid: detail.uid,\n        dom: dom(detail),\n        components: [],\n        behaviours: behaviours(detail),\n        eventOrder: detail.eventOrder\n      };\n    };\n    var Input = single({\n      name: 'Input',\n      configFields: schema$k(),\n      factory: factory$h\n    });\n\n    var exports$1 = {}, module = { exports: exports$1 };\n    (function (define, exports, module, require) {\n      (function (global, factory) {\n        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());\n      }(this, function () {\n        var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n        var promise = { exports: {} };\n        (function (module) {\n          (function (root) {\n            var setTimeoutFunc = setTimeout;\n            function noop() {\n            }\n            function bind(fn, thisArg) {\n              return function () {\n                fn.apply(thisArg, arguments);\n              };\n            }\n            function Promise(fn) {\n              if (typeof this !== 'object')\n                throw new TypeError('Promises must be constructed via new');\n              if (typeof fn !== 'function')\n                throw new TypeError('not a function');\n              this._state = 0;\n              this._handled = false;\n              this._value = undefined;\n              this._deferreds = [];\n              doResolve(fn, this);\n            }\n            function handle(self, deferred) {\n              while (self._state === 3) {\n                self = self._value;\n              }\n              if (self._state === 0) {\n                self._deferreds.push(deferred);\n                return;\n              }\n              self._handled = true;\n              Promise._immediateFn(function () {\n                var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n                if (cb === null) {\n                  (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n                  return;\n                }\n                var ret;\n                try {\n                  ret = cb(self._value);\n                } catch (e) {\n                  reject(deferred.promise, e);\n                  return;\n                }\n                resolve(deferred.promise, ret);\n              });\n            }\n            function resolve(self, newValue) {\n              try {\n                if (newValue === self)\n                  throw new TypeError('A promise cannot be resolved with itself.');\n                if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n                  var then = newValue.then;\n                  if (newValue instanceof Promise) {\n                    self._state = 3;\n                    self._value = newValue;\n                    finale(self);\n                    return;\n                  } else if (typeof then === 'function') {\n                    doResolve(bind(then, newValue), self);\n                    return;\n                  }\n                }\n                self._state = 1;\n                self._value = newValue;\n                finale(self);\n              } catch (e) {\n                reject(self, e);\n              }\n            }\n            function reject(self, newValue) {\n              self._state = 2;\n              self._value = newValue;\n              finale(self);\n            }\n            function finale(self) {\n              if (self._state === 2 && self._deferreds.length === 0) {\n                Promise._immediateFn(function () {\n                  if (!self._handled) {\n                    Promise._unhandledRejectionFn(self._value);\n                  }\n                });\n              }\n              for (var i = 0, len = self._deferreds.length; i < len; i++) {\n                handle(self, self._deferreds[i]);\n              }\n              self._deferreds = null;\n            }\n            function Handler(onFulfilled, onRejected, promise) {\n              this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n              this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n              this.promise = promise;\n            }\n            function doResolve(fn, self) {\n              var done = false;\n              try {\n                fn(function (value) {\n                  if (done)\n                    return;\n                  done = true;\n                  resolve(self, value);\n                }, function (reason) {\n                  if (done)\n                    return;\n                  done = true;\n                  reject(self, reason);\n                });\n              } catch (ex) {\n                if (done)\n                  return;\n                done = true;\n                reject(self, ex);\n              }\n            }\n            Promise.prototype['catch'] = function (onRejected) {\n              return this.then(null, onRejected);\n            };\n            Promise.prototype.then = function (onFulfilled, onRejected) {\n              var prom = new this.constructor(noop);\n              handle(this, new Handler(onFulfilled, onRejected, prom));\n              return prom;\n            };\n            Promise.all = function (arr) {\n              var args = Array.prototype.slice.call(arr);\n              return new Promise(function (resolve, reject) {\n                if (args.length === 0)\n                  return resolve([]);\n                var remaining = args.length;\n                function res(i, val) {\n                  try {\n                    if (val && (typeof val === 'object' || typeof val === 'function')) {\n                      var then = val.then;\n                      if (typeof then === 'function') {\n                        then.call(val, function (val) {\n                          res(i, val);\n                        }, reject);\n                        return;\n                      }\n                    }\n                    args[i] = val;\n                    if (--remaining === 0) {\n                      resolve(args);\n                    }\n                  } catch (ex) {\n                    reject(ex);\n                  }\n                }\n                for (var i = 0; i < args.length; i++) {\n                  res(i, args[i]);\n                }\n              });\n            };\n            Promise.resolve = function (value) {\n              if (value && typeof value === 'object' && value.constructor === Promise) {\n                return value;\n              }\n              return new Promise(function (resolve) {\n                resolve(value);\n              });\n            };\n            Promise.reject = function (value) {\n              return new Promise(function (resolve, reject) {\n                reject(value);\n              });\n            };\n            Promise.race = function (values) {\n              return new Promise(function (resolve, reject) {\n                for (var i = 0, len = values.length; i < len; i++) {\n                  values[i].then(resolve, reject);\n                }\n              });\n            };\n            Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) {\n              setImmediate(fn);\n            } : function (fn) {\n              setTimeoutFunc(fn, 0);\n            };\n            Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n              if (typeof console !== 'undefined' && console) {\n                console.warn('Possible Unhandled Promise Rejection:', err);\n              }\n            };\n            Promise._setImmediateFn = function _setImmediateFn(fn) {\n              Promise._immediateFn = fn;\n            };\n            Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {\n              Promise._unhandledRejectionFn = fn;\n            };\n            if (module.exports) {\n              module.exports = Promise;\n            } else if (!root.Promise) {\n              root.Promise = Promise;\n            }\n          }(commonjsGlobal));\n        }(promise));\n        var promisePolyfill = promise.exports;\n        var Global = function () {\n          if (typeof window !== 'undefined') {\n            return window;\n          } else {\n            return Function('return this;')();\n          }\n        }();\n        var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill };\n        return promisePolyfill_1;\n      }));\n    }(undefined, exports$1, module));\n    var Promise$1 = module.exports.boltExport;\n\n    var nu$3 = function (baseFn) {\n      var data = Optional.none();\n      var callbacks = [];\n      var map = function (f) {\n        return nu$3(function (nCallback) {\n          get(function (data) {\n            nCallback(f(data));\n          });\n        });\n      };\n      var get = function (nCallback) {\n        if (isReady()) {\n          call(nCallback);\n        } else {\n          callbacks.push(nCallback);\n        }\n      };\n      var set = function (x) {\n        if (!isReady()) {\n          data = Optional.some(x);\n          run(callbacks);\n          callbacks = [];\n        }\n      };\n      var isReady = function () {\n        return data.isSome();\n      };\n      var run = function (cbs) {\n        each$1(cbs, call);\n      };\n      var call = function (cb) {\n        data.each(function (x) {\n          setTimeout(function () {\n            cb(x);\n          }, 0);\n        });\n      };\n      baseFn(set);\n      return {\n        get: get,\n        map: map,\n        isReady: isReady\n      };\n    };\n    var pure$1 = function (a) {\n      return nu$3(function (callback) {\n        callback(a);\n      });\n    };\n    var LazyValue = {\n      nu: nu$3,\n      pure: pure$1\n    };\n\n    var errorReporter = function (err) {\n      setTimeout(function () {\n        throw err;\n      }, 0);\n    };\n    var make$5 = function (run) {\n      var get = function (callback) {\n        run().then(callback, errorReporter);\n      };\n      var map = function (fab) {\n        return make$5(function () {\n          return run().then(fab);\n        });\n      };\n      var bind = function (aFutureB) {\n        return make$5(function () {\n          return run().then(function (v) {\n            return aFutureB(v).toPromise();\n          });\n        });\n      };\n      var anonBind = function (futureB) {\n        return make$5(function () {\n          return run().then(function () {\n            return futureB.toPromise();\n          });\n        });\n      };\n      var toLazy = function () {\n        return LazyValue.nu(get);\n      };\n      var toCached = function () {\n        var cache = null;\n        return make$5(function () {\n          if (cache === null) {\n            cache = run();\n          }\n          return cache;\n        });\n      };\n      var toPromise = run;\n      return {\n        map: map,\n        bind: bind,\n        anonBind: anonBind,\n        toLazy: toLazy,\n        toCached: toCached,\n        toPromise: toPromise,\n        get: get\n      };\n    };\n    var nu$2 = function (baseFn) {\n      return make$5(function () {\n        return new Promise$1(baseFn);\n      });\n    };\n    var pure = function (a) {\n      return make$5(function () {\n        return Promise$1.resolve(a);\n      });\n    };\n    var Future = {\n      nu: nu$2,\n      pure: pure\n    };\n\n    var ariaElements = [\n      'input',\n      'textarea'\n    ];\n    var isAriaElement = function (elem) {\n      var name = name$2(elem);\n      return contains$2(ariaElements, name);\n    };\n    var markValid = function (component, invalidConfig) {\n      var elem = invalidConfig.getRoot(component).getOr(component.element);\n      remove$2(elem, invalidConfig.invalidClass);\n      invalidConfig.notify.each(function (notifyInfo) {\n        if (isAriaElement(component.element)) {\n          set$8(component.element, 'aria-invalid', false);\n        }\n        notifyInfo.getContainer(component).each(function (container) {\n          set$5(container, notifyInfo.validHtml);\n        });\n        notifyInfo.onValid(component);\n      });\n    };\n    var markInvalid = function (component, invalidConfig, invalidState, text) {\n      var elem = invalidConfig.getRoot(component).getOr(component.element);\n      add$2(elem, invalidConfig.invalidClass);\n      invalidConfig.notify.each(function (notifyInfo) {\n        if (isAriaElement(component.element)) {\n          set$8(component.element, 'aria-invalid', true);\n        }\n        notifyInfo.getContainer(component).each(function (container) {\n          set$5(container, text);\n        });\n        notifyInfo.onInvalid(component, text);\n      });\n    };\n    var query = function (component, invalidConfig, _invalidState) {\n      return invalidConfig.validator.fold(function () {\n        return Future.pure(Result.value(true));\n      }, function (validatorInfo) {\n        return validatorInfo.validate(component);\n      });\n    };\n    var run = function (component, invalidConfig, invalidState) {\n      invalidConfig.notify.each(function (notifyInfo) {\n        notifyInfo.onValidate(component);\n      });\n      return query(component, invalidConfig).map(function (valid) {\n        if (component.getSystem().isConnected()) {\n          return valid.fold(function (err) {\n            markInvalid(component, invalidConfig, invalidState, err);\n            return Result.error(err);\n          }, function (v) {\n            markValid(component, invalidConfig);\n            return Result.value(v);\n          });\n        } else {\n          return Result.error('No longer in system');\n        }\n      });\n    };\n    var isInvalid = function (component, invalidConfig) {\n      var elem = invalidConfig.getRoot(component).getOr(component.element);\n      return has(elem, invalidConfig.invalidClass);\n    };\n\n    var InvalidateApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        markValid: markValid,\n        markInvalid: markInvalid,\n        query: query,\n        run: run,\n        isInvalid: isInvalid\n    });\n\n    var events$8 = function (invalidConfig, invalidState) {\n      return invalidConfig.validator.map(function (validatorInfo) {\n        return derive$2([run$1(validatorInfo.onEvent, function (component) {\n            run(component, invalidConfig, invalidState).get(identity$1);\n          })].concat(validatorInfo.validateOnLoad ? [runOnAttached(function (component) {\n            run(component, invalidConfig, invalidState).get(noop);\n          })] : []));\n      }).getOr({});\n    };\n\n    var ActiveInvalidate = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$8\n    });\n\n    var InvalidateSchema = [\n      required$1('invalidClass'),\n      defaulted('getRoot', Optional.none),\n      optionObjOf('notify', [\n        defaulted('aria', 'alert'),\n        defaulted('getContainer', Optional.none),\n        defaulted('validHtml', ''),\n        onHandler('onValid'),\n        onHandler('onInvalid'),\n        onHandler('onValidate')\n      ]),\n      optionObjOf('validator', [\n        required$1('validate'),\n        defaulted('onEvent', 'input'),\n        defaulted('validateOnLoad', true)\n      ])\n    ];\n\n    var Invalidating = create$8({\n      fields: InvalidateSchema,\n      name: 'invalidating',\n      active: ActiveInvalidate,\n      apis: InvalidateApis,\n      extra: {\n        validation: function (validator) {\n          return function (component) {\n            var v = Representing.getValue(component);\n            return Future.pure(validator(v));\n          };\n        }\n      }\n    });\n\n    var getCoupled = function (component, coupleConfig, coupleState, name) {\n      return coupleState.getOrCreate(component, coupleConfig, name);\n    };\n\n    var CouplingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        getCoupled: getCoupled\n    });\n\n    var CouplingSchema = [requiredOf('others', setOf(Result.value, anyValue()))];\n\n    var init$a = function () {\n      var coupled = {};\n      var getOrCreate = function (component, coupleConfig, name) {\n        var available = keys(coupleConfig.others);\n        if (!available) {\n          throw new Error('Cannot find coupled component: ' + name + '. Known coupled components: ' + JSON.stringify(available, null, 2));\n        } else {\n          return get$e(coupled, name).getOrThunk(function () {\n            var builder = get$e(coupleConfig.others, name).getOrDie('No information found for coupled component: ' + name);\n            var spec = builder(component);\n            var built = component.getSystem().build(spec);\n            coupled[name] = built;\n            return built;\n          });\n        }\n      };\n      var readState = constant$1({});\n      return nu$8({\n        readState: readState,\n        getOrCreate: getOrCreate\n      });\n    };\n\n    var CouplingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$a\n    });\n\n    var Coupling = create$8({\n      fields: CouplingSchema,\n      name: 'coupling',\n      apis: CouplingApis,\n      state: CouplingState\n    });\n\n    var suffix = constant$1('sink');\n    var partType$1 = constant$1(optional({\n      name: suffix(),\n      overrides: constant$1({\n        dom: { tag: 'div' },\n        behaviours: derive$1([Positioning.config({ useFixed: always })]),\n        events: derive$2([\n          cutter(keydown()),\n          cutter(mousedown()),\n          cutter(click())\n        ])\n      })\n    }));\n\n    var HighlightOnOpen;\n    (function (HighlightOnOpen) {\n      HighlightOnOpen[HighlightOnOpen['HighlightFirst'] = 0] = 'HighlightFirst';\n      HighlightOnOpen[HighlightOnOpen['HighlightNone'] = 1] = 'HighlightNone';\n    }(HighlightOnOpen || (HighlightOnOpen = {})));\n    var getAnchor = function (detail, component) {\n      var hotspot = detail.getHotspot(component).getOr(component);\n      var type = 'hotspot';\n      var overrides = detail.getAnchorOverrides();\n      return detail.layouts.fold(function () {\n        return {\n          type: type,\n          hotspot: hotspot,\n          overrides: overrides\n        };\n      }, function (layouts) {\n        return {\n          type: type,\n          hotspot: hotspot,\n          overrides: overrides,\n          layouts: layouts\n        };\n      });\n    };\n    var fetch = function (detail, mapFetch, component) {\n      var fetcher = detail.fetch;\n      return fetcher(component).map(mapFetch);\n    };\n    var openF = function (detail, mapFetch, anchor, component, sandbox, externals, highlightOnOpen) {\n      var futureData = fetch(detail, mapFetch, component);\n      var getLazySink = getSink(component, detail);\n      return futureData.map(function (tdata) {\n        return tdata.bind(function (data) {\n          return Optional.from(tieredMenu.sketch(__assign(__assign({}, externals.menu()), {\n            uid: generate$5(''),\n            data: data,\n            highlightImmediately: highlightOnOpen === HighlightOnOpen.HighlightFirst,\n            onOpenMenu: function (tmenu, menu) {\n              var sink = getLazySink().getOrDie();\n              Positioning.position(sink, menu, { anchor: anchor });\n              Sandboxing.decloak(sandbox);\n            },\n            onOpenSubmenu: function (tmenu, item, submenu) {\n              var sink = getLazySink().getOrDie();\n              Positioning.position(sink, submenu, {\n                anchor: {\n                  type: 'submenu',\n                  item: item\n                }\n              });\n              Sandboxing.decloak(sandbox);\n            },\n            onRepositionMenu: function (tmenu, primaryMenu, submenuTriggers) {\n              var sink = getLazySink().getOrDie();\n              Positioning.position(sink, primaryMenu, { anchor: anchor });\n              each$1(submenuTriggers, function (st) {\n                Positioning.position(sink, st.triggeredMenu, {\n                  anchor: {\n                    type: 'submenu',\n                    item: st.triggeringItem\n                  }\n                });\n              });\n            },\n            onEscape: function () {\n              Focusing.focus(component);\n              Sandboxing.close(sandbox);\n              return Optional.some(true);\n            }\n          })));\n        });\n      });\n    };\n    var open = function (detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen) {\n      var anchor = getAnchor(detail, hotspot);\n      var processed = openF(detail, mapFetch, anchor, hotspot, sandbox, externals, highlightOnOpen);\n      return processed.map(function (tdata) {\n        tdata.fold(function () {\n          if (Sandboxing.isOpen(sandbox)) {\n            Sandboxing.close(sandbox);\n          }\n        }, function (data) {\n          Sandboxing.cloak(sandbox);\n          Sandboxing.open(sandbox, data);\n          onOpenSync(sandbox);\n        });\n        return sandbox;\n      });\n    };\n    var close = function (detail, mapFetch, component, sandbox, _externals, _onOpenSync, _highlightOnOpen) {\n      Sandboxing.close(sandbox);\n      return Future.pure(sandbox);\n    };\n    var togglePopup = function (detail, mapFetch, hotspot, externals, onOpenSync, highlightOnOpen) {\n      var sandbox = Coupling.getCoupled(hotspot, 'sandbox');\n      var showing = Sandboxing.isOpen(sandbox);\n      var action = showing ? close : open;\n      return action(detail, mapFetch, hotspot, sandbox, externals, onOpenSync, highlightOnOpen);\n    };\n    var matchWidth = function (hotspot, container, useMinWidth) {\n      var menu = Composing.getCurrent(container).getOr(container);\n      var buttonWidth = get$a(hotspot.element);\n      if (useMinWidth) {\n        set$7(menu.element, 'min-width', buttonWidth + 'px');\n      } else {\n        set$6(menu.element, buttonWidth);\n      }\n    };\n    var getSink = function (anyInSystem, sinkDetail) {\n      return anyInSystem.getSystem().getByUid(sinkDetail.uid + '-' + suffix()).map(function (internalSink) {\n        return function () {\n          return Result.value(internalSink);\n        };\n      }).getOrThunk(function () {\n        return sinkDetail.lazySink.fold(function () {\n          return function () {\n            return Result.error(new Error('No internal sink is specified, nor could an external sink be found'));\n          };\n        }, function (lazySinkFn) {\n          return function () {\n            return lazySinkFn(anyInSystem);\n          };\n        });\n      });\n    };\n    var doRepositionMenus = function (sandbox) {\n      Sandboxing.getState(sandbox).each(function (tmenu) {\n        tieredMenu.repositionMenus(tmenu);\n      });\n    };\n    var makeSandbox$1 = function (detail, hotspot, extras) {\n      var ariaOwner = manager();\n      var onOpen = function (component, menu) {\n        var anchor = getAnchor(detail, hotspot);\n        ariaOwner.link(hotspot.element);\n        if (detail.matchWidth) {\n          matchWidth(anchor.hotspot, menu, detail.useMinWidth);\n        }\n        detail.onOpen(anchor, component, menu);\n        if (extras !== undefined && extras.onOpen !== undefined) {\n          extras.onOpen(component, menu);\n        }\n      };\n      var onClose = function (component, menu) {\n        ariaOwner.unlink(hotspot.element);\n        if (extras !== undefined && extras.onClose !== undefined) {\n          extras.onClose(component, menu);\n        }\n      };\n      var lazySink = getSink(hotspot, detail);\n      return {\n        dom: {\n          tag: 'div',\n          classes: detail.sandboxClasses,\n          attributes: {\n            id: ariaOwner.id,\n            role: 'listbox'\n          }\n        },\n        behaviours: SketchBehaviours.augment(detail.sandboxBehaviours, [\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: hotspot\n            }\n          }),\n          Sandboxing.config({\n            onOpen: onOpen,\n            onClose: onClose,\n            isPartOf: function (container, data, queryElem) {\n              return isPartOf$1(data, queryElem) || isPartOf$1(hotspot, queryElem);\n            },\n            getAttachPoint: function () {\n              return lazySink().getOrDie();\n            }\n          }),\n          Composing.config({\n            find: function (sandbox) {\n              return Sandboxing.getState(sandbox).bind(function (menu) {\n                return Composing.getCurrent(menu);\n              });\n            }\n          }),\n          Receiving.config({ channels: __assign(__assign({}, receivingChannel$1({ isExtraPart: never })), receivingChannel({ doReposition: doRepositionMenus })) })\n        ])\n      };\n    };\n    var repositionMenus = function (comp) {\n      var sandbox = Coupling.getCoupled(comp, 'sandbox');\n      doRepositionMenus(sandbox);\n    };\n\n    var sandboxFields = function () {\n      return [\n        defaulted('sandboxClasses', []),\n        SketchBehaviours.field('sandboxBehaviours', [\n          Composing,\n          Receiving,\n          Sandboxing,\n          Representing\n        ])\n      ];\n    };\n\n    var schema$j = constant$1([\n      required$1('dom'),\n      required$1('fetch'),\n      onHandler('onOpen'),\n      onKeyboardHandler('onExecute'),\n      defaulted('getHotspot', Optional.some),\n      defaulted('getAnchorOverrides', constant$1({})),\n      schema$y(),\n      field('dropdownBehaviours', [\n        Toggling,\n        Coupling,\n        Keying,\n        Focusing\n      ]),\n      required$1('toggleClass'),\n      defaulted('eventOrder', {}),\n      option('lazySink'),\n      defaulted('matchWidth', false),\n      defaulted('useMinWidth', false),\n      option('role')\n    ].concat(sandboxFields()));\n    var parts$d = constant$1([\n      external$1({\n        schema: [tieredMenuMarkers()],\n        name: 'menu',\n        defaults: function (detail) {\n          return { onExecute: detail.onExecute };\n        }\n      }),\n      partType$1()\n    ]);\n\n    var factory$g = function (detail, components, _spec, externals) {\n      var _a;\n      var lookupAttr = function (attr) {\n        return get$e(detail.dom, 'attributes').bind(function (attrs) {\n          return get$e(attrs, attr);\n        });\n      };\n      var switchToMenu = function (sandbox) {\n        Sandboxing.getState(sandbox).each(function (tmenu) {\n          tieredMenu.highlightPrimary(tmenu);\n        });\n      };\n      var action = function (component) {\n        var onOpenSync = switchToMenu;\n        togglePopup(detail, identity$1, component, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop);\n      };\n      var apis = {\n        expand: function (comp) {\n          if (!Toggling.isOn(comp)) {\n            togglePopup(detail, identity$1, comp, externals, noop, HighlightOnOpen.HighlightNone).get(noop);\n          }\n        },\n        open: function (comp) {\n          if (!Toggling.isOn(comp)) {\n            togglePopup(detail, identity$1, comp, externals, noop, HighlightOnOpen.HighlightFirst).get(noop);\n          }\n        },\n        isOpen: Toggling.isOn,\n        close: function (comp) {\n          if (Toggling.isOn(comp)) {\n            togglePopup(detail, identity$1, comp, externals, noop, HighlightOnOpen.HighlightFirst).get(noop);\n          }\n        },\n        repositionMenus: function (comp) {\n          if (Toggling.isOn(comp)) {\n            repositionMenus(comp);\n          }\n        }\n      };\n      var triggerExecute = function (comp, _se) {\n        emitExecute(comp);\n        return Optional.some(true);\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.dropdownBehaviours, [\n          Toggling.config({\n            toggleClass: detail.toggleClass,\n            aria: { mode: 'expanded' }\n          }),\n          Coupling.config({\n            others: {\n              sandbox: function (hotspot) {\n                return makeSandbox$1(detail, hotspot, {\n                  onOpen: function () {\n                    return Toggling.on(hotspot);\n                  },\n                  onClose: function () {\n                    return Toggling.off(hotspot);\n                  }\n                });\n              }\n            }\n          }),\n          Keying.config({\n            mode: 'special',\n            onSpace: triggerExecute,\n            onEnter: triggerExecute,\n            onDown: function (comp, _se) {\n              if (Dropdown.isOpen(comp)) {\n                var sandbox = Coupling.getCoupled(comp, 'sandbox');\n                switchToMenu(sandbox);\n              } else {\n                Dropdown.open(comp);\n              }\n              return Optional.some(true);\n            },\n            onEscape: function (comp, _se) {\n              if (Dropdown.isOpen(comp)) {\n                Dropdown.close(comp);\n                return Optional.some(true);\n              } else {\n                return Optional.none();\n              }\n            }\n          }),\n          Focusing.config({})\n        ]),\n        events: events$a(Optional.some(action)),\n        eventOrder: __assign(__assign({}, detail.eventOrder), (_a = {}, _a[execute$5()] = [\n          'disabling',\n          'toggling',\n          'alloy.base.behaviour'\n        ], _a)),\n        apis: apis,\n        domModification: {\n          attributes: __assign(__assign({ 'aria-haspopup': 'true' }, detail.role.fold(function () {\n            return {};\n          }, function (role) {\n            return { role: role };\n          })), detail.dom.tag === 'button' ? { type: lookupAttr('type').getOr('button') } : {})\n        }\n      };\n    };\n    var Dropdown = composite({\n      name: 'Dropdown',\n      configFields: schema$j(),\n      partFields: parts$d(),\n      factory: factory$g,\n      apis: {\n        open: function (apis, comp) {\n          return apis.open(comp);\n        },\n        expand: function (apis, comp) {\n          return apis.expand(comp);\n        },\n        close: function (apis, comp) {\n          return apis.close(comp);\n        },\n        isOpen: function (apis, comp) {\n          return apis.isOpen(comp);\n        },\n        repositionMenus: function (apis, comp) {\n          return apis.repositionMenus(comp);\n        }\n      }\n    });\n\n    var exhibit$1 = function () {\n      return nu$7({\n        styles: {\n          '-webkit-user-select': 'none',\n          'user-select': 'none',\n          '-ms-user-select': 'none',\n          '-moz-user-select': '-moz-none'\n        },\n        attributes: { unselectable: 'on' }\n      });\n    };\n    var events$7 = function () {\n      return derive$2([abort(selectstart(), always)]);\n    };\n\n    var ActiveUnselecting = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$7,\n        exhibit: exhibit$1\n    });\n\n    var Unselecting = create$8({\n      fields: [],\n      name: 'unselecting',\n      active: ActiveUnselecting\n    });\n\n    var renderPanelButton = function (spec, sharedBackstage) {\n      return Dropdown.sketch({\n        dom: spec.dom,\n        components: spec.components,\n        toggleClass: 'mce-active',\n        dropdownBehaviours: derive$1([\n          DisablingConfigs.button(sharedBackstage.providers.isDisabled),\n          receivingConfig(),\n          Unselecting.config({}),\n          Tabstopping.config({})\n        ]),\n        layouts: spec.layouts,\n        sandboxClasses: ['tox-dialog__popups'],\n        lazySink: sharedBackstage.getSink,\n        fetch: function (comp) {\n          return Future.nu(function (callback) {\n            return spec.fetch(callback);\n          }).map(function (items) {\n            return Optional.from(createTieredDataFrom(deepMerge(createPartialChoiceMenu(generate$6('menu-value'), items, function (value) {\n              spec.onItemAction(comp, value);\n            }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, never, sharedBackstage.providers), { movement: deriveMenuMovement(spec.columns, spec.presets) })));\n          });\n        },\n        parts: { menu: part(false, 1, spec.presets) }\n      });\n    };\n\n    var colorInputChangeEvent = generate$6('color-input-change');\n    var colorSwatchChangeEvent = generate$6('color-swatch-change');\n    var colorPickerCancelEvent = generate$6('color-picker-cancel');\n    var renderColorInput = function (spec, sharedBackstage, colorInputBackstage) {\n      var pField = FormField.parts.field({\n        factory: Input,\n        inputClasses: ['tox-textfield'],\n        onSetValue: function (c) {\n          return Invalidating.run(c).get(noop);\n        },\n        inputBehaviours: derive$1([\n          Disabling.config({ disabled: sharedBackstage.providers.isDisabled }),\n          receivingConfig(),\n          Tabstopping.config({}),\n          Invalidating.config({\n            invalidClass: 'tox-textbox-field-invalid',\n            getRoot: function (comp) {\n              return parent(comp.element);\n            },\n            notify: {\n              onValid: function (comp) {\n                var val = Representing.getValue(comp);\n                emitWith(comp, colorInputChangeEvent, { color: val });\n              }\n            },\n            validator: {\n              validateOnLoad: false,\n              validate: function (input) {\n                var inputValue = Representing.getValue(input);\n                if (inputValue.length === 0) {\n                  return Future.pure(Result.value(true));\n                } else {\n                  var span = SugarElement.fromTag('span');\n                  set$7(span, 'background-color', inputValue);\n                  var res = getRaw(span, 'background-color').fold(function () {\n                    return Result.error('blah');\n                  }, function (_) {\n                    return Result.value(inputValue);\n                  });\n                  return Future.pure(res);\n                }\n              }\n            }\n          })\n        ]),\n        selectOnFocus: false\n      });\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, sharedBackstage.providers);\n      });\n      var emitSwatchChange = function (colorBit, value) {\n        emitWith(colorBit, colorSwatchChangeEvent, { value: value });\n      };\n      var onItemAction = function (comp, value) {\n        memColorButton.getOpt(comp).each(function (colorBit) {\n          if (value === 'custom') {\n            colorInputBackstage.colorPicker(function (valueOpt) {\n              valueOpt.fold(function () {\n                return emit(colorBit, colorPickerCancelEvent);\n              }, function (value) {\n                emitSwatchChange(colorBit, value);\n                addColor(value);\n              });\n            }, '#ffffff');\n          } else if (value === 'remove') {\n            emitSwatchChange(colorBit, '');\n          } else {\n            emitSwatchChange(colorBit, value);\n          }\n        });\n      };\n      var memColorButton = record(renderPanelButton({\n        dom: {\n          tag: 'span',\n          attributes: { 'aria-label': sharedBackstage.providers.translate('Color swatch') }\n        },\n        layouts: {\n          onRtl: function () {\n            return [\n              southwest$2,\n              southeast$2,\n              south$2\n            ];\n          },\n          onLtr: function () {\n            return [\n              southeast$2,\n              southwest$2,\n              south$2\n            ];\n          }\n        },\n        components: [],\n        fetch: getFetch$1(colorInputBackstage.getColors(), colorInputBackstage.hasCustomColors()),\n        columns: colorInputBackstage.getColorCols(),\n        presets: 'color',\n        onItemAction: onItemAction\n      }, sharedBackstage));\n      return FormField.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-form__group']\n        },\n        components: pLabel.toArray().concat([{\n            dom: {\n              tag: 'div',\n              classes: ['tox-color-input']\n            },\n            components: [\n              pField,\n              memColorButton.asSpec()\n            ]\n          }]),\n        fieldBehaviours: derive$1([config('form-field-events', [\n            run$1(colorInputChangeEvent, function (comp, se) {\n              memColorButton.getOpt(comp).each(function (colorButton) {\n                set$7(colorButton.element, 'background-color', se.event.color);\n              });\n              emitWith(comp, formChangeEvent, { name: spec.name });\n            }),\n            run$1(colorSwatchChangeEvent, function (comp, se) {\n              FormField.getField(comp).each(function (field) {\n                Representing.setValue(field, se.event.value);\n                Composing.getCurrent(comp).each(Focusing.focus);\n              });\n            }),\n            run$1(colorPickerCancelEvent, function (comp, _se) {\n              FormField.getField(comp).each(function (_field) {\n                Composing.getCurrent(comp).each(Focusing.focus);\n              });\n            })\n          ])])\n      });\n    };\n\n    var labelPart = optional({\n      schema: [required$1('dom')],\n      name: 'label'\n    });\n    var edgePart = function (name) {\n      return optional({\n        name: '' + name + '-edge',\n        overrides: function (detail) {\n          var action = detail.model.manager.edgeActions[name];\n          return action.fold(function () {\n            return {};\n          }, function (a) {\n            return {\n              events: derive$2([\n                runActionExtra(touchstart(), function (comp, se, d) {\n                  return a(comp, d);\n                }, [detail]),\n                runActionExtra(mousedown(), function (comp, se, d) {\n                  return a(comp, d);\n                }, [detail]),\n                runActionExtra(mousemove(), function (comp, se, det) {\n                  if (det.mouseIsDown.get()) {\n                    a(comp, det);\n                  }\n                }, [detail])\n              ])\n            };\n          });\n        }\n      });\n    };\n    var tlEdgePart = edgePart('top-left');\n    var tedgePart = edgePart('top');\n    var trEdgePart = edgePart('top-right');\n    var redgePart = edgePart('right');\n    var brEdgePart = edgePart('bottom-right');\n    var bedgePart = edgePart('bottom');\n    var blEdgePart = edgePart('bottom-left');\n    var ledgePart = edgePart('left');\n    var thumbPart = required({\n      name: 'thumb',\n      defaults: constant$1({ dom: { styles: { position: 'absolute' } } }),\n      overrides: function (detail) {\n        return {\n          events: derive$2([\n            redirectToPart(touchstart(), detail, 'spectrum'),\n            redirectToPart(touchmove(), detail, 'spectrum'),\n            redirectToPart(touchend(), detail, 'spectrum'),\n            redirectToPart(mousedown(), detail, 'spectrum'),\n            redirectToPart(mousemove(), detail, 'spectrum'),\n            redirectToPart(mouseup(), detail, 'spectrum')\n          ])\n        };\n      }\n    });\n    var spectrumPart = required({\n      schema: [customField('mouseIsDown', function () {\n          return Cell(false);\n        })],\n      name: 'spectrum',\n      overrides: function (detail) {\n        var modelDetail = detail.model;\n        var model = modelDetail.manager;\n        var setValueFrom = function (component, simulatedEvent) {\n          return model.getValueFromEvent(simulatedEvent).map(function (value) {\n            return model.setValueFrom(component, detail, value);\n          });\n        };\n        return {\n          behaviours: derive$1([\n            Keying.config({\n              mode: 'special',\n              onLeft: function (spectrum) {\n                return model.onLeft(spectrum, detail);\n              },\n              onRight: function (spectrum) {\n                return model.onRight(spectrum, detail);\n              },\n              onUp: function (spectrum) {\n                return model.onUp(spectrum, detail);\n              },\n              onDown: function (spectrum) {\n                return model.onDown(spectrum, detail);\n              }\n            }),\n            Focusing.config({})\n          ]),\n          events: derive$2([\n            run$1(touchstart(), setValueFrom),\n            run$1(touchmove(), setValueFrom),\n            run$1(mousedown(), setValueFrom),\n            run$1(mousemove(), function (spectrum, se) {\n              if (detail.mouseIsDown.get()) {\n                setValueFrom(spectrum, se);\n              }\n            })\n          ])\n        };\n      }\n    });\n    var SliderParts = [\n      labelPart,\n      ledgePart,\n      redgePart,\n      tedgePart,\n      bedgePart,\n      tlEdgePart,\n      trEdgePart,\n      blEdgePart,\n      brEdgePart,\n      thumbPart,\n      spectrumPart\n    ];\n\n    var _sliderChangeEvent = 'slider.change.value';\n    var sliderChangeEvent = constant$1(_sliderChangeEvent);\n    var isTouchEvent$2 = function (evt) {\n      return evt.type.indexOf('touch') !== -1;\n    };\n    var getEventSource = function (simulatedEvent) {\n      var evt = simulatedEvent.event.raw;\n      if (isTouchEvent$2(evt)) {\n        var touchEvent = evt;\n        return touchEvent.touches !== undefined && touchEvent.touches.length === 1 ? Optional.some(touchEvent.touches[0]).map(function (t) {\n          return SugarPosition(t.clientX, t.clientY);\n        }) : Optional.none();\n      } else {\n        var mouseEvent = evt;\n        return mouseEvent.clientX !== undefined ? Optional.some(mouseEvent).map(function (me) {\n          return SugarPosition(me.clientX, me.clientY);\n        }) : Optional.none();\n      }\n    };\n\n    var t = 'top', r = 'right', b = 'bottom', l = 'left';\n    var minX = function (detail) {\n      return detail.model.minX;\n    };\n    var minY = function (detail) {\n      return detail.model.minY;\n    };\n    var min1X = function (detail) {\n      return detail.model.minX - 1;\n    };\n    var min1Y = function (detail) {\n      return detail.model.minY - 1;\n    };\n    var maxX = function (detail) {\n      return detail.model.maxX;\n    };\n    var maxY = function (detail) {\n      return detail.model.maxY;\n    };\n    var max1X = function (detail) {\n      return detail.model.maxX + 1;\n    };\n    var max1Y = function (detail) {\n      return detail.model.maxY + 1;\n    };\n    var range = function (detail, max, min) {\n      return max(detail) - min(detail);\n    };\n    var xRange = function (detail) {\n      return range(detail, maxX, minX);\n    };\n    var yRange = function (detail) {\n      return range(detail, maxY, minY);\n    };\n    var halfX = function (detail) {\n      return xRange(detail) / 2;\n    };\n    var halfY = function (detail) {\n      return yRange(detail) / 2;\n    };\n    var step = function (detail) {\n      return detail.stepSize;\n    };\n    var snap = function (detail) {\n      return detail.snapToGrid;\n    };\n    var snapStart = function (detail) {\n      return detail.snapStart;\n    };\n    var rounded = function (detail) {\n      return detail.rounded;\n    };\n    var hasEdge = function (detail, edgeName) {\n      return detail[edgeName + '-edge'] !== undefined;\n    };\n    var hasLEdge = function (detail) {\n      return hasEdge(detail, l);\n    };\n    var hasREdge = function (detail) {\n      return hasEdge(detail, r);\n    };\n    var hasTEdge = function (detail) {\n      return hasEdge(detail, t);\n    };\n    var hasBEdge = function (detail) {\n      return hasEdge(detail, b);\n    };\n    var currentValue = function (detail) {\n      return detail.model.value.get();\n    };\n\n    var xValue = function (x) {\n      return { x: x };\n    };\n    var yValue = function (y) {\n      return { y: y };\n    };\n    var xyValue = function (x, y) {\n      return {\n        x: x,\n        y: y\n      };\n    };\n    var fireSliderChange$3 = function (component, value) {\n      emitWith(component, sliderChangeEvent(), { value: value });\n    };\n    var setToTLEdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(min1X(detail), min1Y(detail)));\n    };\n    var setToTEdge = function (edge, detail) {\n      fireSliderChange$3(edge, yValue(min1Y(detail)));\n    };\n    var setToTEdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(halfX(detail), min1Y(detail)));\n    };\n    var setToTREdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(max1X(detail), min1Y(detail)));\n    };\n    var setToREdge = function (edge, detail) {\n      fireSliderChange$3(edge, xValue(max1X(detail)));\n    };\n    var setToREdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(max1X(detail), halfY(detail)));\n    };\n    var setToBREdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(max1X(detail), max1Y(detail)));\n    };\n    var setToBEdge = function (edge, detail) {\n      fireSliderChange$3(edge, yValue(max1Y(detail)));\n    };\n    var setToBEdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(halfX(detail), max1Y(detail)));\n    };\n    var setToBLEdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(min1X(detail), max1Y(detail)));\n    };\n    var setToLEdge = function (edge, detail) {\n      fireSliderChange$3(edge, xValue(min1X(detail)));\n    };\n    var setToLEdgeXY = function (edge, detail) {\n      fireSliderChange$3(edge, xyValue(min1X(detail), halfY(detail)));\n    };\n\n    var reduceBy = function (value, min, max, step) {\n      if (value < min) {\n        return value;\n      } else if (value > max) {\n        return max;\n      } else if (value === min) {\n        return min - 1;\n      } else {\n        return Math.max(min, value - step);\n      }\n    };\n    var increaseBy = function (value, min, max, step) {\n      if (value > max) {\n        return value;\n      } else if (value < min) {\n        return min;\n      } else if (value === max) {\n        return max + 1;\n      } else {\n        return Math.min(max, value + step);\n      }\n    };\n    var capValue = function (value, min, max) {\n      return Math.max(min, Math.min(max, value));\n    };\n    var snapValueOf = function (value, min, max, step, snapStart) {\n      return snapStart.fold(function () {\n        var initValue = value - min;\n        var extraValue = Math.round(initValue / step) * step;\n        return capValue(min + extraValue, min - 1, max + 1);\n      }, function (start) {\n        var remainder = (value - start) % step;\n        var adjustment = Math.round(remainder / step);\n        var rawSteps = Math.floor((value - start) / step);\n        var maxSteps = Math.floor((max - start) / step);\n        var numSteps = Math.min(maxSteps, rawSteps + adjustment);\n        var r = start + numSteps * step;\n        return Math.max(start, r);\n      });\n    };\n    var findOffsetOf = function (value, min, max) {\n      return Math.min(max, Math.max(value, min)) - min;\n    };\n    var findValueOf = function (args) {\n      var min = args.min, max = args.max, range = args.range, value = args.value, step = args.step, snap = args.snap, snapStart = args.snapStart, rounded = args.rounded, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, minBound = args.minBound, maxBound = args.maxBound, screenRange = args.screenRange;\n      var capMin = hasMinEdge ? min - 1 : min;\n      var capMax = hasMaxEdge ? max + 1 : max;\n      if (value < minBound) {\n        return capMin;\n      } else if (value > maxBound) {\n        return capMax;\n      } else {\n        var offset = findOffsetOf(value, minBound, maxBound);\n        var newValue = capValue(offset / screenRange * range + min, capMin, capMax);\n        if (snap && newValue >= min && newValue <= max) {\n          return snapValueOf(newValue, min, max, step, snapStart);\n        } else if (rounded) {\n          return Math.round(newValue);\n        } else {\n          return newValue;\n        }\n      }\n    };\n    var findOffsetOfValue$2 = function (args) {\n      var min = args.min, max = args.max, range = args.range, value = args.value, hasMinEdge = args.hasMinEdge, hasMaxEdge = args.hasMaxEdge, maxBound = args.maxBound, maxOffset = args.maxOffset, centerMinEdge = args.centerMinEdge, centerMaxEdge = args.centerMaxEdge;\n      if (value < min) {\n        return hasMinEdge ? 0 : centerMinEdge;\n      } else if (value > max) {\n        return hasMaxEdge ? maxBound : centerMaxEdge;\n      } else {\n        return (value - min) / range * maxOffset;\n      }\n    };\n\n    var top = 'top', right = 'right', bottom = 'bottom', left = 'left', width = 'width', height = 'height';\n    var getBounds = function (component) {\n      return component.element.dom.getBoundingClientRect();\n    };\n    var getBoundsProperty = function (bounds, property) {\n      return bounds[property];\n    };\n    var getMinXBounds = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, left);\n    };\n    var getMaxXBounds = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, right);\n    };\n    var getMinYBounds = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, top);\n    };\n    var getMaxYBounds = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, bottom);\n    };\n    var getXScreenRange = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, width);\n    };\n    var getYScreenRange = function (component) {\n      var bounds = getBounds(component);\n      return getBoundsProperty(bounds, height);\n    };\n    var getCenterOffsetOf = function (componentMinEdge, componentMaxEdge, spectrumMinEdge) {\n      return (componentMinEdge + componentMaxEdge) / 2 - spectrumMinEdge;\n    };\n    var getXCenterOffSetOf = function (component, spectrum) {\n      var componentBounds = getBounds(component);\n      var spectrumBounds = getBounds(spectrum);\n      var componentMinEdge = getBoundsProperty(componentBounds, left);\n      var componentMaxEdge = getBoundsProperty(componentBounds, right);\n      var spectrumMinEdge = getBoundsProperty(spectrumBounds, left);\n      return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge);\n    };\n    var getYCenterOffSetOf = function (component, spectrum) {\n      var componentBounds = getBounds(component);\n      var spectrumBounds = getBounds(spectrum);\n      var componentMinEdge = getBoundsProperty(componentBounds, top);\n      var componentMaxEdge = getBoundsProperty(componentBounds, bottom);\n      var spectrumMinEdge = getBoundsProperty(spectrumBounds, top);\n      return getCenterOffsetOf(componentMinEdge, componentMaxEdge, spectrumMinEdge);\n    };\n\n    var fireSliderChange$2 = function (spectrum, value) {\n      emitWith(spectrum, sliderChangeEvent(), { value: value });\n    };\n    var sliderValue$2 = function (x) {\n      return { x: x };\n    };\n    var findValueOfOffset$1 = function (spectrum, detail, left) {\n      var args = {\n        min: minX(detail),\n        max: maxX(detail),\n        range: xRange(detail),\n        value: left,\n        step: step(detail),\n        snap: snap(detail),\n        snapStart: snapStart(detail),\n        rounded: rounded(detail),\n        hasMinEdge: hasLEdge(detail),\n        hasMaxEdge: hasREdge(detail),\n        minBound: getMinXBounds(spectrum),\n        maxBound: getMaxXBounds(spectrum),\n        screenRange: getXScreenRange(spectrum)\n      };\n      return findValueOf(args);\n    };\n    var setValueFrom$2 = function (spectrum, detail, value) {\n      var xValue = findValueOfOffset$1(spectrum, detail, value);\n      var sliderVal = sliderValue$2(xValue);\n      fireSliderChange$2(spectrum, sliderVal);\n      return xValue;\n    };\n    var setToMin$2 = function (spectrum, detail) {\n      var min = minX(detail);\n      fireSliderChange$2(spectrum, sliderValue$2(min));\n    };\n    var setToMax$2 = function (spectrum, detail) {\n      var max = maxX(detail);\n      fireSliderChange$2(spectrum, sliderValue$2(max));\n    };\n    var moveBy$2 = function (direction, spectrum, detail) {\n      var f = direction > 0 ? increaseBy : reduceBy;\n      var xValue = f(currentValue(detail).x, minX(detail), maxX(detail), step(detail));\n      fireSliderChange$2(spectrum, sliderValue$2(xValue));\n      return Optional.some(xValue);\n    };\n    var handleMovement$2 = function (direction) {\n      return function (spectrum, detail) {\n        return moveBy$2(direction, spectrum, detail).map(always);\n      };\n    };\n    var getValueFromEvent$2 = function (simulatedEvent) {\n      var pos = getEventSource(simulatedEvent);\n      return pos.map(function (p) {\n        return p.left;\n      });\n    };\n    var findOffsetOfValue$1 = function (spectrum, detail, value, minEdge, maxEdge) {\n      var minOffset = 0;\n      var maxOffset = getXScreenRange(spectrum);\n      var centerMinEdge = minEdge.bind(function (edge) {\n        return Optional.some(getXCenterOffSetOf(edge, spectrum));\n      }).getOr(minOffset);\n      var centerMaxEdge = maxEdge.bind(function (edge) {\n        return Optional.some(getXCenterOffSetOf(edge, spectrum));\n      }).getOr(maxOffset);\n      var args = {\n        min: minX(detail),\n        max: maxX(detail),\n        range: xRange(detail),\n        value: value,\n        hasMinEdge: hasLEdge(detail),\n        hasMaxEdge: hasREdge(detail),\n        minBound: getMinXBounds(spectrum),\n        minOffset: minOffset,\n        maxBound: getMaxXBounds(spectrum),\n        maxOffset: maxOffset,\n        centerMinEdge: centerMinEdge,\n        centerMaxEdge: centerMaxEdge\n      };\n      return findOffsetOfValue$2(args);\n    };\n    var findPositionOfValue$1 = function (slider, spectrum, value, minEdge, maxEdge, detail) {\n      var offset = findOffsetOfValue$1(spectrum, detail, value, minEdge, maxEdge);\n      return getMinXBounds(spectrum) - getMinXBounds(slider) + offset;\n    };\n    var setPositionFromValue$2 = function (slider, thumb, detail, edges) {\n      var value = currentValue(detail);\n      var pos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);\n      var thumbRadius = get$a(thumb.element) / 2;\n      set$7(thumb.element, 'left', pos - thumbRadius + 'px');\n    };\n    var onLeft$2 = handleMovement$2(-1);\n    var onRight$2 = handleMovement$2(1);\n    var onUp$2 = Optional.none;\n    var onDown$2 = Optional.none;\n    var edgeActions$2 = {\n      'top-left': Optional.none(),\n      'top': Optional.none(),\n      'top-right': Optional.none(),\n      'right': Optional.some(setToREdge),\n      'bottom-right': Optional.none(),\n      'bottom': Optional.none(),\n      'bottom-left': Optional.none(),\n      'left': Optional.some(setToLEdge)\n    };\n\n    var HorizontalModel = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        setValueFrom: setValueFrom$2,\n        setToMin: setToMin$2,\n        setToMax: setToMax$2,\n        findValueOfOffset: findValueOfOffset$1,\n        getValueFromEvent: getValueFromEvent$2,\n        findPositionOfValue: findPositionOfValue$1,\n        setPositionFromValue: setPositionFromValue$2,\n        onLeft: onLeft$2,\n        onRight: onRight$2,\n        onUp: onUp$2,\n        onDown: onDown$2,\n        edgeActions: edgeActions$2\n    });\n\n    var fireSliderChange$1 = function (spectrum, value) {\n      emitWith(spectrum, sliderChangeEvent(), { value: value });\n    };\n    var sliderValue$1 = function (y) {\n      return { y: y };\n    };\n    var findValueOfOffset = function (spectrum, detail, top) {\n      var args = {\n        min: minY(detail),\n        max: maxY(detail),\n        range: yRange(detail),\n        value: top,\n        step: step(detail),\n        snap: snap(detail),\n        snapStart: snapStart(detail),\n        rounded: rounded(detail),\n        hasMinEdge: hasTEdge(detail),\n        hasMaxEdge: hasBEdge(detail),\n        minBound: getMinYBounds(spectrum),\n        maxBound: getMaxYBounds(spectrum),\n        screenRange: getYScreenRange(spectrum)\n      };\n      return findValueOf(args);\n    };\n    var setValueFrom$1 = function (spectrum, detail, value) {\n      var yValue = findValueOfOffset(spectrum, detail, value);\n      var sliderVal = sliderValue$1(yValue);\n      fireSliderChange$1(spectrum, sliderVal);\n      return yValue;\n    };\n    var setToMin$1 = function (spectrum, detail) {\n      var min = minY(detail);\n      fireSliderChange$1(spectrum, sliderValue$1(min));\n    };\n    var setToMax$1 = function (spectrum, detail) {\n      var max = maxY(detail);\n      fireSliderChange$1(spectrum, sliderValue$1(max));\n    };\n    var moveBy$1 = function (direction, spectrum, detail) {\n      var f = direction > 0 ? increaseBy : reduceBy;\n      var yValue = f(currentValue(detail).y, minY(detail), maxY(detail), step(detail));\n      fireSliderChange$1(spectrum, sliderValue$1(yValue));\n      return Optional.some(yValue);\n    };\n    var handleMovement$1 = function (direction) {\n      return function (spectrum, detail) {\n        return moveBy$1(direction, spectrum, detail).map(always);\n      };\n    };\n    var getValueFromEvent$1 = function (simulatedEvent) {\n      var pos = getEventSource(simulatedEvent);\n      return pos.map(function (p) {\n        return p.top;\n      });\n    };\n    var findOffsetOfValue = function (spectrum, detail, value, minEdge, maxEdge) {\n      var minOffset = 0;\n      var maxOffset = getYScreenRange(spectrum);\n      var centerMinEdge = minEdge.bind(function (edge) {\n        return Optional.some(getYCenterOffSetOf(edge, spectrum));\n      }).getOr(minOffset);\n      var centerMaxEdge = maxEdge.bind(function (edge) {\n        return Optional.some(getYCenterOffSetOf(edge, spectrum));\n      }).getOr(maxOffset);\n      var args = {\n        min: minY(detail),\n        max: maxY(detail),\n        range: yRange(detail),\n        value: value,\n        hasMinEdge: hasTEdge(detail),\n        hasMaxEdge: hasBEdge(detail),\n        minBound: getMinYBounds(spectrum),\n        minOffset: minOffset,\n        maxBound: getMaxYBounds(spectrum),\n        maxOffset: maxOffset,\n        centerMinEdge: centerMinEdge,\n        centerMaxEdge: centerMaxEdge\n      };\n      return findOffsetOfValue$2(args);\n    };\n    var findPositionOfValue = function (slider, spectrum, value, minEdge, maxEdge, detail) {\n      var offset = findOffsetOfValue(spectrum, detail, value, minEdge, maxEdge);\n      return getMinYBounds(spectrum) - getMinYBounds(slider) + offset;\n    };\n    var setPositionFromValue$1 = function (slider, thumb, detail, edges) {\n      var value = currentValue(detail);\n      var pos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);\n      var thumbRadius = get$b(thumb.element) / 2;\n      set$7(thumb.element, 'top', pos - thumbRadius + 'px');\n    };\n    var onLeft$1 = Optional.none;\n    var onRight$1 = Optional.none;\n    var onUp$1 = handleMovement$1(-1);\n    var onDown$1 = handleMovement$1(1);\n    var edgeActions$1 = {\n      'top-left': Optional.none(),\n      'top': Optional.some(setToTEdge),\n      'top-right': Optional.none(),\n      'right': Optional.none(),\n      'bottom-right': Optional.none(),\n      'bottom': Optional.some(setToBEdge),\n      'bottom-left': Optional.none(),\n      'left': Optional.none()\n    };\n\n    var VerticalModel = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        setValueFrom: setValueFrom$1,\n        setToMin: setToMin$1,\n        setToMax: setToMax$1,\n        findValueOfOffset: findValueOfOffset,\n        getValueFromEvent: getValueFromEvent$1,\n        findPositionOfValue: findPositionOfValue,\n        setPositionFromValue: setPositionFromValue$1,\n        onLeft: onLeft$1,\n        onRight: onRight$1,\n        onUp: onUp$1,\n        onDown: onDown$1,\n        edgeActions: edgeActions$1\n    });\n\n    var fireSliderChange = function (spectrum, value) {\n      emitWith(spectrum, sliderChangeEvent(), { value: value });\n    };\n    var sliderValue = function (x, y) {\n      return {\n        x: x,\n        y: y\n      };\n    };\n    var setValueFrom = function (spectrum, detail, value) {\n      var xValue = findValueOfOffset$1(spectrum, detail, value.left);\n      var yValue = findValueOfOffset(spectrum, detail, value.top);\n      var val = sliderValue(xValue, yValue);\n      fireSliderChange(spectrum, val);\n      return val;\n    };\n    var moveBy = function (direction, isVerticalMovement, spectrum, detail) {\n      var f = direction > 0 ? increaseBy : reduceBy;\n      var xValue = isVerticalMovement ? currentValue(detail).x : f(currentValue(detail).x, minX(detail), maxX(detail), step(detail));\n      var yValue = !isVerticalMovement ? currentValue(detail).y : f(currentValue(detail).y, minY(detail), maxY(detail), step(detail));\n      fireSliderChange(spectrum, sliderValue(xValue, yValue));\n      return Optional.some(xValue);\n    };\n    var handleMovement = function (direction, isVerticalMovement) {\n      return function (spectrum, detail) {\n        return moveBy(direction, isVerticalMovement, spectrum, detail).map(always);\n      };\n    };\n    var setToMin = function (spectrum, detail) {\n      var mX = minX(detail);\n      var mY = minY(detail);\n      fireSliderChange(spectrum, sliderValue(mX, mY));\n    };\n    var setToMax = function (spectrum, detail) {\n      var mX = maxX(detail);\n      var mY = maxY(detail);\n      fireSliderChange(spectrum, sliderValue(mX, mY));\n    };\n    var getValueFromEvent = function (simulatedEvent) {\n      return getEventSource(simulatedEvent);\n    };\n    var setPositionFromValue = function (slider, thumb, detail, edges) {\n      var value = currentValue(detail);\n      var xPos = findPositionOfValue$1(slider, edges.getSpectrum(slider), value.x, edges.getLeftEdge(slider), edges.getRightEdge(slider), detail);\n      var yPos = findPositionOfValue(slider, edges.getSpectrum(slider), value.y, edges.getTopEdge(slider), edges.getBottomEdge(slider), detail);\n      var thumbXRadius = get$a(thumb.element) / 2;\n      var thumbYRadius = get$b(thumb.element) / 2;\n      set$7(thumb.element, 'left', xPos - thumbXRadius + 'px');\n      set$7(thumb.element, 'top', yPos - thumbYRadius + 'px');\n    };\n    var onLeft = handleMovement(-1, false);\n    var onRight = handleMovement(1, false);\n    var onUp = handleMovement(-1, true);\n    var onDown = handleMovement(1, true);\n    var edgeActions = {\n      'top-left': Optional.some(setToTLEdgeXY),\n      'top': Optional.some(setToTEdgeXY),\n      'top-right': Optional.some(setToTREdgeXY),\n      'right': Optional.some(setToREdgeXY),\n      'bottom-right': Optional.some(setToBREdgeXY),\n      'bottom': Optional.some(setToBEdgeXY),\n      'bottom-left': Optional.some(setToBLEdgeXY),\n      'left': Optional.some(setToLEdgeXY)\n    };\n\n    var TwoDModel = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        setValueFrom: setValueFrom,\n        setToMin: setToMin,\n        setToMax: setToMax,\n        getValueFromEvent: getValueFromEvent,\n        setPositionFromValue: setPositionFromValue,\n        onLeft: onLeft,\n        onRight: onRight,\n        onUp: onUp,\n        onDown: onDown,\n        edgeActions: edgeActions\n    });\n\n    var SliderSchema = [\n      defaulted('stepSize', 1),\n      defaulted('onChange', noop),\n      defaulted('onChoose', noop),\n      defaulted('onInit', noop),\n      defaulted('onDragStart', noop),\n      defaulted('onDragEnd', noop),\n      defaulted('snapToGrid', false),\n      defaulted('rounded', true),\n      option('snapStart'),\n      requiredOf('model', choose$1('mode', {\n        x: [\n          defaulted('minX', 0),\n          defaulted('maxX', 100),\n          customField('value', function (spec) {\n            return Cell(spec.mode.minX);\n          }),\n          required$1('getInitialValue'),\n          output$1('manager', HorizontalModel)\n        ],\n        y: [\n          defaulted('minY', 0),\n          defaulted('maxY', 100),\n          customField('value', function (spec) {\n            return Cell(spec.mode.minY);\n          }),\n          required$1('getInitialValue'),\n          output$1('manager', VerticalModel)\n        ],\n        xy: [\n          defaulted('minX', 0),\n          defaulted('maxX', 100),\n          defaulted('minY', 0),\n          defaulted('maxY', 100),\n          customField('value', function (spec) {\n            return Cell({\n              x: spec.mode.minX,\n              y: spec.mode.minY\n            });\n          }),\n          required$1('getInitialValue'),\n          output$1('manager', TwoDModel)\n        ]\n      })),\n      field('sliderBehaviours', [\n        Keying,\n        Representing\n      ]),\n      customField('mouseIsDown', function () {\n        return Cell(false);\n      })\n    ];\n\n    var sketch$2 = function (detail, components, _spec, _externals) {\n      var _a;\n      var getThumb = function (component) {\n        return getPartOrDie(component, detail, 'thumb');\n      };\n      var getSpectrum = function (component) {\n        return getPartOrDie(component, detail, 'spectrum');\n      };\n      var getLeftEdge = function (component) {\n        return getPart(component, detail, 'left-edge');\n      };\n      var getRightEdge = function (component) {\n        return getPart(component, detail, 'right-edge');\n      };\n      var getTopEdge = function (component) {\n        return getPart(component, detail, 'top-edge');\n      };\n      var getBottomEdge = function (component) {\n        return getPart(component, detail, 'bottom-edge');\n      };\n      var modelDetail = detail.model;\n      var model = modelDetail.manager;\n      var refresh = function (slider, thumb) {\n        model.setPositionFromValue(slider, thumb, detail, {\n          getLeftEdge: getLeftEdge,\n          getRightEdge: getRightEdge,\n          getTopEdge: getTopEdge,\n          getBottomEdge: getBottomEdge,\n          getSpectrum: getSpectrum\n        });\n      };\n      var setValue = function (slider, newValue) {\n        modelDetail.value.set(newValue);\n        var thumb = getThumb(slider);\n        refresh(slider, thumb);\n      };\n      var changeValue = function (slider, newValue) {\n        setValue(slider, newValue);\n        var thumb = getThumb(slider);\n        detail.onChange(slider, thumb, newValue);\n        return Optional.some(true);\n      };\n      var resetToMin = function (slider) {\n        model.setToMin(slider, detail);\n      };\n      var resetToMax = function (slider) {\n        model.setToMax(slider, detail);\n      };\n      var choose = function (slider) {\n        var fireOnChoose = function () {\n          getPart(slider, detail, 'thumb').each(function (thumb) {\n            var value = modelDetail.value.get();\n            detail.onChoose(slider, thumb, value);\n          });\n        };\n        var wasDown = detail.mouseIsDown.get();\n        detail.mouseIsDown.set(false);\n        if (wasDown) {\n          fireOnChoose();\n        }\n      };\n      var onDragStart = function (slider, simulatedEvent) {\n        simulatedEvent.stop();\n        detail.mouseIsDown.set(true);\n        detail.onDragStart(slider, getThumb(slider));\n      };\n      var onDragEnd = function (slider, simulatedEvent) {\n        simulatedEvent.stop();\n        detail.onDragEnd(slider, getThumb(slider));\n        choose(slider);\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.sliderBehaviours, [\n          Keying.config({\n            mode: 'special',\n            focusIn: function (slider) {\n              return getPart(slider, detail, 'spectrum').map(Keying.focusIn).map(always);\n            }\n          }),\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function (_) {\n                return modelDetail.value.get();\n              }\n            }\n          }),\n          Receiving.config({ channels: (_a = {}, _a[mouseReleased()] = { onReceive: choose }, _a) })\n        ]),\n        events: derive$2([\n          run$1(sliderChangeEvent(), function (slider, simulatedEvent) {\n            changeValue(slider, simulatedEvent.event.value);\n          }),\n          runOnAttached(function (slider, _simulatedEvent) {\n            var getInitial = modelDetail.getInitialValue();\n            modelDetail.value.set(getInitial);\n            var thumb = getThumb(slider);\n            refresh(slider, thumb);\n            var spectrum = getSpectrum(slider);\n            detail.onInit(slider, thumb, spectrum, modelDetail.value.get());\n          }),\n          run$1(touchstart(), onDragStart),\n          run$1(touchend(), onDragEnd),\n          run$1(mousedown(), onDragStart),\n          run$1(mouseup(), onDragEnd)\n        ]),\n        apis: {\n          resetToMin: resetToMin,\n          resetToMax: resetToMax,\n          setValue: setValue,\n          refresh: refresh\n        },\n        domModification: { styles: { position: 'relative' } }\n      };\n    };\n\n    var Slider = composite({\n      name: 'Slider',\n      configFields: SliderSchema,\n      partFields: SliderParts,\n      factory: sketch$2,\n      apis: {\n        setValue: function (apis, slider, value) {\n          apis.setValue(slider, value);\n        },\n        resetToMin: function (apis, slider) {\n          apis.resetToMin(slider);\n        },\n        resetToMax: function (apis, slider) {\n          apis.resetToMax(slider);\n        },\n        refresh: function (apis, slider) {\n          apis.refresh(slider);\n        }\n      }\n    });\n\n    var fieldsUpdate = generate$6('rgb-hex-update');\n    var sliderUpdate = generate$6('slider-update');\n    var paletteUpdate = generate$6('palette-update');\n\n    var sliderFactory = function (translate, getClass) {\n      var spectrum = Slider.parts.spectrum({\n        dom: {\n          tag: 'div',\n          classes: [getClass('hue-slider-spectrum')],\n          attributes: { role: 'presentation' }\n        }\n      });\n      var thumb = Slider.parts.thumb({\n        dom: {\n          tag: 'div',\n          classes: [getClass('hue-slider-thumb')],\n          attributes: { role: 'presentation' }\n        }\n      });\n      return Slider.sketch({\n        dom: {\n          tag: 'div',\n          classes: [getClass('hue-slider')],\n          attributes: { role: 'presentation' }\n        },\n        rounded: false,\n        model: {\n          mode: 'y',\n          getInitialValue: constant$1({ y: 0 })\n        },\n        components: [\n          spectrum,\n          thumb\n        ],\n        sliderBehaviours: derive$1([Focusing.config({})]),\n        onChange: function (slider, _thumb, value) {\n          emitWith(slider, sliderUpdate, { value: value });\n        }\n      });\n    };\n\n    var owner$1 = 'form';\n    var schema$i = [field('formBehaviours', [Representing])];\n    var getPartName$1 = function (name) {\n      return '<alloy.field.' + name + '>';\n    };\n    var sketch$1 = function (fSpec) {\n      var parts = function () {\n        var record = [];\n        var field = function (name, config) {\n          record.push(name);\n          return generateOne$1(owner$1, getPartName$1(name), config);\n        };\n        return {\n          field: field,\n          record: constant$1(record)\n        };\n      }();\n      var spec = fSpec(parts);\n      var partNames = parts.record();\n      var fieldParts = map$2(partNames, function (n) {\n        return required({\n          name: n,\n          pname: getPartName$1(n)\n        });\n      });\n      return composite$1(owner$1, schema$i, fieldParts, make$4, spec);\n    };\n    var toResult = function (o, e) {\n      return o.fold(function () {\n        return Result.error(e);\n      }, Result.value);\n    };\n    var make$4 = function (detail, components) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.formBehaviours, [Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function (form) {\n                var resPs = getAllParts(form, detail);\n                return map$1(resPs, function (resPThunk, pName) {\n                  return resPThunk().bind(function (v) {\n                    var opt = Composing.getCurrent(v);\n                    return toResult(opt, new Error('Cannot find a current component to extract the value from for form part \\'' + pName + '\\': ' + element(v.element)));\n                  }).map(Representing.getValue);\n                });\n              },\n              setValue: function (form, values) {\n                each(values, function (newValue, key) {\n                  getPart(form, detail, key).each(function (wrapper) {\n                    Composing.getCurrent(wrapper).each(function (field) {\n                      Representing.setValue(field, newValue);\n                    });\n                  });\n                });\n              }\n            }\n          })]),\n        apis: {\n          getField: function (form, key) {\n            return getPart(form, detail, key).bind(Composing.getCurrent);\n          }\n        }\n      };\n    };\n    var Form = {\n      getField: makeApi(function (apis, component, key) {\n        return apis.getField(component, key);\n      }),\n      sketch: sketch$1\n    };\n\n    var validInput = generate$6('valid-input');\n    var invalidInput = generate$6('invalid-input');\n    var validatingInput = generate$6('validating-input');\n    var translatePrefix = 'colorcustom.rgb.';\n    var rgbFormFactory = function (translate, getClass, onValidHexx, onInvalidHexx) {\n      var invalidation = function (label, isValid) {\n        return Invalidating.config({\n          invalidClass: getClass('invalid'),\n          notify: {\n            onValidate: function (comp) {\n              emitWith(comp, validatingInput, { type: label });\n            },\n            onValid: function (comp) {\n              emitWith(comp, validInput, {\n                type: label,\n                value: Representing.getValue(comp)\n              });\n            },\n            onInvalid: function (comp) {\n              emitWith(comp, invalidInput, {\n                type: label,\n                value: Representing.getValue(comp)\n              });\n            }\n          },\n          validator: {\n            validate: function (comp) {\n              var value = Representing.getValue(comp);\n              var res = isValid(value) ? Result.value(true) : Result.error(translate('aria.input.invalid'));\n              return Future.pure(res);\n            },\n            validateOnLoad: false\n          }\n        });\n      };\n      var renderTextField = function (isValid, name, label, description, data) {\n        var helptext = translate(translatePrefix + 'range');\n        var pLabel = FormField.parts.label({\n          dom: {\n            tag: 'label',\n            innerHtml: label,\n            attributes: { 'aria-label': description }\n          }\n        });\n        var pField = FormField.parts.field({\n          data: data,\n          factory: Input,\n          inputAttributes: __assign({ type: 'text' }, name === 'hex' ? { 'aria-live': 'polite' } : {}),\n          inputClasses: [getClass('textfield')],\n          inputBehaviours: derive$1([\n            invalidation(name, isValid),\n            Tabstopping.config({})\n          ]),\n          onSetValue: function (input) {\n            if (Invalidating.isInvalid(input)) {\n              var run = Invalidating.run(input);\n              run.get(noop);\n            }\n          }\n        });\n        var comps = [\n          pLabel,\n          pField\n        ];\n        var concats = name !== 'hex' ? [FormField.parts['aria-descriptor']({ text: helptext })] : [];\n        var components = comps.concat(concats);\n        return {\n          dom: {\n            tag: 'div',\n            attributes: { role: 'presentation' }\n          },\n          components: components\n        };\n      };\n      var copyRgbToHex = function (form, rgba) {\n        var hex = fromRgba(rgba);\n        Form.getField(form, 'hex').each(function (hexField) {\n          if (!Focusing.isFocused(hexField)) {\n            Representing.setValue(form, { hex: hex.value });\n          }\n        });\n        return hex;\n      };\n      var copyRgbToForm = function (form, rgb) {\n        var red = rgb.red;\n        var green = rgb.green;\n        var blue = rgb.blue;\n        Representing.setValue(form, {\n          red: red,\n          green: green,\n          blue: blue\n        });\n      };\n      var memPreview = record({\n        dom: {\n          tag: 'div',\n          classes: [getClass('rgba-preview')],\n          styles: { 'background-color': 'white' },\n          attributes: { role: 'presentation' }\n        }\n      });\n      var updatePreview = function (anyInSystem, hex) {\n        memPreview.getOpt(anyInSystem).each(function (preview) {\n          set$7(preview.element, 'background-color', '#' + hex.value);\n        });\n      };\n      var factory = function () {\n        var state = {\n          red: Cell(Optional.some(255)),\n          green: Cell(Optional.some(255)),\n          blue: Cell(Optional.some(255)),\n          hex: Cell(Optional.some('ffffff'))\n        };\n        var copyHexToRgb = function (form, hex) {\n          var rgb = fromHex(hex);\n          copyRgbToForm(form, rgb);\n          setValueRgb(rgb);\n        };\n        var get = function (prop) {\n          return state[prop].get();\n        };\n        var set = function (prop, value) {\n          state[prop].set(value);\n        };\n        var getValueRgb = function () {\n          return get('red').bind(function (red) {\n            return get('green').bind(function (green) {\n              return get('blue').map(function (blue) {\n                return rgbaColour(red, green, blue, 1);\n              });\n            });\n          });\n        };\n        var setValueRgb = function (rgb) {\n          var red = rgb.red;\n          var green = rgb.green;\n          var blue = rgb.blue;\n          set('red', Optional.some(red));\n          set('green', Optional.some(green));\n          set('blue', Optional.some(blue));\n        };\n        var onInvalidInput = function (form, simulatedEvent) {\n          var data = simulatedEvent.event;\n          if (data.type !== 'hex') {\n            set(data.type, Optional.none());\n          } else {\n            onInvalidHexx(form);\n          }\n        };\n        var onValidHex = function (form, value) {\n          onValidHexx(form);\n          var hex = hexColour(value);\n          set('hex', Optional.some(value));\n          var rgb = fromHex(hex);\n          copyRgbToForm(form, rgb);\n          setValueRgb(rgb);\n          emitWith(form, fieldsUpdate, { hex: hex });\n          updatePreview(form, hex);\n        };\n        var onValidRgb = function (form, prop, value) {\n          var val = parseInt(value, 10);\n          set(prop, Optional.some(val));\n          getValueRgb().each(function (rgb) {\n            var hex = copyRgbToHex(form, rgb);\n            emitWith(form, fieldsUpdate, { hex: hex });\n            updatePreview(form, hex);\n          });\n        };\n        var isHexInputEvent = function (data) {\n          return data.type === 'hex';\n        };\n        var onValidInput = function (form, simulatedEvent) {\n          var data = simulatedEvent.event;\n          if (isHexInputEvent(data)) {\n            onValidHex(form, data.value);\n          } else {\n            onValidRgb(form, data.type, data.value);\n          }\n        };\n        var formPartStrings = function (key) {\n          return {\n            label: translate(translatePrefix + key + '.label'),\n            description: translate(translatePrefix + key + '.description')\n          };\n        };\n        var redStrings = formPartStrings('red');\n        var greenStrings = formPartStrings('green');\n        var blueStrings = formPartStrings('blue');\n        var hexStrings = formPartStrings('hex');\n        return deepMerge(Form.sketch(function (parts) {\n          return {\n            dom: {\n              tag: 'form',\n              classes: [getClass('rgb-form')],\n              attributes: { 'aria-label': translate('aria.color.picker') }\n            },\n            components: [\n              parts.field('red', FormField.sketch(renderTextField(isRgbaComponent, 'red', redStrings.label, redStrings.description, 255))),\n              parts.field('green', FormField.sketch(renderTextField(isRgbaComponent, 'green', greenStrings.label, greenStrings.description, 255))),\n              parts.field('blue', FormField.sketch(renderTextField(isRgbaComponent, 'blue', blueStrings.label, blueStrings.description, 255))),\n              parts.field('hex', FormField.sketch(renderTextField(isHexString, 'hex', hexStrings.label, hexStrings.description, 'ffffff'))),\n              memPreview.asSpec()\n            ],\n            formBehaviours: derive$1([\n              Invalidating.config({ invalidClass: getClass('form-invalid') }),\n              config('rgb-form-events', [\n                run$1(validInput, onValidInput),\n                run$1(invalidInput, onInvalidInput),\n                run$1(validatingInput, onInvalidInput)\n              ])\n            ])\n          };\n        }), {\n          apis: {\n            updateHex: function (form, hex) {\n              Representing.setValue(form, { hex: hex.value });\n              copyHexToRgb(form, hex);\n              updatePreview(form, hex);\n            }\n          }\n        });\n      };\n      var rgbFormSketcher = single({\n        factory: factory,\n        name: 'RgbForm',\n        configFields: [],\n        apis: {\n          updateHex: function (apis, form, hex) {\n            apis.updateHex(form, hex);\n          }\n        },\n        extraApis: {}\n      });\n      return rgbFormSketcher;\n    };\n\n    var paletteFactory = function (_translate, getClass) {\n      var spectrumPart = Slider.parts.spectrum({\n        dom: {\n          tag: 'canvas',\n          attributes: { role: 'presentation' },\n          classes: [getClass('sv-palette-spectrum')]\n        }\n      });\n      var thumbPart = Slider.parts.thumb({\n        dom: {\n          tag: 'div',\n          attributes: { role: 'presentation' },\n          classes: [getClass('sv-palette-thumb')],\n          innerHtml: '<div class=' + getClass('sv-palette-inner-thumb') + ' role=\"presentation\"></div>'\n        }\n      });\n      var setColour = function (canvas, rgba) {\n        var width = canvas.width, height = canvas.height;\n        var ctx = canvas.getContext('2d');\n        if (ctx === null) {\n          return;\n        }\n        ctx.fillStyle = rgba;\n        ctx.fillRect(0, 0, width, height);\n        var grdWhite = ctx.createLinearGradient(0, 0, width, 0);\n        grdWhite.addColorStop(0, 'rgba(255,255,255,1)');\n        grdWhite.addColorStop(1, 'rgba(255,255,255,0)');\n        ctx.fillStyle = grdWhite;\n        ctx.fillRect(0, 0, width, height);\n        var grdBlack = ctx.createLinearGradient(0, 0, 0, height);\n        grdBlack.addColorStop(0, 'rgba(0,0,0,0)');\n        grdBlack.addColorStop(1, 'rgba(0,0,0,1)');\n        ctx.fillStyle = grdBlack;\n        ctx.fillRect(0, 0, width, height);\n      };\n      var setPaletteHue = function (slider, hue) {\n        var canvas = slider.components()[0].element.dom;\n        var hsv = hsvColour(hue, 100, 100);\n        var rgba = fromHsv(hsv);\n        setColour(canvas, toString(rgba));\n      };\n      var setPaletteThumb = function (slider, hex) {\n        var hsv = fromRgb(fromHex(hex));\n        Slider.setValue(slider, {\n          x: hsv.saturation,\n          y: 100 - hsv.value\n        });\n      };\n      var factory = function (_detail) {\n        var getInitialValue = constant$1({\n          x: 0,\n          y: 0\n        });\n        var onChange = function (slider, _thumb, value) {\n          emitWith(slider, paletteUpdate, { value: value });\n        };\n        var onInit = function (_slider, _thumb, spectrum, _value) {\n          setColour(spectrum.element.dom, toString(red));\n        };\n        var sliderBehaviours = derive$1([\n          Composing.config({ find: Optional.some }),\n          Focusing.config({})\n        ]);\n        return Slider.sketch({\n          dom: {\n            tag: 'div',\n            attributes: { role: 'presentation' },\n            classes: [getClass('sv-palette')]\n          },\n          model: {\n            mode: 'xy',\n            getInitialValue: getInitialValue\n          },\n          rounded: false,\n          components: [\n            spectrumPart,\n            thumbPart\n          ],\n          onChange: onChange,\n          onInit: onInit,\n          sliderBehaviours: sliderBehaviours\n        });\n      };\n      var saturationBrightnessPaletteSketcher = single({\n        factory: factory,\n        name: 'SaturationBrightnessPalette',\n        configFields: [],\n        apis: {\n          setHue: function (_apis, slider, hue) {\n            setPaletteHue(slider, hue);\n          },\n          setThumb: function (_apis, slider, hex) {\n            setPaletteThumb(slider, hex);\n          }\n        },\n        extraApis: {}\n      });\n      return saturationBrightnessPaletteSketcher;\n    };\n\n    var makeFactory = function (translate, getClass) {\n      var factory = function (detail) {\n        var rgbForm = rgbFormFactory(translate, getClass, detail.onValidHex, detail.onInvalidHex);\n        var sbPalette = paletteFactory(translate, getClass);\n        var hueSliderToDegrees = function (hue) {\n          return (100 - hue) / 100 * 360;\n        };\n        var hueDegreesToSlider = function (hue) {\n          return 100 - hue / 360 * 100;\n        };\n        var state = {\n          paletteRgba: Cell(red),\n          paletteHue: Cell(0)\n        };\n        var memSlider = record(sliderFactory(translate, getClass));\n        var memPalette = record(sbPalette.sketch({}));\n        var memRgb = record(rgbForm.sketch({}));\n        var updatePalette = function (anyInSystem, _hex, hue) {\n          memPalette.getOpt(anyInSystem).each(function (palette) {\n            sbPalette.setHue(palette, hue);\n          });\n        };\n        var updateFields = function (anyInSystem, hex) {\n          memRgb.getOpt(anyInSystem).each(function (form) {\n            rgbForm.updateHex(form, hex);\n          });\n        };\n        var updateSlider = function (anyInSystem, _hex, hue) {\n          memSlider.getOpt(anyInSystem).each(function (slider) {\n            Slider.setValue(slider, { y: hueDegreesToSlider(hue) });\n          });\n        };\n        var updatePaletteThumb = function (anyInSystem, hex) {\n          memPalette.getOpt(anyInSystem).each(function (palette) {\n            sbPalette.setThumb(palette, hex);\n          });\n        };\n        var updateState = function (hex, hue) {\n          var rgba = fromHex(hex);\n          state.paletteRgba.set(rgba);\n          state.paletteHue.set(hue);\n        };\n        var runUpdates = function (anyInSystem, hex, hue, updates) {\n          updateState(hex, hue);\n          each$1(updates, function (update) {\n            update(anyInSystem, hex, hue);\n          });\n        };\n        var onPaletteUpdate = function () {\n          var updates = [updateFields];\n          return function (form, simulatedEvent) {\n            var value = simulatedEvent.event.value;\n            var oldHue = state.paletteHue.get();\n            var newHsv = hsvColour(oldHue, value.x, 100 - value.y);\n            var newHex = hsvToHex(newHsv);\n            runUpdates(form, newHex, oldHue, updates);\n          };\n        };\n        var onSliderUpdate = function () {\n          var updates = [\n            updatePalette,\n            updateFields\n          ];\n          return function (form, simulatedEvent) {\n            var hue = hueSliderToDegrees(simulatedEvent.event.value.y);\n            var oldRgb = state.paletteRgba.get();\n            var oldHsv = fromRgb(oldRgb);\n            var newHsv = hsvColour(hue, oldHsv.saturation, oldHsv.value);\n            var newHex = hsvToHex(newHsv);\n            runUpdates(form, newHex, hue, updates);\n          };\n        };\n        var onFieldsUpdate = function () {\n          var updates = [\n            updatePalette,\n            updateSlider,\n            updatePaletteThumb\n          ];\n          return function (form, simulatedEvent) {\n            var hex = simulatedEvent.event.hex;\n            var hsv = hexToHsv(hex);\n            runUpdates(form, hex, hsv.hue, updates);\n          };\n        };\n        return {\n          uid: detail.uid,\n          dom: detail.dom,\n          components: [\n            memPalette.asSpec(),\n            memSlider.asSpec(),\n            memRgb.asSpec()\n          ],\n          behaviours: derive$1([\n            config('colour-picker-events', [\n              run$1(fieldsUpdate, onFieldsUpdate()),\n              run$1(paletteUpdate, onPaletteUpdate()),\n              run$1(sliderUpdate, onSliderUpdate())\n            ]),\n            Composing.config({\n              find: function (comp) {\n                return memRgb.getOpt(comp);\n              }\n            }),\n            Keying.config({ mode: 'acyclic' })\n          ])\n        };\n      };\n      var colourPickerSketcher = single({\n        name: 'ColourPicker',\n        configFields: [\n          required$1('dom'),\n          defaulted('onValidHex', noop),\n          defaulted('onInvalidHex', noop)\n        ],\n        factory: factory\n      });\n      return colourPickerSketcher;\n    };\n\n    var self$1 = function () {\n      return Composing.config({ find: Optional.some });\n    };\n    var memento$1 = function (mem) {\n      return Composing.config({ find: mem.getOpt });\n    };\n    var childAt = function (index) {\n      return Composing.config({\n        find: function (comp) {\n          return child$2(comp.element, index).bind(function (element) {\n            return comp.getSystem().getByDom(element).toOptional();\n          });\n        }\n      });\n    };\n    var ComposingConfigs = {\n      self: self$1,\n      memento: memento$1,\n      childAt: childAt\n    };\n\n    var english = {\n      'colorcustom.rgb.red.label': 'R',\n      'colorcustom.rgb.red.description': 'Red component',\n      'colorcustom.rgb.green.label': 'G',\n      'colorcustom.rgb.green.description': 'Green component',\n      'colorcustom.rgb.blue.label': 'B',\n      'colorcustom.rgb.blue.description': 'Blue component',\n      'colorcustom.rgb.hex.label': '#',\n      'colorcustom.rgb.hex.description': 'Hex color code',\n      'colorcustom.rgb.range': 'Range 0 to 255',\n      'colorcustom.sb.saturation': 'Saturation',\n      'colorcustom.sb.brightness': 'Brightness',\n      'colorcustom.sb.picker': 'Saturation and Brightness Picker',\n      'colorcustom.sb.palette': 'Saturation and Brightness Palette',\n      'colorcustom.sb.instructions': 'Use arrow keys to select saturation and brightness, on x and y axes',\n      'colorcustom.hue.hue': 'Hue',\n      'colorcustom.hue.slider': 'Hue Slider',\n      'colorcustom.hue.palette': 'Hue Palette',\n      'colorcustom.hue.instructions': 'Use arrow keys to select a hue',\n      'aria.color.picker': 'Color Picker',\n      'aria.input.invalid': 'Invalid input'\n    };\n    var getEnglishText = function (key) {\n      return english[key];\n    };\n    var translate$1 = function (key) {\n      return getEnglishText(key);\n    };\n    var renderColorPicker = function (_spec) {\n      var getClass = function (key) {\n        return 'tox-' + key;\n      };\n      var colourPickerFactory = makeFactory(translate$1, getClass);\n      var onValidHex = function (form) {\n        emitWith(form, formActionEvent, {\n          name: 'hex-valid',\n          value: true\n        });\n      };\n      var onInvalidHex = function (form) {\n        emitWith(form, formActionEvent, {\n          name: 'hex-valid',\n          value: false\n        });\n      };\n      var memPicker = record(colourPickerFactory.sketch({\n        dom: {\n          tag: 'div',\n          classes: [getClass('color-picker-container')],\n          attributes: { role: 'presentation' }\n        },\n        onValidHex: onValidHex,\n        onInvalidHex: onInvalidHex\n      }));\n      return {\n        dom: { tag: 'div' },\n        components: [memPicker.asSpec()],\n        behaviours: derive$1([\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function (comp) {\n                var picker = memPicker.get(comp);\n                var optRgbForm = Composing.getCurrent(picker);\n                var optHex = optRgbForm.bind(function (rgbForm) {\n                  var formValues = Representing.getValue(rgbForm);\n                  return formValues.hex;\n                });\n                return optHex.map(function (hex) {\n                  return '#' + hex;\n                }).getOr('');\n              },\n              setValue: function (comp, newValue) {\n                var pattern = /^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/;\n                var m = pattern.exec(newValue);\n                var picker = memPicker.get(comp);\n                var optRgbForm = Composing.getCurrent(picker);\n                optRgbForm.fold(function () {\n                  console.log('Can not find form');\n                }, function (rgbForm) {\n                  Representing.setValue(rgbForm, { hex: Optional.from(m[1]).getOr('') });\n                  Form.getField(rgbForm, 'hex').each(function (hexField) {\n                    emit(hexField, input());\n                  });\n                });\n              }\n            }\n          }),\n          ComposingConfigs.self()\n        ])\n      };\n    };\n\n    var global$6 = tinymce.util.Tools.resolve('tinymce.Resource');\n\n    var isOldCustomEditor = function (spec) {\n      return has$2(spec, 'init');\n    };\n    var renderCustomEditor = function (spec) {\n      var editorApi = value$1();\n      var memReplaced = record({ dom: { tag: spec.tag } });\n      var initialValue = value$1();\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-custom-editor']\n        },\n        behaviours: derive$1([\n          config('custom-editor-events', [runOnAttached(function (component) {\n              memReplaced.getOpt(component).each(function (ta) {\n                (isOldCustomEditor(spec) ? spec.init(ta.element.dom) : global$6.load(spec.scriptId, spec.scriptUrl).then(function (init) {\n                  return init(ta.element.dom, spec.settings);\n                })).then(function (ea) {\n                  initialValue.on(function (cvalue) {\n                    ea.setValue(cvalue);\n                  });\n                  initialValue.clear();\n                  editorApi.set(ea);\n                });\n              });\n            })]),\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function () {\n                return editorApi.get().fold(function () {\n                  return initialValue.get().getOr('');\n                }, function (ed) {\n                  return ed.getValue();\n                });\n              },\n              setValue: function (component, value) {\n                editorApi.get().fold(function () {\n                  initialValue.set(value);\n                }, function (ed) {\n                  return ed.setValue(value);\n                });\n              }\n            }\n          }),\n          ComposingConfigs.self()\n        ]),\n        components: [memReplaced.asSpec()]\n      };\n    };\n\n    var global$5 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var processors = objOf([\n      defaulted('preprocess', identity$1),\n      defaulted('postprocess', identity$1)\n    ]);\n    var memento = function (mem, rawProcessors) {\n      var ps = asRawOrDie$1('RepresentingConfigs.memento processors', processors, rawProcessors);\n      return Representing.config({\n        store: {\n          mode: 'manual',\n          getValue: function (comp) {\n            var other = mem.get(comp);\n            var rawValue = Representing.getValue(other);\n            return ps.postprocess(rawValue);\n          },\n          setValue: function (comp, rawValue) {\n            var newValue = ps.preprocess(rawValue);\n            var other = mem.get(comp);\n            Representing.setValue(other, newValue);\n          }\n        }\n      });\n    };\n    var withComp = function (optInitialValue, getter, setter) {\n      return Representing.config(deepMerge({\n        store: {\n          mode: 'manual',\n          getValue: getter,\n          setValue: setter\n        }\n      }, optInitialValue.map(function (initialValue) {\n        return { store: { initialValue: initialValue } };\n      }).getOr({})));\n    };\n    var withElement = function (initialValue, getter, setter) {\n      return withComp(initialValue, function (c) {\n        return getter(c.element);\n      }, function (c, v) {\n        return setter(c.element, v);\n      });\n    };\n    var domValue = function (optInitialValue) {\n      return withElement(optInitialValue, get$5, set$4);\n    };\n    var domHtml = function (optInitialValue) {\n      return withElement(optInitialValue, get$7, set$5);\n    };\n    var memory = function (initialValue) {\n      return Representing.config({\n        store: {\n          mode: 'memory',\n          initialValue: initialValue\n        }\n      });\n    };\n    var RepresentingConfigs = {\n      memento: memento,\n      withElement: withElement,\n      withComp: withComp,\n      domValue: domValue,\n      domHtml: domHtml,\n      memory: memory\n    };\n\n    var defaultImageFileTypes = 'jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp';\n    var filterByExtension = function (files, providersBackstage) {\n      var allowedImageFileTypes = global$5.explode(providersBackstage.getSetting('images_file_types', defaultImageFileTypes, 'string'));\n      var isFileInAllowedTypes = function (file) {\n        return exists(allowedImageFileTypes, function (type) {\n          return endsWith(file.name.toLowerCase(), '.' + type.toLowerCase());\n        });\n      };\n      return filter$2(from(files), isFileInAllowedTypes);\n    };\n    var renderDropZone = function (spec, providersBackstage) {\n      var stopper = function (_, se) {\n        se.stop();\n      };\n      var sequence = function (actions) {\n        return function (comp, se) {\n          each$1(actions, function (a) {\n            a(comp, se);\n          });\n        };\n      };\n      var onDrop = function (comp, se) {\n        if (!Disabling.isDisabled(comp)) {\n          var transferEvent = se.event.raw;\n          handleFiles(comp, transferEvent.dataTransfer.files);\n        }\n      };\n      var onSelect = function (component, simulatedEvent) {\n        var input = simulatedEvent.event.raw.target;\n        handleFiles(component, input.files);\n      };\n      var handleFiles = function (component, files) {\n        Representing.setValue(component, filterByExtension(files, providersBackstage));\n        emitWith(component, formChangeEvent, { name: spec.name });\n      };\n      var memInput = record({\n        dom: {\n          tag: 'input',\n          attributes: {\n            type: 'file',\n            accept: 'image/*'\n          },\n          styles: { display: 'none' }\n        },\n        behaviours: derive$1([config('input-file-events', [\n            cutter(click()),\n            cutter(tap())\n          ])])\n      });\n      var renderField = function (s) {\n        return {\n          uid: s.uid,\n          dom: {\n            tag: 'div',\n            classes: ['tox-dropzone-container']\n          },\n          behaviours: derive$1([\n            RepresentingConfigs.memory([]),\n            ComposingConfigs.self(),\n            Disabling.config({}),\n            Toggling.config({\n              toggleClass: 'dragenter',\n              toggleOnExecute: false\n            }),\n            config('dropzone-events', [\n              run$1('dragenter', sequence([\n                stopper,\n                Toggling.toggle\n              ])),\n              run$1('dragleave', sequence([\n                stopper,\n                Toggling.toggle\n              ])),\n              run$1('dragover', stopper),\n              run$1('drop', sequence([\n                stopper,\n                onDrop\n              ])),\n              run$1(change(), onSelect)\n            ])\n          ]),\n          components: [{\n              dom: {\n                tag: 'div',\n                classes: ['tox-dropzone'],\n                styles: {}\n              },\n              components: [\n                {\n                  dom: {\n                    tag: 'p',\n                    innerHtml: providersBackstage.translate('Drop an image here')\n                  }\n                },\n                Button.sketch({\n                  dom: {\n                    tag: 'button',\n                    innerHtml: providersBackstage.translate('Browse for an image'),\n                    styles: { position: 'relative' },\n                    classes: [\n                      'tox-button',\n                      'tox-button--secondary'\n                    ]\n                  },\n                  components: [memInput.asSpec()],\n                  action: function (comp) {\n                    var inputComp = memInput.get(comp);\n                    inputComp.element.dom.click();\n                  },\n                  buttonBehaviours: derive$1([\n                    Tabstopping.config({}),\n                    DisablingConfigs.button(providersBackstage.isDisabled),\n                    receivingConfig()\n                  ])\n                })\n              ]\n            }]\n        };\n      };\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var pField = FormField.parts.field({ factory: { sketch: renderField } });\n      return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched'], []);\n    };\n\n    var renderGrid = function (spec, backstage) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-form__grid',\n            'tox-form__grid--' + spec.columns + 'col'\n          ]\n        },\n        components: map$2(spec.items, backstage.interpreter)\n      };\n    };\n\n    var beforeObject = generate$6('alloy-fake-before-tabstop');\n    var afterObject = generate$6('alloy-fake-after-tabstop');\n    var craftWithClasses = function (classes) {\n      return {\n        dom: {\n          tag: 'div',\n          styles: {\n            width: '1px',\n            height: '1px',\n            outline: 'none'\n          },\n          attributes: { tabindex: '0' },\n          classes: classes\n        },\n        behaviours: derive$1([\n          Focusing.config({ ignore: true }),\n          Tabstopping.config({})\n        ])\n      };\n    };\n    var craft = function (spec) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-navobj']\n        },\n        components: [\n          craftWithClasses([beforeObject]),\n          spec,\n          craftWithClasses([afterObject])\n        ],\n        behaviours: derive$1([ComposingConfigs.childAt(1)])\n      };\n    };\n    var triggerTab = function (placeholder, shiftKey) {\n      emitWith(placeholder, keydown(), {\n        raw: {\n          which: 9,\n          shiftKey: shiftKey\n        }\n      });\n    };\n    var onFocus = function (container, targetComp) {\n      var target = targetComp.element;\n      if (has(target, beforeObject)) {\n        triggerTab(container, true);\n      } else if (has(target, afterObject)) {\n        triggerTab(container, false);\n      }\n    };\n    var isPseudoStop = function (element) {\n      return closest(element, [\n        '.' + beforeObject,\n        '.' + afterObject\n      ].join(','), never);\n    };\n\n    var platformNeedsSandboxing = !(detect$1().browser.isIE() || detect$1().browser.isEdge());\n    var getDynamicSource = function (isSandbox) {\n      var cachedValue = Cell('');\n      return {\n        getValue: function (_frameComponent) {\n          return cachedValue.get();\n        },\n        setValue: function (frameComponent, html) {\n          if (!isSandbox) {\n            set$8(frameComponent.element, 'src', 'javascript:\\'\\'');\n            var doc = frameComponent.element.dom.contentWindow.document;\n            doc.open();\n            doc.write(html);\n            doc.close();\n          } else {\n            set$8(frameComponent.element, 'srcdoc', html);\n          }\n          cachedValue.set(html);\n        }\n      };\n    };\n    var renderIFrame = function (spec, providersBackstage) {\n      var isSandbox = platformNeedsSandboxing && spec.sandboxed;\n      var attributes = __assign(__assign({}, spec.label.map(function (title) {\n        return { title: title };\n      }).getOr({})), isSandbox ? { sandbox: 'allow-scripts allow-same-origin' } : {});\n      var sourcing = getDynamicSource(isSandbox);\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var factory = function (newSpec) {\n        return craft({\n          uid: newSpec.uid,\n          dom: {\n            tag: 'iframe',\n            attributes: attributes\n          },\n          behaviours: derive$1([\n            Tabstopping.config({}),\n            Focusing.config({}),\n            RepresentingConfigs.withComp(Optional.none(), sourcing.getValue, sourcing.setValue)\n          ])\n        });\n      };\n      var pField = FormField.parts.field({ factory: { sketch: factory } });\n      return renderFormFieldWith(pLabel, pField, ['tox-form__group--stretched'], []);\n    };\n\n    var create$3 = function (width, height) {\n      return resize$3(document.createElement('canvas'), width, height);\n    };\n    var clone = function (canvas) {\n      var tCanvas = create$3(canvas.width, canvas.height);\n      var ctx = get2dContext(tCanvas);\n      ctx.drawImage(canvas, 0, 0);\n      return tCanvas;\n    };\n    var get2dContext = function (canvas) {\n      return canvas.getContext('2d');\n    };\n    var resize$3 = function (canvas, width, height) {\n      canvas.width = width;\n      canvas.height = height;\n      return canvas;\n    };\n\n    var getWidth$1 = function (image) {\n      return image.naturalWidth || image.width;\n    };\n    var getHeight$1 = function (image) {\n      return image.naturalHeight || image.height;\n    };\n\n    var blobToImage = function (blob) {\n      return new Promise$1(function (resolve, reject) {\n        var blobUrl = URL.createObjectURL(blob);\n        var image = new Image();\n        var removeListeners = function () {\n          image.removeEventListener('load', loaded);\n          image.removeEventListener('error', error);\n        };\n        var loaded = function () {\n          removeListeners();\n          resolve(image);\n        };\n        var error = function () {\n          removeListeners();\n          reject('Unable to load data of type ' + blob.type + ': ' + blobUrl);\n        };\n        image.addEventListener('load', loaded);\n        image.addEventListener('error', error);\n        image.src = blobUrl;\n        if (image.complete) {\n          setTimeout(loaded, 0);\n        }\n      });\n    };\n    var dataUriToBlobSync = function (uri) {\n      var data = uri.split(',');\n      var matches = /data:([^;]+)/.exec(data[0]);\n      if (!matches) {\n        return Optional.none();\n      }\n      var mimetype = matches[1];\n      var base64 = data[1];\n      var sliceSize = 1024;\n      var byteCharacters = atob(base64);\n      var bytesLength = byteCharacters.length;\n      var slicesCount = Math.ceil(bytesLength / sliceSize);\n      var byteArrays = new Array(slicesCount);\n      for (var sliceIndex = 0; sliceIndex < slicesCount; ++sliceIndex) {\n        var begin = sliceIndex * sliceSize;\n        var end = Math.min(begin + sliceSize, bytesLength);\n        var bytes = new Array(end - begin);\n        for (var offset = begin, i = 0; offset < end; ++i, ++offset) {\n          bytes[i] = byteCharacters[offset].charCodeAt(0);\n        }\n        byteArrays[sliceIndex] = new Uint8Array(bytes);\n      }\n      return Optional.some(new Blob(byteArrays, { type: mimetype }));\n    };\n    var dataUriToBlob = function (uri) {\n      return new Promise$1(function (resolve, reject) {\n        dataUriToBlobSync(uri).fold(function () {\n          reject('uri is not base64: ' + uri);\n        }, resolve);\n      });\n    };\n    var canvasToBlob = function (canvas, type, quality) {\n      type = type || 'image/png';\n      if (isFunction(HTMLCanvasElement.prototype.toBlob)) {\n        return new Promise$1(function (resolve, reject) {\n          canvas.toBlob(function (blob) {\n            if (blob) {\n              resolve(blob);\n            } else {\n              reject();\n            }\n          }, type, quality);\n        });\n      } else {\n        return dataUriToBlob(canvas.toDataURL(type, quality));\n      }\n    };\n    var canvasToDataURL = function (canvas, type, quality) {\n      type = type || 'image/png';\n      return canvas.toDataURL(type, quality);\n    };\n    var blobToCanvas = function (blob) {\n      return blobToImage(blob).then(function (image) {\n        revokeImageUrl(image);\n        var canvas = create$3(getWidth$1(image), getHeight$1(image));\n        var context = get2dContext(canvas);\n        context.drawImage(image, 0, 0);\n        return canvas;\n      });\n    };\n    var blobToDataUri = function (blob) {\n      return new Promise$1(function (resolve) {\n        var reader = new FileReader();\n        reader.onloadend = function () {\n          resolve(reader.result);\n        };\n        reader.readAsDataURL(blob);\n      });\n    };\n    var revokeImageUrl = function (image) {\n      URL.revokeObjectURL(image.src);\n    };\n\n    var create$2 = function (getCanvas, blob, uri) {\n      var initialType = blob.type;\n      var getType = constant$1(initialType);\n      var toBlob = function () {\n        return Promise$1.resolve(blob);\n      };\n      var toDataURL = constant$1(uri);\n      var toBase64 = function () {\n        return uri.split(',')[1];\n      };\n      var toAdjustedBlob = function (type, quality) {\n        return getCanvas.then(function (canvas) {\n          return canvasToBlob(canvas, type, quality);\n        });\n      };\n      var toAdjustedDataURL = function (type, quality) {\n        return getCanvas.then(function (canvas) {\n          return canvasToDataURL(canvas, type, quality);\n        });\n      };\n      var toAdjustedBase64 = function (type, quality) {\n        return toAdjustedDataURL(type, quality).then(function (dataurl) {\n          return dataurl.split(',')[1];\n        });\n      };\n      var toCanvas = function () {\n        return getCanvas.then(clone);\n      };\n      return {\n        getType: getType,\n        toBlob: toBlob,\n        toDataURL: toDataURL,\n        toBase64: toBase64,\n        toAdjustedBlob: toAdjustedBlob,\n        toAdjustedDataURL: toAdjustedDataURL,\n        toAdjustedBase64: toAdjustedBase64,\n        toCanvas: toCanvas\n      };\n    };\n    var fromBlob = function (blob) {\n      return blobToDataUri(blob).then(function (uri) {\n        return create$2(blobToCanvas(blob), blob, uri);\n      });\n    };\n    var fromCanvas = function (canvas, type) {\n      return canvasToBlob(canvas, type).then(function (blob) {\n        return create$2(Promise$1.resolve(canvas), blob, canvas.toDataURL());\n      });\n    };\n\n    var blobToImageResult = function (blob) {\n      return fromBlob(blob);\n    };\n\n    var clamp = function (value, min, max) {\n      var parsedValue = typeof value === 'string' ? parseFloat(value) : value;\n      if (parsedValue > max) {\n        parsedValue = max;\n      } else if (parsedValue < min) {\n        parsedValue = min;\n      }\n      return parsedValue;\n    };\n    var identity = function () {\n      return [\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1\n      ];\n    };\n    var DELTA_INDEX = [\n      0,\n      0.01,\n      0.02,\n      0.04,\n      0.05,\n      0.06,\n      0.07,\n      0.08,\n      0.1,\n      0.11,\n      0.12,\n      0.14,\n      0.15,\n      0.16,\n      0.17,\n      0.18,\n      0.2,\n      0.21,\n      0.22,\n      0.24,\n      0.25,\n      0.27,\n      0.28,\n      0.3,\n      0.32,\n      0.34,\n      0.36,\n      0.38,\n      0.4,\n      0.42,\n      0.44,\n      0.46,\n      0.48,\n      0.5,\n      0.53,\n      0.56,\n      0.59,\n      0.62,\n      0.65,\n      0.68,\n      0.71,\n      0.74,\n      0.77,\n      0.8,\n      0.83,\n      0.86,\n      0.89,\n      0.92,\n      0.95,\n      0.98,\n      1,\n      1.06,\n      1.12,\n      1.18,\n      1.24,\n      1.3,\n      1.36,\n      1.42,\n      1.48,\n      1.54,\n      1.6,\n      1.66,\n      1.72,\n      1.78,\n      1.84,\n      1.9,\n      1.96,\n      2,\n      2.12,\n      2.25,\n      2.37,\n      2.5,\n      2.62,\n      2.75,\n      2.87,\n      3,\n      3.2,\n      3.4,\n      3.6,\n      3.8,\n      4,\n      4.3,\n      4.7,\n      4.9,\n      5,\n      5.5,\n      6,\n      6.5,\n      6.8,\n      7,\n      7.3,\n      7.5,\n      7.8,\n      8,\n      8.4,\n      8.7,\n      9,\n      9.4,\n      9.6,\n      9.8,\n      10\n    ];\n    var multiply = function (matrix1, matrix2) {\n      var col = [];\n      var out = new Array(25);\n      var val;\n      for (var i = 0; i < 5; i++) {\n        for (var j = 0; j < 5; j++) {\n          col[j] = matrix2[j + i * 5];\n        }\n        for (var j = 0; j < 5; j++) {\n          val = 0;\n          for (var k = 0; k < 5; k++) {\n            val += matrix1[j + k * 5] * col[k];\n          }\n          out[j + i * 5] = val;\n        }\n      }\n      return out;\n    };\n    var adjustContrast = function (matrix, value) {\n      var x;\n      value = clamp(value, -1, 1);\n      value *= 100;\n      if (value < 0) {\n        x = 127 + value / 100 * 127;\n      } else {\n        x = value % 1;\n        if (x === 0) {\n          x = DELTA_INDEX[value];\n        } else {\n          x = DELTA_INDEX[Math.floor(value)] * (1 - x) + DELTA_INDEX[Math.floor(value) + 1] * x;\n        }\n        x = x * 127 + 127;\n      }\n      return multiply(matrix, [\n        x / 127,\n        0,\n        0,\n        0,\n        0.5 * (127 - x),\n        0,\n        x / 127,\n        0,\n        0,\n        0.5 * (127 - x),\n        0,\n        0,\n        x / 127,\n        0,\n        0.5 * (127 - x),\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1\n      ]);\n    };\n    var adjustBrightness = function (matrix, value) {\n      value = clamp(255 * value, -255, 255);\n      return multiply(matrix, [\n        1,\n        0,\n        0,\n        0,\n        value,\n        0,\n        1,\n        0,\n        0,\n        value,\n        0,\n        0,\n        1,\n        0,\n        value,\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1\n      ]);\n    };\n    var adjustColors = function (matrix, adjustR, adjustG, adjustB) {\n      adjustR = clamp(adjustR, 0, 2);\n      adjustG = clamp(adjustG, 0, 2);\n      adjustB = clamp(adjustB, 0, 2);\n      return multiply(matrix, [\n        adjustR,\n        0,\n        0,\n        0,\n        0,\n        0,\n        adjustG,\n        0,\n        0,\n        0,\n        0,\n        0,\n        adjustB,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1,\n        0,\n        0,\n        0,\n        0,\n        0,\n        1\n      ]);\n    };\n\n    var colorFilter = function (ir, matrix) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyColorFilter(canvas, ir.getType(), matrix);\n      });\n    };\n    var applyColorFilter = function (canvas, type, matrix) {\n      var context = get2dContext(canvas);\n      var applyMatrix = function (pixelsData, m) {\n        var r, g, b, a;\n        var data = pixelsData.data, m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3], m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7], m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11], m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15], m16 = m[16], m17 = m[17], m18 = m[18], m19 = m[19];\n        for (var i = 0; i < data.length; i += 4) {\n          r = data[i];\n          g = data[i + 1];\n          b = data[i + 2];\n          a = data[i + 3];\n          data[i] = r * m0 + g * m1 + b * m2 + a * m3 + m4;\n          data[i + 1] = r * m5 + g * m6 + b * m7 + a * m8 + m9;\n          data[i + 2] = r * m10 + g * m11 + b * m12 + a * m13 + m14;\n          data[i + 3] = r * m15 + g * m16 + b * m17 + a * m18 + m19;\n        }\n        return pixelsData;\n      };\n      var pixels = applyMatrix(context.getImageData(0, 0, canvas.width, canvas.height), matrix);\n      context.putImageData(pixels, 0, 0);\n      return fromCanvas(canvas, type);\n    };\n    var convoluteFilter = function (ir, matrix) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyConvoluteFilter(canvas, ir.getType(), matrix);\n      });\n    };\n    var applyConvoluteFilter = function (canvas, type, matrix) {\n      var context = get2dContext(canvas);\n      var applyMatrix = function (pIn, pOut, aMatrix) {\n        var clamp = function (value, min, max) {\n          if (value > max) {\n            value = max;\n          } else if (value < min) {\n            value = min;\n          }\n          return value;\n        };\n        var side = Math.round(Math.sqrt(aMatrix.length));\n        var halfSide = Math.floor(side / 2);\n        var rgba = pIn.data;\n        var drgba = pOut.data;\n        var w = pIn.width;\n        var h = pIn.height;\n        for (var y = 0; y < h; y++) {\n          for (var x = 0; x < w; x++) {\n            var r = 0;\n            var g = 0;\n            var b = 0;\n            for (var cy = 0; cy < side; cy++) {\n              for (var cx = 0; cx < side; cx++) {\n                var scx = clamp(x + cx - halfSide, 0, w - 1);\n                var scy = clamp(y + cy - halfSide, 0, h - 1);\n                var innerOffset = (scy * w + scx) * 4;\n                var wt = aMatrix[cy * side + cx];\n                r += rgba[innerOffset] * wt;\n                g += rgba[innerOffset + 1] * wt;\n                b += rgba[innerOffset + 2] * wt;\n              }\n            }\n            var offset = (y * w + x) * 4;\n            drgba[offset] = clamp(r, 0, 255);\n            drgba[offset + 1] = clamp(g, 0, 255);\n            drgba[offset + 2] = clamp(b, 0, 255);\n          }\n        }\n        return pOut;\n      };\n      var pixelsIn = context.getImageData(0, 0, canvas.width, canvas.height);\n      var pixelsOut = context.getImageData(0, 0, canvas.width, canvas.height);\n      pixelsOut = applyMatrix(pixelsIn, pixelsOut, matrix);\n      context.putImageData(pixelsOut, 0, 0);\n      return fromCanvas(canvas, type);\n    };\n    var functionColorFilter = function (colorFn) {\n      var filterImpl = function (canvas, type, value) {\n        var context = get2dContext(canvas);\n        var lookup = new Array(256);\n        var applyLookup = function (pixelsData, lookupData) {\n          var data = pixelsData.data;\n          for (var i = 0; i < data.length; i += 4) {\n            data[i] = lookupData[data[i]];\n            data[i + 1] = lookupData[data[i + 1]];\n            data[i + 2] = lookupData[data[i + 2]];\n          }\n          return pixelsData;\n        };\n        for (var i = 0; i < lookup.length; i++) {\n          lookup[i] = colorFn(i, value);\n        }\n        var pixels = applyLookup(context.getImageData(0, 0, canvas.width, canvas.height), lookup);\n        context.putImageData(pixels, 0, 0);\n        return fromCanvas(canvas, type);\n      };\n      return function (ir, value) {\n        return ir.toCanvas().then(function (canvas) {\n          return filterImpl(canvas, ir.getType(), value);\n        });\n      };\n    };\n    var complexAdjustableColorFilter = function (matrixAdjustFn) {\n      return function (ir, adjust) {\n        return colorFilter(ir, matrixAdjustFn(identity(), adjust));\n      };\n    };\n    var basicColorFilter = function (matrix) {\n      return function (ir) {\n        return colorFilter(ir, matrix);\n      };\n    };\n    var basicConvolutionFilter = function (kernel) {\n      return function (ir) {\n        return convoluteFilter(ir, kernel);\n      };\n    };\n    var invert$1 = basicColorFilter([\n      -1,\n      0,\n      0,\n      0,\n      255,\n      0,\n      -1,\n      0,\n      0,\n      255,\n      0,\n      0,\n      -1,\n      0,\n      255,\n      0,\n      0,\n      0,\n      1,\n      0,\n      0,\n      0,\n      0,\n      0,\n      1\n    ]);\n    var brightness$1 = complexAdjustableColorFilter(adjustBrightness);\n    var contrast$1 = complexAdjustableColorFilter(adjustContrast);\n    var colorize$1 = function (ir, adjustR, adjustG, adjustB) {\n      return colorFilter(ir, adjustColors(identity(), adjustR, adjustG, adjustB));\n    };\n    var sharpen$1 = basicConvolutionFilter([\n      0,\n      -1,\n      0,\n      -1,\n      5,\n      -1,\n      0,\n      -1,\n      0\n    ]);\n    var gamma$1 = functionColorFilter(function (color, value) {\n      return Math.pow(color / 255, 1 - value) * 255;\n    });\n\n    var scale = function (image, dW, dH) {\n      var sW = getWidth$1(image);\n      var sH = getHeight$1(image);\n      var wRatio = dW / sW;\n      var hRatio = dH / sH;\n      var scaleCapped = false;\n      if (wRatio < 0.5 || wRatio > 2) {\n        wRatio = wRatio < 0.5 ? 0.5 : 2;\n        scaleCapped = true;\n      }\n      if (hRatio < 0.5 || hRatio > 2) {\n        hRatio = hRatio < 0.5 ? 0.5 : 2;\n        scaleCapped = true;\n      }\n      var scaled = _scale(image, wRatio, hRatio);\n      return !scaleCapped ? scaled : scaled.then(function (tCanvas) {\n        return scale(tCanvas, dW, dH);\n      });\n    };\n    var _scale = function (image, wRatio, hRatio) {\n      return new Promise$1(function (resolve) {\n        var sW = getWidth$1(image);\n        var sH = getHeight$1(image);\n        var dW = Math.floor(sW * wRatio);\n        var dH = Math.floor(sH * hRatio);\n        var canvas = create$3(dW, dH);\n        var context = get2dContext(canvas);\n        context.drawImage(image, 0, 0, sW, sH, 0, 0, dW, dH);\n        resolve(canvas);\n      });\n    };\n\n    var ceilWithPrecision = function (num, precision) {\n      if (precision === void 0) {\n        precision = 2;\n      }\n      var mul = Math.pow(10, precision);\n      var upper = Math.round(num * mul);\n      return Math.ceil(upper / mul);\n    };\n    var rotate$1 = function (ir, angle) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyRotate(canvas, ir.getType(), angle);\n      });\n    };\n    var applyRotate = function (image, type, angle) {\n      var degrees = angle < 0 ? 360 + angle : angle;\n      var rad = degrees * Math.PI / 180;\n      var width = image.width;\n      var height = image.height;\n      var sin = Math.sin(rad);\n      var cos = Math.cos(rad);\n      var newWidth = ceilWithPrecision(Math.abs(width * cos) + Math.abs(height * sin));\n      var newHeight = ceilWithPrecision(Math.abs(width * sin) + Math.abs(height * cos));\n      var canvas = create$3(newWidth, newHeight);\n      var context = get2dContext(canvas);\n      context.translate(newWidth / 2, newHeight / 2);\n      context.rotate(rad);\n      context.drawImage(image, -width / 2, -height / 2);\n      return fromCanvas(canvas, type);\n    };\n    var flip$1 = function (ir, axis) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyFlip(canvas, ir.getType(), axis);\n      });\n    };\n    var applyFlip = function (image, type, axis) {\n      var canvas = create$3(image.width, image.height);\n      var context = get2dContext(canvas);\n      if (axis === 'v') {\n        context.scale(1, -1);\n        context.drawImage(image, 0, -canvas.height);\n      } else {\n        context.scale(-1, 1);\n        context.drawImage(image, -canvas.width, 0);\n      }\n      return fromCanvas(canvas, type);\n    };\n    var crop$1 = function (ir, x, y, w, h) {\n      return ir.toCanvas().then(function (canvas) {\n        return applyCrop(canvas, ir.getType(), x, y, w, h);\n      });\n    };\n    var applyCrop = function (image, type, x, y, w, h) {\n      var canvas = create$3(w, h);\n      var context = get2dContext(canvas);\n      context.drawImage(image, -x, -y);\n      return fromCanvas(canvas, type);\n    };\n    var resize$2 = function (ir, w, h) {\n      return ir.toCanvas().then(function (canvas) {\n        return scale(canvas, w, h).then(function (newCanvas) {\n          return fromCanvas(newCanvas, ir.getType());\n        });\n      });\n    };\n\n    var invert = function (ir) {\n      return invert$1(ir);\n    };\n    var sharpen = function (ir) {\n      return sharpen$1(ir);\n    };\n    var gamma = function (ir, value) {\n      return gamma$1(ir, value);\n    };\n    var colorize = function (ir, adjustR, adjustG, adjustB) {\n      return colorize$1(ir, adjustR, adjustG, adjustB);\n    };\n    var brightness = function (ir, adjust) {\n      return brightness$1(ir, adjust);\n    };\n    var contrast = function (ir, adjust) {\n      return contrast$1(ir, adjust);\n    };\n    var flip = function (ir, axis) {\n      return flip$1(ir, axis);\n    };\n    var crop = function (ir, x, y, w, h) {\n      return crop$1(ir, x, y, w, h);\n    };\n    var resize$1 = function (ir, w, h) {\n      return resize$2(ir, w, h);\n    };\n    var rotate = function (ir, angle) {\n      return rotate$1(ir, angle);\n    };\n\n    var renderIcon = function (iconName, iconsProvider, behaviours) {\n      return render$3(iconName, {\n        tag: 'span',\n        classes: [\n          'tox-icon',\n          'tox-tbtn__icon-wrap'\n        ],\n        behaviours: behaviours\n      }, iconsProvider);\n    };\n    var renderIconFromPack = function (iconName, iconsProvider) {\n      return renderIcon(iconName, iconsProvider, []);\n    };\n    var renderReplacableIconFromPack = function (iconName, iconsProvider) {\n      return renderIcon(iconName, iconsProvider, [Replacing.config({})]);\n    };\n    var renderLabel$1 = function (text, prefix, providersBackstage) {\n      return {\n        dom: {\n          tag: 'span',\n          innerHtml: providersBackstage.translate(text),\n          classes: [prefix + '__select-label']\n        },\n        behaviours: derive$1([Replacing.config({})])\n      };\n    };\n\n    var _a;\n    var internalToolbarButtonExecute = generate$6('toolbar.button.execute');\n    var onToolbarButtonExecute = function (info) {\n      return runOnExecute$1(function (comp, _simulatedEvent) {\n        runWithApi(info, comp)(function (itemApi) {\n          emitWith(comp, internalToolbarButtonExecute, { buttonApi: itemApi });\n          info.onAction(itemApi);\n        });\n      });\n    };\n    var toolbarButtonEventOrder = (_a = {}, _a[execute$5()] = [\n      'disabling',\n      'alloy.base.behaviour',\n      'toggling',\n      'toolbar-button-events'\n    ], _a);\n\n    var updateMenuText = generate$6('update-menu-text');\n    var updateMenuIcon = generate$6('update-menu-icon');\n    var renderCommonDropdown = function (spec, prefix, sharedBackstage) {\n      var editorOffCell = Cell(noop);\n      var optMemDisplayText = spec.text.map(function (text) {\n        return record(renderLabel$1(text, prefix, sharedBackstage.providers));\n      });\n      var optMemDisplayIcon = spec.icon.map(function (iconName) {\n        return record(renderReplacableIconFromPack(iconName, sharedBackstage.providers.icons));\n      });\n      var onLeftOrRightInMenu = function (comp, se) {\n        var dropdown = Representing.getValue(comp);\n        Focusing.focus(dropdown);\n        emitWith(dropdown, 'keydown', { raw: se.event.raw });\n        Dropdown.close(dropdown);\n        return Optional.some(true);\n      };\n      var role = spec.role.fold(function () {\n        return {};\n      }, function (role) {\n        return { role: role };\n      });\n      var tooltipAttributes = spec.tooltip.fold(function () {\n        return {};\n      }, function (tooltip) {\n        var translatedTooltip = sharedBackstage.providers.translate(tooltip);\n        return {\n          'title': translatedTooltip,\n          'aria-label': translatedTooltip\n        };\n      });\n      var iconSpec = render$3('chevron-down', {\n        tag: 'div',\n        classes: [prefix + '__select-chevron']\n      }, sharedBackstage.providers.icons);\n      var memDropdown = record(Dropdown.sketch(__assign(__assign(__assign({}, spec.uid ? { uid: spec.uid } : {}), role), {\n        dom: {\n          tag: 'button',\n          classes: [\n            prefix,\n            prefix + '--select'\n          ].concat(map$2(spec.classes, function (c) {\n            return prefix + '--' + c;\n          })),\n          attributes: __assign({}, tooltipAttributes)\n        },\n        components: componentRenderPipeline([\n          optMemDisplayIcon.map(function (mem) {\n            return mem.asSpec();\n          }),\n          optMemDisplayText.map(function (mem) {\n            return mem.asSpec();\n          }),\n          Optional.some(iconSpec)\n        ]),\n        matchWidth: true,\n        useMinWidth: true,\n        dropdownBehaviours: derive$1(__spreadArray(__spreadArray([], spec.dropdownBehaviours, true), [\n          DisablingConfigs.button(function () {\n            return spec.disabled || sharedBackstage.providers.isDisabled();\n          }),\n          receivingConfig(),\n          Unselecting.config({}),\n          Replacing.config({}),\n          config('dropdown-events', [\n            onControlAttached(spec, editorOffCell),\n            onControlDetached(spec, editorOffCell)\n          ]),\n          config('menubutton-update-display-text', [\n            run$1(updateMenuText, function (comp, se) {\n              optMemDisplayText.bind(function (mem) {\n                return mem.getOpt(comp);\n              }).each(function (displayText) {\n                Replacing.set(displayText, [text$1(sharedBackstage.providers.translate(se.event.text))]);\n              });\n            }),\n            run$1(updateMenuIcon, function (comp, se) {\n              optMemDisplayIcon.bind(function (mem) {\n                return mem.getOpt(comp);\n              }).each(function (displayIcon) {\n                Replacing.set(displayIcon, [renderReplacableIconFromPack(se.event.icon, sharedBackstage.providers.icons)]);\n              });\n            })\n          ])\n        ], false)),\n        eventOrder: deepMerge(toolbarButtonEventOrder, {\n          mousedown: [\n            'focusing',\n            'alloy.base.behaviour',\n            'item-type-events',\n            'normal-dropdown-events'\n          ]\n        }),\n        sandboxBehaviours: derive$1([Keying.config({\n            mode: 'special',\n            onLeft: onLeftOrRightInMenu,\n            onRight: onLeftOrRightInMenu\n          })]),\n        lazySink: sharedBackstage.getSink,\n        toggleClass: prefix + '--active',\n        parts: { menu: part(false, spec.columns, spec.presets) },\n        fetch: function (comp) {\n          return Future.nu(curry(spec.fetch, comp));\n        }\n      })));\n      return memDropdown.asSpec();\n    };\n\n    var isMenuItemReference = function (item) {\n      return isString(item);\n    };\n    var isSeparator$1 = function (item) {\n      return item.type === 'separator';\n    };\n    var isExpandingMenuItem = function (item) {\n      return has$2(item, 'getSubmenuItems');\n    };\n    var separator$2 = { type: 'separator' };\n    var unwrapReferences = function (items, menuItems) {\n      var realItems = foldl(items, function (acc, item) {\n        if (isMenuItemReference(item)) {\n          if (item === '') {\n            return acc;\n          } else if (item === '|') {\n            return acc.length > 0 && !isSeparator$1(acc[acc.length - 1]) ? acc.concat([separator$2]) : acc;\n          } else if (has$2(menuItems, item.toLowerCase())) {\n            return acc.concat([menuItems[item.toLowerCase()]]);\n          } else {\n            return acc;\n          }\n        } else {\n          return acc.concat([item]);\n        }\n      }, []);\n      if (realItems.length > 0 && isSeparator$1(realItems[realItems.length - 1])) {\n        realItems.pop();\n      }\n      return realItems;\n    };\n    var getFromExpandingItem = function (item, menuItems) {\n      var submenuItems = item.getSubmenuItems();\n      var rest = expand(submenuItems, menuItems);\n      var newMenus = deepMerge(rest.menus, wrap$1(item.value, rest.items));\n      var newExpansions = deepMerge(rest.expansions, wrap$1(item.value, item.value));\n      return {\n        item: item,\n        menus: newMenus,\n        expansions: newExpansions\n      };\n    };\n    var getFromItem = function (item, menuItems) {\n      return isExpandingMenuItem(item) ? getFromExpandingItem(item, menuItems) : {\n        item: item,\n        menus: {},\n        expansions: {}\n      };\n    };\n    var generateValueIfRequired = function (item) {\n      if (isSeparator$1(item)) {\n        return item;\n      } else {\n        var itemValue = get$e(item, 'value').getOrThunk(function () {\n          return generate$6('generated-menu-item');\n        });\n        return deepMerge({ value: itemValue }, item);\n      }\n    };\n    var expand = function (items, menuItems) {\n      var realItems = unwrapReferences(isString(items) ? items.split(' ') : items, menuItems);\n      return foldr(realItems, function (acc, item) {\n        var itemWithValue = generateValueIfRequired(item);\n        var newData = getFromItem(itemWithValue, menuItems);\n        return {\n          menus: deepMerge(acc.menus, newData.menus),\n          items: [newData.item].concat(acc.items),\n          expansions: deepMerge(acc.expansions, newData.expansions)\n        };\n      }, {\n        menus: {},\n        expansions: {},\n        items: []\n      });\n    };\n\n    var build = function (items, itemResponse, backstage, isHorizontalMenu) {\n      var primary = generate$6('primary-menu');\n      var data = expand(items, backstage.shared.providers.menuItems());\n      if (data.items.length === 0) {\n        return Optional.none();\n      }\n      var mainMenu = createPartialMenu(primary, data.items, itemResponse, backstage, isHorizontalMenu);\n      var submenus = map$1(data.menus, function (menuItems, menuName) {\n        return createPartialMenu(menuName, menuItems, itemResponse, backstage, false);\n      });\n      var menus = deepMerge(submenus, wrap$1(primary, mainMenu));\n      return Optional.from(tieredMenu.tieredData(primary, menus, data.expansions));\n    };\n\n    var getMenuButtonApi = function (component) {\n      return {\n        isDisabled: function () {\n          return Disabling.isDisabled(component);\n        },\n        setDisabled: function (state) {\n          return Disabling.set(component, state);\n        },\n        setActive: function (state) {\n          var elm = component.element;\n          if (state) {\n            add$2(elm, 'tox-tbtn--enabled');\n            set$8(elm, 'aria-pressed', true);\n          } else {\n            remove$2(elm, 'tox-tbtn--enabled');\n            remove$7(elm, 'aria-pressed');\n          }\n        },\n        isActive: function () {\n          return has(component.element, 'tox-tbtn--enabled');\n        }\n      };\n    };\n    var renderMenuButton = function (spec, prefix, backstage, role) {\n      return renderCommonDropdown({\n        text: spec.text,\n        icon: spec.icon,\n        tooltip: spec.tooltip,\n        role: role,\n        fetch: function (_comp, callback) {\n          spec.fetch(function (items) {\n            callback(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false));\n          });\n        },\n        onSetup: spec.onSetup,\n        getApi: getMenuButtonApi,\n        columns: 1,\n        presets: 'normal',\n        classes: [],\n        dropdownBehaviours: [Tabstopping.config({})]\n      }, prefix, backstage.shared);\n    };\n    var getFetch = function (items, getButton, backstage) {\n      var getMenuItemAction = function (item) {\n        return function (api) {\n          var newValue = !api.isActive();\n          api.setActive(newValue);\n          item.storage.set(newValue);\n          backstage.shared.getSink().each(function (sink) {\n            getButton().getOpt(sink).each(function (orig) {\n              focus$3(orig.element);\n              emitWith(orig, formActionEvent, {\n                name: item.name,\n                value: item.storage.get()\n              });\n            });\n          });\n        };\n      };\n      var getMenuItemSetup = function (item) {\n        return function (api) {\n          api.setActive(item.storage.get());\n        };\n      };\n      return function (success) {\n        success(map$2(items, function (item) {\n          var text = item.text.fold(function () {\n            return {};\n          }, function (text) {\n            return { text: text };\n          });\n          return __assign(__assign({\n            type: item.type,\n            active: false\n          }, text), {\n            onAction: getMenuItemAction(item),\n            onSetup: getMenuItemSetup(item)\n          });\n        }));\n      };\n    };\n\n    var renderCommonSpec = function (spec, actionOpt, extraBehaviours, dom, components, providersBackstage) {\n      if (extraBehaviours === void 0) {\n        extraBehaviours = [];\n      }\n      var action = actionOpt.fold(function () {\n        return {};\n      }, function (action) {\n        return { action: action };\n      });\n      var common = __assign({\n        buttonBehaviours: derive$1([\n          DisablingConfigs.button(function () {\n            return spec.disabled || providersBackstage.isDisabled();\n          }),\n          receivingConfig(),\n          Tabstopping.config({}),\n          config('button press', [\n            preventDefault('click'),\n            preventDefault('mousedown')\n          ])\n        ].concat(extraBehaviours)),\n        eventOrder: {\n          click: [\n            'button press',\n            'alloy.base.behaviour'\n          ],\n          mousedown: [\n            'button press',\n            'alloy.base.behaviour'\n          ]\n        }\n      }, action);\n      var domFinal = deepMerge(common, { dom: dom });\n      return deepMerge(domFinal, { components: components });\n    };\n    var renderIconButtonSpec = function (spec, action, providersBackstage, extraBehaviours) {\n      if (extraBehaviours === void 0) {\n        extraBehaviours = [];\n      }\n      var tooltipAttributes = spec.tooltip.map(function (tooltip) {\n        return {\n          'aria-label': providersBackstage.translate(tooltip),\n          'title': providersBackstage.translate(tooltip)\n        };\n      }).getOr({});\n      var dom = {\n        tag: 'button',\n        classes: ['tox-tbtn'],\n        attributes: tooltipAttributes\n      };\n      var icon = spec.icon.map(function (iconName) {\n        return renderIconFromPack(iconName, providersBackstage.icons);\n      });\n      var components = componentRenderPipeline([icon]);\n      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);\n    };\n    var renderIconButton = function (spec, action, providersBackstage, extraBehaviours) {\n      if (extraBehaviours === void 0) {\n        extraBehaviours = [];\n      }\n      var iconButtonSpec = renderIconButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours);\n      return Button.sketch(iconButtonSpec);\n    };\n    var renderButtonSpec = function (spec, action, providersBackstage, extraBehaviours, extraClasses) {\n      if (extraBehaviours === void 0) {\n        extraBehaviours = [];\n      }\n      if (extraClasses === void 0) {\n        extraClasses = [];\n      }\n      var translatedText = providersBackstage.translate(spec.text);\n      var icon = spec.icon ? spec.icon.map(function (iconName) {\n        return renderIconFromPack(iconName, providersBackstage.icons);\n      }) : Optional.none();\n      var components = icon.isSome() ? componentRenderPipeline([icon]) : [];\n      var innerHtml = icon.isSome() ? {} : { innerHtml: translatedText };\n      var classes = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], !spec.primary && !spec.borderless ? [\n        'tox-button',\n        'tox-button--secondary'\n      ] : ['tox-button'], true), icon.isSome() ? ['tox-button--icon'] : [], true), spec.borderless ? ['tox-button--naked'] : [], true), extraClasses, true);\n      var dom = __assign(__assign({\n        tag: 'button',\n        classes: classes\n      }, innerHtml), { attributes: { title: translatedText } });\n      return renderCommonSpec(spec, action, extraBehaviours, dom, components, providersBackstage);\n    };\n    var renderButton = function (spec, action, providersBackstage, extraBehaviours, extraClasses) {\n      if (extraBehaviours === void 0) {\n        extraBehaviours = [];\n      }\n      if (extraClasses === void 0) {\n        extraClasses = [];\n      }\n      var buttonSpec = renderButtonSpec(spec, Optional.some(action), providersBackstage, extraBehaviours, extraClasses);\n      return Button.sketch(buttonSpec);\n    };\n    var getAction = function (name, buttonType) {\n      return function (comp) {\n        if (buttonType === 'custom') {\n          emitWith(comp, formActionEvent, {\n            name: name,\n            value: {}\n          });\n        } else if (buttonType === 'submit') {\n          emit(comp, formSubmitEvent);\n        } else if (buttonType === 'cancel') {\n          emit(comp, formCancelEvent);\n        } else {\n          console.error('Unknown button type: ', buttonType);\n        }\n      };\n    };\n    var isMenuFooterButtonSpec = function (spec, buttonType) {\n      return buttonType === 'menu';\n    };\n    var isNormalFooterButtonSpec = function (spec, buttonType) {\n      return buttonType === 'custom' || buttonType === 'cancel' || buttonType === 'submit';\n    };\n    var renderFooterButton = function (spec, buttonType, backstage) {\n      if (isMenuFooterButtonSpec(spec, buttonType)) {\n        var getButton = function () {\n          return memButton_1;\n        };\n        var menuButtonSpec = spec;\n        var fixedSpec = __assign(__assign({}, spec), {\n          onSetup: function (api) {\n            api.setDisabled(spec.disabled);\n            return noop;\n          },\n          fetch: getFetch(menuButtonSpec.items, getButton, backstage)\n        });\n        var memButton_1 = record(renderMenuButton(fixedSpec, 'tox-tbtn', backstage, Optional.none()));\n        return memButton_1.asSpec();\n      } else if (isNormalFooterButtonSpec(spec, buttonType)) {\n        var action = getAction(spec.name, buttonType);\n        var buttonSpec = __assign(__assign({}, spec), { borderless: false });\n        return renderButton(buttonSpec, action, backstage.shared.providers, []);\n      } else {\n        console.error('Unknown footer button type: ', buttonType);\n      }\n    };\n    var renderDialogButton = function (spec, providersBackstage) {\n      var action = getAction(spec.name, 'custom');\n      return renderFormField(Optional.none(), FormField.parts.field(__assign({ factory: Button }, renderButtonSpec(spec, Optional.some(action), providersBackstage, [\n        RepresentingConfigs.memory(''),\n        ComposingConfigs.self()\n      ]))));\n    };\n\n    var schema$h = constant$1([\n      defaulted('field1Name', 'field1'),\n      defaulted('field2Name', 'field2'),\n      onStrictHandler('onLockedChange'),\n      markers$1(['lockClass']),\n      defaulted('locked', false),\n      SketchBehaviours.field('coupledFieldBehaviours', [\n        Composing,\n        Representing\n      ])\n    ]);\n    var getField = function (comp, detail, partName) {\n      return getPart(comp, detail, partName).bind(Composing.getCurrent);\n    };\n    var coupledPart = function (selfName, otherName) {\n      return required({\n        factory: FormField,\n        name: selfName,\n        overrides: function (detail) {\n          return {\n            fieldBehaviours: derive$1([config('coupled-input-behaviour', [run$1(input(), function (me) {\n                  getField(me, detail, otherName).each(function (other) {\n                    getPart(me, detail, 'lock').each(function (lock) {\n                      if (Toggling.isOn(lock)) {\n                        detail.onLockedChange(me, other, lock);\n                      }\n                    });\n                  });\n                })])])\n          };\n        }\n      });\n    };\n    var parts$c = constant$1([\n      coupledPart('field1', 'field2'),\n      coupledPart('field2', 'field1'),\n      required({\n        factory: Button,\n        schema: [required$1('dom')],\n        name: 'lock',\n        overrides: function (detail) {\n          return {\n            buttonBehaviours: derive$1([Toggling.config({\n                selected: detail.locked,\n                toggleClass: detail.markers.lockClass,\n                aria: { mode: 'pressed' }\n              })])\n          };\n        }\n      })\n    ]);\n\n    var factory$f = function (detail, components, _spec, _externals) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: SketchBehaviours.augment(detail.coupledFieldBehaviours, [\n          Composing.config({ find: Optional.some }),\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function (comp) {\n                var _a;\n                var parts = getPartsOrDie(comp, detail, [\n                  'field1',\n                  'field2'\n                ]);\n                return _a = {}, _a[detail.field1Name] = Representing.getValue(parts.field1()), _a[detail.field2Name] = Representing.getValue(parts.field2()), _a;\n              },\n              setValue: function (comp, value) {\n                var parts = getPartsOrDie(comp, detail, [\n                  'field1',\n                  'field2'\n                ]);\n                if (hasNonNullableKey(value, detail.field1Name)) {\n                  Representing.setValue(parts.field1(), value[detail.field1Name]);\n                }\n                if (hasNonNullableKey(value, detail.field2Name)) {\n                  Representing.setValue(parts.field2(), value[detail.field2Name]);\n                }\n              }\n            }\n          })\n        ]),\n        apis: {\n          getField1: function (component) {\n            return getPart(component, detail, 'field1');\n          },\n          getField2: function (component) {\n            return getPart(component, detail, 'field2');\n          },\n          getLock: function (component) {\n            return getPart(component, detail, 'lock');\n          }\n        }\n      };\n    };\n    var FormCoupledInputs = composite({\n      name: 'FormCoupledInputs',\n      configFields: schema$h(),\n      partFields: parts$c(),\n      factory: factory$f,\n      apis: {\n        getField1: function (apis, component) {\n          return apis.getField1(component);\n        },\n        getField2: function (apis, component) {\n          return apis.getField2(component);\n        },\n        getLock: function (apis, component) {\n          return apis.getLock(component);\n        }\n      }\n    });\n\n    var formatSize = function (size) {\n      var unitDec = {\n        '': 0,\n        'px': 0,\n        'pt': 1,\n        'mm': 1,\n        'pc': 2,\n        'ex': 2,\n        'em': 2,\n        'ch': 2,\n        'rem': 2,\n        'cm': 3,\n        'in': 4,\n        '%': 4\n      };\n      var maxDecimal = function (unit) {\n        return unit in unitDec ? unitDec[unit] : 1;\n      };\n      var numText = size.value.toFixed(maxDecimal(size.unit));\n      if (numText.indexOf('.') !== -1) {\n        numText = numText.replace(/\\.?0*$/, '');\n      }\n      return numText + size.unit;\n    };\n    var parseSize = function (sizeText) {\n      var numPattern = /^\\s*(\\d+(?:\\.\\d+)?)\\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\\s*$/;\n      var match = numPattern.exec(sizeText);\n      if (match !== null) {\n        var value = parseFloat(match[1]);\n        var unit = match[2];\n        return Result.value({\n          value: value,\n          unit: unit\n        });\n      } else {\n        return Result.error(sizeText);\n      }\n    };\n    var convertUnit = function (size, unit) {\n      var inInch = {\n        '': 96,\n        'px': 96,\n        'pt': 72,\n        'cm': 2.54,\n        'pc': 12,\n        'mm': 25.4,\n        'in': 1\n      };\n      var supported = function (u) {\n        return has$2(inInch, u);\n      };\n      if (size.unit === unit) {\n        return Optional.some(size.value);\n      } else if (supported(size.unit) && supported(unit)) {\n        if (inInch[size.unit] === inInch[unit]) {\n          return Optional.some(size.value);\n        } else {\n          return Optional.some(size.value / inInch[size.unit] * inInch[unit]);\n        }\n      } else {\n        return Optional.none();\n      }\n    };\n    var noSizeConversion = function (_input) {\n      return Optional.none();\n    };\n    var ratioSizeConversion = function (scale, unit) {\n      return function (size) {\n        return convertUnit(size, unit).map(function (value) {\n          return {\n            value: value * scale,\n            unit: unit\n          };\n        });\n      };\n    };\n    var makeRatioConverter = function (currentFieldText, otherFieldText) {\n      var cValue = parseSize(currentFieldText).toOptional();\n      var oValue = parseSize(otherFieldText).toOptional();\n      return lift2(cValue, oValue, function (cSize, oSize) {\n        return convertUnit(cSize, oSize.unit).map(function (val) {\n          return oSize.value / val;\n        }).map(function (r) {\n          return ratioSizeConversion(r, oSize.unit);\n        }).getOr(noSizeConversion);\n      }).getOr(noSizeConversion);\n    };\n\n    var renderSizeInput = function (spec, providersBackstage) {\n      var converter = noSizeConversion;\n      var ratioEvent = generate$6('ratio-event');\n      var makeIcon = function (iconName) {\n        return render$3(iconName, {\n          tag: 'span',\n          classes: [\n            'tox-icon',\n            'tox-lock-icon__' + iconName\n          ]\n        }, providersBackstage.icons);\n      };\n      var pLock = FormCoupledInputs.parts.lock({\n        dom: {\n          tag: 'button',\n          classes: [\n            'tox-lock',\n            'tox-button',\n            'tox-button--naked',\n            'tox-button--icon'\n          ],\n          attributes: { title: providersBackstage.translate(spec.label.getOr('Constrain proportions')) }\n        },\n        components: [\n          makeIcon('lock'),\n          makeIcon('unlock')\n        ],\n        buttonBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            }\n          }),\n          receivingConfig(),\n          Tabstopping.config({})\n        ])\n      });\n      var formGroup = function (components) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-form__group']\n          },\n          components: components\n        };\n      };\n      var getFieldPart = function (isField1) {\n        return FormField.parts.field({\n          factory: Input,\n          inputClasses: ['tox-textfield'],\n          inputBehaviours: derive$1([\n            Disabling.config({\n              disabled: function () {\n                return spec.disabled || providersBackstage.isDisabled();\n              }\n            }),\n            receivingConfig(),\n            Tabstopping.config({}),\n            config('size-input-events', [\n              run$1(focusin(), function (component, _simulatedEvent) {\n                emitWith(component, ratioEvent, { isField1: isField1 });\n              }),\n              run$1(change(), function (component, _simulatedEvent) {\n                emitWith(component, formChangeEvent, { name: spec.name });\n              })\n            ])\n          ]),\n          selectOnFocus: false\n        });\n      };\n      var getLabel = function (label) {\n        return {\n          dom: {\n            tag: 'label',\n            classes: ['tox-label'],\n            innerHtml: providersBackstage.translate(label)\n          }\n        };\n      };\n      var widthField = FormCoupledInputs.parts.field1(formGroup([\n        FormField.parts.label(getLabel('Width')),\n        getFieldPart(true)\n      ]));\n      var heightField = FormCoupledInputs.parts.field2(formGroup([\n        FormField.parts.label(getLabel('Height')),\n        getFieldPart(false)\n      ]));\n      return FormCoupledInputs.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-form__group']\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-form__controls-h-stack']\n            },\n            components: [\n              widthField,\n              heightField,\n              formGroup([\n                getLabel('&nbsp;'),\n                pLock\n              ])\n            ]\n          }],\n        field1Name: 'width',\n        field2Name: 'height',\n        locked: true,\n        markers: { lockClass: 'tox-locked' },\n        onLockedChange: function (current, other, _lock) {\n          parseSize(Representing.getValue(current)).each(function (size) {\n            converter(size).each(function (newSize) {\n              Representing.setValue(other, formatSize(newSize));\n            });\n          });\n        },\n        coupledFieldBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            },\n            onDisabled: function (comp) {\n              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.disable);\n              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.disable);\n              FormCoupledInputs.getLock(comp).each(Disabling.disable);\n            },\n            onEnabled: function (comp) {\n              FormCoupledInputs.getField1(comp).bind(FormField.getField).each(Disabling.enable);\n              FormCoupledInputs.getField2(comp).bind(FormField.getField).each(Disabling.enable);\n              FormCoupledInputs.getLock(comp).each(Disabling.enable);\n            }\n          }),\n          receivingConfig(),\n          config('size-input-events2', [run$1(ratioEvent, function (component, simulatedEvent) {\n              var isField1 = simulatedEvent.event.isField1;\n              var optCurrent = isField1 ? FormCoupledInputs.getField1(component) : FormCoupledInputs.getField2(component);\n              var optOther = isField1 ? FormCoupledInputs.getField2(component) : FormCoupledInputs.getField1(component);\n              var value1 = optCurrent.map(Representing.getValue).getOr('');\n              var value2 = optOther.map(Representing.getValue).getOr('');\n              converter = makeRatioConverter(value1, value2);\n            })])\n        ])\n      });\n    };\n\n    var undo = constant$1(generate$6('undo'));\n    var redo = constant$1(generate$6('redo'));\n    var zoom = constant$1(generate$6('zoom'));\n    var back = constant$1(generate$6('back'));\n    var apply = constant$1(generate$6('apply'));\n    var swap = constant$1(generate$6('swap'));\n    var transform$1 = constant$1(generate$6('transform'));\n    var tempTransform = constant$1(generate$6('temp-transform'));\n    var transformApply = constant$1(generate$6('transform-apply'));\n    var internal = {\n      undo: undo,\n      redo: redo,\n      zoom: zoom,\n      back: back,\n      apply: apply,\n      swap: swap,\n      transform: transform$1,\n      tempTransform: tempTransform,\n      transformApply: transformApply\n    };\n    var saveState = constant$1('save-state');\n    var disable = constant$1('disable');\n    var enable = constant$1('enable');\n    var external = {\n      formActionEvent: formActionEvent,\n      saveState: saveState,\n      disable: disable,\n      enable: enable\n    };\n\n    var renderEditPanel = function (imagePanel, providersBackstage) {\n      var createButton = function (text, action, disabled, primary) {\n        return record(renderButton({\n          name: text,\n          text: text,\n          disabled: disabled,\n          primary: primary,\n          icon: Optional.none(),\n          borderless: false\n        }, action, providersBackstage));\n      };\n      var createIconButton = function (icon, tooltip, action, disabled) {\n        return record(renderIconButton({\n          name: icon,\n          icon: Optional.some(icon),\n          tooltip: Optional.some(tooltip),\n          disabled: disabled,\n          primary: false,\n          borderless: false\n        }, action, providersBackstage));\n      };\n      var disableAllComponents = function (comps, eventcomp) {\n        comps.map(function (mem) {\n          var component = mem.get(eventcomp);\n          if (component.hasConfigured(Disabling)) {\n            Disabling.disable(component);\n          }\n        });\n      };\n      var enableAllComponents = function (comps, eventcomp) {\n        comps.map(function (mem) {\n          var component = mem.get(eventcomp);\n          if (component.hasConfigured(Disabling)) {\n            Disabling.enable(component);\n          }\n        });\n      };\n      var panelDom = {\n        tag: 'div',\n        classes: [\n          'tox-image-tools__toolbar',\n          'tox-image-tools-edit-panel'\n        ]\n      };\n      var noop$1 = noop;\n      var emit$1 = function (comp, event, data) {\n        emitWith(comp, event, data);\n      };\n      var emitDisable = function (component) {\n        return emit(component, external.disable());\n      };\n      var emitEnable = function (component) {\n        return emit(component, external.enable());\n      };\n      var emitTransform = function (comp, transform) {\n        emitDisable(comp);\n        emit$1(comp, internal.transform(), { transform: transform });\n        emitEnable(comp);\n      };\n      var emitTempTransform = function (comp, transform) {\n        emitDisable(comp);\n        emit$1(comp, internal.tempTransform(), { transform: transform });\n        emitEnable(comp);\n      };\n      var getBackSwap = function (anyInSystem) {\n        return function () {\n          memContainer.getOpt(anyInSystem).each(function (container) {\n            Replacing.set(container, [ButtonPanel]);\n          });\n        };\n      };\n      var emitTransformApply = function (comp, transform) {\n        emitDisable(comp);\n        emit$1(comp, internal.transformApply(), {\n          transform: transform,\n          swap: getBackSwap(comp)\n        });\n        emitEnable(comp);\n      };\n      var createBackButton = function () {\n        return createButton('Back', function (button) {\n          return emit$1(button, internal.back(), { swap: getBackSwap(button) });\n        }, false, false);\n      };\n      var createSpacer = function () {\n        return record({\n          dom: {\n            tag: 'div',\n            classes: ['tox-spacer']\n          },\n          behaviours: derive$1([Disabling.config({})])\n        });\n      };\n      var createApplyButton = function () {\n        return createButton('Apply', function (button) {\n          return emit$1(button, internal.apply(), { swap: getBackSwap(button) });\n        }, true, true);\n      };\n      var makeCropTransform = function () {\n        return function (ir) {\n          var rect = imagePanel.getRect();\n          return crop(ir, rect.x, rect.y, rect.w, rect.h);\n        };\n      };\n      var cropPanelComponents = [\n        createBackButton(),\n        createSpacer(),\n        createButton('Apply', function (button) {\n          var transform = makeCropTransform();\n          emitTransformApply(button, transform);\n          imagePanel.hideCrop();\n        }, false, true)\n      ];\n      var CropPanel = Container.sketch({\n        dom: panelDom,\n        components: cropPanelComponents.map(function (mem) {\n          return mem.asSpec();\n        }),\n        containerBehaviours: derive$1([config('image-tools-crop-buttons-events', [\n            run$1(external.disable(), function (comp, _se) {\n              disableAllComponents(cropPanelComponents, comp);\n            }),\n            run$1(external.enable(), function (comp, _se) {\n              enableAllComponents(cropPanelComponents, comp);\n            })\n          ])])\n      });\n      var memSize = record(renderSizeInput({\n        name: 'size',\n        label: Optional.none(),\n        constrain: true,\n        disabled: false\n      }, providersBackstage));\n      var makeResizeTransform = function (width, height) {\n        return function (ir) {\n          return resize$1(ir, width, height);\n        };\n      };\n      var resizePanelComponents = [\n        createBackButton(),\n        createSpacer(),\n        memSize,\n        createSpacer(),\n        createButton('Apply', function (button) {\n          memSize.getOpt(button).each(function (sizeInput) {\n            var value = Representing.getValue(sizeInput);\n            var width = parseInt(value.width, 10);\n            var height = parseInt(value.height, 10);\n            var transform = makeResizeTransform(width, height);\n            emitTransformApply(button, transform);\n          });\n        }, false, true)\n      ];\n      var ResizePanel = Container.sketch({\n        dom: panelDom,\n        components: resizePanelComponents.map(function (mem) {\n          return mem.asSpec();\n        }),\n        containerBehaviours: derive$1([config('image-tools-resize-buttons-events', [\n            run$1(external.disable(), function (comp, _se) {\n              disableAllComponents(resizePanelComponents, comp);\n            }),\n            run$1(external.enable(), function (comp, _se) {\n              enableAllComponents(resizePanelComponents, comp);\n            })\n          ])])\n      });\n      var makeValueTransform = function (transform, value) {\n        return function (ir) {\n          return transform(ir, value);\n        };\n      };\n      var horizontalFlip = makeValueTransform(flip, 'h');\n      var verticalFlip = makeValueTransform(flip, 'v');\n      var counterclockwiseRotate = makeValueTransform(rotate, -90);\n      var clockwiseRotate = makeValueTransform(rotate, 90);\n      var flipRotateOnAction = function (comp, operation) {\n        emitTempTransform(comp, operation);\n      };\n      var flipRotateComponents = [\n        createBackButton(),\n        createSpacer(),\n        createIconButton('flip-horizontally', 'Flip horizontally', function (button) {\n          flipRotateOnAction(button, horizontalFlip);\n        }, false),\n        createIconButton('flip-vertically', 'Flip vertically', function (button) {\n          flipRotateOnAction(button, verticalFlip);\n        }, false),\n        createIconButton('rotate-left', 'Rotate counterclockwise', function (button) {\n          flipRotateOnAction(button, counterclockwiseRotate);\n        }, false),\n        createIconButton('rotate-right', 'Rotate clockwise', function (button) {\n          flipRotateOnAction(button, clockwiseRotate);\n        }, false),\n        createSpacer(),\n        createApplyButton()\n      ];\n      var FlipRotatePanel = Container.sketch({\n        dom: panelDom,\n        components: flipRotateComponents.map(function (mem) {\n          return mem.asSpec();\n        }),\n        containerBehaviours: derive$1([config('image-tools-fliprotate-buttons-events', [\n            run$1(external.disable(), function (comp, _se) {\n              disableAllComponents(flipRotateComponents, comp);\n            }),\n            run$1(external.enable(), function (comp, _se) {\n              enableAllComponents(flipRotateComponents, comp);\n            })\n          ])])\n      });\n      var makeSlider = function (label, onChoose, min, value, max) {\n        var labelPart = Slider.parts.label({\n          dom: {\n            tag: 'label',\n            classes: ['tox-label'],\n            innerHtml: providersBackstage.translate(label)\n          }\n        });\n        var spectrum = Slider.parts.spectrum({\n          dom: {\n            tag: 'div',\n            classes: ['tox-slider__rail'],\n            attributes: { role: 'presentation' }\n          }\n        });\n        var thumb = Slider.parts.thumb({\n          dom: {\n            tag: 'div',\n            classes: ['tox-slider__handle'],\n            attributes: { role: 'presentation' }\n          }\n        });\n        return record(Slider.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-slider'],\n            attributes: { role: 'presentation' }\n          },\n          model: {\n            mode: 'x',\n            minX: min,\n            maxX: max,\n            getInitialValue: constant$1({ x: value })\n          },\n          components: [\n            labelPart,\n            spectrum,\n            thumb\n          ],\n          sliderBehaviours: derive$1([Focusing.config({})]),\n          onChoose: onChoose\n        }));\n      };\n      var makeVariableSlider = function (label, transform, min, value, max) {\n        var onChoose = function (slider, _thumb, value) {\n          var valTransform = makeValueTransform(transform, value.x / 100);\n          emitTransform(slider, valTransform);\n        };\n        return makeSlider(label, onChoose, min, value, max);\n      };\n      var variableFilterPanelComponents = function (label, transform, min, value, max) {\n        return [\n          createBackButton(),\n          makeVariableSlider(label, transform, min, value, max),\n          createApplyButton()\n        ];\n      };\n      var createVariableFilterPanel = function (label, transform, min, value, max) {\n        var filterPanelComponents = variableFilterPanelComponents(label, transform, min, value, max);\n        return Container.sketch({\n          dom: panelDom,\n          components: filterPanelComponents.map(function (mem) {\n            return mem.asSpec();\n          }),\n          containerBehaviours: derive$1([config('image-tools-filter-panel-buttons-events', [\n              run$1(external.disable(), function (comp, _se) {\n                disableAllComponents(filterPanelComponents, comp);\n              }),\n              run$1(external.enable(), function (comp, _se) {\n                enableAllComponents(filterPanelComponents, comp);\n              })\n            ])])\n        });\n      };\n      var filterPanelComponents = [\n        createBackButton(),\n        createSpacer(),\n        createApplyButton()\n      ];\n      var FilterPanel = Container.sketch({\n        dom: panelDom,\n        components: filterPanelComponents.map(function (mem) {\n          return mem.asSpec();\n        })\n      });\n      var BrightnessPanel = createVariableFilterPanel('Brightness', brightness, -100, 0, 100);\n      var ContrastPanel = createVariableFilterPanel('Contrast', contrast, -100, 0, 100);\n      var GammaPanel = createVariableFilterPanel('Gamma', gamma, -100, 0, 100);\n      var makeColorTransform = function (red, green, blue) {\n        return function (ir) {\n          return colorize(ir, red, green, blue);\n        };\n      };\n      var makeColorSlider = function (label) {\n        var onChoose = function (slider, _thumb, _value) {\n          var redOpt = memRed.getOpt(slider);\n          var blueOpt = memBlue.getOpt(slider);\n          var greenOpt = memGreen.getOpt(slider);\n          redOpt.each(function (red) {\n            blueOpt.each(function (blue) {\n              greenOpt.each(function (green) {\n                var r = Representing.getValue(red).x / 100;\n                var g = Representing.getValue(green).x / 100;\n                var b = Representing.getValue(blue).x / 100;\n                var transform = makeColorTransform(r, g, b);\n                emitTransform(slider, transform);\n              });\n            });\n          });\n        };\n        return makeSlider(label, onChoose, 0, 100, 200);\n      };\n      var memRed = makeColorSlider('R');\n      var memGreen = makeColorSlider('G');\n      var memBlue = makeColorSlider('B');\n      var colorizePanelComponents = [\n        createBackButton(),\n        memRed,\n        memGreen,\n        memBlue,\n        createApplyButton()\n      ];\n      var ColorizePanel = Container.sketch({\n        dom: panelDom,\n        components: colorizePanelComponents.map(function (mem) {\n          return mem.asSpec();\n        })\n      });\n      var getTransformPanelEvent = function (panel, transform, update) {\n        return function (button) {\n          var swap = function () {\n            memContainer.getOpt(button).each(function (container) {\n              Replacing.set(container, [panel]);\n              update(container);\n            });\n          };\n          emit$1(button, internal.swap(), {\n            transform: transform,\n            swap: swap\n          });\n        };\n      };\n      var cropPanelUpdate = function (_anyInSystem) {\n        imagePanel.showCrop();\n      };\n      var resizePanelUpdate = function (anyInSystem) {\n        memSize.getOpt(anyInSystem).each(function (sizeInput) {\n          var measurements = imagePanel.getMeasurements();\n          var width = measurements.width;\n          var height = measurements.height;\n          Representing.setValue(sizeInput, {\n            width: width,\n            height: height\n          });\n        });\n      };\n      var sharpenTransform = Optional.some(sharpen);\n      var invertTransform = Optional.some(invert);\n      var buttonPanelComponents = [\n        createIconButton('crop', 'Crop', getTransformPanelEvent(CropPanel, Optional.none(), cropPanelUpdate), false),\n        createIconButton('resize', 'Resize', getTransformPanelEvent(ResizePanel, Optional.none(), resizePanelUpdate), false),\n        createIconButton('orientation', 'Orientation', getTransformPanelEvent(FlipRotatePanel, Optional.none(), noop$1), false),\n        createIconButton('brightness', 'Brightness', getTransformPanelEvent(BrightnessPanel, Optional.none(), noop$1), false),\n        createIconButton('sharpen', 'Sharpen', getTransformPanelEvent(FilterPanel, sharpenTransform, noop$1), false),\n        createIconButton('contrast', 'Contrast', getTransformPanelEvent(ContrastPanel, Optional.none(), noop$1), false),\n        createIconButton('color-levels', 'Color levels', getTransformPanelEvent(ColorizePanel, Optional.none(), noop$1), false),\n        createIconButton('gamma', 'Gamma', getTransformPanelEvent(GammaPanel, Optional.none(), noop$1), false),\n        createIconButton('invert', 'Invert', getTransformPanelEvent(FilterPanel, invertTransform, noop$1), false)\n      ];\n      var ButtonPanel = Container.sketch({\n        dom: panelDom,\n        components: buttonPanelComponents.map(function (mem) {\n          return mem.asSpec();\n        })\n      });\n      var container = Container.sketch({\n        dom: { tag: 'div' },\n        components: [ButtonPanel],\n        containerBehaviours: derive$1([Replacing.config({})])\n      });\n      var memContainer = record(container);\n      var getApplyButton = function (anyInSystem) {\n        return memContainer.getOpt(anyInSystem).map(function (container) {\n          var panel = container.components()[0];\n          return panel.components()[panel.components().length - 1];\n        });\n      };\n      return {\n        memContainer: memContainer,\n        getApplyButton: getApplyButton\n      };\n    };\n\n    var global$4 = tinymce.util.Tools.resolve('tinymce.geom.Rect');\n\n    var global$3 = tinymce.util.Tools.resolve('tinymce.util.Observable');\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.VK');\n\n    var getDocumentSize = function (doc) {\n      var max = Math.max;\n      var documentElement = doc.documentElement;\n      var body = doc.body;\n      var scrollWidth = max(documentElement.scrollWidth, body.scrollWidth);\n      var clientWidth = max(documentElement.clientWidth, body.clientWidth);\n      var offsetWidth = max(documentElement.offsetWidth, body.offsetWidth);\n      var scrollHeight = max(documentElement.scrollHeight, body.scrollHeight);\n      var clientHeight = max(documentElement.clientHeight, body.clientHeight);\n      var offsetHeight = max(documentElement.offsetHeight, body.offsetHeight);\n      return {\n        width: scrollWidth < offsetWidth ? clientWidth : scrollWidth,\n        height: scrollHeight < offsetHeight ? clientHeight : scrollHeight\n      };\n    };\n    var isTouchEvent$1 = function (e) {\n      return isNonNullable(e.changedTouches);\n    };\n    var updateWithTouchData = function (e) {\n      if (isTouchEvent$1(e)) {\n        var keys = 'screenX screenY pageX pageY clientX clientY'.split(' ');\n        for (var i = 0; i < keys.length; i++) {\n          e[keys[i]] = e.changedTouches[0][keys[i]];\n        }\n      }\n    };\n    function DragHelper (id, settings) {\n      var _a, _b, _c;\n      var eventOverlay;\n      var handleEvents = [];\n      var overlayEvents = [];\n      var doc = (_a = settings.document) !== null && _a !== void 0 ? _a : document;\n      var root = (_b = settings.root) !== null && _b !== void 0 ? _b : doc;\n      var sugarDoc = SugarElement.fromDom(doc);\n      var downButton;\n      var startX;\n      var startY;\n      var handleElement = SugarElement.fromDom(root.getElementById((_c = settings.handle) !== null && _c !== void 0 ? _c : id));\n      var start = function (e) {\n        var rawEvent = e.raw;\n        var docSize = getDocumentSize(doc);\n        updateWithTouchData(rawEvent);\n        e.prevent();\n        downButton = rawEvent.button;\n        startX = rawEvent.screenX;\n        startY = rawEvent.screenY;\n        var cursor = get$c(handleElement, 'cursor');\n        eventOverlay = SugarElement.fromTag('div', doc);\n        setAll(eventOverlay, {\n          'position': 'absolute',\n          'top': '0',\n          'left': '0',\n          'width': docSize.width + 'px',\n          'height': docSize.height + 'px',\n          'z-index': 2147483647 + '',\n          'opacity': '0.0001',\n          cursor: cursor\n        });\n        append$2(getBody(sugarDoc), eventOverlay);\n        overlayEvents.push(bind(sugarDoc, 'mousemove', drag), bind(sugarDoc, 'touchmove', drag), bind(sugarDoc, 'mouseup', stop), bind(sugarDoc, 'touchend', stop));\n        settings.start(rawEvent);\n      };\n      var drag = function (e) {\n        var rawEvent = e.raw;\n        updateWithTouchData(rawEvent);\n        if (rawEvent.button !== downButton) {\n          return stop(e);\n        }\n        rawEvent.deltaX = rawEvent.screenX - startX;\n        rawEvent.deltaY = rawEvent.screenY - startY;\n        e.prevent();\n        settings.drag(rawEvent);\n      };\n      var stop = function (e) {\n        updateWithTouchData(e.raw);\n        each$1(overlayEvents, function (e) {\n          return e.unbind();\n        });\n        overlayEvents = [];\n        remove$5(eventOverlay);\n        if (settings.stop) {\n          settings.stop(e.raw);\n        }\n      };\n      var destroy = function () {\n        each$1(overlayEvents.concat(handleEvents), function (e) {\n          return e.unbind();\n        });\n        overlayEvents = [];\n        handleEvents = [];\n        if (isNonNullable(eventOverlay)) {\n          remove$5(eventOverlay);\n        }\n      };\n      handleEvents.push(bind(handleElement, 'mousedown', start), bind(handleElement, 'touchstart', start));\n      return { destroy: destroy };\n    }\n\n    var count = 0;\n    var create$1 = function (currentRect, viewPortRect, clampRect, containerElm, action) {\n      var dragHelpers;\n      var events = [];\n      var prefix = 'tox-';\n      var id = prefix + 'crid-' + count++;\n      var container = SugarElement.fromDom(containerElm);\n      var handles = [\n        {\n          name: 'move',\n          xMul: 0,\n          yMul: 0,\n          deltaX: 1,\n          deltaY: 1,\n          deltaW: 0,\n          deltaH: 0,\n          label: 'Crop Mask'\n        },\n        {\n          name: 'nw',\n          xMul: 0,\n          yMul: 0,\n          deltaX: 1,\n          deltaY: 1,\n          deltaW: -1,\n          deltaH: -1,\n          label: 'Top Left Crop Handle'\n        },\n        {\n          name: 'ne',\n          xMul: 1,\n          yMul: 0,\n          deltaX: 0,\n          deltaY: 1,\n          deltaW: 1,\n          deltaH: -1,\n          label: 'Top Right Crop Handle'\n        },\n        {\n          name: 'sw',\n          xMul: 0,\n          yMul: 1,\n          deltaX: 1,\n          deltaY: 0,\n          deltaW: -1,\n          deltaH: 1,\n          label: 'Bottom Left Crop Handle'\n        },\n        {\n          name: 'se',\n          xMul: 1,\n          yMul: 1,\n          deltaX: 0,\n          deltaY: 0,\n          deltaW: 1,\n          deltaH: 1,\n          label: 'Bottom Right Crop Handle'\n        }\n      ];\n      var blockers = [\n        'top',\n        'right',\n        'bottom',\n        'left'\n      ];\n      var getAbsoluteRect = function (outerRect, relativeRect) {\n        return {\n          x: relativeRect.x + outerRect.x,\n          y: relativeRect.y + outerRect.y,\n          w: relativeRect.w,\n          h: relativeRect.h\n        };\n      };\n      var getRelativeRect = function (outerRect, innerRect) {\n        return {\n          x: innerRect.x - outerRect.x,\n          y: innerRect.y - outerRect.y,\n          w: innerRect.w,\n          h: innerRect.h\n        };\n      };\n      var getInnerRect = function () {\n        return getRelativeRect(clampRect, currentRect);\n      };\n      var moveRect = function (handle, startRect, deltaX, deltaY) {\n        var x = startRect.x + deltaX * handle.deltaX;\n        var y = startRect.y + deltaY * handle.deltaY;\n        var w = Math.max(20, startRect.w + deltaX * handle.deltaW);\n        var h = Math.max(20, startRect.h + deltaY * handle.deltaH);\n        var rect = currentRect = global$4.clamp({\n          x: x,\n          y: y,\n          w: w,\n          h: h\n        }, clampRect, handle.name === 'move');\n        rect = getRelativeRect(clampRect, rect);\n        instance.fire('updateRect', { rect: rect });\n        setInnerRect(rect);\n      };\n      var render = function () {\n        var createDragHelper = function (handle) {\n          var startRect;\n          return DragHelper(id, {\n            document: containerElm.ownerDocument,\n            root: getRootNode(container).dom,\n            handle: id + '-' + handle.name,\n            start: function () {\n              startRect = currentRect;\n            },\n            drag: function (e) {\n              moveRect(handle, startRect, e.deltaX, e.deltaY);\n            }\n          });\n        };\n        var cropContainer = SugarElement.fromTag('div');\n        setAll$1(cropContainer, {\n          id: id,\n          'class': prefix + 'croprect-container',\n          'role': 'grid',\n          'aria-dropeffect': 'execute'\n        });\n        append$2(container, cropContainer);\n        each$1(blockers, function (blocker) {\n          descendant(container, '#' + id).each(function (blockerElm) {\n            var cropBlocker = SugarElement.fromTag('div');\n            setAll$1(cropBlocker, {\n              'id': id + '-' + blocker,\n              'class': prefix + 'croprect-block',\n              'data-mce-bogus': 'all'\n            });\n            set$7(cropBlocker, 'display', 'none');\n            append$2(blockerElm, cropBlocker);\n          });\n        });\n        each$1(handles, function (handle) {\n          descendant(container, '#' + id).each(function (handleElm) {\n            var cropHandle = SugarElement.fromTag('div');\n            setAll$1(cropHandle, {\n              'id': id + '-' + handle.name,\n              'aria-label': handle.label,\n              'aria-grabbed': 'false',\n              'data-mce-bogus': 'all',\n              'role': 'gridcell',\n              'tabindex': '-1',\n              'title': handle.label\n            });\n            add$1(cropHandle, [\n              prefix + 'croprect-handle',\n              prefix + 'croprect-handle-' + handle.name\n            ]);\n            set$7(cropHandle, 'display', 'none');\n            append$2(handleElm, cropHandle);\n          });\n        });\n        dragHelpers = map$2(handles, createDragHelper);\n        repaint(currentRect);\n        var handleFocus = function (e) {\n          set$8(e.target, 'aria-grabbed', e.raw.type === 'focus' ? 'true' : 'false');\n        };\n        var handleKeydown = function (e) {\n          var activeHandle;\n          each$1(handles, function (handle) {\n            if (get$d(e.target, 'id') === id + '-' + handle.name) {\n              activeHandle = handle;\n              return false;\n            }\n          });\n          var moveAndBlock = function (evt, handle, startRect, deltaX, deltaY) {\n            evt.stopPropagation();\n            evt.preventDefault();\n            moveRect(activeHandle, startRect, deltaX, deltaY);\n          };\n          switch (e.raw.keyCode) {\n          case global$2.LEFT:\n            moveAndBlock(e, activeHandle, currentRect, -10, 0);\n            break;\n          case global$2.RIGHT:\n            moveAndBlock(e, activeHandle, currentRect, 10, 0);\n            break;\n          case global$2.UP:\n            moveAndBlock(e, activeHandle, currentRect, 0, -10);\n            break;\n          case global$2.DOWN:\n            moveAndBlock(e, activeHandle, currentRect, 0, 10);\n            break;\n          case global$2.ENTER:\n          case global$2.SPACEBAR:\n            e.prevent();\n            action();\n            break;\n          }\n        };\n        events.push(bind(container, 'focusin', handleFocus), bind(container, 'focusout', handleFocus), bind(container, 'keydown', handleKeydown));\n      };\n      var toggleVisibility = function (state) {\n        var selectors = __spreadArray(__spreadArray([], map$2(handles, function (handle) {\n          return '#' + id + '-' + handle.name;\n        }), true), map$2(blockers, function (blocker) {\n          return '#' + id + '-' + blocker;\n        }), true).join(',');\n        var elems = descendants(container, selectors);\n        if (state) {\n          each$1(elems, function (elm) {\n            return remove$6(elm, 'display');\n          });\n        } else {\n          each$1(elems, function (elm) {\n            return set$7(elm, 'display', 'none');\n          });\n        }\n      };\n      var repaint = function (rect) {\n        var updateElementRect = function (name, newRect) {\n          descendant(container, '#' + id + '-' + name).each(function (elm) {\n            setAll(elm, {\n              left: newRect.x + 'px',\n              top: newRect.y + 'px',\n              width: Math.max(0, newRect.w) + 'px',\n              height: Math.max(0, newRect.h) + 'px'\n            });\n          });\n        };\n        each$1(handles, function (handle) {\n          descendant(container, '#' + id + '-' + handle.name).each(function (elm) {\n            setAll(elm, {\n              left: rect.w * handle.xMul + rect.x + 'px',\n              top: rect.h * handle.yMul + rect.y + 'px'\n            });\n          });\n        });\n        updateElementRect('top', {\n          x: viewPortRect.x,\n          y: viewPortRect.y,\n          w: viewPortRect.w,\n          h: rect.y - viewPortRect.y\n        });\n        updateElementRect('right', {\n          x: rect.x + rect.w,\n          y: rect.y,\n          w: viewPortRect.w - rect.x - rect.w + viewPortRect.x,\n          h: rect.h\n        });\n        updateElementRect('bottom', {\n          x: viewPortRect.x,\n          y: rect.y + rect.h,\n          w: viewPortRect.w,\n          h: viewPortRect.h - rect.y - rect.h + viewPortRect.y\n        });\n        updateElementRect('left', {\n          x: viewPortRect.x,\n          y: rect.y,\n          w: rect.x - viewPortRect.x,\n          h: rect.h\n        });\n        updateElementRect('move', rect);\n      };\n      var setRect = function (rect) {\n        currentRect = rect;\n        repaint(currentRect);\n      };\n      var setViewPortRect = function (rect) {\n        viewPortRect = rect;\n        repaint(currentRect);\n      };\n      var setInnerRect = function (rect) {\n        setRect(getAbsoluteRect(clampRect, rect));\n      };\n      var setClampRect = function (rect) {\n        clampRect = rect;\n        repaint(currentRect);\n      };\n      var destroy = function () {\n        each$1(dragHelpers, function (helper) {\n          return helper.destroy();\n        });\n        dragHelpers = [];\n        each$1(events, function (e) {\n          return e.unbind();\n        });\n        events = [];\n      };\n      render();\n      var instance = __assign(__assign({}, global$3), {\n        toggleVisibility: toggleVisibility,\n        setClampRect: setClampRect,\n        setRect: setRect,\n        getInnerRect: getInnerRect,\n        setInnerRect: setInnerRect,\n        setViewPortRect: setViewPortRect,\n        destroy: destroy\n      });\n      return instance;\n    };\n    var CropRect = { create: create$1 };\n\n    var loadImage = function (image) {\n      return new global$c(function (resolve) {\n        var loaded = function () {\n          image.removeEventListener('load', loaded);\n          resolve(image);\n        };\n        if (image.complete) {\n          resolve(image);\n        } else {\n          image.addEventListener('load', loaded);\n        }\n      });\n    };\n    var renderImagePanel = function (initialUrl) {\n      var memBg = record({\n        dom: {\n          tag: 'div',\n          classes: ['tox-image-tools__image-bg'],\n          attributes: { role: 'presentation' }\n        }\n      });\n      var zoomState = Cell(1);\n      var cropRect = api$1();\n      var rectState = Cell({\n        x: 0,\n        y: 0,\n        w: 1,\n        h: 1\n      });\n      var viewRectState = Cell({\n        x: 0,\n        y: 0,\n        w: 1,\n        h: 1\n      });\n      var repaintImg = function (anyInSystem, img) {\n        memContainer.getOpt(anyInSystem).each(function (panel) {\n          var zoom = zoomState.get();\n          var panelW = get$a(panel.element);\n          var panelH = get$b(panel.element);\n          var width = img.dom.naturalWidth * zoom;\n          var height = img.dom.naturalHeight * zoom;\n          var left = Math.max(0, panelW / 2 - width / 2);\n          var top = Math.max(0, panelH / 2 - height / 2);\n          var css = {\n            left: left.toString() + 'px',\n            top: top.toString() + 'px',\n            width: width.toString() + 'px',\n            height: height.toString() + 'px',\n            position: 'absolute'\n          };\n          setAll(img, css);\n          memBg.getOpt(panel).each(function (bg) {\n            setAll(bg.element, css);\n          });\n          cropRect.run(function (cRect) {\n            var rect = rectState.get();\n            cRect.setRect({\n              x: rect.x * zoom + left,\n              y: rect.y * zoom + top,\n              w: rect.w * zoom,\n              h: rect.h * zoom\n            });\n            cRect.setClampRect({\n              x: left,\n              y: top,\n              w: width,\n              h: height\n            });\n            cRect.setViewPortRect({\n              x: 0,\n              y: 0,\n              w: panelW,\n              h: panelH\n            });\n          });\n        });\n      };\n      var zoomFit = function (anyInSystem, img) {\n        memContainer.getOpt(anyInSystem).each(function (panel) {\n          var panelW = get$a(panel.element);\n          var panelH = get$b(panel.element);\n          var width = img.dom.naturalWidth;\n          var height = img.dom.naturalHeight;\n          var zoom = Math.min(panelW / width, panelH / height);\n          if (zoom >= 1) {\n            zoomState.set(1);\n          } else {\n            zoomState.set(zoom);\n          }\n        });\n      };\n      var updateSrc = function (anyInSystem, url) {\n        var img = SugarElement.fromTag('img');\n        set$8(img, 'src', url);\n        return loadImage(img.dom).then(function () {\n          if (anyInSystem.getSystem().isConnected()) {\n            memContainer.getOpt(anyInSystem).map(function (panel) {\n              var aImg = external$2({ element: img });\n              Replacing.replaceAt(panel, 1, Optional.some(aImg));\n              var lastViewRect = viewRectState.get();\n              var viewRect = {\n                x: 0,\n                y: 0,\n                w: img.dom.naturalWidth,\n                h: img.dom.naturalHeight\n              };\n              viewRectState.set(viewRect);\n              var rect = global$4.inflate(viewRect, -20, -20);\n              rectState.set(rect);\n              if (lastViewRect.w !== viewRect.w || lastViewRect.h !== viewRect.h) {\n                zoomFit(panel, img);\n              }\n              repaintImg(panel, img);\n            });\n          }\n        });\n      };\n      var zoom = function (anyInSystem, direction) {\n        var currentZoom = zoomState.get();\n        var newZoom = direction > 0 ? Math.min(2, currentZoom + 0.1) : Math.max(0.1, currentZoom - 0.1);\n        zoomState.set(newZoom);\n        memContainer.getOpt(anyInSystem).each(function (panel) {\n          var img = panel.components()[1].element;\n          repaintImg(panel, img);\n        });\n      };\n      var showCrop = function () {\n        cropRect.run(function (cRect) {\n          cRect.toggleVisibility(true);\n        });\n      };\n      var hideCrop = function () {\n        cropRect.run(function (cRect) {\n          cRect.toggleVisibility(false);\n        });\n      };\n      var getRect = function () {\n        return rectState.get();\n      };\n      var container = Container.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-image-tools__image']\n        },\n        components: [\n          memBg.asSpec(),\n          {\n            dom: {\n              tag: 'img',\n              attributes: { src: initialUrl }\n            }\n          },\n          {\n            dom: { tag: 'div' },\n            behaviours: derive$1([config('image-panel-crop-events', [\n                runOnAttached(function (comp) {\n                  memContainer.getOpt(comp).each(function (container) {\n                    var el = container.element.dom;\n                    var cRect = CropRect.create({\n                      x: 10,\n                      y: 10,\n                      w: 100,\n                      h: 100\n                    }, {\n                      x: 0,\n                      y: 0,\n                      w: 200,\n                      h: 200\n                    }, {\n                      x: 0,\n                      y: 0,\n                      w: 200,\n                      h: 200\n                    }, el, noop);\n                    cRect.toggleVisibility(false);\n                    cRect.on('updateRect', function (e) {\n                      var rect = e.rect;\n                      var zoom = zoomState.get();\n                      var newRect = {\n                        x: Math.round(rect.x / zoom),\n                        y: Math.round(rect.y / zoom),\n                        w: Math.round(rect.w / zoom),\n                        h: Math.round(rect.h / zoom)\n                      };\n                      rectState.set(newRect);\n                    });\n                    cropRect.set(cRect);\n                  });\n                }),\n                runOnDetached(function () {\n                  cropRect.clear();\n                })\n              ])])\n          }\n        ],\n        containerBehaviours: derive$1([\n          Replacing.config({}),\n          config('image-panel-events', [runOnAttached(function (comp) {\n              updateSrc(comp, initialUrl);\n            })])\n        ])\n      });\n      var memContainer = record(container);\n      var getMeasurements = function () {\n        var viewRect = viewRectState.get();\n        return {\n          width: viewRect.w,\n          height: viewRect.h\n        };\n      };\n      return {\n        memContainer: memContainer,\n        updateSrc: updateSrc,\n        zoom: zoom,\n        showCrop: showCrop,\n        hideCrop: hideCrop,\n        getRect: getRect,\n        getMeasurements: getMeasurements\n      };\n    };\n\n    var createButton = function (innerHtml, icon, disabled, action, providersBackstage) {\n      return renderIconButton({\n        name: innerHtml,\n        icon: Optional.some(icon),\n        disabled: disabled,\n        tooltip: Optional.some(innerHtml),\n        primary: false,\n        borderless: false\n      }, action, providersBackstage);\n    };\n    var setButtonEnabled = function (button, enabled) {\n      if (enabled) {\n        Disabling.enable(button);\n      } else {\n        Disabling.disable(button);\n      }\n    };\n    var renderSideBar = function (providersBackstage) {\n      var updateButtonUndoStates = function (anyInSystem, undoEnabled, redoEnabled) {\n        memUndo.getOpt(anyInSystem).each(function (undo) {\n          setButtonEnabled(undo, undoEnabled);\n        });\n        memRedo.getOpt(anyInSystem).each(function (redo) {\n          setButtonEnabled(redo, redoEnabled);\n        });\n      };\n      var memUndo = record(createButton('Undo', 'undo', true, function (button) {\n        emitWith(button, internal.undo(), { direction: 1 });\n      }, providersBackstage));\n      var memRedo = record(createButton('Redo', 'redo', true, function (button) {\n        emitWith(button, internal.redo(), { direction: 1 });\n      }, providersBackstage));\n      var container = Container.sketch({\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-image-tools__toolbar',\n            'tox-image-tools__sidebar'\n          ]\n        },\n        components: [\n          memUndo.asSpec(),\n          memRedo.asSpec(),\n          createButton('Zoom in', 'zoom-in', false, function (button) {\n            emitWith(button, internal.zoom(), { direction: 1 });\n          }, providersBackstage),\n          createButton('Zoom out', 'zoom-out', false, function (button) {\n            emitWith(button, internal.zoom(), { direction: -1 });\n          }, providersBackstage)\n        ]\n      });\n      return {\n        container: container,\n        updateButtonUndoStates: updateButtonUndoStates\n      };\n    };\n\n    function UndoStack () {\n      var data = [];\n      var index = -1;\n      var add = function (state) {\n        var removed = data.splice(++index);\n        data.push(state);\n        return {\n          state: state,\n          removed: removed\n        };\n      };\n      var undo = function () {\n        if (canUndo()) {\n          return data[--index];\n        }\n      };\n      var redo = function () {\n        if (canRedo()) {\n          return data[++index];\n        }\n      };\n      var canUndo = function () {\n        return index > 0;\n      };\n      var canRedo = function () {\n        return index !== -1 && index < data.length - 1;\n      };\n      return {\n        data: data,\n        add: add,\n        undo: undo,\n        redo: redo,\n        canUndo: canUndo,\n        canRedo: canRedo\n      };\n    }\n\n    var makeState = function (initialState) {\n      var blobState = Cell(initialState);\n      var tempState = value$1();\n      var undoStack = UndoStack();\n      undoStack.add(initialState);\n      var getBlobState = function () {\n        return blobState.get();\n      };\n      var setBlobState = function (state) {\n        blobState.set(state);\n      };\n      var getTempState = function () {\n        return tempState.get().getOrThunk(blobState.get);\n      };\n      var updateTempState = function (blob) {\n        var newTempState = createState(blob);\n        destroyTempState();\n        tempState.set(newTempState);\n        return newTempState.url;\n      };\n      var createState = function (blob) {\n        return {\n          blob: blob,\n          url: URL.createObjectURL(blob)\n        };\n      };\n      var destroyState = function (state) {\n        URL.revokeObjectURL(state.url);\n      };\n      var destroyStates = function (states) {\n        global$5.each(states, destroyState);\n      };\n      var destroyTempState = function () {\n        tempState.on(destroyState);\n        tempState.clear();\n      };\n      var addBlobState = function (blob) {\n        var newState = createState(blob);\n        setBlobState(newState);\n        var removed = undoStack.add(newState).removed;\n        destroyStates(removed);\n        return newState.url;\n      };\n      var addTempState = function (blob) {\n        var newState = createState(blob);\n        tempState.set(newState);\n        return newState.url;\n      };\n      var applyTempState = function (postApply) {\n        return tempState.get().fold(noop, function (temp) {\n          addBlobState(temp.blob);\n          postApply();\n        });\n      };\n      var undo = function () {\n        var currentState = undoStack.undo();\n        setBlobState(currentState);\n        return currentState.url;\n      };\n      var redo = function () {\n        var currentState = undoStack.redo();\n        setBlobState(currentState);\n        return currentState.url;\n      };\n      var getHistoryStates = function () {\n        var undoEnabled = undoStack.canUndo();\n        var redoEnabled = undoStack.canRedo();\n        return {\n          undoEnabled: undoEnabled,\n          redoEnabled: redoEnabled\n        };\n      };\n      return {\n        getBlobState: getBlobState,\n        setBlobState: setBlobState,\n        addBlobState: addBlobState,\n        getTempState: getTempState,\n        updateTempState: updateTempState,\n        addTempState: addTempState,\n        applyTempState: applyTempState,\n        destroyTempState: destroyTempState,\n        undo: undo,\n        redo: redo,\n        getHistoryStates: getHistoryStates\n      };\n    };\n\n    var renderImageTools = function (detail, providersBackstage) {\n      var state = makeState(detail.currentState);\n      var zoom = function (anyInSystem, simulatedEvent) {\n        var direction = simulatedEvent.event.direction;\n        imagePanel.zoom(anyInSystem, direction);\n      };\n      var updateButtonUndoStates = function (anyInSystem) {\n        var historyStates = state.getHistoryStates();\n        sideBar.updateButtonUndoStates(anyInSystem, historyStates.undoEnabled, historyStates.redoEnabled);\n        emitWith(anyInSystem, external.formActionEvent, {\n          name: external.saveState(),\n          value: historyStates.undoEnabled\n        });\n      };\n      var disableUndoRedo = function (anyInSystem) {\n        sideBar.updateButtonUndoStates(anyInSystem, false, false);\n      };\n      var undo = function (anyInSystem, _simulatedEvent) {\n        var url = state.undo();\n        updateSrc(anyInSystem, url).then(function (_oImg) {\n          unblock(anyInSystem);\n          updateButtonUndoStates(anyInSystem);\n        });\n      };\n      var redo = function (anyInSystem, _simulatedEvent) {\n        var url = state.redo();\n        updateSrc(anyInSystem, url).then(function (_oImg) {\n          unblock(anyInSystem);\n          updateButtonUndoStates(anyInSystem);\n        });\n      };\n      var imageResultToBlob = function (ir) {\n        return ir.toBlob();\n      };\n      var block = function (anyInSystem) {\n        emitWith(anyInSystem, external.formActionEvent, {\n          name: external.disable(),\n          value: {}\n        });\n      };\n      var unblock = function (anyInSystem) {\n        editPanel.getApplyButton(anyInSystem).each(function (applyButton) {\n          Disabling.enable(applyButton);\n        });\n        emitWith(anyInSystem, external.formActionEvent, {\n          name: external.enable(),\n          value: {}\n        });\n      };\n      var updateSrc = function (anyInSystem, src) {\n        block(anyInSystem);\n        return imagePanel.updateSrc(anyInSystem, src);\n      };\n      var blobManipulate = function (anyInSystem, blob, filter, action, swap) {\n        block(anyInSystem);\n        blobToImageResult(blob).then(filter).then(imageResultToBlob).then(action).then(function (url) {\n          return updateSrc(anyInSystem, url);\n        }).then(function () {\n          updateButtonUndoStates(anyInSystem);\n          swap();\n          unblock(anyInSystem);\n        }).catch(function (err) {\n          console.log(err);\n          if (anyInSystem.getSystem().isConnected()) {\n            unblock(anyInSystem);\n          }\n        });\n      };\n      var manipulate = function (anyInSystem, filter, swap) {\n        var blob = state.getBlobState().blob;\n        var action = function (blob) {\n          return state.updateTempState(blob);\n        };\n        blobManipulate(anyInSystem, blob, filter, action, swap);\n      };\n      var tempManipulate = function (anyInSystem, filter) {\n        var blob = state.getTempState().blob;\n        var action = function (blob) {\n          return state.addTempState(blob);\n        };\n        blobManipulate(anyInSystem, blob, filter, action, noop);\n      };\n      var manipulateApply = function (anyInSystem, filter, swap) {\n        var blob = state.getBlobState().blob;\n        var action = function (blob) {\n          var url = state.addBlobState(blob);\n          destroyTempState(anyInSystem);\n          return url;\n        };\n        blobManipulate(anyInSystem, blob, filter, action, swap);\n      };\n      var apply = function (anyInSystem, simulatedEvent) {\n        var postApply = function () {\n          destroyTempState(anyInSystem);\n          var swap = simulatedEvent.event.swap;\n          swap();\n        };\n        state.applyTempState(postApply);\n      };\n      var destroyTempState = function (anyInSystem) {\n        var currentUrl = state.getBlobState().url;\n        state.destroyTempState();\n        updateButtonUndoStates(anyInSystem);\n        return currentUrl;\n      };\n      var cancel = function (anyInSystem) {\n        var currentUrl = destroyTempState(anyInSystem);\n        updateSrc(anyInSystem, currentUrl).then(function (_oImg) {\n          unblock(anyInSystem);\n        });\n      };\n      var back = function (anyInSystem, simulatedEvent) {\n        cancel(anyInSystem);\n        var swap = simulatedEvent.event.swap;\n        swap();\n        imagePanel.hideCrop();\n      };\n      var transform = function (anyInSystem, simulatedEvent) {\n        return manipulate(anyInSystem, simulatedEvent.event.transform, noop);\n      };\n      var tempTransform = function (anyInSystem, simulatedEvent) {\n        return tempManipulate(anyInSystem, simulatedEvent.event.transform);\n      };\n      var transformApply = function (anyInSystem, simulatedEvent) {\n        return manipulateApply(anyInSystem, simulatedEvent.event.transform, simulatedEvent.event.swap);\n      };\n      var imagePanel = renderImagePanel(detail.currentState.url);\n      var sideBar = renderSideBar(providersBackstage);\n      var editPanel = renderEditPanel(imagePanel, providersBackstage);\n      var swap = function (anyInSystem, simulatedEvent) {\n        disableUndoRedo(anyInSystem);\n        var transform = simulatedEvent.event.transform;\n        var swap = simulatedEvent.event.swap;\n        transform.fold(function () {\n          swap();\n        }, function (transform) {\n          manipulate(anyInSystem, transform, swap);\n        });\n      };\n      return {\n        dom: {\n          tag: 'div',\n          attributes: { role: 'presentation' }\n        },\n        components: [\n          editPanel.memContainer.asSpec(),\n          imagePanel.memContainer.asSpec(),\n          sideBar.container\n        ],\n        behaviours: derive$1([\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function () {\n                return state.getBlobState();\n              }\n            }\n          }),\n          config('image-tools-events', [\n            run$1(internal.undo(), undo),\n            run$1(internal.redo(), redo),\n            run$1(internal.zoom(), zoom),\n            run$1(internal.back(), back),\n            run$1(internal.apply(), apply),\n            run$1(internal.transform(), transform),\n            run$1(internal.tempTransform(), tempTransform),\n            run$1(internal.transformApply(), transformApply),\n            run$1(internal.swap(), swap)\n          ]),\n          ComposingConfigs.self()\n        ])\n      };\n    };\n\n    var renderLabel = function (spec, backstageShared) {\n      var label = {\n        dom: {\n          tag: 'label',\n          innerHtml: backstageShared.providers.translate(spec.label),\n          classes: ['tox-label']\n        }\n      };\n      var comps = map$2(spec.items, backstageShared.interpreter);\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-form__group']\n        },\n        components: [label].concat(comps),\n        behaviours: derive$1([\n          ComposingConfigs.self(),\n          Replacing.config({}),\n          RepresentingConfigs.domHtml(Optional.none()),\n          Keying.config({ mode: 'acyclic' })\n        ])\n      };\n    };\n\n    var isSingleListItem = function (item) {\n      return !has$2(item, 'items');\n    };\n    var dataAttribute = 'data-value';\n    var fetchItems = function (dropdownComp, name, items, selectedValue) {\n      return map$2(items, function (item) {\n        if (!isSingleListItem(item)) {\n          return {\n            type: 'nestedmenuitem',\n            text: item.text,\n            getSubmenuItems: function () {\n              return fetchItems(dropdownComp, name, item.items, selectedValue);\n            }\n          };\n        } else {\n          return {\n            type: 'togglemenuitem',\n            text: item.text,\n            value: item.value,\n            active: item.value === selectedValue,\n            onAction: function () {\n              Representing.setValue(dropdownComp, item.value);\n              emitWith(dropdownComp, formChangeEvent, { name: name });\n              Focusing.focus(dropdownComp);\n            }\n          };\n        }\n      });\n    };\n    var findItemByValue = function (items, value) {\n      return findMap(items, function (item) {\n        if (!isSingleListItem(item)) {\n          return findItemByValue(item.items, value);\n        } else {\n          return someIf(item.value === value, item);\n        }\n      });\n    };\n    var renderListBox = function (spec, backstage) {\n      var providersBackstage = backstage.shared.providers;\n      var initialItem = head(spec.items).filter(isSingleListItem);\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var pField = FormField.parts.field({\n        dom: {},\n        factory: {\n          sketch: function (sketchSpec) {\n            return renderCommonDropdown({\n              uid: sketchSpec.uid,\n              text: initialItem.map(function (item) {\n                return item.text;\n              }),\n              icon: Optional.none(),\n              tooltip: spec.label,\n              role: Optional.none(),\n              fetch: function (comp, callback) {\n                var items = fetchItems(comp, spec.name, spec.items, Representing.getValue(comp));\n                callback(build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false));\n              },\n              onSetup: constant$1(noop),\n              getApi: constant$1({}),\n              columns: 1,\n              presets: 'normal',\n              classes: [],\n              dropdownBehaviours: [\n                Tabstopping.config({}),\n                Representing.config({\n                  store: {\n                    mode: 'manual',\n                    initialValue: initialItem.map(function (item) {\n                      return item.value;\n                    }).getOr(''),\n                    getValue: function (comp) {\n                      return get$d(comp.element, dataAttribute);\n                    },\n                    setValue: function (comp, data) {\n                      findItemByValue(spec.items, data).each(function (item) {\n                        set$8(comp.element, dataAttribute, item.value);\n                        emitWith(comp, updateMenuText, { text: item.text });\n                      });\n                    }\n                  }\n                })\n              ]\n            }, 'tox-listbox', backstage.shared);\n          }\n        }\n      });\n      var listBoxWrap = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-listboxfield']\n        },\n        components: [pField]\n      };\n      return FormField.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-form__group']\n        },\n        components: flatten([\n          pLabel.toArray(),\n          [listBoxWrap]\n        ]),\n        fieldBehaviours: derive$1([Disabling.config({\n            disabled: constant$1(spec.disabled),\n            onDisabled: function (comp) {\n              FormField.getField(comp).each(Disabling.disable);\n            },\n            onEnabled: function (comp) {\n              FormField.getField(comp).each(Disabling.enable);\n            }\n          })])\n      });\n    };\n\n    var renderPanel = function (spec, backstage) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: spec.classes\n        },\n        components: map$2(spec.items, backstage.shared.interpreter)\n      };\n    };\n\n    var factory$e = function (detail, _spec) {\n      var options = map$2(detail.options, function (option) {\n        return {\n          dom: {\n            tag: 'option',\n            value: option.value,\n            innerHtml: option.text\n          }\n        };\n      });\n      var initialValues = detail.data.map(function (v) {\n        return wrap$1('initialValue', v);\n      }).getOr({});\n      return {\n        uid: detail.uid,\n        dom: {\n          tag: 'select',\n          classes: detail.selectClasses,\n          attributes: detail.selectAttributes\n        },\n        components: options,\n        behaviours: augment(detail.selectBehaviours, [\n          Focusing.config({}),\n          Representing.config({\n            store: __assign({\n              mode: 'manual',\n              getValue: function (select) {\n                return get$5(select.element);\n              },\n              setValue: function (select, newValue) {\n                var found = find$5(detail.options, function (opt) {\n                  return opt.value === newValue;\n                });\n                if (found.isSome()) {\n                  set$4(select.element, newValue);\n                }\n              }\n            }, initialValues)\n          })\n        ])\n      };\n    };\n    var HtmlSelect = single({\n      name: 'HtmlSelect',\n      configFields: [\n        required$1('options'),\n        field('selectBehaviours', [\n          Focusing,\n          Representing\n        ]),\n        defaulted('selectClasses', []),\n        defaulted('selectAttributes', {}),\n        option('data')\n      ],\n      factory: factory$e\n    });\n\n    var renderSelectBox = function (spec, providersBackstage) {\n      var translatedOptions = map$2(spec.items, function (item) {\n        return {\n          text: providersBackstage.translate(item.text),\n          value: item.value\n        };\n      });\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var pField = FormField.parts.field({\n        dom: {},\n        selectAttributes: { size: spec.size },\n        options: translatedOptions,\n        factory: HtmlSelect,\n        selectBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            }\n          }),\n          Tabstopping.config({}),\n          config('selectbox-change', [run$1(change(), function (component, _) {\n              emitWith(component, formChangeEvent, { name: spec.name });\n            })])\n        ])\n      });\n      var chevron = spec.size > 1 ? Optional.none() : Optional.some(render$3('chevron-down', {\n        tag: 'div',\n        classes: ['tox-selectfield__icon-js']\n      }, providersBackstage.icons));\n      var selectWrap = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-selectfield']\n        },\n        components: flatten([\n          [pField],\n          chevron.toArray()\n        ])\n      };\n      return FormField.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-form__group']\n        },\n        components: flatten([\n          pLabel.toArray(),\n          [selectWrap]\n        ]),\n        fieldBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            },\n            onDisabled: function (comp) {\n              FormField.getField(comp).each(Disabling.disable);\n            },\n            onEnabled: function (comp) {\n              FormField.getField(comp).each(Disabling.enable);\n            }\n          }),\n          receivingConfig()\n        ])\n      });\n    };\n\n    var renderTable = function (spec, providersBackstage) {\n      var renderTh = function (text) {\n        return {\n          dom: {\n            tag: 'th',\n            innerHtml: providersBackstage.translate(text)\n          }\n        };\n      };\n      var renderHeader = function (header) {\n        return {\n          dom: { tag: 'thead' },\n          components: [{\n              dom: { tag: 'tr' },\n              components: map$2(header, renderTh)\n            }]\n        };\n      };\n      var renderTd = function (text) {\n        return {\n          dom: {\n            tag: 'td',\n            innerHtml: providersBackstage.translate(text)\n          }\n        };\n      };\n      var renderTr = function (row) {\n        return {\n          dom: { tag: 'tr' },\n          components: map$2(row, renderTd)\n        };\n      };\n      var renderRows = function (rows) {\n        return {\n          dom: { tag: 'tbody' },\n          components: map$2(rows, renderTr)\n        };\n      };\n      return {\n        dom: {\n          tag: 'table',\n          classes: ['tox-dialog__table']\n        },\n        components: [\n          renderHeader(spec.header),\n          renderRows(spec.cells)\n        ],\n        behaviours: derive$1([\n          Tabstopping.config({}),\n          Focusing.config({})\n        ])\n      };\n    };\n\n    var renderTextField = function (spec, providersBackstage) {\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var baseInputBehaviours = [\n        Disabling.config({\n          disabled: function () {\n            return spec.disabled || providersBackstage.isDisabled();\n          }\n        }),\n        receivingConfig(),\n        Keying.config({\n          mode: 'execution',\n          useEnter: spec.multiline !== true,\n          useControlEnter: spec.multiline === true,\n          execute: function (comp) {\n            emit(comp, formSubmitEvent);\n            return Optional.some(true);\n          }\n        }),\n        config('textfield-change', [\n          run$1(input(), function (component, _) {\n            emitWith(component, formChangeEvent, { name: spec.name });\n          }),\n          run$1(postPaste(), function (component, _) {\n            emitWith(component, formChangeEvent, { name: spec.name });\n          })\n        ]),\n        Tabstopping.config({})\n      ];\n      var validatingBehaviours = spec.validation.map(function (vl) {\n        return Invalidating.config({\n          getRoot: function (input) {\n            return parent(input.element);\n          },\n          invalidClass: 'tox-invalid',\n          validator: {\n            validate: function (input) {\n              var v = Representing.getValue(input);\n              var result = vl.validator(v);\n              return Future.pure(result === true ? Result.value(v) : Result.error(result));\n            },\n            validateOnLoad: vl.validateOnLoad\n          }\n        });\n      }).toArray();\n      var placeholder = spec.placeholder.fold(constant$1({}), function (p) {\n        return { placeholder: providersBackstage.translate(p) };\n      });\n      var inputMode = spec.inputMode.fold(constant$1({}), function (mode) {\n        return { inputmode: mode };\n      });\n      var inputAttributes = __assign(__assign({}, placeholder), inputMode);\n      var pField = FormField.parts.field({\n        tag: spec.multiline === true ? 'textarea' : 'input',\n        inputAttributes: inputAttributes,\n        inputClasses: [spec.classname],\n        inputBehaviours: derive$1(flatten([\n          baseInputBehaviours,\n          validatingBehaviours\n        ])),\n        selectOnFocus: false,\n        factory: Input\n      });\n      var extraClasses = spec.flex ? ['tox-form__group--stretched'] : [];\n      var extraClasses2 = extraClasses.concat(spec.maximized ? ['tox-form-group--maximize'] : []);\n      var extraBehaviours = [\n        Disabling.config({\n          disabled: function () {\n            return spec.disabled || providersBackstage.isDisabled();\n          },\n          onDisabled: function (comp) {\n            FormField.getField(comp).each(Disabling.disable);\n          },\n          onEnabled: function (comp) {\n            FormField.getField(comp).each(Disabling.enable);\n          }\n        }),\n        receivingConfig()\n      ];\n      return renderFormFieldWith(pLabel, pField, extraClasses2, extraBehaviours);\n    };\n    var renderInput = function (spec, providersBackstage) {\n      return renderTextField({\n        name: spec.name,\n        multiline: false,\n        label: spec.label,\n        inputMode: spec.inputMode,\n        placeholder: spec.placeholder,\n        flex: false,\n        disabled: spec.disabled,\n        classname: 'tox-textfield',\n        validation: Optional.none(),\n        maximized: spec.maximized\n      }, providersBackstage);\n    };\n    var renderTextarea = function (spec, providersBackstage) {\n      return renderTextField({\n        name: spec.name,\n        multiline: true,\n        label: spec.label,\n        inputMode: Optional.none(),\n        placeholder: spec.placeholder,\n        flex: true,\n        disabled: spec.disabled,\n        classname: 'tox-textarea',\n        validation: Optional.none(),\n        maximized: spec.maximized\n      }, providersBackstage);\n    };\n\n    var events$6 = function (streamConfig, streamState) {\n      var streams = streamConfig.stream.streams;\n      var processor = streams.setup(streamConfig, streamState);\n      return derive$2([\n        run$1(streamConfig.event, processor),\n        runOnDetached(function () {\n          return streamState.cancel();\n        })\n      ].concat(streamConfig.cancelEvent.map(function (e) {\n        return [run$1(e, function () {\n            return streamState.cancel();\n          })];\n      }).getOr([])));\n    };\n\n    var ActiveStreaming = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$6\n    });\n\n    var throttle = function (_config) {\n      var state = Cell(null);\n      var readState = function () {\n        return { timer: state.get() !== null ? 'set' : 'unset' };\n      };\n      var setTimer = function (t) {\n        state.set(t);\n      };\n      var cancel = function () {\n        var t = state.get();\n        if (t !== null) {\n          t.cancel();\n        }\n      };\n      return nu$8({\n        readState: readState,\n        setTimer: setTimer,\n        cancel: cancel\n      });\n    };\n    var init$9 = function (spec) {\n      return spec.stream.streams.state(spec);\n    };\n\n    var StreamingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        throttle: throttle,\n        init: init$9\n    });\n\n    var setup$c = function (streamInfo, streamState) {\n      var sInfo = streamInfo.stream;\n      var throttler = last(streamInfo.onStream, sInfo.delay);\n      streamState.setTimer(throttler);\n      return function (component, simulatedEvent) {\n        throttler.throttle(component, simulatedEvent);\n        if (sInfo.stopEvent) {\n          simulatedEvent.stop();\n        }\n      };\n    };\n    var StreamingSchema = [\n      requiredOf('stream', choose$1('mode', {\n        throttle: [\n          required$1('delay'),\n          defaulted('stopEvent', true),\n          output$1('streams', {\n            setup: setup$c,\n            state: throttle\n          })\n        ]\n      })),\n      defaulted('event', 'input'),\n      option('cancelEvent'),\n      onStrictHandler('onStream')\n    ];\n\n    var Streaming = create$8({\n      fields: StreamingSchema,\n      name: 'streaming',\n      active: ActiveStreaming,\n      state: StreamingState\n    });\n\n    var setValueFromItem = function (model, input, item) {\n      var itemData = Representing.getValue(item);\n      Representing.setValue(input, itemData);\n      setCursorAtEnd(input);\n    };\n    var setSelectionOn = function (input, f) {\n      var el = input.element;\n      var value = get$5(el);\n      var node = el.dom;\n      if (get$d(el, 'type') !== 'number') {\n        f(node, value);\n      }\n    };\n    var setCursorAtEnd = function (input) {\n      setSelectionOn(input, function (node, value) {\n        return node.setSelectionRange(value.length, value.length);\n      });\n    };\n    var setSelectionToEnd = function (input, startOffset) {\n      setSelectionOn(input, function (node, value) {\n        return node.setSelectionRange(startOffset, value.length);\n      });\n    };\n    var attemptSelectOver = function (model, input, item) {\n      if (!model.selectsOver) {\n        return Optional.none();\n      } else {\n        var currentValue = Representing.getValue(input);\n        var inputDisplay_1 = model.getDisplayText(currentValue);\n        var itemValue = Representing.getValue(item);\n        var itemDisplay = model.getDisplayText(itemValue);\n        return itemDisplay.indexOf(inputDisplay_1) === 0 ? Optional.some(function () {\n          setValueFromItem(model, input, item);\n          setSelectionToEnd(input, inputDisplay_1.length);\n        }) : Optional.none();\n      }\n    };\n\n    var itemExecute = constant$1('alloy.typeahead.itemexecute');\n\n    var make$3 = function (detail, components, spec, externals) {\n      var navigateList = function (comp, simulatedEvent, highlighter) {\n        detail.previewing.set(false);\n        var sandbox = Coupling.getCoupled(comp, 'sandbox');\n        if (Sandboxing.isOpen(sandbox)) {\n          Composing.getCurrent(sandbox).each(function (menu) {\n            Highlighting.getHighlighted(menu).fold(function () {\n              highlighter(menu);\n            }, function () {\n              dispatchEvent(sandbox, menu.element, 'keydown', simulatedEvent);\n            });\n          });\n        } else {\n          var onOpenSync = function (sandbox) {\n            Composing.getCurrent(sandbox).each(highlighter);\n          };\n          open(detail, mapFetch(comp), comp, sandbox, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop);\n        }\n      };\n      var focusBehaviours$1 = focusBehaviours(detail);\n      var mapFetch = function (comp) {\n        return function (tdata) {\n          return tdata.map(function (data) {\n            var menus = values(data.menus);\n            var items = bind$3(menus, function (menu) {\n              return filter$2(menu.items, function (item) {\n                return item.type === 'item';\n              });\n            });\n            var repState = Representing.getState(comp);\n            repState.update(map$2(items, function (item) {\n              return item.data;\n            }));\n            return data;\n          });\n        };\n      };\n      var behaviours = [\n        Focusing.config({}),\n        Representing.config({\n          onSetValue: detail.onSetValue,\n          store: __assign({\n            mode: 'dataset',\n            getDataKey: function (comp) {\n              return get$5(comp.element);\n            },\n            getFallbackEntry: function (itemString) {\n              return {\n                value: itemString,\n                meta: {}\n              };\n            },\n            setValue: function (comp, data) {\n              set$4(comp.element, detail.model.getDisplayText(data));\n            }\n          }, detail.initialData.map(function (d) {\n            return wrap$1('initialValue', d);\n          }).getOr({}))\n        }),\n        Streaming.config({\n          stream: {\n            mode: 'throttle',\n            delay: detail.responseTime,\n            stopEvent: false\n          },\n          onStream: function (component, _simulatedEvent) {\n            var sandbox = Coupling.getCoupled(component, 'sandbox');\n            var focusInInput = Focusing.isFocused(component);\n            if (focusInInput) {\n              if (get$5(component.element).length >= detail.minChars) {\n                var previousValue_1 = Composing.getCurrent(sandbox).bind(function (menu) {\n                  return Highlighting.getHighlighted(menu).map(Representing.getValue);\n                });\n                detail.previewing.set(true);\n                var onOpenSync = function (_sandbox) {\n                  Composing.getCurrent(sandbox).each(function (menu) {\n                    previousValue_1.fold(function () {\n                      if (detail.model.selectsOver) {\n                        Highlighting.highlightFirst(menu);\n                      }\n                    }, function (pv) {\n                      Highlighting.highlightBy(menu, function (item) {\n                        var itemData = Representing.getValue(item);\n                        return itemData.value === pv.value;\n                      });\n                      Highlighting.getHighlighted(menu).orThunk(function () {\n                        Highlighting.highlightFirst(menu);\n                        return Optional.none();\n                      });\n                    });\n                  });\n                };\n                open(detail, mapFetch(component), component, sandbox, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop);\n              }\n            }\n          },\n          cancelEvent: typeaheadCancel()\n        }),\n        Keying.config({\n          mode: 'special',\n          onDown: function (comp, simulatedEvent) {\n            navigateList(comp, simulatedEvent, Highlighting.highlightFirst);\n            return Optional.some(true);\n          },\n          onEscape: function (comp) {\n            var sandbox = Coupling.getCoupled(comp, 'sandbox');\n            if (Sandboxing.isOpen(sandbox)) {\n              Sandboxing.close(sandbox);\n              return Optional.some(true);\n            }\n            return Optional.none();\n          },\n          onUp: function (comp, simulatedEvent) {\n            navigateList(comp, simulatedEvent, Highlighting.highlightLast);\n            return Optional.some(true);\n          },\n          onEnter: function (comp) {\n            var sandbox = Coupling.getCoupled(comp, 'sandbox');\n            var sandboxIsOpen = Sandboxing.isOpen(sandbox);\n            if (sandboxIsOpen && !detail.previewing.get()) {\n              return Composing.getCurrent(sandbox).bind(function (menu) {\n                return Highlighting.getHighlighted(menu);\n              }).map(function (item) {\n                emitWith(comp, itemExecute(), { item: item });\n                return true;\n              });\n            } else {\n              var currentValue = Representing.getValue(comp);\n              emit(comp, typeaheadCancel());\n              detail.onExecute(sandbox, comp, currentValue);\n              if (sandboxIsOpen) {\n                Sandboxing.close(sandbox);\n              }\n              return Optional.some(true);\n            }\n          }\n        }),\n        Toggling.config({\n          toggleClass: detail.markers.openClass,\n          aria: { mode: 'expanded' }\n        }),\n        Coupling.config({\n          others: {\n            sandbox: function (hotspot) {\n              return makeSandbox$1(detail, hotspot, {\n                onOpen: function () {\n                  return Toggling.on(hotspot);\n                },\n                onClose: function () {\n                  return Toggling.off(hotspot);\n                }\n              });\n            }\n          }\n        }),\n        config('typeaheadevents', [\n          runOnExecute$1(function (comp) {\n            var onOpenSync = noop;\n            togglePopup(detail, mapFetch(comp), comp, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop);\n          }),\n          run$1(itemExecute(), function (comp, se) {\n            var sandbox = Coupling.getCoupled(comp, 'sandbox');\n            setValueFromItem(detail.model, comp, se.event.item);\n            emit(comp, typeaheadCancel());\n            detail.onItemExecute(comp, sandbox, se.event.item, Representing.getValue(comp));\n            Sandboxing.close(sandbox);\n            setCursorAtEnd(comp);\n          })\n        ].concat(detail.dismissOnBlur ? [run$1(postBlur(), function (typeahead) {\n            var sandbox = Coupling.getCoupled(typeahead, 'sandbox');\n            if (search(sandbox.element).isNone()) {\n              Sandboxing.close(sandbox);\n            }\n          })] : []))\n      ];\n      return {\n        uid: detail.uid,\n        dom: dom(deepMerge(detail, {\n          inputAttributes: {\n            'role': 'combobox',\n            'aria-autocomplete': 'list',\n            'aria-haspopup': 'true'\n          }\n        })),\n        behaviours: __assign(__assign({}, focusBehaviours$1), augment(detail.typeaheadBehaviours, behaviours)),\n        eventOrder: detail.eventOrder\n      };\n    };\n\n    var schema$g = constant$1([\n      option('lazySink'),\n      required$1('fetch'),\n      defaulted('minChars', 5),\n      defaulted('responseTime', 1000),\n      onHandler('onOpen'),\n      defaulted('getHotspot', Optional.some),\n      defaulted('getAnchorOverrides', constant$1({})),\n      defaulted('layouts', Optional.none()),\n      defaulted('eventOrder', {}),\n      defaultedObjOf('model', {}, [\n        defaulted('getDisplayText', function (itemData) {\n          return itemData.meta !== undefined && itemData.meta.text !== undefined ? itemData.meta.text : itemData.value;\n        }),\n        defaulted('selectsOver', true),\n        defaulted('populateFromBrowse', true)\n      ]),\n      onHandler('onSetValue'),\n      onKeyboardHandler('onExecute'),\n      onHandler('onItemExecute'),\n      defaulted('inputClasses', []),\n      defaulted('inputAttributes', {}),\n      defaulted('inputStyles', {}),\n      defaulted('matchWidth', true),\n      defaulted('useMinWidth', false),\n      defaulted('dismissOnBlur', true),\n      markers$1(['openClass']),\n      option('initialData'),\n      field('typeaheadBehaviours', [\n        Focusing,\n        Representing,\n        Streaming,\n        Keying,\n        Toggling,\n        Coupling\n      ]),\n      customField('previewing', function () {\n        return Cell(true);\n      })\n    ].concat(schema$k()).concat(sandboxFields()));\n    var parts$b = constant$1([external$1({\n        schema: [tieredMenuMarkers()],\n        name: 'menu',\n        overrides: function (detail) {\n          return {\n            fakeFocus: true,\n            onHighlight: function (menu, item) {\n              if (!detail.previewing.get()) {\n                menu.getSystem().getByUid(detail.uid).each(function (input) {\n                  if (detail.model.populateFromBrowse) {\n                    setValueFromItem(detail.model, input, item);\n                  }\n                });\n              } else {\n                menu.getSystem().getByUid(detail.uid).each(function (input) {\n                  attemptSelectOver(detail.model, input, item).fold(function () {\n                    return Highlighting.dehighlight(menu, item);\n                  }, function (fn) {\n                    return fn();\n                  });\n                });\n              }\n              detail.previewing.set(false);\n            },\n            onExecute: function (menu, item) {\n              return menu.getSystem().getByUid(detail.uid).toOptional().map(function (typeahead) {\n                emitWith(typeahead, itemExecute(), { item: item });\n                return true;\n              });\n            },\n            onHover: function (menu, item) {\n              detail.previewing.set(false);\n              menu.getSystem().getByUid(detail.uid).each(function (input) {\n                if (detail.model.populateFromBrowse) {\n                  setValueFromItem(detail.model, input, item);\n                }\n              });\n            }\n          };\n        }\n      })]);\n\n    var Typeahead = composite({\n      name: 'Typeahead',\n      configFields: schema$g(),\n      partFields: parts$b(),\n      factory: make$3\n    });\n\n    var wrap = function (delegate) {\n      var toCached = function () {\n        return wrap(delegate.toCached());\n      };\n      var bindFuture = function (f) {\n        return wrap(delegate.bind(function (resA) {\n          return resA.fold(function (err) {\n            return Future.pure(Result.error(err));\n          }, function (a) {\n            return f(a);\n          });\n        }));\n      };\n      var bindResult = function (f) {\n        return wrap(delegate.map(function (resA) {\n          return resA.bind(f);\n        }));\n      };\n      var mapResult = function (f) {\n        return wrap(delegate.map(function (resA) {\n          return resA.map(f);\n        }));\n      };\n      var mapError = function (f) {\n        return wrap(delegate.map(function (resA) {\n          return resA.mapError(f);\n        }));\n      };\n      var foldResult = function (whenError, whenValue) {\n        return delegate.map(function (res) {\n          return res.fold(whenError, whenValue);\n        });\n      };\n      var withTimeout = function (timeout, errorThunk) {\n        return wrap(Future.nu(function (callback) {\n          var timedOut = false;\n          var timer = setTimeout(function () {\n            timedOut = true;\n            callback(Result.error(errorThunk()));\n          }, timeout);\n          delegate.get(function (result) {\n            if (!timedOut) {\n              clearTimeout(timer);\n              callback(result);\n            }\n          });\n        }));\n      };\n      return __assign(__assign({}, delegate), {\n        toCached: toCached,\n        bindFuture: bindFuture,\n        bindResult: bindResult,\n        mapResult: mapResult,\n        mapError: mapError,\n        foldResult: foldResult,\n        withTimeout: withTimeout\n      });\n    };\n    var nu$1 = function (worker) {\n      return wrap(Future.nu(worker));\n    };\n    var value = function (value) {\n      return wrap(Future.pure(Result.value(value)));\n    };\n    var error = function (error) {\n      return wrap(Future.pure(Result.error(error)));\n    };\n    var fromResult = function (result) {\n      return wrap(Future.pure(result));\n    };\n    var fromFuture = function (future) {\n      return wrap(future.map(Result.value));\n    };\n    var fromPromise = function (promise) {\n      return nu$1(function (completer) {\n        promise.then(function (value) {\n          completer(Result.value(value));\n        }, function (error) {\n          completer(Result.error(error));\n        });\n      });\n    };\n    var FutureResult = {\n      nu: nu$1,\n      wrap: wrap,\n      pure: value,\n      value: value,\n      error: error,\n      fromResult: fromResult,\n      fromFuture: fromFuture,\n      fromPromise: fromPromise\n    };\n\n    var separator$1 = { type: 'separator' };\n    var toMenuItem = function (target) {\n      return {\n        type: 'menuitem',\n        value: target.url,\n        text: target.title,\n        meta: { attach: target.attach },\n        onAction: noop\n      };\n    };\n    var staticMenuItem = function (title, url) {\n      return {\n        type: 'menuitem',\n        value: url,\n        text: title,\n        meta: { attach: undefined },\n        onAction: noop\n      };\n    };\n    var toMenuItems = function (targets) {\n      return map$2(targets, toMenuItem);\n    };\n    var filterLinkTargets = function (type, targets) {\n      return filter$2(targets, function (target) {\n        return target.type === type;\n      });\n    };\n    var filteredTargets = function (type, targets) {\n      return toMenuItems(filterLinkTargets(type, targets));\n    };\n    var headerTargets = function (linkInfo) {\n      return filteredTargets('header', linkInfo.targets);\n    };\n    var anchorTargets = function (linkInfo) {\n      return filteredTargets('anchor', linkInfo.targets);\n    };\n    var anchorTargetTop = function (linkInfo) {\n      return Optional.from(linkInfo.anchorTop).map(function (url) {\n        return staticMenuItem('<top>', url);\n      }).toArray();\n    };\n    var anchorTargetBottom = function (linkInfo) {\n      return Optional.from(linkInfo.anchorBottom).map(function (url) {\n        return staticMenuItem('<bottom>', url);\n      }).toArray();\n    };\n    var historyTargets = function (history) {\n      return map$2(history, function (url) {\n        return staticMenuItem(url, url);\n      });\n    };\n    var joinMenuLists = function (items) {\n      return foldl(items, function (a, b) {\n        var bothEmpty = a.length === 0 || b.length === 0;\n        return bothEmpty ? a.concat(b) : a.concat(separator$1, b);\n      }, []);\n    };\n    var filterByQuery = function (term, menuItems) {\n      var lowerCaseTerm = term.toLowerCase();\n      return filter$2(menuItems, function (item) {\n        var text = item.meta !== undefined && item.meta.text !== undefined ? item.meta.text : item.text;\n        return contains$1(text.toLowerCase(), lowerCaseTerm) || contains$1(item.value.toLowerCase(), lowerCaseTerm);\n      });\n    };\n\n    var getItems = function (fileType, input, urlBackstage) {\n      var urlInputValue = Representing.getValue(input);\n      var term = urlInputValue.meta.text !== undefined ? urlInputValue.meta.text : urlInputValue.value;\n      var info = urlBackstage.getLinkInformation();\n      return info.fold(function () {\n        return [];\n      }, function (linkInfo) {\n        var history = filterByQuery(term, historyTargets(urlBackstage.getHistory(fileType)));\n        return fileType === 'file' ? joinMenuLists([\n          history,\n          filterByQuery(term, headerTargets(linkInfo)),\n          filterByQuery(term, flatten([\n            anchorTargetTop(linkInfo),\n            anchorTargets(linkInfo),\n            anchorTargetBottom(linkInfo)\n          ]))\n        ]) : history;\n      });\n    };\n    var errorId = generate$6('aria-invalid');\n    var renderUrlInput = function (spec, backstage, urlBackstage) {\n      var _a;\n      var providersBackstage = backstage.shared.providers;\n      var updateHistory = function (component) {\n        var urlEntry = Representing.getValue(component);\n        urlBackstage.addToHistory(urlEntry.value, spec.filetype);\n      };\n      var pField = FormField.parts.field({\n        factory: Typeahead,\n        dismissOnBlur: true,\n        inputClasses: ['tox-textfield'],\n        sandboxClasses: ['tox-dialog__popups'],\n        inputAttributes: {\n          'aria-errormessage': errorId,\n          'type': 'url'\n        },\n        minChars: 0,\n        responseTime: 0,\n        fetch: function (input) {\n          var items = getItems(spec.filetype, input, urlBackstage);\n          var tdata = build(items, ItemResponse$1.BUBBLE_TO_SANDBOX, backstage, false);\n          return Future.pure(tdata);\n        },\n        getHotspot: function (comp) {\n          return memUrlBox.getOpt(comp);\n        },\n        onSetValue: function (comp, _newValue) {\n          if (comp.hasConfigured(Invalidating)) {\n            Invalidating.run(comp).get(noop);\n          }\n        },\n        typeaheadBehaviours: derive$1(flatten([\n          urlBackstage.getValidationHandler().map(function (handler) {\n            return Invalidating.config({\n              getRoot: function (comp) {\n                return parent(comp.element);\n              },\n              invalidClass: 'tox-control-wrap--status-invalid',\n              notify: {\n                onInvalid: function (comp, err) {\n                  memInvalidIcon.getOpt(comp).each(function (invalidComp) {\n                    set$8(invalidComp.element, 'title', providersBackstage.translate(err));\n                  });\n                }\n              },\n              validator: {\n                validate: function (input) {\n                  var urlEntry = Representing.getValue(input);\n                  return FutureResult.nu(function (completer) {\n                    handler({\n                      type: spec.filetype,\n                      url: urlEntry.value\n                    }, function (validation) {\n                      if (validation.status === 'invalid') {\n                        var err = Result.error(validation.message);\n                        completer(err);\n                      } else {\n                        var val = Result.value(validation.message);\n                        completer(val);\n                      }\n                    });\n                  });\n                },\n                validateOnLoad: false\n              }\n            });\n          }).toArray(),\n          [\n            Disabling.config({\n              disabled: function () {\n                return spec.disabled || providersBackstage.isDisabled();\n              }\n            }),\n            Tabstopping.config({}),\n            config('urlinput-events', flatten([\n              spec.filetype === 'file' ? [run$1(input(), function (comp) {\n                  emitWith(comp, formChangeEvent, { name: spec.name });\n                })] : [],\n              [\n                run$1(change(), function (comp) {\n                  emitWith(comp, formChangeEvent, { name: spec.name });\n                  updateHistory(comp);\n                }),\n                run$1(postPaste(), function (comp) {\n                  emitWith(comp, formChangeEvent, { name: spec.name });\n                  updateHistory(comp);\n                })\n              ]\n            ]))\n          ]\n        ])),\n        eventOrder: (_a = {}, _a[input()] = [\n          'streaming',\n          'urlinput-events',\n          'invalidating'\n        ], _a),\n        model: {\n          getDisplayText: function (itemData) {\n            return itemData.value;\n          },\n          selectsOver: false,\n          populateFromBrowse: false\n        },\n        markers: { openClass: 'tox-textfield--popup-open' },\n        lazySink: backstage.shared.getSink,\n        parts: { menu: part(false, 1, 'normal') },\n        onExecute: function (_menu, component, _entry) {\n          emitWith(component, formSubmitEvent, {});\n        },\n        onItemExecute: function (typeahead, _sandbox, _item, _value) {\n          updateHistory(typeahead);\n          emitWith(typeahead, formChangeEvent, { name: spec.name });\n        }\n      });\n      var pLabel = spec.label.map(function (label) {\n        return renderLabel$2(label, providersBackstage);\n      });\n      var makeIcon = function (name, errId, icon, label) {\n        if (icon === void 0) {\n          icon = name;\n        }\n        if (label === void 0) {\n          label = name;\n        }\n        return render$3(icon, {\n          tag: 'div',\n          classes: [\n            'tox-icon',\n            'tox-control-wrap__status-icon-' + name\n          ],\n          attributes: __assign({\n            'title': providersBackstage.translate(label),\n            'aria-live': 'polite'\n          }, errId.fold(function () {\n            return {};\n          }, function (id) {\n            return { id: id };\n          }))\n        }, providersBackstage.icons);\n      };\n      var memInvalidIcon = record(makeIcon('invalid', Optional.some(errorId), 'warning'));\n      var memStatus = record({\n        dom: {\n          tag: 'div',\n          classes: ['tox-control-wrap__status-icon-wrap']\n        },\n        components: [memInvalidIcon.asSpec()]\n      });\n      var optUrlPicker = urlBackstage.getUrlPicker(spec.filetype);\n      var browseUrlEvent = generate$6('browser.url.event');\n      var memUrlBox = record({\n        dom: {\n          tag: 'div',\n          classes: ['tox-control-wrap']\n        },\n        components: [\n          pField,\n          memStatus.asSpec()\n        ],\n        behaviours: derive$1([Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            }\n          })])\n      });\n      var memUrlPickerButton = record(renderButton({\n        name: spec.name,\n        icon: Optional.some('browse'),\n        text: spec.label.getOr(''),\n        disabled: spec.disabled,\n        primary: false,\n        borderless: true\n      }, function (component) {\n        return emit(component, browseUrlEvent);\n      }, providersBackstage, [], ['tox-browse-url']));\n      var controlHWrapper = function () {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-form__controls-h-stack']\n          },\n          components: flatten([\n            [memUrlBox.asSpec()],\n            optUrlPicker.map(function () {\n              return memUrlPickerButton.asSpec();\n            }).toArray()\n          ])\n        };\n      };\n      var openUrlPicker = function (comp) {\n        Composing.getCurrent(comp).each(function (field) {\n          var componentData = Representing.getValue(field);\n          var urlData = __assign({ fieldname: spec.name }, componentData);\n          optUrlPicker.each(function (picker) {\n            picker(urlData).get(function (chosenData) {\n              Representing.setValue(field, chosenData);\n              emitWith(comp, formChangeEvent, { name: spec.name });\n            });\n          });\n        });\n      };\n      return FormField.sketch({\n        dom: renderFormFieldDom(),\n        components: pLabel.toArray().concat([controlHWrapper()]),\n        fieldBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providersBackstage.isDisabled();\n            },\n            onDisabled: function (comp) {\n              FormField.getField(comp).each(Disabling.disable);\n              memUrlPickerButton.getOpt(comp).each(Disabling.disable);\n            },\n            onEnabled: function (comp) {\n              FormField.getField(comp).each(Disabling.enable);\n              memUrlPickerButton.getOpt(comp).each(Disabling.enable);\n            }\n          }),\n          receivingConfig(),\n          config('url-input-events', [run$1(browseUrlEvent, openUrlPicker)])\n        ])\n      });\n    };\n\n    var renderAlertBanner = function (spec, providersBackstage) {\n      return Container.sketch({\n        dom: {\n          tag: 'div',\n          attributes: { role: 'alert' },\n          classes: [\n            'tox-notification',\n            'tox-notification--in',\n            'tox-notification--' + spec.level\n          ]\n        },\n        components: [\n          {\n            dom: {\n              tag: 'div',\n              classes: ['tox-notification__icon']\n            },\n            components: [Button.sketch({\n                dom: {\n                  tag: 'button',\n                  classes: [\n                    'tox-button',\n                    'tox-button--naked',\n                    'tox-button--icon'\n                  ],\n                  innerHtml: get$1(spec.icon, providersBackstage.icons),\n                  attributes: { title: providersBackstage.translate(spec.iconTooltip) }\n                },\n                action: function (comp) {\n                  emitWith(comp, formActionEvent, {\n                    name: 'alert-banner',\n                    value: spec.url\n                  });\n                },\n                buttonBehaviours: derive$1([addFocusableBehaviour()])\n              })]\n          },\n          {\n            dom: {\n              tag: 'div',\n              classes: ['tox-notification__body'],\n              innerHtml: providersBackstage.translate(spec.text)\n            }\n          }\n        ]\n      });\n    };\n\n    var renderCheckbox = function (spec, providerBackstage) {\n      var repBehaviour = Representing.config({\n        store: {\n          mode: 'manual',\n          getValue: function (comp) {\n            var el = comp.element.dom;\n            return el.checked;\n          },\n          setValue: function (comp, value) {\n            var el = comp.element.dom;\n            el.checked = value;\n          }\n        }\n      });\n      var toggleCheckboxHandler = function (comp) {\n        comp.element.dom.click();\n        return Optional.some(true);\n      };\n      var pField = FormField.parts.field({\n        factory: { sketch: identity$1 },\n        dom: {\n          tag: 'input',\n          classes: ['tox-checkbox__input'],\n          attributes: { type: 'checkbox' }\n        },\n        behaviours: derive$1([\n          ComposingConfigs.self(),\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providerBackstage.isDisabled();\n            }\n          }),\n          Tabstopping.config({}),\n          Focusing.config({}),\n          repBehaviour,\n          Keying.config({\n            mode: 'special',\n            onEnter: toggleCheckboxHandler,\n            onSpace: toggleCheckboxHandler,\n            stopSpaceKeyup: true\n          }),\n          config('checkbox-events', [run$1(change(), function (component, _) {\n              emitWith(component, formChangeEvent, { name: spec.name });\n            })])\n        ])\n      });\n      var pLabel = FormField.parts.label({\n        dom: {\n          tag: 'span',\n          classes: ['tox-checkbox__label'],\n          innerHtml: providerBackstage.translate(spec.label)\n        },\n        behaviours: derive$1([Unselecting.config({})])\n      });\n      var makeIcon = function (className) {\n        var iconName = className === 'checked' ? 'selected' : 'unselected';\n        return render$3(iconName, {\n          tag: 'span',\n          classes: [\n            'tox-icon',\n            'tox-checkbox-icon__' + className\n          ]\n        }, providerBackstage.icons);\n      };\n      var memIcons = record({\n        dom: {\n          tag: 'div',\n          classes: ['tox-checkbox__icons']\n        },\n        components: [\n          makeIcon('checked'),\n          makeIcon('unchecked')\n        ]\n      });\n      return FormField.sketch({\n        dom: {\n          tag: 'label',\n          classes: ['tox-checkbox']\n        },\n        components: [\n          pField,\n          memIcons.asSpec(),\n          pLabel\n        ],\n        fieldBehaviours: derive$1([\n          Disabling.config({\n            disabled: function () {\n              return spec.disabled || providerBackstage.isDisabled();\n            },\n            disableClass: 'tox-checkbox--disabled',\n            onDisabled: function (comp) {\n              FormField.getField(comp).each(Disabling.disable);\n            },\n            onEnabled: function (comp) {\n              FormField.getField(comp).each(Disabling.enable);\n            }\n          }),\n          receivingConfig()\n        ])\n      });\n    };\n\n    var renderHtmlPanel = function (spec) {\n      if (spec.presets === 'presentation') {\n        return Container.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-form__group'],\n            innerHtml: spec.html\n          }\n        });\n      } else {\n        return Container.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-form__group'],\n            innerHtml: spec.html,\n            attributes: { role: 'document' }\n          },\n          containerBehaviours: derive$1([\n            Tabstopping.config({}),\n            Focusing.config({})\n          ])\n        });\n      }\n    };\n\n    var make$2 = function (render) {\n      return function (parts, spec, backstage) {\n        return get$e(spec, 'name').fold(function () {\n          return render(spec, backstage);\n        }, function (fieldName) {\n          return parts.field(fieldName, render(spec, backstage));\n        });\n      };\n    };\n    var makeIframe = function (render) {\n      return function (parts, spec, backstage) {\n        var iframeSpec = deepMerge(spec, { source: 'dynamic' });\n        return make$2(render)(parts, iframeSpec, backstage);\n      };\n    };\n    var factories = {\n      bar: make$2(function (spec, backstage) {\n        return renderBar(spec, backstage.shared);\n      }),\n      collection: make$2(function (spec, backstage) {\n        return renderCollection(spec, backstage.shared.providers);\n      }),\n      alertbanner: make$2(function (spec, backstage) {\n        return renderAlertBanner(spec, backstage.shared.providers);\n      }),\n      input: make$2(function (spec, backstage) {\n        return renderInput(spec, backstage.shared.providers);\n      }),\n      textarea: make$2(function (spec, backstage) {\n        return renderTextarea(spec, backstage.shared.providers);\n      }),\n      label: make$2(function (spec, backstage) {\n        return renderLabel(spec, backstage.shared);\n      }),\n      iframe: makeIframe(function (spec, backstage) {\n        return renderIFrame(spec, backstage.shared.providers);\n      }),\n      button: make$2(function (spec, backstage) {\n        return renderDialogButton(spec, backstage.shared.providers);\n      }),\n      checkbox: make$2(function (spec, backstage) {\n        return renderCheckbox(spec, backstage.shared.providers);\n      }),\n      colorinput: make$2(function (spec, backstage) {\n        return renderColorInput(spec, backstage.shared, backstage.colorinput);\n      }),\n      colorpicker: make$2(renderColorPicker),\n      dropzone: make$2(function (spec, backstage) {\n        return renderDropZone(spec, backstage.shared.providers);\n      }),\n      grid: make$2(function (spec, backstage) {\n        return renderGrid(spec, backstage.shared);\n      }),\n      listbox: make$2(function (spec, backstage) {\n        return renderListBox(spec, backstage);\n      }),\n      selectbox: make$2(function (spec, backstage) {\n        return renderSelectBox(spec, backstage.shared.providers);\n      }),\n      sizeinput: make$2(function (spec, backstage) {\n        return renderSizeInput(spec, backstage.shared.providers);\n      }),\n      urlinput: make$2(function (spec, backstage) {\n        return renderUrlInput(spec, backstage, backstage.urlinput);\n      }),\n      customeditor: make$2(renderCustomEditor),\n      htmlpanel: make$2(renderHtmlPanel),\n      imagetools: make$2(function (spec, backstage) {\n        return renderImageTools(spec, backstage.shared.providers);\n      }),\n      table: make$2(function (spec, backstage) {\n        return renderTable(spec, backstage.shared.providers);\n      }),\n      panel: make$2(function (spec, backstage) {\n        return renderPanel(spec, backstage);\n      })\n    };\n    var noFormParts = {\n      field: function (_name, spec) {\n        return spec;\n      }\n    };\n    var interpretInForm = function (parts, spec, oldBackstage) {\n      var newBackstage = deepMerge(oldBackstage, {\n        shared: {\n          interpreter: function (childSpec) {\n            return interpretParts(parts, childSpec, newBackstage);\n          }\n        }\n      });\n      return interpretParts(parts, spec, newBackstage);\n    };\n    var interpretParts = function (parts, spec, backstage) {\n      return get$e(factories, spec.type).fold(function () {\n        console.error('Unknown factory type \"' + spec.type + '\", defaulting to container: ', spec);\n        return spec;\n      }, function (factory) {\n        return factory(parts, spec, backstage);\n      });\n    };\n    var interpretWithoutForm = function (spec, backstage) {\n      var parts = noFormParts;\n      return interpretParts(parts, spec, backstage);\n    };\n\n    var bubbleAlignments$2 = {\n      valignCentre: [],\n      alignCentre: [],\n      alignLeft: [],\n      alignRight: [],\n      right: [],\n      left: [],\n      bottom: [],\n      top: []\n    };\n    var getInlineDialogAnchor = function (contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor) {\n      var bubbleSize = 12;\n      var overrides = { maxHeightFunction: expandable$1() };\n      var editableAreaAnchor = function () {\n        return {\n          type: 'node',\n          root: getContentContainer(contentAreaElement()),\n          node: Optional.from(contentAreaElement()),\n          bubble: nu$5(bubbleSize, bubbleSize, bubbleAlignments$2),\n          layouts: {\n            onRtl: function () {\n              return [northeast];\n            },\n            onLtr: function () {\n              return [northwest];\n            }\n          },\n          overrides: overrides\n        };\n      };\n      var standardAnchor = function () {\n        return {\n          type: 'hotspot',\n          hotspot: lazyAnchorbar(),\n          bubble: nu$5(-bubbleSize, bubbleSize, bubbleAlignments$2),\n          layouts: {\n            onRtl: function () {\n              return [southeast$2];\n            },\n            onLtr: function () {\n              return [southwest$2];\n            }\n          },\n          overrides: overrides\n        };\n      };\n      return function () {\n        return lazyUseEditableAreaAnchor() ? editableAreaAnchor() : standardAnchor();\n      };\n    };\n    var getBannerAnchor = function (contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor) {\n      var editableAreaAnchor = function () {\n        return {\n          type: 'node',\n          root: getContentContainer(contentAreaElement()),\n          node: Optional.from(contentAreaElement()),\n          layouts: {\n            onRtl: function () {\n              return [north];\n            },\n            onLtr: function () {\n              return [north];\n            }\n          }\n        };\n      };\n      var standardAnchor = function () {\n        return {\n          type: 'hotspot',\n          hotspot: lazyAnchorbar(),\n          layouts: {\n            onRtl: function () {\n              return [south$2];\n            },\n            onLtr: function () {\n              return [south$2];\n            }\n          }\n        };\n      };\n      return function () {\n        return lazyUseEditableAreaAnchor() ? editableAreaAnchor() : standardAnchor();\n      };\n    };\n    var getCursorAnchor = function (editor, bodyElement) {\n      return function () {\n        return {\n          type: 'selection',\n          root: bodyElement(),\n          getSelection: function () {\n            var rng = editor.selection.getRng();\n            return Optional.some(SimSelection.range(SugarElement.fromDom(rng.startContainer), rng.startOffset, SugarElement.fromDom(rng.endContainer), rng.endOffset));\n          }\n        };\n      };\n    };\n    var getNodeAnchor$1 = function (bodyElement) {\n      return function (element) {\n        return {\n          type: 'node',\n          root: bodyElement(),\n          node: element\n        };\n      };\n    };\n    var getAnchors = function (editor, lazyAnchorbar, isToolbarTop) {\n      var useFixedToolbarContainer = useFixedContainer(editor);\n      var bodyElement = function () {\n        return SugarElement.fromDom(editor.getBody());\n      };\n      var contentAreaElement = function () {\n        return SugarElement.fromDom(editor.getContentAreaContainer());\n      };\n      var lazyUseEditableAreaAnchor = function () {\n        return useFixedToolbarContainer || !isToolbarTop();\n      };\n      return {\n        inlineDialog: getInlineDialogAnchor(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor),\n        banner: getBannerAnchor(contentAreaElement, lazyAnchorbar, lazyUseEditableAreaAnchor),\n        cursor: getCursorAnchor(editor, bodyElement),\n        node: getNodeAnchor$1(bodyElement)\n      };\n    };\n\n    var colorPicker = function (editor) {\n      return function (callback, value) {\n        var dialog = colorPickerDialog(editor);\n        dialog(callback, value);\n      };\n    };\n    var hasCustomColors = function (editor) {\n      return function () {\n        return hasCustomColors$1(editor);\n      };\n    };\n    var getColors = function (editor) {\n      return function () {\n        return getColors$2(editor);\n      };\n    };\n    var getColorCols = function (editor) {\n      return function () {\n        return getColorCols$1(editor);\n      };\n    };\n    var ColorInputBackstage = function (editor) {\n      return {\n        colorPicker: colorPicker(editor),\n        hasCustomColors: hasCustomColors(editor),\n        getColors: getColors(editor),\n        getColorCols: getColorCols(editor)\n      };\n    };\n\n    var isDraggableModal = function (editor) {\n      return function () {\n        return isDraggableModal$1(editor);\n      };\n    };\n    var DialogBackstage = function (editor) {\n      return { isDraggableModal: isDraggableModal(editor) };\n    };\n\n    var HeaderBackstage = function (editor) {\n      var mode = Cell(isToolbarLocationBottom(editor) ? 'bottom' : 'top');\n      return {\n        isPositionedAtTop: function () {\n          return mode.get() === 'top';\n        },\n        getDockingMode: mode.get,\n        setDockingMode: mode.set\n      };\n    };\n\n    var defaultStyleFormats = [\n      {\n        title: 'Headings',\n        items: [\n          {\n            title: 'Heading 1',\n            format: 'h1'\n          },\n          {\n            title: 'Heading 2',\n            format: 'h2'\n          },\n          {\n            title: 'Heading 3',\n            format: 'h3'\n          },\n          {\n            title: 'Heading 4',\n            format: 'h4'\n          },\n          {\n            title: 'Heading 5',\n            format: 'h5'\n          },\n          {\n            title: 'Heading 6',\n            format: 'h6'\n          }\n        ]\n      },\n      {\n        title: 'Inline',\n        items: [\n          {\n            title: 'Bold',\n            format: 'bold'\n          },\n          {\n            title: 'Italic',\n            format: 'italic'\n          },\n          {\n            title: 'Underline',\n            format: 'underline'\n          },\n          {\n            title: 'Strikethrough',\n            format: 'strikethrough'\n          },\n          {\n            title: 'Superscript',\n            format: 'superscript'\n          },\n          {\n            title: 'Subscript',\n            format: 'subscript'\n          },\n          {\n            title: 'Code',\n            format: 'code'\n          }\n        ]\n      },\n      {\n        title: 'Blocks',\n        items: [\n          {\n            title: 'Paragraph',\n            format: 'p'\n          },\n          {\n            title: 'Blockquote',\n            format: 'blockquote'\n          },\n          {\n            title: 'Div',\n            format: 'div'\n          },\n          {\n            title: 'Pre',\n            format: 'pre'\n          }\n        ]\n      },\n      {\n        title: 'Align',\n        items: [\n          {\n            title: 'Left',\n            format: 'alignleft'\n          },\n          {\n            title: 'Center',\n            format: 'aligncenter'\n          },\n          {\n            title: 'Right',\n            format: 'alignright'\n          },\n          {\n            title: 'Justify',\n            format: 'alignjustify'\n          }\n        ]\n      }\n    ];\n    var isNestedFormat = function (format) {\n      return has$2(format, 'items');\n    };\n    var isBlockFormat = function (format) {\n      return has$2(format, 'block');\n    };\n    var isInlineFormat = function (format) {\n      return has$2(format, 'inline');\n    };\n    var isSelectorFormat = function (format) {\n      return has$2(format, 'selector');\n    };\n    var mapFormats = function (userFormats) {\n      return foldl(userFormats, function (acc, fmt) {\n        if (isNestedFormat(fmt)) {\n          var result = mapFormats(fmt.items);\n          return {\n            customFormats: acc.customFormats.concat(result.customFormats),\n            formats: acc.formats.concat([{\n                title: fmt.title,\n                items: result.formats\n              }])\n          };\n        } else if (isInlineFormat(fmt) || isBlockFormat(fmt) || isSelectorFormat(fmt)) {\n          var formatName = isString(fmt.name) ? fmt.name : fmt.title.toLowerCase();\n          var formatNameWithPrefix = 'custom-' + formatName;\n          return {\n            customFormats: acc.customFormats.concat([{\n                name: formatNameWithPrefix,\n                format: fmt\n              }]),\n            formats: acc.formats.concat([{\n                title: fmt.title,\n                format: formatNameWithPrefix,\n                icon: fmt.icon\n              }])\n          };\n        } else {\n          return __assign(__assign({}, acc), { formats: acc.formats.concat(fmt) });\n        }\n      }, {\n        customFormats: [],\n        formats: []\n      });\n    };\n    var registerCustomFormats = function (editor, userFormats) {\n      var result = mapFormats(userFormats);\n      var registerFormats = function (customFormats) {\n        each$1(customFormats, function (fmt) {\n          if (!editor.formatter.has(fmt.name)) {\n            editor.formatter.register(fmt.name, fmt.format);\n          }\n        });\n      };\n      if (editor.formatter) {\n        registerFormats(result.customFormats);\n      } else {\n        editor.on('init', function () {\n          registerFormats(result.customFormats);\n        });\n      }\n      return result.formats;\n    };\n    var getStyleFormats = function (editor) {\n      return getUserStyleFormats(editor).map(function (userFormats) {\n        var registeredUserFormats = registerCustomFormats(editor, userFormats);\n        return isMergeStyleFormats(editor) ? defaultStyleFormats.concat(registeredUserFormats) : registeredUserFormats;\n      }).getOr(defaultStyleFormats);\n    };\n\n    var processBasic = function (item, isSelectedFor, getPreviewFor) {\n      var formatterSpec = {\n        type: 'formatter',\n        isSelected: isSelectedFor(item.format),\n        getStylePreview: getPreviewFor(item.format)\n      };\n      return deepMerge(item, formatterSpec);\n    };\n    var register$8 = function (editor, formats, isSelectedFor, getPreviewFor) {\n      var enrichSupported = function (item) {\n        return processBasic(item, isSelectedFor, getPreviewFor);\n      };\n      var enrichMenu = function (item) {\n        var submenuSpec = { type: 'submenu' };\n        return deepMerge(item, submenuSpec);\n      };\n      var enrichCustom = function (item) {\n        var formatName = isString(item.name) ? item.name : generate$6(item.title);\n        var formatNameWithPrefix = 'custom-' + formatName;\n        var customSpec = {\n          type: 'formatter',\n          format: formatNameWithPrefix,\n          isSelected: isSelectedFor(formatNameWithPrefix),\n          getStylePreview: getPreviewFor(formatNameWithPrefix)\n        };\n        var newItem = deepMerge(item, customSpec);\n        editor.formatter.register(formatName, newItem);\n        return newItem;\n      };\n      var doEnrich = function (items) {\n        return map$2(items, function (item) {\n          var keys$1 = keys(item);\n          if (hasNonNullableKey(item, 'items')) {\n            var newItems = doEnrich(item.items);\n            return deepMerge(enrichMenu(item), { getStyleItems: constant$1(newItems) });\n          } else if (hasNonNullableKey(item, 'format')) {\n            return enrichSupported(item);\n          } else if (keys$1.length === 1 && contains$2(keys$1, 'title')) {\n            return deepMerge(item, { type: 'separator' });\n          } else {\n            return enrichCustom(item);\n          }\n        });\n      };\n      return doEnrich(formats);\n    };\n\n    var init$8 = function (editor) {\n      var isSelectedFor = function (format) {\n        return function () {\n          return editor.formatter.match(format);\n        };\n      };\n      var getPreviewFor = function (format) {\n        return function () {\n          var fmt = editor.formatter.get(format);\n          return fmt !== undefined ? Optional.some({\n            tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || 'div' : 'div',\n            styles: editor.dom.parseStyle(editor.formatter.getCssText(format))\n          }) : Optional.none();\n        };\n      };\n      var flatten = function (fmt) {\n        var subs = fmt.items;\n        return subs !== undefined && subs.length > 0 ? bind$3(subs, flatten) : [fmt.format];\n      };\n      var settingsFormats = Cell([]);\n      var settingsFlattenedFormats = Cell([]);\n      var eventsFormats = Cell([]);\n      var eventsFlattenedFormats = Cell([]);\n      var replaceSettings = Cell(false);\n      editor.on('PreInit', function (_e) {\n        var formats = getStyleFormats(editor);\n        var enriched = register$8(editor, formats, isSelectedFor, getPreviewFor);\n        settingsFormats.set(enriched);\n        settingsFlattenedFormats.set(bind$3(enriched, flatten));\n      });\n      editor.on('addStyleModifications', function (e) {\n        var modifications = register$8(editor, e.items, isSelectedFor, getPreviewFor);\n        eventsFormats.set(modifications);\n        replaceSettings.set(e.replace);\n        eventsFlattenedFormats.set(bind$3(modifications, flatten));\n      });\n      var getData = function () {\n        var fromSettings = replaceSettings.get() ? [] : settingsFormats.get();\n        var fromEvents = eventsFormats.get();\n        return fromSettings.concat(fromEvents);\n      };\n      var getFlattenedKeys = function () {\n        var fromSettings = replaceSettings.get() ? [] : settingsFlattenedFormats.get();\n        var fromEvents = eventsFlattenedFormats.get();\n        return fromSettings.concat(fromEvents);\n      };\n      return {\n        getData: getData,\n        getFlattenedKeys: getFlattenedKeys\n      };\n    };\n\n    var isElement = function (node) {\n      return isNonNullable(node) && node.nodeType === 1;\n    };\n    var trim = global$5.trim;\n    var hasContentEditableState = function (value) {\n      return function (node) {\n        if (isElement(node)) {\n          if (node.contentEditable === value) {\n            return true;\n          }\n          if (node.getAttribute('data-mce-contenteditable') === value) {\n            return true;\n          }\n        }\n        return false;\n      };\n    };\n    var isContentEditableTrue = hasContentEditableState('true');\n    var isContentEditableFalse = hasContentEditableState('false');\n    var create = function (type, title, url, level, attach) {\n      return {\n        type: type,\n        title: title,\n        url: url,\n        level: level,\n        attach: attach\n      };\n    };\n    var isChildOfContentEditableTrue = function (node) {\n      while (node = node.parentNode) {\n        var value = node.contentEditable;\n        if (value && value !== 'inherit') {\n          return isContentEditableTrue(node);\n        }\n      }\n      return false;\n    };\n    var select = function (selector, root) {\n      return map$2(descendants(SugarElement.fromDom(root), selector), function (element) {\n        return element.dom;\n      });\n    };\n    var getElementText = function (elm) {\n      return elm.innerText || elm.textContent;\n    };\n    var getOrGenerateId = function (elm) {\n      return elm.id ? elm.id : generate$6('h');\n    };\n    var isAnchor = function (elm) {\n      return elm && elm.nodeName === 'A' && (elm.id || elm.name) !== undefined;\n    };\n    var isValidAnchor = function (elm) {\n      return isAnchor(elm) && isEditable(elm);\n    };\n    var isHeader = function (elm) {\n      return elm && /^(H[1-6])$/.test(elm.nodeName);\n    };\n    var isEditable = function (elm) {\n      return isChildOfContentEditableTrue(elm) && !isContentEditableFalse(elm);\n    };\n    var isValidHeader = function (elm) {\n      return isHeader(elm) && isEditable(elm);\n    };\n    var getLevel = function (elm) {\n      return isHeader(elm) ? parseInt(elm.nodeName.substr(1), 10) : 0;\n    };\n    var headerTarget = function (elm) {\n      var headerId = getOrGenerateId(elm);\n      var attach = function () {\n        elm.id = headerId;\n      };\n      return create('header', getElementText(elm), '#' + headerId, getLevel(elm), attach);\n    };\n    var anchorTarget = function (elm) {\n      var anchorId = elm.id || elm.name;\n      var anchorText = getElementText(elm);\n      return create('anchor', anchorText ? anchorText : '#' + anchorId, '#' + anchorId, 0, noop);\n    };\n    var getHeaderTargets = function (elms) {\n      return map$2(filter$2(elms, isValidHeader), headerTarget);\n    };\n    var getAnchorTargets = function (elms) {\n      return map$2(filter$2(elms, isValidAnchor), anchorTarget);\n    };\n    var getTargetElements = function (elm) {\n      var elms = select('h1,h2,h3,h4,h5,h6,a:not([href])', elm);\n      return elms;\n    };\n    var hasTitle = function (target) {\n      return trim(target.title).length > 0;\n    };\n    var find = function (elm) {\n      var elms = getTargetElements(elm);\n      return filter$2(getHeaderTargets(elms).concat(getAnchorTargets(elms)), hasTitle);\n    };\n    var LinkTargets = { find: find };\n\n    var STORAGE_KEY = 'tinymce-url-history';\n    var HISTORY_LENGTH = 5;\n    var isHttpUrl = function (url) {\n      return isString(url) && /^https?/.test(url);\n    };\n    var isArrayOfUrl = function (a) {\n      return isArray(a) && a.length <= HISTORY_LENGTH && forall(a, isHttpUrl);\n    };\n    var isRecordOfUrlArray = function (r) {\n      return isObject(r) && find$4(r, function (value) {\n        return !isArrayOfUrl(value);\n      }).isNone();\n    };\n    var getAllHistory = function () {\n      var unparsedHistory = global$8.getItem(STORAGE_KEY);\n      if (unparsedHistory === null) {\n        return {};\n      }\n      var history;\n      try {\n        history = JSON.parse(unparsedHistory);\n      } catch (e) {\n        if (e instanceof SyntaxError) {\n          console.log('Local storage ' + STORAGE_KEY + ' was not valid JSON', e);\n          return {};\n        }\n        throw e;\n      }\n      if (!isRecordOfUrlArray(history)) {\n        console.log('Local storage ' + STORAGE_KEY + ' was not valid format', history);\n        return {};\n      }\n      return history;\n    };\n    var setAllHistory = function (history) {\n      if (!isRecordOfUrlArray(history)) {\n        throw new Error('Bad format for history:\\n' + JSON.stringify(history));\n      }\n      global$8.setItem(STORAGE_KEY, JSON.stringify(history));\n    };\n    var getHistory = function (fileType) {\n      var history = getAllHistory();\n      return get$e(history, fileType).getOr([]);\n    };\n    var addToHistory = function (url, fileType) {\n      if (!isHttpUrl(url)) {\n        return;\n      }\n      var history = getAllHistory();\n      var items = get$e(history, fileType).getOr([]);\n      var itemsWithoutUrl = filter$2(items, function (item) {\n        return item !== url;\n      });\n      history[fileType] = [url].concat(itemsWithoutUrl).slice(0, HISTORY_LENGTH);\n      setAllHistory(history);\n    };\n\n    var isTruthy = function (value) {\n      return !!value;\n    };\n    var makeMap = function (value) {\n      return map$1(global$5.makeMap(value, /[, ]/), isTruthy);\n    };\n    var getPicker = function (editor) {\n      return Optional.from(getFilePickerCallback(editor)).filter(isFunction);\n    };\n    var getPickerTypes = function (editor) {\n      var optFileTypes = Optional.some(getFilePickerTypes(editor)).filter(isTruthy);\n      var optLegacyTypes = Optional.some(getFileBrowserCallbackTypes(editor)).filter(isTruthy);\n      var optTypes = optFileTypes.or(optLegacyTypes).map(makeMap);\n      return getPicker(editor).fold(never, function (_picker) {\n        return optTypes.fold(always, function (types) {\n          return keys(types).length > 0 ? types : false;\n        });\n      });\n    };\n    var getPickerSetting = function (editor, filetype) {\n      var pickerTypes = getPickerTypes(editor);\n      if (isBoolean(pickerTypes)) {\n        return pickerTypes ? getPicker(editor) : Optional.none();\n      } else {\n        return pickerTypes[filetype] ? getPicker(editor) : Optional.none();\n      }\n    };\n    var getUrlPicker = function (editor, filetype) {\n      return getPickerSetting(editor, filetype).map(function (picker) {\n        return function (entry) {\n          return Future.nu(function (completer) {\n            var handler = function (value, meta) {\n              if (!isString(value)) {\n                throw new Error('Expected value to be string');\n              }\n              if (meta !== undefined && !isObject(meta)) {\n                throw new Error('Expected meta to be a object');\n              }\n              var r = {\n                value: value,\n                meta: meta\n              };\n              completer(r);\n            };\n            var meta = __assign({\n              filetype: filetype,\n              fieldname: entry.fieldname\n            }, Optional.from(entry.meta).getOr({}));\n            picker.call(editor, handler, entry.value, meta);\n          });\n        };\n      });\n    };\n    var getTextSetting = function (value) {\n      return Optional.from(value).filter(isString).getOrUndefined();\n    };\n    var getLinkInformation = function (editor) {\n      if (noTypeaheadUrls(editor)) {\n        return Optional.none();\n      }\n      return Optional.some({\n        targets: LinkTargets.find(editor.getBody()),\n        anchorTop: getTextSetting(getAnchorTop(editor)),\n        anchorBottom: getTextSetting(getAnchorBottom(editor))\n      });\n    };\n    var getValidationHandler = function (editor) {\n      return Optional.from(getFilePickerValidatorHandler(editor));\n    };\n    var UrlInputBackstage = function (editor) {\n      return {\n        getHistory: getHistory,\n        addToHistory: addToHistory,\n        getLinkInformation: function () {\n          return getLinkInformation(editor);\n        },\n        getValidationHandler: function () {\n          return getValidationHandler(editor);\n        },\n        getUrlPicker: function (filetype) {\n          return getUrlPicker(editor, filetype);\n        }\n      };\n    };\n\n    var init$7 = function (sink, editor, lazyAnchorbar) {\n      var contextMenuState = Cell(false);\n      var toolbar = HeaderBackstage(editor);\n      var backstage = {\n        shared: {\n          providers: {\n            icons: function () {\n              return editor.ui.registry.getAll().icons;\n            },\n            menuItems: function () {\n              return editor.ui.registry.getAll().menuItems;\n            },\n            translate: global$e.translate,\n            isDisabled: function () {\n              return editor.mode.isReadOnly() || editor.ui.isDisabled();\n            },\n            getSetting: editor.getParam.bind(editor)\n          },\n          interpreter: function (s) {\n            return interpretWithoutForm(s, backstage);\n          },\n          anchors: getAnchors(editor, lazyAnchorbar, toolbar.isPositionedAtTop),\n          header: toolbar,\n          getSink: function () {\n            return Result.value(sink);\n          }\n        },\n        urlinput: UrlInputBackstage(editor),\n        styleselect: init$8(editor),\n        colorinput: ColorInputBackstage(editor),\n        dialog: DialogBackstage(editor),\n        isContextMenuOpen: function () {\n          return contextMenuState.get();\n        },\n        setContextMenuState: function (state) {\n          return contextMenuState.set(state);\n        }\n      };\n      return backstage;\n    };\n\n    var setup$b = function (editor, mothership, uiMothership) {\n      var broadcastEvent = function (name, evt) {\n        each$1([\n          mothership,\n          uiMothership\n        ], function (ship) {\n          ship.broadcastEvent(name, evt);\n        });\n      };\n      var broadcastOn = function (channel, message) {\n        each$1([\n          mothership,\n          uiMothership\n        ], function (ship) {\n          ship.broadcastOn([channel], message);\n        });\n      };\n      var fireDismissPopups = function (evt) {\n        return broadcastOn(dismissPopups(), { target: evt.target });\n      };\n      var doc = getDocument();\n      var onTouchstart = bind(doc, 'touchstart', fireDismissPopups);\n      var onTouchmove = bind(doc, 'touchmove', function (evt) {\n        return broadcastEvent(documentTouchmove(), evt);\n      });\n      var onTouchend = bind(doc, 'touchend', function (evt) {\n        return broadcastEvent(documentTouchend(), evt);\n      });\n      var onMousedown = bind(doc, 'mousedown', fireDismissPopups);\n      var onMouseup = bind(doc, 'mouseup', function (evt) {\n        if (evt.raw.button === 0) {\n          broadcastOn(mouseReleased(), { target: evt.target });\n        }\n      });\n      var onContentClick = function (raw) {\n        return broadcastOn(dismissPopups(), { target: SugarElement.fromDom(raw.target) });\n      };\n      var onContentMouseup = function (raw) {\n        if (raw.button === 0) {\n          broadcastOn(mouseReleased(), { target: SugarElement.fromDom(raw.target) });\n        }\n      };\n      var onContentMousedown = function () {\n        each$1(editor.editorManager.get(), function (loopEditor) {\n          if (editor !== loopEditor) {\n            loopEditor.fire('DismissPopups', { relatedTarget: editor });\n          }\n        });\n      };\n      var onWindowScroll = function (evt) {\n        return broadcastEvent(windowScroll(), fromRawEvent(evt));\n      };\n      var onWindowResize = function (evt) {\n        broadcastOn(repositionPopups(), {});\n        broadcastEvent(windowResize(), fromRawEvent(evt));\n      };\n      var onEditorResize = function () {\n        return broadcastOn(repositionPopups(), {});\n      };\n      var onEditorProgress = function (evt) {\n        if (evt.state) {\n          broadcastOn(dismissPopups(), { target: SugarElement.fromDom(editor.getContainer()) });\n        }\n      };\n      var onDismissPopups = function (event) {\n        broadcastOn(dismissPopups(), { target: SugarElement.fromDom(event.relatedTarget.getContainer()) });\n      };\n      editor.on('PostRender', function () {\n        editor.on('click', onContentClick);\n        editor.on('tap', onContentClick);\n        editor.on('mouseup', onContentMouseup);\n        editor.on('mousedown', onContentMousedown);\n        editor.on('ScrollWindow', onWindowScroll);\n        editor.on('ResizeWindow', onWindowResize);\n        editor.on('ResizeEditor', onEditorResize);\n        editor.on('AfterProgressState', onEditorProgress);\n        editor.on('DismissPopups', onDismissPopups);\n      });\n      editor.on('remove', function () {\n        editor.off('click', onContentClick);\n        editor.off('tap', onContentClick);\n        editor.off('mouseup', onContentMouseup);\n        editor.off('mousedown', onContentMousedown);\n        editor.off('ScrollWindow', onWindowScroll);\n        editor.off('ResizeWindow', onWindowResize);\n        editor.off('ResizeEditor', onEditorResize);\n        editor.off('AfterProgressState', onEditorProgress);\n        editor.off('DismissPopups', onDismissPopups);\n        onMousedown.unbind();\n        onTouchstart.unbind();\n        onTouchmove.unbind();\n        onTouchend.unbind();\n        onMouseup.unbind();\n      });\n      editor.on('detach', function () {\n        detachSystem(mothership);\n        detachSystem(uiMothership);\n        mothership.destroy();\n        uiMothership.destroy();\n      });\n    };\n\n    var parts$a = AlloyParts;\n    var partType = PartType;\n\n    var schema$f = constant$1([\n      defaulted('shell', false),\n      required$1('makeItem'),\n      defaulted('setupItem', noop),\n      SketchBehaviours.field('listBehaviours', [Replacing])\n    ]);\n    var customListDetail = function () {\n      return { behaviours: derive$1([Replacing.config({})]) };\n    };\n    var itemsPart = optional({\n      name: 'items',\n      overrides: customListDetail\n    });\n    var parts$9 = constant$1([itemsPart]);\n    var name = constant$1('CustomList');\n\n    var factory$d = function (detail, components, _spec, _external) {\n      var setItems = function (list, items) {\n        getListContainer(list).fold(function () {\n          console.error('Custom List was defined to not be a shell, but no item container was specified in components');\n          throw new Error('Custom List was defined to not be a shell, but no item container was specified in components');\n        }, function (container) {\n          var itemComps = Replacing.contents(container);\n          var numListsRequired = items.length;\n          var numListsToAdd = numListsRequired - itemComps.length;\n          var itemsToAdd = numListsToAdd > 0 ? range$2(numListsToAdd, function () {\n            return detail.makeItem();\n          }) : [];\n          var itemsToRemove = itemComps.slice(numListsRequired);\n          each$1(itemsToRemove, function (item) {\n            return Replacing.remove(container, item);\n          });\n          each$1(itemsToAdd, function (item) {\n            return Replacing.append(container, item);\n          });\n          var builtLists = Replacing.contents(container);\n          each$1(builtLists, function (item, i) {\n            detail.setupItem(list, item, items[i], i);\n          });\n        });\n      };\n      var extra = detail.shell ? {\n        behaviours: [Replacing.config({})],\n        components: []\n      } : {\n        behaviours: [],\n        components: components\n      };\n      var getListContainer = function (component) {\n        return detail.shell ? Optional.some(component) : getPart(component, detail, 'items');\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: extra.components,\n        behaviours: augment(detail.listBehaviours, extra.behaviours),\n        apis: { setItems: setItems }\n      };\n    };\n    var CustomList = composite({\n      name: name(),\n      configFields: schema$f(),\n      partFields: parts$9(),\n      factory: factory$d,\n      apis: {\n        setItems: function (apis, list, items) {\n          apis.setItems(list, items);\n        }\n      }\n    });\n\n    var schema$e = constant$1([\n      required$1('dom'),\n      defaulted('shell', true),\n      field('toolbarBehaviours', [Replacing])\n    ]);\n    var enhanceGroups = function () {\n      return { behaviours: derive$1([Replacing.config({})]) };\n    };\n    var parts$8 = constant$1([optional({\n        name: 'groups',\n        overrides: enhanceGroups\n      })]);\n\n    var factory$c = function (detail, components, _spec, _externals) {\n      var setGroups = function (toolbar, groups) {\n        getGroupContainer(toolbar).fold(function () {\n          console.error('Toolbar was defined to not be a shell, but no groups container was specified in components');\n          throw new Error('Toolbar was defined to not be a shell, but no groups container was specified in components');\n        }, function (container) {\n          Replacing.set(container, groups);\n        });\n      };\n      var getGroupContainer = function (component) {\n        return detail.shell ? Optional.some(component) : getPart(component, detail, 'groups');\n      };\n      var extra = detail.shell ? {\n        behaviours: [Replacing.config({})],\n        components: []\n      } : {\n        behaviours: [],\n        components: components\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: extra.components,\n        behaviours: augment(detail.toolbarBehaviours, extra.behaviours),\n        apis: { setGroups: setGroups },\n        domModification: { attributes: { role: 'group' } }\n      };\n    };\n    var Toolbar = composite({\n      name: 'Toolbar',\n      configFields: schema$e(),\n      partFields: parts$8(),\n      factory: factory$c,\n      apis: {\n        setGroups: function (apis, toolbar, groups) {\n          apis.setGroups(toolbar, groups);\n        }\n      }\n    });\n\n    var setup$a = noop;\n    var isDocked$2 = never;\n    var getBehaviours$1 = constant$1([]);\n\n    var StaticHeader = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        setup: setup$a,\n        isDocked: isDocked$2,\n        getBehaviours: getBehaviours$1\n    });\n\n    var getOffsetParent = function (element) {\n      var isFixed = is$1(getRaw(element, 'position'), 'fixed');\n      var offsetParent$1 = isFixed ? Optional.none() : offsetParent(element);\n      return offsetParent$1.orThunk(function () {\n        var marker = SugarElement.fromTag('span');\n        return parent(element).bind(function (parent) {\n          append$2(parent, marker);\n          var offsetParent$1 = offsetParent(marker);\n          remove$5(marker);\n          return offsetParent$1;\n        });\n      });\n    };\n    var getOrigin = function (element) {\n      return getOffsetParent(element).map(absolute$3).getOrThunk(function () {\n        return SugarPosition(0, 0);\n      });\n    };\n\n    var morphAdt = Adt.generate([\n      { static: [] },\n      { absolute: ['positionCss'] },\n      { fixed: ['positionCss'] }\n    ]);\n    var appear = function (component, contextualInfo) {\n      var elem = component.element;\n      add$2(elem, contextualInfo.transitionClass);\n      remove$2(elem, contextualInfo.fadeOutClass);\n      add$2(elem, contextualInfo.fadeInClass);\n      contextualInfo.onShow(component);\n    };\n    var disappear = function (component, contextualInfo) {\n      var elem = component.element;\n      add$2(elem, contextualInfo.transitionClass);\n      remove$2(elem, contextualInfo.fadeInClass);\n      add$2(elem, contextualInfo.fadeOutClass);\n      contextualInfo.onHide(component);\n    };\n    var isPartiallyVisible = function (box, viewport) {\n      return box.y < viewport.bottom && box.bottom > viewport.y;\n    };\n    var isTopCompletelyVisible = function (box, viewport) {\n      return box.y >= viewport.y;\n    };\n    var isBottomCompletelyVisible = function (box, viewport) {\n      return box.bottom <= viewport.bottom;\n    };\n    var isVisibleForModes = function (modes, box, viewport) {\n      return forall(modes, function (mode) {\n        switch (mode) {\n        case 'bottom':\n          return isBottomCompletelyVisible(box, viewport);\n        case 'top':\n          return isTopCompletelyVisible(box, viewport);\n        }\n      });\n    };\n    var getPrior = function (elem, state) {\n      return state.getInitialPos().map(function (pos) {\n        return bounds(pos.bounds.x, pos.bounds.y, get$a(elem), get$b(elem));\n      });\n    };\n    var storePrior = function (elem, box, state) {\n      state.setInitialPos({\n        style: getAllRaw(elem),\n        position: get$c(elem, 'position') || 'static',\n        bounds: box\n      });\n    };\n    var revertToOriginal = function (elem, box, state) {\n      return state.getInitialPos().bind(function (position) {\n        state.clearInitialPos();\n        switch (position.position) {\n        case 'static':\n          return Optional.some(morphAdt.static());\n        case 'absolute':\n          var offsetBox_1 = getOffsetParent(elem).map(box$1).getOrThunk(function () {\n            return box$1(body());\n          });\n          return Optional.some(morphAdt.absolute(NuPositionCss('absolute', get$e(position.style, 'left').map(function (_left) {\n            return box.x - offsetBox_1.x;\n          }), get$e(position.style, 'top').map(function (_top) {\n            return box.y - offsetBox_1.y;\n          }), get$e(position.style, 'right').map(function (_right) {\n            return offsetBox_1.right - box.right;\n          }), get$e(position.style, 'bottom').map(function (_bottom) {\n            return offsetBox_1.bottom - box.bottom;\n          }))));\n        default:\n          return Optional.none();\n        }\n      });\n    };\n    var morphToOriginal = function (elem, viewport, state) {\n      return getPrior(elem, state).filter(function (box) {\n        return isVisibleForModes(state.getModes(), box, viewport);\n      }).bind(function (box) {\n        return revertToOriginal(elem, box, state);\n      });\n    };\n    var morphToFixed = function (elem, viewport, state) {\n      var box = box$1(elem);\n      if (!isVisibleForModes(state.getModes(), box, viewport)) {\n        storePrior(elem, box, state);\n        var winBox = win();\n        var left = box.x - winBox.x;\n        var top_1 = viewport.y - winBox.y;\n        var bottom = winBox.bottom - viewport.bottom;\n        var isTop = box.y <= viewport.y;\n        return Optional.some(morphAdt.fixed(NuPositionCss('fixed', Optional.some(left), isTop ? Optional.some(top_1) : Optional.none(), Optional.none(), !isTop ? Optional.some(bottom) : Optional.none())));\n      } else {\n        return Optional.none();\n      }\n    };\n    var getMorph = function (component, viewport, state) {\n      var elem = component.element;\n      var isDocked = is$1(getRaw(elem, 'position'), 'fixed');\n      return isDocked ? morphToOriginal(elem, viewport, state) : morphToFixed(elem, viewport, state);\n    };\n    var getMorphToOriginal = function (component, state) {\n      var elem = component.element;\n      return getPrior(elem, state).bind(function (box) {\n        return revertToOriginal(elem, box, state);\n      });\n    };\n\n    var morphToStatic = function (component, config, state) {\n      state.setDocked(false);\n      each$1([\n        'left',\n        'right',\n        'top',\n        'bottom',\n        'position'\n      ], function (prop) {\n        return remove$6(component.element, prop);\n      });\n      config.onUndocked(component);\n    };\n    var morphToCoord = function (component, config, state, position) {\n      var isDocked = position.position === 'fixed';\n      state.setDocked(isDocked);\n      applyPositionCss(component.element, position);\n      var method = isDocked ? config.onDocked : config.onUndocked;\n      method(component);\n    };\n    var updateVisibility = function (component, config, state, viewport, morphToDocked) {\n      if (morphToDocked === void 0) {\n        morphToDocked = false;\n      }\n      config.contextual.each(function (contextInfo) {\n        contextInfo.lazyContext(component).each(function (box) {\n          var isVisible = isPartiallyVisible(box, viewport);\n          if (isVisible !== state.isVisible()) {\n            state.setVisible(isVisible);\n            if (morphToDocked && !isVisible) {\n              add$1(component.element, [contextInfo.fadeOutClass]);\n              contextInfo.onHide(component);\n            } else {\n              var method = isVisible ? appear : disappear;\n              method(component, contextInfo);\n            }\n          }\n        });\n      });\n    };\n    var refreshInternal = function (component, config, state) {\n      var viewport = config.lazyViewport(component);\n      var isDocked = state.isDocked();\n      if (isDocked) {\n        updateVisibility(component, config, state, viewport);\n      }\n      getMorph(component, viewport, state).each(function (morph) {\n        morph.fold(function () {\n          return morphToStatic(component, config, state);\n        }, function (position) {\n          return morphToCoord(component, config, state, position);\n        }, function (position) {\n          updateVisibility(component, config, state, viewport, true);\n          morphToCoord(component, config, state, position);\n        });\n      });\n    };\n    var resetInternal = function (component, config, state) {\n      var elem = component.element;\n      state.setDocked(false);\n      getMorphToOriginal(component, state).each(function (morph) {\n        morph.fold(function () {\n          return morphToStatic(component, config, state);\n        }, function (position) {\n          return morphToCoord(component, config, state, position);\n        }, noop);\n      });\n      state.setVisible(true);\n      config.contextual.each(function (contextInfo) {\n        remove$1(elem, [\n          contextInfo.fadeInClass,\n          contextInfo.fadeOutClass,\n          contextInfo.transitionClass\n        ]);\n        contextInfo.onShow(component);\n      });\n      refresh$4(component, config, state);\n    };\n    var refresh$4 = function (component, config, state) {\n      if (component.getSystem().isConnected()) {\n        refreshInternal(component, config, state);\n      }\n    };\n    var reset = function (component, config, state) {\n      if (state.isDocked()) {\n        resetInternal(component, config, state);\n      }\n    };\n    var isDocked$1 = function (component, config, state) {\n      return state.isDocked();\n    };\n    var setModes = function (component, config, state, modes) {\n      return state.setModes(modes);\n    };\n    var getModes = function (component, config, state) {\n      return state.getModes();\n    };\n\n    var DockingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        refresh: refresh$4,\n        reset: reset,\n        isDocked: isDocked$1,\n        getModes: getModes,\n        setModes: setModes\n    });\n\n    var events$5 = function (dockInfo, dockState) {\n      return derive$2([\n        runOnSource(transitionend(), function (component, simulatedEvent) {\n          dockInfo.contextual.each(function (contextInfo) {\n            if (has(component.element, contextInfo.transitionClass)) {\n              remove$1(component.element, [\n                contextInfo.transitionClass,\n                contextInfo.fadeInClass\n              ]);\n              var notify = dockState.isVisible() ? contextInfo.onShown : contextInfo.onHidden;\n              notify(component);\n            }\n            simulatedEvent.stop();\n          });\n        }),\n        run$1(windowScroll(), function (component, _) {\n          refresh$4(component, dockInfo, dockState);\n        }),\n        run$1(windowResize(), function (component, _) {\n          reset(component, dockInfo, dockState);\n        })\n      ]);\n    };\n\n    var ActiveDocking = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$5\n    });\n\n    var DockingSchema = [\n      optionObjOf('contextual', [\n        requiredString('fadeInClass'),\n        requiredString('fadeOutClass'),\n        requiredString('transitionClass'),\n        requiredFunction('lazyContext'),\n        onHandler('onShow'),\n        onHandler('onShown'),\n        onHandler('onHide'),\n        onHandler('onHidden')\n      ]),\n      defaultedFunction('lazyViewport', win),\n      defaultedArrayOf('modes', [\n        'top',\n        'bottom'\n      ], string),\n      onHandler('onDocked'),\n      onHandler('onUndocked')\n    ];\n\n    var init$6 = function (spec) {\n      var docked = Cell(false);\n      var visible = Cell(true);\n      var initialBounds = value$1();\n      var modes = Cell(spec.modes);\n      var readState = function () {\n        return 'docked:  ' + docked.get() + ', visible: ' + visible.get() + ', modes: ' + modes.get().join(',');\n      };\n      return nu$8({\n        isDocked: docked.get,\n        setDocked: docked.set,\n        getInitialPos: initialBounds.get,\n        setInitialPos: initialBounds.set,\n        clearInitialPos: initialBounds.clear,\n        isVisible: visible.get,\n        setVisible: visible.set,\n        getModes: modes.get,\n        setModes: modes.set,\n        readState: readState\n      });\n    };\n\n    var DockingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$6\n    });\n\n    var Docking = create$8({\n      fields: DockingSchema,\n      name: 'docking',\n      active: ActiveDocking,\n      apis: DockingApis,\n      state: DockingState\n    });\n\n    var toolbarHeightChange = constant$1(generate$6('toolbar-height-change'));\n\n    var visibility = {\n      fadeInClass: 'tox-editor-dock-fadein',\n      fadeOutClass: 'tox-editor-dock-fadeout',\n      transitionClass: 'tox-editor-dock-transition'\n    };\n    var editorStickyOnClass = 'tox-tinymce--toolbar-sticky-on';\n    var editorStickyOffClass = 'tox-tinymce--toolbar-sticky-off';\n    var scrollFromBehindHeader = function (e, containerHeader) {\n      var doc = owner$4(containerHeader);\n      var viewHeight = doc.dom.defaultView.innerHeight;\n      var scrollPos = get$9(doc);\n      var markerElement = SugarElement.fromDom(e.elm);\n      var markerPos = absolute$2(markerElement);\n      var markerHeight = get$b(markerElement);\n      var markerTop = markerPos.y;\n      var markerBottom = markerTop + markerHeight;\n      var editorHeaderPos = absolute$3(containerHeader);\n      var editorHeaderHeight = get$b(containerHeader);\n      var editorHeaderTop = editorHeaderPos.top;\n      var editorHeaderBottom = editorHeaderTop + editorHeaderHeight;\n      var editorHeaderDockedAtTop = Math.abs(editorHeaderTop - scrollPos.top) < 2;\n      var editorHeaderDockedAtBottom = Math.abs(editorHeaderBottom - (scrollPos.top + viewHeight)) < 2;\n      if (editorHeaderDockedAtTop && markerTop < editorHeaderBottom) {\n        to(scrollPos.left, markerTop - editorHeaderHeight, doc);\n      } else if (editorHeaderDockedAtBottom && markerBottom > editorHeaderTop) {\n        var y = markerTop - viewHeight + markerHeight + editorHeaderHeight;\n        to(scrollPos.left, y, doc);\n      }\n    };\n    var isDockedMode = function (header, mode) {\n      return contains$2(Docking.getModes(header), mode);\n    };\n    var updateIframeContentFlow = function (header) {\n      var getOccupiedHeight = function (elm) {\n        return getOuter$2(elm) + (parseInt(get$c(elm, 'margin-top'), 10) || 0) + (parseInt(get$c(elm, 'margin-bottom'), 10) || 0);\n      };\n      var elm = header.element;\n      parent(elm).each(function (parentElem) {\n        var padding = 'padding-' + Docking.getModes(header)[0];\n        if (Docking.isDocked(header)) {\n          var parentWidth = get$a(parentElem);\n          set$7(elm, 'width', parentWidth + 'px');\n          set$7(parentElem, padding, getOccupiedHeight(elm) + 'px');\n        } else {\n          remove$6(elm, 'width');\n          remove$6(parentElem, padding);\n        }\n      });\n    };\n    var updateSinkVisibility = function (sinkElem, visible) {\n      if (visible) {\n        remove$2(sinkElem, visibility.fadeOutClass);\n        add$1(sinkElem, [\n          visibility.transitionClass,\n          visibility.fadeInClass\n        ]);\n      } else {\n        remove$2(sinkElem, visibility.fadeInClass);\n        add$1(sinkElem, [\n          visibility.fadeOutClass,\n          visibility.transitionClass\n        ]);\n      }\n    };\n    var updateEditorClasses = function (editor, docked) {\n      var editorContainer = SugarElement.fromDom(editor.getContainer());\n      if (docked) {\n        add$2(editorContainer, editorStickyOnClass);\n        remove$2(editorContainer, editorStickyOffClass);\n      } else {\n        add$2(editorContainer, editorStickyOffClass);\n        remove$2(editorContainer, editorStickyOnClass);\n      }\n    };\n    var restoreFocus = function (headerElem, focusedElem) {\n      var ownerDoc = owner$4(focusedElem);\n      active(ownerDoc).filter(function (activeElm) {\n        return !eq(focusedElem, activeElm);\n      }).filter(function (activeElm) {\n        return eq(activeElm, SugarElement.fromDom(ownerDoc.dom.body)) || contains(headerElem, activeElm);\n      }).each(function () {\n        return focus$3(focusedElem);\n      });\n    };\n    var findFocusedElem = function (rootElm, lazySink) {\n      return search(rootElm).orThunk(function () {\n        return lazySink().toOptional().bind(function (sink) {\n          return search(sink.element);\n        });\n      });\n    };\n    var setup$9 = function (editor, sharedBackstage, lazyHeader) {\n      if (!editor.inline) {\n        if (!sharedBackstage.header.isPositionedAtTop()) {\n          editor.on('ResizeEditor', function () {\n            lazyHeader().each(Docking.reset);\n          });\n        }\n        editor.on('ResizeWindow ResizeEditor', function () {\n          lazyHeader().each(updateIframeContentFlow);\n        });\n        editor.on('SkinLoaded', function () {\n          lazyHeader().each(function (comp) {\n            Docking.isDocked(comp) ? Docking.reset(comp) : Docking.refresh(comp);\n          });\n        });\n        editor.on('FullscreenStateChanged', function () {\n          lazyHeader().each(Docking.reset);\n        });\n      }\n      editor.on('AfterScrollIntoView', function (e) {\n        lazyHeader().each(function (header) {\n          Docking.refresh(header);\n          var headerElem = header.element;\n          if (isVisible(headerElem)) {\n            scrollFromBehindHeader(e, headerElem);\n          }\n        });\n      });\n      editor.on('PostRender', function () {\n        updateEditorClasses(editor, false);\n      });\n    };\n    var isDocked = function (lazyHeader) {\n      return lazyHeader().map(Docking.isDocked).getOr(false);\n    };\n    var getIframeBehaviours = function () {\n      var _a;\n      return [Receiving.config({ channels: (_a = {}, _a[toolbarHeightChange()] = { onReceive: updateIframeContentFlow }, _a) })];\n    };\n    var getBehaviours = function (editor, sharedBackstage) {\n      var focusedElm = value$1();\n      var lazySink = sharedBackstage.getSink;\n      var runOnSinkElement = function (f) {\n        lazySink().each(function (sink) {\n          return f(sink.element);\n        });\n      };\n      var onDockingSwitch = function (comp) {\n        if (!editor.inline) {\n          updateIframeContentFlow(comp);\n        }\n        updateEditorClasses(editor, Docking.isDocked(comp));\n        comp.getSystem().broadcastOn([repositionPopups()], {});\n        lazySink().each(function (sink) {\n          return sink.getSystem().broadcastOn([repositionPopups()], {});\n        });\n      };\n      var additionalBehaviours = editor.inline ? [] : getIframeBehaviours();\n      return __spreadArray([\n        Focusing.config({}),\n        Docking.config({\n          contextual: __assign({\n            lazyContext: function (comp) {\n              var headerHeight = getOuter$2(comp.element);\n              var container = editor.inline ? editor.getContentAreaContainer() : editor.getContainer();\n              var box = box$1(SugarElement.fromDom(container));\n              var boxHeight = box.height - headerHeight;\n              var topBound = box.y + (isDockedMode(comp, 'top') ? 0 : headerHeight);\n              return Optional.some(bounds(box.x, topBound, box.width, boxHeight));\n            },\n            onShow: function () {\n              runOnSinkElement(function (elem) {\n                return updateSinkVisibility(elem, true);\n              });\n            },\n            onShown: function (comp) {\n              runOnSinkElement(function (elem) {\n                return remove$1(elem, [\n                  visibility.transitionClass,\n                  visibility.fadeInClass\n                ]);\n              });\n              focusedElm.get().each(function (elem) {\n                restoreFocus(comp.element, elem);\n                focusedElm.clear();\n              });\n            },\n            onHide: function (comp) {\n              findFocusedElem(comp.element, lazySink).fold(focusedElm.clear, focusedElm.set);\n              runOnSinkElement(function (elem) {\n                return updateSinkVisibility(elem, false);\n              });\n            },\n            onHidden: function () {\n              runOnSinkElement(function (elem) {\n                return remove$1(elem, [visibility.transitionClass]);\n              });\n            }\n          }, visibility),\n          lazyViewport: function (comp) {\n            var win$1 = win();\n            var offset = getStickyToolbarOffset(editor);\n            var top = win$1.y + (isDockedMode(comp, 'top') ? offset : 0);\n            var height = win$1.height - (isDockedMode(comp, 'bottom') ? offset : 0);\n            return bounds(win$1.x, top, win$1.width, height);\n          },\n          modes: [sharedBackstage.header.getDockingMode()],\n          onDocked: onDockingSwitch,\n          onUndocked: onDockingSwitch\n        })\n      ], additionalBehaviours, true);\n    };\n\n    var StickyHeader = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        setup: setup$9,\n        isDocked: isDocked,\n        getBehaviours: getBehaviours\n    });\n\n    var renderHeader = function (spec) {\n      var editor = spec.editor;\n      var getBehaviours$2 = spec.sticky ? getBehaviours : getBehaviours$1;\n      return {\n        uid: spec.uid,\n        dom: spec.dom,\n        components: spec.components,\n        behaviours: derive$1(getBehaviours$2(editor, spec.sharedBackstage))\n      };\n    };\n\n    var groupToolbarButtonSchema = objOf([\n      requiredString('type'),\n      requiredOf('items', oneOf([\n        arrOfObj([\n          requiredString('name'),\n          requiredArrayOf('items', string)\n        ]),\n        string\n      ]))\n    ].concat(baseToolbarButtonFields));\n    var createGroupToolbarButton = function (spec) {\n      return asRaw('GroupToolbarButton', groupToolbarButtonSchema, spec);\n    };\n\n    var baseMenuButtonFields = [\n      optionString('text'),\n      optionString('tooltip'),\n      optionString('icon'),\n      requiredFunction('fetch'),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      })\n    ];\n\n    var MenuButtonSchema = objOf(__spreadArray([requiredString('type')], baseMenuButtonFields, true));\n    var createMenuButton = function (spec) {\n      return asRaw('menubutton', MenuButtonSchema, spec);\n    };\n\n    var splitButtonSchema = objOf([\n      requiredString('type'),\n      optionString('tooltip'),\n      optionString('icon'),\n      optionString('text'),\n      optionFunction('select'),\n      requiredFunction('fetch'),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      }),\n      defaultedStringEnum('presets', 'normal', [\n        'normal',\n        'color',\n        'listpreview'\n      ]),\n      defaulted('columns', 1),\n      requiredFunction('onAction'),\n      requiredFunction('onItemAction')\n    ]);\n    var createSplitButton = function (spec) {\n      return asRaw('SplitButton', splitButtonSchema, spec);\n    };\n\n    var factory$b = function (detail, spec) {\n      var setMenus = function (comp, menus) {\n        var newMenus = map$2(menus, function (m) {\n          var buttonSpec = {\n            type: 'menubutton',\n            text: m.text,\n            fetch: function (callback) {\n              callback(m.getItems());\n            }\n          };\n          var internal = createMenuButton(buttonSpec).mapError(function (errInfo) {\n            return formatError(errInfo);\n          }).getOrDie();\n          return renderMenuButton(internal, 'tox-mbtn', spec.backstage, Optional.some('menuitem'));\n        });\n        Replacing.set(comp, newMenus);\n      };\n      var apis = {\n        focus: Keying.focusIn,\n        setMenus: setMenus\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: [],\n        behaviours: derive$1([\n          Replacing.config({}),\n          config('menubar-events', [\n            runOnAttached(function (component) {\n              detail.onSetup(component);\n            }),\n            run$1(mouseover(), function (comp, se) {\n              descendant(comp.element, '.' + 'tox-mbtn--active').each(function (activeButton) {\n                closest$1(se.event.target, '.' + 'tox-mbtn').each(function (hoveredButton) {\n                  if (!eq(activeButton, hoveredButton)) {\n                    comp.getSystem().getByDom(activeButton).each(function (activeComp) {\n                      comp.getSystem().getByDom(hoveredButton).each(function (hoveredComp) {\n                        Dropdown.expand(hoveredComp);\n                        Dropdown.close(activeComp);\n                        Focusing.focus(hoveredComp);\n                      });\n                    });\n                  }\n                });\n              });\n            }),\n            run$1(focusShifted(), function (comp, se) {\n              se.event.prevFocus.bind(function (prev) {\n                return comp.getSystem().getByDom(prev).toOptional();\n              }).each(function (prev) {\n                se.event.newFocus.bind(function (nu) {\n                  return comp.getSystem().getByDom(nu).toOptional();\n                }).each(function (nu) {\n                  if (Dropdown.isOpen(prev)) {\n                    Dropdown.expand(nu);\n                    Dropdown.close(prev);\n                  }\n                });\n              });\n            })\n          ]),\n          Keying.config({\n            mode: 'flow',\n            selector: '.' + 'tox-mbtn',\n            onEscape: function (comp) {\n              detail.onEscape(comp);\n              return Optional.some(true);\n            }\n          }),\n          Tabstopping.config({})\n        ]),\n        apis: apis,\n        domModification: { attributes: { role: 'menubar' } }\n      };\n    };\n    var SilverMenubar = single({\n      factory: factory$b,\n      name: 'silver.Menubar',\n      configFields: [\n        required$1('dom'),\n        required$1('uid'),\n        required$1('onEscape'),\n        required$1('backstage'),\n        defaulted('onSetup', noop)\n      ],\n      apis: {\n        focus: function (apis, comp) {\n          apis.focus(comp);\n        },\n        setMenus: function (apis, comp, menus) {\n          apis.setMenus(comp, menus);\n        }\n      }\n    });\n\n    var getAnimationRoot = function (component, slideConfig) {\n      return slideConfig.getAnimationRoot.fold(function () {\n        return component.element;\n      }, function (get) {\n        return get(component);\n      });\n    };\n\n    var getDimensionProperty = function (slideConfig) {\n      return slideConfig.dimension.property;\n    };\n    var getDimension = function (slideConfig, elem) {\n      return slideConfig.dimension.getDimension(elem);\n    };\n    var disableTransitions = function (component, slideConfig) {\n      var root = getAnimationRoot(component, slideConfig);\n      remove$1(root, [\n        slideConfig.shrinkingClass,\n        slideConfig.growingClass\n      ]);\n    };\n    var setShrunk = function (component, slideConfig) {\n      remove$2(component.element, slideConfig.openClass);\n      add$2(component.element, slideConfig.closedClass);\n      set$7(component.element, getDimensionProperty(slideConfig), '0px');\n      reflow(component.element);\n    };\n    var setGrown = function (component, slideConfig) {\n      remove$2(component.element, slideConfig.closedClass);\n      add$2(component.element, slideConfig.openClass);\n      remove$6(component.element, getDimensionProperty(slideConfig));\n    };\n    var doImmediateShrink = function (component, slideConfig, slideState, _calculatedSize) {\n      slideState.setCollapsed();\n      set$7(component.element, getDimensionProperty(slideConfig), getDimension(slideConfig, component.element));\n      reflow(component.element);\n      disableTransitions(component, slideConfig);\n      setShrunk(component, slideConfig);\n      slideConfig.onStartShrink(component);\n      slideConfig.onShrunk(component);\n    };\n    var doStartShrink = function (component, slideConfig, slideState, calculatedSize) {\n      var size = calculatedSize.getOrThunk(function () {\n        return getDimension(slideConfig, component.element);\n      });\n      slideState.setCollapsed();\n      set$7(component.element, getDimensionProperty(slideConfig), size);\n      reflow(component.element);\n      var root = getAnimationRoot(component, slideConfig);\n      remove$2(root, slideConfig.growingClass);\n      add$2(root, slideConfig.shrinkingClass);\n      setShrunk(component, slideConfig);\n      slideConfig.onStartShrink(component);\n    };\n    var doStartSmartShrink = function (component, slideConfig, slideState) {\n      var size = getDimension(slideConfig, component.element);\n      var shrinker = size === '0px' ? doImmediateShrink : doStartShrink;\n      shrinker(component, slideConfig, slideState, Optional.some(size));\n    };\n    var doStartGrow = function (component, slideConfig, slideState) {\n      var root = getAnimationRoot(component, slideConfig);\n      var wasShrinking = has(root, slideConfig.shrinkingClass);\n      var beforeSize = getDimension(slideConfig, component.element);\n      setGrown(component, slideConfig);\n      var fullSize = getDimension(slideConfig, component.element);\n      var startPartialGrow = function () {\n        set$7(component.element, getDimensionProperty(slideConfig), beforeSize);\n        reflow(component.element);\n      };\n      var startCompleteGrow = function () {\n        setShrunk(component, slideConfig);\n      };\n      var setStartSize = wasShrinking ? startPartialGrow : startCompleteGrow;\n      setStartSize();\n      remove$2(root, slideConfig.shrinkingClass);\n      add$2(root, slideConfig.growingClass);\n      setGrown(component, slideConfig);\n      set$7(component.element, getDimensionProperty(slideConfig), fullSize);\n      slideState.setExpanded();\n      slideConfig.onStartGrow(component);\n    };\n    var refresh$3 = function (component, slideConfig, slideState) {\n      if (slideState.isExpanded()) {\n        remove$6(component.element, getDimensionProperty(slideConfig));\n        var fullSize = getDimension(slideConfig, component.element);\n        set$7(component.element, getDimensionProperty(slideConfig), fullSize);\n      }\n    };\n    var grow = function (component, slideConfig, slideState) {\n      if (!slideState.isExpanded()) {\n        doStartGrow(component, slideConfig, slideState);\n      }\n    };\n    var shrink = function (component, slideConfig, slideState) {\n      if (slideState.isExpanded()) {\n        doStartSmartShrink(component, slideConfig, slideState);\n      }\n    };\n    var immediateShrink = function (component, slideConfig, slideState) {\n      if (slideState.isExpanded()) {\n        doImmediateShrink(component, slideConfig, slideState);\n      }\n    };\n    var hasGrown = function (component, slideConfig, slideState) {\n      return slideState.isExpanded();\n    };\n    var hasShrunk = function (component, slideConfig, slideState) {\n      return slideState.isCollapsed();\n    };\n    var isGrowing = function (component, slideConfig, _slideState) {\n      var root = getAnimationRoot(component, slideConfig);\n      return has(root, slideConfig.growingClass) === true;\n    };\n    var isShrinking = function (component, slideConfig, _slideState) {\n      var root = getAnimationRoot(component, slideConfig);\n      return has(root, slideConfig.shrinkingClass) === true;\n    };\n    var isTransitioning = function (component, slideConfig, slideState) {\n      return isGrowing(component, slideConfig) || isShrinking(component, slideConfig);\n    };\n    var toggleGrow = function (component, slideConfig, slideState) {\n      var f = slideState.isExpanded() ? doStartSmartShrink : doStartGrow;\n      f(component, slideConfig, slideState);\n    };\n\n    var SlidingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        refresh: refresh$3,\n        grow: grow,\n        shrink: shrink,\n        immediateShrink: immediateShrink,\n        hasGrown: hasGrown,\n        hasShrunk: hasShrunk,\n        isGrowing: isGrowing,\n        isShrinking: isShrinking,\n        isTransitioning: isTransitioning,\n        toggleGrow: toggleGrow,\n        disableTransitions: disableTransitions\n    });\n\n    var exhibit = function (base, slideConfig, _slideState) {\n      var expanded = slideConfig.expanded;\n      return expanded ? nu$7({\n        classes: [slideConfig.openClass],\n        styles: {}\n      }) : nu$7({\n        classes: [slideConfig.closedClass],\n        styles: wrap$1(slideConfig.dimension.property, '0px')\n      });\n    };\n    var events$4 = function (slideConfig, slideState) {\n      return derive$2([runOnSource(transitionend(), function (component, simulatedEvent) {\n          var raw = simulatedEvent.event.raw;\n          if (raw.propertyName === slideConfig.dimension.property) {\n            disableTransitions(component, slideConfig);\n            if (slideState.isExpanded()) {\n              remove$6(component.element, slideConfig.dimension.property);\n            }\n            var notify = slideState.isExpanded() ? slideConfig.onGrown : slideConfig.onShrunk;\n            notify(component);\n          }\n        })]);\n    };\n\n    var ActiveSliding = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        exhibit: exhibit,\n        events: events$4\n    });\n\n    var SlidingSchema = [\n      required$1('closedClass'),\n      required$1('openClass'),\n      required$1('shrinkingClass'),\n      required$1('growingClass'),\n      option('getAnimationRoot'),\n      onHandler('onShrunk'),\n      onHandler('onStartShrink'),\n      onHandler('onGrown'),\n      onHandler('onStartGrow'),\n      defaulted('expanded', false),\n      requiredOf('dimension', choose$1('property', {\n        width: [\n          output$1('property', 'width'),\n          output$1('getDimension', function (elem) {\n            return get$a(elem) + 'px';\n          })\n        ],\n        height: [\n          output$1('property', 'height'),\n          output$1('getDimension', function (elem) {\n            return get$b(elem) + 'px';\n          })\n        ]\n      }))\n    ];\n\n    var init$5 = function (spec) {\n      var state = Cell(spec.expanded);\n      var readState = function () {\n        return 'expanded: ' + state.get();\n      };\n      return nu$8({\n        isExpanded: function () {\n          return state.get() === true;\n        },\n        isCollapsed: function () {\n          return state.get() === false;\n        },\n        setCollapsed: curry(state.set, false),\n        setExpanded: curry(state.set, true),\n        readState: readState\n      });\n    };\n\n    var SlidingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$5\n    });\n\n    var Sliding = create$8({\n      fields: SlidingSchema,\n      name: 'sliding',\n      active: ActiveSliding,\n      apis: SlidingApis,\n      state: SlidingState\n    });\n\n    var owner = 'container';\n    var schema$d = [field('slotBehaviours', [])];\n    var getPartName = function (name) {\n      return '<alloy.field.' + name + '>';\n    };\n    var sketch = function (sSpec) {\n      var parts = function () {\n        var record = [];\n        var slot = function (name, config) {\n          record.push(name);\n          return generateOne$1(owner, getPartName(name), config);\n        };\n        return {\n          slot: slot,\n          record: constant$1(record)\n        };\n      }();\n      var spec = sSpec(parts);\n      var partNames = parts.record();\n      var fieldParts = map$2(partNames, function (n) {\n        return required({\n          name: n,\n          pname: getPartName(n)\n        });\n      });\n      return composite$1(owner, schema$d, fieldParts, make$1, spec);\n    };\n    var make$1 = function (detail, components) {\n      var getSlotNames = function (_) {\n        return getAllPartNames(detail);\n      };\n      var getSlot = function (container, key) {\n        return getPart(container, detail, key);\n      };\n      var onSlot = function (f, def) {\n        return function (container, key) {\n          return getPart(container, detail, key).map(function (slot) {\n            return f(slot, key);\n          }).getOr(def);\n        };\n      };\n      var onSlots = function (f) {\n        return function (container, keys) {\n          each$1(keys, function (key) {\n            return f(container, key);\n          });\n        };\n      };\n      var doShowing = function (comp, _key) {\n        return get$d(comp.element, 'aria-hidden') !== 'true';\n      };\n      var doShow = function (comp, key) {\n        if (!doShowing(comp)) {\n          var element = comp.element;\n          remove$6(element, 'display');\n          remove$7(element, 'aria-hidden');\n          emitWith(comp, slotVisibility(), {\n            name: key,\n            visible: true\n          });\n        }\n      };\n      var doHide = function (comp, key) {\n        if (doShowing(comp)) {\n          var element = comp.element;\n          set$7(element, 'display', 'none');\n          set$8(element, 'aria-hidden', 'true');\n          emitWith(comp, slotVisibility(), {\n            name: key,\n            visible: false\n          });\n        }\n      };\n      var isShowing = onSlot(doShowing, false);\n      var hideSlot = onSlot(doHide);\n      var hideSlots = onSlots(hideSlot);\n      var hideAllSlots = function (container) {\n        return hideSlots(container, getSlotNames());\n      };\n      var showSlot = onSlot(doShow);\n      var apis = {\n        getSlotNames: getSlotNames,\n        getSlot: getSlot,\n        isShowing: isShowing,\n        hideSlot: hideSlot,\n        hideAllSlots: hideAllSlots,\n        showSlot: showSlot\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: get$2(detail.slotBehaviours),\n        apis: apis\n      };\n    };\n    var slotApis = map$1({\n      getSlotNames: function (apis, c) {\n        return apis.getSlotNames(c);\n      },\n      getSlot: function (apis, c, key) {\n        return apis.getSlot(c, key);\n      },\n      isShowing: function (apis, c, key) {\n        return apis.isShowing(c, key);\n      },\n      hideSlot: function (apis, c, key) {\n        return apis.hideSlot(c, key);\n      },\n      hideAllSlots: function (apis, c) {\n        return apis.hideAllSlots(c);\n      },\n      showSlot: function (apis, c, key) {\n        return apis.showSlot(c, key);\n      }\n    }, function (value) {\n      return makeApi(value);\n    });\n    var SlotContainer = __assign(__assign({}, slotApis), { sketch: sketch });\n\n    var sidebarSchema = objOf([\n      optionString('icon'),\n      optionString('tooltip'),\n      defaultedFunction('onShow', noop),\n      defaultedFunction('onHide', noop),\n      defaultedFunction('onSetup', function () {\n        return noop;\n      })\n    ]);\n    var createSidebar = function (spec) {\n      return asRaw('sidebar', sidebarSchema, spec);\n    };\n\n    var setup$8 = function (editor) {\n      var sidebars = editor.ui.registry.getAll().sidebars;\n      each$1(keys(sidebars), function (name) {\n        var spec = sidebars[name];\n        var isActive = function () {\n          return is$1(Optional.from(editor.queryCommandValue('ToggleSidebar')), name);\n        };\n        editor.ui.registry.addToggleButton(name, {\n          icon: spec.icon,\n          tooltip: spec.tooltip,\n          onAction: function (buttonApi) {\n            editor.execCommand('ToggleSidebar', false, name);\n            buttonApi.setActive(isActive());\n          },\n          onSetup: function (buttonApi) {\n            var handleToggle = function () {\n              return buttonApi.setActive(isActive());\n            };\n            editor.on('ToggleSidebar', handleToggle);\n            return function () {\n              editor.off('ToggleSidebar', handleToggle);\n            };\n          }\n        });\n      });\n    };\n    var getApi = function (comp) {\n      return {\n        element: function () {\n          return comp.element.dom;\n        }\n      };\n    };\n    var makePanels = function (parts, panelConfigs) {\n      var specs = map$2(keys(panelConfigs), function (name) {\n        var spec = panelConfigs[name];\n        var bridged = getOrDie(createSidebar(spec));\n        return {\n          name: name,\n          getApi: getApi,\n          onSetup: bridged.onSetup,\n          onShow: bridged.onShow,\n          onHide: bridged.onHide\n        };\n      });\n      return map$2(specs, function (spec) {\n        var editorOffCell = Cell(noop);\n        return parts.slot(spec.name, {\n          dom: {\n            tag: 'div',\n            classes: ['tox-sidebar__pane']\n          },\n          behaviours: SimpleBehaviours.unnamedEvents([\n            onControlAttached(spec, editorOffCell),\n            onControlDetached(spec, editorOffCell),\n            run$1(slotVisibility(), function (sidepanel, se) {\n              var data = se.event;\n              var optSidePanelSpec = find$5(specs, function (config) {\n                return config.name === data.name;\n              });\n              optSidePanelSpec.each(function (sidePanelSpec) {\n                var handler = data.visible ? sidePanelSpec.onShow : sidePanelSpec.onHide;\n                handler(sidePanelSpec.getApi(sidepanel));\n              });\n            })\n          ])\n        });\n      });\n    };\n    var makeSidebar = function (panelConfigs) {\n      return SlotContainer.sketch(function (parts) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-sidebar__pane-container']\n          },\n          components: makePanels(parts, panelConfigs),\n          slotBehaviours: SimpleBehaviours.unnamedEvents([runOnAttached(function (slotContainer) {\n              return SlotContainer.hideAllSlots(slotContainer);\n            })])\n        };\n      });\n    };\n    var setSidebar = function (sidebar, panelConfigs) {\n      var optSlider = Composing.getCurrent(sidebar);\n      optSlider.each(function (slider) {\n        return Replacing.set(slider, [makeSidebar(panelConfigs)]);\n      });\n    };\n    var toggleSidebar = function (sidebar, name) {\n      var optSlider = Composing.getCurrent(sidebar);\n      optSlider.each(function (slider) {\n        var optSlotContainer = Composing.getCurrent(slider);\n        optSlotContainer.each(function (slotContainer) {\n          if (Sliding.hasGrown(slider)) {\n            if (SlotContainer.isShowing(slotContainer, name)) {\n              Sliding.shrink(slider);\n            } else {\n              SlotContainer.hideAllSlots(slotContainer);\n              SlotContainer.showSlot(slotContainer, name);\n            }\n          } else {\n            SlotContainer.hideAllSlots(slotContainer);\n            SlotContainer.showSlot(slotContainer, name);\n            Sliding.grow(slider);\n          }\n        });\n      });\n    };\n    var whichSidebar = function (sidebar) {\n      var optSlider = Composing.getCurrent(sidebar);\n      return optSlider.bind(function (slider) {\n        var sidebarOpen = Sliding.isGrowing(slider) || Sliding.hasGrown(slider);\n        if (sidebarOpen) {\n          var optSlotContainer = Composing.getCurrent(slider);\n          return optSlotContainer.bind(function (slotContainer) {\n            return find$5(SlotContainer.getSlotNames(slotContainer), function (name) {\n              return SlotContainer.isShowing(slotContainer, name);\n            });\n          });\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var fixSize = generate$6('FixSizeEvent');\n    var autoSize = generate$6('AutoSizeEvent');\n    var renderSidebar = function (spec) {\n      return {\n        uid: spec.uid,\n        dom: {\n          tag: 'div',\n          classes: ['tox-sidebar'],\n          attributes: { role: 'complementary' }\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-sidebar__slider']\n            },\n            components: [],\n            behaviours: derive$1([\n              Tabstopping.config({}),\n              Focusing.config({}),\n              Sliding.config({\n                dimension: { property: 'width' },\n                closedClass: 'tox-sidebar--sliding-closed',\n                openClass: 'tox-sidebar--sliding-open',\n                shrinkingClass: 'tox-sidebar--sliding-shrinking',\n                growingClass: 'tox-sidebar--sliding-growing',\n                onShrunk: function (slider) {\n                  var optSlotContainer = Composing.getCurrent(slider);\n                  optSlotContainer.each(SlotContainer.hideAllSlots);\n                  emit(slider, autoSize);\n                },\n                onGrown: function (slider) {\n                  emit(slider, autoSize);\n                },\n                onStartGrow: function (slider) {\n                  emitWith(slider, fixSize, { width: getRaw(slider.element, 'width').getOr('') });\n                },\n                onStartShrink: function (slider) {\n                  emitWith(slider, fixSize, { width: get$a(slider.element) + 'px' });\n                }\n              }),\n              Replacing.config({}),\n              Composing.config({\n                find: function (comp) {\n                  var children = Replacing.contents(comp);\n                  return head(children);\n                }\n              })\n            ])\n          }],\n        behaviours: derive$1([\n          ComposingConfigs.childAt(0),\n          config('sidebar-sliding-events', [\n            run$1(fixSize, function (comp, se) {\n              set$7(comp.element, 'width', se.event.width);\n            }),\n            run$1(autoSize, function (comp, _se) {\n              remove$6(comp.element, 'width');\n            })\n          ])\n        ])\n      };\n    };\n\n    var block = function (component, config, state, getBusySpec) {\n      set$8(component.element, 'aria-busy', true);\n      var root = config.getRoot(component).getOr(component);\n      var blockerBehaviours = derive$1([\n        Keying.config({\n          mode: 'special',\n          onTab: function () {\n            return Optional.some(true);\n          },\n          onShiftTab: function () {\n            return Optional.some(true);\n          }\n        }),\n        Focusing.config({})\n      ]);\n      var blockSpec = getBusySpec(root, blockerBehaviours);\n      var blocker = root.getSystem().build(blockSpec);\n      Replacing.append(root, premade(blocker));\n      if (blocker.hasConfigured(Keying) && config.focus) {\n        Keying.focusIn(blocker);\n      }\n      if (!state.isBlocked()) {\n        config.onBlock(component);\n      }\n      state.blockWith(function () {\n        return Replacing.remove(root, blocker);\n      });\n    };\n    var unblock = function (component, config, state) {\n      remove$7(component.element, 'aria-busy');\n      if (state.isBlocked()) {\n        config.onUnblock(component);\n      }\n      state.clear();\n    };\n\n    var BlockingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        block: block,\n        unblock: unblock\n    });\n\n    var BlockingSchema = [\n      defaultedFunction('getRoot', Optional.none),\n      defaultedBoolean('focus', true),\n      onHandler('onBlock'),\n      onHandler('onUnblock')\n    ];\n\n    var init$4 = function () {\n      var blocker = destroyable();\n      var blockWith = function (destroy) {\n        blocker.set({ destroy: destroy });\n      };\n      return nu$8({\n        readState: blocker.isSet,\n        blockWith: blockWith,\n        clear: blocker.clear,\n        isBlocked: blocker.isSet\n      });\n    };\n\n    var BlockingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$4\n    });\n\n    var Blocking = create$8({\n      fields: BlockingSchema,\n      name: 'blocking',\n      apis: BlockingApis,\n      state: BlockingState\n    });\n\n    var getBusySpec$1 = function (providerBackstage) {\n      return function (_root, _behaviours) {\n        return {\n          dom: {\n            tag: 'div',\n            attributes: {\n              'aria-label': providerBackstage.translate('Loading...'),\n              'tabindex': '0'\n            },\n            classes: ['tox-throbber__busy-spinner']\n          },\n          components: [{ dom: fromHtml('<div class=\"tox-spinner\"><div></div><div></div><div></div></div>') }]\n        };\n      };\n    };\n    var focusBusyComponent = function (throbber) {\n      return Composing.getCurrent(throbber).each(function (comp) {\n        return focus$3(comp.element);\n      });\n    };\n    var toggleEditorTabIndex = function (editor, state) {\n      var tabIndexAttr = 'tabindex';\n      var dataTabIndexAttr = 'data-mce-' + tabIndexAttr;\n      Optional.from(editor.iframeElement).map(SugarElement.fromDom).each(function (iframe) {\n        if (state) {\n          getOpt(iframe, tabIndexAttr).each(function (tabIndex) {\n            return set$8(iframe, dataTabIndexAttr, tabIndex);\n          });\n          set$8(iframe, tabIndexAttr, -1);\n        } else {\n          remove$7(iframe, tabIndexAttr);\n          getOpt(iframe, dataTabIndexAttr).each(function (tabIndex) {\n            set$8(iframe, tabIndexAttr, tabIndex);\n            remove$7(iframe, dataTabIndexAttr);\n          });\n        }\n      });\n    };\n    var toggleThrobber = function (editor, comp, state, providerBackstage) {\n      var element = comp.element;\n      toggleEditorTabIndex(editor, state);\n      if (state) {\n        Blocking.block(comp, getBusySpec$1(providerBackstage));\n        remove$6(element, 'display');\n        remove$7(element, 'aria-hidden');\n        if (editor.hasFocus()) {\n          focusBusyComponent(comp);\n        }\n      } else {\n        var throbberFocus = Composing.getCurrent(comp).exists(function (busyComp) {\n          return hasFocus(busyComp.element);\n        });\n        Blocking.unblock(comp);\n        set$7(element, 'display', 'none');\n        set$8(element, 'aria-hidden', 'true');\n        if (throbberFocus) {\n          editor.focus();\n        }\n      }\n    };\n    var renderThrobber = function (spec) {\n      return {\n        uid: spec.uid,\n        dom: {\n          tag: 'div',\n          attributes: { 'aria-hidden': 'true' },\n          classes: ['tox-throbber'],\n          styles: { display: 'none' }\n        },\n        behaviours: derive$1([\n          Replacing.config({}),\n          Blocking.config({ focus: false }),\n          Composing.config({\n            find: function (comp) {\n              return head(comp.components());\n            }\n          })\n        ]),\n        components: []\n      };\n    };\n    var isFocusEvent = function (event) {\n      return event.type === 'focusin';\n    };\n    var isPasteBinTarget = function (event) {\n      if (isFocusEvent(event)) {\n        var node = event.composed ? head(event.composedPath()) : Optional.from(event.target);\n        return node.map(SugarElement.fromDom).filter(isElement$2).exists(function (targetElm) {\n          return has(targetElm, 'mce-pastebin');\n        });\n      } else {\n        return false;\n      }\n    };\n    var setup$7 = function (editor, lazyThrobber, sharedBackstage) {\n      var throbberState = Cell(false);\n      var timer = value$1();\n      var stealFocus = function (e) {\n        if (throbberState.get() && !isPasteBinTarget(e)) {\n          e.preventDefault();\n          focusBusyComponent(lazyThrobber());\n          editor.editorManager.setActive(editor);\n        }\n      };\n      if (!editor.inline) {\n        editor.on('PreInit', function () {\n          editor.dom.bind(editor.getWin(), 'focusin', stealFocus);\n          editor.on('BeforeExecCommand', function (e) {\n            if (e.command.toLowerCase() === 'mcefocus' && e.value !== true) {\n              stealFocus(e);\n            }\n          });\n        });\n      }\n      var toggle = function (state) {\n        if (state !== throbberState.get()) {\n          throbberState.set(state);\n          toggleThrobber(editor, lazyThrobber(), state, sharedBackstage.providers);\n          editor.fire('AfterProgressState', { state: state });\n        }\n      };\n      editor.on('ProgressState', function (e) {\n        timer.on(global$f.clearTimeout);\n        if (isNumber(e.time)) {\n          var timerId = global$f.setEditorTimeout(editor, function () {\n            return toggle(e.state);\n          }, e.time);\n          timer.set(timerId);\n        } else {\n          toggle(e.state);\n          timer.clear();\n        }\n      });\n    };\n\n    var generate$1 = function (xs, f) {\n      var init = {\n        len: 0,\n        list: []\n      };\n      var r = foldl(xs, function (b, a) {\n        var value = f(a, b.len);\n        return value.fold(constant$1(b), function (v) {\n          return {\n            len: v.finish,\n            list: b.list.concat([v])\n          };\n        });\n      }, init);\n      return r.list;\n    };\n\n    var output = function (within, extra, withinWidth) {\n      return {\n        within: within,\n        extra: extra,\n        withinWidth: withinWidth\n      };\n    };\n    var apportion = function (units, total, len) {\n      var parray = generate$1(units, function (unit, current) {\n        var width = len(unit);\n        return Optional.some({\n          element: unit,\n          start: current,\n          finish: current + width,\n          width: width\n        });\n      });\n      var within = filter$2(parray, function (unit) {\n        return unit.finish <= total;\n      });\n      var withinWidth = foldr(within, function (acc, el) {\n        return acc + el.width;\n      }, 0);\n      var extra = parray.slice(within.length);\n      return {\n        within: within,\n        extra: extra,\n        withinWidth: withinWidth\n      };\n    };\n    var toUnit = function (parray) {\n      return map$2(parray, function (unit) {\n        return unit.element;\n      });\n    };\n    var fitLast = function (within, extra, withinWidth) {\n      var fits = toUnit(within.concat(extra));\n      return output(fits, [], withinWidth);\n    };\n    var overflow = function (within, extra, overflower, withinWidth) {\n      var fits = toUnit(within).concat([overflower]);\n      return output(fits, toUnit(extra), withinWidth);\n    };\n    var fitAll = function (within, extra, withinWidth) {\n      return output(toUnit(within), [], withinWidth);\n    };\n    var tryFit = function (total, units, len) {\n      var divide = apportion(units, total, len);\n      return divide.extra.length === 0 ? Optional.some(divide) : Optional.none();\n    };\n    var partition = function (total, units, len, overflower) {\n      var divide = tryFit(total, units, len).getOrThunk(function () {\n        return apportion(units, total - len(overflower), len);\n      });\n      var within = divide.within;\n      var extra = divide.extra;\n      var withinWidth = divide.withinWidth;\n      if (extra.length === 1 && extra[0].width <= len(overflower)) {\n        return fitLast(within, extra, withinWidth);\n      } else if (extra.length >= 1) {\n        return overflow(within, extra, overflower, withinWidth);\n      } else {\n        return fitAll(within, extra, withinWidth);\n      }\n    };\n\n    var setGroups$1 = function (toolbar, storedGroups) {\n      var bGroups = map$2(storedGroups, function (g) {\n        return premade(g);\n      });\n      Toolbar.setGroups(toolbar, bGroups);\n    };\n    var findFocusedComp = function (comps) {\n      return findMap(comps, function (comp) {\n        return search(comp.element).bind(function (focusedElm) {\n          return comp.getSystem().getByDom(focusedElm).toOptional();\n        });\n      });\n    };\n    var refresh$2 = function (toolbar, detail, setOverflow) {\n      var builtGroups = detail.builtGroups.get();\n      if (builtGroups.length === 0) {\n        return;\n      }\n      var primary = getPartOrDie(toolbar, detail, 'primary');\n      var overflowGroup = Coupling.getCoupled(toolbar, 'overflowGroup');\n      set$7(primary.element, 'visibility', 'hidden');\n      var groups = builtGroups.concat([overflowGroup]);\n      var focusedComp = findFocusedComp(groups);\n      setOverflow([]);\n      setGroups$1(primary, groups);\n      var availableWidth = get$a(primary.element);\n      var overflows = partition(availableWidth, detail.builtGroups.get(), function (comp) {\n        return get$a(comp.element);\n      }, overflowGroup);\n      if (overflows.extra.length === 0) {\n        Replacing.remove(primary, overflowGroup);\n        setOverflow([]);\n      } else {\n        setGroups$1(primary, overflows.within);\n        setOverflow(overflows.extra);\n      }\n      remove$6(primary.element, 'visibility');\n      reflow(primary.element);\n      focusedComp.each(Focusing.focus);\n    };\n\n    var schema$c = constant$1([\n      field('splitToolbarBehaviours', [Coupling]),\n      customField('builtGroups', function () {\n        return Cell([]);\n      })\n    ]);\n\n    var schema$b = constant$1([\n      markers$1(['overflowToggledClass']),\n      optionFunction('getOverflowBounds'),\n      required$1('lazySink'),\n      customField('overflowGroups', function () {\n        return Cell([]);\n      })\n    ].concat(schema$c()));\n    var parts$7 = constant$1([\n      required({\n        factory: Toolbar,\n        schema: schema$e(),\n        name: 'primary'\n      }),\n      external$1({\n        schema: schema$e(),\n        name: 'overflow'\n      }),\n      external$1({ name: 'overflow-button' }),\n      external$1({ name: 'overflow-group' })\n    ]);\n\n    var expandable = constant$1(function (element, available) {\n      setMax(element, Math.floor(available));\n    });\n\n    var schema$a = constant$1([\n      markers$1(['toggledClass']),\n      required$1('lazySink'),\n      requiredFunction('fetch'),\n      optionFunction('getBounds'),\n      optionObjOf('fireDismissalEventInstead', [defaulted('event', dismissRequested())]),\n      schema$y()\n    ]);\n    var parts$6 = constant$1([\n      external$1({\n        name: 'button',\n        overrides: function (detail) {\n          return {\n            dom: { attributes: { 'aria-haspopup': 'true' } },\n            buttonBehaviours: derive$1([Toggling.config({\n                toggleClass: detail.markers.toggledClass,\n                aria: { mode: 'expanded' },\n                toggleOnExecute: false\n              })])\n          };\n        }\n      }),\n      external$1({\n        factory: Toolbar,\n        schema: schema$e(),\n        name: 'toolbar',\n        overrides: function (detail) {\n          return {\n            toolbarBehaviours: derive$1([Keying.config({\n                mode: 'cyclic',\n                onEscape: function (comp) {\n                  getPart(comp, detail, 'button').each(Focusing.focus);\n                  return Optional.none();\n                }\n              })])\n          };\n        }\n      })\n    ]);\n\n    var toggle = function (button, externals) {\n      var toolbarSandbox = Coupling.getCoupled(button, 'toolbarSandbox');\n      if (Sandboxing.isOpen(toolbarSandbox)) {\n        Sandboxing.close(toolbarSandbox);\n      } else {\n        Sandboxing.open(toolbarSandbox, externals.toolbar());\n      }\n    };\n    var position = function (button, toolbar, detail, layouts) {\n      var bounds = detail.getBounds.map(function (bounder) {\n        return bounder();\n      });\n      var sink = detail.lazySink(button).getOrDie();\n      Positioning.positionWithinBounds(sink, toolbar, {\n        anchor: {\n          type: 'hotspot',\n          hotspot: button,\n          layouts: layouts,\n          overrides: { maxWidthFunction: expandable() }\n        }\n      }, bounds);\n    };\n    var setGroups = function (button, toolbar, detail, layouts, groups) {\n      Toolbar.setGroups(toolbar, groups);\n      position(button, toolbar, detail, layouts);\n      Toggling.on(button);\n    };\n    var makeSandbox = function (button, spec, detail) {\n      var ariaOwner = manager();\n      var onOpen = function (sandbox, toolbar) {\n        detail.fetch().get(function (groups) {\n          setGroups(button, toolbar, detail, spec.layouts, groups);\n          ariaOwner.link(button.element);\n          Keying.focusIn(toolbar);\n        });\n      };\n      var onClose = function () {\n        Toggling.off(button);\n        Focusing.focus(button);\n        ariaOwner.unlink(button.element);\n      };\n      return {\n        dom: {\n          tag: 'div',\n          attributes: { id: ariaOwner.id }\n        },\n        behaviours: derive$1([\n          Keying.config({\n            mode: 'special',\n            onEscape: function (comp) {\n              Sandboxing.close(comp);\n              return Optional.some(true);\n            }\n          }),\n          Sandboxing.config({\n            onOpen: onOpen,\n            onClose: onClose,\n            isPartOf: function (container, data, queryElem) {\n              return isPartOf$1(data, queryElem) || isPartOf$1(button, queryElem);\n            },\n            getAttachPoint: function () {\n              return detail.lazySink(button).getOrDie();\n            }\n          }),\n          Receiving.config({\n            channels: __assign(__assign({}, receivingChannel$1(__assign({ isExtraPart: never }, detail.fireDismissalEventInstead.map(function (fe) {\n              return { fireEventInstead: { event: fe.event } };\n            }).getOr({})))), receivingChannel({\n              doReposition: function () {\n                Sandboxing.getState(Coupling.getCoupled(button, 'toolbarSandbox')).each(function (toolbar) {\n                  position(button, toolbar, detail, spec.layouts);\n                });\n              }\n            }))\n          })\n        ])\n      };\n    };\n    var factory$a = function (detail, components, spec, externals) {\n      return __assign(__assign({}, Button.sketch(__assign(__assign({}, externals.button()), {\n        action: function (button) {\n          toggle(button, externals);\n        },\n        buttonBehaviours: SketchBehaviours.augment({ dump: externals.button().buttonBehaviours }, [Coupling.config({\n            others: {\n              toolbarSandbox: function (button) {\n                return makeSandbox(button, spec, detail);\n              }\n            }\n          })])\n      }))), {\n        apis: {\n          setGroups: function (button, groups) {\n            Sandboxing.getState(Coupling.getCoupled(button, 'toolbarSandbox')).each(function (toolbar) {\n              setGroups(button, toolbar, detail, spec.layouts, groups);\n            });\n          },\n          reposition: function (button) {\n            Sandboxing.getState(Coupling.getCoupled(button, 'toolbarSandbox')).each(function (toolbar) {\n              position(button, toolbar, detail, spec.layouts);\n            });\n          },\n          toggle: function (button) {\n            toggle(button, externals);\n          },\n          getToolbar: function (button) {\n            return Sandboxing.getState(Coupling.getCoupled(button, 'toolbarSandbox'));\n          },\n          isOpen: function (button) {\n            return Sandboxing.isOpen(Coupling.getCoupled(button, 'toolbarSandbox'));\n          }\n        }\n      });\n    };\n    var FloatingToolbarButton = composite({\n      name: 'FloatingToolbarButton',\n      factory: factory$a,\n      configFields: schema$a(),\n      partFields: parts$6(),\n      apis: {\n        setGroups: function (apis, button, groups) {\n          apis.setGroups(button, groups);\n        },\n        reposition: function (apis, button) {\n          apis.reposition(button);\n        },\n        toggle: function (apis, button) {\n          apis.toggle(button);\n        },\n        getToolbar: function (apis, button) {\n          return apis.getToolbar(button);\n        },\n        isOpen: function (apis, button) {\n          return apis.isOpen(button);\n        }\n      }\n    });\n\n    var schema$9 = constant$1([\n      required$1('items'),\n      markers$1(['itemSelector']),\n      field('tgroupBehaviours', [Keying])\n    ]);\n    var parts$5 = constant$1([group({\n        name: 'items',\n        unit: 'item'\n      })]);\n\n    var factory$9 = function (detail, components, _spec, _externals) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.tgroupBehaviours, [Keying.config({\n            mode: 'flow',\n            selector: detail.markers.itemSelector\n          })]),\n        domModification: { attributes: { role: 'toolbar' } }\n      };\n    };\n    var ToolbarGroup = composite({\n      name: 'ToolbarGroup',\n      configFields: schema$9(),\n      partFields: parts$5(),\n      factory: factory$9\n    });\n\n    var buildGroups = function (comps) {\n      return map$2(comps, function (g) {\n        return premade(g);\n      });\n    };\n    var refresh$1 = function (toolbar, memFloatingToolbarButton, detail) {\n      refresh$2(toolbar, detail, function (overflowGroups) {\n        detail.overflowGroups.set(overflowGroups);\n        memFloatingToolbarButton.getOpt(toolbar).each(function (floatingToolbarButton) {\n          FloatingToolbarButton.setGroups(floatingToolbarButton, buildGroups(overflowGroups));\n        });\n      });\n    };\n    var factory$8 = function (detail, components, spec, externals) {\n      var memFloatingToolbarButton = record(FloatingToolbarButton.sketch({\n        fetch: function () {\n          return Future.nu(function (resolve) {\n            resolve(buildGroups(detail.overflowGroups.get()));\n          });\n        },\n        layouts: {\n          onLtr: function () {\n            return [\n              southwest$2,\n              southeast$2\n            ];\n          },\n          onRtl: function () {\n            return [\n              southeast$2,\n              southwest$2\n            ];\n          },\n          onBottomLtr: function () {\n            return [\n              northwest$2,\n              northeast$2\n            ];\n          },\n          onBottomRtl: function () {\n            return [\n              northeast$2,\n              northwest$2\n            ];\n          }\n        },\n        getBounds: spec.getOverflowBounds,\n        lazySink: detail.lazySink,\n        fireDismissalEventInstead: {},\n        markers: { toggledClass: detail.markers.overflowToggledClass },\n        parts: {\n          button: externals['overflow-button'](),\n          toolbar: externals.overflow()\n        }\n      }));\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.splitToolbarBehaviours, [Coupling.config({\n            others: {\n              overflowGroup: function () {\n                return ToolbarGroup.sketch(__assign(__assign({}, externals['overflow-group']()), { items: [memFloatingToolbarButton.asSpec()] }));\n              }\n            }\n          })]),\n        apis: {\n          setGroups: function (toolbar, groups) {\n            detail.builtGroups.set(map$2(groups, toolbar.getSystem().build));\n            refresh$1(toolbar, memFloatingToolbarButton, detail);\n          },\n          refresh: function (toolbar) {\n            return refresh$1(toolbar, memFloatingToolbarButton, detail);\n          },\n          toggle: function (toolbar) {\n            memFloatingToolbarButton.getOpt(toolbar).each(function (floatingToolbarButton) {\n              FloatingToolbarButton.toggle(floatingToolbarButton);\n            });\n          },\n          isOpen: function (toolbar) {\n            return memFloatingToolbarButton.getOpt(toolbar).map(FloatingToolbarButton.isOpen).getOr(false);\n          },\n          reposition: function (toolbar) {\n            memFloatingToolbarButton.getOpt(toolbar).each(function (floatingToolbarButton) {\n              FloatingToolbarButton.reposition(floatingToolbarButton);\n            });\n          },\n          getOverflow: function (toolbar) {\n            return memFloatingToolbarButton.getOpt(toolbar).bind(FloatingToolbarButton.getToolbar);\n          }\n        },\n        domModification: { attributes: { role: 'group' } }\n      };\n    };\n    var SplitFloatingToolbar = composite({\n      name: 'SplitFloatingToolbar',\n      configFields: schema$b(),\n      partFields: parts$7(),\n      factory: factory$8,\n      apis: {\n        setGroups: function (apis, toolbar, groups) {\n          apis.setGroups(toolbar, groups);\n        },\n        refresh: function (apis, toolbar) {\n          apis.refresh(toolbar);\n        },\n        reposition: function (apis, toolbar) {\n          apis.reposition(toolbar);\n        },\n        toggle: function (apis, toolbar) {\n          apis.toggle(toolbar);\n        },\n        isOpen: function (apis, toolbar) {\n          return apis.isOpen(toolbar);\n        },\n        getOverflow: function (apis, toolbar) {\n          return apis.getOverflow(toolbar);\n        }\n      }\n    });\n\n    var schema$8 = constant$1([\n      markers$1([\n        'closedClass',\n        'openClass',\n        'shrinkingClass',\n        'growingClass',\n        'overflowToggledClass'\n      ]),\n      onHandler('onOpened'),\n      onHandler('onClosed')\n    ].concat(schema$c()));\n    var parts$4 = constant$1([\n      required({\n        factory: Toolbar,\n        schema: schema$e(),\n        name: 'primary'\n      }),\n      required({\n        factory: Toolbar,\n        schema: schema$e(),\n        name: 'overflow',\n        overrides: function (detail) {\n          return {\n            toolbarBehaviours: derive$1([\n              Sliding.config({\n                dimension: { property: 'height' },\n                closedClass: detail.markers.closedClass,\n                openClass: detail.markers.openClass,\n                shrinkingClass: detail.markers.shrinkingClass,\n                growingClass: detail.markers.growingClass,\n                onShrunk: function (comp) {\n                  getPart(comp, detail, 'overflow-button').each(function (button) {\n                    Toggling.off(button);\n                    Focusing.focus(button);\n                  });\n                  detail.onClosed(comp);\n                },\n                onGrown: function (comp) {\n                  Keying.focusIn(comp);\n                  detail.onOpened(comp);\n                },\n                onStartGrow: function (comp) {\n                  getPart(comp, detail, 'overflow-button').each(Toggling.on);\n                }\n              }),\n              Keying.config({\n                mode: 'acyclic',\n                onEscape: function (comp) {\n                  getPart(comp, detail, 'overflow-button').each(Focusing.focus);\n                  return Optional.some(true);\n                }\n              })\n            ])\n          };\n        }\n      }),\n      external$1({\n        name: 'overflow-button',\n        overrides: function (detail) {\n          return {\n            buttonBehaviours: derive$1([Toggling.config({\n                toggleClass: detail.markers.overflowToggledClass,\n                aria: { mode: 'pressed' },\n                toggleOnExecute: false\n              })])\n          };\n        }\n      }),\n      external$1({ name: 'overflow-group' })\n    ]);\n\n    var isOpen = function (toolbar, detail) {\n      return getPart(toolbar, detail, 'overflow').map(Sliding.hasGrown).getOr(false);\n    };\n    var toggleToolbar = function (toolbar, detail) {\n      getPart(toolbar, detail, 'overflow-button').bind(function () {\n        return getPart(toolbar, detail, 'overflow');\n      }).each(function (overf) {\n        refresh(toolbar, detail);\n        Sliding.toggleGrow(overf);\n      });\n    };\n    var refresh = function (toolbar, detail) {\n      getPart(toolbar, detail, 'overflow').each(function (overflow) {\n        refresh$2(toolbar, detail, function (groups) {\n          var builtGroups = map$2(groups, function (g) {\n            return premade(g);\n          });\n          Toolbar.setGroups(overflow, builtGroups);\n        });\n        getPart(toolbar, detail, 'overflow-button').each(function (button) {\n          if (Sliding.hasGrown(overflow)) {\n            Toggling.on(button);\n          }\n        });\n        Sliding.refresh(overflow);\n      });\n    };\n    var factory$7 = function (detail, components, spec, externals) {\n      var toolbarToggleEvent = 'alloy.toolbar.toggle';\n      var doSetGroups = function (toolbar, groups) {\n        var built = map$2(groups, toolbar.getSystem().build);\n        detail.builtGroups.set(built);\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: augment(detail.splitToolbarBehaviours, [\n          Coupling.config({\n            others: {\n              overflowGroup: function (toolbar) {\n                return ToolbarGroup.sketch(__assign(__assign({}, externals['overflow-group']()), {\n                  items: [Button.sketch(__assign(__assign({}, externals['overflow-button']()), {\n                      action: function (_button) {\n                        emit(toolbar, toolbarToggleEvent);\n                      }\n                    }))]\n                }));\n              }\n            }\n          }),\n          config('toolbar-toggle-events', [run$1(toolbarToggleEvent, function (toolbar) {\n              toggleToolbar(toolbar, detail);\n            })])\n        ]),\n        apis: {\n          setGroups: function (toolbar, groups) {\n            doSetGroups(toolbar, groups);\n            refresh(toolbar, detail);\n          },\n          refresh: function (toolbar) {\n            return refresh(toolbar, detail);\n          },\n          toggle: function (toolbar) {\n            return toggleToolbar(toolbar, detail);\n          },\n          isOpen: function (toolbar) {\n            return isOpen(toolbar, detail);\n          }\n        },\n        domModification: { attributes: { role: 'group' } }\n      };\n    };\n    var SplitSlidingToolbar = composite({\n      name: 'SplitSlidingToolbar',\n      configFields: schema$8(),\n      partFields: parts$4(),\n      factory: factory$7,\n      apis: {\n        setGroups: function (apis, toolbar, groups) {\n          apis.setGroups(toolbar, groups);\n        },\n        refresh: function (apis, toolbar) {\n          apis.refresh(toolbar);\n        },\n        toggle: function (apis, toolbar) {\n          apis.toggle(toolbar);\n        },\n        isOpen: function (apis, toolbar) {\n          return apis.isOpen(toolbar);\n        }\n      }\n    });\n\n    var renderToolbarGroupCommon = function (toolbarGroup) {\n      var attributes = toolbarGroup.title.fold(function () {\n        return {};\n      }, function (title) {\n        return { attributes: { title: title } };\n      });\n      return {\n        dom: __assign({\n          tag: 'div',\n          classes: ['tox-toolbar__group']\n        }, attributes),\n        components: [ToolbarGroup.parts.items({})],\n        items: toolbarGroup.items,\n        markers: { itemSelector: '*:not(.tox-split-button) > .tox-tbtn:not([disabled]), ' + '.tox-split-button:not([disabled]), ' + '.tox-toolbar-nav-js:not([disabled])' },\n        tgroupBehaviours: derive$1([\n          Tabstopping.config({}),\n          Focusing.config({})\n        ])\n      };\n    };\n    var renderToolbarGroup = function (toolbarGroup) {\n      return ToolbarGroup.sketch(renderToolbarGroupCommon(toolbarGroup));\n    };\n    var getToolbarbehaviours = function (toolbarSpec, modeName) {\n      var onAttached = runOnAttached(function (component) {\n        var groups = map$2(toolbarSpec.initGroups, renderToolbarGroup);\n        Toolbar.setGroups(component, groups);\n      });\n      return derive$1([\n        DisablingConfigs.toolbarButton(toolbarSpec.providers.isDisabled),\n        receivingConfig(),\n        Keying.config({\n          mode: modeName,\n          onEscape: toolbarSpec.onEscape,\n          selector: '.tox-toolbar__group'\n        }),\n        config('toolbar-events', [onAttached])\n      ]);\n    };\n    var renderMoreToolbarCommon = function (toolbarSpec) {\n      var modeName = toolbarSpec.cyclicKeying ? 'cyclic' : 'acyclic';\n      return {\n        uid: toolbarSpec.uid,\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar-overlord']\n        },\n        parts: {\n          'overflow-group': renderToolbarGroupCommon({\n            title: Optional.none(),\n            items: []\n          }),\n          'overflow-button': renderIconButtonSpec({\n            name: 'more',\n            icon: Optional.some('more-drawer'),\n            disabled: false,\n            tooltip: Optional.some('More...'),\n            primary: false,\n            borderless: false\n          }, Optional.none(), toolbarSpec.providers)\n        },\n        splitToolbarBehaviours: getToolbarbehaviours(toolbarSpec, modeName)\n      };\n    };\n    var renderFloatingMoreToolbar = function (toolbarSpec) {\n      var baseSpec = renderMoreToolbarCommon(toolbarSpec);\n      var overflowXOffset = 4;\n      var primary = SplitFloatingToolbar.parts.primary({\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar__primary']\n        }\n      });\n      return SplitFloatingToolbar.sketch(__assign(__assign({}, baseSpec), {\n        lazySink: toolbarSpec.getSink,\n        getOverflowBounds: function () {\n          var headerElem = toolbarSpec.moreDrawerData.lazyHeader().element;\n          var headerBounds = absolute$2(headerElem);\n          var docElem = documentElement(headerElem);\n          var docBounds = absolute$2(docElem);\n          var height = Math.max(docElem.dom.scrollHeight, docBounds.height);\n          return bounds(headerBounds.x + overflowXOffset, docBounds.y, headerBounds.width - overflowXOffset * 2, height);\n        },\n        parts: __assign(__assign({}, baseSpec.parts), {\n          overflow: {\n            dom: {\n              tag: 'div',\n              classes: ['tox-toolbar__overflow'],\n              attributes: toolbarSpec.attributes\n            }\n          }\n        }),\n        components: [primary],\n        markers: { overflowToggledClass: 'tox-tbtn--enabled' }\n      }));\n    };\n    var renderSlidingMoreToolbar = function (toolbarSpec) {\n      var primary = SplitSlidingToolbar.parts.primary({\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar__primary']\n        }\n      });\n      var overflow = SplitSlidingToolbar.parts.overflow({\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar__overflow']\n        }\n      });\n      var baseSpec = renderMoreToolbarCommon(toolbarSpec);\n      return SplitSlidingToolbar.sketch(__assign(__assign({}, baseSpec), {\n        components: [\n          primary,\n          overflow\n        ],\n        markers: {\n          openClass: 'tox-toolbar__overflow--open',\n          closedClass: 'tox-toolbar__overflow--closed',\n          growingClass: 'tox-toolbar__overflow--growing',\n          shrinkingClass: 'tox-toolbar__overflow--shrinking',\n          overflowToggledClass: 'tox-tbtn--enabled'\n        },\n        onOpened: function (comp) {\n          comp.getSystem().broadcastOn([toolbarHeightChange()], { type: 'opened' });\n        },\n        onClosed: function (comp) {\n          comp.getSystem().broadcastOn([toolbarHeightChange()], { type: 'closed' });\n        }\n      }));\n    };\n    var renderToolbar = function (toolbarSpec) {\n      var modeName = toolbarSpec.cyclicKeying ? 'cyclic' : 'acyclic';\n      return Toolbar.sketch({\n        uid: toolbarSpec.uid,\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar'].concat(toolbarSpec.type === ToolbarMode.scrolling ? ['tox-toolbar--scrolling'] : [])\n        },\n        components: [Toolbar.parts.groups({})],\n        toolbarBehaviours: getToolbarbehaviours(toolbarSpec, modeName)\n      });\n    };\n\n    var factory$6 = function (detail, components, _spec) {\n      var apis = {\n        getSocket: function (comp) {\n          return parts$a.getPart(comp, detail, 'socket');\n        },\n        setSidebar: function (comp, panelConfigs) {\n          parts$a.getPart(comp, detail, 'sidebar').each(function (sidebar) {\n            return setSidebar(sidebar, panelConfigs);\n          });\n        },\n        toggleSidebar: function (comp, name) {\n          parts$a.getPart(comp, detail, 'sidebar').each(function (sidebar) {\n            return toggleSidebar(sidebar, name);\n          });\n        },\n        whichSidebar: function (comp) {\n          return parts$a.getPart(comp, detail, 'sidebar').bind(whichSidebar).getOrNull();\n        },\n        getHeader: function (comp) {\n          return parts$a.getPart(comp, detail, 'header');\n        },\n        getToolbar: function (comp) {\n          return parts$a.getPart(comp, detail, 'toolbar');\n        },\n        setToolbar: function (comp, groups) {\n          parts$a.getPart(comp, detail, 'toolbar').each(function (toolbar) {\n            toolbar.getApis().setGroups(toolbar, groups);\n          });\n        },\n        setToolbars: function (comp, toolbars) {\n          parts$a.getPart(comp, detail, 'multiple-toolbar').each(function (mToolbar) {\n            CustomList.setItems(mToolbar, toolbars);\n          });\n        },\n        refreshToolbar: function (comp) {\n          var toolbar = parts$a.getPart(comp, detail, 'toolbar');\n          toolbar.each(function (toolbar) {\n            return toolbar.getApis().refresh(toolbar);\n          });\n        },\n        toggleToolbarDrawer: function (comp) {\n          parts$a.getPart(comp, detail, 'toolbar').each(function (toolbar) {\n            mapFrom(toolbar.getApis().toggle, function (toggle) {\n              return toggle(toolbar);\n            });\n          });\n        },\n        isToolbarDrawerToggled: function (comp) {\n          return parts$a.getPart(comp, detail, 'toolbar').bind(function (toolbar) {\n            return Optional.from(toolbar.getApis().isOpen).map(function (isOpen) {\n              return isOpen(toolbar);\n            });\n          }).getOr(false);\n        },\n        getThrobber: function (comp) {\n          return parts$a.getPart(comp, detail, 'throbber');\n        },\n        focusToolbar: function (comp) {\n          var optToolbar = parts$a.getPart(comp, detail, 'toolbar').orThunk(function () {\n            return parts$a.getPart(comp, detail, 'multiple-toolbar');\n          });\n          optToolbar.each(function (toolbar) {\n            Keying.focusIn(toolbar);\n          });\n        },\n        setMenubar: function (comp, menus) {\n          parts$a.getPart(comp, detail, 'menubar').each(function (menubar) {\n            SilverMenubar.setMenus(menubar, menus);\n          });\n        },\n        focusMenubar: function (comp) {\n          parts$a.getPart(comp, detail, 'menubar').each(function (menubar) {\n            SilverMenubar.focus(menubar);\n          });\n        }\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        apis: apis,\n        behaviours: detail.behaviours\n      };\n    };\n    var partMenubar = partType.optional({\n      factory: SilverMenubar,\n      name: 'menubar',\n      schema: [required$1('backstage')]\n    });\n    var toolbarFactory = function (spec) {\n      if (spec.type === ToolbarMode.sliding) {\n        return renderSlidingMoreToolbar;\n      } else if (spec.type === ToolbarMode.floating) {\n        return renderFloatingMoreToolbar;\n      } else {\n        return renderToolbar;\n      }\n    };\n    var partMultipleToolbar = partType.optional({\n      factory: {\n        sketch: function (spec) {\n          return CustomList.sketch({\n            uid: spec.uid,\n            dom: spec.dom,\n            listBehaviours: derive$1([Keying.config({\n                mode: 'acyclic',\n                selector: '.tox-toolbar'\n              })]),\n            makeItem: function () {\n              return renderToolbar({\n                type: spec.type,\n                uid: generate$6('multiple-toolbar-item'),\n                cyclicKeying: false,\n                initGroups: [],\n                providers: spec.providers,\n                onEscape: function () {\n                  spec.onEscape();\n                  return Optional.some(true);\n                }\n              });\n            },\n            setupItem: function (_mToolbar, tc, data, _index) {\n              Toolbar.setGroups(tc, data);\n            },\n            shell: true\n          });\n        }\n      },\n      name: 'multiple-toolbar',\n      schema: [\n        required$1('dom'),\n        required$1('onEscape')\n      ]\n    });\n    var partToolbar = partType.optional({\n      factory: {\n        sketch: function (spec) {\n          var renderer = toolbarFactory(spec);\n          var toolbarSpec = {\n            type: spec.type,\n            uid: spec.uid,\n            onEscape: function () {\n              spec.onEscape();\n              return Optional.some(true);\n            },\n            cyclicKeying: false,\n            initGroups: [],\n            getSink: spec.getSink,\n            providers: spec.providers,\n            moreDrawerData: {\n              lazyToolbar: spec.lazyToolbar,\n              lazyMoreButton: spec.lazyMoreButton,\n              lazyHeader: spec.lazyHeader\n            },\n            attributes: spec.attributes\n          };\n          return renderer(toolbarSpec);\n        }\n      },\n      name: 'toolbar',\n      schema: [\n        required$1('dom'),\n        required$1('onEscape'),\n        required$1('getSink')\n      ]\n    });\n    var partHeader = partType.optional({\n      factory: { sketch: renderHeader },\n      name: 'header',\n      schema: [required$1('dom')]\n    });\n    var partSocket = partType.optional({\n      name: 'socket',\n      schema: [required$1('dom')]\n    });\n    var partSidebar = partType.optional({\n      factory: { sketch: renderSidebar },\n      name: 'sidebar',\n      schema: [required$1('dom')]\n    });\n    var partThrobber = partType.optional({\n      factory: { sketch: renderThrobber },\n      name: 'throbber',\n      schema: [required$1('dom')]\n    });\n    var OuterContainer = composite({\n      name: 'OuterContainer',\n      factory: factory$6,\n      configFields: [\n        required$1('dom'),\n        required$1('behaviours')\n      ],\n      partFields: [\n        partHeader,\n        partMenubar,\n        partToolbar,\n        partMultipleToolbar,\n        partSocket,\n        partSidebar,\n        partThrobber\n      ],\n      apis: {\n        getSocket: function (apis, comp) {\n          return apis.getSocket(comp);\n        },\n        setSidebar: function (apis, comp, panelConfigs) {\n          apis.setSidebar(comp, panelConfigs);\n        },\n        toggleSidebar: function (apis, comp, name) {\n          apis.toggleSidebar(comp, name);\n        },\n        whichSidebar: function (apis, comp) {\n          return apis.whichSidebar(comp);\n        },\n        getHeader: function (apis, comp) {\n          return apis.getHeader(comp);\n        },\n        getToolbar: function (apis, comp) {\n          return apis.getToolbar(comp);\n        },\n        setToolbar: function (apis, comp, grps) {\n          var groups = map$2(grps, function (grp) {\n            return renderToolbarGroup(grp);\n          });\n          apis.setToolbar(comp, groups);\n        },\n        setToolbars: function (apis, comp, ts) {\n          var renderedToolbars = map$2(ts, function (g) {\n            return map$2(g, renderToolbarGroup);\n          });\n          apis.setToolbars(comp, renderedToolbars);\n        },\n        refreshToolbar: function (apis, comp) {\n          return apis.refreshToolbar(comp);\n        },\n        toggleToolbarDrawer: function (apis, comp) {\n          apis.toggleToolbarDrawer(comp);\n        },\n        isToolbarDrawerToggled: function (apis, comp) {\n          return apis.isToolbarDrawerToggled(comp);\n        },\n        getThrobber: function (apis, comp) {\n          return apis.getThrobber(comp);\n        },\n        setMenubar: function (apis, comp, menus) {\n          apis.setMenubar(comp, menus);\n        },\n        focusMenubar: function (apis, comp) {\n          apis.focusMenubar(comp);\n        },\n        focusToolbar: function (apis, comp) {\n          apis.focusToolbar(comp);\n        }\n      }\n    });\n\n    var defaultMenubar = 'file edit view insert format tools table help';\n    var defaultMenus = {\n      file: {\n        title: 'File',\n        items: 'newdocument restoredraft | preview | export print | deleteallconversations'\n      },\n      edit: {\n        title: 'Edit',\n        items: 'undo redo | cut copy paste pastetext | selectall | searchreplace'\n      },\n      view: {\n        title: 'View',\n        items: 'code | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments'\n      },\n      insert: {\n        title: 'Insert',\n        items: 'image link media addcomment pageembed template codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor toc | insertdatetime'\n      },\n      format: {\n        title: 'Format',\n        items: 'bold italic underline strikethrough superscript subscript codeformat | formats blockformats fontformats fontsizes align lineheight | forecolor backcolor | language | removeformat'\n      },\n      tools: {\n        title: 'Tools',\n        items: 'spellchecker spellcheckerlanguage | a11ycheck code wordcount'\n      },\n      table: {\n        title: 'Table',\n        items: 'inserttable | cell row column | advtablesort | tableprops deletetable'\n      },\n      help: {\n        title: 'Help',\n        items: 'help'\n      }\n    };\n    var make = function (menu, registry, editor) {\n      var removedMenuItems = getRemovedMenuItems(editor).split(/[ ,]/);\n      return {\n        text: menu.title,\n        getItems: function () {\n          return bind$3(menu.items, function (i) {\n            var itemName = i.toLowerCase();\n            if (itemName.trim().length === 0) {\n              return [];\n            } else if (exists(removedMenuItems, function (removedMenuItem) {\n                return removedMenuItem === itemName;\n              })) {\n              return [];\n            } else if (itemName === 'separator' || itemName === '|') {\n              return [{ type: 'separator' }];\n            } else if (registry.menuItems[itemName]) {\n              return [registry.menuItems[itemName]];\n            } else {\n              return [];\n            }\n          });\n        }\n      };\n    };\n    var parseItemsString = function (items) {\n      if (typeof items === 'string') {\n        return items.split(' ');\n      }\n      return items;\n    };\n    var identifyMenus = function (editor, registry) {\n      var rawMenuData = __assign(__assign({}, defaultMenus), registry.menus);\n      var userDefinedMenus = keys(registry.menus).length > 0;\n      var menubar = registry.menubar === undefined || registry.menubar === true ? parseItemsString(defaultMenubar) : parseItemsString(registry.menubar === false ? '' : registry.menubar);\n      var validMenus = filter$2(menubar, function (menuName) {\n        var isDefaultMenu = has$2(defaultMenus, menuName);\n        if (userDefinedMenus) {\n          return isDefaultMenu || get$e(registry.menus, menuName).exists(function (menu) {\n            return has$2(menu, 'items');\n          });\n        } else {\n          return isDefaultMenu;\n        }\n      });\n      var menus = map$2(validMenus, function (menuName) {\n        var menuData = rawMenuData[menuName];\n        return make({\n          title: menuData.title,\n          items: parseItemsString(menuData.items)\n        }, registry, editor);\n      });\n      return filter$2(menus, function (menu) {\n        var isNotSeparator = function (item) {\n          return item.type !== 'separator';\n        };\n        return menu.getItems().length > 0 && exists(menu.getItems(), isNotSeparator);\n      });\n    };\n\n    var fireSkinLoaded = function (editor) {\n      var done = function () {\n        editor._skinLoaded = true;\n        fireSkinLoaded$1(editor);\n      };\n      return function () {\n        if (editor.initialized) {\n          done();\n        } else {\n          editor.on('init', done);\n        }\n      };\n    };\n    var fireSkinLoadError = function (editor, err) {\n      return function () {\n        return fireSkinLoadError$1(editor, { message: err });\n      };\n    };\n\n    var loadStylesheet = function (editor, stylesheetUrl, styleSheetLoader) {\n      return new global$c(function (resolve, reject) {\n        styleSheetLoader.load(stylesheetUrl, resolve, reject);\n        editor.on('remove', function () {\n          return styleSheetLoader.unload(stylesheetUrl);\n        });\n      });\n    };\n    var loadUiSkins = function (editor, skinUrl) {\n      var skinUiCss = skinUrl + '/skin.min.css';\n      return loadStylesheet(editor, skinUiCss, editor.ui.styleSheetLoader);\n    };\n    var loadShadowDomUiSkins = function (editor, skinUrl) {\n      var isInShadowRoot$1 = isInShadowRoot(SugarElement.fromDom(editor.getElement()));\n      if (isInShadowRoot$1) {\n        var shadowDomSkinCss = skinUrl + '/skin.shadowdom.min.css';\n        return loadStylesheet(editor, shadowDomSkinCss, global$b.DOM.styleSheetLoader);\n      } else {\n        return global$c.resolve();\n      }\n    };\n    var loadSkin = function (isInline, editor) {\n      var skinUrl = getSkinUrl(editor);\n      if (skinUrl) {\n        editor.contentCSS.push(skinUrl + (isInline ? '/content.inline' : '/content') + '.min.css');\n      }\n      if (isSkinDisabled(editor) === false && isString(skinUrl)) {\n        global$c.all([\n          loadUiSkins(editor, skinUrl),\n          loadShadowDomUiSkins(editor, skinUrl)\n        ]).then(fireSkinLoaded(editor), fireSkinLoadError(editor, 'Skin could not be loaded'));\n      } else {\n        fireSkinLoaded(editor)();\n      }\n    };\n    var iframe = curry(loadSkin, false);\n    var inline = curry(loadSkin, true);\n\n    var onSetupFormatToggle = function (editor, name) {\n      return function (api) {\n        var boundCallback = unbindable();\n        var init = function () {\n          api.setActive(editor.formatter.match(name));\n          var binding = editor.formatter.formatChanged(name, api.setActive);\n          boundCallback.set(binding);\n        };\n        editor.initialized ? init() : editor.once('init', init);\n        return function () {\n          editor.off('init', init);\n          boundCallback.clear();\n        };\n      };\n    };\n    var onSetupEvent = function (editor, event, f) {\n      return function (api) {\n        var handleEvent = function () {\n          return f(api);\n        };\n        var init = function () {\n          f(api);\n          editor.on(event, handleEvent);\n        };\n        editor.initialized ? init() : editor.once('init', init);\n        return function () {\n          editor.off('init', init);\n          editor.off(event, handleEvent);\n        };\n      };\n    };\n    var onActionToggleFormat$1 = function (editor) {\n      return function (rawItem) {\n        return function () {\n          editor.undoManager.transact(function () {\n            editor.focus();\n            editor.execCommand('mceToggleFormat', false, rawItem.format);\n          });\n        };\n      };\n    };\n    var onActionExecCommand = function (editor, command) {\n      return function () {\n        return editor.execCommand(command);\n      };\n    };\n\n    var generateSelectItems = function (_editor, backstage, spec) {\n      var generateItem = function (rawItem, response, disabled, value) {\n        var translatedText = backstage.shared.providers.translate(rawItem.title);\n        if (rawItem.type === 'separator') {\n          return Optional.some({\n            type: 'separator',\n            text: translatedText\n          });\n        } else if (rawItem.type === 'submenu') {\n          var items = bind$3(rawItem.getStyleItems(), function (si) {\n            return validate(si, response, value);\n          });\n          if (response === 0 && items.length <= 0) {\n            return Optional.none();\n          } else {\n            return Optional.some({\n              type: 'nestedmenuitem',\n              text: translatedText,\n              disabled: items.length <= 0,\n              getSubmenuItems: function () {\n                return bind$3(rawItem.getStyleItems(), function (si) {\n                  return validate(si, response, value);\n                });\n              }\n            });\n          }\n        } else {\n          return Optional.some(__assign({\n            type: 'togglemenuitem',\n            text: translatedText,\n            icon: rawItem.icon,\n            active: rawItem.isSelected(value),\n            disabled: disabled,\n            onAction: spec.onAction(rawItem)\n          }, rawItem.getStylePreview().fold(function () {\n            return {};\n          }, function (preview) {\n            return { meta: { style: preview } };\n          })));\n        }\n      };\n      var validate = function (item, response, value) {\n        var invalid = item.type === 'formatter' && spec.isInvalid(item);\n        if (response === 0) {\n          return invalid ? [] : generateItem(item, response, false, value).toArray();\n        } else {\n          return generateItem(item, response, invalid, value).toArray();\n        }\n      };\n      var validateItems = function (preItems) {\n        var value = spec.getCurrentValue();\n        var response = spec.shouldHide ? 0 : 1;\n        return bind$3(preItems, function (item) {\n          return validate(item, response, value);\n        });\n      };\n      var getFetch = function (backstage, getStyleItems) {\n        return function (comp, callback) {\n          var preItems = getStyleItems();\n          var items = validateItems(preItems);\n          var menu = build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false);\n          callback(menu);\n        };\n      };\n      return {\n        validateItems: validateItems,\n        getFetch: getFetch\n      };\n    };\n    var createMenuItems = function (editor, backstage, spec) {\n      var dataset = spec.dataset;\n      var getStyleItems = dataset.type === 'basic' ? function () {\n        return map$2(dataset.data, function (d) {\n          return processBasic(d, spec.isSelectedFor, spec.getPreviewFor);\n        });\n      } : dataset.getData;\n      return {\n        items: generateSelectItems(editor, backstage, spec),\n        getStyleItems: getStyleItems\n      };\n    };\n    var createSelectButton = function (editor, backstage, spec) {\n      var _a = createMenuItems(editor, backstage, spec), items = _a.items, getStyleItems = _a.getStyleItems;\n      var getApi = function (comp) {\n        return { getComponent: constant$1(comp) };\n      };\n      var onSetup = onSetupEvent(editor, 'NodeChange', function (api) {\n        var comp = api.getComponent();\n        spec.updateText(comp);\n      });\n      return renderCommonDropdown({\n        text: spec.icon.isSome() ? Optional.none() : spec.text,\n        icon: spec.icon,\n        tooltip: Optional.from(spec.tooltip),\n        role: Optional.none(),\n        fetch: items.getFetch(backstage, getStyleItems),\n        onSetup: onSetup,\n        getApi: getApi,\n        columns: 1,\n        presets: 'normal',\n        classes: spec.icon.isSome() ? [] : ['bespoke'],\n        dropdownBehaviours: []\n      }, 'tox-tbtn', backstage.shared);\n    };\n\n    var process = function (rawFormats) {\n      return map$2(rawFormats, function (item) {\n        var title = item, format = item;\n        var values = item.split('=');\n        if (values.length > 1) {\n          title = values[0];\n          format = values[1];\n        }\n        return {\n          title: title,\n          format: format\n        };\n      });\n    };\n    var buildBasicStaticDataset = function (data) {\n      return {\n        type: 'basic',\n        data: data\n      };\n    };\n    var Delimiter;\n    (function (Delimiter) {\n      Delimiter[Delimiter['SemiColon'] = 0] = 'SemiColon';\n      Delimiter[Delimiter['Space'] = 1] = 'Space';\n    }(Delimiter || (Delimiter = {})));\n    var split = function (rawFormats, delimiter) {\n      if (delimiter === Delimiter.SemiColon) {\n        return rawFormats.replace(/;$/, '').split(';');\n      } else {\n        return rawFormats.split(' ');\n      }\n    };\n    var buildBasicSettingsDataset = function (editor, settingName, defaults, delimiter) {\n      var rawFormats = editor.getParam(settingName, defaults, 'string');\n      var data = process(split(rawFormats, delimiter));\n      return {\n        type: 'basic',\n        data: data\n      };\n    };\n\n    var alignMenuItems = [\n      {\n        title: 'Left',\n        icon: 'align-left',\n        format: 'alignleft',\n        command: 'JustifyLeft'\n      },\n      {\n        title: 'Center',\n        icon: 'align-center',\n        format: 'aligncenter',\n        command: 'JustifyCenter'\n      },\n      {\n        title: 'Right',\n        icon: 'align-right',\n        format: 'alignright',\n        command: 'JustifyRight'\n      },\n      {\n        title: 'Justify',\n        icon: 'align-justify',\n        format: 'alignjustify',\n        command: 'JustifyFull'\n      }\n    ];\n    var getSpec$4 = function (editor) {\n      var getMatchingValue = function () {\n        return find$5(alignMenuItems, function (item) {\n          return editor.formatter.match(item.format);\n        });\n      };\n      var isSelectedFor = function (format) {\n        return function () {\n          return editor.formatter.match(format);\n        };\n      };\n      var getPreviewFor = function (_format) {\n        return Optional.none;\n      };\n      var updateSelectMenuIcon = function (comp) {\n        var match = getMatchingValue();\n        var alignment = match.fold(constant$1('left'), function (item) {\n          return item.title.toLowerCase();\n        });\n        emitWith(comp, updateMenuIcon, { icon: 'align-' + alignment });\n      };\n      var dataset = buildBasicStaticDataset(alignMenuItems);\n      var onAction = function (rawItem) {\n        return function () {\n          return find$5(alignMenuItems, function (item) {\n            return item.format === rawItem.format;\n          }).each(function (item) {\n            return editor.execCommand(item.command);\n          });\n        };\n      };\n      return {\n        tooltip: 'Align',\n        text: Optional.none(),\n        icon: Optional.some('align-left'),\n        isSelectedFor: isSelectedFor,\n        getCurrentValue: Optional.none,\n        getPreviewFor: getPreviewFor,\n        onAction: onAction,\n        updateText: updateSelectMenuIcon,\n        dataset: dataset,\n        shouldHide: false,\n        isInvalid: function (item) {\n          return !editor.formatter.canApply(item.format);\n        }\n      };\n    };\n    var createAlignSelect = function (editor, backstage) {\n      return createSelectButton(editor, backstage, getSpec$4(editor));\n    };\n    var alignSelectMenu = function (editor, backstage) {\n      var menuItems = createMenuItems(editor, backstage, getSpec$4(editor));\n      editor.ui.registry.addNestedMenuItem('align', {\n        text: backstage.shared.providers.translate('Align'),\n        getSubmenuItems: function () {\n          return menuItems.items.validateItems(menuItems.getStyleItems());\n        }\n      });\n    };\n\n    var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats';\n    var systemStackFonts = [\n      '-apple-system',\n      'Segoe UI',\n      'Roboto',\n      'Helvetica Neue',\n      'sans-serif'\n    ];\n    var splitFonts = function (fontFamily) {\n      var fonts = fontFamily.split(/\\s*,\\s*/);\n      return map$2(fonts, function (font) {\n        return font.replace(/^['\"]+|['\"]+$/g, '');\n      });\n    };\n    var isSystemFontStack = function (fontFamily) {\n      var matchesSystemStack = function () {\n        var fonts = splitFonts(fontFamily.toLowerCase());\n        return forall(systemStackFonts, function (font) {\n          return fonts.indexOf(font.toLowerCase()) > -1;\n        });\n      };\n      return fontFamily.indexOf('-apple-system') === 0 && matchesSystemStack();\n    };\n    var getSpec$3 = function (editor) {\n      var systemFont = 'System Font';\n      var getMatchingValue = function () {\n        var getFirstFont = function (fontFamily) {\n          return fontFamily ? splitFonts(fontFamily)[0] : '';\n        };\n        var fontFamily = editor.queryCommandValue('FontName');\n        var items = dataset.data;\n        var font = fontFamily ? fontFamily.toLowerCase() : '';\n        var matchOpt = find$5(items, function (item) {\n          var format = item.format;\n          return format.toLowerCase() === font || getFirstFont(format).toLowerCase() === getFirstFont(font).toLowerCase();\n        }).orThunk(function () {\n          return someIf(isSystemFontStack(font), {\n            title: systemFont,\n            format: font\n          });\n        });\n        return {\n          matchOpt: matchOpt,\n          font: fontFamily\n        };\n      };\n      var isSelectedFor = function (item) {\n        return function (valueOpt) {\n          return valueOpt.exists(function (value) {\n            return value.format === item;\n          });\n        };\n      };\n      var getCurrentValue = function () {\n        var matchOpt = getMatchingValue().matchOpt;\n        return matchOpt;\n      };\n      var getPreviewFor = function (item) {\n        return function () {\n          return Optional.some({\n            tag: 'div',\n            styles: item.indexOf('dings') === -1 ? { 'font-family': item } : {}\n          });\n        };\n      };\n      var onAction = function (rawItem) {\n        return function () {\n          editor.undoManager.transact(function () {\n            editor.focus();\n            editor.execCommand('FontName', false, rawItem.format);\n          });\n        };\n      };\n      var updateSelectMenuText = function (comp) {\n        var _a = getMatchingValue(), matchOpt = _a.matchOpt, font = _a.font;\n        var text = matchOpt.fold(constant$1(font), function (item) {\n          return item.title;\n        });\n        emitWith(comp, updateMenuText, { text: text });\n      };\n      var dataset = buildBasicSettingsDataset(editor, 'font_formats', defaultFontsFormats, Delimiter.SemiColon);\n      return {\n        tooltip: 'Fonts',\n        text: Optional.some(systemFont),\n        icon: Optional.none(),\n        isSelectedFor: isSelectedFor,\n        getCurrentValue: getCurrentValue,\n        getPreviewFor: getPreviewFor,\n        onAction: onAction,\n        updateText: updateSelectMenuText,\n        dataset: dataset,\n        shouldHide: false,\n        isInvalid: never\n      };\n    };\n    var createFontSelect = function (editor, backstage) {\n      return createSelectButton(editor, backstage, getSpec$3(editor));\n    };\n    var fontSelectMenu = function (editor, backstage) {\n      var menuItems = createMenuItems(editor, backstage, getSpec$3(editor));\n      editor.ui.registry.addNestedMenuItem('fontformats', {\n        text: backstage.shared.providers.translate('Fonts'),\n        getSubmenuItems: function () {\n          return menuItems.items.validateItems(menuItems.getStyleItems());\n        }\n      });\n    };\n\n    var defaultFontsizeFormats = '8pt 10pt 12pt 14pt 18pt 24pt 36pt';\n    var legacyFontSizes = {\n      '8pt': '1',\n      '10pt': '2',\n      '12pt': '3',\n      '14pt': '4',\n      '18pt': '5',\n      '24pt': '6',\n      '36pt': '7'\n    };\n    var keywordFontSizes = {\n      'xx-small': '7pt',\n      'x-small': '8pt',\n      'small': '10pt',\n      'medium': '12pt',\n      'large': '14pt',\n      'x-large': '18pt',\n      'xx-large': '24pt'\n    };\n    var round = function (number, precision) {\n      var factor = Math.pow(10, precision);\n      return Math.round(number * factor) / factor;\n    };\n    var toPt = function (fontSize, precision) {\n      if (/[0-9.]+px$/.test(fontSize)) {\n        return round(parseInt(fontSize, 10) * 72 / 96, precision || 0) + 'pt';\n      } else {\n        return get$e(keywordFontSizes, fontSize).getOr(fontSize);\n      }\n    };\n    var toLegacy = function (fontSize) {\n      return get$e(legacyFontSizes, fontSize).getOr('');\n    };\n    var getSpec$2 = function (editor) {\n      var getMatchingValue = function () {\n        var matchOpt = Optional.none();\n        var items = dataset.data;\n        var fontSize = editor.queryCommandValue('FontSize');\n        if (fontSize) {\n          var _loop_1 = function (precision) {\n            var pt = toPt(fontSize, precision);\n            var legacy = toLegacy(pt);\n            matchOpt = find$5(items, function (item) {\n              return item.format === fontSize || item.format === pt || item.format === legacy;\n            });\n          };\n          for (var precision = 3; matchOpt.isNone() && precision >= 0; precision--) {\n            _loop_1(precision);\n          }\n        }\n        return {\n          matchOpt: matchOpt,\n          size: fontSize\n        };\n      };\n      var isSelectedFor = function (item) {\n        return function (valueOpt) {\n          return valueOpt.exists(function (value) {\n            return value.format === item;\n          });\n        };\n      };\n      var getCurrentValue = function () {\n        var matchOpt = getMatchingValue().matchOpt;\n        return matchOpt;\n      };\n      var getPreviewFor = constant$1(Optional.none);\n      var onAction = function (rawItem) {\n        return function () {\n          editor.undoManager.transact(function () {\n            editor.focus();\n            editor.execCommand('FontSize', false, rawItem.format);\n          });\n        };\n      };\n      var updateSelectMenuText = function (comp) {\n        var _a = getMatchingValue(), matchOpt = _a.matchOpt, size = _a.size;\n        var text = matchOpt.fold(constant$1(size), function (match) {\n          return match.title;\n        });\n        emitWith(comp, updateMenuText, { text: text });\n      };\n      var dataset = buildBasicSettingsDataset(editor, 'fontsize_formats', defaultFontsizeFormats, Delimiter.Space);\n      return {\n        tooltip: 'Font sizes',\n        text: Optional.some('12pt'),\n        icon: Optional.none(),\n        isSelectedFor: isSelectedFor,\n        getPreviewFor: getPreviewFor,\n        getCurrentValue: getCurrentValue,\n        onAction: onAction,\n        updateText: updateSelectMenuText,\n        dataset: dataset,\n        shouldHide: false,\n        isInvalid: never\n      };\n    };\n    var createFontsizeSelect = function (editor, backstage) {\n      return createSelectButton(editor, backstage, getSpec$2(editor));\n    };\n    var fontsizeSelectMenu = function (editor, backstage) {\n      var menuItems = createMenuItems(editor, backstage, getSpec$2(editor));\n      editor.ui.registry.addNestedMenuItem('fontsizes', {\n        text: 'Font sizes',\n        getSubmenuItems: function () {\n          return menuItems.items.validateItems(menuItems.getStyleItems());\n        }\n      });\n    };\n\n    var findNearest = function (editor, getStyles) {\n      var styles = getStyles();\n      var formats = map$2(styles, function (style) {\n        return style.format;\n      });\n      return Optional.from(editor.formatter.closest(formats)).bind(function (fmt) {\n        return find$5(styles, function (data) {\n          return data.format === fmt;\n        });\n      }).orThunk(function () {\n        return someIf(editor.formatter.match('p'), {\n          title: 'Paragraph',\n          format: 'p'\n        });\n      });\n    };\n\n    var defaultBlocks = 'Paragraph=p;' + 'Heading 1=h1;' + 'Heading 2=h2;' + 'Heading 3=h3;' + 'Heading 4=h4;' + 'Heading 5=h5;' + 'Heading 6=h6;' + 'Preformatted=pre';\n    var getSpec$1 = function (editor) {\n      var fallbackFormat = 'Paragraph';\n      var isSelectedFor = function (format) {\n        return function () {\n          return editor.formatter.match(format);\n        };\n      };\n      var getPreviewFor = function (format) {\n        return function () {\n          var fmt = editor.formatter.get(format);\n          return Optional.some({\n            tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || 'div' : 'div',\n            styles: editor.dom.parseStyle(editor.formatter.getCssText(format))\n          });\n        };\n      };\n      var updateSelectMenuText = function (comp) {\n        var detectedFormat = findNearest(editor, function () {\n          return dataset.data;\n        });\n        var text = detectedFormat.fold(constant$1(fallbackFormat), function (fmt) {\n          return fmt.title;\n        });\n        emitWith(comp, updateMenuText, { text: text });\n      };\n      var dataset = buildBasicSettingsDataset(editor, 'block_formats', defaultBlocks, Delimiter.SemiColon);\n      return {\n        tooltip: 'Blocks',\n        text: Optional.some(fallbackFormat),\n        icon: Optional.none(),\n        isSelectedFor: isSelectedFor,\n        getCurrentValue: Optional.none,\n        getPreviewFor: getPreviewFor,\n        onAction: onActionToggleFormat$1(editor),\n        updateText: updateSelectMenuText,\n        dataset: dataset,\n        shouldHide: false,\n        isInvalid: function (item) {\n          return !editor.formatter.canApply(item.format);\n        }\n      };\n    };\n    var createFormatSelect = function (editor, backstage) {\n      return createSelectButton(editor, backstage, getSpec$1(editor));\n    };\n    var formatSelectMenu = function (editor, backstage) {\n      var menuItems = createMenuItems(editor, backstage, getSpec$1(editor));\n      editor.ui.registry.addNestedMenuItem('blockformats', {\n        text: 'Blocks',\n        getSubmenuItems: function () {\n          return menuItems.items.validateItems(menuItems.getStyleItems());\n        }\n      });\n    };\n\n    var getSpec = function (editor, dataset) {\n      var fallbackFormat = 'Paragraph';\n      var isSelectedFor = function (format) {\n        return function () {\n          return editor.formatter.match(format);\n        };\n      };\n      var getPreviewFor = function (format) {\n        return function () {\n          var fmt = editor.formatter.get(format);\n          return fmt !== undefined ? Optional.some({\n            tag: fmt.length > 0 ? fmt[0].inline || fmt[0].block || 'div' : 'div',\n            styles: editor.dom.parseStyle(editor.formatter.getCssText(format))\n          }) : Optional.none();\n        };\n      };\n      var updateSelectMenuText = function (comp) {\n        var getFormatItems = function (fmt) {\n          var subs = fmt.items;\n          return subs !== undefined && subs.length > 0 ? bind$3(subs, getFormatItems) : [{\n              title: fmt.title,\n              format: fmt.format\n            }];\n        };\n        var flattenedItems = bind$3(getStyleFormats(editor), getFormatItems);\n        var detectedFormat = findNearest(editor, constant$1(flattenedItems));\n        var text = detectedFormat.fold(constant$1(fallbackFormat), function (fmt) {\n          return fmt.title;\n        });\n        emitWith(comp, updateMenuText, { text: text });\n      };\n      return {\n        tooltip: 'Formats',\n        text: Optional.some(fallbackFormat),\n        icon: Optional.none(),\n        isSelectedFor: isSelectedFor,\n        getCurrentValue: Optional.none,\n        getPreviewFor: getPreviewFor,\n        onAction: onActionToggleFormat$1(editor),\n        updateText: updateSelectMenuText,\n        shouldHide: editor.getParam('style_formats_autohide', false, 'boolean'),\n        isInvalid: function (item) {\n          return !editor.formatter.canApply(item.format);\n        },\n        dataset: dataset\n      };\n    };\n    var createStyleSelect = function (editor, backstage) {\n      var dataset = __assign({ type: 'advanced' }, backstage.styleselect);\n      return createSelectButton(editor, backstage, getSpec(editor, dataset));\n    };\n    var styleSelectMenu = function (editor, backstage) {\n      var dataset = __assign({ type: 'advanced' }, backstage.styleselect);\n      var menuItems = createMenuItems(editor, backstage, getSpec(editor, dataset));\n      editor.ui.registry.addNestedMenuItem('formats', {\n        text: 'Formats',\n        getSubmenuItems: function () {\n          return menuItems.items.validateItems(menuItems.getStyleItems());\n        }\n      });\n    };\n\n    var events$3 = function (reflectingConfig, reflectingState) {\n      var update = function (component, data) {\n        reflectingConfig.updateState.each(function (updateState) {\n          var newState = updateState(component, data);\n          reflectingState.set(newState);\n        });\n        reflectingConfig.renderComponents.each(function (renderComponents) {\n          var newComponents = renderComponents(data, reflectingState.get());\n          var newChildren = map$2(newComponents, component.getSystem().build);\n          replaceChildren(component, newChildren);\n        });\n      };\n      return derive$2([\n        run$1(receive(), function (component, message) {\n          var receivingData = message;\n          if (!receivingData.universal) {\n            var channel = reflectingConfig.channel;\n            if (contains$2(receivingData.channels, channel)) {\n              update(component, receivingData.data);\n            }\n          }\n        }),\n        runOnAttached(function (comp, _se) {\n          reflectingConfig.initialData.each(function (rawData) {\n            update(comp, rawData);\n          });\n        })\n      ]);\n    };\n\n    var ActiveReflecting = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        events: events$3\n    });\n\n    var getState = function (component, replaceConfig, reflectState) {\n      return reflectState;\n    };\n\n    var ReflectingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        getState: getState\n    });\n\n    var ReflectingSchema = [\n      required$1('channel'),\n      option('renderComponents'),\n      option('updateState'),\n      option('initialData')\n    ];\n\n    var init$3 = function () {\n      var cell = Cell(Optional.none());\n      var clear = function () {\n        return cell.set(Optional.none());\n      };\n      var readState = function () {\n        return cell.get().getOr('none');\n      };\n      return {\n        readState: readState,\n        get: cell.get,\n        set: cell.set,\n        clear: clear\n      };\n    };\n\n    var ReflectingState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init$3\n    });\n\n    var Reflecting = create$8({\n      fields: ReflectingSchema,\n      name: 'reflecting',\n      active: ActiveReflecting,\n      apis: ReflectingApis,\n      state: ReflectingState\n    });\n\n    var schema$7 = constant$1([\n      required$1('toggleClass'),\n      required$1('fetch'),\n      onStrictHandler('onExecute'),\n      defaulted('getHotspot', Optional.some),\n      defaulted('getAnchorOverrides', constant$1({})),\n      schema$y(),\n      onStrictHandler('onItemExecute'),\n      option('lazySink'),\n      required$1('dom'),\n      onHandler('onOpen'),\n      field('splitDropdownBehaviours', [\n        Coupling,\n        Keying,\n        Focusing\n      ]),\n      defaulted('matchWidth', false),\n      defaulted('useMinWidth', false),\n      defaulted('eventOrder', {}),\n      option('role')\n    ].concat(sandboxFields()));\n    var arrowPart = required({\n      factory: Button,\n      schema: [required$1('dom')],\n      name: 'arrow',\n      defaults: function () {\n        return { buttonBehaviours: derive$1([Focusing.revoke()]) };\n      },\n      overrides: function (detail) {\n        return {\n          dom: {\n            tag: 'span',\n            attributes: { role: 'presentation' }\n          },\n          action: function (arrow) {\n            arrow.getSystem().getByUid(detail.uid).each(emitExecute);\n          },\n          buttonBehaviours: derive$1([Toggling.config({\n              toggleOnExecute: false,\n              toggleClass: detail.toggleClass\n            })])\n        };\n      }\n    });\n    var buttonPart = required({\n      factory: Button,\n      schema: [required$1('dom')],\n      name: 'button',\n      defaults: function () {\n        return { buttonBehaviours: derive$1([Focusing.revoke()]) };\n      },\n      overrides: function (detail) {\n        return {\n          dom: {\n            tag: 'span',\n            attributes: { role: 'presentation' }\n          },\n          action: function (btn) {\n            btn.getSystem().getByUid(detail.uid).each(function (splitDropdown) {\n              detail.onExecute(splitDropdown, btn);\n            });\n          }\n        };\n      }\n    });\n    var parts$3 = constant$1([\n      arrowPart,\n      buttonPart,\n      optional({\n        factory: {\n          sketch: function (spec) {\n            return {\n              uid: spec.uid,\n              dom: {\n                tag: 'span',\n                styles: { display: 'none' },\n                attributes: { 'aria-hidden': 'true' },\n                innerHtml: spec.text\n              }\n            };\n          }\n        },\n        schema: [required$1('text')],\n        name: 'aria-descriptor'\n      }),\n      external$1({\n        schema: [tieredMenuMarkers()],\n        name: 'menu',\n        defaults: function (detail) {\n          return {\n            onExecute: function (tmenu, item) {\n              tmenu.getSystem().getByUid(detail.uid).each(function (splitDropdown) {\n                detail.onItemExecute(splitDropdown, tmenu, item);\n              });\n            }\n          };\n        }\n      }),\n      partType$1()\n    ]);\n\n    var factory$5 = function (detail, components, spec, externals) {\n      var _a;\n      var switchToMenu = function (sandbox) {\n        Composing.getCurrent(sandbox).each(function (current) {\n          Highlighting.highlightFirst(current);\n          Keying.focusIn(current);\n        });\n      };\n      var action = function (component) {\n        var onOpenSync = switchToMenu;\n        togglePopup(detail, identity$1, component, externals, onOpenSync, HighlightOnOpen.HighlightFirst).get(noop);\n      };\n      var openMenu = function (comp) {\n        action(comp);\n        return Optional.some(true);\n      };\n      var executeOnButton = function (comp) {\n        var button = getPartOrDie(comp, detail, 'button');\n        emitExecute(button);\n        return Optional.some(true);\n      };\n      var buttonEvents = __assign(__assign({}, derive$2([runOnAttached(function (component, _simulatedEvent) {\n          var ariaDescriptor = getPart(component, detail, 'aria-descriptor');\n          ariaDescriptor.each(function (descriptor) {\n            var descriptorId = generate$6('aria');\n            set$8(descriptor.element, 'id', descriptorId);\n            set$8(component.element, 'aria-describedby', descriptorId);\n          });\n        })])), events$a(Optional.some(action)));\n      var apis = {\n        repositionMenus: function (comp) {\n          if (Toggling.isOn(comp)) {\n            repositionMenus(comp);\n          }\n        }\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        apis: apis,\n        eventOrder: __assign(__assign({}, detail.eventOrder), (_a = {}, _a[execute$5()] = [\n          'disabling',\n          'toggling',\n          'alloy.base.behaviour'\n        ], _a)),\n        events: buttonEvents,\n        behaviours: augment(detail.splitDropdownBehaviours, [\n          Coupling.config({\n            others: {\n              sandbox: function (hotspot) {\n                var arrow = getPartOrDie(hotspot, detail, 'arrow');\n                var extras = {\n                  onOpen: function () {\n                    Toggling.on(arrow);\n                    Toggling.on(hotspot);\n                  },\n                  onClose: function () {\n                    Toggling.off(arrow);\n                    Toggling.off(hotspot);\n                  }\n                };\n                return makeSandbox$1(detail, hotspot, extras);\n              }\n            }\n          }),\n          Keying.config({\n            mode: 'special',\n            onSpace: executeOnButton,\n            onEnter: executeOnButton,\n            onDown: openMenu\n          }),\n          Focusing.config({}),\n          Toggling.config({\n            toggleOnExecute: false,\n            aria: { mode: 'expanded' }\n          })\n        ]),\n        domModification: {\n          attributes: {\n            'role': detail.role.getOr('button'),\n            'aria-haspopup': true\n          }\n        }\n      };\n    };\n    var SplitDropdown = composite({\n      name: 'SplitDropdown',\n      configFields: schema$7(),\n      partFields: parts$3(),\n      factory: factory$5,\n      apis: {\n        repositionMenus: function (apis, comp) {\n          return apis.repositionMenus(comp);\n        }\n      }\n    });\n\n    var getButtonApi = function (component) {\n      return {\n        isDisabled: function () {\n          return Disabling.isDisabled(component);\n        },\n        setDisabled: function (state) {\n          return Disabling.set(component, state);\n        }\n      };\n    };\n    var getToggleApi = function (component) {\n      return {\n        setActive: function (state) {\n          Toggling.set(component, state);\n        },\n        isActive: function () {\n          return Toggling.isOn(component);\n        },\n        isDisabled: function () {\n          return Disabling.isDisabled(component);\n        },\n        setDisabled: function (state) {\n          return Disabling.set(component, state);\n        }\n      };\n    };\n    var getTooltipAttributes = function (tooltip, providersBackstage) {\n      return tooltip.map(function (tooltip) {\n        return {\n          'aria-label': providersBackstage.translate(tooltip),\n          'title': providersBackstage.translate(tooltip)\n        };\n      }).getOr({});\n    };\n    var focusButtonEvent = generate$6('focus-button');\n    var renderCommonStructure = function (icon, text, tooltip, receiver, behaviours, providersBackstage) {\n      var _d;\n      return {\n        dom: {\n          tag: 'button',\n          classes: ['tox-tbtn'].concat(text.isSome() ? ['tox-tbtn--select'] : []),\n          attributes: getTooltipAttributes(tooltip, providersBackstage)\n        },\n        components: componentRenderPipeline([\n          icon.map(function (iconName) {\n            return renderIconFromPack(iconName, providersBackstage.icons);\n          }),\n          text.map(function (text) {\n            return renderLabel$1(text, 'tox-tbtn', providersBackstage);\n          })\n        ]),\n        eventOrder: (_d = {}, _d[mousedown()] = [\n          'focusing',\n          'alloy.base.behaviour',\n          'common-button-display-events'\n        ], _d),\n        buttonBehaviours: derive$1([\n          DisablingConfigs.toolbarButton(providersBackstage.isDisabled),\n          receivingConfig(),\n          config('common-button-display-events', [run$1(mousedown(), function (button, se) {\n              se.event.prevent();\n              emit(button, focusButtonEvent);\n            })])\n        ].concat(receiver.map(function (r) {\n          return Reflecting.config({\n            channel: r,\n            initialData: {\n              icon: icon,\n              text: text\n            },\n            renderComponents: function (data, _state) {\n              return componentRenderPipeline([\n                data.icon.map(function (iconName) {\n                  return renderIconFromPack(iconName, providersBackstage.icons);\n                }),\n                data.text.map(function (text) {\n                  return renderLabel$1(text, 'tox-tbtn', providersBackstage);\n                })\n              ]);\n            }\n          });\n        }).toArray()).concat(behaviours.getOr([])))\n      };\n    };\n    var renderFloatingToolbarButton = function (spec, backstage, identifyButtons, attributes) {\n      var sharedBackstage = backstage.shared;\n      return FloatingToolbarButton.sketch({\n        lazySink: sharedBackstage.getSink,\n        fetch: function () {\n          return Future.nu(function (resolve) {\n            resolve(map$2(identifyButtons(spec.items), renderToolbarGroup));\n          });\n        },\n        markers: { toggledClass: 'tox-tbtn--enabled' },\n        parts: {\n          button: renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), Optional.none(), sharedBackstage.providers),\n          toolbar: {\n            dom: {\n              tag: 'div',\n              classes: ['tox-toolbar__overflow'],\n              attributes: attributes\n            }\n          }\n        }\n      });\n    };\n    var renderCommonToolbarButton = function (spec, specialisation, providersBackstage) {\n      var editorOffCell = Cell(noop);\n      var structure = renderCommonStructure(spec.icon, spec.text, spec.tooltip, Optional.none(), Optional.none(), providersBackstage);\n      return Button.sketch({\n        dom: structure.dom,\n        components: structure.components,\n        eventOrder: toolbarButtonEventOrder,\n        buttonBehaviours: derive$1([\n          config('toolbar-button-events', [\n            onToolbarButtonExecute({\n              onAction: spec.onAction,\n              getApi: specialisation.getApi\n            }),\n            onControlAttached(specialisation, editorOffCell),\n            onControlDetached(specialisation, editorOffCell)\n          ]),\n          DisablingConfigs.toolbarButton(function () {\n            return spec.disabled || providersBackstage.isDisabled();\n          }),\n          receivingConfig()\n        ].concat(specialisation.toolbarButtonBehaviours))\n      });\n    };\n    var renderToolbarButton = function (spec, providersBackstage) {\n      return renderToolbarButtonWith(spec, providersBackstage, []);\n    };\n    var renderToolbarButtonWith = function (spec, providersBackstage, bonusEvents) {\n      return renderCommonToolbarButton(spec, {\n        toolbarButtonBehaviours: [].concat(bonusEvents.length > 0 ? [config('toolbarButtonWith', bonusEvents)] : []),\n        getApi: getButtonApi,\n        onSetup: spec.onSetup\n      }, providersBackstage);\n    };\n    var renderToolbarToggleButton = function (spec, providersBackstage) {\n      return renderToolbarToggleButtonWith(spec, providersBackstage, []);\n    };\n    var renderToolbarToggleButtonWith = function (spec, providersBackstage, bonusEvents) {\n      return deepMerge(renderCommonToolbarButton(spec, {\n        toolbarButtonBehaviours: [\n          Replacing.config({}),\n          Toggling.config({\n            toggleClass: 'tox-tbtn--enabled',\n            aria: { mode: 'pressed' },\n            toggleOnExecute: false\n          })\n        ].concat(bonusEvents.length > 0 ? [config('toolbarToggleButtonWith', bonusEvents)] : []),\n        getApi: getToggleApi,\n        onSetup: spec.onSetup\n      }, providersBackstage));\n    };\n    var fetchChoices = function (getApi, spec, providersBackstage) {\n      return function (comp) {\n        return Future.nu(function (callback) {\n          return spec.fetch(callback);\n        }).map(function (items) {\n          return Optional.from(createTieredDataFrom(deepMerge(createPartialChoiceMenu(generate$6('menu-value'), items, function (value) {\n            spec.onItemAction(getApi(comp), value);\n          }, spec.columns, spec.presets, ItemResponse$1.CLOSE_ON_EXECUTE, spec.select.getOr(never), providersBackstage), {\n            movement: deriveMenuMovement(spec.columns, spec.presets),\n            menuBehaviours: SimpleBehaviours.unnamedEvents(spec.columns !== 'auto' ? [] : [runOnAttached(function (comp, _se) {\n                detectSize(comp, 4, classForPreset(spec.presets)).each(function (_d) {\n                  var numRows = _d.numRows, numColumns = _d.numColumns;\n                  Keying.setGridSize(comp, numRows, numColumns);\n                });\n              })])\n          })));\n        });\n      };\n    };\n    var renderSplitButton = function (spec, sharedBackstage) {\n      var _d;\n      var displayChannel = generate$6('channel-update-split-dropdown-display');\n      var getApi = function (comp) {\n        return {\n          isDisabled: function () {\n            return Disabling.isDisabled(comp);\n          },\n          setDisabled: function (state) {\n            return Disabling.set(comp, state);\n          },\n          setIconFill: function (id, value) {\n            descendant(comp.element, 'svg path[id=\"' + id + '\"], rect[id=\"' + id + '\"]').each(function (underlinePath) {\n              set$8(underlinePath, 'fill', value);\n            });\n          },\n          setIconStroke: function (id, value) {\n            descendant(comp.element, 'svg path[id=\"' + id + '\"], rect[id=\"' + id + '\"]').each(function (underlinePath) {\n              set$8(underlinePath, 'stroke', value);\n            });\n          },\n          setActive: function (state) {\n            set$8(comp.element, 'aria-pressed', state);\n            descendant(comp.element, 'span').each(function (button) {\n              comp.getSystem().getByDom(button).each(function (buttonComp) {\n                return Toggling.set(buttonComp, state);\n              });\n            });\n          },\n          isActive: function () {\n            return descendant(comp.element, 'span').exists(function (button) {\n              return comp.getSystem().getByDom(button).exists(Toggling.isOn);\n            });\n          }\n        };\n      };\n      var editorOffCell = Cell(noop);\n      var specialisation = {\n        getApi: getApi,\n        onSetup: spec.onSetup\n      };\n      return SplitDropdown.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-split-button'],\n          attributes: __assign({ 'aria-pressed': false }, getTooltipAttributes(spec.tooltip, sharedBackstage.providers))\n        },\n        onExecute: function (button) {\n          spec.onAction(getApi(button));\n        },\n        onItemExecute: function (_a, _b, _c) {\n        },\n        splitDropdownBehaviours: derive$1([\n          DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled),\n          receivingConfig(),\n          config('split-dropdown-events', [\n            run$1(focusButtonEvent, Focusing.focus),\n            onControlAttached(specialisation, editorOffCell),\n            onControlDetached(specialisation, editorOffCell)\n          ]),\n          Unselecting.config({})\n        ]),\n        eventOrder: (_d = {}, _d[attachedToDom()] = [\n          'alloy.base.behaviour',\n          'split-dropdown-events'\n        ], _d),\n        toggleClass: 'tox-tbtn--enabled',\n        lazySink: sharedBackstage.getSink,\n        fetch: fetchChoices(getApi, spec, sharedBackstage.providers),\n        parts: { menu: part(false, spec.columns, spec.presets) },\n        components: [\n          SplitDropdown.parts.button(renderCommonStructure(spec.icon, spec.text, Optional.none(), Optional.some(displayChannel), Optional.some([Toggling.config({\n              toggleClass: 'tox-tbtn--enabled',\n              toggleOnExecute: false\n            })]), sharedBackstage.providers)),\n          SplitDropdown.parts.arrow({\n            dom: {\n              tag: 'button',\n              classes: [\n                'tox-tbtn',\n                'tox-split-button__chevron'\n              ],\n              innerHtml: get$1('chevron-down', sharedBackstage.providers.icons)\n            },\n            buttonBehaviours: derive$1([\n              DisablingConfigs.splitButton(sharedBackstage.providers.isDisabled),\n              receivingConfig(),\n              addFocusableBehaviour()\n            ])\n          }),\n          SplitDropdown.parts['aria-descriptor']({ text: sharedBackstage.providers.translate('To open the popup, press Shift+Enter') })\n        ]\n      });\n    };\n\n    var defaultToolbar = [\n      {\n        name: 'history',\n        items: [\n          'undo',\n          'redo'\n        ]\n      },\n      {\n        name: 'styles',\n        items: ['styleselect']\n      },\n      {\n        name: 'formatting',\n        items: [\n          'bold',\n          'italic'\n        ]\n      },\n      {\n        name: 'alignment',\n        items: [\n          'alignleft',\n          'aligncenter',\n          'alignright',\n          'alignjustify'\n        ]\n      },\n      {\n        name: 'indentation',\n        items: [\n          'outdent',\n          'indent'\n        ]\n      },\n      {\n        name: 'permanent pen',\n        items: ['permanentpen']\n      },\n      {\n        name: 'comments',\n        items: ['addcomment']\n      }\n    ];\n    var renderFromBridge = function (bridgeBuilder, render) {\n      return function (spec, extras, editor) {\n        var internal = bridgeBuilder(spec).mapError(function (errInfo) {\n          return formatError(errInfo);\n        }).getOrDie();\n        return render(internal, extras, editor);\n      };\n    };\n    var types = {\n      button: renderFromBridge(createToolbarButton, function (s, extras) {\n        return renderToolbarButton(s, extras.backstage.shared.providers);\n      }),\n      togglebutton: renderFromBridge(createToggleButton, function (s, extras) {\n        return renderToolbarToggleButton(s, extras.backstage.shared.providers);\n      }),\n      menubutton: renderFromBridge(createMenuButton, function (s, extras) {\n        return renderMenuButton(s, 'tox-tbtn', extras.backstage, Optional.none());\n      }),\n      splitbutton: renderFromBridge(createSplitButton, function (s, extras) {\n        return renderSplitButton(s, extras.backstage.shared);\n      }),\n      grouptoolbarbutton: renderFromBridge(createGroupToolbarButton, function (s, extras, editor) {\n        var _a;\n        var buttons = editor.ui.registry.getAll().buttons;\n        var identify = function (toolbar) {\n          return identifyButtons(editor, {\n            buttons: buttons,\n            toolbar: toolbar,\n            allowToolbarGroups: false\n          }, extras, Optional.none());\n        };\n        var attributes = (_a = {}, _a[Attribute] = extras.backstage.shared.header.isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop, _a);\n        switch (getToolbarMode(editor)) {\n        case ToolbarMode.floating:\n          return renderFloatingToolbarButton(s, extras.backstage, identify, attributes);\n        default:\n          throw new Error('Toolbar groups are only supported when using floating toolbar mode');\n        }\n      }),\n      styleSelectButton: function (editor, extras) {\n        return createStyleSelect(editor, extras.backstage);\n      },\n      fontsizeSelectButton: function (editor, extras) {\n        return createFontsizeSelect(editor, extras.backstage);\n      },\n      fontSelectButton: function (editor, extras) {\n        return createFontSelect(editor, extras.backstage);\n      },\n      formatButton: function (editor, extras) {\n        return createFormatSelect(editor, extras.backstage);\n      },\n      alignMenuButton: function (editor, extras) {\n        return createAlignSelect(editor, extras.backstage);\n      }\n    };\n    var extractFrom = function (spec, extras, editor) {\n      return get$e(types, spec.type).fold(function () {\n        console.error('skipping button defined by', spec);\n        return Optional.none();\n      }, function (render) {\n        return Optional.some(render(spec, extras, editor));\n      });\n    };\n    var bespokeButtons = {\n      styleselect: types.styleSelectButton,\n      fontsizeselect: types.fontsizeSelectButton,\n      fontselect: types.fontSelectButton,\n      formatselect: types.formatButton,\n      align: types.alignMenuButton\n    };\n    var removeUnusedDefaults = function (buttons) {\n      var filteredItemGroups = map$2(defaultToolbar, function (group) {\n        var items = filter$2(group.items, function (subItem) {\n          return has$2(buttons, subItem) || has$2(bespokeButtons, subItem);\n        });\n        return {\n          name: group.name,\n          items: items\n        };\n      });\n      return filter$2(filteredItemGroups, function (group) {\n        return group.items.length > 0;\n      });\n    };\n    var convertStringToolbar = function (strToolbar) {\n      var groupsStrings = strToolbar.split('|');\n      return map$2(groupsStrings, function (g) {\n        return { items: g.trim().split(' ') };\n      });\n    };\n    var isToolbarGroupSettingArray = function (toolbar) {\n      return isArrayOf(toolbar, function (t) {\n        return has$2(t, 'name') && has$2(t, 'items');\n      });\n    };\n    var createToolbar = function (toolbarConfig) {\n      var toolbar = toolbarConfig.toolbar;\n      var buttons = toolbarConfig.buttons;\n      if (toolbar === false) {\n        return [];\n      } else if (toolbar === undefined || toolbar === true) {\n        return removeUnusedDefaults(buttons);\n      } else if (isString(toolbar)) {\n        return convertStringToolbar(toolbar);\n      } else if (isToolbarGroupSettingArray(toolbar)) {\n        return toolbar;\n      } else {\n        console.error('Toolbar type should be string, string[], boolean or ToolbarGroup[]');\n        return [];\n      }\n    };\n    var lookupButton = function (editor, buttons, toolbarItem, allowToolbarGroups, extras, prefixes) {\n      return get$e(buttons, toolbarItem.toLowerCase()).orThunk(function () {\n        return prefixes.bind(function (ps) {\n          return findMap(ps, function (prefix) {\n            return get$e(buttons, prefix + toolbarItem.toLowerCase());\n          });\n        });\n      }).fold(function () {\n        return get$e(bespokeButtons, toolbarItem.toLowerCase()).map(function (r) {\n          return r(editor, extras);\n        }).orThunk(function () {\n          return Optional.none();\n        });\n      }, function (spec) {\n        if (spec.type === 'grouptoolbarbutton' && !allowToolbarGroups) {\n          console.warn('Ignoring the \\'' + toolbarItem + '\\' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.');\n          return Optional.none();\n        } else {\n          return extractFrom(spec, extras, editor);\n        }\n      });\n    };\n    var identifyButtons = function (editor, toolbarConfig, extras, prefixes) {\n      var toolbarGroups = createToolbar(toolbarConfig);\n      var groups = map$2(toolbarGroups, function (group) {\n        var items = bind$3(group.items, function (toolbarItem) {\n          return toolbarItem.trim().length === 0 ? [] : lookupButton(editor, toolbarConfig.buttons, toolbarItem, toolbarConfig.allowToolbarGroups, extras, prefixes).toArray();\n        });\n        return {\n          title: Optional.from(editor.translate(group.name)),\n          items: items\n        };\n      });\n      return filter$2(groups, function (group) {\n        return group.items.length > 0;\n      });\n    };\n\n    var setToolbar = function (editor, uiComponents, rawUiConfig, backstage) {\n      var comp = uiComponents.outerContainer;\n      var toolbarConfig = rawUiConfig.toolbar;\n      var toolbarButtonsConfig = rawUiConfig.buttons;\n      if (isArrayOf(toolbarConfig, isString)) {\n        var toolbars = toolbarConfig.map(function (t) {\n          var config = {\n            toolbar: t,\n            buttons: toolbarButtonsConfig,\n            allowToolbarGroups: rawUiConfig.allowToolbarGroups\n          };\n          return identifyButtons(editor, config, { backstage: backstage }, Optional.none());\n        });\n        OuterContainer.setToolbars(comp, toolbars);\n      } else {\n        OuterContainer.setToolbar(comp, identifyButtons(editor, rawUiConfig, { backstage: backstage }, Optional.none()));\n      }\n    };\n\n    var detection = detect$1();\n    var isiOS12 = detection.os.isiOS() && detection.os.version.major <= 12;\n    var setupEvents$1 = function (editor, uiComponents) {\n      var dom = editor.dom;\n      var contentWindow = editor.getWin();\n      var initialDocEle = editor.getDoc().documentElement;\n      var lastWindowDimensions = Cell(SugarPosition(contentWindow.innerWidth, contentWindow.innerHeight));\n      var lastDocumentDimensions = Cell(SugarPosition(initialDocEle.offsetWidth, initialDocEle.offsetHeight));\n      var resizeWindow = function () {\n        var outer = lastWindowDimensions.get();\n        if (outer.left !== contentWindow.innerWidth || outer.top !== contentWindow.innerHeight) {\n          lastWindowDimensions.set(SugarPosition(contentWindow.innerWidth, contentWindow.innerHeight));\n          fireResizeContent(editor);\n        }\n      };\n      var resizeDocument = function () {\n        var docEle = editor.getDoc().documentElement;\n        var inner = lastDocumentDimensions.get();\n        if (inner.left !== docEle.offsetWidth || inner.top !== docEle.offsetHeight) {\n          lastDocumentDimensions.set(SugarPosition(docEle.offsetWidth, docEle.offsetHeight));\n          fireResizeContent(editor);\n        }\n      };\n      var scroll = function (e) {\n        return fireScrollContent(editor, e);\n      };\n      dom.bind(contentWindow, 'resize', resizeWindow);\n      dom.bind(contentWindow, 'scroll', scroll);\n      var elementLoad = capture(SugarElement.fromDom(editor.getBody()), 'load', resizeDocument);\n      var mothership = uiComponents.uiMothership.element;\n      editor.on('hide', function () {\n        set$7(mothership, 'display', 'none');\n      });\n      editor.on('show', function () {\n        remove$6(mothership, 'display');\n      });\n      editor.on('NodeChange', resizeDocument);\n      editor.on('remove', function () {\n        elementLoad.unbind();\n        dom.unbind(contentWindow, 'resize', resizeWindow);\n        dom.unbind(contentWindow, 'scroll', scroll);\n        contentWindow = null;\n      });\n    };\n    var render$1 = function (editor, uiComponents, rawUiConfig, backstage, args) {\n      var lastToolbarWidth = Cell(0);\n      var outerContainer = uiComponents.outerContainer;\n      iframe(editor);\n      var eTargetNode = SugarElement.fromDom(args.targetNode);\n      var uiRoot = getContentContainer(getRootNode(eTargetNode));\n      attachSystemAfter(eTargetNode, uiComponents.mothership);\n      attachSystem(uiRoot, uiComponents.uiMothership);\n      editor.on('PostRender', function () {\n        setToolbar(editor, uiComponents, rawUiConfig, backstage);\n        lastToolbarWidth.set(editor.getWin().innerWidth);\n        OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));\n        OuterContainer.setSidebar(outerContainer, rawUiConfig.sidebar);\n        setupEvents$1(editor, uiComponents);\n      });\n      var socket = OuterContainer.getSocket(outerContainer).getOrDie('Could not find expected socket element');\n      if (isiOS12) {\n        setAll(socket.element, {\n          'overflow': 'scroll',\n          '-webkit-overflow-scrolling': 'touch'\n        });\n        var limit = first(function () {\n          editor.fire('ScrollContent');\n        }, 20);\n        var unbinder = bind(socket.element, 'scroll', limit.throttle);\n        editor.on('remove', unbinder.unbind);\n      }\n      setupReadonlyModeSwitch(editor, uiComponents);\n      editor.addCommand('ToggleSidebar', function (_ui, value) {\n        OuterContainer.toggleSidebar(outerContainer, value);\n        editor.fire('ToggleSidebar');\n      });\n      editor.addQueryValueHandler('ToggleSidebar', function () {\n        return OuterContainer.whichSidebar(outerContainer);\n      });\n      var toolbarMode = getToolbarMode(editor);\n      var refreshDrawer = function () {\n        OuterContainer.refreshToolbar(uiComponents.outerContainer);\n      };\n      if (toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating) {\n        editor.on('ResizeWindow ResizeEditor ResizeContent', function () {\n          var width = editor.getWin().innerWidth;\n          if (width !== lastToolbarWidth.get()) {\n            refreshDrawer();\n            lastToolbarWidth.set(width);\n          }\n        });\n      }\n      var api = {\n        enable: function () {\n          broadcastReadonly(uiComponents, false);\n        },\n        disable: function () {\n          broadcastReadonly(uiComponents, true);\n        },\n        isDisabled: function () {\n          return Disabling.isDisabled(outerContainer);\n        }\n      };\n      return {\n        iframeContainer: socket.element.dom,\n        editorContainer: outerContainer.element.dom,\n        api: api\n      };\n    };\n\n    var Iframe = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        render: render$1\n    });\n\n    var parseToInt = function (val) {\n      var re = /^[0-9\\.]+(|px)$/i;\n      if (re.test('' + val)) {\n        return Optional.some(parseInt('' + val, 10));\n      }\n      return Optional.none();\n    };\n    var numToPx = function (val) {\n      return isNumber(val) ? val + 'px' : val;\n    };\n    var calcCappedSize = function (size, minSize, maxSize) {\n      var minOverride = minSize.filter(function (min) {\n        return size < min;\n      });\n      var maxOverride = maxSize.filter(function (max) {\n        return size > max;\n      });\n      return minOverride.or(maxOverride).getOr(size);\n    };\n\n    var getHeight = function (editor) {\n      var baseHeight = getHeightSetting(editor);\n      var minHeight = getMinHeightSetting(editor);\n      var maxHeight = getMaxHeightSetting(editor);\n      return parseToInt(baseHeight).map(function (height) {\n        return calcCappedSize(height, minHeight, maxHeight);\n      });\n    };\n    var getHeightWithFallback = function (editor) {\n      var height = getHeight(editor);\n      return height.getOr(getHeightSetting(editor));\n    };\n    var getWidth = function (editor) {\n      var baseWidth = getWidthSetting(editor);\n      var minWidth = getMinWidthSetting(editor);\n      var maxWidth = getMaxWidthSetting(editor);\n      return parseToInt(baseWidth).map(function (width) {\n        return calcCappedSize(width, minWidth, maxWidth);\n      });\n    };\n    var getWidthWithFallback = function (editor) {\n      var width = getWidth(editor);\n      return width.getOr(getWidthSetting(editor));\n    };\n\n    var InlineHeader = function (editor, targetElm, uiComponents, backstage, floatContainer) {\n      var uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer;\n      var DOM = global$b.DOM;\n      var useFixedToolbarContainer = useFixedContainer(editor);\n      var isSticky = isStickyToolbar(editor);\n      var editorMaxWidthOpt = getMaxWidthSetting(editor).or(getWidth(editor));\n      var headerBackstage = backstage.shared.header;\n      var isPositionedAtTop = headerBackstage.isPositionedAtTop;\n      var toolbarMode = getToolbarMode(editor);\n      var isSplitToolbar = toolbarMode === ToolbarMode.sliding || toolbarMode === ToolbarMode.floating;\n      var visible = Cell(false);\n      var isVisible = function () {\n        return visible.get() && !editor.removed;\n      };\n      var calcToolbarOffset = function (toolbar) {\n        return isSplitToolbar ? toolbar.fold(constant$1(0), function (tbar) {\n          return tbar.components().length > 1 ? get$b(tbar.components()[1].element) : 0;\n        }) : 0;\n      };\n      var calcMode = function (container) {\n        switch (getToolbarLocation(editor)) {\n        case ToolbarLocation.auto:\n          var toolbar_1 = OuterContainer.getToolbar(outerContainer);\n          var offset = calcToolbarOffset(toolbar_1);\n          var toolbarHeight = get$b(container.element) - offset;\n          var targetBounds = box$1(targetElm);\n          var roomAtTop = targetBounds.y > toolbarHeight;\n          if (roomAtTop) {\n            return 'top';\n          } else {\n            var doc = documentElement(targetElm);\n            var docHeight = Math.max(doc.dom.scrollHeight, get$b(doc));\n            var roomAtBottom = targetBounds.bottom < docHeight - toolbarHeight;\n            if (roomAtBottom) {\n              return 'bottom';\n            } else {\n              var winBounds = win();\n              var isRoomAtBottomViewport = winBounds.bottom < targetBounds.bottom - toolbarHeight;\n              return isRoomAtBottomViewport ? 'bottom' : 'top';\n            }\n          }\n        case ToolbarLocation.bottom:\n          return 'bottom';\n        case ToolbarLocation.top:\n        default:\n          return 'top';\n        }\n      };\n      var setupMode = function (mode) {\n        var container = floatContainer.get();\n        Docking.setModes(container, [mode]);\n        headerBackstage.setDockingMode(mode);\n        var verticalDir = isPositionedAtTop() ? AttributeValue.TopToBottom : AttributeValue.BottomToTop;\n        set$8(container.element, Attribute, verticalDir);\n      };\n      var updateChromeWidth = function () {\n        var maxWidth = editorMaxWidthOpt.getOrThunk(function () {\n          var bodyMargin = parseToInt(get$c(body(), 'margin-left')).getOr(0);\n          return get$a(body()) - absolute$3(targetElm).left + bodyMargin;\n        });\n        set$7(floatContainer.get().element, 'max-width', maxWidth + 'px');\n      };\n      var updateChromePosition = function () {\n        var toolbar = OuterContainer.getToolbar(outerContainer);\n        var offset = calcToolbarOffset(toolbar);\n        var targetBounds = box$1(targetElm);\n        var top = isPositionedAtTop() ? Math.max(targetBounds.y - get$b(floatContainer.get().element) + offset, 0) : targetBounds.bottom;\n        setAll(outerContainer.element, {\n          position: 'absolute',\n          top: Math.round(top) + 'px',\n          left: Math.round(targetBounds.x) + 'px'\n        });\n      };\n      var repositionPopups$1 = function () {\n        uiMothership.broadcastOn([repositionPopups()], {});\n      };\n      var updateChromeUi = function (resetDocking) {\n        if (resetDocking === void 0) {\n          resetDocking = false;\n        }\n        if (!isVisible()) {\n          return;\n        }\n        if (!useFixedToolbarContainer) {\n          updateChromeWidth();\n        }\n        if (isSplitToolbar) {\n          OuterContainer.refreshToolbar(outerContainer);\n        }\n        if (!useFixedToolbarContainer) {\n          updateChromePosition();\n        }\n        if (isSticky) {\n          var floatContainerComp = floatContainer.get();\n          resetDocking ? Docking.reset(floatContainerComp) : Docking.refresh(floatContainerComp);\n        }\n        repositionPopups$1();\n      };\n      var updateMode = function (updateUi) {\n        if (updateUi === void 0) {\n          updateUi = true;\n        }\n        if (useFixedToolbarContainer || !isSticky || !isVisible()) {\n          return;\n        }\n        var currentMode = headerBackstage.getDockingMode();\n        var newMode = calcMode(floatContainer.get());\n        if (newMode !== currentMode) {\n          setupMode(newMode);\n          if (updateUi) {\n            updateChromeUi(true);\n          }\n        }\n      };\n      var show = function () {\n        visible.set(true);\n        set$7(outerContainer.element, 'display', 'flex');\n        DOM.addClass(editor.getBody(), 'mce-edit-focus');\n        remove$6(uiMothership.element, 'display');\n        updateMode(false);\n        updateChromeUi();\n      };\n      var hide = function () {\n        visible.set(false);\n        if (uiComponents.outerContainer) {\n          set$7(outerContainer.element, 'display', 'none');\n          DOM.removeClass(editor.getBody(), 'mce-edit-focus');\n        }\n        set$7(uiMothership.element, 'display', 'none');\n      };\n      return {\n        isVisible: isVisible,\n        isPositionedAtTop: isPositionedAtTop,\n        show: show,\n        hide: hide,\n        update: updateChromeUi,\n        updateMode: updateMode,\n        repositionPopups: repositionPopups$1\n      };\n    };\n\n    var getTargetPosAndBounds = function (targetElm, isToolbarTop) {\n      var bounds = box$1(targetElm);\n      return {\n        pos: isToolbarTop ? bounds.y : bounds.bottom,\n        bounds: bounds\n      };\n    };\n    var setupEvents = function (editor, targetElm, ui, toolbarPersist) {\n      var prevPosAndBounds = Cell(getTargetPosAndBounds(targetElm, ui.isPositionedAtTop()));\n      var resizeContent = function (e) {\n        var _a = getTargetPosAndBounds(targetElm, ui.isPositionedAtTop()), pos = _a.pos, bounds = _a.bounds;\n        var _b = prevPosAndBounds.get(), prevPos = _b.pos, prevBounds = _b.bounds;\n        var hasResized = bounds.height !== prevBounds.height || bounds.width !== prevBounds.width;\n        prevPosAndBounds.set({\n          pos: pos,\n          bounds: bounds\n        });\n        if (hasResized) {\n          fireResizeContent(editor, e);\n        }\n        if (ui.isVisible()) {\n          if (prevPos !== pos) {\n            ui.update(true);\n          } else if (hasResized) {\n            ui.updateMode();\n            ui.repositionPopups();\n          }\n        }\n      };\n      if (!toolbarPersist) {\n        editor.on('activate', ui.show);\n        editor.on('deactivate', ui.hide);\n      }\n      editor.on('SkinLoaded ResizeWindow', function () {\n        return ui.update(true);\n      });\n      editor.on('NodeChange keydown', function (e) {\n        global$f.requestAnimationFrame(function () {\n          return resizeContent(e);\n        });\n      });\n      editor.on('ScrollWindow', function () {\n        return ui.updateMode();\n      });\n      var elementLoad = unbindable();\n      elementLoad.set(capture(SugarElement.fromDom(editor.getBody()), 'load', resizeContent));\n      editor.on('remove', function () {\n        elementLoad.clear();\n      });\n    };\n    var render = function (editor, uiComponents, rawUiConfig, backstage, args) {\n      var mothership = uiComponents.mothership, uiMothership = uiComponents.uiMothership, outerContainer = uiComponents.outerContainer;\n      var floatContainer = Cell(null);\n      var targetElm = SugarElement.fromDom(args.targetNode);\n      var ui = InlineHeader(editor, targetElm, uiComponents, backstage, floatContainer);\n      var toolbarPersist = isToolbarPersist(editor);\n      inline(editor);\n      var render = function () {\n        if (floatContainer.get()) {\n          ui.show();\n          return;\n        }\n        floatContainer.set(OuterContainer.getHeader(outerContainer).getOrDie());\n        var uiContainer = getUiContainer(editor);\n        attachSystem(uiContainer, mothership);\n        attachSystem(uiContainer, uiMothership);\n        setToolbar(editor, uiComponents, rawUiConfig, backstage);\n        OuterContainer.setMenubar(outerContainer, identifyMenus(editor, rawUiConfig));\n        ui.show();\n        setupEvents(editor, targetElm, ui, toolbarPersist);\n        editor.nodeChanged();\n      };\n      editor.on('show', render);\n      editor.on('hide', ui.hide);\n      if (!toolbarPersist) {\n        editor.on('focus', render);\n        editor.on('blur', ui.hide);\n      }\n      editor.on('init', function () {\n        if (editor.hasFocus() || toolbarPersist) {\n          render();\n        }\n      });\n      setupReadonlyModeSwitch(editor, uiComponents);\n      var api = {\n        show: function () {\n          ui.show();\n        },\n        hide: function () {\n          ui.hide();\n        },\n        enable: function () {\n          broadcastReadonly(uiComponents, false);\n        },\n        disable: function () {\n          broadcastReadonly(uiComponents, true);\n        },\n        isDisabled: function () {\n          return Disabling.isDisabled(outerContainer);\n        }\n      };\n      return {\n        editorContainer: outerContainer.element.dom,\n        api: api\n      };\n    };\n\n    var Inline = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        render: render\n    });\n\n    var showContextToolbarEvent = 'contexttoolbar-show';\n    var hideContextToolbarEvent = 'contexttoolbar-hide';\n\n    var getFormApi = function (input) {\n      return {\n        hide: function () {\n          return emit(input, sandboxClose());\n        },\n        getValue: function () {\n          return Representing.getValue(input);\n        }\n      };\n    };\n    var runOnExecute = function (memInput, original) {\n      return run$1(internalToolbarButtonExecute, function (comp, se) {\n        var input = memInput.get(comp);\n        var formApi = getFormApi(input);\n        original.onAction(formApi, se.event.buttonApi);\n      });\n    };\n    var renderContextButton = function (memInput, button, extras) {\n      var _a = button.original; _a.primary; var rest = __rest(_a, ['primary']);\n      var bridged = getOrDie(createToolbarButton(__assign(__assign({}, rest), {\n        type: 'button',\n        onAction: noop\n      })));\n      return renderToolbarButtonWith(bridged, extras.backstage.shared.providers, [runOnExecute(memInput, button)]);\n    };\n    var renderContextToggleButton = function (memInput, button, extras) {\n      var _a = button.original; _a.primary; var rest = __rest(_a, ['primary']);\n      var bridged = getOrDie(createToggleButton(__assign(__assign({}, rest), {\n        type: 'togglebutton',\n        onAction: noop\n      })));\n      return renderToolbarToggleButtonWith(bridged, extras.backstage.shared.providers, [runOnExecute(memInput, button)]);\n    };\n    var generateOne = function (memInput, button, providersBackstage) {\n      var extras = { backstage: { shared: { providers: providersBackstage } } };\n      if (button.type === 'contextformtogglebutton') {\n        return renderContextToggleButton(memInput, button, extras);\n      } else {\n        return renderContextButton(memInput, button, extras);\n      }\n    };\n    var generate = function (memInput, buttons, providersBackstage) {\n      var mementos = map$2(buttons, function (button) {\n        return record(generateOne(memInput, button, providersBackstage));\n      });\n      var asSpecs = function () {\n        return map$2(mementos, function (mem) {\n          return mem.asSpec();\n        });\n      };\n      var findPrimary = function (compInSystem) {\n        return findMap(buttons, function (button, i) {\n          if (button.primary) {\n            return Optional.from(mementos[i]).bind(function (mem) {\n              return mem.getOpt(compInSystem);\n            }).filter(not(Disabling.isDisabled));\n          } else {\n            return Optional.none();\n          }\n        });\n      };\n      return {\n        asSpecs: asSpecs,\n        findPrimary: findPrimary\n      };\n    };\n\n    var buildInitGroups = function (ctx, providers) {\n      var inputAttributes = ctx.label.fold(function () {\n        return {};\n      }, function (label) {\n        return { 'aria-label': label };\n      });\n      var memInput = record(Input.sketch({\n        inputClasses: [\n          'tox-toolbar-textfield',\n          'tox-toolbar-nav-js'\n        ],\n        data: ctx.initValue(),\n        inputAttributes: inputAttributes,\n        selectOnFocus: true,\n        inputBehaviours: derive$1([Keying.config({\n            mode: 'special',\n            onEnter: function (input) {\n              return commands.findPrimary(input).map(function (primary) {\n                emitExecute(primary);\n                return true;\n              });\n            },\n            onLeft: function (comp, se) {\n              se.cut();\n              return Optional.none();\n            },\n            onRight: function (comp, se) {\n              se.cut();\n              return Optional.none();\n            }\n          })])\n      }));\n      var commands = generate(memInput, ctx.commands, providers);\n      return [\n        {\n          title: Optional.none(),\n          items: [memInput.asSpec()]\n        },\n        {\n          title: Optional.none(),\n          items: commands.asSpecs()\n        }\n      ];\n    };\n    var renderContextForm = function (toolbarType, ctx, providers) {\n      return renderToolbar({\n        type: toolbarType,\n        uid: generate$6('context-toolbar'),\n        initGroups: buildInitGroups(ctx, providers),\n        onEscape: Optional.none,\n        cyclicKeying: true,\n        providers: providers\n      });\n    };\n    var ContextForm = {\n      renderContextForm: renderContextForm,\n      buildInitGroups: buildInitGroups\n    };\n\n    var isVerticalOverlap = function (a, b, threshold) {\n      if (threshold === void 0) {\n        threshold = 0.01;\n      }\n      return b.bottom - a.y >= threshold && a.bottom - b.y >= threshold;\n    };\n    var getRangeRect = function (rng) {\n      var rect = rng.getBoundingClientRect();\n      if (rect.height <= 0 && rect.width <= 0) {\n        var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset).element;\n        var elm = isText$1(leaf$1) ? parent(leaf$1) : Optional.some(leaf$1);\n        return elm.filter(isElement$2).map(function (e) {\n          return e.dom.getBoundingClientRect();\n        }).getOr(rect);\n      } else {\n        return rect;\n      }\n    };\n    var getSelectionBounds = function (editor) {\n      var rng = editor.selection.getRng();\n      var rect = getRangeRect(rng);\n      if (editor.inline) {\n        var scroll_1 = get$9();\n        return bounds(scroll_1.left + rect.left, scroll_1.top + rect.top, rect.width, rect.height);\n      } else {\n        var bodyPos = absolute$2(SugarElement.fromDom(editor.getBody()));\n        return bounds(bodyPos.x + rect.left, bodyPos.y + rect.top, rect.width, rect.height);\n      }\n    };\n    var getAnchorElementBounds = function (editor, lastElement) {\n      return lastElement.filter(inBody).map(absolute$2).getOrThunk(function () {\n        return getSelectionBounds(editor);\n      });\n    };\n    var getHorizontalBounds = function (contentAreaBox, viewportBounds, margin) {\n      var x = Math.max(contentAreaBox.x + margin, viewportBounds.x);\n      var right = Math.min(contentAreaBox.right - margin, viewportBounds.right);\n      return {\n        x: x,\n        width: right - x\n      };\n    };\n    var getVerticalBounds = function (editor, contentAreaBox, viewportBounds, isToolbarLocationTop, toolbarType, margin) {\n      var container = SugarElement.fromDom(editor.getContainer());\n      var header = descendant(container, '.tox-editor-header').getOr(container);\n      var headerBox = box$1(header);\n      var isToolbarBelowContentArea = headerBox.y >= contentAreaBox.bottom;\n      var isToolbarAbove = isToolbarLocationTop && !isToolbarBelowContentArea;\n      if (editor.inline && isToolbarAbove) {\n        return {\n          y: Math.max(headerBox.bottom + margin, viewportBounds.y),\n          bottom: viewportBounds.bottom\n        };\n      }\n      if (editor.inline && !isToolbarAbove) {\n        return {\n          y: viewportBounds.y,\n          bottom: Math.min(headerBox.y - margin, viewportBounds.bottom)\n        };\n      }\n      var containerBounds = toolbarType === 'line' ? box$1(container) : contentAreaBox;\n      if (isToolbarAbove) {\n        return {\n          y: Math.max(headerBox.bottom + margin, viewportBounds.y),\n          bottom: Math.min(containerBounds.bottom - margin, viewportBounds.bottom)\n        };\n      }\n      return {\n        y: Math.max(containerBounds.y + margin, viewportBounds.y),\n        bottom: Math.min(headerBox.y - margin, viewportBounds.bottom)\n      };\n    };\n    var getContextToolbarBounds = function (editor, sharedBackstage, toolbarType, margin) {\n      if (margin === void 0) {\n        margin = 0;\n      }\n      var viewportBounds = getBounds$3(window);\n      var contentAreaBox = box$1(SugarElement.fromDom(editor.getContentAreaContainer()));\n      var toolbarOrMenubarEnabled = isMenubarEnabled(editor) || isToolbarEnabled(editor) || isMultipleToolbars(editor);\n      var _a = getHorizontalBounds(contentAreaBox, viewportBounds, margin), x = _a.x, width = _a.width;\n      if (editor.inline && !toolbarOrMenubarEnabled) {\n        return bounds(x, viewportBounds.y, width, viewportBounds.height);\n      } else {\n        var isToolbarTop = sharedBackstage.header.isPositionedAtTop();\n        var _b = getVerticalBounds(editor, contentAreaBox, viewportBounds, isToolbarTop, toolbarType, margin), y = _b.y, bottom = _b.bottom;\n        return bounds(x, y, width, bottom - y);\n      }\n    };\n\n    var bubbleSize$1 = 12;\n    var bubbleAlignments$1 = {\n      valignCentre: [],\n      alignCentre: [],\n      alignLeft: ['tox-pop--align-left'],\n      alignRight: ['tox-pop--align-right'],\n      right: ['tox-pop--right'],\n      left: ['tox-pop--left'],\n      bottom: ['tox-pop--bottom'],\n      top: ['tox-pop--top'],\n      inset: ['tox-pop--inset']\n    };\n    var anchorOverrides = {\n      maxHeightFunction: expandable$1(),\n      maxWidthFunction: expandable()\n    };\n    var isEntireElementSelected = function (editor, elem) {\n      var rng = editor.selection.getRng();\n      var leaf$1 = leaf(SugarElement.fromDom(rng.startContainer), rng.startOffset);\n      return rng.startContainer === rng.endContainer && rng.startOffset === rng.endOffset - 1 && eq(leaf$1.element, elem);\n    };\n    var preservePosition = function (elem, position, f) {\n      var currentPosition = getRaw(elem, 'position');\n      set$7(elem, 'position', position);\n      var result = f(elem);\n      currentPosition.each(function (pos) {\n        return set$7(elem, 'position', pos);\n      });\n      return result;\n    };\n    var shouldUseInsetLayouts = function (position) {\n      return position === 'node';\n    };\n    var determineInsetLayout = function (editor, contextbar, elem, data, bounds) {\n      var selectionBounds = getSelectionBounds(editor);\n      var isSameAnchorElement = data.lastElement().exists(function (prev) {\n        return eq(elem, prev);\n      });\n      if (isEntireElementSelected(editor, elem)) {\n        return isSameAnchorElement ? preserve : north;\n      } else if (isSameAnchorElement) {\n        return preservePosition(contextbar, data.getMode(), function () {\n          var isOverlapping = isVerticalOverlap(selectionBounds, box$1(contextbar));\n          return isOverlapping && !data.isReposition() ? flip$2 : preserve;\n        });\n      } else {\n        var yBounds = data.getMode() === 'fixed' ? bounds.y + get$9().top : bounds.y;\n        var contextbarHeight = get$b(contextbar) + bubbleSize$1;\n        return yBounds + contextbarHeight <= selectionBounds.y ? north : south;\n      }\n    };\n    var getAnchorSpec$2 = function (editor, mobile, data, position) {\n      var smartInsetLayout = function (elem) {\n        return function (anchor, element, bubbles, placee, bounds) {\n          var layout = determineInsetLayout(editor, placee, elem, data, bounds);\n          var newAnchor = __assign(__assign({}, anchor), {\n            y: bounds.y,\n            height: bounds.height\n          });\n          return __assign(__assign({}, layout(newAnchor, element, bubbles, placee, bounds)), { alwaysFit: true });\n        };\n      };\n      var getInsetLayouts = function (elem) {\n        return shouldUseInsetLayouts(position) ? [smartInsetLayout(elem)] : [];\n      };\n      var desktopAnchorSpecLayouts = {\n        onLtr: function (elem) {\n          return [\n            north$2,\n            south$2,\n            northeast$2,\n            southeast$2,\n            northwest$2,\n            southwest$2\n          ].concat(getInsetLayouts(elem));\n        },\n        onRtl: function (elem) {\n          return [\n            north$2,\n            south$2,\n            northwest$2,\n            southwest$2,\n            northeast$2,\n            southeast$2\n          ].concat(getInsetLayouts(elem));\n        }\n      };\n      var mobileAnchorSpecLayouts = {\n        onLtr: function (elem) {\n          return [\n            south$2,\n            southeast$2,\n            southwest$2,\n            northeast$2,\n            northwest$2,\n            north$2\n          ].concat(getInsetLayouts(elem));\n        },\n        onRtl: function (elem) {\n          return [\n            south$2,\n            southwest$2,\n            southeast$2,\n            northwest$2,\n            northeast$2,\n            north$2\n          ].concat(getInsetLayouts(elem));\n        }\n      };\n      return mobile ? mobileAnchorSpecLayouts : desktopAnchorSpecLayouts;\n    };\n    var getAnchorLayout = function (editor, position, isTouch, data) {\n      if (position === 'line') {\n        return {\n          bubble: nu$5(bubbleSize$1, 0, bubbleAlignments$1),\n          layouts: {\n            onLtr: function () {\n              return [east$2];\n            },\n            onRtl: function () {\n              return [west$2];\n            }\n          },\n          overrides: anchorOverrides\n        };\n      } else {\n        return {\n          bubble: nu$5(0, bubbleSize$1, bubbleAlignments$1, 1 / bubbleSize$1),\n          layouts: getAnchorSpec$2(editor, isTouch, data, position),\n          overrides: anchorOverrides\n        };\n      }\n    };\n\n    var matchTargetWith = function (elem, candidates) {\n      var ctxs = filter$2(candidates, function (toolbarApi) {\n        return toolbarApi.predicate(elem.dom);\n      });\n      var _a = partition$3(ctxs, function (t) {\n          return t.type === 'contexttoolbar';\n        }), pass = _a.pass, fail = _a.fail;\n      return {\n        contextToolbars: pass,\n        contextForms: fail\n      };\n    };\n    var filterByPositionForStartNode = function (toolbars) {\n      if (toolbars.length <= 1) {\n        return toolbars;\n      } else {\n        var doesPositionExist = function (value) {\n          return exists(toolbars, function (t) {\n            return t.position === value;\n          });\n        };\n        var filterToolbarsByPosition = function (value) {\n          return filter$2(toolbars, function (t) {\n            return t.position === value;\n          });\n        };\n        var hasSelectionToolbars = doesPositionExist('selection');\n        var hasNodeToolbars = doesPositionExist('node');\n        if (hasSelectionToolbars || hasNodeToolbars) {\n          if (hasNodeToolbars && hasSelectionToolbars) {\n            var nodeToolbars = filterToolbarsByPosition('node');\n            var selectionToolbars = map$2(filterToolbarsByPosition('selection'), function (t) {\n              return __assign(__assign({}, t), { position: 'node' });\n            });\n            return nodeToolbars.concat(selectionToolbars);\n          } else {\n            return hasSelectionToolbars ? filterToolbarsByPosition('selection') : filterToolbarsByPosition('node');\n          }\n        } else {\n          return filterToolbarsByPosition('line');\n        }\n      }\n    };\n    var filterByPositionForAncestorNode = function (toolbars) {\n      if (toolbars.length <= 1) {\n        return toolbars;\n      } else {\n        var findPosition_1 = function (value) {\n          return find$5(toolbars, function (t) {\n            return t.position === value;\n          });\n        };\n        var basePosition = findPosition_1('selection').orThunk(function () {\n          return findPosition_1('node');\n        }).orThunk(function () {\n          return findPosition_1('line');\n        }).map(function (t) {\n          return t.position;\n        });\n        return basePosition.fold(function () {\n          return [];\n        }, function (pos) {\n          return filter$2(toolbars, function (t) {\n            return t.position === pos;\n          });\n        });\n      }\n    };\n    var matchStartNode = function (elem, nodeCandidates, editorCandidates) {\n      var nodeMatches = matchTargetWith(elem, nodeCandidates);\n      if (nodeMatches.contextForms.length > 0) {\n        return Optional.some({\n          elem: elem,\n          toolbars: [nodeMatches.contextForms[0]]\n        });\n      } else {\n        var editorMatches = matchTargetWith(elem, editorCandidates);\n        if (editorMatches.contextForms.length > 0) {\n          return Optional.some({\n            elem: elem,\n            toolbars: [editorMatches.contextForms[0]]\n          });\n        } else if (nodeMatches.contextToolbars.length > 0 || editorMatches.contextToolbars.length > 0) {\n          var toolbars = filterByPositionForStartNode(nodeMatches.contextToolbars.concat(editorMatches.contextToolbars));\n          return Optional.some({\n            elem: elem,\n            toolbars: toolbars\n          });\n        } else {\n          return Optional.none();\n        }\n      }\n    };\n    var matchAncestor = function (isRoot, startNode, scopes) {\n      if (isRoot(startNode)) {\n        return Optional.none();\n      } else {\n        return ancestor$2(startNode, function (ancestorElem) {\n          if (isElement$2(ancestorElem)) {\n            var _a = matchTargetWith(ancestorElem, scopes.inNodeScope), contextToolbars = _a.contextToolbars, contextForms = _a.contextForms;\n            var toolbars = contextForms.length > 0 ? contextForms : filterByPositionForAncestorNode(contextToolbars);\n            return toolbars.length > 0 ? Optional.some({\n              elem: ancestorElem,\n              toolbars: toolbars\n            }) : Optional.none();\n          } else {\n            return Optional.none();\n          }\n        }, isRoot);\n      }\n    };\n    var lookup$1 = function (scopes, editor) {\n      var rootElem = SugarElement.fromDom(editor.getBody());\n      var isRoot = function (elem) {\n        return eq(elem, rootElem);\n      };\n      var isOutsideRoot = function (startNode) {\n        return !isRoot(startNode) && !contains(rootElem, startNode);\n      };\n      var startNode = SugarElement.fromDom(editor.selection.getNode());\n      if (isOutsideRoot(startNode)) {\n        return Optional.none();\n      }\n      return matchStartNode(startNode, scopes.inNodeScope, scopes.inEditorScope).orThunk(function () {\n        return matchAncestor(isRoot, startNode, scopes);\n      });\n    };\n\n    var categorise = function (contextToolbars, navigate) {\n      var forms = {};\n      var inNodeScope = [];\n      var inEditorScope = [];\n      var formNavigators = {};\n      var lookupTable = {};\n      var registerForm = function (key, toolbarSpec) {\n        var contextForm = getOrDie(createContextForm(toolbarSpec));\n        forms[key] = contextForm;\n        contextForm.launch.map(function (launch) {\n          formNavigators['form:' + key + ''] = __assign(__assign({}, toolbarSpec.launch), {\n            type: launch.type === 'contextformtogglebutton' ? 'togglebutton' : 'button',\n            onAction: function () {\n              navigate(contextForm);\n            }\n          });\n        });\n        if (contextForm.scope === 'editor') {\n          inEditorScope.push(contextForm);\n        } else {\n          inNodeScope.push(contextForm);\n        }\n        lookupTable[key] = contextForm;\n      };\n      var registerToolbar = function (key, toolbarSpec) {\n        createContextToolbar(toolbarSpec).each(function (contextToolbar) {\n          if (toolbarSpec.scope === 'editor') {\n            inEditorScope.push(contextToolbar);\n          } else {\n            inNodeScope.push(contextToolbar);\n          }\n          lookupTable[key] = contextToolbar;\n        });\n      };\n      var keys$1 = keys(contextToolbars);\n      each$1(keys$1, function (key) {\n        var toolbarApi = contextToolbars[key];\n        if (toolbarApi.type === 'contextform') {\n          registerForm(key, toolbarApi);\n        } else if (toolbarApi.type === 'contexttoolbar') {\n          registerToolbar(key, toolbarApi);\n        }\n      });\n      return {\n        forms: forms,\n        inNodeScope: inNodeScope,\n        inEditorScope: inEditorScope,\n        lookupTable: lookupTable,\n        formNavigators: formNavigators\n      };\n    };\n\n    var forwardSlideEvent = generate$6('forward-slide');\n    var backSlideEvent = generate$6('backward-slide');\n    var changeSlideEvent = generate$6('change-slide-event');\n    var resizingClass = 'tox-pop--resizing';\n    var renderContextToolbar = function (spec) {\n      var stack = Cell([]);\n      return InlineView.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-pop']\n        },\n        fireDismissalEventInstead: { event: 'doNotDismissYet' },\n        onShow: function (comp) {\n          stack.set([]);\n          InlineView.getContent(comp).each(function (c) {\n            remove$6(c.element, 'visibility');\n          });\n          remove$2(comp.element, resizingClass);\n          remove$6(comp.element, 'width');\n        },\n        inlineBehaviours: derive$1([\n          config('context-toolbar-events', [\n            runOnSource(transitionend(), function (comp, se) {\n              if (se.event.raw.propertyName === 'width') {\n                remove$2(comp.element, resizingClass);\n                remove$6(comp.element, 'width');\n              }\n            }),\n            run$1(changeSlideEvent, function (comp, se) {\n              var elem = comp.element;\n              remove$6(elem, 'width');\n              var currentWidth = get$a(elem);\n              InlineView.setContent(comp, se.event.contents);\n              add$2(elem, resizingClass);\n              var newWidth = get$a(elem);\n              set$7(elem, 'width', currentWidth + 'px');\n              InlineView.getContent(comp).each(function (newContents) {\n                se.event.focus.bind(function (f) {\n                  focus$3(f);\n                  return search(elem);\n                }).orThunk(function () {\n                  Keying.focusIn(newContents);\n                  return active(getRootNode(elem));\n                });\n              });\n              global$f.setTimeout(function () {\n                set$7(comp.element, 'width', newWidth + 'px');\n              }, 0);\n            }),\n            run$1(forwardSlideEvent, function (comp, se) {\n              InlineView.getContent(comp).each(function (oldContents) {\n                stack.set(stack.get().concat([{\n                    bar: oldContents,\n                    focus: active(getRootNode(comp.element))\n                  }]));\n              });\n              emitWith(comp, changeSlideEvent, {\n                contents: se.event.forwardContents,\n                focus: Optional.none()\n              });\n            }),\n            run$1(backSlideEvent, function (comp, _se) {\n              last$2(stack.get()).each(function (last) {\n                stack.set(stack.get().slice(0, stack.get().length - 1));\n                emitWith(comp, changeSlideEvent, {\n                  contents: premade(last.bar),\n                  focus: last.focus\n                });\n              });\n            })\n          ]),\n          Keying.config({\n            mode: 'special',\n            onEscape: function (comp) {\n              return last$2(stack.get()).fold(function () {\n                return spec.onEscape();\n              }, function (_) {\n                emit(comp, backSlideEvent);\n                return Optional.some(true);\n              });\n            }\n          })\n        ]),\n        lazySink: function () {\n          return Result.value(spec.sink);\n        }\n      });\n    };\n\n    var transitionClass = 'tox-pop--transition';\n    var register$7 = function (editor, registryContextToolbars, sink, extras) {\n      var backstage = extras.backstage;\n      var sharedBackstage = backstage.shared;\n      var isTouch = detect$1().deviceType.isTouch;\n      var lastElement = value$1();\n      var lastTrigger = value$1();\n      var lastContextPosition = value$1();\n      var contextbar = build$1(renderContextToolbar({\n        sink: sink,\n        onEscape: function () {\n          editor.focus();\n          return Optional.some(true);\n        }\n      }));\n      var getBounds = function () {\n        var position = lastContextPosition.get().getOr('node');\n        var margin = shouldUseInsetLayouts(position) ? 1 : 0;\n        return getContextToolbarBounds(editor, sharedBackstage, position, margin);\n      };\n      var canLaunchToolbar = function () {\n        return !editor.removed && !(isTouch() && backstage.isContextMenuOpen());\n      };\n      var isSameLaunchElement = function (elem) {\n        return is$1(lift2(elem, lastElement.get(), eq), true);\n      };\n      var shouldContextToolbarHide = function () {\n        if (!canLaunchToolbar()) {\n          return true;\n        } else {\n          var contextToolbarBounds = getBounds();\n          var anchorBounds = is$1(lastContextPosition.get(), 'node') ? getAnchorElementBounds(editor, lastElement.get()) : getSelectionBounds(editor);\n          return contextToolbarBounds.height <= 0 || !isVerticalOverlap(anchorBounds, contextToolbarBounds);\n        }\n      };\n      var close = function () {\n        lastElement.clear();\n        lastTrigger.clear();\n        lastContextPosition.clear();\n        InlineView.hide(contextbar);\n      };\n      var hideOrRepositionIfNecessary = function () {\n        if (InlineView.isOpen(contextbar)) {\n          var contextBarEle = contextbar.element;\n          remove$6(contextBarEle, 'display');\n          if (shouldContextToolbarHide()) {\n            set$7(contextBarEle, 'display', 'none');\n          } else {\n            lastTrigger.set(0);\n            InlineView.reposition(contextbar);\n          }\n        }\n      };\n      var wrapInPopDialog = function (toolbarSpec) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-pop__dialog']\n          },\n          components: [toolbarSpec],\n          behaviours: derive$1([\n            Keying.config({ mode: 'acyclic' }),\n            config('pop-dialog-wrap-events', [\n              runOnAttached(function (comp) {\n                editor.shortcuts.add('ctrl+F9', 'focus statusbar', function () {\n                  return Keying.focusIn(comp);\n                });\n              }),\n              runOnDetached(function (_comp) {\n                editor.shortcuts.remove('ctrl+F9');\n              })\n            ])\n          ])\n        };\n      };\n      var getScopes = cached(function () {\n        return categorise(registryContextToolbars, function (toolbarApi) {\n          var alloySpec = buildToolbar([toolbarApi]);\n          emitWith(contextbar, forwardSlideEvent, { forwardContents: wrapInPopDialog(alloySpec) });\n        });\n      });\n      var buildContextToolbarGroups = function (allButtons, ctx) {\n        return identifyButtons(editor, {\n          buttons: allButtons,\n          toolbar: ctx.items,\n          allowToolbarGroups: false\n        }, extras, Optional.some(['form:']));\n      };\n      var buildContextFormGroups = function (ctx, providers) {\n        return ContextForm.buildInitGroups(ctx, providers);\n      };\n      var buildToolbar = function (toolbars) {\n        var buttons = editor.ui.registry.getAll().buttons;\n        var scopes = getScopes();\n        var allButtons = __assign(__assign({}, buttons), scopes.formNavigators);\n        var toolbarType = getToolbarMode(editor) === ToolbarMode.scrolling ? ToolbarMode.scrolling : ToolbarMode.default;\n        var initGroups = flatten(map$2(toolbars, function (ctx) {\n          return ctx.type === 'contexttoolbar' ? buildContextToolbarGroups(allButtons, ctx) : buildContextFormGroups(ctx, sharedBackstage.providers);\n        }));\n        return renderToolbar({\n          type: toolbarType,\n          uid: generate$6('context-toolbar'),\n          initGroups: initGroups,\n          onEscape: Optional.none,\n          cyclicKeying: true,\n          providers: sharedBackstage.providers\n        });\n      };\n      var getAnchor = function (position, element) {\n        var anchorage = position === 'node' ? sharedBackstage.anchors.node(element) : sharedBackstage.anchors.cursor();\n        var anchorLayout = getAnchorLayout(editor, position, isTouch(), {\n          lastElement: lastElement.get,\n          isReposition: function () {\n            return is$1(lastTrigger.get(), 0);\n          },\n          getMode: function () {\n            return Positioning.getMode(sink);\n          }\n        });\n        return deepMerge(anchorage, anchorLayout);\n      };\n      var launchContext = function (toolbarApi, elem) {\n        launchContextToolbar.cancel();\n        if (!canLaunchToolbar()) {\n          return;\n        }\n        var toolbarSpec = buildToolbar(toolbarApi);\n        var position = toolbarApi[0].position;\n        var anchor = getAnchor(position, elem);\n        lastContextPosition.set(position);\n        lastTrigger.set(1);\n        var contextBarEle = contextbar.element;\n        remove$6(contextBarEle, 'display');\n        if (!isSameLaunchElement(elem)) {\n          remove$2(contextBarEle, transitionClass);\n          Positioning.reset(sink, contextbar);\n        }\n        InlineView.showWithinBounds(contextbar, wrapInPopDialog(toolbarSpec), {\n          anchor: anchor,\n          transition: {\n            classes: [transitionClass],\n            mode: 'placement'\n          }\n        }, function () {\n          return Optional.some(getBounds());\n        });\n        elem.fold(lastElement.clear, lastElement.set);\n        if (shouldContextToolbarHide()) {\n          set$7(contextBarEle, 'display', 'none');\n        }\n      };\n      var launchContextToolbar = last(function () {\n        if (!editor.hasFocus() || editor.removed) {\n          return;\n        }\n        if (has(contextbar.element, transitionClass)) {\n          launchContextToolbar.throttle();\n        } else {\n          var scopes = getScopes();\n          lookup$1(scopes, editor).fold(close, function (info) {\n            launchContext(info.toolbars, Optional.some(info.elem));\n          });\n        }\n      }, 17);\n      editor.on('init', function () {\n        editor.on('remove', close);\n        editor.on('ScrollContent ScrollWindow ObjectResized ResizeEditor longpress', hideOrRepositionIfNecessary);\n        editor.on('click keyup focus SetContent', launchContextToolbar.throttle);\n        editor.on(hideContextToolbarEvent, close);\n        editor.on(showContextToolbarEvent, function (e) {\n          var scopes = getScopes();\n          get$e(scopes.lookupTable, e.toolbarKey).each(function (ctx) {\n            launchContext([ctx], someIf(e.target !== editor, e.target));\n            InlineView.getContent(contextbar).each(Keying.focusIn);\n          });\n        });\n        editor.on('focusout', function (_e) {\n          global$f.setEditorTimeout(editor, function () {\n            if (search(sink.element).isNone() && search(contextbar.element).isNone()) {\n              close();\n            }\n          }, 0);\n        });\n        editor.on('SwitchMode', function () {\n          if (editor.mode.isReadOnly()) {\n            close();\n          }\n        });\n        editor.on('AfterProgressState', function (event) {\n          if (event.state) {\n            close();\n          } else if (editor.hasFocus()) {\n            launchContextToolbar.throttle();\n          }\n        });\n        editor.on('NodeChange', function (_e) {\n          search(contextbar.element).fold(launchContextToolbar.throttle, noop);\n        });\n      });\n    };\n\n    var register$6 = function (editor) {\n      var alignToolbarButtons = [\n        {\n          name: 'alignleft',\n          text: 'Align left',\n          cmd: 'JustifyLeft',\n          icon: 'align-left'\n        },\n        {\n          name: 'aligncenter',\n          text: 'Align center',\n          cmd: 'JustifyCenter',\n          icon: 'align-center'\n        },\n        {\n          name: 'alignright',\n          text: 'Align right',\n          cmd: 'JustifyRight',\n          icon: 'align-right'\n        },\n        {\n          name: 'alignjustify',\n          text: 'Justify',\n          cmd: 'JustifyFull',\n          icon: 'align-justify'\n        }\n      ];\n      each$1(alignToolbarButtons, function (item) {\n        editor.ui.registry.addToggleButton(item.name, {\n          tooltip: item.text,\n          icon: item.icon,\n          onAction: onActionExecCommand(editor, item.cmd),\n          onSetup: onSetupFormatToggle(editor, item.name)\n        });\n      });\n      editor.ui.registry.addButton('alignnone', {\n        tooltip: 'No alignment',\n        icon: 'align-none',\n        onAction: onActionExecCommand(editor, 'JustifyNone')\n      });\n    };\n\n    var units = {\n      unsupportedLength: [\n        'em',\n        'ex',\n        'cap',\n        'ch',\n        'ic',\n        'rem',\n        'lh',\n        'rlh',\n        'vw',\n        'vh',\n        'vi',\n        'vb',\n        'vmin',\n        'vmax',\n        'cm',\n        'mm',\n        'Q',\n        'in',\n        'pc',\n        'pt',\n        'px'\n      ],\n      fixed: [\n        'px',\n        'pt'\n      ],\n      relative: ['%'],\n      empty: ['']\n    };\n    var pattern = function () {\n      var decimalDigits = '[0-9]+';\n      var signedInteger = '[+-]?' + decimalDigits;\n      var exponentPart = '[eE]' + signedInteger;\n      var dot = '\\\\.';\n      var opt = function (input) {\n        return '(?:' + input + ')?';\n      };\n      var unsignedDecimalLiteral = [\n        'Infinity',\n        decimalDigits + dot + opt(decimalDigits) + opt(exponentPart),\n        dot + decimalDigits + opt(exponentPart),\n        decimalDigits + opt(exponentPart)\n      ].join('|');\n      var float = '[+-]?(?:' + unsignedDecimalLiteral + ')';\n      return new RegExp('^(' + float + ')(.*)$');\n    }();\n    var isUnit = function (unit, accepted) {\n      return exists(accepted, function (acc) {\n        return exists(units[acc], function (check) {\n          return unit === check;\n        });\n      });\n    };\n    var parse = function (input, accepted) {\n      var match = Optional.from(pattern.exec(input));\n      return match.bind(function (array) {\n        var value = Number(array[1]);\n        var unitRaw = array[2];\n        if (isUnit(unitRaw, accepted)) {\n          return Optional.some({\n            value: value,\n            unit: unitRaw\n          });\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var normalise = function (input, accepted) {\n      return parse(input, accepted).map(function (_a) {\n        var value = _a.value, unit = _a.unit;\n        return value + unit;\n      });\n    };\n\n    var registerController = function (editor, spec) {\n      var getMenuItems = function () {\n        var options = spec.getOptions(editor);\n        var initial = spec.getCurrent(editor).map(spec.hash);\n        var current = value$1();\n        return map$2(options, function (value) {\n          return {\n            type: 'togglemenuitem',\n            text: spec.display(value),\n            onSetup: function (api) {\n              var setActive = function (active) {\n                if (active) {\n                  current.on(function (oldApi) {\n                    return oldApi.setActive(false);\n                  });\n                  current.set(api);\n                }\n                api.setActive(active);\n              };\n              setActive(is$1(initial, spec.hash(value)));\n              var unbindWatcher = spec.watcher(editor, value, setActive);\n              return function () {\n                current.clear();\n                unbindWatcher();\n              };\n            },\n            onAction: function () {\n              return spec.setCurrent(editor, value);\n            }\n          };\n        });\n      };\n      editor.ui.registry.addMenuButton(spec.name, {\n        tooltip: spec.text,\n        icon: spec.icon,\n        fetch: function (callback) {\n          return callback(getMenuItems());\n        },\n        onSetup: spec.onToolbarSetup\n      });\n      editor.ui.registry.addNestedMenuItem(spec.name, {\n        type: 'nestedmenuitem',\n        text: spec.text,\n        getSubmenuItems: getMenuItems,\n        onSetup: spec.onMenuSetup\n      });\n    };\n    var lineHeightSpec = {\n      name: 'lineheight',\n      text: 'Line height',\n      icon: 'line-height',\n      getOptions: getLineHeightFormats,\n      hash: function (input) {\n        return normalise(input, [\n          'fixed',\n          'relative',\n          'empty'\n        ]).getOr(input);\n      },\n      display: identity$1,\n      watcher: function (editor, value, callback) {\n        return editor.formatter.formatChanged('lineheight', callback, false, { value: value }).unbind;\n      },\n      getCurrent: function (editor) {\n        return Optional.from(editor.queryCommandValue('LineHeight'));\n      },\n      setCurrent: function (editor, value) {\n        return editor.execCommand('LineHeight', false, value);\n      }\n    };\n    var languageSpec = function (editor) {\n      var settingsOpt = Optional.from(getContentLanguages(editor));\n      return settingsOpt.map(function (settings) {\n        return {\n          name: 'language',\n          text: 'Language',\n          icon: 'language',\n          getOptions: constant$1(settings),\n          hash: function (input) {\n            return isUndefined(input.customCode) ? input.code : input.code + '/' + input.customCode;\n          },\n          display: function (input) {\n            return input.title;\n          },\n          watcher: function (editor, value, callback) {\n            return editor.formatter.formatChanged('lang', callback, false, {\n              value: value.code,\n              customValue: value.customCode\n            }).unbind;\n          },\n          getCurrent: function (editor) {\n            var node = SugarElement.fromDom(editor.selection.getNode());\n            return closest$4(node, function (n) {\n              return Optional.some(n).filter(isElement$2).bind(function (ele) {\n                var codeOpt = getOpt(ele, 'lang');\n                return codeOpt.map(function (code) {\n                  var customCode = getOpt(ele, 'data-mce-lang').getOrUndefined();\n                  return {\n                    code: code,\n                    customCode: customCode,\n                    title: ''\n                  };\n                });\n              });\n            });\n          },\n          setCurrent: function (editor, lang) {\n            return editor.execCommand('Lang', false, lang);\n          },\n          onToolbarSetup: function (api) {\n            var unbinder = unbindable();\n            api.setActive(editor.formatter.match('lang', {}, undefined, true));\n            unbinder.set(editor.formatter.formatChanged('lang', api.setActive, true));\n            return unbinder.clear;\n          }\n        };\n      });\n    };\n    var register$5 = function (editor) {\n      registerController(editor, lineHeightSpec);\n      languageSpec(editor).each(function (spec) {\n        return registerController(editor, spec);\n      });\n    };\n\n    var register$4 = function (editor, backstage) {\n      alignSelectMenu(editor, backstage);\n      fontSelectMenu(editor, backstage);\n      styleSelectMenu(editor, backstage);\n      formatSelectMenu(editor, backstage);\n      fontsizeSelectMenu(editor, backstage);\n    };\n\n    var onSetupOutdentState = function (editor) {\n      return onSetupEvent(editor, 'NodeChange', function (api) {\n        api.setDisabled(!editor.queryCommandState('outdent'));\n      });\n    };\n    var registerButtons$2 = function (editor) {\n      editor.ui.registry.addButton('outdent', {\n        tooltip: 'Decrease indent',\n        icon: 'outdent',\n        onSetup: onSetupOutdentState(editor),\n        onAction: onActionExecCommand(editor, 'outdent')\n      });\n      editor.ui.registry.addButton('indent', {\n        tooltip: 'Increase indent',\n        icon: 'indent',\n        onAction: onActionExecCommand(editor, 'indent')\n      });\n    };\n    var register$3 = function (editor) {\n      registerButtons$2(editor);\n    };\n\n    var onActionToggleFormat = function (editor, fmt) {\n      return function () {\n        editor.execCommand('mceToggleFormat', false, fmt);\n      };\n    };\n    var registerFormatButtons = function (editor) {\n      global$5.each([\n        {\n          name: 'bold',\n          text: 'Bold',\n          icon: 'bold'\n        },\n        {\n          name: 'italic',\n          text: 'Italic',\n          icon: 'italic'\n        },\n        {\n          name: 'underline',\n          text: 'Underline',\n          icon: 'underline'\n        },\n        {\n          name: 'strikethrough',\n          text: 'Strikethrough',\n          icon: 'strike-through'\n        },\n        {\n          name: 'subscript',\n          text: 'Subscript',\n          icon: 'subscript'\n        },\n        {\n          name: 'superscript',\n          text: 'Superscript',\n          icon: 'superscript'\n        }\n      ], function (btn, _idx) {\n        editor.ui.registry.addToggleButton(btn.name, {\n          tooltip: btn.text,\n          icon: btn.icon,\n          onSetup: onSetupFormatToggle(editor, btn.name),\n          onAction: onActionToggleFormat(editor, btn.name)\n        });\n      });\n      for (var i = 1; i <= 6; i++) {\n        var name_1 = 'h' + i;\n        editor.ui.registry.addToggleButton(name_1, {\n          text: name_1.toUpperCase(),\n          tooltip: 'Heading ' + i,\n          onSetup: onSetupFormatToggle(editor, name_1),\n          onAction: onActionToggleFormat(editor, name_1)\n        });\n      }\n    };\n    var registerCommandButtons = function (editor) {\n      global$5.each([\n        {\n          name: 'cut',\n          text: 'Cut',\n          action: 'Cut',\n          icon: 'cut'\n        },\n        {\n          name: 'copy',\n          text: 'Copy',\n          action: 'Copy',\n          icon: 'copy'\n        },\n        {\n          name: 'paste',\n          text: 'Paste',\n          action: 'Paste',\n          icon: 'paste'\n        },\n        {\n          name: 'help',\n          text: 'Help',\n          action: 'mceHelp',\n          icon: 'help'\n        },\n        {\n          name: 'selectall',\n          text: 'Select all',\n          action: 'SelectAll',\n          icon: 'select-all'\n        },\n        {\n          name: 'newdocument',\n          text: 'New document',\n          action: 'mceNewDocument',\n          icon: 'new-document'\n        },\n        {\n          name: 'removeformat',\n          text: 'Clear formatting',\n          action: 'RemoveFormat',\n          icon: 'remove-formatting'\n        },\n        {\n          name: 'remove',\n          text: 'Remove',\n          action: 'Delete',\n          icon: 'remove'\n        }\n      ], function (btn) {\n        editor.ui.registry.addButton(btn.name, {\n          tooltip: btn.text,\n          icon: btn.icon,\n          onAction: onActionExecCommand(editor, btn.action)\n        });\n      });\n    };\n    var registerCommandToggleButtons = function (editor) {\n      global$5.each([{\n          name: 'blockquote',\n          text: 'Blockquote',\n          action: 'mceBlockQuote',\n          icon: 'quote'\n        }], function (btn) {\n        editor.ui.registry.addToggleButton(btn.name, {\n          tooltip: btn.text,\n          icon: btn.icon,\n          onAction: onActionExecCommand(editor, btn.action),\n          onSetup: onSetupFormatToggle(editor, btn.name)\n        });\n      });\n    };\n    var registerButtons$1 = function (editor) {\n      registerFormatButtons(editor);\n      registerCommandButtons(editor);\n      registerCommandToggleButtons(editor);\n    };\n    var registerMenuItems$2 = function (editor) {\n      global$5.each([\n        {\n          name: 'bold',\n          text: 'Bold',\n          action: 'Bold',\n          icon: 'bold',\n          shortcut: 'Meta+B'\n        },\n        {\n          name: 'italic',\n          text: 'Italic',\n          action: 'Italic',\n          icon: 'italic',\n          shortcut: 'Meta+I'\n        },\n        {\n          name: 'underline',\n          text: 'Underline',\n          action: 'Underline',\n          icon: 'underline',\n          shortcut: 'Meta+U'\n        },\n        {\n          name: 'strikethrough',\n          text: 'Strikethrough',\n          action: 'Strikethrough',\n          icon: 'strike-through',\n          shortcut: ''\n        },\n        {\n          name: 'subscript',\n          text: 'Subscript',\n          action: 'Subscript',\n          icon: 'subscript',\n          shortcut: ''\n        },\n        {\n          name: 'superscript',\n          text: 'Superscript',\n          action: 'Superscript',\n          icon: 'superscript',\n          shortcut: ''\n        },\n        {\n          name: 'removeformat',\n          text: 'Clear formatting',\n          action: 'RemoveFormat',\n          icon: 'remove-formatting',\n          shortcut: ''\n        },\n        {\n          name: 'newdocument',\n          text: 'New document',\n          action: 'mceNewDocument',\n          icon: 'new-document',\n          shortcut: ''\n        },\n        {\n          name: 'cut',\n          text: 'Cut',\n          action: 'Cut',\n          icon: 'cut',\n          shortcut: 'Meta+X'\n        },\n        {\n          name: 'copy',\n          text: 'Copy',\n          action: 'Copy',\n          icon: 'copy',\n          shortcut: 'Meta+C'\n        },\n        {\n          name: 'paste',\n          text: 'Paste',\n          action: 'Paste',\n          icon: 'paste',\n          shortcut: 'Meta+V'\n        },\n        {\n          name: 'selectall',\n          text: 'Select all',\n          action: 'SelectAll',\n          icon: 'select-all',\n          shortcut: 'Meta+A'\n        }\n      ], function (btn) {\n        editor.ui.registry.addMenuItem(btn.name, {\n          text: btn.text,\n          icon: btn.icon,\n          shortcut: btn.shortcut,\n          onAction: onActionExecCommand(editor, btn.action)\n        });\n      });\n      editor.ui.registry.addMenuItem('codeformat', {\n        text: 'Code',\n        icon: 'sourcecode',\n        onAction: onActionToggleFormat(editor, 'code')\n      });\n    };\n    var register$2 = function (editor) {\n      registerButtons$1(editor);\n      registerMenuItems$2(editor);\n    };\n\n    var onSetupUndoRedoState = function (editor, type) {\n      return onSetupEvent(editor, 'Undo Redo AddUndo TypingUndo ClearUndos SwitchMode', function (api) {\n        api.setDisabled(editor.mode.isReadOnly() || !editor.undoManager[type]());\n      });\n    };\n    var registerMenuItems$1 = function (editor) {\n      editor.ui.registry.addMenuItem('undo', {\n        text: 'Undo',\n        icon: 'undo',\n        shortcut: 'Meta+Z',\n        onSetup: onSetupUndoRedoState(editor, 'hasUndo'),\n        onAction: onActionExecCommand(editor, 'undo')\n      });\n      editor.ui.registry.addMenuItem('redo', {\n        text: 'Redo',\n        icon: 'redo',\n        shortcut: 'Meta+Y',\n        onSetup: onSetupUndoRedoState(editor, 'hasRedo'),\n        onAction: onActionExecCommand(editor, 'redo')\n      });\n    };\n    var registerButtons = function (editor) {\n      editor.ui.registry.addButton('undo', {\n        tooltip: 'Undo',\n        icon: 'undo',\n        disabled: true,\n        onSetup: onSetupUndoRedoState(editor, 'hasUndo'),\n        onAction: onActionExecCommand(editor, 'undo')\n      });\n      editor.ui.registry.addButton('redo', {\n        tooltip: 'Redo',\n        icon: 'redo',\n        disabled: true,\n        onSetup: onSetupUndoRedoState(editor, 'hasRedo'),\n        onAction: onActionExecCommand(editor, 'redo')\n      });\n    };\n    var register$1 = function (editor) {\n      registerMenuItems$1(editor);\n      registerButtons(editor);\n    };\n\n    var onSetupVisualAidState = function (editor) {\n      return onSetupEvent(editor, 'VisualAid', function (api) {\n        api.setActive(editor.hasVisual);\n      });\n    };\n    var registerMenuItems = function (editor) {\n      editor.ui.registry.addToggleMenuItem('visualaid', {\n        text: 'Visual aids',\n        onSetup: onSetupVisualAidState(editor),\n        onAction: onActionExecCommand(editor, 'mceToggleVisualAid')\n      });\n    };\n    var registerToolbarButton = function (editor) {\n      editor.ui.registry.addButton('visualaid', {\n        tooltip: 'Visual aids',\n        text: 'Visual aids',\n        onAction: onActionExecCommand(editor, 'mceToggleVisualAid')\n      });\n    };\n    var register = function (editor) {\n      registerToolbarButton(editor);\n      registerMenuItems(editor);\n    };\n\n    var setup$6 = function (editor, backstage) {\n      register$6(editor);\n      register$2(editor);\n      register$4(editor, backstage);\n      register$1(editor);\n      register$a(editor);\n      register(editor);\n      register$3(editor);\n      register$5(editor);\n    };\n\n    var nu = function (x, y) {\n      return {\n        type: 'makeshift',\n        x: x,\n        y: y\n      };\n    };\n    var transpose = function (pos, dx, dy) {\n      return nu(pos.x + dx, pos.y + dy);\n    };\n    var isTouchEvent = function (e) {\n      return e.type === 'longpress' || e.type.indexOf('touch') === 0;\n    };\n    var fromPageXY = function (e) {\n      if (isTouchEvent(e)) {\n        var touch = e.touches[0];\n        return nu(touch.pageX, touch.pageY);\n      } else {\n        return nu(e.pageX, e.pageY);\n      }\n    };\n    var fromClientXY = function (e) {\n      if (isTouchEvent(e)) {\n        var touch = e.touches[0];\n        return nu(touch.clientX, touch.clientY);\n      } else {\n        return nu(e.clientX, e.clientY);\n      }\n    };\n    var transposeContentAreaContainer = function (element, pos) {\n      var containerPos = global$b.DOM.getPos(element);\n      return transpose(pos, containerPos.x, containerPos.y);\n    };\n    var getPointAnchor = function (editor, e) {\n      if (e.type === 'contextmenu' || e.type === 'longpress') {\n        if (editor.inline) {\n          return fromPageXY(e);\n        } else {\n          return transposeContentAreaContainer(editor.getContentAreaContainer(), fromClientXY(e));\n        }\n      } else {\n        return getSelectionAnchor(editor);\n      }\n    };\n    var getSelectionAnchor = function (editor) {\n      return {\n        type: 'selection',\n        root: SugarElement.fromDom(editor.selection.getNode())\n      };\n    };\n    var getNodeAnchor = function (editor) {\n      return {\n        type: 'node',\n        node: Optional.some(SugarElement.fromDom(editor.selection.getNode())),\n        root: SugarElement.fromDom(editor.getBody())\n      };\n    };\n    var getAnchorSpec$1 = function (editor, e, anchorType) {\n      switch (anchorType) {\n      case 'node':\n        return getNodeAnchor(editor);\n      case 'point':\n        return getPointAnchor(editor, e);\n      case 'selection':\n        return getSelectionAnchor(editor);\n      }\n    };\n\n    var initAndShow$1 = function (editor, e, buildMenu, backstage, contextmenu, anchorType) {\n      var items = buildMenu();\n      var anchorSpec = getAnchorSpec$1(editor, e, anchorType);\n      build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, false).map(function (menuData) {\n        e.preventDefault();\n        InlineView.showMenuAt(contextmenu, { anchor: anchorSpec }, {\n          menu: { markers: markers('normal') },\n          data: menuData\n        });\n      });\n    };\n\n    var layouts = {\n      onLtr: function () {\n        return [\n          south$2,\n          southeast$2,\n          southwest$2,\n          northeast$2,\n          northwest$2,\n          north$2,\n          north,\n          south,\n          northeast,\n          southeast,\n          northwest,\n          southwest\n        ];\n      },\n      onRtl: function () {\n        return [\n          south$2,\n          southwest$2,\n          southeast$2,\n          northwest$2,\n          northeast$2,\n          north$2,\n          north,\n          south,\n          northwest,\n          southwest,\n          northeast,\n          southeast\n        ];\n      }\n    };\n    var bubbleSize = 12;\n    var bubbleAlignments = {\n      valignCentre: [],\n      alignCentre: [],\n      alignLeft: ['tox-pop--align-left'],\n      alignRight: ['tox-pop--align-right'],\n      right: ['tox-pop--right'],\n      left: ['tox-pop--left'],\n      bottom: ['tox-pop--bottom'],\n      top: ['tox-pop--top']\n    };\n    var isTouchWithinSelection = function (editor, e) {\n      var selection = editor.selection;\n      if (selection.isCollapsed() || e.touches.length < 1) {\n        return false;\n      } else {\n        var touch_1 = e.touches[0];\n        var rng = selection.getRng();\n        var rngRectOpt = getFirstRect(editor.getWin(), SimSelection.domRange(rng));\n        return rngRectOpt.exists(function (rngRect) {\n          return rngRect.left <= touch_1.clientX && rngRect.right >= touch_1.clientX && rngRect.top <= touch_1.clientY && rngRect.bottom >= touch_1.clientY;\n        });\n      }\n    };\n    var setupiOSOverrides = function (editor) {\n      var originalSelection = editor.selection.getRng();\n      var selectionReset = function () {\n        global$f.setEditorTimeout(editor, function () {\n          editor.selection.setRng(originalSelection);\n        }, 10);\n        unbindEventListeners();\n      };\n      editor.once('touchend', selectionReset);\n      var preventMousedown = function (e) {\n        e.preventDefault();\n        e.stopImmediatePropagation();\n      };\n      editor.on('mousedown', preventMousedown, true);\n      var clearSelectionReset = function () {\n        return unbindEventListeners();\n      };\n      editor.once('longpresscancel', clearSelectionReset);\n      var unbindEventListeners = function () {\n        editor.off('touchend', selectionReset);\n        editor.off('longpresscancel', clearSelectionReset);\n        editor.off('mousedown', preventMousedown);\n      };\n    };\n    var getAnchorSpec = function (editor, e, anchorType) {\n      var anchorSpec = getAnchorSpec$1(editor, e, anchorType);\n      var bubbleYOffset = anchorType === 'point' ? bubbleSize : 0;\n      return __assign({\n        bubble: nu$5(0, bubbleYOffset, bubbleAlignments),\n        layouts: layouts,\n        overrides: {\n          maxWidthFunction: expandable(),\n          maxHeightFunction: expandable$1()\n        }\n      }, anchorSpec);\n    };\n    var show = function (editor, e, items, backstage, contextmenu, anchorType, highlightImmediately) {\n      var anchorSpec = getAnchorSpec(editor, e, anchorType);\n      build(items, ItemResponse$1.CLOSE_ON_EXECUTE, backstage, true).map(function (menuData) {\n        e.preventDefault();\n        InlineView.showMenuWithinBounds(contextmenu, { anchor: anchorSpec }, {\n          menu: {\n            markers: markers('normal'),\n            highlightImmediately: highlightImmediately\n          },\n          data: menuData,\n          type: 'horizontal'\n        }, function () {\n          return Optional.some(getContextToolbarBounds(editor, backstage.shared, anchorType === 'node' ? 'node' : 'selection'));\n        });\n        editor.fire(hideContextToolbarEvent);\n      });\n    };\n    var initAndShow = function (editor, e, buildMenu, backstage, contextmenu, anchorType) {\n      var detection = detect$1();\n      var isiOS = detection.os.isiOS();\n      var isOSX = detection.os.isOSX();\n      var isAndroid = detection.os.isAndroid();\n      var isTouch = detection.deviceType.isTouch();\n      var shouldHighlightImmediately = function () {\n        return !(isAndroid || isiOS || isOSX && isTouch);\n      };\n      var open = function () {\n        var items = buildMenu();\n        show(editor, e, items, backstage, contextmenu, anchorType, shouldHighlightImmediately());\n      };\n      if ((isOSX || isiOS) && anchorType !== 'node') {\n        var openiOS_1 = function () {\n          setupiOSOverrides(editor);\n          open();\n        };\n        if (isTouchWithinSelection(editor, e)) {\n          openiOS_1();\n        } else {\n          editor.once('selectionchange', openiOS_1);\n          editor.once('touchend', function () {\n            return editor.off('selectionchange', openiOS_1);\n          });\n        }\n      } else {\n        open();\n      }\n    };\n\n    var patchPipeConfig = function (config) {\n      return typeof config === 'string' ? config.split(/[ ,]/) : config;\n    };\n    var shouldNeverUseNative = function (editor) {\n      return editor.getParam('contextmenu_never_use_native', false, 'boolean');\n    };\n    var getMenuItems = function (editor, name, defaultItems) {\n      var contextMenus = editor.ui.registry.getAll().contextMenus;\n      return Optional.from(editor.getParam(name)).map(patchPipeConfig).getOrThunk(function () {\n        return filter$2(patchPipeConfig(defaultItems), function (item) {\n          return has$2(contextMenus, item);\n        });\n      });\n    };\n    var isContextMenuDisabled = function (editor) {\n      return editor.getParam('contextmenu') === false;\n    };\n    var getContextMenu = function (editor) {\n      return getMenuItems(editor, 'contextmenu', 'link linkchecker image imagetools table spellchecker configurepermanentpen');\n    };\n    var getAvoidOverlapSelector = function (editor) {\n      return editor.getParam('contextmenu_avoid_overlap', '', 'string');\n    };\n\n    var isSeparator = function (item) {\n      return isString(item) ? item === '|' : item.type === 'separator';\n    };\n    var separator = { type: 'separator' };\n    var makeContextItem = function (item) {\n      var commonMenuItem = function (item) {\n        return {\n          text: item.text,\n          icon: item.icon,\n          disabled: item.disabled,\n          shortcut: item.shortcut\n        };\n      };\n      if (isString(item)) {\n        return item;\n      } else {\n        switch (item.type) {\n        case 'separator':\n          return separator;\n        case 'submenu':\n          return __assign(__assign({ type: 'nestedmenuitem' }, commonMenuItem(item)), {\n            getSubmenuItems: function () {\n              var items = item.getSubmenuItems();\n              if (isString(items)) {\n                return items;\n              } else {\n                return map$2(items, makeContextItem);\n              }\n            }\n          });\n        default:\n          return __assign(__assign({ type: 'menuitem' }, commonMenuItem(item)), { onAction: noarg(item.onAction) });\n        }\n      }\n    };\n    var addContextMenuGroup = function (xs, groupItems) {\n      if (groupItems.length === 0) {\n        return xs;\n      }\n      var lastMenuItem = last$2(xs).filter(function (item) {\n        return !isSeparator(item);\n      });\n      var before = lastMenuItem.fold(function () {\n        return [];\n      }, function (_) {\n        return [separator];\n      });\n      return xs.concat(before).concat(groupItems).concat([separator]);\n    };\n    var generateContextMenu = function (contextMenus, menuConfig, selectedElement) {\n      var sections = foldl(menuConfig, function (acc, name) {\n        return get$e(contextMenus, name.toLowerCase()).map(function (menu) {\n          var items = menu.update(selectedElement);\n          if (isString(items)) {\n            return addContextMenuGroup(acc, items.split(' '));\n          } else if (items.length > 0) {\n            var allItems = map$2(items, makeContextItem);\n            return addContextMenuGroup(acc, allItems);\n          } else {\n            return acc;\n          }\n        }).getOrThunk(function () {\n          return acc.concat([name]);\n        });\n      }, []);\n      if (sections.length > 0 && isSeparator(sections[sections.length - 1])) {\n        sections.pop();\n      }\n      return sections;\n    };\n    var isNativeOverrideKeyEvent = function (editor, e) {\n      return e.ctrlKey && !shouldNeverUseNative(editor);\n    };\n    var isTriggeredByKeyboard = function (editor, e) {\n      return e.type !== 'longpress' && (e.button !== 2 || e.target === editor.getBody() && e.pointerType === '');\n    };\n    var getSelectedElement = function (editor, e) {\n      return isTriggeredByKeyboard(editor, e) ? editor.selection.getStart(true) : e.target;\n    };\n    var getAnchorType = function (editor, e) {\n      var selector = getAvoidOverlapSelector(editor);\n      var anchorType = isTriggeredByKeyboard(editor, e) ? 'selection' : 'point';\n      if (isNotEmpty(selector)) {\n        var target = getSelectedElement(editor, e);\n        var selectorExists = closest(SugarElement.fromDom(target), selector);\n        return selectorExists ? 'node' : anchorType;\n      } else {\n        return anchorType;\n      }\n    };\n    var setup$5 = function (editor, lazySink, backstage) {\n      var detection = detect$1();\n      var isTouch = detection.deviceType.isTouch;\n      var contextmenu = build$1(InlineView.sketch({\n        dom: { tag: 'div' },\n        lazySink: lazySink,\n        onEscape: function () {\n          return editor.focus();\n        },\n        onShow: function () {\n          return backstage.setContextMenuState(true);\n        },\n        onHide: function () {\n          return backstage.setContextMenuState(false);\n        },\n        fireDismissalEventInstead: {},\n        inlineBehaviours: derive$1([config('dismissContextMenu', [run$1(dismissRequested(), function (comp, _se) {\n              Sandboxing.close(comp);\n              editor.focus();\n            })])])\n      }));\n      var hideContextMenu = function (_e) {\n        return InlineView.hide(contextmenu);\n      };\n      var showContextMenu = function (e) {\n        if (shouldNeverUseNative(editor)) {\n          e.preventDefault();\n        }\n        if (isNativeOverrideKeyEvent(editor, e) || isContextMenuDisabled(editor)) {\n          return;\n        }\n        var anchorType = getAnchorType(editor, e);\n        var buildMenu = function () {\n          var selectedElement = getSelectedElement(editor, e);\n          var registry = editor.ui.registry.getAll();\n          var menuConfig = getContextMenu(editor);\n          return generateContextMenu(registry.contextMenus, menuConfig, selectedElement);\n        };\n        var initAndShow$2 = isTouch() ? initAndShow : initAndShow$1;\n        initAndShow$2(editor, e, buildMenu, backstage, contextmenu, anchorType);\n      };\n      editor.on('init', function () {\n        var hideEvents = 'ResizeEditor ScrollContent ScrollWindow longpresscancel' + (isTouch() ? '' : ' ResizeWindow');\n        editor.on(hideEvents, hideContextMenu);\n        editor.on('longpress contextmenu', showContextMenu);\n      });\n    };\n\n    var adt = Adt.generate([\n      {\n        offset: [\n          'x',\n          'y'\n        ]\n      },\n      {\n        absolute: [\n          'x',\n          'y'\n        ]\n      },\n      {\n        fixed: [\n          'x',\n          'y'\n        ]\n      }\n    ]);\n    var subtract = function (change) {\n      return function (point) {\n        return point.translate(-change.left, -change.top);\n      };\n    };\n    var add = function (change) {\n      return function (point) {\n        return point.translate(change.left, change.top);\n      };\n    };\n    var transform = function (changes) {\n      return function (x, y) {\n        return foldl(changes, function (rest, f) {\n          return f(rest);\n        }, SugarPosition(x, y));\n      };\n    };\n    var asFixed = function (coord, scroll, origin) {\n      return coord.fold(transform([\n        add(origin),\n        subtract(scroll)\n      ]), transform([subtract(scroll)]), transform([]));\n    };\n    var asAbsolute = function (coord, scroll, origin) {\n      return coord.fold(transform([add(origin)]), transform([]), transform([add(scroll)]));\n    };\n    var asOffset = function (coord, scroll, origin) {\n      return coord.fold(transform([]), transform([subtract(origin)]), transform([\n        add(scroll),\n        subtract(origin)\n      ]));\n    };\n    var withinRange = function (coord1, coord2, xRange, yRange, scroll, origin) {\n      var a1 = asAbsolute(coord1, scroll, origin);\n      var a2 = asAbsolute(coord2, scroll, origin);\n      return Math.abs(a1.left - a2.left) <= xRange && Math.abs(a1.top - a2.top) <= yRange;\n    };\n    var getDeltas = function (coord1, coord2, xRange, yRange, scroll, origin) {\n      var a1 = asAbsolute(coord1, scroll, origin);\n      var a2 = asAbsolute(coord2, scroll, origin);\n      var left = Math.abs(a1.left - a2.left);\n      var top = Math.abs(a1.top - a2.top);\n      return SugarPosition(left, top);\n    };\n    var toStyles = function (coord, scroll, origin) {\n      var stylesOpt = coord.fold(function (x, y) {\n        return {\n          position: Optional.some('absolute'),\n          left: Optional.some(x + 'px'),\n          top: Optional.some(y + 'px')\n        };\n      }, function (x, y) {\n        return {\n          position: Optional.some('absolute'),\n          left: Optional.some(x - origin.left + 'px'),\n          top: Optional.some(y - origin.top + 'px')\n        };\n      }, function (x, y) {\n        return {\n          position: Optional.some('fixed'),\n          left: Optional.some(x + 'px'),\n          top: Optional.some(y + 'px')\n        };\n      });\n      return __assign({\n        right: Optional.none(),\n        bottom: Optional.none()\n      }, stylesOpt);\n    };\n    var translate = function (coord, deltaX, deltaY) {\n      return coord.fold(function (x, y) {\n        return offset(x + deltaX, y + deltaY);\n      }, function (x, y) {\n        return absolute(x + deltaX, y + deltaY);\n      }, function (x, y) {\n        return fixed(x + deltaX, y + deltaY);\n      });\n    };\n    var absorb = function (partialCoord, originalCoord, scroll, origin) {\n      var absorbOne = function (stencil, nu) {\n        return function (optX, optY) {\n          var original = stencil(originalCoord, scroll, origin);\n          return nu(optX.getOr(original.left), optY.getOr(original.top));\n        };\n      };\n      return partialCoord.fold(absorbOne(asOffset, offset), absorbOne(asAbsolute, absolute), absorbOne(asFixed, fixed));\n    };\n    var offset = adt.offset;\n    var absolute = adt.absolute;\n    var fixed = adt.fixed;\n\n    var parseAttrToInt = function (element, name) {\n      var value = get$d(element, name);\n      return isUndefined(value) ? NaN : parseInt(value, 10);\n    };\n    var get = function (component, snapsInfo) {\n      var element = component.element;\n      var x = parseAttrToInt(element, snapsInfo.leftAttr);\n      var y = parseAttrToInt(element, snapsInfo.topAttr);\n      return isNaN(x) || isNaN(y) ? Optional.none() : Optional.some(SugarPosition(x, y));\n    };\n    var set = function (component, snapsInfo, pt) {\n      var element = component.element;\n      set$8(element, snapsInfo.leftAttr, pt.left + 'px');\n      set$8(element, snapsInfo.topAttr, pt.top + 'px');\n    };\n    var clear = function (component, snapsInfo) {\n      var element = component.element;\n      remove$7(element, snapsInfo.leftAttr);\n      remove$7(element, snapsInfo.topAttr);\n    };\n\n    var getCoords = function (component, snapInfo, coord, delta) {\n      return get(component, snapInfo).fold(function () {\n        return coord;\n      }, function (fixed$1) {\n        return fixed(fixed$1.left + delta.left, fixed$1.top + delta.top);\n      });\n    };\n    var moveOrSnap = function (component, snapInfo, coord, delta, scroll, origin) {\n      var newCoord = getCoords(component, snapInfo, coord, delta);\n      var snap = snapInfo.mustSnap ? findClosestSnap(component, snapInfo, newCoord, scroll, origin) : findSnap(component, snapInfo, newCoord, scroll, origin);\n      var fixedCoord = asFixed(newCoord, scroll, origin);\n      set(component, snapInfo, fixedCoord);\n      return snap.fold(function () {\n        return {\n          coord: fixed(fixedCoord.left, fixedCoord.top),\n          extra: Optional.none()\n        };\n      }, function (spanned) {\n        return {\n          coord: spanned.output,\n          extra: spanned.extra\n        };\n      });\n    };\n    var stopDrag = function (component, snapInfo) {\n      clear(component, snapInfo);\n    };\n    var findMatchingSnap = function (snaps, newCoord, scroll, origin) {\n      return findMap(snaps, function (snap) {\n        var sensor = snap.sensor;\n        var inRange = withinRange(newCoord, sensor, snap.range.left, snap.range.top, scroll, origin);\n        return inRange ? Optional.some({\n          output: absorb(snap.output, newCoord, scroll, origin),\n          extra: snap.extra\n        }) : Optional.none();\n      });\n    };\n    var findClosestSnap = function (component, snapInfo, newCoord, scroll, origin) {\n      var snaps = snapInfo.getSnapPoints(component);\n      var matchSnap = findMatchingSnap(snaps, newCoord, scroll, origin);\n      return matchSnap.orThunk(function () {\n        var bestSnap = foldl(snaps, function (acc, snap) {\n          var sensor = snap.sensor;\n          var deltas = getDeltas(newCoord, sensor, snap.range.left, snap.range.top, scroll, origin);\n          return acc.deltas.fold(function () {\n            return {\n              deltas: Optional.some(deltas),\n              snap: Optional.some(snap)\n            };\n          }, function (bestDeltas) {\n            var currAvg = (deltas.left + deltas.top) / 2;\n            var bestAvg = (bestDeltas.left + bestDeltas.top) / 2;\n            if (currAvg <= bestAvg) {\n              return {\n                deltas: Optional.some(deltas),\n                snap: Optional.some(snap)\n              };\n            } else {\n              return acc;\n            }\n          });\n        }, {\n          deltas: Optional.none(),\n          snap: Optional.none()\n        });\n        return bestSnap.snap.map(function (snap) {\n          return {\n            output: absorb(snap.output, newCoord, scroll, origin),\n            extra: snap.extra\n          };\n        });\n      });\n    };\n    var findSnap = function (component, snapInfo, newCoord, scroll, origin) {\n      var snaps = snapInfo.getSnapPoints(component);\n      return findMatchingSnap(snaps, newCoord, scroll, origin);\n    };\n    var snapTo$1 = function (snap, scroll, origin) {\n      return {\n        coord: absorb(snap.output, snap.output, scroll, origin),\n        extra: snap.extra\n      };\n    };\n\n    var snapTo = function (component, dragConfig, _state, snap) {\n      var target = dragConfig.getTarget(component.element);\n      if (dragConfig.repositionTarget) {\n        var doc = owner$4(component.element);\n        var scroll_1 = get$9(doc);\n        var origin_1 = getOrigin(target);\n        var snapPin = snapTo$1(snap, scroll_1, origin_1);\n        var styles = toStyles(snapPin.coord, scroll_1, origin_1);\n        setOptions(target, styles);\n      }\n    };\n\n    var DraggingApis = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        snapTo: snapTo\n    });\n\n    var initialAttribute = 'data-initial-z-index';\n    var resetZIndex = function (blocker) {\n      parent(blocker.element).filter(isElement$2).each(function (root) {\n        getOpt(root, initialAttribute).fold(function () {\n          return remove$6(root, 'z-index');\n        }, function (zIndex) {\n          return set$7(root, 'z-index', zIndex);\n        });\n        remove$7(root, initialAttribute);\n      });\n    };\n    var changeZIndex = function (blocker) {\n      parent(blocker.element).filter(isElement$2).each(function (root) {\n        getRaw(root, 'z-index').each(function (zindex) {\n          set$8(root, initialAttribute, zindex);\n        });\n        set$7(root, 'z-index', get$c(blocker.element, 'z-index'));\n      });\n    };\n    var instigate = function (anyComponent, blocker) {\n      anyComponent.getSystem().addToGui(blocker);\n      changeZIndex(blocker);\n    };\n    var discard = function (blocker) {\n      resetZIndex(blocker);\n      blocker.getSystem().removeFromGui(blocker);\n    };\n    var createComponent = function (component, blockerClass, blockerEvents) {\n      return component.getSystem().build(Container.sketch({\n        dom: {\n          styles: {\n            'left': '0px',\n            'top': '0px',\n            'width': '100%',\n            'height': '100%',\n            'position': 'fixed',\n            'z-index': '1000000000000000'\n          },\n          classes: [blockerClass]\n        },\n        events: blockerEvents\n      }));\n    };\n\n    var SnapSchema = optionObjOf('snaps', [\n      required$1('getSnapPoints'),\n      onHandler('onSensor'),\n      required$1('leftAttr'),\n      required$1('topAttr'),\n      defaulted('lazyViewport', win),\n      defaulted('mustSnap', false)\n    ]);\n\n    var schema$6 = [\n      defaulted('useFixed', never),\n      required$1('blockerClass'),\n      defaulted('getTarget', identity$1),\n      defaulted('onDrag', noop),\n      defaulted('repositionTarget', true),\n      defaulted('onDrop', noop),\n      defaultedFunction('getBounds', win),\n      SnapSchema\n    ];\n\n    var getCurrentCoord = function (target) {\n      return lift3(getRaw(target, 'left'), getRaw(target, 'top'), getRaw(target, 'position'), function (left, top, position) {\n        var nu = position === 'fixed' ? fixed : offset;\n        return nu(parseInt(left, 10), parseInt(top, 10));\n      }).getOrThunk(function () {\n        var location = absolute$3(target);\n        return absolute(location.left, location.top);\n      });\n    };\n    var clampCoords = function (component, coords, scroll, origin, startData) {\n      var bounds = startData.bounds;\n      var absoluteCoord = asAbsolute(coords, scroll, origin);\n      var newX = clamp$1(absoluteCoord.left, bounds.x, bounds.x + bounds.width - startData.width);\n      var newY = clamp$1(absoluteCoord.top, bounds.y, bounds.y + bounds.height - startData.height);\n      var newCoords = absolute(newX, newY);\n      return coords.fold(function () {\n        var offset$1 = asOffset(newCoords, scroll, origin);\n        return offset(offset$1.left, offset$1.top);\n      }, constant$1(newCoords), function () {\n        var fixed$1 = asFixed(newCoords, scroll, origin);\n        return fixed(fixed$1.left, fixed$1.top);\n      });\n    };\n    var calcNewCoord = function (component, optSnaps, currentCoord, scroll, origin, delta, startData) {\n      var newCoord = optSnaps.fold(function () {\n        var translated = translate(currentCoord, delta.left, delta.top);\n        var fixedCoord = asFixed(translated, scroll, origin);\n        return fixed(fixedCoord.left, fixedCoord.top);\n      }, function (snapInfo) {\n        var snapping = moveOrSnap(component, snapInfo, currentCoord, delta, scroll, origin);\n        snapping.extra.each(function (extra) {\n          snapInfo.onSensor(component, extra);\n        });\n        return snapping.coord;\n      });\n      return clampCoords(component, newCoord, scroll, origin, startData);\n    };\n    var dragBy = function (component, dragConfig, startData, delta) {\n      var target = dragConfig.getTarget(component.element);\n      if (dragConfig.repositionTarget) {\n        var doc = owner$4(component.element);\n        var scroll_1 = get$9(doc);\n        var origin_1 = getOrigin(target);\n        var currentCoord = getCurrentCoord(target);\n        var newCoord = calcNewCoord(component, dragConfig.snaps, currentCoord, scroll_1, origin_1, delta, startData);\n        var styles = toStyles(newCoord, scroll_1, origin_1);\n        setOptions(target, styles);\n      }\n      dragConfig.onDrag(component, target, delta);\n    };\n\n    var calcStartData = function (dragConfig, comp) {\n      return {\n        bounds: dragConfig.getBounds(),\n        height: getOuter$2(comp.element),\n        width: getOuter$1(comp.element)\n      };\n    };\n    var move = function (component, dragConfig, dragState, dragMode, event) {\n      var delta = dragState.update(dragMode, event);\n      var dragStartData = dragState.getStartData().getOrThunk(function () {\n        return calcStartData(dragConfig, component);\n      });\n      delta.each(function (dlt) {\n        dragBy(component, dragConfig, dragStartData, dlt);\n      });\n    };\n    var stop = function (component, blocker, dragConfig, dragState) {\n      blocker.each(discard);\n      dragConfig.snaps.each(function (snapInfo) {\n        stopDrag(component, snapInfo);\n      });\n      var target = dragConfig.getTarget(component.element);\n      dragState.reset();\n      dragConfig.onDrop(component, target);\n    };\n    var handlers = function (events) {\n      return function (dragConfig, dragState) {\n        var updateStartState = function (comp) {\n          dragState.setStartData(calcStartData(dragConfig, comp));\n        };\n        return derive$2(__spreadArray([run$1(windowScroll(), function (comp) {\n            dragState.getStartData().each(function () {\n              return updateStartState(comp);\n            });\n          })], events(dragConfig, dragState, updateStartState), true));\n      };\n    };\n\n    var init$2 = function (dragApi) {\n      return derive$2([\n        run$1(mousedown(), dragApi.forceDrop),\n        run$1(mouseup(), dragApi.drop),\n        run$1(mousemove(), function (comp, simulatedEvent) {\n          dragApi.move(simulatedEvent.event);\n        }),\n        run$1(mouseout(), dragApi.delayDrop)\n      ]);\n    };\n\n    var getData$1 = function (event) {\n      return Optional.from(SugarPosition(event.x, event.y));\n    };\n    var getDelta$1 = function (old, nu) {\n      return SugarPosition(nu.left - old.left, nu.top - old.top);\n    };\n\n    var MouseData = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        getData: getData$1,\n        getDelta: getDelta$1\n    });\n\n    var events$2 = function (dragConfig, dragState, updateStartState) {\n      return [run$1(mousedown(), function (component, simulatedEvent) {\n          var raw = simulatedEvent.event.raw;\n          if (raw.button !== 0) {\n            return;\n          }\n          simulatedEvent.stop();\n          var stop$1 = function () {\n            return stop(component, Optional.some(blocker), dragConfig, dragState);\n          };\n          var delayDrop = DelayedFunction(stop$1, 200);\n          var dragApi = {\n            drop: stop$1,\n            delayDrop: delayDrop.schedule,\n            forceDrop: stop$1,\n            move: function (event) {\n              delayDrop.cancel();\n              move(component, dragConfig, dragState, MouseData, event);\n            }\n          };\n          var blocker = createComponent(component, dragConfig.blockerClass, init$2(dragApi));\n          var start = function () {\n            updateStartState(component);\n            instigate(component, blocker);\n          };\n          start();\n        })];\n    };\n    var schema$5 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events$2) })], false);\n\n    var init$1 = function (dragApi) {\n      return derive$2([\n        run$1(touchstart(), dragApi.forceDrop),\n        run$1(touchend(), dragApi.drop),\n        run$1(touchcancel(), dragApi.drop),\n        run$1(touchmove(), function (comp, simulatedEvent) {\n          dragApi.move(simulatedEvent.event);\n        })\n      ]);\n    };\n\n    var getDataFrom = function (touches) {\n      var touch = touches[0];\n      return Optional.some(SugarPosition(touch.clientX, touch.clientY));\n    };\n    var getData = function (event) {\n      var raw = event.raw;\n      var touches = raw.touches;\n      return touches.length === 1 ? getDataFrom(touches) : Optional.none();\n    };\n    var getDelta = function (old, nu) {\n      return SugarPosition(nu.left - old.left, nu.top - old.top);\n    };\n\n    var TouchData = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        getData: getData,\n        getDelta: getDelta\n    });\n\n    var events$1 = function (dragConfig, dragState, updateStartState) {\n      var blockerSingleton = value$1();\n      var stopBlocking = function (component) {\n        stop(component, blockerSingleton.get(), dragConfig, dragState);\n        blockerSingleton.clear();\n      };\n      return [\n        run$1(touchstart(), function (component, simulatedEvent) {\n          simulatedEvent.stop();\n          var stop = function () {\n            return stopBlocking(component);\n          };\n          var dragApi = {\n            drop: stop,\n            delayDrop: noop,\n            forceDrop: stop,\n            move: function (event) {\n              move(component, dragConfig, dragState, TouchData, event);\n            }\n          };\n          var blocker = createComponent(component, dragConfig.blockerClass, init$1(dragApi));\n          blockerSingleton.set(blocker);\n          var start = function () {\n            updateStartState(component);\n            instigate(component, blocker);\n          };\n          start();\n        }),\n        run$1(touchmove(), function (component, simulatedEvent) {\n          simulatedEvent.stop();\n          move(component, dragConfig, dragState, TouchData, simulatedEvent.event);\n        }),\n        run$1(touchend(), function (component, simulatedEvent) {\n          simulatedEvent.stop();\n          stopBlocking(component);\n        }),\n        run$1(touchcancel(), stopBlocking)\n      ];\n    };\n    var schema$4 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events$1) })], false);\n\n    var events = function (dragConfig, dragState, updateStartState) {\n      return __spreadArray(__spreadArray([], events$2(dragConfig, dragState, updateStartState), true), events$1(dragConfig, dragState, updateStartState), true);\n    };\n    var schema$3 = __spreadArray(__spreadArray([], schema$6, true), [output$1('dragger', { handlers: handlers(events) })], false);\n\n    var mouse = schema$5;\n    var touch = schema$4;\n    var mouseOrTouch = schema$3;\n\n    var DraggingBranches = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        mouse: mouse,\n        touch: touch,\n        mouseOrTouch: mouseOrTouch\n    });\n\n    var init = function () {\n      var previous = Optional.none();\n      var startData = Optional.none();\n      var reset = function () {\n        previous = Optional.none();\n        startData = Optional.none();\n      };\n      var calculateDelta = function (mode, nu) {\n        var result = previous.map(function (old) {\n          return mode.getDelta(old, nu);\n        });\n        previous = Optional.some(nu);\n        return result;\n      };\n      var update = function (mode, dragEvent) {\n        return mode.getData(dragEvent).bind(function (nuData) {\n          return calculateDelta(mode, nuData);\n        });\n      };\n      var setStartData = function (data) {\n        startData = Optional.some(data);\n      };\n      var getStartData = function () {\n        return startData;\n      };\n      var readState = constant$1({});\n      return nu$8({\n        readState: readState,\n        reset: reset,\n        update: update,\n        getStartData: getStartData,\n        setStartData: setStartData\n      });\n    };\n\n    var DragState = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        init: init\n    });\n\n    var Dragging = createModes({\n      branchKey: 'mode',\n      branches: DraggingBranches,\n      name: 'dragging',\n      active: {\n        events: function (dragConfig, dragState) {\n          var dragger = dragConfig.dragger;\n          return dragger.handlers(dragConfig, dragState);\n        }\n      },\n      extra: {\n        snap: function (sConfig) {\n          return {\n            sensor: sConfig.sensor,\n            range: sConfig.range,\n            output: sConfig.output,\n            extra: Optional.from(sConfig.extra)\n          };\n        }\n      },\n      state: DragState,\n      apis: DraggingApis\n    });\n\n    var snapWidth = 40;\n    var snapOffset = snapWidth / 2;\n    var calcSnap = function (selectorOpt, td, x, y, width, height) {\n      return selectorOpt.fold(function () {\n        return Dragging.snap({\n          sensor: absolute(x - snapOffset, y - snapOffset),\n          range: SugarPosition(width, height),\n          output: absolute(Optional.some(x), Optional.some(y)),\n          extra: { td: td }\n        });\n      }, function (selectorHandle) {\n        var sensorLeft = x - snapOffset;\n        var sensorTop = y - snapOffset;\n        var sensorWidth = snapWidth;\n        var sensorHeight = snapWidth;\n        var rect = selectorHandle.element.dom.getBoundingClientRect();\n        return Dragging.snap({\n          sensor: absolute(sensorLeft, sensorTop),\n          range: SugarPosition(sensorWidth, sensorHeight),\n          output: absolute(Optional.some(x - rect.width / 2), Optional.some(y - rect.height / 2)),\n          extra: { td: td }\n        });\n      });\n    };\n    var getSnapsConfig = function (getSnapPoints, cell, onChange) {\n      var isSameCell = function (cellOpt, td) {\n        return cellOpt.exists(function (currentTd) {\n          return eq(currentTd, td);\n        });\n      };\n      return {\n        getSnapPoints: getSnapPoints,\n        leftAttr: 'data-drag-left',\n        topAttr: 'data-drag-top',\n        onSensor: function (component, extra) {\n          var td = extra.td;\n          if (!isSameCell(cell.get(), td)) {\n            cell.set(td);\n            onChange(td);\n          }\n        },\n        mustSnap: true\n      };\n    };\n    var createSelector = function (snaps) {\n      return record(Button.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-selector']\n        },\n        buttonBehaviours: derive$1([\n          Dragging.config({\n            mode: 'mouseOrTouch',\n            blockerClass: 'blocker',\n            snaps: snaps\n          }),\n          Unselecting.config({})\n        ]),\n        eventOrder: {\n          mousedown: [\n            'dragging',\n            'alloy.base.behaviour'\n          ],\n          touchstart: [\n            'dragging',\n            'alloy.base.behaviour'\n          ]\n        }\n      }));\n    };\n    var setup$4 = function (editor, sink) {\n      var tlTds = Cell([]);\n      var brTds = Cell([]);\n      var isVisible = Cell(false);\n      var startCell = value$1();\n      var finishCell = value$1();\n      var getTopLeftSnap = function (td) {\n        var box = absolute$2(td);\n        return calcSnap(memTopLeft.getOpt(sink), td, box.x, box.y, box.width, box.height);\n      };\n      var getTopLeftSnaps = function () {\n        return map$2(tlTds.get(), function (td) {\n          return getTopLeftSnap(td);\n        });\n      };\n      var getBottomRightSnap = function (td) {\n        var box = absolute$2(td);\n        return calcSnap(memBottomRight.getOpt(sink), td, box.right, box.bottom, box.width, box.height);\n      };\n      var getBottomRightSnaps = function () {\n        return map$2(brTds.get(), function (td) {\n          return getBottomRightSnap(td);\n        });\n      };\n      var topLeftSnaps = getSnapsConfig(getTopLeftSnaps, startCell, function (start) {\n        finishCell.get().each(function (finish) {\n          editor.fire('TableSelectorChange', {\n            start: start,\n            finish: finish\n          });\n        });\n      });\n      var bottomRightSnaps = getSnapsConfig(getBottomRightSnaps, finishCell, function (finish) {\n        startCell.get().each(function (start) {\n          editor.fire('TableSelectorChange', {\n            start: start,\n            finish: finish\n          });\n        });\n      });\n      var memTopLeft = createSelector(topLeftSnaps);\n      var memBottomRight = createSelector(bottomRightSnaps);\n      var topLeft = build$1(memTopLeft.asSpec());\n      var bottomRight = build$1(memBottomRight.asSpec());\n      var showOrHideHandle = function (selector, cell, isAbove, isBelow) {\n        var cellRect = cell.dom.getBoundingClientRect();\n        remove$6(selector.element, 'display');\n        var viewportHeight = defaultView(SugarElement.fromDom(editor.getBody())).dom.innerHeight;\n        var aboveViewport = isAbove(cellRect);\n        var belowViewport = isBelow(cellRect, viewportHeight);\n        if (aboveViewport || belowViewport) {\n          set$7(selector.element, 'display', 'none');\n        }\n      };\n      var snapTo = function (selector, cell, getSnapConfig, pos) {\n        var snap = getSnapConfig(cell);\n        Dragging.snapTo(selector, snap);\n        var isAbove = function (rect) {\n          return rect[pos] < 0;\n        };\n        var isBelow = function (rect, viewportHeight) {\n          return rect[pos] > viewportHeight;\n        };\n        showOrHideHandle(selector, cell, isAbove, isBelow);\n      };\n      var snapTopLeft = function (cell) {\n        return snapTo(topLeft, cell, getTopLeftSnap, 'top');\n      };\n      var snapLastTopLeft = function () {\n        return startCell.get().each(snapTopLeft);\n      };\n      var snapBottomRight = function (cell) {\n        return snapTo(bottomRight, cell, getBottomRightSnap, 'bottom');\n      };\n      var snapLastBottomRight = function () {\n        return finishCell.get().each(snapBottomRight);\n      };\n      if (detect$1().deviceType.isTouch()) {\n        editor.on('TableSelectionChange', function (e) {\n          if (!isVisible.get()) {\n            attach(sink, topLeft);\n            attach(sink, bottomRight);\n            isVisible.set(true);\n          }\n          startCell.set(e.start);\n          finishCell.set(e.finish);\n          e.otherCells.each(function (otherCells) {\n            tlTds.set(otherCells.upOrLeftCells);\n            brTds.set(otherCells.downOrRightCells);\n            snapTopLeft(e.start);\n            snapBottomRight(e.finish);\n          });\n        });\n        editor.on('ResizeEditor ResizeWindow ScrollContent', function () {\n          snapLastTopLeft();\n          snapLastBottomRight();\n        });\n        editor.on('TableSelectionClear', function () {\n          if (isVisible.get()) {\n            detach(topLeft);\n            detach(bottomRight);\n            isVisible.set(false);\n          }\n          startCell.clear();\n          finishCell.clear();\n        });\n      }\n    };\n\n    var isHidden = function (elm) {\n      if (elm.nodeType === 1) {\n        if (elm.nodeName === 'BR' || !!elm.getAttribute('data-mce-bogus')) {\n          return true;\n        }\n        if (elm.getAttribute('data-mce-type') === 'bookmark') {\n          return true;\n        }\n      }\n      return false;\n    };\n    var renderElementPath = function (editor, settings, providersBackstage) {\n      if (!settings.delimiter) {\n        settings.delimiter = '\\xBB';\n      }\n      var getDataPath = function (data) {\n        var parts = data || [];\n        var newPathElements = map$2(parts, function (part, index) {\n          return Button.sketch({\n            dom: {\n              tag: 'div',\n              classes: ['tox-statusbar__path-item'],\n              attributes: {\n                'role': 'button',\n                'data-index': index,\n                'tab-index': -1,\n                'aria-level': index + 1\n              },\n              innerHtml: part.name\n            },\n            action: function (_btn) {\n              editor.focus();\n              editor.selection.select(part.element);\n              editor.nodeChanged();\n            },\n            buttonBehaviours: derive$1([\n              DisablingConfigs.button(providersBackstage.isDisabled),\n              receivingConfig()\n            ])\n          });\n        });\n        var divider = {\n          dom: {\n            tag: 'div',\n            classes: ['tox-statusbar__path-divider'],\n            attributes: { 'aria-hidden': true },\n            innerHtml: ' ' + settings.delimiter + ' '\n          }\n        };\n        return foldl(newPathElements.slice(1), function (acc, element) {\n          var newAcc = acc;\n          newAcc.push(divider);\n          newAcc.push(element);\n          return newAcc;\n        }, [newPathElements[0]]);\n      };\n      var updatePath = function (parents) {\n        var newPath = [];\n        var i = parents.length;\n        while (i-- > 0) {\n          var parent_1 = parents[i];\n          if (parent_1.nodeType === 1 && !isHidden(parent_1)) {\n            var args = editor.fire('ResolveName', {\n              name: parent_1.nodeName.toLowerCase(),\n              target: parent_1\n            });\n            if (!args.isDefaultPrevented()) {\n              newPath.push({\n                name: args.name,\n                element: parent_1\n              });\n            }\n            if (args.isPropagationStopped()) {\n              break;\n            }\n          }\n        }\n        return newPath;\n      };\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-statusbar__path'],\n          attributes: { role: 'navigation' }\n        },\n        behaviours: derive$1([\n          Keying.config({\n            mode: 'flow',\n            selector: 'div[role=button]'\n          }),\n          Disabling.config({ disabled: providersBackstage.isDisabled }),\n          receivingConfig(),\n          Tabstopping.config({}),\n          Replacing.config({}),\n          config('elementPathEvents', [runOnAttached(function (comp, _e) {\n              editor.shortcuts.add('alt+F11', 'focus statusbar elementpath', function () {\n                return Keying.focusIn(comp);\n              });\n              editor.on('NodeChange', function (e) {\n                var newPath = updatePath(e.parents);\n                if (newPath.length > 0) {\n                  Replacing.set(comp, getDataPath(newPath));\n                } else {\n                  Replacing.set(comp, []);\n                }\n              });\n            })])\n        ]),\n        components: []\n      };\n    };\n\n    var ResizeTypes;\n    (function (ResizeTypes) {\n      ResizeTypes[ResizeTypes['None'] = 0] = 'None';\n      ResizeTypes[ResizeTypes['Both'] = 1] = 'Both';\n      ResizeTypes[ResizeTypes['Vertical'] = 2] = 'Vertical';\n    }(ResizeTypes || (ResizeTypes = {})));\n    var getDimensions = function (editor, deltas, resizeType, originalHeight, originalWidth) {\n      var dimensions = {};\n      dimensions.height = calcCappedSize(originalHeight + deltas.top, getMinHeightSetting(editor), getMaxHeightSetting(editor));\n      if (resizeType === ResizeTypes.Both) {\n        dimensions.width = calcCappedSize(originalWidth + deltas.left, getMinWidthSetting(editor), getMaxWidthSetting(editor));\n      }\n      return dimensions;\n    };\n    var resize = function (editor, deltas, resizeType) {\n      var container = SugarElement.fromDom(editor.getContainer());\n      var dimensions = getDimensions(editor, deltas, resizeType, get$b(container), get$a(container));\n      each(dimensions, function (val, dim) {\n        return set$7(container, dim, numToPx(val));\n      });\n      fireResizeEditor(editor);\n    };\n\n    var getResizeType = function (editor) {\n      var fallback = !editor.hasPlugin('autoresize');\n      var resize = editor.getParam('resize', fallback);\n      if (resize === false) {\n        return ResizeTypes.None;\n      } else if (resize === 'both') {\n        return ResizeTypes.Both;\n      } else {\n        return ResizeTypes.Vertical;\n      }\n    };\n    var keyboardHandler = function (editor, resizeType, x, y) {\n      var scale = 20;\n      var delta = SugarPosition(x * scale, y * scale);\n      resize(editor, delta, resizeType);\n      return Optional.some(true);\n    };\n    var renderResizeHandler = function (editor, providersBackstage) {\n      var resizeType = getResizeType(editor);\n      if (resizeType === ResizeTypes.None) {\n        return Optional.none();\n      }\n      return Optional.some(render$3('resize-handle', {\n        tag: 'div',\n        classes: ['tox-statusbar__resize-handle'],\n        attributes: { title: providersBackstage.translate('Resize') },\n        behaviours: [\n          Dragging.config({\n            mode: 'mouse',\n            repositionTarget: false,\n            onDrag: function (_comp, _target, delta) {\n              return resize(editor, delta, resizeType);\n            },\n            blockerClass: 'tox-blocker'\n          }),\n          Keying.config({\n            mode: 'special',\n            onLeft: function () {\n              return keyboardHandler(editor, resizeType, -1, 0);\n            },\n            onRight: function () {\n              return keyboardHandler(editor, resizeType, 1, 0);\n            },\n            onUp: function () {\n              return keyboardHandler(editor, resizeType, 0, -1);\n            },\n            onDown: function () {\n              return keyboardHandler(editor, resizeType, 0, 1);\n            }\n          }),\n          Tabstopping.config({}),\n          Focusing.config({})\n        ]\n      }, providersBackstage.icons));\n    };\n\n    var renderWordCount = function (editor, providersBackstage) {\n      var _a;\n      var replaceCountText = function (comp, count, mode) {\n        return Replacing.set(comp, [text$1(providersBackstage.translate([\n            '{0} ' + mode,\n            count[mode]\n          ]))]);\n      };\n      return Button.sketch({\n        dom: {\n          tag: 'button',\n          classes: ['tox-statusbar__wordcount']\n        },\n        components: [],\n        buttonBehaviours: derive$1([\n          DisablingConfigs.button(providersBackstage.isDisabled),\n          receivingConfig(),\n          Tabstopping.config({}),\n          Replacing.config({}),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: {\n                mode: 'words',\n                count: {\n                  words: 0,\n                  characters: 0\n                }\n              }\n            }\n          }),\n          config('wordcount-events', [\n            runOnExecute$1(function (comp) {\n              var currentVal = Representing.getValue(comp);\n              var newMode = currentVal.mode === 'words' ? 'characters' : 'words';\n              Representing.setValue(comp, {\n                mode: newMode,\n                count: currentVal.count\n              });\n              replaceCountText(comp, currentVal.count, newMode);\n            }),\n            runOnAttached(function (comp) {\n              editor.on('wordCountUpdate', function (e) {\n                var mode = Representing.getValue(comp).mode;\n                Representing.setValue(comp, {\n                  mode: mode,\n                  count: e.wordCount\n                });\n                replaceCountText(comp, e.wordCount, mode);\n              });\n            })\n          ])\n        ]),\n        eventOrder: (_a = {}, _a[execute$5()] = [\n          'disabling',\n          'alloy.base.behaviour',\n          'wordcount-events'\n        ], _a)\n      });\n    };\n\n    var renderStatusbar = function (editor, providersBackstage) {\n      var renderBranding = function () {\n        var label = global$e.translate([\n          'Powered by {0}',\n          'Tiny'\n        ]);\n        var linkHtml = '<a href=\"https://www.tiny.cloud/?utm_campaign=editor_referral&amp;utm_medium=poweredby&amp;utm_source=tinymce&amp;utm_content=v5\" rel=\"noopener\" target=\"_blank\" tabindex=\"-1\" aria-label=\"' + label + '\">' + label + '</a>';\n        return {\n          dom: {\n            tag: 'span',\n            classes: ['tox-statusbar__branding'],\n            innerHtml: linkHtml\n          }\n        };\n      };\n      var getTextComponents = function () {\n        var components = [];\n        if (editor.getParam('elementpath', true, 'boolean')) {\n          components.push(renderElementPath(editor, {}, providersBackstage));\n        }\n        if (editor.hasPlugin('wordcount')) {\n          components.push(renderWordCount(editor, providersBackstage));\n        }\n        if (editor.getParam('branding', true, 'boolean')) {\n          components.push(renderBranding());\n        }\n        if (components.length > 0) {\n          return [{\n              dom: {\n                tag: 'div',\n                classes: ['tox-statusbar__text-container']\n              },\n              components: components\n            }];\n        }\n        return [];\n      };\n      var getComponents = function () {\n        var components = getTextComponents();\n        var resizeHandler = renderResizeHandler(editor, providersBackstage);\n        return components.concat(resizeHandler.toArray());\n      };\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-statusbar']\n        },\n        components: getComponents()\n      };\n    };\n\n    var setup$3 = function (editor) {\n      var _a;\n      var isInline = editor.inline;\n      var mode = isInline ? Inline : Iframe;\n      var header = isStickyToolbar(editor) ? StickyHeader : StaticHeader;\n      var lazyOuterContainer = Optional.none();\n      var platform = detect$1();\n      var isIE = platform.browser.isIE();\n      var platformClasses = isIE ? ['tox-platform-ie'] : [];\n      var isTouch = platform.deviceType.isTouch();\n      var touchPlatformClass = 'tox-platform-touch';\n      var deviceClasses = isTouch ? [touchPlatformClass] : [];\n      var isToolbarBottom = isToolbarLocationBottom(editor);\n      var uiContainer = getUiContainer(editor);\n      var dirAttributes = global$e.isRtl() ? { attributes: { dir: 'rtl' } } : {};\n      var verticalDirAttributes = { attributes: (_a = {}, _a[Attribute] = isToolbarBottom ? AttributeValue.BottomToTop : AttributeValue.TopToBottom, _a) };\n      var lazyHeader = function () {\n        return lazyOuterContainer.bind(OuterContainer.getHeader);\n      };\n      var isHeaderDocked = function () {\n        return header.isDocked(lazyHeader);\n      };\n      var resizeUiMothership = function () {\n        set$7(uiMothership.element, 'width', document.body.clientWidth + 'px');\n      };\n      var makeSinkDefinition = function () {\n        var isGridUiContainer = eq(body(), uiContainer) && get$c(uiContainer, 'display') === 'grid';\n        var sinkSpec = {\n          dom: __assign({\n            tag: 'div',\n            classes: [\n              'tox',\n              'tox-silver-sink',\n              'tox-tinymce-aux'\n            ].concat(platformClasses).concat(deviceClasses)\n          }, dirAttributes),\n          behaviours: derive$1([Positioning.config({\n              useFixed: function () {\n                return isHeaderDocked();\n              }\n            })])\n        };\n        var reactiveWidthSpec = {\n          dom: { styles: { width: document.body.clientWidth + 'px' } },\n          events: derive$2([run$1(windowResize(), resizeUiMothership)])\n        };\n        return deepMerge(sinkSpec, isGridUiContainer ? reactiveWidthSpec : {});\n      };\n      var sink = build$1(makeSinkDefinition());\n      var lazySink = function () {\n        return Result.value(sink);\n      };\n      var memAnchorBar = record({\n        dom: {\n          tag: 'div',\n          classes: ['tox-anchorbar']\n        }\n      });\n      var lazyAnchorBar = function () {\n        return lazyOuterContainer.bind(function (container) {\n          return memAnchorBar.getOpt(container);\n        }).getOrDie('Could not find a anchor bar element');\n      };\n      var lazyToolbar = function () {\n        return lazyOuterContainer.bind(function (container) {\n          return OuterContainer.getToolbar(container);\n        }).getOrDie('Could not find more toolbar element');\n      };\n      var lazyThrobber = function () {\n        return lazyOuterContainer.bind(function (container) {\n          return OuterContainer.getThrobber(container);\n        }).getOrDie('Could not find throbber element');\n      };\n      var backstage = init$7(sink, editor, lazyAnchorBar);\n      var partMenubar = OuterContainer.parts.menubar({\n        dom: {\n          tag: 'div',\n          classes: ['tox-menubar']\n        },\n        backstage: backstage,\n        onEscape: function () {\n          editor.focus();\n        }\n      });\n      var toolbarMode = getToolbarMode(editor);\n      var partToolbar = OuterContainer.parts.toolbar(__assign({\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar']\n        },\n        getSink: lazySink,\n        providers: backstage.shared.providers,\n        onEscape: function () {\n          editor.focus();\n        },\n        type: toolbarMode,\n        lazyToolbar: lazyToolbar,\n        lazyHeader: function () {\n          return lazyHeader().getOrDie('Could not find header element');\n        }\n      }, verticalDirAttributes));\n      var partMultipleToolbar = OuterContainer.parts['multiple-toolbar']({\n        dom: {\n          tag: 'div',\n          classes: ['tox-toolbar-overlord']\n        },\n        providers: backstage.shared.providers,\n        onEscape: function () {\n          editor.focus();\n        },\n        type: toolbarMode\n      });\n      var partSocket = OuterContainer.parts.socket({\n        dom: {\n          tag: 'div',\n          classes: ['tox-edit-area']\n        }\n      });\n      var partSidebar = OuterContainer.parts.sidebar({\n        dom: {\n          tag: 'div',\n          classes: ['tox-sidebar']\n        }\n      });\n      var partThrobber = OuterContainer.parts.throbber({\n        dom: {\n          tag: 'div',\n          classes: ['tox-throbber']\n        },\n        backstage: backstage\n      });\n      var sb = editor.getParam('statusbar', true, 'boolean');\n      var statusbar = sb && !isInline ? Optional.some(renderStatusbar(editor, backstage.shared.providers)) : Optional.none();\n      var socketSidebarContainer = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-sidebar-wrap']\n        },\n        components: [\n          partSocket,\n          partSidebar\n        ]\n      };\n      var hasMultipleToolbar = isMultipleToolbars(editor);\n      var hasToolbar = isToolbarEnabled(editor);\n      var hasMenubar = isMenubarEnabled(editor);\n      var getPartToolbar = function () {\n        if (hasMultipleToolbar) {\n          return [partMultipleToolbar];\n        } else if (hasToolbar) {\n          return [partToolbar];\n        } else {\n          return [];\n        }\n      };\n      var partHeader = OuterContainer.parts.header({\n        dom: __assign({\n          tag: 'div',\n          classes: ['tox-editor-header']\n        }, verticalDirAttributes),\n        components: flatten([\n          hasMenubar ? [partMenubar] : [],\n          getPartToolbar(),\n          useFixedContainer(editor) ? [] : [memAnchorBar.asSpec()]\n        ]),\n        sticky: isStickyToolbar(editor),\n        editor: editor,\n        sharedBackstage: backstage.shared\n      });\n      var editorComponents = flatten([\n        isToolbarBottom ? [] : [partHeader],\n        isInline ? [] : [socketSidebarContainer],\n        isToolbarBottom ? [partHeader] : []\n      ]);\n      var editorContainer = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-editor-container']\n        },\n        components: editorComponents\n      };\n      var containerComponents = flatten([\n        [editorContainer],\n        isInline ? [] : statusbar.toArray(),\n        [partThrobber]\n      ]);\n      var isHidden = isDistractionFree(editor);\n      var attributes = __assign(__assign({ role: 'application' }, global$e.isRtl() ? { dir: 'rtl' } : {}), isHidden ? { 'aria-hidden': 'true' } : {});\n      var outerContainer = build$1(OuterContainer.sketch({\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox',\n            'tox-tinymce'\n          ].concat(isInline ? ['tox-tinymce-inline'] : []).concat(isToolbarBottom ? ['tox-tinymce--toolbar-bottom'] : []).concat(deviceClasses).concat(platformClasses),\n          styles: __assign({ visibility: 'hidden' }, isHidden ? {\n            opacity: '0',\n            border: '0'\n          } : {}),\n          attributes: attributes\n        },\n        components: containerComponents,\n        behaviours: derive$1([\n          receivingConfig(),\n          Disabling.config({ disableClass: 'tox-tinymce--disabled' }),\n          Keying.config({\n            mode: 'cyclic',\n            selector: '.tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle'\n          })\n        ])\n      }));\n      lazyOuterContainer = Optional.some(outerContainer);\n      editor.shortcuts.add('alt+F9', 'focus menubar', function () {\n        OuterContainer.focusMenubar(outerContainer);\n      });\n      editor.shortcuts.add('alt+F10', 'focus toolbar', function () {\n        OuterContainer.focusToolbar(outerContainer);\n      });\n      editor.addCommand('ToggleToolbarDrawer', function () {\n        OuterContainer.toggleToolbarDrawer(outerContainer);\n      });\n      editor.addQueryStateHandler('ToggleToolbarDrawer', function () {\n        return OuterContainer.isToolbarDrawerToggled(outerContainer);\n      });\n      var mothership = takeover(outerContainer);\n      var uiMothership = takeover(sink);\n      setup$b(editor, mothership, uiMothership);\n      var getUi = function () {\n        var channels = {\n          broadcastAll: uiMothership.broadcast,\n          broadcastOn: uiMothership.broadcastOn,\n          register: noop\n        };\n        return { channels: channels };\n      };\n      var setEditorSize = function () {\n        var parsedHeight = numToPx(getHeightWithFallback(editor));\n        var parsedWidth = numToPx(getWidthWithFallback(editor));\n        if (!editor.inline) {\n          if (isValidValue('div', 'width', parsedWidth)) {\n            set$7(outerContainer.element, 'width', parsedWidth);\n          }\n          if (isValidValue('div', 'height', parsedHeight)) {\n            set$7(outerContainer.element, 'height', parsedHeight);\n          } else {\n            set$7(outerContainer.element, 'height', '200px');\n          }\n        }\n        return parsedHeight;\n      };\n      var renderUI = function () {\n        header.setup(editor, backstage.shared, lazyHeader);\n        setup$6(editor, backstage);\n        setup$5(editor, lazySink, backstage);\n        setup$8(editor);\n        setup$7(editor, lazyThrobber, backstage.shared);\n        map$1(getToolbarGroups(editor), function (toolbarGroupButtonConfig, name) {\n          editor.ui.registry.addGroupToolbarButton(name, toolbarGroupButtonConfig);\n        });\n        var _a = editor.ui.registry.getAll(), buttons = _a.buttons, menuItems = _a.menuItems, contextToolbars = _a.contextToolbars, sidebars = _a.sidebars;\n        var toolbarOpt = getMultipleToolbarsSetting(editor);\n        var rawUiConfig = {\n          menuItems: menuItems,\n          menus: getMenus(editor),\n          menubar: getMenubar(editor),\n          toolbar: toolbarOpt.getOrThunk(function () {\n            return getToolbar(editor);\n          }),\n          allowToolbarGroups: toolbarMode === ToolbarMode.floating,\n          buttons: buttons,\n          sidebar: sidebars\n        };\n        register$7(editor, contextToolbars, sink, { backstage: backstage });\n        setup$4(editor, sink);\n        var elm = editor.getElement();\n        var height = setEditorSize();\n        var uiComponents = {\n          mothership: mothership,\n          uiMothership: uiMothership,\n          outerContainer: outerContainer\n        };\n        var args = {\n          targetNode: elm,\n          height: height\n        };\n        return mode.render(editor, uiComponents, rawUiConfig, backstage, args);\n      };\n      return {\n        mothership: mothership,\n        uiMothership: uiMothership,\n        backstage: backstage,\n        renderUI: renderUI,\n        getUi: getUi\n      };\n    };\n\n    var describedBy = function (describedElement, describeElement) {\n      var describeId = Optional.from(get$d(describedElement, 'id')).fold(function () {\n        var id = generate$6('dialog-describe');\n        set$8(describeElement, 'id', id);\n        return id;\n      }, identity$1);\n      set$8(describedElement, 'aria-describedby', describeId);\n    };\n\n    var labelledBy = function (labelledElement, labelElement) {\n      var labelId = getOpt(labelledElement, 'id').fold(function () {\n        var id = generate$6('dialog-label');\n        set$8(labelElement, 'id', id);\n        return id;\n      }, identity$1);\n      set$8(labelledElement, 'aria-labelledby', labelId);\n    };\n\n    var schema$2 = constant$1([\n      required$1('lazySink'),\n      option('dragBlockClass'),\n      defaultedFunction('getBounds', win),\n      defaulted('useTabstopAt', always),\n      defaulted('eventOrder', {}),\n      field('modalBehaviours', [Keying]),\n      onKeyboardHandler('onExecute'),\n      onStrictKeyboardHandler('onEscape')\n    ]);\n    var basic = { sketch: identity$1 };\n    var parts$2 = constant$1([\n      optional({\n        name: 'draghandle',\n        overrides: function (detail, spec) {\n          return {\n            behaviours: derive$1([Dragging.config({\n                mode: 'mouse',\n                getTarget: function (handle) {\n                  return ancestor(handle, '[role=\"dialog\"]').getOr(handle);\n                },\n                blockerClass: detail.dragBlockClass.getOrDie(new Error('The drag blocker class was not specified for a dialog with a drag handle: \\n' + JSON.stringify(spec, null, 2)).message),\n                getBounds: detail.getDragBounds\n              })])\n          };\n        }\n      }),\n      required({\n        schema: [required$1('dom')],\n        name: 'title'\n      }),\n      required({\n        factory: basic,\n        schema: [required$1('dom')],\n        name: 'close'\n      }),\n      required({\n        factory: basic,\n        schema: [required$1('dom')],\n        name: 'body'\n      }),\n      optional({\n        factory: basic,\n        schema: [required$1('dom')],\n        name: 'footer'\n      }),\n      external$1({\n        factory: {\n          sketch: function (spec, detail) {\n            return __assign(__assign({}, spec), {\n              dom: detail.dom,\n              components: detail.components\n            });\n          }\n        },\n        schema: [\n          defaulted('dom', {\n            tag: 'div',\n            styles: {\n              position: 'fixed',\n              left: '0px',\n              top: '0px',\n              right: '0px',\n              bottom: '0px'\n            }\n          }),\n          defaulted('components', [])\n        ],\n        name: 'blocker'\n      })\n    ]);\n\n    var factory$4 = function (detail, components, spec, externals) {\n      var _a;\n      var dialogComp = value$1();\n      var showDialog = function (dialog) {\n        dialogComp.set(dialog);\n        var sink = detail.lazySink(dialog).getOrDie();\n        var externalBlocker = externals.blocker();\n        var blocker = sink.getSystem().build(__assign(__assign({}, externalBlocker), {\n          components: externalBlocker.components.concat([premade(dialog)]),\n          behaviours: derive$1([\n            Focusing.config({}),\n            config('dialog-blocker-events', [runOnSource(focusin(), function () {\n                Keying.focusIn(dialog);\n              })])\n          ])\n        }));\n        attach(sink, blocker);\n        Keying.focusIn(dialog);\n      };\n      var hideDialog = function (dialog) {\n        dialogComp.clear();\n        parent(dialog.element).each(function (blockerDom) {\n          dialog.getSystem().getByDom(blockerDom).each(function (blocker) {\n            detach(blocker);\n          });\n        });\n      };\n      var getDialogBody = function (dialog) {\n        return getPartOrDie(dialog, detail, 'body');\n      };\n      var getDialogFooter = function (dialog) {\n        return getPartOrDie(dialog, detail, 'footer');\n      };\n      var setBusy = function (dialog, getBusySpec) {\n        Blocking.block(dialog, getBusySpec);\n      };\n      var setIdle = function (dialog) {\n        Blocking.unblock(dialog);\n      };\n      var modalEventsId = generate$6('modal-events');\n      var eventOrder = __assign(__assign({}, detail.eventOrder), (_a = {}, _a[attachedToDom()] = [modalEventsId].concat(detail.eventOrder['alloy.system.attached'] || []), _a));\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        apis: {\n          show: showDialog,\n          hide: hideDialog,\n          getBody: getDialogBody,\n          getFooter: getDialogFooter,\n          setIdle: setIdle,\n          setBusy: setBusy\n        },\n        eventOrder: eventOrder,\n        domModification: {\n          attributes: {\n            'role': 'dialog',\n            'aria-modal': 'true'\n          }\n        },\n        behaviours: augment(detail.modalBehaviours, [\n          Replacing.config({}),\n          Keying.config({\n            mode: 'cyclic',\n            onEnter: detail.onExecute,\n            onEscape: detail.onEscape,\n            useTabstopAt: detail.useTabstopAt\n          }),\n          Blocking.config({ getRoot: dialogComp.get }),\n          config(modalEventsId, [runOnAttached(function (c) {\n              labelledBy(c.element, getPartOrDie(c, detail, 'title').element);\n              describedBy(c.element, getPartOrDie(c, detail, 'body').element);\n            })])\n        ])\n      };\n    };\n    var ModalDialog = composite({\n      name: 'ModalDialog',\n      configFields: schema$2(),\n      partFields: parts$2(),\n      factory: factory$4,\n      apis: {\n        show: function (apis, dialog) {\n          apis.show(dialog);\n        },\n        hide: function (apis, dialog) {\n          apis.hide(dialog);\n        },\n        getBody: function (apis, dialog) {\n          return apis.getBody(dialog);\n        },\n        getFooter: function (apis, dialog) {\n          return apis.getFooter(dialog);\n        },\n        setBusy: function (apis, dialog, getBusySpec) {\n          apis.setBusy(dialog, getBusySpec);\n        },\n        setIdle: function (apis, dialog) {\n          apis.setIdle(dialog);\n        }\n      }\n    });\n\n    var dialogToggleMenuItemSchema = objOf([\n      requiredString('type'),\n      requiredString('name')\n    ].concat(commonMenuItemFields));\n    var dialogToggleMenuItemDataProcessor = boolean;\n\n    var baseFooterButtonFields = [\n      field$1('name', 'name', defaultedThunk(function () {\n        return generate$6('button-name');\n      }), string),\n      optionString('icon'),\n      defaultedStringEnum('align', 'end', [\n        'start',\n        'end'\n      ]),\n      defaultedBoolean('primary', false),\n      defaultedBoolean('disabled', false)\n    ];\n    var dialogFooterButtonFields = __spreadArray(__spreadArray([], baseFooterButtonFields, true), [requiredString('text')], false);\n    var normalFooterButtonFields = __spreadArray([requiredStringEnum('type', [\n        'submit',\n        'cancel',\n        'custom'\n      ])], dialogFooterButtonFields, true);\n    var menuFooterButtonFields = __spreadArray([\n      requiredStringEnum('type', ['menu']),\n      optionString('text'),\n      optionString('tooltip'),\n      optionString('icon'),\n      requiredArrayOf('items', dialogToggleMenuItemSchema)\n    ], baseFooterButtonFields, true);\n    var dialogFooterButtonSchema = choose$1('type', {\n      submit: normalFooterButtonFields,\n      cancel: normalFooterButtonFields,\n      custom: normalFooterButtonFields,\n      menu: menuFooterButtonFields\n    });\n\n    var alertBannerFields = [\n      requiredString('type'),\n      requiredString('text'),\n      requiredStringEnum('level', [\n        'info',\n        'warn',\n        'error',\n        'success'\n      ]),\n      requiredString('icon'),\n      defaulted('url', '')\n    ];\n    var alertBannerSchema = objOf(alertBannerFields);\n\n    var createBarFields = function (itemsField) {\n      return [\n        requiredString('type'),\n        itemsField\n      ];\n    };\n\n    var buttonFields = [\n      requiredString('type'),\n      requiredString('text'),\n      defaultedBoolean('disabled', false),\n      defaultedBoolean('primary', false),\n      field$1('name', 'name', defaultedThunk(function () {\n        return generate$6('button-name');\n      }), string),\n      optionString('icon'),\n      defaultedBoolean('borderless', false)\n    ];\n    var buttonSchema = objOf(buttonFields);\n\n    var checkboxFields = [\n      requiredString('type'),\n      requiredString('name'),\n      requiredString('label'),\n      defaultedBoolean('disabled', false)\n    ];\n    var checkboxSchema = objOf(checkboxFields);\n    var checkboxDataProcessor = boolean;\n\n    var formComponentFields = [\n      requiredString('type'),\n      requiredString('name')\n    ];\n    var formComponentWithLabelFields = formComponentFields.concat([optionString('label')]);\n\n    var collectionFields = formComponentWithLabelFields.concat([defaulted('columns', 'auto')]);\n    var collectionSchema = objOf(collectionFields);\n    var collectionDataProcessor = arrOfObj([\n      requiredString('value'),\n      requiredString('text'),\n      requiredString('icon')\n    ]);\n\n    var colorInputFields = formComponentWithLabelFields;\n    var colorInputSchema = objOf(colorInputFields);\n    var colorInputDataProcessor = string;\n\n    var colorPickerFields = formComponentWithLabelFields;\n    var colorPickerSchema = objOf(colorPickerFields);\n    var colorPickerDataProcessor = string;\n\n    var customEditorFields = formComponentFields.concat([\n      defaultedString('tag', 'textarea'),\n      requiredString('scriptId'),\n      requiredString('scriptUrl'),\n      defaultedPostMsg('settings', undefined)\n    ]);\n    var customEditorFieldsOld = formComponentFields.concat([\n      defaultedString('tag', 'textarea'),\n      requiredFunction('init')\n    ]);\n    var customEditorSchema = valueOf(function (v) {\n      return asRaw('customeditor.old', objOfOnly(customEditorFieldsOld), v).orThunk(function () {\n        return asRaw('customeditor.new', objOfOnly(customEditorFields), v);\n      });\n    });\n    var customEditorDataProcessor = string;\n\n    var dropZoneFields = formComponentWithLabelFields;\n    var dropZoneSchema = objOf(dropZoneFields);\n    var dropZoneDataProcessor = arrOfVal();\n\n    var createGridFields = function (itemsField) {\n      return [\n        requiredString('type'),\n        requiredNumber('columns'),\n        itemsField\n      ];\n    };\n\n    var htmlPanelFields = [\n      requiredString('type'),\n      requiredString('html'),\n      defaultedStringEnum('presets', 'presentation', [\n        'presentation',\n        'document'\n      ])\n    ];\n    var htmlPanelSchema = objOf(htmlPanelFields);\n\n    var iframeFields = formComponentWithLabelFields.concat([defaultedBoolean('sandboxed', true)]);\n    var iframeSchema = objOf(iframeFields);\n    var iframeDataProcessor = string;\n\n    var imageToolsFields = formComponentWithLabelFields.concat([requiredOf('currentState', objOf([\n        required$1('blob'),\n        requiredString('url')\n      ]))]);\n    var imageToolsSchema = objOf(imageToolsFields);\n\n    var inputFields = formComponentWithLabelFields.concat([\n      optionString('inputMode'),\n      optionString('placeholder'),\n      defaultedBoolean('maximized', false),\n      defaultedBoolean('disabled', false)\n    ]);\n    var inputSchema = objOf(inputFields);\n    var inputDataProcessor = string;\n\n    var createLabelFields = function (itemsField) {\n      return [\n        requiredString('type'),\n        requiredString('label'),\n        itemsField\n      ];\n    };\n\n    var listBoxSingleItemFields = [\n      requiredString('text'),\n      requiredString('value')\n    ];\n    var listBoxNestedItemFields = [\n      requiredString('text'),\n      requiredArrayOf('items', thunkOf('items', function () {\n        return listBoxItemSchema;\n      }))\n    ];\n    var listBoxItemSchema = oneOf([\n      objOf(listBoxSingleItemFields),\n      objOf(listBoxNestedItemFields)\n    ]);\n    var listBoxFields = formComponentWithLabelFields.concat([\n      requiredArrayOf('items', listBoxItemSchema),\n      defaultedBoolean('disabled', false)\n    ]);\n    var listBoxSchema = objOf(listBoxFields);\n    var listBoxDataProcessor = string;\n\n    var selectBoxFields = formComponentWithLabelFields.concat([\n      requiredArrayOfObj('items', [\n        requiredString('text'),\n        requiredString('value')\n      ]),\n      defaultedNumber('size', 1),\n      defaultedBoolean('disabled', false)\n    ]);\n    var selectBoxSchema = objOf(selectBoxFields);\n    var selectBoxDataProcessor = string;\n\n    var sizeInputFields = formComponentWithLabelFields.concat([\n      defaultedBoolean('constrain', true),\n      defaultedBoolean('disabled', false)\n    ]);\n    var sizeInputSchema = objOf(sizeInputFields);\n    var sizeInputDataProcessor = objOf([\n      requiredString('width'),\n      requiredString('height')\n    ]);\n\n    var tableFields = [\n      requiredString('type'),\n      requiredArrayOf('header', string),\n      requiredArrayOf('cells', arrOf(string))\n    ];\n    var tableSchema = objOf(tableFields);\n\n    var textAreaFields = formComponentWithLabelFields.concat([\n      optionString('placeholder'),\n      defaultedBoolean('maximized', false),\n      defaultedBoolean('disabled', false)\n    ]);\n    var textAreaSchema = objOf(textAreaFields);\n    var textAreaDataProcessor = string;\n\n    var urlInputFields = formComponentWithLabelFields.concat([\n      defaultedStringEnum('filetype', 'file', [\n        'image',\n        'media',\n        'file'\n      ]),\n      defaulted('disabled', false)\n    ]);\n    var urlInputSchema = objOf(urlInputFields);\n    var urlInputDataProcessor = objOf([\n      requiredString('value'),\n      defaulted('meta', {})\n    ]);\n\n    var createItemsField = function (name) {\n      return field$1('items', 'items', required$2(), arrOf(valueOf(function (v) {\n        return asRaw('Checking item of ' + name, itemSchema, v).fold(function (sErr) {\n          return Result.error(formatError(sErr));\n        }, function (passValue) {\n          return Result.value(passValue);\n        });\n      })));\n    };\n    var itemSchema = valueThunk(function () {\n      return choose$2('type', {\n        alertbanner: alertBannerSchema,\n        bar: objOf(createBarFields(createItemsField('bar'))),\n        button: buttonSchema,\n        checkbox: checkboxSchema,\n        colorinput: colorInputSchema,\n        colorpicker: colorPickerSchema,\n        dropzone: dropZoneSchema,\n        grid: objOf(createGridFields(createItemsField('grid'))),\n        iframe: iframeSchema,\n        input: inputSchema,\n        listbox: listBoxSchema,\n        selectbox: selectBoxSchema,\n        sizeinput: sizeInputSchema,\n        textarea: textAreaSchema,\n        urlinput: urlInputSchema,\n        customeditor: customEditorSchema,\n        htmlpanel: htmlPanelSchema,\n        imagetools: imageToolsSchema,\n        collection: collectionSchema,\n        label: objOf(createLabelFields(createItemsField('label'))),\n        table: tableSchema,\n        panel: panelSchema\n      });\n    });\n    var panelFields = [\n      requiredString('type'),\n      defaulted('classes', []),\n      requiredArrayOf('items', itemSchema)\n    ];\n    var panelSchema = objOf(panelFields);\n\n    var tabFields = [\n      field$1('name', 'name', defaultedThunk(function () {\n        return generate$6('tab-name');\n      }), string),\n      requiredString('title'),\n      requiredArrayOf('items', itemSchema)\n    ];\n    var tabPanelFields = [\n      requiredString('type'),\n      requiredArrayOfObj('tabs', tabFields)\n    ];\n    var tabPanelSchema = objOf(tabPanelFields);\n\n    var dialogButtonFields = dialogFooterButtonFields;\n    var dialogButtonSchema = dialogFooterButtonSchema;\n    var dialogSchema = objOf([\n      requiredString('title'),\n      requiredOf('body', choose$2('type', {\n        panel: panelSchema,\n        tabpanel: tabPanelSchema\n      })),\n      defaultedString('size', 'normal'),\n      requiredArrayOf('buttons', dialogButtonSchema),\n      defaulted('initialData', {}),\n      defaultedFunction('onAction', noop),\n      defaultedFunction('onChange', noop),\n      defaultedFunction('onSubmit', noop),\n      defaultedFunction('onClose', noop),\n      defaultedFunction('onCancel', noop),\n      defaulted('onTabChange', noop)\n    ]);\n    var createDialog = function (spec) {\n      return asRaw('dialog', dialogSchema, spec);\n    };\n\n    var urlDialogButtonSchema = objOf(__spreadArray([requiredStringEnum('type', [\n        'cancel',\n        'custom'\n      ])], dialogButtonFields, true));\n    var urlDialogSchema = objOf([\n      requiredString('title'),\n      requiredString('url'),\n      optionNumber('height'),\n      optionNumber('width'),\n      optionArrayOf('buttons', urlDialogButtonSchema),\n      defaultedFunction('onAction', noop),\n      defaultedFunction('onCancel', noop),\n      defaultedFunction('onClose', noop),\n      defaultedFunction('onMessage', noop)\n    ]);\n    var createUrlDialog = function (spec) {\n      return asRaw('dialog', urlDialogSchema, spec);\n    };\n\n    var getAllObjects = function (obj) {\n      if (isObject(obj)) {\n        return [obj].concat(bind$3(values(obj), getAllObjects));\n      } else if (isArray(obj)) {\n        return bind$3(obj, getAllObjects);\n      } else {\n        return [];\n      }\n    };\n\n    var isNamedItem = function (obj) {\n      return isString(obj.type) && isString(obj.name);\n    };\n    var dataProcessors = {\n      checkbox: checkboxDataProcessor,\n      colorinput: colorInputDataProcessor,\n      colorpicker: colorPickerDataProcessor,\n      dropzone: dropZoneDataProcessor,\n      input: inputDataProcessor,\n      iframe: iframeDataProcessor,\n      sizeinput: sizeInputDataProcessor,\n      selectbox: selectBoxDataProcessor,\n      listbox: listBoxDataProcessor,\n      size: sizeInputDataProcessor,\n      textarea: textAreaDataProcessor,\n      urlinput: urlInputDataProcessor,\n      customeditor: customEditorDataProcessor,\n      collection: collectionDataProcessor,\n      togglemenuitem: dialogToggleMenuItemDataProcessor\n    };\n    var getDataProcessor = function (item) {\n      return Optional.from(dataProcessors[item.type]);\n    };\n    var getNamedItems = function (structure) {\n      return filter$2(getAllObjects(structure), isNamedItem);\n    };\n\n    var createDataValidator = function (structure) {\n      var namedItems = getNamedItems(structure);\n      var fields = bind$3(namedItems, function (item) {\n        return getDataProcessor(item).fold(function () {\n          return [];\n        }, function (schema) {\n          return [requiredOf(item.name, schema)];\n        });\n      });\n      return objOf(fields);\n    };\n\n    var extract = function (structure) {\n      var internalDialog = getOrDie(createDialog(structure));\n      var dataValidator = createDataValidator(structure);\n      var initialData = structure.initialData;\n      return {\n        internalDialog: internalDialog,\n        dataValidator: dataValidator,\n        initialData: initialData\n      };\n    };\n    var DialogManager = {\n      open: function (factory, structure) {\n        var extraction = extract(structure);\n        return factory(extraction.internalDialog, extraction.initialData, extraction.dataValidator);\n      },\n      openUrl: function (factory, structure) {\n        var internalDialog = getOrDie(createUrlDialog(structure));\n        return factory(internalDialog);\n      },\n      redial: function (structure) {\n        return extract(structure);\n      }\n    };\n\n    var toValidValues = function (values) {\n      var errors = [];\n      var result = {};\n      each(values, function (value, name) {\n        value.fold(function () {\n          errors.push(name);\n        }, function (v) {\n          result[name] = v;\n        });\n      });\n      return errors.length > 0 ? Result.error(errors) : Result.value(result);\n    };\n\n    var renderBodyPanel = function (spec, backstage) {\n      var memForm = record(Form.sketch(function (parts) {\n        return {\n          dom: {\n            tag: 'div',\n            classes: ['tox-form'].concat(spec.classes)\n          },\n          components: map$2(spec.items, function (item) {\n            return interpretInForm(parts, item, backstage);\n          })\n        };\n      }));\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__body']\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-dialog__body-content']\n            },\n            components: [memForm.asSpec()]\n          }],\n        behaviours: derive$1([\n          Keying.config({\n            mode: 'acyclic',\n            useTabstopAt: not(isPseudoStop)\n          }),\n          ComposingConfigs.memento(memForm),\n          RepresentingConfigs.memento(memForm, {\n            postprocess: function (formValue) {\n              return toValidValues(formValue).fold(function (err) {\n                console.error(err);\n                return {};\n              }, identity$1);\n            }\n          })\n        ])\n      };\n    };\n\n    var factory$3 = function (detail, _spec) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: detail.components,\n        events: events$a(detail.action),\n        behaviours: augment(detail.tabButtonBehaviours, [\n          Focusing.config({}),\n          Keying.config({\n            mode: 'execution',\n            useSpace: true,\n            useEnter: true\n          }),\n          Representing.config({\n            store: {\n              mode: 'memory',\n              initialValue: detail.value\n            }\n          })\n        ]),\n        domModification: detail.domModification\n      };\n    };\n    var TabButton = single({\n      name: 'TabButton',\n      configFields: [\n        defaulted('uid', undefined),\n        required$1('value'),\n        field$1('dom', 'dom', mergeWithThunk(function () {\n          return {\n            attributes: {\n              'role': 'tab',\n              'id': generate$6('aria'),\n              'aria-selected': 'false'\n            }\n          };\n        }), anyValue()),\n        option('action'),\n        defaulted('domModification', {}),\n        field('tabButtonBehaviours', [\n          Focusing,\n          Keying,\n          Representing\n        ]),\n        required$1('view')\n      ],\n      factory: factory$3\n    });\n\n    var schema$1 = constant$1([\n      required$1('tabs'),\n      required$1('dom'),\n      defaulted('clickToDismiss', false),\n      field('tabbarBehaviours', [\n        Highlighting,\n        Keying\n      ]),\n      markers$1([\n        'tabClass',\n        'selectedClass'\n      ])\n    ]);\n    var tabsPart = group({\n      factory: TabButton,\n      name: 'tabs',\n      unit: 'tab',\n      overrides: function (barDetail) {\n        var dismissTab$1 = function (tabbar, button) {\n          Highlighting.dehighlight(tabbar, button);\n          emitWith(tabbar, dismissTab(), {\n            tabbar: tabbar,\n            button: button\n          });\n        };\n        var changeTab$1 = function (tabbar, button) {\n          Highlighting.highlight(tabbar, button);\n          emitWith(tabbar, changeTab(), {\n            tabbar: tabbar,\n            button: button\n          });\n        };\n        return {\n          action: function (button) {\n            var tabbar = button.getSystem().getByUid(barDetail.uid).getOrDie();\n            var activeButton = Highlighting.isHighlighted(tabbar, button);\n            var response = function () {\n              if (activeButton && barDetail.clickToDismiss) {\n                return dismissTab$1;\n              } else if (!activeButton) {\n                return changeTab$1;\n              } else {\n                return noop;\n              }\n            }();\n            response(tabbar, button);\n          },\n          domModification: { classes: [barDetail.markers.tabClass] }\n        };\n      }\n    });\n    var parts$1 = constant$1([tabsPart]);\n\n    var factory$2 = function (detail, components, _spec, _externals) {\n      return {\n        'uid': detail.uid,\n        'dom': detail.dom,\n        components: components,\n        'debug.sketcher': 'Tabbar',\n        'domModification': { attributes: { role: 'tablist' } },\n        'behaviours': augment(detail.tabbarBehaviours, [\n          Highlighting.config({\n            highlightClass: detail.markers.selectedClass,\n            itemClass: detail.markers.tabClass,\n            onHighlight: function (tabbar, tab) {\n              set$8(tab.element, 'aria-selected', 'true');\n            },\n            onDehighlight: function (tabbar, tab) {\n              set$8(tab.element, 'aria-selected', 'false');\n            }\n          }),\n          Keying.config({\n            mode: 'flow',\n            getInitial: function (tabbar) {\n              return Highlighting.getHighlighted(tabbar).map(function (tab) {\n                return tab.element;\n              });\n            },\n            selector: '.' + detail.markers.tabClass,\n            executeOnMove: true\n          })\n        ])\n      };\n    };\n    var Tabbar = composite({\n      name: 'Tabbar',\n      configFields: schema$1(),\n      partFields: parts$1(),\n      factory: factory$2\n    });\n\n    var factory$1 = function (detail, _spec) {\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        behaviours: augment(detail.tabviewBehaviours, [Replacing.config({})]),\n        domModification: { attributes: { role: 'tabpanel' } }\n      };\n    };\n    var Tabview = single({\n      name: 'Tabview',\n      configFields: [field('tabviewBehaviours', [Replacing])],\n      factory: factory$1\n    });\n\n    var schema = constant$1([\n      defaulted('selectFirst', true),\n      onHandler('onChangeTab'),\n      onHandler('onDismissTab'),\n      defaulted('tabs', []),\n      field('tabSectionBehaviours', [])\n    ]);\n    var barPart = required({\n      factory: Tabbar,\n      schema: [\n        required$1('dom'),\n        requiredObjOf('markers', [\n          required$1('tabClass'),\n          required$1('selectedClass')\n        ])\n      ],\n      name: 'tabbar',\n      defaults: function (detail) {\n        return { tabs: detail.tabs };\n      }\n    });\n    var viewPart = required({\n      factory: Tabview,\n      name: 'tabview'\n    });\n    var parts = constant$1([\n      barPart,\n      viewPart\n    ]);\n\n    var factory = function (detail, components, _spec, _externals) {\n      var changeTab$1 = function (button) {\n        var tabValue = Representing.getValue(button);\n        getPart(button, detail, 'tabview').each(function (tabview) {\n          var tabWithValue = find$5(detail.tabs, function (t) {\n            return t.value === tabValue;\n          });\n          tabWithValue.each(function (tabData) {\n            var panel = tabData.view();\n            getOpt(button.element, 'id').each(function (id) {\n              set$8(tabview.element, 'aria-labelledby', id);\n            });\n            Replacing.set(tabview, panel);\n            detail.onChangeTab(tabview, button, panel);\n          });\n        });\n      };\n      var changeTabBy = function (section, byPred) {\n        getPart(section, detail, 'tabbar').each(function (tabbar) {\n          byPred(tabbar).each(emitExecute);\n        });\n      };\n      return {\n        uid: detail.uid,\n        dom: detail.dom,\n        components: components,\n        behaviours: get$2(detail.tabSectionBehaviours),\n        events: derive$2(flatten([\n          detail.selectFirst ? [runOnAttached(function (section, _simulatedEvent) {\n              changeTabBy(section, Highlighting.getFirst);\n            })] : [],\n          [\n            run$1(changeTab(), function (section, simulatedEvent) {\n              var button = simulatedEvent.event.button;\n              changeTab$1(button);\n            }),\n            run$1(dismissTab(), function (section, simulatedEvent) {\n              var button = simulatedEvent.event.button;\n              detail.onDismissTab(section, button);\n            })\n          ]\n        ])),\n        apis: {\n          getViewItems: function (section) {\n            return getPart(section, detail, 'tabview').map(function (tabview) {\n              return Replacing.contents(tabview);\n            }).getOr([]);\n          },\n          showTab: function (section, tabKey) {\n            var getTabIfNotActive = function (tabbar) {\n              var candidates = Highlighting.getCandidates(tabbar);\n              var optTab = find$5(candidates, function (c) {\n                return Representing.getValue(c) === tabKey;\n              });\n              return optTab.filter(function (tab) {\n                return !Highlighting.isHighlighted(tabbar, tab);\n              });\n            };\n            changeTabBy(section, getTabIfNotActive);\n          }\n        }\n      };\n    };\n    var TabSection = composite({\n      name: 'TabSection',\n      configFields: schema(),\n      partFields: parts(),\n      factory: factory,\n      apis: {\n        getViewItems: function (apis, component) {\n          return apis.getViewItems(component);\n        },\n        showTab: function (apis, component, tabKey) {\n          apis.showTab(component, tabKey);\n        }\n      }\n    });\n\n    var measureHeights = function (allTabs, tabview, tabviewComp) {\n      return map$2(allTabs, function (_tab, i) {\n        Replacing.set(tabviewComp, allTabs[i].view());\n        var rect = tabview.dom.getBoundingClientRect();\n        Replacing.set(tabviewComp, []);\n        return rect.height;\n      });\n    };\n    var getMaxHeight = function (heights) {\n      return head(sort(heights, function (a, b) {\n        if (a > b) {\n          return -1;\n        } else if (a < b) {\n          return +1;\n        } else {\n          return 0;\n        }\n      }));\n    };\n    var getMaxTabviewHeight = function (dialog, tabview, tablist) {\n      var documentElement$1 = documentElement(dialog).dom;\n      var rootElm = ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);\n      var isFixed = get$c(rootElm, 'position') === 'fixed';\n      var maxHeight;\n      if (isFixed) {\n        maxHeight = Math.max(documentElement$1.clientHeight, window.innerHeight);\n      } else {\n        maxHeight = Math.max(documentElement$1.offsetHeight, documentElement$1.scrollHeight);\n      }\n      var tabviewHeight = get$b(tabview);\n      var isTabListBeside = tabview.dom.offsetLeft >= tablist.dom.offsetLeft + get$a(tablist);\n      var currentTabHeight = isTabListBeside ? Math.max(get$b(tablist), tabviewHeight) : tabviewHeight;\n      var dialogTopMargin = parseInt(get$c(dialog, 'margin-top'), 10) || 0;\n      var dialogBottomMargin = parseInt(get$c(dialog, 'margin-bottom'), 10) || 0;\n      var dialogHeight = get$b(dialog) + dialogTopMargin + dialogBottomMargin;\n      var chromeHeight = dialogHeight - currentTabHeight;\n      return maxHeight - chromeHeight;\n    };\n    var showTab = function (allTabs, comp) {\n      head(allTabs).each(function (tab) {\n        return TabSection.showTab(comp, tab.value);\n      });\n    };\n    var setTabviewHeight = function (tabview, height) {\n      set$7(tabview, 'height', height + 'px');\n      if (!detect$1().browser.isIE()) {\n        set$7(tabview, 'flex-basis', height + 'px');\n      } else {\n        remove$6(tabview, 'flex-basis');\n      }\n    };\n    var updateTabviewHeight = function (dialogBody, tabview, maxTabHeight) {\n      ancestor(dialogBody, '[role=\"dialog\"]').each(function (dialog) {\n        descendant(dialog, '[role=\"tablist\"]').each(function (tablist) {\n          maxTabHeight.get().map(function (height) {\n            set$7(tabview, 'height', '0');\n            set$7(tabview, 'flex-basis', '0');\n            return Math.min(height, getMaxTabviewHeight(dialog, tabview, tablist));\n          }).each(function (height) {\n            setTabviewHeight(tabview, height);\n          });\n        });\n      });\n    };\n    var getTabview = function (dialog) {\n      return descendant(dialog, '[role=\"tabpanel\"]');\n    };\n    var setMode = function (allTabs) {\n      var smartTabHeight = function () {\n        var maxTabHeight = value$1();\n        var extraEvents = [\n          runOnAttached(function (comp) {\n            var dialog = comp.element;\n            getTabview(dialog).each(function (tabview) {\n              set$7(tabview, 'visibility', 'hidden');\n              comp.getSystem().getByDom(tabview).toOptional().each(function (tabviewComp) {\n                var heights = measureHeights(allTabs, tabview, tabviewComp);\n                var maxTabHeightOpt = getMaxHeight(heights);\n                maxTabHeightOpt.fold(maxTabHeight.clear, maxTabHeight.set);\n              });\n              updateTabviewHeight(dialog, tabview, maxTabHeight);\n              remove$6(tabview, 'visibility');\n              showTab(allTabs, comp);\n              global$f.requestAnimationFrame(function () {\n                updateTabviewHeight(dialog, tabview, maxTabHeight);\n              });\n            });\n          }),\n          run$1(windowResize(), function (comp) {\n            var dialog = comp.element;\n            getTabview(dialog).each(function (tabview) {\n              updateTabviewHeight(dialog, tabview, maxTabHeight);\n            });\n          }),\n          run$1(formResizeEvent, function (comp, _se) {\n            var dialog = comp.element;\n            getTabview(dialog).each(function (tabview) {\n              var oldFocus = active(getRootNode(tabview));\n              set$7(tabview, 'visibility', 'hidden');\n              var oldHeight = getRaw(tabview, 'height').map(function (h) {\n                return parseInt(h, 10);\n              });\n              remove$6(tabview, 'height');\n              remove$6(tabview, 'flex-basis');\n              var newHeight = tabview.dom.getBoundingClientRect().height;\n              var hasGrown = oldHeight.forall(function (h) {\n                return newHeight > h;\n              });\n              if (hasGrown) {\n                maxTabHeight.set(newHeight);\n                updateTabviewHeight(dialog, tabview, maxTabHeight);\n              } else {\n                oldHeight.each(function (h) {\n                  setTabviewHeight(tabview, h);\n                });\n              }\n              remove$6(tabview, 'visibility');\n              oldFocus.each(focus$3);\n            });\n          })\n        ];\n        var selectFirst = false;\n        return {\n          extraEvents: extraEvents,\n          selectFirst: selectFirst\n        };\n      }();\n      var naiveTabHeight = function () {\n        var extraEvents = [];\n        var selectFirst = true;\n        return {\n          extraEvents: extraEvents,\n          selectFirst: selectFirst\n        };\n      }();\n      return {\n        smartTabHeight: smartTabHeight,\n        naiveTabHeight: naiveTabHeight\n      };\n    };\n\n    var SendDataToSectionChannel = 'send-data-to-section';\n    var SendDataToViewChannel = 'send-data-to-view';\n    var renderTabPanel = function (spec, backstage) {\n      var storedValue = Cell({});\n      var updateDataWithForm = function (form) {\n        var formData = Representing.getValue(form);\n        var validData = toValidValues(formData).getOr({});\n        var currentData = storedValue.get();\n        var newData = deepMerge(currentData, validData);\n        storedValue.set(newData);\n      };\n      var setDataOnForm = function (form) {\n        var tabData = storedValue.get();\n        Representing.setValue(form, tabData);\n      };\n      var oldTab = Cell(null);\n      var allTabs = map$2(spec.tabs, function (tab) {\n        return {\n          value: tab.name,\n          dom: {\n            tag: 'div',\n            classes: ['tox-dialog__body-nav-item'],\n            innerHtml: backstage.shared.providers.translate(tab.title)\n          },\n          view: function () {\n            return [Form.sketch(function (parts) {\n                return {\n                  dom: {\n                    tag: 'div',\n                    classes: ['tox-form']\n                  },\n                  components: map$2(tab.items, function (item) {\n                    return interpretInForm(parts, item, backstage);\n                  }),\n                  formBehaviours: derive$1([\n                    Keying.config({\n                      mode: 'acyclic',\n                      useTabstopAt: not(isPseudoStop)\n                    }),\n                    config('TabView.form.events', [\n                      runOnAttached(setDataOnForm),\n                      runOnDetached(updateDataWithForm)\n                    ]),\n                    Receiving.config({\n                      channels: wrapAll([\n                        {\n                          key: SendDataToSectionChannel,\n                          value: { onReceive: updateDataWithForm }\n                        },\n                        {\n                          key: SendDataToViewChannel,\n                          value: { onReceive: setDataOnForm }\n                        }\n                      ])\n                    })\n                  ])\n                };\n              })];\n          }\n        };\n      });\n      var tabMode = setMode(allTabs).smartTabHeight;\n      return TabSection.sketch({\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__body']\n        },\n        onChangeTab: function (section, button, _viewItems) {\n          var name = Representing.getValue(button);\n          emitWith(section, formTabChangeEvent, {\n            name: name,\n            oldName: oldTab.get()\n          });\n          oldTab.set(name);\n        },\n        tabs: allTabs,\n        components: [\n          TabSection.parts.tabbar({\n            dom: {\n              tag: 'div',\n              classes: ['tox-dialog__body-nav']\n            },\n            components: [Tabbar.parts.tabs({})],\n            markers: {\n              tabClass: 'tox-tab',\n              selectedClass: 'tox-dialog__body-nav-item--active'\n            },\n            tabbarBehaviours: derive$1([Tabstopping.config({})])\n          }),\n          TabSection.parts.tabview({\n            dom: {\n              tag: 'div',\n              classes: ['tox-dialog__body-content']\n            }\n          })\n        ],\n        selectFirst: tabMode.selectFirst,\n        tabSectionBehaviours: derive$1([\n          config('tabpanel', tabMode.extraEvents),\n          Keying.config({ mode: 'acyclic' }),\n          Composing.config({\n            find: function (comp) {\n              return head(TabSection.getViewItems(comp));\n            }\n          }),\n          Representing.config({\n            store: {\n              mode: 'manual',\n              getValue: function (tsection) {\n                tsection.getSystem().broadcastOn([SendDataToSectionChannel], {});\n                return storedValue.get();\n              },\n              setValue: function (tsection, value) {\n                storedValue.set(value);\n                tsection.getSystem().broadcastOn([SendDataToViewChannel], {});\n              }\n            }\n          })\n        ])\n      });\n    };\n\n    var dialogChannel = generate$6('update-dialog');\n    var titleChannel = generate$6('update-title');\n    var bodyChannel = generate$6('update-body');\n    var footerChannel = generate$6('update-footer');\n    var bodySendMessageChannel = generate$6('body-send-message');\n\n    var renderBody = function (spec, id, backstage, ariaAttrs) {\n      var renderComponents = function (incoming) {\n        switch (incoming.body.type) {\n        case 'tabpanel': {\n            return [renderTabPanel(incoming.body, backstage)];\n          }\n        default: {\n            return [renderBodyPanel(incoming.body, backstage)];\n          }\n        }\n      };\n      var updateState = function (_comp, incoming) {\n        return Optional.some({\n          isTabPanel: function () {\n            return incoming.body.type === 'tabpanel';\n          }\n        });\n      };\n      var ariaAttributes = { 'aria-live': 'polite' };\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__content-js'],\n          attributes: __assign(__assign({}, id.map(function (x) {\n            return { id: x };\n          }).getOr({})), ariaAttrs ? ariaAttributes : {})\n        },\n        components: [],\n        behaviours: derive$1([\n          ComposingConfigs.childAt(0),\n          Reflecting.config({\n            channel: bodyChannel,\n            updateState: updateState,\n            renderComponents: renderComponents,\n            initialData: spec\n          })\n        ])\n      };\n    };\n    var renderInlineBody = function (spec, contentId, backstage, ariaAttrs) {\n      return renderBody(spec, Optional.some(contentId), backstage, ariaAttrs);\n    };\n    var renderModalBody = function (spec, backstage) {\n      var bodySpec = renderBody(spec, Optional.none(), backstage, false);\n      return ModalDialog.parts.body(bodySpec);\n    };\n    var renderIframeBody = function (spec) {\n      var bodySpec = {\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__content-js']\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-dialog__body-iframe']\n            },\n            components: [craft({\n                dom: {\n                  tag: 'iframe',\n                  attributes: { src: spec.url }\n                },\n                behaviours: derive$1([\n                  Tabstopping.config({}),\n                  Focusing.config({})\n                ])\n              })]\n          }],\n        behaviours: derive$1([Keying.config({\n            mode: 'acyclic',\n            useTabstopAt: not(isPseudoStop)\n          })])\n      };\n      return ModalDialog.parts.body(bodySpec);\n    };\n\n    var isTouch = global$9.deviceType.isTouch();\n    var hiddenHeader = function (title, close) {\n      return {\n        dom: {\n          tag: 'div',\n          styles: { display: 'none' },\n          classes: ['tox-dialog__header']\n        },\n        components: [\n          title,\n          close\n        ]\n      };\n    };\n    var pClose = function (onClose, providersBackstage) {\n      return ModalDialog.parts.close(Button.sketch({\n        dom: {\n          tag: 'button',\n          classes: [\n            'tox-button',\n            'tox-button--icon',\n            'tox-button--naked'\n          ],\n          attributes: {\n            'type': 'button',\n            'aria-label': providersBackstage.translate('Close')\n          }\n        },\n        action: onClose,\n        buttonBehaviours: derive$1([Tabstopping.config({})])\n      }));\n    };\n    var pUntitled = function () {\n      return ModalDialog.parts.title({\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__title'],\n          innerHtml: '',\n          styles: { display: 'none' }\n        }\n      });\n    };\n    var pBodyMessage = function (message, providersBackstage) {\n      return ModalDialog.parts.body({\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__body']\n        },\n        components: [{\n            dom: {\n              tag: 'div',\n              classes: ['tox-dialog__body-content']\n            },\n            components: [{ dom: fromHtml('<p>' + sanitizeHtmlString(providersBackstage.translate(message)) + '</p>') }]\n          }]\n      });\n    };\n    var pFooter = function (buttons) {\n      return ModalDialog.parts.footer({\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__footer']\n        },\n        components: buttons\n      });\n    };\n    var pFooterGroup = function (startButtons, endButtons) {\n      return [\n        Container.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-dialog__footer-start']\n          },\n          components: startButtons\n        }),\n        Container.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-dialog__footer-end']\n          },\n          components: endButtons\n        })\n      ];\n    };\n    var renderDialog$1 = function (spec) {\n      var _a;\n      var dialogClass = 'tox-dialog';\n      var blockerClass = dialogClass + '-wrap';\n      var blockerBackdropClass = blockerClass + '__backdrop';\n      var scrollLockClass = dialogClass + '__disable-scroll';\n      return ModalDialog.sketch({\n        lazySink: spec.lazySink,\n        onEscape: function (comp) {\n          spec.onEscape(comp);\n          return Optional.some(true);\n        },\n        useTabstopAt: function (elem) {\n          return !isPseudoStop(elem);\n        },\n        dom: {\n          tag: 'div',\n          classes: [dialogClass].concat(spec.extraClasses),\n          styles: __assign({ position: 'relative' }, spec.extraStyles)\n        },\n        components: __spreadArray([\n          spec.header,\n          spec.body\n        ], spec.footer.toArray(), true),\n        parts: {\n          blocker: {\n            dom: fromHtml('<div class=\"' + blockerClass + '\"></div>'),\n            components: [{\n                dom: {\n                  tag: 'div',\n                  classes: isTouch ? [\n                    blockerBackdropClass,\n                    blockerBackdropClass + '--opaque'\n                  ] : [blockerBackdropClass]\n                }\n              }]\n          }\n        },\n        dragBlockClass: blockerClass,\n        modalBehaviours: derive$1(__spreadArray([\n          Focusing.config({}),\n          config('dialog-events', spec.dialogEvents.concat([runOnSource(focusin(), function (comp, _se) {\n              Keying.focusIn(comp);\n            })])),\n          config('scroll-lock', [\n            runOnAttached(function () {\n              add$2(body(), scrollLockClass);\n            }),\n            runOnDetached(function () {\n              remove$2(body(), scrollLockClass);\n            })\n          ])\n        ], spec.extraBehaviours, true)),\n        eventOrder: __assign((_a = {}, _a[execute$5()] = ['dialog-events'], _a[attachedToDom()] = [\n          'scroll-lock',\n          'dialog-events',\n          'alloy.base.behaviour'\n        ], _a[detachedFromDom()] = [\n          'alloy.base.behaviour',\n          'dialog-events',\n          'scroll-lock'\n        ], _a), spec.eventOrder)\n      });\n    };\n\n    var renderClose = function (providersBackstage) {\n      return Button.sketch({\n        dom: {\n          tag: 'button',\n          classes: [\n            'tox-button',\n            'tox-button--icon',\n            'tox-button--naked'\n          ],\n          attributes: {\n            'type': 'button',\n            'aria-label': providersBackstage.translate('Close'),\n            'title': providersBackstage.translate('Close')\n          }\n        },\n        components: [render$3('close', {\n            tag: 'div',\n            classes: ['tox-icon']\n          }, providersBackstage.icons)],\n        action: function (comp) {\n          emit(comp, formCancelEvent);\n        }\n      });\n    };\n    var renderTitle = function (spec, id, providersBackstage) {\n      var renderComponents = function (data) {\n        return [text$1(providersBackstage.translate(data.title))];\n      };\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__title'],\n          attributes: __assign({}, id.map(function (x) {\n            return { id: x };\n          }).getOr({}))\n        },\n        components: renderComponents(spec),\n        behaviours: derive$1([Reflecting.config({\n            channel: titleChannel,\n            renderComponents: renderComponents\n          })])\n      };\n    };\n    var renderDragHandle = function () {\n      return { dom: fromHtml('<div class=\"tox-dialog__draghandle\"></div>') };\n    };\n    var renderInlineHeader = function (spec, titleId, providersBackstage) {\n      return Container.sketch({\n        dom: fromHtml('<div class=\"tox-dialog__header\"></div>'),\n        components: [\n          renderTitle(spec, Optional.some(titleId), providersBackstage),\n          renderDragHandle(),\n          renderClose(providersBackstage)\n        ],\n        containerBehaviours: derive$1([Dragging.config({\n            mode: 'mouse',\n            blockerClass: 'blocker',\n            getTarget: function (handle) {\n              return closest$1(handle, '[role=\"dialog\"]').getOrDie();\n            },\n            snaps: {\n              getSnapPoints: function () {\n                return [];\n              },\n              leftAttr: 'data-drag-left',\n              topAttr: 'data-drag-top'\n            }\n          })])\n      });\n    };\n    var renderModalHeader = function (spec, providersBackstage) {\n      var pTitle = ModalDialog.parts.title(renderTitle(spec, Optional.none(), providersBackstage));\n      var pHandle = ModalDialog.parts.draghandle(renderDragHandle());\n      var pClose = ModalDialog.parts.close(renderClose(providersBackstage));\n      var components = [pTitle].concat(spec.draggable ? [pHandle] : []).concat([pClose]);\n      return Container.sketch({\n        dom: fromHtml('<div class=\"tox-dialog__header\"></div>'),\n        components: components\n      });\n    };\n\n    var getHeader = function (title, backstage) {\n      return renderModalHeader({\n        title: backstage.shared.providers.translate(title),\n        draggable: backstage.dialog.isDraggableModal()\n      }, backstage.shared.providers);\n    };\n    var getBusySpec = function (message, bs, providers) {\n      return {\n        dom: {\n          tag: 'div',\n          classes: ['tox-dialog__busy-spinner'],\n          attributes: { 'aria-label': providers.translate(message) },\n          styles: {\n            left: '0px',\n            right: '0px',\n            bottom: '0px',\n            top: '0px',\n            position: 'absolute'\n          }\n        },\n        behaviours: bs,\n        components: [{ dom: fromHtml('<div class=\"tox-spinner\"><div></div><div></div><div></div></div>') }]\n      };\n    };\n    var getEventExtras = function (lazyDialog, providers, extra) {\n      return {\n        onClose: function () {\n          return extra.closeWindow();\n        },\n        onBlock: function (blockEvent) {\n          ModalDialog.setBusy(lazyDialog(), function (_comp, bs) {\n            return getBusySpec(blockEvent.message, bs, providers);\n          });\n        },\n        onUnblock: function () {\n          ModalDialog.setIdle(lazyDialog());\n        }\n      };\n    };\n    var renderModalDialog = function (spec, initialData, dialogEvents, backstage) {\n      var _a;\n      var updateState = function (_comp, incoming) {\n        return Optional.some(incoming);\n      };\n      return build$1(renderDialog$1(__assign(__assign({}, spec), {\n        lazySink: backstage.shared.getSink,\n        extraBehaviours: __spreadArray([\n          Reflecting.config({\n            channel: dialogChannel,\n            updateState: updateState,\n            initialData: initialData\n          }),\n          RepresentingConfigs.memory({})\n        ], spec.extraBehaviours, true),\n        onEscape: function (comp) {\n          emit(comp, formCancelEvent);\n        },\n        dialogEvents: dialogEvents,\n        eventOrder: (_a = {}, _a[receive()] = [\n          Reflecting.name(),\n          Receiving.name()\n        ], _a[attachedToDom()] = [\n          'scroll-lock',\n          Reflecting.name(),\n          'messages',\n          'dialog-events',\n          'alloy.base.behaviour'\n        ], _a[detachedFromDom()] = [\n          'alloy.base.behaviour',\n          'dialog-events',\n          'messages',\n          Reflecting.name(),\n          'scroll-lock'\n        ], _a)\n      })));\n    };\n    var mapMenuButtons = function (buttons) {\n      var mapItems = function (button) {\n        var items = map$2(button.items, function (item) {\n          var cell = Cell(false);\n          return __assign(__assign({}, item), { storage: cell });\n        });\n        return __assign(__assign({}, button), { items: items });\n      };\n      return map$2(buttons, function (button) {\n        if (button.type === 'menu') {\n          return mapItems(button);\n        }\n        return button;\n      });\n    };\n    var extractCellsToObject = function (buttons) {\n      return foldl(buttons, function (acc, button) {\n        if (button.type === 'menu') {\n          var menuButton = button;\n          return foldl(menuButton.items, function (innerAcc, item) {\n            innerAcc[item.name] = item.storage;\n            return innerAcc;\n          }, acc);\n        }\n        return acc;\n      }, {});\n    };\n\n    var initCommonEvents = function (fireApiEvent, extras) {\n      return [\n        runWithTarget(focusin(), onFocus),\n        fireApiEvent(formCloseEvent, function (_api, spec) {\n          extras.onClose();\n          spec.onClose();\n        }),\n        fireApiEvent(formCancelEvent, function (api, spec, _event, self) {\n          spec.onCancel(api);\n          emit(self, formCloseEvent);\n        }),\n        run$1(formUnblockEvent, function (_c, _se) {\n          return extras.onUnblock();\n        }),\n        run$1(formBlockEvent, function (_c, se) {\n          return extras.onBlock(se.event);\n        })\n      ];\n    };\n    var initUrlDialog = function (getInstanceApi, extras) {\n      var fireApiEvent = function (eventName, f) {\n        return run$1(eventName, function (c, se) {\n          withSpec(c, function (spec, _c) {\n            f(getInstanceApi(), spec, se.event, c);\n          });\n        });\n      };\n      var withSpec = function (c, f) {\n        Reflecting.getState(c).get().each(function (currentDialog) {\n          f(currentDialog, c);\n        });\n      };\n      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras), true), [fireApiEvent(formActionEvent, function (api, spec, event) {\n          spec.onAction(api, { name: event.name });\n        })], false);\n    };\n    var initDialog = function (getInstanceApi, extras, getSink) {\n      var fireApiEvent = function (eventName, f) {\n        return run$1(eventName, function (c, se) {\n          withSpec(c, function (spec, _c) {\n            f(getInstanceApi(), spec, se.event, c);\n          });\n        });\n      };\n      var withSpec = function (c, f) {\n        Reflecting.getState(c).get().each(function (currentDialogInit) {\n          f(currentDialogInit.internalDialog, c);\n        });\n      };\n      return __spreadArray(__spreadArray([], initCommonEvents(fireApiEvent, extras), true), [\n        fireApiEvent(formSubmitEvent, function (api, spec) {\n          return spec.onSubmit(api);\n        }),\n        fireApiEvent(formChangeEvent, function (api, spec, event) {\n          spec.onChange(api, { name: event.name });\n        }),\n        fireApiEvent(formActionEvent, function (api, spec, event, component) {\n          var focusIn = function () {\n            return Keying.focusIn(component);\n          };\n          var isDisabled = function (focused) {\n            return has$1(focused, 'disabled') || getOpt(focused, 'aria-disabled').exists(function (val) {\n              return val === 'true';\n            });\n          };\n          var rootNode = getRootNode(component.element);\n          var current = active(rootNode);\n          spec.onAction(api, {\n            name: event.name,\n            value: event.value\n          });\n          active(rootNode).fold(focusIn, function (focused) {\n            if (isDisabled(focused)) {\n              focusIn();\n            } else if (current.exists(function (cur) {\n                return contains(focused, cur) && isDisabled(cur);\n              })) {\n              focusIn();\n            } else {\n              getSink().toOptional().filter(function (sink) {\n                return !contains(sink.element, focused);\n              }).each(focusIn);\n            }\n          });\n        }),\n        fireApiEvent(formTabChangeEvent, function (api, spec, event) {\n          spec.onTabChange(api, {\n            newTabName: event.name,\n            oldTabName: event.oldName\n          });\n        }),\n        runOnDetached(function (component) {\n          var api = getInstanceApi();\n          Representing.setValue(component, api.getData());\n        })\n      ], false);\n    };\n    var SilverDialogEvents = {\n      initUrlDialog: initUrlDialog,\n      initDialog: initDialog\n    };\n\n    var makeButton = function (button, backstage) {\n      return renderFooterButton(button, button.type, backstage);\n    };\n    var lookup = function (compInSystem, footerButtons, buttonName) {\n      return find$5(footerButtons, function (button) {\n        return button.name === buttonName;\n      }).bind(function (memButton) {\n        return memButton.memento.getOpt(compInSystem);\n      });\n    };\n    var renderComponents = function (_data, state) {\n      var footerButtons = state.map(function (s) {\n        return s.footerButtons;\n      }).getOr([]);\n      var buttonGroups = partition$3(footerButtons, function (button) {\n        return button.align === 'start';\n      });\n      var makeGroup = function (edge, buttons) {\n        return Container.sketch({\n          dom: {\n            tag: 'div',\n            classes: ['tox-dialog__footer-' + edge]\n          },\n          components: map$2(buttons, function (button) {\n            return button.memento.asSpec();\n          })\n        });\n      };\n      var startButtons = makeGroup('start', buttonGroups.pass);\n      var endButtons = makeGroup('end', buttonGroups.fail);\n      return [\n        startButtons,\n        endButtons\n      ];\n    };\n    var renderFooter = function (initSpec, backstage) {\n      var updateState = function (_comp, data) {\n        var footerButtons = map$2(data.buttons, function (button) {\n          var memButton = record(makeButton(button, backstage));\n          return {\n            name: button.name,\n            align: button.align,\n            memento: memButton\n          };\n        });\n        var lookupByName = function (compInSystem, buttonName) {\n          return lookup(compInSystem, footerButtons, buttonName);\n        };\n        return Optional.some({\n          lookupByName: lookupByName,\n          footerButtons: footerButtons\n        });\n      };\n      return {\n        dom: fromHtml('<div class=\"tox-dialog__footer\"></div>'),\n        components: [],\n        behaviours: derive$1([Reflecting.config({\n            channel: footerChannel,\n            initialData: initSpec,\n            updateState: updateState,\n            renderComponents: renderComponents\n          })])\n      };\n    };\n    var renderInlineFooter = function (initSpec, backstage) {\n      return renderFooter(initSpec, backstage);\n    };\n    var renderModalFooter = function (initSpec, backstage) {\n      return ModalDialog.parts.footer(renderFooter(initSpec, backstage));\n    };\n\n    var getCompByName = function (access, name) {\n      var root = access.getRoot();\n      if (root.getSystem().isConnected()) {\n        var form_1 = Composing.getCurrent(access.getFormWrapper()).getOr(access.getFormWrapper());\n        return Form.getField(form_1, name).fold(function () {\n          var footer = access.getFooter();\n          var footerState = Reflecting.getState(footer);\n          return footerState.get().bind(function (f) {\n            return f.lookupByName(form_1, name);\n          });\n        }, function (comp) {\n          return Optional.some(comp);\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n    var validateData$1 = function (access, data) {\n      var root = access.getRoot();\n      return Reflecting.getState(root).get().map(function (dialogState) {\n        return getOrDie(asRaw('data', dialogState.dataValidator, data));\n      }).getOr(data);\n    };\n    var getDialogApi = function (access, doRedial, menuItemStates) {\n      var withRoot = function (f) {\n        var root = access.getRoot();\n        if (root.getSystem().isConnected()) {\n          f(root);\n        }\n      };\n      var getData = function () {\n        var root = access.getRoot();\n        var valueComp = root.getSystem().isConnected() ? access.getFormWrapper() : root;\n        var representedValues = Representing.getValue(valueComp);\n        var menuItemCurrentState = map$1(menuItemStates, function (cell) {\n          return cell.get();\n        });\n        return __assign(__assign({}, representedValues), menuItemCurrentState);\n      };\n      var setData = function (newData) {\n        withRoot(function (_) {\n          var prevData = instanceApi.getData();\n          var mergedData = __assign(__assign({}, prevData), newData);\n          var newInternalData = validateData$1(access, mergedData);\n          var form = access.getFormWrapper();\n          Representing.setValue(form, newInternalData);\n          each(menuItemStates, function (v, k) {\n            if (has$2(mergedData, k)) {\n              v.set(mergedData[k]);\n            }\n          });\n        });\n      };\n      var disable = function (name) {\n        getCompByName(access, name).each(Disabling.disable);\n      };\n      var enable = function (name) {\n        getCompByName(access, name).each(Disabling.enable);\n      };\n      var focus = function (name) {\n        getCompByName(access, name).each(Focusing.focus);\n      };\n      var block = function (message) {\n        if (!isString(message)) {\n          throw new Error('The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument');\n        }\n        withRoot(function (root) {\n          emitWith(root, formBlockEvent, { message: message });\n        });\n      };\n      var unblock = function () {\n        withRoot(function (root) {\n          emit(root, formUnblockEvent);\n        });\n      };\n      var showTab = function (name) {\n        withRoot(function (_) {\n          var body = access.getBody();\n          var bodyState = Reflecting.getState(body);\n          if (bodyState.get().exists(function (b) {\n              return b.isTabPanel();\n            })) {\n            Composing.getCurrent(body).each(function (tabSection) {\n              TabSection.showTab(tabSection, name);\n            });\n          }\n        });\n      };\n      var redial = function (d) {\n        withRoot(function (root) {\n          var dialogInit = doRedial(d);\n          root.getSystem().broadcastOn([dialogChannel], dialogInit);\n          root.getSystem().broadcastOn([titleChannel], dialogInit.internalDialog);\n          root.getSystem().broadcastOn([bodyChannel], dialogInit.internalDialog);\n          root.getSystem().broadcastOn([footerChannel], dialogInit.internalDialog);\n          instanceApi.setData(dialogInit.initialData);\n        });\n      };\n      var close = function () {\n        withRoot(function (root) {\n          emit(root, formCloseEvent);\n        });\n      };\n      var instanceApi = {\n        getData: getData,\n        setData: setData,\n        disable: disable,\n        enable: enable,\n        focus: focus,\n        block: block,\n        unblock: unblock,\n        showTab: showTab,\n        redial: redial,\n        close: close\n      };\n      return instanceApi;\n    };\n\n    var getDialogSizeClasses = function (size) {\n      switch (size) {\n      case 'large':\n        return ['tox-dialog--width-lg'];\n      case 'medium':\n        return ['tox-dialog--width-md'];\n      default:\n        return [];\n      }\n    };\n    var renderDialog = function (dialogInit, extra, backstage) {\n      var header = getHeader(dialogInit.internalDialog.title, backstage);\n      var body = renderModalBody({ body: dialogInit.internalDialog.body }, backstage);\n      var storagedMenuButtons = mapMenuButtons(dialogInit.internalDialog.buttons);\n      var objOfCells = extractCellsToObject(storagedMenuButtons);\n      var footer = renderModalFooter({ buttons: storagedMenuButtons }, backstage);\n      var dialogEvents = SilverDialogEvents.initDialog(function () {\n        return instanceApi;\n      }, getEventExtras(function () {\n        return dialog;\n      }, backstage.shared.providers, extra), backstage.shared.getSink);\n      var dialogSize = getDialogSizeClasses(dialogInit.internalDialog.size);\n      var spec = {\n        header: header,\n        body: body,\n        footer: Optional.some(footer),\n        extraClasses: dialogSize,\n        extraBehaviours: [],\n        extraStyles: {}\n      };\n      var dialog = renderModalDialog(spec, dialogInit, dialogEvents, backstage);\n      var modalAccess = function () {\n        var getForm = function () {\n          var outerForm = ModalDialog.getBody(dialog);\n          return Composing.getCurrent(outerForm).getOr(outerForm);\n        };\n        return {\n          getRoot: constant$1(dialog),\n          getBody: function () {\n            return ModalDialog.getBody(dialog);\n          },\n          getFooter: function () {\n            return ModalDialog.getFooter(dialog);\n          },\n          getFormWrapper: getForm\n        };\n      }();\n      var instanceApi = getDialogApi(modalAccess, extra.redial, objOfCells);\n      return {\n        dialog: dialog,\n        instanceApi: instanceApi\n      };\n    };\n\n    var renderInlineDialog = function (dialogInit, extra, backstage, ariaAttrs) {\n      var _a, _b;\n      var dialogLabelId = generate$6('dialog-label');\n      var dialogContentId = generate$6('dialog-content');\n      var updateState = function (_comp, incoming) {\n        return Optional.some(incoming);\n      };\n      var memHeader = record(renderInlineHeader({\n        title: dialogInit.internalDialog.title,\n        draggable: true\n      }, dialogLabelId, backstage.shared.providers));\n      var memBody = record(renderInlineBody({ body: dialogInit.internalDialog.body }, dialogContentId, backstage, ariaAttrs));\n      var storagedMenuButtons = mapMenuButtons(dialogInit.internalDialog.buttons);\n      var objOfCells = extractCellsToObject(storagedMenuButtons);\n      var memFooter = record(renderInlineFooter({ buttons: storagedMenuButtons }, backstage));\n      var dialogEvents = SilverDialogEvents.initDialog(function () {\n        return instanceApi;\n      }, {\n        onBlock: function (event) {\n          Blocking.block(dialog, function (_comp, bs) {\n            return getBusySpec(event.message, bs, backstage.shared.providers);\n          });\n        },\n        onUnblock: function () {\n          Blocking.unblock(dialog);\n        },\n        onClose: function () {\n          return extra.closeWindow();\n        }\n      }, backstage.shared.getSink);\n      var dialog = build$1({\n        dom: {\n          tag: 'div',\n          classes: [\n            'tox-dialog',\n            'tox-dialog-inline'\n          ],\n          attributes: (_a = { role: 'dialog' }, _a['aria-labelledby'] = dialogLabelId, _a['aria-describedby'] = dialogContentId, _a)\n        },\n        eventOrder: (_b = {}, _b[receive()] = [\n          Reflecting.name(),\n          Receiving.name()\n        ], _b[execute$5()] = ['execute-on-form'], _b[attachedToDom()] = [\n          'reflecting',\n          'execute-on-form'\n        ], _b),\n        behaviours: derive$1([\n          Keying.config({\n            mode: 'cyclic',\n            onEscape: function (c) {\n              emit(c, formCloseEvent);\n              return Optional.some(true);\n            },\n            useTabstopAt: function (elem) {\n              return !isPseudoStop(elem) && (name$2(elem) !== 'button' || get$d(elem, 'disabled') !== 'disabled');\n            }\n          }),\n          Reflecting.config({\n            channel: dialogChannel,\n            updateState: updateState,\n            initialData: dialogInit\n          }),\n          Focusing.config({}),\n          config('execute-on-form', dialogEvents.concat([runOnSource(focusin(), function (comp, _se) {\n              Keying.focusIn(comp);\n            })])),\n          Blocking.config({\n            getRoot: function () {\n              return Optional.some(dialog);\n            }\n          }),\n          Replacing.config({}),\n          RepresentingConfigs.memory({})\n        ]),\n        components: [\n          memHeader.asSpec(),\n          memBody.asSpec(),\n          memFooter.asSpec()\n        ]\n      });\n      var instanceApi = getDialogApi({\n        getRoot: constant$1(dialog),\n        getFooter: function () {\n          return memFooter.get(dialog);\n        },\n        getBody: function () {\n          return memBody.get(dialog);\n        },\n        getFormWrapper: function () {\n          var body = memBody.get(dialog);\n          return Composing.getCurrent(body).getOr(body);\n        }\n      }, extra.redial, objOfCells);\n      return {\n        dialog: dialog,\n        instanceApi: instanceApi\n      };\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.URI');\n\n    var getUrlDialogApi = function (root) {\n      var withRoot = function (f) {\n        if (root.getSystem().isConnected()) {\n          f(root);\n        }\n      };\n      var block = function (message) {\n        if (!isString(message)) {\n          throw new Error('The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument');\n        }\n        withRoot(function (root) {\n          emitWith(root, formBlockEvent, { message: message });\n        });\n      };\n      var unblock = function () {\n        withRoot(function (root) {\n          emit(root, formUnblockEvent);\n        });\n      };\n      var close = function () {\n        withRoot(function (root) {\n          emit(root, formCloseEvent);\n        });\n      };\n      var sendMessage = function (data) {\n        withRoot(function (root) {\n          root.getSystem().broadcastOn([bodySendMessageChannel], data);\n        });\n      };\n      return {\n        block: block,\n        unblock: unblock,\n        close: close,\n        sendMessage: sendMessage\n      };\n    };\n\n    var SUPPORTED_MESSAGE_ACTIONS = [\n      'insertContent',\n      'setContent',\n      'execCommand',\n      'close',\n      'block',\n      'unblock'\n    ];\n    var isSupportedMessage = function (data) {\n      return isObject(data) && SUPPORTED_MESSAGE_ACTIONS.indexOf(data.mceAction) !== -1;\n    };\n    var isCustomMessage = function (data) {\n      return !isSupportedMessage(data) && isObject(data) && has$2(data, 'mceAction');\n    };\n    var handleMessage = function (editor, api, data) {\n      switch (data.mceAction) {\n      case 'insertContent':\n        editor.insertContent(data.content);\n        break;\n      case 'setContent':\n        editor.setContent(data.content);\n        break;\n      case 'execCommand':\n        var ui = isBoolean(data.ui) ? data.ui : false;\n        editor.execCommand(data.cmd, ui, data.value);\n        break;\n      case 'close':\n        api.close();\n        break;\n      case 'block':\n        api.block(data.message);\n        break;\n      case 'unblock':\n        api.unblock();\n        break;\n      }\n    };\n    var renderUrlDialog = function (internalDialog, extra, editor, backstage) {\n      var _a;\n      var header = getHeader(internalDialog.title, backstage);\n      var body = renderIframeBody(internalDialog);\n      var footer = internalDialog.buttons.bind(function (buttons) {\n        if (buttons.length === 0) {\n          return Optional.none();\n        } else {\n          return Optional.some(renderModalFooter({ buttons: buttons }, backstage));\n        }\n      });\n      var dialogEvents = SilverDialogEvents.initUrlDialog(function () {\n        return instanceApi;\n      }, getEventExtras(function () {\n        return dialog;\n      }, backstage.shared.providers, extra));\n      var styles = __assign(__assign({}, internalDialog.height.fold(function () {\n        return {};\n      }, function (height) {\n        return {\n          'height': height + 'px',\n          'max-height': height + 'px'\n        };\n      })), internalDialog.width.fold(function () {\n        return {};\n      }, function (width) {\n        return {\n          'width': width + 'px',\n          'max-width': width + 'px'\n        };\n      }));\n      var classes = internalDialog.width.isNone() && internalDialog.height.isNone() ? ['tox-dialog--width-lg'] : [];\n      var iframeUri = new global$1(internalDialog.url, { base_uri: new global$1(window.location.href) });\n      var iframeDomain = iframeUri.protocol + '://' + iframeUri.host + (iframeUri.port ? ':' + iframeUri.port : '');\n      var messageHandlerUnbinder = unbindable();\n      var extraBehaviours = [\n        config('messages', [\n          runOnAttached(function () {\n            var unbind = bind(SugarElement.fromDom(window), 'message', function (e) {\n              if (iframeUri.isSameOrigin(new global$1(e.raw.origin))) {\n                var data = e.raw.data;\n                if (isSupportedMessage(data)) {\n                  handleMessage(editor, instanceApi, data);\n                } else if (isCustomMessage(data)) {\n                  internalDialog.onMessage(instanceApi, data);\n                }\n              }\n            });\n            messageHandlerUnbinder.set(unbind);\n          }),\n          runOnDetached(messageHandlerUnbinder.clear)\n        ]),\n        Receiving.config({\n          channels: (_a = {}, _a[bodySendMessageChannel] = {\n            onReceive: function (comp, data) {\n              descendant(comp.element, 'iframe').each(function (iframeEle) {\n                var iframeWin = iframeEle.dom.contentWindow;\n                iframeWin.postMessage(data, iframeDomain);\n              });\n            }\n          }, _a)\n        })\n      ];\n      var spec = {\n        header: header,\n        body: body,\n        footer: footer,\n        extraClasses: classes,\n        extraBehaviours: extraBehaviours,\n        extraStyles: styles\n      };\n      var dialog = renderModalDialog(spec, internalDialog, dialogEvents, backstage);\n      var instanceApi = getUrlDialogApi(dialog);\n      return {\n        dialog: dialog,\n        instanceApi: instanceApi\n      };\n    };\n\n    var setup$2 = function (extras) {\n      var sharedBackstage = extras.backstage.shared;\n      var open = function (message, callback) {\n        var closeDialog = function () {\n          ModalDialog.hide(alertDialog);\n          callback();\n        };\n        var memFooterClose = record(renderFooterButton({\n          name: 'close-alert',\n          text: 'OK',\n          primary: true,\n          align: 'end',\n          disabled: false,\n          icon: Optional.none()\n        }, 'cancel', extras.backstage));\n        var titleSpec = pUntitled();\n        var closeSpec = pClose(closeDialog, sharedBackstage.providers);\n        var alertDialog = build$1(renderDialog$1({\n          lazySink: function () {\n            return sharedBackstage.getSink();\n          },\n          header: hiddenHeader(titleSpec, closeSpec),\n          body: pBodyMessage(message, sharedBackstage.providers),\n          footer: Optional.some(pFooter(pFooterGroup([], [memFooterClose.asSpec()]))),\n          onEscape: closeDialog,\n          extraClasses: ['tox-alert-dialog'],\n          extraBehaviours: [],\n          extraStyles: {},\n          dialogEvents: [run$1(formCancelEvent, closeDialog)],\n          eventOrder: {}\n        }));\n        ModalDialog.show(alertDialog);\n        var footerCloseButton = memFooterClose.get(alertDialog);\n        Focusing.focus(footerCloseButton);\n      };\n      return { open: open };\n    };\n\n    var setup$1 = function (extras) {\n      var sharedBackstage = extras.backstage.shared;\n      var open = function (message, callback) {\n        var closeDialog = function (state) {\n          ModalDialog.hide(confirmDialog);\n          callback(state);\n        };\n        var memFooterYes = record(renderFooterButton({\n          name: 'yes',\n          text: 'Yes',\n          primary: true,\n          align: 'end',\n          disabled: false,\n          icon: Optional.none()\n        }, 'submit', extras.backstage));\n        var footerNo = renderFooterButton({\n          name: 'no',\n          text: 'No',\n          primary: false,\n          align: 'end',\n          disabled: false,\n          icon: Optional.none()\n        }, 'cancel', extras.backstage);\n        var titleSpec = pUntitled();\n        var closeSpec = pClose(function () {\n          return closeDialog(false);\n        }, sharedBackstage.providers);\n        var confirmDialog = build$1(renderDialog$1({\n          lazySink: function () {\n            return sharedBackstage.getSink();\n          },\n          header: hiddenHeader(titleSpec, closeSpec),\n          body: pBodyMessage(message, sharedBackstage.providers),\n          footer: Optional.some(pFooter(pFooterGroup([], [\n            footerNo,\n            memFooterYes.asSpec()\n          ]))),\n          onEscape: function () {\n            return closeDialog(false);\n          },\n          extraClasses: ['tox-confirm-dialog'],\n          extraBehaviours: [],\n          extraStyles: {},\n          dialogEvents: [\n            run$1(formCancelEvent, function () {\n              return closeDialog(false);\n            }),\n            run$1(formSubmitEvent, function () {\n              return closeDialog(true);\n            })\n          ],\n          eventOrder: {}\n        }));\n        ModalDialog.show(confirmDialog);\n        var footerYesButton = memFooterYes.get(confirmDialog);\n        Focusing.focus(footerYesButton);\n      };\n      return { open: open };\n    };\n\n    var validateData = function (data, validator) {\n      return getOrDie(asRaw('data', validator, data));\n    };\n    var isAlertOrConfirmDialog = function (target) {\n      return closest(target, '.tox-alert-dialog') || closest(target, '.tox-confirm-dialog');\n    };\n    var inlineAdditionalBehaviours = function (editor, isStickyToolbar, isToolbarLocationTop) {\n      if (isStickyToolbar && isToolbarLocationTop) {\n        return [];\n      } else {\n        return [Docking.config({\n            contextual: {\n              lazyContext: function () {\n                return Optional.some(box$1(SugarElement.fromDom(editor.getContentAreaContainer())));\n              },\n              fadeInClass: 'tox-dialog-dock-fadein',\n              fadeOutClass: 'tox-dialog-dock-fadeout',\n              transitionClass: 'tox-dialog-dock-transition'\n            },\n            modes: ['top']\n          })];\n      }\n    };\n    var setup = function (extras) {\n      var backstage = extras.backstage;\n      var editor = extras.editor;\n      var isStickyToolbar$1 = isStickyToolbar(editor);\n      var alertDialog = setup$2(extras);\n      var confirmDialog = setup$1(extras);\n      var open = function (config, params, closeWindow) {\n        if (params !== undefined && params.inline === 'toolbar') {\n          return openInlineDialog(config, backstage.shared.anchors.inlineDialog(), closeWindow, params.ariaAttrs);\n        } else if (params !== undefined && params.inline === 'cursor') {\n          return openInlineDialog(config, backstage.shared.anchors.cursor(), closeWindow, params.ariaAttrs);\n        } else {\n          return openModalDialog(config, closeWindow);\n        }\n      };\n      var openUrl = function (config, closeWindow) {\n        return openModalUrlDialog(config, closeWindow);\n      };\n      var openModalUrlDialog = function (config, closeWindow) {\n        var factory = function (contents) {\n          var dialog = renderUrlDialog(contents, {\n            closeWindow: function () {\n              ModalDialog.hide(dialog.dialog);\n              closeWindow(dialog.instanceApi);\n            }\n          }, editor, backstage);\n          ModalDialog.show(dialog.dialog);\n          return dialog.instanceApi;\n        };\n        return DialogManager.openUrl(factory, config);\n      };\n      var openModalDialog = function (config, closeWindow) {\n        var factory = function (contents, internalInitialData, dataValidator) {\n          var initialData = internalInitialData;\n          var dialogInit = {\n            dataValidator: dataValidator,\n            initialData: initialData,\n            internalDialog: contents\n          };\n          var dialog = renderDialog(dialogInit, {\n            redial: DialogManager.redial,\n            closeWindow: function () {\n              ModalDialog.hide(dialog.dialog);\n              closeWindow(dialog.instanceApi);\n            }\n          }, backstage);\n          ModalDialog.show(dialog.dialog);\n          dialog.instanceApi.setData(initialData);\n          return dialog.instanceApi;\n        };\n        return DialogManager.open(factory, config);\n      };\n      var openInlineDialog = function (config$1, anchor, closeWindow, ariaAttrs) {\n        var factory = function (contents, internalInitialData, dataValidator) {\n          var initialData = validateData(internalInitialData, dataValidator);\n          var inlineDialog = value$1();\n          var isToolbarLocationTop = backstage.shared.header.isPositionedAtTop();\n          var dialogInit = {\n            dataValidator: dataValidator,\n            initialData: initialData,\n            internalDialog: contents\n          };\n          var refreshDocking = function () {\n            return inlineDialog.on(function (dialog) {\n              InlineView.reposition(dialog);\n              Docking.refresh(dialog);\n            });\n          };\n          var dialogUi = renderInlineDialog(dialogInit, {\n            redial: DialogManager.redial,\n            closeWindow: function () {\n              inlineDialog.on(InlineView.hide);\n              editor.off('ResizeEditor', refreshDocking);\n              inlineDialog.clear();\n              closeWindow(dialogUi.instanceApi);\n            }\n          }, backstage, ariaAttrs);\n          var inlineDialogComp = build$1(InlineView.sketch(__assign(__assign({\n            lazySink: backstage.shared.getSink,\n            dom: {\n              tag: 'div',\n              classes: []\n            },\n            fireDismissalEventInstead: {}\n          }, isToolbarLocationTop ? {} : { fireRepositionEventInstead: {} }), {\n            inlineBehaviours: derive$1(__spreadArray([config('window-manager-inline-events', [run$1(dismissRequested(), function (_comp, _se) {\n                  emit(dialogUi.dialog, formCancelEvent);\n                })])], inlineAdditionalBehaviours(editor, isStickyToolbar$1, isToolbarLocationTop), true)),\n            isExtraPart: function (_comp, target) {\n              return isAlertOrConfirmDialog(target);\n            }\n          })));\n          inlineDialog.set(inlineDialogComp);\n          InlineView.showWithin(inlineDialogComp, premade(dialogUi.dialog), { anchor: anchor }, Optional.some(body()));\n          if (!isStickyToolbar$1 || !isToolbarLocationTop) {\n            Docking.refresh(inlineDialogComp);\n            editor.on('ResizeEditor', refreshDocking);\n          }\n          dialogUi.instanceApi.setData(initialData);\n          Keying.focusIn(dialogUi.dialog);\n          return dialogUi.instanceApi;\n        };\n        return DialogManager.open(factory, config$1);\n      };\n      var confirm = function (message, callback) {\n        confirmDialog.open(message, function (state) {\n          callback(state);\n        });\n      };\n      var alert = function (message, callback) {\n        alertDialog.open(message, function () {\n          callback();\n        });\n      };\n      var close = function (instanceApi) {\n        instanceApi.close();\n      };\n      return {\n        open: open,\n        openUrl: openUrl,\n        alert: alert,\n        close: close,\n        confirm: confirm\n      };\n    };\n\n    function Theme () {\n      global$g.add('silver', function (editor) {\n        var _a = setup$3(editor), uiMothership = _a.uiMothership, backstage = _a.backstage, renderUI = _a.renderUI, getUi = _a.getUi;\n        Autocompleter.register(editor, backstage.shared);\n        var windowMgr = setup({\n          editor: editor,\n          backstage: backstage\n        });\n        return {\n          renderUI: renderUI,\n          getWindowManagerImpl: constant$1(windowMgr),\n          getNotificationManagerImpl: function () {\n            return NotificationManagerImpl(editor, { backstage: backstage }, uiMothership);\n          },\n          ui: getUi()\n        };\n      });\n    }\n\n    Theme();\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/themes/silver/theme.js?");

/***/ }),

/***/ "../../node_modules/tinymce/tinymce.js":
/*!*********************************************!*\
  !*** ../../node_modules/tinymce/tinymce.js ***!
  \*********************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

eval("/**\n * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n * Licensed under the LGPL or a commercial license.\n * For LGPL see License.txt in the project root for license information.\n * For commercial licenses see https://www.tiny.cloud/\n *\n * Version: 5.10.9 (2023-11-15)\n */\n(function () {\n    'use strict';\n\n    var typeOf$1 = function (x) {\n      if (x === null) {\n        return 'null';\n      }\n      if (x === undefined) {\n        return 'undefined';\n      }\n      var t = typeof x;\n      if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      }\n      if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      }\n      return t;\n    };\n    var isEquatableType = function (x) {\n      return [\n        'undefined',\n        'boolean',\n        'number',\n        'string',\n        'function',\n        'xml',\n        'null'\n      ].indexOf(x) !== -1;\n    };\n\n    var sort$1 = function (xs, compareFn) {\n      var clone = Array.prototype.slice.call(xs);\n      return clone.sort(compareFn);\n    };\n\n    var contramap = function (eqa, f) {\n      return eq$2(function (x, y) {\n        return eqa.eq(f(x), f(y));\n      });\n    };\n    var eq$2 = function (f) {\n      return { eq: f };\n    };\n    var tripleEq = eq$2(function (x, y) {\n      return x === y;\n    });\n    var eqString = tripleEq;\n    var eqArray = function (eqa) {\n      return eq$2(function (x, y) {\n        if (x.length !== y.length) {\n          return false;\n        }\n        var len = x.length;\n        for (var i = 0; i < len; i++) {\n          if (!eqa.eq(x[i], y[i])) {\n            return false;\n          }\n        }\n        return true;\n      });\n    };\n    var eqSortedArray = function (eqa, compareFn) {\n      return contramap(eqArray(eqa), function (xs) {\n        return sort$1(xs, compareFn);\n      });\n    };\n    var eqRecord = function (eqa) {\n      return eq$2(function (x, y) {\n        var kx = Object.keys(x);\n        var ky = Object.keys(y);\n        if (!eqSortedArray(eqString).eq(kx, ky)) {\n          return false;\n        }\n        var len = kx.length;\n        for (var i = 0; i < len; i++) {\n          var q = kx[i];\n          if (!eqa.eq(x[q], y[q])) {\n            return false;\n          }\n        }\n        return true;\n      });\n    };\n    var eqAny = eq$2(function (x, y) {\n      if (x === y) {\n        return true;\n      }\n      var tx = typeOf$1(x);\n      var ty = typeOf$1(y);\n      if (tx !== ty) {\n        return false;\n      }\n      if (isEquatableType(tx)) {\n        return x === y;\n      } else if (tx === 'array') {\n        return eqArray(eqAny).eq(x, y);\n      } else if (tx === 'object') {\n        return eqRecord(eqAny).eq(x, y);\n      }\n      return false;\n    });\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType$1 = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isSimpleType = function (type) {\n      return function (value) {\n        return typeof value === type;\n      };\n    };\n    var eq$1 = function (t) {\n      return function (a) {\n        return t === a;\n      };\n    };\n    var isString$1 = isType$1('string');\n    var isObject = isType$1('object');\n    var isArray$1 = isType$1('array');\n    var isNull = eq$1(null);\n    var isBoolean = isSimpleType('boolean');\n    var isUndefined = eq$1(undefined);\n    var isNullable = function (a) {\n      return a === null || a === undefined;\n    };\n    var isNonNullable = function (a) {\n      return !isNullable(a);\n    };\n    var isFunction = isSimpleType('function');\n    var isNumber = isSimpleType('number');\n\n    var noop = function () {\n    };\n    var compose = function (fa, fb) {\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        return fa(fb.apply(null, args));\n      };\n    };\n    var compose1 = function (fbc, fab) {\n      return function (a) {\n        return fbc(fab(a));\n      };\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var identity = function (x) {\n      return x;\n    };\n    var tripleEquals = function (a, b) {\n      return a === b;\n    };\n    function curry(fn) {\n      var initialArgs = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        initialArgs[_i - 1] = arguments[_i];\n      }\n      return function () {\n        var restArgs = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          restArgs[_i] = arguments[_i];\n        }\n        var all = initialArgs.concat(restArgs);\n        return fn.apply(null, all);\n      };\n    }\n    var not = function (f) {\n      return function (t) {\n        return !f(t);\n      };\n    };\n    var die = function (msg) {\n      return function () {\n        throw new Error(msg);\n      };\n    };\n    var apply = function (f) {\n      return f();\n    };\n    var call = function (f) {\n      f();\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = identity;\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: function () {\n          return none();\n        },\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        }\n      };\n      return me;\n    };\n    var from$1 = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from$1\n    };\n\n    var nativeSlice = Array.prototype.slice;\n    var nativeIndexOf = Array.prototype.indexOf;\n    var nativePush = Array.prototype.push;\n    var rawIndexOf = function (ts, t) {\n      return nativeIndexOf.call(ts, t);\n    };\n    var indexOf$2 = function (xs, x) {\n      var r = rawIndexOf(xs, x);\n      return r === -1 ? Optional.none() : Optional.some(r);\n    };\n    var contains$3 = function (xs, x) {\n      return rawIndexOf(xs, x) > -1;\n    };\n    var exists = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var map$3 = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each$k = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var eachr = function (xs, f) {\n      for (var i = xs.length - 1; i >= 0; i--) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var partition = function (xs, pred) {\n      var pass = [];\n      var fail = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        var arr = pred(x, i) ? pass : fail;\n        arr.push(x);\n      }\n      return {\n        pass: pass,\n        fail: fail\n      };\n    };\n    var filter$4 = function (xs, pred) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          r.push(x);\n        }\n      }\n      return r;\n    };\n    var foldr = function (xs, f, acc) {\n      eachr(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var foldl = function (xs, f, acc) {\n      each$k(xs, function (x, i) {\n        acc = f(acc, x, i);\n      });\n      return acc;\n    };\n    var findUntil$1 = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find$3 = function (xs, pred) {\n      return findUntil$1(xs, pred, never);\n    };\n    var findIndex$2 = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(i);\n        }\n      }\n      return Optional.none();\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray$1(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map$3(xs, f));\n    };\n    var forall = function (xs, pred) {\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        var x = xs[i];\n        if (pred(x, i) !== true) {\n          return false;\n        }\n      }\n      return true;\n    };\n    var reverse = function (xs) {\n      var r = nativeSlice.call(xs, 0);\n      r.reverse();\n      return r;\n    };\n    var difference = function (a1, a2) {\n      return filter$4(a1, function (x) {\n        return !contains$3(a2, x);\n      });\n    };\n    var mapToObject = function (xs, f) {\n      var r = {};\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        r[String(x)] = f(x, i);\n      }\n      return r;\n    };\n    var sort = function (xs, comparator) {\n      var copy = nativeSlice.call(xs, 0);\n      copy.sort(comparator);\n      return copy;\n    };\n    var get$a = function (xs, i) {\n      return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();\n    };\n    var head = function (xs) {\n      return get$a(xs, 0);\n    };\n    var last$2 = function (xs) {\n      return get$a(xs, xs.length - 1);\n    };\n    var from = isFunction(Array.from) ? Array.from : function (x) {\n      return nativeSlice.call(x);\n    };\n    var findMap = function (arr, f) {\n      for (var i = 0; i < arr.length; i++) {\n        var r = f(arr[i], i);\n        if (r.isSome()) {\n          return r;\n        }\n      }\n      return Optional.none();\n    };\n\n    var keys = Object.keys;\n    var hasOwnProperty$1 = Object.hasOwnProperty;\n    var each$j = function (obj, f) {\n      var props = keys(obj);\n      for (var k = 0, len = props.length; k < len; k++) {\n        var i = props[k];\n        var x = obj[i];\n        f(x, i);\n      }\n    };\n    var map$2 = function (obj, f) {\n      return tupleMap(obj, function (x, i) {\n        return {\n          k: i,\n          v: f(x, i)\n        };\n      });\n    };\n    var tupleMap = function (obj, f) {\n      var r = {};\n      each$j(obj, function (x, i) {\n        var tuple = f(x, i);\n        r[tuple.k] = tuple.v;\n      });\n      return r;\n    };\n    var objAcc = function (r) {\n      return function (x, i) {\n        r[i] = x;\n      };\n    };\n    var internalFilter = function (obj, pred, onTrue, onFalse) {\n      var r = {};\n      each$j(obj, function (x, i) {\n        (pred(x, i) ? onTrue : onFalse)(x, i);\n      });\n      return r;\n    };\n    var bifilter = function (obj, pred) {\n      var t = {};\n      var f = {};\n      internalFilter(obj, pred, objAcc(t), objAcc(f));\n      return {\n        t: t,\n        f: f\n      };\n    };\n    var filter$3 = function (obj, pred) {\n      var t = {};\n      internalFilter(obj, pred, objAcc(t), noop);\n      return t;\n    };\n    var mapToArray = function (obj, f) {\n      var r = [];\n      each$j(obj, function (value, name) {\n        r.push(f(value, name));\n      });\n      return r;\n    };\n    var values = function (obj) {\n      return mapToArray(obj, identity);\n    };\n    var get$9 = function (obj, key) {\n      return has$2(obj, key) ? Optional.from(obj[key]) : Optional.none();\n    };\n    var has$2 = function (obj, key) {\n      return hasOwnProperty$1.call(obj, key);\n    };\n    var hasNonNullableKey = function (obj, key) {\n      return has$2(obj, key) && obj[key] !== undefined && obj[key] !== null;\n    };\n    var equal$1 = function (a1, a2, eq) {\n      if (eq === void 0) {\n        eq = eqAny;\n      }\n      return eqRecord(eq).eq(a1, a2);\n    };\n\n    var isArray = Array.isArray;\n    var toArray$1 = function (obj) {\n      if (!isArray(obj)) {\n        var array = [];\n        for (var i = 0, l = obj.length; i < l; i++) {\n          array[i] = obj[i];\n        }\n        return array;\n      } else {\n        return obj;\n      }\n    };\n    var each$i = function (o, cb, s) {\n      var n, l;\n      if (!o) {\n        return false;\n      }\n      s = s || o;\n      if (o.length !== undefined) {\n        for (n = 0, l = o.length; n < l; n++) {\n          if (cb.call(s, o[n], n, o) === false) {\n            return false;\n          }\n        }\n      } else {\n        for (n in o) {\n          if (has$2(o, n)) {\n            if (cb.call(s, o[n], n, o) === false) {\n              return false;\n            }\n          }\n        }\n      }\n      return true;\n    };\n    var map$1 = function (array, callback) {\n      var out = [];\n      each$i(array, function (item, index) {\n        out.push(callback(item, index, array));\n      });\n      return out;\n    };\n    var filter$2 = function (a, f) {\n      var o = [];\n      each$i(a, function (v, index) {\n        if (!f || f(v, index, a)) {\n          o.push(v);\n        }\n      });\n      return o;\n    };\n    var indexOf$1 = function (a, v) {\n      if (a) {\n        for (var i = 0, l = a.length; i < l; i++) {\n          if (a[i] === v) {\n            return i;\n          }\n        }\n      }\n      return -1;\n    };\n    var reduce = function (collection, iteratee, accumulator, thisArg) {\n      var acc = isUndefined(accumulator) ? collection[0] : accumulator;\n      for (var i = 0; i < collection.length; i++) {\n        acc = iteratee.call(thisArg, acc, collection[i], i);\n      }\n      return acc;\n    };\n    var findIndex$1 = function (array, predicate, thisArg) {\n      var i, l;\n      for (i = 0, l = array.length; i < l; i++) {\n        if (predicate.call(thisArg, array[i], i, array)) {\n          return i;\n        }\n      }\n      return -1;\n    };\n    var last$1 = function (collection) {\n      return collection[collection.length - 1];\n    };\n\n    var __assign = function () {\n      __assign = Object.assign || function __assign(t) {\n        for (var s, i = 1, n = arguments.length; i < n; i++) {\n          s = arguments[i];\n          for (var p in s)\n            if (Object.prototype.hasOwnProperty.call(s, p))\n              t[p] = s[p];\n        }\n        return t;\n      };\n      return __assign.apply(this, arguments);\n    };\n    function __rest(s, e) {\n      var t = {};\n      for (var p in s)\n        if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n          t[p] = s[p];\n      if (s != null && typeof Object.getOwnPropertySymbols === 'function')\n        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n          if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n            t[p[i]] = s[p[i]];\n        }\n      return t;\n    }\n    function __spreadArray(to, from, pack) {\n      if (pack || arguments.length === 2)\n        for (var i = 0, l = from.length, ar; i < l; i++) {\n          if (ar || !(i in from)) {\n            if (!ar)\n              ar = Array.prototype.slice.call(from, 0, i);\n            ar[i] = from[i];\n          }\n        }\n      return to.concat(ar || Array.prototype.slice.call(from));\n    }\n\n    var cached = function (f) {\n      var called = false;\n      var r;\n      return function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!called) {\n          called = true;\n          r = f.apply(null, args);\n        }\n        return r;\n      };\n    };\n\n    var DeviceType = function (os, browser, userAgent, mediaMatch) {\n      var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;\n      var isiPhone = os.isiOS() && !isiPad;\n      var isMobile = os.isiOS() || os.isAndroid();\n      var isTouch = isMobile || mediaMatch('(pointer:coarse)');\n      var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');\n      var isPhone = isiPhone || isMobile && !isTablet;\n      var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;\n      var isDesktop = !isPhone && !isTablet && !iOSwebview;\n      return {\n        isiPad: constant(isiPad),\n        isiPhone: constant(isiPhone),\n        isTablet: constant(isTablet),\n        isPhone: constant(isPhone),\n        isTouch: constant(isTouch),\n        isAndroid: os.isAndroid,\n        isiOS: os.isiOS,\n        isWebView: constant(iOSwebview),\n        isDesktop: constant(isDesktop)\n      };\n    };\n\n    var firstMatch = function (regexes, s) {\n      for (var i = 0; i < regexes.length; i++) {\n        var x = regexes[i];\n        if (x.test(s)) {\n          return x;\n        }\n      }\n      return undefined;\n    };\n    var find$2 = function (regexes, agent) {\n      var r = firstMatch(regexes, agent);\n      if (!r) {\n        return {\n          major: 0,\n          minor: 0\n        };\n      }\n      var group = function (i) {\n        return Number(agent.replace(r, '$' + i));\n      };\n      return nu$4(group(1), group(2));\n    };\n    var detect$3 = function (versionRegexes, agent) {\n      var cleanedAgent = String(agent).toLowerCase();\n      if (versionRegexes.length === 0) {\n        return unknown$2();\n      }\n      return find$2(versionRegexes, cleanedAgent);\n    };\n    var unknown$2 = function () {\n      return nu$4(0, 0);\n    };\n    var nu$4 = function (major, minor) {\n      return {\n        major: major,\n        minor: minor\n      };\n    };\n    var Version = {\n      nu: nu$4,\n      detect: detect$3,\n      unknown: unknown$2\n    };\n\n    var detectBrowser$1 = function (browsers, userAgentData) {\n      return findMap(userAgentData.brands, function (uaBrand) {\n        var lcBrand = uaBrand.brand.toLowerCase();\n        return find$3(browsers, function (browser) {\n          var _a;\n          return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());\n        }).map(function (info) {\n          return {\n            current: info.name,\n            version: Version.nu(parseInt(uaBrand.version, 10), 0)\n          };\n        });\n      });\n    };\n\n    var detect$2 = function (candidates, userAgent) {\n      var agent = String(userAgent).toLowerCase();\n      return find$3(candidates, function (candidate) {\n        return candidate.search(agent);\n      });\n    };\n    var detectBrowser = function (browsers, userAgent) {\n      return detect$2(browsers, userAgent).map(function (browser) {\n        var version = Version.detect(browser.versionRegexes, userAgent);\n        return {\n          current: browser.name,\n          version: version\n        };\n      });\n    };\n    var detectOs = function (oses, userAgent) {\n      return detect$2(oses, userAgent).map(function (os) {\n        var version = Version.detect(os.versionRegexes, userAgent);\n        return {\n          current: os.name,\n          version: version\n        };\n      });\n    };\n\n    var removeFromStart = function (str, numChars) {\n      return str.substring(numChars);\n    };\n\n    var checkRange = function (str, substr, start) {\n      return substr === '' || str.length >= substr.length && str.substr(start, start + substr.length) === substr;\n    };\n    var removeLeading = function (str, prefix) {\n      return startsWith(str, prefix) ? removeFromStart(str, prefix.length) : str;\n    };\n    var contains$2 = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var startsWith = function (str, prefix) {\n      return checkRange(str, prefix, 0);\n    };\n    var blank = function (r) {\n      return function (s) {\n        return s.replace(r, '');\n      };\n    };\n    var trim$5 = blank(/^\\s+|\\s+$/g);\n    var lTrim = blank(/^\\s+/g);\n    var rTrim = blank(/\\s+$/g);\n    var isNotEmpty = function (s) {\n      return s.length > 0;\n    };\n    var isEmpty$3 = function (s) {\n      return !isNotEmpty(s);\n    };\n\n    var normalVersionRegex = /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/;\n    var checkContains = function (target) {\n      return function (uastring) {\n        return contains$2(uastring, target);\n      };\n    };\n    var browsers = [\n      {\n        name: 'Edge',\n        versionRegexes: [/.*?edge\\/ ?([0-9]+)\\.([0-9]+)$/],\n        search: function (uastring) {\n          return contains$2(uastring, 'edge/') && contains$2(uastring, 'chrome') && contains$2(uastring, 'safari') && contains$2(uastring, 'applewebkit');\n        }\n      },\n      {\n        name: 'Chrome',\n        brand: 'Chromium',\n        versionRegexes: [\n          /.*?chrome\\/([0-9]+)\\.([0-9]+).*/,\n          normalVersionRegex\n        ],\n        search: function (uastring) {\n          return contains$2(uastring, 'chrome') && !contains$2(uastring, 'chromeframe');\n        }\n      },\n      {\n        name: 'IE',\n        versionRegexes: [\n          /.*?msie\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*?rv:([0-9]+)\\.([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return contains$2(uastring, 'msie') || contains$2(uastring, 'trident');\n        }\n      },\n      {\n        name: 'Opera',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?opera\\/([0-9]+)\\.([0-9]+).*/\n        ],\n        search: checkContains('opera')\n      },\n      {\n        name: 'Firefox',\n        versionRegexes: [/.*?firefox\\/\\ ?([0-9]+)\\.([0-9]+).*/],\n        search: checkContains('firefox')\n      },\n      {\n        name: 'Safari',\n        versionRegexes: [\n          normalVersionRegex,\n          /.*?cpu os ([0-9]+)_([0-9]+).*/\n        ],\n        search: function (uastring) {\n          return (contains$2(uastring, 'safari') || contains$2(uastring, 'mobile/')) && contains$2(uastring, 'applewebkit');\n        }\n      }\n    ];\n    var oses = [\n      {\n        name: 'Windows',\n        search: checkContains('win'),\n        versionRegexes: [/.*?windows\\ nt\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'iOS',\n        search: function (uastring) {\n          return contains$2(uastring, 'iphone') || contains$2(uastring, 'ipad');\n        },\n        versionRegexes: [\n          /.*?version\\/\\ ?([0-9]+)\\.([0-9]+).*/,\n          /.*cpu os ([0-9]+)_([0-9]+).*/,\n          /.*cpu iphone os ([0-9]+)_([0-9]+).*/\n        ]\n      },\n      {\n        name: 'Android',\n        search: checkContains('android'),\n        versionRegexes: [/.*?android\\ ?([0-9]+)\\.([0-9]+).*/]\n      },\n      {\n        name: 'OSX',\n        search: checkContains('mac os x'),\n        versionRegexes: [/.*?mac\\ os\\ x\\ ?([0-9]+)_([0-9]+).*/]\n      },\n      {\n        name: 'Linux',\n        search: checkContains('linux'),\n        versionRegexes: []\n      },\n      {\n        name: 'Solaris',\n        search: checkContains('sunos'),\n        versionRegexes: []\n      },\n      {\n        name: 'FreeBSD',\n        search: checkContains('freebsd'),\n        versionRegexes: []\n      },\n      {\n        name: 'ChromeOS',\n        search: checkContains('cros'),\n        versionRegexes: [/.*?chrome\\/([0-9]+)\\.([0-9]+).*/]\n      }\n    ];\n    var PlatformInfo = {\n      browsers: constant(browsers),\n      oses: constant(oses)\n    };\n\n    var edge = 'Edge';\n    var chrome = 'Chrome';\n    var ie$1 = 'IE';\n    var opera = 'Opera';\n    var firefox = 'Firefox';\n    var safari = 'Safari';\n    var unknown$1 = function () {\n      return nu$3({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$3 = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isBrowser = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isEdge: isBrowser(edge),\n        isChrome: isBrowser(chrome),\n        isIE: isBrowser(ie$1),\n        isOpera: isBrowser(opera),\n        isFirefox: isBrowser(firefox),\n        isSafari: isBrowser(safari)\n      };\n    };\n    var Browser = {\n      unknown: unknown$1,\n      nu: nu$3,\n      edge: constant(edge),\n      chrome: constant(chrome),\n      ie: constant(ie$1),\n      opera: constant(opera),\n      firefox: constant(firefox),\n      safari: constant(safari)\n    };\n\n    var windows = 'Windows';\n    var ios = 'iOS';\n    var android = 'Android';\n    var linux = 'Linux';\n    var osx = 'OSX';\n    var solaris = 'Solaris';\n    var freebsd = 'FreeBSD';\n    var chromeos = 'ChromeOS';\n    var unknown = function () {\n      return nu$2({\n        current: undefined,\n        version: Version.unknown()\n      });\n    };\n    var nu$2 = function (info) {\n      var current = info.current;\n      var version = info.version;\n      var isOS = function (name) {\n        return function () {\n          return current === name;\n        };\n      };\n      return {\n        current: current,\n        version: version,\n        isWindows: isOS(windows),\n        isiOS: isOS(ios),\n        isAndroid: isOS(android),\n        isOSX: isOS(osx),\n        isLinux: isOS(linux),\n        isSolaris: isOS(solaris),\n        isFreeBSD: isOS(freebsd),\n        isChromeOS: isOS(chromeos)\n      };\n    };\n    var OperatingSystem = {\n      unknown: unknown,\n      nu: nu$2,\n      windows: constant(windows),\n      ios: constant(ios),\n      android: constant(android),\n      linux: constant(linux),\n      osx: constant(osx),\n      solaris: constant(solaris),\n      freebsd: constant(freebsd),\n      chromeos: constant(chromeos)\n    };\n\n    var detect$1 = function (userAgent, userAgentDataOpt, mediaMatch) {\n      var browsers = PlatformInfo.browsers();\n      var oses = PlatformInfo.oses();\n      var browser = userAgentDataOpt.bind(function (userAgentData) {\n        return detectBrowser$1(browsers, userAgentData);\n      }).orThunk(function () {\n        return detectBrowser(browsers, userAgent);\n      }).fold(Browser.unknown, Browser.nu);\n      var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);\n      var deviceType = DeviceType(os, browser, userAgent, mediaMatch);\n      return {\n        browser: browser,\n        os: os,\n        deviceType: deviceType\n      };\n    };\n    var PlatformDetection = { detect: detect$1 };\n\n    var mediaMatch = function (query) {\n      return window.matchMedia(query).matches;\n    };\n    var platform$2 = cached(function () {\n      return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);\n    });\n    var detect = function () {\n      return platform$2();\n    };\n\n    var userAgent = navigator.userAgent;\n    var platform$1 = detect();\n    var browser$4 = platform$1.browser;\n    var os = platform$1.os;\n    var deviceType = platform$1.deviceType;\n    var webkit = /WebKit/.test(userAgent) && !browser$4.isEdge();\n    var fileApi = 'FormData' in window && 'FileReader' in window && 'URL' in window && !!URL.createObjectURL;\n    var windowsPhone = userAgent.indexOf('Windows Phone') !== -1;\n    var Env = {\n      opera: browser$4.isOpera(),\n      webkit: webkit,\n      ie: browser$4.isIE() || browser$4.isEdge() ? browser$4.version.major : false,\n      gecko: browser$4.isFirefox(),\n      mac: os.isOSX() || os.isiOS(),\n      iOS: deviceType.isiPad() || deviceType.isiPhone(),\n      android: os.isAndroid(),\n      contentEditable: true,\n      transparentSrc: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',\n      caretAfter: true,\n      range: window.getSelection && 'Range' in window,\n      documentMode: browser$4.isIE() ? document.documentMode || 7 : 10,\n      fileApi: fileApi,\n      ceFalse: true,\n      cacheSuffix: null,\n      container: null,\n      experimentalShadowDom: false,\n      canHaveCSP: !browser$4.isIE(),\n      desktop: deviceType.isDesktop(),\n      windowsPhone: windowsPhone,\n      browser: {\n        current: browser$4.current,\n        version: browser$4.version,\n        isChrome: browser$4.isChrome,\n        isEdge: browser$4.isEdge,\n        isFirefox: browser$4.isFirefox,\n        isIE: browser$4.isIE,\n        isOpera: browser$4.isOpera,\n        isSafari: browser$4.isSafari\n      },\n      os: {\n        current: os.current,\n        version: os.version,\n        isAndroid: os.isAndroid,\n        isChromeOS: os.isChromeOS,\n        isFreeBSD: os.isFreeBSD,\n        isiOS: os.isiOS,\n        isLinux: os.isLinux,\n        isOSX: os.isOSX,\n        isSolaris: os.isSolaris,\n        isWindows: os.isWindows\n      },\n      deviceType: {\n        isDesktop: deviceType.isDesktop,\n        isiPad: deviceType.isiPad,\n        isiPhone: deviceType.isiPhone,\n        isPhone: deviceType.isPhone,\n        isTablet: deviceType.isTablet,\n        isTouch: deviceType.isTouch,\n        isWebView: deviceType.isWebView\n      }\n    };\n\n    var whiteSpaceRegExp$2 = /^\\s*|\\s*$/g;\n    var trim$4 = function (str) {\n      return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp$2, '');\n    };\n    var is$3 = function (obj, type) {\n      if (!type) {\n        return obj !== undefined;\n      }\n      if (type === 'array' && isArray(obj)) {\n        return true;\n      }\n      return typeof obj === type;\n    };\n    var makeMap$4 = function (items, delim, map) {\n      var i;\n      items = items || [];\n      delim = delim || ',';\n      if (typeof items === 'string') {\n        items = items.split(delim);\n      }\n      map = map || {};\n      i = items.length;\n      while (i--) {\n        map[items[i]] = {};\n      }\n      return map;\n    };\n    var hasOwnProperty = has$2;\n    var create$9 = function (s, p, root) {\n      var self = this;\n      var sp, scn, c, de = 0;\n      s = /^((static) )?([\\w.]+)(:([\\w.]+))?/.exec(s);\n      var cn = s[3].match(/(^|\\.)(\\w+)$/i)[2];\n      var ns = self.createNS(s[3].replace(/\\.\\w+$/, ''), root);\n      if (ns[cn]) {\n        return;\n      }\n      if (s[2] === 'static') {\n        ns[cn] = p;\n        if (this.onCreate) {\n          this.onCreate(s[2], s[3], ns[cn]);\n        }\n        return;\n      }\n      if (!p[cn]) {\n        p[cn] = function () {\n        };\n        de = 1;\n      }\n      ns[cn] = p[cn];\n      self.extend(ns[cn].prototype, p);\n      if (s[5]) {\n        sp = self.resolve(s[5]).prototype;\n        scn = s[5].match(/\\.(\\w+)$/i)[1];\n        c = ns[cn];\n        if (de) {\n          ns[cn] = function () {\n            return sp[scn].apply(this, arguments);\n          };\n        } else {\n          ns[cn] = function () {\n            this.parent = sp[scn];\n            return c.apply(this, arguments);\n          };\n        }\n        ns[cn].prototype[cn] = ns[cn];\n        self.each(sp, function (f, n) {\n          ns[cn].prototype[n] = sp[n];\n        });\n        self.each(p, function (f, n) {\n          if (sp[n]) {\n            ns[cn].prototype[n] = function () {\n              this.parent = sp[n];\n              return f.apply(this, arguments);\n            };\n          } else {\n            if (n !== cn) {\n              ns[cn].prototype[n] = f;\n            }\n          }\n        });\n      }\n      self.each(p.static, function (f, n) {\n        ns[cn][n] = f;\n      });\n    };\n    var extend$6 = function (obj) {\n      var exts = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        exts[_i - 1] = arguments[_i];\n      }\n      for (var i = 0; i < exts.length; i++) {\n        var ext = exts[i];\n        for (var name_1 in ext) {\n          if (has$2(ext, name_1)) {\n            var value = ext[name_1];\n            if (value !== undefined) {\n              obj[name_1] = value;\n            }\n          }\n        }\n      }\n      return obj;\n    };\n    var walk$3 = function (o, f, n, s) {\n      s = s || this;\n      if (o) {\n        if (n) {\n          o = o[n];\n        }\n        each$i(o, function (o, i) {\n          if (f.call(s, o, i, n) === false) {\n            return false;\n          }\n          walk$3(o, f, n, s);\n        });\n      }\n    };\n    var createNS = function (n, o) {\n      var i, v;\n      o = o || window;\n      n = n.split('.');\n      for (i = 0; i < n.length; i++) {\n        v = n[i];\n        if (!o[v]) {\n          o[v] = {};\n        }\n        o = o[v];\n      }\n      return o;\n    };\n    var resolve$3 = function (n, o) {\n      var i, l;\n      o = o || window;\n      n = n.split('.');\n      for (i = 0, l = n.length; i < l; i++) {\n        o = o[n[i]];\n        if (!o) {\n          break;\n        }\n      }\n      return o;\n    };\n    var explode$4 = function (s, d) {\n      if (!s || is$3(s, 'array')) {\n        return s;\n      }\n      return map$1(s.split(d || ','), trim$4);\n    };\n    var _addCacheSuffix = function (url) {\n      var cacheSuffix = Env.cacheSuffix;\n      if (cacheSuffix) {\n        url += (url.indexOf('?') === -1 ? '?' : '&') + cacheSuffix;\n      }\n      return url;\n    };\n    var Tools = {\n      trim: trim$4,\n      isArray: isArray,\n      is: is$3,\n      toArray: toArray$1,\n      makeMap: makeMap$4,\n      each: each$i,\n      map: map$1,\n      grep: filter$2,\n      inArray: indexOf$1,\n      hasOwn: hasOwnProperty,\n      extend: extend$6,\n      create: create$9,\n      walk: walk$3,\n      createNS: createNS,\n      resolve: resolve$3,\n      explode: explode$4,\n      _addCacheSuffix: _addCacheSuffix\n    };\n\n    var fromHtml$1 = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      if (!div.hasChildNodes() || div.childNodes.length > 1) {\n        console.error('HTML does not have a single root node', html);\n        throw new Error('HTML must have a single root node');\n      }\n      return fromDom$2(div.childNodes[0]);\n    };\n    var fromTag = function (tag, scope) {\n      var doc = scope || document;\n      var node = doc.createElement(tag);\n      return fromDom$2(node);\n    };\n    var fromText = function (text, scope) {\n      var doc = scope || document;\n      var node = doc.createTextNode(text);\n      return fromDom$2(node);\n    };\n    var fromDom$2 = function (node) {\n      if (node === null || node === undefined) {\n        throw new Error('Node cannot be null or undefined');\n      }\n      return { dom: node };\n    };\n    var fromPoint$1 = function (docElm, x, y) {\n      return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom$2);\n    };\n    var SugarElement = {\n      fromHtml: fromHtml$1,\n      fromTag: fromTag,\n      fromText: fromText,\n      fromDom: fromDom$2,\n      fromPoint: fromPoint$1\n    };\n\n    var toArray = function (target, f) {\n      var r = [];\n      var recurse = function (e) {\n        r.push(e);\n        return f(e);\n      };\n      var cur = f(target);\n      do {\n        cur = cur.bind(recurse);\n      } while (cur.isSome());\n      return r;\n    };\n\n    var compareDocumentPosition = function (a, b, match) {\n      return (a.compareDocumentPosition(b) & match) !== 0;\n    };\n    var documentPositionContainedBy = function (a, b) {\n      return compareDocumentPosition(a, b, Node.DOCUMENT_POSITION_CONTAINED_BY);\n    };\n\n    var COMMENT = 8;\n    var DOCUMENT = 9;\n    var DOCUMENT_FRAGMENT = 11;\n    var ELEMENT = 1;\n    var TEXT = 3;\n\n    var is$2 = function (element, selector) {\n      var dom = element.dom;\n      if (dom.nodeType !== ELEMENT) {\n        return false;\n      } else {\n        var elem = dom;\n        if (elem.matches !== undefined) {\n          return elem.matches(selector);\n        } else if (elem.msMatchesSelector !== undefined) {\n          return elem.msMatchesSelector(selector);\n        } else if (elem.webkitMatchesSelector !== undefined) {\n          return elem.webkitMatchesSelector(selector);\n        } else if (elem.mozMatchesSelector !== undefined) {\n          return elem.mozMatchesSelector(selector);\n        } else {\n          throw new Error('Browser lacks native selectors');\n        }\n      }\n    };\n    var bypassSelector = function (dom) {\n      return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;\n    };\n    var all = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? [] : map$3(base.querySelectorAll(selector), SugarElement.fromDom);\n    };\n    var one = function (selector, scope) {\n      var base = scope === undefined ? document : scope.dom;\n      return bypassSelector(base) ? Optional.none() : Optional.from(base.querySelector(selector)).map(SugarElement.fromDom);\n    };\n\n    var eq = function (e1, e2) {\n      return e1.dom === e2.dom;\n    };\n    var regularContains = function (e1, e2) {\n      var d1 = e1.dom;\n      var d2 = e2.dom;\n      return d1 === d2 ? false : d1.contains(d2);\n    };\n    var ieContains = function (e1, e2) {\n      return documentPositionContainedBy(e1.dom, e2.dom);\n    };\n    var contains$1 = function (e1, e2) {\n      return detect().browser.isIE() ? ieContains(e1, e2) : regularContains(e1, e2);\n    };\n\n    typeof window !== 'undefined' ? window : Function('return this;')();\n\n    var name = function (element) {\n      var r = element.dom.nodeName;\n      return r.toLowerCase();\n    };\n    var type = function (element) {\n      return element.dom.nodeType;\n    };\n    var isType = function (t) {\n      return function (element) {\n        return type(element) === t;\n      };\n    };\n    var isComment$1 = function (element) {\n      return type(element) === COMMENT || name(element) === '#comment';\n    };\n    var isElement$6 = isType(ELEMENT);\n    var isText$8 = isType(TEXT);\n    var isDocument$2 = isType(DOCUMENT);\n    var isDocumentFragment$1 = isType(DOCUMENT_FRAGMENT);\n    var isTag = function (tag) {\n      return function (e) {\n        return isElement$6(e) && name(e) === tag;\n      };\n    };\n\n    var owner$1 = function (element) {\n      return SugarElement.fromDom(element.dom.ownerDocument);\n    };\n    var documentOrOwner = function (dos) {\n      return isDocument$2(dos) ? dos : owner$1(dos);\n    };\n    var documentElement = function (element) {\n      return SugarElement.fromDom(documentOrOwner(element).dom.documentElement);\n    };\n    var defaultView = function (element) {\n      return SugarElement.fromDom(documentOrOwner(element).dom.defaultView);\n    };\n    var parent = function (element) {\n      return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);\n    };\n    var parents$1 = function (element, isRoot) {\n      var stop = isFunction(isRoot) ? isRoot : never;\n      var dom = element.dom;\n      var ret = [];\n      while (dom.parentNode !== null && dom.parentNode !== undefined) {\n        var rawParent = dom.parentNode;\n        var p = SugarElement.fromDom(rawParent);\n        ret.push(p);\n        if (stop(p) === true) {\n          break;\n        } else {\n          dom = rawParent;\n        }\n      }\n      return ret;\n    };\n    var siblings = function (element) {\n      var filterSelf = function (elements) {\n        return filter$4(elements, function (x) {\n          return !eq(element, x);\n        });\n      };\n      return parent(element).map(children).map(filterSelf).getOr([]);\n    };\n    var prevSibling = function (element) {\n      return Optional.from(element.dom.previousSibling).map(SugarElement.fromDom);\n    };\n    var nextSibling = function (element) {\n      return Optional.from(element.dom.nextSibling).map(SugarElement.fromDom);\n    };\n    var prevSiblings = function (element) {\n      return reverse(toArray(element, prevSibling));\n    };\n    var nextSiblings = function (element) {\n      return toArray(element, nextSibling);\n    };\n    var children = function (element) {\n      return map$3(element.dom.childNodes, SugarElement.fromDom);\n    };\n    var child$1 = function (element, index) {\n      var cs = element.dom.childNodes;\n      return Optional.from(cs[index]).map(SugarElement.fromDom);\n    };\n    var firstChild = function (element) {\n      return child$1(element, 0);\n    };\n    var lastChild = function (element) {\n      return child$1(element, element.dom.childNodes.length - 1);\n    };\n    var childNodesCount = function (element) {\n      return element.dom.childNodes.length;\n    };\n\n    var getHead = function (doc) {\n      var b = doc.dom.head;\n      if (b === null || b === undefined) {\n        throw new Error('Head is not available yet');\n      }\n      return SugarElement.fromDom(b);\n    };\n\n    var isShadowRoot = function (dos) {\n      return isDocumentFragment$1(dos) && isNonNullable(dos.dom.host);\n    };\n    var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);\n    var isSupported$1 = constant(supported);\n    var getRootNode = supported ? function (e) {\n      return SugarElement.fromDom(e.dom.getRootNode());\n    } : documentOrOwner;\n    var getStyleContainer = function (dos) {\n      return isShadowRoot(dos) ? dos : getHead(documentOrOwner(dos));\n    };\n    var getShadowRoot = function (e) {\n      var r = getRootNode(e);\n      return isShadowRoot(r) ? Optional.some(r) : Optional.none();\n    };\n    var getShadowHost = function (e) {\n      return SugarElement.fromDom(e.dom.host);\n    };\n    var getOriginalEventTarget = function (event) {\n      if (isSupported$1() && isNonNullable(event.target)) {\n        var el = SugarElement.fromDom(event.target);\n        if (isElement$6(el) && isOpenShadowHost(el)) {\n          if (event.composed && event.composedPath) {\n            var composedPath = event.composedPath();\n            if (composedPath) {\n              return head(composedPath);\n            }\n          }\n        }\n      }\n      return Optional.from(event.target);\n    };\n    var isOpenShadowHost = function (element) {\n      return isNonNullable(element.dom.shadowRoot);\n    };\n\n    var before$4 = function (marker, element) {\n      var parent$1 = parent(marker);\n      parent$1.each(function (v) {\n        v.dom.insertBefore(element.dom, marker.dom);\n      });\n    };\n    var after$3 = function (marker, element) {\n      var sibling = nextSibling(marker);\n      sibling.fold(function () {\n        var parent$1 = parent(marker);\n        parent$1.each(function (v) {\n          append$1(v, element);\n        });\n      }, function (v) {\n        before$4(v, element);\n      });\n    };\n    var prepend = function (parent, element) {\n      var firstChild$1 = firstChild(parent);\n      firstChild$1.fold(function () {\n        append$1(parent, element);\n      }, function (v) {\n        parent.dom.insertBefore(element.dom, v.dom);\n      });\n    };\n    var append$1 = function (parent, element) {\n      parent.dom.appendChild(element.dom);\n    };\n    var wrap$3 = function (element, wrapper) {\n      before$4(element, wrapper);\n      append$1(wrapper, element);\n    };\n\n    var before$3 = function (marker, elements) {\n      each$k(elements, function (x) {\n        before$4(marker, x);\n      });\n    };\n    var append = function (parent, elements) {\n      each$k(elements, function (x) {\n        append$1(parent, x);\n      });\n    };\n\n    var empty = function (element) {\n      element.dom.textContent = '';\n      each$k(children(element), function (rogue) {\n        remove$7(rogue);\n      });\n    };\n    var remove$7 = function (element) {\n      var dom = element.dom;\n      if (dom.parentNode !== null) {\n        dom.parentNode.removeChild(dom);\n      }\n    };\n    var unwrap = function (wrapper) {\n      var children$1 = children(wrapper);\n      if (children$1.length > 0) {\n        before$3(wrapper, children$1);\n      }\n      remove$7(wrapper);\n    };\n\n    var inBody = function (element) {\n      var dom = isText$8(element) ? element.dom.parentNode : element.dom;\n      if (dom === undefined || dom === null || dom.ownerDocument === null) {\n        return false;\n      }\n      var doc = dom.ownerDocument;\n      return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {\n        return doc.body.contains(dom);\n      }, compose1(inBody, getShadowHost));\n    };\n\n    var r = function (left, top) {\n      var translate = function (x, y) {\n        return r(left + x, top + y);\n      };\n      return {\n        left: left,\n        top: top,\n        translate: translate\n      };\n    };\n    var SugarPosition = r;\n\n    var boxPosition = function (dom) {\n      var box = dom.getBoundingClientRect();\n      return SugarPosition(box.left, box.top);\n    };\n    var firstDefinedOrZero = function (a, b) {\n      if (a !== undefined) {\n        return a;\n      } else {\n        return b !== undefined ? b : 0;\n      }\n    };\n    var absolute = function (element) {\n      var doc = element.dom.ownerDocument;\n      var body = doc.body;\n      var win = doc.defaultView;\n      var html = doc.documentElement;\n      if (body === element.dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      var scrollTop = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageYOffset, html.scrollTop);\n      var scrollLeft = firstDefinedOrZero(win === null || win === void 0 ? void 0 : win.pageXOffset, html.scrollLeft);\n      var clientTop = firstDefinedOrZero(html.clientTop, body.clientTop);\n      var clientLeft = firstDefinedOrZero(html.clientLeft, body.clientLeft);\n      return viewport(element).translate(scrollLeft - clientLeft, scrollTop - clientTop);\n    };\n    var viewport = function (element) {\n      var dom = element.dom;\n      var doc = dom.ownerDocument;\n      var body = doc.body;\n      if (body === dom) {\n        return SugarPosition(body.offsetLeft, body.offsetTop);\n      }\n      if (!inBody(element)) {\n        return SugarPosition(0, 0);\n      }\n      return boxPosition(dom);\n    };\n\n    var get$8 = function (_DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;\n      var y = doc.body.scrollTop || doc.documentElement.scrollTop;\n      return SugarPosition(x, y);\n    };\n    var to = function (x, y, _DOC) {\n      var doc = _DOC !== undefined ? _DOC.dom : document;\n      var win = doc.defaultView;\n      if (win) {\n        win.scrollTo(x, y);\n      }\n    };\n    var intoView = function (element, alignToTop) {\n      var isSafari = detect().browser.isSafari();\n      if (isSafari && isFunction(element.dom.scrollIntoViewIfNeeded)) {\n        element.dom.scrollIntoViewIfNeeded(false);\n      } else {\n        element.dom.scrollIntoView(alignToTop);\n      }\n    };\n\n    var get$7 = function (_win) {\n      var win = _win === undefined ? window : _win;\n      if (detect().browser.isFirefox()) {\n        return Optional.none();\n      } else {\n        return Optional.from(win['visualViewport']);\n      }\n    };\n    var bounds = function (x, y, width, height) {\n      return {\n        x: x,\n        y: y,\n        width: width,\n        height: height,\n        right: x + width,\n        bottom: y + height\n      };\n    };\n    var getBounds = function (_win) {\n      var win = _win === undefined ? window : _win;\n      var doc = win.document;\n      var scroll = get$8(SugarElement.fromDom(doc));\n      return get$7(win).fold(function () {\n        var html = win.document.documentElement;\n        var width = html.clientWidth;\n        var height = html.clientHeight;\n        return bounds(scroll.left, scroll.top, width, height);\n      }, function (visualViewport) {\n        return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);\n      });\n    };\n\n    var isNodeType = function (type) {\n      return function (node) {\n        return !!node && node.nodeType === type;\n      };\n    };\n    var isRestrictedNode = function (node) {\n      return !!node && !Object.getPrototypeOf(node);\n    };\n    var isElement$5 = isNodeType(1);\n    var matchNodeNames = function (names) {\n      var lowercasedNames = names.map(function (s) {\n        return s.toLowerCase();\n      });\n      return function (node) {\n        if (node && node.nodeName) {\n          var nodeName = node.nodeName.toLowerCase();\n          return contains$3(lowercasedNames, nodeName);\n        }\n        return false;\n      };\n    };\n    var matchStyleValues = function (name, values) {\n      var items = values.toLowerCase().split(' ');\n      return function (node) {\n        if (isElement$5(node)) {\n          for (var i = 0; i < items.length; i++) {\n            var computed = node.ownerDocument.defaultView.getComputedStyle(node, null);\n            var cssValue = computed ? computed.getPropertyValue(name) : null;\n            if (cssValue === items[i]) {\n              return true;\n            }\n          }\n        }\n        return false;\n      };\n    };\n    var hasAttribute = function (attrName) {\n      return function (node) {\n        return isElement$5(node) && node.hasAttribute(attrName);\n      };\n    };\n    var hasAttributeValue = function (attrName, attrValue) {\n      return function (node) {\n        return isElement$5(node) && node.getAttribute(attrName) === attrValue;\n      };\n    };\n    var isBogus$2 = function (node) {\n      return isElement$5(node) && node.hasAttribute('data-mce-bogus');\n    };\n    var isBogusAll$1 = function (node) {\n      return isElement$5(node) && node.getAttribute('data-mce-bogus') === 'all';\n    };\n    var isTable$3 = function (node) {\n      return isElement$5(node) && node.tagName === 'TABLE';\n    };\n    var hasContentEditableState = function (value) {\n      return function (node) {\n        if (isElement$5(node)) {\n          if (node.contentEditable === value) {\n            return true;\n          }\n          if (node.getAttribute('data-mce-contenteditable') === value) {\n            return true;\n          }\n        }\n        return false;\n      };\n    };\n    var isTextareaOrInput = matchNodeNames([\n      'textarea',\n      'input'\n    ]);\n    var isText$7 = isNodeType(3);\n    var isComment = isNodeType(8);\n    var isDocument$1 = isNodeType(9);\n    var isDocumentFragment = isNodeType(11);\n    var isBr$5 = matchNodeNames(['br']);\n    var isImg = matchNodeNames(['img']);\n    var isContentEditableTrue$4 = hasContentEditableState('true');\n    var isContentEditableFalse$b = hasContentEditableState('false');\n    var isTableCell$5 = matchNodeNames([\n      'td',\n      'th'\n    ]);\n    var isMedia$2 = matchNodeNames([\n      'video',\n      'audio',\n      'object',\n      'embed'\n    ]);\n\n    var is$1 = function (lhs, rhs, comparator) {\n      if (comparator === void 0) {\n        comparator = tripleEquals;\n      }\n      return lhs.exists(function (left) {\n        return comparator(left, rhs);\n      });\n    };\n    var cat = function (arr) {\n      var r = [];\n      var push = function (x) {\n        r.push(x);\n      };\n      for (var i = 0; i < arr.length; i++) {\n        arr[i].each(push);\n      }\n      return r;\n    };\n    var lift2 = function (oa, ob, f) {\n      return oa.isSome() && ob.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie())) : Optional.none();\n    };\n    var lift3 = function (oa, ob, oc, f) {\n      return oa.isSome() && ob.isSome() && oc.isSome() ? Optional.some(f(oa.getOrDie(), ob.getOrDie(), oc.getOrDie())) : Optional.none();\n    };\n    var someIf = function (b, a) {\n      return b ? Optional.some(a) : Optional.none();\n    };\n\n    var isSupported = function (dom) {\n      return dom.style !== undefined && isFunction(dom.style.getPropertyValue);\n    };\n\n    var rawSet = function (dom, key, value) {\n      if (isString$1(value) || isBoolean(value) || isNumber(value)) {\n        dom.setAttribute(key, value + '');\n      } else {\n        console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);\n        throw new Error('Attribute value was not simple');\n      }\n    };\n    var set$1 = function (element, key, value) {\n      rawSet(element.dom, key, value);\n    };\n    var setAll$1 = function (element, attrs) {\n      var dom = element.dom;\n      each$j(attrs, function (v, k) {\n        rawSet(dom, k, v);\n      });\n    };\n    var get$6 = function (element, key) {\n      var v = element.dom.getAttribute(key);\n      return v === null ? undefined : v;\n    };\n    var getOpt = function (element, key) {\n      return Optional.from(get$6(element, key));\n    };\n    var has$1 = function (element, key) {\n      var dom = element.dom;\n      return dom && dom.hasAttribute ? dom.hasAttribute(key) : false;\n    };\n    var remove$6 = function (element, key) {\n      element.dom.removeAttribute(key);\n    };\n    var clone$3 = function (element) {\n      return foldl(element.dom.attributes, function (acc, attr) {\n        acc[attr.name] = attr.value;\n        return acc;\n      }, {});\n    };\n\n    var internalSet = function (dom, property, value) {\n      if (!isString$1(value)) {\n        console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);\n        throw new Error('CSS value must be a string: ' + value);\n      }\n      if (isSupported(dom)) {\n        dom.style.setProperty(property, value);\n      }\n    };\n    var setAll = function (element, css) {\n      var dom = element.dom;\n      each$j(css, function (v, k) {\n        internalSet(dom, k, v);\n      });\n    };\n    var get$5 = function (element, property) {\n      var dom = element.dom;\n      var styles = window.getComputedStyle(dom);\n      var r = styles.getPropertyValue(property);\n      return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;\n    };\n    var getUnsafeProperty = function (dom, property) {\n      return isSupported(dom) ? dom.style.getPropertyValue(property) : '';\n    };\n    var getRaw = function (element, property) {\n      var dom = element.dom;\n      var raw = getUnsafeProperty(dom, property);\n      return Optional.from(raw).filter(function (r) {\n        return r.length > 0;\n      });\n    };\n    var getAllRaw = function (element) {\n      var css = {};\n      var dom = element.dom;\n      if (isSupported(dom)) {\n        for (var i = 0; i < dom.style.length; i++) {\n          var ruleName = dom.style.item(i);\n          css[ruleName] = dom.style[ruleName];\n        }\n      }\n      return css;\n    };\n    var reflow = function (e) {\n      return e.dom.offsetWidth;\n    };\n\n    var browser$3 = detect().browser;\n    var firstElement = function (nodes) {\n      return find$3(nodes, isElement$6);\n    };\n    var getTableCaptionDeltaY = function (elm) {\n      if (browser$3.isFirefox() && name(elm) === 'table') {\n        return firstElement(children(elm)).filter(function (elm) {\n          return name(elm) === 'caption';\n        }).bind(function (caption) {\n          return firstElement(nextSiblings(caption)).map(function (body) {\n            var bodyTop = body.dom.offsetTop;\n            var captionTop = caption.dom.offsetTop;\n            var captionHeight = caption.dom.offsetHeight;\n            return bodyTop <= captionTop ? -captionHeight : 0;\n          });\n        }).getOr(0);\n      } else {\n        return 0;\n      }\n    };\n    var hasChild = function (elm, child) {\n      return elm.children && contains$3(elm.children, child);\n    };\n    var getPos = function (body, elm, rootElm) {\n      var x = 0, y = 0;\n      var doc = body.ownerDocument;\n      rootElm = rootElm ? rootElm : body;\n      if (elm) {\n        if (rootElm === body && elm.getBoundingClientRect && get$5(SugarElement.fromDom(body), 'position') === 'static') {\n          var pos = elm.getBoundingClientRect();\n          x = pos.left + (doc.documentElement.scrollLeft || body.scrollLeft) - doc.documentElement.clientLeft;\n          y = pos.top + (doc.documentElement.scrollTop || body.scrollTop) - doc.documentElement.clientTop;\n          return {\n            x: x,\n            y: y\n          };\n        }\n        var offsetParent = elm;\n        while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {\n          var castOffsetParent = offsetParent;\n          x += castOffsetParent.offsetLeft || 0;\n          y += castOffsetParent.offsetTop || 0;\n          offsetParent = castOffsetParent.offsetParent;\n        }\n        offsetParent = elm.parentNode;\n        while (offsetParent && offsetParent !== rootElm && offsetParent.nodeType && !hasChild(offsetParent, rootElm)) {\n          x -= offsetParent.scrollLeft || 0;\n          y -= offsetParent.scrollTop || 0;\n          offsetParent = offsetParent.parentNode;\n        }\n        y += getTableCaptionDeltaY(SugarElement.fromDom(elm));\n      }\n      return {\n        x: x,\n        y: y\n      };\n    };\n\n    var exports$1 = {}, module$1 = { exports: exports$1 };\n    (function (define, exports, module, require) {\n      (function (global, factory) {\n        typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EphoxContactWrapper = factory());\n      }(this, function () {\n        var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n        var promise = { exports: {} };\n        (function (module) {\n          (function (root) {\n            var setTimeoutFunc = setTimeout;\n            function noop() {\n            }\n            function bind(fn, thisArg) {\n              return function () {\n                fn.apply(thisArg, arguments);\n              };\n            }\n            function Promise(fn) {\n              if (typeof this !== 'object')\n                throw new TypeError('Promises must be constructed via new');\n              if (typeof fn !== 'function')\n                throw new TypeError('not a function');\n              this._state = 0;\n              this._handled = false;\n              this._value = undefined;\n              this._deferreds = [];\n              doResolve(fn, this);\n            }\n            function handle(self, deferred) {\n              while (self._state === 3) {\n                self = self._value;\n              }\n              if (self._state === 0) {\n                self._deferreds.push(deferred);\n                return;\n              }\n              self._handled = true;\n              Promise._immediateFn(function () {\n                var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n                if (cb === null) {\n                  (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n                  return;\n                }\n                var ret;\n                try {\n                  ret = cb(self._value);\n                } catch (e) {\n                  reject(deferred.promise, e);\n                  return;\n                }\n                resolve(deferred.promise, ret);\n              });\n            }\n            function resolve(self, newValue) {\n              try {\n                if (newValue === self)\n                  throw new TypeError('A promise cannot be resolved with itself.');\n                if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n                  var then = newValue.then;\n                  if (newValue instanceof Promise) {\n                    self._state = 3;\n                    self._value = newValue;\n                    finale(self);\n                    return;\n                  } else if (typeof then === 'function') {\n                    doResolve(bind(then, newValue), self);\n                    return;\n                  }\n                }\n                self._state = 1;\n                self._value = newValue;\n                finale(self);\n              } catch (e) {\n                reject(self, e);\n              }\n            }\n            function reject(self, newValue) {\n              self._state = 2;\n              self._value = newValue;\n              finale(self);\n            }\n            function finale(self) {\n              if (self._state === 2 && self._deferreds.length === 0) {\n                Promise._immediateFn(function () {\n                  if (!self._handled) {\n                    Promise._unhandledRejectionFn(self._value);\n                  }\n                });\n              }\n              for (var i = 0, len = self._deferreds.length; i < len; i++) {\n                handle(self, self._deferreds[i]);\n              }\n              self._deferreds = null;\n            }\n            function Handler(onFulfilled, onRejected, promise) {\n              this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n              this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n              this.promise = promise;\n            }\n            function doResolve(fn, self) {\n              var done = false;\n              try {\n                fn(function (value) {\n                  if (done)\n                    return;\n                  done = true;\n                  resolve(self, value);\n                }, function (reason) {\n                  if (done)\n                    return;\n                  done = true;\n                  reject(self, reason);\n                });\n              } catch (ex) {\n                if (done)\n                  return;\n                done = true;\n                reject(self, ex);\n              }\n            }\n            Promise.prototype['catch'] = function (onRejected) {\n              return this.then(null, onRejected);\n            };\n            Promise.prototype.then = function (onFulfilled, onRejected) {\n              var prom = new this.constructor(noop);\n              handle(this, new Handler(onFulfilled, onRejected, prom));\n              return prom;\n            };\n            Promise.all = function (arr) {\n              var args = Array.prototype.slice.call(arr);\n              return new Promise(function (resolve, reject) {\n                if (args.length === 0)\n                  return resolve([]);\n                var remaining = args.length;\n                function res(i, val) {\n                  try {\n                    if (val && (typeof val === 'object' || typeof val === 'function')) {\n                      var then = val.then;\n                      if (typeof then === 'function') {\n                        then.call(val, function (val) {\n                          res(i, val);\n                        }, reject);\n                        return;\n                      }\n                    }\n                    args[i] = val;\n                    if (--remaining === 0) {\n                      resolve(args);\n                    }\n                  } catch (ex) {\n                    reject(ex);\n                  }\n                }\n                for (var i = 0; i < args.length; i++) {\n                  res(i, args[i]);\n                }\n              });\n            };\n            Promise.resolve = function (value) {\n              if (value && typeof value === 'object' && value.constructor === Promise) {\n                return value;\n              }\n              return new Promise(function (resolve) {\n                resolve(value);\n              });\n            };\n            Promise.reject = function (value) {\n              return new Promise(function (resolve, reject) {\n                reject(value);\n              });\n            };\n            Promise.race = function (values) {\n              return new Promise(function (resolve, reject) {\n                for (var i = 0, len = values.length; i < len; i++) {\n                  values[i].then(resolve, reject);\n                }\n              });\n            };\n            Promise._immediateFn = typeof setImmediate === 'function' ? function (fn) {\n              setImmediate(fn);\n            } : function (fn) {\n              setTimeoutFunc(fn, 0);\n            };\n            Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n              if (typeof console !== 'undefined' && console) {\n                console.warn('Possible Unhandled Promise Rejection:', err);\n              }\n            };\n            Promise._setImmediateFn = function _setImmediateFn(fn) {\n              Promise._immediateFn = fn;\n            };\n            Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {\n              Promise._unhandledRejectionFn = fn;\n            };\n            if (module.exports) {\n              module.exports = Promise;\n            } else if (!root.Promise) {\n              root.Promise = Promise;\n            }\n          }(commonjsGlobal));\n        }(promise));\n        var promisePolyfill = promise.exports;\n        var Global = function () {\n          if (typeof window !== 'undefined') {\n            return window;\n          } else {\n            return Function('return this;')();\n          }\n        }();\n        var promisePolyfill_1 = { boltExport: Global.Promise || promisePolyfill };\n        return promisePolyfill_1;\n      }));\n    }(undefined, exports$1, module$1));\n    var Promise$1 = module$1.exports.boltExport;\n\n    var nu$1 = function (baseFn) {\n      var data = Optional.none();\n      var callbacks = [];\n      var map = function (f) {\n        return nu$1(function (nCallback) {\n          get(function (data) {\n            nCallback(f(data));\n          });\n        });\n      };\n      var get = function (nCallback) {\n        if (isReady()) {\n          call(nCallback);\n        } else {\n          callbacks.push(nCallback);\n        }\n      };\n      var set = function (x) {\n        if (!isReady()) {\n          data = Optional.some(x);\n          run(callbacks);\n          callbacks = [];\n        }\n      };\n      var isReady = function () {\n        return data.isSome();\n      };\n      var run = function (cbs) {\n        each$k(cbs, call);\n      };\n      var call = function (cb) {\n        data.each(function (x) {\n          setTimeout(function () {\n            cb(x);\n          }, 0);\n        });\n      };\n      baseFn(set);\n      return {\n        get: get,\n        map: map,\n        isReady: isReady\n      };\n    };\n    var pure$1 = function (a) {\n      return nu$1(function (callback) {\n        callback(a);\n      });\n    };\n    var LazyValue = {\n      nu: nu$1,\n      pure: pure$1\n    };\n\n    var errorReporter = function (err) {\n      setTimeout(function () {\n        throw err;\n      }, 0);\n    };\n    var make = function (run) {\n      var get = function (callback) {\n        run().then(callback, errorReporter);\n      };\n      var map = function (fab) {\n        return make(function () {\n          return run().then(fab);\n        });\n      };\n      var bind = function (aFutureB) {\n        return make(function () {\n          return run().then(function (v) {\n            return aFutureB(v).toPromise();\n          });\n        });\n      };\n      var anonBind = function (futureB) {\n        return make(function () {\n          return run().then(function () {\n            return futureB.toPromise();\n          });\n        });\n      };\n      var toLazy = function () {\n        return LazyValue.nu(get);\n      };\n      var toCached = function () {\n        var cache = null;\n        return make(function () {\n          if (cache === null) {\n            cache = run();\n          }\n          return cache;\n        });\n      };\n      var toPromise = run;\n      return {\n        map: map,\n        bind: bind,\n        anonBind: anonBind,\n        toLazy: toLazy,\n        toCached: toCached,\n        toPromise: toPromise,\n        get: get\n      };\n    };\n    var nu = function (baseFn) {\n      return make(function () {\n        return new Promise$1(baseFn);\n      });\n    };\n    var pure = function (a) {\n      return make(function () {\n        return Promise$1.resolve(a);\n      });\n    };\n    var Future = {\n      nu: nu,\n      pure: pure\n    };\n\n    var par$1 = function (asyncValues, nu) {\n      return nu(function (callback) {\n        var r = [];\n        var count = 0;\n        var cb = function (i) {\n          return function (value) {\n            r[i] = value;\n            count++;\n            if (count >= asyncValues.length) {\n              callback(r);\n            }\n          };\n        };\n        if (asyncValues.length === 0) {\n          callback([]);\n        } else {\n          each$k(asyncValues, function (asyncValue, i) {\n            asyncValue.get(cb(i));\n          });\n        }\n      });\n    };\n\n    var par = function (futures) {\n      return par$1(futures, Future.nu);\n    };\n\n    var value$1 = function (o) {\n      var or = function (_opt) {\n        return value$1(o);\n      };\n      var orThunk = function (_f) {\n        return value$1(o);\n      };\n      var map = function (f) {\n        return value$1(f(o));\n      };\n      var mapError = function (_f) {\n        return value$1(o);\n      };\n      var each = function (f) {\n        f(o);\n      };\n      var bind = function (f) {\n        return f(o);\n      };\n      var fold = function (_, onValue) {\n        return onValue(o);\n      };\n      var exists = function (f) {\n        return f(o);\n      };\n      var forall = function (f) {\n        return f(o);\n      };\n      var toOptional = function () {\n        return Optional.some(o);\n      };\n      return {\n        isValue: always,\n        isError: never,\n        getOr: constant(o),\n        getOrThunk: constant(o),\n        getOrDie: constant(o),\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: each,\n        bind: bind,\n        exists: exists,\n        forall: forall,\n        toOptional: toOptional\n      };\n    };\n    var error = function (message) {\n      var getOrThunk = function (f) {\n        return f();\n      };\n      var getOrDie = function () {\n        return die(String(message))();\n      };\n      var or = identity;\n      var orThunk = function (f) {\n        return f();\n      };\n      var map = function (_f) {\n        return error(message);\n      };\n      var mapError = function (f) {\n        return error(f(message));\n      };\n      var bind = function (_f) {\n        return error(message);\n      };\n      var fold = function (onError, _) {\n        return onError(message);\n      };\n      return {\n        isValue: never,\n        isError: always,\n        getOr: identity,\n        getOrThunk: getOrThunk,\n        getOrDie: getOrDie,\n        or: or,\n        orThunk: orThunk,\n        fold: fold,\n        map: map,\n        mapError: mapError,\n        each: noop,\n        bind: bind,\n        exists: never,\n        forall: always,\n        toOptional: Optional.none\n      };\n    };\n    var fromOption = function (opt, err) {\n      return opt.fold(function () {\n        return error(err);\n      }, value$1);\n    };\n    var Result = {\n      value: value$1,\n      error: error,\n      fromOption: fromOption\n    };\n\n    var generate$1 = function (cases) {\n      if (!isArray$1(cases)) {\n        throw new Error('cases must be an array');\n      }\n      if (cases.length === 0) {\n        throw new Error('there must be at least one case');\n      }\n      var constructors = [];\n      var adt = {};\n      each$k(cases, function (acase, count) {\n        var keys$1 = keys(acase);\n        if (keys$1.length !== 1) {\n          throw new Error('one and only one name per case');\n        }\n        var key = keys$1[0];\n        var value = acase[key];\n        if (adt[key] !== undefined) {\n          throw new Error('duplicate key detected:' + key);\n        } else if (key === 'cata') {\n          throw new Error('cannot have a case named cata (sorry)');\n        } else if (!isArray$1(value)) {\n          throw new Error('case arguments must be an array');\n        }\n        constructors.push(key);\n        adt[key] = function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          var argLength = args.length;\n          if (argLength !== value.length) {\n            throw new Error('Wrong number of arguments to case ' + key + '. Expected ' + value.length + ' (' + value + '), got ' + argLength);\n          }\n          var match = function (branches) {\n            var branchKeys = keys(branches);\n            if (constructors.length !== branchKeys.length) {\n              throw new Error('Wrong number of arguments to match. Expected: ' + constructors.join(',') + '\\nActual: ' + branchKeys.join(','));\n            }\n            var allReqd = forall(constructors, function (reqKey) {\n              return contains$3(branchKeys, reqKey);\n            });\n            if (!allReqd) {\n              throw new Error('Not all branches were specified when using match. Specified: ' + branchKeys.join(', ') + '\\nRequired: ' + constructors.join(', '));\n            }\n            return branches[key].apply(null, args);\n          };\n          return {\n            fold: function () {\n              var foldArgs = [];\n              for (var _i = 0; _i < arguments.length; _i++) {\n                foldArgs[_i] = arguments[_i];\n              }\n              if (foldArgs.length !== cases.length) {\n                throw new Error('Wrong number of arguments to fold. Expected ' + cases.length + ', got ' + foldArgs.length);\n              }\n              var target = foldArgs[count];\n              return target.apply(null, args);\n            },\n            match: match,\n            log: function (label) {\n              console.log(label, {\n                constructors: constructors,\n                constructor: key,\n                params: args\n              });\n            }\n          };\n        };\n      });\n      return adt;\n    };\n    var Adt = { generate: generate$1 };\n\n    Adt.generate([\n      {\n        bothErrors: [\n          'error1',\n          'error2'\n        ]\n      },\n      {\n        firstError: [\n          'error1',\n          'value2'\n        ]\n      },\n      {\n        secondError: [\n          'value1',\n          'error2'\n        ]\n      },\n      {\n        bothValues: [\n          'value1',\n          'value2'\n        ]\n      }\n    ]);\n    var unite = function (result) {\n      return result.fold(identity, identity);\n    };\n\n    function ClosestOrAncestor (is, ancestor, scope, a, isRoot) {\n      if (is(scope, a)) {\n        return Optional.some(scope);\n      } else if (isFunction(isRoot) && isRoot(scope)) {\n        return Optional.none();\n      } else {\n        return ancestor(scope, a, isRoot);\n      }\n    }\n\n    var ancestor$3 = function (scope, predicate, isRoot) {\n      var element = scope.dom;\n      var stop = isFunction(isRoot) ? isRoot : never;\n      while (element.parentNode) {\n        element = element.parentNode;\n        var el = SugarElement.fromDom(element);\n        if (predicate(el)) {\n          return Optional.some(el);\n        } else if (stop(el)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var closest$3 = function (scope, predicate, isRoot) {\n      var is = function (s, test) {\n        return test(s);\n      };\n      return ClosestOrAncestor(is, ancestor$3, scope, predicate, isRoot);\n    };\n    var sibling$2 = function (scope, predicate) {\n      var element = scope.dom;\n      if (!element.parentNode) {\n        return Optional.none();\n      }\n      return child(SugarElement.fromDom(element.parentNode), function (x) {\n        return !eq(scope, x) && predicate(x);\n      });\n    };\n    var child = function (scope, predicate) {\n      var pred = function (node) {\n        return predicate(SugarElement.fromDom(node));\n      };\n      var result = find$3(scope.dom.childNodes, pred);\n      return result.map(SugarElement.fromDom);\n    };\n\n    var ancestor$2 = function (scope, selector, isRoot) {\n      return ancestor$3(scope, function (e) {\n        return is$2(e, selector);\n      }, isRoot);\n    };\n    var descendant = function (scope, selector) {\n      return one(selector, scope);\n    };\n    var closest$2 = function (scope, selector, isRoot) {\n      var is = function (element, selector) {\n        return is$2(element, selector);\n      };\n      return ClosestOrAncestor(is, ancestor$2, scope, selector, isRoot);\n    };\n\n    var promiseObj = window.Promise ? window.Promise : Promise$1;\n\n    var requestAnimationFramePromise;\n    var requestAnimationFrame = function (callback, element) {\n      var requestAnimationFrameFunc = window.requestAnimationFrame;\n      var vendors = [\n        'ms',\n        'moz',\n        'webkit'\n      ];\n      var featurefill = function (cb) {\n        window.setTimeout(cb, 0);\n      };\n      for (var i = 0; i < vendors.length && !requestAnimationFrameFunc; i++) {\n        requestAnimationFrameFunc = window[vendors[i] + 'RequestAnimationFrame'];\n      }\n      if (!requestAnimationFrameFunc) {\n        requestAnimationFrameFunc = featurefill;\n      }\n      requestAnimationFrameFunc(callback, element);\n    };\n    var wrappedSetTimeout = function (callback, time) {\n      if (typeof time !== 'number') {\n        time = 0;\n      }\n      return setTimeout(callback, time);\n    };\n    var wrappedSetInterval = function (callback, time) {\n      if (typeof time !== 'number') {\n        time = 1;\n      }\n      return setInterval(callback, time);\n    };\n    var wrappedClearTimeout = function (id) {\n      return clearTimeout(id);\n    };\n    var wrappedClearInterval = function (id) {\n      return clearInterval(id);\n    };\n    var debounce = function (callback, time) {\n      var timer;\n      var func = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        clearTimeout(timer);\n        timer = wrappedSetTimeout(function () {\n          callback.apply(this, args);\n        }, time);\n      };\n      func.stop = function () {\n        clearTimeout(timer);\n      };\n      return func;\n    };\n    var Delay = {\n      requestAnimationFrame: function (callback, element) {\n        if (requestAnimationFramePromise) {\n          requestAnimationFramePromise.then(callback);\n          return;\n        }\n        requestAnimationFramePromise = new promiseObj(function (resolve) {\n          if (!element) {\n            element = document.body;\n          }\n          requestAnimationFrame(resolve, element);\n        }).then(callback);\n      },\n      setTimeout: wrappedSetTimeout,\n      setInterval: wrappedSetInterval,\n      setEditorTimeout: function (editor, callback, time) {\n        return wrappedSetTimeout(function () {\n          if (!editor.removed) {\n            callback();\n          }\n        }, time);\n      },\n      setEditorInterval: function (editor, callback, time) {\n        var timer = wrappedSetInterval(function () {\n          if (!editor.removed) {\n            callback();\n          } else {\n            clearInterval(timer);\n          }\n        }, time);\n        return timer;\n      },\n      debounce: debounce,\n      throttle: debounce,\n      clearInterval: wrappedClearInterval,\n      clearTimeout: wrappedClearTimeout\n    };\n\n    var StyleSheetLoader = function (documentOrShadowRoot, settings) {\n      if (settings === void 0) {\n        settings = {};\n      }\n      var idCount = 0;\n      var loadedStates = {};\n      var edos = SugarElement.fromDom(documentOrShadowRoot);\n      var doc = documentOrOwner(edos);\n      var maxLoadTime = settings.maxLoadTime || 5000;\n      var _setReferrerPolicy = function (referrerPolicy) {\n        settings.referrerPolicy = referrerPolicy;\n      };\n      var addStyle = function (element) {\n        append$1(getStyleContainer(edos), element);\n      };\n      var removeStyle = function (id) {\n        var styleContainer = getStyleContainer(edos);\n        descendant(styleContainer, '#' + id).each(remove$7);\n      };\n      var getOrCreateState = function (url) {\n        return get$9(loadedStates, url).getOrThunk(function () {\n          return {\n            id: 'mce-u' + idCount++,\n            passed: [],\n            failed: [],\n            count: 0\n          };\n        });\n      };\n      var load = function (url, success, failure) {\n        var link;\n        var urlWithSuffix = Tools._addCacheSuffix(url);\n        var state = getOrCreateState(urlWithSuffix);\n        loadedStates[urlWithSuffix] = state;\n        state.count++;\n        var resolve = function (callbacks, status) {\n          var i = callbacks.length;\n          while (i--) {\n            callbacks[i]();\n          }\n          state.status = status;\n          state.passed = [];\n          state.failed = [];\n          if (link) {\n            link.onload = null;\n            link.onerror = null;\n            link = null;\n          }\n        };\n        var passed = function () {\n          return resolve(state.passed, 2);\n        };\n        var failed = function () {\n          return resolve(state.failed, 3);\n        };\n        var wait = function (testCallback, waitCallback) {\n          if (!testCallback()) {\n            if (Date.now() - startTime < maxLoadTime) {\n              Delay.setTimeout(waitCallback);\n            } else {\n              failed();\n            }\n          }\n        };\n        var waitForWebKitLinkLoaded = function () {\n          wait(function () {\n            var styleSheets = documentOrShadowRoot.styleSheets;\n            var i = styleSheets.length;\n            while (i--) {\n              var styleSheet = styleSheets[i];\n              var owner = styleSheet.ownerNode;\n              if (owner && owner.id === link.id) {\n                passed();\n                return true;\n              }\n            }\n            return false;\n          }, waitForWebKitLinkLoaded);\n        };\n        if (success) {\n          state.passed.push(success);\n        }\n        if (failure) {\n          state.failed.push(failure);\n        }\n        if (state.status === 1) {\n          return;\n        }\n        if (state.status === 2) {\n          passed();\n          return;\n        }\n        if (state.status === 3) {\n          failed();\n          return;\n        }\n        state.status = 1;\n        var linkElem = SugarElement.fromTag('link', doc.dom);\n        setAll$1(linkElem, {\n          rel: 'stylesheet',\n          type: 'text/css',\n          id: state.id\n        });\n        var startTime = Date.now();\n        if (settings.contentCssCors) {\n          set$1(linkElem, 'crossOrigin', 'anonymous');\n        }\n        if (settings.referrerPolicy) {\n          set$1(linkElem, 'referrerpolicy', settings.referrerPolicy);\n        }\n        link = linkElem.dom;\n        link.onload = waitForWebKitLinkLoaded;\n        link.onerror = failed;\n        addStyle(linkElem);\n        set$1(linkElem, 'href', urlWithSuffix);\n      };\n      var loadF = function (url) {\n        return Future.nu(function (resolve) {\n          load(url, compose(resolve, constant(Result.value(url))), compose(resolve, constant(Result.error(url))));\n        });\n      };\n      var loadAll = function (urls, success, failure) {\n        par(map$3(urls, loadF)).get(function (result) {\n          var parts = partition(result, function (r) {\n            return r.isValue();\n          });\n          if (parts.fail.length > 0) {\n            failure(parts.fail.map(unite));\n          } else {\n            success(parts.pass.map(unite));\n          }\n        });\n      };\n      var unload = function (url) {\n        var urlWithSuffix = Tools._addCacheSuffix(url);\n        get$9(loadedStates, urlWithSuffix).each(function (state) {\n          var count = --state.count;\n          if (count === 0) {\n            delete loadedStates[urlWithSuffix];\n            removeStyle(state.id);\n          }\n        });\n      };\n      var unloadAll = function (urls) {\n        each$k(urls, function (url) {\n          unload(url);\n        });\n      };\n      return {\n        load: load,\n        loadAll: loadAll,\n        unload: unload,\n        unloadAll: unloadAll,\n        _setReferrerPolicy: _setReferrerPolicy\n      };\n    };\n\n    var create$8 = function () {\n      var map = new WeakMap();\n      var forElement = function (referenceElement, settings) {\n        var root = getRootNode(referenceElement);\n        var rootDom = root.dom;\n        return Optional.from(map.get(rootDom)).getOrThunk(function () {\n          var sl = StyleSheetLoader(rootDom, settings);\n          map.set(rootDom, sl);\n          return sl;\n        });\n      };\n      return { forElement: forElement };\n    };\n    var instance = create$8();\n\n    var DomTreeWalker = function () {\n      function DomTreeWalker(startNode, rootNode) {\n        this.node = startNode;\n        this.rootNode = rootNode;\n        this.current = this.current.bind(this);\n        this.next = this.next.bind(this);\n        this.prev = this.prev.bind(this);\n        this.prev2 = this.prev2.bind(this);\n      }\n      DomTreeWalker.prototype.current = function () {\n        return this.node;\n      };\n      DomTreeWalker.prototype.next = function (shallow) {\n        this.node = this.findSibling(this.node, 'firstChild', 'nextSibling', shallow);\n        return this.node;\n      };\n      DomTreeWalker.prototype.prev = function (shallow) {\n        this.node = this.findSibling(this.node, 'lastChild', 'previousSibling', shallow);\n        return this.node;\n      };\n      DomTreeWalker.prototype.prev2 = function (shallow) {\n        this.node = this.findPreviousNode(this.node, 'lastChild', 'previousSibling', shallow);\n        return this.node;\n      };\n      DomTreeWalker.prototype.findSibling = function (node, startName, siblingName, shallow) {\n        var sibling, parent;\n        if (node) {\n          if (!shallow && node[startName]) {\n            return node[startName];\n          }\n          if (node !== this.rootNode) {\n            sibling = node[siblingName];\n            if (sibling) {\n              return sibling;\n            }\n            for (parent = node.parentNode; parent && parent !== this.rootNode; parent = parent.parentNode) {\n              sibling = parent[siblingName];\n              if (sibling) {\n                return sibling;\n              }\n            }\n          }\n        }\n      };\n      DomTreeWalker.prototype.findPreviousNode = function (node, startName, siblingName, shallow) {\n        var sibling, parent, child;\n        if (node) {\n          sibling = node[siblingName];\n          if (this.rootNode && sibling === this.rootNode) {\n            return;\n          }\n          if (sibling) {\n            if (!shallow) {\n              for (child = sibling[startName]; child; child = child[startName]) {\n                if (!child[startName]) {\n                  return child;\n                }\n              }\n            }\n            return sibling;\n          }\n          parent = node.parentNode;\n          if (parent && parent !== this.rootNode) {\n            return parent;\n          }\n        }\n      };\n      return DomTreeWalker;\n    }();\n\n    var blocks = [\n      'article',\n      'aside',\n      'details',\n      'div',\n      'dt',\n      'figcaption',\n      'footer',\n      'form',\n      'fieldset',\n      'header',\n      'hgroup',\n      'html',\n      'main',\n      'nav',\n      'section',\n      'summary',\n      'body',\n      'p',\n      'dl',\n      'multicol',\n      'dd',\n      'figure',\n      'address',\n      'center',\n      'blockquote',\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6',\n      'listing',\n      'xmp',\n      'pre',\n      'plaintext',\n      'menu',\n      'dir',\n      'ul',\n      'ol',\n      'li',\n      'hr',\n      'table',\n      'tbody',\n      'thead',\n      'tfoot',\n      'th',\n      'tr',\n      'td',\n      'caption'\n    ];\n    var tableCells = [\n      'td',\n      'th'\n    ];\n    var tableSections = [\n      'thead',\n      'tbody',\n      'tfoot'\n    ];\n    var textBlocks = [\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6',\n      'p',\n      'div',\n      'address',\n      'pre',\n      'form',\n      'blockquote',\n      'center',\n      'dir',\n      'fieldset',\n      'header',\n      'footer',\n      'article',\n      'section',\n      'hgroup',\n      'aside',\n      'nav',\n      'figure'\n    ];\n    var headings = [\n      'h1',\n      'h2',\n      'h3',\n      'h4',\n      'h5',\n      'h6'\n    ];\n    var listItems$1 = [\n      'li',\n      'dd',\n      'dt'\n    ];\n    var lists = [\n      'ul',\n      'ol',\n      'dl'\n    ];\n    var wsElements = [\n      'pre',\n      'script',\n      'textarea',\n      'style'\n    ];\n    var lazyLookup = function (items) {\n      var lookup;\n      return function (node) {\n        lookup = lookup ? lookup : mapToObject(items, always);\n        return has$2(lookup, name(node));\n      };\n    };\n    var isHeading = lazyLookup(headings);\n    var isBlock$2 = lazyLookup(blocks);\n    var isTable$2 = function (node) {\n      return name(node) === 'table';\n    };\n    var isInline$1 = function (node) {\n      return isElement$6(node) && !isBlock$2(node);\n    };\n    var isBr$4 = function (node) {\n      return isElement$6(node) && name(node) === 'br';\n    };\n    var isTextBlock$2 = lazyLookup(textBlocks);\n    var isList = lazyLookup(lists);\n    var isListItem = lazyLookup(listItems$1);\n    var isTableSection = lazyLookup(tableSections);\n    var isTableCell$4 = lazyLookup(tableCells);\n    var isWsPreserveElement = lazyLookup(wsElements);\n\n    var ancestor$1 = function (scope, selector, isRoot) {\n      return ancestor$2(scope, selector, isRoot).isSome();\n    };\n\n    var zeroWidth = '\\uFEFF';\n    var nbsp = '\\xA0';\n    var isZwsp$1 = function (char) {\n      return char === zeroWidth;\n    };\n    var removeZwsp = function (s) {\n      return s.replace(/\\uFEFF/g, '');\n    };\n\n    var ZWSP$1 = zeroWidth;\n    var isZwsp = isZwsp$1;\n    var trim$3 = removeZwsp;\n\n    var isElement$4 = isElement$5;\n    var isText$6 = isText$7;\n    var isCaretContainerBlock$1 = function (node) {\n      if (isText$6(node)) {\n        node = node.parentNode;\n      }\n      return isElement$4(node) && node.hasAttribute('data-mce-caret');\n    };\n    var isCaretContainerInline = function (node) {\n      return isText$6(node) && isZwsp(node.data);\n    };\n    var isCaretContainer$2 = function (node) {\n      return isCaretContainerBlock$1(node) || isCaretContainerInline(node);\n    };\n    var hasContent = function (node) {\n      return node.firstChild !== node.lastChild || !isBr$5(node.firstChild);\n    };\n    var insertInline$1 = function (node, before) {\n      var doc = node.ownerDocument;\n      var textNode = doc.createTextNode(ZWSP$1);\n      var parentNode = node.parentNode;\n      if (!before) {\n        var sibling = node.nextSibling;\n        if (isText$6(sibling)) {\n          if (isCaretContainer$2(sibling)) {\n            return sibling;\n          }\n          if (startsWithCaretContainer$1(sibling)) {\n            sibling.splitText(1);\n            return sibling;\n          }\n        }\n        if (node.nextSibling) {\n          parentNode.insertBefore(textNode, node.nextSibling);\n        } else {\n          parentNode.appendChild(textNode);\n        }\n      } else {\n        var sibling = node.previousSibling;\n        if (isText$6(sibling)) {\n          if (isCaretContainer$2(sibling)) {\n            return sibling;\n          }\n          if (endsWithCaretContainer$1(sibling)) {\n            return sibling.splitText(sibling.data.length - 1);\n          }\n        }\n        parentNode.insertBefore(textNode, node);\n      }\n      return textNode;\n    };\n    var isBeforeInline = function (pos) {\n      var container = pos.container();\n      if (!isText$7(container)) {\n        return false;\n      }\n      return container.data.charAt(pos.offset()) === ZWSP$1 || pos.isAtStart() && isCaretContainerInline(container.previousSibling);\n    };\n    var isAfterInline = function (pos) {\n      var container = pos.container();\n      if (!isText$7(container)) {\n        return false;\n      }\n      return container.data.charAt(pos.offset() - 1) === ZWSP$1 || pos.isAtEnd() && isCaretContainerInline(container.nextSibling);\n    };\n    var createBogusBr = function () {\n      var br = document.createElement('br');\n      br.setAttribute('data-mce-bogus', '1');\n      return br;\n    };\n    var insertBlock$1 = function (blockName, node, before) {\n      var doc = node.ownerDocument;\n      var blockNode = doc.createElement(blockName);\n      blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');\n      blockNode.setAttribute('data-mce-bogus', 'all');\n      blockNode.appendChild(createBogusBr());\n      var parentNode = node.parentNode;\n      if (!before) {\n        if (node.nextSibling) {\n          parentNode.insertBefore(blockNode, node.nextSibling);\n        } else {\n          parentNode.appendChild(blockNode);\n        }\n      } else {\n        parentNode.insertBefore(blockNode, node);\n      }\n      return blockNode;\n    };\n    var startsWithCaretContainer$1 = function (node) {\n      return isText$6(node) && node.data[0] === ZWSP$1;\n    };\n    var endsWithCaretContainer$1 = function (node) {\n      return isText$6(node) && node.data[node.data.length - 1] === ZWSP$1;\n    };\n    var trimBogusBr = function (elm) {\n      var brs = elm.getElementsByTagName('br');\n      var lastBr = brs[brs.length - 1];\n      if (isBogus$2(lastBr)) {\n        lastBr.parentNode.removeChild(lastBr);\n      }\n    };\n    var showCaretContainerBlock = function (caretContainer) {\n      if (caretContainer && caretContainer.hasAttribute('data-mce-caret')) {\n        trimBogusBr(caretContainer);\n        caretContainer.removeAttribute('data-mce-caret');\n        caretContainer.removeAttribute('data-mce-bogus');\n        caretContainer.removeAttribute('style');\n        caretContainer.removeAttribute('_moz_abspos');\n        return caretContainer;\n      }\n      return null;\n    };\n    var isRangeInCaretContainerBlock = function (range) {\n      return isCaretContainerBlock$1(range.startContainer);\n    };\n\n    var isContentEditableTrue$3 = isContentEditableTrue$4;\n    var isContentEditableFalse$a = isContentEditableFalse$b;\n    var isBr$3 = isBr$5;\n    var isText$5 = isText$7;\n    var isInvalidTextElement = matchNodeNames([\n      'script',\n      'style',\n      'textarea'\n    ]);\n    var isAtomicInline = matchNodeNames([\n      'img',\n      'input',\n      'textarea',\n      'hr',\n      'iframe',\n      'video',\n      'audio',\n      'object',\n      'embed'\n    ]);\n    var isTable$1 = matchNodeNames(['table']);\n    var isCaretContainer$1 = isCaretContainer$2;\n    var isCaretCandidate$3 = function (node) {\n      if (isCaretContainer$1(node)) {\n        return false;\n      }\n      if (isText$5(node)) {\n        return !isInvalidTextElement(node.parentNode);\n      }\n      return isAtomicInline(node) || isBr$3(node) || isTable$1(node) || isNonUiContentEditableFalse(node);\n    };\n    var isUnselectable = function (node) {\n      return isElement$5(node) && node.getAttribute('unselectable') === 'true';\n    };\n    var isNonUiContentEditableFalse = function (node) {\n      return isUnselectable(node) === false && isContentEditableFalse$a(node);\n    };\n    var isInEditable = function (node, root) {\n      for (node = node.parentNode; node && node !== root; node = node.parentNode) {\n        if (isNonUiContentEditableFalse(node)) {\n          return false;\n        }\n        if (isContentEditableTrue$3(node)) {\n          return true;\n        }\n      }\n      return true;\n    };\n    var isAtomicContentEditableFalse = function (node) {\n      if (!isNonUiContentEditableFalse(node)) {\n        return false;\n      }\n      return foldl(from(node.getElementsByTagName('*')), function (result, elm) {\n        return result || isContentEditableTrue$3(elm);\n      }, false) !== true;\n    };\n    var isAtomic$1 = function (node) {\n      return isAtomicInline(node) || isAtomicContentEditableFalse(node);\n    };\n    var isEditableCaretCandidate$1 = function (node, root) {\n      return isCaretCandidate$3(node) && isInEditable(node, root);\n    };\n\n    var whiteSpaceRegExp$1 = /^[ \\t\\r\\n]*$/;\n    var isWhitespaceText = function (text) {\n      return whiteSpaceRegExp$1.test(text);\n    };\n\n    var hasWhitespacePreserveParent = function (node, rootNode) {\n      var rootElement = SugarElement.fromDom(rootNode);\n      var startNode = SugarElement.fromDom(node);\n      return ancestor$1(startNode, 'pre,code', curry(eq, rootElement));\n    };\n    var isWhitespace = function (node, rootNode) {\n      return isText$7(node) && isWhitespaceText(node.data) && hasWhitespacePreserveParent(node, rootNode) === false;\n    };\n    var isNamedAnchor = function (node) {\n      return isElement$5(node) && node.nodeName === 'A' && !node.hasAttribute('href') && (node.hasAttribute('name') || node.hasAttribute('id'));\n    };\n    var isContent$1 = function (node, rootNode) {\n      return isCaretCandidate$3(node) && isWhitespace(node, rootNode) === false || isNamedAnchor(node) || isBookmark(node);\n    };\n    var isBookmark = hasAttribute('data-mce-bookmark');\n    var isBogus$1 = hasAttribute('data-mce-bogus');\n    var isBogusAll = hasAttributeValue('data-mce-bogus', 'all');\n    var isEmptyNode = function (targetNode, skipBogus) {\n      var brCount = 0;\n      if (isContent$1(targetNode, targetNode)) {\n        return false;\n      } else {\n        var node = targetNode.firstChild;\n        if (!node) {\n          return true;\n        }\n        var walker = new DomTreeWalker(node, targetNode);\n        do {\n          if (skipBogus) {\n            if (isBogusAll(node)) {\n              node = walker.next(true);\n              continue;\n            }\n            if (isBogus$1(node)) {\n              node = walker.next();\n              continue;\n            }\n          }\n          if (isBr$5(node)) {\n            brCount++;\n            node = walker.next();\n            continue;\n          }\n          if (isContent$1(node, targetNode)) {\n            return false;\n          }\n          node = walker.next();\n        } while (node);\n        return brCount <= 1;\n      }\n    };\n    var isEmpty$2 = function (elm, skipBogus) {\n      if (skipBogus === void 0) {\n        skipBogus = true;\n      }\n      return isEmptyNode(elm.dom, skipBogus);\n    };\n\n    var isSpan = function (node) {\n      return node.nodeName.toLowerCase() === 'span';\n    };\n    var isInlineContent = function (node, root) {\n      return isNonNullable(node) && (isContent$1(node, root) || isInline$1(SugarElement.fromDom(node)));\n    };\n    var surroundedByInlineContent = function (node, root) {\n      var prev = new DomTreeWalker(node, root).prev(false);\n      var next = new DomTreeWalker(node, root).next(false);\n      var prevIsInline = isUndefined(prev) || isInlineContent(prev, root);\n      var nextIsInline = isUndefined(next) || isInlineContent(next, root);\n      return prevIsInline && nextIsInline;\n    };\n    var isBookmarkNode$2 = function (node) {\n      return isSpan(node) && node.getAttribute('data-mce-type') === 'bookmark';\n    };\n    var isKeepTextNode = function (node, root) {\n      return isText$7(node) && node.data.length > 0 && surroundedByInlineContent(node, root);\n    };\n    var isKeepElement = function (node) {\n      return isElement$5(node) ? node.childNodes.length > 0 : false;\n    };\n    var isDocument = function (node) {\n      return isDocumentFragment(node) || isDocument$1(node);\n    };\n    var trimNode = function (dom, node, root) {\n      var rootNode = root || node;\n      if (isElement$5(node) && isBookmarkNode$2(node)) {\n        return node;\n      }\n      var children = node.childNodes;\n      for (var i = children.length - 1; i >= 0; i--) {\n        trimNode(dom, children[i], rootNode);\n      }\n      if (isElement$5(node)) {\n        var currentChildren = node.childNodes;\n        if (currentChildren.length === 1 && isBookmarkNode$2(currentChildren[0])) {\n          node.parentNode.insertBefore(currentChildren[0], node);\n        }\n      }\n      if (!isDocument(node) && !isContent$1(node, rootNode) && !isKeepElement(node) && !isKeepTextNode(node, rootNode)) {\n        dom.remove(node);\n      }\n      return node;\n    };\n\n    var makeMap$3 = Tools.makeMap;\n    var attrsCharsRegExp = /[&<>\\\"\\u0060\\u007E-\\uD7FF\\uE000-\\uFFEF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n    var textCharsRegExp = /[<>&\\u007E-\\uD7FF\\uE000-\\uFFEF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g;\n    var rawCharsRegExp = /[<>&\\\"\\']/g;\n    var entityRegExp = /&#([a-z0-9]+);?|&([a-z0-9]+);/gi;\n    var asciiMap = {\n      128: '\\u20AC',\n      130: '\\u201A',\n      131: '\\u0192',\n      132: '\\u201E',\n      133: '\\u2026',\n      134: '\\u2020',\n      135: '\\u2021',\n      136: '\\u02c6',\n      137: '\\u2030',\n      138: '\\u0160',\n      139: '\\u2039',\n      140: '\\u0152',\n      142: '\\u017d',\n      145: '\\u2018',\n      146: '\\u2019',\n      147: '\\u201C',\n      148: '\\u201D',\n      149: '\\u2022',\n      150: '\\u2013',\n      151: '\\u2014',\n      152: '\\u02DC',\n      153: '\\u2122',\n      154: '\\u0161',\n      155: '\\u203A',\n      156: '\\u0153',\n      158: '\\u017e',\n      159: '\\u0178'\n    };\n    var baseEntities = {\n      '\"': '&quot;',\n      '\\'': '&#39;',\n      '<': '&lt;',\n      '>': '&gt;',\n      '&': '&amp;',\n      '`': '&#96;'\n    };\n    var reverseEntities = {\n      '&lt;': '<',\n      '&gt;': '>',\n      '&amp;': '&',\n      '&quot;': '\"',\n      '&apos;': '\\''\n    };\n    var nativeDecode = function (text) {\n      var elm = SugarElement.fromTag('div').dom;\n      elm.innerHTML = text;\n      return elm.textContent || elm.innerText || text;\n    };\n    var buildEntitiesLookup = function (items, radix) {\n      var i, chr, entity;\n      var lookup = {};\n      if (items) {\n        items = items.split(',');\n        radix = radix || 10;\n        for (i = 0; i < items.length; i += 2) {\n          chr = String.fromCharCode(parseInt(items[i], radix));\n          if (!baseEntities[chr]) {\n            entity = '&' + items[i + 1] + ';';\n            lookup[chr] = entity;\n            lookup[entity] = chr;\n          }\n        }\n        return lookup;\n      }\n    };\n    var namedEntities = buildEntitiesLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' + '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' + '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' + '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' + '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' + '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' + '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' + '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' + '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' + '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' + 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' + 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' + 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' + 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' + 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' + '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' + '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' + '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' + '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' + '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' + 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' + 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' + 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' + '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' + '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\n    var encodeRaw = function (text, attr) {\n      return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n        return baseEntities[chr] || chr;\n      });\n    };\n    var encodeAllRaw = function (text) {\n      return ('' + text).replace(rawCharsRegExp, function (chr) {\n        return baseEntities[chr] || chr;\n      });\n    };\n    var encodeNumeric = function (text, attr) {\n      return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n        if (chr.length > 1) {\n          return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';\n        }\n        return baseEntities[chr] || '&#' + chr.charCodeAt(0) + ';';\n      });\n    };\n    var encodeNamed = function (text, attr, entities) {\n      entities = entities || namedEntities;\n      return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n        return baseEntities[chr] || entities[chr] || chr;\n      });\n    };\n    var getEncodeFunc = function (name, entities) {\n      var entitiesMap = buildEntitiesLookup(entities) || namedEntities;\n      var encodeNamedAndNumeric = function (text, attr) {\n        return text.replace(attr ? attrsCharsRegExp : textCharsRegExp, function (chr) {\n          if (baseEntities[chr] !== undefined) {\n            return baseEntities[chr];\n          }\n          if (entitiesMap[chr] !== undefined) {\n            return entitiesMap[chr];\n          }\n          if (chr.length > 1) {\n            return '&#' + ((chr.charCodeAt(0) - 55296) * 1024 + (chr.charCodeAt(1) - 56320) + 65536) + ';';\n          }\n          return '&#' + chr.charCodeAt(0) + ';';\n        });\n      };\n      var encodeCustomNamed = function (text, attr) {\n        return encodeNamed(text, attr, entitiesMap);\n      };\n      var nameMap = makeMap$3(name.replace(/\\+/g, ','));\n      if (nameMap.named && nameMap.numeric) {\n        return encodeNamedAndNumeric;\n      }\n      if (nameMap.named) {\n        if (entities) {\n          return encodeCustomNamed;\n        }\n        return encodeNamed;\n      }\n      if (nameMap.numeric) {\n        return encodeNumeric;\n      }\n      return encodeRaw;\n    };\n    var decode = function (text) {\n      return text.replace(entityRegExp, function (all, numeric) {\n        if (numeric) {\n          if (numeric.charAt(0).toLowerCase() === 'x') {\n            numeric = parseInt(numeric.substr(1), 16);\n          } else {\n            numeric = parseInt(numeric, 10);\n          }\n          if (numeric > 65535) {\n            numeric -= 65536;\n            return String.fromCharCode(55296 + (numeric >> 10), 56320 + (numeric & 1023));\n          }\n          return asciiMap[numeric] || String.fromCharCode(numeric);\n        }\n        return reverseEntities[all] || namedEntities[all] || nativeDecode(all);\n      });\n    };\n    var Entities = {\n      encodeRaw: encodeRaw,\n      encodeAllRaw: encodeAllRaw,\n      encodeNumeric: encodeNumeric,\n      encodeNamed: encodeNamed,\n      getEncodeFunc: getEncodeFunc,\n      decode: decode\n    };\n\n    var mapCache = {}, dummyObj = {};\n    var makeMap$2 = Tools.makeMap, each$h = Tools.each, extend$5 = Tools.extend, explode$3 = Tools.explode, inArray$2 = Tools.inArray;\n    var split$1 = function (items, delim) {\n      items = Tools.trim(items);\n      return items ? items.split(delim || ' ') : [];\n    };\n    var createMap = function (defaultValue, extendWith) {\n      var value = makeMap$2(defaultValue, ' ', makeMap$2(defaultValue.toUpperCase(), ' '));\n      return extend$5(value, extendWith);\n    };\n    var getTextRootBlockElements = function (schema) {\n      return createMap('td th li dt dd figcaption caption details summary', schema.getTextBlockElements());\n    };\n    var compileSchema = function (type) {\n      var schema = {};\n      var globalAttributes, blockContent;\n      var phrasingContent, flowContent, html4BlockContent, html4PhrasingContent;\n      var add = function (name, attributes, children) {\n        var ni, attributesOrder, element;\n        var arrayToMap = function (array, obj) {\n          var map = {};\n          var i, l;\n          for (i = 0, l = array.length; i < l; i++) {\n            map[array[i]] = obj || {};\n          }\n          return map;\n        };\n        children = children || [];\n        attributes = attributes || '';\n        if (typeof children === 'string') {\n          children = split$1(children);\n        }\n        var names = split$1(name);\n        ni = names.length;\n        while (ni--) {\n          attributesOrder = split$1([\n            globalAttributes,\n            attributes\n          ].join(' '));\n          element = {\n            attributes: arrayToMap(attributesOrder),\n            attributesOrder: attributesOrder,\n            children: arrayToMap(children, dummyObj)\n          };\n          schema[names[ni]] = element;\n        }\n      };\n      var addAttrs = function (name, attributes) {\n        var ni, schemaItem, i, l;\n        var names = split$1(name);\n        ni = names.length;\n        var attrs = split$1(attributes);\n        while (ni--) {\n          schemaItem = schema[names[ni]];\n          for (i = 0, l = attrs.length; i < l; i++) {\n            schemaItem.attributes[attrs[i]] = {};\n            schemaItem.attributesOrder.push(attrs[i]);\n          }\n        }\n      };\n      if (mapCache[type]) {\n        return mapCache[type];\n      }\n      globalAttributes = 'id accesskey class dir lang style tabindex title role';\n      blockContent = 'address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul';\n      phrasingContent = 'a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd ' + 'label map noscript object q s samp script select small span strong sub sup ' + 'textarea u var #text #comment';\n      if (type !== 'html4') {\n        globalAttributes += ' contenteditable contextmenu draggable dropzone ' + 'hidden spellcheck translate';\n        blockContent += ' article aside details dialog figure main header footer hgroup section nav';\n        phrasingContent += ' audio canvas command datalist mark meter output picture ' + 'progress time wbr video ruby bdi keygen';\n      }\n      if (type !== 'html5-strict') {\n        globalAttributes += ' xml:lang';\n        html4PhrasingContent = 'acronym applet basefont big font strike tt';\n        phrasingContent = [\n          phrasingContent,\n          html4PhrasingContent\n        ].join(' ');\n        each$h(split$1(html4PhrasingContent), function (name) {\n          add(name, '', phrasingContent);\n        });\n        html4BlockContent = 'center dir isindex noframes';\n        blockContent = [\n          blockContent,\n          html4BlockContent\n        ].join(' ');\n        flowContent = [\n          blockContent,\n          phrasingContent\n        ].join(' ');\n        each$h(split$1(html4BlockContent), function (name) {\n          add(name, '', flowContent);\n        });\n      }\n      flowContent = flowContent || [\n        blockContent,\n        phrasingContent\n      ].join(' ');\n      add('html', 'manifest', 'head body');\n      add('head', '', 'base command link meta noscript script style title');\n      add('title hr noscript br');\n      add('base', 'href target');\n      add('link', 'href rel media hreflang type sizes hreflang');\n      add('meta', 'name http-equiv content charset');\n      add('style', 'media type scoped');\n      add('script', 'src async defer type charset');\n      add('body', 'onafterprint onbeforeprint onbeforeunload onblur onerror onfocus ' + 'onhashchange onload onmessage onoffline ononline onpagehide onpageshow ' + 'onpopstate onresize onscroll onstorage onunload', flowContent);\n      add('address dt dd div caption', '', flowContent);\n      add('h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn', '', phrasingContent);\n      add('blockquote', 'cite', flowContent);\n      add('ol', 'reversed start type', 'li');\n      add('ul', '', 'li');\n      add('li', 'value', flowContent);\n      add('dl', '', 'dt dd');\n      add('a', 'href target rel media hreflang type', phrasingContent);\n      add('q', 'cite', phrasingContent);\n      add('ins del', 'cite datetime', flowContent);\n      add('img', 'src sizes srcset alt usemap ismap width height');\n      add('iframe', 'src name width height', flowContent);\n      add('embed', 'src type width height');\n      add('object', 'data type typemustmatch name usemap form width height', [\n        flowContent,\n        'param'\n      ].join(' '));\n      add('param', 'name value');\n      add('map', 'name', [\n        flowContent,\n        'area'\n      ].join(' '));\n      add('area', 'alt coords shape href target rel media hreflang type');\n      add('table', 'border', 'caption colgroup thead tfoot tbody tr' + (type === 'html4' ? ' col' : ''));\n      add('colgroup', 'span', 'col');\n      add('col', 'span');\n      add('tbody thead tfoot', '', 'tr');\n      add('tr', '', 'td th');\n      add('td', 'colspan rowspan headers', flowContent);\n      add('th', 'colspan rowspan headers scope abbr', flowContent);\n      add('form', 'accept-charset action autocomplete enctype method name novalidate target', flowContent);\n      add('fieldset', 'disabled form name', [\n        flowContent,\n        'legend'\n      ].join(' '));\n      add('label', 'form for', phrasingContent);\n      add('input', 'accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate ' + 'formtarget height list max maxlength min multiple name pattern readonly required size src step type value width');\n      add('button', 'disabled form formaction formenctype formmethod formnovalidate formtarget name type value', type === 'html4' ? flowContent : phrasingContent);\n      add('select', 'disabled form multiple name required size', 'option optgroup');\n      add('optgroup', 'disabled label', 'option');\n      add('option', 'disabled label selected value');\n      add('textarea', 'cols dirname disabled form maxlength name readonly required rows wrap');\n      add('menu', 'type label', [\n        flowContent,\n        'li'\n      ].join(' '));\n      add('noscript', '', flowContent);\n      if (type !== 'html4') {\n        add('wbr');\n        add('ruby', '', [\n          phrasingContent,\n          'rt rp'\n        ].join(' '));\n        add('figcaption', '', flowContent);\n        add('mark rt rp summary bdi', '', phrasingContent);\n        add('canvas', 'width height', flowContent);\n        add('video', 'src crossorigin poster preload autoplay mediagroup loop ' + 'muted controls width height buffered', [\n          flowContent,\n          'track source'\n        ].join(' '));\n        add('audio', 'src crossorigin preload autoplay mediagroup loop muted controls ' + 'buffered volume', [\n          flowContent,\n          'track source'\n        ].join(' '));\n        add('picture', '', 'img source');\n        add('source', 'src srcset type media sizes');\n        add('track', 'kind src srclang label default');\n        add('datalist', '', [\n          phrasingContent,\n          'option'\n        ].join(' '));\n        add('article section nav aside main header footer', '', flowContent);\n        add('hgroup', '', 'h1 h2 h3 h4 h5 h6');\n        add('figure', '', [\n          flowContent,\n          'figcaption'\n        ].join(' '));\n        add('time', 'datetime', phrasingContent);\n        add('dialog', 'open', flowContent);\n        add('command', 'type label icon disabled checked radiogroup command');\n        add('output', 'for form name', phrasingContent);\n        add('progress', 'value max', phrasingContent);\n        add('meter', 'value min max low high optimum', phrasingContent);\n        add('details', 'open', [\n          flowContent,\n          'summary'\n        ].join(' '));\n        add('keygen', 'autofocus challenge disabled form keytype name');\n      }\n      if (type !== 'html5-strict') {\n        addAttrs('script', 'language xml:space');\n        addAttrs('style', 'xml:space');\n        addAttrs('object', 'declare classid code codebase codetype archive standby align border hspace vspace');\n        addAttrs('embed', 'align name hspace vspace');\n        addAttrs('param', 'valuetype type');\n        addAttrs('a', 'charset name rev shape coords');\n        addAttrs('br', 'clear');\n        addAttrs('applet', 'codebase archive code object alt name width height align hspace vspace');\n        addAttrs('img', 'name longdesc align border hspace vspace');\n        addAttrs('iframe', 'longdesc frameborder marginwidth marginheight scrolling align');\n        addAttrs('font basefont', 'size color face');\n        addAttrs('input', 'usemap align');\n        addAttrs('select');\n        addAttrs('textarea');\n        addAttrs('h1 h2 h3 h4 h5 h6 div p legend caption', 'align');\n        addAttrs('ul', 'type compact');\n        addAttrs('li', 'type');\n        addAttrs('ol dl menu dir', 'compact');\n        addAttrs('pre', 'width xml:space');\n        addAttrs('hr', 'align noshade size width');\n        addAttrs('isindex', 'prompt');\n        addAttrs('table', 'summary width frame rules cellspacing cellpadding align bgcolor');\n        addAttrs('col', 'width align char charoff valign');\n        addAttrs('colgroup', 'width align char charoff valign');\n        addAttrs('thead', 'align char charoff valign');\n        addAttrs('tr', 'align char charoff valign bgcolor');\n        addAttrs('th', 'axis align char charoff valign nowrap bgcolor width height');\n        addAttrs('form', 'accept');\n        addAttrs('td', 'abbr axis scope align char charoff valign nowrap bgcolor width height');\n        addAttrs('tfoot', 'align char charoff valign');\n        addAttrs('tbody', 'align char charoff valign');\n        addAttrs('area', 'nohref');\n        addAttrs('body', 'background bgcolor text link vlink alink');\n      }\n      if (type !== 'html4') {\n        addAttrs('input button select textarea', 'autofocus');\n        addAttrs('input textarea', 'placeholder');\n        addAttrs('a', 'download');\n        addAttrs('link script img', 'crossorigin');\n        addAttrs('img', 'loading');\n        addAttrs('iframe', 'sandbox seamless allowfullscreen loading');\n      }\n      each$h(split$1('a form meter progress dfn'), function (name) {\n        if (schema[name]) {\n          delete schema[name].children[name];\n        }\n      });\n      delete schema.caption.children.table;\n      delete schema.script;\n      mapCache[type] = schema;\n      return schema;\n    };\n    var compileElementMap = function (value, mode) {\n      var styles;\n      if (value) {\n        styles = {};\n        if (typeof value === 'string') {\n          value = { '*': value };\n        }\n        each$h(value, function (value, key) {\n          styles[key] = styles[key.toUpperCase()] = mode === 'map' ? makeMap$2(value, /[, ]/) : explode$3(value, /[, ]/);\n        });\n      }\n      return styles;\n    };\n    var Schema = function (settings) {\n      var elements = {};\n      var children = {};\n      var patternElements = [];\n      var customElementsMap = {}, specialElements = {};\n      var createLookupTable = function (option, defaultValue, extendWith) {\n        var value = settings[option];\n        if (!value) {\n          value = mapCache[option];\n          if (!value) {\n            value = createMap(defaultValue, extendWith);\n            mapCache[option] = value;\n          }\n        } else {\n          value = makeMap$2(value, /[, ]/, makeMap$2(value.toUpperCase(), /[, ]/));\n        }\n        return value;\n      };\n      settings = settings || {};\n      var schemaItems = compileSchema(settings.schema);\n      if (settings.verify_html === false) {\n        settings.valid_elements = '*[*]';\n      }\n      var validStyles = compileElementMap(settings.valid_styles);\n      var invalidStyles = compileElementMap(settings.invalid_styles, 'map');\n      var validClasses = compileElementMap(settings.valid_classes, 'map');\n      var whiteSpaceElementsMap = createLookupTable('whitespace_elements', 'pre script noscript style textarea video audio iframe object code');\n      var selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');\n      var shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link ' + 'meta param embed source wbr track');\n      var boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize ' + 'noshade nowrap readonly selected autoplay loop controls');\n      var nonEmptyOrMoveCaretBeforeOnEnter = 'td th iframe video audio object script code';\n      var nonEmptyElementsMap = createLookupTable('non_empty_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' pre', shortEndedElementsMap);\n      var moveCaretBeforeOnEnterElementsMap = createLookupTable('move_caret_before_on_enter_elements', nonEmptyOrMoveCaretBeforeOnEnter + ' table', shortEndedElementsMap);\n      var textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' + 'blockquote center dir fieldset header footer article section hgroup aside main nav figure');\n      var blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' + 'th tr td li ol ul caption dl dt dd noscript menu isindex option ' + 'datalist select optgroup figcaption details summary', textBlockElementsMap);\n      var textInlineElementsMap = createLookupTable('text_inline_elements', 'span strong b em i font s strike u var cite ' + 'dfn code mark q sup sub samp');\n      each$h((settings.special || 'script noscript iframe noframes noembed title style textarea xmp').split(' '), function (name) {\n        specialElements[name] = new RegExp('</' + name + '[^>]*>', 'gi');\n      });\n      var patternToRegExp = function (str) {\n        return new RegExp('^' + str.replace(/([?+*])/g, '.$1') + '$');\n      };\n      var addValidElements = function (validElements) {\n        var ei, el, ai, al, matches, element, attr, attrData, elementName, attrName, attrType, attributes, attributesOrder, prefix, outputName, globalAttributes, globalAttributesOrder, value;\n        var elementRuleRegExp = /^([#+\\-])?([^\\[!\\/]+)(?:\\/([^\\[!]+))?(?:(!?)\\[([^\\]]+)])?$/, attrRuleRegExp = /^([!\\-])?(\\w+[\\\\:]:\\w+|[^=:<]+)?(?:([=:<])(.*))?$/, hasPatternsRegExp = /[*?+]/;\n        if (validElements) {\n          var validElementsArr = split$1(validElements, ',');\n          if (elements['@']) {\n            globalAttributes = elements['@'].attributes;\n            globalAttributesOrder = elements['@'].attributesOrder;\n          }\n          for (ei = 0, el = validElementsArr.length; ei < el; ei++) {\n            matches = elementRuleRegExp.exec(validElementsArr[ei]);\n            if (matches) {\n              prefix = matches[1];\n              elementName = matches[2];\n              outputName = matches[3];\n              attrData = matches[5];\n              attributes = {};\n              attributesOrder = [];\n              element = {\n                attributes: attributes,\n                attributesOrder: attributesOrder\n              };\n              if (prefix === '#') {\n                element.paddEmpty = true;\n              }\n              if (prefix === '-') {\n                element.removeEmpty = true;\n              }\n              if (matches[4] === '!') {\n                element.removeEmptyAttrs = true;\n              }\n              if (globalAttributes) {\n                each$j(globalAttributes, function (value, key) {\n                  attributes[key] = value;\n                });\n                attributesOrder.push.apply(attributesOrder, globalAttributesOrder);\n              }\n              if (attrData) {\n                attrData = split$1(attrData, '|');\n                for (ai = 0, al = attrData.length; ai < al; ai++) {\n                  matches = attrRuleRegExp.exec(attrData[ai]);\n                  if (matches) {\n                    attr = {};\n                    attrType = matches[1];\n                    attrName = matches[2].replace(/[\\\\:]:/g, ':');\n                    prefix = matches[3];\n                    value = matches[4];\n                    if (attrType === '!') {\n                      element.attributesRequired = element.attributesRequired || [];\n                      element.attributesRequired.push(attrName);\n                      attr.required = true;\n                    }\n                    if (attrType === '-') {\n                      delete attributes[attrName];\n                      attributesOrder.splice(inArray$2(attributesOrder, attrName), 1);\n                      continue;\n                    }\n                    if (prefix) {\n                      if (prefix === '=') {\n                        element.attributesDefault = element.attributesDefault || [];\n                        element.attributesDefault.push({\n                          name: attrName,\n                          value: value\n                        });\n                        attr.defaultValue = value;\n                      }\n                      if (prefix === ':') {\n                        element.attributesForced = element.attributesForced || [];\n                        element.attributesForced.push({\n                          name: attrName,\n                          value: value\n                        });\n                        attr.forcedValue = value;\n                      }\n                      if (prefix === '<') {\n                        attr.validValues = makeMap$2(value, '?');\n                      }\n                    }\n                    if (hasPatternsRegExp.test(attrName)) {\n                      element.attributePatterns = element.attributePatterns || [];\n                      attr.pattern = patternToRegExp(attrName);\n                      element.attributePatterns.push(attr);\n                    } else {\n                      if (!attributes[attrName]) {\n                        attributesOrder.push(attrName);\n                      }\n                      attributes[attrName] = attr;\n                    }\n                  }\n                }\n              }\n              if (!globalAttributes && elementName === '@') {\n                globalAttributes = attributes;\n                globalAttributesOrder = attributesOrder;\n              }\n              if (outputName) {\n                element.outputName = elementName;\n                elements[outputName] = element;\n              }\n              if (hasPatternsRegExp.test(elementName)) {\n                element.pattern = patternToRegExp(elementName);\n                patternElements.push(element);\n              } else {\n                elements[elementName] = element;\n              }\n            }\n          }\n        }\n      };\n      var setValidElements = function (validElements) {\n        elements = {};\n        patternElements = [];\n        addValidElements(validElements);\n        each$h(schemaItems, function (element, name) {\n          children[name] = element.children;\n        });\n      };\n      var addCustomElements = function (customElements) {\n        var customElementRegExp = /^(~)?(.+)$/;\n        if (customElements) {\n          mapCache.text_block_elements = mapCache.block_elements = null;\n          each$h(split$1(customElements, ','), function (rule) {\n            var matches = customElementRegExp.exec(rule), inline = matches[1] === '~', cloneName = inline ? 'span' : 'div', name = matches[2];\n            children[name] = children[cloneName];\n            customElementsMap[name] = cloneName;\n            if (!inline) {\n              blockElementsMap[name.toUpperCase()] = {};\n              blockElementsMap[name] = {};\n            }\n            if (!elements[name]) {\n              var customRule = elements[cloneName];\n              customRule = extend$5({}, customRule);\n              delete customRule.removeEmptyAttrs;\n              delete customRule.removeEmpty;\n              elements[name] = customRule;\n            }\n            each$h(children, function (element, elmName) {\n              if (element[cloneName]) {\n                children[elmName] = element = extend$5({}, children[elmName]);\n                element[name] = element[cloneName];\n              }\n            });\n          });\n        }\n      };\n      var addValidChildren = function (validChildren) {\n        var childRuleRegExp = /^([+\\-]?)([A-Za-z0-9_\\-.\\u00b7\\u00c0-\\u00d6\\u00d8-\\u00f6\\u00f8-\\u037d\\u037f-\\u1fff\\u200c-\\u200d\\u203f-\\u2040\\u2070-\\u218f\\u2c00-\\u2fef\\u3001-\\ud7ff\\uf900-\\ufdcf\\ufdf0-\\ufffd]+)\\[([^\\]]+)]$/;\n        mapCache[settings.schema] = null;\n        if (validChildren) {\n          each$h(split$1(validChildren, ','), function (rule) {\n            var matches = childRuleRegExp.exec(rule);\n            var parent, prefix;\n            if (matches) {\n              prefix = matches[1];\n              if (prefix) {\n                parent = children[matches[2]];\n              } else {\n                parent = children[matches[2]] = { '#comment': {} };\n              }\n              parent = children[matches[2]];\n              each$h(split$1(matches[3], '|'), function (child) {\n                if (prefix === '-') {\n                  delete parent[child];\n                } else {\n                  parent[child] = {};\n                }\n              });\n            }\n          });\n        }\n      };\n      var getElementRule = function (name) {\n        var element = elements[name], i;\n        if (element) {\n          return element;\n        }\n        i = patternElements.length;\n        while (i--) {\n          element = patternElements[i];\n          if (element.pattern.test(name)) {\n            return element;\n          }\n        }\n      };\n      if (!settings.valid_elements) {\n        each$h(schemaItems, function (element, name) {\n          elements[name] = {\n            attributes: element.attributes,\n            attributesOrder: element.attributesOrder\n          };\n          children[name] = element.children;\n        });\n        if (settings.schema !== 'html5') {\n          each$h(split$1('strong/b em/i'), function (item) {\n            var items = split$1(item, '/');\n            elements[items[1]].outputName = items[0];\n          });\n        }\n        each$h(textInlineElementsMap, function (_val, name) {\n          if (elements[name]) {\n            if (settings.padd_empty_block_inline_children) {\n              elements[name].paddInEmptyBlock = true;\n            }\n            elements[name].removeEmpty = true;\n          }\n        });\n        each$h(split$1('ol ul blockquote a table tbody'), function (name) {\n          if (elements[name]) {\n            elements[name].removeEmpty = true;\n          }\n        });\n        each$h(split$1('p h1 h2 h3 h4 h5 h6 th td pre div address caption li'), function (name) {\n          elements[name].paddEmpty = true;\n        });\n        each$h(split$1('span'), function (name) {\n          elements[name].removeEmptyAttrs = true;\n        });\n      } else {\n        setValidElements(settings.valid_elements);\n      }\n      addCustomElements(settings.custom_elements);\n      addValidChildren(settings.valid_children);\n      addValidElements(settings.extended_valid_elements);\n      addValidChildren('+ol[ul|ol],+ul[ul|ol]');\n      each$h({\n        dd: 'dl',\n        dt: 'dl',\n        li: 'ul ol',\n        td: 'tr',\n        th: 'tr',\n        tr: 'tbody thead tfoot',\n        tbody: 'table',\n        thead: 'table',\n        tfoot: 'table',\n        legend: 'fieldset',\n        area: 'map',\n        param: 'video audio object'\n      }, function (parents, item) {\n        if (elements[item]) {\n          elements[item].parentsRequired = split$1(parents);\n        }\n      });\n      if (settings.invalid_elements) {\n        each$h(explode$3(settings.invalid_elements), function (item) {\n          if (elements[item]) {\n            delete elements[item];\n          }\n        });\n      }\n      if (!getElementRule('span')) {\n        addValidElements('span[!data-mce-type|*]');\n      }\n      var getValidStyles = constant(validStyles);\n      var getInvalidStyles = constant(invalidStyles);\n      var getValidClasses = constant(validClasses);\n      var getBoolAttrs = constant(boolAttrMap);\n      var getBlockElements = constant(blockElementsMap);\n      var getTextBlockElements = constant(textBlockElementsMap);\n      var getTextInlineElements = constant(textInlineElementsMap);\n      var getShortEndedElements = constant(shortEndedElementsMap);\n      var getSelfClosingElements = constant(selfClosingElementsMap);\n      var getNonEmptyElements = constant(nonEmptyElementsMap);\n      var getMoveCaretBeforeOnEnterElements = constant(moveCaretBeforeOnEnterElementsMap);\n      var getWhiteSpaceElements = constant(whiteSpaceElementsMap);\n      var getSpecialElements = constant(specialElements);\n      var isValidChild = function (name, child) {\n        var parent = children[name.toLowerCase()];\n        return !!(parent && parent[child.toLowerCase()]);\n      };\n      var isValid = function (name, attr) {\n        var attrPatterns, i;\n        var rule = getElementRule(name);\n        if (rule) {\n          if (attr) {\n            if (rule.attributes[attr]) {\n              return true;\n            }\n            attrPatterns = rule.attributePatterns;\n            if (attrPatterns) {\n              i = attrPatterns.length;\n              while (i--) {\n                if (attrPatterns[i].pattern.test(name)) {\n                  return true;\n                }\n              }\n            }\n          } else {\n            return true;\n          }\n        }\n        return false;\n      };\n      var getCustomElements = constant(customElementsMap);\n      return {\n        children: children,\n        elements: elements,\n        getValidStyles: getValidStyles,\n        getValidClasses: getValidClasses,\n        getBlockElements: getBlockElements,\n        getInvalidStyles: getInvalidStyles,\n        getShortEndedElements: getShortEndedElements,\n        getTextBlockElements: getTextBlockElements,\n        getTextInlineElements: getTextInlineElements,\n        getBoolAttrs: getBoolAttrs,\n        getElementRule: getElementRule,\n        getSelfClosingElements: getSelfClosingElements,\n        getNonEmptyElements: getNonEmptyElements,\n        getMoveCaretBeforeOnEnterElements: getMoveCaretBeforeOnEnterElements,\n        getWhiteSpaceElements: getWhiteSpaceElements,\n        getSpecialElements: getSpecialElements,\n        isValidChild: isValidChild,\n        isValid: isValid,\n        getCustomElements: getCustomElements,\n        addValidElements: addValidElements,\n        setValidElements: setValidElements,\n        addCustomElements: addCustomElements,\n        addValidChildren: addValidChildren\n      };\n    };\n\n    var toHex = function (match, r, g, b) {\n      var hex = function (val) {\n        val = parseInt(val, 10).toString(16);\n        return val.length > 1 ? val : '0' + val;\n      };\n      return '#' + hex(r) + hex(g) + hex(b);\n    };\n    var Styles = function (settings, schema) {\n      var _this = this;\n      var rgbRegExp = /rgb\\s*\\(\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*\\)/gi;\n      var urlOrStrRegExp = /(?:url(?:(?:\\(\\s*\\\"([^\\\"]+)\\\"\\s*\\))|(?:\\(\\s*\\'([^\\']+)\\'\\s*\\))|(?:\\(\\s*([^)\\s]+)\\s*\\))))|(?:\\'([^\\']+)\\')|(?:\\\"([^\\\"]+)\\\")/gi;\n      var styleRegExp = /\\s*([^:]+):\\s*([^;]+);?/g;\n      var trimRightRegExp = /\\s+$/;\n      var i;\n      var encodingLookup = {};\n      var validStyles;\n      var invalidStyles;\n      var invisibleChar = zeroWidth;\n      settings = settings || {};\n      if (schema) {\n        validStyles = schema.getValidStyles();\n        invalidStyles = schema.getInvalidStyles();\n      }\n      var encodingItems = ('\\\\\" \\\\\\' \\\\; \\\\: ; : ' + invisibleChar).split(' ');\n      for (i = 0; i < encodingItems.length; i++) {\n        encodingLookup[encodingItems[i]] = invisibleChar + i;\n        encodingLookup[invisibleChar + i] = encodingItems[i];\n      }\n      return {\n        toHex: function (color) {\n          return color.replace(rgbRegExp, toHex);\n        },\n        parse: function (css) {\n          var styles = {};\n          var matches, name, value, isEncoded;\n          var urlConverter = settings.url_converter;\n          var urlConverterScope = settings.url_converter_scope || _this;\n          var compress = function (prefix, suffix, noJoin) {\n            var top = styles[prefix + '-top' + suffix];\n            if (!top) {\n              return;\n            }\n            var right = styles[prefix + '-right' + suffix];\n            if (!right) {\n              return;\n            }\n            var bottom = styles[prefix + '-bottom' + suffix];\n            if (!bottom) {\n              return;\n            }\n            var left = styles[prefix + '-left' + suffix];\n            if (!left) {\n              return;\n            }\n            var box = [\n              top,\n              right,\n              bottom,\n              left\n            ];\n            i = box.length - 1;\n            while (i--) {\n              if (box[i] !== box[i + 1]) {\n                break;\n              }\n            }\n            if (i > -1 && noJoin) {\n              return;\n            }\n            styles[prefix + suffix] = i === -1 ? box[0] : box.join(' ');\n            delete styles[prefix + '-top' + suffix];\n            delete styles[prefix + '-right' + suffix];\n            delete styles[prefix + '-bottom' + suffix];\n            delete styles[prefix + '-left' + suffix];\n          };\n          var canCompress = function (key) {\n            var value = styles[key], i;\n            if (!value) {\n              return;\n            }\n            value = value.split(' ');\n            i = value.length;\n            while (i--) {\n              if (value[i] !== value[0]) {\n                return false;\n              }\n            }\n            styles[key] = value[0];\n            return true;\n          };\n          var compress2 = function (target, a, b, c) {\n            if (!canCompress(a)) {\n              return;\n            }\n            if (!canCompress(b)) {\n              return;\n            }\n            if (!canCompress(c)) {\n              return;\n            }\n            styles[target] = styles[a] + ' ' + styles[b] + ' ' + styles[c];\n            delete styles[a];\n            delete styles[b];\n            delete styles[c];\n          };\n          var encode = function (str) {\n            isEncoded = true;\n            return encodingLookup[str];\n          };\n          var decode = function (str, keepSlashes) {\n            if (isEncoded) {\n              str = str.replace(/\\uFEFF[0-9]/g, function (str) {\n                return encodingLookup[str];\n              });\n            }\n            if (!keepSlashes) {\n              str = str.replace(/\\\\([\\'\\\";:])/g, '$1');\n            }\n            return str;\n          };\n          var decodeSingleHexSequence = function (escSeq) {\n            return String.fromCharCode(parseInt(escSeq.slice(1), 16));\n          };\n          var decodeHexSequences = function (value) {\n            return value.replace(/\\\\[0-9a-f]+/gi, decodeSingleHexSequence);\n          };\n          var processUrl = function (match, url, url2, url3, str, str2) {\n            str = str || str2;\n            if (str) {\n              str = decode(str);\n              return '\\'' + str.replace(/\\'/g, '\\\\\\'') + '\\'';\n            }\n            url = decode(url || url2 || url3);\n            if (!settings.allow_script_urls) {\n              var scriptUrl = url.replace(/[\\s\\r\\n]+/g, '');\n              if (/(java|vb)script:/i.test(scriptUrl)) {\n                return '';\n              }\n              if (!settings.allow_svg_data_urls && /^data:image\\/svg/i.test(scriptUrl)) {\n                return '';\n              }\n            }\n            if (urlConverter) {\n              url = urlConverter.call(urlConverterScope, url, 'style');\n            }\n            return 'url(\\'' + url.replace(/\\'/g, '\\\\\\'') + '\\')';\n          };\n          if (css) {\n            css = css.replace(/[\\u0000-\\u001F]/g, '');\n            css = css.replace(/\\\\[\\\"\\';:\\uFEFF]/g, encode).replace(/\\\"[^\\\"]+\\\"|\\'[^\\']+\\'/g, function (str) {\n              return str.replace(/[;:]/g, encode);\n            });\n            while (matches = styleRegExp.exec(css)) {\n              styleRegExp.lastIndex = matches.index + matches[0].length;\n              name = matches[1].replace(trimRightRegExp, '').toLowerCase();\n              value = matches[2].replace(trimRightRegExp, '');\n              if (name && value) {\n                name = decodeHexSequences(name);\n                value = decodeHexSequences(value);\n                if (name.indexOf(invisibleChar) !== -1 || name.indexOf('\"') !== -1) {\n                  continue;\n                }\n                if (!settings.allow_script_urls && (name === 'behavior' || /expression\\s*\\(|\\/\\*|\\*\\//.test(value))) {\n                  continue;\n                }\n                if (name === 'font-weight' && value === '700') {\n                  value = 'bold';\n                } else if (name === 'color' || name === 'background-color') {\n                  value = value.toLowerCase();\n                }\n                value = value.replace(rgbRegExp, toHex);\n                value = value.replace(urlOrStrRegExp, processUrl);\n                styles[name] = isEncoded ? decode(value, true) : value;\n              }\n            }\n            compress('border', '', true);\n            compress('border', '-width');\n            compress('border', '-color');\n            compress('border', '-style');\n            compress('padding', '');\n            compress('margin', '');\n            compress2('border', 'border-width', 'border-style', 'border-color');\n            if (styles.border === 'medium none') {\n              delete styles.border;\n            }\n            if (styles['border-image'] === 'none') {\n              delete styles['border-image'];\n            }\n          }\n          return styles;\n        },\n        serialize: function (styles, elementName) {\n          var css = '';\n          var serializeStyles = function (name) {\n            var value;\n            var styleList = validStyles[name];\n            if (styleList) {\n              for (var i_1 = 0, l = styleList.length; i_1 < l; i_1++) {\n                name = styleList[i_1];\n                value = styles[name];\n                if (value) {\n                  css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\n                }\n              }\n            }\n          };\n          var isValid = function (name, elementName) {\n            var styleMap = invalidStyles['*'];\n            if (styleMap && styleMap[name]) {\n              return false;\n            }\n            styleMap = invalidStyles[elementName];\n            return !(styleMap && styleMap[name]);\n          };\n          if (elementName && validStyles) {\n            serializeStyles('*');\n            serializeStyles(elementName);\n          } else {\n            each$j(styles, function (value, name) {\n              if (value && (!invalidStyles || isValid(name, elementName))) {\n                css += (css.length > 0 ? ' ' : '') + name + ': ' + value + ';';\n              }\n            });\n          }\n          return css;\n        }\n      };\n    };\n\n    var deprecated = {\n      keyLocation: true,\n      layerX: true,\n      layerY: true,\n      returnValue: true,\n      webkitMovementX: true,\n      webkitMovementY: true,\n      keyIdentifier: true,\n      mozPressure: true\n    };\n    var isNativeEvent = function (event) {\n      return event instanceof Event || isFunction(event.initEvent);\n    };\n    var hasIsDefaultPrevented = function (event) {\n      return event.isDefaultPrevented === always || event.isDefaultPrevented === never;\n    };\n    var needsNormalizing = function (event) {\n      return isNullable(event.preventDefault) || isNativeEvent(event);\n    };\n    var clone$2 = function (originalEvent, data) {\n      var event = data !== null && data !== void 0 ? data : {};\n      for (var name_1 in originalEvent) {\n        if (!has$2(deprecated, name_1)) {\n          event[name_1] = originalEvent[name_1];\n        }\n      }\n      if (isNonNullable(event.composedPath)) {\n        event.composedPath = function () {\n          return originalEvent.composedPath();\n        };\n      }\n      return event;\n    };\n    var normalize$3 = function (type, originalEvent, fallbackTarget, data) {\n      var _a;\n      var event = clone$2(originalEvent, data);\n      event.type = type;\n      if (isNullable(event.target)) {\n        event.target = (_a = event.srcElement) !== null && _a !== void 0 ? _a : fallbackTarget;\n      }\n      if (needsNormalizing(originalEvent)) {\n        event.preventDefault = function () {\n          event.defaultPrevented = true;\n          event.isDefaultPrevented = always;\n          if (isFunction(originalEvent.preventDefault)) {\n            originalEvent.preventDefault();\n          } else if (isNativeEvent(originalEvent)) {\n            originalEvent.returnValue = false;\n          }\n        };\n        event.stopPropagation = function () {\n          event.cancelBubble = true;\n          event.isPropagationStopped = always;\n          if (isFunction(originalEvent.stopPropagation)) {\n            originalEvent.stopPropagation();\n          } else if (isNativeEvent(originalEvent)) {\n            originalEvent.cancelBubble = true;\n          }\n        };\n        event.stopImmediatePropagation = function () {\n          event.isImmediatePropagationStopped = always;\n          event.stopPropagation();\n        };\n        if (!hasIsDefaultPrevented(event)) {\n          event.isDefaultPrevented = event.defaultPrevented === true ? always : never;\n          event.isPropagationStopped = event.cancelBubble === true ? always : never;\n          event.isImmediatePropagationStopped = never;\n        }\n      }\n      return event;\n    };\n\n    var eventExpandoPrefix = 'mce-data-';\n    var mouseEventRe = /^(?:mouse|contextmenu)|click/;\n    var addEvent = function (target, name, callback, capture) {\n      if (target.addEventListener) {\n        target.addEventListener(name, callback, capture || false);\n      } else if (target.attachEvent) {\n        target.attachEvent('on' + name, callback);\n      }\n    };\n    var removeEvent = function (target, name, callback, capture) {\n      if (target.removeEventListener) {\n        target.removeEventListener(name, callback, capture || false);\n      } else if (target.detachEvent) {\n        target.detachEvent('on' + name, callback);\n      }\n    };\n    var isMouseEvent = function (event) {\n      return isNonNullable(event) && mouseEventRe.test(event.type);\n    };\n    var fix = function (originalEvent, data) {\n      var event = normalize$3(originalEvent.type, originalEvent, document, data);\n      if (isMouseEvent(originalEvent) && isUndefined(originalEvent.pageX) && !isUndefined(originalEvent.clientX)) {\n        var eventDoc = event.target.ownerDocument || document;\n        var doc = eventDoc.documentElement;\n        var body = eventDoc.body;\n        var mouseEvent = event;\n        mouseEvent.pageX = originalEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n        mouseEvent.pageY = originalEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n      }\n      if (isUndefined(event.metaKey)) {\n        event.metaKey = false;\n      }\n      return event;\n    };\n    var bindOnReady = function (win, callback, eventUtils) {\n      var doc = win.document, event = { type: 'ready' };\n      if (eventUtils.domLoaded) {\n        callback(event);\n        return;\n      }\n      var isDocReady = function () {\n        return doc.readyState === 'complete' || doc.readyState === 'interactive' && doc.body;\n      };\n      var readyHandler = function () {\n        removeEvent(win, 'DOMContentLoaded', readyHandler);\n        removeEvent(win, 'load', readyHandler);\n        if (!eventUtils.domLoaded) {\n          eventUtils.domLoaded = true;\n          callback(event);\n        }\n        win = null;\n      };\n      if (isDocReady()) {\n        readyHandler();\n      } else {\n        addEvent(win, 'DOMContentLoaded', readyHandler);\n      }\n      if (!eventUtils.domLoaded) {\n        addEvent(win, 'load', readyHandler);\n      }\n    };\n    var EventUtils = function () {\n      function EventUtils() {\n        this.domLoaded = false;\n        this.events = {};\n        this.count = 1;\n        this.expando = eventExpandoPrefix + (+new Date()).toString(32);\n        this.hasMouseEnterLeave = 'onmouseenter' in document.documentElement;\n        this.hasFocusIn = 'onfocusin' in document.documentElement;\n        this.count = 1;\n      }\n      EventUtils.prototype.bind = function (target, names, callback, scope) {\n        var self = this;\n        var id, callbackList, i, name, fakeName, nativeHandler, capture;\n        var win = window;\n        var defaultNativeHandler = function (evt) {\n          self.executeHandlers(fix(evt || win.event), id);\n        };\n        if (!target || target.nodeType === 3 || target.nodeType === 8) {\n          return;\n        }\n        if (!target[self.expando]) {\n          id = self.count++;\n          target[self.expando] = id;\n          self.events[id] = {};\n        } else {\n          id = target[self.expando];\n        }\n        scope = scope || target;\n        var namesList = names.split(' ');\n        i = namesList.length;\n        while (i--) {\n          name = namesList[i];\n          nativeHandler = defaultNativeHandler;\n          fakeName = capture = false;\n          if (name === 'DOMContentLoaded') {\n            name = 'ready';\n          }\n          if (self.domLoaded && name === 'ready' && target.readyState === 'complete') {\n            callback.call(scope, fix({ type: name }));\n            continue;\n          }\n          if (!self.hasMouseEnterLeave) {\n            fakeName = self.mouseEnterLeave[name];\n            if (fakeName) {\n              nativeHandler = function (evt) {\n                var current = evt.currentTarget;\n                var related = evt.relatedTarget;\n                if (related && current.contains) {\n                  related = current.contains(related);\n                } else {\n                  while (related && related !== current) {\n                    related = related.parentNode;\n                  }\n                }\n                if (!related) {\n                  evt = fix(evt || win.event);\n                  evt.type = evt.type === 'mouseout' ? 'mouseleave' : 'mouseenter';\n                  evt.target = current;\n                  self.executeHandlers(evt, id);\n                }\n              };\n            }\n          }\n          if (!self.hasFocusIn && (name === 'focusin' || name === 'focusout')) {\n            capture = true;\n            fakeName = name === 'focusin' ? 'focus' : 'blur';\n            nativeHandler = function (evt) {\n              evt = fix(evt || win.event);\n              evt.type = evt.type === 'focus' ? 'focusin' : 'focusout';\n              self.executeHandlers(evt, id);\n            };\n          }\n          callbackList = self.events[id][name];\n          if (!callbackList) {\n            self.events[id][name] = callbackList = [{\n                func: callback,\n                scope: scope\n              }];\n            callbackList.fakeName = fakeName;\n            callbackList.capture = capture;\n            callbackList.nativeHandler = nativeHandler;\n            if (name === 'ready') {\n              bindOnReady(target, nativeHandler, self);\n            } else {\n              addEvent(target, fakeName || name, nativeHandler, capture);\n            }\n          } else {\n            if (name === 'ready' && self.domLoaded) {\n              callback(fix({ type: name }));\n            } else {\n              callbackList.push({\n                func: callback,\n                scope: scope\n              });\n            }\n          }\n        }\n        target = callbackList = null;\n        return callback;\n      };\n      EventUtils.prototype.unbind = function (target, names, callback) {\n        var callbackList, i, ci, name, eventMap;\n        if (!target || target.nodeType === 3 || target.nodeType === 8) {\n          return this;\n        }\n        var id = target[this.expando];\n        if (id) {\n          eventMap = this.events[id];\n          if (names) {\n            var namesList = names.split(' ');\n            i = namesList.length;\n            while (i--) {\n              name = namesList[i];\n              callbackList = eventMap[name];\n              if (callbackList) {\n                if (callback) {\n                  ci = callbackList.length;\n                  while (ci--) {\n                    if (callbackList[ci].func === callback) {\n                      var nativeHandler = callbackList.nativeHandler;\n                      var fakeName = callbackList.fakeName, capture = callbackList.capture;\n                      callbackList = callbackList.slice(0, ci).concat(callbackList.slice(ci + 1));\n                      callbackList.nativeHandler = nativeHandler;\n                      callbackList.fakeName = fakeName;\n                      callbackList.capture = capture;\n                      eventMap[name] = callbackList;\n                    }\n                  }\n                }\n                if (!callback || callbackList.length === 0) {\n                  delete eventMap[name];\n                  removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);\n                }\n              }\n            }\n          } else {\n            each$j(eventMap, function (callbackList, name) {\n              removeEvent(target, callbackList.fakeName || name, callbackList.nativeHandler, callbackList.capture);\n            });\n            eventMap = {};\n          }\n          for (name in eventMap) {\n            if (has$2(eventMap, name)) {\n              return this;\n            }\n          }\n          delete this.events[id];\n          try {\n            delete target[this.expando];\n          } catch (ex) {\n            target[this.expando] = null;\n          }\n        }\n        return this;\n      };\n      EventUtils.prototype.fire = function (target, name, args) {\n        var id;\n        if (!target || target.nodeType === 3 || target.nodeType === 8) {\n          return this;\n        }\n        var event = fix({\n          type: name,\n          target: target\n        }, args);\n        do {\n          id = target[this.expando];\n          if (id) {\n            this.executeHandlers(event, id);\n          }\n          target = target.parentNode || target.ownerDocument || target.defaultView || target.parentWindow;\n        } while (target && !event.isPropagationStopped());\n        return this;\n      };\n      EventUtils.prototype.clean = function (target) {\n        var i, children;\n        if (!target || target.nodeType === 3 || target.nodeType === 8) {\n          return this;\n        }\n        if (target[this.expando]) {\n          this.unbind(target);\n        }\n        if (!target.getElementsByTagName) {\n          target = target.document;\n        }\n        if (target && target.getElementsByTagName) {\n          this.unbind(target);\n          children = target.getElementsByTagName('*');\n          i = children.length;\n          while (i--) {\n            target = children[i];\n            if (target[this.expando]) {\n              this.unbind(target);\n            }\n          }\n        }\n        return this;\n      };\n      EventUtils.prototype.destroy = function () {\n        this.events = {};\n      };\n      EventUtils.prototype.cancel = function (e) {\n        if (e) {\n          e.preventDefault();\n          e.stopImmediatePropagation();\n        }\n        return false;\n      };\n      EventUtils.prototype.executeHandlers = function (evt, id) {\n        var container = this.events[id];\n        var callbackList = container && container[evt.type];\n        if (callbackList) {\n          for (var i = 0, l = callbackList.length; i < l; i++) {\n            var callback = callbackList[i];\n            if (callback && callback.func.call(callback.scope, evt) === false) {\n              evt.preventDefault();\n            }\n            if (evt.isImmediatePropagationStopped()) {\n              return;\n            }\n          }\n        }\n      };\n      EventUtils.Event = new EventUtils();\n      return EventUtils;\n    }();\n\n    var support, Expr, getText, isXML, tokenize, compile, select$1, outermostContext, sortInput, hasDuplicate, setDocument, document$1, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = 'sizzle' + -new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) {\n        if (a === b) {\n          hasDuplicate = true;\n        }\n        return 0;\n      }, strundefined = typeof undefined, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push$1 = arr.push, slice$1 = arr.slice, indexOf = arr.indexOf || function (elem) {\n        var i = 0, len = this.length;\n        for (; i < len; i++) {\n          if (this[i] === elem) {\n            return i;\n          }\n        }\n        return -1;\n      }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\\\x20\\\\t\\\\r\\\\n\\\\f]', identifier = '(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+', attributes = '\\\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\\'((?:\\\\\\\\.|[^\\\\\\\\\\'])*)\\'|\"((?:\\\\\\\\.|[^\\\\\\\\\"])*)\"|(' + identifier + '))|)' + whitespace + '*\\\\]', pseudos = ':(' + identifier + ')(?:\\\\((' + '(\\'((?:\\\\\\\\.|[^\\\\\\\\\\'])*)\\'|\"((?:\\\\\\\\.|[^\\\\\\\\\"])*)\")|' + '((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|' + attributes + ')*)|' + '.*' + ')\\\\)|)', rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\\\]\\'\"]*?)' + whitespace + '*\\\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = {\n        ID: new RegExp('^#(' + identifier + ')'),\n        CLASS: new RegExp('^\\\\.(' + identifier + ')'),\n        TAG: new RegExp('^(' + identifier + '|[*])'),\n        ATTR: new RegExp('^' + attributes),\n        PSEUDO: new RegExp('^' + pseudos),\n        CHILD: new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(' + whitespace + '*(even|odd|(([+-]|)(\\\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\\\d+)|))' + whitespace + '*\\\\)|)', 'i'),\n        bool: new RegExp('^(?:' + booleans + ')$', 'i'),\n        needsContext: new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(' + whitespace + '*((?:-\\\\d)?\\\\d*)' + whitespace + '*\\\\)|)(?=[^-]|$)', 'i')\n      }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\\d$/i, rnative = /^[^{]+\\{\\s*\\[native \\w/, rquickExpr$1 = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\\\/g, runescape = new RegExp('\\\\\\\\([\\\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) {\n        var high = '0x' + escaped - 65536;\n        return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);\n      };\n    try {\n      push$1.apply(arr = slice$1.call(preferredDoc.childNodes), preferredDoc.childNodes);\n      arr[preferredDoc.childNodes.length].nodeType;\n    } catch (e) {\n      push$1 = {\n        apply: arr.length ? function (target, els) {\n          push_native.apply(target, slice$1.call(els));\n        } : function (target, els) {\n          var j = target.length, i = 0;\n          while (target[j++] = els[i++]) {\n          }\n          target.length = j - 1;\n        }\n      };\n    }\n    var Sizzle = function (selector, context, results, seed) {\n      var match, elem, m, nodeType, i, groups, old, nid, newContext, newSelector;\n      if ((context ? context.ownerDocument || context : preferredDoc) !== document$1) {\n        setDocument(context);\n      }\n      context = context || document$1;\n      results = results || [];\n      if (!selector || typeof selector !== 'string') {\n        return results;\n      }\n      if ((nodeType = context.nodeType) !== 1 && nodeType !== 9) {\n        return [];\n      }\n      if (documentIsHTML && !seed) {\n        if (match = rquickExpr$1.exec(selector)) {\n          if (m = match[1]) {\n            if (nodeType === 9) {\n              elem = context.getElementById(m);\n              if (elem && elem.parentNode) {\n                if (elem.id === m) {\n                  results.push(elem);\n                  return results;\n                }\n              } else {\n                return results;\n              }\n            } else {\n              if (context.ownerDocument && (elem = context.ownerDocument.getElementById(m)) && contains(context, elem) && elem.id === m) {\n                results.push(elem);\n                return results;\n              }\n            }\n          } else if (match[2]) {\n            push$1.apply(results, context.getElementsByTagName(selector));\n            return results;\n          } else if ((m = match[3]) && support.getElementsByClassName) {\n            push$1.apply(results, context.getElementsByClassName(m));\n            return results;\n          }\n        }\n        if (support.qsa && (!rbuggyQSA || !rbuggyQSA.test(selector))) {\n          nid = old = expando;\n          newContext = context;\n          newSelector = nodeType === 9 && selector;\n          if (nodeType === 1 && context.nodeName.toLowerCase() !== 'object') {\n            groups = tokenize(selector);\n            if (old = context.getAttribute('id')) {\n              nid = old.replace(rescape, '\\\\$&');\n            } else {\n              context.setAttribute('id', nid);\n            }\n            nid = '[id=\\'' + nid + '\\'] ';\n            i = groups.length;\n            while (i--) {\n              groups[i] = nid + toSelector(groups[i]);\n            }\n            newContext = rsibling.test(selector) && testContext(context.parentNode) || context;\n            newSelector = groups.join(',');\n          }\n          if (newSelector) {\n            try {\n              push$1.apply(results, newContext.querySelectorAll(newSelector));\n              return results;\n            } catch (qsaError) {\n            } finally {\n              if (!old) {\n                context.removeAttribute('id');\n              }\n            }\n          }\n        }\n      }\n      return select$1(selector.replace(rtrim, '$1'), context, results, seed);\n    };\n    function createCache() {\n      var keys = [];\n      function cache(key, value) {\n        if (keys.push(key + ' ') > Expr.cacheLength) {\n          delete cache[keys.shift()];\n        }\n        return cache[key + ' '] = value;\n      }\n      return cache;\n    }\n    function markFunction(fn) {\n      fn[expando] = true;\n      return fn;\n    }\n    function siblingCheck(a, b) {\n      var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);\n      if (diff) {\n        return diff;\n      }\n      if (cur) {\n        while (cur = cur.nextSibling) {\n          if (cur === b) {\n            return -1;\n          }\n        }\n      }\n      return a ? 1 : -1;\n    }\n    function createInputPseudo(type) {\n      return function (elem) {\n        var name = elem.nodeName.toLowerCase();\n        return name === 'input' && elem.type === type;\n      };\n    }\n    function createButtonPseudo(type) {\n      return function (elem) {\n        var name = elem.nodeName.toLowerCase();\n        return (name === 'input' || name === 'button') && elem.type === type;\n      };\n    }\n    function createPositionalPseudo(fn) {\n      return markFunction(function (argument) {\n        argument = +argument;\n        return markFunction(function (seed, matches) {\n          var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;\n          while (i--) {\n            if (seed[j = matchIndexes[i]]) {\n              seed[j] = !(matches[j] = seed[j]);\n            }\n          }\n        });\n      });\n    }\n    function testContext(context) {\n      return context && typeof context.getElementsByTagName !== strundefined && context;\n    }\n    support = Sizzle.support = {};\n    isXML = Sizzle.isXML = function (elem) {\n      var documentElement = elem && (elem.ownerDocument || elem).documentElement;\n      return documentElement ? documentElement.nodeName !== 'HTML' : false;\n    };\n    setDocument = Sizzle.setDocument = function (node) {\n      var hasCompare, doc = node ? node.ownerDocument || node : preferredDoc, parent = doc.defaultView;\n      function getTop(win) {\n        try {\n          return win.top;\n        } catch (ex) {\n        }\n        return null;\n      }\n      if (doc === document$1 || doc.nodeType !== 9 || !doc.documentElement) {\n        return document$1;\n      }\n      document$1 = doc;\n      docElem = doc.documentElement;\n      documentIsHTML = !isXML(doc);\n      if (parent && parent !== getTop(parent)) {\n        if (parent.addEventListener) {\n          parent.addEventListener('unload', function () {\n            setDocument();\n          }, false);\n        } else if (parent.attachEvent) {\n          parent.attachEvent('onunload', function () {\n            setDocument();\n          });\n        }\n      }\n      support.attributes = true;\n      support.getElementsByTagName = true;\n      support.getElementsByClassName = rnative.test(doc.getElementsByClassName);\n      support.getById = true;\n      Expr.find.ID = function (id, context) {\n        if (typeof context.getElementById !== strundefined && documentIsHTML) {\n          var m = context.getElementById(id);\n          return m && m.parentNode ? [m] : [];\n        }\n      };\n      Expr.filter.ID = function (id) {\n        var attrId = id.replace(runescape, funescape);\n        return function (elem) {\n          return elem.getAttribute('id') === attrId;\n        };\n      };\n      Expr.find.TAG = support.getElementsByTagName ? function (tag, context) {\n        if (typeof context.getElementsByTagName !== strundefined) {\n          return context.getElementsByTagName(tag);\n        }\n      } : function (tag, context) {\n        var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);\n        if (tag === '*') {\n          while (elem = results[i++]) {\n            if (elem.nodeType === 1) {\n              tmp.push(elem);\n            }\n          }\n          return tmp;\n        }\n        return results;\n      };\n      Expr.find.CLASS = support.getElementsByClassName && function (className, context) {\n        if (documentIsHTML) {\n          return context.getElementsByClassName(className);\n        }\n      };\n      rbuggyMatches = [];\n      rbuggyQSA = [];\n      support.disconnectedMatch = true;\n      rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|'));\n      rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|'));\n      hasCompare = rnative.test(docElem.compareDocumentPosition);\n      contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {\n        var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;\n        return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n      } : function (a, b) {\n        if (b) {\n          while (b = b.parentNode) {\n            if (b === a) {\n              return true;\n            }\n          }\n        }\n        return false;\n      };\n      sortOrder = hasCompare ? function (a, b) {\n        if (a === b) {\n          hasDuplicate = true;\n          return 0;\n        }\n        var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n        if (compare) {\n          return compare;\n        }\n        compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;\n        if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {\n          if (a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {\n            return -1;\n          }\n          if (b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {\n            return 1;\n          }\n          return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;\n        }\n        return compare & 4 ? -1 : 1;\n      } : function (a, b) {\n        if (a === b) {\n          hasDuplicate = true;\n          return 0;\n        }\n        var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];\n        if (!aup || !bup) {\n          return a === doc ? -1 : b === doc ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;\n        } else if (aup === bup) {\n          return siblingCheck(a, b);\n        }\n        cur = a;\n        while (cur = cur.parentNode) {\n          ap.unshift(cur);\n        }\n        cur = b;\n        while (cur = cur.parentNode) {\n          bp.unshift(cur);\n        }\n        while (ap[i] === bp[i]) {\n          i++;\n        }\n        return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;\n      };\n      return doc;\n    };\n    Sizzle.matches = function (expr, elements) {\n      return Sizzle(expr, null, null, elements);\n    };\n    Sizzle.matchesSelector = function (elem, expr) {\n      if ((elem.ownerDocument || elem) !== document$1) {\n        setDocument(elem);\n      }\n      expr = expr.replace(rattributeQuotes, '=\\'$1\\']');\n      if (support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n        try {\n          var ret = matches.call(elem, expr);\n          if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {\n            return ret;\n          }\n        } catch (e) {\n        }\n      }\n      return Sizzle(expr, document$1, null, [elem]).length > 0;\n    };\n    Sizzle.contains = function (context, elem) {\n      if ((context.ownerDocument || context) !== document$1) {\n        setDocument(context);\n      }\n      return contains(context, elem);\n    };\n    Sizzle.attr = function (elem, name) {\n      if ((elem.ownerDocument || elem) !== document$1) {\n        setDocument(elem);\n      }\n      var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;\n      return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;\n    };\n    Sizzle.error = function (msg) {\n      throw new Error('Syntax error, unrecognized expression: ' + msg);\n    };\n    Sizzle.uniqueSort = function (results) {\n      var elem, duplicates = [], j = 0, i = 0;\n      hasDuplicate = !support.detectDuplicates;\n      sortInput = !support.sortStable && results.slice(0);\n      results.sort(sortOrder);\n      if (hasDuplicate) {\n        while (elem = results[i++]) {\n          if (elem === results[i]) {\n            j = duplicates.push(i);\n          }\n        }\n        while (j--) {\n          results.splice(duplicates[j], 1);\n        }\n      }\n      sortInput = null;\n      return results;\n    };\n    getText = Sizzle.getText = function (elem) {\n      var node, ret = '', i = 0, nodeType = elem.nodeType;\n      if (!nodeType) {\n        while (node = elem[i++]) {\n          ret += getText(node);\n        }\n      } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n        if (typeof elem.textContent === 'string') {\n          return elem.textContent;\n        } else {\n          for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n            ret += getText(elem);\n          }\n        }\n      } else if (nodeType === 3 || nodeType === 4) {\n        return elem.nodeValue;\n      }\n      return ret;\n    };\n    Expr = Sizzle.selectors = {\n      cacheLength: 50,\n      createPseudo: markFunction,\n      match: matchExpr,\n      attrHandle: {},\n      find: {},\n      relative: {\n        '>': {\n          dir: 'parentNode',\n          first: true\n        },\n        ' ': { dir: 'parentNode' },\n        '+': {\n          dir: 'previousSibling',\n          first: true\n        },\n        '~': { dir: 'previousSibling' }\n      },\n      preFilter: {\n        ATTR: function (match) {\n          match[1] = match[1].replace(runescape, funescape);\n          match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape);\n          if (match[2] === '~=') {\n            match[3] = ' ' + match[3] + ' ';\n          }\n          return match.slice(0, 4);\n        },\n        CHILD: function (match) {\n          match[1] = match[1].toLowerCase();\n          if (match[1].slice(0, 3) === 'nth') {\n            if (!match[3]) {\n              Sizzle.error(match[0]);\n            }\n            match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd'));\n            match[5] = +(match[7] + match[8] || match[3] === 'odd');\n          } else if (match[3]) {\n            Sizzle.error(match[0]);\n          }\n          return match;\n        },\n        PSEUDO: function (match) {\n          var excess, unquoted = !match[6] && match[2];\n          if (matchExpr.CHILD.test(match[0])) {\n            return null;\n          }\n          if (match[3]) {\n            match[2] = match[4] || match[5] || '';\n          } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) {\n            match[0] = match[0].slice(0, excess);\n            match[2] = unquoted.slice(0, excess);\n          }\n          return match.slice(0, 3);\n        }\n      },\n      filter: {\n        TAG: function (nodeNameSelector) {\n          var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n          return nodeNameSelector === '*' ? function () {\n            return true;\n          } : function (elem) {\n            return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n          };\n        },\n        CLASS: function (className) {\n          var pattern = classCache[className + ' '];\n          return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) {\n            return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute('class') || '');\n          });\n        },\n        ATTR: function (name, operator, check) {\n          return function (elem) {\n            var result = Sizzle.attr(elem, name);\n            if (result == null) {\n              return operator === '!=';\n            }\n            if (!operator) {\n              return true;\n            }\n            result += '';\n            return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false;\n          };\n        },\n        CHILD: function (type, what, argument, first, last) {\n          var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type';\n          return first === 1 && last === 0 ? function (elem) {\n            return !!elem.parentNode;\n          } : function (elem, context, xml) {\n            var cache, outerCache, node, diff, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType;\n            if (parent) {\n              if (simple) {\n                while (dir) {\n                  node = elem;\n                  while (node = node[dir]) {\n                    if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {\n                      return false;\n                    }\n                  }\n                  start = dir = type === 'only' && !start && 'nextSibling';\n                }\n                return true;\n              }\n              start = [forward ? parent.firstChild : parent.lastChild];\n              if (forward && useCache) {\n                outerCache = parent[expando] || (parent[expando] = {});\n                cache = outerCache[type] || [];\n                nodeIndex = cache[0] === dirruns && cache[1];\n                diff = cache[0] === dirruns && cache[2];\n                node = nodeIndex && parent.childNodes[nodeIndex];\n                while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n                  if (node.nodeType === 1 && ++diff && node === elem) {\n                    outerCache[type] = [\n                      dirruns,\n                      nodeIndex,\n                      diff\n                    ];\n                    break;\n                  }\n                }\n              } else if (useCache && (cache = (elem[expando] || (elem[expando] = {}))[type]) && cache[0] === dirruns) {\n                diff = cache[1];\n              } else {\n                while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n                  if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {\n                    if (useCache) {\n                      (node[expando] || (node[expando] = {}))[type] = [\n                        dirruns,\n                        diff\n                      ];\n                    }\n                    if (node === elem) {\n                      break;\n                    }\n                  }\n                }\n              }\n              diff -= last;\n              return diff === first || diff % first === 0 && diff / first >= 0;\n            }\n          };\n        },\n        PSEUDO: function (pseudo, argument) {\n          var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo);\n          if (fn[expando]) {\n            return fn(argument);\n          }\n          if (fn.length > 1) {\n            args = [\n              pseudo,\n              pseudo,\n              '',\n              argument\n            ];\n            return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {\n              var idx, matched = fn(seed, argument), i = matched.length;\n              while (i--) {\n                idx = indexOf.call(seed, matched[i]);\n                seed[idx] = !(matches[idx] = matched[i]);\n              }\n            }) : function (elem) {\n              return fn(elem, 0, args);\n            };\n          }\n          return fn;\n        }\n      },\n      pseudos: {\n        not: markFunction(function (selector) {\n          var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1'));\n          return matcher[expando] ? markFunction(function (seed, matches, context, xml) {\n            var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;\n            while (i--) {\n              if (elem = unmatched[i]) {\n                seed[i] = !(matches[i] = elem);\n              }\n            }\n          }) : function (elem, context, xml) {\n            input[0] = elem;\n            matcher(input, null, xml, results);\n            input[0] = null;\n            return !results.pop();\n          };\n        }),\n        has: markFunction(function (selector) {\n          return function (elem) {\n            return Sizzle(selector, elem).length > 0;\n          };\n        }),\n        contains: markFunction(function (text) {\n          text = text.replace(runescape, funescape);\n          return function (elem) {\n            return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;\n          };\n        }),\n        lang: markFunction(function (lang) {\n          if (!ridentifier.test(lang || '')) {\n            Sizzle.error('unsupported lang: ' + lang);\n          }\n          lang = lang.replace(runescape, funescape).toLowerCase();\n          return function (elem) {\n            var elemLang;\n            do {\n              if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) {\n                elemLang = elemLang.toLowerCase();\n                return elemLang === lang || elemLang.indexOf(lang + '-') === 0;\n              }\n            } while ((elem = elem.parentNode) && elem.nodeType === 1);\n            return false;\n          };\n        }),\n        target: function (elem) {\n          var hash = window.location && window.location.hash;\n          return hash && hash.slice(1) === elem.id;\n        },\n        root: function (elem) {\n          return elem === docElem;\n        },\n        focus: function (elem) {\n          return elem === document$1.activeElement && (!document$1.hasFocus || document$1.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n        },\n        enabled: function (elem) {\n          return elem.disabled === false;\n        },\n        disabled: function (elem) {\n          return elem.disabled === true;\n        },\n        checked: function (elem) {\n          var nodeName = elem.nodeName.toLowerCase();\n          return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected;\n        },\n        selected: function (elem) {\n          if (elem.parentNode) {\n            elem.parentNode.selectedIndex;\n          }\n          return elem.selected === true;\n        },\n        empty: function (elem) {\n          for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n            if (elem.nodeType < 6) {\n              return false;\n            }\n          }\n          return true;\n        },\n        parent: function (elem) {\n          return !Expr.pseudos.empty(elem);\n        },\n        header: function (elem) {\n          return rheader.test(elem.nodeName);\n        },\n        input: function (elem) {\n          return rinputs.test(elem.nodeName);\n        },\n        button: function (elem) {\n          var name = elem.nodeName.toLowerCase();\n          return name === 'input' && elem.type === 'button' || name === 'button';\n        },\n        text: function (elem) {\n          var attr;\n          return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text');\n        },\n        first: createPositionalPseudo(function () {\n          return [0];\n        }),\n        last: createPositionalPseudo(function (matchIndexes, length) {\n          return [length - 1];\n        }),\n        eq: createPositionalPseudo(function (matchIndexes, length, argument) {\n          return [argument < 0 ? argument + length : argument];\n        }),\n        even: createPositionalPseudo(function (matchIndexes, length) {\n          var i = 0;\n          for (; i < length; i += 2) {\n            matchIndexes.push(i);\n          }\n          return matchIndexes;\n        }),\n        odd: createPositionalPseudo(function (matchIndexes, length) {\n          var i = 1;\n          for (; i < length; i += 2) {\n            matchIndexes.push(i);\n          }\n          return matchIndexes;\n        }),\n        lt: createPositionalPseudo(function (matchIndexes, length, argument) {\n          var i = argument < 0 ? argument + length : argument;\n          for (; --i >= 0;) {\n            matchIndexes.push(i);\n          }\n          return matchIndexes;\n        }),\n        gt: createPositionalPseudo(function (matchIndexes, length, argument) {\n          var i = argument < 0 ? argument + length : argument;\n          for (; ++i < length;) {\n            matchIndexes.push(i);\n          }\n          return matchIndexes;\n        })\n      }\n    };\n    Expr.pseudos.nth = Expr.pseudos.eq;\n    each$k([\n      'radio',\n      'checkbox',\n      'file',\n      'password',\n      'image'\n    ], function (i) {\n      Expr.pseudos[i] = createInputPseudo(i);\n    });\n    each$k([\n      'submit',\n      'reset'\n    ], function (i) {\n      Expr.pseudos[i] = createButtonPseudo(i);\n    });\n    function setFilters() {\n    }\n    setFilters.prototype = Expr.filters = Expr.pseudos;\n    Expr.setFilters = new setFilters();\n    tokenize = Sizzle.tokenize = function (selector, parseOnly) {\n      var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' '];\n      if (cached) {\n        return parseOnly ? 0 : cached.slice(0);\n      }\n      soFar = selector;\n      groups = [];\n      preFilters = Expr.preFilter;\n      while (soFar) {\n        if (!matched || (match = rcomma.exec(soFar))) {\n          if (match) {\n            soFar = soFar.slice(match[0].length) || soFar;\n          }\n          groups.push(tokens = []);\n        }\n        matched = false;\n        if (match = rcombinators.exec(soFar)) {\n          matched = match.shift();\n          tokens.push({\n            value: matched,\n            type: match[0].replace(rtrim, ' ')\n          });\n          soFar = soFar.slice(matched.length);\n        }\n        for (type in Expr.filter) {\n          if (!Expr.filter.hasOwnProperty(type)) {\n            continue;\n          }\n          if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {\n            matched = match.shift();\n            tokens.push({\n              value: matched,\n              type: type,\n              matches: match\n            });\n            soFar = soFar.slice(matched.length);\n          }\n        }\n        if (!matched) {\n          break;\n        }\n      }\n      return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);\n    };\n    function toSelector(tokens) {\n      var i = 0, len = tokens.length, selector = '';\n      for (; i < len; i++) {\n        selector += tokens[i].value;\n      }\n      return selector;\n    }\n    function addCombinator(matcher, combinator, base) {\n      var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++;\n      return combinator.first ? function (elem, context, xml) {\n        while (elem = elem[dir]) {\n          if (elem.nodeType === 1 || checkNonElements) {\n            return matcher(elem, context, xml);\n          }\n        }\n      } : function (elem, context, xml) {\n        var oldCache, outerCache, newCache = [\n            dirruns,\n            doneName\n          ];\n        if (xml) {\n          while (elem = elem[dir]) {\n            if (elem.nodeType === 1 || checkNonElements) {\n              if (matcher(elem, context, xml)) {\n                return true;\n              }\n            }\n          }\n        } else {\n          while (elem = elem[dir]) {\n            if (elem.nodeType === 1 || checkNonElements) {\n              outerCache = elem[expando] || (elem[expando] = {});\n              if ((oldCache = outerCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {\n                return newCache[2] = oldCache[2];\n              } else {\n                outerCache[dir] = newCache;\n                if (newCache[2] = matcher(elem, context, xml)) {\n                  return true;\n                }\n              }\n            }\n          }\n        }\n      };\n    }\n    function elementMatcher(matchers) {\n      return matchers.length > 1 ? function (elem, context, xml) {\n        var i = matchers.length;\n        while (i--) {\n          if (!matchers[i](elem, context, xml)) {\n            return false;\n          }\n        }\n        return true;\n      } : matchers[0];\n    }\n    function multipleContexts(selector, contexts, results) {\n      var i = 0, len = contexts.length;\n      for (; i < len; i++) {\n        Sizzle(selector, contexts[i], results);\n      }\n      return results;\n    }\n    function condense(unmatched, map, filter, context, xml) {\n      var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;\n      for (; i < len; i++) {\n        if (elem = unmatched[i]) {\n          if (!filter || filter(elem, context, xml)) {\n            newUnmatched.push(elem);\n            if (mapped) {\n              map.push(i);\n            }\n          }\n        }\n      }\n      return newUnmatched;\n    }\n    function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n      if (postFilter && !postFilter[expando]) {\n        postFilter = setMatcher(postFilter);\n      }\n      if (postFinder && !postFinder[expando]) {\n        postFinder = setMatcher(postFinder, postSelector);\n      }\n      return markFunction(function (seed, results, context, xml) {\n        var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;\n        if (matcher) {\n          matcher(matcherIn, matcherOut, context, xml);\n        }\n        if (postFilter) {\n          temp = condense(matcherOut, postMap);\n          postFilter(temp, [], context, xml);\n          i = temp.length;\n          while (i--) {\n            if (elem = temp[i]) {\n              matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n            }\n          }\n        }\n        if (seed) {\n          if (postFinder || preFilter) {\n            if (postFinder) {\n              temp = [];\n              i = matcherOut.length;\n              while (i--) {\n                if (elem = matcherOut[i]) {\n                  temp.push(matcherIn[i] = elem);\n                }\n              }\n              postFinder(null, matcherOut = [], temp, xml);\n            }\n            i = matcherOut.length;\n            while (i--) {\n              if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i]) > -1) {\n                seed[temp] = !(results[temp] = elem);\n              }\n            }\n          }\n        } else {\n          matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);\n          if (postFinder) {\n            postFinder(null, results, matcherOut, xml);\n          } else {\n            push$1.apply(results, matcherOut);\n          }\n        }\n      });\n    }\n    function matcherFromTokens(tokens) {\n      var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) {\n          return elem === checkContext;\n        }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {\n          return indexOf.call(checkContext, elem) > -1;\n        }, implicitRelative, true), matchers = [function (elem, context, xml) {\n            var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));\n            checkContext = null;\n            return ret;\n          }];\n      for (; i < len; i++) {\n        if (matcher = Expr.relative[tokens[i].type]) {\n          matchers = [addCombinator(elementMatcher(matchers), matcher)];\n        } else {\n          matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);\n          if (matcher[expando]) {\n            j = ++i;\n            for (; j < len; j++) {\n              if (Expr.relative[tokens[j].type]) {\n                break;\n              }\n            }\n            return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));\n          }\n          matchers.push(matcher);\n        }\n      }\n      return elementMatcher(matchers);\n    }\n    function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n      var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {\n          var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;\n          if (outermost) {\n            outermostContext = context !== document$1 && context;\n          }\n          for (; i !== len && (elem = elems[i]) != null; i++) {\n            if (byElement && elem) {\n              j = 0;\n              while (matcher = elementMatchers[j++]) {\n                if (matcher(elem, context, xml)) {\n                  results.push(elem);\n                  break;\n                }\n              }\n              if (outermost) {\n                dirruns = dirrunsUnique;\n              }\n            }\n            if (bySet) {\n              if (elem = !matcher && elem) {\n                matchedCount--;\n              }\n              if (seed) {\n                unmatched.push(elem);\n              }\n            }\n          }\n          matchedCount += i;\n          if (bySet && i !== matchedCount) {\n            j = 0;\n            while (matcher = setMatchers[j++]) {\n              matcher(unmatched, setMatched, context, xml);\n            }\n            if (seed) {\n              if (matchedCount > 0) {\n                while (i--) {\n                  if (!(unmatched[i] || setMatched[i])) {\n                    setMatched[i] = pop.call(results);\n                  }\n                }\n              }\n              setMatched = condense(setMatched);\n            }\n            push$1.apply(results, setMatched);\n            if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {\n              Sizzle.uniqueSort(results);\n            }\n          }\n          if (outermost) {\n            dirruns = dirrunsUnique;\n            outermostContext = contextBackup;\n          }\n          return unmatched;\n        };\n      return bySet ? markFunction(superMatcher) : superMatcher;\n    }\n    compile = Sizzle.compile = function (selector, match) {\n      var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' '];\n      if (!cached) {\n        if (!match) {\n          match = tokenize(selector);\n        }\n        i = match.length;\n        while (i--) {\n          cached = matcherFromTokens(match[i]);\n          if (cached[expando]) {\n            setMatchers.push(cached);\n          } else {\n            elementMatchers.push(cached);\n          }\n        }\n        cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));\n        cached.selector = selector;\n      }\n      return cached;\n    };\n    select$1 = Sizzle.select = function (selector, context, results, seed) {\n      var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector);\n      results = results || [];\n      if (match.length === 1) {\n        tokens = match[0] = match[0].slice(0);\n        if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n          context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0];\n          if (!context) {\n            return results;\n          } else if (compiled) {\n            context = context.parentNode;\n          }\n          selector = selector.slice(tokens.shift().value.length);\n        }\n        i = matchExpr.needsContext.test(selector) ? 0 : tokens.length;\n        while (i--) {\n          token = tokens[i];\n          if (Expr.relative[type = token.type]) {\n            break;\n          }\n          if (find = Expr.find[type]) {\n            if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {\n              tokens.splice(i, 1);\n              selector = seed.length && toSelector(tokens);\n              if (!selector) {\n                push$1.apply(results, seed);\n                return results;\n              }\n              break;\n            }\n          }\n        }\n      }\n      (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, rsibling.test(selector) && testContext(context.parentNode) || context);\n      return results;\n    };\n    support.sortStable = expando.split('').sort(sortOrder).join('') === expando;\n    support.detectDuplicates = !!hasDuplicate;\n    setDocument();\n    support.sortDetached = true;\n\n    var doc = document;\n    var push = Array.prototype.push;\n    var slice = Array.prototype.slice;\n    var rquickExpr = /^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/;\n    var Event$1 = EventUtils.Event;\n    var skipUniques = Tools.makeMap('children,contents,next,prev');\n    var isDefined = function (obj) {\n      return typeof obj !== 'undefined';\n    };\n    var isString = function (obj) {\n      return typeof obj === 'string';\n    };\n    var isWindow = function (obj) {\n      return obj && obj === obj.window;\n    };\n    var createFragment$1 = function (html, fragDoc) {\n      fragDoc = fragDoc || doc;\n      var container = fragDoc.createElement('div');\n      var frag = fragDoc.createDocumentFragment();\n      container.innerHTML = html;\n      var node;\n      while (node = container.firstChild) {\n        frag.appendChild(node);\n      }\n      return frag;\n    };\n    var domManipulate = function (targetNodes, sourceItem, callback, reverse) {\n      var i;\n      if (isString(sourceItem)) {\n        sourceItem = createFragment$1(sourceItem, getElementDocument(targetNodes[0]));\n      } else if (sourceItem.length && !sourceItem.nodeType) {\n        sourceItem = DomQuery.makeArray(sourceItem);\n        if (reverse) {\n          for (i = sourceItem.length - 1; i >= 0; i--) {\n            domManipulate(targetNodes, sourceItem[i], callback, reverse);\n          }\n        } else {\n          for (i = 0; i < sourceItem.length; i++) {\n            domManipulate(targetNodes, sourceItem[i], callback, reverse);\n          }\n        }\n        return targetNodes;\n      }\n      if (sourceItem.nodeType) {\n        i = targetNodes.length;\n        while (i--) {\n          callback.call(targetNodes[i], sourceItem);\n        }\n      }\n      return targetNodes;\n    };\n    var hasClass = function (node, className) {\n      return node && className && (' ' + node.className + ' ').indexOf(' ' + className + ' ') !== -1;\n    };\n    var wrap$2 = function (elements, wrapper, all) {\n      var lastParent, newWrapper;\n      wrapper = DomQuery(wrapper)[0];\n      elements.each(function () {\n        var self = this;\n        if (!all || lastParent !== self.parentNode) {\n          lastParent = self.parentNode;\n          newWrapper = wrapper.cloneNode(false);\n          self.parentNode.insertBefore(newWrapper, self);\n          newWrapper.appendChild(self);\n        } else {\n          newWrapper.appendChild(self);\n        }\n      });\n      return elements;\n    };\n    var numericCssMap = Tools.makeMap('fillOpacity fontWeight lineHeight opacity orphans widows zIndex zoom', ' ');\n    var booleanMap = Tools.makeMap('checked compact declare defer disabled ismap multiple nohref noshade nowrap readonly selected', ' ');\n    var propFix = {\n      for: 'htmlFor',\n      class: 'className',\n      readonly: 'readOnly'\n    };\n    var cssFix = { float: 'cssFloat' };\n    var attrHooks = {}, cssHooks = {};\n    var DomQueryConstructor = function (selector, context) {\n      return new DomQuery.fn.init(selector, context);\n    };\n    var inArray$1 = function (item, array) {\n      var i;\n      if (array.indexOf) {\n        return array.indexOf(item);\n      }\n      i = array.length;\n      while (i--) {\n        if (array[i] === item) {\n          return i;\n        }\n      }\n      return -1;\n    };\n    var whiteSpaceRegExp = /^\\s*|\\s*$/g;\n    var trim$2 = function (str) {\n      return str === null || str === undefined ? '' : ('' + str).replace(whiteSpaceRegExp, '');\n    };\n    var each$g = function (obj, callback) {\n      var length, key, i, value;\n      if (obj) {\n        length = obj.length;\n        if (length === undefined) {\n          for (key in obj) {\n            if (obj.hasOwnProperty(key)) {\n              value = obj[key];\n              if (callback.call(value, key, value) === false) {\n                break;\n              }\n            }\n          }\n        } else {\n          for (i = 0; i < length; i++) {\n            value = obj[i];\n            if (callback.call(value, i, value) === false) {\n              break;\n            }\n          }\n        }\n      }\n      return obj;\n    };\n    var grep$2 = function (array, callback) {\n      var out = [];\n      each$g(array, function (i, item) {\n        if (callback(item, i)) {\n          out.push(item);\n        }\n      });\n      return out;\n    };\n    var getElementDocument = function (element) {\n      if (!element) {\n        return doc;\n      }\n      if (element.nodeType === 9) {\n        return element;\n      }\n      return element.ownerDocument;\n    };\n    DomQueryConstructor.fn = DomQueryConstructor.prototype = {\n      constructor: DomQueryConstructor,\n      selector: '',\n      context: null,\n      length: 0,\n      init: function (selector, context) {\n        var self = this;\n        var match, node;\n        if (!selector) {\n          return self;\n        }\n        if (selector.nodeType) {\n          self.context = self[0] = selector;\n          self.length = 1;\n          return self;\n        }\n        if (context && context.nodeType) {\n          self.context = context;\n        } else {\n          if (context) {\n            return DomQuery(selector).attr(context);\n          }\n          self.context = context = document;\n        }\n        if (isString(selector)) {\n          self.selector = selector;\n          if (selector.charAt(0) === '<' && selector.charAt(selector.length - 1) === '>' && selector.length >= 3) {\n            match = [\n              null,\n              selector,\n              null\n            ];\n          } else {\n            match = rquickExpr.exec(selector);\n          }\n          if (match) {\n            if (match[1]) {\n              node = createFragment$1(selector, getElementDocument(context)).firstChild;\n              while (node) {\n                push.call(self, node);\n                node = node.nextSibling;\n              }\n            } else {\n              node = getElementDocument(context).getElementById(match[2]);\n              if (!node) {\n                return self;\n              }\n              if (node.id !== match[2]) {\n                return self.find(selector);\n              }\n              self.length = 1;\n              self[0] = node;\n            }\n          } else {\n            return DomQuery(context).find(selector);\n          }\n        } else {\n          this.add(selector, false);\n        }\n        return self;\n      },\n      toArray: function () {\n        return Tools.toArray(this);\n      },\n      add: function (items, sort) {\n        var self = this;\n        var nodes, i;\n        if (isString(items)) {\n          return self.add(DomQuery(items));\n        }\n        if (sort !== false) {\n          nodes = DomQuery.unique(self.toArray().concat(DomQuery.makeArray(items)));\n          self.length = nodes.length;\n          for (i = 0; i < nodes.length; i++) {\n            self[i] = nodes[i];\n          }\n        } else {\n          push.apply(self, DomQuery.makeArray(items));\n        }\n        return self;\n      },\n      attr: function (name, value) {\n        var self = this;\n        var hook;\n        if (typeof name === 'object') {\n          each$g(name, function (name, value) {\n            self.attr(name, value);\n          });\n        } else if (isDefined(value)) {\n          this.each(function () {\n            var hook;\n            if (this.nodeType === 1) {\n              hook = attrHooks[name];\n              if (hook && hook.set) {\n                hook.set(this, value);\n                return;\n              }\n              if (value === null) {\n                this.removeAttribute(name, 2);\n              } else {\n                this.setAttribute(name, value, 2);\n              }\n            }\n          });\n        } else {\n          if (self[0] && self[0].nodeType === 1) {\n            hook = attrHooks[name];\n            if (hook && hook.get) {\n              return hook.get(self[0], name);\n            }\n            if (booleanMap[name]) {\n              return self.prop(name) ? name : undefined;\n            }\n            value = self[0].getAttribute(name, 2);\n            if (value === null) {\n              value = undefined;\n            }\n          }\n          return value;\n        }\n        return self;\n      },\n      removeAttr: function (name) {\n        return this.attr(name, null);\n      },\n      prop: function (name, value) {\n        var self = this;\n        name = propFix[name] || name;\n        if (typeof name === 'object') {\n          each$g(name, function (name, value) {\n            self.prop(name, value);\n          });\n        } else if (isDefined(value)) {\n          this.each(function () {\n            if (this.nodeType === 1) {\n              this[name] = value;\n            }\n          });\n        } else {\n          if (self[0] && self[0].nodeType && name in self[0]) {\n            return self[0][name];\n          }\n          return value;\n        }\n        return self;\n      },\n      css: function (name, value) {\n        var self = this;\n        var elm, hook;\n        var camel = function (name) {\n          return name.replace(/-(\\D)/g, function (a, b) {\n            return b.toUpperCase();\n          });\n        };\n        var dashed = function (name) {\n          return name.replace(/[A-Z]/g, function (a) {\n            return '-' + a;\n          });\n        };\n        if (typeof name === 'object') {\n          each$g(name, function (name, value) {\n            self.css(name, value);\n          });\n        } else {\n          if (isDefined(value)) {\n            name = camel(name);\n            if (typeof value === 'number' && !numericCssMap[name]) {\n              value = value.toString() + 'px';\n            }\n            self.each(function () {\n              var style = this.style;\n              hook = cssHooks[name];\n              if (hook && hook.set) {\n                hook.set(this, value);\n                return;\n              }\n              try {\n                this.style[cssFix[name] || name] = value;\n              } catch (ex) {\n              }\n              if (value === null || value === '') {\n                if (style.removeProperty) {\n                  style.removeProperty(dashed(name));\n                } else {\n                  style.removeAttribute(name);\n                }\n              }\n            });\n          } else {\n            elm = self[0];\n            hook = cssHooks[name];\n            if (hook && hook.get) {\n              return hook.get(elm);\n            }\n            if (elm.ownerDocument.defaultView) {\n              try {\n                return elm.ownerDocument.defaultView.getComputedStyle(elm, null).getPropertyValue(dashed(name));\n              } catch (ex) {\n                return undefined;\n              }\n            } else if (elm.currentStyle) {\n              return elm.currentStyle[camel(name)];\n            } else {\n              return '';\n            }\n          }\n        }\n        return self;\n      },\n      remove: function () {\n        var self = this;\n        var node, i = this.length;\n        while (i--) {\n          node = self[i];\n          Event$1.clean(node);\n          if (node.parentNode) {\n            node.parentNode.removeChild(node);\n          }\n        }\n        return this;\n      },\n      empty: function () {\n        var self = this;\n        var node, i = this.length;\n        while (i--) {\n          node = self[i];\n          while (node.firstChild) {\n            node.removeChild(node.firstChild);\n          }\n        }\n        return this;\n      },\n      html: function (value) {\n        var self = this;\n        var i;\n        if (isDefined(value)) {\n          i = self.length;\n          try {\n            while (i--) {\n              self[i].innerHTML = value;\n            }\n          } catch (ex) {\n            DomQuery(self[i]).empty().append(value);\n          }\n          return self;\n        }\n        return self[0] ? self[0].innerHTML : '';\n      },\n      text: function (value) {\n        var self = this;\n        var i;\n        if (isDefined(value)) {\n          i = self.length;\n          while (i--) {\n            if ('innerText' in self[i]) {\n              self[i].innerText = value;\n            } else {\n              self[0].textContent = value;\n            }\n          }\n          return self;\n        }\n        return self[0] ? self[0].innerText || self[0].textContent : '';\n      },\n      append: function () {\n        return domManipulate(this, arguments, function (node) {\n          if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {\n            this.appendChild(node);\n          }\n        });\n      },\n      prepend: function () {\n        return domManipulate(this, arguments, function (node) {\n          if (this.nodeType === 1 || this.host && this.host.nodeType === 1) {\n            this.insertBefore(node, this.firstChild);\n          }\n        }, true);\n      },\n      before: function () {\n        var self = this;\n        if (self[0] && self[0].parentNode) {\n          return domManipulate(self, arguments, function (node) {\n            this.parentNode.insertBefore(node, this);\n          });\n        }\n        return self;\n      },\n      after: function () {\n        var self = this;\n        if (self[0] && self[0].parentNode) {\n          return domManipulate(self, arguments, function (node) {\n            this.parentNode.insertBefore(node, this.nextSibling);\n          }, true);\n        }\n        return self;\n      },\n      appendTo: function (val) {\n        DomQuery(val).append(this);\n        return this;\n      },\n      prependTo: function (val) {\n        DomQuery(val).prepend(this);\n        return this;\n      },\n      replaceWith: function (content) {\n        return this.before(content).remove();\n      },\n      wrap: function (content) {\n        return wrap$2(this, content);\n      },\n      wrapAll: function (content) {\n        return wrap$2(this, content, true);\n      },\n      wrapInner: function (content) {\n        this.each(function () {\n          DomQuery(this).contents().wrapAll(content);\n        });\n        return this;\n      },\n      unwrap: function () {\n        return this.parent().each(function () {\n          DomQuery(this).replaceWith(this.childNodes);\n        });\n      },\n      clone: function () {\n        var result = [];\n        this.each(function () {\n          result.push(this.cloneNode(true));\n        });\n        return DomQuery(result);\n      },\n      addClass: function (className) {\n        return this.toggleClass(className, true);\n      },\n      removeClass: function (className) {\n        return this.toggleClass(className, false);\n      },\n      toggleClass: function (className, state) {\n        var self = this;\n        if (typeof className !== 'string') {\n          return self;\n        }\n        if (className.indexOf(' ') !== -1) {\n          each$g(className.split(' '), function () {\n            self.toggleClass(this, state);\n          });\n        } else {\n          self.each(function (index, node) {\n            var classState = hasClass(node, className);\n            if (classState !== state) {\n              var existingClassName = node.className;\n              if (classState) {\n                node.className = trim$2((' ' + existingClassName + ' ').replace(' ' + className + ' ', ' '));\n              } else {\n                node.className += existingClassName ? ' ' + className : className;\n              }\n            }\n          });\n        }\n        return self;\n      },\n      hasClass: function (className) {\n        return hasClass(this[0], className);\n      },\n      each: function (callback) {\n        return each$g(this, callback);\n      },\n      on: function (name, callback) {\n        return this.each(function () {\n          Event$1.bind(this, name, callback);\n        });\n      },\n      off: function (name, callback) {\n        return this.each(function () {\n          Event$1.unbind(this, name, callback);\n        });\n      },\n      trigger: function (name) {\n        return this.each(function () {\n          if (typeof name === 'object') {\n            Event$1.fire(this, name.type, name);\n          } else {\n            Event$1.fire(this, name);\n          }\n        });\n      },\n      show: function () {\n        return this.css('display', '');\n      },\n      hide: function () {\n        return this.css('display', 'none');\n      },\n      slice: function () {\n        return DomQuery(slice.apply(this, arguments));\n      },\n      eq: function (index) {\n        return index === -1 ? this.slice(index) : this.slice(index, +index + 1);\n      },\n      first: function () {\n        return this.eq(0);\n      },\n      last: function () {\n        return this.eq(-1);\n      },\n      find: function (selector) {\n        var i, l;\n        var ret = [];\n        for (i = 0, l = this.length; i < l; i++) {\n          DomQuery.find(selector, this[i], ret);\n        }\n        return DomQuery(ret);\n      },\n      filter: function (selector) {\n        if (typeof selector === 'function') {\n          return DomQuery(grep$2(this.toArray(), function (item, i) {\n            return selector(i, item);\n          }));\n        }\n        return DomQuery(DomQuery.filter(selector, this.toArray()));\n      },\n      closest: function (selector) {\n        var result = [];\n        if (selector instanceof DomQuery) {\n          selector = selector[0];\n        }\n        this.each(function (i, node) {\n          while (node) {\n            if (typeof selector === 'string' && DomQuery(node).is(selector)) {\n              result.push(node);\n              break;\n            } else if (node === selector) {\n              result.push(node);\n              break;\n            }\n            node = node.parentNode;\n          }\n        });\n        return DomQuery(result);\n      },\n      offset: function (offset) {\n        var elm, doc, docElm;\n        var x = 0, y = 0, pos;\n        if (!offset) {\n          elm = this[0];\n          if (elm) {\n            doc = elm.ownerDocument;\n            docElm = doc.documentElement;\n            if (elm.getBoundingClientRect) {\n              pos = elm.getBoundingClientRect();\n              x = pos.left + (docElm.scrollLeft || doc.body.scrollLeft) - docElm.clientLeft;\n              y = pos.top + (docElm.scrollTop || doc.body.scrollTop) - docElm.clientTop;\n            }\n          }\n          return {\n            left: x,\n            top: y\n          };\n        }\n        return this.css(offset);\n      },\n      push: push,\n      sort: Array.prototype.sort,\n      splice: Array.prototype.splice\n    };\n    Tools.extend(DomQueryConstructor, {\n      extend: Tools.extend,\n      makeArray: function (object) {\n        if (isWindow(object) || object.nodeType) {\n          return [object];\n        }\n        return Tools.toArray(object);\n      },\n      inArray: inArray$1,\n      isArray: Tools.isArray,\n      each: each$g,\n      trim: trim$2,\n      grep: grep$2,\n      find: Sizzle,\n      expr: Sizzle.selectors,\n      unique: Sizzle.uniqueSort,\n      text: Sizzle.getText,\n      contains: Sizzle.contains,\n      filter: function (expr, elems, not) {\n        var i = elems.length;\n        if (not) {\n          expr = ':not(' + expr + ')';\n        }\n        while (i--) {\n          if (elems[i].nodeType !== 1) {\n            elems.splice(i, 1);\n          }\n        }\n        if (elems.length === 1) {\n          elems = DomQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [];\n        } else {\n          elems = DomQuery.find.matches(expr, elems);\n        }\n        return elems;\n      }\n    });\n    var dir = function (el, prop, until) {\n      var matched = [];\n      var cur = el[prop];\n      if (typeof until !== 'string' && until instanceof DomQuery) {\n        until = until[0];\n      }\n      while (cur && cur.nodeType !== 9) {\n        if (until !== undefined) {\n          if (cur === until) {\n            break;\n          }\n          if (typeof until === 'string' && DomQuery(cur).is(until)) {\n            break;\n          }\n        }\n        if (cur.nodeType === 1) {\n          matched.push(cur);\n        }\n        cur = cur[prop];\n      }\n      return matched;\n    };\n    var sibling$1 = function (node, siblingName, nodeType, until) {\n      var result = [];\n      if (until instanceof DomQuery) {\n        until = until[0];\n      }\n      for (; node; node = node[siblingName]) {\n        if (nodeType && node.nodeType !== nodeType) {\n          continue;\n        }\n        if (until !== undefined) {\n          if (node === until) {\n            break;\n          }\n          if (typeof until === 'string' && DomQuery(node).is(until)) {\n            break;\n          }\n        }\n        result.push(node);\n      }\n      return result;\n    };\n    var firstSibling = function (node, siblingName, nodeType) {\n      for (node = node[siblingName]; node; node = node[siblingName]) {\n        if (node.nodeType === nodeType) {\n          return node;\n        }\n      }\n      return null;\n    };\n    each$g({\n      parent: function (node) {\n        var parent = node.parentNode;\n        return parent && parent.nodeType !== 11 ? parent : null;\n      },\n      parents: function (node) {\n        return dir(node, 'parentNode');\n      },\n      next: function (node) {\n        return firstSibling(node, 'nextSibling', 1);\n      },\n      prev: function (node) {\n        return firstSibling(node, 'previousSibling', 1);\n      },\n      children: function (node) {\n        return sibling$1(node.firstChild, 'nextSibling', 1);\n      },\n      contents: function (node) {\n        return Tools.toArray((node.nodeName === 'iframe' ? node.contentDocument || node.contentWindow.document : node).childNodes);\n      }\n    }, function (name, fn) {\n      DomQueryConstructor.fn[name] = function (selector) {\n        var self = this;\n        var result = [];\n        self.each(function () {\n          var nodes = fn.call(result, this, selector, result);\n          if (nodes) {\n            if (DomQuery.isArray(nodes)) {\n              result.push.apply(result, nodes);\n            } else {\n              result.push(nodes);\n            }\n          }\n        });\n        if (this.length > 1) {\n          if (!skipUniques[name]) {\n            result = DomQuery.unique(result);\n          }\n          if (name.indexOf('parents') === 0) {\n            result = result.reverse();\n          }\n        }\n        var wrappedResult = DomQuery(result);\n        if (selector) {\n          return wrappedResult.filter(selector);\n        }\n        return wrappedResult;\n      };\n    });\n    each$g({\n      parentsUntil: function (node, until) {\n        return dir(node, 'parentNode', until);\n      },\n      nextUntil: function (node, until) {\n        return sibling$1(node, 'nextSibling', 1, until).slice(1);\n      },\n      prevUntil: function (node, until) {\n        return sibling$1(node, 'previousSibling', 1, until).slice(1);\n      }\n    }, function (name, fn) {\n      DomQueryConstructor.fn[name] = function (selector, filter) {\n        var self = this;\n        var result = [];\n        self.each(function () {\n          var nodes = fn.call(result, this, selector, result);\n          if (nodes) {\n            if (DomQuery.isArray(nodes)) {\n              result.push.apply(result, nodes);\n            } else {\n              result.push(nodes);\n            }\n          }\n        });\n        if (this.length > 1) {\n          result = DomQuery.unique(result);\n          if (name.indexOf('parents') === 0 || name === 'prevUntil') {\n            result = result.reverse();\n          }\n        }\n        var wrappedResult = DomQuery(result);\n        if (filter) {\n          return wrappedResult.filter(filter);\n        }\n        return wrappedResult;\n      };\n    });\n    DomQueryConstructor.fn.is = function (selector) {\n      return !!selector && this.filter(selector).length > 0;\n    };\n    DomQueryConstructor.fn.init.prototype = DomQueryConstructor.fn;\n    DomQueryConstructor.overrideDefaults = function (callback) {\n      var defaults;\n      var sub = function (selector, context) {\n        defaults = defaults || callback();\n        if (arguments.length === 0) {\n          selector = defaults.element;\n        }\n        if (!context) {\n          context = defaults.context;\n        }\n        return new sub.fn.init(selector, context);\n      };\n      DomQuery.extend(sub, this);\n      return sub;\n    };\n    DomQueryConstructor.attrHooks = attrHooks;\n    DomQueryConstructor.cssHooks = cssHooks;\n    var DomQuery = DomQueryConstructor;\n\n    var each$f = Tools.each;\n    var grep$1 = Tools.grep;\n    var isIE = Env.ie;\n    var simpleSelectorRe = /^([a-z0-9],?)+$/i;\n    var setupAttrHooks = function (styles, settings, getContext) {\n      var keepValues = settings.keep_values;\n      var keepUrlHook = {\n        set: function ($elm, value, name) {\n          if (settings.url_converter && value !== null) {\n            value = settings.url_converter.call(settings.url_converter_scope || getContext(), value, name, $elm[0]);\n          }\n          $elm.attr('data-mce-' + name, value).attr(name, value);\n        },\n        get: function ($elm, name) {\n          return $elm.attr('data-mce-' + name) || $elm.attr(name);\n        }\n      };\n      var attrHooks = {\n        style: {\n          set: function ($elm, value) {\n            if (value !== null && typeof value === 'object') {\n              $elm.css(value);\n              return;\n            }\n            if (keepValues) {\n              $elm.attr('data-mce-style', value);\n            }\n            if (value !== null && typeof value === 'string') {\n              $elm.removeAttr('style');\n              $elm.css(styles.parse(value));\n            } else {\n              $elm.attr('style', value);\n            }\n          },\n          get: function ($elm) {\n            var value = $elm.attr('data-mce-style') || $elm.attr('style');\n            value = styles.serialize(styles.parse(value), $elm[0].nodeName);\n            return value;\n          }\n        }\n      };\n      if (keepValues) {\n        attrHooks.href = attrHooks.src = keepUrlHook;\n      }\n      return attrHooks;\n    };\n    var updateInternalStyleAttr = function (styles, $elm) {\n      var rawValue = $elm.attr('style');\n      var value = styles.serialize(styles.parse(rawValue), $elm[0].nodeName);\n      if (!value) {\n        value = null;\n      }\n      $elm.attr('data-mce-style', value);\n    };\n    var findNodeIndex = function (node, normalized) {\n      var idx = 0, lastNodeType, nodeType;\n      if (node) {\n        for (lastNodeType = node.nodeType, node = node.previousSibling; node; node = node.previousSibling) {\n          nodeType = node.nodeType;\n          if (normalized && nodeType === 3) {\n            if (nodeType === lastNodeType || !node.nodeValue.length) {\n              continue;\n            }\n          }\n          idx++;\n          lastNodeType = nodeType;\n        }\n      }\n      return idx;\n    };\n    var DOMUtils = function (doc, settings) {\n      if (settings === void 0) {\n        settings = {};\n      }\n      var addedStyles = {};\n      var win = window;\n      var files = {};\n      var counter = 0;\n      var stdMode = true;\n      var boxModel = true;\n      var styleSheetLoader = instance.forElement(SugarElement.fromDom(doc), {\n        contentCssCors: settings.contentCssCors,\n        referrerPolicy: settings.referrerPolicy\n      });\n      var boundEvents = [];\n      var schema = settings.schema ? settings.schema : Schema({});\n      var styles = Styles({\n        url_converter: settings.url_converter,\n        url_converter_scope: settings.url_converter_scope\n      }, settings.schema);\n      var events = settings.ownEvents ? new EventUtils() : EventUtils.Event;\n      var blockElementsMap = schema.getBlockElements();\n      var $ = DomQuery.overrideDefaults(function () {\n        return {\n          context: doc,\n          element: self.getRoot()\n        };\n      });\n      var isBlock = function (node) {\n        if (typeof node === 'string') {\n          return !!blockElementsMap[node];\n        } else if (node) {\n          var type = node.nodeType;\n          if (type) {\n            return !!(type === 1 && blockElementsMap[node.nodeName]);\n          }\n        }\n        return false;\n      };\n      var get = function (elm) {\n        return elm && doc && isString$1(elm) ? doc.getElementById(elm) : elm;\n      };\n      var $$ = function (elm) {\n        return $(typeof elm === 'string' ? get(elm) : elm);\n      };\n      var getAttrib = function (elm, name, defaultVal) {\n        var hook, value;\n        var $elm = $$(elm);\n        if ($elm.length) {\n          hook = attrHooks[name];\n          if (hook && hook.get) {\n            value = hook.get($elm, name);\n          } else {\n            value = $elm.attr(name);\n          }\n        }\n        if (typeof value === 'undefined') {\n          value = defaultVal || '';\n        }\n        return value;\n      };\n      var getAttribs = function (elm) {\n        var node = get(elm);\n        if (!node) {\n          return [];\n        }\n        return node.attributes;\n      };\n      var setAttrib = function (elm, name, value) {\n        if (value === '') {\n          value = null;\n        }\n        var $elm = $$(elm);\n        var originalValue = $elm.attr(name);\n        if (!$elm.length) {\n          return;\n        }\n        var hook = attrHooks[name];\n        if (hook && hook.set) {\n          hook.set($elm, value, name);\n        } else {\n          $elm.attr(name, value);\n        }\n        if (originalValue !== value && settings.onSetAttrib) {\n          settings.onSetAttrib({\n            attrElm: $elm,\n            attrName: name,\n            attrValue: value\n          });\n        }\n      };\n      var clone = function (node, deep) {\n        if (!isIE || node.nodeType !== 1 || deep) {\n          return node.cloneNode(deep);\n        } else {\n          var clone_1 = doc.createElement(node.nodeName);\n          each$f(getAttribs(node), function (attr) {\n            setAttrib(clone_1, attr.nodeName, getAttrib(node, attr.nodeName));\n          });\n          return clone_1;\n        }\n      };\n      var getRoot = function () {\n        return settings.root_element || doc.body;\n      };\n      var getViewPort = function (argWin) {\n        var vp = getBounds(argWin);\n        return {\n          x: vp.x,\n          y: vp.y,\n          w: vp.width,\n          h: vp.height\n        };\n      };\n      var getPos$1 = function (elm, rootElm) {\n        return getPos(doc.body, get(elm), rootElm);\n      };\n      var setStyle = function (elm, name, value) {\n        var $elm = isString$1(name) ? $$(elm).css(name, value) : $$(elm).css(name);\n        if (settings.update_styles) {\n          updateInternalStyleAttr(styles, $elm);\n        }\n      };\n      var setStyles = function (elm, stylesArg) {\n        var $elm = $$(elm).css(stylesArg);\n        if (settings.update_styles) {\n          updateInternalStyleAttr(styles, $elm);\n        }\n      };\n      var getStyle = function (elm, name, computed) {\n        var $elm = $$(elm);\n        if (computed) {\n          return $elm.css(name);\n        }\n        name = name.replace(/-(\\D)/g, function (a, b) {\n          return b.toUpperCase();\n        });\n        if (name === 'float') {\n          name = Env.browser.isIE() ? 'styleFloat' : 'cssFloat';\n        }\n        return $elm[0] && $elm[0].style ? $elm[0].style[name] : undefined;\n      };\n      var getSize = function (elm) {\n        var w, h;\n        elm = get(elm);\n        w = getStyle(elm, 'width');\n        h = getStyle(elm, 'height');\n        if (w.indexOf('px') === -1) {\n          w = 0;\n        }\n        if (h.indexOf('px') === -1) {\n          h = 0;\n        }\n        return {\n          w: parseInt(w, 10) || elm.offsetWidth || elm.clientWidth,\n          h: parseInt(h, 10) || elm.offsetHeight || elm.clientHeight\n        };\n      };\n      var getRect = function (elm) {\n        elm = get(elm);\n        var pos = getPos$1(elm);\n        var size = getSize(elm);\n        return {\n          x: pos.x,\n          y: pos.y,\n          w: size.w,\n          h: size.h\n        };\n      };\n      var is = function (elm, selector) {\n        var i;\n        if (!elm) {\n          return false;\n        }\n        if (!Array.isArray(elm)) {\n          if (selector === '*') {\n            return elm.nodeType === 1;\n          }\n          if (simpleSelectorRe.test(selector)) {\n            var selectors = selector.toLowerCase().split(/,/);\n            var elmName = elm.nodeName.toLowerCase();\n            for (i = selectors.length - 1; i >= 0; i--) {\n              if (selectors[i] === elmName) {\n                return true;\n              }\n            }\n            return false;\n          }\n          if (elm.nodeType && elm.nodeType !== 1) {\n            return false;\n          }\n        }\n        var elms = !Array.isArray(elm) ? [elm] : elm;\n        return Sizzle(selector, elms[0].ownerDocument || elms[0], null, elms).length > 0;\n      };\n      var getParents = function (elm, selector, root, collect) {\n        var result = [];\n        var selectorVal;\n        var node = get(elm);\n        collect = collect === undefined;\n        root = root || (getRoot().nodeName !== 'BODY' ? getRoot().parentNode : null);\n        if (Tools.is(selector, 'string')) {\n          selectorVal = selector;\n          if (selector === '*') {\n            selector = function (node) {\n              return node.nodeType === 1;\n            };\n          } else {\n            selector = function (node) {\n              return is(node, selectorVal);\n            };\n          }\n        }\n        while (node) {\n          if (node === root || isNullable(node.nodeType) || isDocument$1(node) || isDocumentFragment(node)) {\n            break;\n          }\n          if (!selector || typeof selector === 'function' && selector(node)) {\n            if (collect) {\n              result.push(node);\n            } else {\n              return [node];\n            }\n          }\n          node = node.parentNode;\n        }\n        return collect ? result : null;\n      };\n      var getParent = function (node, selector, root) {\n        var parents = getParents(node, selector, root, false);\n        return parents && parents.length > 0 ? parents[0] : null;\n      };\n      var _findSib = function (node, selector, name) {\n        var func = selector;\n        if (node) {\n          if (typeof selector === 'string') {\n            func = function (node) {\n              return is(node, selector);\n            };\n          }\n          for (node = node[name]; node; node = node[name]) {\n            if (typeof func === 'function' && func(node)) {\n              return node;\n            }\n          }\n        }\n        return null;\n      };\n      var getNext = function (node, selector) {\n        return _findSib(node, selector, 'nextSibling');\n      };\n      var getPrev = function (node, selector) {\n        return _findSib(node, selector, 'previousSibling');\n      };\n      var select = function (selector, scope) {\n        return Sizzle(selector, get(scope) || settings.root_element || doc, []);\n      };\n      var run = function (elm, func, scope) {\n        var result;\n        var node = typeof elm === 'string' ? get(elm) : elm;\n        if (!node) {\n          return false;\n        }\n        if (Tools.isArray(node) && (node.length || node.length === 0)) {\n          result = [];\n          each$f(node, function (elm, i) {\n            if (elm) {\n              result.push(func.call(scope, typeof elm === 'string' ? get(elm) : elm, i));\n            }\n          });\n          return result;\n        }\n        var context = scope ? scope : this;\n        return func.call(context, node);\n      };\n      var setAttribs = function (elm, attrs) {\n        $$(elm).each(function (i, node) {\n          each$f(attrs, function (value, name) {\n            setAttrib(node, name, value);\n          });\n        });\n      };\n      var setHTML = function (elm, html) {\n        var $elm = $$(elm);\n        if (isIE) {\n          $elm.each(function (i, target) {\n            if (target.canHaveHTML === false) {\n              return;\n            }\n            while (target.firstChild) {\n              target.removeChild(target.firstChild);\n            }\n            try {\n              target.innerHTML = '<br>' + html;\n              target.removeChild(target.firstChild);\n            } catch (ex) {\n              DomQuery('<div></div>').html('<br>' + html).contents().slice(1).appendTo(target);\n            }\n            return html;\n          });\n        } else {\n          $elm.html(html);\n        }\n      };\n      var add = function (parentElm, name, attrs, html, create) {\n        return run(parentElm, function (parentElm) {\n          var newElm = typeof name === 'string' ? doc.createElement(name) : name;\n          setAttribs(newElm, attrs);\n          if (html) {\n            if (typeof html !== 'string' && html.nodeType) {\n              newElm.appendChild(html);\n            } else if (typeof html === 'string') {\n              setHTML(newElm, html);\n            }\n          }\n          return !create ? parentElm.appendChild(newElm) : newElm;\n        });\n      };\n      var create = function (name, attrs, html) {\n        return add(doc.createElement(name), name, attrs, html, true);\n      };\n      var decode = Entities.decode;\n      var encode = Entities.encodeAllRaw;\n      var createHTML = function (name, attrs, html) {\n        var outHtml = '', key;\n        outHtml += '<' + name;\n        for (key in attrs) {\n          if (hasNonNullableKey(attrs, key)) {\n            outHtml += ' ' + key + '=\"' + encode(attrs[key]) + '\"';\n          }\n        }\n        if (typeof html !== 'undefined') {\n          return outHtml + '>' + html + '</' + name + '>';\n        }\n        return outHtml + ' />';\n      };\n      var createFragment = function (html) {\n        var node;\n        var container = doc.createElement('div');\n        var frag = doc.createDocumentFragment();\n        frag.appendChild(container);\n        if (html) {\n          container.innerHTML = html;\n        }\n        while (node = container.firstChild) {\n          frag.appendChild(node);\n        }\n        frag.removeChild(container);\n        return frag;\n      };\n      var remove = function (node, keepChildren) {\n        var $node = $$(node);\n        if (keepChildren) {\n          $node.each(function () {\n            var child;\n            while (child = this.firstChild) {\n              if (child.nodeType === 3 && child.data.length === 0) {\n                this.removeChild(child);\n              } else {\n                this.parentNode.insertBefore(child, this);\n              }\n            }\n          }).remove();\n        } else {\n          $node.remove();\n        }\n        return $node.length > 1 ? $node.toArray() : $node[0];\n      };\n      var removeAllAttribs = function (e) {\n        return run(e, function (e) {\n          var i;\n          var attrs = e.attributes;\n          for (i = attrs.length - 1; i >= 0; i--) {\n            e.removeAttributeNode(attrs.item(i));\n          }\n        });\n      };\n      var parseStyle = function (cssText) {\n        return styles.parse(cssText);\n      };\n      var serializeStyle = function (stylesArg, name) {\n        return styles.serialize(stylesArg, name);\n      };\n      var addStyle = function (cssText) {\n        var head, styleElm;\n        if (self !== DOMUtils.DOM && doc === document) {\n          if (addedStyles[cssText]) {\n            return;\n          }\n          addedStyles[cssText] = true;\n        }\n        styleElm = doc.getElementById('mceDefaultStyles');\n        if (!styleElm) {\n          styleElm = doc.createElement('style');\n          styleElm.id = 'mceDefaultStyles';\n          styleElm.type = 'text/css';\n          head = doc.getElementsByTagName('head')[0];\n          if (head.firstChild) {\n            head.insertBefore(styleElm, head.firstChild);\n          } else {\n            head.appendChild(styleElm);\n          }\n        }\n        if (styleElm.styleSheet) {\n          styleElm.styleSheet.cssText += cssText;\n        } else {\n          styleElm.appendChild(doc.createTextNode(cssText));\n        }\n      };\n      var loadCSS = function (urls) {\n        if (!urls) {\n          urls = '';\n        }\n        each$k(urls.split(','), function (url) {\n          files[url] = true;\n          styleSheetLoader.load(url, noop);\n        });\n      };\n      var toggleClass = function (elm, cls, state) {\n        $$(elm).toggleClass(cls, state).each(function () {\n          if (this.className === '') {\n            DomQuery(this).attr('class', null);\n          }\n        });\n      };\n      var addClass = function (elm, cls) {\n        $$(elm).addClass(cls);\n      };\n      var removeClass = function (elm, cls) {\n        toggleClass(elm, cls, false);\n      };\n      var hasClass = function (elm, cls) {\n        return $$(elm).hasClass(cls);\n      };\n      var show = function (elm) {\n        $$(elm).show();\n      };\n      var hide = function (elm) {\n        $$(elm).hide();\n      };\n      var isHidden = function (elm) {\n        return $$(elm).css('display') === 'none';\n      };\n      var uniqueId = function (prefix) {\n        return (!prefix ? 'mce_' : prefix) + counter++;\n      };\n      var getOuterHTML = function (elm) {\n        var node = typeof elm === 'string' ? get(elm) : elm;\n        return isElement$5(node) ? node.outerHTML : DomQuery('<div></div>').append(DomQuery(node).clone()).html();\n      };\n      var setOuterHTML = function (elm, html) {\n        $$(elm).each(function () {\n          try {\n            if ('outerHTML' in this) {\n              this.outerHTML = html;\n              return;\n            }\n          } catch (ex) {\n          }\n          remove(DomQuery(this).html(html), true);\n        });\n      };\n      var insertAfter = function (node, reference) {\n        var referenceNode = get(reference);\n        return run(node, function (node) {\n          var parent = referenceNode.parentNode;\n          var nextSibling = referenceNode.nextSibling;\n          if (nextSibling) {\n            parent.insertBefore(node, nextSibling);\n          } else {\n            parent.appendChild(node);\n          }\n          return node;\n        });\n      };\n      var replace = function (newElm, oldElm, keepChildren) {\n        return run(oldElm, function (oldElm) {\n          if (Tools.is(oldElm, 'array')) {\n            newElm = newElm.cloneNode(true);\n          }\n          if (keepChildren) {\n            each$f(grep$1(oldElm.childNodes), function (node) {\n              newElm.appendChild(node);\n            });\n          }\n          return oldElm.parentNode.replaceChild(newElm, oldElm);\n        });\n      };\n      var rename = function (elm, name) {\n        var newElm;\n        if (elm.nodeName !== name.toUpperCase()) {\n          newElm = create(name);\n          each$f(getAttribs(elm), function (attrNode) {\n            setAttrib(newElm, attrNode.nodeName, getAttrib(elm, attrNode.nodeName));\n          });\n          replace(newElm, elm, true);\n        }\n        return newElm || elm;\n      };\n      var findCommonAncestor = function (a, b) {\n        var ps = a, pe;\n        while (ps) {\n          pe = b;\n          while (pe && ps !== pe) {\n            pe = pe.parentNode;\n          }\n          if (ps === pe) {\n            break;\n          }\n          ps = ps.parentNode;\n        }\n        if (!ps && a.ownerDocument) {\n          return a.ownerDocument.documentElement;\n        }\n        return ps;\n      };\n      var toHex = function (rgbVal) {\n        return styles.toHex(Tools.trim(rgbVal));\n      };\n      var isNonEmptyElement = function (node) {\n        if (isElement$5(node)) {\n          var isNamedAnchor = node.nodeName.toLowerCase() === 'a' && !getAttrib(node, 'href') && getAttrib(node, 'id');\n          if (getAttrib(node, 'name') || getAttrib(node, 'data-mce-bookmark') || isNamedAnchor) {\n            return true;\n          }\n        }\n        return false;\n      };\n      var isEmpty = function (node, elements) {\n        var type, name, brCount = 0;\n        if (isNonEmptyElement(node)) {\n          return false;\n        }\n        node = node.firstChild;\n        if (node) {\n          var walker = new DomTreeWalker(node, node.parentNode);\n          var whitespace = schema ? schema.getWhiteSpaceElements() : {};\n          elements = elements || (schema ? schema.getNonEmptyElements() : null);\n          do {\n            type = node.nodeType;\n            if (isElement$5(node)) {\n              var bogusVal = node.getAttribute('data-mce-bogus');\n              if (bogusVal) {\n                node = walker.next(bogusVal === 'all');\n                continue;\n              }\n              name = node.nodeName.toLowerCase();\n              if (elements && elements[name]) {\n                if (name === 'br') {\n                  brCount++;\n                  node = walker.next();\n                  continue;\n                }\n                return false;\n              }\n              if (isNonEmptyElement(node)) {\n                return false;\n              }\n            }\n            if (type === 8) {\n              return false;\n            }\n            if (type === 3 && !isWhitespaceText(node.nodeValue)) {\n              return false;\n            }\n            if (type === 3 && node.parentNode && whitespace[node.parentNode.nodeName] && isWhitespaceText(node.nodeValue)) {\n              return false;\n            }\n            node = walker.next();\n          } while (node);\n        }\n        return brCount <= 1;\n      };\n      var createRng = function () {\n        return doc.createRange();\n      };\n      var split = function (parentElm, splitElm, replacementElm) {\n        var range = createRng();\n        var beforeFragment;\n        var afterFragment;\n        var parentNode;\n        if (parentElm && splitElm) {\n          range.setStart(parentElm.parentNode, findNodeIndex(parentElm));\n          range.setEnd(splitElm.parentNode, findNodeIndex(splitElm));\n          beforeFragment = range.extractContents();\n          range = createRng();\n          range.setStart(splitElm.parentNode, findNodeIndex(splitElm) + 1);\n          range.setEnd(parentElm.parentNode, findNodeIndex(parentElm) + 1);\n          afterFragment = range.extractContents();\n          parentNode = parentElm.parentNode;\n          parentNode.insertBefore(trimNode(self, beforeFragment), parentElm);\n          if (replacementElm) {\n            parentNode.insertBefore(replacementElm, parentElm);\n          } else {\n            parentNode.insertBefore(splitElm, parentElm);\n          }\n          parentNode.insertBefore(trimNode(self, afterFragment), parentElm);\n          remove(parentElm);\n          return replacementElm || splitElm;\n        }\n      };\n      var bind = function (target, name, func, scope) {\n        if (Tools.isArray(target)) {\n          var i = target.length;\n          var rv = [];\n          while (i--) {\n            rv[i] = bind(target[i], name, func, scope);\n          }\n          return rv;\n        }\n        if (settings.collect && (target === doc || target === win)) {\n          boundEvents.push([\n            target,\n            name,\n            func,\n            scope\n          ]);\n        }\n        var output = events.bind(target, name, func, scope || self);\n        return output;\n      };\n      var unbind = function (target, name, func) {\n        if (Tools.isArray(target)) {\n          var i = target.length;\n          var rv = [];\n          while (i--) {\n            rv[i] = unbind(target[i], name, func);\n          }\n          return rv;\n        } else {\n          if (boundEvents.length > 0 && (target === doc || target === win)) {\n            var i = boundEvents.length;\n            while (i--) {\n              var item = boundEvents[i];\n              if (target === item[0] && (!name || name === item[1]) && (!func || func === item[2])) {\n                events.unbind(item[0], item[1], item[2]);\n              }\n            }\n          }\n          return events.unbind(target, name, func);\n        }\n      };\n      var fire = function (target, name, evt) {\n        return events.fire(target, name, evt);\n      };\n      var getContentEditable = function (node) {\n        if (node && isElement$5(node)) {\n          var contentEditable = node.getAttribute('data-mce-contenteditable');\n          if (contentEditable && contentEditable !== 'inherit') {\n            return contentEditable;\n          }\n          return node.contentEditable !== 'inherit' ? node.contentEditable : null;\n        } else {\n          return null;\n        }\n      };\n      var getContentEditableParent = function (node) {\n        var root = getRoot();\n        var state = null;\n        for (; node && node !== root; node = node.parentNode) {\n          state = getContentEditable(node);\n          if (state !== null) {\n            break;\n          }\n        }\n        return state;\n      };\n      var destroy = function () {\n        if (boundEvents.length > 0) {\n          var i = boundEvents.length;\n          while (i--) {\n            var item = boundEvents[i];\n            events.unbind(item[0], item[1], item[2]);\n          }\n        }\n        each$j(files, function (_, url) {\n          styleSheetLoader.unload(url);\n          delete files[url];\n        });\n        if (Sizzle.setDocument) {\n          Sizzle.setDocument();\n        }\n      };\n      var isChildOf = function (node, parent) {\n        if (!isIE) {\n          return node === parent || parent.contains(node);\n        } else {\n          while (node) {\n            if (parent === node) {\n              return true;\n            }\n            node = node.parentNode;\n          }\n          return false;\n        }\n      };\n      var dumpRng = function (r) {\n        return 'startContainer: ' + r.startContainer.nodeName + ', startOffset: ' + r.startOffset + ', endContainer: ' + r.endContainer.nodeName + ', endOffset: ' + r.endOffset;\n      };\n      var self = {\n        doc: doc,\n        settings: settings,\n        win: win,\n        files: files,\n        stdMode: stdMode,\n        boxModel: boxModel,\n        styleSheetLoader: styleSheetLoader,\n        boundEvents: boundEvents,\n        styles: styles,\n        schema: schema,\n        events: events,\n        isBlock: isBlock,\n        $: $,\n        $$: $$,\n        root: null,\n        clone: clone,\n        getRoot: getRoot,\n        getViewPort: getViewPort,\n        getRect: getRect,\n        getSize: getSize,\n        getParent: getParent,\n        getParents: getParents,\n        get: get,\n        getNext: getNext,\n        getPrev: getPrev,\n        select: select,\n        is: is,\n        add: add,\n        create: create,\n        createHTML: createHTML,\n        createFragment: createFragment,\n        remove: remove,\n        setStyle: setStyle,\n        getStyle: getStyle,\n        setStyles: setStyles,\n        removeAllAttribs: removeAllAttribs,\n        setAttrib: setAttrib,\n        setAttribs: setAttribs,\n        getAttrib: getAttrib,\n        getPos: getPos$1,\n        parseStyle: parseStyle,\n        serializeStyle: serializeStyle,\n        addStyle: addStyle,\n        loadCSS: loadCSS,\n        addClass: addClass,\n        removeClass: removeClass,\n        hasClass: hasClass,\n        toggleClass: toggleClass,\n        show: show,\n        hide: hide,\n        isHidden: isHidden,\n        uniqueId: uniqueId,\n        setHTML: setHTML,\n        getOuterHTML: getOuterHTML,\n        setOuterHTML: setOuterHTML,\n        decode: decode,\n        encode: encode,\n        insertAfter: insertAfter,\n        replace: replace,\n        rename: rename,\n        findCommonAncestor: findCommonAncestor,\n        toHex: toHex,\n        run: run,\n        getAttribs: getAttribs,\n        isEmpty: isEmpty,\n        createRng: createRng,\n        nodeIndex: findNodeIndex,\n        split: split,\n        bind: bind,\n        unbind: unbind,\n        fire: fire,\n        getContentEditable: getContentEditable,\n        getContentEditableParent: getContentEditableParent,\n        destroy: destroy,\n        isChildOf: isChildOf,\n        dumpRng: dumpRng\n      };\n      var attrHooks = setupAttrHooks(styles, settings, constant(self));\n      return self;\n    };\n    DOMUtils.DOM = DOMUtils(document);\n    DOMUtils.nodeIndex = findNodeIndex;\n\n    var DOM$a = DOMUtils.DOM;\n    var each$e = Tools.each, grep = Tools.grep;\n    var QUEUED = 0;\n    var LOADING = 1;\n    var LOADED = 2;\n    var FAILED = 3;\n    var ScriptLoader = function () {\n      function ScriptLoader(settings) {\n        if (settings === void 0) {\n          settings = {};\n        }\n        this.states = {};\n        this.queue = [];\n        this.scriptLoadedCallbacks = {};\n        this.queueLoadedCallbacks = [];\n        this.loading = 0;\n        this.settings = settings;\n      }\n      ScriptLoader.prototype._setReferrerPolicy = function (referrerPolicy) {\n        this.settings.referrerPolicy = referrerPolicy;\n      };\n      ScriptLoader.prototype.loadScript = function (url, success, failure) {\n        var dom = DOM$a;\n        var elm;\n        var cleanup = function () {\n          dom.remove(id);\n          if (elm) {\n            elm.onerror = elm.onload = elm = null;\n          }\n        };\n        var done = function () {\n          cleanup();\n          success();\n        };\n        var error = function () {\n          cleanup();\n          if (isFunction(failure)) {\n            failure();\n          } else {\n            if (typeof console !== 'undefined' && console.log) {\n              console.log('Failed to load script: ' + url);\n            }\n          }\n        };\n        var id = dom.uniqueId();\n        elm = document.createElement('script');\n        elm.id = id;\n        elm.type = 'text/javascript';\n        elm.src = Tools._addCacheSuffix(url);\n        if (this.settings.referrerPolicy) {\n          dom.setAttrib(elm, 'referrerpolicy', this.settings.referrerPolicy);\n        }\n        elm.onload = done;\n        elm.onerror = error;\n        (document.getElementsByTagName('head')[0] || document.body).appendChild(elm);\n      };\n      ScriptLoader.prototype.isDone = function (url) {\n        return this.states[url] === LOADED;\n      };\n      ScriptLoader.prototype.markDone = function (url) {\n        this.states[url] = LOADED;\n      };\n      ScriptLoader.prototype.add = function (url, success, scope, failure) {\n        var state = this.states[url];\n        this.queue.push(url);\n        if (state === undefined) {\n          this.states[url] = QUEUED;\n        }\n        if (success) {\n          if (!this.scriptLoadedCallbacks[url]) {\n            this.scriptLoadedCallbacks[url] = [];\n          }\n          this.scriptLoadedCallbacks[url].push({\n            success: success,\n            failure: failure,\n            scope: scope || this\n          });\n        }\n      };\n      ScriptLoader.prototype.load = function (url, success, scope, failure) {\n        return this.add(url, success, scope, failure);\n      };\n      ScriptLoader.prototype.remove = function (url) {\n        delete this.states[url];\n        delete this.scriptLoadedCallbacks[url];\n      };\n      ScriptLoader.prototype.loadQueue = function (success, scope, failure) {\n        this.loadScripts(this.queue, success, scope, failure);\n      };\n      ScriptLoader.prototype.loadScripts = function (scripts, success, scope, failure) {\n        var self = this;\n        var failures = [];\n        var execCallbacks = function (name, url) {\n          each$e(self.scriptLoadedCallbacks[url], function (callback) {\n            if (isFunction(callback[name])) {\n              callback[name].call(callback.scope);\n            }\n          });\n          self.scriptLoadedCallbacks[url] = undefined;\n        };\n        self.queueLoadedCallbacks.push({\n          success: success,\n          failure: failure,\n          scope: scope || this\n        });\n        var loadScripts = function () {\n          var loadingScripts = grep(scripts);\n          scripts.length = 0;\n          each$e(loadingScripts, function (url) {\n            if (self.states[url] === LOADED) {\n              execCallbacks('success', url);\n              return;\n            }\n            if (self.states[url] === FAILED) {\n              execCallbacks('failure', url);\n              return;\n            }\n            if (self.states[url] !== LOADING) {\n              self.states[url] = LOADING;\n              self.loading++;\n              self.loadScript(url, function () {\n                self.states[url] = LOADED;\n                self.loading--;\n                execCallbacks('success', url);\n                loadScripts();\n              }, function () {\n                self.states[url] = FAILED;\n                self.loading--;\n                failures.push(url);\n                execCallbacks('failure', url);\n                loadScripts();\n              });\n            }\n          });\n          if (!self.loading) {\n            var notifyCallbacks = self.queueLoadedCallbacks.slice(0);\n            self.queueLoadedCallbacks.length = 0;\n            each$e(notifyCallbacks, function (callback) {\n              if (failures.length === 0) {\n                if (isFunction(callback.success)) {\n                  callback.success.call(callback.scope);\n                }\n              } else {\n                if (isFunction(callback.failure)) {\n                  callback.failure.call(callback.scope, failures);\n                }\n              }\n            });\n          }\n        };\n        loadScripts();\n      };\n      ScriptLoader.ScriptLoader = new ScriptLoader();\n      return ScriptLoader;\n    }();\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var isRaw = function (str) {\n      return isObject(str) && has$2(str, 'raw');\n    };\n    var isTokenised = function (str) {\n      return isArray$1(str) && str.length > 1;\n    };\n    var data = {};\n    var currentCode = Cell('en');\n    var getLanguageData = function () {\n      return get$9(data, currentCode.get());\n    };\n    var getData = function () {\n      return map$2(data, function (value) {\n        return __assign({}, value);\n      });\n    };\n    var setCode = function (newCode) {\n      if (newCode) {\n        currentCode.set(newCode);\n      }\n    };\n    var getCode = function () {\n      return currentCode.get();\n    };\n    var add$4 = function (code, items) {\n      var langData = data[code];\n      if (!langData) {\n        data[code] = langData = {};\n      }\n      each$j(items, function (translation, name) {\n        langData[name.toLowerCase()] = translation;\n      });\n    };\n    var translate = function (text) {\n      var langData = getLanguageData().getOr({});\n      var toString = function (obj) {\n        if (isFunction(obj)) {\n          return Object.prototype.toString.call(obj);\n        }\n        return !isEmpty(obj) ? '' + obj : '';\n      };\n      var isEmpty = function (text) {\n        return text === '' || text === null || text === undefined;\n      };\n      var getLangData = function (text) {\n        var textstr = toString(text);\n        return get$9(langData, textstr.toLowerCase()).map(toString).getOr(textstr);\n      };\n      var removeContext = function (str) {\n        return str.replace(/{context:\\w+}$/, '');\n      };\n      if (isEmpty(text)) {\n        return '';\n      }\n      if (isRaw(text)) {\n        return toString(text.raw);\n      }\n      if (isTokenised(text)) {\n        var values_1 = text.slice(1);\n        var substitued = getLangData(text[0]).replace(/\\{([0-9]+)\\}/g, function ($1, $2) {\n          return has$2(values_1, $2) ? toString(values_1[$2]) : $1;\n        });\n        return removeContext(substitued);\n      }\n      return removeContext(getLangData(text));\n    };\n    var isRtl$1 = function () {\n      return getLanguageData().bind(function (items) {\n        return get$9(items, '_dir');\n      }).exists(function (dir) {\n        return dir === 'rtl';\n      });\n    };\n    var hasCode = function (code) {\n      return has$2(data, code);\n    };\n    var I18n = {\n      getData: getData,\n      setCode: setCode,\n      getCode: getCode,\n      add: add$4,\n      translate: translate,\n      isRtl: isRtl$1,\n      hasCode: hasCode\n    };\n\n    var AddOnManager = function () {\n      var items = [];\n      var urls = {};\n      var lookup = {};\n      var _listeners = [];\n      var runListeners = function (name, state) {\n        var matchedListeners = filter$4(_listeners, function (listener) {\n          return listener.name === name && listener.state === state;\n        });\n        each$k(matchedListeners, function (listener) {\n          return listener.callback();\n        });\n      };\n      var get = function (name) {\n        if (lookup[name]) {\n          return lookup[name].instance;\n        }\n        return undefined;\n      };\n      var dependencies = function (name) {\n        var result;\n        if (lookup[name]) {\n          result = lookup[name].dependencies;\n        }\n        return result || [];\n      };\n      var requireLangPack = function (name, languages) {\n        if (AddOnManager.languageLoad !== false) {\n          waitFor(name, function () {\n            var language = I18n.getCode();\n            var wrappedLanguages = ',' + (languages || '') + ',';\n            if (!language || languages && wrappedLanguages.indexOf(',' + language + ',') === -1) {\n              return;\n            }\n            ScriptLoader.ScriptLoader.add(urls[name] + '/langs/' + language + '.js');\n          }, 'loaded');\n        }\n      };\n      var add = function (id, addOn, dependencies) {\n        var addOnConstructor = addOn;\n        items.push(addOnConstructor);\n        lookup[id] = {\n          instance: addOnConstructor,\n          dependencies: dependencies\n        };\n        runListeners(id, 'added');\n        return addOnConstructor;\n      };\n      var remove = function (name) {\n        delete urls[name];\n        delete lookup[name];\n      };\n      var createUrl = function (baseUrl, dep) {\n        if (typeof dep === 'object') {\n          return dep;\n        }\n        return typeof baseUrl === 'string' ? {\n          prefix: '',\n          resource: dep,\n          suffix: ''\n        } : {\n          prefix: baseUrl.prefix,\n          resource: dep,\n          suffix: baseUrl.suffix\n        };\n      };\n      var addComponents = function (pluginName, scripts) {\n        var pluginUrl = urls[pluginName];\n        each$k(scripts, function (script) {\n          ScriptLoader.ScriptLoader.add(pluginUrl + '/' + script);\n        });\n      };\n      var loadDependencies = function (name, addOnUrl, success, scope) {\n        var deps = dependencies(name);\n        each$k(deps, function (dep) {\n          var newUrl = createUrl(addOnUrl, dep);\n          load(newUrl.resource, newUrl, undefined, undefined);\n        });\n        if (success) {\n          if (scope) {\n            success.call(scope);\n          } else {\n            success.call(ScriptLoader);\n          }\n        }\n      };\n      var load = function (name, addOnUrl, success, scope, failure) {\n        if (urls[name]) {\n          return;\n        }\n        var urlString = typeof addOnUrl === 'string' ? addOnUrl : addOnUrl.prefix + addOnUrl.resource + addOnUrl.suffix;\n        if (urlString.indexOf('/') !== 0 && urlString.indexOf('://') === -1) {\n          urlString = AddOnManager.baseURL + '/' + urlString;\n        }\n        urls[name] = urlString.substring(0, urlString.lastIndexOf('/'));\n        var done = function () {\n          runListeners(name, 'loaded');\n          loadDependencies(name, addOnUrl, success, scope);\n        };\n        if (lookup[name]) {\n          done();\n        } else {\n          ScriptLoader.ScriptLoader.add(urlString, done, scope, failure);\n        }\n      };\n      var waitFor = function (name, callback, state) {\n        if (state === void 0) {\n          state = 'added';\n        }\n        if (has$2(lookup, name) && state === 'added') {\n          callback();\n        } else if (has$2(urls, name) && state === 'loaded') {\n          callback();\n        } else {\n          _listeners.push({\n            name: name,\n            state: state,\n            callback: callback\n          });\n        }\n      };\n      return {\n        items: items,\n        urls: urls,\n        lookup: lookup,\n        _listeners: _listeners,\n        get: get,\n        dependencies: dependencies,\n        requireLangPack: requireLangPack,\n        add: add,\n        remove: remove,\n        createUrl: createUrl,\n        addComponents: addComponents,\n        load: load,\n        waitFor: waitFor\n      };\n    };\n    AddOnManager.languageLoad = true;\n    AddOnManager.baseURL = '';\n    AddOnManager.PluginManager = AddOnManager();\n    AddOnManager.ThemeManager = AddOnManager();\n\n    var singleton = function (doRevoke) {\n      var subject = Cell(Optional.none());\n      var revoke = function () {\n        return subject.get().each(doRevoke);\n      };\n      var clear = function () {\n        revoke();\n        subject.set(Optional.none());\n      };\n      var isSet = function () {\n        return subject.get().isSome();\n      };\n      var get = function () {\n        return subject.get();\n      };\n      var set = function (s) {\n        revoke();\n        subject.set(Optional.some(s));\n      };\n      return {\n        clear: clear,\n        isSet: isSet,\n        get: get,\n        set: set\n      };\n    };\n    var value = function () {\n      var subject = singleton(noop);\n      var on = function (f) {\n        return subject.get().each(f);\n      };\n      return __assign(__assign({}, subject), { on: on });\n    };\n\n    var first = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (isNull(timer)) {\n          timer = setTimeout(function () {\n            timer = null;\n            fn.apply(null, args);\n          }, rate);\n        }\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n    var last = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (!isNull(timer)) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        cancel();\n        timer = setTimeout(function () {\n          timer = null;\n          fn.apply(null, args);\n        }, rate);\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n\n    var read$4 = function (element, attr) {\n      var value = get$6(element, attr);\n      return value === undefined || value === '' ? [] : value.split(' ');\n    };\n    var add$3 = function (element, attr, id) {\n      var old = read$4(element, attr);\n      var nu = old.concat([id]);\n      set$1(element, attr, nu.join(' '));\n      return true;\n    };\n    var remove$5 = function (element, attr, id) {\n      var nu = filter$4(read$4(element, attr), function (v) {\n        return v !== id;\n      });\n      if (nu.length > 0) {\n        set$1(element, attr, nu.join(' '));\n      } else {\n        remove$6(element, attr);\n      }\n      return false;\n    };\n\n    var supports = function (element) {\n      return element.dom.classList !== undefined;\n    };\n    var get$4 = function (element) {\n      return read$4(element, 'class');\n    };\n    var add$2 = function (element, clazz) {\n      return add$3(element, 'class', clazz);\n    };\n    var remove$4 = function (element, clazz) {\n      return remove$5(element, 'class', clazz);\n    };\n\n    var add$1 = function (element, clazz) {\n      if (supports(element)) {\n        element.dom.classList.add(clazz);\n      } else {\n        add$2(element, clazz);\n      }\n    };\n    var cleanClass = function (element) {\n      var classList = supports(element) ? element.dom.classList : get$4(element);\n      if (classList.length === 0) {\n        remove$6(element, 'class');\n      }\n    };\n    var remove$3 = function (element, clazz) {\n      if (supports(element)) {\n        var classList = element.dom.classList;\n        classList.remove(clazz);\n      } else {\n        remove$4(element, clazz);\n      }\n      cleanClass(element);\n    };\n    var has = function (element, clazz) {\n      return supports(element) && element.dom.classList.contains(clazz);\n    };\n\n    var descendants$1 = function (scope, predicate) {\n      var result = [];\n      each$k(children(scope), function (x) {\n        if (predicate(x)) {\n          result = result.concat([x]);\n        }\n        result = result.concat(descendants$1(x, predicate));\n      });\n      return result;\n    };\n\n    var descendants = function (scope, selector) {\n      return all(selector, scope);\n    };\n\n    var annotation = constant('mce-annotation');\n    var dataAnnotation = constant('data-mce-annotation');\n    var dataAnnotationId = constant('data-mce-annotation-uid');\n\n    var identify = function (editor, annotationName) {\n      var rng = editor.selection.getRng();\n      var start = SugarElement.fromDom(rng.startContainer);\n      var root = SugarElement.fromDom(editor.getBody());\n      var selector = annotationName.fold(function () {\n        return '.' + annotation();\n      }, function (an) {\n        return '[' + dataAnnotation() + '=\"' + an + '\"]';\n      });\n      var newStart = child$1(start, rng.startOffset).getOr(start);\n      var closest = closest$2(newStart, selector, function (n) {\n        return eq(n, root);\n      });\n      var getAttr = function (c, property) {\n        if (has$1(c, property)) {\n          return Optional.some(get$6(c, property));\n        } else {\n          return Optional.none();\n        }\n      };\n      return closest.bind(function (c) {\n        return getAttr(c, '' + dataAnnotationId()).bind(function (uid) {\n          return getAttr(c, '' + dataAnnotation()).map(function (name) {\n            var elements = findMarkers(editor, uid);\n            return {\n              uid: uid,\n              name: name,\n              elements: elements\n            };\n          });\n        });\n      });\n    };\n    var isAnnotation = function (elem) {\n      return isElement$6(elem) && has(elem, annotation());\n    };\n    var findMarkers = function (editor, uid) {\n      var body = SugarElement.fromDom(editor.getBody());\n      return descendants(body, '[' + dataAnnotationId() + '=\"' + uid + '\"]');\n    };\n    var findAll = function (editor, name) {\n      var body = SugarElement.fromDom(editor.getBody());\n      var markers = descendants(body, '[' + dataAnnotation() + '=\"' + name + '\"]');\n      var directory = {};\n      each$k(markers, function (m) {\n        var uid = get$6(m, dataAnnotationId());\n        var nodesAlready = get$9(directory, uid).getOr([]);\n        directory[uid] = nodesAlready.concat([m]);\n      });\n      return directory;\n    };\n\n    var setup$n = function (editor, _registry) {\n      var changeCallbacks = Cell({});\n      var initData = function () {\n        return {\n          listeners: [],\n          previous: value()\n        };\n      };\n      var withCallbacks = function (name, f) {\n        updateCallbacks(name, function (data) {\n          f(data);\n          return data;\n        });\n      };\n      var updateCallbacks = function (name, f) {\n        var callbackMap = changeCallbacks.get();\n        var data = get$9(callbackMap, name).getOrThunk(initData);\n        var outputData = f(data);\n        callbackMap[name] = outputData;\n        changeCallbacks.set(callbackMap);\n      };\n      var fireCallbacks = function (name, uid, elements) {\n        withCallbacks(name, function (data) {\n          each$k(data.listeners, function (f) {\n            return f(true, name, {\n              uid: uid,\n              nodes: map$3(elements, function (elem) {\n                return elem.dom;\n              })\n            });\n          });\n        });\n      };\n      var fireNoAnnotation = function (name) {\n        withCallbacks(name, function (data) {\n          each$k(data.listeners, function (f) {\n            return f(false, name);\n          });\n        });\n      };\n      var onNodeChange = last(function () {\n        var callbackMap = changeCallbacks.get();\n        var annotations = sort(keys(callbackMap));\n        each$k(annotations, function (name) {\n          updateCallbacks(name, function (data) {\n            var prev = data.previous.get();\n            identify(editor, Optional.some(name)).fold(function () {\n              if (prev.isSome()) {\n                fireNoAnnotation(name);\n                data.previous.clear();\n              }\n            }, function (_a) {\n              var uid = _a.uid, name = _a.name, elements = _a.elements;\n              if (!is$1(prev, uid)) {\n                fireCallbacks(name, uid, elements);\n                data.previous.set(uid);\n              }\n            });\n            return {\n              previous: data.previous,\n              listeners: data.listeners\n            };\n          });\n        });\n      }, 30);\n      editor.on('remove', function () {\n        onNodeChange.cancel();\n      });\n      editor.on('NodeChange', function () {\n        onNodeChange.throttle();\n      });\n      var addListener = function (name, f) {\n        updateCallbacks(name, function (data) {\n          return {\n            previous: data.previous,\n            listeners: data.listeners.concat([f])\n          };\n        });\n      };\n      return { addListener: addListener };\n    };\n\n    var setup$m = function (editor, registry) {\n      var identifyParserNode = function (span) {\n        return Optional.from(span.attr(dataAnnotation())).bind(registry.lookup);\n      };\n      editor.on('init', function () {\n        editor.serializer.addNodeFilter('span', function (spans) {\n          each$k(spans, function (span) {\n            identifyParserNode(span).each(function (settings) {\n              if (settings.persistent === false) {\n                span.unwrap();\n              }\n            });\n          });\n        });\n      });\n    };\n\n    var create$7 = function () {\n      var annotations = {};\n      var register = function (name, settings) {\n        annotations[name] = {\n          name: name,\n          settings: settings\n        };\n      };\n      var lookup = function (name) {\n        return get$9(annotations, name).map(function (a) {\n          return a.settings;\n        });\n      };\n      return {\n        register: register,\n        lookup: lookup\n      };\n    };\n\n    var unique = 0;\n    var generate = function (prefix) {\n      var date = new Date();\n      var time = date.getTime();\n      var random = Math.floor(Math.random() * 1000000000);\n      unique++;\n      return prefix + '_' + random + unique + String(time);\n    };\n\n    var add = function (element, classes) {\n      each$k(classes, function (x) {\n        add$1(element, x);\n      });\n    };\n\n    var fromHtml = function (html, scope) {\n      var doc = scope || document;\n      var div = doc.createElement('div');\n      div.innerHTML = html;\n      return children(SugarElement.fromDom(div));\n    };\n    var fromDom$1 = function (nodes) {\n      return map$3(nodes, SugarElement.fromDom);\n    };\n\n    var get$3 = function (element) {\n      return element.dom.innerHTML;\n    };\n    var set = function (element, content) {\n      var owner = owner$1(element);\n      var docDom = owner.dom;\n      var fragment = SugarElement.fromDom(docDom.createDocumentFragment());\n      var contentElements = fromHtml(content, docDom);\n      append(fragment, contentElements);\n      empty(element);\n      append$1(element, fragment);\n    };\n\n    var clone$1 = function (original, isDeep) {\n      return SugarElement.fromDom(original.dom.cloneNode(isDeep));\n    };\n    var shallow = function (original) {\n      return clone$1(original, false);\n    };\n    var deep$1 = function (original) {\n      return clone$1(original, true);\n    };\n\n    var TextWalker = function (startNode, rootNode, isBoundary) {\n      if (isBoundary === void 0) {\n        isBoundary = never;\n      }\n      var walker = new DomTreeWalker(startNode, rootNode);\n      var walk = function (direction) {\n        var next;\n        do {\n          next = walker[direction]();\n        } while (next && !isText$7(next) && !isBoundary(next));\n        return Optional.from(next).filter(isText$7);\n      };\n      return {\n        current: function () {\n          return Optional.from(walker.current()).filter(isText$7);\n        },\n        next: function () {\n          return walk('next');\n        },\n        prev: function () {\n          return walk('prev');\n        },\n        prev2: function () {\n          return walk('prev2');\n        }\n      };\n    };\n\n    var TextSeeker = function (dom, isBoundary) {\n      var isBlockBoundary = isBoundary ? isBoundary : function (node) {\n        return dom.isBlock(node) || isBr$5(node) || isContentEditableFalse$b(node);\n      };\n      var walk = function (node, offset, walker, process) {\n        if (isText$7(node)) {\n          var newOffset = process(node, offset, node.data);\n          if (newOffset !== -1) {\n            return Optional.some({\n              container: node,\n              offset: newOffset\n            });\n          }\n        }\n        return walker().bind(function (next) {\n          return walk(next.container, next.offset, walker, process);\n        });\n      };\n      var backwards = function (node, offset, process, root) {\n        var walker = TextWalker(node, root, isBlockBoundary);\n        return walk(node, offset, function () {\n          return walker.prev().map(function (prev) {\n            return {\n              container: prev,\n              offset: prev.length\n            };\n          });\n        }, process).getOrNull();\n      };\n      var forwards = function (node, offset, process, root) {\n        var walker = TextWalker(node, root, isBlockBoundary);\n        return walk(node, offset, function () {\n          return walker.next().map(function (next) {\n            return {\n              container: next,\n              offset: 0\n            };\n          });\n        }, process).getOrNull();\n      };\n      return {\n        backwards: backwards,\n        forwards: forwards\n      };\n    };\n\n    var round$2 = Math.round;\n    var clone = function (rect) {\n      if (!rect) {\n        return {\n          left: 0,\n          top: 0,\n          bottom: 0,\n          right: 0,\n          width: 0,\n          height: 0\n        };\n      }\n      return {\n        left: round$2(rect.left),\n        top: round$2(rect.top),\n        bottom: round$2(rect.bottom),\n        right: round$2(rect.right),\n        width: round$2(rect.width),\n        height: round$2(rect.height)\n      };\n    };\n    var collapse = function (rect, toStart) {\n      rect = clone(rect);\n      if (toStart) {\n        rect.right = rect.left;\n      } else {\n        rect.left = rect.left + rect.width;\n        rect.right = rect.left;\n      }\n      rect.width = 0;\n      return rect;\n    };\n    var isEqual = function (rect1, rect2) {\n      return rect1.left === rect2.left && rect1.top === rect2.top && rect1.bottom === rect2.bottom && rect1.right === rect2.right;\n    };\n    var isValidOverflow = function (overflowY, rect1, rect2) {\n      return overflowY >= 0 && overflowY <= Math.min(rect1.height, rect2.height) / 2;\n    };\n    var isAbove$1 = function (rect1, rect2) {\n      var halfHeight = Math.min(rect2.height / 2, rect1.height / 2);\n      if (rect1.bottom - halfHeight < rect2.top) {\n        return true;\n      }\n      if (rect1.top > rect2.bottom) {\n        return false;\n      }\n      return isValidOverflow(rect2.top - rect1.bottom, rect1, rect2);\n    };\n    var isBelow$1 = function (rect1, rect2) {\n      if (rect1.top > rect2.bottom) {\n        return true;\n      }\n      if (rect1.bottom < rect2.top) {\n        return false;\n      }\n      return isValidOverflow(rect2.bottom - rect1.top, rect1, rect2);\n    };\n    var containsXY = function (rect, clientX, clientY) {\n      return clientX >= rect.left && clientX <= rect.right && clientY >= rect.top && clientY <= rect.bottom;\n    };\n\n    var clamp$2 = function (value, min, max) {\n      return Math.min(Math.max(value, min), max);\n    };\n\n    var getSelectedNode = function (range) {\n      var startContainer = range.startContainer, startOffset = range.startOffset;\n      if (startContainer.hasChildNodes() && range.endOffset === startOffset + 1) {\n        return startContainer.childNodes[startOffset];\n      }\n      return null;\n    };\n    var getNode$1 = function (container, offset) {\n      if (isElement$5(container) && container.hasChildNodes()) {\n        var childNodes = container.childNodes;\n        var safeOffset = clamp$2(offset, 0, childNodes.length - 1);\n        return childNodes[safeOffset];\n      } else {\n        return container;\n      }\n    };\n    var getNodeUnsafe = function (container, offset) {\n      if (offset < 0 && isElement$5(container) && container.hasChildNodes()) {\n        return undefined;\n      } else {\n        return getNode$1(container, offset);\n      }\n    };\n\n    var extendingChars = new RegExp('[\\u0300-\\u036f\\u0483-\\u0487\\u0488-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1-\\u05c2\\u05c4-\\u05c5\\u05c7\\u0610-\\u061a' + '\\u064b-\\u065f\\u0670\\u06d6-\\u06dc\\u06df-\\u06e4\\u06e7-\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0' + '\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0859-\\u085b\\u08e3-\\u0902\\u093a\\u093c' + '\\u0941-\\u0948\\u094d\\u0951-\\u0957\\u0962-\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2-\\u09e3' + '\\u0a01-\\u0a02\\u0a3c\\u0a41-\\u0a42\\u0a47-\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70-\\u0a71\\u0a75\\u0a81-\\u0a82\\u0abc' + '\\u0ac1-\\u0ac5\\u0ac7-\\u0ac8\\u0acd\\u0ae2-\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57' + '\\u0b62-\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c00\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55-\\u0c56' + '\\u0c62-\\u0c63\\u0c81\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc-\\u0ccd\\u0cd5-\\u0cd6\\u0ce2-\\u0ce3\\u0d01\\u0d3e\\u0d41-\\u0d44' + '\\u0d4d\\u0d57\\u0d62-\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9' + '\\u0ebb-\\u0ebc\\u0ec8-\\u0ecd\\u0f18-\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97' + '\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039-\\u103a\\u103d-\\u103e\\u1058-\\u1059\\u105e-\\u1060\\u1071-\\u1074' + '\\u1082\\u1085-\\u1086\\u108d\\u109d\\u135d-\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752-\\u1753\\u1772-\\u1773\\u17b4-\\u17b5' + '\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927-\\u1928\\u1932\\u1939-\\u193b\\u1a17-\\u1a18' + '\\u1a1b\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1ab0-\\u1abd\\u1ABE\\u1b00-\\u1b03\\u1b34' + '\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80-\\u1b81\\u1ba2-\\u1ba5\\u1ba8-\\u1ba9\\u1bab-\\u1bad\\u1be6\\u1be8-\\u1be9' + '\\u1bed\\u1bef-\\u1bf1\\u1c2c-\\u1c33\\u1c36-\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1cf4\\u1cf8-\\u1cf9' + '\\u1dc0-\\u1df5\\u1dfc-\\u1dff\\u200c-\\u200d\\u20d0-\\u20dc\\u20DD-\\u20E0\\u20e1\\u20E2-\\u20E4\\u20e5-\\u20f0\\u2cef-\\u2cf1' + '\\u2d7f\\u2de0-\\u2dff\\u302a-\\u302d\\u302e-\\u302f\\u3099-\\u309a\\ua66f\\uA670-\\uA672\\ua674-\\ua67d\\ua69e-\\ua69f\\ua6f0-\\ua6f1' + '\\ua802\\ua806\\ua80b\\ua825-\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc' + '\\ua9e5\\uaa29-\\uaa2e\\uaa31-\\uaa32\\uaa35-\\uaa36\\uaa43\\uaa4c\\uaa7c\\uaab0\\uaab2-\\uaab4\\uaab7-\\uaab8\\uaabe-\\uaabf\\uaac1' + '\\uaaec-\\uaaed\\uaaf6\\uabe5\\uabe8\\uabed\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe2f\\uff9e-\\uff9f]');\n    var isExtendingChar = function (ch) {\n      return typeof ch === 'string' && ch.charCodeAt(0) >= 768 && extendingChars.test(ch);\n    };\n\n    var or = function () {\n      var args = [];\n      for (var _i = 0; _i < arguments.length; _i++) {\n        args[_i] = arguments[_i];\n      }\n      return function (x) {\n        for (var i = 0; i < args.length; i++) {\n          if (args[i](x)) {\n            return true;\n          }\n        }\n        return false;\n      };\n    };\n    var and = function () {\n      var args = [];\n      for (var _i = 0; _i < arguments.length; _i++) {\n        args[_i] = arguments[_i];\n      }\n      return function (x) {\n        for (var i = 0; i < args.length; i++) {\n          if (!args[i](x)) {\n            return false;\n          }\n        }\n        return true;\n      };\n    };\n\n    var isElement$3 = isElement$5;\n    var isCaretCandidate$2 = isCaretCandidate$3;\n    var isBlock$1 = matchStyleValues('display', 'block table');\n    var isFloated = matchStyleValues('float', 'left right');\n    var isValidElementCaretCandidate = and(isElement$3, isCaretCandidate$2, not(isFloated));\n    var isNotPre = not(matchStyleValues('white-space', 'pre pre-line pre-wrap'));\n    var isText$4 = isText$7;\n    var isBr$2 = isBr$5;\n    var nodeIndex$1 = DOMUtils.nodeIndex;\n    var resolveIndex$1 = getNodeUnsafe;\n    var createRange$1 = function (doc) {\n      return 'createRange' in doc ? doc.createRange() : DOMUtils.DOM.createRng();\n    };\n    var isWhiteSpace$1 = function (chr) {\n      return chr && /[\\r\\n\\t ]/.test(chr);\n    };\n    var isRange = function (rng) {\n      return !!rng.setStart && !!rng.setEnd;\n    };\n    var isHiddenWhiteSpaceRange = function (range) {\n      var container = range.startContainer;\n      var offset = range.startOffset;\n      if (isWhiteSpace$1(range.toString()) && isNotPre(container.parentNode) && isText$7(container)) {\n        var text = container.data;\n        if (isWhiteSpace$1(text[offset - 1]) || isWhiteSpace$1(text[offset + 1])) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var getBrClientRect = function (brNode) {\n      var doc = brNode.ownerDocument;\n      var rng = createRange$1(doc);\n      var nbsp$1 = doc.createTextNode(nbsp);\n      var parentNode = brNode.parentNode;\n      parentNode.insertBefore(nbsp$1, brNode);\n      rng.setStart(nbsp$1, 0);\n      rng.setEnd(nbsp$1, 1);\n      var clientRect = clone(rng.getBoundingClientRect());\n      parentNode.removeChild(nbsp$1);\n      return clientRect;\n    };\n    var getBoundingClientRectWebKitText = function (rng) {\n      var sc = rng.startContainer;\n      var ec = rng.endContainer;\n      var so = rng.startOffset;\n      var eo = rng.endOffset;\n      if (sc === ec && isText$7(ec) && so === 0 && eo === 1) {\n        var newRng = rng.cloneRange();\n        newRng.setEndAfter(ec);\n        return getBoundingClientRect$1(newRng);\n      } else {\n        return null;\n      }\n    };\n    var isZeroRect = function (r) {\n      return r.left === 0 && r.right === 0 && r.top === 0 && r.bottom === 0;\n    };\n    var getBoundingClientRect$1 = function (item) {\n      var clientRect;\n      var clientRects = item.getClientRects();\n      if (clientRects.length > 0) {\n        clientRect = clone(clientRects[0]);\n      } else {\n        clientRect = clone(item.getBoundingClientRect());\n      }\n      if (!isRange(item) && isBr$2(item) && isZeroRect(clientRect)) {\n        return getBrClientRect(item);\n      }\n      if (isZeroRect(clientRect) && isRange(item)) {\n        return getBoundingClientRectWebKitText(item);\n      }\n      return clientRect;\n    };\n    var collapseAndInflateWidth = function (clientRect, toStart) {\n      var newClientRect = collapse(clientRect, toStart);\n      newClientRect.width = 1;\n      newClientRect.right = newClientRect.left + 1;\n      return newClientRect;\n    };\n    var getCaretPositionClientRects = function (caretPosition) {\n      var clientRects = [];\n      var addUniqueAndValidRect = function (clientRect) {\n        if (clientRect.height === 0) {\n          return;\n        }\n        if (clientRects.length > 0) {\n          if (isEqual(clientRect, clientRects[clientRects.length - 1])) {\n            return;\n          }\n        }\n        clientRects.push(clientRect);\n      };\n      var addCharacterOffset = function (container, offset) {\n        var range = createRange$1(container.ownerDocument);\n        if (offset < container.data.length) {\n          if (isExtendingChar(container.data[offset])) {\n            return clientRects;\n          }\n          if (isExtendingChar(container.data[offset - 1])) {\n            range.setStart(container, offset);\n            range.setEnd(container, offset + 1);\n            if (!isHiddenWhiteSpaceRange(range)) {\n              addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range), false));\n              return clientRects;\n            }\n          }\n        }\n        if (offset > 0) {\n          range.setStart(container, offset - 1);\n          range.setEnd(container, offset);\n          if (!isHiddenWhiteSpaceRange(range)) {\n            addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range), false));\n          }\n        }\n        if (offset < container.data.length) {\n          range.setStart(container, offset);\n          range.setEnd(container, offset + 1);\n          if (!isHiddenWhiteSpaceRange(range)) {\n            addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(range), true));\n          }\n        }\n      };\n      var container = caretPosition.container();\n      var offset = caretPosition.offset();\n      if (isText$4(container)) {\n        addCharacterOffset(container, offset);\n        return clientRects;\n      }\n      if (isElement$3(container)) {\n        if (caretPosition.isAtEnd()) {\n          var node = resolveIndex$1(container, offset);\n          if (isText$4(node)) {\n            addCharacterOffset(node, node.data.length);\n          }\n          if (isValidElementCaretCandidate(node) && !isBr$2(node)) {\n            addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), false));\n          }\n        } else {\n          var node = resolveIndex$1(container, offset);\n          if (isText$4(node)) {\n            addCharacterOffset(node, 0);\n          }\n          if (isValidElementCaretCandidate(node) && caretPosition.isAtEnd()) {\n            addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), false));\n            return clientRects;\n          }\n          var beforeNode = resolveIndex$1(caretPosition.container(), caretPosition.offset() - 1);\n          if (isValidElementCaretCandidate(beforeNode) && !isBr$2(beforeNode)) {\n            if (isBlock$1(beforeNode) || isBlock$1(node) || !isValidElementCaretCandidate(node)) {\n              addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(beforeNode), false));\n            }\n          }\n          if (isValidElementCaretCandidate(node)) {\n            addUniqueAndValidRect(collapseAndInflateWidth(getBoundingClientRect$1(node), true));\n          }\n        }\n      }\n      return clientRects;\n    };\n    var CaretPosition = function (container, offset, clientRects) {\n      var isAtStart = function () {\n        if (isText$4(container)) {\n          return offset === 0;\n        }\n        return offset === 0;\n      };\n      var isAtEnd = function () {\n        if (isText$4(container)) {\n          return offset >= container.data.length;\n        }\n        return offset >= container.childNodes.length;\n      };\n      var toRange = function () {\n        var range = createRange$1(container.ownerDocument);\n        range.setStart(container, offset);\n        range.setEnd(container, offset);\n        return range;\n      };\n      var getClientRects = function () {\n        if (!clientRects) {\n          clientRects = getCaretPositionClientRects(CaretPosition(container, offset));\n        }\n        return clientRects;\n      };\n      var isVisible = function () {\n        return getClientRects().length > 0;\n      };\n      var isEqual = function (caretPosition) {\n        return caretPosition && container === caretPosition.container() && offset === caretPosition.offset();\n      };\n      var getNode = function (before) {\n        return resolveIndex$1(container, before ? offset - 1 : offset);\n      };\n      return {\n        container: constant(container),\n        offset: constant(offset),\n        toRange: toRange,\n        getClientRects: getClientRects,\n        isVisible: isVisible,\n        isAtStart: isAtStart,\n        isAtEnd: isAtEnd,\n        isEqual: isEqual,\n        getNode: getNode\n      };\n    };\n    CaretPosition.fromRangeStart = function (range) {\n      return CaretPosition(range.startContainer, range.startOffset);\n    };\n    CaretPosition.fromRangeEnd = function (range) {\n      return CaretPosition(range.endContainer, range.endOffset);\n    };\n    CaretPosition.after = function (node) {\n      return CaretPosition(node.parentNode, nodeIndex$1(node) + 1);\n    };\n    CaretPosition.before = function (node) {\n      return CaretPosition(node.parentNode, nodeIndex$1(node));\n    };\n    CaretPosition.isAbove = function (pos1, pos2) {\n      return lift2(head(pos2.getClientRects()), last$2(pos1.getClientRects()), isAbove$1).getOr(false);\n    };\n    CaretPosition.isBelow = function (pos1, pos2) {\n      return lift2(last$2(pos2.getClientRects()), head(pos1.getClientRects()), isBelow$1).getOr(false);\n    };\n    CaretPosition.isAtStart = function (pos) {\n      return pos ? pos.isAtStart() : false;\n    };\n    CaretPosition.isAtEnd = function (pos) {\n      return pos ? pos.isAtEnd() : false;\n    };\n    CaretPosition.isTextPosition = function (pos) {\n      return pos ? isText$7(pos.container()) : false;\n    };\n    CaretPosition.isElementPosition = function (pos) {\n      return CaretPosition.isTextPosition(pos) === false;\n    };\n\n    var trimEmptyTextNode$1 = function (dom, node) {\n      if (isText$7(node) && node.data.length === 0) {\n        dom.remove(node);\n      }\n    };\n    var insertNode = function (dom, rng, node) {\n      rng.insertNode(node);\n      trimEmptyTextNode$1(dom, node.previousSibling);\n      trimEmptyTextNode$1(dom, node.nextSibling);\n    };\n    var insertFragment = function (dom, rng, frag) {\n      var firstChild = Optional.from(frag.firstChild);\n      var lastChild = Optional.from(frag.lastChild);\n      rng.insertNode(frag);\n      firstChild.each(function (child) {\n        return trimEmptyTextNode$1(dom, child.previousSibling);\n      });\n      lastChild.each(function (child) {\n        return trimEmptyTextNode$1(dom, child.nextSibling);\n      });\n    };\n    var rangeInsertNode = function (dom, rng, node) {\n      if (isDocumentFragment(node)) {\n        insertFragment(dom, rng, node);\n      } else {\n        insertNode(dom, rng, node);\n      }\n    };\n\n    var isText$3 = isText$7;\n    var isBogus = isBogus$2;\n    var nodeIndex = DOMUtils.nodeIndex;\n    var normalizedParent = function (node) {\n      var parentNode = node.parentNode;\n      if (isBogus(parentNode)) {\n        return normalizedParent(parentNode);\n      }\n      return parentNode;\n    };\n    var getChildNodes = function (node) {\n      if (!node) {\n        return [];\n      }\n      return reduce(node.childNodes, function (result, node) {\n        if (isBogus(node) && node.nodeName !== 'BR') {\n          result = result.concat(getChildNodes(node));\n        } else {\n          result.push(node);\n        }\n        return result;\n      }, []);\n    };\n    var normalizedTextOffset = function (node, offset) {\n      while (node = node.previousSibling) {\n        if (!isText$3(node)) {\n          break;\n        }\n        offset += node.data.length;\n      }\n      return offset;\n    };\n    var equal = function (a) {\n      return function (b) {\n        return a === b;\n      };\n    };\n    var normalizedNodeIndex = function (node) {\n      var nodes, index;\n      nodes = getChildNodes(normalizedParent(node));\n      index = findIndex$1(nodes, equal(node), node);\n      nodes = nodes.slice(0, index + 1);\n      var numTextFragments = reduce(nodes, function (result, node, i) {\n        if (isText$3(node) && isText$3(nodes[i - 1])) {\n          result++;\n        }\n        return result;\n      }, 0);\n      nodes = filter$2(nodes, matchNodeNames([node.nodeName]));\n      index = findIndex$1(nodes, equal(node), node);\n      return index - numTextFragments;\n    };\n    var createPathItem = function (node) {\n      var name;\n      if (isText$3(node)) {\n        name = 'text()';\n      } else {\n        name = node.nodeName.toLowerCase();\n      }\n      return name + '[' + normalizedNodeIndex(node) + ']';\n    };\n    var parentsUntil$1 = function (root, node, predicate) {\n      var parents = [];\n      for (node = node.parentNode; node !== root; node = node.parentNode) {\n        if (predicate && predicate(node)) {\n          break;\n        }\n        parents.push(node);\n      }\n      return parents;\n    };\n    var create$6 = function (root, caretPosition) {\n      var container, offset, path = [], outputOffset, childNodes, parents;\n      container = caretPosition.container();\n      offset = caretPosition.offset();\n      if (isText$3(container)) {\n        outputOffset = normalizedTextOffset(container, offset);\n      } else {\n        childNodes = container.childNodes;\n        if (offset >= childNodes.length) {\n          outputOffset = 'after';\n          offset = childNodes.length - 1;\n        } else {\n          outputOffset = 'before';\n        }\n        container = childNodes[offset];\n      }\n      path.push(createPathItem(container));\n      parents = parentsUntil$1(root, container);\n      parents = filter$2(parents, not(isBogus$2));\n      path = path.concat(map$1(parents, function (node) {\n        return createPathItem(node);\n      }));\n      return path.reverse().join('/') + ',' + outputOffset;\n    };\n    var resolvePathItem = function (node, name, index) {\n      var nodes = getChildNodes(node);\n      nodes = filter$2(nodes, function (node, index) {\n        return !isText$3(node) || !isText$3(nodes[index - 1]);\n      });\n      nodes = filter$2(nodes, matchNodeNames([name]));\n      return nodes[index];\n    };\n    var findTextPosition = function (container, offset) {\n      var node = container, targetOffset = 0, dataLen;\n      while (isText$3(node)) {\n        dataLen = node.data.length;\n        if (offset >= targetOffset && offset <= targetOffset + dataLen) {\n          container = node;\n          offset = offset - targetOffset;\n          break;\n        }\n        if (!isText$3(node.nextSibling)) {\n          container = node;\n          offset = dataLen;\n          break;\n        }\n        targetOffset += dataLen;\n        node = node.nextSibling;\n      }\n      if (isText$3(container) && offset > container.data.length) {\n        offset = container.data.length;\n      }\n      return CaretPosition(container, offset);\n    };\n    var resolve$2 = function (root, path) {\n      var offset;\n      if (!path) {\n        return null;\n      }\n      var parts = path.split(',');\n      var paths = parts[0].split('/');\n      offset = parts.length > 1 ? parts[1] : 'before';\n      var container = reduce(paths, function (result, value) {\n        var match = /([\\w\\-\\(\\)]+)\\[([0-9]+)\\]/.exec(value);\n        if (!match) {\n          return null;\n        }\n        if (match[1] === 'text()') {\n          match[1] = '#text';\n        }\n        return resolvePathItem(result, match[1], parseInt(match[2], 10));\n      }, root);\n      if (!container) {\n        return null;\n      }\n      if (!isText$3(container)) {\n        if (offset === 'after') {\n          offset = nodeIndex(container) + 1;\n        } else {\n          offset = nodeIndex(container);\n        }\n        return CaretPosition(container.parentNode, offset);\n      }\n      return findTextPosition(container, parseInt(offset, 10));\n    };\n\n    var isContentEditableFalse$9 = isContentEditableFalse$b;\n    var getNormalizedTextOffset = function (trim, container, offset) {\n      var node, trimmedOffset;\n      trimmedOffset = trim(container.data.slice(0, offset)).length;\n      for (node = container.previousSibling; node && isText$7(node); node = node.previousSibling) {\n        trimmedOffset += trim(node.data).length;\n      }\n      return trimmedOffset;\n    };\n    var getPoint = function (dom, trim, normalized, rng, start) {\n      var container = rng[start ? 'startContainer' : 'endContainer'];\n      var offset = rng[start ? 'startOffset' : 'endOffset'];\n      var point = [];\n      var childNodes, after = 0;\n      var root = dom.getRoot();\n      if (isText$7(container)) {\n        point.push(normalized ? getNormalizedTextOffset(trim, container, offset) : offset);\n      } else {\n        childNodes = container.childNodes;\n        if (offset >= childNodes.length && childNodes.length) {\n          after = 1;\n          offset = Math.max(0, childNodes.length - 1);\n        }\n        point.push(dom.nodeIndex(childNodes[offset], normalized) + after);\n      }\n      for (; container && container !== root; container = container.parentNode) {\n        point.push(dom.nodeIndex(container, normalized));\n      }\n      return point;\n    };\n    var getLocation = function (trim, selection, normalized, rng) {\n      var dom = selection.dom, bookmark = {};\n      bookmark.start = getPoint(dom, trim, normalized, rng, true);\n      if (!selection.isCollapsed()) {\n        bookmark.end = getPoint(dom, trim, normalized, rng, false);\n      }\n      if (isRangeInCaretContainerBlock(rng)) {\n        bookmark.isFakeCaret = true;\n      }\n      return bookmark;\n    };\n    var findIndex = function (dom, name, element) {\n      var count = 0;\n      Tools.each(dom.select(name), function (node) {\n        if (node.getAttribute('data-mce-bogus') === 'all') {\n          return;\n        }\n        if (node === element) {\n          return false;\n        }\n        count++;\n      });\n      return count;\n    };\n    var moveEndPoint$1 = function (rng, start) {\n      var container, offset, childNodes;\n      var prefix = start ? 'start' : 'end';\n      container = rng[prefix + 'Container'];\n      offset = rng[prefix + 'Offset'];\n      if (isElement$5(container) && container.nodeName === 'TR') {\n        childNodes = container.childNodes;\n        container = childNodes[Math.min(start ? offset : offset - 1, childNodes.length - 1)];\n        if (container) {\n          offset = start ? 0 : container.childNodes.length;\n          rng['set' + (start ? 'Start' : 'End')](container, offset);\n        }\n      }\n    };\n    var normalizeTableCellSelection = function (rng) {\n      moveEndPoint$1(rng, true);\n      moveEndPoint$1(rng, false);\n      return rng;\n    };\n    var findSibling = function (node, offset) {\n      var sibling;\n      if (isElement$5(node)) {\n        node = getNode$1(node, offset);\n        if (isContentEditableFalse$9(node)) {\n          return node;\n        }\n      }\n      if (isCaretContainer$2(node)) {\n        if (isText$7(node) && isCaretContainerBlock$1(node)) {\n          node = node.parentNode;\n        }\n        sibling = node.previousSibling;\n        if (isContentEditableFalse$9(sibling)) {\n          return sibling;\n        }\n        sibling = node.nextSibling;\n        if (isContentEditableFalse$9(sibling)) {\n          return sibling;\n        }\n      }\n    };\n    var findAdjacentContentEditableFalseElm = function (rng) {\n      return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);\n    };\n    var getOffsetBookmark = function (trim, normalized, selection) {\n      var element = selection.getNode();\n      var name = element ? element.nodeName : null;\n      var rng = selection.getRng();\n      if (isContentEditableFalse$9(element) || name === 'IMG') {\n        return {\n          name: name,\n          index: findIndex(selection.dom, name, element)\n        };\n      }\n      var sibling = findAdjacentContentEditableFalseElm(rng);\n      if (sibling) {\n        name = sibling.tagName;\n        return {\n          name: name,\n          index: findIndex(selection.dom, name, sibling)\n        };\n      }\n      return getLocation(trim, selection, normalized, rng);\n    };\n    var getCaretBookmark = function (selection) {\n      var rng = selection.getRng();\n      return {\n        start: create$6(selection.dom.getRoot(), CaretPosition.fromRangeStart(rng)),\n        end: create$6(selection.dom.getRoot(), CaretPosition.fromRangeEnd(rng))\n      };\n    };\n    var getRangeBookmark = function (selection) {\n      return { rng: selection.getRng() };\n    };\n    var createBookmarkSpan = function (dom, id, filled) {\n      var args = {\n        'data-mce-type': 'bookmark',\n        id: id,\n        'style': 'overflow:hidden;line-height:0px'\n      };\n      return filled ? dom.create('span', args, '&#xFEFF;') : dom.create('span', args);\n    };\n    var getPersistentBookmark = function (selection, filled) {\n      var dom = selection.dom;\n      var rng = selection.getRng();\n      var id = dom.uniqueId();\n      var collapsed = selection.isCollapsed();\n      var element = selection.getNode();\n      var name = element.nodeName;\n      if (name === 'IMG') {\n        return {\n          name: name,\n          index: findIndex(dom, name, element)\n        };\n      }\n      var rng2 = normalizeTableCellSelection(rng.cloneRange());\n      if (!collapsed) {\n        rng2.collapse(false);\n        var endBookmarkNode = createBookmarkSpan(dom, id + '_end', filled);\n        rangeInsertNode(dom, rng2, endBookmarkNode);\n      }\n      rng = normalizeTableCellSelection(rng);\n      rng.collapse(true);\n      var startBookmarkNode = createBookmarkSpan(dom, id + '_start', filled);\n      rangeInsertNode(dom, rng, startBookmarkNode);\n      selection.moveToBookmark({\n        id: id,\n        keep: true\n      });\n      return { id: id };\n    };\n    var getBookmark$2 = function (selection, type, normalized) {\n      if (type === 2) {\n        return getOffsetBookmark(trim$3, normalized, selection);\n      } else if (type === 3) {\n        return getCaretBookmark(selection);\n      } else if (type) {\n        return getRangeBookmark(selection);\n      } else {\n        return getPersistentBookmark(selection, false);\n      }\n    };\n    var getUndoBookmark = curry(getOffsetBookmark, identity, true);\n\n    var DOM$9 = DOMUtils.DOM;\n    var defaultPreviewStyles = 'font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow';\n    var getBodySetting = function (editor, name, defaultValue) {\n      var value = editor.getParam(name, defaultValue);\n      if (value.indexOf('=') !== -1) {\n        var bodyObj = editor.getParam(name, '', 'hash');\n        return get$9(bodyObj, editor.id).getOr(defaultValue);\n      } else {\n        return value;\n      }\n    };\n    var getIframeAttrs = function (editor) {\n      return editor.getParam('iframe_attrs', {});\n    };\n    var getDocType = function (editor) {\n      return editor.getParam('doctype', '<!DOCTYPE html>');\n    };\n    var getDocumentBaseUrl = function (editor) {\n      return editor.getParam('document_base_url', '');\n    };\n    var getBodyId = function (editor) {\n      return getBodySetting(editor, 'body_id', 'tinymce');\n    };\n    var getBodyClass = function (editor) {\n      return getBodySetting(editor, 'body_class', '');\n    };\n    var getContentSecurityPolicy = function (editor) {\n      return editor.getParam('content_security_policy', '');\n    };\n    var shouldPutBrInPre$1 = function (editor) {\n      return editor.getParam('br_in_pre', true);\n    };\n    var getForcedRootBlock = function (editor) {\n      if (editor.getParam('force_p_newlines', false)) {\n        return 'p';\n      }\n      var block = editor.getParam('forced_root_block', 'p');\n      if (block === false) {\n        return '';\n      } else if (block === true) {\n        return 'p';\n      } else {\n        return block;\n      }\n    };\n    var getForcedRootBlockAttrs = function (editor) {\n      return editor.getParam('forced_root_block_attrs', {});\n    };\n    var getBrNewLineSelector = function (editor) {\n      return editor.getParam('br_newline_selector', '.mce-toc h2,figcaption,caption');\n    };\n    var getNoNewLineSelector = function (editor) {\n      return editor.getParam('no_newline_selector', '');\n    };\n    var shouldKeepStyles = function (editor) {\n      return editor.getParam('keep_styles', true);\n    };\n    var shouldEndContainerOnEmptyBlock = function (editor) {\n      return editor.getParam('end_container_on_empty_block', false);\n    };\n    var getFontStyleValues = function (editor) {\n      return Tools.explode(editor.getParam('font_size_style_values', 'xx-small,x-small,small,medium,large,x-large,xx-large'));\n    };\n    var getFontSizeClasses = function (editor) {\n      return Tools.explode(editor.getParam('font_size_classes', ''));\n    };\n    var getImagesDataImgFilter = function (editor) {\n      return editor.getParam('images_dataimg_filter', always, 'function');\n    };\n    var isAutomaticUploadsEnabled = function (editor) {\n      return editor.getParam('automatic_uploads', true, 'boolean');\n    };\n    var shouldReuseFileName = function (editor) {\n      return editor.getParam('images_reuse_filename', false, 'boolean');\n    };\n    var shouldReplaceBlobUris = function (editor) {\n      return editor.getParam('images_replace_blob_uris', true, 'boolean');\n    };\n    var getIconPackName = function (editor) {\n      return editor.getParam('icons', '', 'string');\n    };\n    var getIconsUrl = function (editor) {\n      return editor.getParam('icons_url', '', 'string');\n    };\n    var getImageUploadUrl = function (editor) {\n      return editor.getParam('images_upload_url', '', 'string');\n    };\n    var getImageUploadBasePath = function (editor) {\n      return editor.getParam('images_upload_base_path', '', 'string');\n    };\n    var getImagesUploadCredentials = function (editor) {\n      return editor.getParam('images_upload_credentials', false, 'boolean');\n    };\n    var getImagesUploadHandler = function (editor) {\n      return editor.getParam('images_upload_handler', null, 'function');\n    };\n    var shouldUseContentCssCors = function (editor) {\n      return editor.getParam('content_css_cors', false, 'boolean');\n    };\n    var getReferrerPolicy = function (editor) {\n      return editor.getParam('referrer_policy', '', 'string');\n    };\n    var getLanguageCode = function (editor) {\n      return editor.getParam('language', 'en', 'string');\n    };\n    var getLanguageUrl = function (editor) {\n      return editor.getParam('language_url', '', 'string');\n    };\n    var shouldIndentUseMargin = function (editor) {\n      return editor.getParam('indent_use_margin', false);\n    };\n    var getIndentation = function (editor) {\n      return editor.getParam('indentation', '40px', 'string');\n    };\n    var getContentCss = function (editor) {\n      var contentCss = editor.getParam('content_css');\n      if (isString$1(contentCss)) {\n        return map$3(contentCss.split(','), trim$5);\n      } else if (isArray$1(contentCss)) {\n        return contentCss;\n      } else if (contentCss === false || editor.inline) {\n        return [];\n      } else {\n        return ['default'];\n      }\n    };\n    var getFontCss = function (editor) {\n      var fontCss = editor.getParam('font_css', []);\n      return isArray$1(fontCss) ? fontCss : map$3(fontCss.split(','), trim$5);\n    };\n    var getDirectionality = function (editor) {\n      return editor.getParam('directionality', I18n.isRtl() ? 'rtl' : undefined);\n    };\n    var getInlineBoundarySelector = function (editor) {\n      return editor.getParam('inline_boundaries_selector', 'a[href],code,.mce-annotation', 'string');\n    };\n    var getObjectResizing = function (editor) {\n      var selector = editor.getParam('object_resizing');\n      if (selector === false || Env.iOS) {\n        return false;\n      } else {\n        return isString$1(selector) ? selector : 'table,img,figure.image,div,video,iframe';\n      }\n    };\n    var getResizeImgProportional = function (editor) {\n      return editor.getParam('resize_img_proportional', true, 'boolean');\n    };\n    var getPlaceholder = function (editor) {\n      return editor.getParam('placeholder', DOM$9.getAttrib(editor.getElement(), 'placeholder'), 'string');\n    };\n    var getEventRoot = function (editor) {\n      return editor.getParam('event_root');\n    };\n    var getServiceMessage = function (editor) {\n      return editor.getParam('service_message');\n    };\n    var getTheme = function (editor) {\n      return editor.getParam('theme');\n    };\n    var shouldValidate = function (editor) {\n      return editor.getParam('validate');\n    };\n    var isInlineBoundariesEnabled = function (editor) {\n      return editor.getParam('inline_boundaries') !== false;\n    };\n    var getFormats = function (editor) {\n      return editor.getParam('formats');\n    };\n    var getPreviewStyles = function (editor) {\n      var style = editor.getParam('preview_styles', defaultPreviewStyles);\n      if (isString$1(style)) {\n        return style;\n      } else {\n        return '';\n      }\n    };\n    var canFormatEmptyLines = function (editor) {\n      return editor.getParam('format_empty_lines', false, 'boolean');\n    };\n    var getCustomUiSelector = function (editor) {\n      return editor.getParam('custom_ui_selector', '', 'string');\n    };\n    var getThemeUrl = function (editor) {\n      return editor.getParam('theme_url');\n    };\n    var isInline = function (editor) {\n      return editor.getParam('inline');\n    };\n    var hasHiddenInput = function (editor) {\n      return editor.getParam('hidden_input');\n    };\n    var shouldPatchSubmit = function (editor) {\n      return editor.getParam('submit_patch');\n    };\n    var isEncodingXml = function (editor) {\n      return editor.getParam('encoding') === 'xml';\n    };\n    var shouldAddFormSubmitTrigger = function (editor) {\n      return editor.getParam('add_form_submit_trigger');\n    };\n    var shouldAddUnloadTrigger = function (editor) {\n      return editor.getParam('add_unload_trigger');\n    };\n    var hasForcedRootBlock = function (editor) {\n      return getForcedRootBlock(editor) !== '';\n    };\n    var getCustomUndoRedoLevels = function (editor) {\n      return editor.getParam('custom_undo_redo_levels', 0, 'number');\n    };\n    var shouldDisableNodeChange = function (editor) {\n      return editor.getParam('disable_nodechange');\n    };\n    var isReadOnly$1 = function (editor) {\n      return editor.getParam('readonly');\n    };\n    var hasContentCssCors = function (editor) {\n      return editor.getParam('content_css_cors');\n    };\n    var getPlugins = function (editor) {\n      return editor.getParam('plugins', '', 'string');\n    };\n    var getExternalPlugins$1 = function (editor) {\n      return editor.getParam('external_plugins');\n    };\n    var shouldBlockUnsupportedDrop = function (editor) {\n      return editor.getParam('block_unsupported_drop', true, 'boolean');\n    };\n    var isVisualAidsEnabled = function (editor) {\n      return editor.getParam('visual', true, 'boolean');\n    };\n    var getVisualAidsTableClass = function (editor) {\n      return editor.getParam('visual_table_class', 'mce-item-table', 'string');\n    };\n    var getVisualAidsAnchorClass = function (editor) {\n      return editor.getParam('visual_anchor_class', 'mce-item-anchor', 'string');\n    };\n    var getIframeAriaText = function (editor) {\n      return editor.getParam('iframe_aria_text', 'Rich Text Area. Press ALT-0 for help.', 'string');\n    };\n\n    var isElement$2 = isElement$5;\n    var isText$2 = isText$7;\n    var removeNode$1 = function (node) {\n      var parentNode = node.parentNode;\n      if (parentNode) {\n        parentNode.removeChild(node);\n      }\n    };\n    var trimCount = function (text) {\n      var trimmedText = trim$3(text);\n      return {\n        count: text.length - trimmedText.length,\n        text: trimmedText\n      };\n    };\n    var deleteZwspChars = function (caretContainer) {\n      var idx;\n      while ((idx = caretContainer.data.lastIndexOf(ZWSP$1)) !== -1) {\n        caretContainer.deleteData(idx, 1);\n      }\n    };\n    var removeUnchanged = function (caretContainer, pos) {\n      remove$2(caretContainer);\n      return pos;\n    };\n    var removeTextAndReposition = function (caretContainer, pos) {\n      var before = trimCount(caretContainer.data.substr(0, pos.offset()));\n      var after = trimCount(caretContainer.data.substr(pos.offset()));\n      var text = before.text + after.text;\n      if (text.length > 0) {\n        deleteZwspChars(caretContainer);\n        return CaretPosition(caretContainer, pos.offset() - before.count);\n      } else {\n        return pos;\n      }\n    };\n    var removeElementAndReposition = function (caretContainer, pos) {\n      var parentNode = pos.container();\n      var newPosition = indexOf$2(from(parentNode.childNodes), caretContainer).map(function (index) {\n        return index < pos.offset() ? CaretPosition(parentNode, pos.offset() - 1) : pos;\n      }).getOr(pos);\n      remove$2(caretContainer);\n      return newPosition;\n    };\n    var removeTextCaretContainer = function (caretContainer, pos) {\n      return isText$2(caretContainer) && pos.container() === caretContainer ? removeTextAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);\n    };\n    var removeElementCaretContainer = function (caretContainer, pos) {\n      return pos.container() === caretContainer.parentNode ? removeElementAndReposition(caretContainer, pos) : removeUnchanged(caretContainer, pos);\n    };\n    var removeAndReposition = function (container, pos) {\n      return CaretPosition.isTextPosition(pos) ? removeTextCaretContainer(container, pos) : removeElementCaretContainer(container, pos);\n    };\n    var remove$2 = function (caretContainerNode) {\n      if (isElement$2(caretContainerNode) && isCaretContainer$2(caretContainerNode)) {\n        if (hasContent(caretContainerNode)) {\n          caretContainerNode.removeAttribute('data-mce-caret');\n        } else {\n          removeNode$1(caretContainerNode);\n        }\n      }\n      if (isText$2(caretContainerNode)) {\n        deleteZwspChars(caretContainerNode);\n        if (caretContainerNode.data.length === 0) {\n          removeNode$1(caretContainerNode);\n        }\n      }\n    };\n\n    var browser$2 = detect().browser;\n    var isContentEditableFalse$8 = isContentEditableFalse$b;\n    var isMedia$1 = isMedia$2;\n    var isTableCell$3 = isTableCell$5;\n    var inlineFakeCaretSelector = '*[contentEditable=false],video,audio,embed,object';\n    var getAbsoluteClientRect = function (root, element, before) {\n      var clientRect = collapse(element.getBoundingClientRect(), before);\n      var scrollX;\n      var scrollY;\n      if (root.tagName === 'BODY') {\n        var docElm = root.ownerDocument.documentElement;\n        scrollX = root.scrollLeft || docElm.scrollLeft;\n        scrollY = root.scrollTop || docElm.scrollTop;\n      } else {\n        var rootRect = root.getBoundingClientRect();\n        scrollX = root.scrollLeft - rootRect.left;\n        scrollY = root.scrollTop - rootRect.top;\n      }\n      clientRect.left += scrollX;\n      clientRect.right += scrollX;\n      clientRect.top += scrollY;\n      clientRect.bottom += scrollY;\n      clientRect.width = 1;\n      var margin = element.offsetWidth - element.clientWidth;\n      if (margin > 0) {\n        if (before) {\n          margin *= -1;\n        }\n        clientRect.left += margin;\n        clientRect.right += margin;\n      }\n      return clientRect;\n    };\n    var trimInlineCaretContainers = function (root) {\n      var fakeCaretTargetNodes = descendants(SugarElement.fromDom(root), inlineFakeCaretSelector);\n      for (var i = 0; i < fakeCaretTargetNodes.length; i++) {\n        var node = fakeCaretTargetNodes[i].dom;\n        var sibling = node.previousSibling;\n        if (endsWithCaretContainer$1(sibling)) {\n          var data = sibling.data;\n          if (data.length === 1) {\n            sibling.parentNode.removeChild(sibling);\n          } else {\n            sibling.deleteData(data.length - 1, 1);\n          }\n        }\n        sibling = node.nextSibling;\n        if (startsWithCaretContainer$1(sibling)) {\n          var data = sibling.data;\n          if (data.length === 1) {\n            sibling.parentNode.removeChild(sibling);\n          } else {\n            sibling.deleteData(0, 1);\n          }\n        }\n      }\n    };\n    var FakeCaret = function (editor, root, isBlock, hasFocus) {\n      var lastVisualCaret = value();\n      var cursorInterval;\n      var caretContainerNode;\n      var rootBlock = getForcedRootBlock(editor);\n      var caretBlock = rootBlock.length > 0 ? rootBlock : 'p';\n      var show = function (before, element) {\n        var rng;\n        hide();\n        if (isTableCell$3(element)) {\n          return null;\n        }\n        if (isBlock(element)) {\n          caretContainerNode = insertBlock$1(caretBlock, element, before);\n          var clientRect = getAbsoluteClientRect(root, element, before);\n          DomQuery(caretContainerNode).css('top', clientRect.top);\n          var caret = DomQuery('<div class=\"mce-visual-caret\" data-mce-bogus=\"all\"></div>').css(__assign({}, clientRect)).appendTo(root)[0];\n          lastVisualCaret.set({\n            caret: caret,\n            element: element,\n            before: before\n          });\n          if (before) {\n            DomQuery(caret).addClass('mce-visual-caret-before');\n          }\n          startBlink();\n          rng = element.ownerDocument.createRange();\n          rng.setStart(caretContainerNode, 0);\n          rng.setEnd(caretContainerNode, 0);\n        } else {\n          caretContainerNode = insertInline$1(element, before);\n          rng = element.ownerDocument.createRange();\n          if (isInlineFakeCaretTarget(caretContainerNode.nextSibling)) {\n            rng.setStart(caretContainerNode, 0);\n            rng.setEnd(caretContainerNode, 0);\n          } else {\n            rng.setStart(caretContainerNode, 1);\n            rng.setEnd(caretContainerNode, 1);\n          }\n          return rng;\n        }\n        return rng;\n      };\n      var hide = function () {\n        trimInlineCaretContainers(root);\n        if (caretContainerNode) {\n          remove$2(caretContainerNode);\n          caretContainerNode = null;\n        }\n        lastVisualCaret.on(function (caretState) {\n          DomQuery(caretState.caret).remove();\n          lastVisualCaret.clear();\n        });\n        if (cursorInterval) {\n          Delay.clearInterval(cursorInterval);\n          cursorInterval = undefined;\n        }\n      };\n      var startBlink = function () {\n        cursorInterval = Delay.setInterval(function () {\n          if (hasFocus()) {\n            DomQuery('div.mce-visual-caret', root).toggleClass('mce-visual-caret-hidden');\n          } else {\n            DomQuery('div.mce-visual-caret', root).addClass('mce-visual-caret-hidden');\n          }\n        }, 500);\n      };\n      var reposition = function () {\n        lastVisualCaret.on(function (caretState) {\n          var clientRect = getAbsoluteClientRect(root, caretState.element, caretState.before);\n          DomQuery(caretState.caret).css(__assign({}, clientRect));\n        });\n      };\n      var destroy = function () {\n        return Delay.clearInterval(cursorInterval);\n      };\n      var getCss = function () {\n        return '.mce-visual-caret {' + 'position: absolute;' + 'background-color: black;' + 'background-color: currentcolor;' + '}' + '.mce-visual-caret-hidden {' + 'display: none;' + '}' + '*[data-mce-caret] {' + 'position: absolute;' + 'left: -1000px;' + 'right: auto;' + 'top: 0;' + 'margin: 0;' + 'padding: 0;' + '}';\n      };\n      return {\n        show: show,\n        hide: hide,\n        getCss: getCss,\n        reposition: reposition,\n        destroy: destroy\n      };\n    };\n    var isFakeCaretTableBrowser = function () {\n      return browser$2.isIE() || browser$2.isEdge() || browser$2.isFirefox();\n    };\n    var isInlineFakeCaretTarget = function (node) {\n      return isContentEditableFalse$8(node) || isMedia$1(node);\n    };\n    var isFakeCaretTarget = function (node) {\n      return isInlineFakeCaretTarget(node) || isTable$3(node) && isFakeCaretTableBrowser();\n    };\n\n    var isContentEditableFalse$7 = isContentEditableFalse$b;\n    var isMedia = isMedia$2;\n    var isBlockLike = matchStyleValues('display', 'block table table-cell table-caption list-item');\n    var isCaretContainer = isCaretContainer$2;\n    var isCaretContainerBlock = isCaretContainerBlock$1;\n    var isElement$1 = isElement$5;\n    var isCaretCandidate$1 = isCaretCandidate$3;\n    var isForwards = function (direction) {\n      return direction > 0;\n    };\n    var isBackwards = function (direction) {\n      return direction < 0;\n    };\n    var skipCaretContainers = function (walk, shallow) {\n      var node;\n      while (node = walk(shallow)) {\n        if (!isCaretContainerBlock(node)) {\n          return node;\n        }\n      }\n      return null;\n    };\n    var findNode$1 = function (node, direction, predicateFn, rootNode, shallow) {\n      var walker = new DomTreeWalker(node, rootNode);\n      var isCefOrCaretContainer = isContentEditableFalse$7(node) || isCaretContainerBlock(node);\n      if (isBackwards(direction)) {\n        if (isCefOrCaretContainer) {\n          node = skipCaretContainers(walker.prev.bind(walker), true);\n          if (predicateFn(node)) {\n            return node;\n          }\n        }\n        while (node = skipCaretContainers(walker.prev.bind(walker), shallow)) {\n          if (predicateFn(node)) {\n            return node;\n          }\n        }\n      }\n      if (isForwards(direction)) {\n        if (isCefOrCaretContainer) {\n          node = skipCaretContainers(walker.next.bind(walker), true);\n          if (predicateFn(node)) {\n            return node;\n          }\n        }\n        while (node = skipCaretContainers(walker.next.bind(walker), shallow)) {\n          if (predicateFn(node)) {\n            return node;\n          }\n        }\n      }\n      return null;\n    };\n    var getParentBlock$2 = function (node, rootNode) {\n      while (node && node !== rootNode) {\n        if (isBlockLike(node)) {\n          return node;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n    var isInSameBlock = function (caretPosition1, caretPosition2, rootNode) {\n      return getParentBlock$2(caretPosition1.container(), rootNode) === getParentBlock$2(caretPosition2.container(), rootNode);\n    };\n    var getChildNodeAtRelativeOffset = function (relativeOffset, caretPosition) {\n      if (!caretPosition) {\n        return null;\n      }\n      var container = caretPosition.container();\n      var offset = caretPosition.offset();\n      if (!isElement$1(container)) {\n        return null;\n      }\n      return container.childNodes[offset + relativeOffset];\n    };\n    var beforeAfter = function (before, node) {\n      var range = node.ownerDocument.createRange();\n      if (before) {\n        range.setStartBefore(node);\n        range.setEndBefore(node);\n      } else {\n        range.setStartAfter(node);\n        range.setEndAfter(node);\n      }\n      return range;\n    };\n    var isNodesInSameBlock = function (root, node1, node2) {\n      return getParentBlock$2(node1, root) === getParentBlock$2(node2, root);\n    };\n    var lean = function (left, root, node) {\n      var siblingName = left ? 'previousSibling' : 'nextSibling';\n      while (node && node !== root) {\n        var sibling = node[siblingName];\n        if (isCaretContainer(sibling)) {\n          sibling = sibling[siblingName];\n        }\n        if (isContentEditableFalse$7(sibling) || isMedia(sibling)) {\n          if (isNodesInSameBlock(root, sibling, node)) {\n            return sibling;\n          }\n          break;\n        }\n        if (isCaretCandidate$1(sibling)) {\n          break;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n    var before$2 = curry(beforeAfter, true);\n    var after$2 = curry(beforeAfter, false);\n    var normalizeRange = function (direction, root, range) {\n      var node;\n      var leanLeft = curry(lean, true, root);\n      var leanRight = curry(lean, false, root);\n      var container = range.startContainer;\n      var offset = range.startOffset;\n      if (isCaretContainerBlock$1(container)) {\n        if (!isElement$1(container)) {\n          container = container.parentNode;\n        }\n        var location_1 = container.getAttribute('data-mce-caret');\n        if (location_1 === 'before') {\n          node = container.nextSibling;\n          if (isFakeCaretTarget(node)) {\n            return before$2(node);\n          }\n        }\n        if (location_1 === 'after') {\n          node = container.previousSibling;\n          if (isFakeCaretTarget(node)) {\n            return after$2(node);\n          }\n        }\n      }\n      if (!range.collapsed) {\n        return range;\n      }\n      if (isText$7(container)) {\n        if (isCaretContainer(container)) {\n          if (direction === 1) {\n            node = leanRight(container);\n            if (node) {\n              return before$2(node);\n            }\n            node = leanLeft(container);\n            if (node) {\n              return after$2(node);\n            }\n          }\n          if (direction === -1) {\n            node = leanLeft(container);\n            if (node) {\n              return after$2(node);\n            }\n            node = leanRight(container);\n            if (node) {\n              return before$2(node);\n            }\n          }\n          return range;\n        }\n        if (endsWithCaretContainer$1(container) && offset >= container.data.length - 1) {\n          if (direction === 1) {\n            node = leanRight(container);\n            if (node) {\n              return before$2(node);\n            }\n          }\n          return range;\n        }\n        if (startsWithCaretContainer$1(container) && offset <= 1) {\n          if (direction === -1) {\n            node = leanLeft(container);\n            if (node) {\n              return after$2(node);\n            }\n          }\n          return range;\n        }\n        if (offset === container.data.length) {\n          node = leanRight(container);\n          if (node) {\n            return before$2(node);\n          }\n          return range;\n        }\n        if (offset === 0) {\n          node = leanLeft(container);\n          if (node) {\n            return after$2(node);\n          }\n          return range;\n        }\n      }\n      return range;\n    };\n    var getRelativeCefElm = function (forward, caretPosition) {\n      return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, caretPosition)).filter(isContentEditableFalse$7);\n    };\n    var getNormalizedRangeEndPoint = function (direction, root, range) {\n      var normalizedRange = normalizeRange(direction, root, range);\n      if (direction === -1) {\n        return CaretPosition.fromRangeStart(normalizedRange);\n      }\n      return CaretPosition.fromRangeEnd(normalizedRange);\n    };\n    var getElementFromPosition = function (pos) {\n      return Optional.from(pos.getNode()).map(SugarElement.fromDom);\n    };\n    var getElementFromPrevPosition = function (pos) {\n      return Optional.from(pos.getNode(true)).map(SugarElement.fromDom);\n    };\n    var getVisualCaretPosition = function (walkFn, caretPosition) {\n      while (caretPosition = walkFn(caretPosition)) {\n        if (caretPosition.isVisible()) {\n          return caretPosition;\n        }\n      }\n      return caretPosition;\n    };\n    var isMoveInsideSameBlock = function (from, to) {\n      var inSameBlock = isInSameBlock(from, to);\n      if (!inSameBlock && isBr$5(from.getNode())) {\n        return true;\n      }\n      return inSameBlock;\n    };\n\n    var HDirection;\n    (function (HDirection) {\n      HDirection[HDirection['Backwards'] = -1] = 'Backwards';\n      HDirection[HDirection['Forwards'] = 1] = 'Forwards';\n    }(HDirection || (HDirection = {})));\n    var isContentEditableFalse$6 = isContentEditableFalse$b;\n    var isText$1 = isText$7;\n    var isElement = isElement$5;\n    var isBr$1 = isBr$5;\n    var isCaretCandidate = isCaretCandidate$3;\n    var isAtomic = isAtomic$1;\n    var isEditableCaretCandidate = isEditableCaretCandidate$1;\n    var getParents$3 = function (node, root) {\n      var parents = [];\n      while (node && node !== root) {\n        parents.push(node);\n        node = node.parentNode;\n      }\n      return parents;\n    };\n    var nodeAtIndex = function (container, offset) {\n      if (container.hasChildNodes() && offset < container.childNodes.length) {\n        return container.childNodes[offset];\n      }\n      return null;\n    };\n    var getCaretCandidatePosition = function (direction, node) {\n      if (isForwards(direction)) {\n        if (isCaretCandidate(node.previousSibling) && !isText$1(node.previousSibling)) {\n          return CaretPosition.before(node);\n        }\n        if (isText$1(node)) {\n          return CaretPosition(node, 0);\n        }\n      }\n      if (isBackwards(direction)) {\n        if (isCaretCandidate(node.nextSibling) && !isText$1(node.nextSibling)) {\n          return CaretPosition.after(node);\n        }\n        if (isText$1(node)) {\n          return CaretPosition(node, node.data.length);\n        }\n      }\n      if (isBackwards(direction)) {\n        if (isBr$1(node)) {\n          return CaretPosition.before(node);\n        }\n        return CaretPosition.after(node);\n      }\n      return CaretPosition.before(node);\n    };\n    var moveForwardFromBr = function (root, nextNode) {\n      var nextSibling = nextNode.nextSibling;\n      if (nextSibling && isCaretCandidate(nextSibling)) {\n        if (isText$1(nextSibling)) {\n          return CaretPosition(nextSibling, 0);\n        } else {\n          return CaretPosition.before(nextSibling);\n        }\n      } else {\n        return findCaretPosition$1(HDirection.Forwards, CaretPosition.after(nextNode), root);\n      }\n    };\n    var findCaretPosition$1 = function (direction, startPos, root) {\n      var node;\n      var nextNode;\n      var innerNode;\n      var caretPosition;\n      if (!isElement(root) || !startPos) {\n        return null;\n      }\n      if (startPos.isEqual(CaretPosition.after(root)) && root.lastChild) {\n        caretPosition = CaretPosition.after(root.lastChild);\n        if (isBackwards(direction) && isCaretCandidate(root.lastChild) && isElement(root.lastChild)) {\n          return isBr$1(root.lastChild) ? CaretPosition.before(root.lastChild) : caretPosition;\n        }\n      } else {\n        caretPosition = startPos;\n      }\n      var container = caretPosition.container();\n      var offset = caretPosition.offset();\n      if (isText$1(container)) {\n        if (isBackwards(direction) && offset > 0) {\n          return CaretPosition(container, --offset);\n        }\n        if (isForwards(direction) && offset < container.length) {\n          return CaretPosition(container, ++offset);\n        }\n        node = container;\n      } else {\n        if (isBackwards(direction) && offset > 0) {\n          nextNode = nodeAtIndex(container, offset - 1);\n          if (isCaretCandidate(nextNode)) {\n            if (!isAtomic(nextNode)) {\n              innerNode = findNode$1(nextNode, direction, isEditableCaretCandidate, nextNode);\n              if (innerNode) {\n                if (isText$1(innerNode)) {\n                  return CaretPosition(innerNode, innerNode.data.length);\n                }\n                return CaretPosition.after(innerNode);\n              }\n            }\n            if (isText$1(nextNode)) {\n              return CaretPosition(nextNode, nextNode.data.length);\n            }\n            return CaretPosition.before(nextNode);\n          }\n        }\n        if (isForwards(direction) && offset < container.childNodes.length) {\n          nextNode = nodeAtIndex(container, offset);\n          if (isCaretCandidate(nextNode)) {\n            if (isBr$1(nextNode)) {\n              return moveForwardFromBr(root, nextNode);\n            }\n            if (!isAtomic(nextNode)) {\n              innerNode = findNode$1(nextNode, direction, isEditableCaretCandidate, nextNode);\n              if (innerNode) {\n                if (isText$1(innerNode)) {\n                  return CaretPosition(innerNode, 0);\n                }\n                return CaretPosition.before(innerNode);\n              }\n            }\n            if (isText$1(nextNode)) {\n              return CaretPosition(nextNode, 0);\n            }\n            return CaretPosition.after(nextNode);\n          }\n        }\n        node = nextNode ? nextNode : caretPosition.getNode();\n      }\n      if (isForwards(direction) && caretPosition.isAtEnd() || isBackwards(direction) && caretPosition.isAtStart()) {\n        node = findNode$1(node, direction, always, root, true);\n        if (isEditableCaretCandidate(node, root)) {\n          return getCaretCandidatePosition(direction, node);\n        }\n      }\n      nextNode = findNode$1(node, direction, isEditableCaretCandidate, root);\n      var rootContentEditableFalseElm = last$1(filter$4(getParents$3(container, root), isContentEditableFalse$6));\n      if (rootContentEditableFalseElm && (!nextNode || !rootContentEditableFalseElm.contains(nextNode))) {\n        if (isForwards(direction)) {\n          caretPosition = CaretPosition.after(rootContentEditableFalseElm);\n        } else {\n          caretPosition = CaretPosition.before(rootContentEditableFalseElm);\n        }\n        return caretPosition;\n      }\n      if (nextNode) {\n        return getCaretCandidatePosition(direction, nextNode);\n      }\n      return null;\n    };\n    var CaretWalker = function (root) {\n      return {\n        next: function (caretPosition) {\n          return findCaretPosition$1(HDirection.Forwards, caretPosition, root);\n        },\n        prev: function (caretPosition) {\n          return findCaretPosition$1(HDirection.Backwards, caretPosition, root);\n        }\n      };\n    };\n\n    var walkToPositionIn = function (forward, root, start) {\n      var position = forward ? CaretPosition.before(start) : CaretPosition.after(start);\n      return fromPosition(forward, root, position);\n    };\n    var afterElement = function (node) {\n      return isBr$5(node) ? CaretPosition.before(node) : CaretPosition.after(node);\n    };\n    var isBeforeOrStart = function (position) {\n      if (CaretPosition.isTextPosition(position)) {\n        return position.offset() === 0;\n      } else {\n        return isCaretCandidate$3(position.getNode());\n      }\n    };\n    var isAfterOrEnd = function (position) {\n      if (CaretPosition.isTextPosition(position)) {\n        var container = position.container();\n        return position.offset() === container.data.length;\n      } else {\n        return isCaretCandidate$3(position.getNode(true));\n      }\n    };\n    var isBeforeAfterSameElement = function (from, to) {\n      return !CaretPosition.isTextPosition(from) && !CaretPosition.isTextPosition(to) && from.getNode() === to.getNode(true);\n    };\n    var isAtBr = function (position) {\n      return !CaretPosition.isTextPosition(position) && isBr$5(position.getNode());\n    };\n    var shouldSkipPosition = function (forward, from, to) {\n      if (forward) {\n        return !isBeforeAfterSameElement(from, to) && !isAtBr(from) && isAfterOrEnd(from) && isBeforeOrStart(to);\n      } else {\n        return !isBeforeAfterSameElement(to, from) && isBeforeOrStart(from) && isAfterOrEnd(to);\n      }\n    };\n    var fromPosition = function (forward, root, pos) {\n      var walker = CaretWalker(root);\n      return Optional.from(forward ? walker.next(pos) : walker.prev(pos));\n    };\n    var navigate = function (forward, root, from) {\n      return fromPosition(forward, root, from).bind(function (to) {\n        if (isInSameBlock(from, to, root) && shouldSkipPosition(forward, from, to)) {\n          return fromPosition(forward, root, to);\n        } else {\n          return Optional.some(to);\n        }\n      });\n    };\n    var navigateIgnore = function (forward, root, from, ignoreFilter) {\n      return navigate(forward, root, from).bind(function (pos) {\n        return ignoreFilter(pos) ? navigateIgnore(forward, root, pos, ignoreFilter) : Optional.some(pos);\n      });\n    };\n    var positionIn = function (forward, element) {\n      var startNode = forward ? element.firstChild : element.lastChild;\n      if (isText$7(startNode)) {\n        return Optional.some(CaretPosition(startNode, forward ? 0 : startNode.data.length));\n      } else if (startNode) {\n        if (isCaretCandidate$3(startNode)) {\n          return Optional.some(forward ? CaretPosition.before(startNode) : afterElement(startNode));\n        } else {\n          return walkToPositionIn(forward, element, startNode);\n        }\n      } else {\n        return Optional.none();\n      }\n    };\n    var nextPosition = curry(fromPosition, true);\n    var prevPosition = curry(fromPosition, false);\n    var firstPositionIn = curry(positionIn, true);\n    var lastPositionIn = curry(positionIn, false);\n\n    var CARET_ID$1 = '_mce_caret';\n    var isCaretNode = function (node) {\n      return isElement$5(node) && node.id === CARET_ID$1;\n    };\n    var getParentCaretContainer = function (body, node) {\n      while (node && node !== body) {\n        if (node.id === CARET_ID$1) {\n          return node;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n\n    var isStringPathBookmark = function (bookmark) {\n      return isString$1(bookmark.start);\n    };\n    var isRangeBookmark = function (bookmark) {\n      return has$2(bookmark, 'rng');\n    };\n    var isIdBookmark = function (bookmark) {\n      return has$2(bookmark, 'id');\n    };\n    var isIndexBookmark = function (bookmark) {\n      return has$2(bookmark, 'name');\n    };\n    var isPathBookmark = function (bookmark) {\n      return Tools.isArray(bookmark.start);\n    };\n\n    var addBogus = function (dom, node) {\n      if (isElement$5(node) && dom.isBlock(node) && !node.innerHTML && !Env.ie) {\n        node.innerHTML = '<br data-mce-bogus=\"1\" />';\n      }\n      return node;\n    };\n    var resolveCaretPositionBookmark = function (dom, bookmark) {\n      var pos;\n      var rng = dom.createRng();\n      pos = resolve$2(dom.getRoot(), bookmark.start);\n      rng.setStart(pos.container(), pos.offset());\n      pos = resolve$2(dom.getRoot(), bookmark.end);\n      rng.setEnd(pos.container(), pos.offset());\n      return rng;\n    };\n    var insertZwsp = function (node, rng) {\n      var textNode = node.ownerDocument.createTextNode(ZWSP$1);\n      node.appendChild(textNode);\n      rng.setStart(textNode, 0);\n      rng.setEnd(textNode, 0);\n    };\n    var isEmpty$1 = function (node) {\n      return node.hasChildNodes() === false;\n    };\n    var tryFindRangePosition = function (node, rng) {\n      return lastPositionIn(node).fold(never, function (pos) {\n        rng.setStart(pos.container(), pos.offset());\n        rng.setEnd(pos.container(), pos.offset());\n        return true;\n      });\n    };\n    var padEmptyCaretContainer = function (root, node, rng) {\n      if (isEmpty$1(node) && getParentCaretContainer(root, node)) {\n        insertZwsp(node, rng);\n        return true;\n      } else {\n        return false;\n      }\n    };\n    var setEndPoint = function (dom, start, bookmark, rng) {\n      var point = bookmark[start ? 'start' : 'end'];\n      var i, node, offset, children;\n      var root = dom.getRoot();\n      if (point) {\n        offset = point[0];\n        for (node = root, i = point.length - 1; i >= 1; i--) {\n          children = node.childNodes;\n          if (padEmptyCaretContainer(root, node, rng)) {\n            return true;\n          }\n          if (point[i] > children.length - 1) {\n            if (padEmptyCaretContainer(root, node, rng)) {\n              return true;\n            }\n            return tryFindRangePosition(node, rng);\n          }\n          node = children[point[i]];\n        }\n        if (node.nodeType === 3) {\n          offset = Math.min(point[0], node.nodeValue.length);\n        }\n        if (node.nodeType === 1) {\n          offset = Math.min(point[0], node.childNodes.length);\n        }\n        if (start) {\n          rng.setStart(node, offset);\n        } else {\n          rng.setEnd(node, offset);\n        }\n      }\n      return true;\n    };\n    var isValidTextNode = function (node) {\n      return isText$7(node) && node.data.length > 0;\n    };\n    var restoreEndPoint = function (dom, suffix, bookmark) {\n      var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev;\n      var keep = bookmark.keep;\n      var container, offset;\n      if (marker) {\n        node = marker.parentNode;\n        if (suffix === 'start') {\n          if (!keep) {\n            idx = dom.nodeIndex(marker);\n          } else {\n            if (marker.hasChildNodes()) {\n              node = marker.firstChild;\n              idx = 1;\n            } else if (isValidTextNode(marker.nextSibling)) {\n              node = marker.nextSibling;\n              idx = 0;\n            } else if (isValidTextNode(marker.previousSibling)) {\n              node = marker.previousSibling;\n              idx = marker.previousSibling.data.length;\n            } else {\n              node = marker.parentNode;\n              idx = dom.nodeIndex(marker) + 1;\n            }\n          }\n          container = node;\n          offset = idx;\n        } else {\n          if (!keep) {\n            idx = dom.nodeIndex(marker);\n          } else {\n            if (marker.hasChildNodes()) {\n              node = marker.firstChild;\n              idx = 1;\n            } else if (isValidTextNode(marker.previousSibling)) {\n              node = marker.previousSibling;\n              idx = marker.previousSibling.data.length;\n            } else {\n              node = marker.parentNode;\n              idx = dom.nodeIndex(marker);\n            }\n          }\n          container = node;\n          offset = idx;\n        }\n        if (!keep) {\n          prev = marker.previousSibling;\n          next = marker.nextSibling;\n          Tools.each(Tools.grep(marker.childNodes), function (node) {\n            if (isText$7(node)) {\n              node.nodeValue = node.nodeValue.replace(/\\uFEFF/g, '');\n            }\n          });\n          while (marker = dom.get(bookmark.id + '_' + suffix)) {\n            dom.remove(marker, true);\n          }\n          if (prev && next && prev.nodeType === next.nodeType && isText$7(prev) && !Env.opera) {\n            idx = prev.nodeValue.length;\n            prev.appendData(next.nodeValue);\n            dom.remove(next);\n            container = prev;\n            offset = idx;\n          }\n        }\n        return Optional.some(CaretPosition(container, offset));\n      } else {\n        return Optional.none();\n      }\n    };\n    var resolvePaths = function (dom, bookmark) {\n      var rng = dom.createRng();\n      if (setEndPoint(dom, true, bookmark, rng) && setEndPoint(dom, false, bookmark, rng)) {\n        return Optional.some(rng);\n      } else {\n        return Optional.none();\n      }\n    };\n    var resolveId = function (dom, bookmark) {\n      var startPos = restoreEndPoint(dom, 'start', bookmark);\n      var endPos = restoreEndPoint(dom, 'end', bookmark);\n      return lift2(startPos, endPos.or(startPos), function (spos, epos) {\n        var rng = dom.createRng();\n        rng.setStart(addBogus(dom, spos.container()), spos.offset());\n        rng.setEnd(addBogus(dom, epos.container()), epos.offset());\n        return rng;\n      });\n    };\n    var resolveIndex = function (dom, bookmark) {\n      return Optional.from(dom.select(bookmark.name)[bookmark.index]).map(function (elm) {\n        var rng = dom.createRng();\n        rng.selectNode(elm);\n        return rng;\n      });\n    };\n    var resolve$1 = function (selection, bookmark) {\n      var dom = selection.dom;\n      if (bookmark) {\n        if (isPathBookmark(bookmark)) {\n          return resolvePaths(dom, bookmark);\n        } else if (isStringPathBookmark(bookmark)) {\n          return Optional.some(resolveCaretPositionBookmark(dom, bookmark));\n        } else if (isIdBookmark(bookmark)) {\n          return resolveId(dom, bookmark);\n        } else if (isIndexBookmark(bookmark)) {\n          return resolveIndex(dom, bookmark);\n        } else if (isRangeBookmark(bookmark)) {\n          return Optional.some(bookmark.rng);\n        }\n      }\n      return Optional.none();\n    };\n\n    var getBookmark$1 = function (selection, type, normalized) {\n      return getBookmark$2(selection, type, normalized);\n    };\n    var moveToBookmark = function (selection, bookmark) {\n      resolve$1(selection, bookmark).each(function (rng) {\n        selection.setRng(rng);\n      });\n    };\n    var isBookmarkNode$1 = function (node) {\n      return isElement$5(node) && node.tagName === 'SPAN' && node.getAttribute('data-mce-type') === 'bookmark';\n    };\n\n    var is = function (expected) {\n      return function (actual) {\n        return expected === actual;\n      };\n    };\n    var isNbsp = is(nbsp);\n    var isWhiteSpace = function (chr) {\n      return chr !== '' && ' \\f\\n\\r\\t\\x0B'.indexOf(chr) !== -1;\n    };\n    var isContent = function (chr) {\n      return !isWhiteSpace(chr) && !isNbsp(chr);\n    };\n\n    var isNode = function (node) {\n      return !!node.nodeType;\n    };\n    var isInlineBlock = function (node) {\n      return node && /^(IMG)$/.test(node.nodeName);\n    };\n    var moveStart = function (dom, selection, rng) {\n      var offset = rng.startOffset;\n      var container = rng.startContainer;\n      if (container === rng.endContainer) {\n        if (isInlineBlock(container.childNodes[offset])) {\n          return;\n        }\n      }\n      if (isElement$5(container)) {\n        var nodes = container.childNodes;\n        var walker = void 0;\n        if (offset < nodes.length) {\n          container = nodes[offset];\n          walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock));\n        } else {\n          container = nodes[nodes.length - 1];\n          walker = new DomTreeWalker(container, dom.getParent(container, dom.isBlock));\n          walker.next(true);\n        }\n        for (var node = walker.current(); node; node = walker.next()) {\n          if (isText$7(node) && !isWhiteSpaceNode$1(node)) {\n            rng.setStart(node, 0);\n            selection.setRng(rng);\n            return;\n          }\n        }\n      }\n    };\n    var getNonWhiteSpaceSibling = function (node, next, inc) {\n      if (node) {\n        var nextName = next ? 'nextSibling' : 'previousSibling';\n        for (node = inc ? node : node[nextName]; node; node = node[nextName]) {\n          if (isElement$5(node) || !isWhiteSpaceNode$1(node)) {\n            return node;\n          }\n        }\n      }\n    };\n    var isTextBlock$1 = function (editor, name) {\n      if (isNode(name)) {\n        name = name.nodeName;\n      }\n      return !!editor.schema.getTextBlockElements()[name.toLowerCase()];\n    };\n    var isValid = function (ed, parent, child) {\n      return ed.schema.isValidChild(parent, child);\n    };\n    var isWhiteSpaceNode$1 = function (node, allowSpaces) {\n      if (allowSpaces === void 0) {\n        allowSpaces = false;\n      }\n      if (isNonNullable(node) && isText$7(node)) {\n        var data = allowSpaces ? node.data.replace(/ /g, '\\xA0') : node.data;\n        return isWhitespaceText(data);\n      } else {\n        return false;\n      }\n    };\n    var isEmptyTextNode$1 = function (node) {\n      return isNonNullable(node) && isText$7(node) && node.length === 0;\n    };\n    var replaceVars = function (value, vars) {\n      if (isFunction(value)) {\n        value = value(vars);\n      } else if (isNonNullable(vars)) {\n        value = value.replace(/%(\\w+)/g, function (str, name) {\n          return vars[name] || str;\n        });\n      }\n      return value;\n    };\n    var isEq$5 = function (str1, str2) {\n      str1 = str1 || '';\n      str2 = str2 || '';\n      str1 = '' + (str1.nodeName || str1);\n      str2 = '' + (str2.nodeName || str2);\n      return str1.toLowerCase() === str2.toLowerCase();\n    };\n    var normalizeStyleValue = function (dom, value, name) {\n      if (name === 'color' || name === 'backgroundColor') {\n        value = dom.toHex(value);\n      }\n      if (name === 'fontWeight' && value === 700) {\n        value = 'bold';\n      }\n      if (name === 'fontFamily') {\n        value = value.replace(/[\\'\\\"]/g, '').replace(/,\\s+/g, ',');\n      }\n      return '' + value;\n    };\n    var getStyle = function (dom, node, name) {\n      return normalizeStyleValue(dom, dom.getStyle(node, name), name);\n    };\n    var getTextDecoration = function (dom, node) {\n      var decoration;\n      dom.getParent(node, function (n) {\n        decoration = dom.getStyle(n, 'text-decoration');\n        return decoration && decoration !== 'none';\n      });\n      return decoration;\n    };\n    var getParents$2 = function (dom, node, selector) {\n      return dom.getParents(node, selector, dom.getRoot());\n    };\n    var isVariableFormatName = function (editor, formatName) {\n      var hasVariableValues = function (format) {\n        var isVariableValue = function (val) {\n          return val.length > 1 && val.charAt(0) === '%';\n        };\n        return exists([\n          'styles',\n          'attributes'\n        ], function (key) {\n          return get$9(format, key).exists(function (field) {\n            var fieldValues = isArray$1(field) ? field : values(field);\n            return exists(fieldValues, isVariableValue);\n          });\n        });\n      };\n      return exists(editor.formatter.get(formatName), hasVariableValues);\n    };\n    var areSimilarFormats = function (editor, formatName, otherFormatName) {\n      var validKeys = [\n        'inline',\n        'block',\n        'selector',\n        'attributes',\n        'styles',\n        'classes'\n      ];\n      var filterObj = function (format) {\n        return filter$3(format, function (_, key) {\n          return exists(validKeys, function (validKey) {\n            return validKey === key;\n          });\n        });\n      };\n      return exists(editor.formatter.get(formatName), function (fmt1) {\n        var filteredFmt1 = filterObj(fmt1);\n        return exists(editor.formatter.get(otherFormatName), function (fmt2) {\n          var filteredFmt2 = filterObj(fmt2);\n          return equal$1(filteredFmt1, filteredFmt2);\n        });\n      });\n    };\n    var isBlockFormat = function (format) {\n      return hasNonNullableKey(format, 'block');\n    };\n    var isSelectorFormat = function (format) {\n      return hasNonNullableKey(format, 'selector');\n    };\n    var isInlineFormat = function (format) {\n      return hasNonNullableKey(format, 'inline');\n    };\n    var isMixedFormat = function (format) {\n      return isSelectorFormat(format) && isInlineFormat(format) && is$1(get$9(format, 'mixed'), true);\n    };\n    var shouldExpandToSelector = function (format) {\n      return isSelectorFormat(format) && format.expand !== false && !isInlineFormat(format);\n    };\n\n    var isBookmarkNode = isBookmarkNode$1;\n    var getParents$1 = getParents$2;\n    var isWhiteSpaceNode = isWhiteSpaceNode$1;\n    var isTextBlock = isTextBlock$1;\n    var isBogusBr = function (node) {\n      return isBr$5(node) && node.getAttribute('data-mce-bogus') && !node.nextSibling;\n    };\n    var findParentContentEditable = function (dom, node) {\n      var parent = node;\n      while (parent) {\n        if (isElement$5(parent) && dom.getContentEditable(parent)) {\n          return dom.getContentEditable(parent) === 'false' ? parent : node;\n        }\n        parent = parent.parentNode;\n      }\n      return node;\n    };\n    var walkText = function (start, node, offset, predicate) {\n      var str = node.data;\n      for (var i = offset; start ? i >= 0 : i < str.length; start ? i-- : i++) {\n        if (predicate(str.charAt(i))) {\n          return start ? i + 1 : i;\n        }\n      }\n      return -1;\n    };\n    var findSpace = function (start, node, offset) {\n      return walkText(start, node, offset, function (c) {\n        return isNbsp(c) || isWhiteSpace(c);\n      });\n    };\n    var findContent = function (start, node, offset) {\n      return walkText(start, node, offset, isContent);\n    };\n    var findWordEndPoint = function (dom, body, container, offset, start, includeTrailingSpaces) {\n      var lastTextNode;\n      var rootNode = dom.getParent(container, dom.isBlock) || body;\n      var walk = function (container, offset, pred) {\n        var textSeeker = TextSeeker(dom);\n        var walker = start ? textSeeker.backwards : textSeeker.forwards;\n        return Optional.from(walker(container, offset, function (text, textOffset) {\n          if (isBookmarkNode(text.parentNode)) {\n            return -1;\n          } else {\n            lastTextNode = text;\n            return pred(start, text, textOffset);\n          }\n        }, rootNode));\n      };\n      var spaceResult = walk(container, offset, findSpace);\n      return spaceResult.bind(function (result) {\n        return includeTrailingSpaces ? walk(result.container, result.offset + (start ? -1 : 0), findContent) : Optional.some(result);\n      }).orThunk(function () {\n        return lastTextNode ? Optional.some({\n          container: lastTextNode,\n          offset: start ? 0 : lastTextNode.length\n        }) : Optional.none();\n      });\n    };\n    var findSelectorEndPoint = function (dom, formatList, rng, container, siblingName) {\n      if (isText$7(container) && isEmpty$3(container.data) && container[siblingName]) {\n        container = container[siblingName];\n      }\n      var parents = getParents$1(dom, container);\n      for (var i = 0; i < parents.length; i++) {\n        for (var y = 0; y < formatList.length; y++) {\n          var curFormat = formatList[y];\n          if (isNonNullable(curFormat.collapsed) && curFormat.collapsed !== rng.collapsed) {\n            continue;\n          }\n          if (isSelectorFormat(curFormat) && dom.is(parents[i], curFormat.selector)) {\n            return parents[i];\n          }\n        }\n      }\n      return container;\n    };\n    var findBlockEndPoint = function (editor, formatList, container, siblingName) {\n      var node = container;\n      var dom = editor.dom;\n      var root = dom.getRoot();\n      var format = formatList[0];\n      if (isBlockFormat(format)) {\n        node = format.wrapper ? null : dom.getParent(container, format.block, root);\n      }\n      if (!node) {\n        var scopeRoot = dom.getParent(container, 'LI,TD,TH');\n        node = dom.getParent(isText$7(container) ? container.parentNode : container, function (node) {\n          return node !== root && isTextBlock(editor, node);\n        }, scopeRoot);\n      }\n      if (node && isBlockFormat(format) && format.wrapper) {\n        node = getParents$1(dom, node, 'ul,ol').reverse()[0] || node;\n      }\n      if (!node) {\n        node = container;\n        while (node[siblingName] && !dom.isBlock(node[siblingName])) {\n          node = node[siblingName];\n          if (isEq$5(node, 'br')) {\n            break;\n          }\n        }\n      }\n      return node || container;\n    };\n    var isAtBlockBoundary$1 = function (dom, root, container, siblingName) {\n      var parent = container.parentNode;\n      if (isNonNullable(container[siblingName])) {\n        return false;\n      } else if (parent === root || isNullable(parent) || dom.isBlock(parent)) {\n        return true;\n      } else {\n        return isAtBlockBoundary$1(dom, root, parent, siblingName);\n      }\n    };\n    var findParentContainer = function (dom, formatList, container, offset, start) {\n      var parent = container;\n      var siblingName = start ? 'previousSibling' : 'nextSibling';\n      var root = dom.getRoot();\n      if (isText$7(container) && !isWhiteSpaceNode(container)) {\n        if (start ? offset > 0 : offset < container.data.length) {\n          return container;\n        }\n      }\n      while (true) {\n        if (!formatList[0].block_expand && dom.isBlock(parent)) {\n          return parent;\n        }\n        for (var sibling = parent[siblingName]; sibling; sibling = sibling[siblingName]) {\n          var allowSpaces = isText$7(sibling) && !isAtBlockBoundary$1(dom, root, sibling, siblingName);\n          if (!isBookmarkNode(sibling) && !isBogusBr(sibling) && !isWhiteSpaceNode(sibling, allowSpaces)) {\n            return parent;\n          }\n        }\n        if (parent === root || parent.parentNode === root) {\n          container = parent;\n          break;\n        }\n        parent = parent.parentNode;\n      }\n      return container;\n    };\n    var isSelfOrParentBookmark = function (container) {\n      return isBookmarkNode(container.parentNode) || isBookmarkNode(container);\n    };\n    var expandRng = function (editor, rng, formatList, includeTrailingSpace) {\n      if (includeTrailingSpace === void 0) {\n        includeTrailingSpace = false;\n      }\n      var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;\n      var dom = editor.dom;\n      var format = formatList[0];\n      if (isElement$5(startContainer) && startContainer.hasChildNodes()) {\n        startContainer = getNode$1(startContainer, startOffset);\n        if (isText$7(startContainer)) {\n          startOffset = 0;\n        }\n      }\n      if (isElement$5(endContainer) && endContainer.hasChildNodes()) {\n        endContainer = getNode$1(endContainer, rng.collapsed ? endOffset : endOffset - 1);\n        if (isText$7(endContainer)) {\n          endOffset = endContainer.nodeValue.length;\n        }\n      }\n      startContainer = findParentContentEditable(dom, startContainer);\n      endContainer = findParentContentEditable(dom, endContainer);\n      if (isSelfOrParentBookmark(startContainer)) {\n        startContainer = isBookmarkNode(startContainer) ? startContainer : startContainer.parentNode;\n        if (rng.collapsed) {\n          startContainer = startContainer.previousSibling || startContainer;\n        } else {\n          startContainer = startContainer.nextSibling || startContainer;\n        }\n        if (isText$7(startContainer)) {\n          startOffset = rng.collapsed ? startContainer.length : 0;\n        }\n      }\n      if (isSelfOrParentBookmark(endContainer)) {\n        endContainer = isBookmarkNode(endContainer) ? endContainer : endContainer.parentNode;\n        if (rng.collapsed) {\n          endContainer = endContainer.nextSibling || endContainer;\n        } else {\n          endContainer = endContainer.previousSibling || endContainer;\n        }\n        if (isText$7(endContainer)) {\n          endOffset = rng.collapsed ? 0 : endContainer.length;\n        }\n      }\n      if (rng.collapsed) {\n        var startPoint = findWordEndPoint(dom, editor.getBody(), startContainer, startOffset, true, includeTrailingSpace);\n        startPoint.each(function (_a) {\n          var container = _a.container, offset = _a.offset;\n          startContainer = container;\n          startOffset = offset;\n        });\n        var endPoint = findWordEndPoint(dom, editor.getBody(), endContainer, endOffset, false, includeTrailingSpace);\n        endPoint.each(function (_a) {\n          var container = _a.container, offset = _a.offset;\n          endContainer = container;\n          endOffset = offset;\n        });\n      }\n      if (isInlineFormat(format) || format.block_expand) {\n        if (!isInlineFormat(format) || (!isText$7(startContainer) || startOffset === 0)) {\n          startContainer = findParentContainer(dom, formatList, startContainer, startOffset, true);\n        }\n        if (!isInlineFormat(format) || (!isText$7(endContainer) || endOffset === endContainer.nodeValue.length)) {\n          endContainer = findParentContainer(dom, formatList, endContainer, endOffset, false);\n        }\n      }\n      if (shouldExpandToSelector(format)) {\n        startContainer = findSelectorEndPoint(dom, formatList, rng, startContainer, 'previousSibling');\n        endContainer = findSelectorEndPoint(dom, formatList, rng, endContainer, 'nextSibling');\n      }\n      if (isBlockFormat(format) || isSelectorFormat(format)) {\n        startContainer = findBlockEndPoint(editor, formatList, startContainer, 'previousSibling');\n        endContainer = findBlockEndPoint(editor, formatList, endContainer, 'nextSibling');\n        if (isBlockFormat(format)) {\n          if (!dom.isBlock(startContainer)) {\n            startContainer = findParentContainer(dom, formatList, startContainer, startOffset, true);\n          }\n          if (!dom.isBlock(endContainer)) {\n            endContainer = findParentContainer(dom, formatList, endContainer, endOffset, false);\n          }\n        }\n      }\n      if (isElement$5(startContainer)) {\n        startOffset = dom.nodeIndex(startContainer);\n        startContainer = startContainer.parentNode;\n      }\n      if (isElement$5(endContainer)) {\n        endOffset = dom.nodeIndex(endContainer) + 1;\n        endContainer = endContainer.parentNode;\n      }\n      return {\n        startContainer: startContainer,\n        startOffset: startOffset,\n        endContainer: endContainer,\n        endOffset: endOffset\n      };\n    };\n\n    var walk$2 = function (dom, rng, callback) {\n      var startOffset = rng.startOffset;\n      var startContainer = getNode$1(rng.startContainer, startOffset);\n      var endOffset = rng.endOffset;\n      var endContainer = getNode$1(rng.endContainer, endOffset - 1);\n      var exclude = function (nodes) {\n        var firstNode = nodes[0];\n        if (isText$7(firstNode) && firstNode === startContainer && startOffset >= firstNode.data.length) {\n          nodes.splice(0, 1);\n        }\n        var lastNode = nodes[nodes.length - 1];\n        if (endOffset === 0 && nodes.length > 0 && lastNode === endContainer && isText$7(lastNode)) {\n          nodes.splice(nodes.length - 1, 1);\n        }\n        return nodes;\n      };\n      var collectSiblings = function (node, name, endNode) {\n        var siblings = [];\n        for (; node && node !== endNode; node = node[name]) {\n          siblings.push(node);\n        }\n        return siblings;\n      };\n      var findEndPoint = function (node, root) {\n        return dom.getParent(node, function (node) {\n          return node.parentNode === root;\n        }, root);\n      };\n      var walkBoundary = function (startNode, endNode, next) {\n        var siblingName = next ? 'nextSibling' : 'previousSibling';\n        for (var node = startNode, parent_1 = node.parentNode; node && node !== endNode; node = parent_1) {\n          parent_1 = node.parentNode;\n          var siblings_1 = collectSiblings(node === startNode ? node : node[siblingName], siblingName);\n          if (siblings_1.length) {\n            if (!next) {\n              siblings_1.reverse();\n            }\n            callback(exclude(siblings_1));\n          }\n        }\n      };\n      if (startContainer === endContainer) {\n        return callback(exclude([startContainer]));\n      }\n      var ancestor = dom.findCommonAncestor(startContainer, endContainer);\n      if (dom.isChildOf(startContainer, endContainer)) {\n        return walkBoundary(startContainer, ancestor, true);\n      }\n      if (dom.isChildOf(endContainer, startContainer)) {\n        return walkBoundary(endContainer, ancestor);\n      }\n      var startPoint = findEndPoint(startContainer, ancestor) || startContainer;\n      var endPoint = findEndPoint(endContainer, ancestor) || endContainer;\n      walkBoundary(startContainer, startPoint, true);\n      var siblings = collectSiblings(startPoint === startContainer ? startPoint : startPoint.nextSibling, 'nextSibling', endPoint === endContainer ? endPoint.nextSibling : endPoint);\n      if (siblings.length) {\n        callback(exclude(siblings));\n      }\n      walkBoundary(endContainer, endPoint);\n    };\n\n    var getRanges = function (selection) {\n      var ranges = [];\n      if (selection) {\n        for (var i = 0; i < selection.rangeCount; i++) {\n          ranges.push(selection.getRangeAt(i));\n        }\n      }\n      return ranges;\n    };\n    var getSelectedNodes = function (ranges) {\n      return bind(ranges, function (range) {\n        var node = getSelectedNode(range);\n        return node ? [SugarElement.fromDom(node)] : [];\n      });\n    };\n    var hasMultipleRanges = function (selection) {\n      return getRanges(selection).length > 1;\n    };\n\n    var getCellsFromRanges = function (ranges) {\n      return filter$4(getSelectedNodes(ranges), isTableCell$4);\n    };\n    var getCellsFromElement = function (elm) {\n      return descendants(elm, 'td[data-mce-selected],th[data-mce-selected]');\n    };\n    var getCellsFromElementOrRanges = function (ranges, element) {\n      var selectedCells = getCellsFromElement(element);\n      return selectedCells.length > 0 ? selectedCells : getCellsFromRanges(ranges);\n    };\n    var getCellsFromEditor = function (editor) {\n      return getCellsFromElementOrRanges(getRanges(editor.selection.getSel()), SugarElement.fromDom(editor.getBody()));\n    };\n    var getClosestTable = function (cell, isRoot) {\n      return ancestor$2(cell, 'table', isRoot);\n    };\n\n    var getStartNode = function (rng) {\n      var sc = rng.startContainer, so = rng.startOffset;\n      if (isText$7(sc)) {\n        return so === 0 ? Optional.some(SugarElement.fromDom(sc)) : Optional.none();\n      } else {\n        return Optional.from(sc.childNodes[so]).map(SugarElement.fromDom);\n      }\n    };\n    var getEndNode = function (rng) {\n      var ec = rng.endContainer, eo = rng.endOffset;\n      if (isText$7(ec)) {\n        return eo === ec.data.length ? Optional.some(SugarElement.fromDom(ec)) : Optional.none();\n      } else {\n        return Optional.from(ec.childNodes[eo - 1]).map(SugarElement.fromDom);\n      }\n    };\n    var getFirstChildren = function (node) {\n      return firstChild(node).fold(constant([node]), function (child) {\n        return [node].concat(getFirstChildren(child));\n      });\n    };\n    var getLastChildren$1 = function (node) {\n      return lastChild(node).fold(constant([node]), function (child) {\n        if (name(child) === 'br') {\n          return prevSibling(child).map(function (sibling) {\n            return [node].concat(getLastChildren$1(sibling));\n          }).getOr([]);\n        } else {\n          return [node].concat(getLastChildren$1(child));\n        }\n      });\n    };\n    var hasAllContentsSelected = function (elm, rng) {\n      return lift2(getStartNode(rng), getEndNode(rng), function (startNode, endNode) {\n        var start = find$3(getFirstChildren(elm), curry(eq, startNode));\n        var end = find$3(getLastChildren$1(elm), curry(eq, endNode));\n        return start.isSome() && end.isSome();\n      }).getOr(false);\n    };\n    var moveEndPoint = function (dom, rng, node, start) {\n      var root = node, walker = new DomTreeWalker(node, root);\n      var moveCaretBeforeOnEnterElementsMap = filter$3(dom.schema.getMoveCaretBeforeOnEnterElements(), function (_, name) {\n        return !contains$3([\n          'td',\n          'th',\n          'table'\n        ], name.toLowerCase());\n      });\n      do {\n        if (isText$7(node) && Tools.trim(node.nodeValue).length !== 0) {\n          if (start) {\n            rng.setStart(node, 0);\n          } else {\n            rng.setEnd(node, node.nodeValue.length);\n          }\n          return;\n        }\n        if (moveCaretBeforeOnEnterElementsMap[node.nodeName]) {\n          if (start) {\n            rng.setStartBefore(node);\n          } else {\n            if (node.nodeName === 'BR') {\n              rng.setEndBefore(node);\n            } else {\n              rng.setEndAfter(node);\n            }\n          }\n          return;\n        }\n      } while (node = start ? walker.next() : walker.prev());\n      if (root.nodeName === 'BODY') {\n        if (start) {\n          rng.setStart(root, 0);\n        } else {\n          rng.setEnd(root, root.childNodes.length);\n        }\n      }\n    };\n    var hasAnyRanges = function (editor) {\n      var sel = editor.selection.getSel();\n      return sel && sel.rangeCount > 0;\n    };\n    var runOnRanges = function (editor, executor) {\n      var fakeSelectionNodes = getCellsFromEditor(editor);\n      if (fakeSelectionNodes.length > 0) {\n        each$k(fakeSelectionNodes, function (elem) {\n          var node = elem.dom;\n          var fakeNodeRng = editor.dom.createRng();\n          fakeNodeRng.setStartBefore(node);\n          fakeNodeRng.setEndAfter(node);\n          executor(fakeNodeRng, true);\n        });\n      } else {\n        executor(editor.selection.getRng(), false);\n      }\n    };\n    var preserve = function (selection, fillBookmark, executor) {\n      var bookmark = getPersistentBookmark(selection, fillBookmark);\n      executor(bookmark);\n      selection.moveToBookmark(bookmark);\n    };\n\n    var NodeValue = function (is, name) {\n      var get = function (element) {\n        if (!is(element)) {\n          throw new Error('Can only get ' + name + ' value of a ' + name + ' node');\n        }\n        return getOption(element).getOr('');\n      };\n      var getOption = function (element) {\n        return is(element) ? Optional.from(element.dom.nodeValue) : Optional.none();\n      };\n      var set = function (element, value) {\n        if (!is(element)) {\n          throw new Error('Can only set raw ' + name + ' value of a ' + name + ' node');\n        }\n        element.dom.nodeValue = value;\n      };\n      return {\n        get: get,\n        getOption: getOption,\n        set: set\n      };\n    };\n\n    var api$1 = NodeValue(isText$8, 'text');\n    var get$2 = function (element) {\n      return api$1.get(element);\n    };\n\n    var isZeroWidth = function (elem) {\n      return isText$8(elem) && get$2(elem) === ZWSP$1;\n    };\n    var context = function (editor, elem, wrapName, nodeName) {\n      return parent(elem).fold(function () {\n        return 'skipping';\n      }, function (parent) {\n        if (nodeName === 'br' || isZeroWidth(elem)) {\n          return 'valid';\n        } else if (isAnnotation(elem)) {\n          return 'existing';\n        } else if (isCaretNode(elem.dom)) {\n          return 'caret';\n        } else if (!isValid(editor, wrapName, nodeName) || !isValid(editor, name(parent), wrapName)) {\n          return 'invalid-child';\n        } else {\n          return 'valid';\n        }\n      });\n    };\n\n    var applyWordGrab = function (editor, rng) {\n      var r = expandRng(editor, rng, [{ inline: 'span' }]);\n      rng.setStart(r.startContainer, r.startOffset);\n      rng.setEnd(r.endContainer, r.endOffset);\n      editor.selection.setRng(rng);\n    };\n    var makeAnnotation = function (eDoc, _a, annotationName, decorate) {\n      var _b = _a.uid, uid = _b === void 0 ? generate('mce-annotation') : _b, data = __rest(_a, ['uid']);\n      var master = SugarElement.fromTag('span', eDoc);\n      add$1(master, annotation());\n      set$1(master, '' + dataAnnotationId(), uid);\n      set$1(master, '' + dataAnnotation(), annotationName);\n      var _c = decorate(uid, data), _d = _c.attributes, attributes = _d === void 0 ? {} : _d, _e = _c.classes, classes = _e === void 0 ? [] : _e;\n      setAll$1(master, attributes);\n      add(master, classes);\n      return master;\n    };\n    var annotate = function (editor, rng, annotationName, decorate, data) {\n      var newWrappers = [];\n      var master = makeAnnotation(editor.getDoc(), data, annotationName, decorate);\n      var wrapper = value();\n      var finishWrapper = function () {\n        wrapper.clear();\n      };\n      var getOrOpenWrapper = function () {\n        return wrapper.get().getOrThunk(function () {\n          var nu = shallow(master);\n          newWrappers.push(nu);\n          wrapper.set(nu);\n          return nu;\n        });\n      };\n      var processElements = function (elems) {\n        each$k(elems, processElement);\n      };\n      var processElement = function (elem) {\n        var ctx = context(editor, elem, 'span', name(elem));\n        switch (ctx) {\n        case 'invalid-child': {\n            finishWrapper();\n            var children$1 = children(elem);\n            processElements(children$1);\n            finishWrapper();\n            break;\n          }\n        case 'valid': {\n            var w = getOrOpenWrapper();\n            wrap$3(elem, w);\n            break;\n          }\n        }\n      };\n      var processNodes = function (nodes) {\n        var elems = map$3(nodes, SugarElement.fromDom);\n        processElements(elems);\n      };\n      walk$2(editor.dom, rng, function (nodes) {\n        finishWrapper();\n        processNodes(nodes);\n      });\n      return newWrappers;\n    };\n    var annotateWithBookmark = function (editor, name, settings, data) {\n      editor.undoManager.transact(function () {\n        var selection = editor.selection;\n        var initialRng = selection.getRng();\n        var hasFakeSelection = getCellsFromEditor(editor).length > 0;\n        if (initialRng.collapsed && !hasFakeSelection) {\n          applyWordGrab(editor, initialRng);\n        }\n        if (selection.getRng().collapsed && !hasFakeSelection) {\n          var wrapper = makeAnnotation(editor.getDoc(), data, name, settings.decorate);\n          set(wrapper, nbsp);\n          selection.getRng().insertNode(wrapper.dom);\n          selection.select(wrapper.dom);\n        } else {\n          preserve(selection, false, function () {\n            runOnRanges(editor, function (selectionRng) {\n              annotate(editor, selectionRng, name, settings.decorate, data);\n            });\n          });\n        }\n      });\n    };\n\n    var Annotator = function (editor) {\n      var registry = create$7();\n      setup$m(editor, registry);\n      var changes = setup$n(editor);\n      return {\n        register: function (name, settings) {\n          registry.register(name, settings);\n        },\n        annotate: function (name, data) {\n          registry.lookup(name).each(function (settings) {\n            annotateWithBookmark(editor, name, settings, data);\n          });\n        },\n        annotationChanged: function (name, callback) {\n          changes.addListener(name, callback);\n        },\n        remove: function (name) {\n          identify(editor, Optional.some(name)).each(function (_a) {\n            var elements = _a.elements;\n            each$k(elements, unwrap);\n          });\n        },\n        getAll: function (name) {\n          var directory = findAll(editor, name);\n          return map$2(directory, function (elems) {\n            return map$3(elems, function (elem) {\n              return elem.dom;\n            });\n          });\n        }\n      };\n    };\n\n    var BookmarkManager = function (selection) {\n      return {\n        getBookmark: curry(getBookmark$1, selection),\n        moveToBookmark: curry(moveToBookmark, selection)\n      };\n    };\n    BookmarkManager.isBookmarkNode = isBookmarkNode$1;\n\n    var getContentEditableRoot$1 = function (root, node) {\n      while (node && node !== root) {\n        if (isContentEditableTrue$4(node) || isContentEditableFalse$b(node)) {\n          return node;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n\n    var isXYWithinRange = function (clientX, clientY, range) {\n      if (range.collapsed) {\n        return false;\n      }\n      if (Env.browser.isIE() && range.startOffset === range.endOffset - 1 && range.startContainer === range.endContainer) {\n        var elm = range.startContainer.childNodes[range.startOffset];\n        if (isElement$5(elm)) {\n          return exists(elm.getClientRects(), function (rect) {\n            return containsXY(rect, clientX, clientY);\n          });\n        }\n      }\n      return exists(range.getClientRects(), function (rect) {\n        return containsXY(rect, clientX, clientY);\n      });\n    };\n\n    var firePreProcess = function (editor, args) {\n      return editor.fire('PreProcess', args);\n    };\n    var firePostProcess = function (editor, args) {\n      return editor.fire('PostProcess', args);\n    };\n    var fireRemove = function (editor) {\n      return editor.fire('remove');\n    };\n    var fireDetach = function (editor) {\n      return editor.fire('detach');\n    };\n    var fireSwitchMode = function (editor, mode) {\n      return editor.fire('SwitchMode', { mode: mode });\n    };\n    var fireObjectResizeStart = function (editor, target, width, height, origin) {\n      editor.fire('ObjectResizeStart', {\n        target: target,\n        width: width,\n        height: height,\n        origin: origin\n      });\n    };\n    var fireObjectResized = function (editor, target, width, height, origin) {\n      editor.fire('ObjectResized', {\n        target: target,\n        width: width,\n        height: height,\n        origin: origin\n      });\n    };\n    var firePreInit = function (editor) {\n      return editor.fire('PreInit');\n    };\n    var firePostRender = function (editor) {\n      return editor.fire('PostRender');\n    };\n    var fireInit = function (editor) {\n      return editor.fire('Init');\n    };\n    var firePlaceholderToggle = function (editor, state) {\n      return editor.fire('PlaceholderToggle', { state: state });\n    };\n    var fireError = function (editor, errorType, error) {\n      return editor.fire(errorType, error);\n    };\n    var fireFormatApply = function (editor, format, node, vars) {\n      return editor.fire('FormatApply', {\n        format: format,\n        node: node,\n        vars: vars\n      });\n    };\n    var fireFormatRemove = function (editor, format, node, vars) {\n      return editor.fire('FormatRemove', {\n        format: format,\n        node: node,\n        vars: vars\n      });\n    };\n\n    var VK = {\n      BACKSPACE: 8,\n      DELETE: 46,\n      DOWN: 40,\n      ENTER: 13,\n      ESC: 27,\n      LEFT: 37,\n      RIGHT: 39,\n      SPACEBAR: 32,\n      TAB: 9,\n      UP: 38,\n      PAGE_UP: 33,\n      PAGE_DOWN: 34,\n      END: 35,\n      HOME: 36,\n      modifierPressed: function (e) {\n        return e.shiftKey || e.ctrlKey || e.altKey || VK.metaKeyPressed(e);\n      },\n      metaKeyPressed: function (e) {\n        return Env.mac ? e.metaKey : e.ctrlKey && !e.altKey;\n      }\n    };\n\n    var isContentEditableFalse$5 = isContentEditableFalse$b;\n    var ControlSelection = function (selection, editor) {\n      var elementSelectionAttr = 'data-mce-selected';\n      var dom = editor.dom, each = Tools.each;\n      var selectedElm, selectedElmGhost, resizeHelper, selectedHandle, resizeBackdrop;\n      var startX, startY, selectedElmX, selectedElmY, startW, startH, ratio, resizeStarted;\n      var width, height;\n      var editableDoc = editor.getDoc(), rootDocument = document;\n      var abs = Math.abs, round = Math.round, rootElement = editor.getBody();\n      var startScrollWidth, startScrollHeight;\n      var resizeHandles = {\n        nw: [\n          0,\n          0,\n          -1,\n          -1\n        ],\n        ne: [\n          1,\n          0,\n          1,\n          -1\n        ],\n        se: [\n          1,\n          1,\n          1,\n          1\n        ],\n        sw: [\n          0,\n          1,\n          -1,\n          1\n        ]\n      };\n      var isImage = function (elm) {\n        return elm && (elm.nodeName === 'IMG' || editor.dom.is(elm, 'figure.image'));\n      };\n      var isMedia = function (elm) {\n        return isMedia$2(elm) || dom.hasClass(elm, 'mce-preview-object');\n      };\n      var isEventOnImageOutsideRange = function (evt, range) {\n        if (evt.type === 'longpress' || evt.type.indexOf('touch') === 0) {\n          var touch = evt.touches[0];\n          return isImage(evt.target) && !isXYWithinRange(touch.clientX, touch.clientY, range);\n        } else {\n          return isImage(evt.target) && !isXYWithinRange(evt.clientX, evt.clientY, range);\n        }\n      };\n      var contextMenuSelectImage = function (evt) {\n        var target = evt.target;\n        if (isEventOnImageOutsideRange(evt, editor.selection.getRng()) && !evt.isDefaultPrevented()) {\n          editor.selection.select(target);\n        }\n      };\n      var getResizeTargets = function (elm) {\n        if (dom.is(elm, 'figure.image')) {\n          return [elm.querySelector('img')];\n        } else if (dom.hasClass(elm, 'mce-preview-object') && isNonNullable(elm.firstElementChild)) {\n          return [\n            elm,\n            elm.firstElementChild\n          ];\n        } else {\n          return [elm];\n        }\n      };\n      var isResizable = function (elm) {\n        var selector = getObjectResizing(editor);\n        if (!selector) {\n          return false;\n        }\n        if (elm.getAttribute('data-mce-resize') === 'false') {\n          return false;\n        }\n        if (elm === editor.getBody()) {\n          return false;\n        }\n        if (dom.hasClass(elm, 'mce-preview-object')) {\n          return is$2(SugarElement.fromDom(elm.firstElementChild), selector);\n        } else {\n          return is$2(SugarElement.fromDom(elm), selector);\n        }\n      };\n      var createGhostElement = function (elm) {\n        if (isMedia(elm)) {\n          return dom.create('img', { src: Env.transparentSrc });\n        } else {\n          return elm.cloneNode(true);\n        }\n      };\n      var setSizeProp = function (element, name, value) {\n        if (isNonNullable(value)) {\n          var targets = getResizeTargets(element);\n          each$k(targets, function (target) {\n            if (target.style[name] || !editor.schema.isValid(target.nodeName.toLowerCase(), name)) {\n              dom.setStyle(target, name, value);\n            } else {\n              dom.setAttrib(target, name, '' + value);\n            }\n          });\n        }\n      };\n      var setGhostElmSize = function (ghostElm, width, height) {\n        setSizeProp(ghostElm, 'width', width);\n        setSizeProp(ghostElm, 'height', height);\n      };\n      var resizeGhostElement = function (e) {\n        var deltaX, deltaY, proportional;\n        var resizeHelperX, resizeHelperY;\n        deltaX = e.screenX - startX;\n        deltaY = e.screenY - startY;\n        width = deltaX * selectedHandle[2] + startW;\n        height = deltaY * selectedHandle[3] + startH;\n        width = width < 5 ? 5 : width;\n        height = height < 5 ? 5 : height;\n        if ((isImage(selectedElm) || isMedia(selectedElm)) && getResizeImgProportional(editor) !== false) {\n          proportional = !VK.modifierPressed(e);\n        } else {\n          proportional = VK.modifierPressed(e);\n        }\n        if (proportional) {\n          if (abs(deltaX) > abs(deltaY)) {\n            height = round(width * ratio);\n            width = round(height / ratio);\n          } else {\n            width = round(height / ratio);\n            height = round(width * ratio);\n          }\n        }\n        setGhostElmSize(selectedElmGhost, width, height);\n        resizeHelperX = selectedHandle.startPos.x + deltaX;\n        resizeHelperY = selectedHandle.startPos.y + deltaY;\n        resizeHelperX = resizeHelperX > 0 ? resizeHelperX : 0;\n        resizeHelperY = resizeHelperY > 0 ? resizeHelperY : 0;\n        dom.setStyles(resizeHelper, {\n          left: resizeHelperX,\n          top: resizeHelperY,\n          display: 'block'\n        });\n        resizeHelper.innerHTML = width + ' &times; ' + height;\n        if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {\n          dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));\n        }\n        if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {\n          dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));\n        }\n        deltaX = rootElement.scrollWidth - startScrollWidth;\n        deltaY = rootElement.scrollHeight - startScrollHeight;\n        if (deltaX + deltaY !== 0) {\n          dom.setStyles(resizeHelper, {\n            left: resizeHelperX - deltaX,\n            top: resizeHelperY - deltaY\n          });\n        }\n        if (!resizeStarted) {\n          fireObjectResizeStart(editor, selectedElm, startW, startH, 'corner-' + selectedHandle.name);\n          resizeStarted = true;\n        }\n      };\n      var endGhostResize = function () {\n        var wasResizeStarted = resizeStarted;\n        resizeStarted = false;\n        if (wasResizeStarted) {\n          setSizeProp(selectedElm, 'width', width);\n          setSizeProp(selectedElm, 'height', height);\n        }\n        dom.unbind(editableDoc, 'mousemove', resizeGhostElement);\n        dom.unbind(editableDoc, 'mouseup', endGhostResize);\n        if (rootDocument !== editableDoc) {\n          dom.unbind(rootDocument, 'mousemove', resizeGhostElement);\n          dom.unbind(rootDocument, 'mouseup', endGhostResize);\n        }\n        dom.remove(selectedElmGhost);\n        dom.remove(resizeHelper);\n        dom.remove(resizeBackdrop);\n        showResizeRect(selectedElm);\n        if (wasResizeStarted) {\n          fireObjectResized(editor, selectedElm, width, height, 'corner-' + selectedHandle.name);\n          dom.setAttrib(selectedElm, 'style', dom.getAttrib(selectedElm, 'style'));\n        }\n        editor.nodeChanged();\n      };\n      var showResizeRect = function (targetElm) {\n        unbindResizeHandleEvents();\n        var position = dom.getPos(targetElm, rootElement);\n        var selectedElmX = position.x;\n        var selectedElmY = position.y;\n        var rect = targetElm.getBoundingClientRect();\n        var targetWidth = rect.width || rect.right - rect.left;\n        var targetHeight = rect.height || rect.bottom - rect.top;\n        if (selectedElm !== targetElm) {\n          hideResizeRect();\n          selectedElm = targetElm;\n          width = height = 0;\n        }\n        var e = editor.fire('ObjectSelected', { target: targetElm });\n        var selectedValue = dom.getAttrib(selectedElm, elementSelectionAttr, '1');\n        if (isResizable(targetElm) && !e.isDefaultPrevented()) {\n          each(resizeHandles, function (handle, name) {\n            var handleElm;\n            var startDrag = function (e) {\n              var target = getResizeTargets(selectedElm)[0];\n              startX = e.screenX;\n              startY = e.screenY;\n              startW = target.clientWidth;\n              startH = target.clientHeight;\n              ratio = startH / startW;\n              selectedHandle = handle;\n              selectedHandle.name = name;\n              selectedHandle.startPos = {\n                x: targetWidth * handle[0] + selectedElmX,\n                y: targetHeight * handle[1] + selectedElmY\n              };\n              startScrollWidth = rootElement.scrollWidth;\n              startScrollHeight = rootElement.scrollHeight;\n              resizeBackdrop = dom.add(rootElement, 'div', {\n                'class': 'mce-resize-backdrop',\n                'data-mce-bogus': 'all'\n              });\n              dom.setStyles(resizeBackdrop, {\n                position: 'fixed',\n                left: '0',\n                top: '0',\n                width: '100%',\n                height: '100%'\n              });\n              selectedElmGhost = createGhostElement(selectedElm);\n              dom.addClass(selectedElmGhost, 'mce-clonedresizable');\n              dom.setAttrib(selectedElmGhost, 'data-mce-bogus', 'all');\n              selectedElmGhost.contentEditable = 'false';\n              dom.setStyles(selectedElmGhost, {\n                left: selectedElmX,\n                top: selectedElmY,\n                margin: 0\n              });\n              setGhostElmSize(selectedElmGhost, targetWidth, targetHeight);\n              selectedElmGhost.removeAttribute(elementSelectionAttr);\n              rootElement.appendChild(selectedElmGhost);\n              dom.bind(editableDoc, 'mousemove', resizeGhostElement);\n              dom.bind(editableDoc, 'mouseup', endGhostResize);\n              if (rootDocument !== editableDoc) {\n                dom.bind(rootDocument, 'mousemove', resizeGhostElement);\n                dom.bind(rootDocument, 'mouseup', endGhostResize);\n              }\n              resizeHelper = dom.add(rootElement, 'div', {\n                'class': 'mce-resize-helper',\n                'data-mce-bogus': 'all'\n              }, startW + ' &times; ' + startH);\n            };\n            handleElm = dom.get('mceResizeHandle' + name);\n            if (handleElm) {\n              dom.remove(handleElm);\n            }\n            handleElm = dom.add(rootElement, 'div', {\n              'id': 'mceResizeHandle' + name,\n              'data-mce-bogus': 'all',\n              'class': 'mce-resizehandle',\n              'unselectable': true,\n              'style': 'cursor:' + name + '-resize; margin:0; padding:0'\n            });\n            if (Env.ie === 11) {\n              handleElm.contentEditable = false;\n            }\n            dom.bind(handleElm, 'mousedown', function (e) {\n              e.stopImmediatePropagation();\n              e.preventDefault();\n              startDrag(e);\n            });\n            handle.elm = handleElm;\n            dom.setStyles(handleElm, {\n              left: targetWidth * handle[0] + selectedElmX - handleElm.offsetWidth / 2,\n              top: targetHeight * handle[1] + selectedElmY - handleElm.offsetHeight / 2\n            });\n          });\n        } else {\n          hideResizeRect();\n        }\n        if (!dom.getAttrib(selectedElm, elementSelectionAttr)) {\n          selectedElm.setAttribute(elementSelectionAttr, selectedValue);\n        }\n      };\n      var hideResizeRect = function () {\n        unbindResizeHandleEvents();\n        if (selectedElm) {\n          selectedElm.removeAttribute(elementSelectionAttr);\n        }\n        each$j(resizeHandles, function (value, name) {\n          var handleElm = dom.get('mceResizeHandle' + name);\n          if (handleElm) {\n            dom.unbind(handleElm);\n            dom.remove(handleElm);\n          }\n        });\n      };\n      var updateResizeRect = function (e) {\n        var startElm, controlElm;\n        var isChildOrEqual = function (node, parent) {\n          if (node) {\n            do {\n              if (node === parent) {\n                return true;\n              }\n            } while (node = node.parentNode);\n          }\n        };\n        if (resizeStarted || editor.removed) {\n          return;\n        }\n        each(dom.select('img[data-mce-selected],hr[data-mce-selected]'), function (img) {\n          img.removeAttribute(elementSelectionAttr);\n        });\n        controlElm = e.type === 'mousedown' ? e.target : selection.getNode();\n        controlElm = dom.$(controlElm).closest('table,img,figure.image,hr,video,span.mce-preview-object')[0];\n        if (isChildOrEqual(controlElm, rootElement)) {\n          disableGeckoResize();\n          startElm = selection.getStart(true);\n          if (isChildOrEqual(startElm, controlElm) && isChildOrEqual(selection.getEnd(true), controlElm)) {\n            showResizeRect(controlElm);\n            return;\n          }\n        }\n        hideResizeRect();\n      };\n      var isWithinContentEditableFalse = function (elm) {\n        return isContentEditableFalse$5(getContentEditableRoot$1(editor.getBody(), elm));\n      };\n      var unbindResizeHandleEvents = function () {\n        each$j(resizeHandles, function (handle) {\n          if (handle.elm) {\n            dom.unbind(handle.elm);\n            delete handle.elm;\n          }\n        });\n      };\n      var disableGeckoResize = function () {\n        try {\n          editor.getDoc().execCommand('enableObjectResizing', false, 'false');\n        } catch (ex) {\n        }\n      };\n      editor.on('init', function () {\n        disableGeckoResize();\n        if (Env.browser.isIE() || Env.browser.isEdge()) {\n          editor.on('mousedown click', function (e) {\n            var target = e.target, nodeName = target.nodeName;\n            if (!resizeStarted && /^(TABLE|IMG|HR)$/.test(nodeName) && !isWithinContentEditableFalse(target)) {\n              if (e.button !== 2) {\n                editor.selection.select(target, nodeName === 'TABLE');\n              }\n              if (e.type === 'mousedown') {\n                editor.nodeChanged();\n              }\n            }\n          });\n          var handleMSControlSelect_1 = function (e) {\n            var delayedSelect = function (node) {\n              Delay.setEditorTimeout(editor, function () {\n                return editor.selection.select(node);\n              });\n            };\n            if (isWithinContentEditableFalse(e.target) || isMedia$2(e.target)) {\n              e.preventDefault();\n              delayedSelect(e.target);\n              return;\n            }\n            if (/^(TABLE|IMG|HR)$/.test(e.target.nodeName)) {\n              e.preventDefault();\n              if (e.target.tagName === 'IMG') {\n                delayedSelect(e.target);\n              }\n            }\n          };\n          dom.bind(rootElement, 'mscontrolselect', handleMSControlSelect_1);\n          editor.on('remove', function () {\n            return dom.unbind(rootElement, 'mscontrolselect', handleMSControlSelect_1);\n          });\n        }\n        var throttledUpdateResizeRect = Delay.throttle(function (e) {\n          if (!editor.composing) {\n            updateResizeRect(e);\n          }\n        });\n        editor.on('NodeChange ResizeEditor ResizeWindow ResizeContent drop', throttledUpdateResizeRect);\n        editor.on('keyup compositionend', function (e) {\n          if (selectedElm && selectedElm.nodeName === 'TABLE') {\n            throttledUpdateResizeRect(e);\n          }\n        });\n        editor.on('hide blur', hideResizeRect);\n        editor.on('contextmenu longpress', contextMenuSelectImage, true);\n      });\n      editor.on('remove', unbindResizeHandleEvents);\n      var destroy = function () {\n        selectedElm = selectedElmGhost = resizeBackdrop = null;\n      };\n      return {\n        isResizable: isResizable,\n        showResizeRect: showResizeRect,\n        hideResizeRect: hideResizeRect,\n        updateResizeRect: updateResizeRect,\n        destroy: destroy\n      };\n    };\n\n    var hasCeProperty = function (node) {\n      return isContentEditableTrue$4(node) || isContentEditableFalse$b(node);\n    };\n    var findParent$1 = function (node, rootNode, predicate) {\n      while (node && node !== rootNode) {\n        if (predicate(node)) {\n          return node;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n    var findClosestIeRange = function (clientX, clientY, doc) {\n      var rects;\n      var element = doc.elementFromPoint(clientX, clientY);\n      var rng = doc.body.createTextRange();\n      if (!element || element.tagName === 'HTML') {\n        element = doc.body;\n      }\n      rng.moveToElementText(element);\n      rects = Tools.toArray(rng.getClientRects());\n      rects = rects.sort(function (a, b) {\n        a = Math.abs(Math.max(a.top - clientY, a.bottom - clientY));\n        b = Math.abs(Math.max(b.top - clientY, b.bottom - clientY));\n        return a - b;\n      });\n      if (rects.length > 0) {\n        clientY = (rects[0].bottom + rects[0].top) / 2;\n        try {\n          rng.moveToPoint(clientX, clientY);\n          rng.collapse(true);\n          return rng;\n        } catch (ex) {\n        }\n      }\n      return null;\n    };\n    var moveOutOfContentEditableFalse = function (rng, rootNode) {\n      var parentElement = rng && rng.parentElement ? rng.parentElement() : null;\n      return isContentEditableFalse$b(findParent$1(parentElement, rootNode, hasCeProperty)) ? null : rng;\n    };\n    var fromPoint = function (clientX, clientY, doc) {\n      var rng, point;\n      var pointDoc = doc;\n      if (pointDoc.caretPositionFromPoint) {\n        point = pointDoc.caretPositionFromPoint(clientX, clientY);\n        if (point) {\n          rng = doc.createRange();\n          rng.setStart(point.offsetNode, point.offset);\n          rng.collapse(true);\n        }\n      } else if (pointDoc.caretRangeFromPoint) {\n        rng = pointDoc.caretRangeFromPoint(clientX, clientY);\n      } else if (pointDoc.body.createTextRange) {\n        rng = pointDoc.body.createTextRange();\n        try {\n          rng.moveToPoint(clientX, clientY);\n          rng.collapse(true);\n        } catch (ex) {\n          rng = findClosestIeRange(clientX, clientY, doc);\n        }\n        return moveOutOfContentEditableFalse(rng, doc.body);\n      }\n      return rng;\n    };\n\n    var isEq$4 = function (rng1, rng2) {\n      return rng1 && rng2 && (rng1.startContainer === rng2.startContainer && rng1.startOffset === rng2.startOffset) && (rng1.endContainer === rng2.endContainer && rng1.endOffset === rng2.endOffset);\n    };\n\n    var findParent = function (node, rootNode, predicate) {\n      while (node && node !== rootNode) {\n        if (predicate(node)) {\n          return node;\n        }\n        node = node.parentNode;\n      }\n      return null;\n    };\n    var hasParent$1 = function (node, rootNode, predicate) {\n      return findParent(node, rootNode, predicate) !== null;\n    };\n    var hasParentWithName = function (node, rootNode, name) {\n      return hasParent$1(node, rootNode, function (node) {\n        return node.nodeName === name;\n      });\n    };\n    var isTable = function (node) {\n      return node && node.nodeName === 'TABLE';\n    };\n    var isTableCell$2 = function (node) {\n      return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);\n    };\n    var isCeFalseCaretContainer = function (node, rootNode) {\n      return isCaretContainer$2(node) && hasParent$1(node, rootNode, isCaretNode) === false;\n    };\n    var hasBrBeforeAfter = function (dom, node, left) {\n      var walker = new DomTreeWalker(node, dom.getParent(node.parentNode, dom.isBlock) || dom.getRoot());\n      while (node = walker[left ? 'prev' : 'next']()) {\n        if (isBr$5(node)) {\n          return true;\n        }\n      }\n    };\n    var isPrevNode = function (node, name) {\n      return node.previousSibling && node.previousSibling.nodeName === name;\n    };\n    var hasContentEditableFalseParent = function (body, node) {\n      while (node && node !== body) {\n        if (isContentEditableFalse$b(node)) {\n          return true;\n        }\n        node = node.parentNode;\n      }\n      return false;\n    };\n    var findTextNodeRelative = function (dom, isAfterNode, collapsed, left, startNode) {\n      var lastInlineElement;\n      var body = dom.getRoot();\n      var node;\n      var nonEmptyElementsMap = dom.schema.getNonEmptyElements();\n      var parentBlockContainer = dom.getParent(startNode.parentNode, dom.isBlock) || body;\n      if (left && isBr$5(startNode) && isAfterNode && dom.isEmpty(parentBlockContainer)) {\n        return Optional.some(CaretPosition(startNode.parentNode, dom.nodeIndex(startNode)));\n      }\n      var walker = new DomTreeWalker(startNode, parentBlockContainer);\n      while (node = walker[left ? 'prev' : 'next']()) {\n        if (dom.getContentEditableParent(node) === 'false' || isCeFalseCaretContainer(node, body)) {\n          return Optional.none();\n        }\n        if (isText$7(node) && node.nodeValue.length > 0) {\n          if (hasParentWithName(node, body, 'A') === false) {\n            return Optional.some(CaretPosition(node, left ? node.nodeValue.length : 0));\n          }\n          return Optional.none();\n        }\n        if (dom.isBlock(node) || nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\n          return Optional.none();\n        }\n        lastInlineElement = node;\n      }\n      if (collapsed && lastInlineElement) {\n        return Optional.some(CaretPosition(lastInlineElement, 0));\n      }\n      return Optional.none();\n    };\n    var normalizeEndPoint = function (dom, collapsed, start, rng) {\n      var container, offset;\n      var body = dom.getRoot();\n      var node;\n      var directionLeft, normalized = false;\n      container = rng[(start ? 'start' : 'end') + 'Container'];\n      offset = rng[(start ? 'start' : 'end') + 'Offset'];\n      var isAfterNode = isElement$5(container) && offset === container.childNodes.length;\n      var nonEmptyElementsMap = dom.schema.getNonEmptyElements();\n      directionLeft = start;\n      if (isCaretContainer$2(container)) {\n        return Optional.none();\n      }\n      if (isElement$5(container) && offset > container.childNodes.length - 1) {\n        directionLeft = false;\n      }\n      if (isDocument$1(container)) {\n        container = body;\n        offset = 0;\n      }\n      if (container === body) {\n        if (directionLeft) {\n          node = container.childNodes[offset > 0 ? offset - 1 : 0];\n          if (node) {\n            if (isCaretContainer$2(node)) {\n              return Optional.none();\n            }\n            if (nonEmptyElementsMap[node.nodeName] || isTable(node)) {\n              return Optional.none();\n            }\n          }\n        }\n        if (container.hasChildNodes()) {\n          offset = Math.min(!directionLeft && offset > 0 ? offset - 1 : offset, container.childNodes.length - 1);\n          container = container.childNodes[offset];\n          offset = isText$7(container) && isAfterNode ? container.data.length : 0;\n          if (!collapsed && container === body.lastChild && isTable(container)) {\n            return Optional.none();\n          }\n          if (hasContentEditableFalseParent(body, container) || isCaretContainer$2(container)) {\n            return Optional.none();\n          }\n          if (container.hasChildNodes() && isTable(container) === false) {\n            node = container;\n            var walker = new DomTreeWalker(container, body);\n            do {\n              if (isContentEditableFalse$b(node) || isCaretContainer$2(node)) {\n                normalized = false;\n                break;\n              }\n              if (isText$7(node) && node.nodeValue.length > 0) {\n                offset = directionLeft ? 0 : node.nodeValue.length;\n                container = node;\n                normalized = true;\n                break;\n              }\n              if (nonEmptyElementsMap[node.nodeName.toLowerCase()] && !isTableCell$2(node)) {\n                offset = dom.nodeIndex(node);\n                container = node.parentNode;\n                if (!directionLeft) {\n                  offset++;\n                }\n                normalized = true;\n                break;\n              }\n            } while (node = directionLeft ? walker.next() : walker.prev());\n          }\n        }\n      }\n      if (collapsed) {\n        if (isText$7(container) && offset === 0) {\n          findTextNodeRelative(dom, isAfterNode, collapsed, true, container).each(function (pos) {\n            container = pos.container();\n            offset = pos.offset();\n            normalized = true;\n          });\n        }\n        if (isElement$5(container)) {\n          node = container.childNodes[offset];\n          if (!node) {\n            node = container.childNodes[offset - 1];\n          }\n          if (node && isBr$5(node) && !isPrevNode(node, 'A') && !hasBrBeforeAfter(dom, node, false) && !hasBrBeforeAfter(dom, node, true)) {\n            findTextNodeRelative(dom, isAfterNode, collapsed, true, node).each(function (pos) {\n              container = pos.container();\n              offset = pos.offset();\n              normalized = true;\n            });\n          }\n        }\n      }\n      if (directionLeft && !collapsed && isText$7(container) && offset === container.nodeValue.length) {\n        findTextNodeRelative(dom, isAfterNode, collapsed, false, container).each(function (pos) {\n          container = pos.container();\n          offset = pos.offset();\n          normalized = true;\n        });\n      }\n      return normalized ? Optional.some(CaretPosition(container, offset)) : Optional.none();\n    };\n    var normalize$2 = function (dom, rng) {\n      var collapsed = rng.collapsed, normRng = rng.cloneRange();\n      var startPos = CaretPosition.fromRangeStart(rng);\n      normalizeEndPoint(dom, collapsed, true, normRng).each(function (pos) {\n        if (!collapsed || !CaretPosition.isAbove(startPos, pos)) {\n          normRng.setStart(pos.container(), pos.offset());\n        }\n      });\n      if (!collapsed) {\n        normalizeEndPoint(dom, collapsed, false, normRng).each(function (pos) {\n          normRng.setEnd(pos.container(), pos.offset());\n        });\n      }\n      if (collapsed) {\n        normRng.collapse(true);\n      }\n      return isEq$4(rng, normRng) ? Optional.none() : Optional.some(normRng);\n    };\n\n    var splitText = function (node, offset) {\n      return node.splitText(offset);\n    };\n    var split = function (rng) {\n      var startContainer = rng.startContainer, startOffset = rng.startOffset, endContainer = rng.endContainer, endOffset = rng.endOffset;\n      if (startContainer === endContainer && isText$7(startContainer)) {\n        if (startOffset > 0 && startOffset < startContainer.nodeValue.length) {\n          endContainer = splitText(startContainer, startOffset);\n          startContainer = endContainer.previousSibling;\n          if (endOffset > startOffset) {\n            endOffset = endOffset - startOffset;\n            startContainer = endContainer = splitText(endContainer, endOffset).previousSibling;\n            endOffset = endContainer.nodeValue.length;\n            startOffset = 0;\n          } else {\n            endOffset = 0;\n          }\n        }\n      } else {\n        if (isText$7(startContainer) && startOffset > 0 && startOffset < startContainer.nodeValue.length) {\n          startContainer = splitText(startContainer, startOffset);\n          startOffset = 0;\n        }\n        if (isText$7(endContainer) && endOffset > 0 && endOffset < endContainer.nodeValue.length) {\n          endContainer = splitText(endContainer, endOffset).previousSibling;\n          endOffset = endContainer.nodeValue.length;\n        }\n      }\n      return {\n        startContainer: startContainer,\n        startOffset: startOffset,\n        endContainer: endContainer,\n        endOffset: endOffset\n      };\n    };\n\n    var RangeUtils = function (dom) {\n      var walk = function (rng, callback) {\n        return walk$2(dom, rng, callback);\n      };\n      var split$1 = split;\n      var normalize = function (rng) {\n        return normalize$2(dom, rng).fold(never, function (normalizedRng) {\n          rng.setStart(normalizedRng.startContainer, normalizedRng.startOffset);\n          rng.setEnd(normalizedRng.endContainer, normalizedRng.endOffset);\n          return true;\n        });\n      };\n      return {\n        walk: walk,\n        split: split$1,\n        normalize: normalize\n      };\n    };\n    RangeUtils.compareRanges = isEq$4;\n    RangeUtils.getCaretRangeFromPoint = fromPoint;\n    RangeUtils.getSelectedNode = getSelectedNode;\n    RangeUtils.getNode = getNode$1;\n\n    var Dimension = function (name, getOffset) {\n      var set = function (element, h) {\n        if (!isNumber(h) && !h.match(/^[0-9]+$/)) {\n          throw new Error(name + '.set accepts only positive integer values. Value was ' + h);\n        }\n        var dom = element.dom;\n        if (isSupported(dom)) {\n          dom.style[name] = h + 'px';\n        }\n      };\n      var get = function (element) {\n        var r = getOffset(element);\n        if (r <= 0 || r === null) {\n          var css = get$5(element, name);\n          return parseFloat(css) || 0;\n        }\n        return r;\n      };\n      var getOuter = get;\n      var aggregate = function (element, properties) {\n        return foldl(properties, function (acc, property) {\n          var val = get$5(element, property);\n          var value = val === undefined ? 0 : parseInt(val, 10);\n          return isNaN(value) ? acc : acc + value;\n        }, 0);\n      };\n      var max = function (element, value, properties) {\n        var cumulativeInclusions = aggregate(element, properties);\n        var absoluteMax = value > cumulativeInclusions ? value - cumulativeInclusions : 0;\n        return absoluteMax;\n      };\n      return {\n        set: set,\n        get: get,\n        getOuter: getOuter,\n        aggregate: aggregate,\n        max: max\n      };\n    };\n\n    var api = Dimension('height', function (element) {\n      var dom = element.dom;\n      return inBody(element) ? dom.getBoundingClientRect().height : dom.offsetHeight;\n    });\n    var get$1 = function (element) {\n      return api.get(element);\n    };\n\n    var walkUp = function (navigation, doc) {\n      var frame = navigation.view(doc);\n      return frame.fold(constant([]), function (f) {\n        var parent = navigation.owner(f);\n        var rest = walkUp(navigation, parent);\n        return [f].concat(rest);\n      });\n    };\n    var pathTo = function (element, navigation) {\n      var d = navigation.owner(element);\n      return walkUp(navigation, d);\n    };\n\n    var view = function (doc) {\n      var _a;\n      var element = doc.dom === document ? Optional.none() : Optional.from((_a = doc.dom.defaultView) === null || _a === void 0 ? void 0 : _a.frameElement);\n      return element.map(SugarElement.fromDom);\n    };\n    var owner = function (element) {\n      return documentOrOwner(element);\n    };\n\n    var Navigation = /*#__PURE__*/Object.freeze({\n        __proto__: null,\n        view: view,\n        owner: owner\n    });\n\n    var find$1 = function (element) {\n      var doc = SugarElement.fromDom(document);\n      var scroll = get$8(doc);\n      var frames = pathTo(element, Navigation);\n      var offset = viewport(element);\n      var r = foldr(frames, function (b, a) {\n        var loc = viewport(a);\n        return {\n          left: b.left + loc.left,\n          top: b.top + loc.top\n        };\n      }, {\n        left: 0,\n        top: 0\n      });\n      return SugarPosition(r.left + offset.left + scroll.left, r.top + offset.top + scroll.top);\n    };\n\n    var excludeFromDescend = function (element) {\n      return name(element) === 'textarea';\n    };\n    var fireScrollIntoViewEvent = function (editor, data) {\n      var scrollEvent = editor.fire('ScrollIntoView', data);\n      return scrollEvent.isDefaultPrevented();\n    };\n    var fireAfterScrollIntoViewEvent = function (editor, data) {\n      editor.fire('AfterScrollIntoView', data);\n    };\n    var descend = function (element, offset) {\n      var children$1 = children(element);\n      if (children$1.length === 0 || excludeFromDescend(element)) {\n        return {\n          element: element,\n          offset: offset\n        };\n      } else if (offset < children$1.length && !excludeFromDescend(children$1[offset])) {\n        return {\n          element: children$1[offset],\n          offset: 0\n        };\n      } else {\n        var last = children$1[children$1.length - 1];\n        if (excludeFromDescend(last)) {\n          return {\n            element: element,\n            offset: offset\n          };\n        } else {\n          if (name(last) === 'img') {\n            return {\n              element: last,\n              offset: 1\n            };\n          } else if (isText$8(last)) {\n            return {\n              element: last,\n              offset: get$2(last).length\n            };\n          } else {\n            return {\n              element: last,\n              offset: children(last).length\n            };\n          }\n        }\n      }\n    };\n    var markerInfo = function (element, cleanupFun) {\n      var pos = absolute(element);\n      var height = get$1(element);\n      return {\n        element: element,\n        bottom: pos.top + height,\n        height: height,\n        pos: pos,\n        cleanup: cleanupFun\n      };\n    };\n    var createMarker = function (element, offset) {\n      var startPoint = descend(element, offset);\n      var span = SugarElement.fromHtml('<span data-mce-bogus=\"all\" style=\"display: inline-block;\">' + ZWSP$1 + '</span>');\n      before$4(startPoint.element, span);\n      return markerInfo(span, function () {\n        return remove$7(span);\n      });\n    };\n    var elementMarker = function (element) {\n      return markerInfo(SugarElement.fromDom(element), noop);\n    };\n    var withMarker = function (editor, f, rng, alignToTop) {\n      preserveWith(editor, function (_s, _e) {\n        return applyWithMarker(editor, f, rng, alignToTop);\n      }, rng);\n    };\n    var withScrollEvents = function (editor, doc, f, marker, alignToTop) {\n      var data = {\n        elm: marker.element.dom,\n        alignToTop: alignToTop\n      };\n      if (fireScrollIntoViewEvent(editor, data)) {\n        return;\n      }\n      var scrollTop = get$8(doc).top;\n      f(doc, scrollTop, marker, alignToTop);\n      fireAfterScrollIntoViewEvent(editor, data);\n    };\n    var applyWithMarker = function (editor, f, rng, alignToTop) {\n      var body = SugarElement.fromDom(editor.getBody());\n      var doc = SugarElement.fromDom(editor.getDoc());\n      reflow(body);\n      var marker = createMarker(SugarElement.fromDom(rng.startContainer), rng.startOffset);\n      withScrollEvents(editor, doc, f, marker, alignToTop);\n      marker.cleanup();\n    };\n    var withElement = function (editor, element, f, alignToTop) {\n      var doc = SugarElement.fromDom(editor.getDoc());\n      withScrollEvents(editor, doc, f, elementMarker(element), alignToTop);\n    };\n    var preserveWith = function (editor, f, rng) {\n      var startElement = rng.startContainer;\n      var startOffset = rng.startOffset;\n      var endElement = rng.endContainer;\n      var endOffset = rng.endOffset;\n      f(SugarElement.fromDom(startElement), SugarElement.fromDom(endElement));\n      var newRng = editor.dom.createRng();\n      newRng.setStart(startElement, startOffset);\n      newRng.setEnd(endElement, endOffset);\n      editor.selection.setRng(rng);\n    };\n    var scrollToMarker = function (marker, viewHeight, alignToTop, doc) {\n      var pos = marker.pos;\n      if (alignToTop) {\n        to(pos.left, pos.top, doc);\n      } else {\n        var y = pos.top - viewHeight + marker.height;\n        to(pos.left, y, doc);\n      }\n    };\n    var intoWindowIfNeeded = function (doc, scrollTop, viewHeight, marker, alignToTop) {\n      var viewportBottom = viewHeight + scrollTop;\n      var markerTop = marker.pos.top;\n      var markerBottom = marker.bottom;\n      var largerThanViewport = markerBottom - markerTop >= viewHeight;\n      if (markerTop < scrollTop) {\n        scrollToMarker(marker, viewHeight, alignToTop !== false, doc);\n      } else if (markerTop > viewportBottom) {\n        var align = largerThanViewport ? alignToTop !== false : alignToTop === true;\n        scrollToMarker(marker, viewHeight, align, doc);\n      } else if (markerBottom > viewportBottom && !largerThanViewport) {\n        scrollToMarker(marker, viewHeight, alignToTop === true, doc);\n      }\n    };\n    var intoWindow = function (doc, scrollTop, marker, alignToTop) {\n      var viewHeight = doc.dom.defaultView.innerHeight;\n      intoWindowIfNeeded(doc, scrollTop, viewHeight, marker, alignToTop);\n    };\n    var intoFrame = function (doc, scrollTop, marker, alignToTop) {\n      var frameViewHeight = doc.dom.defaultView.innerHeight;\n      intoWindowIfNeeded(doc, scrollTop, frameViewHeight, marker, alignToTop);\n      var op = find$1(marker.element);\n      var viewportBounds = getBounds(window);\n      if (op.top < viewportBounds.y) {\n        intoView(marker.element, alignToTop !== false);\n      } else if (op.top > viewportBounds.bottom) {\n        intoView(marker.element, alignToTop === true);\n      }\n    };\n    var rangeIntoWindow = function (editor, rng, alignToTop) {\n      return withMarker(editor, intoWindow, rng, alignToTop);\n    };\n    var elementIntoWindow = function (editor, element, alignToTop) {\n      return withElement(editor, element, intoWindow, alignToTop);\n    };\n    var rangeIntoFrame = function (editor, rng, alignToTop) {\n      return withMarker(editor, intoFrame, rng, alignToTop);\n    };\n    var elementIntoFrame = function (editor, element, alignToTop) {\n      return withElement(editor, element, intoFrame, alignToTop);\n    };\n    var scrollElementIntoView = function (editor, element, alignToTop) {\n      var scroller = editor.inline ? elementIntoWindow : elementIntoFrame;\n      scroller(editor, element, alignToTop);\n    };\n    var scrollRangeIntoView = function (editor, rng, alignToTop) {\n      var scroller = editor.inline ? rangeIntoWindow : rangeIntoFrame;\n      scroller(editor, rng, alignToTop);\n    };\n\n    var getDocument = function () {\n      return SugarElement.fromDom(document);\n    };\n\n    var focus$1 = function (element) {\n      return element.dom.focus();\n    };\n    var hasFocus$1 = function (element) {\n      var root = getRootNode(element).dom;\n      return element.dom === root.activeElement;\n    };\n    var active = function (root) {\n      if (root === void 0) {\n        root = getDocument();\n      }\n      return Optional.from(root.dom.activeElement).map(SugarElement.fromDom);\n    };\n    var search = function (element) {\n      return active(getRootNode(element)).filter(function (e) {\n        return element.dom.contains(e.dom);\n      });\n    };\n\n    var create$5 = function (start, soffset, finish, foffset) {\n      return {\n        start: start,\n        soffset: soffset,\n        finish: finish,\n        foffset: foffset\n      };\n    };\n    var SimRange = { create: create$5 };\n\n    var adt$1 = Adt.generate([\n      { before: ['element'] },\n      {\n        on: [\n          'element',\n          'offset'\n        ]\n      },\n      { after: ['element'] }\n    ]);\n    var cata = function (subject, onBefore, onOn, onAfter) {\n      return subject.fold(onBefore, onOn, onAfter);\n    };\n    var getStart$2 = function (situ) {\n      return situ.fold(identity, identity, identity);\n    };\n    var before$1 = adt$1.before;\n    var on = adt$1.on;\n    var after$1 = adt$1.after;\n    var Situ = {\n      before: before$1,\n      on: on,\n      after: after$1,\n      cata: cata,\n      getStart: getStart$2\n    };\n\n    var adt = Adt.generate([\n      { domRange: ['rng'] },\n      {\n        relative: [\n          'startSitu',\n          'finishSitu'\n        ]\n      },\n      {\n        exact: [\n          'start',\n          'soffset',\n          'finish',\n          'foffset'\n        ]\n      }\n    ]);\n    var exactFromRange = function (simRange) {\n      return adt.exact(simRange.start, simRange.soffset, simRange.finish, simRange.foffset);\n    };\n    var getStart$1 = function (selection) {\n      return selection.match({\n        domRange: function (rng) {\n          return SugarElement.fromDom(rng.startContainer);\n        },\n        relative: function (startSitu, _finishSitu) {\n          return Situ.getStart(startSitu);\n        },\n        exact: function (start, _soffset, _finish, _foffset) {\n          return start;\n        }\n      });\n    };\n    var domRange = adt.domRange;\n    var relative = adt.relative;\n    var exact = adt.exact;\n    var getWin = function (selection) {\n      var start = getStart$1(selection);\n      return defaultView(start);\n    };\n    var range = SimRange.create;\n    var SimSelection = {\n      domRange: domRange,\n      relative: relative,\n      exact: exact,\n      exactFromRange: exactFromRange,\n      getWin: getWin,\n      range: range\n    };\n\n    var browser$1 = detect().browser;\n    var clamp$1 = function (offset, element) {\n      var max = isText$8(element) ? get$2(element).length : children(element).length + 1;\n      if (offset > max) {\n        return max;\n      } else if (offset < 0) {\n        return 0;\n      }\n      return offset;\n    };\n    var normalizeRng = function (rng) {\n      return SimSelection.range(rng.start, clamp$1(rng.soffset, rng.start), rng.finish, clamp$1(rng.foffset, rng.finish));\n    };\n    var isOrContains = function (root, elm) {\n      return !isRestrictedNode(elm.dom) && (contains$1(root, elm) || eq(root, elm));\n    };\n    var isRngInRoot = function (root) {\n      return function (rng) {\n        return isOrContains(root, rng.start) && isOrContains(root, rng.finish);\n      };\n    };\n    var shouldStore = function (editor) {\n      return editor.inline === true || browser$1.isIE();\n    };\n    var nativeRangeToSelectionRange = function (r) {\n      return SimSelection.range(SugarElement.fromDom(r.startContainer), r.startOffset, SugarElement.fromDom(r.endContainer), r.endOffset);\n    };\n    var readRange = function (win) {\n      var selection = win.getSelection();\n      var rng = !selection || selection.rangeCount === 0 ? Optional.none() : Optional.from(selection.getRangeAt(0));\n      return rng.map(nativeRangeToSelectionRange);\n    };\n    var getBookmark = function (root) {\n      var win = defaultView(root);\n      return readRange(win.dom).filter(isRngInRoot(root));\n    };\n    var validate = function (root, bookmark) {\n      return Optional.from(bookmark).filter(isRngInRoot(root)).map(normalizeRng);\n    };\n    var bookmarkToNativeRng = function (bookmark) {\n      var rng = document.createRange();\n      try {\n        rng.setStart(bookmark.start.dom, bookmark.soffset);\n        rng.setEnd(bookmark.finish.dom, bookmark.foffset);\n        return Optional.some(rng);\n      } catch (_) {\n        return Optional.none();\n      }\n    };\n    var store = function (editor) {\n      var newBookmark = shouldStore(editor) ? getBookmark(SugarElement.fromDom(editor.getBody())) : Optional.none();\n      editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;\n    };\n    var storeNative = function (editor, rng) {\n      var root = SugarElement.fromDom(editor.getBody());\n      var range = shouldStore(editor) ? Optional.from(rng) : Optional.none();\n      var newBookmark = range.map(nativeRangeToSelectionRange).filter(isRngInRoot(root));\n      editor.bookmark = newBookmark.isSome() ? newBookmark : editor.bookmark;\n    };\n    var getRng = function (editor) {\n      var bookmark = editor.bookmark ? editor.bookmark : Optional.none();\n      return bookmark.bind(function (x) {\n        return validate(SugarElement.fromDom(editor.getBody()), x);\n      }).bind(bookmarkToNativeRng);\n    };\n    var restore = function (editor) {\n      getRng(editor).each(function (rng) {\n        return editor.selection.setRng(rng);\n      });\n    };\n\n    var isEditorUIElement$1 = function (elm) {\n      var className = elm.className.toString();\n      return className.indexOf('tox-') !== -1 || className.indexOf('mce-') !== -1;\n    };\n    var FocusManager = { isEditorUIElement: isEditorUIElement$1 };\n\n    var isManualNodeChange = function (e) {\n      return e.type === 'nodechange' && e.selectionChange;\n    };\n    var registerPageMouseUp = function (editor, throttledStore) {\n      var mouseUpPage = function () {\n        throttledStore.throttle();\n      };\n      DOMUtils.DOM.bind(document, 'mouseup', mouseUpPage);\n      editor.on('remove', function () {\n        DOMUtils.DOM.unbind(document, 'mouseup', mouseUpPage);\n      });\n    };\n    var registerFocusOut = function (editor) {\n      editor.on('focusout', function () {\n        store(editor);\n      });\n    };\n    var registerMouseUp = function (editor, throttledStore) {\n      editor.on('mouseup touchend', function (_e) {\n        throttledStore.throttle();\n      });\n    };\n    var registerEditorEvents = function (editor, throttledStore) {\n      var browser = detect().browser;\n      if (browser.isIE()) {\n        registerFocusOut(editor);\n      } else {\n        registerMouseUp(editor, throttledStore);\n      }\n      editor.on('keyup NodeChange', function (e) {\n        if (!isManualNodeChange(e)) {\n          store(editor);\n        }\n      });\n    };\n    var register$3 = function (editor) {\n      var throttledStore = first(function () {\n        store(editor);\n      }, 0);\n      editor.on('init', function () {\n        if (editor.inline) {\n          registerPageMouseUp(editor, throttledStore);\n        }\n        registerEditorEvents(editor, throttledStore);\n      });\n      editor.on('remove', function () {\n        throttledStore.cancel();\n      });\n    };\n\n    var documentFocusInHandler;\n    var DOM$8 = DOMUtils.DOM;\n    var isEditorUIElement = function (elm) {\n      return FocusManager.isEditorUIElement(elm);\n    };\n    var isEditorContentAreaElement = function (elm) {\n      var classList = elm.classList;\n      if (classList !== undefined) {\n        return classList.contains('tox-edit-area') || classList.contains('tox-edit-area__iframe') || classList.contains('mce-content-body');\n      } else {\n        return false;\n      }\n    };\n    var isUIElement = function (editor, elm) {\n      var customSelector = getCustomUiSelector(editor);\n      var parent = DOM$8.getParent(elm, function (elm) {\n        return isEditorUIElement(elm) || (customSelector ? editor.dom.is(elm, customSelector) : false);\n      });\n      return parent !== null;\n    };\n    var getActiveElement = function (editor) {\n      try {\n        var root = getRootNode(SugarElement.fromDom(editor.getElement()));\n        return active(root).fold(function () {\n          return document.body;\n        }, function (x) {\n          return x.dom;\n        });\n      } catch (ex) {\n        return document.body;\n      }\n    };\n    var registerEvents$1 = function (editorManager, e) {\n      var editor = e.editor;\n      register$3(editor);\n      editor.on('focusin', function () {\n        var focusedEditor = editorManager.focusedEditor;\n        if (focusedEditor !== editor) {\n          if (focusedEditor) {\n            focusedEditor.fire('blur', { focusedEditor: editor });\n          }\n          editorManager.setActive(editor);\n          editorManager.focusedEditor = editor;\n          editor.fire('focus', { blurredEditor: focusedEditor });\n          editor.focus(true);\n        }\n      });\n      editor.on('focusout', function () {\n        Delay.setEditorTimeout(editor, function () {\n          var focusedEditor = editorManager.focusedEditor;\n          if (!isUIElement(editor, getActiveElement(editor)) && focusedEditor === editor) {\n            editor.fire('blur', { focusedEditor: null });\n            editorManager.focusedEditor = null;\n          }\n        });\n      });\n      if (!documentFocusInHandler) {\n        documentFocusInHandler = function (e) {\n          var activeEditor = editorManager.activeEditor;\n          if (activeEditor) {\n            getOriginalEventTarget(e).each(function (target) {\n              if (target.ownerDocument === document) {\n                if (target !== document.body && !isUIElement(activeEditor, target) && editorManager.focusedEditor === activeEditor) {\n                  activeEditor.fire('blur', { focusedEditor: null });\n                  editorManager.focusedEditor = null;\n                }\n              }\n            });\n          }\n        };\n        DOM$8.bind(document, 'focusin', documentFocusInHandler);\n      }\n    };\n    var unregisterDocumentEvents = function (editorManager, e) {\n      if (editorManager.focusedEditor === e.editor) {\n        editorManager.focusedEditor = null;\n      }\n      if (!editorManager.activeEditor) {\n        DOM$8.unbind(document, 'focusin', documentFocusInHandler);\n        documentFocusInHandler = null;\n      }\n    };\n    var setup$l = function (editorManager) {\n      editorManager.on('AddEditor', curry(registerEvents$1, editorManager));\n      editorManager.on('RemoveEditor', curry(unregisterDocumentEvents, editorManager));\n    };\n\n    var getContentEditableHost = function (editor, node) {\n      return editor.dom.getParent(node, function (node) {\n        return editor.dom.getContentEditable(node) === 'true';\n      });\n    };\n    var getCollapsedNode = function (rng) {\n      return rng.collapsed ? Optional.from(getNode$1(rng.startContainer, rng.startOffset)).map(SugarElement.fromDom) : Optional.none();\n    };\n    var getFocusInElement = function (root, rng) {\n      return getCollapsedNode(rng).bind(function (node) {\n        if (isTableSection(node)) {\n          return Optional.some(node);\n        } else if (contains$1(root, node) === false) {\n          return Optional.some(root);\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var normalizeSelection$1 = function (editor, rng) {\n      getFocusInElement(SugarElement.fromDom(editor.getBody()), rng).bind(function (elm) {\n        return firstPositionIn(elm.dom);\n      }).fold(function () {\n        editor.selection.normalize();\n        return;\n      }, function (caretPos) {\n        return editor.selection.setRng(caretPos.toRange());\n      });\n    };\n    var focusBody = function (body) {\n      if (body.setActive) {\n        try {\n          body.setActive();\n        } catch (ex) {\n          body.focus();\n        }\n      } else {\n        body.focus();\n      }\n    };\n    var hasElementFocus = function (elm) {\n      return hasFocus$1(elm) || search(elm).isSome();\n    };\n    var hasIframeFocus = function (editor) {\n      return editor.iframeElement && hasFocus$1(SugarElement.fromDom(editor.iframeElement));\n    };\n    var hasInlineFocus = function (editor) {\n      var rawBody = editor.getBody();\n      return rawBody && hasElementFocus(SugarElement.fromDom(rawBody));\n    };\n    var hasUiFocus = function (editor) {\n      var dos = getRootNode(SugarElement.fromDom(editor.getElement()));\n      return active(dos).filter(function (elem) {\n        return !isEditorContentAreaElement(elem.dom) && isUIElement(editor, elem.dom);\n      }).isSome();\n    };\n    var hasFocus = function (editor) {\n      return editor.inline ? hasInlineFocus(editor) : hasIframeFocus(editor);\n    };\n    var hasEditorOrUiFocus = function (editor) {\n      return hasFocus(editor) || hasUiFocus(editor);\n    };\n    var focusEditor = function (editor) {\n      var selection = editor.selection;\n      var body = editor.getBody();\n      var rng = selection.getRng();\n      editor.quirks.refreshContentEditable();\n      if (editor.bookmark !== undefined && hasFocus(editor) === false) {\n        getRng(editor).each(function (bookmarkRng) {\n          editor.selection.setRng(bookmarkRng);\n          rng = bookmarkRng;\n        });\n      }\n      var contentEditableHost = getContentEditableHost(editor, selection.getNode());\n      if (editor.$.contains(body, contentEditableHost)) {\n        focusBody(contentEditableHost);\n        normalizeSelection$1(editor, rng);\n        activateEditor(editor);\n        return;\n      }\n      if (!editor.inline) {\n        if (!Env.opera) {\n          focusBody(body);\n        }\n        editor.getWin().focus();\n      }\n      if (Env.gecko || editor.inline) {\n        focusBody(body);\n        normalizeSelection$1(editor, rng);\n      }\n      activateEditor(editor);\n    };\n    var activateEditor = function (editor) {\n      return editor.editorManager.setActive(editor);\n    };\n    var focus = function (editor, skipFocus) {\n      if (editor.removed) {\n        return;\n      }\n      if (skipFocus) {\n        activateEditor(editor);\n      } else {\n        focusEditor(editor);\n      }\n    };\n\n    var getEndpointElement = function (root, rng, start, real, resolve) {\n      var container = start ? rng.startContainer : rng.endContainer;\n      var offset = start ? rng.startOffset : rng.endOffset;\n      return Optional.from(container).map(SugarElement.fromDom).map(function (elm) {\n        return !real || !rng.collapsed ? child$1(elm, resolve(elm, offset)).getOr(elm) : elm;\n      }).bind(function (elm) {\n        return isElement$6(elm) ? Optional.some(elm) : parent(elm).filter(isElement$6);\n      }).map(function (elm) {\n        return elm.dom;\n      }).getOr(root);\n    };\n    var getStart = function (root, rng, real) {\n      return getEndpointElement(root, rng, true, real, function (elm, offset) {\n        return Math.min(childNodesCount(elm), offset);\n      });\n    };\n    var getEnd = function (root, rng, real) {\n      return getEndpointElement(root, rng, false, real, function (elm, offset) {\n        return offset > 0 ? offset - 1 : offset;\n      });\n    };\n    var skipEmptyTextNodes = function (node, forwards) {\n      var orig = node;\n      while (node && isText$7(node) && node.length === 0) {\n        node = forwards ? node.nextSibling : node.previousSibling;\n      }\n      return node || orig;\n    };\n    var getNode = function (root, rng) {\n      var elm, startContainer, endContainer;\n      if (!rng) {\n        return root;\n      }\n      startContainer = rng.startContainer;\n      endContainer = rng.endContainer;\n      var startOffset = rng.startOffset;\n      var endOffset = rng.endOffset;\n      elm = rng.commonAncestorContainer;\n      if (!rng.collapsed) {\n        if (startContainer === endContainer) {\n          if (endOffset - startOffset < 2) {\n            if (startContainer.hasChildNodes()) {\n              elm = startContainer.childNodes[startOffset];\n            }\n          }\n        }\n        if (startContainer.nodeType === 3 && endContainer.nodeType === 3) {\n          if (startContainer.length === startOffset) {\n            startContainer = skipEmptyTextNodes(startContainer.nextSibling, true);\n          } else {\n            startContainer = startContainer.parentNode;\n          }\n          if (endOffset === 0) {\n            endContainer = skipEmptyTextNodes(endContainer.previousSibling, false);\n          } else {\n            endContainer = endContainer.parentNode;\n          }\n          if (startContainer && startContainer === endContainer) {\n            return startContainer;\n          }\n        }\n      }\n      if (elm && elm.nodeType === 3) {\n        return elm.parentNode;\n      }\n      return elm;\n    };\n    var getSelectedBlocks = function (dom, rng, startElm, endElm) {\n      var node;\n      var selectedBlocks = [];\n      var root = dom.getRoot();\n      startElm = dom.getParent(startElm || getStart(root, rng, rng.collapsed), dom.isBlock);\n      endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock);\n      if (startElm && startElm !== root) {\n        selectedBlocks.push(startElm);\n      }\n      if (startElm && endElm && startElm !== endElm) {\n        node = startElm;\n        var walker = new DomTreeWalker(startElm, root);\n        while ((node = walker.next()) && node !== endElm) {\n          if (dom.isBlock(node)) {\n            selectedBlocks.push(node);\n          }\n        }\n      }\n      if (endElm && startElm !== endElm && endElm !== root) {\n        selectedBlocks.push(endElm);\n      }\n      return selectedBlocks;\n    };\n    var select = function (dom, node, content) {\n      return Optional.from(node).map(function (node) {\n        var idx = dom.nodeIndex(node);\n        var rng = dom.createRng();\n        rng.setStart(node.parentNode, idx);\n        rng.setEnd(node.parentNode, idx + 1);\n        if (content) {\n          moveEndPoint(dom, rng, node, true);\n          moveEndPoint(dom, rng, node, false);\n        }\n        return rng;\n      });\n    };\n\n    var processRanges = function (editor, ranges) {\n      return map$3(ranges, function (range) {\n        var evt = editor.fire('GetSelectionRange', { range: range });\n        return evt.range !== range ? evt.range : range;\n      });\n    };\n\n    var typeLookup = {\n      '#text': 3,\n      '#comment': 8,\n      '#cdata': 4,\n      '#pi': 7,\n      '#doctype': 10,\n      '#document-fragment': 11\n    };\n    var walk$1 = function (node, root, prev) {\n      var startName = prev ? 'lastChild' : 'firstChild';\n      var siblingName = prev ? 'prev' : 'next';\n      if (node[startName]) {\n        return node[startName];\n      }\n      if (node !== root) {\n        var sibling = node[siblingName];\n        if (sibling) {\n          return sibling;\n        }\n        for (var parent_1 = node.parent; parent_1 && parent_1 !== root; parent_1 = parent_1.parent) {\n          sibling = parent_1[siblingName];\n          if (sibling) {\n            return sibling;\n          }\n        }\n      }\n    };\n    var isEmptyTextNode = function (node) {\n      if (!isWhitespaceText(node.value)) {\n        return false;\n      }\n      var parentNode = node.parent;\n      if (parentNode && (parentNode.name !== 'span' || parentNode.attr('style')) && /^[ ]+$/.test(node.value)) {\n        return false;\n      }\n      return true;\n    };\n    var isNonEmptyElement = function (node) {\n      var isNamedAnchor = node.name === 'a' && !node.attr('href') && node.attr('id');\n      return node.attr('name') || node.attr('id') && !node.firstChild || node.attr('data-mce-bookmark') || isNamedAnchor;\n    };\n    var AstNode = function () {\n      function AstNode(name, type) {\n        this.name = name;\n        this.type = type;\n        if (type === 1) {\n          this.attributes = [];\n          this.attributes.map = {};\n        }\n      }\n      AstNode.create = function (name, attrs) {\n        var node = new AstNode(name, typeLookup[name] || 1);\n        if (attrs) {\n          each$j(attrs, function (value, attrName) {\n            node.attr(attrName, value);\n          });\n        }\n        return node;\n      };\n      AstNode.prototype.replace = function (node) {\n        var self = this;\n        if (node.parent) {\n          node.remove();\n        }\n        self.insert(node, self);\n        self.remove();\n        return self;\n      };\n      AstNode.prototype.attr = function (name, value) {\n        var self = this;\n        var attrs;\n        if (typeof name !== 'string') {\n          if (name !== undefined && name !== null) {\n            each$j(name, function (value, key) {\n              self.attr(key, value);\n            });\n          }\n          return self;\n        }\n        if (attrs = self.attributes) {\n          if (value !== undefined) {\n            if (value === null) {\n              if (name in attrs.map) {\n                delete attrs.map[name];\n                var i = attrs.length;\n                while (i--) {\n                  if (attrs[i].name === name) {\n                    attrs.splice(i, 1);\n                    return self;\n                  }\n                }\n              }\n              return self;\n            }\n            if (name in attrs.map) {\n              var i = attrs.length;\n              while (i--) {\n                if (attrs[i].name === name) {\n                  attrs[i].value = value;\n                  break;\n                }\n              }\n            } else {\n              attrs.push({\n                name: name,\n                value: value\n              });\n            }\n            attrs.map[name] = value;\n            return self;\n          }\n          return attrs.map[name];\n        }\n      };\n      AstNode.prototype.clone = function () {\n        var self = this;\n        var clone = new AstNode(self.name, self.type);\n        var selfAttrs;\n        if (selfAttrs = self.attributes) {\n          var cloneAttrs = [];\n          cloneAttrs.map = {};\n          for (var i = 0, l = selfAttrs.length; i < l; i++) {\n            var selfAttr = selfAttrs[i];\n            if (selfAttr.name !== 'id') {\n              cloneAttrs[cloneAttrs.length] = {\n                name: selfAttr.name,\n                value: selfAttr.value\n              };\n              cloneAttrs.map[selfAttr.name] = selfAttr.value;\n            }\n          }\n          clone.attributes = cloneAttrs;\n        }\n        clone.value = self.value;\n        clone.shortEnded = self.shortEnded;\n        return clone;\n      };\n      AstNode.prototype.wrap = function (wrapper) {\n        var self = this;\n        self.parent.insert(wrapper, self);\n        wrapper.append(self);\n        return self;\n      };\n      AstNode.prototype.unwrap = function () {\n        var self = this;\n        for (var node = self.firstChild; node;) {\n          var next = node.next;\n          self.insert(node, self, true);\n          node = next;\n        }\n        self.remove();\n      };\n      AstNode.prototype.remove = function () {\n        var self = this, parent = self.parent, next = self.next, prev = self.prev;\n        if (parent) {\n          if (parent.firstChild === self) {\n            parent.firstChild = next;\n            if (next) {\n              next.prev = null;\n            }\n          } else {\n            prev.next = next;\n          }\n          if (parent.lastChild === self) {\n            parent.lastChild = prev;\n            if (prev) {\n              prev.next = null;\n            }\n          } else {\n            next.prev = prev;\n          }\n          self.parent = self.next = self.prev = null;\n        }\n        return self;\n      };\n      AstNode.prototype.append = function (node) {\n        var self = this;\n        if (node.parent) {\n          node.remove();\n        }\n        var last = self.lastChild;\n        if (last) {\n          last.next = node;\n          node.prev = last;\n          self.lastChild = node;\n        } else {\n          self.lastChild = self.firstChild = node;\n        }\n        node.parent = self;\n        return node;\n      };\n      AstNode.prototype.insert = function (node, refNode, before) {\n        if (node.parent) {\n          node.remove();\n        }\n        var parent = refNode.parent || this;\n        if (before) {\n          if (refNode === parent.firstChild) {\n            parent.firstChild = node;\n          } else {\n            refNode.prev.next = node;\n          }\n          node.prev = refNode.prev;\n          node.next = refNode;\n          refNode.prev = node;\n        } else {\n          if (refNode === parent.lastChild) {\n            parent.lastChild = node;\n          } else {\n            refNode.next.prev = node;\n          }\n          node.next = refNode.next;\n          node.prev = refNode;\n          refNode.next = node;\n        }\n        node.parent = parent;\n        return node;\n      };\n      AstNode.prototype.getAll = function (name) {\n        var self = this;\n        var collection = [];\n        for (var node = self.firstChild; node; node = walk$1(node, self)) {\n          if (node.name === name) {\n            collection.push(node);\n          }\n        }\n        return collection;\n      };\n      AstNode.prototype.children = function () {\n        var self = this;\n        var collection = [];\n        for (var node = self.firstChild; node; node = node.next) {\n          collection.push(node);\n        }\n        return collection;\n      };\n      AstNode.prototype.empty = function () {\n        var self = this;\n        if (self.firstChild) {\n          var nodes = [];\n          for (var node = self.firstChild; node; node = walk$1(node, self)) {\n            nodes.push(node);\n          }\n          var i = nodes.length;\n          while (i--) {\n            var node = nodes[i];\n            node.parent = node.firstChild = node.lastChild = node.next = node.prev = null;\n          }\n        }\n        self.firstChild = self.lastChild = null;\n        return self;\n      };\n      AstNode.prototype.isEmpty = function (elements, whitespace, predicate) {\n        if (whitespace === void 0) {\n          whitespace = {};\n        }\n        var self = this;\n        var node = self.firstChild;\n        if (isNonEmptyElement(self)) {\n          return false;\n        }\n        if (node) {\n          do {\n            if (node.type === 1) {\n              if (node.attr('data-mce-bogus')) {\n                continue;\n              }\n              if (elements[node.name]) {\n                return false;\n              }\n              if (isNonEmptyElement(node)) {\n                return false;\n              }\n            }\n            if (node.type === 8) {\n              return false;\n            }\n            if (node.type === 3 && !isEmptyTextNode(node)) {\n              return false;\n            }\n            if (node.type === 3 && node.parent && whitespace[node.parent.name] && isWhitespaceText(node.value)) {\n              return false;\n            }\n            if (predicate && predicate(node)) {\n              return false;\n            }\n          } while (node = walk$1(node, self));\n        }\n        return true;\n      };\n      AstNode.prototype.walk = function (prev) {\n        return walk$1(this, null, prev);\n      };\n      return AstNode;\n    }();\n\n    var unescapedTextParents = Tools.makeMap('NOSCRIPT STYLE SCRIPT XMP IFRAME NOEMBED NOFRAMES PLAINTEXT', ' ');\n    var containsZwsp = function (node) {\n      return isString$1(node.nodeValue) && contains$2(node.nodeValue, ZWSP$1);\n    };\n    var getTemporaryNodeSelector = function (tempAttrs) {\n      return (tempAttrs.length === 0 ? '' : map$3(tempAttrs, function (attr) {\n        return '[' + attr + ']';\n      }).join(',') + ',') + '[data-mce-bogus=\"all\"]';\n    };\n    var getTemporaryNodes = function (tempAttrs, body) {\n      return body.querySelectorAll(getTemporaryNodeSelector(tempAttrs));\n    };\n    var createWalker = function (body, whatToShow, filter) {\n      return document.createTreeWalker(body, whatToShow, filter, false);\n    };\n    var createZwspCommentWalker = function (body) {\n      return createWalker(body, NodeFilter.SHOW_COMMENT, function (node) {\n        return containsZwsp(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n      });\n    };\n    var createUnescapedZwspTextWalker = function (body) {\n      return createWalker(body, NodeFilter.SHOW_TEXT, function (node) {\n        if (containsZwsp(node)) {\n          var parent_1 = node.parentNode;\n          return parent_1 && has$2(unescapedTextParents, parent_1.nodeName) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n        } else {\n          return NodeFilter.FILTER_SKIP;\n        }\n      });\n    };\n    var hasZwspComment = function (body) {\n      return createZwspCommentWalker(body).nextNode() !== null;\n    };\n    var hasUnescapedZwspText = function (body) {\n      return createUnescapedZwspTextWalker(body).nextNode() !== null;\n    };\n    var hasTemporaryNode = function (tempAttrs, body) {\n      return body.querySelector(getTemporaryNodeSelector(tempAttrs)) !== null;\n    };\n    var trimTemporaryNodes = function (tempAttrs, body) {\n      each$k(getTemporaryNodes(tempAttrs, body), function (elm) {\n        var element = SugarElement.fromDom(elm);\n        if (get$6(element, 'data-mce-bogus') === 'all') {\n          remove$7(element);\n        } else {\n          each$k(tempAttrs, function (attr) {\n            if (has$1(element, attr)) {\n              remove$6(element, attr);\n            }\n          });\n        }\n      });\n    };\n    var emptyAllNodeValuesInWalker = function (walker) {\n      var curr = walker.nextNode();\n      while (curr !== null) {\n        curr.nodeValue = null;\n        curr = walker.nextNode();\n      }\n    };\n    var emptyZwspComments = compose(emptyAllNodeValuesInWalker, createZwspCommentWalker);\n    var emptyUnescapedZwspTexts = compose(emptyAllNodeValuesInWalker, createUnescapedZwspTextWalker);\n    var trim$1 = function (body, tempAttrs) {\n      var conditionalTrims = [\n        {\n          condition: curry(hasTemporaryNode, tempAttrs),\n          action: curry(trimTemporaryNodes, tempAttrs)\n        },\n        {\n          condition: hasZwspComment,\n          action: emptyZwspComments\n        },\n        {\n          condition: hasUnescapedZwspText,\n          action: emptyUnescapedZwspTexts\n        }\n      ];\n      var trimmed = body;\n      var cloned = false;\n      each$k(conditionalTrims, function (_a) {\n        var condition = _a.condition, action = _a.action;\n        if (condition(trimmed)) {\n          if (!cloned) {\n            trimmed = body.cloneNode(true);\n            cloned = true;\n          }\n          action(trimmed);\n        }\n      });\n      return trimmed;\n    };\n\n    var trimEmptyContents = function (editor, html) {\n      var blockName = getForcedRootBlock(editor);\n      var emptyRegExp = new RegExp('^(<' + blockName + '[^>]*>(&nbsp;|&#160;|\\\\s|\\xA0|<br \\\\/>|)<\\\\/' + blockName + '>[\\r\\n]*|<br \\\\/>[\\r\\n]*)$');\n      return html.replace(emptyRegExp, '');\n    };\n    var setupArgs$3 = function (args, format) {\n      return __assign(__assign({}, args), {\n        format: format,\n        get: true,\n        getInner: true\n      });\n    };\n    var getContentFromBody = function (editor, args, format, body) {\n      var defaultedArgs = setupArgs$3(args, format);\n      var updatedArgs = args.no_events ? defaultedArgs : editor.fire('BeforeGetContent', defaultedArgs);\n      var content;\n      if (updatedArgs.format === 'raw') {\n        content = Tools.trim(trim$3(trim$1(body, editor.serializer.getTempAttrs()).innerHTML));\n      } else if (updatedArgs.format === 'text') {\n        content = editor.dom.isEmpty(body) ? '' : trim$3(body.innerText || body.textContent);\n      } else if (updatedArgs.format === 'tree') {\n        content = editor.serializer.serialize(body, updatedArgs);\n      } else {\n        content = trimEmptyContents(editor, editor.serializer.serialize(body, updatedArgs));\n      }\n      if (!contains$3([\n          'text',\n          'tree'\n        ], updatedArgs.format) && !isWsPreserveElement(SugarElement.fromDom(body))) {\n        updatedArgs.content = Tools.trim(content);\n      } else {\n        updatedArgs.content = content;\n      }\n      if (updatedArgs.no_events) {\n        return updatedArgs.content;\n      } else {\n        return editor.fire('GetContent', updatedArgs).content;\n      }\n    };\n    var getContentInternal = function (editor, args, format) {\n      return Optional.from(editor.getBody()).fold(constant(args.format === 'tree' ? new AstNode('body', 11) : ''), function (body) {\n        return getContentFromBody(editor, args, format, body);\n      });\n    };\n\n    var each$d = Tools.each;\n    var ElementUtils = function (dom) {\n      var compare = function (node1, node2) {\n        if (node1.nodeName !== node2.nodeName) {\n          return false;\n        }\n        var getAttribs = function (node) {\n          var attribs = {};\n          each$d(dom.getAttribs(node), function (attr) {\n            var name = attr.nodeName.toLowerCase();\n            if (name.indexOf('_') !== 0 && name !== 'style' && name.indexOf('data-') !== 0) {\n              attribs[name] = dom.getAttrib(node, name);\n            }\n          });\n          return attribs;\n        };\n        var compareObjects = function (obj1, obj2) {\n          var value, name;\n          for (name in obj1) {\n            if (has$2(obj1, name)) {\n              value = obj2[name];\n              if (typeof value === 'undefined') {\n                return false;\n              }\n              if (obj1[name] !== value) {\n                return false;\n              }\n              delete obj2[name];\n            }\n          }\n          for (name in obj2) {\n            if (has$2(obj2, name)) {\n              return false;\n            }\n          }\n          return true;\n        };\n        if (!compareObjects(getAttribs(node1), getAttribs(node2))) {\n          return false;\n        }\n        if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style')))) {\n          return false;\n        }\n        return !isBookmarkNode$1(node1) && !isBookmarkNode$1(node2);\n      };\n      return { compare: compare };\n    };\n\n    var makeMap$1 = Tools.makeMap;\n    var Writer = function (settings) {\n      var html = [];\n      settings = settings || {};\n      var indent = settings.indent;\n      var indentBefore = makeMap$1(settings.indent_before || '');\n      var indentAfter = makeMap$1(settings.indent_after || '');\n      var encode = Entities.getEncodeFunc(settings.entity_encoding || 'raw', settings.entities);\n      var htmlOutput = settings.element_format === 'html';\n      return {\n        start: function (name, attrs, empty) {\n          var i, l, attr, value;\n          if (indent && indentBefore[name] && html.length > 0) {\n            value = html[html.length - 1];\n            if (value.length > 0 && value !== '\\n') {\n              html.push('\\n');\n            }\n          }\n          html.push('<', name);\n          if (attrs) {\n            for (i = 0, l = attrs.length; i < l; i++) {\n              attr = attrs[i];\n              html.push(' ', attr.name, '=\"', encode(attr.value, true), '\"');\n            }\n          }\n          if (!empty || htmlOutput) {\n            html[html.length] = '>';\n          } else {\n            html[html.length] = ' />';\n          }\n          if (empty && indent && indentAfter[name] && html.length > 0) {\n            value = html[html.length - 1];\n            if (value.length > 0 && value !== '\\n') {\n              html.push('\\n');\n            }\n          }\n        },\n        end: function (name) {\n          var value;\n          html.push('</', name, '>');\n          if (indent && indentAfter[name] && html.length > 0) {\n            value = html[html.length - 1];\n            if (value.length > 0 && value !== '\\n') {\n              html.push('\\n');\n            }\n          }\n        },\n        text: function (text, raw) {\n          if (text.length > 0) {\n            html[html.length] = raw ? text : encode(text);\n          }\n        },\n        cdata: function (text) {\n          html.push('<![CDATA[', text, ']]>');\n        },\n        comment: function (text) {\n          html.push('<!--', text, '-->');\n        },\n        pi: function (name, text) {\n          if (text) {\n            html.push('<?', name, ' ', encode(text), '?>');\n          } else {\n            html.push('<?', name, '?>');\n          }\n          if (indent) {\n            html.push('\\n');\n          }\n        },\n        doctype: function (text) {\n          html.push('<!DOCTYPE', text, '>', indent ? '\\n' : '');\n        },\n        reset: function () {\n          html.length = 0;\n        },\n        getContent: function () {\n          return html.join('').replace(/\\n$/, '');\n        }\n      };\n    };\n\n    var HtmlSerializer = function (settings, schema) {\n      if (schema === void 0) {\n        schema = Schema();\n      }\n      var writer = Writer(settings);\n      settings = settings || {};\n      settings.validate = 'validate' in settings ? settings.validate : true;\n      var serialize = function (node) {\n        var validate = settings.validate;\n        var handlers = {\n          3: function (node) {\n            writer.text(node.value, node.raw);\n          },\n          8: function (node) {\n            writer.comment(node.value);\n          },\n          7: function (node) {\n            writer.pi(node.name, node.value);\n          },\n          10: function (node) {\n            writer.doctype(node.value);\n          },\n          4: function (node) {\n            writer.cdata(node.value);\n          },\n          11: function (node) {\n            if (node = node.firstChild) {\n              do {\n                walk(node);\n              } while (node = node.next);\n            }\n          }\n        };\n        writer.reset();\n        var walk = function (node) {\n          var handler = handlers[node.type];\n          if (!handler) {\n            var name_1 = node.name;\n            var isEmpty = node.shortEnded;\n            var attrs = node.attributes;\n            if (validate && attrs && attrs.length > 1) {\n              var sortedAttrs = [];\n              sortedAttrs.map = {};\n              var elementRule = schema.getElementRule(node.name);\n              if (elementRule) {\n                for (var i = 0, l = elementRule.attributesOrder.length; i < l; i++) {\n                  var attrName = elementRule.attributesOrder[i];\n                  if (attrName in attrs.map) {\n                    var attrValue = attrs.map[attrName];\n                    sortedAttrs.map[attrName] = attrValue;\n                    sortedAttrs.push({\n                      name: attrName,\n                      value: attrValue\n                    });\n                  }\n                }\n                for (var i = 0, l = attrs.length; i < l; i++) {\n                  var attrName = attrs[i].name;\n                  if (!(attrName in sortedAttrs.map)) {\n                    var attrValue = attrs.map[attrName];\n                    sortedAttrs.map[attrName] = attrValue;\n                    sortedAttrs.push({\n                      name: attrName,\n                      value: attrValue\n                    });\n                  }\n                }\n                attrs = sortedAttrs;\n              }\n            }\n            writer.start(node.name, attrs, isEmpty);\n            if (!isEmpty) {\n              if (node = node.firstChild) {\n                do {\n                  walk(node);\n                } while (node = node.next);\n              }\n              writer.end(name_1);\n            }\n          } else {\n            handler(node);\n          }\n        };\n        if (node.type === 1 && !settings.inner) {\n          walk(node);\n        } else {\n          handlers[11](node);\n        }\n        return writer.getContent();\n      };\n      return { serialize: serialize };\n    };\n\n    var nonInheritableStyles = new Set();\n    (function () {\n      var nonInheritableStylesArr = [\n        'margin',\n        'margin-left',\n        'margin-right',\n        'margin-top',\n        'margin-bottom',\n        'padding',\n        'padding-left',\n        'padding-right',\n        'padding-top',\n        'padding-bottom',\n        'border',\n        'border-width',\n        'border-style',\n        'border-color',\n        'background',\n        'background-attachment',\n        'background-clip',\n        'background-color',\n        'background-image',\n        'background-origin',\n        'background-position',\n        'background-repeat',\n        'background-size',\n        'float',\n        'position',\n        'left',\n        'right',\n        'top',\n        'bottom',\n        'z-index',\n        'display',\n        'transform',\n        'width',\n        'max-width',\n        'min-width',\n        'height',\n        'max-height',\n        'min-height',\n        'overflow',\n        'overflow-x',\n        'overflow-y',\n        'text-overflow',\n        'vertical-align',\n        'transition',\n        'transition-delay',\n        'transition-duration',\n        'transition-property',\n        'transition-timing-function'\n      ];\n      each$k(nonInheritableStylesArr, function (style) {\n        nonInheritableStyles.add(style);\n      });\n    }());\n    var shorthandStyleProps = [\n      'font',\n      'text-decoration',\n      'text-emphasis'\n    ];\n    var getStyleProps = function (dom, node) {\n      return keys(dom.parseStyle(dom.getAttrib(node, 'style')));\n    };\n    var isNonInheritableStyle = function (style) {\n      return nonInheritableStyles.has(style);\n    };\n    var hasInheritableStyles = function (dom, node) {\n      return forall(getStyleProps(dom, node), function (style) {\n        return !isNonInheritableStyle(style);\n      });\n    };\n    var getLonghandStyleProps = function (styles) {\n      return filter$4(styles, function (style) {\n        return exists(shorthandStyleProps, function (prop) {\n          return startsWith(style, prop);\n        });\n      });\n    };\n    var hasStyleConflict = function (dom, node, parentNode) {\n      var nodeStyleProps = getStyleProps(dom, node);\n      var parentNodeStyleProps = getStyleProps(dom, parentNode);\n      var valueMismatch = function (prop) {\n        var nodeValue = dom.getStyle(node, prop);\n        var parentValue = dom.getStyle(parentNode, prop);\n        return isNotEmpty(nodeValue) && isNotEmpty(parentValue) && nodeValue !== parentValue;\n      };\n      return exists(nodeStyleProps, function (nodeStyleProp) {\n        var propExists = function (props) {\n          return exists(props, function (prop) {\n            return prop === nodeStyleProp;\n          });\n        };\n        if (!propExists(parentNodeStyleProps) && propExists(shorthandStyleProps)) {\n          var longhandProps = getLonghandStyleProps(parentNodeStyleProps);\n          return exists(longhandProps, valueMismatch);\n        } else {\n          return valueMismatch(nodeStyleProp);\n        }\n      });\n    };\n\n    var isChar = function (forward, predicate, pos) {\n      return Optional.from(pos.container()).filter(isText$7).exists(function (text) {\n        var delta = forward ? 0 : -1;\n        return predicate(text.data.charAt(pos.offset() + delta));\n      });\n    };\n    var isBeforeSpace = curry(isChar, true, isWhiteSpace);\n    var isAfterSpace = curry(isChar, false, isWhiteSpace);\n    var isEmptyText = function (pos) {\n      var container = pos.container();\n      return isText$7(container) && (container.data.length === 0 || isZwsp(container.data) && BookmarkManager.isBookmarkNode(container.parentNode));\n    };\n    var matchesElementPosition = function (before, predicate) {\n      return function (pos) {\n        return Optional.from(getChildNodeAtRelativeOffset(before ? 0 : -1, pos)).filter(predicate).isSome();\n      };\n    };\n    var isImageBlock = function (node) {\n      return isImg(node) && get$5(SugarElement.fromDom(node), 'display') === 'block';\n    };\n    var isCefNode = function (node) {\n      return isContentEditableFalse$b(node) && !isBogusAll$1(node);\n    };\n    var isBeforeImageBlock = matchesElementPosition(true, isImageBlock);\n    var isAfterImageBlock = matchesElementPosition(false, isImageBlock);\n    var isBeforeMedia = matchesElementPosition(true, isMedia$2);\n    var isAfterMedia = matchesElementPosition(false, isMedia$2);\n    var isBeforeTable = matchesElementPosition(true, isTable$3);\n    var isAfterTable = matchesElementPosition(false, isTable$3);\n    var isBeforeContentEditableFalse = matchesElementPosition(true, isCefNode);\n    var isAfterContentEditableFalse = matchesElementPosition(false, isCefNode);\n\n    var getLastChildren = function (elm) {\n      var children = [];\n      var rawNode = elm.dom;\n      while (rawNode) {\n        children.push(SugarElement.fromDom(rawNode));\n        rawNode = rawNode.lastChild;\n      }\n      return children;\n    };\n    var removeTrailingBr = function (elm) {\n      var allBrs = descendants(elm, 'br');\n      var brs = filter$4(getLastChildren(elm).slice(-1), isBr$4);\n      if (allBrs.length === brs.length) {\n        each$k(brs, remove$7);\n      }\n    };\n    var fillWithPaddingBr = function (elm) {\n      empty(elm);\n      append$1(elm, SugarElement.fromHtml('<br data-mce-bogus=\"1\">'));\n    };\n    var trimBlockTrailingBr = function (elm) {\n      lastChild(elm).each(function (lastChild) {\n        prevSibling(lastChild).each(function (lastChildPrevSibling) {\n          if (isBlock$2(elm) && isBr$4(lastChild) && isBlock$2(lastChildPrevSibling)) {\n            remove$7(lastChild);\n          }\n        });\n      });\n    };\n\n    var dropLast = function (xs) {\n      return xs.slice(0, -1);\n    };\n    var parentsUntil = function (start, root, predicate) {\n      if (contains$1(root, start)) {\n        return dropLast(parents$1(start, function (elm) {\n          return predicate(elm) || eq(elm, root);\n        }));\n      } else {\n        return [];\n      }\n    };\n    var parents = function (start, root) {\n      return parentsUntil(start, root, never);\n    };\n    var parentsAndSelf = function (start, root) {\n      return [start].concat(parents(start, root));\n    };\n\n    var navigateIgnoreEmptyTextNodes = function (forward, root, from) {\n      return navigateIgnore(forward, root, from, isEmptyText);\n    };\n    var getClosestBlock$1 = function (root, pos) {\n      return find$3(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock$2);\n    };\n    var isAtBeforeAfterBlockBoundary = function (forward, root, pos) {\n      return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) {\n        return getClosestBlock$1(root, pos).fold(function () {\n          return isInSameBlock(newPos, pos, root.dom) === false;\n        }, function (fromBlock) {\n          return isInSameBlock(newPos, pos, root.dom) === false && contains$1(fromBlock, SugarElement.fromDom(newPos.container()));\n        });\n      });\n    };\n    var isAtBlockBoundary = function (forward, root, pos) {\n      return getClosestBlock$1(root, pos).fold(function () {\n        return navigateIgnoreEmptyTextNodes(forward, root.dom, pos).forall(function (newPos) {\n          return isInSameBlock(newPos, pos, root.dom) === false;\n        });\n      }, function (parent) {\n        return navigateIgnoreEmptyTextNodes(forward, parent.dom, pos).isNone();\n      });\n    };\n    var isAtStartOfBlock = curry(isAtBlockBoundary, false);\n    var isAtEndOfBlock = curry(isAtBlockBoundary, true);\n    var isBeforeBlock = curry(isAtBeforeAfterBlockBoundary, false);\n    var isAfterBlock = curry(isAtBeforeAfterBlockBoundary, true);\n\n    var isBr = function (pos) {\n      return getElementFromPosition(pos).exists(isBr$4);\n    };\n    var findBr = function (forward, root, pos) {\n      var parentBlocks = filter$4(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock$2);\n      var scope = head(parentBlocks).getOr(root);\n      return fromPosition(forward, scope.dom, pos).filter(isBr);\n    };\n    var isBeforeBr$1 = function (root, pos) {\n      return getElementFromPosition(pos).exists(isBr$4) || findBr(true, root, pos).isSome();\n    };\n    var isAfterBr = function (root, pos) {\n      return getElementFromPrevPosition(pos).exists(isBr$4) || findBr(false, root, pos).isSome();\n    };\n    var findPreviousBr = curry(findBr, false);\n    var findNextBr = curry(findBr, true);\n\n    var isInMiddleOfText = function (pos) {\n      return CaretPosition.isTextPosition(pos) && !pos.isAtStart() && !pos.isAtEnd();\n    };\n    var getClosestBlock = function (root, pos) {\n      var parentBlocks = filter$4(parentsAndSelf(SugarElement.fromDom(pos.container()), root), isBlock$2);\n      return head(parentBlocks).getOr(root);\n    };\n    var hasSpaceBefore = function (root, pos) {\n      if (isInMiddleOfText(pos)) {\n        return isAfterSpace(pos);\n      } else {\n        return isAfterSpace(pos) || prevPosition(getClosestBlock(root, pos).dom, pos).exists(isAfterSpace);\n      }\n    };\n    var hasSpaceAfter = function (root, pos) {\n      if (isInMiddleOfText(pos)) {\n        return isBeforeSpace(pos);\n      } else {\n        return isBeforeSpace(pos) || nextPosition(getClosestBlock(root, pos).dom, pos).exists(isBeforeSpace);\n      }\n    };\n    var isPreValue = function (value) {\n      return contains$3([\n        'pre',\n        'pre-wrap'\n      ], value);\n    };\n    var isInPre = function (pos) {\n      return getElementFromPosition(pos).bind(function (elm) {\n        return closest$3(elm, isElement$6);\n      }).exists(function (elm) {\n        return isPreValue(get$5(elm, 'white-space'));\n      });\n    };\n    var isAtBeginningOfBody = function (root, pos) {\n      return prevPosition(root.dom, pos).isNone();\n    };\n    var isAtEndOfBody = function (root, pos) {\n      return nextPosition(root.dom, pos).isNone();\n    };\n    var isAtLineBoundary = function (root, pos) {\n      return isAtBeginningOfBody(root, pos) || isAtEndOfBody(root, pos) || isAtStartOfBlock(root, pos) || isAtEndOfBlock(root, pos) || isAfterBr(root, pos) || isBeforeBr$1(root, pos);\n    };\n    var needsToHaveNbsp = function (root, pos) {\n      if (isInPre(pos)) {\n        return false;\n      } else {\n        return isAtLineBoundary(root, pos) || hasSpaceBefore(root, pos) || hasSpaceAfter(root, pos);\n      }\n    };\n    var needsToBeNbspLeft = function (root, pos) {\n      if (isInPre(pos)) {\n        return false;\n      } else {\n        return isAtStartOfBlock(root, pos) || isBeforeBlock(root, pos) || isAfterBr(root, pos) || hasSpaceBefore(root, pos);\n      }\n    };\n    var leanRight = function (pos) {\n      var container = pos.container();\n      var offset = pos.offset();\n      if (isText$7(container) && offset < container.data.length) {\n        return CaretPosition(container, offset + 1);\n      } else {\n        return pos;\n      }\n    };\n    var needsToBeNbspRight = function (root, pos) {\n      if (isInPre(pos)) {\n        return false;\n      } else {\n        return isAtEndOfBlock(root, pos) || isAfterBlock(root, pos) || isBeforeBr$1(root, pos) || hasSpaceAfter(root, pos);\n      }\n    };\n    var needsToBeNbsp = function (root, pos) {\n      return needsToBeNbspLeft(root, pos) || needsToBeNbspRight(root, leanRight(pos));\n    };\n    var isNbspAt = function (text, offset) {\n      return isNbsp(text.charAt(offset));\n    };\n    var hasNbsp = function (pos) {\n      var container = pos.container();\n      return isText$7(container) && contains$2(container.data, nbsp);\n    };\n    var normalizeNbspMiddle = function (text) {\n      var chars = text.split('');\n      return map$3(chars, function (chr, i) {\n        if (isNbsp(chr) && i > 0 && i < chars.length - 1 && isContent(chars[i - 1]) && isContent(chars[i + 1])) {\n          return ' ';\n        } else {\n          return chr;\n        }\n      }).join('');\n    };\n    var normalizeNbspAtStart = function (root, node) {\n      var text = node.data;\n      var firstPos = CaretPosition(node, 0);\n      if (isNbspAt(text, 0) && !needsToBeNbsp(root, firstPos)) {\n        node.data = ' ' + text.slice(1);\n        return true;\n      } else {\n        return false;\n      }\n    };\n    var normalizeNbspInMiddleOfTextNode = function (node) {\n      var text = node.data;\n      var newText = normalizeNbspMiddle(text);\n      if (newText !== text) {\n        node.data = newText;\n        return true;\n      } else {\n        return false;\n      }\n    };\n    var normalizeNbspAtEnd = function (root, node) {\n      var text = node.data;\n      var lastPos = CaretPosition(node, text.length - 1);\n      if (isNbspAt(text, text.length - 1) && !needsToBeNbsp(root, lastPos)) {\n        node.data = text.slice(0, -1) + ' ';\n        return true;\n      } else {\n        return false;\n      }\n    };\n    var normalizeNbsps = function (root, pos) {\n      return Optional.some(pos).filter(hasNbsp).bind(function (pos) {\n        var container = pos.container();\n        var normalized = normalizeNbspAtStart(root, container) || normalizeNbspInMiddleOfTextNode(container) || normalizeNbspAtEnd(root, container);\n        return normalized ? Optional.some(pos) : Optional.none();\n      });\n    };\n    var normalizeNbspsInEditor = function (editor) {\n      var root = SugarElement.fromDom(editor.getBody());\n      if (editor.selection.isCollapsed()) {\n        normalizeNbsps(root, CaretPosition.fromRangeStart(editor.selection.getRng())).each(function (pos) {\n          editor.selection.setRng(pos.toRange());\n        });\n      }\n    };\n\n    var normalizeContent = function (content, isStartOfContent, isEndOfContent) {\n      var result = foldl(content, function (acc, c) {\n        if (isWhiteSpace(c) || isNbsp(c)) {\n          if (acc.previousCharIsSpace || acc.str === '' && isStartOfContent || acc.str.length === content.length - 1 && isEndOfContent) {\n            return {\n              previousCharIsSpace: false,\n              str: acc.str + nbsp\n            };\n          } else {\n            return {\n              previousCharIsSpace: true,\n              str: acc.str + ' '\n            };\n          }\n        } else {\n          return {\n            previousCharIsSpace: false,\n            str: acc.str + c\n          };\n        }\n      }, {\n        previousCharIsSpace: false,\n        str: ''\n      });\n      return result.str;\n    };\n    var normalize$1 = function (node, offset, count) {\n      if (count === 0) {\n        return;\n      }\n      var elm = SugarElement.fromDom(node);\n      var root = ancestor$3(elm, isBlock$2).getOr(elm);\n      var whitespace = node.data.slice(offset, offset + count);\n      var isEndOfContent = offset + count >= node.data.length && needsToBeNbspRight(root, CaretPosition(node, node.data.length));\n      var isStartOfContent = offset === 0 && needsToBeNbspLeft(root, CaretPosition(node, 0));\n      node.replaceData(offset, count, normalizeContent(whitespace, isStartOfContent, isEndOfContent));\n    };\n    var normalizeWhitespaceAfter = function (node, offset) {\n      var content = node.data.slice(offset);\n      var whitespaceCount = content.length - lTrim(content).length;\n      normalize$1(node, offset, whitespaceCount);\n    };\n    var normalizeWhitespaceBefore = function (node, offset) {\n      var content = node.data.slice(0, offset);\n      var whitespaceCount = content.length - rTrim(content).length;\n      normalize$1(node, offset - whitespaceCount, whitespaceCount);\n    };\n    var mergeTextNodes = function (prevNode, nextNode, normalizeWhitespace, mergeToPrev) {\n      if (mergeToPrev === void 0) {\n        mergeToPrev = true;\n      }\n      var whitespaceOffset = rTrim(prevNode.data).length;\n      var newNode = mergeToPrev ? prevNode : nextNode;\n      var removeNode = mergeToPrev ? nextNode : prevNode;\n      if (mergeToPrev) {\n        newNode.appendData(removeNode.data);\n      } else {\n        newNode.insertData(0, removeNode.data);\n      }\n      remove$7(SugarElement.fromDom(removeNode));\n      if (normalizeWhitespace) {\n        normalizeWhitespaceAfter(newNode, whitespaceOffset);\n      }\n      return newNode;\n    };\n\n    var needsReposition = function (pos, elm) {\n      var container = pos.container();\n      var offset = pos.offset();\n      return CaretPosition.isTextPosition(pos) === false && container === elm.parentNode && offset > CaretPosition.before(elm).offset();\n    };\n    var reposition = function (elm, pos) {\n      return needsReposition(pos, elm) ? CaretPosition(pos.container(), pos.offset() - 1) : pos;\n    };\n    var beforeOrStartOf = function (node) {\n      return isText$7(node) ? CaretPosition(node, 0) : CaretPosition.before(node);\n    };\n    var afterOrEndOf = function (node) {\n      return isText$7(node) ? CaretPosition(node, node.data.length) : CaretPosition.after(node);\n    };\n    var getPreviousSiblingCaretPosition = function (elm) {\n      if (isCaretCandidate$3(elm.previousSibling)) {\n        return Optional.some(afterOrEndOf(elm.previousSibling));\n      } else {\n        return elm.previousSibling ? lastPositionIn(elm.previousSibling) : Optional.none();\n      }\n    };\n    var getNextSiblingCaretPosition = function (elm) {\n      if (isCaretCandidate$3(elm.nextSibling)) {\n        return Optional.some(beforeOrStartOf(elm.nextSibling));\n      } else {\n        return elm.nextSibling ? firstPositionIn(elm.nextSibling) : Optional.none();\n      }\n    };\n    var findCaretPositionBackwardsFromElm = function (rootElement, elm) {\n      var startPosition = CaretPosition.before(elm.previousSibling ? elm.previousSibling : elm.parentNode);\n      return prevPosition(rootElement, startPosition).fold(function () {\n        return nextPosition(rootElement, CaretPosition.after(elm));\n      }, Optional.some);\n    };\n    var findCaretPositionForwardsFromElm = function (rootElement, elm) {\n      return nextPosition(rootElement, CaretPosition.after(elm)).fold(function () {\n        return prevPosition(rootElement, CaretPosition.before(elm));\n      }, Optional.some);\n    };\n    var findCaretPositionBackwards = function (rootElement, elm) {\n      return getPreviousSiblingCaretPosition(elm).orThunk(function () {\n        return getNextSiblingCaretPosition(elm);\n      }).orThunk(function () {\n        return findCaretPositionBackwardsFromElm(rootElement, elm);\n      });\n    };\n    var findCaretPositionForward = function (rootElement, elm) {\n      return getNextSiblingCaretPosition(elm).orThunk(function () {\n        return getPreviousSiblingCaretPosition(elm);\n      }).orThunk(function () {\n        return findCaretPositionForwardsFromElm(rootElement, elm);\n      });\n    };\n    var findCaretPosition = function (forward, rootElement, elm) {\n      return forward ? findCaretPositionForward(rootElement, elm) : findCaretPositionBackwards(rootElement, elm);\n    };\n    var findCaretPosOutsideElmAfterDelete = function (forward, rootElement, elm) {\n      return findCaretPosition(forward, rootElement, elm).map(curry(reposition, elm));\n    };\n    var setSelection$1 = function (editor, forward, pos) {\n      pos.fold(function () {\n        editor.focus();\n      }, function (pos) {\n        editor.selection.setRng(pos.toRange(), forward);\n      });\n    };\n    var eqRawNode = function (rawNode) {\n      return function (elm) {\n        return elm.dom === rawNode;\n      };\n    };\n    var isBlock = function (editor, elm) {\n      return elm && has$2(editor.schema.getBlockElements(), name(elm));\n    };\n    var paddEmptyBlock = function (elm) {\n      if (isEmpty$2(elm)) {\n        var br = SugarElement.fromHtml('<br data-mce-bogus=\"1\">');\n        empty(elm);\n        append$1(elm, br);\n        return Optional.some(CaretPosition.before(br.dom));\n      } else {\n        return Optional.none();\n      }\n    };\n    var deleteNormalized = function (elm, afterDeletePosOpt, normalizeWhitespace) {\n      var prevTextOpt = prevSibling(elm).filter(isText$8);\n      var nextTextOpt = nextSibling(elm).filter(isText$8);\n      remove$7(elm);\n      return lift3(prevTextOpt, nextTextOpt, afterDeletePosOpt, function (prev, next, pos) {\n        var prevNode = prev.dom, nextNode = next.dom;\n        var offset = prevNode.data.length;\n        mergeTextNodes(prevNode, nextNode, normalizeWhitespace);\n        return pos.container() === nextNode ? CaretPosition(prevNode, offset) : pos;\n      }).orThunk(function () {\n        if (normalizeWhitespace) {\n          prevTextOpt.each(function (elm) {\n            return normalizeWhitespaceBefore(elm.dom, elm.dom.length);\n          });\n          nextTextOpt.each(function (elm) {\n            return normalizeWhitespaceAfter(elm.dom, 0);\n          });\n        }\n        return afterDeletePosOpt;\n      });\n    };\n    var isInlineElement = function (editor, element) {\n      return has$2(editor.schema.getTextInlineElements(), name(element));\n    };\n    var deleteElement$2 = function (editor, forward, elm, moveCaret) {\n      if (moveCaret === void 0) {\n        moveCaret = true;\n      }\n      var afterDeletePos = findCaretPosOutsideElmAfterDelete(forward, editor.getBody(), elm.dom);\n      var parentBlock = ancestor$3(elm, curry(isBlock, editor), eqRawNode(editor.getBody()));\n      var normalizedAfterDeletePos = deleteNormalized(elm, afterDeletePos, isInlineElement(editor, elm));\n      if (editor.dom.isEmpty(editor.getBody())) {\n        editor.setContent('');\n        editor.selection.setCursorLocation();\n      } else {\n        parentBlock.bind(paddEmptyBlock).fold(function () {\n          if (moveCaret) {\n            setSelection$1(editor, forward, normalizedAfterDeletePos);\n          }\n        }, function (paddPos) {\n          if (moveCaret) {\n            setSelection$1(editor, forward, Optional.some(paddPos));\n          }\n        });\n      }\n    };\n\n    var isRootFromElement = function (root) {\n      return function (cur) {\n        return eq(root, cur);\n      };\n    };\n    var getTableCells = function (table) {\n      return descendants(table, 'td,th');\n    };\n    var getTableDetailsFromRange = function (rng, isRoot) {\n      var getTable = function (node) {\n        return getClosestTable(SugarElement.fromDom(node), isRoot);\n      };\n      var startTable = getTable(rng.startContainer);\n      var endTable = getTable(rng.endContainer);\n      var isStartInTable = startTable.isSome();\n      var isEndInTable = endTable.isSome();\n      var isSameTable = lift2(startTable, endTable, eq).getOr(false);\n      var isMultiTable = !isSameTable && isStartInTable && isEndInTable;\n      return {\n        startTable: startTable,\n        endTable: endTable,\n        isStartInTable: isStartInTable,\n        isEndInTable: isEndInTable,\n        isSameTable: isSameTable,\n        isMultiTable: isMultiTable\n      };\n    };\n\n    var tableCellRng = function (start, end) {\n      return {\n        start: start,\n        end: end\n      };\n    };\n    var tableSelection = function (rng, table, cells) {\n      return {\n        rng: rng,\n        table: table,\n        cells: cells\n      };\n    };\n    var deleteAction = Adt.generate([\n      {\n        singleCellTable: [\n          'rng',\n          'cell'\n        ]\n      },\n      { fullTable: ['table'] },\n      {\n        partialTable: [\n          'cells',\n          'outsideDetails'\n        ]\n      },\n      {\n        multiTable: [\n          'startTableCells',\n          'endTableCells',\n          'betweenRng'\n        ]\n      }\n    ]);\n    var getClosestCell$1 = function (container, isRoot) {\n      return closest$2(SugarElement.fromDom(container), 'td,th', isRoot);\n    };\n    var isExpandedCellRng = function (cellRng) {\n      return !eq(cellRng.start, cellRng.end);\n    };\n    var getTableFromCellRng = function (cellRng, isRoot) {\n      return getClosestTable(cellRng.start, isRoot).bind(function (startParentTable) {\n        return getClosestTable(cellRng.end, isRoot).bind(function (endParentTable) {\n          return someIf(eq(startParentTable, endParentTable), startParentTable);\n        });\n      });\n    };\n    var isSingleCellTable = function (cellRng, isRoot) {\n      return !isExpandedCellRng(cellRng) && getTableFromCellRng(cellRng, isRoot).exists(function (table) {\n        var rows = table.dom.rows;\n        return rows.length === 1 && rows[0].cells.length === 1;\n      });\n    };\n    var getCellRng = function (rng, isRoot) {\n      var startCell = getClosestCell$1(rng.startContainer, isRoot);\n      var endCell = getClosestCell$1(rng.endContainer, isRoot);\n      return lift2(startCell, endCell, tableCellRng);\n    };\n    var getCellRangeFromStartTable = function (isRoot) {\n      return function (startCell) {\n        return getClosestTable(startCell, isRoot).bind(function (table) {\n          return last$2(getTableCells(table)).map(function (endCell) {\n            return tableCellRng(startCell, endCell);\n          });\n        });\n      };\n    };\n    var getCellRangeFromEndTable = function (isRoot) {\n      return function (endCell) {\n        return getClosestTable(endCell, isRoot).bind(function (table) {\n          return head(getTableCells(table)).map(function (startCell) {\n            return tableCellRng(startCell, endCell);\n          });\n        });\n      };\n    };\n    var getTableSelectionFromCellRng = function (isRoot) {\n      return function (cellRng) {\n        return getTableFromCellRng(cellRng, isRoot).map(function (table) {\n          return tableSelection(cellRng, table, getTableCells(table));\n        });\n      };\n    };\n    var getTableSelections = function (cellRng, selectionDetails, rng, isRoot) {\n      if (rng.collapsed || !cellRng.forall(isExpandedCellRng)) {\n        return Optional.none();\n      } else if (selectionDetails.isSameTable) {\n        var sameTableSelection = cellRng.bind(getTableSelectionFromCellRng(isRoot));\n        return Optional.some({\n          start: sameTableSelection,\n          end: sameTableSelection\n        });\n      } else {\n        var startCell = getClosestCell$1(rng.startContainer, isRoot);\n        var endCell = getClosestCell$1(rng.endContainer, isRoot);\n        var startTableSelection = startCell.bind(getCellRangeFromStartTable(isRoot)).bind(getTableSelectionFromCellRng(isRoot));\n        var endTableSelection = endCell.bind(getCellRangeFromEndTable(isRoot)).bind(getTableSelectionFromCellRng(isRoot));\n        return Optional.some({\n          start: startTableSelection,\n          end: endTableSelection\n        });\n      }\n    };\n    var getCellIndex = function (cells, cell) {\n      return findIndex$2(cells, function (x) {\n        return eq(x, cell);\n      });\n    };\n    var getSelectedCells = function (tableSelection) {\n      return lift2(getCellIndex(tableSelection.cells, tableSelection.rng.start), getCellIndex(tableSelection.cells, tableSelection.rng.end), function (startIndex, endIndex) {\n        return tableSelection.cells.slice(startIndex, endIndex + 1);\n      });\n    };\n    var isSingleCellTableContentSelected = function (optCellRng, rng, isRoot) {\n      return optCellRng.exists(function (cellRng) {\n        return isSingleCellTable(cellRng, isRoot) && hasAllContentsSelected(cellRng.start, rng);\n      });\n    };\n    var unselectCells = function (rng, selectionDetails) {\n      var startTable = selectionDetails.startTable, endTable = selectionDetails.endTable;\n      var otherContentRng = rng.cloneRange();\n      startTable.each(function (table) {\n        return otherContentRng.setStartAfter(table.dom);\n      });\n      endTable.each(function (table) {\n        return otherContentRng.setEndBefore(table.dom);\n      });\n      return otherContentRng;\n    };\n    var handleSingleTable = function (cellRng, selectionDetails, rng, isRoot) {\n      return getTableSelections(cellRng, selectionDetails, rng, isRoot).bind(function (_a) {\n        var start = _a.start, end = _a.end;\n        return start.or(end);\n      }).bind(function (tableSelection) {\n        var isSameTable = selectionDetails.isSameTable;\n        var selectedCells = getSelectedCells(tableSelection).getOr([]);\n        if (isSameTable && tableSelection.cells.length === selectedCells.length) {\n          return Optional.some(deleteAction.fullTable(tableSelection.table));\n        } else if (selectedCells.length > 0) {\n          if (isSameTable) {\n            return Optional.some(deleteAction.partialTable(selectedCells, Optional.none()));\n          } else {\n            var otherContentRng = unselectCells(rng, selectionDetails);\n            return Optional.some(deleteAction.partialTable(selectedCells, Optional.some(__assign(__assign({}, selectionDetails), { rng: otherContentRng }))));\n          }\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var handleMultiTable = function (cellRng, selectionDetails, rng, isRoot) {\n      return getTableSelections(cellRng, selectionDetails, rng, isRoot).bind(function (_a) {\n        var start = _a.start, end = _a.end;\n        var startTableSelectedCells = start.bind(getSelectedCells).getOr([]);\n        var endTableSelectedCells = end.bind(getSelectedCells).getOr([]);\n        if (startTableSelectedCells.length > 0 && endTableSelectedCells.length > 0) {\n          var otherContentRng = unselectCells(rng, selectionDetails);\n          return Optional.some(deleteAction.multiTable(startTableSelectedCells, endTableSelectedCells, otherContentRng));\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var getActionFromRange = function (root, rng) {\n      var isRoot = isRootFromElement(root);\n      var optCellRng = getCellRng(rng, isRoot);\n      var selectionDetails = getTableDetailsFromRange(rng, isRoot);\n      if (isSingleCellTableContentSelected(optCellRng, rng, isRoot)) {\n        return optCellRng.map(function (cellRng) {\n          return deleteAction.singleCellTable(rng, cellRng.start);\n        });\n      } else if (selectionDetails.isMultiTable) {\n        return handleMultiTable(optCellRng, selectionDetails, rng, isRoot);\n      } else {\n        return handleSingleTable(optCellRng, selectionDetails, rng, isRoot);\n      }\n    };\n\n    var freefallRtl = function (root) {\n      var child = isComment$1(root) ? prevSibling(root) : lastChild(root);\n      return child.bind(freefallRtl).orThunk(function () {\n        return Optional.some(root);\n      });\n    };\n    var cleanCells = function (cells) {\n      return each$k(cells, function (cell) {\n        remove$6(cell, 'contenteditable');\n        fillWithPaddingBr(cell);\n      });\n    };\n    var getOutsideBlock = function (editor, container) {\n      return Optional.from(editor.dom.getParent(container, editor.dom.isBlock)).map(SugarElement.fromDom);\n    };\n    var handleEmptyBlock = function (editor, startInTable, emptyBlock) {\n      emptyBlock.each(function (block) {\n        if (startInTable) {\n          remove$7(block);\n        } else {\n          fillWithPaddingBr(block);\n          editor.selection.setCursorLocation(block.dom, 0);\n        }\n      });\n    };\n    var deleteContentInsideCell = function (editor, cell, rng, isFirstCellInSelection) {\n      var insideTableRng = rng.cloneRange();\n      if (isFirstCellInSelection) {\n        insideTableRng.setStart(rng.startContainer, rng.startOffset);\n        insideTableRng.setEndAfter(cell.dom.lastChild);\n      } else {\n        insideTableRng.setStartBefore(cell.dom.firstChild);\n        insideTableRng.setEnd(rng.endContainer, rng.endOffset);\n      }\n      deleteCellContents(editor, insideTableRng, cell, false);\n    };\n    var collapseAndRestoreCellSelection = function (editor) {\n      var selectedCells = getCellsFromEditor(editor);\n      var selectedNode = SugarElement.fromDom(editor.selection.getNode());\n      if (isTableCell$5(selectedNode.dom) && isEmpty$2(selectedNode)) {\n        editor.selection.setCursorLocation(selectedNode.dom, 0);\n      } else {\n        editor.selection.collapse(true);\n      }\n      if (selectedCells.length > 1 && exists(selectedCells, function (cell) {\n          return eq(cell, selectedNode);\n        })) {\n        set$1(selectedNode, 'data-mce-selected', '1');\n      }\n    };\n    var emptySingleTableCells = function (editor, cells, outsideDetails) {\n      var editorRng = editor.selection.getRng();\n      var cellsToClean = outsideDetails.bind(function (_a) {\n        var rng = _a.rng, isStartInTable = _a.isStartInTable;\n        var outsideBlock = getOutsideBlock(editor, isStartInTable ? rng.endContainer : rng.startContainer);\n        rng.deleteContents();\n        handleEmptyBlock(editor, isStartInTable, outsideBlock.filter(isEmpty$2));\n        var endPointCell = isStartInTable ? cells[0] : cells[cells.length - 1];\n        deleteContentInsideCell(editor, endPointCell, editorRng, isStartInTable);\n        if (!isEmpty$2(endPointCell)) {\n          return Optional.some(isStartInTable ? cells.slice(1) : cells.slice(0, -1));\n        } else {\n          return Optional.none();\n        }\n      }).getOr(cells);\n      cleanCells(cellsToClean);\n      collapseAndRestoreCellSelection(editor);\n      return true;\n    };\n    var emptyMultiTableCells = function (editor, startTableCells, endTableCells, betweenRng) {\n      var rng = editor.selection.getRng();\n      var startCell = startTableCells[0];\n      var endCell = endTableCells[endTableCells.length - 1];\n      deleteContentInsideCell(editor, startCell, rng, true);\n      deleteContentInsideCell(editor, endCell, rng, false);\n      var startTableCellsToClean = isEmpty$2(startCell) ? startTableCells : startTableCells.slice(1);\n      var endTableCellsToClean = isEmpty$2(endCell) ? endTableCells : endTableCells.slice(0, -1);\n      cleanCells(startTableCellsToClean.concat(endTableCellsToClean));\n      betweenRng.deleteContents();\n      collapseAndRestoreCellSelection(editor);\n      return true;\n    };\n    var deleteCellContents = function (editor, rng, cell, moveSelection) {\n      if (moveSelection === void 0) {\n        moveSelection = true;\n      }\n      rng.deleteContents();\n      var lastNode = freefallRtl(cell).getOr(cell);\n      var lastBlock = SugarElement.fromDom(editor.dom.getParent(lastNode.dom, editor.dom.isBlock));\n      if (isEmpty$2(lastBlock)) {\n        fillWithPaddingBr(lastBlock);\n        if (moveSelection) {\n          editor.selection.setCursorLocation(lastBlock.dom, 0);\n        }\n      }\n      if (!eq(cell, lastBlock)) {\n        var additionalCleanupNodes = is$1(parent(lastBlock), cell) ? [] : siblings(lastBlock);\n        each$k(additionalCleanupNodes.concat(children(cell)), function (node) {\n          if (!eq(node, lastBlock) && !contains$1(node, lastBlock) && isEmpty$2(node)) {\n            remove$7(node);\n          }\n        });\n      }\n      return true;\n    };\n    var deleteTableElement = function (editor, table) {\n      deleteElement$2(editor, false, table);\n      return true;\n    };\n    var deleteCellRange = function (editor, rootElm, rng) {\n      return getActionFromRange(rootElm, rng).map(function (action) {\n        return action.fold(curry(deleteCellContents, editor), curry(deleteTableElement, editor), curry(emptySingleTableCells, editor), curry(emptyMultiTableCells, editor));\n      });\n    };\n    var deleteCaptionRange = function (editor, caption) {\n      return emptyElement(editor, caption);\n    };\n    var deleteTableRange = function (editor, rootElm, rng, startElm) {\n      return getParentCaption(rootElm, startElm).fold(function () {\n        return deleteCellRange(editor, rootElm, rng);\n      }, function (caption) {\n        return deleteCaptionRange(editor, caption);\n      }).getOr(false);\n    };\n    var deleteRange$2 = function (editor, startElm, selectedCells) {\n      var rootNode = SugarElement.fromDom(editor.getBody());\n      var rng = editor.selection.getRng();\n      return selectedCells.length !== 0 ? emptySingleTableCells(editor, selectedCells, Optional.none()) : deleteTableRange(editor, rootNode, rng, startElm);\n    };\n    var getParentCell = function (rootElm, elm) {\n      return find$3(parentsAndSelf(elm, rootElm), isTableCell$4);\n    };\n    var getParentCaption = function (rootElm, elm) {\n      return find$3(parentsAndSelf(elm, rootElm), isTag('caption'));\n    };\n    var deleteBetweenCells = function (editor, rootElm, forward, fromCell, from) {\n      return navigate(forward, editor.getBody(), from).bind(function (to) {\n        return getParentCell(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCell) {\n          return eq(toCell, fromCell) === false;\n        });\n      });\n    };\n    var emptyElement = function (editor, elm) {\n      fillWithPaddingBr(elm);\n      editor.selection.setCursorLocation(elm.dom, 0);\n      return Optional.some(true);\n    };\n    var isDeleteOfLastCharPos = function (fromCaption, forward, from, to) {\n      return firstPositionIn(fromCaption.dom).bind(function (first) {\n        return lastPositionIn(fromCaption.dom).map(function (last) {\n          return forward ? from.isEqual(first) && to.isEqual(last) : from.isEqual(last) && to.isEqual(first);\n        });\n      }).getOr(true);\n    };\n    var emptyCaretCaption = function (editor, elm) {\n      return emptyElement(editor, elm);\n    };\n    var validateCaretCaption = function (rootElm, fromCaption, to) {\n      return getParentCaption(rootElm, SugarElement.fromDom(to.getNode())).map(function (toCaption) {\n        return eq(toCaption, fromCaption) === false;\n      });\n    };\n    var deleteCaretInsideCaption = function (editor, rootElm, forward, fromCaption, from) {\n      return navigate(forward, editor.getBody(), from).bind(function (to) {\n        return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to);\n      }).or(Optional.some(true));\n    };\n    var deleteCaretCells = function (editor, forward, rootElm, startElm) {\n      var from = CaretPosition.fromRangeStart(editor.selection.getRng());\n      return getParentCell(rootElm, startElm).bind(function (fromCell) {\n        return isEmpty$2(fromCell) ? emptyElement(editor, fromCell) : deleteBetweenCells(editor, rootElm, forward, fromCell, from);\n      }).getOr(false);\n    };\n    var deleteCaretCaption = function (editor, forward, rootElm, fromCaption) {\n      var from = CaretPosition.fromRangeStart(editor.selection.getRng());\n      return isEmpty$2(fromCaption) ? emptyElement(editor, fromCaption) : deleteCaretInsideCaption(editor, rootElm, forward, fromCaption, from);\n    };\n    var isNearTable = function (forward, pos) {\n      return forward ? isBeforeTable(pos) : isAfterTable(pos);\n    };\n    var isBeforeOrAfterTable = function (editor, forward) {\n      var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());\n      return isNearTable(forward, fromPos) || fromPosition(forward, editor.getBody(), fromPos).exists(function (pos) {\n        return isNearTable(forward, pos);\n      });\n    };\n    var deleteCaret$3 = function (editor, forward, startElm) {\n      var rootElm = SugarElement.fromDom(editor.getBody());\n      return getParentCaption(rootElm, startElm).fold(function () {\n        return deleteCaretCells(editor, forward, rootElm, startElm) || isBeforeOrAfterTable(editor, forward);\n      }, function (fromCaption) {\n        return deleteCaretCaption(editor, forward, rootElm, fromCaption).getOr(false);\n      });\n    };\n    var backspaceDelete$9 = function (editor, forward) {\n      var startElm = SugarElement.fromDom(editor.selection.getStart(true));\n      var cells = getCellsFromEditor(editor);\n      return editor.selection.isCollapsed() && cells.length === 0 ? deleteCaret$3(editor, forward, startElm) : deleteRange$2(editor, startElm, cells);\n    };\n\n    var createRange = function (sc, so, ec, eo) {\n      var rng = document.createRange();\n      rng.setStart(sc, so);\n      rng.setEnd(ec, eo);\n      return rng;\n    };\n    var normalizeBlockSelectionRange = function (rng) {\n      var startPos = CaretPosition.fromRangeStart(rng);\n      var endPos = CaretPosition.fromRangeEnd(rng);\n      var rootNode = rng.commonAncestorContainer;\n      return fromPosition(false, rootNode, endPos).map(function (newEndPos) {\n        if (!isInSameBlock(startPos, endPos, rootNode) && isInSameBlock(startPos, newEndPos, rootNode)) {\n          return createRange(startPos.container(), startPos.offset(), newEndPos.container(), newEndPos.offset());\n        } else {\n          return rng;\n        }\n      }).getOr(rng);\n    };\n    var normalize = function (rng) {\n      return rng.collapsed ? rng : normalizeBlockSelectionRange(rng);\n    };\n\n    var hasOnlyOneChild$1 = function (node) {\n      return node.firstChild && node.firstChild === node.lastChild;\n    };\n    var isPaddingNode = function (node) {\n      return node.name === 'br' || node.value === nbsp;\n    };\n    var isPaddedEmptyBlock = function (schema, node) {\n      var blockElements = schema.getBlockElements();\n      return blockElements[node.name] && hasOnlyOneChild$1(node) && isPaddingNode(node.firstChild);\n    };\n    var isEmptyFragmentElement = function (schema, node) {\n      var nonEmptyElements = schema.getNonEmptyElements();\n      return node && (node.isEmpty(nonEmptyElements) || isPaddedEmptyBlock(schema, node));\n    };\n    var isListFragment = function (schema, fragment) {\n      var firstChild = fragment.firstChild;\n      var lastChild = fragment.lastChild;\n      if (firstChild && firstChild.name === 'meta') {\n        firstChild = firstChild.next;\n      }\n      if (lastChild && lastChild.attr('id') === 'mce_marker') {\n        lastChild = lastChild.prev;\n      }\n      if (isEmptyFragmentElement(schema, lastChild)) {\n        lastChild = lastChild.prev;\n      }\n      if (!firstChild || firstChild !== lastChild) {\n        return false;\n      }\n      return firstChild.name === 'ul' || firstChild.name === 'ol';\n    };\n    var cleanupDomFragment = function (domFragment) {\n      var firstChild = domFragment.firstChild;\n      var lastChild = domFragment.lastChild;\n      if (firstChild && firstChild.nodeName === 'META') {\n        firstChild.parentNode.removeChild(firstChild);\n      }\n      if (lastChild && lastChild.id === 'mce_marker') {\n        lastChild.parentNode.removeChild(lastChild);\n      }\n      return domFragment;\n    };\n    var toDomFragment = function (dom, serializer, fragment) {\n      var html = serializer.serialize(fragment);\n      var domFragment = dom.createFragment(html);\n      return cleanupDomFragment(domFragment);\n    };\n    var listItems = function (elm) {\n      return filter$4(elm.childNodes, function (child) {\n        return child.nodeName === 'LI';\n      });\n    };\n    var isPadding = function (node) {\n      return node.data === nbsp || isBr$5(node);\n    };\n    var isListItemPadded = function (node) {\n      return node && node.firstChild && node.firstChild === node.lastChild && isPadding(node.firstChild);\n    };\n    var isEmptyOrPadded = function (elm) {\n      return !elm.firstChild || isListItemPadded(elm);\n    };\n    var trimListItems = function (elms) {\n      return elms.length > 0 && isEmptyOrPadded(elms[elms.length - 1]) ? elms.slice(0, -1) : elms;\n    };\n    var getParentLi = function (dom, node) {\n      var parentBlock = dom.getParent(node, dom.isBlock);\n      return parentBlock && parentBlock.nodeName === 'LI' ? parentBlock : null;\n    };\n    var isParentBlockLi = function (dom, node) {\n      return !!getParentLi(dom, node);\n    };\n    var getSplit = function (parentNode, rng) {\n      var beforeRng = rng.cloneRange();\n      var afterRng = rng.cloneRange();\n      beforeRng.setStartBefore(parentNode);\n      afterRng.setEndAfter(parentNode);\n      return [\n        beforeRng.cloneContents(),\n        afterRng.cloneContents()\n      ];\n    };\n    var findFirstIn = function (node, rootNode) {\n      var caretPos = CaretPosition.before(node);\n      var caretWalker = CaretWalker(rootNode);\n      var newCaretPos = caretWalker.next(caretPos);\n      return newCaretPos ? newCaretPos.toRange() : null;\n    };\n    var findLastOf = function (node, rootNode) {\n      var caretPos = CaretPosition.after(node);\n      var caretWalker = CaretWalker(rootNode);\n      var newCaretPos = caretWalker.prev(caretPos);\n      return newCaretPos ? newCaretPos.toRange() : null;\n    };\n    var insertMiddle = function (target, elms, rootNode, rng) {\n      var parts = getSplit(target, rng);\n      var parentElm = target.parentNode;\n      parentElm.insertBefore(parts[0], target);\n      Tools.each(elms, function (li) {\n        parentElm.insertBefore(li, target);\n      });\n      parentElm.insertBefore(parts[1], target);\n      parentElm.removeChild(target);\n      return findLastOf(elms[elms.length - 1], rootNode);\n    };\n    var insertBefore$1 = function (target, elms, rootNode) {\n      var parentElm = target.parentNode;\n      Tools.each(elms, function (elm) {\n        parentElm.insertBefore(elm, target);\n      });\n      return findFirstIn(target, rootNode);\n    };\n    var insertAfter$1 = function (target, elms, rootNode, dom) {\n      dom.insertAfter(elms.reverse(), target);\n      return findLastOf(elms[0], rootNode);\n    };\n    var insertAtCaret$1 = function (serializer, dom, rng, fragment) {\n      var domFragment = toDomFragment(dom, serializer, fragment);\n      var liTarget = getParentLi(dom, rng.startContainer);\n      var liElms = trimListItems(listItems(domFragment.firstChild));\n      var BEGINNING = 1, END = 2;\n      var rootNode = dom.getRoot();\n      var isAt = function (location) {\n        var caretPos = CaretPosition.fromRangeStart(rng);\n        var caretWalker = CaretWalker(dom.getRoot());\n        var newPos = location === BEGINNING ? caretWalker.prev(caretPos) : caretWalker.next(caretPos);\n        return newPos ? getParentLi(dom, newPos.getNode()) !== liTarget : true;\n      };\n      if (isAt(BEGINNING)) {\n        return insertBefore$1(liTarget, liElms, rootNode);\n      } else if (isAt(END)) {\n        return insertAfter$1(liTarget, liElms, rootNode, dom);\n      }\n      return insertMiddle(liTarget, liElms, rootNode, rng);\n    };\n\n    var trimOrPadLeftRight = function (dom, rng, html) {\n      var root = SugarElement.fromDom(dom.getRoot());\n      if (needsToBeNbspLeft(root, CaretPosition.fromRangeStart(rng))) {\n        html = html.replace(/^ /, '&nbsp;');\n      } else {\n        html = html.replace(/^&nbsp;/, ' ');\n      }\n      if (needsToBeNbspRight(root, CaretPosition.fromRangeEnd(rng))) {\n        html = html.replace(/(&nbsp;| )(<br( \\/)>)?$/, '&nbsp;');\n      } else {\n        html = html.replace(/&nbsp;(<br( \\/)?>)?$/, ' ');\n      }\n      return html;\n    };\n\n    var isTableCell$1 = isTableCell$5;\n    var isTableCellContentSelected = function (dom, rng, cell) {\n      if (cell !== null) {\n        var endCell = dom.getParent(rng.endContainer, isTableCell$1);\n        return cell === endCell && hasAllContentsSelected(SugarElement.fromDom(cell), rng);\n      } else {\n        return false;\n      }\n    };\n    var validInsertion = function (editor, value, parentNode) {\n      if (parentNode.getAttribute('data-mce-bogus') === 'all') {\n        parentNode.parentNode.insertBefore(editor.dom.createFragment(value), parentNode);\n      } else {\n        var node = parentNode.firstChild;\n        var node2 = parentNode.lastChild;\n        if (!node || node === node2 && node.nodeName === 'BR') {\n          editor.dom.setHTML(parentNode, value);\n        } else {\n          editor.selection.setContent(value);\n        }\n      }\n    };\n    var trimBrsFromTableCell = function (dom, elm) {\n      Optional.from(dom.getParent(elm, 'td,th')).map(SugarElement.fromDom).each(trimBlockTrailingBr);\n    };\n    var reduceInlineTextElements = function (editor, merge) {\n      var textInlineElements = editor.schema.getTextInlineElements();\n      var dom = editor.dom;\n      if (merge) {\n        var root_1 = editor.getBody();\n        var elementUtils_1 = ElementUtils(dom);\n        Tools.each(dom.select('*[data-mce-fragment]'), function (node) {\n          var isInline = isNonNullable(textInlineElements[node.nodeName.toLowerCase()]);\n          if (isInline && hasInheritableStyles(dom, node)) {\n            for (var parentNode = node.parentNode; isNonNullable(parentNode) && parentNode !== root_1; parentNode = parentNode.parentNode) {\n              var styleConflict = hasStyleConflict(dom, node, parentNode);\n              if (styleConflict) {\n                break;\n              }\n              if (elementUtils_1.compare(parentNode, node)) {\n                dom.remove(node, true);\n                break;\n              }\n            }\n          }\n        });\n      }\n    };\n    var markFragmentElements = function (fragment) {\n      var node = fragment;\n      while (node = node.walk()) {\n        if (node.type === 1) {\n          node.attr('data-mce-fragment', '1');\n        }\n      }\n    };\n    var unmarkFragmentElements = function (elm) {\n      Tools.each(elm.getElementsByTagName('*'), function (elm) {\n        elm.removeAttribute('data-mce-fragment');\n      });\n    };\n    var isPartOfFragment = function (node) {\n      return !!node.getAttribute('data-mce-fragment');\n    };\n    var canHaveChildren = function (editor, node) {\n      return node && !editor.schema.getShortEndedElements()[node.nodeName];\n    };\n    var moveSelectionToMarker = function (editor, marker) {\n      var nextRng;\n      var dom = editor.dom;\n      var selection = editor.selection;\n      if (!marker) {\n        return;\n      }\n      selection.scrollIntoView(marker);\n      var parentEditableElm = getContentEditableRoot$1(editor.getBody(), marker);\n      if (dom.getContentEditable(parentEditableElm) === 'false') {\n        dom.remove(marker);\n        selection.select(parentEditableElm);\n        return;\n      }\n      var rng = dom.createRng();\n      var node = marker.previousSibling;\n      if (isText$7(node)) {\n        rng.setStart(node, node.nodeValue.length);\n        if (!Env.ie) {\n          var node2 = marker.nextSibling;\n          if (isText$7(node2)) {\n            node.appendData(node2.data);\n            node2.parentNode.removeChild(node2);\n          }\n        }\n      } else {\n        rng.setStartBefore(marker);\n        rng.setEndBefore(marker);\n      }\n      var findNextCaretRng = function (rng) {\n        var caretPos = CaretPosition.fromRangeStart(rng);\n        var caretWalker = CaretWalker(editor.getBody());\n        caretPos = caretWalker.next(caretPos);\n        if (caretPos) {\n          return caretPos.toRange();\n        }\n      };\n      var parentBlock = dom.getParent(marker, dom.isBlock);\n      dom.remove(marker);\n      if (parentBlock && dom.isEmpty(parentBlock)) {\n        editor.$(parentBlock).empty();\n        rng.setStart(parentBlock, 0);\n        rng.setEnd(parentBlock, 0);\n        if (!isTableCell$1(parentBlock) && !isPartOfFragment(parentBlock) && (nextRng = findNextCaretRng(rng))) {\n          rng = nextRng;\n          dom.remove(parentBlock);\n        } else {\n          dom.add(parentBlock, dom.create('br', { 'data-mce-bogus': '1' }));\n        }\n      }\n      selection.setRng(rng);\n    };\n    var deleteSelectedContent = function (editor) {\n      var dom = editor.dom;\n      var rng = normalize(editor.selection.getRng());\n      editor.selection.setRng(rng);\n      var startCell = dom.getParent(rng.startContainer, isTableCell$1);\n      if (isTableCellContentSelected(dom, rng, startCell)) {\n        deleteCellContents(editor, rng, SugarElement.fromDom(startCell));\n      } else {\n        editor.getDoc().execCommand('Delete', false, null);\n      }\n    };\n    var insertHtmlAtCaret = function (editor, value, details) {\n      var parentNode;\n      var rng, node;\n      var selection = editor.selection;\n      var dom = editor.dom;\n      if (/^ | $/.test(value)) {\n        value = trimOrPadLeftRight(dom, selection.getRng(), value);\n      }\n      var parser = editor.parser;\n      var merge = details.merge;\n      var serializer = HtmlSerializer({ validate: shouldValidate(editor) }, editor.schema);\n      var bookmarkHtml = '<span id=\"mce_marker\" data-mce-type=\"bookmark\">&#xFEFF;</span>';\n      var args = editor.fire('BeforeSetContent', {\n        content: value,\n        format: 'html',\n        selection: true,\n        paste: details.paste\n      });\n      if (args.isDefaultPrevented()) {\n        editor.fire('SetContent', {\n          content: args.content,\n          format: 'html',\n          selection: true,\n          paste: details.paste\n        });\n        return;\n      }\n      value = args.content;\n      if (!details.preserve_zwsp) {\n        value = trim$3(value);\n      }\n      if (value.indexOf('{$caret}') === -1) {\n        value += '{$caret}';\n      }\n      value = value.replace(/\\{\\$caret\\}/, bookmarkHtml);\n      rng = selection.getRng();\n      var caretElement = rng.startContainer || (rng.parentElement ? rng.parentElement() : null);\n      var body = editor.getBody();\n      if (caretElement === body && selection.isCollapsed()) {\n        if (dom.isBlock(body.firstChild) && canHaveChildren(editor, body.firstChild) && dom.isEmpty(body.firstChild)) {\n          rng = dom.createRng();\n          rng.setStart(body.firstChild, 0);\n          rng.setEnd(body.firstChild, 0);\n          selection.setRng(rng);\n        }\n      }\n      if (!selection.isCollapsed()) {\n        deleteSelectedContent(editor);\n      }\n      parentNode = selection.getNode();\n      var parserArgs = {\n        context: parentNode.nodeName.toLowerCase(),\n        data: details.data,\n        insert: true\n      };\n      var fragment = parser.parse(value, parserArgs);\n      if (details.paste === true && isListFragment(editor.schema, fragment) && isParentBlockLi(dom, parentNode)) {\n        rng = insertAtCaret$1(serializer, dom, selection.getRng(), fragment);\n        selection.setRng(rng);\n        editor.fire('SetContent', args);\n        return;\n      }\n      markFragmentElements(fragment);\n      node = fragment.lastChild;\n      if (node.attr('id') === 'mce_marker') {\n        var marker = node;\n        for (node = node.prev; node; node = node.walk(true)) {\n          if (node.type === 3 || !dom.isBlock(node.name)) {\n            if (editor.schema.isValidChild(node.parent.name, 'span')) {\n              node.parent.insert(marker, node, node.name === 'br');\n            }\n            break;\n          }\n        }\n      }\n      editor._selectionOverrides.showBlockCaretContainer(parentNode);\n      if (!parserArgs.invalid) {\n        value = serializer.serialize(fragment);\n        validInsertion(editor, value, parentNode);\n      } else {\n        editor.selection.setContent(bookmarkHtml);\n        parentNode = selection.getNode();\n        var rootNode = editor.getBody();\n        if (parentNode.nodeType === 9) {\n          parentNode = node = rootNode;\n        } else {\n          node = parentNode;\n        }\n        while (node !== rootNode) {\n          parentNode = node;\n          node = node.parentNode;\n        }\n        value = parentNode === rootNode ? rootNode.innerHTML : dom.getOuterHTML(parentNode);\n        value = serializer.serialize(parser.parse(value.replace(/<span (id=\"mce_marker\"|id=mce_marker).+?<\\/span>/i, function () {\n          return serializer.serialize(fragment);\n        })));\n        if (parentNode === rootNode) {\n          dom.setHTML(rootNode, value);\n        } else {\n          dom.setOuterHTML(parentNode, value);\n        }\n      }\n      reduceInlineTextElements(editor, merge);\n      moveSelectionToMarker(editor, dom.get('mce_marker'));\n      unmarkFragmentElements(editor.getBody());\n      trimBrsFromTableCell(dom, selection.getStart());\n      editor.fire('SetContent', args);\n      editor.addVisual();\n    };\n\n    var traverse = function (node, fn) {\n      fn(node);\n      if (node.firstChild) {\n        traverse(node.firstChild, fn);\n      }\n      if (node.next) {\n        traverse(node.next, fn);\n      }\n    };\n    var findMatchingNodes = function (nodeFilters, attributeFilters, node) {\n      var nodeMatches = {};\n      var attrMatches = {};\n      var matches = [];\n      if (node.firstChild) {\n        traverse(node.firstChild, function (node) {\n          each$k(nodeFilters, function (filter) {\n            if (filter.name === node.name) {\n              if (nodeMatches[filter.name]) {\n                nodeMatches[filter.name].nodes.push(node);\n              } else {\n                nodeMatches[filter.name] = {\n                  filter: filter,\n                  nodes: [node]\n                };\n              }\n            }\n          });\n          each$k(attributeFilters, function (filter) {\n            if (typeof node.attr(filter.name) === 'string') {\n              if (attrMatches[filter.name]) {\n                attrMatches[filter.name].nodes.push(node);\n              } else {\n                attrMatches[filter.name] = {\n                  filter: filter,\n                  nodes: [node]\n                };\n              }\n            }\n          });\n        });\n      }\n      for (var name_1 in nodeMatches) {\n        if (has$2(nodeMatches, name_1)) {\n          matches.push(nodeMatches[name_1]);\n        }\n      }\n      for (var name_2 in attrMatches) {\n        if (has$2(attrMatches, name_2)) {\n          matches.push(attrMatches[name_2]);\n        }\n      }\n      return matches;\n    };\n    var filter$1 = function (nodeFilters, attributeFilters, node) {\n      var matches = findMatchingNodes(nodeFilters, attributeFilters, node);\n      each$k(matches, function (match) {\n        each$k(match.filter.callbacks, function (callback) {\n          callback(match.nodes, match.filter.name, {});\n        });\n      });\n    };\n\n    var defaultFormat$1 = 'html';\n    var isTreeNode = function (content) {\n      return content instanceof AstNode;\n    };\n    var moveSelection = function (editor) {\n      if (hasFocus(editor)) {\n        firstPositionIn(editor.getBody()).each(function (pos) {\n          var node = pos.getNode();\n          var caretPos = isTable$3(node) ? firstPositionIn(node).getOr(pos) : pos;\n          editor.selection.setRng(caretPos.toRange());\n        });\n      }\n    };\n    var setEditorHtml = function (editor, html, noSelection) {\n      editor.dom.setHTML(editor.getBody(), html);\n      if (noSelection !== true) {\n        moveSelection(editor);\n      }\n    };\n    var setContentString = function (editor, body, content, args) {\n      content = trim$3(content);\n      if (content.length === 0 || /^\\s+$/.test(content)) {\n        var padd = '<br data-mce-bogus=\"1\">';\n        if (body.nodeName === 'TABLE') {\n          content = '<tr><td>' + padd + '</td></tr>';\n        } else if (/^(UL|OL)$/.test(body.nodeName)) {\n          content = '<li>' + padd + '</li>';\n        }\n        var forcedRootBlockName = getForcedRootBlock(editor);\n        if (forcedRootBlockName && editor.schema.isValidChild(body.nodeName.toLowerCase(), forcedRootBlockName.toLowerCase())) {\n          content = padd;\n          content = editor.dom.createHTML(forcedRootBlockName, getForcedRootBlockAttrs(editor), content);\n        } else if (!content) {\n          content = '<br data-mce-bogus=\"1\">';\n        }\n        setEditorHtml(editor, content, args.no_selection);\n        editor.fire('SetContent', args);\n      } else {\n        if (args.format !== 'raw') {\n          content = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(editor.parser.parse(content, {\n            isRootContent: true,\n            insert: true\n          }));\n        }\n        args.content = isWsPreserveElement(SugarElement.fromDom(body)) ? content : Tools.trim(content);\n        setEditorHtml(editor, args.content, args.no_selection);\n        if (!args.no_events) {\n          editor.fire('SetContent', args);\n        }\n      }\n      return args.content;\n    };\n    var setContentTree = function (editor, body, content, args) {\n      filter$1(editor.parser.getNodeFilters(), editor.parser.getAttributeFilters(), content);\n      var html = HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(content);\n      args.content = trim$3(isWsPreserveElement(SugarElement.fromDom(body)) ? html : Tools.trim(html));\n      setEditorHtml(editor, args.content, args.no_selection);\n      if (!args.no_events) {\n        editor.fire('SetContent', args);\n      }\n      return content;\n    };\n    var setupArgs$2 = function (args, content) {\n      return __assign(__assign({ format: defaultFormat$1 }, args), {\n        set: true,\n        content: isTreeNode(content) ? '' : content\n      });\n    };\n    var setContentInternal = function (editor, content, args) {\n      var defaultedArgs = setupArgs$2(args, content);\n      var updatedArgs = args.no_events ? defaultedArgs : editor.fire('BeforeSetContent', defaultedArgs);\n      if (!isTreeNode(content)) {\n        content = updatedArgs.content;\n      }\n      return Optional.from(editor.getBody()).fold(constant(content), function (body) {\n        return isTreeNode(content) ? setContentTree(editor, body, content, updatedArgs) : setContentString(editor, body, content, updatedArgs);\n      });\n    };\n\n    var sibling = function (scope, predicate) {\n      return sibling$2(scope, predicate).isSome();\n    };\n\n    var ensureIsRoot = function (isRoot) {\n      return isFunction(isRoot) ? isRoot : never;\n    };\n    var ancestor = function (scope, transform, isRoot) {\n      var element = scope.dom;\n      var stop = ensureIsRoot(isRoot);\n      while (element.parentNode) {\n        element = element.parentNode;\n        var el = SugarElement.fromDom(element);\n        var transformed = transform(el);\n        if (transformed.isSome()) {\n          return transformed;\n        } else if (stop(el)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var closest$1 = function (scope, transform, isRoot) {\n      var current = transform(scope);\n      var stop = ensureIsRoot(isRoot);\n      return current.orThunk(function () {\n        return stop(scope) ? Optional.none() : ancestor(scope, transform, stop);\n      });\n    };\n\n    var isEq$3 = isEq$5;\n    var matchesUnInheritedFormatSelector = function (ed, node, name) {\n      var formatList = ed.formatter.get(name);\n      if (formatList) {\n        for (var i = 0; i < formatList.length; i++) {\n          var format = formatList[i];\n          if (isSelectorFormat(format) && format.inherit === false && ed.dom.is(node, format.selector)) {\n            return true;\n          }\n        }\n      }\n      return false;\n    };\n    var matchParents = function (editor, node, name, vars, similar) {\n      var root = editor.dom.getRoot();\n      if (node === root) {\n        return false;\n      }\n      node = editor.dom.getParent(node, function (node) {\n        if (matchesUnInheritedFormatSelector(editor, node, name)) {\n          return true;\n        }\n        return node.parentNode === root || !!matchNode(editor, node, name, vars, true);\n      });\n      return !!matchNode(editor, node, name, vars, similar);\n    };\n    var matchName$1 = function (dom, node, format) {\n      if (isEq$3(node, format.inline)) {\n        return true;\n      }\n      if (isEq$3(node, format.block)) {\n        return true;\n      }\n      if (format.selector) {\n        return node.nodeType === 1 && dom.is(node, format.selector);\n      }\n    };\n    var matchItems = function (dom, node, format, itemName, similar, vars) {\n      var items = format[itemName];\n      if (isFunction(format.onmatch)) {\n        return format.onmatch(node, format, itemName);\n      }\n      if (items) {\n        if (isUndefined(items.length)) {\n          for (var key in items) {\n            if (has$2(items, key)) {\n              var value = itemName === 'attributes' ? dom.getAttrib(node, key) : getStyle(dom, node, key);\n              var expectedValue = replaceVars(items[key], vars);\n              var isEmptyValue = isNullable(value) || isEmpty$3(value);\n              if (isEmptyValue && isNullable(expectedValue)) {\n                continue;\n              }\n              if (similar && isEmptyValue && !format.exact) {\n                return false;\n              }\n              if ((!similar || format.exact) && !isEq$3(value, normalizeStyleValue(dom, expectedValue, key))) {\n                return false;\n              }\n            }\n          }\n        } else {\n          for (var i = 0; i < items.length; i++) {\n            if (itemName === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(dom, node, items[i])) {\n              return true;\n            }\n          }\n        }\n      }\n      return true;\n    };\n    var matchNode = function (ed, node, name, vars, similar) {\n      var formatList = ed.formatter.get(name);\n      var dom = ed.dom;\n      if (formatList && node) {\n        for (var i = 0; i < formatList.length; i++) {\n          var format = formatList[i];\n          if (matchName$1(ed.dom, node, format) && matchItems(dom, node, format, 'attributes', similar, vars) && matchItems(dom, node, format, 'styles', similar, vars)) {\n            var classes = format.classes;\n            if (classes) {\n              for (var x = 0; x < classes.length; x++) {\n                if (!ed.dom.hasClass(node, replaceVars(classes[x], vars))) {\n                  return;\n                }\n              }\n            }\n            return format;\n          }\n        }\n      }\n    };\n    var match$2 = function (editor, name, vars, node, similar) {\n      if (node) {\n        return matchParents(editor, node, name, vars, similar);\n      }\n      node = editor.selection.getNode();\n      if (matchParents(editor, node, name, vars, similar)) {\n        return true;\n      }\n      var startNode = editor.selection.getStart();\n      if (startNode !== node) {\n        if (matchParents(editor, startNode, name, vars, similar)) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var matchAll = function (editor, names, vars) {\n      var matchedFormatNames = [];\n      var checkedMap = {};\n      var startElement = editor.selection.getStart();\n      editor.dom.getParent(startElement, function (node) {\n        for (var i = 0; i < names.length; i++) {\n          var name_1 = names[i];\n          if (!checkedMap[name_1] && matchNode(editor, node, name_1, vars)) {\n            checkedMap[name_1] = true;\n            matchedFormatNames.push(name_1);\n          }\n        }\n      }, editor.dom.getRoot());\n      return matchedFormatNames;\n    };\n    var closest = function (editor, names) {\n      var isRoot = function (elm) {\n        return eq(elm, SugarElement.fromDom(editor.getBody()));\n      };\n      var match = function (elm, name) {\n        return matchNode(editor, elm.dom, name) ? Optional.some(name) : Optional.none();\n      };\n      return Optional.from(editor.selection.getStart(true)).bind(function (rawElm) {\n        return closest$1(SugarElement.fromDom(rawElm), function (elm) {\n          return findMap(names, function (name) {\n            return match(elm, name);\n          });\n        }, isRoot);\n      }).getOrNull();\n    };\n    var canApply = function (editor, name) {\n      var formatList = editor.formatter.get(name);\n      var dom = editor.dom;\n      if (formatList) {\n        var startNode = editor.selection.getStart();\n        var parents = getParents$2(dom, startNode);\n        for (var x = formatList.length - 1; x >= 0; x--) {\n          var format = formatList[x];\n          if (!isSelectorFormat(format) || isNonNullable(format.defaultBlock)) {\n            return true;\n          }\n          for (var i = parents.length - 1; i >= 0; i--) {\n            if (dom.is(parents[i], format.selector)) {\n              return true;\n            }\n          }\n        }\n      }\n      return false;\n    };\n    var matchAllOnNode = function (editor, node, formatNames) {\n      return foldl(formatNames, function (acc, name) {\n        var matchSimilar = isVariableFormatName(editor, name);\n        if (editor.formatter.matchNode(node, name, {}, matchSimilar)) {\n          return acc.concat([name]);\n        } else {\n          return acc;\n        }\n      }, []);\n    };\n\n    var ZWSP = ZWSP$1, CARET_ID = '_mce_caret';\n    var importNode = function (ownerDocument, node) {\n      return ownerDocument.importNode(node, true);\n    };\n    var getEmptyCaretContainers = function (node) {\n      var nodes = [];\n      while (node) {\n        if (node.nodeType === 3 && node.nodeValue !== ZWSP || node.childNodes.length > 1) {\n          return [];\n        }\n        if (node.nodeType === 1) {\n          nodes.push(node);\n        }\n        node = node.firstChild;\n      }\n      return nodes;\n    };\n    var isCaretContainerEmpty = function (node) {\n      return getEmptyCaretContainers(node).length > 0;\n    };\n    var findFirstTextNode = function (node) {\n      if (node) {\n        var walker = new DomTreeWalker(node, node);\n        for (node = walker.current(); node; node = walker.next()) {\n          if (isText$7(node)) {\n            return node;\n          }\n        }\n      }\n      return null;\n    };\n    var createCaretContainer = function (fill) {\n      var caretContainer = SugarElement.fromTag('span');\n      setAll$1(caretContainer, {\n        'id': CARET_ID,\n        'data-mce-bogus': '1',\n        'data-mce-type': 'format-caret'\n      });\n      if (fill) {\n        append$1(caretContainer, SugarElement.fromText(ZWSP));\n      }\n      return caretContainer;\n    };\n    var trimZwspFromCaretContainer = function (caretContainerNode) {\n      var textNode = findFirstTextNode(caretContainerNode);\n      if (textNode && textNode.nodeValue.charAt(0) === ZWSP) {\n        textNode.deleteData(0, 1);\n      }\n      return textNode;\n    };\n    var removeCaretContainerNode = function (editor, node, moveCaret) {\n      if (moveCaret === void 0) {\n        moveCaret = true;\n      }\n      var dom = editor.dom, selection = editor.selection;\n      if (isCaretContainerEmpty(node)) {\n        deleteElement$2(editor, false, SugarElement.fromDom(node), moveCaret);\n      } else {\n        var rng = selection.getRng();\n        var block = dom.getParent(node, dom.isBlock);\n        var startContainer = rng.startContainer;\n        var startOffset = rng.startOffset;\n        var endContainer = rng.endContainer;\n        var endOffset = rng.endOffset;\n        var textNode = trimZwspFromCaretContainer(node);\n        dom.remove(node, true);\n        if (startContainer === textNode && startOffset > 0) {\n          rng.setStart(textNode, startOffset - 1);\n        }\n        if (endContainer === textNode && endOffset > 0) {\n          rng.setEnd(textNode, endOffset - 1);\n        }\n        if (block && dom.isEmpty(block)) {\n          fillWithPaddingBr(SugarElement.fromDom(block));\n        }\n        selection.setRng(rng);\n      }\n    };\n    var removeCaretContainer = function (editor, node, moveCaret) {\n      if (moveCaret === void 0) {\n        moveCaret = true;\n      }\n      var dom = editor.dom, selection = editor.selection;\n      if (!node) {\n        node = getParentCaretContainer(editor.getBody(), selection.getStart());\n        if (!node) {\n          while (node = dom.get(CARET_ID)) {\n            removeCaretContainerNode(editor, node, false);\n          }\n        }\n      } else {\n        removeCaretContainerNode(editor, node, moveCaret);\n      }\n    };\n    var insertCaretContainerNode = function (editor, caretContainer, formatNode) {\n      var dom = editor.dom, block = dom.getParent(formatNode, curry(isTextBlock$1, editor));\n      if (block && dom.isEmpty(block)) {\n        formatNode.parentNode.replaceChild(caretContainer, formatNode);\n      } else {\n        removeTrailingBr(SugarElement.fromDom(formatNode));\n        if (dom.isEmpty(formatNode)) {\n          formatNode.parentNode.replaceChild(caretContainer, formatNode);\n        } else {\n          dom.insertAfter(caretContainer, formatNode);\n        }\n      }\n    };\n    var appendNode = function (parentNode, node) {\n      parentNode.appendChild(node);\n      return node;\n    };\n    var insertFormatNodesIntoCaretContainer = function (formatNodes, caretContainer) {\n      var innerMostFormatNode = foldr(formatNodes, function (parentNode, formatNode) {\n        return appendNode(parentNode, formatNode.cloneNode(false));\n      }, caretContainer);\n      return appendNode(innerMostFormatNode, innerMostFormatNode.ownerDocument.createTextNode(ZWSP));\n    };\n    var cleanFormatNode = function (editor, caretContainer, formatNode, name, vars, similar) {\n      var formatter = editor.formatter;\n      var dom = editor.dom;\n      var validFormats = filter$4(keys(formatter.get()), function (formatName) {\n        return formatName !== name && !contains$2(formatName, 'removeformat');\n      });\n      var matchedFormats = matchAllOnNode(editor, formatNode, validFormats);\n      var uniqueFormats = filter$4(matchedFormats, function (fmtName) {\n        return !areSimilarFormats(editor, fmtName, name);\n      });\n      if (uniqueFormats.length > 0) {\n        var clonedFormatNode = formatNode.cloneNode(false);\n        dom.add(caretContainer, clonedFormatNode);\n        formatter.remove(name, vars, clonedFormatNode, similar);\n        dom.remove(clonedFormatNode);\n        return Optional.some(clonedFormatNode);\n      } else {\n        return Optional.none();\n      }\n    };\n    var applyCaretFormat = function (editor, name, vars) {\n      var caretContainer, textNode;\n      var selection = editor.selection;\n      var selectionRng = selection.getRng();\n      var offset = selectionRng.startOffset;\n      var container = selectionRng.startContainer;\n      var text = container.nodeValue;\n      caretContainer = getParentCaretContainer(editor.getBody(), selection.getStart());\n      if (caretContainer) {\n        textNode = findFirstTextNode(caretContainer);\n      }\n      var wordcharRegex = /[^\\s\\u00a0\\u00ad\\u200b\\ufeff]/;\n      if (text && offset > 0 && offset < text.length && wordcharRegex.test(text.charAt(offset)) && wordcharRegex.test(text.charAt(offset - 1))) {\n        var bookmark = selection.getBookmark();\n        selectionRng.collapse(true);\n        var rng = expandRng(editor, selectionRng, editor.formatter.get(name));\n        rng = split(rng);\n        editor.formatter.apply(name, vars, rng);\n        selection.moveToBookmark(bookmark);\n      } else {\n        if (!caretContainer || textNode.nodeValue !== ZWSP) {\n          caretContainer = importNode(editor.getDoc(), createCaretContainer(true).dom);\n          textNode = caretContainer.firstChild;\n          selectionRng.insertNode(caretContainer);\n          offset = 1;\n          editor.formatter.apply(name, vars, caretContainer);\n        } else {\n          editor.formatter.apply(name, vars, caretContainer);\n        }\n        selection.setCursorLocation(textNode, offset);\n      }\n    };\n    var removeCaretFormat = function (editor, name, vars, similar) {\n      var dom = editor.dom;\n      var selection = editor.selection;\n      var hasContentAfter, node, formatNode;\n      var parents = [];\n      var rng = selection.getRng();\n      var container = rng.startContainer;\n      var offset = rng.startOffset;\n      node = container;\n      if (container.nodeType === 3) {\n        if (offset !== container.nodeValue.length) {\n          hasContentAfter = true;\n        }\n        node = node.parentNode;\n      }\n      while (node) {\n        if (matchNode(editor, node, name, vars, similar)) {\n          formatNode = node;\n          break;\n        }\n        if (node.nextSibling) {\n          hasContentAfter = true;\n        }\n        parents.push(node);\n        node = node.parentNode;\n      }\n      if (!formatNode) {\n        return;\n      }\n      if (hasContentAfter) {\n        var bookmark = selection.getBookmark();\n        rng.collapse(true);\n        var expandedRng = expandRng(editor, rng, editor.formatter.get(name), true);\n        expandedRng = split(expandedRng);\n        editor.formatter.remove(name, vars, expandedRng, similar);\n        selection.moveToBookmark(bookmark);\n      } else {\n        var caretContainer = getParentCaretContainer(editor.getBody(), formatNode);\n        var newCaretContainer = createCaretContainer(false).dom;\n        insertCaretContainerNode(editor, newCaretContainer, caretContainer !== null ? caretContainer : formatNode);\n        var cleanedFormatNode = cleanFormatNode(editor, newCaretContainer, formatNode, name, vars, similar);\n        var caretTextNode = insertFormatNodesIntoCaretContainer(parents.concat(cleanedFormatNode.toArray()), newCaretContainer);\n        removeCaretContainerNode(editor, caretContainer, false);\n        selection.setCursorLocation(caretTextNode, 1);\n        if (dom.isEmpty(formatNode)) {\n          dom.remove(formatNode);\n        }\n      }\n    };\n    var disableCaretContainer = function (editor, keyCode) {\n      var selection = editor.selection, body = editor.getBody();\n      removeCaretContainer(editor, null, false);\n      if ((keyCode === 8 || keyCode === 46) && selection.isCollapsed() && selection.getStart().innerHTML === ZWSP) {\n        removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));\n      }\n      if (keyCode === 37 || keyCode === 39) {\n        removeCaretContainer(editor, getParentCaretContainer(body, selection.getStart()));\n      }\n    };\n    var setup$k = function (editor) {\n      editor.on('mouseup keydown', function (e) {\n        disableCaretContainer(editor, e.keyCode);\n      });\n    };\n    var replaceWithCaretFormat = function (targetNode, formatNodes) {\n      var caretContainer = createCaretContainer(false);\n      var innerMost = insertFormatNodesIntoCaretContainer(formatNodes, caretContainer.dom);\n      before$4(SugarElement.fromDom(targetNode), caretContainer);\n      remove$7(SugarElement.fromDom(targetNode));\n      return CaretPosition(innerMost, 0);\n    };\n    var isFormatElement = function (editor, element) {\n      var inlineElements = editor.schema.getTextInlineElements();\n      return has$2(inlineElements, name(element)) && !isCaretNode(element.dom) && !isBogus$2(element.dom);\n    };\n    var isEmptyCaretFormatElement = function (element) {\n      return isCaretNode(element.dom) && isCaretContainerEmpty(element.dom);\n    };\n\n    var postProcessHooks = {};\n    var filter = filter$2;\n    var each$c = each$i;\n    var addPostProcessHook = function (name, hook) {\n      var hooks = postProcessHooks[name];\n      if (!hooks) {\n        postProcessHooks[name] = [];\n      }\n      postProcessHooks[name].push(hook);\n    };\n    var postProcess$1 = function (name, editor) {\n      each$c(postProcessHooks[name], function (hook) {\n        hook(editor);\n      });\n    };\n    addPostProcessHook('pre', function (editor) {\n      var rng = editor.selection.getRng();\n      var blocks;\n      var hasPreSibling = function (pre) {\n        return isPre(pre.previousSibling) && indexOf$1(blocks, pre.previousSibling) !== -1;\n      };\n      var joinPre = function (pre1, pre2) {\n        DomQuery(pre2).remove();\n        DomQuery(pre1).append('<br><br>').append(pre2.childNodes);\n      };\n      var isPre = matchNodeNames(['pre']);\n      if (!rng.collapsed) {\n        blocks = editor.selection.getSelectedBlocks();\n        each$c(filter(filter(blocks, isPre), hasPreSibling), function (pre) {\n          joinPre(pre.previousSibling, pre);\n        });\n      }\n    });\n\n    var each$b = Tools.each;\n    var isElementNode$1 = function (node) {\n      return isElement$5(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus$2(node);\n    };\n    var findElementSibling = function (node, siblingName) {\n      for (var sibling = node; sibling; sibling = sibling[siblingName]) {\n        if (isText$7(sibling) && isNotEmpty(sibling.data)) {\n          return node;\n        }\n        if (isElement$5(sibling) && !isBookmarkNode$1(sibling)) {\n          return sibling;\n        }\n      }\n      return node;\n    };\n    var mergeSiblingsNodes = function (dom, prev, next) {\n      var elementUtils = ElementUtils(dom);\n      if (prev && next) {\n        prev = findElementSibling(prev, 'previousSibling');\n        next = findElementSibling(next, 'nextSibling');\n        if (elementUtils.compare(prev, next)) {\n          for (var sibling = prev.nextSibling; sibling && sibling !== next;) {\n            var tmpSibling = sibling;\n            sibling = sibling.nextSibling;\n            prev.appendChild(tmpSibling);\n          }\n          dom.remove(next);\n          Tools.each(Tools.grep(next.childNodes), function (node) {\n            prev.appendChild(node);\n          });\n          return prev;\n        }\n      }\n      return next;\n    };\n    var mergeSiblings = function (dom, format, vars, node) {\n      if (node && format.merge_siblings !== false) {\n        var newNode = mergeSiblingsNodes(dom, getNonWhiteSpaceSibling(node), node);\n        mergeSiblingsNodes(dom, newNode, getNonWhiteSpaceSibling(newNode, true));\n      }\n    };\n    var clearChildStyles = function (dom, format, node) {\n      if (format.clear_child_styles) {\n        var selector = format.links ? '*:not(a)' : '*';\n        each$b(dom.select(selector, node), function (node) {\n          if (isElementNode$1(node)) {\n            each$b(format.styles, function (value, name) {\n              dom.setStyle(node, name, '');\n            });\n          }\n        });\n      }\n    };\n    var processChildElements = function (node, filter, process) {\n      each$b(node.childNodes, function (node) {\n        if (isElementNode$1(node)) {\n          if (filter(node)) {\n            process(node);\n          }\n          if (node.hasChildNodes()) {\n            processChildElements(node, filter, process);\n          }\n        }\n      });\n    };\n    var unwrapEmptySpan = function (dom, node) {\n      if (node.nodeName === 'SPAN' && dom.getAttribs(node).length === 0) {\n        dom.remove(node, true);\n      }\n    };\n    var hasStyle = function (dom, name) {\n      return function (node) {\n        return !!(node && getStyle(dom, node, name));\n      };\n    };\n    var applyStyle = function (dom, name, value) {\n      return function (node) {\n        dom.setStyle(node, name, value);\n        if (node.getAttribute('style') === '') {\n          node.removeAttribute('style');\n        }\n        unwrapEmptySpan(dom, node);\n      };\n    };\n\n    var removeResult = Adt.generate([\n      { keep: [] },\n      { rename: ['name'] },\n      { removed: [] }\n    ]);\n    var MCE_ATTR_RE = /^(src|href|style)$/;\n    var each$a = Tools.each;\n    var isEq$2 = isEq$5;\n    var isTableCellOrRow = function (node) {\n      return /^(TR|TH|TD)$/.test(node.nodeName);\n    };\n    var isChildOfInlineParent = function (dom, node, parent) {\n      return dom.isChildOf(node, parent) && node !== parent && !dom.isBlock(parent);\n    };\n    var getContainer = function (ed, rng, start) {\n      var container = rng[start ? 'startContainer' : 'endContainer'];\n      var offset = rng[start ? 'startOffset' : 'endOffset'];\n      if (isElement$5(container)) {\n        var lastIdx = container.childNodes.length - 1;\n        if (!start && offset) {\n          offset--;\n        }\n        container = container.childNodes[offset > lastIdx ? lastIdx : offset];\n      }\n      if (isText$7(container) && start && offset >= container.nodeValue.length) {\n        container = new DomTreeWalker(container, ed.getBody()).next() || container;\n      }\n      if (isText$7(container) && !start && offset === 0) {\n        container = new DomTreeWalker(container, ed.getBody()).prev() || container;\n      }\n      return container;\n    };\n    var normalizeTableSelection = function (node, start) {\n      var prop = start ? 'firstChild' : 'lastChild';\n      if (isTableCellOrRow(node) && node[prop]) {\n        var childNode = node[prop];\n        if (node.nodeName === 'TR') {\n          return childNode[prop] || childNode;\n        } else {\n          return childNode;\n        }\n      }\n      return node;\n    };\n    var wrap$1 = function (dom, node, name, attrs) {\n      var wrapper = dom.create(name, attrs);\n      node.parentNode.insertBefore(wrapper, node);\n      wrapper.appendChild(node);\n      return wrapper;\n    };\n    var wrapWithSiblings = function (dom, node, next, name, attrs) {\n      var start = SugarElement.fromDom(node);\n      var wrapper = SugarElement.fromDom(dom.create(name, attrs));\n      var siblings = next ? nextSiblings(start) : prevSiblings(start);\n      append(wrapper, siblings);\n      if (next) {\n        before$4(start, wrapper);\n        prepend(wrapper, start);\n      } else {\n        after$3(start, wrapper);\n        append$1(wrapper, start);\n      }\n      return wrapper.dom;\n    };\n    var matchName = function (dom, node, format) {\n      if (isInlineFormat(format) && isEq$2(node, format.inline)) {\n        return true;\n      }\n      if (isBlockFormat(format) && isEq$2(node, format.block)) {\n        return true;\n      }\n      if (isSelectorFormat(format)) {\n        return isElement$5(node) && dom.is(node, format.selector);\n      }\n    };\n    var isColorFormatAndAnchor = function (node, format) {\n      return format.links && node.nodeName === 'A';\n    };\n    var find = function (dom, node, next, inc) {\n      var sibling = getNonWhiteSpaceSibling(node, next, inc);\n      return isNullable(sibling) || sibling.nodeName === 'BR' || dom.isBlock(sibling);\n    };\n    var removeNode = function (ed, node, format) {\n      var parentNode = node.parentNode;\n      var rootBlockElm;\n      var dom = ed.dom, forcedRootBlock = getForcedRootBlock(ed);\n      if (isBlockFormat(format)) {\n        if (!forcedRootBlock) {\n          if (dom.isBlock(node) && !dom.isBlock(parentNode)) {\n            if (!find(dom, node, false) && !find(dom, node.firstChild, true, true)) {\n              node.insertBefore(dom.create('br'), node.firstChild);\n            }\n            if (!find(dom, node, true) && !find(dom, node.lastChild, false, true)) {\n              node.appendChild(dom.create('br'));\n            }\n          }\n        } else {\n          if (parentNode === dom.getRoot()) {\n            if (!format.list_block || !isEq$2(node, format.list_block)) {\n              each$k(from(node.childNodes), function (node) {\n                if (isValid(ed, forcedRootBlock, node.nodeName.toLowerCase())) {\n                  if (!rootBlockElm) {\n                    rootBlockElm = wrap$1(dom, node, forcedRootBlock);\n                    dom.setAttribs(rootBlockElm, ed.settings.forced_root_block_attrs);\n                  } else {\n                    rootBlockElm.appendChild(node);\n                  }\n                } else {\n                  rootBlockElm = null;\n                }\n              });\n            }\n          }\n        }\n      }\n      if (isMixedFormat(format) && !isEq$2(format.inline, node)) {\n        return;\n      }\n      dom.remove(node, true);\n    };\n    var removeFormatInternal = function (ed, format, vars, node, compareNode) {\n      var stylesModified;\n      var dom = ed.dom;\n      if (!matchName(dom, node, format) && !isColorFormatAndAnchor(node, format)) {\n        return removeResult.keep();\n      }\n      var elm = node;\n      if (isInlineFormat(format) && format.remove === 'all' && isArray$1(format.preserve_attributes)) {\n        var attrsToPreserve = filter$4(dom.getAttribs(elm), function (attr) {\n          return contains$3(format.preserve_attributes, attr.name.toLowerCase());\n        });\n        dom.removeAllAttribs(elm);\n        each$k(attrsToPreserve, function (attr) {\n          return dom.setAttrib(elm, attr.name, attr.value);\n        });\n        if (attrsToPreserve.length > 0) {\n          return removeResult.rename('span');\n        }\n      }\n      if (format.remove !== 'all') {\n        each$a(format.styles, function (value, name) {\n          value = normalizeStyleValue(dom, replaceVars(value, vars), name + '');\n          if (isNumber(name)) {\n            name = value;\n            compareNode = null;\n          }\n          if (format.remove_similar || (!compareNode || isEq$2(getStyle(dom, compareNode, name), value))) {\n            dom.setStyle(elm, name, '');\n          }\n          stylesModified = true;\n        });\n        if (stylesModified && dom.getAttrib(elm, 'style') === '') {\n          elm.removeAttribute('style');\n          elm.removeAttribute('data-mce-style');\n        }\n        each$a(format.attributes, function (value, name) {\n          var valueOut;\n          value = replaceVars(value, vars);\n          if (isNumber(name)) {\n            name = value;\n            compareNode = null;\n          }\n          if (format.remove_similar || (!compareNode || isEq$2(dom.getAttrib(compareNode, name), value))) {\n            if (name === 'class') {\n              value = dom.getAttrib(elm, name);\n              if (value) {\n                valueOut = '';\n                each$k(value.split(/\\s+/), function (cls) {\n                  if (/mce\\-\\w+/.test(cls)) {\n                    valueOut += (valueOut ? ' ' : '') + cls;\n                  }\n                });\n                if (valueOut) {\n                  dom.setAttrib(elm, name, valueOut);\n                  return;\n                }\n              }\n            }\n            if (MCE_ATTR_RE.test(name)) {\n              elm.removeAttribute('data-mce-' + name);\n            }\n            if (name === 'style' && matchNodeNames(['li'])(elm) && dom.getStyle(elm, 'list-style-type') === 'none') {\n              elm.removeAttribute(name);\n              dom.setStyle(elm, 'list-style-type', 'none');\n              return;\n            }\n            if (name === 'class') {\n              elm.removeAttribute('className');\n            }\n            elm.removeAttribute(name);\n          }\n        });\n        each$a(format.classes, function (value) {\n          value = replaceVars(value, vars);\n          if (!compareNode || dom.hasClass(compareNode, value)) {\n            dom.removeClass(elm, value);\n          }\n        });\n        var attrs = dom.getAttribs(elm);\n        for (var i = 0; i < attrs.length; i++) {\n          var attrName = attrs[i].nodeName;\n          if (attrName.indexOf('_') !== 0 && attrName.indexOf('data-') !== 0) {\n            return removeResult.keep();\n          }\n        }\n      }\n      if (format.remove !== 'none') {\n        removeNode(ed, elm, format);\n        return removeResult.removed();\n      }\n      return removeResult.keep();\n    };\n    var removeFormat$1 = function (ed, format, vars, node, compareNode) {\n      return removeFormatInternal(ed, format, vars, node, compareNode).fold(never, function (newName) {\n        ed.dom.rename(node, newName);\n        return true;\n      }, always);\n    };\n    var findFormatRoot = function (editor, container, name, vars, similar) {\n      var formatRoot;\n      each$k(getParents$2(editor.dom, container.parentNode).reverse(), function (parent) {\n        if (!formatRoot && parent.id !== '_start' && parent.id !== '_end') {\n          var format = matchNode(editor, parent, name, vars, similar);\n          if (format && format.split !== false) {\n            formatRoot = parent;\n          }\n        }\n      });\n      return formatRoot;\n    };\n    var removeFormatFromClone = function (editor, format, vars, clone) {\n      return removeFormatInternal(editor, format, vars, clone, clone).fold(constant(clone), function (newName) {\n        var fragment = editor.dom.createFragment();\n        fragment.appendChild(clone);\n        return editor.dom.rename(clone, newName);\n      }, constant(null));\n    };\n    var wrapAndSplit = function (editor, formatList, formatRoot, container, target, split, format, vars) {\n      var clone, lastClone, firstClone;\n      var dom = editor.dom;\n      if (formatRoot) {\n        var formatRootParent = formatRoot.parentNode;\n        for (var parent_1 = container.parentNode; parent_1 && parent_1 !== formatRootParent; parent_1 = parent_1.parentNode) {\n          clone = dom.clone(parent_1, false);\n          for (var i = 0; i < formatList.length; i++) {\n            clone = removeFormatFromClone(editor, formatList[i], vars, clone);\n            if (clone === null) {\n              break;\n            }\n          }\n          if (clone) {\n            if (lastClone) {\n              clone.appendChild(lastClone);\n            }\n            if (!firstClone) {\n              firstClone = clone;\n            }\n            lastClone = clone;\n          }\n        }\n        if (split && (!format.mixed || !dom.isBlock(formatRoot))) {\n          container = dom.split(formatRoot, container);\n        }\n        if (lastClone) {\n          target.parentNode.insertBefore(lastClone, target);\n          firstClone.appendChild(target);\n          if (isInlineFormat(format)) {\n            mergeSiblings(dom, format, vars, lastClone);\n          }\n        }\n      }\n      return container;\n    };\n    var remove$1 = function (ed, name, vars, node, similar) {\n      var formatList = ed.formatter.get(name);\n      var format = formatList[0];\n      var contentEditable = true;\n      var dom = ed.dom;\n      var selection = ed.selection;\n      var splitToFormatRoot = function (container) {\n        var formatRoot = findFormatRoot(ed, container, name, vars, similar);\n        return wrapAndSplit(ed, formatList, formatRoot, container, container, true, format, vars);\n      };\n      var isRemoveBookmarkNode = function (node) {\n        return isBookmarkNode$1(node) && isElement$5(node) && (node.id === '_start' || node.id === '_end');\n      };\n      var removeNodeFormat = function (node) {\n        return exists(formatList, function (fmt) {\n          return removeFormat$1(ed, fmt, vars, node, node);\n        });\n      };\n      var process = function (node) {\n        var lastContentEditable = true;\n        var hasContentEditableState = false;\n        if (isElement$5(node) && dom.getContentEditable(node)) {\n          lastContentEditable = contentEditable;\n          contentEditable = dom.getContentEditable(node) === 'true';\n          hasContentEditableState = true;\n        }\n        var children = from(node.childNodes);\n        if (contentEditable && !hasContentEditableState) {\n          var removed = removeNodeFormat(node);\n          var currentNodeMatches = removed || exists(formatList, function (f) {\n            return matchName$1(dom, node, f);\n          });\n          var parentNode = node.parentNode;\n          if (!currentNodeMatches && isNonNullable(parentNode) && shouldExpandToSelector(format)) {\n            removeNodeFormat(parentNode);\n          }\n        }\n        if (format.deep) {\n          if (children.length) {\n            for (var i = 0; i < children.length; i++) {\n              process(children[i]);\n            }\n            if (hasContentEditableState) {\n              contentEditable = lastContentEditable;\n            }\n          }\n        }\n        var textDecorations = [\n          'underline',\n          'line-through',\n          'overline'\n        ];\n        each$k(textDecorations, function (decoration) {\n          if (isElement$5(node) && ed.dom.getStyle(node, 'text-decoration') === decoration && node.parentNode && getTextDecoration(dom, node.parentNode) === decoration) {\n            removeFormat$1(ed, {\n              deep: false,\n              exact: true,\n              inline: 'span',\n              styles: { textDecoration: decoration }\n            }, null, node);\n          }\n        });\n      };\n      var unwrap = function (start) {\n        var node = dom.get(start ? '_start' : '_end');\n        var out = node[start ? 'firstChild' : 'lastChild'];\n        if (isRemoveBookmarkNode(out)) {\n          out = out[start ? 'firstChild' : 'lastChild'];\n        }\n        if (isText$7(out) && out.data.length === 0) {\n          out = start ? node.previousSibling || node.nextSibling : node.nextSibling || node.previousSibling;\n        }\n        dom.remove(node, true);\n        return out;\n      };\n      var removeRngStyle = function (rng) {\n        var startContainer, endContainer;\n        var expandedRng = expandRng(ed, rng, formatList, rng.collapsed);\n        if (format.split) {\n          expandedRng = split(expandedRng);\n          startContainer = getContainer(ed, expandedRng, true);\n          endContainer = getContainer(ed, expandedRng);\n          if (startContainer !== endContainer) {\n            startContainer = normalizeTableSelection(startContainer, true);\n            endContainer = normalizeTableSelection(endContainer, false);\n            if (isChildOfInlineParent(dom, startContainer, endContainer)) {\n              var marker = Optional.from(startContainer.firstChild).getOr(startContainer);\n              splitToFormatRoot(wrapWithSiblings(dom, marker, true, 'span', {\n                'id': '_start',\n                'data-mce-type': 'bookmark'\n              }));\n              unwrap(true);\n              return;\n            }\n            if (isChildOfInlineParent(dom, endContainer, startContainer)) {\n              var marker = Optional.from(endContainer.lastChild).getOr(endContainer);\n              splitToFormatRoot(wrapWithSiblings(dom, marker, false, 'span', {\n                'id': '_end',\n                'data-mce-type': 'bookmark'\n              }));\n              unwrap(false);\n              return;\n            }\n            startContainer = wrap$1(dom, startContainer, 'span', {\n              'id': '_start',\n              'data-mce-type': 'bookmark'\n            });\n            endContainer = wrap$1(dom, endContainer, 'span', {\n              'id': '_end',\n              'data-mce-type': 'bookmark'\n            });\n            var newRng = dom.createRng();\n            newRng.setStartAfter(startContainer);\n            newRng.setEndBefore(endContainer);\n            walk$2(dom, newRng, function (nodes) {\n              each$k(nodes, function (n) {\n                if (!isBookmarkNode$1(n) && !isBookmarkNode$1(n.parentNode)) {\n                  splitToFormatRoot(n);\n                }\n              });\n            });\n            splitToFormatRoot(startContainer);\n            splitToFormatRoot(endContainer);\n            startContainer = unwrap(true);\n            endContainer = unwrap();\n          } else {\n            startContainer = endContainer = splitToFormatRoot(startContainer);\n          }\n          expandedRng.startContainer = startContainer.parentNode ? startContainer.parentNode : startContainer;\n          expandedRng.startOffset = dom.nodeIndex(startContainer);\n          expandedRng.endContainer = endContainer.parentNode ? endContainer.parentNode : endContainer;\n          expandedRng.endOffset = dom.nodeIndex(endContainer) + 1;\n        }\n        walk$2(dom, expandedRng, function (nodes) {\n          each$k(nodes, process);\n        });\n      };\n      if (node) {\n        if (isNode(node)) {\n          var rng = dom.createRng();\n          rng.setStartBefore(node);\n          rng.setEndAfter(node);\n          removeRngStyle(rng);\n        } else {\n          removeRngStyle(node);\n        }\n        fireFormatRemove(ed, name, node, vars);\n        return;\n      }\n      if (dom.getContentEditable(selection.getNode()) === 'false') {\n        node = selection.getNode();\n        for (var i = 0; i < formatList.length; i++) {\n          if (formatList[i].ceFalseOverride) {\n            if (removeFormat$1(ed, formatList[i], vars, node, node)) {\n              break;\n            }\n          }\n        }\n        fireFormatRemove(ed, name, node, vars);\n        return;\n      }\n      if (!selection.isCollapsed() || !isInlineFormat(format) || getCellsFromEditor(ed).length) {\n        preserve(selection, true, function () {\n          runOnRanges(ed, removeRngStyle);\n        });\n        if (isInlineFormat(format) && match$2(ed, name, vars, selection.getStart())) {\n          moveStart(dom, selection, selection.getRng());\n        }\n        ed.nodeChanged();\n      } else {\n        removeCaretFormat(ed, name, vars, similar);\n      }\n      fireFormatRemove(ed, name, node, vars);\n    };\n\n    var each$9 = Tools.each;\n    var mergeTextDecorationsAndColor = function (dom, format, vars, node) {\n      var processTextDecorationsAndColor = function (n) {\n        if (n.nodeType === 1 && n.parentNode && n.parentNode.nodeType === 1) {\n          var textDecoration = getTextDecoration(dom, n.parentNode);\n          if (dom.getStyle(n, 'color') && textDecoration) {\n            dom.setStyle(n, 'text-decoration', textDecoration);\n          } else if (dom.getStyle(n, 'text-decoration') === textDecoration) {\n            dom.setStyle(n, 'text-decoration', null);\n          }\n        }\n      };\n      if (format.styles && (format.styles.color || format.styles.textDecoration)) {\n        Tools.walk(node, processTextDecorationsAndColor, 'childNodes');\n        processTextDecorationsAndColor(node);\n      }\n    };\n    var mergeBackgroundColorAndFontSize = function (dom, format, vars, node) {\n      if (format.styles && format.styles.backgroundColor) {\n        processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'backgroundColor', replaceVars(format.styles.backgroundColor, vars)));\n      }\n    };\n    var mergeSubSup = function (dom, format, vars, node) {\n      if (isInlineFormat(format) && (format.inline === 'sub' || format.inline === 'sup')) {\n        processChildElements(node, hasStyle(dom, 'fontSize'), applyStyle(dom, 'fontSize', ''));\n        dom.remove(dom.select(format.inline === 'sup' ? 'sub' : 'sup', node), true);\n      }\n    };\n    var mergeWithChildren = function (editor, formatList, vars, node) {\n      each$9(formatList, function (format) {\n        if (isInlineFormat(format)) {\n          each$9(editor.dom.select(format.inline, node), function (child) {\n            if (!isElementNode$1(child)) {\n              return;\n            }\n            removeFormat$1(editor, format, vars, child, format.exact ? child : null);\n          });\n        }\n        clearChildStyles(editor.dom, format, node);\n      });\n    };\n    var mergeWithParents = function (editor, format, name, vars, node) {\n      if (matchNode(editor, node.parentNode, name, vars)) {\n        if (removeFormat$1(editor, format, vars, node)) {\n          return;\n        }\n      }\n      if (format.merge_with_parents) {\n        editor.dom.getParent(node.parentNode, function (parent) {\n          if (matchNode(editor, parent, name, vars)) {\n            removeFormat$1(editor, format, vars, node);\n            return true;\n          }\n        });\n      }\n    };\n\n    var each$8 = Tools.each;\n    var isElementNode = function (node) {\n      return isElement$5(node) && !isBookmarkNode$1(node) && !isCaretNode(node) && !isBogus$2(node);\n    };\n    var canFormatBR = function (editor, format, node, parentName) {\n      if (canFormatEmptyLines(editor) && isInlineFormat(format)) {\n        var validBRParentElements = getTextRootBlockElements(editor.schema);\n        var hasCaretNodeSibling = sibling(SugarElement.fromDom(node), function (sibling) {\n          return isCaretNode(sibling.dom);\n        });\n        return hasNonNullableKey(validBRParentElements, parentName) && isEmpty$2(SugarElement.fromDom(node.parentNode), false) && !hasCaretNodeSibling;\n      } else {\n        return false;\n      }\n    };\n    var applyFormat$1 = function (ed, name, vars, node) {\n      var formatList = ed.formatter.get(name);\n      var format = formatList[0];\n      var isCollapsed = !node && ed.selection.isCollapsed();\n      var dom = ed.dom;\n      var selection = ed.selection;\n      var setElementFormat = function (elm, fmt) {\n        if (fmt === void 0) {\n          fmt = format;\n        }\n        if (isFunction(fmt.onformat)) {\n          fmt.onformat(elm, fmt, vars, node);\n        }\n        each$8(fmt.styles, function (value, name) {\n          dom.setStyle(elm, name, replaceVars(value, vars));\n        });\n        if (fmt.styles) {\n          var styleVal = dom.getAttrib(elm, 'style');\n          if (styleVal) {\n            dom.setAttrib(elm, 'data-mce-style', styleVal);\n          }\n        }\n        each$8(fmt.attributes, function (value, name) {\n          dom.setAttrib(elm, name, replaceVars(value, vars));\n        });\n        each$8(fmt.classes, function (value) {\n          value = replaceVars(value, vars);\n          if (!dom.hasClass(elm, value)) {\n            dom.addClass(elm, value);\n          }\n        });\n      };\n      var applyNodeStyle = function (formatList, node) {\n        var found = false;\n        each$8(formatList, function (format) {\n          if (!isSelectorFormat(format)) {\n            return false;\n          }\n          if (isNonNullable(format.collapsed) && format.collapsed !== isCollapsed) {\n            return;\n          }\n          if (dom.is(node, format.selector) && !isCaretNode(node)) {\n            setElementFormat(node, format);\n            found = true;\n            return false;\n          }\n        });\n        return found;\n      };\n      var createWrapElement = function (wrapName) {\n        if (isString$1(wrapName)) {\n          var wrapElm = dom.create(wrapName);\n          setElementFormat(wrapElm);\n          return wrapElm;\n        } else {\n          return null;\n        }\n      };\n      var applyRngStyle = function (dom, rng, nodeSpecific) {\n        var newWrappers = [];\n        var contentEditable = true;\n        var wrapName = format.inline || format.block;\n        var wrapElm = createWrapElement(wrapName);\n        walk$2(dom, rng, function (nodes) {\n          var currentWrapElm;\n          var process = function (node) {\n            var hasContentEditableState = false;\n            var lastContentEditable = contentEditable;\n            var nodeName = node.nodeName.toLowerCase();\n            var parentNode = node.parentNode;\n            var parentName = parentNode.nodeName.toLowerCase();\n            if (isElement$5(node) && dom.getContentEditable(node)) {\n              lastContentEditable = contentEditable;\n              contentEditable = dom.getContentEditable(node) === 'true';\n              hasContentEditableState = true;\n            }\n            if (isBr$5(node) && !canFormatBR(ed, format, node, parentName)) {\n              currentWrapElm = null;\n              if (isBlockFormat(format)) {\n                dom.remove(node);\n              }\n              return;\n            }\n            if (isBlockFormat(format) && format.wrapper && matchNode(ed, node, name, vars)) {\n              currentWrapElm = null;\n              return;\n            }\n            if (contentEditable && !hasContentEditableState && isBlockFormat(format) && !format.wrapper && isTextBlock$1(ed, nodeName) && isValid(ed, parentName, wrapName)) {\n              var elm = dom.rename(node, wrapName);\n              setElementFormat(elm);\n              newWrappers.push(elm);\n              currentWrapElm = null;\n              return;\n            }\n            if (isSelectorFormat(format)) {\n              var found = applyNodeStyle(formatList, node);\n              if (!found && isNonNullable(parentNode) && shouldExpandToSelector(format)) {\n                found = applyNodeStyle(formatList, parentNode);\n              }\n              if (!isInlineFormat(format) || found) {\n                currentWrapElm = null;\n                return;\n              }\n            }\n            if (contentEditable && !hasContentEditableState && isValid(ed, wrapName, nodeName) && isValid(ed, parentName, wrapName) && !(!nodeSpecific && isText$7(node) && isZwsp(node.data)) && !isCaretNode(node) && (!isInlineFormat(format) || !dom.isBlock(node))) {\n              if (!currentWrapElm) {\n                currentWrapElm = dom.clone(wrapElm, false);\n                node.parentNode.insertBefore(currentWrapElm, node);\n                newWrappers.push(currentWrapElm);\n              }\n              currentWrapElm.appendChild(node);\n            } else {\n              currentWrapElm = null;\n              each$k(from(node.childNodes), process);\n              if (hasContentEditableState) {\n                contentEditable = lastContentEditable;\n              }\n              currentWrapElm = null;\n            }\n          };\n          each$k(nodes, process);\n        });\n        if (format.links === true) {\n          each$k(newWrappers, function (node) {\n            var process = function (node) {\n              if (node.nodeName === 'A') {\n                setElementFormat(node, format);\n              }\n              each$k(from(node.childNodes), process);\n            };\n            process(node);\n          });\n        }\n        each$k(newWrappers, function (node) {\n          var getChildCount = function (node) {\n            var count = 0;\n            each$k(node.childNodes, function (node) {\n              if (!isEmptyTextNode$1(node) && !isBookmarkNode$1(node)) {\n                count++;\n              }\n            });\n            return count;\n          };\n          var mergeStyles = function (node) {\n            var childElement = find$3(node.childNodes, isElementNode).filter(function (child) {\n              return matchName$1(dom, child, format);\n            });\n            return childElement.map(function (child) {\n              var clone = dom.clone(child, false);\n              setElementFormat(clone);\n              dom.replace(clone, node, true);\n              dom.remove(child, true);\n              return clone;\n            }).getOr(node);\n          };\n          var childCount = getChildCount(node);\n          if ((newWrappers.length > 1 || !dom.isBlock(node)) && childCount === 0) {\n            dom.remove(node, true);\n            return;\n          }\n          if (isInlineFormat(format) || isBlockFormat(format) && format.wrapper) {\n            if (!format.exact && childCount === 1) {\n              node = mergeStyles(node);\n            }\n            mergeWithChildren(ed, formatList, vars, node);\n            mergeWithParents(ed, format, name, vars, node);\n            mergeBackgroundColorAndFontSize(dom, format, vars, node);\n            mergeTextDecorationsAndColor(dom, format, vars, node);\n            mergeSubSup(dom, format, vars, node);\n            mergeSiblings(dom, format, vars, node);\n          }\n        });\n      };\n      if (dom.getContentEditable(selection.getNode()) === 'false') {\n        node = selection.getNode();\n        for (var i = 0, l = formatList.length; i < l; i++) {\n          var formatItem = formatList[i];\n          if (formatItem.ceFalseOverride && isSelectorFormat(formatItem) && dom.is(node, formatItem.selector)) {\n            setElementFormat(node, formatItem);\n            break;\n          }\n        }\n        fireFormatApply(ed, name, node, vars);\n        return;\n      }\n      if (format) {\n        if (node) {\n          if (isNode(node)) {\n            if (!applyNodeStyle(formatList, node)) {\n              var rng = dom.createRng();\n              rng.setStartBefore(node);\n              rng.setEndAfter(node);\n              applyRngStyle(dom, expandRng(ed, rng, formatList), true);\n            }\n          } else {\n            applyRngStyle(dom, node, true);\n          }\n        } else {\n          if (!isCollapsed || !isInlineFormat(format) || getCellsFromEditor(ed).length) {\n            var curSelNode = selection.getNode();\n            var firstFormat = formatList[0];\n            if (!ed.settings.forced_root_block && firstFormat.defaultBlock && !dom.getParent(curSelNode, dom.isBlock)) {\n              applyFormat$1(ed, firstFormat.defaultBlock);\n            }\n            selection.setRng(normalize(selection.getRng()));\n            preserve(selection, true, function () {\n              runOnRanges(ed, function (selectionRng, fake) {\n                var expandedRng = fake ? selectionRng : expandRng(ed, selectionRng, formatList);\n                applyRngStyle(dom, expandedRng, false);\n              });\n            });\n            moveStart(dom, selection, selection.getRng());\n            ed.nodeChanged();\n          } else {\n            applyCaretFormat(ed, name, vars);\n          }\n        }\n        postProcess$1(name, ed);\n      }\n      fireFormatApply(ed, name, node, vars);\n    };\n\n    var hasVars = function (value) {\n      return has$2(value, 'vars');\n    };\n    var setup$j = function (registeredFormatListeners, editor) {\n      registeredFormatListeners.set({});\n      editor.on('NodeChange', function (e) {\n        updateAndFireChangeCallbacks(editor, e.element, registeredFormatListeners.get());\n      });\n      editor.on('FormatApply FormatRemove', function (e) {\n        var element = Optional.from(e.node).map(function (nodeOrRange) {\n          return isNode(nodeOrRange) ? nodeOrRange : nodeOrRange.startContainer;\n        }).bind(function (node) {\n          return isElement$5(node) ? Optional.some(node) : Optional.from(node.parentElement);\n        }).getOrThunk(function () {\n          return fallbackElement(editor);\n        });\n        updateAndFireChangeCallbacks(editor, element, registeredFormatListeners.get());\n      });\n    };\n    var fallbackElement = function (editor) {\n      return editor.selection.getStart();\n    };\n    var matchingNode = function (editor, parents, format, similar, vars) {\n      var isMatchingNode = function (node) {\n        var matchingFormat = editor.formatter.matchNode(node, format, vars !== null && vars !== void 0 ? vars : {}, similar);\n        return !isUndefined(matchingFormat);\n      };\n      var isUnableToMatch = function (node) {\n        if (matchesUnInheritedFormatSelector(editor, node, format)) {\n          return true;\n        } else {\n          if (!similar) {\n            return isNonNullable(editor.formatter.matchNode(node, format, vars, true));\n          } else {\n            return false;\n          }\n        }\n      };\n      return findUntil$1(parents, isMatchingNode, isUnableToMatch);\n    };\n    var getParents = function (editor, elm) {\n      var element = elm !== null && elm !== void 0 ? elm : fallbackElement(editor);\n      return filter$4(getParents$2(editor.dom, element), function (node) {\n        return isElement$5(node) && !isBogus$2(node);\n      });\n    };\n    var updateAndFireChangeCallbacks = function (editor, elm, registeredCallbacks) {\n      var parents = getParents(editor, elm);\n      each$j(registeredCallbacks, function (data, format) {\n        var runIfChanged = function (spec) {\n          var match = matchingNode(editor, parents, format, spec.similar, hasVars(spec) ? spec.vars : undefined);\n          var isSet = match.isSome();\n          if (spec.state.get() !== isSet) {\n            spec.state.set(isSet);\n            var node_1 = match.getOr(elm);\n            if (hasVars(spec)) {\n              spec.callback(isSet, {\n                node: node_1,\n                format: format,\n                parents: parents\n              });\n            } else {\n              each$k(spec.callbacks, function (callback) {\n                return callback(isSet, {\n                  node: node_1,\n                  format: format,\n                  parents: parents\n                });\n              });\n            }\n          }\n        };\n        each$k([\n          data.withSimilar,\n          data.withoutSimilar\n        ], runIfChanged);\n        each$k(data.withVars, runIfChanged);\n      });\n    };\n    var addListeners = function (editor, registeredFormatListeners, formats, callback, similar, vars) {\n      var formatChangeItems = registeredFormatListeners.get();\n      each$k(formats.split(','), function (format) {\n        var group = get$9(formatChangeItems, format).getOrThunk(function () {\n          var base = {\n            withSimilar: {\n              state: Cell(false),\n              similar: true,\n              callbacks: []\n            },\n            withoutSimilar: {\n              state: Cell(false),\n              similar: false,\n              callbacks: []\n            },\n            withVars: []\n          };\n          formatChangeItems[format] = base;\n          return base;\n        });\n        var getCurrent = function () {\n          var parents = getParents(editor);\n          return matchingNode(editor, parents, format, similar, vars).isSome();\n        };\n        if (isUndefined(vars)) {\n          var toAppendTo = similar ? group.withSimilar : group.withoutSimilar;\n          toAppendTo.callbacks.push(callback);\n          if (toAppendTo.callbacks.length === 1) {\n            toAppendTo.state.set(getCurrent());\n          }\n        } else {\n          group.withVars.push({\n            state: Cell(getCurrent()),\n            similar: similar,\n            vars: vars,\n            callback: callback\n          });\n        }\n      });\n      registeredFormatListeners.set(formatChangeItems);\n    };\n    var removeListeners = function (registeredFormatListeners, formats, callback) {\n      var formatChangeItems = registeredFormatListeners.get();\n      each$k(formats.split(','), function (format) {\n        return get$9(formatChangeItems, format).each(function (group) {\n          formatChangeItems[format] = {\n            withSimilar: __assign(__assign({}, group.withSimilar), {\n              callbacks: filter$4(group.withSimilar.callbacks, function (cb) {\n                return cb !== callback;\n              })\n            }),\n            withoutSimilar: __assign(__assign({}, group.withoutSimilar), {\n              callbacks: filter$4(group.withoutSimilar.callbacks, function (cb) {\n                return cb !== callback;\n              })\n            }),\n            withVars: filter$4(group.withVars, function (item) {\n              return item.callback !== callback;\n            })\n          };\n        });\n      });\n      registeredFormatListeners.set(formatChangeItems);\n    };\n    var formatChangedInternal = function (editor, registeredFormatListeners, formats, callback, similar, vars) {\n      if (registeredFormatListeners.get() === null) {\n        setup$j(registeredFormatListeners, editor);\n      }\n      addListeners(editor, registeredFormatListeners, formats, callback, similar, vars);\n      return {\n        unbind: function () {\n          return removeListeners(registeredFormatListeners, formats, callback);\n        }\n      };\n    };\n\n    var toggle = function (editor, name, vars, node) {\n      var fmt = editor.formatter.get(name);\n      if (match$2(editor, name, vars, node) && (!('toggle' in fmt[0]) || fmt[0].toggle)) {\n        remove$1(editor, name, vars, node);\n      } else {\n        applyFormat$1(editor, name, vars, node);\n      }\n    };\n\n    var fromElements = function (elements, scope) {\n      var doc = scope || document;\n      var fragment = doc.createDocumentFragment();\n      each$k(elements, function (element) {\n        fragment.appendChild(element.dom);\n      });\n      return SugarElement.fromDom(fragment);\n    };\n\n    var tableModel = function (element, width, rows) {\n      return {\n        element: element,\n        width: width,\n        rows: rows\n      };\n    };\n    var tableRow = function (element, cells) {\n      return {\n        element: element,\n        cells: cells\n      };\n    };\n    var cellPosition = function (x, y) {\n      return {\n        x: x,\n        y: y\n      };\n    };\n    var getSpan = function (td, key) {\n      var value = parseInt(get$6(td, key), 10);\n      return isNaN(value) ? 1 : value;\n    };\n    var fillout = function (table, x, y, tr, td) {\n      var rowspan = getSpan(td, 'rowspan');\n      var colspan = getSpan(td, 'colspan');\n      var rows = table.rows;\n      for (var y2 = y; y2 < y + rowspan; y2++) {\n        if (!rows[y2]) {\n          rows[y2] = tableRow(deep$1(tr), []);\n        }\n        for (var x2 = x; x2 < x + colspan; x2++) {\n          var cells = rows[y2].cells;\n          cells[x2] = y2 === y && x2 === x ? td : shallow(td);\n        }\n      }\n    };\n    var cellExists = function (table, x, y) {\n      var rows = table.rows;\n      var cells = rows[y] ? rows[y].cells : [];\n      return !!cells[x];\n    };\n    var skipCellsX = function (table, x, y) {\n      while (cellExists(table, x, y)) {\n        x++;\n      }\n      return x;\n    };\n    var getWidth = function (rows) {\n      return foldl(rows, function (acc, row) {\n        return row.cells.length > acc ? row.cells.length : acc;\n      }, 0);\n    };\n    var findElementPos = function (table, element) {\n      var rows = table.rows;\n      for (var y = 0; y < rows.length; y++) {\n        var cells = rows[y].cells;\n        for (var x = 0; x < cells.length; x++) {\n          if (eq(cells[x], element)) {\n            return Optional.some(cellPosition(x, y));\n          }\n        }\n      }\n      return Optional.none();\n    };\n    var extractRows = function (table, sx, sy, ex, ey) {\n      var newRows = [];\n      var rows = table.rows;\n      for (var y = sy; y <= ey; y++) {\n        var cells = rows[y].cells;\n        var slice = sx < ex ? cells.slice(sx, ex + 1) : cells.slice(ex, sx + 1);\n        newRows.push(tableRow(rows[y].element, slice));\n      }\n      return newRows;\n    };\n    var subTable = function (table, startPos, endPos) {\n      var sx = startPos.x, sy = startPos.y;\n      var ex = endPos.x, ey = endPos.y;\n      var newRows = sy < ey ? extractRows(table, sx, sy, ex, ey) : extractRows(table, sx, ey, ex, sy);\n      return tableModel(table.element, getWidth(newRows), newRows);\n    };\n    var createDomTable = function (table, rows) {\n      var tableElement = shallow(table.element);\n      var tableBody = SugarElement.fromTag('tbody');\n      append(tableBody, rows);\n      append$1(tableElement, tableBody);\n      return tableElement;\n    };\n    var modelRowsToDomRows = function (table) {\n      return map$3(table.rows, function (row) {\n        var cells = map$3(row.cells, function (cell) {\n          var td = deep$1(cell);\n          remove$6(td, 'colspan');\n          remove$6(td, 'rowspan');\n          return td;\n        });\n        var tr = shallow(row.element);\n        append(tr, cells);\n        return tr;\n      });\n    };\n    var fromDom = function (tableElm) {\n      var table = tableModel(shallow(tableElm), 0, []);\n      each$k(descendants(tableElm, 'tr'), function (tr, y) {\n        each$k(descendants(tr, 'td,th'), function (td, x) {\n          fillout(table, skipCellsX(table, x, y), y, tr, td);\n        });\n      });\n      return tableModel(table.element, getWidth(table.rows), table.rows);\n    };\n    var toDom = function (table) {\n      return createDomTable(table, modelRowsToDomRows(table));\n    };\n    var subsection = function (table, startElement, endElement) {\n      return findElementPos(table, startElement).bind(function (startPos) {\n        return findElementPos(table, endElement).map(function (endPos) {\n          return subTable(table, startPos, endPos);\n        });\n      });\n    };\n\n    var findParentListContainer = function (parents) {\n      return find$3(parents, function (elm) {\n        return name(elm) === 'ul' || name(elm) === 'ol';\n      });\n    };\n    var getFullySelectedListWrappers = function (parents, rng) {\n      return find$3(parents, function (elm) {\n        return name(elm) === 'li' && hasAllContentsSelected(elm, rng);\n      }).fold(constant([]), function (_li) {\n        return findParentListContainer(parents).map(function (listCont) {\n          var listElm = SugarElement.fromTag(name(listCont));\n          var listStyles = filter$3(getAllRaw(listCont), function (_style, name) {\n            return startsWith(name, 'list-style');\n          });\n          setAll(listElm, listStyles);\n          return [\n            SugarElement.fromTag('li'),\n            listElm\n          ];\n        }).getOr([]);\n      });\n    };\n    var wrap = function (innerElm, elms) {\n      var wrapped = foldl(elms, function (acc, elm) {\n        append$1(elm, acc);\n        return elm;\n      }, innerElm);\n      return elms.length > 0 ? fromElements([wrapped]) : wrapped;\n    };\n    var directListWrappers = function (commonAnchorContainer) {\n      if (isListItem(commonAnchorContainer)) {\n        return parent(commonAnchorContainer).filter(isList).fold(constant([]), function (listElm) {\n          return [\n            commonAnchorContainer,\n            listElm\n          ];\n        });\n      } else {\n        return isList(commonAnchorContainer) ? [commonAnchorContainer] : [];\n      }\n    };\n    var getWrapElements = function (rootNode, rng) {\n      var commonAnchorContainer = SugarElement.fromDom(rng.commonAncestorContainer);\n      var parents = parentsAndSelf(commonAnchorContainer, rootNode);\n      var wrapElements = filter$4(parents, function (elm) {\n        return isInline$1(elm) || isHeading(elm);\n      });\n      var listWrappers = getFullySelectedListWrappers(parents, rng);\n      var allWrappers = wrapElements.concat(listWrappers.length ? listWrappers : directListWrappers(commonAnchorContainer));\n      return map$3(allWrappers, shallow);\n    };\n    var emptyFragment = function () {\n      return fromElements([]);\n    };\n    var getFragmentFromRange = function (rootNode, rng) {\n      return wrap(SugarElement.fromDom(rng.cloneContents()), getWrapElements(rootNode, rng));\n    };\n    var getParentTable = function (rootElm, cell) {\n      return ancestor$2(cell, 'table', curry(eq, rootElm));\n    };\n    var getTableFragment = function (rootNode, selectedTableCells) {\n      return getParentTable(rootNode, selectedTableCells[0]).bind(function (tableElm) {\n        var firstCell = selectedTableCells[0];\n        var lastCell = selectedTableCells[selectedTableCells.length - 1];\n        var fullTableModel = fromDom(tableElm);\n        return subsection(fullTableModel, firstCell, lastCell).map(function (sectionedTableModel) {\n          return fromElements([toDom(sectionedTableModel)]);\n        });\n      }).getOrThunk(emptyFragment);\n    };\n    var getSelectionFragment = function (rootNode, ranges) {\n      return ranges.length > 0 && ranges[0].collapsed ? emptyFragment() : getFragmentFromRange(rootNode, ranges[0]);\n    };\n    var read$3 = function (rootNode, ranges) {\n      var selectedCells = getCellsFromElementOrRanges(ranges, rootNode);\n      return selectedCells.length > 0 ? getTableFragment(rootNode, selectedCells) : getSelectionFragment(rootNode, ranges);\n    };\n\n    var trimLeadingCollapsibleText = function (text) {\n      return text.replace(/^[ \\f\\n\\r\\t\\v]+/, '');\n    };\n    var isCollapsibleWhitespace = function (text, index) {\n      return index >= 0 && index < text.length && isWhiteSpace(text.charAt(index));\n    };\n    var getInnerText = function (bin, shouldTrim) {\n      var text = trim$3(bin.innerText);\n      return shouldTrim ? trimLeadingCollapsibleText(text) : text;\n    };\n    var getContextNodeName = function (parentBlockOpt) {\n      return parentBlockOpt.map(function (block) {\n        return block.nodeName;\n      }).getOr('div').toLowerCase();\n    };\n    var getTextContent = function (editor) {\n      return Optional.from(editor.selection.getRng()).map(function (rng) {\n        var parentBlockOpt = Optional.from(editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock));\n        var body = editor.getBody();\n        var contextNodeName = getContextNodeName(parentBlockOpt);\n        var shouldTrimSpaces = Env.browser.isIE() && contextNodeName !== 'pre';\n        var bin = editor.dom.add(body, contextNodeName, {\n          'data-mce-bogus': 'all',\n          'style': 'overflow: hidden; opacity: 0;'\n        }, rng.cloneContents());\n        var text = getInnerText(bin, shouldTrimSpaces);\n        var nonRenderedText = trim$3(bin.textContent);\n        editor.dom.remove(bin);\n        if (isCollapsibleWhitespace(nonRenderedText, 0) || isCollapsibleWhitespace(nonRenderedText, nonRenderedText.length - 1)) {\n          var parentBlock = parentBlockOpt.getOr(body);\n          var parentBlockText = getInnerText(parentBlock, shouldTrimSpaces);\n          var textIndex = parentBlockText.indexOf(text);\n          if (textIndex === -1) {\n            return text;\n          } else {\n            var hasProceedingSpace = isCollapsibleWhitespace(parentBlockText, textIndex - 1);\n            var hasTrailingSpace = isCollapsibleWhitespace(parentBlockText, textIndex + text.length);\n            return (hasProceedingSpace ? ' ' : '') + text + (hasTrailingSpace ? ' ' : '');\n          }\n        } else {\n          return text;\n        }\n      }).getOr('');\n    };\n    var getSerializedContent = function (editor, args) {\n      var rng = editor.selection.getRng(), tmpElm = editor.dom.create('body');\n      var sel = editor.selection.getSel();\n      var ranges = processRanges(editor, getRanges(sel));\n      var fragment = args.contextual ? read$3(SugarElement.fromDom(editor.getBody()), ranges).dom : rng.cloneContents();\n      if (fragment) {\n        tmpElm.appendChild(fragment);\n      }\n      return editor.selection.serializer.serialize(tmpElm, args);\n    };\n    var setupArgs$1 = function (args, format) {\n      return __assign(__assign({}, args), {\n        format: format,\n        get: true,\n        selection: true\n      });\n    };\n    var getSelectedContentInternal = function (editor, format, args) {\n      if (args === void 0) {\n        args = {};\n      }\n      var defaultedArgs = setupArgs$1(args, format);\n      var updatedArgs = editor.fire('BeforeGetContent', defaultedArgs);\n      if (updatedArgs.isDefaultPrevented()) {\n        editor.fire('GetContent', updatedArgs);\n        return updatedArgs.content;\n      }\n      if (updatedArgs.format === 'text') {\n        return getTextContent(editor);\n      } else {\n        updatedArgs.getInner = true;\n        var content = getSerializedContent(editor, updatedArgs);\n        if (updatedArgs.format === 'tree') {\n          return content;\n        } else {\n          updatedArgs.content = editor.selection.isCollapsed() ? '' : content;\n          editor.fire('GetContent', updatedArgs);\n          return updatedArgs.content;\n        }\n      }\n    };\n\n    var KEEP = 0, INSERT = 1, DELETE = 2;\n    var diff = function (left, right) {\n      var size = left.length + right.length + 2;\n      var vDown = new Array(size);\n      var vUp = new Array(size);\n      var snake = function (start, end, diag) {\n        return {\n          start: start,\n          end: end,\n          diag: diag\n        };\n      };\n      var buildScript = function (start1, end1, start2, end2, script) {\n        var middle = getMiddleSnake(start1, end1, start2, end2);\n        if (middle === null || middle.start === end1 && middle.diag === end1 - end2 || middle.end === start1 && middle.diag === start1 - start2) {\n          var i = start1;\n          var j = start2;\n          while (i < end1 || j < end2) {\n            if (i < end1 && j < end2 && left[i] === right[j]) {\n              script.push([\n                KEEP,\n                left[i]\n              ]);\n              ++i;\n              ++j;\n            } else {\n              if (end1 - start1 > end2 - start2) {\n                script.push([\n                  DELETE,\n                  left[i]\n                ]);\n                ++i;\n              } else {\n                script.push([\n                  INSERT,\n                  right[j]\n                ]);\n                ++j;\n              }\n            }\n          }\n        } else {\n          buildScript(start1, middle.start, start2, middle.start - middle.diag, script);\n          for (var i2 = middle.start; i2 < middle.end; ++i2) {\n            script.push([\n              KEEP,\n              left[i2]\n            ]);\n          }\n          buildScript(middle.end, end1, middle.end - middle.diag, end2, script);\n        }\n      };\n      var buildSnake = function (start, diag, end1, end2) {\n        var end = start;\n        while (end - diag < end2 && end < end1 && left[end] === right[end - diag]) {\n          ++end;\n        }\n        return snake(start, end, diag);\n      };\n      var getMiddleSnake = function (start1, end1, start2, end2) {\n        var m = end1 - start1;\n        var n = end2 - start2;\n        if (m === 0 || n === 0) {\n          return null;\n        }\n        var delta = m - n;\n        var sum = n + m;\n        var offset = (sum % 2 === 0 ? sum : sum + 1) / 2;\n        vDown[1 + offset] = start1;\n        vUp[1 + offset] = end1 + 1;\n        var d, k, i, x, y;\n        for (d = 0; d <= offset; ++d) {\n          for (k = -d; k <= d; k += 2) {\n            i = k + offset;\n            if (k === -d || k !== d && vDown[i - 1] < vDown[i + 1]) {\n              vDown[i] = vDown[i + 1];\n            } else {\n              vDown[i] = vDown[i - 1] + 1;\n            }\n            x = vDown[i];\n            y = x - start1 + start2 - k;\n            while (x < end1 && y < end2 && left[x] === right[y]) {\n              vDown[i] = ++x;\n              ++y;\n            }\n            if (delta % 2 !== 0 && delta - d <= k && k <= delta + d) {\n              if (vUp[i - delta] <= vDown[i]) {\n                return buildSnake(vUp[i - delta], k + start1 - start2, end1, end2);\n              }\n            }\n          }\n          for (k = delta - d; k <= delta + d; k += 2) {\n            i = k + offset - delta;\n            if (k === delta - d || k !== delta + d && vUp[i + 1] <= vUp[i - 1]) {\n              vUp[i] = vUp[i + 1] - 1;\n            } else {\n              vUp[i] = vUp[i - 1];\n            }\n            x = vUp[i] - 1;\n            y = x - start1 + start2 - k;\n            while (x >= start1 && y >= start2 && left[x] === right[y]) {\n              vUp[i] = x--;\n              y--;\n            }\n            if (delta % 2 === 0 && -d <= k && k <= d) {\n              if (vUp[i] <= vDown[i + delta]) {\n                return buildSnake(vUp[i], k + start1 - start2, end1, end2);\n              }\n            }\n          }\n        }\n      };\n      var script = [];\n      buildScript(0, left.length, 0, right.length, script);\n      return script;\n    };\n\n    var getOuterHtml = function (elm) {\n      if (isElement$5(elm)) {\n        return elm.outerHTML;\n      } else if (isText$7(elm)) {\n        return Entities.encodeRaw(elm.data, false);\n      } else if (isComment(elm)) {\n        return '<!--' + elm.data + '-->';\n      }\n      return '';\n    };\n    var createFragment = function (html) {\n      var node;\n      var container = document.createElement('div');\n      var frag = document.createDocumentFragment();\n      if (html) {\n        container.innerHTML = html;\n      }\n      while (node = container.firstChild) {\n        frag.appendChild(node);\n      }\n      return frag;\n    };\n    var insertAt = function (elm, html, index) {\n      var fragment = createFragment(html);\n      if (elm.hasChildNodes() && index < elm.childNodes.length) {\n        var target = elm.childNodes[index];\n        target.parentNode.insertBefore(fragment, target);\n      } else {\n        elm.appendChild(fragment);\n      }\n    };\n    var removeAt = function (elm, index) {\n      if (elm.hasChildNodes() && index < elm.childNodes.length) {\n        var target = elm.childNodes[index];\n        target.parentNode.removeChild(target);\n      }\n    };\n    var applyDiff = function (diff, elm) {\n      var index = 0;\n      each$k(diff, function (action) {\n        if (action[0] === KEEP) {\n          index++;\n        } else if (action[0] === INSERT) {\n          insertAt(elm, action[1], index);\n          index++;\n        } else if (action[0] === DELETE) {\n          removeAt(elm, index);\n        }\n      });\n    };\n    var read$2 = function (elm, trimZwsp) {\n      return filter$4(map$3(from(elm.childNodes), trimZwsp ? compose(trim$3, getOuterHtml) : getOuterHtml), function (item) {\n        return item.length > 0;\n      });\n    };\n    var write = function (fragments, elm) {\n      var currentFragments = map$3(from(elm.childNodes), getOuterHtml);\n      applyDiff(diff(currentFragments, fragments), elm);\n      return elm;\n    };\n\n    var lazyTempDocument$1 = cached(function () {\n      return document.implementation.createHTMLDocument('undo');\n    });\n    var hasIframes = function (body) {\n      return body.querySelector('iframe') !== null;\n    };\n    var createFragmentedLevel = function (fragments) {\n      return {\n        type: 'fragmented',\n        fragments: fragments,\n        content: '',\n        bookmark: null,\n        beforeBookmark: null\n      };\n    };\n    var createCompleteLevel = function (content) {\n      return {\n        type: 'complete',\n        fragments: null,\n        content: content,\n        bookmark: null,\n        beforeBookmark: null\n      };\n    };\n    var createFromEditor = function (editor) {\n      var tempAttrs = editor.serializer.getTempAttrs();\n      var body = trim$1(editor.getBody(), tempAttrs);\n      return hasIframes(body) ? createFragmentedLevel(read$2(body, true)) : createCompleteLevel(trim$3(body.innerHTML));\n    };\n    var applyToEditor = function (editor, level, before) {\n      var bookmark = before ? level.beforeBookmark : level.bookmark;\n      if (level.type === 'fragmented') {\n        write(level.fragments, editor.getBody());\n      } else {\n        editor.setContent(level.content, {\n          format: 'raw',\n          no_selection: isNonNullable(bookmark) && isPathBookmark(bookmark) ? !bookmark.isFakeCaret : true\n        });\n      }\n      editor.selection.moveToBookmark(bookmark);\n    };\n    var getLevelContent = function (level) {\n      return level.type === 'fragmented' ? level.fragments.join('') : level.content;\n    };\n    var getCleanLevelContent = function (level) {\n      var elm = SugarElement.fromTag('body', lazyTempDocument$1());\n      set(elm, getLevelContent(level));\n      each$k(descendants(elm, '*[data-mce-bogus]'), unwrap);\n      return get$3(elm);\n    };\n    var hasEqualContent = function (level1, level2) {\n      return getLevelContent(level1) === getLevelContent(level2);\n    };\n    var hasEqualCleanedContent = function (level1, level2) {\n      return getCleanLevelContent(level1) === getCleanLevelContent(level2);\n    };\n    var isEq$1 = function (level1, level2) {\n      if (!level1 || !level2) {\n        return false;\n      } else if (hasEqualContent(level1, level2)) {\n        return true;\n      } else {\n        return hasEqualCleanedContent(level1, level2);\n      }\n    };\n\n    var isUnlocked = function (locks) {\n      return locks.get() === 0;\n    };\n\n    var setTyping = function (undoManager, typing, locks) {\n      if (isUnlocked(locks)) {\n        undoManager.typing = typing;\n      }\n    };\n    var endTyping = function (undoManager, locks) {\n      if (undoManager.typing) {\n        setTyping(undoManager, false, locks);\n        undoManager.add();\n      }\n    };\n    var endTypingLevelIgnoreLocks = function (undoManager) {\n      if (undoManager.typing) {\n        undoManager.typing = false;\n        undoManager.add();\n      }\n    };\n\n    var beforeChange$1 = function (editor, locks, beforeBookmark) {\n      if (isUnlocked(locks)) {\n        beforeBookmark.set(getUndoBookmark(editor.selection));\n      }\n    };\n    var addUndoLevel$1 = function (editor, undoManager, index, locks, beforeBookmark, level, event) {\n      var currentLevel = createFromEditor(editor);\n      level = level || {};\n      level = Tools.extend(level, currentLevel);\n      if (isUnlocked(locks) === false || editor.removed) {\n        return null;\n      }\n      var lastLevel = undoManager.data[index.get()];\n      if (editor.fire('BeforeAddUndo', {\n          level: level,\n          lastLevel: lastLevel,\n          originalEvent: event\n        }).isDefaultPrevented()) {\n        return null;\n      }\n      if (lastLevel && isEq$1(lastLevel, level)) {\n        return null;\n      }\n      if (undoManager.data[index.get()]) {\n        beforeBookmark.get().each(function (bm) {\n          undoManager.data[index.get()].beforeBookmark = bm;\n        });\n      }\n      var customUndoRedoLevels = getCustomUndoRedoLevels(editor);\n      if (customUndoRedoLevels) {\n        if (undoManager.data.length > customUndoRedoLevels) {\n          for (var i = 0; i < undoManager.data.length - 1; i++) {\n            undoManager.data[i] = undoManager.data[i + 1];\n          }\n          undoManager.data.length--;\n          index.set(undoManager.data.length);\n        }\n      }\n      level.bookmark = getUndoBookmark(editor.selection);\n      if (index.get() < undoManager.data.length - 1) {\n        undoManager.data.length = index.get() + 1;\n      }\n      undoManager.data.push(level);\n      index.set(undoManager.data.length - 1);\n      var args = {\n        level: level,\n        lastLevel: lastLevel,\n        originalEvent: event\n      };\n      if (index.get() > 0) {\n        editor.setDirty(true);\n        editor.fire('AddUndo', args);\n        editor.fire('change', args);\n      } else {\n        editor.fire('AddUndo', args);\n      }\n      return level;\n    };\n    var clear$1 = function (editor, undoManager, index) {\n      undoManager.data = [];\n      index.set(0);\n      undoManager.typing = false;\n      editor.fire('ClearUndos');\n    };\n    var extra$1 = function (editor, undoManager, index, callback1, callback2) {\n      if (undoManager.transact(callback1)) {\n        var bookmark = undoManager.data[index.get()].bookmark;\n        var lastLevel = undoManager.data[index.get() - 1];\n        applyToEditor(editor, lastLevel, true);\n        if (undoManager.transact(callback2)) {\n          undoManager.data[index.get() - 1].beforeBookmark = bookmark;\n        }\n      }\n    };\n    var redo$1 = function (editor, index, data) {\n      var level;\n      if (index.get() < data.length - 1) {\n        index.set(index.get() + 1);\n        level = data[index.get()];\n        applyToEditor(editor, level, false);\n        editor.setDirty(true);\n        editor.fire('Redo', { level: level });\n      }\n      return level;\n    };\n    var undo$1 = function (editor, undoManager, locks, index) {\n      var level;\n      if (undoManager.typing) {\n        undoManager.add();\n        undoManager.typing = false;\n        setTyping(undoManager, false, locks);\n      }\n      if (index.get() > 0) {\n        index.set(index.get() - 1);\n        level = undoManager.data[index.get()];\n        applyToEditor(editor, level, true);\n        editor.setDirty(true);\n        editor.fire('Undo', { level: level });\n      }\n      return level;\n    };\n    var reset$1 = function (undoManager) {\n      undoManager.clear();\n      undoManager.add();\n    };\n    var hasUndo$1 = function (editor, undoManager, index) {\n      return index.get() > 0 || undoManager.typing && undoManager.data[0] && !isEq$1(createFromEditor(editor), undoManager.data[0]);\n    };\n    var hasRedo$1 = function (undoManager, index) {\n      return index.get() < undoManager.data.length - 1 && !undoManager.typing;\n    };\n    var transact$1 = function (undoManager, locks, callback) {\n      endTyping(undoManager, locks);\n      undoManager.beforeChange();\n      undoManager.ignore(callback);\n      return undoManager.add();\n    };\n    var ignore$1 = function (locks, callback) {\n      try {\n        locks.set(locks.get() + 1);\n        callback();\n      } finally {\n        locks.set(locks.get() - 1);\n      }\n    };\n\n    var addVisualInternal = function (editor, elm) {\n      var dom = editor.dom;\n      var scope = isNonNullable(elm) ? elm : editor.getBody();\n      if (isUndefined(editor.hasVisual)) {\n        editor.hasVisual = isVisualAidsEnabled(editor);\n      }\n      each$k(dom.select('table,a', scope), function (matchedElm) {\n        switch (matchedElm.nodeName) {\n        case 'TABLE':\n          var cls = getVisualAidsTableClass(editor);\n          var value = dom.getAttrib(matchedElm, 'border');\n          if ((!value || value === '0') && editor.hasVisual) {\n            dom.addClass(matchedElm, cls);\n          } else {\n            dom.removeClass(matchedElm, cls);\n          }\n          break;\n        case 'A':\n          if (!dom.getAttrib(matchedElm, 'href')) {\n            var value_1 = dom.getAttrib(matchedElm, 'name') || matchedElm.id;\n            var cls_1 = getVisualAidsAnchorClass(editor);\n            if (value_1 && editor.hasVisual) {\n              dom.addClass(matchedElm, cls_1);\n            } else {\n              dom.removeClass(matchedElm, cls_1);\n            }\n          }\n          break;\n        }\n      });\n      editor.fire('VisualAid', {\n        element: elm,\n        hasVisual: editor.hasVisual\n      });\n    };\n\n    var makePlainAdaptor = function (editor) {\n      return {\n        undoManager: {\n          beforeChange: function (locks, beforeBookmark) {\n            return beforeChange$1(editor, locks, beforeBookmark);\n          },\n          add: function (undoManager, index, locks, beforeBookmark, level, event) {\n            return addUndoLevel$1(editor, undoManager, index, locks, beforeBookmark, level, event);\n          },\n          undo: function (undoManager, locks, index) {\n            return undo$1(editor, undoManager, locks, index);\n          },\n          redo: function (index, data) {\n            return redo$1(editor, index, data);\n          },\n          clear: function (undoManager, index) {\n            return clear$1(editor, undoManager, index);\n          },\n          reset: function (undoManager) {\n            return reset$1(undoManager);\n          },\n          hasUndo: function (undoManager, index) {\n            return hasUndo$1(editor, undoManager, index);\n          },\n          hasRedo: function (undoManager, index) {\n            return hasRedo$1(undoManager, index);\n          },\n          transact: function (undoManager, locks, callback) {\n            return transact$1(undoManager, locks, callback);\n          },\n          ignore: function (locks, callback) {\n            return ignore$1(locks, callback);\n          },\n          extra: function (undoManager, index, callback1, callback2) {\n            return extra$1(editor, undoManager, index, callback1, callback2);\n          }\n        },\n        formatter: {\n          match: function (name, vars, node, similar) {\n            return match$2(editor, name, vars, node, similar);\n          },\n          matchAll: function (names, vars) {\n            return matchAll(editor, names, vars);\n          },\n          matchNode: function (node, name, vars, similar) {\n            return matchNode(editor, node, name, vars, similar);\n          },\n          canApply: function (name) {\n            return canApply(editor, name);\n          },\n          closest: function (names) {\n            return closest(editor, names);\n          },\n          apply: function (name, vars, node) {\n            return applyFormat$1(editor, name, vars, node);\n          },\n          remove: function (name, vars, node, similar) {\n            return remove$1(editor, name, vars, node, similar);\n          },\n          toggle: function (name, vars, node) {\n            return toggle(editor, name, vars, node);\n          },\n          formatChanged: function (registeredFormatListeners, formats, callback, similar, vars) {\n            return formatChangedInternal(editor, registeredFormatListeners, formats, callback, similar, vars);\n          }\n        },\n        editor: {\n          getContent: function (args, format) {\n            return getContentInternal(editor, args, format);\n          },\n          setContent: function (content, args) {\n            return setContentInternal(editor, content, args);\n          },\n          insertContent: function (value, details) {\n            return insertHtmlAtCaret(editor, value, details);\n          },\n          addVisual: function (elm) {\n            return addVisualInternal(editor, elm);\n          }\n        },\n        selection: {\n          getContent: function (format, args) {\n            return getSelectedContentInternal(editor, format, args);\n          }\n        },\n        raw: {\n          getModel: function () {\n            return Optional.none();\n          }\n        }\n      };\n    };\n    var makeRtcAdaptor = function (rtcEditor) {\n      var defaultVars = function (vars) {\n        return isObject(vars) ? vars : {};\n      };\n      var undoManager = rtcEditor.undoManager, formatter = rtcEditor.formatter, editor = rtcEditor.editor, selection = rtcEditor.selection, raw = rtcEditor.raw;\n      return {\n        undoManager: {\n          beforeChange: undoManager.beforeChange,\n          add: undoManager.add,\n          undo: undoManager.undo,\n          redo: undoManager.redo,\n          clear: undoManager.clear,\n          reset: undoManager.reset,\n          hasUndo: undoManager.hasUndo,\n          hasRedo: undoManager.hasRedo,\n          transact: function (_undoManager, _locks, fn) {\n            return undoManager.transact(fn);\n          },\n          ignore: function (_locks, callback) {\n            return undoManager.ignore(callback);\n          },\n          extra: function (_undoManager, _index, callback1, callback2) {\n            return undoManager.extra(callback1, callback2);\n          }\n        },\n        formatter: {\n          match: function (name, vars, _node, similar) {\n            return formatter.match(name, defaultVars(vars), similar);\n          },\n          matchAll: formatter.matchAll,\n          matchNode: formatter.matchNode,\n          canApply: function (name) {\n            return formatter.canApply(name);\n          },\n          closest: function (names) {\n            return formatter.closest(names);\n          },\n          apply: function (name, vars, _node) {\n            return formatter.apply(name, defaultVars(vars));\n          },\n          remove: function (name, vars, _node, _similar) {\n            return formatter.remove(name, defaultVars(vars));\n          },\n          toggle: function (name, vars, _node) {\n            return formatter.toggle(name, defaultVars(vars));\n          },\n          formatChanged: function (_rfl, formats, callback, similar, vars) {\n            return formatter.formatChanged(formats, callback, similar, vars);\n          }\n        },\n        editor: {\n          getContent: function (args, _format) {\n            return editor.getContent(args);\n          },\n          setContent: function (content, args) {\n            return editor.setContent(content, args);\n          },\n          insertContent: function (content, _details) {\n            return editor.insertContent(content);\n          },\n          addVisual: editor.addVisual\n        },\n        selection: {\n          getContent: function (_format, args) {\n            return selection.getContent(args);\n          }\n        },\n        raw: {\n          getModel: function () {\n            return Optional.some(raw.getRawModel());\n          }\n        }\n      };\n    };\n    var makeNoopAdaptor = function () {\n      var nul = constant(null);\n      var empty = constant('');\n      return {\n        undoManager: {\n          beforeChange: noop,\n          add: nul,\n          undo: nul,\n          redo: nul,\n          clear: noop,\n          reset: noop,\n          hasUndo: never,\n          hasRedo: never,\n          transact: nul,\n          ignore: noop,\n          extra: noop\n        },\n        formatter: {\n          match: never,\n          matchAll: constant([]),\n          matchNode: constant(undefined),\n          canApply: never,\n          closest: empty,\n          apply: noop,\n          remove: noop,\n          toggle: noop,\n          formatChanged: constant({ unbind: noop })\n        },\n        editor: {\n          getContent: empty,\n          setContent: empty,\n          insertContent: noop,\n          addVisual: noop\n        },\n        selection: { getContent: empty },\n        raw: { getModel: constant(Optional.none()) }\n      };\n    };\n    var isRtc = function (editor) {\n      return has$2(editor.plugins, 'rtc');\n    };\n    var getRtcSetup = function (editor) {\n      return get$9(editor.plugins, 'rtc').bind(function (rtcPlugin) {\n        return Optional.from(rtcPlugin.setup);\n      });\n    };\n    var setup$i = function (editor) {\n      var editorCast = editor;\n      return getRtcSetup(editor).fold(function () {\n        editorCast.rtcInstance = makePlainAdaptor(editor);\n        return Optional.none();\n      }, function (setup) {\n        editorCast.rtcInstance = makeNoopAdaptor();\n        return Optional.some(function () {\n          return setup().then(function (rtcEditor) {\n            editorCast.rtcInstance = makeRtcAdaptor(rtcEditor);\n            return rtcEditor.rtc.isRemote;\n          });\n        });\n      });\n    };\n    var getRtcInstanceWithFallback = function (editor) {\n      return editor.rtcInstance ? editor.rtcInstance : makePlainAdaptor(editor);\n    };\n    var getRtcInstanceWithError = function (editor) {\n      var rtcInstance = editor.rtcInstance;\n      if (!rtcInstance) {\n        throw new Error('Failed to get RTC instance not yet initialized.');\n      } else {\n        return rtcInstance;\n      }\n    };\n    var beforeChange = function (editor, locks, beforeBookmark) {\n      getRtcInstanceWithError(editor).undoManager.beforeChange(locks, beforeBookmark);\n    };\n    var addUndoLevel = function (editor, undoManager, index, locks, beforeBookmark, level, event) {\n      return getRtcInstanceWithError(editor).undoManager.add(undoManager, index, locks, beforeBookmark, level, event);\n    };\n    var undo = function (editor, undoManager, locks, index) {\n      return getRtcInstanceWithError(editor).undoManager.undo(undoManager, locks, index);\n    };\n    var redo = function (editor, index, data) {\n      return getRtcInstanceWithError(editor).undoManager.redo(index, data);\n    };\n    var clear = function (editor, undoManager, index) {\n      getRtcInstanceWithError(editor).undoManager.clear(undoManager, index);\n    };\n    var reset = function (editor, undoManager) {\n      getRtcInstanceWithError(editor).undoManager.reset(undoManager);\n    };\n    var hasUndo = function (editor, undoManager, index) {\n      return getRtcInstanceWithError(editor).undoManager.hasUndo(undoManager, index);\n    };\n    var hasRedo = function (editor, undoManager, index) {\n      return getRtcInstanceWithError(editor).undoManager.hasRedo(undoManager, index);\n    };\n    var transact = function (editor, undoManager, locks, callback) {\n      return getRtcInstanceWithError(editor).undoManager.transact(undoManager, locks, callback);\n    };\n    var ignore = function (editor, locks, callback) {\n      getRtcInstanceWithError(editor).undoManager.ignore(locks, callback);\n    };\n    var extra = function (editor, undoManager, index, callback1, callback2) {\n      getRtcInstanceWithError(editor).undoManager.extra(undoManager, index, callback1, callback2);\n    };\n    var matchFormat = function (editor, name, vars, node, similar) {\n      return getRtcInstanceWithError(editor).formatter.match(name, vars, node, similar);\n    };\n    var matchAllFormats = function (editor, names, vars) {\n      return getRtcInstanceWithError(editor).formatter.matchAll(names, vars);\n    };\n    var matchNodeFormat = function (editor, node, name, vars, similar) {\n      return getRtcInstanceWithError(editor).formatter.matchNode(node, name, vars, similar);\n    };\n    var canApplyFormat = function (editor, name) {\n      return getRtcInstanceWithError(editor).formatter.canApply(name);\n    };\n    var closestFormat = function (editor, names) {\n      return getRtcInstanceWithError(editor).formatter.closest(names);\n    };\n    var applyFormat = function (editor, name, vars, node) {\n      getRtcInstanceWithError(editor).formatter.apply(name, vars, node);\n    };\n    var removeFormat = function (editor, name, vars, node, similar) {\n      getRtcInstanceWithError(editor).formatter.remove(name, vars, node, similar);\n    };\n    var toggleFormat = function (editor, name, vars, node) {\n      getRtcInstanceWithError(editor).formatter.toggle(name, vars, node);\n    };\n    var formatChanged = function (editor, registeredFormatListeners, formats, callback, similar, vars) {\n      return getRtcInstanceWithError(editor).formatter.formatChanged(registeredFormatListeners, formats, callback, similar, vars);\n    };\n    var getContent$2 = function (editor, args, format) {\n      return getRtcInstanceWithFallback(editor).editor.getContent(args, format);\n    };\n    var setContent$2 = function (editor, content, args) {\n      return getRtcInstanceWithFallback(editor).editor.setContent(content, args);\n    };\n    var insertContent = function (editor, value, details) {\n      return getRtcInstanceWithFallback(editor).editor.insertContent(value, details);\n    };\n    var getSelectedContent = function (editor, format, args) {\n      return getRtcInstanceWithError(editor).selection.getContent(format, args);\n    };\n    var addVisual$1 = function (editor, elm) {\n      return getRtcInstanceWithError(editor).editor.addVisual(elm);\n    };\n\n    var getContent$1 = function (editor, args) {\n      if (args === void 0) {\n        args = {};\n      }\n      var format = args.format ? args.format : 'html';\n      return getSelectedContent(editor, format, args);\n    };\n\n    var removeEmpty = function (text) {\n      if (text.dom.length === 0) {\n        remove$7(text);\n        return Optional.none();\n      } else {\n        return Optional.some(text);\n      }\n    };\n    var walkPastBookmark = function (node, start) {\n      return node.filter(function (elm) {\n        return BookmarkManager.isBookmarkNode(elm.dom);\n      }).bind(start ? nextSibling : prevSibling);\n    };\n    var merge = function (outer, inner, rng, start) {\n      var outerElm = outer.dom;\n      var innerElm = inner.dom;\n      var oldLength = start ? outerElm.length : innerElm.length;\n      if (start) {\n        mergeTextNodes(outerElm, innerElm, false, !start);\n        rng.setStart(innerElm, oldLength);\n      } else {\n        mergeTextNodes(innerElm, outerElm, false, !start);\n        rng.setEnd(innerElm, oldLength);\n      }\n    };\n    var normalizeTextIfRequired = function (inner, start) {\n      parent(inner).each(function (root) {\n        var text = inner.dom;\n        if (start && needsToBeNbspLeft(root, CaretPosition(text, 0))) {\n          normalizeWhitespaceAfter(text, 0);\n        } else if (!start && needsToBeNbspRight(root, CaretPosition(text, text.length))) {\n          normalizeWhitespaceBefore(text, text.length);\n        }\n      });\n    };\n    var mergeAndNormalizeText = function (outerNode, innerNode, rng, start) {\n      outerNode.bind(function (outer) {\n        var normalizer = start ? normalizeWhitespaceBefore : normalizeWhitespaceAfter;\n        normalizer(outer.dom, start ? outer.dom.length : 0);\n        return innerNode.filter(isText$8).map(function (inner) {\n          return merge(outer, inner, rng, start);\n        });\n      }).orThunk(function () {\n        var innerTextNode = walkPastBookmark(innerNode, start).or(innerNode).filter(isText$8);\n        return innerTextNode.map(function (inner) {\n          return normalizeTextIfRequired(inner, start);\n        });\n      });\n    };\n    var rngSetContent = function (rng, fragment) {\n      var firstChild = Optional.from(fragment.firstChild).map(SugarElement.fromDom);\n      var lastChild = Optional.from(fragment.lastChild).map(SugarElement.fromDom);\n      rng.deleteContents();\n      rng.insertNode(fragment);\n      var prevText = firstChild.bind(prevSibling).filter(isText$8).bind(removeEmpty);\n      var nextText = lastChild.bind(nextSibling).filter(isText$8).bind(removeEmpty);\n      mergeAndNormalizeText(prevText, firstChild, rng, true);\n      mergeAndNormalizeText(nextText, lastChild, rng, false);\n      rng.collapse(false);\n    };\n    var setupArgs = function (args, content) {\n      return __assign(__assign({ format: 'html' }, args), {\n        set: true,\n        selection: true,\n        content: content\n      });\n    };\n    var cleanContent = function (editor, args) {\n      if (args.format !== 'raw') {\n        var rng = editor.selection.getRng();\n        var contextBlock = editor.dom.getParent(rng.commonAncestorContainer, editor.dom.isBlock);\n        var contextArgs = contextBlock ? { context: contextBlock.nodeName.toLowerCase() } : {};\n        var node = editor.parser.parse(args.content, __assign(__assign({\n          isRootContent: true,\n          forced_root_block: false\n        }, contextArgs), args));\n        return HtmlSerializer({ validate: editor.validate }, editor.schema).serialize(node);\n      } else {\n        return args.content;\n      }\n    };\n    var setContent$1 = function (editor, content, args) {\n      if (args === void 0) {\n        args = {};\n      }\n      var defaultedArgs = setupArgs(args, content);\n      var updatedArgs = defaultedArgs;\n      if (!defaultedArgs.no_events) {\n        var eventArgs = editor.fire('BeforeSetContent', defaultedArgs);\n        if (eventArgs.isDefaultPrevented()) {\n          editor.fire('SetContent', eventArgs);\n          return;\n        } else {\n          updatedArgs = eventArgs;\n        }\n      }\n      updatedArgs.content = cleanContent(editor, updatedArgs);\n      var rng = editor.selection.getRng();\n      rngSetContent(rng, rng.createContextualFragment(updatedArgs.content));\n      editor.selection.setRng(rng);\n      scrollRangeIntoView(editor, rng);\n      if (!updatedArgs.no_events) {\n        editor.fire('SetContent', updatedArgs);\n      }\n    };\n\n    var deleteFromCallbackMap = function (callbackMap, selector, callback) {\n      if (callbackMap && has$2(callbackMap, selector)) {\n        var newCallbacks = filter$4(callbackMap[selector], function (cb) {\n          return cb !== callback;\n        });\n        if (newCallbacks.length === 0) {\n          delete callbackMap[selector];\n        } else {\n          callbackMap[selector] = newCallbacks;\n        }\n      }\n    };\n    function SelectorChanged (dom, editor) {\n      var selectorChangedData;\n      var currentSelectors;\n      var findMatchingNode = function (selector, nodes) {\n        return find$3(nodes, function (node) {\n          return dom.is(node, selector);\n        });\n      };\n      var getParents = function (elem) {\n        return dom.getParents(elem, null, dom.getRoot());\n      };\n      return {\n        selectorChangedWithUnbind: function (selector, callback) {\n          if (!selectorChangedData) {\n            selectorChangedData = {};\n            currentSelectors = {};\n            editor.on('NodeChange', function (e) {\n              var node = e.element;\n              var parents = getParents(node);\n              var matchedSelectors = {};\n              Tools.each(selectorChangedData, function (callbacks, selector) {\n                findMatchingNode(selector, parents).each(function (node) {\n                  if (!currentSelectors[selector]) {\n                    each$k(callbacks, function (callback) {\n                      callback(true, {\n                        node: node,\n                        selector: selector,\n                        parents: parents\n                      });\n                    });\n                    currentSelectors[selector] = callbacks;\n                  }\n                  matchedSelectors[selector] = callbacks;\n                });\n              });\n              Tools.each(currentSelectors, function (callbacks, selector) {\n                if (!matchedSelectors[selector]) {\n                  delete currentSelectors[selector];\n                  Tools.each(callbacks, function (callback) {\n                    callback(false, {\n                      node: node,\n                      selector: selector,\n                      parents: parents\n                    });\n                  });\n                }\n              });\n            });\n          }\n          if (!selectorChangedData[selector]) {\n            selectorChangedData[selector] = [];\n          }\n          selectorChangedData[selector].push(callback);\n          findMatchingNode(selector, getParents(editor.selection.getStart())).each(function () {\n            currentSelectors[selector] = selectorChangedData[selector];\n          });\n          return {\n            unbind: function () {\n              deleteFromCallbackMap(selectorChangedData, selector, callback);\n              deleteFromCallbackMap(currentSelectors, selector, callback);\n            }\n          };\n        }\n      };\n    }\n\n    var isNativeIeSelection = function (rng) {\n      return !!rng.select;\n    };\n    var isAttachedToDom = function (node) {\n      return !!(node && node.ownerDocument) && contains$1(SugarElement.fromDom(node.ownerDocument), SugarElement.fromDom(node));\n    };\n    var isValidRange = function (rng) {\n      if (!rng) {\n        return false;\n      } else if (isNativeIeSelection(rng)) {\n        return true;\n      } else {\n        return isAttachedToDom(rng.startContainer) && isAttachedToDom(rng.endContainer);\n      }\n    };\n    var EditorSelection = function (dom, win, serializer, editor) {\n      var selectedRange;\n      var explicitRange;\n      var selectorChangedWithUnbind = SelectorChanged(dom, editor).selectorChangedWithUnbind;\n      var setCursorLocation = function (node, offset) {\n        var rng = dom.createRng();\n        if (isNonNullable(node) && isNonNullable(offset)) {\n          rng.setStart(node, offset);\n          rng.setEnd(node, offset);\n          setRng(rng);\n          collapse(false);\n        } else {\n          moveEndPoint(dom, rng, editor.getBody(), true);\n          setRng(rng);\n        }\n      };\n      var getContent = function (args) {\n        return getContent$1(editor, args);\n      };\n      var setContent = function (content, args) {\n        return setContent$1(editor, content, args);\n      };\n      var getStart$1 = function (real) {\n        return getStart(editor.getBody(), getRng$1(), real);\n      };\n      var getEnd$1 = function (real) {\n        return getEnd(editor.getBody(), getRng$1(), real);\n      };\n      var getBookmark = function (type, normalized) {\n        return bookmarkManager.getBookmark(type, normalized);\n      };\n      var moveToBookmark = function (bookmark) {\n        return bookmarkManager.moveToBookmark(bookmark);\n      };\n      var select$1 = function (node, content) {\n        select(dom, node, content).each(setRng);\n        return node;\n      };\n      var isCollapsed = function () {\n        var rng = getRng$1(), sel = getSel();\n        if (!rng || rng.item) {\n          return false;\n        }\n        if (rng.compareEndPoints) {\n          return rng.compareEndPoints('StartToEnd', rng) === 0;\n        }\n        return !sel || rng.collapsed;\n      };\n      var collapse = function (toStart) {\n        var rng = getRng$1();\n        rng.collapse(!!toStart);\n        setRng(rng);\n      };\n      var getSel = function () {\n        return win.getSelection ? win.getSelection() : win.document.selection;\n      };\n      var getRng$1 = function () {\n        var selection, rng, elm;\n        var tryCompareBoundaryPoints = function (how, sourceRange, destinationRange) {\n          try {\n            return sourceRange.compareBoundaryPoints(how, destinationRange);\n          } catch (ex) {\n            return -1;\n          }\n        };\n        var doc = win.document;\n        if (editor.bookmark !== undefined && hasFocus(editor) === false) {\n          var bookmark = getRng(editor);\n          if (bookmark.isSome()) {\n            return bookmark.map(function (r) {\n              return processRanges(editor, [r])[0];\n            }).getOr(doc.createRange());\n          }\n        }\n        try {\n          if ((selection = getSel()) && !isRestrictedNode(selection.anchorNode)) {\n            if (selection.rangeCount > 0) {\n              rng = selection.getRangeAt(0);\n            } else {\n              rng = selection.createRange ? selection.createRange() : doc.createRange();\n            }\n            rng = processRanges(editor, [rng])[0];\n          }\n        } catch (ex) {\n        }\n        if (!rng) {\n          rng = doc.createRange ? doc.createRange() : doc.body.createTextRange();\n        }\n        if (rng.setStart && rng.startContainer.nodeType === 9 && rng.collapsed) {\n          elm = dom.getRoot();\n          rng.setStart(elm, 0);\n          rng.setEnd(elm, 0);\n        }\n        if (selectedRange && explicitRange) {\n          if (tryCompareBoundaryPoints(rng.START_TO_START, rng, selectedRange) === 0 && tryCompareBoundaryPoints(rng.END_TO_END, rng, selectedRange) === 0) {\n            rng = explicitRange;\n          } else {\n            selectedRange = null;\n            explicitRange = null;\n          }\n        }\n        return rng;\n      };\n      var setRng = function (rng, forward) {\n        var node;\n        if (!isValidRange(rng)) {\n          return;\n        }\n        var ieRange = isNativeIeSelection(rng) ? rng : null;\n        if (ieRange) {\n          explicitRange = null;\n          try {\n            ieRange.select();\n          } catch (ex) {\n          }\n          return;\n        }\n        var sel = getSel();\n        var evt = editor.fire('SetSelectionRange', {\n          range: rng,\n          forward: forward\n        });\n        rng = evt.range;\n        if (sel) {\n          explicitRange = rng;\n          try {\n            sel.removeAllRanges();\n            sel.addRange(rng);\n          } catch (ex) {\n          }\n          if (forward === false && sel.extend) {\n            sel.collapse(rng.endContainer, rng.endOffset);\n            sel.extend(rng.startContainer, rng.startOffset);\n          }\n          selectedRange = sel.rangeCount > 0 ? sel.getRangeAt(0) : null;\n        }\n        if (!rng.collapsed && rng.startContainer === rng.endContainer && sel.setBaseAndExtent && !Env.ie) {\n          if (rng.endOffset - rng.startOffset < 2) {\n            if (rng.startContainer.hasChildNodes()) {\n              node = rng.startContainer.childNodes[rng.startOffset];\n              if (node && node.tagName === 'IMG') {\n                sel.setBaseAndExtent(rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset);\n                if (sel.anchorNode !== rng.startContainer || sel.focusNode !== rng.endContainer) {\n                  sel.setBaseAndExtent(node, 0, node, 1);\n                }\n              }\n            }\n          }\n        }\n        editor.fire('AfterSetSelectionRange', {\n          range: rng,\n          forward: forward\n        });\n      };\n      var setNode = function (elm) {\n        setContent(dom.getOuterHTML(elm));\n        return elm;\n      };\n      var getNode$1 = function () {\n        return getNode(editor.getBody(), getRng$1());\n      };\n      var getSelectedBlocks$1 = function (startElm, endElm) {\n        return getSelectedBlocks(dom, getRng$1(), startElm, endElm);\n      };\n      var isForward = function () {\n        var sel = getSel();\n        var anchorNode = sel === null || sel === void 0 ? void 0 : sel.anchorNode;\n        var focusNode = sel === null || sel === void 0 ? void 0 : sel.focusNode;\n        if (!sel || !anchorNode || !focusNode || isRestrictedNode(anchorNode) || isRestrictedNode(focusNode)) {\n          return true;\n        }\n        var anchorRange = dom.createRng();\n        anchorRange.setStart(anchorNode, sel.anchorOffset);\n        anchorRange.collapse(true);\n        var focusRange = dom.createRng();\n        focusRange.setStart(focusNode, sel.focusOffset);\n        focusRange.collapse(true);\n        return anchorRange.compareBoundaryPoints(anchorRange.START_TO_START, focusRange) <= 0;\n      };\n      var normalize = function () {\n        var rng = getRng$1();\n        var sel = getSel();\n        if (!hasMultipleRanges(sel) && hasAnyRanges(editor)) {\n          var normRng = normalize$2(dom, rng);\n          normRng.each(function (normRng) {\n            setRng(normRng, isForward());\n          });\n          return normRng.getOr(rng);\n        }\n        return rng;\n      };\n      var selectorChanged = function (selector, callback) {\n        selectorChangedWithUnbind(selector, callback);\n        return exports;\n      };\n      var getScrollContainer = function () {\n        var scrollContainer;\n        var node = dom.getRoot();\n        while (node && node.nodeName !== 'BODY') {\n          if (node.scrollHeight > node.clientHeight) {\n            scrollContainer = node;\n            break;\n          }\n          node = node.parentNode;\n        }\n        return scrollContainer;\n      };\n      var scrollIntoView = function (elm, alignToTop) {\n        if (isNonNullable(elm)) {\n          scrollElementIntoView(editor, elm, alignToTop);\n        } else {\n          scrollRangeIntoView(editor, getRng$1(), alignToTop);\n        }\n      };\n      var placeCaretAt = function (clientX, clientY) {\n        return setRng(fromPoint(clientX, clientY, editor.getDoc()));\n      };\n      var getBoundingClientRect = function () {\n        var rng = getRng$1();\n        return rng.collapsed ? CaretPosition.fromRangeStart(rng).getClientRects()[0] : rng.getBoundingClientRect();\n      };\n      var destroy = function () {\n        win = selectedRange = explicitRange = null;\n        controlSelection.destroy();\n      };\n      var exports = {\n        bookmarkManager: null,\n        controlSelection: null,\n        dom: dom,\n        win: win,\n        serializer: serializer,\n        editor: editor,\n        collapse: collapse,\n        setCursorLocation: setCursorLocation,\n        getContent: getContent,\n        setContent: setContent,\n        getBookmark: getBookmark,\n        moveToBookmark: moveToBookmark,\n        select: select$1,\n        isCollapsed: isCollapsed,\n        isForward: isForward,\n        setNode: setNode,\n        getNode: getNode$1,\n        getSel: getSel,\n        setRng: setRng,\n        getRng: getRng$1,\n        getStart: getStart$1,\n        getEnd: getEnd$1,\n        getSelectedBlocks: getSelectedBlocks$1,\n        normalize: normalize,\n        selectorChanged: selectorChanged,\n        selectorChangedWithUnbind: selectorChangedWithUnbind,\n        getScrollContainer: getScrollContainer,\n        scrollIntoView: scrollIntoView,\n        placeCaretAt: placeCaretAt,\n        getBoundingClientRect: getBoundingClientRect,\n        destroy: destroy\n      };\n      var bookmarkManager = BookmarkManager(exports);\n      var controlSelection = ControlSelection(exports, editor);\n      exports.bookmarkManager = bookmarkManager;\n      exports.controlSelection = controlSelection;\n      return exports;\n    };\n\n    var removeAttrs = function (node, names) {\n      each$k(names, function (name) {\n        node.attr(name, null);\n      });\n    };\n    var addFontToSpansFilter = function (domParser, styles, fontSizes) {\n      domParser.addNodeFilter('font', function (nodes) {\n        each$k(nodes, function (node) {\n          var props = styles.parse(node.attr('style'));\n          var color = node.attr('color');\n          var face = node.attr('face');\n          var size = node.attr('size');\n          if (color) {\n            props.color = color;\n          }\n          if (face) {\n            props['font-family'] = face;\n          }\n          if (size) {\n            props['font-size'] = fontSizes[parseInt(node.attr('size'), 10) - 1];\n          }\n          node.name = 'span';\n          node.attr('style', styles.serialize(props));\n          removeAttrs(node, [\n            'color',\n            'face',\n            'size'\n          ]);\n        });\n      });\n    };\n    var addStrikeToSpanFilter = function (domParser, styles) {\n      domParser.addNodeFilter('strike', function (nodes) {\n        each$k(nodes, function (node) {\n          var props = styles.parse(node.attr('style'));\n          props['text-decoration'] = 'line-through';\n          node.name = 'span';\n          node.attr('style', styles.serialize(props));\n        });\n      });\n    };\n    var addFilters = function (domParser, settings) {\n      var styles = Styles();\n      if (settings.convert_fonts_to_spans) {\n        addFontToSpansFilter(domParser, styles, Tools.explode(settings.font_size_legacy_values));\n      }\n      addStrikeToSpanFilter(domParser, styles);\n    };\n    var register$2 = function (domParser, settings) {\n      if (settings.inline_styles) {\n        addFilters(domParser, settings);\n      }\n    };\n\n    var blobUriToBlob = function (url) {\n      return new promiseObj(function (resolve, reject) {\n        var rejectWithError = function () {\n          reject('Cannot convert ' + url + ' to Blob. Resource might not exist or is inaccessible.');\n        };\n        try {\n          var xhr_1 = new XMLHttpRequest();\n          xhr_1.open('GET', url, true);\n          xhr_1.responseType = 'blob';\n          xhr_1.onload = function () {\n            if (xhr_1.status === 200) {\n              resolve(xhr_1.response);\n            } else {\n              rejectWithError();\n            }\n          };\n          xhr_1.onerror = rejectWithError;\n          xhr_1.send();\n        } catch (ex) {\n          rejectWithError();\n        }\n      });\n    };\n    var parseDataUri$1 = function (uri) {\n      var type;\n      var uriParts = decodeURIComponent(uri).split(',');\n      var matches = /data:([^;]+)/.exec(uriParts[0]);\n      if (matches) {\n        type = matches[1];\n      }\n      return {\n        type: type,\n        data: uriParts[1]\n      };\n    };\n    var buildBlob = function (type, data) {\n      var str;\n      try {\n        str = atob(data);\n      } catch (e) {\n        return Optional.none();\n      }\n      var arr = new Uint8Array(str.length);\n      for (var i = 0; i < arr.length; i++) {\n        arr[i] = str.charCodeAt(i);\n      }\n      return Optional.some(new Blob([arr], { type: type }));\n    };\n    var dataUriToBlob = function (uri) {\n      return new promiseObj(function (resolve) {\n        var _a = parseDataUri$1(uri), type = _a.type, data = _a.data;\n        buildBlob(type, data).fold(function () {\n          return resolve(new Blob([]));\n        }, resolve);\n      });\n    };\n    var uriToBlob = function (url) {\n      if (url.indexOf('blob:') === 0) {\n        return blobUriToBlob(url);\n      }\n      if (url.indexOf('data:') === 0) {\n        return dataUriToBlob(url);\n      }\n      return null;\n    };\n    var blobToDataUri = function (blob) {\n      return new promiseObj(function (resolve) {\n        var reader = new FileReader();\n        reader.onloadend = function () {\n          resolve(reader.result);\n        };\n        reader.readAsDataURL(blob);\n      });\n    };\n\n    var count$1 = 0;\n    var uniqueId = function (prefix) {\n      return (prefix || 'blobid') + count$1++;\n    };\n    var imageToBlobInfo = function (blobCache, img, resolve, reject) {\n      var base64, blobInfo;\n      if (img.src.indexOf('blob:') === 0) {\n        blobInfo = blobCache.getByUri(img.src);\n        if (blobInfo) {\n          resolve({\n            image: img,\n            blobInfo: blobInfo\n          });\n        } else {\n          uriToBlob(img.src).then(function (blob) {\n            blobToDataUri(blob).then(function (dataUri) {\n              base64 = parseDataUri$1(dataUri).data;\n              blobInfo = blobCache.create(uniqueId(), blob, base64);\n              blobCache.add(blobInfo);\n              resolve({\n                image: img,\n                blobInfo: blobInfo\n              });\n            });\n          }, function (err) {\n            reject(err);\n          });\n        }\n        return;\n      }\n      var _a = parseDataUri$1(img.src), data = _a.data, type = _a.type;\n      base64 = data;\n      blobInfo = blobCache.getByData(base64, type);\n      if (blobInfo) {\n        resolve({\n          image: img,\n          blobInfo: blobInfo\n        });\n      } else {\n        uriToBlob(img.src).then(function (blob) {\n          blobInfo = blobCache.create(uniqueId(), blob, base64);\n          blobCache.add(blobInfo);\n          resolve({\n            image: img,\n            blobInfo: blobInfo\n          });\n        }, function (err) {\n          reject(err);\n        });\n      }\n    };\n    var getAllImages = function (elm) {\n      return elm ? from(elm.getElementsByTagName('img')) : [];\n    };\n    var ImageScanner = function (uploadStatus, blobCache) {\n      var cachedPromises = {};\n      var findAll = function (elm, predicate) {\n        if (!predicate) {\n          predicate = always;\n        }\n        var images = filter$4(getAllImages(elm), function (img) {\n          var src = img.src;\n          if (!Env.fileApi) {\n            return false;\n          }\n          if (img.hasAttribute('data-mce-bogus')) {\n            return false;\n          }\n          if (img.hasAttribute('data-mce-placeholder')) {\n            return false;\n          }\n          if (!src || src === Env.transparentSrc) {\n            return false;\n          }\n          if (src.indexOf('blob:') === 0) {\n            return !uploadStatus.isUploaded(src) && predicate(img);\n          }\n          if (src.indexOf('data:') === 0) {\n            return predicate(img);\n          }\n          return false;\n        });\n        var promises = map$3(images, function (img) {\n          if (cachedPromises[img.src] !== undefined) {\n            return new promiseObj(function (resolve) {\n              cachedPromises[img.src].then(function (imageInfo) {\n                if (typeof imageInfo === 'string') {\n                  return imageInfo;\n                }\n                resolve({\n                  image: img,\n                  blobInfo: imageInfo.blobInfo\n                });\n              });\n            });\n          }\n          var newPromise = new promiseObj(function (resolve, reject) {\n            imageToBlobInfo(blobCache, img, resolve, reject);\n          }).then(function (result) {\n            delete cachedPromises[result.image.src];\n            return result;\n          }).catch(function (error) {\n            delete cachedPromises[img.src];\n            return error;\n          });\n          cachedPromises[img.src] = newPromise;\n          return newPromise;\n        });\n        return promiseObj.all(promises);\n      };\n      return { findAll: findAll };\n    };\n\n    var extractBase64DataUris = function (html) {\n      var dataImageUri = /data:[^;<\"'\\s]+;base64,([a-z0-9\\+\\/=\\s]+)/gi;\n      var chunks = [];\n      var uris = {};\n      var prefix = generate('img');\n      var matches;\n      var index = 0;\n      var count = 0;\n      while (matches = dataImageUri.exec(html)) {\n        var uri = matches[0];\n        var imageId = prefix + '_' + count++;\n        uris[imageId] = uri;\n        if (index < matches.index) {\n          chunks.push(html.substr(index, matches.index - index));\n        }\n        chunks.push(imageId);\n        index = matches.index + uri.length;\n      }\n      var re = new RegExp(prefix + '_[0-9]+', 'g');\n      if (index === 0) {\n        return {\n          prefix: prefix,\n          uris: uris,\n          html: html,\n          re: re\n        };\n      } else {\n        if (index < html.length) {\n          chunks.push(html.substr(index));\n        }\n        return {\n          prefix: prefix,\n          uris: uris,\n          html: chunks.join(''),\n          re: re\n        };\n      }\n    };\n    var restoreDataUris = function (html, result) {\n      return html.replace(result.re, function (imageId) {\n        return get$9(result.uris, imageId).getOr(imageId);\n      });\n    };\n    var parseDataUri = function (uri) {\n      var matches = /data:([^;]+);base64,([a-z0-9\\+\\/=\\s]+)/i.exec(uri);\n      if (matches) {\n        return Optional.some({\n          type: matches[1],\n          data: decodeURIComponent(matches[2])\n        });\n      } else {\n        return Optional.none();\n      }\n    };\n\n    var paddEmptyNode = function (settings, args, blockElements, node) {\n      var brPreferred = settings.padd_empty_with_br || args.insert;\n      if (brPreferred && blockElements[node.name]) {\n        node.empty().append(new AstNode('br', 1)).shortEnded = true;\n      } else {\n        node.empty().append(new AstNode('#text', 3)).value = nbsp;\n      }\n    };\n    var isPaddedWithNbsp = function (node) {\n      return hasOnlyChild(node, '#text') && node.firstChild.value === nbsp;\n    };\n    var hasOnlyChild = function (node, name) {\n      return node && node.firstChild && node.firstChild === node.lastChild && node.firstChild.name === name;\n    };\n    var isPadded = function (schema, node) {\n      var rule = schema.getElementRule(node.name);\n      return rule && rule.paddEmpty;\n    };\n    var isEmpty = function (schema, nonEmptyElements, whitespaceElements, node) {\n      return node.isEmpty(nonEmptyElements, whitespaceElements, function (node) {\n        return isPadded(schema, node);\n      });\n    };\n    var isLineBreakNode = function (node, blockElements) {\n      return node && (has$2(blockElements, node.name) || node.name === 'br');\n    };\n\n    var isBogusImage = function (img) {\n      return isNonNullable(img.attr('data-mce-bogus'));\n    };\n    var isInternalImageSource = function (img) {\n      return img.attr('src') === Env.transparentSrc || isNonNullable(img.attr('data-mce-placeholder'));\n    };\n    var isValidDataImg = function (img, settings) {\n      if (settings.images_dataimg_filter) {\n        var imgElem_1 = new Image();\n        imgElem_1.src = img.attr('src');\n        each$j(img.attributes.map, function (value, key) {\n          imgElem_1.setAttribute(key, value);\n        });\n        return settings.images_dataimg_filter(imgElem_1);\n      } else {\n        return true;\n      }\n    };\n    var registerBase64ImageFilter = function (parser, settings) {\n      var blobCache = settings.blob_cache;\n      var processImage = function (img) {\n        var inputSrc = img.attr('src');\n        if (isInternalImageSource(img) || isBogusImage(img)) {\n          return;\n        }\n        parseDataUri(inputSrc).filter(function () {\n          return isValidDataImg(img, settings);\n        }).bind(function (_a) {\n          var type = _a.type, data = _a.data;\n          return Optional.from(blobCache.getByData(data, type)).orThunk(function () {\n            return buildBlob(type, data).map(function (blob) {\n              var blobInfo = blobCache.create(uniqueId(), blob, data);\n              blobCache.add(blobInfo);\n              return blobInfo;\n            });\n          });\n        }).each(function (blobInfo) {\n          img.attr('src', blobInfo.blobUri());\n        });\n      };\n      if (blobCache) {\n        parser.addAttributeFilter('src', function (nodes) {\n          return each$k(nodes, processImage);\n        });\n      }\n    };\n    var register$1 = function (parser, settings) {\n      var schema = parser.schema;\n      if (settings.remove_trailing_brs) {\n        parser.addNodeFilter('br', function (nodes, _, args) {\n          var i;\n          var l = nodes.length;\n          var node;\n          var blockElements = Tools.extend({}, schema.getBlockElements());\n          var nonEmptyElements = schema.getNonEmptyElements();\n          var parent, lastParent, prev, prevName;\n          var whiteSpaceElements = schema.getWhiteSpaceElements();\n          var elementRule, textNode;\n          blockElements.body = 1;\n          for (i = 0; i < l; i++) {\n            node = nodes[i];\n            parent = node.parent;\n            if (blockElements[node.parent.name] && node === parent.lastChild) {\n              prev = node.prev;\n              while (prev) {\n                prevName = prev.name;\n                if (prevName !== 'span' || prev.attr('data-mce-type') !== 'bookmark') {\n                  if (prevName === 'br') {\n                    node = null;\n                  }\n                  break;\n                }\n                prev = prev.prev;\n              }\n              if (node) {\n                node.remove();\n                if (isEmpty(schema, nonEmptyElements, whiteSpaceElements, parent)) {\n                  elementRule = schema.getElementRule(parent.name);\n                  if (elementRule) {\n                    if (elementRule.removeEmpty) {\n                      parent.remove();\n                    } else if (elementRule.paddEmpty) {\n                      paddEmptyNode(settings, args, blockElements, parent);\n                    }\n                  }\n                }\n              }\n            } else {\n              lastParent = node;\n              while (parent && parent.firstChild === lastParent && parent.lastChild === lastParent) {\n                lastParent = parent;\n                if (blockElements[parent.name]) {\n                  break;\n                }\n                parent = parent.parent;\n              }\n              if (lastParent === parent && settings.padd_empty_with_br !== true) {\n                textNode = new AstNode('#text', 3);\n                textNode.value = nbsp;\n                node.replace(textNode);\n              }\n            }\n          }\n        });\n      }\n      parser.addAttributeFilter('href', function (nodes) {\n        var i = nodes.length;\n        var appendRel = function (rel) {\n          var parts = rel.split(' ').filter(function (p) {\n            return p.length > 0;\n          });\n          return parts.concat(['noopener']).sort().join(' ');\n        };\n        var addNoOpener = function (rel) {\n          var newRel = rel ? Tools.trim(rel) : '';\n          if (!/\\b(noopener)\\b/g.test(newRel)) {\n            return appendRel(newRel);\n          } else {\n            return newRel;\n          }\n        };\n        if (!settings.allow_unsafe_link_target) {\n          while (i--) {\n            var node = nodes[i];\n            if (node.name === 'a' && node.attr('target') === '_blank') {\n              node.attr('rel', addNoOpener(node.attr('rel')));\n            }\n          }\n        }\n      });\n      if (!settings.allow_html_in_named_anchor) {\n        parser.addAttributeFilter('id,name', function (nodes) {\n          var i = nodes.length, sibling, prevSibling, parent, node;\n          while (i--) {\n            node = nodes[i];\n            if (node.name === 'a' && node.firstChild && !node.attr('href')) {\n              parent = node.parent;\n              sibling = node.lastChild;\n              do {\n                prevSibling = sibling.prev;\n                parent.insert(sibling, node);\n                sibling = prevSibling;\n              } while (sibling);\n            }\n          }\n        });\n      }\n      if (settings.fix_list_elements) {\n        parser.addNodeFilter('ul,ol', function (nodes) {\n          var i = nodes.length, node, parentNode;\n          while (i--) {\n            node = nodes[i];\n            parentNode = node.parent;\n            if (parentNode.name === 'ul' || parentNode.name === 'ol') {\n              if (node.prev && node.prev.name === 'li') {\n                node.prev.append(node);\n              } else {\n                var li = new AstNode('li', 1);\n                li.attr('style', 'list-style-type: none');\n                node.wrap(li);\n              }\n            }\n          }\n        });\n      }\n      if (settings.validate && schema.getValidClasses()) {\n        parser.addAttributeFilter('class', function (nodes) {\n          var validClasses = schema.getValidClasses();\n          var i = nodes.length;\n          while (i--) {\n            var node = nodes[i];\n            var classList = node.attr('class').split(' ');\n            var classValue = '';\n            for (var ci = 0; ci < classList.length; ci++) {\n              var className = classList[ci];\n              var valid = false;\n              var validClassesMap = validClasses['*'];\n              if (validClassesMap && validClassesMap[className]) {\n                valid = true;\n              }\n              validClassesMap = validClasses[node.name];\n              if (!valid && validClassesMap && validClassesMap[className]) {\n                valid = true;\n              }\n              if (valid) {\n                if (classValue) {\n                  classValue += ' ';\n                }\n                classValue += className;\n              }\n            }\n            if (!classValue.length) {\n              classValue = null;\n            }\n            node.attr('class', classValue);\n          }\n        });\n      }\n      registerBase64ImageFilter(parser, settings);\n    };\n\n    var each$7 = Tools.each, trim = Tools.trim;\n    var queryParts = 'source protocol authority userInfo user password host port relative path directory file query anchor'.split(' ');\n    var DEFAULT_PORTS = {\n      ftp: 21,\n      http: 80,\n      https: 443,\n      mailto: 25\n    };\n    var safeSvgDataUrlElements = [\n      'img',\n      'video'\n    ];\n    var blockSvgDataUris = function (allowSvgDataUrls, tagName) {\n      if (isNonNullable(allowSvgDataUrls)) {\n        return !allowSvgDataUrls;\n      } else {\n        return isNonNullable(tagName) ? !contains$3(safeSvgDataUrlElements, tagName) : true;\n      }\n    };\n    var isInvalidUri = function (settings, uri, tagName) {\n      if (settings.allow_html_data_urls) {\n        return false;\n      } else if (/^data:image\\//i.test(uri)) {\n        return blockSvgDataUris(settings.allow_svg_data_urls, tagName) && /^data:image\\/svg\\+xml/i.test(uri);\n      } else {\n        return /^data:/i.test(uri);\n      }\n    };\n    var URI = function () {\n      function URI(url, settings) {\n        url = trim(url);\n        this.settings = settings || {};\n        var baseUri = this.settings.base_uri;\n        var self = this;\n        if (/^([\\w\\-]+):([^\\/]{2})/i.test(url) || /^\\s*#/.test(url)) {\n          self.source = url;\n          return;\n        }\n        var isProtocolRelative = url.indexOf('//') === 0;\n        if (url.indexOf('/') === 0 && !isProtocolRelative) {\n          url = (baseUri ? baseUri.protocol || 'http' : 'http') + '://mce_host' + url;\n        }\n        if (!/^[\\w\\-]*:?\\/\\//.test(url)) {\n          var baseUrl = this.settings.base_uri ? this.settings.base_uri.path : new URI(document.location.href).directory;\n          if (this.settings.base_uri && this.settings.base_uri.protocol == '') {\n            url = '//mce_host' + self.toAbsPath(baseUrl, url);\n          } else {\n            var match = /([^#?]*)([#?]?.*)/.exec(url);\n            url = (baseUri && baseUri.protocol || 'http') + '://mce_host' + self.toAbsPath(baseUrl, match[1]) + match[2];\n          }\n        }\n        url = url.replace(/@@/g, '(mce_at)');\n        var urlMatch = /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@\\/]*):?([^:@\\/]*))?@)?(\\[[a-zA-Z0-9:.%]+\\]|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/.exec(url);\n        each$7(queryParts, function (v, i) {\n          var part = urlMatch[i];\n          if (part) {\n            part = part.replace(/\\(mce_at\\)/g, '@@');\n          }\n          self[v] = part;\n        });\n        if (baseUri) {\n          if (!self.protocol) {\n            self.protocol = baseUri.protocol;\n          }\n          if (!self.userInfo) {\n            self.userInfo = baseUri.userInfo;\n          }\n          if (!self.port && self.host === 'mce_host') {\n            self.port = baseUri.port;\n          }\n          if (!self.host || self.host === 'mce_host') {\n            self.host = baseUri.host;\n          }\n          self.source = '';\n        }\n        if (isProtocolRelative) {\n          self.protocol = '';\n        }\n      }\n      URI.parseDataUri = function (uri) {\n        var type;\n        var uriComponents = decodeURIComponent(uri).split(',');\n        var matches = /data:([^;]+)/.exec(uriComponents[0]);\n        if (matches) {\n          type = matches[1];\n        }\n        return {\n          type: type,\n          data: uriComponents[1]\n        };\n      };\n      URI.isDomSafe = function (uri, context, options) {\n        if (options === void 0) {\n          options = {};\n        }\n        if (options.allow_script_urls) {\n          return true;\n        } else {\n          var decodedUri = Entities.decode(uri).replace(/[\\s\\u0000-\\u001F]+/g, '');\n          try {\n            decodedUri = decodeURIComponent(decodedUri);\n          } catch (ex) {\n            decodedUri = unescape(decodedUri);\n          }\n          if (/((java|vb)script|mhtml):/i.test(decodedUri)) {\n            return false;\n          }\n          return !isInvalidUri(options, decodedUri, context);\n        }\n      };\n      URI.getDocumentBaseUrl = function (loc) {\n        var baseUrl;\n        if (loc.protocol.indexOf('http') !== 0 && loc.protocol !== 'file:') {\n          baseUrl = loc.href;\n        } else {\n          baseUrl = loc.protocol + '//' + loc.host + loc.pathname;\n        }\n        if (/^[^:]+:\\/\\/\\/?[^\\/]+\\//.test(baseUrl)) {\n          baseUrl = baseUrl.replace(/[\\?#].*$/, '').replace(/[\\/\\\\][^\\/]+$/, '');\n          if (!/[\\/\\\\]$/.test(baseUrl)) {\n            baseUrl += '/';\n          }\n        }\n        return baseUrl;\n      };\n      URI.prototype.setPath = function (path) {\n        var pathMatch = /^(.*?)\\/?(\\w+)?$/.exec(path);\n        this.path = pathMatch[0];\n        this.directory = pathMatch[1];\n        this.file = pathMatch[2];\n        this.source = '';\n        this.getURI();\n      };\n      URI.prototype.toRelative = function (uri) {\n        var output;\n        if (uri === './') {\n          return uri;\n        }\n        var relativeUri = new URI(uri, { base_uri: this });\n        if (relativeUri.host !== 'mce_host' && this.host !== relativeUri.host && relativeUri.host || this.port !== relativeUri.port || this.protocol !== relativeUri.protocol && relativeUri.protocol !== '') {\n          return relativeUri.getURI();\n        }\n        var tu = this.getURI(), uu = relativeUri.getURI();\n        if (tu === uu || tu.charAt(tu.length - 1) === '/' && tu.substr(0, tu.length - 1) === uu) {\n          return tu;\n        }\n        output = this.toRelPath(this.path, relativeUri.path);\n        if (relativeUri.query) {\n          output += '?' + relativeUri.query;\n        }\n        if (relativeUri.anchor) {\n          output += '#' + relativeUri.anchor;\n        }\n        return output;\n      };\n      URI.prototype.toAbsolute = function (uri, noHost) {\n        var absoluteUri = new URI(uri, { base_uri: this });\n        return absoluteUri.getURI(noHost && this.isSameOrigin(absoluteUri));\n      };\n      URI.prototype.isSameOrigin = function (uri) {\n        if (this.host == uri.host && this.protocol == uri.protocol) {\n          if (this.port == uri.port) {\n            return true;\n          }\n          var defaultPort = DEFAULT_PORTS[this.protocol];\n          if (defaultPort && (this.port || defaultPort) == (uri.port || defaultPort)) {\n            return true;\n          }\n        }\n        return false;\n      };\n      URI.prototype.toRelPath = function (base, path) {\n        var breakPoint = 0, out = '', i, l;\n        var normalizedBase = base.substring(0, base.lastIndexOf('/')).split('/');\n        var items = path.split('/');\n        if (normalizedBase.length >= items.length) {\n          for (i = 0, l = normalizedBase.length; i < l; i++) {\n            if (i >= items.length || normalizedBase[i] !== items[i]) {\n              breakPoint = i + 1;\n              break;\n            }\n          }\n        }\n        if (normalizedBase.length < items.length) {\n          for (i = 0, l = items.length; i < l; i++) {\n            if (i >= normalizedBase.length || normalizedBase[i] !== items[i]) {\n              breakPoint = i + 1;\n              break;\n            }\n          }\n        }\n        if (breakPoint === 1) {\n          return path;\n        }\n        for (i = 0, l = normalizedBase.length - (breakPoint - 1); i < l; i++) {\n          out += '../';\n        }\n        for (i = breakPoint - 1, l = items.length; i < l; i++) {\n          if (i !== breakPoint - 1) {\n            out += '/' + items[i];\n          } else {\n            out += items[i];\n          }\n        }\n        return out;\n      };\n      URI.prototype.toAbsPath = function (base, path) {\n        var i, nb = 0, o = [], outPath;\n        var tr = /\\/$/.test(path) ? '/' : '';\n        var normalizedBase = base.split('/');\n        var normalizedPath = path.split('/');\n        each$7(normalizedBase, function (k) {\n          if (k) {\n            o.push(k);\n          }\n        });\n        normalizedBase = o;\n        for (i = normalizedPath.length - 1, o = []; i >= 0; i--) {\n          if (normalizedPath[i].length === 0 || normalizedPath[i] === '.') {\n            continue;\n          }\n          if (normalizedPath[i] === '..') {\n            nb++;\n            continue;\n          }\n          if (nb > 0) {\n            nb--;\n            continue;\n          }\n          o.push(normalizedPath[i]);\n        }\n        i = normalizedBase.length - nb;\n        if (i <= 0) {\n          outPath = reverse(o).join('/');\n        } else {\n          outPath = normalizedBase.slice(0, i).join('/') + '/' + reverse(o).join('/');\n        }\n        if (outPath.indexOf('/') !== 0) {\n          outPath = '/' + outPath;\n        }\n        if (tr && outPath.lastIndexOf('/') !== outPath.length - 1) {\n          outPath += tr;\n        }\n        return outPath;\n      };\n      URI.prototype.getURI = function (noProtoHost) {\n        if (noProtoHost === void 0) {\n          noProtoHost = false;\n        }\n        var s;\n        if (!this.source || noProtoHost) {\n          s = '';\n          if (!noProtoHost) {\n            if (this.protocol) {\n              s += this.protocol + '://';\n            } else {\n              s += '//';\n            }\n            if (this.userInfo) {\n              s += this.userInfo + '@';\n            }\n            if (this.host) {\n              s += this.host;\n            }\n            if (this.port) {\n              s += ':' + this.port;\n            }\n          }\n          if (this.path) {\n            s += this.path;\n          }\n          if (this.query) {\n            s += '?' + this.query;\n          }\n          if (this.anchor) {\n            s += '#' + this.anchor;\n          }\n          this.source = s;\n        }\n        return this.source;\n      };\n      return URI;\n    }();\n\n    var filteredClobberElements = Tools.makeMap('button,fieldset,form,iframe,img,image,input,object,output,select,textarea');\n    var isValidPrefixAttrName = function (name) {\n      return name.indexOf('data-') === 0 || name.indexOf('aria-') === 0;\n    };\n    var lazyTempDocument = cached(function () {\n      return document.implementation.createHTMLDocument('parser');\n    });\n    var findMatchingEndTagIndex = function (schema, html, startIndex) {\n      var startTagRegExp = /<([!?\\/])?([A-Za-z0-9\\-_:.]+)/g;\n      var endTagRegExp = /(?:\\s(?:[^'\">]+(?:\"[^\"]*\"|'[^']*'))*[^\"'>]*(?:\"[^\">]*|'[^'>]*)?|\\s*|\\/)>/g;\n      var shortEndedElements = schema.getShortEndedElements();\n      var count = 1, index = startIndex;\n      while (count !== 0) {\n        startTagRegExp.lastIndex = index;\n        while (true) {\n          var startMatch = startTagRegExp.exec(html);\n          if (startMatch === null) {\n            return index;\n          } else if (startMatch[1] === '!') {\n            if (startsWith(startMatch[2], '--')) {\n              index = findCommentEndIndex(html, false, startMatch.index + '!--'.length);\n            } else {\n              index = findCommentEndIndex(html, true, startMatch.index + 1);\n            }\n            break;\n          } else {\n            endTagRegExp.lastIndex = startTagRegExp.lastIndex;\n            var endMatch = endTagRegExp.exec(html);\n            if (isNull(endMatch) || endMatch.index !== startTagRegExp.lastIndex) {\n              continue;\n            }\n            if (startMatch[1] === '/') {\n              count -= 1;\n            } else if (!has$2(shortEndedElements, startMatch[2])) {\n              count += 1;\n            }\n            index = startTagRegExp.lastIndex + endMatch[0].length;\n            break;\n          }\n        }\n      }\n      return index;\n    };\n    var isConditionalComment = function (html, startIndex) {\n      return /^\\s*\\[if [\\w\\W]+\\]>.*<!\\[endif\\](--!?)?>/.test(html.substr(startIndex));\n    };\n    var findCommentEndIndex = function (html, isBogus, startIndex) {\n      if (startIndex === void 0) {\n        startIndex = 0;\n      }\n      var lcHtml = html.toLowerCase();\n      if (lcHtml.indexOf('[if ', startIndex) !== -1 && isConditionalComment(lcHtml, startIndex)) {\n        var endIfIndex = lcHtml.indexOf('[endif]', startIndex);\n        return lcHtml.indexOf('>', endIfIndex);\n      } else {\n        if (isBogus) {\n          var endIndex = lcHtml.indexOf('>', startIndex);\n          return endIndex !== -1 ? endIndex : lcHtml.length;\n        } else {\n          var endCommentRegexp = /--!?>/g;\n          endCommentRegexp.lastIndex = startIndex;\n          var match = endCommentRegexp.exec(html);\n          return match ? match.index + match[0].length : lcHtml.length;\n        }\n      }\n    };\n    var checkBogusAttribute = function (regExp, attrString) {\n      var matches = regExp.exec(attrString);\n      if (matches) {\n        var name_1 = matches[1];\n        var value = matches[2];\n        return typeof name_1 === 'string' && name_1.toLowerCase() === 'data-mce-bogus' ? value : null;\n      } else {\n        return null;\n      }\n    };\n    var SaxParser = function (settings, schema) {\n      if (schema === void 0) {\n        schema = Schema();\n      }\n      settings = settings || {};\n      var doc = lazyTempDocument();\n      var form = doc.createElement('form');\n      if (settings.fix_self_closing !== false) {\n        settings.fix_self_closing = true;\n      }\n      var comment = settings.comment ? settings.comment : noop;\n      var cdata = settings.cdata ? settings.cdata : noop;\n      var text = settings.text ? settings.text : noop;\n      var start = settings.start ? settings.start : noop;\n      var end = settings.end ? settings.end : noop;\n      var pi = settings.pi ? settings.pi : noop;\n      var doctype = settings.doctype ? settings.doctype : noop;\n      var parseInternal = function (base64Extract, format) {\n        if (format === void 0) {\n          format = 'html';\n        }\n        var html = base64Extract.html;\n        var matches, index = 0, value, endRegExp;\n        var stack = [];\n        var attrList, i, textData, name;\n        var isInternalElement, isShortEnded;\n        var elementRule, isValidElement, attr, attribsValue, validAttributesMap, validAttributePatterns;\n        var attributesRequired, attributesDefault, attributesForced;\n        var anyAttributesRequired, attrValue, idCount = 0;\n        var decode = Entities.decode;\n        var filteredUrlAttrs = Tools.makeMap('src,href,data,background,action,formaction,poster,xlink:href');\n        var parsingMode = format === 'html' ? 0 : 1;\n        var processEndTag = function (name) {\n          var pos, i;\n          pos = stack.length;\n          while (pos--) {\n            if (stack[pos].name === name) {\n              break;\n            }\n          }\n          if (pos >= 0) {\n            for (i = stack.length - 1; i >= pos; i--) {\n              name = stack[i];\n              if (name.valid) {\n                end(name.name);\n              }\n            }\n            stack.length = pos;\n          }\n        };\n        var processText = function (value, raw) {\n          return text(restoreDataUris(value, base64Extract), raw);\n        };\n        var processComment = function (value) {\n          if (value === '') {\n            return;\n          }\n          if (value.charAt(0) === '>') {\n            value = ' ' + value;\n          }\n          if (!settings.allow_conditional_comments && value.substr(0, 3).toLowerCase() === '[if') {\n            value = ' ' + value;\n          }\n          comment(restoreDataUris(value, base64Extract));\n        };\n        var processAttr = function (value) {\n          return restoreDataUris(value, base64Extract);\n        };\n        var processMalformedComment = function (value, startIndex) {\n          var startTag = value || '';\n          var isBogus = !startsWith(startTag, '--');\n          var endIndex = findCommentEndIndex(html, isBogus, startIndex);\n          value = html.substr(startIndex, endIndex - startIndex);\n          processComment(isBogus ? startTag + value : value);\n          return endIndex + 1;\n        };\n        var parseAttribute = function (tagName, name, value, val2, val3) {\n          name = name.toLowerCase();\n          value = processAttr(name in fillAttrsMap ? name : decode(value || val2 || val3 || ''));\n          if (validate && !isInternalElement && isValidPrefixAttrName(name) === false) {\n            var attrRule = validAttributesMap[name];\n            if (!attrRule && validAttributePatterns) {\n              var i_1 = validAttributePatterns.length;\n              while (i_1--) {\n                attrRule = validAttributePatterns[i_1];\n                if (attrRule.pattern.test(name)) {\n                  break;\n                }\n              }\n              if (i_1 === -1) {\n                attrRule = null;\n              }\n            }\n            if (!attrRule) {\n              return;\n            }\n            if (attrRule.validValues && !(value in attrRule.validValues)) {\n              return;\n            }\n          }\n          var isNameOrId = name === 'name' || name === 'id';\n          if (isNameOrId && tagName in filteredClobberElements && (value in doc || value in form)) {\n            return;\n          }\n          if (filteredUrlAttrs[name] && !URI.isDomSafe(value, tagName, settings)) {\n            return;\n          }\n          if (isInternalElement && (name in filteredUrlAttrs || name.indexOf('on') === 0)) {\n            return;\n          }\n          attrList.map[name] = value;\n          attrList.push({\n            name: name,\n            value: value\n          });\n        };\n        var tokenRegExp = new RegExp('<(?:' + '(?:!--([\\\\w\\\\W]*?)--!?>)|' + '(?:!\\\\[CDATA\\\\[([\\\\w\\\\W]*?)\\\\]\\\\]>)|' + '(?:![Dd][Oo][Cc][Tt][Yy][Pp][Ee]([\\\\w\\\\W]*?)>)|' + '(?:!(--)?)|' + '(?:\\\\?([^\\\\s\\\\/<>]+) ?([\\\\w\\\\W]*?)[?/]>)|' + '(?:\\\\/([A-Za-z][A-Za-z0-9\\\\-_\\\\:\\\\.]*)>)|' + '(?:([A-Za-z][A-Za-z0-9\\\\-_:.]*)(\\\\s(?:[^\\'\">]+(?:\"[^\"]*\"|\\'[^\\']*\\'))*[^\"\\'>]*(?:\"[^\">]*|\\'[^\\'>]*)?|\\\\s*|\\\\/)>)' + ')', 'g');\n        var attrRegExp = /([\\w:\\-]+)(?:\\s*=\\s*(?:(?:\\\"((?:[^\\\"])*)\\\")|(?:\\'((?:[^\\'])*)\\')|([^>\\s]+)))?/g;\n        var shortEndedElements = schema.getShortEndedElements();\n        var selfClosing = settings.self_closing_elements || schema.getSelfClosingElements();\n        var fillAttrsMap = schema.getBoolAttrs();\n        var validate = settings.validate;\n        var removeInternalElements = settings.remove_internals;\n        var fixSelfClosing = settings.fix_self_closing;\n        var specialElements = schema.getSpecialElements();\n        var processHtml = html + '>';\n        while (matches = tokenRegExp.exec(processHtml)) {\n          var matchText = matches[0];\n          if (index < matches.index) {\n            processText(decode(html.substr(index, matches.index - index)));\n          }\n          if (value = matches[7]) {\n            value = value.toLowerCase();\n            if (value.charAt(0) === ':') {\n              value = value.substr(1);\n            }\n            processEndTag(value);\n          } else if (value = matches[8]) {\n            if (matches.index + matchText.length > html.length) {\n              processText(decode(html.substr(matches.index)));\n              index = matches.index + matchText.length;\n              continue;\n            }\n            value = value.toLowerCase();\n            if (value.charAt(0) === ':') {\n              value = value.substr(1);\n            }\n            isShortEnded = value in shortEndedElements;\n            if (fixSelfClosing && selfClosing[value] && stack.length > 0 && stack[stack.length - 1].name === value) {\n              processEndTag(value);\n            }\n            var bogusValue = checkBogusAttribute(attrRegExp, matches[9]);\n            if (bogusValue !== null) {\n              if (bogusValue === 'all') {\n                index = findMatchingEndTagIndex(schema, html, tokenRegExp.lastIndex);\n                tokenRegExp.lastIndex = index;\n                continue;\n              }\n              isValidElement = false;\n            }\n            if (!validate || (elementRule = schema.getElementRule(value))) {\n              isValidElement = true;\n              if (validate) {\n                validAttributesMap = elementRule.attributes;\n                validAttributePatterns = elementRule.attributePatterns;\n              }\n              if (attribsValue = matches[9]) {\n                isInternalElement = attribsValue.indexOf('data-mce-type') !== -1;\n                if (isInternalElement && removeInternalElements) {\n                  isValidElement = false;\n                }\n                attrList = [];\n                attrList.map = {};\n                attribsValue.replace(attrRegExp, function (match, name, val, val2, val3) {\n                  parseAttribute(value, name, val, val2, val3);\n                  return '';\n                });\n              } else {\n                attrList = [];\n                attrList.map = {};\n              }\n              if (validate && !isInternalElement) {\n                attributesRequired = elementRule.attributesRequired;\n                attributesDefault = elementRule.attributesDefault;\n                attributesForced = elementRule.attributesForced;\n                anyAttributesRequired = elementRule.removeEmptyAttrs;\n                if (anyAttributesRequired && !attrList.length) {\n                  isValidElement = false;\n                }\n                if (attributesForced) {\n                  i = attributesForced.length;\n                  while (i--) {\n                    attr = attributesForced[i];\n                    name = attr.name;\n                    attrValue = attr.value;\n                    if (attrValue === '{$uid}') {\n                      attrValue = 'mce_' + idCount++;\n                    }\n                    attrList.map[name] = attrValue;\n                    attrList.push({\n                      name: name,\n                      value: attrValue\n                    });\n                  }\n                }\n                if (attributesDefault) {\n                  i = attributesDefault.length;\n                  while (i--) {\n                    attr = attributesDefault[i];\n                    name = attr.name;\n                    if (!(name in attrList.map)) {\n                      attrValue = attr.value;\n                      if (attrValue === '{$uid}') {\n                        attrValue = 'mce_' + idCount++;\n                      }\n                      attrList.map[name] = attrValue;\n                      attrList.push({\n                        name: name,\n                        value: attrValue\n                      });\n                    }\n                  }\n                }\n                if (attributesRequired) {\n                  i = attributesRequired.length;\n                  while (i--) {\n                    if (attributesRequired[i] in attrList.map) {\n                      break;\n                    }\n                  }\n                  if (i === -1) {\n                    isValidElement = false;\n                  }\n                }\n                if (attr = attrList.map['data-mce-bogus']) {\n                  if (attr === 'all') {\n                    index = findMatchingEndTagIndex(schema, html, tokenRegExp.lastIndex);\n                    tokenRegExp.lastIndex = index;\n                    continue;\n                  }\n                  isValidElement = false;\n                }\n              }\n              if (isValidElement) {\n                start(value, attrList, isShortEnded);\n              }\n            } else {\n              isValidElement = false;\n            }\n            if (endRegExp = specialElements[value]) {\n              endRegExp.lastIndex = index = matches.index + matchText.length;\n              if (matches = endRegExp.exec(html)) {\n                if (isValidElement) {\n                  textData = html.substr(index, matches.index - index);\n                }\n                index = matches.index + matches[0].length;\n              } else {\n                textData = html.substr(index);\n                index = html.length;\n              }\n              if (isValidElement) {\n                if (textData.length > 0) {\n                  processText(textData, true);\n                }\n                end(value);\n              }\n              tokenRegExp.lastIndex = index;\n              continue;\n            }\n            if (!isShortEnded) {\n              if (!attribsValue || attribsValue.indexOf('/') !== attribsValue.length - 1) {\n                stack.push({\n                  name: value,\n                  valid: isValidElement\n                });\n              } else if (isValidElement) {\n                end(value);\n              }\n            }\n          } else if (value = matches[1]) {\n            processComment(value);\n          } else if (value = matches[2]) {\n            var isValidCdataSection = parsingMode === 1 || settings.preserve_cdata || stack.length > 0 && schema.isValidChild(stack[stack.length - 1].name, '#cdata');\n            if (isValidCdataSection) {\n              cdata(value);\n            } else {\n              index = processMalformedComment('', matches.index + 2);\n              tokenRegExp.lastIndex = index;\n              continue;\n            }\n          } else if (value = matches[3]) {\n            doctype(value);\n          } else if ((value = matches[4]) || matchText === '<!') {\n            index = processMalformedComment(value, matches.index + matchText.length);\n            tokenRegExp.lastIndex = index;\n            continue;\n          } else if (value = matches[5]) {\n            if (parsingMode === 1) {\n              pi(value, matches[6]);\n            } else {\n              index = processMalformedComment('?', matches.index + 2);\n              tokenRegExp.lastIndex = index;\n              continue;\n            }\n          }\n          index = matches.index + matchText.length;\n        }\n        if (index < html.length) {\n          processText(decode(html.substr(index)));\n        }\n        for (i = stack.length - 1; i >= 0; i--) {\n          value = stack[i];\n          if (value.valid) {\n            end(value.name);\n          }\n        }\n      };\n      var parse = function (html, format) {\n        if (format === void 0) {\n          format = 'html';\n        }\n        parseInternal(extractBase64DataUris(html), format);\n      };\n      return { parse: parse };\n    };\n    SaxParser.findEndTag = findMatchingEndTagIndex;\n\n    var makeMap = Tools.makeMap, each$6 = Tools.each, explode$2 = Tools.explode, extend$4 = Tools.extend;\n    var DomParser = function (settings, schema) {\n      if (schema === void 0) {\n        schema = Schema();\n      }\n      var nodeFilters = {};\n      var attributeFilters = [];\n      var matchedNodes = {};\n      var matchedAttributes = {};\n      settings = settings || {};\n      settings.validate = 'validate' in settings ? settings.validate : true;\n      settings.root_name = settings.root_name || 'body';\n      var fixInvalidChildren = function (nodes) {\n        var nonSplitableElements = makeMap('tr,td,th,tbody,thead,tfoot,table');\n        var nonEmptyElements = schema.getNonEmptyElements();\n        var whitespaceElements = schema.getWhiteSpaceElements();\n        var textBlockElements = schema.getTextBlockElements();\n        var specialElements = schema.getSpecialElements();\n        var removeOrUnwrapInvalidNode = function (node, originalNodeParent) {\n          if (originalNodeParent === void 0) {\n            originalNodeParent = node.parent;\n          }\n          if (specialElements[node.name]) {\n            node.empty().remove();\n          } else {\n            var children = node.children();\n            for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n              var childNode = children_1[_i];\n              if (!schema.isValidChild(originalNodeParent.name, childNode.name)) {\n                removeOrUnwrapInvalidNode(childNode, originalNodeParent);\n              }\n            }\n            node.unwrap();\n          }\n        };\n        for (var ni = 0; ni < nodes.length; ni++) {\n          var node = nodes[ni];\n          var parent_1 = void 0, newParent = void 0, tempNode = void 0;\n          if (!node.parent || node.fixed) {\n            continue;\n          }\n          if (textBlockElements[node.name] && node.parent.name === 'li') {\n            var sibling = node.next;\n            while (sibling) {\n              if (textBlockElements[sibling.name]) {\n                sibling.name = 'li';\n                sibling.fixed = true;\n                node.parent.insert(sibling, node.parent);\n              } else {\n                break;\n              }\n              sibling = sibling.next;\n            }\n            node.unwrap();\n            continue;\n          }\n          var parents = [node];\n          for (parent_1 = node.parent; parent_1 && !schema.isValidChild(parent_1.name, node.name) && !nonSplitableElements[parent_1.name]; parent_1 = parent_1.parent) {\n            parents.push(parent_1);\n          }\n          if (parent_1 && parents.length > 1) {\n            if (schema.isValidChild(parent_1.name, node.name)) {\n              parents.reverse();\n              newParent = filterNode(parents[0].clone());\n              var currentNode = newParent;\n              for (var i = 0; i < parents.length - 1; i++) {\n                if (schema.isValidChild(currentNode.name, parents[i].name)) {\n                  tempNode = filterNode(parents[i].clone());\n                  currentNode.append(tempNode);\n                } else {\n                  tempNode = currentNode;\n                }\n                for (var childNode = parents[i].firstChild; childNode && childNode !== parents[i + 1];) {\n                  var nextNode = childNode.next;\n                  tempNode.append(childNode);\n                  childNode = nextNode;\n                }\n                currentNode = tempNode;\n              }\n              if (!isEmpty(schema, nonEmptyElements, whitespaceElements, newParent)) {\n                parent_1.insert(newParent, parents[0], true);\n                parent_1.insert(node, newParent);\n              } else {\n                parent_1.insert(node, parents[0], true);\n              }\n              parent_1 = parents[0];\n              if (isEmpty(schema, nonEmptyElements, whitespaceElements, parent_1) || hasOnlyChild(parent_1, 'br')) {\n                parent_1.empty().remove();\n              }\n            } else {\n              removeOrUnwrapInvalidNode(node);\n            }\n          } else if (node.parent) {\n            if (node.name === 'li') {\n              var sibling = node.prev;\n              if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) {\n                sibling.append(node);\n                continue;\n              }\n              sibling = node.next;\n              if (sibling && (sibling.name === 'ul' || sibling.name === 'ol')) {\n                sibling.insert(node, sibling.firstChild, true);\n                continue;\n              }\n              node.wrap(filterNode(new AstNode('ul', 1)));\n              continue;\n            }\n            if (schema.isValidChild(node.parent.name, 'div') && schema.isValidChild('div', node.name)) {\n              node.wrap(filterNode(new AstNode('div', 1)));\n            } else {\n              removeOrUnwrapInvalidNode(node);\n            }\n          }\n        }\n      };\n      var filterNode = function (node) {\n        var name = node.name;\n        if (name in nodeFilters) {\n          var list = matchedNodes[name];\n          if (list) {\n            list.push(node);\n          } else {\n            matchedNodes[name] = [node];\n          }\n        }\n        var i = attributeFilters.length;\n        while (i--) {\n          var attrName = attributeFilters[i].name;\n          if (attrName in node.attributes.map) {\n            var list = matchedAttributes[attrName];\n            if (list) {\n              list.push(node);\n            } else {\n              matchedAttributes[attrName] = [node];\n            }\n          }\n        }\n        return node;\n      };\n      var addNodeFilter = function (name, callback) {\n        each$6(explode$2(name), function (name) {\n          var list = nodeFilters[name];\n          if (!list) {\n            nodeFilters[name] = list = [];\n          }\n          list.push(callback);\n        });\n      };\n      var getNodeFilters = function () {\n        var out = [];\n        for (var name_1 in nodeFilters) {\n          if (has$2(nodeFilters, name_1)) {\n            out.push({\n              name: name_1,\n              callbacks: nodeFilters[name_1]\n            });\n          }\n        }\n        return out;\n      };\n      var addAttributeFilter = function (name, callback) {\n        each$6(explode$2(name), function (name) {\n          var i;\n          for (i = 0; i < attributeFilters.length; i++) {\n            if (attributeFilters[i].name === name) {\n              attributeFilters[i].callbacks.push(callback);\n              return;\n            }\n          }\n          attributeFilters.push({\n            name: name,\n            callbacks: [callback]\n          });\n        });\n      };\n      var getAttributeFilters = function () {\n        return [].concat(attributeFilters);\n      };\n      var parse = function (html, args) {\n        var nodes, i, l, fi, fl, list, name;\n        var invalidChildren = [];\n        var node;\n        var getRootBlockName = function (name) {\n          if (name === false) {\n            return '';\n          } else if (name === true) {\n            return 'p';\n          } else {\n            return name;\n          }\n        };\n        args = args || {};\n        matchedNodes = {};\n        matchedAttributes = {};\n        var blockElements = extend$4(makeMap('script,style,head,html,body,title,meta,param'), schema.getBlockElements());\n        var textRootBlockElements = getTextRootBlockElements(schema);\n        var nonEmptyElements = schema.getNonEmptyElements();\n        var children = schema.children;\n        var validate = settings.validate;\n        var forcedRootBlockName = 'forced_root_block' in args ? args.forced_root_block : settings.forced_root_block;\n        var rootBlockName = getRootBlockName(forcedRootBlockName);\n        var whiteSpaceElements = schema.getWhiteSpaceElements();\n        var startWhiteSpaceRegExp = /^[ \\t\\r\\n]+/;\n        var endWhiteSpaceRegExp = /[ \\t\\r\\n]+$/;\n        var allWhiteSpaceRegExp = /[ \\t\\r\\n]+/g;\n        var isAllWhiteSpaceRegExp = /^[ \\t\\r\\n]+$/;\n        var isInWhiteSpacePreservedElement = has$2(whiteSpaceElements, args.context) || has$2(whiteSpaceElements, settings.root_name);\n        var addRootBlocks = function () {\n          var node = rootNode.firstChild, rootBlockNode = null;\n          var trim = function (rootBlock) {\n            if (rootBlock) {\n              node = rootBlock.firstChild;\n              if (node && node.type === 3) {\n                node.value = node.value.replace(startWhiteSpaceRegExp, '');\n              }\n              node = rootBlock.lastChild;\n              if (node && node.type === 3) {\n                node.value = node.value.replace(endWhiteSpaceRegExp, '');\n              }\n            }\n          };\n          if (!schema.isValidChild(rootNode.name, rootBlockName.toLowerCase())) {\n            return;\n          }\n          while (node) {\n            var next = node.next;\n            if (node.type === 3 || node.type === 1 && node.name !== 'p' && !blockElements[node.name] && !node.attr('data-mce-type')) {\n              if (!rootBlockNode) {\n                rootBlockNode = createNode(rootBlockName, 1);\n                rootBlockNode.attr(settings.forced_root_block_attrs);\n                rootNode.insert(rootBlockNode, node);\n                rootBlockNode.append(node);\n              } else {\n                rootBlockNode.append(node);\n              }\n            } else {\n              trim(rootBlockNode);\n              rootBlockNode = null;\n            }\n            node = next;\n          }\n          trim(rootBlockNode);\n        };\n        var createNode = function (name, type) {\n          var node = new AstNode(name, type);\n          var list;\n          if (name in nodeFilters) {\n            list = matchedNodes[name];\n            if (list) {\n              list.push(node);\n            } else {\n              matchedNodes[name] = [node];\n            }\n          }\n          return node;\n        };\n        var removeWhitespaceBefore = function (node) {\n          var blockElements = schema.getBlockElements();\n          for (var textNode = node.prev; textNode && textNode.type === 3;) {\n            var textVal = textNode.value.replace(endWhiteSpaceRegExp, '');\n            if (textVal.length > 0) {\n              textNode.value = textVal;\n              return;\n            }\n            var textNodeNext = textNode.next;\n            if (textNodeNext) {\n              if (textNodeNext.type === 3 && textNodeNext.value.length) {\n                textNode = textNode.prev;\n                continue;\n              }\n              if (!blockElements[textNodeNext.name] && textNodeNext.name !== 'script' && textNodeNext.name !== 'style') {\n                textNode = textNode.prev;\n                continue;\n              }\n            }\n            var sibling = textNode.prev;\n            textNode.remove();\n            textNode = sibling;\n          }\n        };\n        var cloneAndExcludeBlocks = function (input) {\n          var output = {};\n          for (var name_2 in input) {\n            if (name_2 !== 'li' && name_2 !== 'p') {\n              output[name_2] = input[name_2];\n            }\n          }\n          return output;\n        };\n        var isTextRootBlockEmpty = function (node) {\n          var tempNode = node;\n          while (isNonNullable(tempNode)) {\n            if (tempNode.name in textRootBlockElements) {\n              return isEmpty(schema, nonEmptyElements, whiteSpaceElements, tempNode);\n            } else {\n              tempNode = tempNode.parent;\n            }\n          }\n          return false;\n        };\n        var parser = SaxParser({\n          validate: validate,\n          document: settings.document,\n          allow_html_data_urls: settings.allow_html_data_urls,\n          allow_svg_data_urls: settings.allow_svg_data_urls,\n          allow_script_urls: settings.allow_script_urls,\n          allow_conditional_comments: settings.allow_conditional_comments,\n          preserve_cdata: settings.preserve_cdata,\n          self_closing_elements: cloneAndExcludeBlocks(schema.getSelfClosingElements()),\n          cdata: function (text) {\n            node.append(createNode('#cdata', 4)).value = text;\n          },\n          text: function (text, raw) {\n            var textNode;\n            if (!isInWhiteSpacePreservedElement) {\n              text = text.replace(allWhiteSpaceRegExp, ' ');\n              if (isLineBreakNode(node.lastChild, blockElements)) {\n                text = text.replace(startWhiteSpaceRegExp, '');\n              }\n            }\n            if (text.length !== 0) {\n              textNode = createNode('#text', 3);\n              textNode.raw = !!raw;\n              node.append(textNode).value = text;\n            }\n          },\n          comment: function (text) {\n            node.append(createNode('#comment', 8)).value = text;\n          },\n          pi: function (name, text) {\n            node.append(createNode(name, 7)).value = text;\n            removeWhitespaceBefore(node);\n          },\n          doctype: function (text) {\n            var newNode = node.append(createNode('#doctype', 10));\n            newNode.value = text;\n            removeWhitespaceBefore(node);\n          },\n          start: function (name, attrs, empty) {\n            var elementRule = validate ? schema.getElementRule(name) : {};\n            if (elementRule) {\n              var newNode = createNode(elementRule.outputName || name, 1);\n              newNode.attributes = attrs;\n              newNode.shortEnded = empty;\n              node.append(newNode);\n              var parent_2 = children[node.name];\n              if (parent_2 && children[newNode.name] && !parent_2[newNode.name]) {\n                invalidChildren.push(newNode);\n              }\n              var attrFiltersLen = attributeFilters.length;\n              while (attrFiltersLen--) {\n                var attrName = attributeFilters[attrFiltersLen].name;\n                if (attrName in attrs.map) {\n                  list = matchedAttributes[attrName];\n                  if (list) {\n                    list.push(newNode);\n                  } else {\n                    matchedAttributes[attrName] = [newNode];\n                  }\n                }\n              }\n              if (blockElements[name]) {\n                removeWhitespaceBefore(newNode);\n              }\n              if (!empty) {\n                node = newNode;\n              }\n              if (!isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\n                isInWhiteSpacePreservedElement = true;\n              }\n            }\n          },\n          end: function (name) {\n            var textNode, text, sibling;\n            var elementRule = validate ? schema.getElementRule(name) : {};\n            if (elementRule) {\n              if (blockElements[name]) {\n                if (!isInWhiteSpacePreservedElement) {\n                  textNode = node.firstChild;\n                  if (textNode && textNode.type === 3) {\n                    text = textNode.value.replace(startWhiteSpaceRegExp, '');\n                    if (text.length > 0) {\n                      textNode.value = text;\n                      textNode = textNode.next;\n                    } else {\n                      sibling = textNode.next;\n                      textNode.remove();\n                      textNode = sibling;\n                      while (textNode && textNode.type === 3) {\n                        text = textNode.value;\n                        sibling = textNode.next;\n                        if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\n                          textNode.remove();\n                          textNode = sibling;\n                        }\n                        textNode = sibling;\n                      }\n                    }\n                  }\n                  textNode = node.lastChild;\n                  if (textNode && textNode.type === 3) {\n                    text = textNode.value.replace(endWhiteSpaceRegExp, '');\n                    if (text.length > 0) {\n                      textNode.value = text;\n                      textNode = textNode.prev;\n                    } else {\n                      sibling = textNode.prev;\n                      textNode.remove();\n                      textNode = sibling;\n                      while (textNode && textNode.type === 3) {\n                        text = textNode.value;\n                        sibling = textNode.prev;\n                        if (text.length === 0 || isAllWhiteSpaceRegExp.test(text)) {\n                          textNode.remove();\n                          textNode = sibling;\n                        }\n                        textNode = sibling;\n                      }\n                    }\n                  }\n                }\n              }\n              if (isInWhiteSpacePreservedElement && whiteSpaceElements[name]) {\n                isInWhiteSpacePreservedElement = false;\n              }\n              var isNodeEmpty = isEmpty(schema, nonEmptyElements, whiteSpaceElements, node);\n              var parentNode = node.parent;\n              if (elementRule.paddInEmptyBlock && isNodeEmpty && isTextRootBlockEmpty(node)) {\n                paddEmptyNode(settings, args, blockElements, node);\n              } else if (elementRule.removeEmpty && isNodeEmpty) {\n                if (blockElements[node.name]) {\n                  node.empty().remove();\n                } else {\n                  node.unwrap();\n                }\n              } else if (elementRule.paddEmpty && (isPaddedWithNbsp(node) || isNodeEmpty)) {\n                paddEmptyNode(settings, args, blockElements, node);\n              }\n              node = parentNode;\n            }\n          }\n        }, schema);\n        var rootNode = node = new AstNode(args.context || settings.root_name, 11);\n        parser.parse(html, args.format);\n        if (validate && invalidChildren.length) {\n          if (!args.context) {\n            fixInvalidChildren(invalidChildren);\n          } else {\n            args.invalid = true;\n          }\n        }\n        if (rootBlockName && (rootNode.name === 'body' || args.isRootContent)) {\n          addRootBlocks();\n        }\n        if (!args.invalid) {\n          for (name in matchedNodes) {\n            if (!has$2(matchedNodes, name)) {\n              continue;\n            }\n            list = nodeFilters[name];\n            nodes = matchedNodes[name];\n            fi = nodes.length;\n            while (fi--) {\n              if (!nodes[fi].parent) {\n                nodes.splice(fi, 1);\n              }\n            }\n            for (i = 0, l = list.length; i < l; i++) {\n              list[i](nodes, name, args);\n            }\n          }\n          for (i = 0, l = attributeFilters.length; i < l; i++) {\n            list = attributeFilters[i];\n            if (list.name in matchedAttributes) {\n              nodes = matchedAttributes[list.name];\n              fi = nodes.length;\n              while (fi--) {\n                if (!nodes[fi].parent) {\n                  nodes.splice(fi, 1);\n                }\n              }\n              for (fi = 0, fl = list.callbacks.length; fi < fl; fi++) {\n                list.callbacks[fi](nodes, list.name, args);\n              }\n            }\n          }\n        }\n        return rootNode;\n      };\n      var exports = {\n        schema: schema,\n        addAttributeFilter: addAttributeFilter,\n        getAttributeFilters: getAttributeFilters,\n        addNodeFilter: addNodeFilter,\n        getNodeFilters: getNodeFilters,\n        filterNode: filterNode,\n        parse: parse\n      };\n      register$1(exports, settings);\n      register$2(exports, settings);\n      return exports;\n    };\n\n    var register = function (htmlParser, settings, dom) {\n      htmlParser.addAttributeFilter('data-mce-tabindex', function (nodes, name) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          node.attr('tabindex', node.attr('data-mce-tabindex'));\n          node.attr(name, null);\n        }\n      });\n      htmlParser.addAttributeFilter('src,href,style', function (nodes, name) {\n        var internalName = 'data-mce-' + name;\n        var urlConverter = settings.url_converter;\n        var urlConverterScope = settings.url_converter_scope;\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          var value = node.attr(internalName);\n          if (value !== undefined) {\n            node.attr(name, value.length > 0 ? value : null);\n            node.attr(internalName, null);\n          } else {\n            value = node.attr(name);\n            if (name === 'style') {\n              value = dom.serializeStyle(dom.parseStyle(value), node.name);\n            } else if (urlConverter) {\n              value = urlConverter.call(urlConverterScope, value, name, node.name);\n            }\n            node.attr(name, value.length > 0 ? value : null);\n          }\n        }\n      });\n      htmlParser.addAttributeFilter('class', function (nodes) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          var value = node.attr('class');\n          if (value) {\n            value = node.attr('class').replace(/(?:^|\\s)mce-item-\\w+(?!\\S)/g, '');\n            node.attr('class', value.length > 0 ? value : null);\n          }\n        }\n      });\n      htmlParser.addAttributeFilter('data-mce-type', function (nodes, name, args) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          if (node.attr('data-mce-type') === 'bookmark' && !args.cleanup) {\n            var hasChildren = Optional.from(node.firstChild).exists(function (firstChild) {\n              return !isZwsp(firstChild.value);\n            });\n            if (hasChildren) {\n              node.unwrap();\n            } else {\n              node.remove();\n            }\n          }\n        }\n      });\n      htmlParser.addNodeFilter('noscript', function (nodes) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i].firstChild;\n          if (node) {\n            node.value = Entities.decode(node.value);\n          }\n        }\n      });\n      htmlParser.addNodeFilter('script,style', function (nodes, name) {\n        var trim = function (value) {\n          return value.replace(/(<!--\\[CDATA\\[|\\]\\]-->)/g, '\\n').replace(/^[\\r\\n]*|[\\r\\n]*$/g, '').replace(/^\\s*((<!--)?(\\s*\\/\\/)?\\s*<!\\[CDATA\\[|(<!--\\s*)?\\/\\*\\s*<!\\[CDATA\\[\\s*\\*\\/|(\\/\\/)?\\s*<!--|\\/\\*\\s*<!--\\s*\\*\\/)\\s*[\\r\\n]*/gi, '').replace(/\\s*(\\/\\*\\s*\\]\\]>\\s*\\*\\/(-->)?|\\s*\\/\\/\\s*\\]\\]>(-->)?|\\/\\/\\s*(-->)?|\\]\\]>|\\/\\*\\s*-->\\s*\\*\\/|\\s*-->\\s*)\\s*$/g, '');\n        };\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          var value = node.firstChild ? node.firstChild.value : '';\n          if (name === 'script') {\n            var type = node.attr('type');\n            if (type) {\n              node.attr('type', type === 'mce-no/type' ? null : type.replace(/^mce\\-/, ''));\n            }\n            if (settings.element_format === 'xhtml' && value.length > 0) {\n              node.firstChild.value = '// <![CDATA[\\n' + trim(value) + '\\n// ]]>';\n            }\n          } else {\n            if (settings.element_format === 'xhtml' && value.length > 0) {\n              node.firstChild.value = '<!--\\n' + trim(value) + '\\n-->';\n            }\n          }\n        }\n      });\n      htmlParser.addNodeFilter('#comment', function (nodes) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          if (settings.preserve_cdata && node.value.indexOf('[CDATA[') === 0) {\n            node.name = '#cdata';\n            node.type = 4;\n            node.value = dom.decode(node.value.replace(/^\\[CDATA\\[|\\]\\]$/g, ''));\n          } else if (node.value.indexOf('mce:protected ') === 0) {\n            node.name = '#text';\n            node.type = 3;\n            node.raw = true;\n            node.value = unescape(node.value).substr(14);\n          }\n        }\n      });\n      htmlParser.addNodeFilter('xml:namespace,input', function (nodes, name) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          if (node.type === 7) {\n            node.remove();\n          } else if (node.type === 1) {\n            if (name === 'input' && !node.attr('type')) {\n              node.attr('type', 'text');\n            }\n          }\n        }\n      });\n      htmlParser.addAttributeFilter('data-mce-type', function (nodes) {\n        each$k(nodes, function (node) {\n          if (node.attr('data-mce-type') === 'format-caret') {\n            if (node.isEmpty(htmlParser.schema.getNonEmptyElements())) {\n              node.remove();\n            } else {\n              node.unwrap();\n            }\n          }\n        });\n      });\n      htmlParser.addAttributeFilter('data-mce-src,data-mce-href,data-mce-style,' + 'data-mce-selected,data-mce-expando,' + 'data-mce-type,data-mce-resize,data-mce-placeholder', function (nodes, name) {\n        var i = nodes.length;\n        while (i--) {\n          nodes[i].attr(name, null);\n        }\n      });\n    };\n    var trimTrailingBr = function (rootNode) {\n      var isBr = function (node) {\n        return node && node.name === 'br';\n      };\n      var brNode1 = rootNode.lastChild;\n      if (isBr(brNode1)) {\n        var brNode2 = brNode1.prev;\n        if (isBr(brNode2)) {\n          brNode1.remove();\n          brNode2.remove();\n        }\n      }\n    };\n\n    var preProcess = function (editor, node, args) {\n      var oldDoc;\n      var dom = editor.dom;\n      var clonedNode = node.cloneNode(true);\n      var impl = document.implementation;\n      if (impl.createHTMLDocument) {\n        var doc_1 = impl.createHTMLDocument('');\n        Tools.each(clonedNode.nodeName === 'BODY' ? clonedNode.childNodes : [clonedNode], function (node) {\n          doc_1.body.appendChild(doc_1.importNode(node, true));\n        });\n        if (clonedNode.nodeName !== 'BODY') {\n          clonedNode = doc_1.body.firstChild;\n        } else {\n          clonedNode = doc_1.body;\n        }\n        oldDoc = dom.doc;\n        dom.doc = doc_1;\n      }\n      firePreProcess(editor, __assign(__assign({}, args), { node: clonedNode }));\n      if (oldDoc) {\n        dom.doc = oldDoc;\n      }\n      return clonedNode;\n    };\n    var shouldFireEvent = function (editor, args) {\n      return editor && editor.hasEventListeners('PreProcess') && !args.no_events;\n    };\n    var process = function (editor, node, args) {\n      return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node;\n    };\n\n    var addTempAttr = function (htmlParser, tempAttrs, name) {\n      if (Tools.inArray(tempAttrs, name) === -1) {\n        htmlParser.addAttributeFilter(name, function (nodes, name) {\n          var i = nodes.length;\n          while (i--) {\n            nodes[i].attr(name, null);\n          }\n        });\n        tempAttrs.push(name);\n      }\n    };\n    var postProcess = function (editor, args, content) {\n      if (!args.no_events && editor) {\n        var outArgs = firePostProcess(editor, __assign(__assign({}, args), { content: content }));\n        return outArgs.content;\n      } else {\n        return content;\n      }\n    };\n    var getHtmlFromNode = function (dom, node, args) {\n      var html = trim$3(args.getInner ? node.innerHTML : dom.getOuterHTML(node));\n      return args.selection || isWsPreserveElement(SugarElement.fromDom(node)) ? html : Tools.trim(html);\n    };\n    var parseHtml = function (htmlParser, html, args) {\n      var parserArgs = args.selection ? __assign({ forced_root_block: false }, args) : args;\n      var rootNode = htmlParser.parse(html, parserArgs);\n      trimTrailingBr(rootNode);\n      return rootNode;\n    };\n    var serializeNode = function (settings, schema, node) {\n      var htmlSerializer = HtmlSerializer(settings, schema);\n      return htmlSerializer.serialize(node);\n    };\n    var toHtml = function (editor, settings, schema, rootNode, args) {\n      var content = serializeNode(settings, schema, rootNode);\n      return postProcess(editor, args, content);\n    };\n    var DomSerializerImpl = function (settings, editor) {\n      var tempAttrs = ['data-mce-selected'];\n      var dom = editor && editor.dom ? editor.dom : DOMUtils.DOM;\n      var schema = editor && editor.schema ? editor.schema : Schema(settings);\n      settings.entity_encoding = settings.entity_encoding || 'named';\n      settings.remove_trailing_brs = 'remove_trailing_brs' in settings ? settings.remove_trailing_brs : true;\n      var htmlParser = DomParser(settings, schema);\n      register(htmlParser, settings, dom);\n      var serialize = function (node, parserArgs) {\n        if (parserArgs === void 0) {\n          parserArgs = {};\n        }\n        var args = __assign({ format: 'html' }, parserArgs);\n        var targetNode = process(editor, node, args);\n        var html = getHtmlFromNode(dom, targetNode, args);\n        var rootNode = parseHtml(htmlParser, html, args);\n        return args.format === 'tree' ? rootNode : toHtml(editor, settings, schema, rootNode, args);\n      };\n      return {\n        schema: schema,\n        addNodeFilter: htmlParser.addNodeFilter,\n        addAttributeFilter: htmlParser.addAttributeFilter,\n        serialize: serialize,\n        addRules: schema.addValidElements,\n        setRules: schema.setValidElements,\n        addTempAttr: curry(addTempAttr, htmlParser, tempAttrs),\n        getTempAttrs: constant(tempAttrs),\n        getNodeFilters: htmlParser.getNodeFilters,\n        getAttributeFilters: htmlParser.getAttributeFilters\n      };\n    };\n\n    var DomSerializer = function (settings, editor) {\n      var domSerializer = DomSerializerImpl(settings, editor);\n      return {\n        schema: domSerializer.schema,\n        addNodeFilter: domSerializer.addNodeFilter,\n        addAttributeFilter: domSerializer.addAttributeFilter,\n        serialize: domSerializer.serialize,\n        addRules: domSerializer.addRules,\n        setRules: domSerializer.setRules,\n        addTempAttr: domSerializer.addTempAttr,\n        getTempAttrs: domSerializer.getTempAttrs,\n        getNodeFilters: domSerializer.getNodeFilters,\n        getAttributeFilters: domSerializer.getAttributeFilters\n      };\n    };\n\n    var defaultFormat = 'html';\n    var getContent = function (editor, args) {\n      if (args === void 0) {\n        args = {};\n      }\n      var format = args.format ? args.format : defaultFormat;\n      return getContent$2(editor, args, format);\n    };\n\n    var setContent = function (editor, content, args) {\n      if (args === void 0) {\n        args = {};\n      }\n      return setContent$2(editor, content, args);\n    };\n\n    var DOM$7 = DOMUtils.DOM;\n    var restoreOriginalStyles = function (editor) {\n      DOM$7.setStyle(editor.id, 'display', editor.orgDisplay);\n    };\n    var safeDestroy = function (x) {\n      return Optional.from(x).each(function (x) {\n        return x.destroy();\n      });\n    };\n    var clearDomReferences = function (editor) {\n      editor.contentAreaContainer = editor.formElement = editor.container = editor.editorContainer = null;\n      editor.bodyElement = editor.contentDocument = editor.contentWindow = null;\n      editor.iframeElement = editor.targetElm = null;\n      if (editor.selection) {\n        editor.selection = editor.selection.win = editor.selection.dom = editor.selection.dom.doc = null;\n      }\n    };\n    var restoreForm = function (editor) {\n      var form = editor.formElement;\n      if (form) {\n        if (form._mceOldSubmit) {\n          form.submit = form._mceOldSubmit;\n          form._mceOldSubmit = null;\n        }\n        DOM$7.unbind(form, 'submit reset', editor.formEventDelegate);\n      }\n    };\n    var remove = function (editor) {\n      if (!editor.removed) {\n        var _selectionOverrides = editor._selectionOverrides, editorUpload = editor.editorUpload;\n        var body = editor.getBody();\n        var element = editor.getElement();\n        if (body) {\n          editor.save({ is_removing: true });\n        }\n        editor.removed = true;\n        editor.unbindAllNativeEvents();\n        if (editor.hasHiddenInput && element) {\n          DOM$7.remove(element.nextSibling);\n        }\n        fireRemove(editor);\n        editor.editorManager.remove(editor);\n        if (!editor.inline && body) {\n          restoreOriginalStyles(editor);\n        }\n        fireDetach(editor);\n        DOM$7.remove(editor.getContainer());\n        safeDestroy(_selectionOverrides);\n        safeDestroy(editorUpload);\n        editor.destroy();\n      }\n    };\n    var destroy = function (editor, automatic) {\n      var selection = editor.selection, dom = editor.dom;\n      if (editor.destroyed) {\n        return;\n      }\n      if (!automatic && !editor.removed) {\n        editor.remove();\n        return;\n      }\n      if (!automatic) {\n        editor.editorManager.off('beforeunload', editor._beforeUnload);\n        if (editor.theme && editor.theme.destroy) {\n          editor.theme.destroy();\n        }\n        safeDestroy(selection);\n        safeDestroy(dom);\n      }\n      restoreForm(editor);\n      clearDomReferences(editor);\n      editor.destroyed = true;\n    };\n\n    var deep = function (old, nu) {\n      var bothObjects = isObject(old) && isObject(nu);\n      return bothObjects ? deepMerge(old, nu) : nu;\n    };\n    var baseMerge = function (merger) {\n      return function () {\n        var objects = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          objects[_i] = arguments[_i];\n        }\n        if (objects.length === 0) {\n          throw new Error('Can\\'t merge zero objects');\n        }\n        var ret = {};\n        for (var j = 0; j < objects.length; j++) {\n          var curObject = objects[j];\n          for (var key in curObject) {\n            if (has$2(curObject, key)) {\n              ret[key] = merger(ret[key], curObject[key]);\n            }\n          }\n        }\n        return ret;\n      };\n    };\n    var deepMerge = baseMerge(deep);\n\n    var deprecatedSettings = ('autoresize_on_init,content_editable_state,convert_fonts_to_spans,inline_styles,padd_empty_with_br,block_elements,' + 'boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,' + 'force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,' + 'non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,' + 'tab_focus,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,' + 'paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists').split(',');\n    var deprecatedPlugins = 'bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,textcolor'.split(',');\n    var movedToPremiumPlugins = 'imagetools,toc'.split(',');\n    var getDeprecatedSettings = function (settings) {\n      var settingNames = filter$4(deprecatedSettings, function (setting) {\n        return has$2(settings, setting);\n      });\n      var forcedRootBlock = settings.forced_root_block;\n      if (forcedRootBlock === false || forcedRootBlock === '') {\n        settingNames.push('forced_root_block (false only)');\n      }\n      return sort(settingNames);\n    };\n    var getDeprecatedPlugins = function (settings) {\n      var plugins = Tools.makeMap(settings.plugins, ' ');\n      var hasPlugin = function (plugin) {\n        return has$2(plugins, plugin);\n      };\n      var pluginNames = __spreadArray(__spreadArray([], filter$4(deprecatedPlugins, hasPlugin), true), bind(movedToPremiumPlugins, function (plugin) {\n        return hasPlugin(plugin) ? [plugin + ' (moving to premium)'] : [];\n      }), true);\n      return sort(pluginNames);\n    };\n    var logDeprecationsWarning = function (rawSettings, finalSettings) {\n      var deprecatedSettings = getDeprecatedSettings(rawSettings);\n      var deprecatedPlugins = getDeprecatedPlugins(finalSettings);\n      var hasDeprecatedPlugins = deprecatedPlugins.length > 0;\n      var hasDeprecatedSettings = deprecatedSettings.length > 0;\n      var isLegacyMobileTheme = finalSettings.theme === 'mobile';\n      if (hasDeprecatedPlugins || hasDeprecatedSettings || isLegacyMobileTheme) {\n        var listJoiner = '\\n- ';\n        var themesMessage = isLegacyMobileTheme ? '\\n\\nThemes:' + listJoiner + 'mobile' : '';\n        var pluginsMessage = hasDeprecatedPlugins ? '\\n\\nPlugins:' + listJoiner + deprecatedPlugins.join(listJoiner) : '';\n        var settingsMessage = hasDeprecatedSettings ? '\\n\\nSettings:' + listJoiner + deprecatedSettings.join(listJoiner) : '';\n        console.warn('The following deprecated features are currently enabled, these will be removed in TinyMCE 6.0. ' + 'See https://www.tiny.cloud/docs/release-notes/6.0-upcoming-changes/ for more information.' + themesMessage + pluginsMessage + settingsMessage);\n      }\n    };\n\n    var sectionResult = function (sections, settings) {\n      return {\n        sections: constant(sections),\n        settings: constant(settings)\n      };\n    };\n    var deviceDetection = detect().deviceType;\n    var isTouch = deviceDetection.isTouch();\n    var isPhone = deviceDetection.isPhone();\n    var isTablet = deviceDetection.isTablet();\n    var legacyMobilePlugins = [\n      'lists',\n      'autolink',\n      'autosave'\n    ];\n    var defaultTouchSettings = {\n      table_grid: false,\n      object_resizing: false,\n      resize: false\n    };\n    var normalizePlugins = function (plugins) {\n      var pluginNames = isArray$1(plugins) ? plugins.join(' ') : plugins;\n      var trimmedPlugins = map$3(isString$1(pluginNames) ? pluginNames.split(' ') : [], trim$5);\n      return filter$4(trimmedPlugins, function (item) {\n        return item.length > 0;\n      });\n    };\n    var filterLegacyMobilePlugins = function (plugins) {\n      return filter$4(plugins, curry(contains$3, legacyMobilePlugins));\n    };\n    var extractSections = function (keys, settings) {\n      var result = bifilter(settings, function (value, key) {\n        return contains$3(keys, key);\n      });\n      return sectionResult(result.t, result.f);\n    };\n    var getSection = function (sectionResult, name, defaults) {\n      if (defaults === void 0) {\n        defaults = {};\n      }\n      var sections = sectionResult.sections();\n      var sectionSettings = get$9(sections, name).getOr({});\n      return Tools.extend({}, defaults, sectionSettings);\n    };\n    var hasSection = function (sectionResult, name) {\n      return has$2(sectionResult.sections(), name);\n    };\n    var isSectionTheme = function (sectionResult, name, theme) {\n      var section = sectionResult.sections();\n      return hasSection(sectionResult, name) && section[name].theme === theme;\n    };\n    var getSectionConfig = function (sectionResult, name) {\n      return hasSection(sectionResult, name) ? sectionResult.sections()[name] : {};\n    };\n    var getToolbarMode = function (settings, defaultVal) {\n      return get$9(settings, 'toolbar_mode').orThunk(function () {\n        return get$9(settings, 'toolbar_drawer').map(function (val) {\n          return val === false ? 'wrap' : val;\n        });\n      }).getOr(defaultVal);\n    };\n    var getDefaultSettings = function (settings, id, documentBaseUrl, isTouch, editor) {\n      var baseDefaults = {\n        id: id,\n        theme: 'silver',\n        toolbar_mode: getToolbarMode(settings, 'floating'),\n        plugins: '',\n        document_base_url: documentBaseUrl,\n        add_form_submit_trigger: true,\n        submit_patch: true,\n        add_unload_trigger: true,\n        convert_urls: true,\n        relative_urls: true,\n        remove_script_host: true,\n        object_resizing: true,\n        doctype: '<!DOCTYPE html>',\n        visual: true,\n        font_size_legacy_values: 'xx-small,small,medium,large,x-large,xx-large,300%',\n        forced_root_block: 'p',\n        hidden_input: true,\n        inline_styles: true,\n        convert_fonts_to_spans: true,\n        indent: true,\n        indent_before: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',\n        indent_after: 'p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,' + 'tfoot,tbody,tr,section,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist',\n        entity_encoding: 'named',\n        url_converter: editor.convertURL,\n        url_converter_scope: editor\n      };\n      return __assign(__assign({}, baseDefaults), isTouch ? defaultTouchSettings : {});\n    };\n    var getDefaultMobileSettings = function (mobileSettings, isPhone) {\n      var defaultMobileSettings = {\n        resize: false,\n        toolbar_mode: getToolbarMode(mobileSettings, 'scrolling'),\n        toolbar_sticky: false\n      };\n      var defaultPhoneSettings = { menubar: false };\n      return __assign(__assign(__assign({}, defaultTouchSettings), defaultMobileSettings), isPhone ? defaultPhoneSettings : {});\n    };\n    var getExternalPlugins = function (overrideSettings, settings) {\n      var userDefinedExternalPlugins = settings.external_plugins ? settings.external_plugins : {};\n      if (overrideSettings && overrideSettings.external_plugins) {\n        return Tools.extend({}, overrideSettings.external_plugins, userDefinedExternalPlugins);\n      } else {\n        return userDefinedExternalPlugins;\n      }\n    };\n    var combinePlugins = function (forcedPlugins, plugins) {\n      return [].concat(normalizePlugins(forcedPlugins)).concat(normalizePlugins(plugins));\n    };\n    var getPlatformPlugins = function (isMobileDevice, sectionResult, desktopPlugins, mobilePlugins) {\n      if (isMobileDevice && isSectionTheme(sectionResult, 'mobile', 'mobile')) {\n        return filterLegacyMobilePlugins(mobilePlugins);\n      } else if (isMobileDevice && hasSection(sectionResult, 'mobile')) {\n        return mobilePlugins;\n      } else {\n        return desktopPlugins;\n      }\n    };\n    var processPlugins = function (isMobileDevice, sectionResult, defaultOverrideSettings, settings) {\n      var forcedPlugins = normalizePlugins(defaultOverrideSettings.forced_plugins);\n      var desktopPlugins = normalizePlugins(settings.plugins);\n      var mobileConfig = getSectionConfig(sectionResult, 'mobile');\n      var mobilePlugins = mobileConfig.plugins ? normalizePlugins(mobileConfig.plugins) : desktopPlugins;\n      var platformPlugins = getPlatformPlugins(isMobileDevice, sectionResult, desktopPlugins, mobilePlugins);\n      var combinedPlugins = combinePlugins(forcedPlugins, platformPlugins);\n      if (Env.browser.isIE() && contains$3(combinedPlugins, 'rtc')) {\n        throw new Error('RTC plugin is not supported on IE 11.');\n      }\n      return Tools.extend(settings, { plugins: combinedPlugins.join(' ') });\n    };\n    var isOnMobile = function (isMobileDevice, sectionResult) {\n      return isMobileDevice && hasSection(sectionResult, 'mobile');\n    };\n    var combineSettings = function (isMobileDevice, isPhone, defaultSettings, defaultOverrideSettings, settings) {\n      var defaultDeviceSettings = isMobileDevice ? { mobile: getDefaultMobileSettings(settings.mobile || {}, isPhone) } : {};\n      var sectionResult = extractSections(['mobile'], deepMerge(defaultDeviceSettings, settings));\n      var extendedSettings = Tools.extend(defaultSettings, defaultOverrideSettings, sectionResult.settings(), isOnMobile(isMobileDevice, sectionResult) ? getSection(sectionResult, 'mobile') : {}, {\n        validate: true,\n        external_plugins: getExternalPlugins(defaultOverrideSettings, sectionResult.settings())\n      });\n      return processPlugins(isMobileDevice, sectionResult, defaultOverrideSettings, extendedSettings);\n    };\n    var getEditorSettings = function (editor, id, documentBaseUrl, defaultOverrideSettings, settings) {\n      var defaultSettings = getDefaultSettings(settings, id, documentBaseUrl, isTouch, editor);\n      var finalSettings = combineSettings(isPhone || isTablet, isPhone, defaultSettings, defaultOverrideSettings, settings);\n      if (finalSettings.deprecation_warnings !== false) {\n        logDeprecationsWarning(settings, finalSettings);\n      }\n      return finalSettings;\n    };\n    var getFiltered = function (predicate, editor, name) {\n      return Optional.from(editor.settings[name]).filter(predicate);\n    };\n    var getParamObject = function (value) {\n      var output = {};\n      if (typeof value === 'string') {\n        each$k(value.indexOf('=') > 0 ? value.split(/[;,](?![^=;,]*(?:[;,]|$))/) : value.split(','), function (val) {\n          var arr = val.split('=');\n          if (arr.length > 1) {\n            output[Tools.trim(arr[0])] = Tools.trim(arr[1]);\n          } else {\n            output[Tools.trim(arr[0])] = Tools.trim(arr[0]);\n          }\n        });\n      } else {\n        output = value;\n      }\n      return output;\n    };\n    var isArrayOf = function (p) {\n      return function (a) {\n        return isArray$1(a) && forall(a, p);\n      };\n    };\n    var getParam = function (editor, name, defaultVal, type) {\n      var value = name in editor.settings ? editor.settings[name] : defaultVal;\n      if (type === 'hash') {\n        return getParamObject(value);\n      } else if (type === 'string') {\n        return getFiltered(isString$1, editor, name).getOr(defaultVal);\n      } else if (type === 'number') {\n        return getFiltered(isNumber, editor, name).getOr(defaultVal);\n      } else if (type === 'boolean') {\n        return getFiltered(isBoolean, editor, name).getOr(defaultVal);\n      } else if (type === 'object') {\n        return getFiltered(isObject, editor, name).getOr(defaultVal);\n      } else if (type === 'array') {\n        return getFiltered(isArray$1, editor, name).getOr(defaultVal);\n      } else if (type === 'string[]') {\n        return getFiltered(isArrayOf(isString$1), editor, name).getOr(defaultVal);\n      } else if (type === 'function') {\n        return getFiltered(isFunction, editor, name).getOr(defaultVal);\n      } else {\n        return value;\n      }\n    };\n\n    var CreateIconManager = function () {\n      var lookup = {};\n      var add = function (id, iconPack) {\n        lookup[id] = iconPack;\n      };\n      var get = function (id) {\n        if (lookup[id]) {\n          return lookup[id];\n        }\n        return { icons: {} };\n      };\n      var has = function (id) {\n        return has$2(lookup, id);\n      };\n      return {\n        add: add,\n        get: get,\n        has: has\n      };\n    };\n    var IconManager = CreateIconManager();\n\n    var getProp = function (propName, elm) {\n      var rawElm = elm.dom;\n      return rawElm[propName];\n    };\n    var getComputedSizeProp = function (propName, elm) {\n      return parseInt(get$5(elm, propName), 10);\n    };\n    var getClientWidth = curry(getProp, 'clientWidth');\n    var getClientHeight = curry(getProp, 'clientHeight');\n    var getMarginTop = curry(getComputedSizeProp, 'margin-top');\n    var getMarginLeft = curry(getComputedSizeProp, 'margin-left');\n    var getBoundingClientRect = function (elm) {\n      return elm.dom.getBoundingClientRect();\n    };\n    var isInsideElementContentArea = function (bodyElm, clientX, clientY) {\n      var clientWidth = getClientWidth(bodyElm);\n      var clientHeight = getClientHeight(bodyElm);\n      return clientX >= 0 && clientY >= 0 && clientX <= clientWidth && clientY <= clientHeight;\n    };\n    var transpose = function (inline, elm, clientX, clientY) {\n      var clientRect = getBoundingClientRect(elm);\n      var deltaX = inline ? clientRect.left + elm.dom.clientLeft + getMarginLeft(elm) : 0;\n      var deltaY = inline ? clientRect.top + elm.dom.clientTop + getMarginTop(elm) : 0;\n      var x = clientX - deltaX;\n      var y = clientY - deltaY;\n      return {\n        x: x,\n        y: y\n      };\n    };\n    var isXYInContentArea = function (editor, clientX, clientY) {\n      var bodyElm = SugarElement.fromDom(editor.getBody());\n      var targetElm = editor.inline ? bodyElm : documentElement(bodyElm);\n      var transposedPoint = transpose(editor.inline, targetElm, clientX, clientY);\n      return isInsideElementContentArea(targetElm, transposedPoint.x, transposedPoint.y);\n    };\n    var fromDomSafe = function (node) {\n      return Optional.from(node).map(SugarElement.fromDom);\n    };\n    var isEditorAttachedToDom = function (editor) {\n      var rawContainer = editor.inline ? editor.getBody() : editor.getContentAreaContainer();\n      return fromDomSafe(rawContainer).map(inBody).getOr(false);\n    };\n\n    var NotificationManagerImpl = function () {\n      var unimplemented = function () {\n        throw new Error('Theme did not provide a NotificationManager implementation.');\n      };\n      return {\n        open: unimplemented,\n        close: unimplemented,\n        reposition: unimplemented,\n        getArgs: unimplemented\n      };\n    };\n\n    var NotificationManager = function (editor) {\n      var notifications = [];\n      var getImplementation = function () {\n        var theme = editor.theme;\n        return theme && theme.getNotificationManagerImpl ? theme.getNotificationManagerImpl() : NotificationManagerImpl();\n      };\n      var getTopNotification = function () {\n        return Optional.from(notifications[0]);\n      };\n      var isEqual = function (a, b) {\n        return a.type === b.type && a.text === b.text && !a.progressBar && !a.timeout && !b.progressBar && !b.timeout;\n      };\n      var reposition = function () {\n        if (notifications.length > 0) {\n          getImplementation().reposition(notifications);\n        }\n      };\n      var addNotification = function (notification) {\n        notifications.push(notification);\n      };\n      var closeNotification = function (notification) {\n        findIndex$2(notifications, function (otherNotification) {\n          return otherNotification === notification;\n        }).each(function (index) {\n          notifications.splice(index, 1);\n        });\n      };\n      var open = function (spec, fireEvent) {\n        if (fireEvent === void 0) {\n          fireEvent = true;\n        }\n        if (editor.removed || !isEditorAttachedToDom(editor)) {\n          return;\n        }\n        if (fireEvent) {\n          editor.fire('BeforeOpenNotification', { notification: spec });\n        }\n        return find$3(notifications, function (notification) {\n          return isEqual(getImplementation().getArgs(notification), spec);\n        }).getOrThunk(function () {\n          editor.editorManager.setActive(editor);\n          var notification = getImplementation().open(spec, function () {\n            closeNotification(notification);\n            reposition();\n            getTopNotification().fold(function () {\n              return editor.focus();\n            }, function (top) {\n              return focus$1(SugarElement.fromDom(top.getEl()));\n            });\n          });\n          addNotification(notification);\n          reposition();\n          editor.fire('OpenNotification', { notification: __assign({}, notification) });\n          return notification;\n        });\n      };\n      var close = function () {\n        getTopNotification().each(function (notification) {\n          getImplementation().close(notification);\n          closeNotification(notification);\n          reposition();\n        });\n      };\n      var getNotifications = constant(notifications);\n      var registerEvents = function (editor) {\n        editor.on('SkinLoaded', function () {\n          var serviceMessage = getServiceMessage(editor);\n          if (serviceMessage) {\n            open({\n              text: serviceMessage,\n              type: 'warning',\n              timeout: 0\n            }, false);\n          }\n          reposition();\n        });\n        editor.on('show ResizeEditor ResizeWindow NodeChange', function () {\n          Delay.requestAnimationFrame(reposition);\n        });\n        editor.on('remove', function () {\n          each$k(notifications.slice(), function (notification) {\n            getImplementation().close(notification);\n          });\n        });\n      };\n      registerEvents(editor);\n      return {\n        open: open,\n        close: close,\n        getNotifications: getNotifications\n      };\n    };\n\n    var PluginManager = AddOnManager.PluginManager;\n\n    var ThemeManager = AddOnManager.ThemeManager;\n\n    function WindowManagerImpl () {\n      var unimplemented = function () {\n        throw new Error('Theme did not provide a WindowManager implementation.');\n      };\n      return {\n        open: unimplemented,\n        openUrl: unimplemented,\n        alert: unimplemented,\n        confirm: unimplemented,\n        close: unimplemented,\n        getParams: unimplemented,\n        setParams: unimplemented\n      };\n    }\n\n    var WindowManager = function (editor) {\n      var dialogs = [];\n      var getImplementation = function () {\n        var theme = editor.theme;\n        return theme && theme.getWindowManagerImpl ? theme.getWindowManagerImpl() : WindowManagerImpl();\n      };\n      var funcBind = function (scope, f) {\n        return function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          return f ? f.apply(scope, args) : undefined;\n        };\n      };\n      var fireOpenEvent = function (dialog) {\n        editor.fire('OpenWindow', { dialog: dialog });\n      };\n      var fireCloseEvent = function (dialog) {\n        editor.fire('CloseWindow', { dialog: dialog });\n      };\n      var addDialog = function (dialog) {\n        dialogs.push(dialog);\n        fireOpenEvent(dialog);\n      };\n      var closeDialog = function (dialog) {\n        fireCloseEvent(dialog);\n        dialogs = filter$4(dialogs, function (otherDialog) {\n          return otherDialog !== dialog;\n        });\n        if (dialogs.length === 0) {\n          editor.focus();\n        }\n      };\n      var getTopDialog = function () {\n        return Optional.from(dialogs[dialogs.length - 1]);\n      };\n      var storeSelectionAndOpenDialog = function (openDialog) {\n        editor.editorManager.setActive(editor);\n        store(editor);\n        var dialog = openDialog();\n        addDialog(dialog);\n        return dialog;\n      };\n      var open = function (args, params) {\n        return storeSelectionAndOpenDialog(function () {\n          return getImplementation().open(args, params, closeDialog);\n        });\n      };\n      var openUrl = function (args) {\n        return storeSelectionAndOpenDialog(function () {\n          return getImplementation().openUrl(args, closeDialog);\n        });\n      };\n      var alert = function (message, callback, scope) {\n        var windowManagerImpl = getImplementation();\n        windowManagerImpl.alert(message, funcBind(scope ? scope : windowManagerImpl, callback));\n      };\n      var confirm = function (message, callback, scope) {\n        var windowManagerImpl = getImplementation();\n        windowManagerImpl.confirm(message, funcBind(scope ? scope : windowManagerImpl, callback));\n      };\n      var close = function () {\n        getTopDialog().each(function (dialog) {\n          getImplementation().close(dialog);\n          closeDialog(dialog);\n        });\n      };\n      editor.on('remove', function () {\n        each$k(dialogs, function (dialog) {\n          getImplementation().close(dialog);\n        });\n      });\n      return {\n        open: open,\n        openUrl: openUrl,\n        alert: alert,\n        confirm: confirm,\n        close: close\n      };\n    };\n\n    var displayNotification = function (editor, message) {\n      editor.notificationManager.open({\n        type: 'error',\n        text: message\n      });\n    };\n    var displayError = function (editor, message) {\n      if (editor._skinLoaded) {\n        displayNotification(editor, message);\n      } else {\n        editor.on('SkinLoaded', function () {\n          displayNotification(editor, message);\n        });\n      }\n    };\n    var uploadError = function (editor, message) {\n      displayError(editor, I18n.translate([\n        'Failed to upload image: {0}',\n        message\n      ]));\n    };\n    var logError = function (editor, errorType, msg) {\n      fireError(editor, errorType, { message: msg });\n      console.error(msg);\n    };\n    var createLoadError = function (type, url, name) {\n      return name ? 'Failed to load ' + type + ': ' + name + ' from url ' + url : 'Failed to load ' + type + ' url: ' + url;\n    };\n    var pluginLoadError = function (editor, url, name) {\n      logError(editor, 'PluginLoadError', createLoadError('plugin', url, name));\n    };\n    var iconsLoadError = function (editor, url, name) {\n      logError(editor, 'IconsLoadError', createLoadError('icons', url, name));\n    };\n    var languageLoadError = function (editor, url, name) {\n      logError(editor, 'LanguageLoadError', createLoadError('language', url, name));\n    };\n    var pluginInitError = function (editor, name, err) {\n      var message = I18n.translate([\n        'Failed to initialize plugin: {0}',\n        name\n      ]);\n      fireError(editor, 'PluginLoadError', { message: message });\n      initError(message, err);\n      displayError(editor, message);\n    };\n    var initError = function (message) {\n      var x = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        x[_i - 1] = arguments[_i];\n      }\n      var console = window.console;\n      if (console) {\n        if (console.error) {\n          console.error.apply(console, __spreadArray([message], x, false));\n        } else {\n          console.log.apply(console, __spreadArray([message], x, false));\n        }\n      }\n    };\n\n    var isContentCssSkinName = function (url) {\n      return /^[a-z0-9\\-]+$/i.test(url);\n    };\n    var getContentCssUrls = function (editor) {\n      return transformToUrls(editor, getContentCss(editor));\n    };\n    var getFontCssUrls = function (editor) {\n      return transformToUrls(editor, getFontCss(editor));\n    };\n    var transformToUrls = function (editor, cssLinks) {\n      var skinUrl = editor.editorManager.baseURL + '/skins/content';\n      var suffix = editor.editorManager.suffix;\n      var contentCssFile = 'content' + suffix + '.css';\n      var inline = editor.inline === true;\n      return map$3(cssLinks, function (url) {\n        if (isContentCssSkinName(url) && !inline) {\n          return skinUrl + '/' + url + '/' + contentCssFile;\n        } else {\n          return editor.documentBaseURI.toAbsolute(url);\n        }\n      });\n    };\n    var appendContentCssFromSettings = function (editor) {\n      editor.contentCSS = editor.contentCSS.concat(getContentCssUrls(editor), getFontCssUrls(editor));\n    };\n\n    var UploadStatus = function () {\n      var PENDING = 1, UPLOADED = 2;\n      var blobUriStatuses = {};\n      var createStatus = function (status, resultUri) {\n        return {\n          status: status,\n          resultUri: resultUri\n        };\n      };\n      var hasBlobUri = function (blobUri) {\n        return blobUri in blobUriStatuses;\n      };\n      var getResultUri = function (blobUri) {\n        var result = blobUriStatuses[blobUri];\n        return result ? result.resultUri : null;\n      };\n      var isPending = function (blobUri) {\n        return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === PENDING : false;\n      };\n      var isUploaded = function (blobUri) {\n        return hasBlobUri(blobUri) ? blobUriStatuses[blobUri].status === UPLOADED : false;\n      };\n      var markPending = function (blobUri) {\n        blobUriStatuses[blobUri] = createStatus(PENDING, null);\n      };\n      var markUploaded = function (blobUri, resultUri) {\n        blobUriStatuses[blobUri] = createStatus(UPLOADED, resultUri);\n      };\n      var removeFailed = function (blobUri) {\n        delete blobUriStatuses[blobUri];\n      };\n      var destroy = function () {\n        blobUriStatuses = {};\n      };\n      return {\n        hasBlobUri: hasBlobUri,\n        getResultUri: getResultUri,\n        isPending: isPending,\n        isUploaded: isUploaded,\n        markPending: markPending,\n        markUploaded: markUploaded,\n        removeFailed: removeFailed,\n        destroy: destroy\n      };\n    };\n\n    var count = 0;\n    var seed = function () {\n      var rnd = function () {\n        return Math.round(Math.random() * 4294967295).toString(36);\n      };\n      var now = new Date().getTime();\n      return 's' + now.toString(36) + rnd() + rnd() + rnd();\n    };\n    var uuid = function (prefix) {\n      return prefix + count++ + seed();\n    };\n\n    var BlobCache = function () {\n      var cache = [];\n      var mimeToExt = function (mime) {\n        var mimes = {\n          'image/jpeg': 'jpg',\n          'image/jpg': 'jpg',\n          'image/gif': 'gif',\n          'image/png': 'png',\n          'image/apng': 'apng',\n          'image/avif': 'avif',\n          'image/svg+xml': 'svg',\n          'image/webp': 'webp',\n          'image/bmp': 'bmp',\n          'image/tiff': 'tiff'\n        };\n        return mimes[mime.toLowerCase()] || 'dat';\n      };\n      var create = function (o, blob, base64, name, filename) {\n        if (isString$1(o)) {\n          var id = o;\n          return toBlobInfo({\n            id: id,\n            name: name,\n            filename: filename,\n            blob: blob,\n            base64: base64\n          });\n        } else if (isObject(o)) {\n          return toBlobInfo(o);\n        } else {\n          throw new Error('Unknown input type');\n        }\n      };\n      var toBlobInfo = function (o) {\n        if (!o.blob || !o.base64) {\n          throw new Error('blob and base64 representations of the image are required for BlobInfo to be created');\n        }\n        var id = o.id || uuid('blobid');\n        var name = o.name || id;\n        var blob = o.blob;\n        return {\n          id: constant(id),\n          name: constant(name),\n          filename: constant(o.filename || name + '.' + mimeToExt(blob.type)),\n          blob: constant(blob),\n          base64: constant(o.base64),\n          blobUri: constant(o.blobUri || URL.createObjectURL(blob)),\n          uri: constant(o.uri)\n        };\n      };\n      var add = function (blobInfo) {\n        if (!get(blobInfo.id())) {\n          cache.push(blobInfo);\n        }\n      };\n      var findFirst = function (predicate) {\n        return find$3(cache, predicate).getOrUndefined();\n      };\n      var get = function (id) {\n        return findFirst(function (cachedBlobInfo) {\n          return cachedBlobInfo.id() === id;\n        });\n      };\n      var getByUri = function (blobUri) {\n        return findFirst(function (blobInfo) {\n          return blobInfo.blobUri() === blobUri;\n        });\n      };\n      var getByData = function (base64, type) {\n        return findFirst(function (blobInfo) {\n          return blobInfo.base64() === base64 && blobInfo.blob().type === type;\n        });\n      };\n      var removeByUri = function (blobUri) {\n        cache = filter$4(cache, function (blobInfo) {\n          if (blobInfo.blobUri() === blobUri) {\n            URL.revokeObjectURL(blobInfo.blobUri());\n            return false;\n          }\n          return true;\n        });\n      };\n      var destroy = function () {\n        each$k(cache, function (cachedBlobInfo) {\n          URL.revokeObjectURL(cachedBlobInfo.blobUri());\n        });\n        cache = [];\n      };\n      return {\n        create: create,\n        add: add,\n        get: get,\n        getByUri: getByUri,\n        getByData: getByData,\n        findFirst: findFirst,\n        removeByUri: removeByUri,\n        destroy: destroy\n      };\n    };\n\n    var Uploader = function (uploadStatus, settings) {\n      var pendingPromises = {};\n      var pathJoin = function (path1, path2) {\n        if (path1) {\n          return path1.replace(/\\/$/, '') + '/' + path2.replace(/^\\//, '');\n        }\n        return path2;\n      };\n      var defaultHandler = function (blobInfo, success, failure, progress) {\n        var xhr = new XMLHttpRequest();\n        xhr.open('POST', settings.url);\n        xhr.withCredentials = settings.credentials;\n        xhr.upload.onprogress = function (e) {\n          progress(e.loaded / e.total * 100);\n        };\n        xhr.onerror = function () {\n          failure('Image upload failed due to a XHR Transport error. Code: ' + xhr.status);\n        };\n        xhr.onload = function () {\n          if (xhr.status < 200 || xhr.status >= 300) {\n            failure('HTTP Error: ' + xhr.status);\n            return;\n          }\n          var json = JSON.parse(xhr.responseText);\n          if (!json || typeof json.location !== 'string') {\n            failure('Invalid JSON: ' + xhr.responseText);\n            return;\n          }\n          success(pathJoin(settings.basePath, json.location));\n        };\n        var formData = new FormData();\n        formData.append('file', blobInfo.blob(), blobInfo.filename());\n        xhr.send(formData);\n      };\n      var noUpload = function () {\n        return new promiseObj(function (resolve) {\n          resolve([]);\n        });\n      };\n      var handlerSuccess = function (blobInfo, url) {\n        return {\n          url: url,\n          blobInfo: blobInfo,\n          status: true\n        };\n      };\n      var handlerFailure = function (blobInfo, message, options) {\n        return {\n          url: '',\n          blobInfo: blobInfo,\n          status: false,\n          error: {\n            message: message,\n            options: options\n          }\n        };\n      };\n      var resolvePending = function (blobUri, result) {\n        Tools.each(pendingPromises[blobUri], function (resolve) {\n          resolve(result);\n        });\n        delete pendingPromises[blobUri];\n      };\n      var uploadBlobInfo = function (blobInfo, handler, openNotification) {\n        uploadStatus.markPending(blobInfo.blobUri());\n        return new promiseObj(function (resolve) {\n          var notification, progress;\n          try {\n            var closeNotification_1 = function () {\n              if (notification) {\n                notification.close();\n                progress = noop;\n              }\n            };\n            var success = function (url) {\n              closeNotification_1();\n              uploadStatus.markUploaded(blobInfo.blobUri(), url);\n              resolvePending(blobInfo.blobUri(), handlerSuccess(blobInfo, url));\n              resolve(handlerSuccess(blobInfo, url));\n            };\n            var failure = function (error, options) {\n              var failureOptions = options ? options : {};\n              closeNotification_1();\n              uploadStatus.removeFailed(blobInfo.blobUri());\n              resolvePending(blobInfo.blobUri(), handlerFailure(blobInfo, error, failureOptions));\n              resolve(handlerFailure(blobInfo, error, failureOptions));\n            };\n            progress = function (percent) {\n              if (percent < 0 || percent > 100) {\n                return;\n              }\n              Optional.from(notification).orThunk(function () {\n                return Optional.from(openNotification).map(apply);\n              }).each(function (n) {\n                notification = n;\n                n.progressBar.value(percent);\n              });\n            };\n            handler(blobInfo, success, failure, progress);\n          } catch (ex) {\n            resolve(handlerFailure(blobInfo, ex.message, {}));\n          }\n        });\n      };\n      var isDefaultHandler = function (handler) {\n        return handler === defaultHandler;\n      };\n      var pendingUploadBlobInfo = function (blobInfo) {\n        var blobUri = blobInfo.blobUri();\n        return new promiseObj(function (resolve) {\n          pendingPromises[blobUri] = pendingPromises[blobUri] || [];\n          pendingPromises[blobUri].push(resolve);\n        });\n      };\n      var uploadBlobs = function (blobInfos, openNotification) {\n        blobInfos = Tools.grep(blobInfos, function (blobInfo) {\n          return !uploadStatus.isUploaded(blobInfo.blobUri());\n        });\n        return promiseObj.all(Tools.map(blobInfos, function (blobInfo) {\n          return uploadStatus.isPending(blobInfo.blobUri()) ? pendingUploadBlobInfo(blobInfo) : uploadBlobInfo(blobInfo, settings.handler, openNotification);\n        }));\n      };\n      var upload = function (blobInfos, openNotification) {\n        return !settings.url && isDefaultHandler(settings.handler) ? noUpload() : uploadBlobs(blobInfos, openNotification);\n      };\n      if (isFunction(settings.handler) === false) {\n        settings.handler = defaultHandler;\n      }\n      return { upload: upload };\n    };\n\n    var openNotification = function (editor) {\n      return function () {\n        return editor.notificationManager.open({\n          text: editor.translate('Image uploading...'),\n          type: 'info',\n          timeout: -1,\n          progressBar: true\n        });\n      };\n    };\n    var createUploader = function (editor, uploadStatus) {\n      return Uploader(uploadStatus, {\n        url: getImageUploadUrl(editor),\n        basePath: getImageUploadBasePath(editor),\n        credentials: getImagesUploadCredentials(editor),\n        handler: getImagesUploadHandler(editor)\n      });\n    };\n    var ImageUploader = function (editor) {\n      var uploadStatus = UploadStatus();\n      var uploader = createUploader(editor, uploadStatus);\n      return {\n        upload: function (blobInfos, showNotification) {\n          if (showNotification === void 0) {\n            showNotification = true;\n          }\n          return uploader.upload(blobInfos, showNotification ? openNotification(editor) : undefined);\n        }\n      };\n    };\n\n    var UploadChangeHandler = function (editor) {\n      var lastChangedLevel = Cell(null);\n      editor.on('change AddUndo', function (e) {\n        lastChangedLevel.set(__assign({}, e.level));\n      });\n      var fireIfChanged = function () {\n        var data = editor.undoManager.data;\n        last$2(data).filter(function (level) {\n          return !isEq$1(lastChangedLevel.get(), level);\n        }).each(function (level) {\n          editor.setDirty(true);\n          editor.fire('change', {\n            level: level,\n            lastLevel: get$a(data, data.length - 2).getOrNull()\n          });\n        });\n      };\n      return { fireIfChanged: fireIfChanged };\n    };\n    var EditorUpload = function (editor) {\n      var blobCache = BlobCache();\n      var uploader, imageScanner;\n      var uploadStatus = UploadStatus();\n      var urlFilters = [];\n      var changeHandler = UploadChangeHandler(editor);\n      var aliveGuard = function (callback) {\n        return function (result) {\n          if (editor.selection) {\n            return callback(result);\n          }\n          return [];\n        };\n      };\n      var cacheInvalidator = function (url) {\n        return url + (url.indexOf('?') === -1 ? '?' : '&') + new Date().getTime();\n      };\n      var replaceString = function (content, search, replace) {\n        var index = 0;\n        do {\n          index = content.indexOf(search, index);\n          if (index !== -1) {\n            content = content.substring(0, index) + replace + content.substr(index + search.length);\n            index += replace.length - search.length + 1;\n          }\n        } while (index !== -1);\n        return content;\n      };\n      var replaceImageUrl = function (content, targetUrl, replacementUrl) {\n        var replacementString = 'src=\"' + replacementUrl + '\"' + (replacementUrl === Env.transparentSrc ? ' data-mce-placeholder=\"1\"' : '');\n        content = replaceString(content, 'src=\"' + targetUrl + '\"', replacementString);\n        content = replaceString(content, 'data-mce-src=\"' + targetUrl + '\"', 'data-mce-src=\"' + replacementUrl + '\"');\n        return content;\n      };\n      var replaceUrlInUndoStack = function (targetUrl, replacementUrl) {\n        each$k(editor.undoManager.data, function (level) {\n          if (level.type === 'fragmented') {\n            level.fragments = map$3(level.fragments, function (fragment) {\n              return replaceImageUrl(fragment, targetUrl, replacementUrl);\n            });\n          } else {\n            level.content = replaceImageUrl(level.content, targetUrl, replacementUrl);\n          }\n        });\n      };\n      var replaceImageUriInView = function (image, resultUri) {\n        var src = editor.convertURL(resultUri, 'src');\n        replaceUrlInUndoStack(image.src, resultUri);\n        editor.$(image).attr({\n          'src': shouldReuseFileName(editor) ? cacheInvalidator(resultUri) : resultUri,\n          'data-mce-src': src\n        });\n      };\n      var uploadImages = function (callback) {\n        if (!uploader) {\n          uploader = createUploader(editor, uploadStatus);\n        }\n        return scanForImages().then(aliveGuard(function (imageInfos) {\n          var blobInfos = map$3(imageInfos, function (imageInfo) {\n            return imageInfo.blobInfo;\n          });\n          return uploader.upload(blobInfos, openNotification(editor)).then(aliveGuard(function (result) {\n            var imagesToRemove = [];\n            var filteredResult = map$3(result, function (uploadInfo, index) {\n              var blobInfo = imageInfos[index].blobInfo;\n              var image = imageInfos[index].image;\n              if (uploadInfo.status && shouldReplaceBlobUris(editor)) {\n                blobCache.removeByUri(image.src);\n                if (isRtc(editor)) ; else {\n                  replaceImageUriInView(image, uploadInfo.url);\n                }\n              } else if (uploadInfo.error) {\n                if (uploadInfo.error.options.remove) {\n                  replaceUrlInUndoStack(image.getAttribute('src'), Env.transparentSrc);\n                  imagesToRemove.push(image);\n                }\n                uploadError(editor, uploadInfo.error.message);\n              }\n              return {\n                element: image,\n                status: uploadInfo.status,\n                uploadUri: uploadInfo.url,\n                blobInfo: blobInfo\n              };\n            });\n            if (filteredResult.length > 0) {\n              changeHandler.fireIfChanged();\n            }\n            if (imagesToRemove.length > 0) {\n              if (isRtc(editor)) {\n                console.error('Removing images on failed uploads is currently unsupported for RTC');\n              } else {\n                editor.undoManager.transact(function () {\n                  each$k(imagesToRemove, function (element) {\n                    editor.dom.remove(element);\n                    blobCache.removeByUri(element.src);\n                  });\n                });\n              }\n            }\n            if (callback) {\n              callback(filteredResult);\n            }\n            return filteredResult;\n          }));\n        }));\n      };\n      var uploadImagesAuto = function (callback) {\n        if (isAutomaticUploadsEnabled(editor)) {\n          return uploadImages(callback);\n        }\n      };\n      var isValidDataUriImage = function (imgElm) {\n        if (forall(urlFilters, function (filter) {\n            return filter(imgElm);\n          }) === false) {\n          return false;\n        }\n        if (imgElm.getAttribute('src').indexOf('data:') === 0) {\n          var dataImgFilter = getImagesDataImgFilter(editor);\n          return dataImgFilter(imgElm);\n        }\n        return true;\n      };\n      var addFilter = function (filter) {\n        urlFilters.push(filter);\n      };\n      var scanForImages = function () {\n        if (!imageScanner) {\n          imageScanner = ImageScanner(uploadStatus, blobCache);\n        }\n        return imageScanner.findAll(editor.getBody(), isValidDataUriImage).then(aliveGuard(function (result) {\n          result = filter$4(result, function (resultItem) {\n            if (typeof resultItem === 'string') {\n              displayError(editor, resultItem);\n              return false;\n            }\n            return true;\n          });\n          if (isRtc(editor)) ; else {\n            each$k(result, function (resultItem) {\n              replaceUrlInUndoStack(resultItem.image.src, resultItem.blobInfo.blobUri());\n              resultItem.image.src = resultItem.blobInfo.blobUri();\n              resultItem.image.removeAttribute('data-mce-src');\n            });\n          }\n          return result;\n        }));\n      };\n      var destroy = function () {\n        blobCache.destroy();\n        uploadStatus.destroy();\n        imageScanner = uploader = null;\n      };\n      var replaceBlobUris = function (content) {\n        return content.replace(/src=\"(blob:[^\"]+)\"/g, function (match, blobUri) {\n          var resultUri = uploadStatus.getResultUri(blobUri);\n          if (resultUri) {\n            return 'src=\"' + resultUri + '\"';\n          }\n          var blobInfo = blobCache.getByUri(blobUri);\n          if (!blobInfo) {\n            blobInfo = foldl(editor.editorManager.get(), function (result, editor) {\n              return result || editor.editorUpload && editor.editorUpload.blobCache.getByUri(blobUri);\n            }, null);\n          }\n          if (blobInfo) {\n            var blob = blobInfo.blob();\n            return 'src=\"data:' + blob.type + ';base64,' + blobInfo.base64() + '\"';\n          }\n          return match;\n        });\n      };\n      editor.on('SetContent', function () {\n        if (isAutomaticUploadsEnabled(editor)) {\n          uploadImagesAuto();\n        } else {\n          scanForImages();\n        }\n      });\n      editor.on('RawSaveContent', function (e) {\n        e.content = replaceBlobUris(e.content);\n      });\n      editor.on('GetContent', function (e) {\n        if (e.source_view || e.format === 'raw' || e.format === 'tree') {\n          return;\n        }\n        e.content = replaceBlobUris(e.content);\n      });\n      editor.on('PostRender', function () {\n        editor.parser.addNodeFilter('img', function (images) {\n          each$k(images, function (img) {\n            var src = img.attr('src');\n            if (blobCache.getByUri(src)) {\n              return;\n            }\n            var resultUri = uploadStatus.getResultUri(src);\n            if (resultUri) {\n              img.attr('src', resultUri);\n            }\n          });\n        });\n      });\n      return {\n        blobCache: blobCache,\n        addFilter: addFilter,\n        uploadImages: uploadImages,\n        uploadImagesAuto: uploadImagesAuto,\n        scanForImages: scanForImages,\n        destroy: destroy\n      };\n    };\n\n    var get = function (dom) {\n      var formats = {\n        valigntop: [{\n            selector: 'td,th',\n            styles: { verticalAlign: 'top' }\n          }],\n        valignmiddle: [{\n            selector: 'td,th',\n            styles: { verticalAlign: 'middle' }\n          }],\n        valignbottom: [{\n            selector: 'td,th',\n            styles: { verticalAlign: 'bottom' }\n          }],\n        alignleft: [\n          {\n            selector: 'figure.image',\n            collapsed: false,\n            classes: 'align-left',\n            ceFalseOverride: true,\n            preview: 'font-family font-size'\n          },\n          {\n            selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n            styles: { textAlign: 'left' },\n            inherit: false,\n            preview: false,\n            defaultBlock: 'div'\n          },\n          {\n            selector: 'img,table,audio,video',\n            collapsed: false,\n            styles: { float: 'left' },\n            preview: 'font-family font-size'\n          }\n        ],\n        aligncenter: [\n          {\n            selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n            styles: { textAlign: 'center' },\n            inherit: false,\n            preview: 'font-family font-size',\n            defaultBlock: 'div'\n          },\n          {\n            selector: 'figure.image',\n            collapsed: false,\n            classes: 'align-center',\n            ceFalseOverride: true,\n            preview: 'font-family font-size'\n          },\n          {\n            selector: 'img,audio,video',\n            collapsed: false,\n            styles: {\n              display: 'block',\n              marginLeft: 'auto',\n              marginRight: 'auto'\n            },\n            preview: false\n          },\n          {\n            selector: 'table',\n            collapsed: false,\n            styles: {\n              marginLeft: 'auto',\n              marginRight: 'auto'\n            },\n            preview: 'font-family font-size'\n          }\n        ],\n        alignright: [\n          {\n            selector: 'figure.image',\n            collapsed: false,\n            classes: 'align-right',\n            ceFalseOverride: true,\n            preview: 'font-family font-size'\n          },\n          {\n            selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n            styles: { textAlign: 'right' },\n            inherit: false,\n            preview: 'font-family font-size',\n            defaultBlock: 'div'\n          },\n          {\n            selector: 'img,table,audio,video',\n            collapsed: false,\n            styles: { float: 'right' },\n            preview: 'font-family font-size'\n          }\n        ],\n        alignjustify: [{\n            selector: 'figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li',\n            styles: { textAlign: 'justify' },\n            inherit: false,\n            defaultBlock: 'div',\n            preview: 'font-family font-size'\n          }],\n        bold: [\n          {\n            inline: 'strong',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          },\n          {\n            inline: 'span',\n            styles: { fontWeight: 'bold' }\n          },\n          {\n            inline: 'b',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          }\n        ],\n        italic: [\n          {\n            inline: 'em',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          },\n          {\n            inline: 'span',\n            styles: { fontStyle: 'italic' }\n          },\n          {\n            inline: 'i',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          }\n        ],\n        underline: [\n          {\n            inline: 'span',\n            styles: { textDecoration: 'underline' },\n            exact: true\n          },\n          {\n            inline: 'u',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          }\n        ],\n        strikethrough: [\n          {\n            inline: 'span',\n            styles: { textDecoration: 'line-through' },\n            exact: true\n          },\n          {\n            inline: 'strike',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          },\n          {\n            inline: 's',\n            remove: 'all',\n            preserve_attributes: [\n              'class',\n              'style'\n            ]\n          }\n        ],\n        forecolor: {\n          inline: 'span',\n          styles: { color: '%value' },\n          links: true,\n          remove_similar: true,\n          clear_child_styles: true\n        },\n        hilitecolor: {\n          inline: 'span',\n          styles: { backgroundColor: '%value' },\n          links: true,\n          remove_similar: true,\n          clear_child_styles: true\n        },\n        fontname: {\n          inline: 'span',\n          toggle: false,\n          styles: { fontFamily: '%value' },\n          clear_child_styles: true\n        },\n        fontsize: {\n          inline: 'span',\n          toggle: false,\n          styles: { fontSize: '%value' },\n          clear_child_styles: true\n        },\n        lineheight: {\n          selector: 'h1,h2,h3,h4,h5,h6,p,li,td,th,div',\n          defaultBlock: 'p',\n          styles: { lineHeight: '%value' }\n        },\n        fontsize_class: {\n          inline: 'span',\n          attributes: { class: '%value' }\n        },\n        blockquote: {\n          block: 'blockquote',\n          wrapper: true,\n          remove: 'all'\n        },\n        subscript: { inline: 'sub' },\n        superscript: { inline: 'sup' },\n        code: { inline: 'code' },\n        link: {\n          inline: 'a',\n          selector: 'a',\n          remove: 'all',\n          split: true,\n          deep: true,\n          onmatch: function (node, _fmt, _itemName) {\n            return isElement$5(node) && node.hasAttribute('href');\n          },\n          onformat: function (elm, _fmt, vars) {\n            Tools.each(vars, function (value, key) {\n              dom.setAttrib(elm, key, value);\n            });\n          }\n        },\n        lang: {\n          inline: 'span',\n          clear_child_styles: true,\n          remove_similar: true,\n          attributes: {\n            'lang': '%value',\n            'data-mce-lang': function (vars) {\n              var _a;\n              return (_a = vars === null || vars === void 0 ? void 0 : vars.customValue) !== null && _a !== void 0 ? _a : null;\n            }\n          }\n        },\n        removeformat: [\n          {\n            selector: 'b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small',\n            remove: 'all',\n            split: true,\n            expand: false,\n            block_expand: true,\n            deep: true\n          },\n          {\n            selector: 'span',\n            attributes: [\n              'style',\n              'class'\n            ],\n            remove: 'empty',\n            split: true,\n            expand: false,\n            deep: true\n          },\n          {\n            selector: '*',\n            attributes: [\n              'style',\n              'class'\n            ],\n            split: false,\n            expand: false,\n            deep: true\n          }\n        ]\n      };\n      Tools.each('p h1 h2 h3 h4 h5 h6 div address pre dt dd samp'.split(/\\s/), function (name) {\n        formats[name] = {\n          block: name,\n          remove: 'all'\n        };\n      });\n      return formats;\n    };\n\n    var FormatRegistry = function (editor) {\n      var formats = {};\n      var get$1 = function (name) {\n        return isNonNullable(name) ? formats[name] : formats;\n      };\n      var has = function (name) {\n        return has$2(formats, name);\n      };\n      var register = function (name, format) {\n        if (name) {\n          if (!isString$1(name)) {\n            each$j(name, function (format, name) {\n              register(name, format);\n            });\n          } else {\n            if (!isArray$1(format)) {\n              format = [format];\n            }\n            each$k(format, function (format) {\n              if (isUndefined(format.deep)) {\n                format.deep = !isSelectorFormat(format);\n              }\n              if (isUndefined(format.split)) {\n                format.split = !isSelectorFormat(format) || isInlineFormat(format);\n              }\n              if (isUndefined(format.remove) && isSelectorFormat(format) && !isInlineFormat(format)) {\n                format.remove = 'none';\n              }\n              if (isSelectorFormat(format) && isInlineFormat(format)) {\n                format.mixed = true;\n                format.block_expand = true;\n              }\n              if (isString$1(format.classes)) {\n                format.classes = format.classes.split(/\\s+/);\n              }\n            });\n            formats[name] = format;\n          }\n        }\n      };\n      var unregister = function (name) {\n        if (name && formats[name]) {\n          delete formats[name];\n        }\n        return formats;\n      };\n      register(get(editor.dom));\n      register(getFormats(editor));\n      return {\n        get: get$1,\n        has: has,\n        register: register,\n        unregister: unregister\n      };\n    };\n\n    var each$5 = Tools.each;\n    var dom = DOMUtils.DOM;\n    var parsedSelectorToHtml = function (ancestry, editor) {\n      var elm, item, fragment;\n      var schema = editor && editor.schema || Schema({});\n      var decorate = function (elm, item) {\n        if (item.classes.length) {\n          dom.addClass(elm, item.classes.join(' '));\n        }\n        dom.setAttribs(elm, item.attrs);\n      };\n      var createElement = function (sItem) {\n        item = typeof sItem === 'string' ? {\n          name: sItem,\n          classes: [],\n          attrs: {}\n        } : sItem;\n        var elm = dom.create(item.name);\n        decorate(elm, item);\n        return elm;\n      };\n      var getRequiredParent = function (elm, candidate) {\n        var name = typeof elm !== 'string' ? elm.nodeName.toLowerCase() : elm;\n        var elmRule = schema.getElementRule(name);\n        var parentsRequired = elmRule && elmRule.parentsRequired;\n        if (parentsRequired && parentsRequired.length) {\n          return candidate && Tools.inArray(parentsRequired, candidate) !== -1 ? candidate : parentsRequired[0];\n        } else {\n          return false;\n        }\n      };\n      var wrapInHtml = function (elm, ancestry, siblings) {\n        var parent, parentCandidate;\n        var ancestor = ancestry.length > 0 && ancestry[0];\n        var ancestorName = ancestor && ancestor.name;\n        var parentRequired = getRequiredParent(elm, ancestorName);\n        if (parentRequired) {\n          if (ancestorName === parentRequired) {\n            parentCandidate = ancestry[0];\n            ancestry = ancestry.slice(1);\n          } else {\n            parentCandidate = parentRequired;\n          }\n        } else if (ancestor) {\n          parentCandidate = ancestry[0];\n          ancestry = ancestry.slice(1);\n        } else if (!siblings) {\n          return elm;\n        }\n        if (parentCandidate) {\n          parent = createElement(parentCandidate);\n          parent.appendChild(elm);\n        }\n        if (siblings) {\n          if (!parent) {\n            parent = dom.create('div');\n            parent.appendChild(elm);\n          }\n          Tools.each(siblings, function (sibling) {\n            var siblingElm = createElement(sibling);\n            parent.insertBefore(siblingElm, elm);\n          });\n        }\n        return wrapInHtml(parent, ancestry, parentCandidate && parentCandidate.siblings);\n      };\n      if (ancestry && ancestry.length) {\n        item = ancestry[0];\n        elm = createElement(item);\n        fragment = dom.create('div');\n        fragment.appendChild(wrapInHtml(elm, ancestry.slice(1), item.siblings));\n        return fragment;\n      } else {\n        return '';\n      }\n    };\n    var parseSelectorItem = function (item) {\n      var tagName;\n      var obj = {\n        classes: [],\n        attrs: {}\n      };\n      item = obj.selector = Tools.trim(item);\n      if (item !== '*') {\n        tagName = item.replace(/(?:([#\\.]|::?)([\\w\\-]+)|(\\[)([^\\]]+)\\]?)/g, function ($0, $1, $2, $3, $4) {\n          switch ($1) {\n          case '#':\n            obj.attrs.id = $2;\n            break;\n          case '.':\n            obj.classes.push($2);\n            break;\n          case ':':\n            if (Tools.inArray('checked disabled enabled read-only required'.split(' '), $2) !== -1) {\n              obj.attrs[$2] = $2;\n            }\n            break;\n          }\n          if ($3 === '[') {\n            var m = $4.match(/([\\w\\-]+)(?:\\=\\\"([^\\\"]+))?/);\n            if (m) {\n              obj.attrs[m[1]] = m[2];\n            }\n          }\n          return '';\n        });\n      }\n      obj.name = tagName || 'div';\n      return obj;\n    };\n    var parseSelector = function (selector) {\n      if (!selector || typeof selector !== 'string') {\n        return [];\n      }\n      selector = selector.split(/\\s*,\\s*/)[0];\n      selector = selector.replace(/\\s*(~\\+|~|\\+|>)\\s*/g, '$1');\n      return Tools.map(selector.split(/(?:>|\\s+(?![^\\[\\]]+\\]))/), function (item) {\n        var siblings = Tools.map(item.split(/(?:~\\+|~|\\+)/), parseSelectorItem);\n        var obj = siblings.pop();\n        if (siblings.length) {\n          obj.siblings = siblings;\n        }\n        return obj;\n      }).reverse();\n    };\n    var getCssText = function (editor, format) {\n      var name, previewFrag;\n      var previewCss = '', parentFontSize;\n      var previewStyles = getPreviewStyles(editor);\n      if (previewStyles === '') {\n        return '';\n      }\n      var removeVars = function (val) {\n        return val.replace(/%(\\w+)/g, '');\n      };\n      if (typeof format === 'string') {\n        format = editor.formatter.get(format);\n        if (!format) {\n          return;\n        }\n        format = format[0];\n      }\n      if ('preview' in format) {\n        var previewOpt = get$9(format, 'preview');\n        if (is$1(previewOpt, false)) {\n          return '';\n        } else {\n          previewStyles = previewOpt.getOr(previewStyles);\n        }\n      }\n      name = format.block || format.inline || 'span';\n      var items = parseSelector(format.selector);\n      if (items.length) {\n        if (!items[0].name) {\n          items[0].name = name;\n        }\n        name = format.selector;\n        previewFrag = parsedSelectorToHtml(items, editor);\n      } else {\n        previewFrag = parsedSelectorToHtml([name], editor);\n      }\n      var previewElm = dom.select(name, previewFrag)[0] || previewFrag.firstChild;\n      each$5(format.styles, function (value, name) {\n        var newValue = removeVars(value);\n        if (newValue) {\n          dom.setStyle(previewElm, name, newValue);\n        }\n      });\n      each$5(format.attributes, function (value, name) {\n        var newValue = removeVars(value);\n        if (newValue) {\n          dom.setAttrib(previewElm, name, newValue);\n        }\n      });\n      each$5(format.classes, function (value) {\n        var newValue = removeVars(value);\n        if (!dom.hasClass(previewElm, newValue)) {\n          dom.addClass(previewElm, newValue);\n        }\n      });\n      editor.fire('PreviewFormats');\n      dom.setStyles(previewFrag, {\n        position: 'absolute',\n        left: -65535\n      });\n      editor.getBody().appendChild(previewFrag);\n      parentFontSize = dom.getStyle(editor.getBody(), 'fontSize', true);\n      parentFontSize = /px$/.test(parentFontSize) ? parseInt(parentFontSize, 10) : 0;\n      each$5(previewStyles.split(' '), function (name) {\n        var value = dom.getStyle(previewElm, name, true);\n        if (name === 'background-color' && /transparent|rgba\\s*\\([^)]+,\\s*0\\)/.test(value)) {\n          value = dom.getStyle(editor.getBody(), name, true);\n          if (dom.toHex(value).toLowerCase() === '#ffffff') {\n            return;\n          }\n        }\n        if (name === 'color') {\n          if (dom.toHex(value).toLowerCase() === '#000000') {\n            return;\n          }\n        }\n        if (name === 'font-size') {\n          if (/em|%$/.test(value)) {\n            if (parentFontSize === 0) {\n              return;\n            }\n            var numValue = parseFloat(value) / (/%$/.test(value) ? 100 : 1);\n            value = numValue * parentFontSize + 'px';\n          }\n        }\n        if (name === 'border' && value) {\n          previewCss += 'padding:0 2px;';\n        }\n        previewCss += name + ':' + value + ';';\n      });\n      editor.fire('AfterPreviewFormats');\n      dom.remove(previewFrag);\n      return previewCss;\n    };\n\n    var setup$h = function (editor) {\n      editor.addShortcut('meta+b', '', 'Bold');\n      editor.addShortcut('meta+i', '', 'Italic');\n      editor.addShortcut('meta+u', '', 'Underline');\n      for (var i = 1; i <= 6; i++) {\n        editor.addShortcut('access+' + i, '', [\n          'FormatBlock',\n          false,\n          'h' + i\n        ]);\n      }\n      editor.addShortcut('access+7', '', [\n        'FormatBlock',\n        false,\n        'p'\n      ]);\n      editor.addShortcut('access+8', '', [\n        'FormatBlock',\n        false,\n        'div'\n      ]);\n      editor.addShortcut('access+9', '', [\n        'FormatBlock',\n        false,\n        'address'\n      ]);\n    };\n\n    var Formatter = function (editor) {\n      var formats = FormatRegistry(editor);\n      var formatChangeState = Cell(null);\n      setup$h(editor);\n      setup$k(editor);\n      return {\n        get: formats.get,\n        has: formats.has,\n        register: formats.register,\n        unregister: formats.unregister,\n        apply: function (name, vars, node) {\n          applyFormat(editor, name, vars, node);\n        },\n        remove: function (name, vars, node, similar) {\n          removeFormat(editor, name, vars, node, similar);\n        },\n        toggle: function (name, vars, node) {\n          toggleFormat(editor, name, vars, node);\n        },\n        match: function (name, vars, node, similar) {\n          return matchFormat(editor, name, vars, node, similar);\n        },\n        closest: function (names) {\n          return closestFormat(editor, names);\n        },\n        matchAll: function (names, vars) {\n          return matchAllFormats(editor, names, vars);\n        },\n        matchNode: function (node, name, vars, similar) {\n          return matchNodeFormat(editor, node, name, vars, similar);\n        },\n        canApply: function (name) {\n          return canApplyFormat(editor, name);\n        },\n        formatChanged: function (formats, callback, similar, vars) {\n          return formatChanged(editor, formatChangeState, formats, callback, similar, vars);\n        },\n        getCssText: curry(getCssText, editor)\n      };\n    };\n\n    var shouldIgnoreCommand = function (cmd) {\n      switch (cmd.toLowerCase()) {\n      case 'undo':\n      case 'redo':\n      case 'mcerepaint':\n      case 'mcefocus':\n        return true;\n      default:\n        return false;\n      }\n    };\n    var registerEvents = function (editor, undoManager, locks) {\n      var isFirstTypedCharacter = Cell(false);\n      var addNonTypingUndoLevel = function (e) {\n        setTyping(undoManager, false, locks);\n        undoManager.add({}, e);\n      };\n      editor.on('init', function () {\n        undoManager.add();\n      });\n      editor.on('BeforeExecCommand', function (e) {\n        var cmd = e.command;\n        if (!shouldIgnoreCommand(cmd)) {\n          endTyping(undoManager, locks);\n          undoManager.beforeChange();\n        }\n      });\n      editor.on('ExecCommand', function (e) {\n        var cmd = e.command;\n        if (!shouldIgnoreCommand(cmd)) {\n          addNonTypingUndoLevel(e);\n        }\n      });\n      editor.on('ObjectResizeStart cut', function () {\n        undoManager.beforeChange();\n      });\n      editor.on('SaveContent ObjectResized blur', addNonTypingUndoLevel);\n      editor.on('dragend', addNonTypingUndoLevel);\n      editor.on('keyup', function (e) {\n        var keyCode = e.keyCode;\n        if (e.isDefaultPrevented()) {\n          return;\n        }\n        if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45 || e.ctrlKey) {\n          addNonTypingUndoLevel();\n          editor.nodeChanged();\n        }\n        if (keyCode === 46 || keyCode === 8) {\n          editor.nodeChanged();\n        }\n        if (isFirstTypedCharacter.get() && undoManager.typing && isEq$1(createFromEditor(editor), undoManager.data[0]) === false) {\n          if (editor.isDirty() === false) {\n            editor.setDirty(true);\n            editor.fire('change', {\n              level: undoManager.data[0],\n              lastLevel: null\n            });\n          }\n          editor.fire('TypingUndo');\n          isFirstTypedCharacter.set(false);\n          editor.nodeChanged();\n        }\n      });\n      editor.on('keydown', function (e) {\n        var keyCode = e.keyCode;\n        if (e.isDefaultPrevented()) {\n          return;\n        }\n        if (keyCode >= 33 && keyCode <= 36 || keyCode >= 37 && keyCode <= 40 || keyCode === 45) {\n          if (undoManager.typing) {\n            addNonTypingUndoLevel(e);\n          }\n          return;\n        }\n        var modKey = e.ctrlKey && !e.altKey || e.metaKey;\n        if ((keyCode < 16 || keyCode > 20) && keyCode !== 224 && keyCode !== 91 && !undoManager.typing && !modKey) {\n          undoManager.beforeChange();\n          setTyping(undoManager, true, locks);\n          undoManager.add({}, e);\n          isFirstTypedCharacter.set(true);\n        }\n      });\n      editor.on('mousedown', function (e) {\n        if (undoManager.typing) {\n          addNonTypingUndoLevel(e);\n        }\n      });\n      var isInsertReplacementText = function (event) {\n        return event.inputType === 'insertReplacementText';\n      };\n      var isInsertTextDataNull = function (event) {\n        return event.inputType === 'insertText' && event.data === null;\n      };\n      var isInsertFromPasteOrDrop = function (event) {\n        return event.inputType === 'insertFromPaste' || event.inputType === 'insertFromDrop';\n      };\n      editor.on('input', function (e) {\n        if (e.inputType && (isInsertReplacementText(e) || isInsertTextDataNull(e) || isInsertFromPasteOrDrop(e))) {\n          addNonTypingUndoLevel(e);\n        }\n      });\n      editor.on('AddUndo Undo Redo ClearUndos', function (e) {\n        if (!e.isDefaultPrevented()) {\n          editor.nodeChanged();\n        }\n      });\n    };\n    var addKeyboardShortcuts = function (editor) {\n      editor.addShortcut('meta+z', '', 'Undo');\n      editor.addShortcut('meta+y,meta+shift+z', '', 'Redo');\n    };\n\n    var UndoManager = function (editor) {\n      var beforeBookmark = value();\n      var locks = Cell(0);\n      var index = Cell(0);\n      var undoManager = {\n        data: [],\n        typing: false,\n        beforeChange: function () {\n          beforeChange(editor, locks, beforeBookmark);\n        },\n        add: function (level, event) {\n          return addUndoLevel(editor, undoManager, index, locks, beforeBookmark, level, event);\n        },\n        undo: function () {\n          return undo(editor, undoManager, locks, index);\n        },\n        redo: function () {\n          return redo(editor, index, undoManager.data);\n        },\n        clear: function () {\n          clear(editor, undoManager, index);\n        },\n        reset: function () {\n          reset(editor, undoManager);\n        },\n        hasUndo: function () {\n          return hasUndo(editor, undoManager, index);\n        },\n        hasRedo: function () {\n          return hasRedo(editor, undoManager, index);\n        },\n        transact: function (callback) {\n          return transact(editor, undoManager, locks, callback);\n        },\n        ignore: function (callback) {\n          ignore(editor, locks, callback);\n        },\n        extra: function (callback1, callback2) {\n          extra(editor, undoManager, index, callback1, callback2);\n        }\n      };\n      if (!isRtc(editor)) {\n        registerEvents(editor, undoManager, locks);\n      }\n      addKeyboardShortcuts(editor);\n      return undoManager;\n    };\n\n    var nonTypingKeycodes = [\n      9,\n      27,\n      VK.HOME,\n      VK.END,\n      19,\n      20,\n      44,\n      144,\n      145,\n      33,\n      34,\n      45,\n      16,\n      17,\n      18,\n      91,\n      92,\n      93,\n      VK.DOWN,\n      VK.UP,\n      VK.LEFT,\n      VK.RIGHT\n    ].concat(Env.browser.isFirefox() ? [224] : []);\n    var placeholderAttr = 'data-mce-placeholder';\n    var isKeyboardEvent = function (e) {\n      return e.type === 'keydown' || e.type === 'keyup';\n    };\n    var isDeleteEvent = function (e) {\n      var keyCode = e.keyCode;\n      return keyCode === VK.BACKSPACE || keyCode === VK.DELETE;\n    };\n    var isNonTypingKeyboardEvent = function (e) {\n      if (isKeyboardEvent(e)) {\n        var keyCode = e.keyCode;\n        return !isDeleteEvent(e) && (VK.metaKeyPressed(e) || e.altKey || keyCode >= 112 && keyCode <= 123 || contains$3(nonTypingKeycodes, keyCode));\n      } else {\n        return false;\n      }\n    };\n    var isTypingKeyboardEvent = function (e) {\n      return isKeyboardEvent(e) && !(isDeleteEvent(e) || e.type === 'keyup' && e.keyCode === 229);\n    };\n    var isVisuallyEmpty = function (dom, rootElm, forcedRootBlock) {\n      if (isEmpty$2(SugarElement.fromDom(rootElm), false)) {\n        var isForcedRootBlockFalse = forcedRootBlock === '';\n        var firstElement = rootElm.firstElementChild;\n        if (!firstElement) {\n          return true;\n        } else if (dom.getStyle(rootElm.firstElementChild, 'padding-left') || dom.getStyle(rootElm.firstElementChild, 'padding-right')) {\n          return false;\n        } else {\n          return isForcedRootBlockFalse ? !dom.isBlock(firstElement) : forcedRootBlock === firstElement.nodeName.toLowerCase();\n        }\n      } else {\n        return false;\n      }\n    };\n    var setup$g = function (editor) {\n      var dom = editor.dom;\n      var rootBlock = getForcedRootBlock(editor);\n      var placeholder = getPlaceholder(editor);\n      var updatePlaceholder = function (e, initial) {\n        if (isNonTypingKeyboardEvent(e)) {\n          return;\n        }\n        var body = editor.getBody();\n        var showPlaceholder = isTypingKeyboardEvent(e) ? false : isVisuallyEmpty(dom, body, rootBlock);\n        var isPlaceholderShown = dom.getAttrib(body, placeholderAttr) !== '';\n        if (isPlaceholderShown !== showPlaceholder || initial) {\n          dom.setAttrib(body, placeholderAttr, showPlaceholder ? placeholder : null);\n          dom.setAttrib(body, 'aria-placeholder', showPlaceholder ? placeholder : null);\n          firePlaceholderToggle(editor, showPlaceholder);\n          editor.on(showPlaceholder ? 'keydown' : 'keyup', updatePlaceholder);\n          editor.off(showPlaceholder ? 'keyup' : 'keydown', updatePlaceholder);\n        }\n      };\n      if (placeholder) {\n        editor.on('init', function (e) {\n          updatePlaceholder(e, true);\n          editor.on('change SetContent ExecCommand', updatePlaceholder);\n          editor.on('paste', function (e) {\n            return Delay.setEditorTimeout(editor, function () {\n              return updatePlaceholder(e);\n            });\n          });\n        });\n      }\n    };\n\n    var strongRtl = /[\\u0591-\\u07FF\\uFB1D-\\uFDFF\\uFE70-\\uFEFC]/;\n    var hasStrongRtl = function (text) {\n      return strongRtl.test(text);\n    };\n\n    var isInlineTarget = function (editor, elm) {\n      return is$2(SugarElement.fromDom(elm), getInlineBoundarySelector(editor));\n    };\n    var isRtl = function (element) {\n      return DOMUtils.DOM.getStyle(element, 'direction', true) === 'rtl' || hasStrongRtl(element.textContent);\n    };\n    var findInlineParents = function (isInlineTarget, rootNode, pos) {\n      return filter$4(DOMUtils.DOM.getParents(pos.container(), '*', rootNode), isInlineTarget);\n    };\n    var findRootInline = function (isInlineTarget, rootNode, pos) {\n      var parents = findInlineParents(isInlineTarget, rootNode, pos);\n      return Optional.from(parents[parents.length - 1]);\n    };\n    var hasSameParentBlock = function (rootNode, node1, node2) {\n      var block1 = getParentBlock$2(node1, rootNode);\n      var block2 = getParentBlock$2(node2, rootNode);\n      return block1 && block1 === block2;\n    };\n    var isAtZwsp = function (pos) {\n      return isBeforeInline(pos) || isAfterInline(pos);\n    };\n    var normalizePosition = function (forward, pos) {\n      if (!pos) {\n        return pos;\n      }\n      var container = pos.container(), offset = pos.offset();\n      if (forward) {\n        if (isCaretContainerInline(container)) {\n          if (isText$7(container.nextSibling)) {\n            return CaretPosition(container.nextSibling, 0);\n          } else {\n            return CaretPosition.after(container);\n          }\n        } else {\n          return isBeforeInline(pos) ? CaretPosition(container, offset + 1) : pos;\n        }\n      } else {\n        if (isCaretContainerInline(container)) {\n          if (isText$7(container.previousSibling)) {\n            return CaretPosition(container.previousSibling, container.previousSibling.data.length);\n          } else {\n            return CaretPosition.before(container);\n          }\n        } else {\n          return isAfterInline(pos) ? CaretPosition(container, offset - 1) : pos;\n        }\n      }\n    };\n    var normalizeForwards = curry(normalizePosition, true);\n    var normalizeBackwards = curry(normalizePosition, false);\n\n    var isBeforeRoot = function (rootNode) {\n      return function (elm) {\n        return eq(rootNode, SugarElement.fromDom(elm.dom.parentNode));\n      };\n    };\n    var isTextBlockOrListItem = function (element) {\n      return isTextBlock$2(element) || isListItem(element);\n    };\n    var getParentBlock$1 = function (rootNode, elm) {\n      if (contains$1(rootNode, elm)) {\n        return closest$3(elm, isTextBlockOrListItem, isBeforeRoot(rootNode));\n      } else {\n        return Optional.none();\n      }\n    };\n    var placeCaretInEmptyBody = function (editor) {\n      var body = editor.getBody();\n      var node = body.firstChild && editor.dom.isBlock(body.firstChild) ? body.firstChild : body;\n      editor.selection.setCursorLocation(node, 0);\n    };\n    var paddEmptyBody = function (editor) {\n      if (editor.dom.isEmpty(editor.getBody())) {\n        editor.setContent('');\n        placeCaretInEmptyBody(editor);\n      }\n    };\n    var willDeleteLastPositionInElement = function (forward, fromPos, elm) {\n      return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) {\n        var normalizedFirstPos = normalizePosition(true, firstPos);\n        var normalizedLastPos = normalizePosition(false, lastPos);\n        var normalizedFromPos = normalizePosition(false, fromPos);\n        if (forward) {\n          return nextPosition(elm, normalizedFromPos).exists(function (nextPos) {\n            return nextPos.isEqual(normalizedLastPos) && fromPos.isEqual(normalizedFirstPos);\n          });\n        } else {\n          return prevPosition(elm, normalizedFromPos).exists(function (prevPos) {\n            return prevPos.isEqual(normalizedFirstPos) && fromPos.isEqual(normalizedLastPos);\n          });\n        }\n      }).getOr(true);\n    };\n\n    var blockPosition = function (block, position) {\n      return {\n        block: block,\n        position: position\n      };\n    };\n    var blockBoundary = function (from, to) {\n      return {\n        from: from,\n        to: to\n      };\n    };\n    var getBlockPosition = function (rootNode, pos) {\n      var rootElm = SugarElement.fromDom(rootNode);\n      var containerElm = SugarElement.fromDom(pos.container());\n      return getParentBlock$1(rootElm, containerElm).map(function (block) {\n        return blockPosition(block, pos);\n      });\n    };\n    var isDifferentBlocks = function (blockBoundary) {\n      return eq(blockBoundary.from.block, blockBoundary.to.block) === false;\n    };\n    var hasSameParent = function (blockBoundary) {\n      return parent(blockBoundary.from.block).bind(function (parent1) {\n        return parent(blockBoundary.to.block).filter(function (parent2) {\n          return eq(parent1, parent2);\n        });\n      }).isSome();\n    };\n    var isEditable$1 = function (blockBoundary) {\n      return isContentEditableFalse$b(blockBoundary.from.block.dom) === false && isContentEditableFalse$b(blockBoundary.to.block.dom) === false;\n    };\n    var skipLastBr = function (rootNode, forward, blockPosition) {\n      if (isBr$5(blockPosition.position.getNode()) && isEmpty$2(blockPosition.block) === false) {\n        return positionIn(false, blockPosition.block.dom).bind(function (lastPositionInBlock) {\n          if (lastPositionInBlock.isEqual(blockPosition.position)) {\n            return fromPosition(forward, rootNode, lastPositionInBlock).bind(function (to) {\n              return getBlockPosition(rootNode, to);\n            });\n          } else {\n            return Optional.some(blockPosition);\n          }\n        }).getOr(blockPosition);\n      } else {\n        return blockPosition;\n      }\n    };\n    var readFromRange = function (rootNode, forward, rng) {\n      var fromBlockPos = getBlockPosition(rootNode, CaretPosition.fromRangeStart(rng));\n      var toBlockPos = fromBlockPos.bind(function (blockPos) {\n        return fromPosition(forward, rootNode, blockPos.position).bind(function (to) {\n          return getBlockPosition(rootNode, to).map(function (blockPos) {\n            return skipLastBr(rootNode, forward, blockPos);\n          });\n        });\n      });\n      return lift2(fromBlockPos, toBlockPos, blockBoundary).filter(function (blockBoundary) {\n        return isDifferentBlocks(blockBoundary) && hasSameParent(blockBoundary) && isEditable$1(blockBoundary);\n      });\n    };\n    var read$1 = function (rootNode, forward, rng) {\n      return rng.collapsed ? readFromRange(rootNode, forward, rng) : Optional.none();\n    };\n\n    var getChildrenUntilBlockBoundary = function (block) {\n      var children$1 = children(block);\n      return findIndex$2(children$1, isBlock$2).fold(constant(children$1), function (index) {\n        return children$1.slice(0, index);\n      });\n    };\n    var extractChildren = function (block) {\n      var children = getChildrenUntilBlockBoundary(block);\n      each$k(children, remove$7);\n      return children;\n    };\n    var removeEmptyRoot = function (rootNode, block) {\n      var parents = parentsAndSelf(block, rootNode);\n      return find$3(parents.reverse(), function (element) {\n        return isEmpty$2(element);\n      }).each(remove$7);\n    };\n    var isEmptyBefore = function (el) {\n      return filter$4(prevSiblings(el), function (el) {\n        return !isEmpty$2(el);\n      }).length === 0;\n    };\n    var nestedBlockMerge = function (rootNode, fromBlock, toBlock, insertionPoint) {\n      if (isEmpty$2(toBlock)) {\n        fillWithPaddingBr(toBlock);\n        return firstPositionIn(toBlock.dom);\n      }\n      if (isEmptyBefore(insertionPoint) && isEmpty$2(fromBlock)) {\n        before$4(insertionPoint, SugarElement.fromTag('br'));\n      }\n      var position = prevPosition(toBlock.dom, CaretPosition.before(insertionPoint.dom));\n      each$k(extractChildren(fromBlock), function (child) {\n        before$4(insertionPoint, child);\n      });\n      removeEmptyRoot(rootNode, fromBlock);\n      return position;\n    };\n    var sidelongBlockMerge = function (rootNode, fromBlock, toBlock) {\n      if (isEmpty$2(toBlock)) {\n        remove$7(toBlock);\n        if (isEmpty$2(fromBlock)) {\n          fillWithPaddingBr(fromBlock);\n        }\n        return firstPositionIn(fromBlock.dom);\n      }\n      var position = lastPositionIn(toBlock.dom);\n      each$k(extractChildren(fromBlock), function (child) {\n        append$1(toBlock, child);\n      });\n      removeEmptyRoot(rootNode, fromBlock);\n      return position;\n    };\n    var findInsertionPoint = function (toBlock, block) {\n      var parentsAndSelf$1 = parentsAndSelf(block, toBlock);\n      return Optional.from(parentsAndSelf$1[parentsAndSelf$1.length - 1]);\n    };\n    var getInsertionPoint = function (fromBlock, toBlock) {\n      return contains$1(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Optional.none();\n    };\n    var trimBr = function (first, block) {\n      positionIn(first, block.dom).map(function (position) {\n        return position.getNode();\n      }).map(SugarElement.fromDom).filter(isBr$4).each(remove$7);\n    };\n    var mergeBlockInto = function (rootNode, fromBlock, toBlock) {\n      trimBr(true, fromBlock);\n      trimBr(false, toBlock);\n      return getInsertionPoint(fromBlock, toBlock).fold(curry(sidelongBlockMerge, rootNode, fromBlock, toBlock), curry(nestedBlockMerge, rootNode, fromBlock, toBlock));\n    };\n    var mergeBlocks = function (rootNode, forward, block1, block2) {\n      return forward ? mergeBlockInto(rootNode, block2, block1) : mergeBlockInto(rootNode, block1, block2);\n    };\n\n    var backspaceDelete$8 = function (editor, forward) {\n      var rootNode = SugarElement.fromDom(editor.getBody());\n      var position = read$1(rootNode.dom, forward, editor.selection.getRng()).bind(function (blockBoundary) {\n        return mergeBlocks(rootNode, forward, blockBoundary.from.block, blockBoundary.to.block);\n      });\n      position.each(function (pos) {\n        editor.selection.setRng(pos.toRange());\n      });\n      return position.isSome();\n    };\n\n    var deleteRangeMergeBlocks = function (rootNode, selection) {\n      var rng = selection.getRng();\n      return lift2(getParentBlock$1(rootNode, SugarElement.fromDom(rng.startContainer)), getParentBlock$1(rootNode, SugarElement.fromDom(rng.endContainer)), function (block1, block2) {\n        if (eq(block1, block2) === false) {\n          rng.deleteContents();\n          mergeBlocks(rootNode, true, block1, block2).each(function (pos) {\n            selection.setRng(pos.toRange());\n          });\n          return true;\n        } else {\n          return false;\n        }\n      }).getOr(false);\n    };\n    var isRawNodeInTable = function (root, rawNode) {\n      var node = SugarElement.fromDom(rawNode);\n      var isRoot = curry(eq, root);\n      return ancestor$3(node, isTableCell$4, isRoot).isSome();\n    };\n    var isSelectionInTable = function (root, rng) {\n      return isRawNodeInTable(root, rng.startContainer) || isRawNodeInTable(root, rng.endContainer);\n    };\n    var isEverythingSelected = function (root, rng) {\n      var noPrevious = prevPosition(root.dom, CaretPosition.fromRangeStart(rng)).isNone();\n      var noNext = nextPosition(root.dom, CaretPosition.fromRangeEnd(rng)).isNone();\n      return !isSelectionInTable(root, rng) && noPrevious && noNext;\n    };\n    var emptyEditor = function (editor) {\n      editor.setContent('');\n      editor.selection.setCursorLocation();\n      return true;\n    };\n    var deleteRange$1 = function (editor) {\n      var rootNode = SugarElement.fromDom(editor.getBody());\n      var rng = editor.selection.getRng();\n      return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection);\n    };\n    var backspaceDelete$7 = function (editor, _forward) {\n      return editor.selection.isCollapsed() ? false : deleteRange$1(editor);\n    };\n\n    var isContentEditableTrue$2 = isContentEditableTrue$4;\n    var isContentEditableFalse$4 = isContentEditableFalse$b;\n    var showCaret = function (direction, editor, node, before, scrollIntoView) {\n      return Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));\n    };\n    var getNodeRange = function (node) {\n      var rng = node.ownerDocument.createRange();\n      rng.selectNode(node);\n      return rng;\n    };\n    var selectNode = function (editor, node) {\n      var e = editor.fire('BeforeObjectSelected', { target: node });\n      if (e.isDefaultPrevented()) {\n        return Optional.none();\n      }\n      return Optional.some(getNodeRange(node));\n    };\n    var renderCaretAtRange = function (editor, range, scrollIntoView) {\n      var normalizedRange = normalizeRange(1, editor.getBody(), range);\n      var caretPosition = CaretPosition.fromRangeStart(normalizedRange);\n      var caretPositionNode = caretPosition.getNode();\n      if (isInlineFakeCaretTarget(caretPositionNode)) {\n        return showCaret(1, editor, caretPositionNode, !caretPosition.isAtEnd(), false);\n      }\n      var caretPositionBeforeNode = caretPosition.getNode(true);\n      if (isInlineFakeCaretTarget(caretPositionBeforeNode)) {\n        return showCaret(1, editor, caretPositionBeforeNode, false, false);\n      }\n      var ceRoot = editor.dom.getParent(caretPosition.getNode(), function (node) {\n        return isContentEditableFalse$4(node) || isContentEditableTrue$2(node);\n      });\n      if (isInlineFakeCaretTarget(ceRoot)) {\n        return showCaret(1, editor, ceRoot, false, scrollIntoView);\n      }\n      return Optional.none();\n    };\n    var renderRangeCaret = function (editor, range, scrollIntoView) {\n      return range.collapsed ? renderCaretAtRange(editor, range, scrollIntoView).getOr(range) : range;\n    };\n\n    var isBeforeBoundary = function (pos) {\n      return isBeforeContentEditableFalse(pos) || isBeforeMedia(pos);\n    };\n    var isAfterBoundary = function (pos) {\n      return isAfterContentEditableFalse(pos) || isAfterMedia(pos);\n    };\n    var trimEmptyTextNode = function (dom, node) {\n      if (isText$7(node) && node.data.length === 0) {\n        dom.remove(node);\n      }\n    };\n    var deleteContentAndShowCaret = function (editor, range, node, direction, forward, peekCaretPosition) {\n      showCaret(direction, editor, peekCaretPosition.getNode(!forward), forward, true).each(function (caretRange) {\n        if (range.collapsed) {\n          var deleteRange = range.cloneRange();\n          if (forward) {\n            deleteRange.setEnd(caretRange.startContainer, caretRange.startOffset);\n          } else {\n            deleteRange.setStart(caretRange.endContainer, caretRange.endOffset);\n          }\n          deleteRange.deleteContents();\n        } else {\n          range.deleteContents();\n        }\n        editor.selection.setRng(caretRange);\n      });\n      trimEmptyTextNode(editor.dom, node);\n      return true;\n    };\n    var deleteBoundaryText = function (editor, forward) {\n      var range = editor.selection.getRng();\n      if (!isText$7(range.commonAncestorContainer)) {\n        return false;\n      }\n      var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n      var caretWalker = CaretWalker(editor.getBody());\n      var getNextPosFn = curry(getVisualCaretPosition, forward ? caretWalker.next : caretWalker.prev);\n      var isBeforeFn = forward ? isBeforeBoundary : isAfterBoundary;\n      var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n      var nextCaretPosition = normalizePosition(forward, getNextPosFn(caretPosition));\n      if (!nextCaretPosition || !isMoveInsideSameBlock(caretPosition, nextCaretPosition)) {\n        return false;\n      } else if (isBeforeFn(nextCaretPosition)) {\n        return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, nextCaretPosition);\n      }\n      var peekCaretPosition = getNextPosFn(nextCaretPosition);\n      if (peekCaretPosition && isBeforeFn(peekCaretPosition)) {\n        if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) {\n          return deleteContentAndShowCaret(editor, range, caretPosition.getNode(), direction, forward, peekCaretPosition);\n        }\n      }\n      return false;\n    };\n    var backspaceDelete$6 = function (editor, forward) {\n      return deleteBoundaryText(editor, forward);\n    };\n\n    var isCompoundElement = function (node) {\n      return isTableCell$4(SugarElement.fromDom(node)) || isListItem(SugarElement.fromDom(node));\n    };\n    var DeleteAction = Adt.generate([\n      { remove: ['element'] },\n      { moveToElement: ['element'] },\n      { moveToPosition: ['position'] }\n    ]);\n    var isAtContentEditableBlockCaret = function (forward, from) {\n      var elm = from.getNode(forward === false);\n      var caretLocation = forward ? 'after' : 'before';\n      return isElement$5(elm) && elm.getAttribute('data-mce-caret') === caretLocation;\n    };\n    var isDeleteFromCefDifferentBlocks = function (root, forward, from, to) {\n      var inSameBlock = function (elm) {\n        return isInline$1(SugarElement.fromDom(elm)) && !isInSameBlock(from, to, root);\n      };\n      return getRelativeCefElm(!forward, from).fold(function () {\n        return getRelativeCefElm(forward, to).fold(never, inSameBlock);\n      }, inSameBlock);\n    };\n    var deleteEmptyBlockOrMoveToCef = function (root, forward, from, to) {\n      var toCefElm = to.getNode(forward === false);\n      return getParentBlock$1(SugarElement.fromDom(root), SugarElement.fromDom(from.getNode())).map(function (blockElm) {\n        return isEmpty$2(blockElm) ? DeleteAction.remove(blockElm.dom) : DeleteAction.moveToElement(toCefElm);\n      }).orThunk(function () {\n        return Optional.some(DeleteAction.moveToElement(toCefElm));\n      });\n    };\n    var findCefPosition = function (root, forward, from) {\n      return fromPosition(forward, root, from).bind(function (to) {\n        if (isCompoundElement(to.getNode())) {\n          return Optional.none();\n        } else if (isDeleteFromCefDifferentBlocks(root, forward, from, to)) {\n          return Optional.none();\n        } else if (forward && isContentEditableFalse$b(to.getNode())) {\n          return deleteEmptyBlockOrMoveToCef(root, forward, from, to);\n        } else if (forward === false && isContentEditableFalse$b(to.getNode(true))) {\n          return deleteEmptyBlockOrMoveToCef(root, forward, from, to);\n        } else if (forward && isAfterContentEditableFalse(from)) {\n          return Optional.some(DeleteAction.moveToPosition(to));\n        } else if (forward === false && isBeforeContentEditableFalse(from)) {\n          return Optional.some(DeleteAction.moveToPosition(to));\n        } else {\n          return Optional.none();\n        }\n      });\n    };\n    var getContentEditableBlockAction = function (forward, elm) {\n      if (forward && isContentEditableFalse$b(elm.nextSibling)) {\n        return Optional.some(DeleteAction.moveToElement(elm.nextSibling));\n      } else if (forward === false && isContentEditableFalse$b(elm.previousSibling)) {\n        return Optional.some(DeleteAction.moveToElement(elm.previousSibling));\n      } else {\n        return Optional.none();\n      }\n    };\n    var skipMoveToActionFromInlineCefToContent = function (root, from, deleteAction) {\n      return deleteAction.fold(function (elm) {\n        return Optional.some(DeleteAction.remove(elm));\n      }, function (elm) {\n        return Optional.some(DeleteAction.moveToElement(elm));\n      }, function (to) {\n        if (isInSameBlock(from, to, root)) {\n          return Optional.none();\n        } else {\n          return Optional.some(DeleteAction.moveToPosition(to));\n        }\n      });\n    };\n    var getContentEditableAction = function (root, forward, from) {\n      if (isAtContentEditableBlockCaret(forward, from)) {\n        return getContentEditableBlockAction(forward, from.getNode(forward === false)).fold(function () {\n          return findCefPosition(root, forward, from);\n        }, Optional.some);\n      } else {\n        return findCefPosition(root, forward, from).bind(function (deleteAction) {\n          return skipMoveToActionFromInlineCefToContent(root, from, deleteAction);\n        });\n      }\n    };\n    var read = function (root, forward, rng) {\n      var normalizedRange = normalizeRange(forward ? 1 : -1, root, rng);\n      var from = CaretPosition.fromRangeStart(normalizedRange);\n      var rootElement = SugarElement.fromDom(root);\n      if (forward === false && isAfterContentEditableFalse(from)) {\n        return Optional.some(DeleteAction.remove(from.getNode(true)));\n      } else if (forward && isBeforeContentEditableFalse(from)) {\n        return Optional.some(DeleteAction.remove(from.getNode()));\n      } else if (forward === false && isBeforeContentEditableFalse(from) && isAfterBr(rootElement, from)) {\n        return findPreviousBr(rootElement, from).map(function (br) {\n          return DeleteAction.remove(br.getNode());\n        });\n      } else if (forward && isAfterContentEditableFalse(from) && isBeforeBr$1(rootElement, from)) {\n        return findNextBr(rootElement, from).map(function (br) {\n          return DeleteAction.remove(br.getNode());\n        });\n      } else {\n        return getContentEditableAction(root, forward, from);\n      }\n    };\n\n    var deleteElement$1 = function (editor, forward) {\n      return function (element) {\n        editor._selectionOverrides.hideFakeCaret();\n        deleteElement$2(editor, forward, SugarElement.fromDom(element));\n        return true;\n      };\n    };\n    var moveToElement = function (editor, forward) {\n      return function (element) {\n        var pos = forward ? CaretPosition.before(element) : CaretPosition.after(element);\n        editor.selection.setRng(pos.toRange());\n        return true;\n      };\n    };\n    var moveToPosition = function (editor) {\n      return function (pos) {\n        editor.selection.setRng(pos.toRange());\n        return true;\n      };\n    };\n    var getAncestorCe = function (editor, node) {\n      return Optional.from(getContentEditableRoot$1(editor.getBody(), node));\n    };\n    var backspaceDeleteCaret = function (editor, forward) {\n      var selectedNode = editor.selection.getNode();\n      return getAncestorCe(editor, selectedNode).filter(isContentEditableFalse$b).fold(function () {\n        return read(editor.getBody(), forward, editor.selection.getRng()).exists(function (deleteAction) {\n          return deleteAction.fold(deleteElement$1(editor, forward), moveToElement(editor, forward), moveToPosition(editor));\n        });\n      }, always);\n    };\n    var deleteOffscreenSelection = function (rootElement) {\n      each$k(descendants(rootElement, '.mce-offscreen-selection'), remove$7);\n    };\n    var backspaceDeleteRange = function (editor, forward) {\n      var selectedNode = editor.selection.getNode();\n      if (isContentEditableFalse$b(selectedNode) && !isTableCell$5(selectedNode)) {\n        var hasCefAncestor = getAncestorCe(editor, selectedNode.parentNode).filter(isContentEditableFalse$b);\n        return hasCefAncestor.fold(function () {\n          deleteOffscreenSelection(SugarElement.fromDom(editor.getBody()));\n          deleteElement$2(editor, forward, SugarElement.fromDom(editor.selection.getNode()));\n          paddEmptyBody(editor);\n          return true;\n        }, always);\n      }\n      return false;\n    };\n    var paddEmptyElement = function (editor) {\n      var dom = editor.dom, selection = editor.selection;\n      var ceRoot = getContentEditableRoot$1(editor.getBody(), selection.getNode());\n      if (isContentEditableTrue$4(ceRoot) && dom.isBlock(ceRoot) && dom.isEmpty(ceRoot)) {\n        var br = dom.create('br', { 'data-mce-bogus': '1' });\n        dom.setHTML(ceRoot, '');\n        ceRoot.appendChild(br);\n        selection.setRng(CaretPosition.before(br).toRange());\n      }\n      return true;\n    };\n    var backspaceDelete$5 = function (editor, forward) {\n      if (editor.selection.isCollapsed()) {\n        return backspaceDeleteCaret(editor, forward);\n      } else {\n        return backspaceDeleteRange(editor, forward);\n      }\n    };\n\n    var deleteCaret$2 = function (editor, forward) {\n      var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());\n      return fromPosition(forward, editor.getBody(), fromPos).filter(function (pos) {\n        return forward ? isBeforeImageBlock(pos) : isAfterImageBlock(pos);\n      }).bind(function (pos) {\n        return Optional.from(getChildNodeAtRelativeOffset(forward ? 0 : -1, pos));\n      }).exists(function (elm) {\n        editor.selection.select(elm);\n        return true;\n      });\n    };\n    var backspaceDelete$4 = function (editor, forward) {\n      return editor.selection.isCollapsed() ? deleteCaret$2(editor, forward) : false;\n    };\n\n    var isText = isText$7;\n    var startsWithCaretContainer = function (node) {\n      return isText(node) && node.data[0] === ZWSP$1;\n    };\n    var endsWithCaretContainer = function (node) {\n      return isText(node) && node.data[node.data.length - 1] === ZWSP$1;\n    };\n    var createZwsp = function (node) {\n      return node.ownerDocument.createTextNode(ZWSP$1);\n    };\n    var insertBefore = function (node) {\n      if (isText(node.previousSibling)) {\n        if (endsWithCaretContainer(node.previousSibling)) {\n          return node.previousSibling;\n        } else {\n          node.previousSibling.appendData(ZWSP$1);\n          return node.previousSibling;\n        }\n      } else if (isText(node)) {\n        if (startsWithCaretContainer(node)) {\n          return node;\n        } else {\n          node.insertData(0, ZWSP$1);\n          return node;\n        }\n      } else {\n        var newNode = createZwsp(node);\n        node.parentNode.insertBefore(newNode, node);\n        return newNode;\n      }\n    };\n    var insertAfter = function (node) {\n      if (isText(node.nextSibling)) {\n        if (startsWithCaretContainer(node.nextSibling)) {\n          return node.nextSibling;\n        } else {\n          node.nextSibling.insertData(0, ZWSP$1);\n          return node.nextSibling;\n        }\n      } else if (isText(node)) {\n        if (endsWithCaretContainer(node)) {\n          return node;\n        } else {\n          node.appendData(ZWSP$1);\n          return node;\n        }\n      } else {\n        var newNode = createZwsp(node);\n        if (node.nextSibling) {\n          node.parentNode.insertBefore(newNode, node.nextSibling);\n        } else {\n          node.parentNode.appendChild(newNode);\n        }\n        return newNode;\n      }\n    };\n    var insertInline = function (before, node) {\n      return before ? insertBefore(node) : insertAfter(node);\n    };\n    var insertInlineBefore = curry(insertInline, true);\n    var insertInlineAfter = curry(insertInline, false);\n\n    var insertInlinePos = function (pos, before) {\n      if (isText$7(pos.container())) {\n        return insertInline(before, pos.container());\n      } else {\n        return insertInline(before, pos.getNode());\n      }\n    };\n    var isPosCaretContainer = function (pos, caret) {\n      var caretNode = caret.get();\n      return caretNode && pos.container() === caretNode && isCaretContainerInline(caretNode);\n    };\n    var renderCaret = function (caret, location) {\n      return location.fold(function (element) {\n        remove$2(caret.get());\n        var text = insertInlineBefore(element);\n        caret.set(text);\n        return Optional.some(CaretPosition(text, text.length - 1));\n      }, function (element) {\n        return firstPositionIn(element).map(function (pos) {\n          if (!isPosCaretContainer(pos, caret)) {\n            remove$2(caret.get());\n            var text = insertInlinePos(pos, true);\n            caret.set(text);\n            return CaretPosition(text, 1);\n          } else {\n            return CaretPosition(caret.get(), 1);\n          }\n        });\n      }, function (element) {\n        return lastPositionIn(element).map(function (pos) {\n          if (!isPosCaretContainer(pos, caret)) {\n            remove$2(caret.get());\n            var text = insertInlinePos(pos, false);\n            caret.set(text);\n            return CaretPosition(text, text.length - 1);\n          } else {\n            return CaretPosition(caret.get(), caret.get().length - 1);\n          }\n        });\n      }, function (element) {\n        remove$2(caret.get());\n        var text = insertInlineAfter(element);\n        caret.set(text);\n        return Optional.some(CaretPosition(text, 1));\n      });\n    };\n\n    var evaluateUntil = function (fns, args) {\n      for (var i = 0; i < fns.length; i++) {\n        var result = fns[i].apply(null, args);\n        if (result.isSome()) {\n          return result;\n        }\n      }\n      return Optional.none();\n    };\n\n    var Location = Adt.generate([\n      { before: ['element'] },\n      { start: ['element'] },\n      { end: ['element'] },\n      { after: ['element'] }\n    ]);\n    var rescope$1 = function (rootNode, node) {\n      var parentBlock = getParentBlock$2(node, rootNode);\n      return parentBlock ? parentBlock : rootNode;\n    };\n    var before = function (isInlineTarget, rootNode, pos) {\n      var nPos = normalizeForwards(pos);\n      var scope = rescope$1(rootNode, nPos.container());\n      return findRootInline(isInlineTarget, scope, nPos).fold(function () {\n        return nextPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) {\n          return Location.before(inline);\n        });\n      }, Optional.none);\n    };\n    var isNotInsideFormatCaretContainer = function (rootNode, elm) {\n      return getParentCaretContainer(rootNode, elm) === null;\n    };\n    var findInsideRootInline = function (isInlineTarget, rootNode, pos) {\n      return findRootInline(isInlineTarget, rootNode, pos).filter(curry(isNotInsideFormatCaretContainer, rootNode));\n    };\n    var start$1 = function (isInlineTarget, rootNode, pos) {\n      var nPos = normalizeBackwards(pos);\n      return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {\n        var prevPos = prevPosition(inline, nPos);\n        return prevPos.isNone() ? Optional.some(Location.start(inline)) : Optional.none();\n      });\n    };\n    var end = function (isInlineTarget, rootNode, pos) {\n      var nPos = normalizeForwards(pos);\n      return findInsideRootInline(isInlineTarget, rootNode, nPos).bind(function (inline) {\n        var nextPos = nextPosition(inline, nPos);\n        return nextPos.isNone() ? Optional.some(Location.end(inline)) : Optional.none();\n      });\n    };\n    var after = function (isInlineTarget, rootNode, pos) {\n      var nPos = normalizeBackwards(pos);\n      var scope = rescope$1(rootNode, nPos.container());\n      return findRootInline(isInlineTarget, scope, nPos).fold(function () {\n        return prevPosition(scope, nPos).bind(curry(findRootInline, isInlineTarget, scope)).map(function (inline) {\n          return Location.after(inline);\n        });\n      }, Optional.none);\n    };\n    var isValidLocation = function (location) {\n      return isRtl(getElement(location)) === false;\n    };\n    var readLocation = function (isInlineTarget, rootNode, pos) {\n      var location = evaluateUntil([\n        before,\n        start$1,\n        end,\n        after\n      ], [\n        isInlineTarget,\n        rootNode,\n        pos\n      ]);\n      return location.filter(isValidLocation);\n    };\n    var getElement = function (location) {\n      return location.fold(identity, identity, identity, identity);\n    };\n    var getName = function (location) {\n      return location.fold(constant('before'), constant('start'), constant('end'), constant('after'));\n    };\n    var outside = function (location) {\n      return location.fold(Location.before, Location.before, Location.after, Location.after);\n    };\n    var inside = function (location) {\n      return location.fold(Location.start, Location.start, Location.end, Location.end);\n    };\n    var isEq = function (location1, location2) {\n      return getName(location1) === getName(location2) && getElement(location1) === getElement(location2);\n    };\n    var betweenInlines = function (forward, isInlineTarget, rootNode, from, to, location) {\n      return lift2(findRootInline(isInlineTarget, rootNode, from), findRootInline(isInlineTarget, rootNode, to), function (fromInline, toInline) {\n        if (fromInline !== toInline && hasSameParentBlock(rootNode, fromInline, toInline)) {\n          return Location.after(forward ? fromInline : toInline);\n        } else {\n          return location;\n        }\n      }).getOr(location);\n    };\n    var skipNoMovement = function (fromLocation, toLocation) {\n      return fromLocation.fold(always, function (fromLocation) {\n        return !isEq(fromLocation, toLocation);\n      });\n    };\n    var findLocationTraverse = function (forward, isInlineTarget, rootNode, fromLocation, pos) {\n      var from = normalizePosition(forward, pos);\n      var to = fromPosition(forward, rootNode, from).map(curry(normalizePosition, forward));\n      var location = to.fold(function () {\n        return fromLocation.map(outside);\n      }, function (to) {\n        return readLocation(isInlineTarget, rootNode, to).map(curry(betweenInlines, forward, isInlineTarget, rootNode, from, to)).filter(curry(skipNoMovement, fromLocation));\n      });\n      return location.filter(isValidLocation);\n    };\n    var findLocationSimple = function (forward, location) {\n      if (forward) {\n        return location.fold(compose(Optional.some, Location.start), Optional.none, compose(Optional.some, Location.after), Optional.none);\n      } else {\n        return location.fold(Optional.none, compose(Optional.some, Location.before), Optional.none, compose(Optional.some, Location.end));\n      }\n    };\n    var findLocation$1 = function (forward, isInlineTarget, rootNode, pos) {\n      var from = normalizePosition(forward, pos);\n      var fromLocation = readLocation(isInlineTarget, rootNode, from);\n      return readLocation(isInlineTarget, rootNode, from).bind(curry(findLocationSimple, forward)).orThunk(function () {\n        return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos);\n      });\n    };\n    curry(findLocation$1, false);\n    curry(findLocation$1, true);\n\n    var hasSelectionModifyApi = function (editor) {\n      return isFunction(editor.selection.getSel().modify);\n    };\n    var moveRel = function (forward, selection, pos) {\n      var delta = forward ? 1 : -1;\n      selection.setRng(CaretPosition(pos.container(), pos.offset() + delta).toRange());\n      selection.getSel().modify('move', forward ? 'forward' : 'backward', 'word');\n      return true;\n    };\n    var moveByWord = function (forward, editor) {\n      var rng = editor.selection.getRng();\n      var pos = forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng);\n      if (!hasSelectionModifyApi(editor)) {\n        return false;\n      } else if (forward && isBeforeInline(pos)) {\n        return moveRel(true, editor.selection, pos);\n      } else if (!forward && isAfterInline(pos)) {\n        return moveRel(false, editor.selection, pos);\n      } else {\n        return false;\n      }\n    };\n\n    var BreakType;\n    (function (BreakType) {\n      BreakType[BreakType['Br'] = 0] = 'Br';\n      BreakType[BreakType['Block'] = 1] = 'Block';\n      BreakType[BreakType['Wrap'] = 2] = 'Wrap';\n      BreakType[BreakType['Eol'] = 3] = 'Eol';\n    }(BreakType || (BreakType = {})));\n    var flip = function (direction, positions) {\n      return direction === HDirection.Backwards ? reverse(positions) : positions;\n    };\n    var walk = function (direction, caretWalker, pos) {\n      return direction === HDirection.Forwards ? caretWalker.next(pos) : caretWalker.prev(pos);\n    };\n    var getBreakType = function (scope, direction, currentPos, nextPos) {\n      if (isBr$5(nextPos.getNode(direction === HDirection.Forwards))) {\n        return BreakType.Br;\n      } else if (isInSameBlock(currentPos, nextPos) === false) {\n        return BreakType.Block;\n      } else {\n        return BreakType.Wrap;\n      }\n    };\n    var getPositionsUntil = function (predicate, direction, scope, start) {\n      var caretWalker = CaretWalker(scope);\n      var currentPos = start;\n      var positions = [];\n      while (currentPos) {\n        var nextPos = walk(direction, caretWalker, currentPos);\n        if (!nextPos) {\n          break;\n        }\n        if (isBr$5(nextPos.getNode(false))) {\n          if (direction === HDirection.Forwards) {\n            return {\n              positions: flip(direction, positions).concat([nextPos]),\n              breakType: BreakType.Br,\n              breakAt: Optional.some(nextPos)\n            };\n          } else {\n            return {\n              positions: flip(direction, positions),\n              breakType: BreakType.Br,\n              breakAt: Optional.some(nextPos)\n            };\n          }\n        }\n        if (!nextPos.isVisible()) {\n          currentPos = nextPos;\n          continue;\n        }\n        if (predicate(currentPos, nextPos)) {\n          var breakType = getBreakType(scope, direction, currentPos, nextPos);\n          return {\n            positions: flip(direction, positions),\n            breakType: breakType,\n            breakAt: Optional.some(nextPos)\n          };\n        }\n        positions.push(nextPos);\n        currentPos = nextPos;\n      }\n      return {\n        positions: flip(direction, positions),\n        breakType: BreakType.Eol,\n        breakAt: Optional.none()\n      };\n    };\n    var getAdjacentLinePositions = function (direction, getPositionsUntilBreak, scope, start) {\n      return getPositionsUntilBreak(scope, start).breakAt.map(function (pos) {\n        var positions = getPositionsUntilBreak(scope, pos).positions;\n        return direction === HDirection.Backwards ? positions.concat(pos) : [pos].concat(positions);\n      }).getOr([]);\n    };\n    var findClosestHorizontalPositionFromPoint = function (positions, x) {\n      return foldl(positions, function (acc, newPos) {\n        return acc.fold(function () {\n          return Optional.some(newPos);\n        }, function (lastPos) {\n          return lift2(head(lastPos.getClientRects()), head(newPos.getClientRects()), function (lastRect, newRect) {\n            var lastDist = Math.abs(x - lastRect.left);\n            var newDist = Math.abs(x - newRect.left);\n            return newDist <= lastDist ? newPos : lastPos;\n          }).or(acc);\n        });\n      }, Optional.none());\n    };\n    var findClosestHorizontalPosition = function (positions, pos) {\n      return head(pos.getClientRects()).bind(function (targetRect) {\n        return findClosestHorizontalPositionFromPoint(positions, targetRect.left);\n      });\n    };\n    var getPositionsUntilPreviousLine = curry(getPositionsUntil, CaretPosition.isAbove, -1);\n    var getPositionsUntilNextLine = curry(getPositionsUntil, CaretPosition.isBelow, 1);\n    var getPositionsAbove = curry(getAdjacentLinePositions, -1, getPositionsUntilPreviousLine);\n    var getPositionsBelow = curry(getAdjacentLinePositions, 1, getPositionsUntilNextLine);\n    var isAtFirstLine = function (scope, pos) {\n      return getPositionsUntilPreviousLine(scope, pos).breakAt.isNone();\n    };\n    var isAtLastLine = function (scope, pos) {\n      return getPositionsUntilNextLine(scope, pos).breakAt.isNone();\n    };\n    var getFirstLinePositions = function (scope) {\n      return firstPositionIn(scope).map(function (pos) {\n        return [pos].concat(getPositionsUntilNextLine(scope, pos).positions);\n      }).getOr([]);\n    };\n    var getLastLinePositions = function (scope) {\n      return lastPositionIn(scope).map(function (pos) {\n        return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos);\n      }).getOr([]);\n    };\n\n    var getNodeClientRects = function (node) {\n      var toArrayWithNode = function (clientRects) {\n        return map$3(clientRects, function (rect) {\n          var clientRect = clone(rect);\n          clientRect.node = node;\n          return clientRect;\n        });\n      };\n      if (isElement$5(node)) {\n        return toArrayWithNode(node.getClientRects());\n      }\n      if (isText$7(node)) {\n        var rng = node.ownerDocument.createRange();\n        rng.setStart(node, 0);\n        rng.setEnd(node, node.data.length);\n        return toArrayWithNode(rng.getClientRects());\n      }\n    };\n    var getClientRects = function (nodes) {\n      return bind(nodes, getNodeClientRects);\n    };\n\n    var VDirection;\n    (function (VDirection) {\n      VDirection[VDirection['Up'] = -1] = 'Up';\n      VDirection[VDirection['Down'] = 1] = 'Down';\n    }(VDirection || (VDirection = {})));\n    var findUntil = function (direction, root, predicateFn, node) {\n      while (node = findNode$1(node, direction, isEditableCaretCandidate$1, root)) {\n        if (predicateFn(node)) {\n          return;\n        }\n      }\n    };\n    var walkUntil$1 = function (direction, isAboveFn, isBeflowFn, root, predicateFn, caretPosition) {\n      var line = 0;\n      var result = [];\n      var add = function (node) {\n        var clientRects = getClientRects([node]);\n        if (direction === -1) {\n          clientRects = clientRects.reverse();\n        }\n        for (var i = 0; i < clientRects.length; i++) {\n          var clientRect = clientRects[i];\n          if (isBeflowFn(clientRect, targetClientRect)) {\n            continue;\n          }\n          if (result.length > 0 && isAboveFn(clientRect, last$1(result))) {\n            line++;\n          }\n          clientRect.line = line;\n          if (predicateFn(clientRect)) {\n            return true;\n          }\n          result.push(clientRect);\n        }\n      };\n      var targetClientRect = last$1(caretPosition.getClientRects());\n      if (!targetClientRect) {\n        return result;\n      }\n      var node = caretPosition.getNode();\n      add(node);\n      findUntil(direction, root, add, node);\n      return result;\n    };\n    var aboveLineNumber = function (lineNumber, clientRect) {\n      return clientRect.line > lineNumber;\n    };\n    var isLineNumber = function (lineNumber, clientRect) {\n      return clientRect.line === lineNumber;\n    };\n    var upUntil = curry(walkUntil$1, VDirection.Up, isAbove$1, isBelow$1);\n    var downUntil = curry(walkUntil$1, VDirection.Down, isBelow$1, isAbove$1);\n    var positionsUntil = function (direction, root, predicateFn, node) {\n      var caretWalker = CaretWalker(root);\n      var walkFn;\n      var isBelowFn;\n      var isAboveFn;\n      var caretPosition;\n      var result = [];\n      var line = 0;\n      var getClientRect = function (caretPosition) {\n        if (direction === 1) {\n          return last$1(caretPosition.getClientRects());\n        }\n        return last$1(caretPosition.getClientRects());\n      };\n      if (direction === 1) {\n        walkFn = caretWalker.next;\n        isBelowFn = isBelow$1;\n        isAboveFn = isAbove$1;\n        caretPosition = CaretPosition.after(node);\n      } else {\n        walkFn = caretWalker.prev;\n        isBelowFn = isAbove$1;\n        isAboveFn = isBelow$1;\n        caretPosition = CaretPosition.before(node);\n      }\n      var targetClientRect = getClientRect(caretPosition);\n      do {\n        if (!caretPosition.isVisible()) {\n          continue;\n        }\n        var rect = getClientRect(caretPosition);\n        if (isAboveFn(rect, targetClientRect)) {\n          continue;\n        }\n        if (result.length > 0 && isBelowFn(rect, last$1(result))) {\n          line++;\n        }\n        var clientRect = clone(rect);\n        clientRect.position = caretPosition;\n        clientRect.line = line;\n        if (predicateFn(clientRect)) {\n          return result;\n        }\n        result.push(clientRect);\n      } while (caretPosition = walkFn(caretPosition));\n      return result;\n    };\n    var isAboveLine = function (lineNumber) {\n      return function (clientRect) {\n        return aboveLineNumber(lineNumber, clientRect);\n      };\n    };\n    var isLine = function (lineNumber) {\n      return function (clientRect) {\n        return isLineNumber(lineNumber, clientRect);\n      };\n    };\n\n    var isContentEditableFalse$3 = isContentEditableFalse$b;\n    var findNode = findNode$1;\n    var distanceToRectLeft = function (clientRect, clientX) {\n      return Math.abs(clientRect.left - clientX);\n    };\n    var distanceToRectRight = function (clientRect, clientX) {\n      return Math.abs(clientRect.right - clientX);\n    };\n    var isInsideX = function (clientX, clientRect) {\n      return clientX >= clientRect.left && clientX <= clientRect.right;\n    };\n    var isInsideY = function (clientY, clientRect) {\n      return clientY >= clientRect.top && clientY <= clientRect.bottom;\n    };\n    var isNodeClientRect = function (rect) {\n      return hasNonNullableKey(rect, 'node');\n    };\n    var findClosestClientRect = function (clientRects, clientX, allowInside) {\n      if (allowInside === void 0) {\n        allowInside = always;\n      }\n      return reduce(clientRects, function (oldClientRect, clientRect) {\n        if (isInsideX(clientX, clientRect)) {\n          return allowInside(clientRect) ? clientRect : oldClientRect;\n        }\n        if (isInsideX(clientX, oldClientRect)) {\n          return allowInside(oldClientRect) ? oldClientRect : clientRect;\n        }\n        var oldDistance = Math.min(distanceToRectLeft(oldClientRect, clientX), distanceToRectRight(oldClientRect, clientX));\n        var newDistance = Math.min(distanceToRectLeft(clientRect, clientX), distanceToRectRight(clientRect, clientX));\n        if (newDistance === oldDistance && isNodeClientRect(clientRect) && isContentEditableFalse$3(clientRect.node)) {\n          return clientRect;\n        }\n        if (newDistance < oldDistance) {\n          return clientRect;\n        }\n        return oldClientRect;\n      });\n    };\n    var walkUntil = function (direction, root, predicateFn, startNode, includeChildren) {\n      var node = findNode(startNode, direction, isEditableCaretCandidate$1, root, !includeChildren);\n      do {\n        if (!node || predicateFn(node)) {\n          return;\n        }\n      } while (node = findNode(node, direction, isEditableCaretCandidate$1, root));\n    };\n    var findLineNodeRects = function (root, targetNodeRect, includeChildren) {\n      if (includeChildren === void 0) {\n        includeChildren = true;\n      }\n      var clientRects = [];\n      var collect = function (checkPosFn, node) {\n        var lineRects = filter$4(getClientRects([node]), function (clientRect) {\n          return !checkPosFn(clientRect, targetNodeRect);\n        });\n        clientRects = clientRects.concat(lineRects);\n        return lineRects.length === 0;\n      };\n      clientRects.push(targetNodeRect);\n      walkUntil(VDirection.Up, root, curry(collect, isAbove$1), targetNodeRect.node, includeChildren);\n      walkUntil(VDirection.Down, root, curry(collect, isBelow$1), targetNodeRect.node, includeChildren);\n      return clientRects;\n    };\n    var getFakeCaretTargets = function (root) {\n      return filter$4(from(root.getElementsByTagName('*')), isFakeCaretTarget);\n    };\n    var caretInfo = function (clientRect, clientX) {\n      return {\n        node: clientRect.node,\n        before: distanceToRectLeft(clientRect, clientX) < distanceToRectRight(clientRect, clientX)\n      };\n    };\n    var closestFakeCaret = function (root, clientX, clientY) {\n      var fakeTargetNodeRects = getClientRects(getFakeCaretTargets(root));\n      var targetNodeRects = filter$4(fakeTargetNodeRects, curry(isInsideY, clientY));\n      var checkInside = function (clientRect) {\n        return !isTable$3(clientRect.node) && !isMedia$2(clientRect.node);\n      };\n      var closestNodeRect = findClosestClientRect(targetNodeRects, clientX, checkInside);\n      if (closestNodeRect) {\n        var includeChildren = checkInside(closestNodeRect);\n        closestNodeRect = findClosestClientRect(findLineNodeRects(root, closestNodeRect, includeChildren), clientX, checkInside);\n        if (closestNodeRect && isFakeCaretTarget(closestNodeRect.node)) {\n          return caretInfo(closestNodeRect, clientX);\n        }\n      }\n      return null;\n    };\n\n    var moveToRange = function (editor, rng) {\n      editor.selection.setRng(rng);\n      scrollRangeIntoView(editor, editor.selection.getRng());\n    };\n    var renderRangeCaretOpt = function (editor, range, scrollIntoView) {\n      return Optional.some(renderRangeCaret(editor, range, scrollIntoView));\n    };\n    var moveHorizontally = function (editor, direction, range, isBefore, isAfter, isElement) {\n      var forwards = direction === HDirection.Forwards;\n      var caretWalker = CaretWalker(editor.getBody());\n      var getNextPosFn = curry(getVisualCaretPosition, forwards ? caretWalker.next : caretWalker.prev);\n      var isBeforeFn = forwards ? isBefore : isAfter;\n      if (!range.collapsed) {\n        var node = getSelectedNode(range);\n        if (isElement(node)) {\n          return showCaret(direction, editor, node, direction === HDirection.Backwards, false);\n        }\n      }\n      var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n      if (isBeforeFn(caretPosition)) {\n        return selectNode(editor, caretPosition.getNode(!forwards));\n      }\n      var nextCaretPosition = normalizePosition(forwards, getNextPosFn(caretPosition));\n      var rangeIsInContainerBlock = isRangeInCaretContainerBlock(range);\n      if (!nextCaretPosition) {\n        return rangeIsInContainerBlock ? Optional.some(range) : Optional.none();\n      }\n      if (isBeforeFn(nextCaretPosition)) {\n        return showCaret(direction, editor, nextCaretPosition.getNode(!forwards), forwards, false);\n      }\n      var peekCaretPosition = getNextPosFn(nextCaretPosition);\n      if (peekCaretPosition && isBeforeFn(peekCaretPosition)) {\n        if (isMoveInsideSameBlock(nextCaretPosition, peekCaretPosition)) {\n          return showCaret(direction, editor, peekCaretPosition.getNode(!forwards), forwards, false);\n        }\n      }\n      if (rangeIsInContainerBlock) {\n        return renderRangeCaretOpt(editor, nextCaretPosition.toRange(), false);\n      }\n      return Optional.none();\n    };\n    var moveVertically = function (editor, direction, range, isBefore, isAfter, isElement) {\n      var caretPosition = getNormalizedRangeEndPoint(direction, editor.getBody(), range);\n      var caretClientRect = last$1(caretPosition.getClientRects());\n      var forwards = direction === VDirection.Down;\n      if (!caretClientRect) {\n        return Optional.none();\n      }\n      var walkerFn = forwards ? downUntil : upUntil;\n      var linePositions = walkerFn(editor.getBody(), isAboveLine(1), caretPosition);\n      var nextLinePositions = filter$4(linePositions, isLine(1));\n      var clientX = caretClientRect.left;\n      var nextLineRect = findClosestClientRect(nextLinePositions, clientX);\n      if (nextLineRect && isElement(nextLineRect.node)) {\n        var dist1 = Math.abs(clientX - nextLineRect.left);\n        var dist2 = Math.abs(clientX - nextLineRect.right);\n        return showCaret(direction, editor, nextLineRect.node, dist1 < dist2, false);\n      }\n      var currentNode;\n      if (isBefore(caretPosition)) {\n        currentNode = caretPosition.getNode();\n      } else if (isAfter(caretPosition)) {\n        currentNode = caretPosition.getNode(true);\n      } else {\n        currentNode = getSelectedNode(range);\n      }\n      if (currentNode) {\n        var caretPositions = positionsUntil(direction, editor.getBody(), isAboveLine(1), currentNode);\n        var closestNextLineRect = findClosestClientRect(filter$4(caretPositions, isLine(1)), clientX);\n        if (closestNextLineRect) {\n          return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false);\n        }\n        closestNextLineRect = last$1(filter$4(caretPositions, isLine(0)));\n        if (closestNextLineRect) {\n          return renderRangeCaretOpt(editor, closestNextLineRect.position.toRange(), false);\n        }\n      }\n      if (nextLinePositions.length === 0) {\n        return getLineEndPoint(editor, forwards).filter(forwards ? isAfter : isBefore).map(function (pos) {\n          return renderRangeCaret(editor, pos.toRange(), false);\n        });\n      }\n      return Optional.none();\n    };\n    var getLineEndPoint = function (editor, forward) {\n      var rng = editor.selection.getRng();\n      var body = editor.getBody();\n      if (forward) {\n        var from = CaretPosition.fromRangeEnd(rng);\n        var result = getPositionsUntilNextLine(body, from);\n        return last$2(result.positions);\n      } else {\n        var from = CaretPosition.fromRangeStart(rng);\n        var result = getPositionsUntilPreviousLine(body, from);\n        return head(result.positions);\n      }\n    };\n    var moveToLineEndPoint$3 = function (editor, forward, isElementPosition) {\n      return getLineEndPoint(editor, forward).filter(isElementPosition).exists(function (pos) {\n        editor.selection.setRng(pos.toRange());\n        return true;\n      });\n    };\n\n    var setCaretPosition = function (editor, pos) {\n      var rng = editor.dom.createRng();\n      rng.setStart(pos.container(), pos.offset());\n      rng.setEnd(pos.container(), pos.offset());\n      editor.selection.setRng(rng);\n    };\n    var setSelected = function (state, elm) {\n      if (state) {\n        elm.setAttribute('data-mce-selected', 'inline-boundary');\n      } else {\n        elm.removeAttribute('data-mce-selected');\n      }\n    };\n    var renderCaretLocation = function (editor, caret, location) {\n      return renderCaret(caret, location).map(function (pos) {\n        setCaretPosition(editor, pos);\n        return location;\n      });\n    };\n    var findLocation = function (editor, caret, forward) {\n      var rootNode = editor.getBody();\n      var from = CaretPosition.fromRangeStart(editor.selection.getRng());\n      var isInlineTarget$1 = curry(isInlineTarget, editor);\n      var location = findLocation$1(forward, isInlineTarget$1, rootNode, from);\n      return location.bind(function (location) {\n        return renderCaretLocation(editor, caret, location);\n      });\n    };\n    var toggleInlines = function (isInlineTarget, dom, elms) {\n      var inlineBoundaries = map$3(descendants(SugarElement.fromDom(dom.getRoot()), '*[data-mce-selected=\"inline-boundary\"]'), function (e) {\n        return e.dom;\n      });\n      var selectedInlines = filter$4(inlineBoundaries, isInlineTarget);\n      var targetInlines = filter$4(elms, isInlineTarget);\n      each$k(difference(selectedInlines, targetInlines), curry(setSelected, false));\n      each$k(difference(targetInlines, selectedInlines), curry(setSelected, true));\n    };\n    var safeRemoveCaretContainer = function (editor, caret) {\n      if (editor.selection.isCollapsed() && editor.composing !== true && caret.get()) {\n        var pos = CaretPosition.fromRangeStart(editor.selection.getRng());\n        if (CaretPosition.isTextPosition(pos) && isAtZwsp(pos) === false) {\n          setCaretPosition(editor, removeAndReposition(caret.get(), pos));\n          caret.set(null);\n        }\n      }\n    };\n    var renderInsideInlineCaret = function (isInlineTarget, editor, caret, elms) {\n      if (editor.selection.isCollapsed()) {\n        var inlines = filter$4(elms, isInlineTarget);\n        each$k(inlines, function (_inline) {\n          var pos = CaretPosition.fromRangeStart(editor.selection.getRng());\n          readLocation(isInlineTarget, editor.getBody(), pos).bind(function (location) {\n            return renderCaretLocation(editor, caret, location);\n          });\n        });\n      }\n    };\n    var move$2 = function (editor, caret, forward) {\n      return isInlineBoundariesEnabled(editor) ? findLocation(editor, caret, forward).isSome() : false;\n    };\n    var moveWord = function (forward, editor, _caret) {\n      return isInlineBoundariesEnabled(editor) ? moveByWord(forward, editor) : false;\n    };\n    var setupSelectedState = function (editor) {\n      var caret = Cell(null);\n      var isInlineTarget$1 = curry(isInlineTarget, editor);\n      editor.on('NodeChange', function (e) {\n        if (isInlineBoundariesEnabled(editor) && !(Env.browser.isIE() && e.initial)) {\n          toggleInlines(isInlineTarget$1, editor.dom, e.parents);\n          safeRemoveCaretContainer(editor, caret);\n          renderInsideInlineCaret(isInlineTarget$1, editor, caret, e.parents);\n        }\n      });\n      return caret;\n    };\n    var moveNextWord = curry(moveWord, true);\n    var movePrevWord = curry(moveWord, false);\n    var moveToLineEndPoint$2 = function (editor, forward, caret) {\n      if (isInlineBoundariesEnabled(editor)) {\n        var linePoint = getLineEndPoint(editor, forward).getOrThunk(function () {\n          var rng = editor.selection.getRng();\n          return forward ? CaretPosition.fromRangeEnd(rng) : CaretPosition.fromRangeStart(rng);\n        });\n        return readLocation(curry(isInlineTarget, editor), editor.getBody(), linePoint).exists(function (loc) {\n          var outsideLoc = outside(loc);\n          return renderCaret(caret, outsideLoc).exists(function (pos) {\n            setCaretPosition(editor, pos);\n            return true;\n          });\n        });\n      } else {\n        return false;\n      }\n    };\n\n    var rangeFromPositions = function (from, to) {\n      var range = document.createRange();\n      range.setStart(from.container(), from.offset());\n      range.setEnd(to.container(), to.offset());\n      return range;\n    };\n    var hasOnlyTwoOrLessPositionsLeft = function (elm) {\n      return lift2(firstPositionIn(elm), lastPositionIn(elm), function (firstPos, lastPos) {\n        var normalizedFirstPos = normalizePosition(true, firstPos);\n        var normalizedLastPos = normalizePosition(false, lastPos);\n        return nextPosition(elm, normalizedFirstPos).forall(function (pos) {\n          return pos.isEqual(normalizedLastPos);\n        });\n      }).getOr(true);\n    };\n    var setCaretLocation = function (editor, caret) {\n      return function (location) {\n        return renderCaret(caret, location).exists(function (pos) {\n          setCaretPosition(editor, pos);\n          return true;\n        });\n      };\n    };\n    var deleteFromTo = function (editor, caret, from, to) {\n      var rootNode = editor.getBody();\n      var isInlineTarget$1 = curry(isInlineTarget, editor);\n      editor.undoManager.ignore(function () {\n        editor.selection.setRng(rangeFromPositions(from, to));\n        editor.execCommand('Delete');\n        readLocation(isInlineTarget$1, rootNode, CaretPosition.fromRangeStart(editor.selection.getRng())).map(inside).map(setCaretLocation(editor, caret));\n      });\n      editor.nodeChanged();\n    };\n    var rescope = function (rootNode, node) {\n      var parentBlock = getParentBlock$2(node, rootNode);\n      return parentBlock ? parentBlock : rootNode;\n    };\n    var backspaceDeleteCollapsed = function (editor, caret, forward, from) {\n      var rootNode = rescope(editor.getBody(), from.container());\n      var isInlineTarget$1 = curry(isInlineTarget, editor);\n      var fromLocation = readLocation(isInlineTarget$1, rootNode, from);\n      return fromLocation.bind(function (location) {\n        if (forward) {\n          return location.fold(constant(Optional.some(inside(location))), Optional.none, constant(Optional.some(outside(location))), Optional.none);\n        } else {\n          return location.fold(Optional.none, constant(Optional.some(outside(location))), Optional.none, constant(Optional.some(inside(location))));\n        }\n      }).map(setCaretLocation(editor, caret)).getOrThunk(function () {\n        var toPosition = navigate(forward, rootNode, from);\n        var toLocation = toPosition.bind(function (pos) {\n          return readLocation(isInlineTarget$1, rootNode, pos);\n        });\n        return lift2(fromLocation, toLocation, function () {\n          return findRootInline(isInlineTarget$1, rootNode, from).exists(function (elm) {\n            if (hasOnlyTwoOrLessPositionsLeft(elm)) {\n              deleteElement$2(editor, forward, SugarElement.fromDom(elm));\n              return true;\n            } else {\n              return false;\n            }\n          });\n        }).orThunk(function () {\n          return toLocation.bind(function (_) {\n            return toPosition.map(function (to) {\n              if (forward) {\n                deleteFromTo(editor, caret, from, to);\n              } else {\n                deleteFromTo(editor, caret, to, from);\n              }\n              return true;\n            });\n          });\n        }).getOr(false);\n      });\n    };\n    var backspaceDelete$3 = function (editor, caret, forward) {\n      if (editor.selection.isCollapsed() && isInlineBoundariesEnabled(editor)) {\n        var from = CaretPosition.fromRangeStart(editor.selection.getRng());\n        return backspaceDeleteCollapsed(editor, caret, forward, from);\n      }\n      return false;\n    };\n\n    var getParentInlines = function (rootElm, startElm) {\n      var parents = parentsAndSelf(startElm, rootElm);\n      return findIndex$2(parents, isBlock$2).fold(constant(parents), function (index) {\n        return parents.slice(0, index);\n      });\n    };\n    var hasOnlyOneChild = function (elm) {\n      return childNodesCount(elm) === 1;\n    };\n    var deleteLastPosition = function (forward, editor, target, parentInlines) {\n      var isFormatElement$1 = curry(isFormatElement, editor);\n      var formatNodes = map$3(filter$4(parentInlines, isFormatElement$1), function (elm) {\n        return elm.dom;\n      });\n      if (formatNodes.length === 0) {\n        deleteElement$2(editor, forward, target);\n      } else {\n        var pos = replaceWithCaretFormat(target.dom, formatNodes);\n        editor.selection.setRng(pos.toRange());\n      }\n    };\n    var deleteCaret$1 = function (editor, forward) {\n      var rootElm = SugarElement.fromDom(editor.getBody());\n      var startElm = SugarElement.fromDom(editor.selection.getStart());\n      var parentInlines = filter$4(getParentInlines(rootElm, startElm), hasOnlyOneChild);\n      return last$2(parentInlines).exists(function (target) {\n        var fromPos = CaretPosition.fromRangeStart(editor.selection.getRng());\n        if (willDeleteLastPositionInElement(forward, fromPos, target.dom) && !isEmptyCaretFormatElement(target)) {\n          deleteLastPosition(forward, editor, target, parentInlines);\n          return true;\n        } else {\n          return false;\n        }\n      });\n    };\n    var backspaceDelete$2 = function (editor, forward) {\n      return editor.selection.isCollapsed() ? deleteCaret$1(editor, forward) : false;\n    };\n\n    var deleteElement = function (editor, forward, element) {\n      editor._selectionOverrides.hideFakeCaret();\n      deleteElement$2(editor, forward, SugarElement.fromDom(element));\n      return true;\n    };\n    var deleteCaret = function (editor, forward) {\n      var isNearMedia = forward ? isBeforeMedia : isAfterMedia;\n      var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n      var fromPos = getNormalizedRangeEndPoint(direction, editor.getBody(), editor.selection.getRng());\n      if (isNearMedia(fromPos)) {\n        return deleteElement(editor, forward, fromPos.getNode(!forward));\n      } else {\n        return Optional.from(normalizePosition(forward, fromPos)).filter(function (pos) {\n          return isNearMedia(pos) && isMoveInsideSameBlock(fromPos, pos);\n        }).exists(function (pos) {\n          return deleteElement(editor, forward, pos.getNode(!forward));\n        });\n      }\n    };\n    var deleteRange = function (editor, forward) {\n      var selectedNode = editor.selection.getNode();\n      return isMedia$2(selectedNode) ? deleteElement(editor, forward, selectedNode) : false;\n    };\n    var backspaceDelete$1 = function (editor, forward) {\n      return editor.selection.isCollapsed() ? deleteCaret(editor, forward) : deleteRange(editor, forward);\n    };\n\n    var isEditable = function (target) {\n      return closest$3(target, function (elm) {\n        return isContentEditableTrue$4(elm.dom) || isContentEditableFalse$b(elm.dom);\n      }).exists(function (elm) {\n        return isContentEditableTrue$4(elm.dom);\n      });\n    };\n    var parseIndentValue = function (value) {\n      var number = parseInt(value, 10);\n      return isNaN(number) ? 0 : number;\n    };\n    var getIndentStyleName = function (useMargin, element) {\n      var indentStyleName = useMargin || isTable$2(element) ? 'margin' : 'padding';\n      var suffix = get$5(element, 'direction') === 'rtl' ? '-right' : '-left';\n      return indentStyleName + suffix;\n    };\n    var indentElement = function (dom, command, useMargin, value, unit, element) {\n      var indentStyleName = getIndentStyleName(useMargin, SugarElement.fromDom(element));\n      if (command === 'outdent') {\n        var styleValue = Math.max(0, parseIndentValue(element.style[indentStyleName]) - value);\n        dom.setStyle(element, indentStyleName, styleValue ? styleValue + unit : '');\n      } else {\n        var styleValue = parseIndentValue(element.style[indentStyleName]) + value + unit;\n        dom.setStyle(element, indentStyleName, styleValue);\n      }\n    };\n    var validateBlocks = function (editor, blocks) {\n      return forall(blocks, function (block) {\n        var indentStyleName = getIndentStyleName(shouldIndentUseMargin(editor), block);\n        var intentValue = getRaw(block, indentStyleName).map(parseIndentValue).getOr(0);\n        var contentEditable = editor.dom.getContentEditable(block.dom);\n        return contentEditable !== 'false' && intentValue > 0;\n      });\n    };\n    var canOutdent = function (editor) {\n      var blocks = getBlocksToIndent(editor);\n      return !editor.mode.isReadOnly() && (blocks.length > 1 || validateBlocks(editor, blocks));\n    };\n    var isListComponent = function (el) {\n      return isList(el) || isListItem(el);\n    };\n    var parentIsListComponent = function (el) {\n      return parent(el).exists(isListComponent);\n    };\n    var getBlocksToIndent = function (editor) {\n      return filter$4(fromDom$1(editor.selection.getSelectedBlocks()), function (el) {\n        return !isListComponent(el) && !parentIsListComponent(el) && isEditable(el);\n      });\n    };\n    var handle = function (editor, command) {\n      var dom = editor.dom, selection = editor.selection, formatter = editor.formatter;\n      var indentation = getIndentation(editor);\n      var indentUnit = /[a-z%]+$/i.exec(indentation)[0];\n      var indentValue = parseInt(indentation, 10);\n      var useMargin = shouldIndentUseMargin(editor);\n      var forcedRootBlock = getForcedRootBlock(editor);\n      if (!editor.queryCommandState('InsertUnorderedList') && !editor.queryCommandState('InsertOrderedList')) {\n        if (forcedRootBlock === '' && !dom.getParent(selection.getNode(), dom.isBlock)) {\n          formatter.apply('div');\n        }\n      }\n      each$k(getBlocksToIndent(editor), function (block) {\n        indentElement(dom, command, useMargin, indentValue, indentUnit, block.dom);\n      });\n    };\n\n    var backspaceDelete = function (editor, _forward) {\n      if (editor.selection.isCollapsed() && canOutdent(editor)) {\n        var dom = editor.dom;\n        var rng = editor.selection.getRng();\n        var pos = CaretPosition.fromRangeStart(rng);\n        var block = dom.getParent(rng.startContainer, dom.isBlock);\n        if (block !== null && isAtStartOfBlock(SugarElement.fromDom(block), pos)) {\n          handle(editor, 'outdent');\n          return true;\n        }\n      }\n      return false;\n    };\n\n    var nativeCommand = function (editor, command) {\n      editor.getDoc().execCommand(command, false, null);\n    };\n    var deleteCommand = function (editor, caret) {\n      if (backspaceDelete(editor)) {\n        return;\n      } else if (backspaceDelete$5(editor, false)) {\n        return;\n      } else if (backspaceDelete$6(editor, false)) {\n        return;\n      } else if (backspaceDelete$3(editor, caret, false)) {\n        return;\n      } else if (backspaceDelete$8(editor, false)) {\n        return;\n      } else if (backspaceDelete$9(editor)) {\n        return;\n      } else if (backspaceDelete$4(editor, false)) {\n        return;\n      } else if (backspaceDelete$1(editor, false)) {\n        return;\n      } else if (backspaceDelete$7(editor)) {\n        return;\n      } else if (backspaceDelete$2(editor, false)) {\n        return;\n      } else {\n        nativeCommand(editor, 'Delete');\n        paddEmptyBody(editor);\n      }\n    };\n    var forwardDeleteCommand = function (editor, caret) {\n      if (backspaceDelete$5(editor, true)) {\n        return;\n      } else if (backspaceDelete$6(editor, true)) {\n        return;\n      } else if (backspaceDelete$3(editor, caret, true)) {\n        return;\n      } else if (backspaceDelete$8(editor, true)) {\n        return;\n      } else if (backspaceDelete$9(editor)) {\n        return;\n      } else if (backspaceDelete$4(editor, true)) {\n        return;\n      } else if (backspaceDelete$1(editor, true)) {\n        return;\n      } else if (backspaceDelete$7(editor)) {\n        return;\n      } else if (backspaceDelete$2(editor, true)) {\n        return;\n      } else {\n        nativeCommand(editor, 'ForwardDelete');\n      }\n    };\n    var setup$f = function (editor, caret) {\n      editor.addCommand('delete', function () {\n        deleteCommand(editor, caret);\n      });\n      editor.addCommand('forwardDelete', function () {\n        forwardDeleteCommand(editor, caret);\n      });\n    };\n\n    var SIGNIFICANT_MOVE = 5;\n    var LONGPRESS_DELAY = 400;\n    var getTouch = function (event) {\n      if (event.touches === undefined || event.touches.length !== 1) {\n        return Optional.none();\n      }\n      return Optional.some(event.touches[0]);\n    };\n    var isFarEnough = function (touch, data) {\n      var distX = Math.abs(touch.clientX - data.x);\n      var distY = Math.abs(touch.clientY - data.y);\n      return distX > SIGNIFICANT_MOVE || distY > SIGNIFICANT_MOVE;\n    };\n    var setup$e = function (editor) {\n      var startData = value();\n      var longpressFired = Cell(false);\n      var debounceLongpress = last(function (e) {\n        editor.fire('longpress', __assign(__assign({}, e), { type: 'longpress' }));\n        longpressFired.set(true);\n      }, LONGPRESS_DELAY);\n      editor.on('touchstart', function (e) {\n        getTouch(e).each(function (touch) {\n          debounceLongpress.cancel();\n          var data = {\n            x: touch.clientX,\n            y: touch.clientY,\n            target: e.target\n          };\n          debounceLongpress.throttle(e);\n          longpressFired.set(false);\n          startData.set(data);\n        });\n      }, true);\n      editor.on('touchmove', function (e) {\n        debounceLongpress.cancel();\n        getTouch(e).each(function (touch) {\n          startData.on(function (data) {\n            if (isFarEnough(touch, data)) {\n              startData.clear();\n              longpressFired.set(false);\n              editor.fire('longpresscancel');\n            }\n          });\n        });\n      }, true);\n      editor.on('touchend touchcancel', function (e) {\n        debounceLongpress.cancel();\n        if (e.type === 'touchcancel') {\n          return;\n        }\n        startData.get().filter(function (data) {\n          return data.target.isEqualNode(e.target);\n        }).each(function () {\n          if (longpressFired.get()) {\n            e.preventDefault();\n          } else {\n            editor.fire('tap', __assign(__assign({}, e), { type: 'tap' }));\n          }\n        });\n      }, true);\n    };\n\n    var isBlockElement = function (blockElements, node) {\n      return has$2(blockElements, node.nodeName);\n    };\n    var isValidTarget = function (blockElements, node) {\n      if (isText$7(node)) {\n        return true;\n      } else if (isElement$5(node)) {\n        return !isBlockElement(blockElements, node) && !isBookmarkNode$1(node);\n      } else {\n        return false;\n      }\n    };\n    var hasBlockParent = function (blockElements, root, node) {\n      return exists(parents(SugarElement.fromDom(node), SugarElement.fromDom(root)), function (elm) {\n        return isBlockElement(blockElements, elm.dom);\n      });\n    };\n    var shouldRemoveTextNode = function (blockElements, node) {\n      if (isText$7(node)) {\n        if (node.nodeValue.length === 0) {\n          return true;\n        } else if (/^\\s+$/.test(node.nodeValue) && (!node.nextSibling || isBlockElement(blockElements, node.nextSibling))) {\n          return true;\n        }\n      }\n      return false;\n    };\n    var addRootBlocks = function (editor) {\n      var dom = editor.dom, selection = editor.selection;\n      var schema = editor.schema, blockElements = schema.getBlockElements();\n      var node = selection.getStart();\n      var rootNode = editor.getBody();\n      var rootBlockNode, tempNode, wrapped;\n      var forcedRootBlock = getForcedRootBlock(editor);\n      if (!node || !isElement$5(node) || !forcedRootBlock) {\n        return;\n      }\n      var rootNodeName = rootNode.nodeName.toLowerCase();\n      if (!schema.isValidChild(rootNodeName, forcedRootBlock.toLowerCase()) || hasBlockParent(blockElements, rootNode, node)) {\n        return;\n      }\n      var rng = selection.getRng();\n      var startContainer = rng.startContainer;\n      var startOffset = rng.startOffset;\n      var endContainer = rng.endContainer;\n      var endOffset = rng.endOffset;\n      var restoreSelection = hasFocus(editor);\n      node = rootNode.firstChild;\n      while (node) {\n        if (isValidTarget(blockElements, node)) {\n          if (shouldRemoveTextNode(blockElements, node)) {\n            tempNode = node;\n            node = node.nextSibling;\n            dom.remove(tempNode);\n            continue;\n          }\n          if (!rootBlockNode) {\n            rootBlockNode = dom.create(forcedRootBlock, getForcedRootBlockAttrs(editor));\n            node.parentNode.insertBefore(rootBlockNode, node);\n            wrapped = true;\n          }\n          tempNode = node;\n          node = node.nextSibling;\n          rootBlockNode.appendChild(tempNode);\n        } else {\n          rootBlockNode = null;\n          node = node.nextSibling;\n        }\n      }\n      if (wrapped && restoreSelection) {\n        rng.setStart(startContainer, startOffset);\n        rng.setEnd(endContainer, endOffset);\n        selection.setRng(rng);\n        editor.nodeChanged();\n      }\n    };\n    var setup$d = function (editor) {\n      if (getForcedRootBlock(editor)) {\n        editor.on('NodeChange', curry(addRootBlocks, editor));\n      }\n    };\n\n    var findBlockCaretContainer = function (editor) {\n      return descendant(SugarElement.fromDom(editor.getBody()), '*[data-mce-caret]').map(function (elm) {\n        return elm.dom;\n      }).getOrNull();\n    };\n    var removeIeControlRect = function (editor) {\n      editor.selection.setRng(editor.selection.getRng());\n    };\n    var showBlockCaretContainer = function (editor, blockCaretContainer) {\n      if (blockCaretContainer.hasAttribute('data-mce-caret')) {\n        showCaretContainerBlock(blockCaretContainer);\n        removeIeControlRect(editor);\n        editor.selection.scrollIntoView(blockCaretContainer);\n      }\n    };\n    var handleBlockContainer = function (editor, e) {\n      var blockCaretContainer = findBlockCaretContainer(editor);\n      if (!blockCaretContainer) {\n        return;\n      }\n      if (e.type === 'compositionstart') {\n        e.preventDefault();\n        e.stopPropagation();\n        showBlockCaretContainer(editor, blockCaretContainer);\n        return;\n      }\n      if (hasContent(blockCaretContainer)) {\n        showBlockCaretContainer(editor, blockCaretContainer);\n        editor.undoManager.add();\n      }\n    };\n    var setup$c = function (editor) {\n      editor.on('keyup compositionstart', curry(handleBlockContainer, editor));\n    };\n\n    var isContentEditableFalse$2 = isContentEditableFalse$b;\n    var moveToCeFalseHorizontally = function (direction, editor, range) {\n      return moveHorizontally(editor, direction, range, isBeforeContentEditableFalse, isAfterContentEditableFalse, isContentEditableFalse$2);\n    };\n    var moveToCeFalseVertically = function (direction, editor, range) {\n      var isBefore = function (caretPosition) {\n        return isBeforeContentEditableFalse(caretPosition) || isBeforeTable(caretPosition);\n      };\n      var isAfter = function (caretPosition) {\n        return isAfterContentEditableFalse(caretPosition) || isAfterTable(caretPosition);\n      };\n      return moveVertically(editor, direction, range, isBefore, isAfter, isContentEditableFalse$2);\n    };\n    var createTextBlock = function (editor) {\n      var textBlock = editor.dom.create(getForcedRootBlock(editor));\n      if (!Env.ie || Env.ie >= 11) {\n        textBlock.innerHTML = '<br data-mce-bogus=\"1\">';\n      }\n      return textBlock;\n    };\n    var exitPreBlock = function (editor, direction, range) {\n      var caretWalker = CaretWalker(editor.getBody());\n      var getVisualCaretPosition$1 = curry(getVisualCaretPosition, direction === 1 ? caretWalker.next : caretWalker.prev);\n      if (range.collapsed && hasForcedRootBlock(editor)) {\n        var pre = editor.dom.getParent(range.startContainer, 'PRE');\n        if (!pre) {\n          return;\n        }\n        var caretPos = getVisualCaretPosition$1(CaretPosition.fromRangeStart(range));\n        if (!caretPos) {\n          var newBlock = createTextBlock(editor);\n          if (direction === 1) {\n            editor.$(pre).after(newBlock);\n          } else {\n            editor.$(pre).before(newBlock);\n          }\n          editor.selection.select(newBlock, true);\n          editor.selection.collapse();\n        }\n      }\n    };\n    var getHorizontalRange = function (editor, forward) {\n      var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n      var range = editor.selection.getRng();\n      return moveToCeFalseHorizontally(direction, editor, range).orThunk(function () {\n        exitPreBlock(editor, direction, range);\n        return Optional.none();\n      });\n    };\n    var getVerticalRange = function (editor, down) {\n      var direction = down ? 1 : -1;\n      var range = editor.selection.getRng();\n      return moveToCeFalseVertically(direction, editor, range).orThunk(function () {\n        exitPreBlock(editor, direction, range);\n        return Optional.none();\n      });\n    };\n    var moveH$2 = function (editor, forward) {\n      return getHorizontalRange(editor, forward).exists(function (newRange) {\n        moveToRange(editor, newRange);\n        return true;\n      });\n    };\n    var moveV$3 = function (editor, down) {\n      return getVerticalRange(editor, down).exists(function (newRange) {\n        moveToRange(editor, newRange);\n        return true;\n      });\n    };\n    var moveToLineEndPoint$1 = function (editor, forward) {\n      var isCefPosition = forward ? isAfterContentEditableFalse : isBeforeContentEditableFalse;\n      return moveToLineEndPoint$3(editor, forward, isCefPosition);\n    };\n\n    var isTarget = function (node) {\n      return contains$3(['figcaption'], name(node));\n    };\n    var rangeBefore = function (target) {\n      var rng = document.createRange();\n      rng.setStartBefore(target.dom);\n      rng.setEndBefore(target.dom);\n      return rng;\n    };\n    var insertElement = function (root, elm, forward) {\n      if (forward) {\n        append$1(root, elm);\n      } else {\n        prepend(root, elm);\n      }\n    };\n    var insertBr = function (root, forward) {\n      var br = SugarElement.fromTag('br');\n      insertElement(root, br, forward);\n      return rangeBefore(br);\n    };\n    var insertBlock = function (root, forward, blockName, attrs) {\n      var block = SugarElement.fromTag(blockName);\n      var br = SugarElement.fromTag('br');\n      setAll$1(block, attrs);\n      append$1(block, br);\n      insertElement(root, block, forward);\n      return rangeBefore(br);\n    };\n    var insertEmptyLine = function (root, rootBlockName, attrs, forward) {\n      if (rootBlockName === '') {\n        return insertBr(root, forward);\n      } else {\n        return insertBlock(root, forward, rootBlockName, attrs);\n      }\n    };\n    var getClosestTargetBlock = function (pos, root) {\n      var isRoot = curry(eq, root);\n      return closest$3(SugarElement.fromDom(pos.container()), isBlock$2, isRoot).filter(isTarget);\n    };\n    var isAtFirstOrLastLine = function (root, forward, pos) {\n      return forward ? isAtLastLine(root.dom, pos) : isAtFirstLine(root.dom, pos);\n    };\n    var moveCaretToNewEmptyLine = function (editor, forward) {\n      var root = SugarElement.fromDom(editor.getBody());\n      var pos = CaretPosition.fromRangeStart(editor.selection.getRng());\n      var rootBlock = getForcedRootBlock(editor);\n      var rootBlockAttrs = getForcedRootBlockAttrs(editor);\n      return getClosestTargetBlock(pos, root).exists(function () {\n        if (isAtFirstOrLastLine(root, forward, pos)) {\n          var rng = insertEmptyLine(root, rootBlock, rootBlockAttrs, forward);\n          editor.selection.setRng(rng);\n          return true;\n        } else {\n          return false;\n        }\n      });\n    };\n    var moveV$2 = function (editor, forward) {\n      if (editor.selection.isCollapsed()) {\n        return moveCaretToNewEmptyLine(editor, forward);\n      } else {\n        return false;\n      }\n    };\n\n    var defaultPatterns = function (patterns) {\n      return map$3(patterns, function (pattern) {\n        return __assign({\n          shiftKey: false,\n          altKey: false,\n          ctrlKey: false,\n          metaKey: false,\n          keyCode: 0,\n          action: noop\n        }, pattern);\n      });\n    };\n    var matchesEvent = function (pattern, evt) {\n      return evt.keyCode === pattern.keyCode && evt.shiftKey === pattern.shiftKey && evt.altKey === pattern.altKey && evt.ctrlKey === pattern.ctrlKey && evt.metaKey === pattern.metaKey;\n    };\n    var match$1 = function (patterns, evt) {\n      return bind(defaultPatterns(patterns), function (pattern) {\n        return matchesEvent(pattern, evt) ? [pattern] : [];\n      });\n    };\n    var action = function (f) {\n      var x = [];\n      for (var _i = 1; _i < arguments.length; _i++) {\n        x[_i - 1] = arguments[_i];\n      }\n      return function () {\n        return f.apply(null, x);\n      };\n    };\n    var execute = function (patterns, evt) {\n      return find$3(match$1(patterns, evt), function (pattern) {\n        return pattern.action();\n      });\n    };\n\n    var moveH$1 = function (editor, forward) {\n      var direction = forward ? HDirection.Forwards : HDirection.Backwards;\n      var range = editor.selection.getRng();\n      return moveHorizontally(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia$2).exists(function (newRange) {\n        moveToRange(editor, newRange);\n        return true;\n      });\n    };\n    var moveV$1 = function (editor, down) {\n      var direction = down ? 1 : -1;\n      var range = editor.selection.getRng();\n      return moveVertically(editor, direction, range, isBeforeMedia, isAfterMedia, isMedia$2).exists(function (newRange) {\n        moveToRange(editor, newRange);\n        return true;\n      });\n    };\n    var moveToLineEndPoint = function (editor, forward) {\n      var isNearMedia = forward ? isAfterMedia : isBeforeMedia;\n      return moveToLineEndPoint$3(editor, forward, isNearMedia);\n    };\n\n    var deflate = function (rect, delta) {\n      return {\n        left: rect.left - delta,\n        top: rect.top - delta,\n        right: rect.right + delta * 2,\n        bottom: rect.bottom + delta * 2,\n        width: rect.width + delta,\n        height: rect.height + delta\n      };\n    };\n    var getCorners = function (getYAxisValue, tds) {\n      return bind(tds, function (td) {\n        var rect = deflate(clone(td.getBoundingClientRect()), -1);\n        return [\n          {\n            x: rect.left,\n            y: getYAxisValue(rect),\n            cell: td\n          },\n          {\n            x: rect.right,\n            y: getYAxisValue(rect),\n            cell: td\n          }\n        ];\n      });\n    };\n    var findClosestCorner = function (corners, x, y) {\n      return foldl(corners, function (acc, newCorner) {\n        return acc.fold(function () {\n          return Optional.some(newCorner);\n        }, function (oldCorner) {\n          var oldDist = Math.sqrt(Math.abs(oldCorner.x - x) + Math.abs(oldCorner.y - y));\n          var newDist = Math.sqrt(Math.abs(newCorner.x - x) + Math.abs(newCorner.y - y));\n          return Optional.some(newDist < oldDist ? newCorner : oldCorner);\n        });\n      }, Optional.none());\n    };\n    var getClosestCell = function (getYAxisValue, isTargetCorner, table, x, y) {\n      var cells = descendants(SugarElement.fromDom(table), 'td,th,caption').map(function (e) {\n        return e.dom;\n      });\n      var corners = filter$4(getCorners(getYAxisValue, cells), function (corner) {\n        return isTargetCorner(corner, y);\n      });\n      return findClosestCorner(corners, x, y).map(function (corner) {\n        return corner.cell;\n      });\n    };\n    var getBottomValue = function (rect) {\n      return rect.bottom;\n    };\n    var getTopValue = function (rect) {\n      return rect.top;\n    };\n    var isAbove = function (corner, y) {\n      return corner.y < y;\n    };\n    var isBelow = function (corner, y) {\n      return corner.y > y;\n    };\n    var getClosestCellAbove = curry(getClosestCell, getBottomValue, isAbove);\n    var getClosestCellBelow = curry(getClosestCell, getTopValue, isBelow);\n    var findClosestPositionInAboveCell = function (table, pos) {\n      return head(pos.getClientRects()).bind(function (rect) {\n        return getClosestCellAbove(table, rect.left, rect.top);\n      }).bind(function (cell) {\n        return findClosestHorizontalPosition(getLastLinePositions(cell), pos);\n      });\n    };\n    var findClosestPositionInBelowCell = function (table, pos) {\n      return last$2(pos.getClientRects()).bind(function (rect) {\n        return getClosestCellBelow(table, rect.left, rect.top);\n      }).bind(function (cell) {\n        return findClosestHorizontalPosition(getFirstLinePositions(cell), pos);\n      });\n    };\n\n    var hasNextBreak = function (getPositionsUntil, scope, lineInfo) {\n      return lineInfo.breakAt.exists(function (breakPos) {\n        return getPositionsUntil(scope, breakPos).breakAt.isSome();\n      });\n    };\n    var startsWithWrapBreak = function (lineInfo) {\n      return lineInfo.breakType === BreakType.Wrap && lineInfo.positions.length === 0;\n    };\n    var startsWithBrBreak = function (lineInfo) {\n      return lineInfo.breakType === BreakType.Br && lineInfo.positions.length === 1;\n    };\n    var isAtTableCellLine = function (getPositionsUntil, scope, pos) {\n      var lineInfo = getPositionsUntil(scope, pos);\n      if (startsWithWrapBreak(lineInfo) || !isBr$5(pos.getNode()) && startsWithBrBreak(lineInfo)) {\n        return !hasNextBreak(getPositionsUntil, scope, lineInfo);\n      } else {\n        return lineInfo.breakAt.isNone();\n      }\n    };\n    var isAtFirstTableCellLine = curry(isAtTableCellLine, getPositionsUntilPreviousLine);\n    var isAtLastTableCellLine = curry(isAtTableCellLine, getPositionsUntilNextLine);\n    var isCaretAtStartOrEndOfTable = function (forward, rng, table) {\n      var caretPos = CaretPosition.fromRangeStart(rng);\n      return positionIn(!forward, table).exists(function (pos) {\n        return pos.isEqual(caretPos);\n      });\n    };\n    var navigateHorizontally = function (editor, forward, table, _td) {\n      var rng = editor.selection.getRng();\n      var direction = forward ? 1 : -1;\n      if (isFakeCaretTableBrowser() && isCaretAtStartOrEndOfTable(forward, rng, table)) {\n        showCaret(direction, editor, table, !forward, false).each(function (newRng) {\n          moveToRange(editor, newRng);\n        });\n        return true;\n      }\n      return false;\n    };\n    var getClosestAbovePosition = function (root, table, start) {\n      return findClosestPositionInAboveCell(table, start).orThunk(function () {\n        return head(start.getClientRects()).bind(function (rect) {\n          return findClosestHorizontalPositionFromPoint(getPositionsAbove(root, CaretPosition.before(table)), rect.left);\n        });\n      }).getOr(CaretPosition.before(table));\n    };\n    var getClosestBelowPosition = function (root, table, start) {\n      return findClosestPositionInBelowCell(table, start).orThunk(function () {\n        return head(start.getClientRects()).bind(function (rect) {\n          return findClosestHorizontalPositionFromPoint(getPositionsBelow(root, CaretPosition.after(table)), rect.left);\n        });\n      }).getOr(CaretPosition.after(table));\n    };\n    var getTable = function (previous, pos) {\n      var node = pos.getNode(previous);\n      return isElement$5(node) && node.nodeName === 'TABLE' ? Optional.some(node) : Optional.none();\n    };\n    var renderBlock = function (down, editor, table, pos) {\n      var forcedRootBlock = getForcedRootBlock(editor);\n      if (forcedRootBlock) {\n        editor.undoManager.transact(function () {\n          var element = SugarElement.fromTag(forcedRootBlock);\n          setAll$1(element, getForcedRootBlockAttrs(editor));\n          append$1(element, SugarElement.fromTag('br'));\n          if (down) {\n            after$3(SugarElement.fromDom(table), element);\n          } else {\n            before$4(SugarElement.fromDom(table), element);\n          }\n          var rng = editor.dom.createRng();\n          rng.setStart(element.dom, 0);\n          rng.setEnd(element.dom, 0);\n          moveToRange(editor, rng);\n        });\n      } else {\n        moveToRange(editor, pos.toRange());\n      }\n    };\n    var moveCaret = function (editor, down, pos) {\n      var table = down ? getTable(true, pos) : getTable(false, pos);\n      var last = down === false;\n      table.fold(function () {\n        return moveToRange(editor, pos.toRange());\n      }, function (table) {\n        return positionIn(last, editor.getBody()).filter(function (lastPos) {\n          return lastPos.isEqual(pos);\n        }).fold(function () {\n          return moveToRange(editor, pos.toRange());\n        }, function (_) {\n          return renderBlock(down, editor, table, pos);\n        });\n      });\n    };\n    var navigateVertically = function (editor, down, table, td) {\n      var rng = editor.selection.getRng();\n      var pos = CaretPosition.fromRangeStart(rng);\n      var root = editor.getBody();\n      if (!down && isAtFirstTableCellLine(td, pos)) {\n        var newPos = getClosestAbovePosition(root, table, pos);\n        moveCaret(editor, down, newPos);\n        return true;\n      } else if (down && isAtLastTableCellLine(td, pos)) {\n        var newPos = getClosestBelowPosition(root, table, pos);\n        moveCaret(editor, down, newPos);\n        return true;\n      } else {\n        return false;\n      }\n    };\n    var move$1 = function (editor, forward, mover) {\n      return Optional.from(editor.dom.getParent(editor.selection.getNode(), 'td,th')).bind(function (td) {\n        return Optional.from(editor.dom.getParent(td, 'table')).map(function (table) {\n          return mover(editor, forward, table, td);\n        });\n      }).getOr(false);\n    };\n    var moveH = function (editor, forward) {\n      return move$1(editor, forward, navigateHorizontally);\n    };\n    var moveV = function (editor, forward) {\n      return move$1(editor, forward, navigateVertically);\n    };\n\n    var executeKeydownOverride$3 = function (editor, caret, evt) {\n      var os = detect().os;\n      execute([\n        {\n          keyCode: VK.RIGHT,\n          action: action(moveH$2, editor, true)\n        },\n        {\n          keyCode: VK.LEFT,\n          action: action(moveH$2, editor, false)\n        },\n        {\n          keyCode: VK.UP,\n          action: action(moveV$3, editor, false)\n        },\n        {\n          keyCode: VK.DOWN,\n          action: action(moveV$3, editor, true)\n        },\n        {\n          keyCode: VK.RIGHT,\n          action: action(moveH, editor, true)\n        },\n        {\n          keyCode: VK.LEFT,\n          action: action(moveH, editor, false)\n        },\n        {\n          keyCode: VK.UP,\n          action: action(moveV, editor, false)\n        },\n        {\n          keyCode: VK.DOWN,\n          action: action(moveV, editor, true)\n        },\n        {\n          keyCode: VK.RIGHT,\n          action: action(moveH$1, editor, true)\n        },\n        {\n          keyCode: VK.LEFT,\n          action: action(moveH$1, editor, false)\n        },\n        {\n          keyCode: VK.UP,\n          action: action(moveV$1, editor, false)\n        },\n        {\n          keyCode: VK.DOWN,\n          action: action(moveV$1, editor, true)\n        },\n        {\n          keyCode: VK.RIGHT,\n          action: action(move$2, editor, caret, true)\n        },\n        {\n          keyCode: VK.LEFT,\n          action: action(move$2, editor, caret, false)\n        },\n        {\n          keyCode: VK.RIGHT,\n          ctrlKey: !os.isOSX(),\n          altKey: os.isOSX(),\n          action: action(moveNextWord, editor, caret)\n        },\n        {\n          keyCode: VK.LEFT,\n          ctrlKey: !os.isOSX(),\n          altKey: os.isOSX(),\n          action: action(movePrevWord, editor, caret)\n        },\n        {\n          keyCode: VK.UP,\n          action: action(moveV$2, editor, false)\n        },\n        {\n          keyCode: VK.DOWN,\n          action: action(moveV$2, editor, true)\n        }\n      ], evt).each(function (_) {\n        evt.preventDefault();\n      });\n    };\n    var setup$b = function (editor, caret) {\n      editor.on('keydown', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeydownOverride$3(editor, caret, evt);\n        }\n      });\n    };\n\n    var executeKeydownOverride$2 = function (editor, caret, evt) {\n      execute([\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete, editor, false)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$5, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$5, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$6, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$6, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$3, editor, caret, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$3, editor, caret, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$9, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$9, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$4, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$4, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$1, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$1, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$7, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$7, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$8, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$8, editor, true)\n        },\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(backspaceDelete$2, editor, false)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(backspaceDelete$2, editor, true)\n        }\n      ], evt).each(function (_) {\n        evt.preventDefault();\n      });\n    };\n    var executeKeyupOverride = function (editor, evt) {\n      execute([\n        {\n          keyCode: VK.BACKSPACE,\n          action: action(paddEmptyElement, editor)\n        },\n        {\n          keyCode: VK.DELETE,\n          action: action(paddEmptyElement, editor)\n        }\n      ], evt);\n    };\n    var setup$a = function (editor, caret) {\n      editor.on('keydown', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeydownOverride$2(editor, caret, evt);\n        }\n      });\n      editor.on('keyup', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeyupOverride(editor, evt);\n        }\n      });\n    };\n\n    var firstNonWhiteSpaceNodeSibling = function (node) {\n      while (node) {\n        if (node.nodeType === 1 || node.nodeType === 3 && node.data && /[\\r\\n\\s]/.test(node.data)) {\n          return node;\n        }\n        node = node.nextSibling;\n      }\n    };\n    var moveToCaretPosition = function (editor, root) {\n      var node, lastNode = root;\n      var dom = editor.dom;\n      var moveCaretBeforeOnEnterElementsMap = editor.schema.getMoveCaretBeforeOnEnterElements();\n      if (!root) {\n        return;\n      }\n      if (/^(LI|DT|DD)$/.test(root.nodeName)) {\n        var firstChild = firstNonWhiteSpaceNodeSibling(root.firstChild);\n        if (firstChild && /^(UL|OL|DL)$/.test(firstChild.nodeName)) {\n          root.insertBefore(dom.doc.createTextNode(nbsp), root.firstChild);\n        }\n      }\n      var rng = dom.createRng();\n      root.normalize();\n      if (root.hasChildNodes()) {\n        var walker = new DomTreeWalker(root, root);\n        while (node = walker.current()) {\n          if (isText$7(node)) {\n            rng.setStart(node, 0);\n            rng.setEnd(node, 0);\n            break;\n          }\n          if (moveCaretBeforeOnEnterElementsMap[node.nodeName.toLowerCase()]) {\n            rng.setStartBefore(node);\n            rng.setEndBefore(node);\n            break;\n          }\n          lastNode = node;\n          node = walker.next();\n        }\n        if (!node) {\n          rng.setStart(lastNode, 0);\n          rng.setEnd(lastNode, 0);\n        }\n      } else {\n        if (isBr$5(root)) {\n          if (root.nextSibling && dom.isBlock(root.nextSibling)) {\n            rng.setStartBefore(root);\n            rng.setEndBefore(root);\n          } else {\n            rng.setStartAfter(root);\n            rng.setEndAfter(root);\n          }\n        } else {\n          rng.setStart(root, 0);\n          rng.setEnd(root, 0);\n        }\n      }\n      editor.selection.setRng(rng);\n      scrollRangeIntoView(editor, rng);\n    };\n    var getEditableRoot$1 = function (dom, node) {\n      var root = dom.getRoot();\n      var parent, editableRoot;\n      parent = node;\n      while (parent !== root && dom.getContentEditable(parent) !== 'false') {\n        if (dom.getContentEditable(parent) === 'true') {\n          editableRoot = parent;\n        }\n        parent = parent.parentNode;\n      }\n      return parent !== root ? editableRoot : root;\n    };\n    var getParentBlock = function (editor) {\n      return Optional.from(editor.dom.getParent(editor.selection.getStart(true), editor.dom.isBlock));\n    };\n    var getParentBlockName = function (editor) {\n      return getParentBlock(editor).fold(constant(''), function (parentBlock) {\n        return parentBlock.nodeName.toUpperCase();\n      });\n    };\n    var isListItemParentBlock = function (editor) {\n      return getParentBlock(editor).filter(function (elm) {\n        return isListItem(SugarElement.fromDom(elm));\n      }).isSome();\n    };\n\n    var hasFirstChild = function (elm, name) {\n      return elm.firstChild && elm.firstChild.nodeName === name;\n    };\n    var isFirstChild = function (elm) {\n      var _a;\n      return ((_a = elm.parentNode) === null || _a === void 0 ? void 0 : _a.firstChild) === elm;\n    };\n    var hasParent = function (elm, parentName) {\n      return elm && elm.parentNode && elm.parentNode.nodeName === parentName;\n    };\n    var isListBlock = function (elm) {\n      return elm && /^(OL|UL|LI)$/.test(elm.nodeName);\n    };\n    var isNestedList = function (elm) {\n      return isListBlock(elm) && isListBlock(elm.parentNode);\n    };\n    var getContainerBlock = function (containerBlock) {\n      var containerBlockParent = containerBlock.parentNode;\n      if (/^(LI|DT|DD)$/.test(containerBlockParent.nodeName)) {\n        return containerBlockParent;\n      }\n      return containerBlock;\n    };\n    var isFirstOrLastLi = function (containerBlock, parentBlock, first) {\n      var node = containerBlock[first ? 'firstChild' : 'lastChild'];\n      while (node) {\n        if (isElement$5(node)) {\n          break;\n        }\n        node = node[first ? 'nextSibling' : 'previousSibling'];\n      }\n      return node === parentBlock;\n    };\n    var insert$3 = function (editor, createNewBlock, containerBlock, parentBlock, newBlockName) {\n      var dom = editor.dom;\n      var rng = editor.selection.getRng();\n      if (containerBlock === editor.getBody()) {\n        return;\n      }\n      if (isNestedList(containerBlock)) {\n        newBlockName = 'LI';\n      }\n      var newBlock = newBlockName ? createNewBlock(newBlockName) : dom.create('BR');\n      if (isFirstOrLastLi(containerBlock, parentBlock, true) && isFirstOrLastLi(containerBlock, parentBlock, false)) {\n        if (hasParent(containerBlock, 'LI')) {\n          var containerBlockParent = getContainerBlock(containerBlock);\n          dom.insertAfter(newBlock, containerBlockParent);\n          if (isFirstChild(containerBlock)) {\n            dom.remove(containerBlockParent);\n          } else {\n            dom.remove(containerBlock);\n          }\n        } else {\n          dom.replace(newBlock, containerBlock);\n        }\n      } else if (isFirstOrLastLi(containerBlock, parentBlock, true)) {\n        if (hasParent(containerBlock, 'LI')) {\n          dom.insertAfter(newBlock, getContainerBlock(containerBlock));\n          newBlock.appendChild(dom.doc.createTextNode(' '));\n          newBlock.appendChild(containerBlock);\n        } else {\n          containerBlock.parentNode.insertBefore(newBlock, containerBlock);\n        }\n        dom.remove(parentBlock);\n      } else if (isFirstOrLastLi(containerBlock, parentBlock, false)) {\n        dom.insertAfter(newBlock, getContainerBlock(containerBlock));\n        dom.remove(parentBlock);\n      } else {\n        containerBlock = getContainerBlock(containerBlock);\n        var tmpRng = rng.cloneRange();\n        tmpRng.setStartAfter(parentBlock);\n        tmpRng.setEndAfter(containerBlock);\n        var fragment = tmpRng.extractContents();\n        if (newBlockName === 'LI' && hasFirstChild(fragment, 'LI')) {\n          newBlock = fragment.firstChild;\n          dom.insertAfter(fragment, containerBlock);\n        } else {\n          dom.insertAfter(fragment, containerBlock);\n          dom.insertAfter(newBlock, containerBlock);\n        }\n        dom.remove(parentBlock);\n      }\n      moveToCaretPosition(editor, newBlock);\n    };\n\n    var trimZwsp = function (fragment) {\n      each$k(descendants$1(SugarElement.fromDom(fragment), isText$8), function (text) {\n        var rawNode = text.dom;\n        rawNode.nodeValue = trim$3(rawNode.nodeValue);\n      });\n    };\n    var isEmptyAnchor = function (dom, elm) {\n      return elm && elm.nodeName === 'A' && dom.isEmpty(elm);\n    };\n    var isTableCell = function (node) {\n      return node && /^(TD|TH|CAPTION)$/.test(node.nodeName);\n    };\n    var emptyBlock = function (elm) {\n      elm.innerHTML = '<br data-mce-bogus=\"1\">';\n    };\n    var containerAndSiblingName = function (container, nodeName) {\n      return container.nodeName === nodeName || container.previousSibling && container.previousSibling.nodeName === nodeName;\n    };\n    var canSplitBlock = function (dom, node) {\n      return node && dom.isBlock(node) && !/^(TD|TH|CAPTION|FORM)$/.test(node.nodeName) && !/^(fixed|absolute)/i.test(node.style.position) && dom.getContentEditable(node) !== 'true';\n    };\n    var trimInlineElementsOnLeftSideOfBlock = function (dom, nonEmptyElementsMap, block) {\n      var node = block;\n      var firstChilds = [];\n      var i;\n      if (!node) {\n        return;\n      }\n      while (node = node.firstChild) {\n        if (dom.isBlock(node)) {\n          return;\n        }\n        if (isElement$5(node) && !nonEmptyElementsMap[node.nodeName.toLowerCase()]) {\n          firstChilds.push(node);\n        }\n      }\n      i = firstChilds.length;\n      while (i--) {\n        node = firstChilds[i];\n        if (!node.hasChildNodes() || node.firstChild === node.lastChild && node.firstChild.nodeValue === '') {\n          dom.remove(node);\n        } else {\n          if (isEmptyAnchor(dom, node)) {\n            dom.remove(node);\n          }\n        }\n      }\n    };\n    var normalizeZwspOffset = function (start, container, offset) {\n      if (isText$7(container) === false) {\n        return offset;\n      } else if (start) {\n        return offset === 1 && container.data.charAt(offset - 1) === ZWSP$1 ? 0 : offset;\n      } else {\n        return offset === container.data.length - 1 && container.data.charAt(offset) === ZWSP$1 ? container.data.length : offset;\n      }\n    };\n    var includeZwspInRange = function (rng) {\n      var newRng = rng.cloneRange();\n      newRng.setStart(rng.startContainer, normalizeZwspOffset(true, rng.startContainer, rng.startOffset));\n      newRng.setEnd(rng.endContainer, normalizeZwspOffset(false, rng.endContainer, rng.endOffset));\n      return newRng;\n    };\n    var trimLeadingLineBreaks = function (node) {\n      do {\n        if (isText$7(node)) {\n          node.nodeValue = node.nodeValue.replace(/^[\\r\\n]+/, '');\n        }\n        node = node.firstChild;\n      } while (node);\n    };\n    var getEditableRoot = function (dom, node) {\n      var root = dom.getRoot();\n      var parent, editableRoot;\n      parent = node;\n      while (parent !== root && dom.getContentEditable(parent) !== 'false') {\n        if (dom.getContentEditable(parent) === 'true') {\n          editableRoot = parent;\n        }\n        parent = parent.parentNode;\n      }\n      return parent !== root ? editableRoot : root;\n    };\n    var applyAttributes = function (editor, node, forcedRootBlockAttrs) {\n      var dom = editor.dom;\n      Optional.from(forcedRootBlockAttrs.style).map(dom.parseStyle).each(function (attrStyles) {\n        var currentStyles = getAllRaw(SugarElement.fromDom(node));\n        var newStyles = __assign(__assign({}, currentStyles), attrStyles);\n        dom.setStyles(node, newStyles);\n      });\n      var attrClassesOpt = Optional.from(forcedRootBlockAttrs.class).map(function (attrClasses) {\n        return attrClasses.split(/\\s+/);\n      });\n      var currentClassesOpt = Optional.from(node.className).map(function (currentClasses) {\n        return filter$4(currentClasses.split(/\\s+/), function (clazz) {\n          return clazz !== '';\n        });\n      });\n      lift2(attrClassesOpt, currentClassesOpt, function (attrClasses, currentClasses) {\n        var filteredClasses = filter$4(currentClasses, function (clazz) {\n          return !contains$3(attrClasses, clazz);\n        });\n        var newClasses = __spreadArray(__spreadArray([], attrClasses, true), filteredClasses, true);\n        dom.setAttrib(node, 'class', newClasses.join(' '));\n      });\n      var appliedAttrs = [\n        'style',\n        'class'\n      ];\n      var remainingAttrs = filter$3(forcedRootBlockAttrs, function (_, attrs) {\n        return !contains$3(appliedAttrs, attrs);\n      });\n      dom.setAttribs(node, remainingAttrs);\n    };\n    var setForcedBlockAttrs = function (editor, node) {\n      var forcedRootBlockName = getForcedRootBlock(editor);\n      if (forcedRootBlockName && forcedRootBlockName.toLowerCase() === node.tagName.toLowerCase()) {\n        var forcedRootBlockAttrs = getForcedRootBlockAttrs(editor);\n        applyAttributes(editor, node, forcedRootBlockAttrs);\n      }\n    };\n    var wrapSelfAndSiblingsInDefaultBlock = function (editor, newBlockName, rng, container, offset) {\n      var newBlock, parentBlock, startNode, node, next, rootBlockName;\n      var blockName = newBlockName || 'P';\n      var dom = editor.dom, editableRoot = getEditableRoot(dom, container);\n      parentBlock = dom.getParent(container, dom.isBlock);\n      if (!parentBlock || !canSplitBlock(dom, parentBlock)) {\n        parentBlock = parentBlock || editableRoot;\n        if (parentBlock === editor.getBody() || isTableCell(parentBlock)) {\n          rootBlockName = parentBlock.nodeName.toLowerCase();\n        } else {\n          rootBlockName = parentBlock.parentNode.nodeName.toLowerCase();\n        }\n        if (!parentBlock.hasChildNodes()) {\n          newBlock = dom.create(blockName);\n          setForcedBlockAttrs(editor, newBlock);\n          parentBlock.appendChild(newBlock);\n          rng.setStart(newBlock, 0);\n          rng.setEnd(newBlock, 0);\n          return newBlock;\n        }\n        node = container;\n        while (node.parentNode !== parentBlock) {\n          node = node.parentNode;\n        }\n        while (node && !dom.isBlock(node)) {\n          startNode = node;\n          node = node.previousSibling;\n        }\n        if (startNode && editor.schema.isValidChild(rootBlockName, blockName.toLowerCase())) {\n          newBlock = dom.create(blockName);\n          setForcedBlockAttrs(editor, newBlock);\n          startNode.parentNode.insertBefore(newBlock, startNode);\n          node = startNode;\n          while (node && !dom.isBlock(node)) {\n            next = node.nextSibling;\n            newBlock.appendChild(node);\n            node = next;\n          }\n          rng.setStart(container, offset);\n          rng.setEnd(container, offset);\n        }\n      }\n      return container;\n    };\n    var addBrToBlockIfNeeded = function (dom, block) {\n      block.normalize();\n      var lastChild = block.lastChild;\n      if (!lastChild || /^(left|right)$/gi.test(dom.getStyle(lastChild, 'float', true))) {\n        dom.add(block, 'br');\n      }\n    };\n    var insert$2 = function (editor, evt) {\n      var tmpRng, container, offset, parentBlock;\n      var newBlock, fragment, containerBlock, parentBlockName, newBlockName, isAfterLastNodeInContainer;\n      var dom = editor.dom;\n      var schema = editor.schema, nonEmptyElementsMap = schema.getNonEmptyElements();\n      var rng = editor.selection.getRng();\n      var createNewBlock = function (name) {\n        var node = container, block, clonedNode, caretNode;\n        var textInlineElements = schema.getTextInlineElements();\n        if (name || parentBlockName === 'TABLE' || parentBlockName === 'HR') {\n          block = dom.create(name || newBlockName);\n        } else {\n          block = parentBlock.cloneNode(false);\n        }\n        caretNode = block;\n        if (shouldKeepStyles(editor) === false) {\n          dom.setAttrib(block, 'style', null);\n          dom.setAttrib(block, 'class', null);\n        } else {\n          do {\n            if (textInlineElements[node.nodeName]) {\n              if (isCaretNode(node) || isBookmarkNode$1(node)) {\n                continue;\n              }\n              clonedNode = node.cloneNode(false);\n              dom.setAttrib(clonedNode, 'id', '');\n              if (block.hasChildNodes()) {\n                clonedNode.appendChild(block.firstChild);\n                block.appendChild(clonedNode);\n              } else {\n                caretNode = clonedNode;\n                block.appendChild(clonedNode);\n              }\n            }\n          } while ((node = node.parentNode) && node !== editableRoot);\n        }\n        setForcedBlockAttrs(editor, block);\n        emptyBlock(caretNode);\n        return block;\n      };\n      var isCaretAtStartOrEndOfBlock = function (start) {\n        var node, name;\n        var normalizedOffset = normalizeZwspOffset(start, container, offset);\n        if (isText$7(container) && (start ? normalizedOffset > 0 : normalizedOffset < container.nodeValue.length)) {\n          return false;\n        }\n        if (container.parentNode === parentBlock && isAfterLastNodeInContainer && !start) {\n          return true;\n        }\n        if (start && isElement$5(container) && container === parentBlock.firstChild) {\n          return true;\n        }\n        if (containerAndSiblingName(container, 'TABLE') || containerAndSiblingName(container, 'HR')) {\n          return isAfterLastNodeInContainer && !start || !isAfterLastNodeInContainer && start;\n        }\n        var walker = new DomTreeWalker(container, parentBlock);\n        if (isText$7(container)) {\n          if (start && normalizedOffset === 0) {\n            walker.prev();\n          } else if (!start && normalizedOffset === container.nodeValue.length) {\n            walker.next();\n          }\n        }\n        while (node = walker.current()) {\n          if (isElement$5(node)) {\n            if (!node.getAttribute('data-mce-bogus')) {\n              name = node.nodeName.toLowerCase();\n              if (nonEmptyElementsMap[name] && name !== 'br') {\n                return false;\n              }\n            }\n          } else if (isText$7(node) && !isWhitespaceText(node.nodeValue)) {\n            return false;\n          }\n          if (start) {\n            walker.prev();\n          } else {\n            walker.next();\n          }\n        }\n        return true;\n      };\n      var insertNewBlockAfter = function () {\n        if (/^(H[1-6]|PRE|FIGURE)$/.test(parentBlockName) && containerBlockName !== 'HGROUP') {\n          newBlock = createNewBlock(newBlockName);\n        } else {\n          newBlock = createNewBlock();\n        }\n        if (shouldEndContainerOnEmptyBlock(editor) && canSplitBlock(dom, containerBlock) && dom.isEmpty(parentBlock)) {\n          newBlock = dom.split(containerBlock, parentBlock);\n        } else {\n          dom.insertAfter(newBlock, parentBlock);\n        }\n        moveToCaretPosition(editor, newBlock);\n      };\n      normalize$2(dom, rng).each(function (normRng) {\n        rng.setStart(normRng.startContainer, normRng.startOffset);\n        rng.setEnd(normRng.endContainer, normRng.endOffset);\n      });\n      container = rng.startContainer;\n      offset = rng.startOffset;\n      newBlockName = getForcedRootBlock(editor);\n      var shiftKey = !!(evt && evt.shiftKey);\n      var ctrlKey = !!(evt && evt.ctrlKey);\n      if (isElement$5(container) && container.hasChildNodes()) {\n        isAfterLastNodeInContainer = offset > container.childNodes.length - 1;\n        container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\n        if (isAfterLastNodeInContainer && isText$7(container)) {\n          offset = container.nodeValue.length;\n        } else {\n          offset = 0;\n        }\n      }\n      var editableRoot = getEditableRoot(dom, container);\n      if (!editableRoot) {\n        return;\n      }\n      if (newBlockName && !shiftKey || !newBlockName && shiftKey) {\n        container = wrapSelfAndSiblingsInDefaultBlock(editor, newBlockName, rng, container, offset);\n      }\n      parentBlock = dom.getParent(container, dom.isBlock);\n      containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\n      parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : '';\n      var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';\n      if (containerBlockName === 'LI' && !ctrlKey) {\n        parentBlock = containerBlock;\n        containerBlock = containerBlock.parentNode;\n        parentBlockName = containerBlockName;\n      }\n      if (/^(LI|DT|DD)$/.test(parentBlockName)) {\n        if (dom.isEmpty(parentBlock)) {\n          insert$3(editor, createNewBlock, containerBlock, parentBlock, newBlockName);\n          return;\n        }\n      }\n      if (newBlockName && parentBlock === editor.getBody()) {\n        return;\n      }\n      newBlockName = newBlockName || 'P';\n      if (isCaretContainerBlock$1(parentBlock)) {\n        newBlock = showCaretContainerBlock(parentBlock);\n        if (dom.isEmpty(parentBlock)) {\n          emptyBlock(parentBlock);\n        }\n        setForcedBlockAttrs(editor, newBlock);\n        moveToCaretPosition(editor, newBlock);\n      } else if (isCaretAtStartOrEndOfBlock()) {\n        insertNewBlockAfter();\n      } else if (isCaretAtStartOrEndOfBlock(true)) {\n        newBlock = parentBlock.parentNode.insertBefore(createNewBlock(), parentBlock);\n        moveToCaretPosition(editor, containerAndSiblingName(parentBlock, 'HR') ? newBlock : parentBlock);\n      } else {\n        tmpRng = includeZwspInRange(rng).cloneRange();\n        tmpRng.setEndAfter(parentBlock);\n        fragment = tmpRng.extractContents();\n        trimZwsp(fragment);\n        trimLeadingLineBreaks(fragment);\n        newBlock = fragment.firstChild;\n        dom.insertAfter(fragment, parentBlock);\n        trimInlineElementsOnLeftSideOfBlock(dom, nonEmptyElementsMap, newBlock);\n        addBrToBlockIfNeeded(dom, parentBlock);\n        if (dom.isEmpty(parentBlock)) {\n          emptyBlock(parentBlock);\n        }\n        newBlock.normalize();\n        if (dom.isEmpty(newBlock)) {\n          dom.remove(newBlock);\n          insertNewBlockAfter();\n        } else {\n          setForcedBlockAttrs(editor, newBlock);\n          moveToCaretPosition(editor, newBlock);\n        }\n      }\n      dom.setAttrib(newBlock, 'id', '');\n      editor.fire('NewBlock', { newBlock: newBlock });\n    };\n\n    var hasRightSideContent = function (schema, container, parentBlock) {\n      var walker = new DomTreeWalker(container, parentBlock);\n      var node;\n      var nonEmptyElementsMap = schema.getNonEmptyElements();\n      while (node = walker.next()) {\n        if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {\n          return true;\n        }\n      }\n    };\n    var moveSelectionToBr = function (editor, brElm, extraBr) {\n      var rng = editor.dom.createRng();\n      if (!extraBr) {\n        rng.setStartAfter(brElm);\n        rng.setEndAfter(brElm);\n      } else {\n        rng.setStartBefore(brElm);\n        rng.setEndBefore(brElm);\n      }\n      editor.selection.setRng(rng);\n      scrollRangeIntoView(editor, rng);\n    };\n    var insertBrAtCaret = function (editor, evt) {\n      var selection = editor.selection;\n      var dom = editor.dom;\n      var rng = selection.getRng();\n      var brElm;\n      var extraBr;\n      normalize$2(dom, rng).each(function (normRng) {\n        rng.setStart(normRng.startContainer, normRng.startOffset);\n        rng.setEnd(normRng.endContainer, normRng.endOffset);\n      });\n      var offset = rng.startOffset;\n      var container = rng.startContainer;\n      if (container.nodeType === 1 && container.hasChildNodes()) {\n        var isAfterLastNodeInContainer = offset > container.childNodes.length - 1;\n        container = container.childNodes[Math.min(offset, container.childNodes.length - 1)] || container;\n        if (isAfterLastNodeInContainer && container.nodeType === 3) {\n          offset = container.nodeValue.length;\n        } else {\n          offset = 0;\n        }\n      }\n      var parentBlock = dom.getParent(container, dom.isBlock);\n      var containerBlock = parentBlock ? dom.getParent(parentBlock.parentNode, dom.isBlock) : null;\n      var containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : '';\n      var isControlKey = !!(evt && evt.ctrlKey);\n      if (containerBlockName === 'LI' && !isControlKey) {\n        parentBlock = containerBlock;\n      }\n      if (container && container.nodeType === 3 && offset >= container.nodeValue.length) {\n        if (!hasRightSideContent(editor.schema, container, parentBlock)) {\n          brElm = dom.create('br');\n          rng.insertNode(brElm);\n          rng.setStartAfter(brElm);\n          rng.setEndAfter(brElm);\n          extraBr = true;\n        }\n      }\n      brElm = dom.create('br');\n      rangeInsertNode(dom, rng, brElm);\n      moveSelectionToBr(editor, brElm, extraBr);\n      editor.undoManager.add();\n    };\n    var insertBrBefore = function (editor, inline) {\n      var br = SugarElement.fromTag('br');\n      before$4(SugarElement.fromDom(inline), br);\n      editor.undoManager.add();\n    };\n    var insertBrAfter = function (editor, inline) {\n      if (!hasBrAfter(editor.getBody(), inline)) {\n        after$3(SugarElement.fromDom(inline), SugarElement.fromTag('br'));\n      }\n      var br = SugarElement.fromTag('br');\n      after$3(SugarElement.fromDom(inline), br);\n      moveSelectionToBr(editor, br.dom, false);\n      editor.undoManager.add();\n    };\n    var isBeforeBr = function (pos) {\n      return isBr$5(pos.getNode());\n    };\n    var hasBrAfter = function (rootNode, startNode) {\n      if (isBeforeBr(CaretPosition.after(startNode))) {\n        return true;\n      } else {\n        return nextPosition(rootNode, CaretPosition.after(startNode)).map(function (pos) {\n          return isBr$5(pos.getNode());\n        }).getOr(false);\n      }\n    };\n    var isAnchorLink = function (elm) {\n      return elm && elm.nodeName === 'A' && 'href' in elm;\n    };\n    var isInsideAnchor = function (location) {\n      return location.fold(never, isAnchorLink, isAnchorLink, never);\n    };\n    var readInlineAnchorLocation = function (editor) {\n      var isInlineTarget$1 = curry(isInlineTarget, editor);\n      var position = CaretPosition.fromRangeStart(editor.selection.getRng());\n      return readLocation(isInlineTarget$1, editor.getBody(), position).filter(isInsideAnchor);\n    };\n    var insertBrOutsideAnchor = function (editor, location) {\n      location.fold(noop, curry(insertBrBefore, editor), curry(insertBrAfter, editor), noop);\n    };\n    var insert$1 = function (editor, evt) {\n      var anchorLocation = readInlineAnchorLocation(editor);\n      if (anchorLocation.isSome()) {\n        anchorLocation.each(curry(insertBrOutsideAnchor, editor));\n      } else {\n        insertBrAtCaret(editor, evt);\n      }\n    };\n\n    var matchesSelector = function (editor, selector) {\n      return getParentBlock(editor).filter(function (parentBlock) {\n        return selector.length > 0 && is$2(SugarElement.fromDom(parentBlock), selector);\n      }).isSome();\n    };\n    var shouldInsertBr = function (editor) {\n      return matchesSelector(editor, getBrNewLineSelector(editor));\n    };\n    var shouldBlockNewLine$1 = function (editor) {\n      return matchesSelector(editor, getNoNewLineSelector(editor));\n    };\n\n    var newLineAction = Adt.generate([\n      { br: [] },\n      { block: [] },\n      { none: [] }\n    ]);\n    var shouldBlockNewLine = function (editor, _shiftKey) {\n      return shouldBlockNewLine$1(editor);\n    };\n    var isBrMode = function (requiredState) {\n      return function (editor, _shiftKey) {\n        var brMode = getForcedRootBlock(editor) === '';\n        return brMode === requiredState;\n      };\n    };\n    var inListBlock = function (requiredState) {\n      return function (editor, _shiftKey) {\n        return isListItemParentBlock(editor) === requiredState;\n      };\n    };\n    var inBlock = function (blockName, requiredState) {\n      return function (editor, _shiftKey) {\n        var state = getParentBlockName(editor) === blockName.toUpperCase();\n        return state === requiredState;\n      };\n    };\n    var inPreBlock = function (requiredState) {\n      return inBlock('pre', requiredState);\n    };\n    var inSummaryBlock = function () {\n      return inBlock('summary', true);\n    };\n    var shouldPutBrInPre = function (requiredState) {\n      return function (editor, _shiftKey) {\n        return shouldPutBrInPre$1(editor) === requiredState;\n      };\n    };\n    var inBrContext = function (editor, _shiftKey) {\n      return shouldInsertBr(editor);\n    };\n    var hasShiftKey = function (_editor, shiftKey) {\n      return shiftKey;\n    };\n    var canInsertIntoEditableRoot = function (editor) {\n      var forcedRootBlock = getForcedRootBlock(editor);\n      var rootEditable = getEditableRoot$1(editor.dom, editor.selection.getStart());\n      return rootEditable && editor.schema.isValidChild(rootEditable.nodeName, forcedRootBlock ? forcedRootBlock : 'P');\n    };\n    var match = function (predicates, action) {\n      return function (editor, shiftKey) {\n        var isMatch = foldl(predicates, function (res, p) {\n          return res && p(editor, shiftKey);\n        }, true);\n        return isMatch ? Optional.some(action) : Optional.none();\n      };\n    };\n    var getAction = function (editor, evt) {\n      return evaluateUntil([\n        match([shouldBlockNewLine], newLineAction.none()),\n        match([inSummaryBlock()], newLineAction.br()),\n        match([\n          inPreBlock(true),\n          shouldPutBrInPre(false),\n          hasShiftKey\n        ], newLineAction.br()),\n        match([\n          inPreBlock(true),\n          shouldPutBrInPre(false)\n        ], newLineAction.block()),\n        match([\n          inPreBlock(true),\n          shouldPutBrInPre(true),\n          hasShiftKey\n        ], newLineAction.block()),\n        match([\n          inPreBlock(true),\n          shouldPutBrInPre(true)\n        ], newLineAction.br()),\n        match([\n          inListBlock(true),\n          hasShiftKey\n        ], newLineAction.br()),\n        match([inListBlock(true)], newLineAction.block()),\n        match([\n          isBrMode(true),\n          hasShiftKey,\n          canInsertIntoEditableRoot\n        ], newLineAction.block()),\n        match([isBrMode(true)], newLineAction.br()),\n        match([inBrContext], newLineAction.br()),\n        match([\n          isBrMode(false),\n          hasShiftKey\n        ], newLineAction.br()),\n        match([canInsertIntoEditableRoot], newLineAction.block())\n      ], [\n        editor,\n        !!(evt && evt.shiftKey)\n      ]).getOr(newLineAction.none());\n    };\n\n    var insert = function (editor, evt) {\n      getAction(editor, evt).fold(function () {\n        insert$1(editor, evt);\n      }, function () {\n        insert$2(editor, evt);\n      }, noop);\n    };\n\n    var handleEnterKeyEvent = function (editor, event) {\n      if (event.isDefaultPrevented()) {\n        return;\n      }\n      event.preventDefault();\n      endTypingLevelIgnoreLocks(editor.undoManager);\n      editor.undoManager.transact(function () {\n        if (editor.selection.isCollapsed() === false) {\n          editor.execCommand('Delete');\n        }\n        insert(editor, event);\n      });\n    };\n    var setup$9 = function (editor) {\n      editor.on('keydown', function (event) {\n        if (event.keyCode === VK.ENTER) {\n          handleEnterKeyEvent(editor, event);\n        }\n      });\n    };\n\n    var executeKeydownOverride$1 = function (editor, caret, evt) {\n      execute([\n        {\n          keyCode: VK.END,\n          action: action(moveToLineEndPoint$1, editor, true)\n        },\n        {\n          keyCode: VK.HOME,\n          action: action(moveToLineEndPoint$1, editor, false)\n        },\n        {\n          keyCode: VK.END,\n          action: action(moveToLineEndPoint, editor, true)\n        },\n        {\n          keyCode: VK.HOME,\n          action: action(moveToLineEndPoint, editor, false)\n        },\n        {\n          keyCode: VK.END,\n          action: action(moveToLineEndPoint$2, editor, true, caret)\n        },\n        {\n          keyCode: VK.HOME,\n          action: action(moveToLineEndPoint$2, editor, false, caret)\n        }\n      ], evt).each(function (_) {\n        evt.preventDefault();\n      });\n    };\n    var setup$8 = function (editor, caret) {\n      editor.on('keydown', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeydownOverride$1(editor, caret, evt);\n        }\n      });\n    };\n\n    var browser = detect().browser;\n    var setupIeInput = function (editor) {\n      var keypressThrotter = first(function () {\n        if (!editor.composing) {\n          normalizeNbspsInEditor(editor);\n        }\n      }, 0);\n      if (browser.isIE()) {\n        editor.on('keypress', function (_e) {\n          keypressThrotter.throttle();\n        });\n        editor.on('remove', function (_e) {\n          keypressThrotter.cancel();\n        });\n      }\n    };\n    var setup$7 = function (editor) {\n      setupIeInput(editor);\n      editor.on('input', function (e) {\n        if (e.isComposing === false) {\n          normalizeNbspsInEditor(editor);\n        }\n      });\n    };\n\n    var platform = detect();\n    var executeKeyupAction = function (editor, caret, evt) {\n      execute([\n        {\n          keyCode: VK.PAGE_UP,\n          action: action(moveToLineEndPoint$2, editor, false, caret)\n        },\n        {\n          keyCode: VK.PAGE_DOWN,\n          action: action(moveToLineEndPoint$2, editor, true, caret)\n        }\n      ], evt);\n    };\n    var stopImmediatePropagation = function (e) {\n      return e.stopImmediatePropagation();\n    };\n    var isPageUpDown = function (evt) {\n      return evt.keyCode === VK.PAGE_UP || evt.keyCode === VK.PAGE_DOWN;\n    };\n    var setNodeChangeBlocker = function (blocked, editor, block) {\n      if (block && !blocked.get()) {\n        editor.on('NodeChange', stopImmediatePropagation, true);\n      } else if (!block && blocked.get()) {\n        editor.off('NodeChange', stopImmediatePropagation);\n      }\n      blocked.set(block);\n    };\n    var setup$6 = function (editor, caret) {\n      if (platform.os.isOSX()) {\n        return;\n      }\n      var blocked = Cell(false);\n      editor.on('keydown', function (evt) {\n        if (isPageUpDown(evt)) {\n          setNodeChangeBlocker(blocked, editor, true);\n        }\n      });\n      editor.on('keyup', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeyupAction(editor, caret, evt);\n        }\n        if (isPageUpDown(evt) && blocked.get()) {\n          setNodeChangeBlocker(blocked, editor, false);\n          editor.nodeChanged();\n        }\n      });\n    };\n\n    var insertTextAtPosition = function (text, pos) {\n      var container = pos.container();\n      var offset = pos.offset();\n      if (isText$7(container)) {\n        container.insertData(offset, text);\n        return Optional.some(CaretPosition(container, offset + text.length));\n      } else {\n        return getElementFromPosition(pos).map(function (elm) {\n          var textNode = SugarElement.fromText(text);\n          if (pos.isAtEnd()) {\n            after$3(elm, textNode);\n          } else {\n            before$4(elm, textNode);\n          }\n          return CaretPosition(textNode.dom, text.length);\n        });\n      }\n    };\n    var insertNbspAtPosition = curry(insertTextAtPosition, nbsp);\n    var insertSpaceAtPosition = curry(insertTextAtPosition, ' ');\n\n    var locationToCaretPosition = function (root) {\n      return function (location) {\n        return location.fold(function (element) {\n          return prevPosition(root.dom, CaretPosition.before(element));\n        }, function (element) {\n          return firstPositionIn(element);\n        }, function (element) {\n          return lastPositionIn(element);\n        }, function (element) {\n          return nextPosition(root.dom, CaretPosition.after(element));\n        });\n      };\n    };\n    var insertInlineBoundarySpaceOrNbsp = function (root, pos) {\n      return function (checkPos) {\n        return needsToHaveNbsp(root, checkPos) ? insertNbspAtPosition(pos) : insertSpaceAtPosition(pos);\n      };\n    };\n    var setSelection = function (editor) {\n      return function (pos) {\n        editor.selection.setRng(pos.toRange());\n        editor.nodeChanged();\n        return true;\n      };\n    };\n    var insertSpaceOrNbspAtSelection = function (editor) {\n      var pos = CaretPosition.fromRangeStart(editor.selection.getRng());\n      var root = SugarElement.fromDom(editor.getBody());\n      if (editor.selection.isCollapsed()) {\n        var isInlineTarget$1 = curry(isInlineTarget, editor);\n        var caretPosition = CaretPosition.fromRangeStart(editor.selection.getRng());\n        return readLocation(isInlineTarget$1, editor.getBody(), caretPosition).bind(locationToCaretPosition(root)).bind(insertInlineBoundarySpaceOrNbsp(root, pos)).exists(setSelection(editor));\n      } else {\n        return false;\n      }\n    };\n\n    var executeKeydownOverride = function (editor, evt) {\n      execute([{\n          keyCode: VK.SPACEBAR,\n          action: action(insertSpaceOrNbspAtSelection, editor)\n        }], evt).each(function (_) {\n        evt.preventDefault();\n      });\n    };\n    var setup$5 = function (editor) {\n      editor.on('keydown', function (evt) {\n        if (evt.isDefaultPrevented() === false) {\n          executeKeydownOverride(editor, evt);\n        }\n      });\n    };\n\n    var registerKeyboardOverrides = function (editor) {\n      var caret = setupSelectedState(editor);\n      setup$c(editor);\n      setup$b(editor, caret);\n      setup$a(editor, caret);\n      setup$9(editor);\n      setup$5(editor);\n      setup$7(editor);\n      setup$8(editor, caret);\n      setup$6(editor, caret);\n      return caret;\n    };\n    var setup$4 = function (editor) {\n      if (!isRtc(editor)) {\n        return registerKeyboardOverrides(editor);\n      } else {\n        return Cell(null);\n      }\n    };\n\n    var NodeChange = function () {\n      function NodeChange(editor) {\n        this.lastPath = [];\n        this.editor = editor;\n        var lastRng;\n        var self = this;\n        if (!('onselectionchange' in editor.getDoc())) {\n          editor.on('NodeChange click mouseup keyup focus', function (e) {\n            var nativeRng = editor.selection.getRng();\n            var fakeRng = {\n              startContainer: nativeRng.startContainer,\n              startOffset: nativeRng.startOffset,\n              endContainer: nativeRng.endContainer,\n              endOffset: nativeRng.endOffset\n            };\n            if (e.type === 'nodechange' || !isEq$4(fakeRng, lastRng)) {\n              editor.fire('SelectionChange');\n            }\n            lastRng = fakeRng;\n          });\n        }\n        editor.on('contextmenu', function () {\n          editor.fire('SelectionChange');\n        });\n        editor.on('SelectionChange', function () {\n          var startElm = editor.selection.getStart(true);\n          if (!startElm || !Env.range && editor.selection.isCollapsed()) {\n            return;\n          }\n          if (hasAnyRanges(editor) && !self.isSameElementPath(startElm) && editor.dom.isChildOf(startElm, editor.getBody())) {\n            editor.nodeChanged({ selectionChange: true });\n          }\n        });\n        editor.on('mouseup', function (e) {\n          if (!e.isDefaultPrevented() && hasAnyRanges(editor)) {\n            if (editor.selection.getNode().nodeName === 'IMG') {\n              Delay.setEditorTimeout(editor, function () {\n                editor.nodeChanged();\n              });\n            } else {\n              editor.nodeChanged();\n            }\n          }\n        });\n      }\n      NodeChange.prototype.nodeChanged = function (args) {\n        var selection = this.editor.selection;\n        var node, parents, root;\n        if (this.editor.initialized && selection && !shouldDisableNodeChange(this.editor) && !this.editor.mode.isReadOnly()) {\n          root = this.editor.getBody();\n          node = selection.getStart(true) || root;\n          if (node.ownerDocument !== this.editor.getDoc() || !this.editor.dom.isChildOf(node, root)) {\n            node = root;\n          }\n          parents = [];\n          this.editor.dom.getParent(node, function (node) {\n            if (node === root) {\n              return true;\n            }\n            parents.push(node);\n          });\n          args = args || {};\n          args.element = node;\n          args.parents = parents;\n          this.editor.fire('NodeChange', args);\n        }\n      };\n      NodeChange.prototype.isSameElementPath = function (startElm) {\n        var i;\n        var currentPath = this.editor.$(startElm).parentsUntil(this.editor.getBody()).add(startElm);\n        if (currentPath.length === this.lastPath.length) {\n          for (i = currentPath.length; i >= 0; i--) {\n            if (currentPath[i] !== this.lastPath[i]) {\n              break;\n            }\n          }\n          if (i === -1) {\n            this.lastPath = currentPath;\n            return true;\n          }\n        }\n        this.lastPath = currentPath;\n        return false;\n      };\n      return NodeChange;\n    }();\n\n    var preventSummaryToggle = function (editor) {\n      editor.on('click', function (e) {\n        if (editor.dom.getParent(e.target, 'details')) {\n          e.preventDefault();\n        }\n      });\n    };\n    var filterDetails = function (editor) {\n      editor.parser.addNodeFilter('details', function (elms) {\n        each$k(elms, function (details) {\n          details.attr('data-mce-open', details.attr('open'));\n          details.attr('open', 'open');\n        });\n      });\n      editor.serializer.addNodeFilter('details', function (elms) {\n        each$k(elms, function (details) {\n          var open = details.attr('data-mce-open');\n          details.attr('open', isString$1(open) ? open : null);\n          details.attr('data-mce-open', null);\n        });\n      });\n    };\n    var setup$3 = function (editor) {\n      preventSummaryToggle(editor);\n      filterDetails(editor);\n    };\n\n    var isTextBlockNode = function (node) {\n      return isElement$5(node) && isTextBlock$2(SugarElement.fromDom(node));\n    };\n    var normalizeSelection = function (editor) {\n      var rng = editor.selection.getRng();\n      var startPos = CaretPosition.fromRangeStart(rng);\n      var endPos = CaretPosition.fromRangeEnd(rng);\n      if (CaretPosition.isElementPosition(startPos)) {\n        var container = startPos.container();\n        if (isTextBlockNode(container)) {\n          firstPositionIn(container).each(function (pos) {\n            return rng.setStart(pos.container(), pos.offset());\n          });\n        }\n      }\n      if (CaretPosition.isElementPosition(endPos)) {\n        var container = startPos.container();\n        if (isTextBlockNode(container)) {\n          lastPositionIn(container).each(function (pos) {\n            return rng.setEnd(pos.container(), pos.offset());\n          });\n        }\n      }\n      editor.selection.setRng(normalize(rng));\n    };\n    var setup$2 = function (editor) {\n      editor.on('click', function (e) {\n        if (e.detail >= 3) {\n          normalizeSelection(editor);\n        }\n      });\n    };\n\n    var getAbsolutePosition = function (elm) {\n      var clientRect = elm.getBoundingClientRect();\n      var doc = elm.ownerDocument;\n      var docElem = doc.documentElement;\n      var win = doc.defaultView;\n      return {\n        top: clientRect.top + win.pageYOffset - docElem.clientTop,\n        left: clientRect.left + win.pageXOffset - docElem.clientLeft\n      };\n    };\n    var getBodyPosition = function (editor) {\n      return editor.inline ? getAbsolutePosition(editor.getBody()) : {\n        left: 0,\n        top: 0\n      };\n    };\n    var getScrollPosition = function (editor) {\n      var body = editor.getBody();\n      return editor.inline ? {\n        left: body.scrollLeft,\n        top: body.scrollTop\n      } : {\n        left: 0,\n        top: 0\n      };\n    };\n    var getBodyScroll = function (editor) {\n      var body = editor.getBody(), docElm = editor.getDoc().documentElement;\n      var inlineScroll = {\n        left: body.scrollLeft,\n        top: body.scrollTop\n      };\n      var iframeScroll = {\n        left: body.scrollLeft || docElm.scrollLeft,\n        top: body.scrollTop || docElm.scrollTop\n      };\n      return editor.inline ? inlineScroll : iframeScroll;\n    };\n    var getMousePosition = function (editor, event) {\n      if (event.target.ownerDocument !== editor.getDoc()) {\n        var iframePosition = getAbsolutePosition(editor.getContentAreaContainer());\n        var scrollPosition = getBodyScroll(editor);\n        return {\n          left: event.pageX - iframePosition.left + scrollPosition.left,\n          top: event.pageY - iframePosition.top + scrollPosition.top\n        };\n      }\n      return {\n        left: event.pageX,\n        top: event.pageY\n      };\n    };\n    var calculatePosition = function (bodyPosition, scrollPosition, mousePosition) {\n      return {\n        pageX: mousePosition.left - bodyPosition.left + scrollPosition.left,\n        pageY: mousePosition.top - bodyPosition.top + scrollPosition.top\n      };\n    };\n    var calc = function (editor, event) {\n      return calculatePosition(getBodyPosition(editor), getScrollPosition(editor), getMousePosition(editor, event));\n    };\n\n    var isContentEditableFalse$1 = isContentEditableFalse$b, isContentEditableTrue$1 = isContentEditableTrue$4;\n    var isDraggable = function (rootElm, elm) {\n      return isContentEditableFalse$1(elm) && elm !== rootElm;\n    };\n    var isValidDropTarget = function (editor, targetElement, dragElement) {\n      if (targetElement === dragElement || editor.dom.isChildOf(targetElement, dragElement)) {\n        return false;\n      }\n      return !isContentEditableFalse$1(targetElement);\n    };\n    var cloneElement = function (elm) {\n      var cloneElm = elm.cloneNode(true);\n      cloneElm.removeAttribute('data-mce-selected');\n      return cloneElm;\n    };\n    var createGhost = function (editor, elm, width, height) {\n      var dom = editor.dom;\n      var clonedElm = elm.cloneNode(true);\n      dom.setStyles(clonedElm, {\n        width: width,\n        height: height\n      });\n      dom.setAttrib(clonedElm, 'data-mce-selected', null);\n      var ghostElm = dom.create('div', {\n        'class': 'mce-drag-container',\n        'data-mce-bogus': 'all',\n        'unselectable': 'on',\n        'contenteditable': 'false'\n      });\n      dom.setStyles(ghostElm, {\n        position: 'absolute',\n        opacity: 0.5,\n        overflow: 'hidden',\n        border: 0,\n        padding: 0,\n        margin: 0,\n        width: width,\n        height: height\n      });\n      dom.setStyles(clonedElm, {\n        margin: 0,\n        boxSizing: 'border-box'\n      });\n      ghostElm.appendChild(clonedElm);\n      return ghostElm;\n    };\n    var appendGhostToBody = function (ghostElm, bodyElm) {\n      if (ghostElm.parentNode !== bodyElm) {\n        bodyElm.appendChild(ghostElm);\n      }\n    };\n    var moveGhost = function (ghostElm, position, width, height, maxX, maxY) {\n      var overflowX = 0, overflowY = 0;\n      ghostElm.style.left = position.pageX + 'px';\n      ghostElm.style.top = position.pageY + 'px';\n      if (position.pageX + width > maxX) {\n        overflowX = position.pageX + width - maxX;\n      }\n      if (position.pageY + height > maxY) {\n        overflowY = position.pageY + height - maxY;\n      }\n      ghostElm.style.width = width - overflowX + 'px';\n      ghostElm.style.height = height - overflowY + 'px';\n    };\n    var removeElement = function (elm) {\n      if (elm && elm.parentNode) {\n        elm.parentNode.removeChild(elm);\n      }\n    };\n    var isLeftMouseButtonPressed = function (e) {\n      return e.button === 0;\n    };\n    var applyRelPos = function (state, position) {\n      return {\n        pageX: position.pageX - state.relX,\n        pageY: position.pageY + 5\n      };\n    };\n    var start = function (state, editor) {\n      return function (e) {\n        if (isLeftMouseButtonPressed(e)) {\n          var ceElm = find$3(editor.dom.getParents(e.target), or(isContentEditableFalse$1, isContentEditableTrue$1)).getOr(null);\n          if (isDraggable(editor.getBody(), ceElm)) {\n            var elmPos = editor.dom.getPos(ceElm);\n            var bodyElm = editor.getBody();\n            var docElm = editor.getDoc().documentElement;\n            state.set({\n              element: ceElm,\n              dragging: false,\n              screenX: e.screenX,\n              screenY: e.screenY,\n              maxX: (editor.inline ? bodyElm.scrollWidth : docElm.offsetWidth) - 2,\n              maxY: (editor.inline ? bodyElm.scrollHeight : docElm.offsetHeight) - 2,\n              relX: e.pageX - elmPos.x,\n              relY: e.pageY - elmPos.y,\n              width: ceElm.offsetWidth,\n              height: ceElm.offsetHeight,\n              ghost: createGhost(editor, ceElm, ceElm.offsetWidth, ceElm.offsetHeight)\n            });\n          }\n        }\n      };\n    };\n    var move = function (state, editor) {\n      var throttledPlaceCaretAt = Delay.throttle(function (clientX, clientY) {\n        editor._selectionOverrides.hideFakeCaret();\n        editor.selection.placeCaretAt(clientX, clientY);\n      }, 0);\n      editor.on('remove', throttledPlaceCaretAt.stop);\n      return function (e) {\n        return state.on(function (state) {\n          var movement = Math.max(Math.abs(e.screenX - state.screenX), Math.abs(e.screenY - state.screenY));\n          if (!state.dragging && movement > 10) {\n            var args = editor.fire('dragstart', { target: state.element });\n            if (args.isDefaultPrevented()) {\n              return;\n            }\n            state.dragging = true;\n            editor.focus();\n          }\n          if (state.dragging) {\n            var targetPos = applyRelPos(state, calc(editor, e));\n            appendGhostToBody(state.ghost, editor.getBody());\n            moveGhost(state.ghost, targetPos, state.width, state.height, state.maxX, state.maxY);\n            throttledPlaceCaretAt(e.clientX, e.clientY);\n          }\n        });\n      };\n    };\n    var getRawTarget = function (selection) {\n      var rng = selection.getSel().getRangeAt(0);\n      var startContainer = rng.startContainer;\n      return startContainer.nodeType === 3 ? startContainer.parentNode : startContainer;\n    };\n    var drop = function (state, editor) {\n      return function (e) {\n        state.on(function (state) {\n          if (state.dragging) {\n            if (isValidDropTarget(editor, getRawTarget(editor.selection), state.element)) {\n              var targetClone_1 = cloneElement(state.element);\n              var args = editor.fire('drop', {\n                clientX: e.clientX,\n                clientY: e.clientY\n              });\n              if (!args.isDefaultPrevented()) {\n                editor.undoManager.transact(function () {\n                  removeElement(state.element);\n                  editor.insertContent(editor.dom.getOuterHTML(targetClone_1));\n                  editor._selectionOverrides.hideFakeCaret();\n                });\n              }\n            }\n            editor.fire('dragend');\n          }\n        });\n        removeDragState(state);\n      };\n    };\n    var stop = function (state, editor) {\n      return function () {\n        state.on(function (state) {\n          if (state.dragging) {\n            editor.fire('dragend');\n          }\n        });\n        removeDragState(state);\n      };\n    };\n    var removeDragState = function (state) {\n      state.on(function (state) {\n        removeElement(state.ghost);\n      });\n      state.clear();\n    };\n    var bindFakeDragEvents = function (editor) {\n      var state = value();\n      var pageDom = DOMUtils.DOM;\n      var rootDocument = document;\n      var dragStartHandler = start(state, editor);\n      var dragHandler = move(state, editor);\n      var dropHandler = drop(state, editor);\n      var dragEndHandler = stop(state, editor);\n      editor.on('mousedown', dragStartHandler);\n      editor.on('mousemove', dragHandler);\n      editor.on('mouseup', dropHandler);\n      pageDom.bind(rootDocument, 'mousemove', dragHandler);\n      pageDom.bind(rootDocument, 'mouseup', dragEndHandler);\n      editor.on('remove', function () {\n        pageDom.unbind(rootDocument, 'mousemove', dragHandler);\n        pageDom.unbind(rootDocument, 'mouseup', dragEndHandler);\n      });\n      editor.on('keydown', function (e) {\n        if (e.keyCode === VK.ESC) {\n          dragEndHandler();\n        }\n      });\n    };\n    var blockIeDrop = function (editor) {\n      editor.on('drop', function (e) {\n        var realTarget = typeof e.clientX !== 'undefined' ? editor.getDoc().elementFromPoint(e.clientX, e.clientY) : null;\n        if (isContentEditableFalse$1(realTarget) || editor.dom.getContentEditableParent(realTarget) === 'false') {\n          e.preventDefault();\n        }\n      });\n    };\n    var blockUnsupportedFileDrop = function (editor) {\n      var preventFileDrop = function (e) {\n        if (!e.isDefaultPrevented()) {\n          var dataTransfer = e.dataTransfer;\n          if (dataTransfer && (contains$3(dataTransfer.types, 'Files') || dataTransfer.files.length > 0)) {\n            e.preventDefault();\n            if (e.type === 'drop') {\n              displayError(editor, 'Dropped file type is not supported');\n            }\n          }\n        }\n      };\n      var preventFileDropIfUIElement = function (e) {\n        if (isUIElement(editor, e.target)) {\n          preventFileDrop(e);\n        }\n      };\n      var setup = function () {\n        var pageDom = DOMUtils.DOM;\n        var dom = editor.dom;\n        var doc = document;\n        var editorRoot = editor.inline ? editor.getBody() : editor.getDoc();\n        var eventNames = [\n          'drop',\n          'dragover'\n        ];\n        each$k(eventNames, function (name) {\n          pageDom.bind(doc, name, preventFileDropIfUIElement);\n          dom.bind(editorRoot, name, preventFileDrop);\n        });\n        editor.on('remove', function () {\n          each$k(eventNames, function (name) {\n            pageDom.unbind(doc, name, preventFileDropIfUIElement);\n            dom.unbind(editorRoot, name, preventFileDrop);\n          });\n        });\n      };\n      editor.on('init', function () {\n        Delay.setEditorTimeout(editor, setup, 0);\n      });\n    };\n    var init$2 = function (editor) {\n      bindFakeDragEvents(editor);\n      blockIeDrop(editor);\n      if (shouldBlockUnsupportedDrop(editor)) {\n        blockUnsupportedFileDrop(editor);\n      }\n    };\n\n    var setup$1 = function (editor) {\n      var renderFocusCaret = first(function () {\n        if (!editor.removed && editor.getBody().contains(document.activeElement)) {\n          var rng = editor.selection.getRng();\n          if (rng.collapsed) {\n            var caretRange = renderRangeCaret(editor, rng, false);\n            editor.selection.setRng(caretRange);\n          }\n        }\n      }, 0);\n      editor.on('focus', function () {\n        renderFocusCaret.throttle();\n      });\n      editor.on('blur', function () {\n        renderFocusCaret.cancel();\n      });\n    };\n\n    var setup = function (editor) {\n      editor.on('init', function () {\n        editor.on('focusin', function (e) {\n          var target = e.target;\n          if (isMedia$2(target)) {\n            var ceRoot = getContentEditableRoot$1(editor.getBody(), target);\n            var node = isContentEditableFalse$b(ceRoot) ? ceRoot : target;\n            if (editor.selection.getNode() !== node) {\n              selectNode(editor, node).each(function (rng) {\n                return editor.selection.setRng(rng);\n              });\n            }\n          }\n        });\n      });\n    };\n\n    var isContentEditableTrue = isContentEditableTrue$4;\n    var isContentEditableFalse = isContentEditableFalse$b;\n    var getContentEditableRoot = function (editor, node) {\n      return getContentEditableRoot$1(editor.getBody(), node);\n    };\n    var SelectionOverrides = function (editor) {\n      var selection = editor.selection, dom = editor.dom;\n      var isBlock = dom.isBlock;\n      var rootNode = editor.getBody();\n      var fakeCaret = FakeCaret(editor, rootNode, isBlock, function () {\n        return hasFocus(editor);\n      });\n      var realSelectionId = 'sel-' + dom.uniqueId();\n      var elementSelectionAttr = 'data-mce-selected';\n      var selectedElement;\n      var isFakeSelectionElement = function (node) {\n        return dom.hasClass(node, 'mce-offscreen-selection');\n      };\n      var isFakeSelectionTargetElement = function (node) {\n        return node !== rootNode && (isContentEditableFalse(node) || isMedia$2(node)) && dom.isChildOf(node, rootNode);\n      };\n      var isNearFakeSelectionElement = function (pos) {\n        return isBeforeContentEditableFalse(pos) || isAfterContentEditableFalse(pos) || isBeforeMedia(pos) || isAfterMedia(pos);\n      };\n      var getRealSelectionElement = function () {\n        var container = dom.get(realSelectionId);\n        return container ? container.getElementsByTagName('*')[0] : container;\n      };\n      var setRange = function (range) {\n        if (range) {\n          selection.setRng(range);\n        }\n      };\n      var getRange = selection.getRng;\n      var showCaret = function (direction, node, before, scrollIntoView) {\n        if (scrollIntoView === void 0) {\n          scrollIntoView = true;\n        }\n        var e = editor.fire('ShowCaret', {\n          target: node,\n          direction: direction,\n          before: before\n        });\n        if (e.isDefaultPrevented()) {\n          return null;\n        }\n        if (scrollIntoView) {\n          selection.scrollIntoView(node, direction === -1);\n        }\n        return fakeCaret.show(before, node);\n      };\n      var showBlockCaretContainer = function (blockCaretContainer) {\n        if (blockCaretContainer.hasAttribute('data-mce-caret')) {\n          showCaretContainerBlock(blockCaretContainer);\n          setRange(getRange());\n          selection.scrollIntoView(blockCaretContainer);\n        }\n      };\n      var registerEvents = function () {\n        editor.on('mouseup', function (e) {\n          var range = getRange();\n          if (range.collapsed && isXYInContentArea(editor, e.clientX, e.clientY)) {\n            renderCaretAtRange(editor, range, false).each(setRange);\n          }\n        });\n        editor.on('click', function (e) {\n          var contentEditableRoot = getContentEditableRoot(editor, e.target);\n          if (contentEditableRoot) {\n            if (isContentEditableFalse(contentEditableRoot)) {\n              e.preventDefault();\n              editor.focus();\n            }\n            if (isContentEditableTrue(contentEditableRoot)) {\n              if (dom.isChildOf(contentEditableRoot, selection.getNode())) {\n                removeElementSelection();\n              }\n            }\n          }\n        });\n        editor.on('blur NewBlock', removeElementSelection);\n        editor.on('ResizeWindow FullscreenStateChanged', fakeCaret.reposition);\n        var hasNormalCaretPosition = function (elm) {\n          var start = elm.firstChild;\n          if (isNullable(start)) {\n            return false;\n          }\n          var startPos = CaretPosition.before(start);\n          if (isBr$5(startPos.getNode()) && elm.childNodes.length === 1) {\n            return !isNearFakeSelectionElement(startPos);\n          } else {\n            var caretWalker = CaretWalker(elm);\n            var newPos = caretWalker.next(startPos);\n            return newPos && !isNearFakeSelectionElement(newPos);\n          }\n        };\n        var isInSameBlock = function (node1, node2) {\n          var block1 = dom.getParent(node1, isBlock);\n          var block2 = dom.getParent(node2, isBlock);\n          return block1 === block2;\n        };\n        var hasBetterMouseTarget = function (targetNode, caretNode) {\n          var targetBlock = dom.getParent(targetNode, isBlock);\n          var caretBlock = dom.getParent(caretNode, isBlock);\n          if (isNullable(targetBlock)) {\n            return false;\n          }\n          if (targetNode !== caretBlock && dom.isChildOf(targetBlock, caretBlock) && isContentEditableFalse(getContentEditableRoot(editor, targetBlock)) === false) {\n            return true;\n          }\n          return !dom.isChildOf(caretBlock, targetBlock) && !isInSameBlock(targetBlock, caretBlock) && hasNormalCaretPosition(targetBlock);\n        };\n        editor.on('tap', function (e) {\n          var targetElm = e.target;\n          var contentEditableRoot = getContentEditableRoot(editor, targetElm);\n          if (isContentEditableFalse(contentEditableRoot)) {\n            e.preventDefault();\n            selectNode(editor, contentEditableRoot).each(setElementSelection);\n          } else if (isFakeSelectionTargetElement(targetElm)) {\n            selectNode(editor, targetElm).each(setElementSelection);\n          }\n        }, true);\n        editor.on('mousedown', function (e) {\n          var targetElm = e.target;\n          if (targetElm !== rootNode && targetElm.nodeName !== 'HTML' && !dom.isChildOf(targetElm, rootNode)) {\n            return;\n          }\n          if (isXYInContentArea(editor, e.clientX, e.clientY) === false) {\n            return;\n          }\n          var contentEditableRoot = getContentEditableRoot(editor, targetElm);\n          if (contentEditableRoot) {\n            if (isContentEditableFalse(contentEditableRoot)) {\n              e.preventDefault();\n              selectNode(editor, contentEditableRoot).each(setElementSelection);\n            } else {\n              removeElementSelection();\n              if (!(isContentEditableTrue(contentEditableRoot) && e.shiftKey) && !isXYWithinRange(e.clientX, e.clientY, selection.getRng())) {\n                hideFakeCaret();\n                selection.placeCaretAt(e.clientX, e.clientY);\n              }\n            }\n          } else if (isFakeSelectionTargetElement(targetElm)) {\n            selectNode(editor, targetElm).each(setElementSelection);\n          } else if (isFakeCaretTarget(targetElm) === false) {\n            removeElementSelection();\n            hideFakeCaret();\n            var fakeCaretInfo = closestFakeCaret(rootNode, e.clientX, e.clientY);\n            if (fakeCaretInfo) {\n              if (!hasBetterMouseTarget(targetElm, fakeCaretInfo.node)) {\n                e.preventDefault();\n                var range = showCaret(1, fakeCaretInfo.node, fakeCaretInfo.before, false);\n                setRange(range);\n                editor.getBody().focus();\n              }\n            }\n          }\n        });\n        editor.on('keypress', function (e) {\n          if (VK.modifierPressed(e)) {\n            return;\n          }\n          if (isContentEditableFalse(selection.getNode())) {\n            e.preventDefault();\n          }\n        });\n        editor.on('GetSelectionRange', function (e) {\n          var rng = e.range;\n          if (selectedElement) {\n            if (!selectedElement.parentNode) {\n              selectedElement = null;\n              return;\n            }\n            rng = rng.cloneRange();\n            rng.selectNode(selectedElement);\n            e.range = rng;\n          }\n        });\n        editor.on('SetSelectionRange', function (e) {\n          e.range = normalizeShortEndedElementSelection(e.range);\n          var rng = setElementSelection(e.range, e.forward);\n          if (rng) {\n            e.range = rng;\n          }\n        });\n        var isPasteBin = function (node) {\n          return node.id === 'mcepastebin';\n        };\n        editor.on('AfterSetSelectionRange', function (e) {\n          var rng = e.range;\n          var parentNode = rng.startContainer.parentNode;\n          if (!isRangeInCaretContainer(rng) && !isPasteBin(parentNode)) {\n            hideFakeCaret();\n          }\n          if (!isFakeSelectionElement(parentNode)) {\n            removeElementSelection();\n          }\n        });\n        editor.on('copy', function (e) {\n          var clipboardData = e.clipboardData;\n          if (!e.isDefaultPrevented() && e.clipboardData && !Env.ie) {\n            var realSelectionElement = getRealSelectionElement();\n            if (realSelectionElement) {\n              e.preventDefault();\n              clipboardData.clearData();\n              clipboardData.setData('text/html', realSelectionElement.outerHTML);\n              clipboardData.setData('text/plain', realSelectionElement.outerText || realSelectionElement.innerText);\n            }\n          }\n        });\n        init$2(editor);\n        setup$1(editor);\n        setup(editor);\n      };\n      var isWithinCaretContainer = function (node) {\n        return isCaretContainer$2(node) || startsWithCaretContainer$1(node) || endsWithCaretContainer$1(node);\n      };\n      var isRangeInCaretContainer = function (rng) {\n        return isWithinCaretContainer(rng.startContainer) || isWithinCaretContainer(rng.endContainer);\n      };\n      var normalizeShortEndedElementSelection = function (rng) {\n        var shortEndedElements = editor.schema.getShortEndedElements();\n        var newRng = dom.createRng();\n        var startContainer = rng.startContainer;\n        var startOffset = rng.startOffset;\n        var endContainer = rng.endContainer;\n        var endOffset = rng.endOffset;\n        if (has$2(shortEndedElements, startContainer.nodeName.toLowerCase())) {\n          if (startOffset === 0) {\n            newRng.setStartBefore(startContainer);\n          } else {\n            newRng.setStartAfter(startContainer);\n          }\n        } else {\n          newRng.setStart(startContainer, startOffset);\n        }\n        if (has$2(shortEndedElements, endContainer.nodeName.toLowerCase())) {\n          if (endOffset === 0) {\n            newRng.setEndBefore(endContainer);\n          } else {\n            newRng.setEndAfter(endContainer);\n          }\n        } else {\n          newRng.setEnd(endContainer, endOffset);\n        }\n        return newRng;\n      };\n      var setupOffscreenSelection = function (node, targetClone, origTargetClone) {\n        var $ = editor.$;\n        var $realSelectionContainer = descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).fold(function () {\n          return $([]);\n        }, function (elm) {\n          return $([elm.dom]);\n        });\n        if ($realSelectionContainer.length === 0) {\n          $realSelectionContainer = $('<div data-mce-bogus=\"all\" class=\"mce-offscreen-selection\"></div>').attr('id', realSelectionId);\n          $realSelectionContainer.appendTo(editor.getBody());\n        }\n        var newRange = dom.createRng();\n        if (targetClone === origTargetClone && Env.ie) {\n          $realSelectionContainer.empty().append('<p style=\"font-size: 0\" data-mce-bogus=\"all\">\\xA0</p>').append(targetClone);\n          newRange.setStartAfter($realSelectionContainer[0].firstChild.firstChild);\n          newRange.setEndAfter(targetClone);\n        } else {\n          $realSelectionContainer.empty().append(nbsp).append(targetClone).append(nbsp);\n          newRange.setStart($realSelectionContainer[0].firstChild, 1);\n          newRange.setEnd($realSelectionContainer[0].lastChild, 0);\n        }\n        $realSelectionContainer.css({ top: dom.getPos(node, editor.getBody()).y });\n        $realSelectionContainer[0].focus();\n        var sel = selection.getSel();\n        sel.removeAllRanges();\n        sel.addRange(newRange);\n        return newRange;\n      };\n      var selectElement = function (elm) {\n        var targetClone = elm.cloneNode(true);\n        var e = editor.fire('ObjectSelected', {\n          target: elm,\n          targetClone: targetClone\n        });\n        if (e.isDefaultPrevented()) {\n          return null;\n        }\n        var range = setupOffscreenSelection(elm, e.targetClone, targetClone);\n        var nodeElm = SugarElement.fromDom(elm);\n        each$k(descendants(SugarElement.fromDom(editor.getBody()), '*[data-mce-selected]'), function (elm) {\n          if (!eq(nodeElm, elm)) {\n            remove$6(elm, elementSelectionAttr);\n          }\n        });\n        if (!dom.getAttrib(elm, elementSelectionAttr)) {\n          elm.setAttribute(elementSelectionAttr, '1');\n        }\n        selectedElement = elm;\n        hideFakeCaret();\n        return range;\n      };\n      var setElementSelection = function (range, forward) {\n        if (!range) {\n          return null;\n        }\n        if (range.collapsed) {\n          if (!isRangeInCaretContainer(range)) {\n            var dir = forward ? 1 : -1;\n            var caretPosition = getNormalizedRangeEndPoint(dir, rootNode, range);\n            var beforeNode = caretPosition.getNode(!forward);\n            if (isFakeCaretTarget(beforeNode)) {\n              return showCaret(dir, beforeNode, forward ? !caretPosition.isAtEnd() : false, false);\n            }\n            var afterNode = caretPosition.getNode(forward);\n            if (isFakeCaretTarget(afterNode)) {\n              return showCaret(dir, afterNode, forward ? false : !caretPosition.isAtEnd(), false);\n            }\n          }\n          return null;\n        }\n        var startContainer = range.startContainer;\n        var startOffset = range.startOffset;\n        var endOffset = range.endOffset;\n        if (startContainer.nodeType === 3 && startOffset === 0 && isContentEditableFalse(startContainer.parentNode)) {\n          startContainer = startContainer.parentNode;\n          startOffset = dom.nodeIndex(startContainer);\n          startContainer = startContainer.parentNode;\n        }\n        if (startContainer.nodeType !== 1) {\n          return null;\n        }\n        if (endOffset === startOffset + 1 && startContainer === range.endContainer) {\n          var node = startContainer.childNodes[startOffset];\n          if (isFakeSelectionTargetElement(node)) {\n            return selectElement(node);\n          }\n        }\n        return null;\n      };\n      var removeElementSelection = function () {\n        if (selectedElement) {\n          selectedElement.removeAttribute(elementSelectionAttr);\n        }\n        descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(remove$7);\n        selectedElement = null;\n      };\n      var destroy = function () {\n        fakeCaret.destroy();\n        selectedElement = null;\n      };\n      var hideFakeCaret = function () {\n        fakeCaret.hide();\n      };\n      if (Env.ceFalse && !isRtc(editor)) {\n        registerEvents();\n      }\n      return {\n        showCaret: showCaret,\n        showBlockCaretContainer: showBlockCaretContainer,\n        hideFakeCaret: hideFakeCaret,\n        destroy: destroy\n      };\n    };\n\n    var Quirks = function (editor) {\n      var each = Tools.each;\n      var BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection, parser = editor.parser;\n      var isGecko = Env.gecko, isIE = Env.ie, isWebKit = Env.webkit;\n      var mceInternalUrlPrefix = 'data:text/mce-internal,';\n      var mceInternalDataType = isIE ? 'Text' : 'URL';\n      var setEditorCommandState = function (cmd, state) {\n        try {\n          editor.getDoc().execCommand(cmd, false, state);\n        } catch (ex) {\n        }\n      };\n      var isDefaultPrevented = function (e) {\n        return e.isDefaultPrevented();\n      };\n      var setMceInternalContent = function (e) {\n        var selectionHtml, internalContent;\n        if (e.dataTransfer) {\n          if (editor.selection.isCollapsed() && e.target.tagName === 'IMG') {\n            selection.select(e.target);\n          }\n          selectionHtml = editor.selection.getContent();\n          if (selectionHtml.length > 0) {\n            internalContent = mceInternalUrlPrefix + escape(editor.id) + ',' + escape(selectionHtml);\n            e.dataTransfer.setData(mceInternalDataType, internalContent);\n          }\n        }\n      };\n      var getMceInternalContent = function (e) {\n        var internalContent;\n        if (e.dataTransfer) {\n          internalContent = e.dataTransfer.getData(mceInternalDataType);\n          if (internalContent && internalContent.indexOf(mceInternalUrlPrefix) >= 0) {\n            internalContent = internalContent.substr(mceInternalUrlPrefix.length).split(',');\n            return {\n              id: unescape(internalContent[0]),\n              html: unescape(internalContent[1])\n            };\n          }\n        }\n        return null;\n      };\n      var insertClipboardContents = function (content, internal) {\n        if (editor.queryCommandSupported('mceInsertClipboardContent')) {\n          editor.execCommand('mceInsertClipboardContent', false, {\n            content: content,\n            internal: internal\n          });\n        } else {\n          editor.execCommand('mceInsertContent', false, content);\n        }\n      };\n      var emptyEditorWhenDeleting = function () {\n        var serializeRng = function (rng) {\n          var body = dom.create('body');\n          var contents = rng.cloneContents();\n          body.appendChild(contents);\n          return selection.serializer.serialize(body, { format: 'html' });\n        };\n        var allContentsSelected = function (rng) {\n          var selection = serializeRng(rng);\n          var allRng = dom.createRng();\n          allRng.selectNode(editor.getBody());\n          var allSelection = serializeRng(allRng);\n          return selection === allSelection;\n        };\n        editor.on('keydown', function (e) {\n          var keyCode = e.keyCode;\n          var isCollapsed, body;\n          if (!isDefaultPrevented(e) && (keyCode === DELETE || keyCode === BACKSPACE)) {\n            isCollapsed = editor.selection.isCollapsed();\n            body = editor.getBody();\n            if (isCollapsed && !dom.isEmpty(body)) {\n              return;\n            }\n            if (!isCollapsed && !allContentsSelected(editor.selection.getRng())) {\n              return;\n            }\n            e.preventDefault();\n            editor.setContent('');\n            if (body.firstChild && dom.isBlock(body.firstChild)) {\n              editor.selection.setCursorLocation(body.firstChild, 0);\n            } else {\n              editor.selection.setCursorLocation(body, 0);\n            }\n            editor.nodeChanged();\n          }\n        });\n      };\n      var selectAll = function () {\n        editor.shortcuts.add('meta+a', null, 'SelectAll');\n      };\n      var documentElementEditingFocus = function () {\n        if (!editor.inline) {\n          dom.bind(editor.getDoc(), 'mousedown mouseup', function (e) {\n            var rng;\n            if (e.target === editor.getDoc().documentElement) {\n              rng = selection.getRng();\n              editor.getBody().focus();\n              if (e.type === 'mousedown') {\n                if (isCaretContainer$2(rng.startContainer)) {\n                  return;\n                }\n                selection.placeCaretAt(e.clientX, e.clientY);\n              } else {\n                selection.setRng(rng);\n              }\n            }\n          });\n        }\n      };\n      var removeHrOnBackspace = function () {\n        editor.on('keydown', function (e) {\n          if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {\n            if (!editor.getBody().getElementsByTagName('hr').length) {\n              return;\n            }\n            if (selection.isCollapsed() && selection.getRng().startOffset === 0) {\n              var node = selection.getNode();\n              var previousSibling = node.previousSibling;\n              if (node.nodeName === 'HR') {\n                dom.remove(node);\n                e.preventDefault();\n                return;\n              }\n              if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'hr') {\n                dom.remove(previousSibling);\n                e.preventDefault();\n              }\n            }\n          }\n        });\n      };\n      var focusBody = function () {\n        if (!Range.prototype.getClientRects) {\n          editor.on('mousedown', function (e) {\n            if (!isDefaultPrevented(e) && e.target.nodeName === 'HTML') {\n              var body_1 = editor.getBody();\n              body_1.blur();\n              Delay.setEditorTimeout(editor, function () {\n                body_1.focus();\n              });\n            }\n          });\n        }\n      };\n      var selectControlElements = function () {\n        editor.on('click', function (e) {\n          var target = e.target;\n          if (/^(IMG|HR)$/.test(target.nodeName) && dom.getContentEditableParent(target) !== 'false') {\n            e.preventDefault();\n            editor.selection.select(target);\n            editor.nodeChanged();\n          }\n          if (target.nodeName === 'A' && dom.hasClass(target, 'mce-item-anchor')) {\n            e.preventDefault();\n            selection.select(target);\n          }\n        });\n      };\n      var removeStylesWhenDeletingAcrossBlockElements = function () {\n        var getAttributeApplyFunction = function () {\n          var template = dom.getAttribs(selection.getStart().cloneNode(false));\n          return function () {\n            var target = selection.getStart();\n            if (target !== editor.getBody()) {\n              dom.setAttrib(target, 'style', null);\n              each(template, function (attr) {\n                target.setAttributeNode(attr.cloneNode(true));\n              });\n            }\n          };\n        };\n        var isSelectionAcrossElements = function () {\n          return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) !== dom.getParent(selection.getEnd(), dom.isBlock);\n        };\n        editor.on('keypress', function (e) {\n          var applyAttributes;\n          if (!isDefaultPrevented(e) && (e.keyCode === 8 || e.keyCode === 46) && isSelectionAcrossElements()) {\n            applyAttributes = getAttributeApplyFunction();\n            editor.getDoc().execCommand('delete', false, null);\n            applyAttributes();\n            e.preventDefault();\n            return false;\n          }\n        });\n        dom.bind(editor.getDoc(), 'cut', function (e) {\n          var applyAttributes;\n          if (!isDefaultPrevented(e) && isSelectionAcrossElements()) {\n            applyAttributes = getAttributeApplyFunction();\n            Delay.setEditorTimeout(editor, function () {\n              applyAttributes();\n            });\n          }\n        });\n      };\n      var disableBackspaceIntoATable = function () {\n        editor.on('keydown', function (e) {\n          if (!isDefaultPrevented(e) && e.keyCode === BACKSPACE) {\n            if (selection.isCollapsed() && selection.getRng().startOffset === 0) {\n              var previousSibling = selection.getNode().previousSibling;\n              if (previousSibling && previousSibling.nodeName && previousSibling.nodeName.toLowerCase() === 'table') {\n                e.preventDefault();\n                return false;\n              }\n            }\n          }\n        });\n      };\n      var removeBlockQuoteOnBackSpace = function () {\n        editor.on('keydown', function (e) {\n          var rng, parent;\n          if (isDefaultPrevented(e) || e.keyCode !== VK.BACKSPACE) {\n            return;\n          }\n          rng = selection.getRng();\n          var container = rng.startContainer;\n          var offset = rng.startOffset;\n          var root = dom.getRoot();\n          parent = container;\n          if (!rng.collapsed || offset !== 0) {\n            return;\n          }\n          while (parent && parent.parentNode && parent.parentNode.firstChild === parent && parent.parentNode !== root) {\n            parent = parent.parentNode;\n          }\n          if (parent.tagName === 'BLOCKQUOTE') {\n            editor.formatter.toggle('blockquote', null, parent);\n            rng = dom.createRng();\n            rng.setStart(container, 0);\n            rng.setEnd(container, 0);\n            selection.setRng(rng);\n          }\n        });\n      };\n      var setGeckoEditingOptions = function () {\n        var setOpts = function () {\n          setEditorCommandState('StyleWithCSS', false);\n          setEditorCommandState('enableInlineTableEditing', false);\n          if (!getObjectResizing(editor)) {\n            setEditorCommandState('enableObjectResizing', false);\n          }\n        };\n        if (!isReadOnly$1(editor)) {\n          editor.on('BeforeExecCommand mousedown', setOpts);\n        }\n      };\n      var addBrAfterLastLinks = function () {\n        var fixLinks = function () {\n          each(dom.select('a'), function (node) {\n            var parentNode = node.parentNode;\n            var root = dom.getRoot();\n            if (parentNode.lastChild === node) {\n              while (parentNode && !dom.isBlock(parentNode)) {\n                if (parentNode.parentNode.lastChild !== parentNode || parentNode === root) {\n                  return;\n                }\n                parentNode = parentNode.parentNode;\n              }\n              dom.add(parentNode, 'br', { 'data-mce-bogus': 1 });\n            }\n          });\n        };\n        editor.on('SetContent ExecCommand', function (e) {\n          if (e.type === 'setcontent' || e.command === 'mceInsertLink') {\n            fixLinks();\n          }\n        });\n      };\n      var setDefaultBlockType = function () {\n        if (getForcedRootBlock(editor)) {\n          editor.on('init', function () {\n            setEditorCommandState('DefaultParagraphSeparator', getForcedRootBlock(editor));\n          });\n        }\n      };\n      var normalizeSelection = function () {\n        editor.on('keyup focusin mouseup', function (e) {\n          if (!VK.modifierPressed(e)) {\n            selection.normalize();\n          }\n        }, true);\n      };\n      var showBrokenImageIcon = function () {\n        editor.contentStyles.push('img:-moz-broken {' + '-moz-force-broken-image-icon:1;' + 'min-width:24px;' + 'min-height:24px' + '}');\n      };\n      var restoreFocusOnKeyDown = function () {\n        if (!editor.inline) {\n          editor.on('keydown', function () {\n            if (document.activeElement === document.body) {\n              editor.getWin().focus();\n            }\n          });\n        }\n      };\n      var bodyHeight = function () {\n        if (!editor.inline) {\n          editor.contentStyles.push('body {min-height: 150px}');\n          editor.on('click', function (e) {\n            var rng;\n            if (e.target.nodeName === 'HTML') {\n              if (Env.ie > 11) {\n                editor.getBody().focus();\n                return;\n              }\n              rng = editor.selection.getRng();\n              editor.getBody().focus();\n              editor.selection.setRng(rng);\n              editor.selection.normalize();\n              editor.nodeChanged();\n            }\n          });\n        }\n      };\n      var blockCmdArrowNavigation = function () {\n        if (Env.mac) {\n          editor.on('keydown', function (e) {\n            if (VK.metaKeyPressed(e) && !e.shiftKey && (e.keyCode === 37 || e.keyCode === 39)) {\n              e.preventDefault();\n              var selection_1 = editor.selection.getSel();\n              selection_1.modify('move', e.keyCode === 37 ? 'backward' : 'forward', 'lineboundary');\n            }\n          });\n        }\n      };\n      var disableAutoUrlDetect = function () {\n        setEditorCommandState('AutoUrlDetect', false);\n      };\n      var tapLinksAndImages = function () {\n        editor.on('click', function (e) {\n          var elm = e.target;\n          do {\n            if (elm.tagName === 'A') {\n              e.preventDefault();\n              return;\n            }\n          } while (elm = elm.parentNode);\n        });\n        editor.contentStyles.push('.mce-content-body {-webkit-touch-callout: none}');\n      };\n      var blockFormSubmitInsideEditor = function () {\n        editor.on('init', function () {\n          editor.dom.bind(editor.getBody(), 'submit', function (e) {\n            e.preventDefault();\n          });\n        });\n      };\n      var removeAppleInterchangeBrs = function () {\n        parser.addNodeFilter('br', function (nodes) {\n          var i = nodes.length;\n          while (i--) {\n            if (nodes[i].attr('class') === 'Apple-interchange-newline') {\n              nodes[i].remove();\n            }\n          }\n        });\n      };\n      var ieInternalDragAndDrop = function () {\n        editor.on('dragstart', function (e) {\n          setMceInternalContent(e);\n        });\n        editor.on('drop', function (e) {\n          if (!isDefaultPrevented(e)) {\n            var internalContent = getMceInternalContent(e);\n            if (internalContent && internalContent.id !== editor.id) {\n              e.preventDefault();\n              var rng = fromPoint(e.x, e.y, editor.getDoc());\n              selection.setRng(rng);\n              insertClipboardContents(internalContent.html, true);\n            }\n          }\n        });\n      };\n      var refreshContentEditable = noop;\n      var isHidden = function () {\n        if (!isGecko || editor.removed) {\n          return false;\n        }\n        var sel = editor.selection.getSel();\n        return !sel || !sel.rangeCount || sel.rangeCount === 0;\n      };\n      var setupRtc = function () {\n        if (isWebKit) {\n          documentElementEditingFocus();\n          selectControlElements();\n          blockFormSubmitInsideEditor();\n          selectAll();\n          if (Env.iOS) {\n            restoreFocusOnKeyDown();\n            bodyHeight();\n            tapLinksAndImages();\n          }\n        }\n        if (isGecko) {\n          focusBody();\n          setGeckoEditingOptions();\n          showBrokenImageIcon();\n          blockCmdArrowNavigation();\n        }\n      };\n      var setup = function () {\n        removeBlockQuoteOnBackSpace();\n        emptyEditorWhenDeleting();\n        if (!Env.windowsPhone) {\n          normalizeSelection();\n        }\n        if (isWebKit) {\n          documentElementEditingFocus();\n          selectControlElements();\n          setDefaultBlockType();\n          blockFormSubmitInsideEditor();\n          disableBackspaceIntoATable();\n          removeAppleInterchangeBrs();\n          if (Env.iOS) {\n            restoreFocusOnKeyDown();\n            bodyHeight();\n            tapLinksAndImages();\n          } else {\n            selectAll();\n          }\n        }\n        if (Env.ie >= 11) {\n          bodyHeight();\n          disableBackspaceIntoATable();\n        }\n        if (Env.ie) {\n          selectAll();\n          disableAutoUrlDetect();\n          ieInternalDragAndDrop();\n        }\n        if (isGecko) {\n          removeHrOnBackspace();\n          focusBody();\n          removeStylesWhenDeletingAcrossBlockElements();\n          setGeckoEditingOptions();\n          addBrAfterLastLinks();\n          showBrokenImageIcon();\n          blockCmdArrowNavigation();\n          disableBackspaceIntoATable();\n        }\n      };\n      if (isRtc(editor)) {\n        setupRtc();\n      } else {\n        setup();\n      }\n      return {\n        refreshContentEditable: refreshContentEditable,\n        isHidden: isHidden\n      };\n    };\n\n    var DOM$6 = DOMUtils.DOM;\n    var appendStyle = function (editor, text) {\n      var body = SugarElement.fromDom(editor.getBody());\n      var container = getStyleContainer(getRootNode(body));\n      var style = SugarElement.fromTag('style');\n      set$1(style, 'type', 'text/css');\n      append$1(style, SugarElement.fromText(text));\n      append$1(container, style);\n      editor.on('remove', function () {\n        remove$7(style);\n      });\n    };\n    var getRootName = function (editor) {\n      return editor.inline ? editor.getElement().nodeName.toLowerCase() : undefined;\n    };\n    var removeUndefined = function (obj) {\n      return filter$3(obj, function (v) {\n        return isUndefined(v) === false;\n      });\n    };\n    var mkSchemaSettings = function (editor) {\n      var settings = editor.settings;\n      return removeUndefined({\n        block_elements: settings.block_elements,\n        boolean_attributes: settings.boolean_attributes,\n        custom_elements: settings.custom_elements,\n        extended_valid_elements: settings.extended_valid_elements,\n        invalid_elements: settings.invalid_elements,\n        invalid_styles: settings.invalid_styles,\n        move_caret_before_on_enter_elements: settings.move_caret_before_on_enter_elements,\n        non_empty_elements: settings.non_empty_elements,\n        schema: settings.schema,\n        self_closing_elements: settings.self_closing_elements,\n        short_ended_elements: settings.short_ended_elements,\n        special: settings.special,\n        text_block_elements: settings.text_block_elements,\n        text_inline_elements: settings.text_inline_elements,\n        valid_children: settings.valid_children,\n        valid_classes: settings.valid_classes,\n        valid_elements: settings.valid_elements,\n        valid_styles: settings.valid_styles,\n        verify_html: settings.verify_html,\n        whitespace_elements: settings.whitespace_elements,\n        padd_empty_block_inline_children: settings.format_empty_lines\n      });\n    };\n    var mkParserSettings = function (editor) {\n      var settings = editor.settings;\n      var blobCache = editor.editorUpload.blobCache;\n      return removeUndefined({\n        allow_conditional_comments: settings.allow_conditional_comments,\n        allow_html_data_urls: settings.allow_html_data_urls,\n        allow_svg_data_urls: settings.allow_svg_data_urls,\n        allow_html_in_named_anchor: settings.allow_html_in_named_anchor,\n        allow_script_urls: settings.allow_script_urls,\n        allow_unsafe_link_target: settings.allow_unsafe_link_target,\n        convert_fonts_to_spans: settings.convert_fonts_to_spans,\n        fix_list_elements: settings.fix_list_elements,\n        font_size_legacy_values: settings.font_size_legacy_values,\n        forced_root_block: settings.forced_root_block,\n        forced_root_block_attrs: settings.forced_root_block_attrs,\n        padd_empty_with_br: settings.padd_empty_with_br,\n        preserve_cdata: settings.preserve_cdata,\n        remove_trailing_brs: settings.remove_trailing_brs,\n        inline_styles: settings.inline_styles,\n        root_name: getRootName(editor),\n        validate: true,\n        blob_cache: blobCache,\n        document: editor.getDoc(),\n        images_dataimg_filter: settings.images_dataimg_filter\n      });\n    };\n    var mkSerializerSettings = function (editor) {\n      var settings = editor.settings;\n      return __assign(__assign(__assign({}, mkParserSettings(editor)), mkSchemaSettings(editor)), removeUndefined({\n        url_converter: settings.url_converter,\n        url_converter_scope: settings.url_converter_scope,\n        element_format: settings.element_format,\n        entities: settings.entities,\n        entity_encoding: settings.entity_encoding,\n        indent: settings.indent,\n        indent_after: settings.indent_after,\n        indent_before: settings.indent_before\n      }));\n    };\n    var createParser = function (editor) {\n      var parser = DomParser(mkParserSettings(editor), editor.schema);\n      parser.addAttributeFilter('src,href,style,tabindex', function (nodes, name) {\n        var i = nodes.length, node, value;\n        var dom = editor.dom;\n        var internalName = 'data-mce-' + name;\n        while (i--) {\n          node = nodes[i];\n          value = node.attr(name);\n          if (value && !node.attr(internalName)) {\n            if (value.indexOf('data:') === 0 || value.indexOf('blob:') === 0) {\n              continue;\n            }\n            if (name === 'style') {\n              value = dom.serializeStyle(dom.parseStyle(value), node.name);\n              if (!value.length) {\n                value = null;\n              }\n              node.attr(internalName, value);\n              node.attr(name, value);\n            } else if (name === 'tabindex') {\n              node.attr(internalName, value);\n              node.attr(name, null);\n            } else {\n              node.attr(internalName, editor.convertURL(value, name, node.name));\n            }\n          }\n        }\n      });\n      parser.addNodeFilter('script', function (nodes) {\n        var i = nodes.length;\n        while (i--) {\n          var node = nodes[i];\n          var type = node.attr('type') || 'no/type';\n          if (type.indexOf('mce-') !== 0) {\n            node.attr('type', 'mce-' + type);\n          }\n        }\n      });\n      if (editor.settings.preserve_cdata) {\n        parser.addNodeFilter('#cdata', function (nodes) {\n          var i = nodes.length;\n          while (i--) {\n            var node = nodes[i];\n            node.type = 8;\n            node.name = '#comment';\n            node.value = '[CDATA[' + editor.dom.encode(node.value) + ']]';\n          }\n        });\n      }\n      parser.addNodeFilter('p,h1,h2,h3,h4,h5,h6,div', function (nodes) {\n        var i = nodes.length;\n        var nonEmptyElements = editor.schema.getNonEmptyElements();\n        while (i--) {\n          var node = nodes[i];\n          if (node.isEmpty(nonEmptyElements) && node.getAll('br').length === 0) {\n            node.append(new AstNode('br', 1)).shortEnded = true;\n          }\n        }\n      });\n      return parser;\n    };\n    var autoFocus = function (editor) {\n      if (editor.settings.auto_focus) {\n        Delay.setEditorTimeout(editor, function () {\n          var focusEditor;\n          if (editor.settings.auto_focus === true) {\n            focusEditor = editor;\n          } else {\n            focusEditor = editor.editorManager.get(editor.settings.auto_focus);\n          }\n          if (!focusEditor.destroyed) {\n            focusEditor.focus();\n          }\n        }, 100);\n      }\n    };\n    var moveSelectionToFirstCaretPosition = function (editor) {\n      var root = editor.dom.getRoot();\n      if (!editor.inline && (!hasAnyRanges(editor) || editor.selection.getStart(true) === root)) {\n        firstPositionIn(root).each(function (pos) {\n          var node = pos.getNode();\n          var caretPos = isTable$3(node) ? firstPositionIn(node).getOr(pos) : pos;\n          if (Env.browser.isIE()) {\n            storeNative(editor, caretPos.toRange());\n          } else {\n            editor.selection.setRng(caretPos.toRange());\n          }\n        });\n      }\n    };\n    var initEditor = function (editor) {\n      editor.bindPendingEventDelegates();\n      editor.initialized = true;\n      fireInit(editor);\n      editor.focus(true);\n      moveSelectionToFirstCaretPosition(editor);\n      editor.nodeChanged({ initial: true });\n      editor.execCallback('init_instance_callback', editor);\n      autoFocus(editor);\n    };\n    var getStyleSheetLoader$1 = function (editor) {\n      return editor.inline ? editor.ui.styleSheetLoader : editor.dom.styleSheetLoader;\n    };\n    var makeStylesheetLoadingPromises = function (editor, css, framedFonts) {\n      var promises = [new promiseObj(function (resolve, reject) {\n          return getStyleSheetLoader$1(editor).loadAll(css, resolve, reject);\n        })];\n      if (editor.inline) {\n        return promises;\n      } else {\n        return promises.concat([new promiseObj(function (resolve, reject) {\n            return editor.ui.styleSheetLoader.loadAll(framedFonts, resolve, reject);\n          })]);\n      }\n    };\n    var loadContentCss = function (editor) {\n      var styleSheetLoader = getStyleSheetLoader$1(editor);\n      var fontCss = getFontCss(editor);\n      var css = editor.contentCSS;\n      var removeCss = function () {\n        styleSheetLoader.unloadAll(css);\n        if (!editor.inline) {\n          editor.ui.styleSheetLoader.unloadAll(fontCss);\n        }\n      };\n      var loaded = function () {\n        if (editor.removed) {\n          removeCss();\n        } else {\n          editor.on('remove', removeCss);\n        }\n      };\n      if (editor.contentStyles.length > 0) {\n        var contentCssText_1 = '';\n        Tools.each(editor.contentStyles, function (style) {\n          contentCssText_1 += style + '\\r\\n';\n        });\n        editor.dom.addStyle(contentCssText_1);\n      }\n      var allStylesheets = promiseObj.all(makeStylesheetLoadingPromises(editor, css, fontCss)).then(loaded).catch(loaded);\n      if (editor.settings.content_style) {\n        appendStyle(editor, editor.settings.content_style);\n      }\n      return allStylesheets;\n    };\n    var preInit = function (editor) {\n      var settings = editor.settings, doc = editor.getDoc(), body = editor.getBody();\n      firePreInit(editor);\n      if (!settings.browser_spellcheck && !settings.gecko_spellcheck) {\n        doc.body.spellcheck = false;\n        DOM$6.setAttrib(body, 'spellcheck', 'false');\n      }\n      editor.quirks = Quirks(editor);\n      firePostRender(editor);\n      var directionality = getDirectionality(editor);\n      if (directionality !== undefined) {\n        body.dir = directionality;\n      }\n      if (settings.protect) {\n        editor.on('BeforeSetContent', function (e) {\n          Tools.each(settings.protect, function (pattern) {\n            e.content = e.content.replace(pattern, function (str) {\n              return '<!--mce:protected ' + escape(str) + '-->';\n            });\n          });\n        });\n      }\n      editor.on('SetContent', function () {\n        editor.addVisual(editor.getBody());\n      });\n      editor.on('compositionstart compositionend', function (e) {\n        editor.composing = e.type === 'compositionstart';\n      });\n    };\n    var loadInitialContent = function (editor) {\n      if (!isRtc(editor)) {\n        editor.load({\n          initial: true,\n          format: 'html'\n        });\n      }\n      editor.startContent = editor.getContent({ format: 'raw' });\n    };\n    var initEditorWithInitialContent = function (editor) {\n      if (editor.removed !== true) {\n        loadInitialContent(editor);\n        initEditor(editor);\n      }\n    };\n    var initContentBody = function (editor, skipWrite) {\n      var settings = editor.settings;\n      var targetElm = editor.getElement();\n      var doc = editor.getDoc();\n      if (!settings.inline) {\n        editor.getElement().style.visibility = editor.orgVisibility;\n      }\n      if (!skipWrite && !editor.inline) {\n        doc.open();\n        doc.write(editor.iframeHTML);\n        doc.close();\n      }\n      if (editor.inline) {\n        DOM$6.addClass(targetElm, 'mce-content-body');\n        editor.contentDocument = doc = document;\n        editor.contentWindow = window;\n        editor.bodyElement = targetElm;\n        editor.contentAreaContainer = targetElm;\n      }\n      var body = editor.getBody();\n      body.disabled = true;\n      editor.readonly = !!settings.readonly;\n      if (!editor.readonly) {\n        if (editor.inline && DOM$6.getStyle(body, 'position', true) === 'static') {\n          body.style.position = 'relative';\n        }\n        body.contentEditable = editor.getParam('content_editable_state', true);\n      }\n      body.disabled = false;\n      editor.editorUpload = EditorUpload(editor);\n      editor.schema = Schema(mkSchemaSettings(editor));\n      editor.dom = DOMUtils(doc, {\n        keep_values: true,\n        url_converter: editor.convertURL,\n        url_converter_scope: editor,\n        hex_colors: settings.force_hex_style_colors,\n        update_styles: true,\n        root_element: editor.inline ? editor.getBody() : null,\n        collect: function () {\n          return editor.inline;\n        },\n        schema: editor.schema,\n        contentCssCors: shouldUseContentCssCors(editor),\n        referrerPolicy: getReferrerPolicy(editor),\n        onSetAttrib: function (e) {\n          editor.fire('SetAttrib', e);\n        }\n      });\n      editor.parser = createParser(editor);\n      editor.serializer = DomSerializer(mkSerializerSettings(editor), editor);\n      editor.selection = EditorSelection(editor.dom, editor.getWin(), editor.serializer, editor);\n      editor.annotator = Annotator(editor);\n      editor.formatter = Formatter(editor);\n      editor.undoManager = UndoManager(editor);\n      editor._nodeChangeDispatcher = new NodeChange(editor);\n      editor._selectionOverrides = SelectionOverrides(editor);\n      setup$e(editor);\n      setup$3(editor);\n      if (!isRtc(editor)) {\n        setup$2(editor);\n      }\n      var caret = setup$4(editor);\n      setup$f(editor, caret);\n      setup$d(editor);\n      setup$g(editor);\n      var setupRtcThunk = setup$i(editor);\n      preInit(editor);\n      setupRtcThunk.fold(function () {\n        loadContentCss(editor).then(function () {\n          return initEditorWithInitialContent(editor);\n        });\n      }, function (setupRtc) {\n        editor.setProgressState(true);\n        loadContentCss(editor).then(function () {\n          setupRtc().then(function (_rtcMode) {\n            editor.setProgressState(false);\n            initEditorWithInitialContent(editor);\n          }, function (err) {\n            editor.notificationManager.open({\n              type: 'error',\n              text: String(err)\n            });\n            initEditorWithInitialContent(editor);\n          });\n        });\n      });\n    };\n\n    var DOM$5 = DOMUtils.DOM;\n    var relaxDomain = function (editor, ifr) {\n      if (document.domain !== window.location.hostname && Env.browser.isIE()) {\n        var bodyUuid = uuid('mce');\n        editor[bodyUuid] = function () {\n          initContentBody(editor);\n        };\n        var domainRelaxUrl = 'javascript:(function(){' + 'document.open();document.domain=\"' + document.domain + '\";' + 'var ed = window.parent.tinymce.get(\"' + editor.id + '\");document.write(ed.iframeHTML);' + 'document.close();ed.' + bodyUuid + '(true);})()';\n        DOM$5.setAttrib(ifr, 'src', domainRelaxUrl);\n        return true;\n      }\n      return false;\n    };\n    var createIframeElement = function (id, title, height, customAttrs) {\n      var iframe = SugarElement.fromTag('iframe');\n      setAll$1(iframe, customAttrs);\n      setAll$1(iframe, {\n        id: id + '_ifr',\n        frameBorder: '0',\n        allowTransparency: 'true',\n        title: title\n      });\n      add$1(iframe, 'tox-edit-area__iframe');\n      return iframe;\n    };\n    var getIframeHtml = function (editor) {\n      var iframeHTML = getDocType(editor) + '<html><head>';\n      if (getDocumentBaseUrl(editor) !== editor.documentBaseUrl) {\n        iframeHTML += '<base href=\"' + editor.documentBaseURI.getURI() + '\" />';\n      }\n      iframeHTML += '<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />';\n      var bodyId = getBodyId(editor);\n      var bodyClass = getBodyClass(editor);\n      var translatedAriaText = editor.translate(getIframeAriaText(editor));\n      if (getContentSecurityPolicy(editor)) {\n        iframeHTML += '<meta http-equiv=\"Content-Security-Policy\" content=\"' + getContentSecurityPolicy(editor) + '\" />';\n      }\n      iframeHTML += '</head>' + ('<body id=\"' + bodyId + '\" class=\"mce-content-body ' + bodyClass + '\" data-id=\"' + editor.id + '\" aria-label=\"' + translatedAriaText + '\">') + '<br>' + '</body></html>';\n      return iframeHTML;\n    };\n    var createIframe = function (editor, o) {\n      var iframeTitle = editor.translate('Rich Text Area');\n      var ifr = createIframeElement(editor.id, iframeTitle, o.height, getIframeAttrs(editor)).dom;\n      ifr.onload = function () {\n        ifr.onload = null;\n        editor.fire('load');\n      };\n      var isDomainRelaxed = relaxDomain(editor, ifr);\n      editor.contentAreaContainer = o.iframeContainer;\n      editor.iframeElement = ifr;\n      editor.iframeHTML = getIframeHtml(editor);\n      DOM$5.add(o.iframeContainer, ifr);\n      return isDomainRelaxed;\n    };\n    var init$1 = function (editor, boxInfo) {\n      var isDomainRelaxed = createIframe(editor, boxInfo);\n      if (boxInfo.editorContainer) {\n        DOM$5.get(boxInfo.editorContainer).style.display = editor.orgDisplay;\n        editor.hidden = DOM$5.isHidden(boxInfo.editorContainer);\n      }\n      editor.getElement().style.display = 'none';\n      DOM$5.setAttrib(editor.id, 'aria-hidden', 'true');\n      if (!isDomainRelaxed) {\n        initContentBody(editor);\n      }\n    };\n\n    var DOM$4 = DOMUtils.DOM;\n    var initPlugin = function (editor, initializedPlugins, plugin) {\n      var Plugin = PluginManager.get(plugin);\n      var pluginUrl = PluginManager.urls[plugin] || editor.documentBaseUrl.replace(/\\/$/, '');\n      plugin = Tools.trim(plugin);\n      if (Plugin && Tools.inArray(initializedPlugins, plugin) === -1) {\n        Tools.each(PluginManager.dependencies(plugin), function (dep) {\n          initPlugin(editor, initializedPlugins, dep);\n        });\n        if (editor.plugins[plugin]) {\n          return;\n        }\n        try {\n          var pluginInstance = new Plugin(editor, pluginUrl, editor.$);\n          editor.plugins[plugin] = pluginInstance;\n          if (pluginInstance.init) {\n            pluginInstance.init(editor, pluginUrl);\n            initializedPlugins.push(plugin);\n          }\n        } catch (e) {\n          pluginInitError(editor, plugin, e);\n        }\n      }\n    };\n    var trimLegacyPrefix = function (name) {\n      return name.replace(/^\\-/, '');\n    };\n    var initPlugins = function (editor) {\n      var initializedPlugins = [];\n      Tools.each(getPlugins(editor).split(/[ ,]/), function (name) {\n        initPlugin(editor, initializedPlugins, trimLegacyPrefix(name));\n      });\n    };\n    var initIcons = function (editor) {\n      var iconPackName = Tools.trim(getIconPackName(editor));\n      var currentIcons = editor.ui.registry.getAll().icons;\n      var loadIcons = __assign(__assign({}, IconManager.get('default').icons), IconManager.get(iconPackName).icons);\n      each$j(loadIcons, function (svgData, icon) {\n        if (!has$2(currentIcons, icon)) {\n          editor.ui.registry.addIcon(icon, svgData);\n        }\n      });\n    };\n    var initTheme = function (editor) {\n      var theme = getTheme(editor);\n      if (isString$1(theme)) {\n        editor.settings.theme = trimLegacyPrefix(theme);\n        var Theme = ThemeManager.get(theme);\n        editor.theme = new Theme(editor, ThemeManager.urls[theme]);\n        if (editor.theme.init) {\n          editor.theme.init(editor, ThemeManager.urls[theme] || editor.documentBaseUrl.replace(/\\/$/, ''), editor.$);\n        }\n      } else {\n        editor.theme = {};\n      }\n    };\n    var renderFromLoadedTheme = function (editor) {\n      return editor.theme.renderUI();\n    };\n    var renderFromThemeFunc = function (editor) {\n      var elm = editor.getElement();\n      var theme = getTheme(editor);\n      var info = theme(editor, elm);\n      if (info.editorContainer.nodeType) {\n        info.editorContainer.id = info.editorContainer.id || editor.id + '_parent';\n      }\n      if (info.iframeContainer && info.iframeContainer.nodeType) {\n        info.iframeContainer.id = info.iframeContainer.id || editor.id + '_iframecontainer';\n      }\n      info.height = info.iframeHeight ? info.iframeHeight : elm.offsetHeight;\n      return info;\n    };\n    var createThemeFalseResult = function (element) {\n      return {\n        editorContainer: element,\n        iframeContainer: element,\n        api: {}\n      };\n    };\n    var renderThemeFalseIframe = function (targetElement) {\n      var iframeContainer = DOM$4.create('div');\n      DOM$4.insertAfter(iframeContainer, targetElement);\n      return createThemeFalseResult(iframeContainer);\n    };\n    var renderThemeFalse = function (editor) {\n      var targetElement = editor.getElement();\n      return editor.inline ? createThemeFalseResult(null) : renderThemeFalseIframe(targetElement);\n    };\n    var renderThemeUi = function (editor) {\n      var elm = editor.getElement();\n      editor.orgDisplay = elm.style.display;\n      if (isString$1(getTheme(editor))) {\n        return renderFromLoadedTheme(editor);\n      } else if (isFunction(getTheme(editor))) {\n        return renderFromThemeFunc(editor);\n      } else {\n        return renderThemeFalse(editor);\n      }\n    };\n    var augmentEditorUiApi = function (editor, api) {\n      var uiApiFacade = {\n        show: Optional.from(api.show).getOr(noop),\n        hide: Optional.from(api.hide).getOr(noop),\n        disable: Optional.from(api.disable).getOr(noop),\n        isDisabled: Optional.from(api.isDisabled).getOr(never),\n        enable: function () {\n          if (!editor.mode.isReadOnly()) {\n            Optional.from(api.enable).map(call);\n          }\n        }\n      };\n      editor.ui = __assign(__assign({}, editor.ui), uiApiFacade);\n    };\n    var init = function (editor) {\n      editor.fire('ScriptsLoaded');\n      initIcons(editor);\n      initTheme(editor);\n      initPlugins(editor);\n      var renderInfo = renderThemeUi(editor);\n      augmentEditorUiApi(editor, Optional.from(renderInfo.api).getOr({}));\n      var boxInfo = {\n        editorContainer: renderInfo.editorContainer,\n        iframeContainer: renderInfo.iframeContainer\n      };\n      editor.editorContainer = boxInfo.editorContainer ? boxInfo.editorContainer : null;\n      appendContentCssFromSettings(editor);\n      if (editor.inline) {\n        return initContentBody(editor);\n      } else {\n        return init$1(editor, boxInfo);\n      }\n    };\n\n    var DOM$3 = DOMUtils.DOM;\n    var hasSkipLoadPrefix = function (name) {\n      return name.charAt(0) === '-';\n    };\n    var loadLanguage = function (scriptLoader, editor) {\n      var languageCode = getLanguageCode(editor);\n      var languageUrl = getLanguageUrl(editor);\n      if (I18n.hasCode(languageCode) === false && languageCode !== 'en') {\n        var url_1 = languageUrl !== '' ? languageUrl : editor.editorManager.baseURL + '/langs/' + languageCode + '.js';\n        scriptLoader.add(url_1, noop, undefined, function () {\n          languageLoadError(editor, url_1, languageCode);\n        });\n      }\n    };\n    var loadTheme = function (scriptLoader, editor, suffix, callback) {\n      var theme = getTheme(editor);\n      if (isString$1(theme)) {\n        if (!hasSkipLoadPrefix(theme) && !has$2(ThemeManager.urls, theme)) {\n          var themeUrl = getThemeUrl(editor);\n          if (themeUrl) {\n            ThemeManager.load(theme, editor.documentBaseURI.toAbsolute(themeUrl));\n          } else {\n            ThemeManager.load(theme, 'themes/' + theme + '/theme' + suffix + '.js');\n          }\n        }\n        scriptLoader.loadQueue(function () {\n          ThemeManager.waitFor(theme, callback);\n        });\n      } else {\n        callback();\n      }\n    };\n    var getIconsUrlMetaFromUrl = function (editor) {\n      return Optional.from(getIconsUrl(editor)).filter(function (url) {\n        return url.length > 0;\n      }).map(function (url) {\n        return {\n          url: url,\n          name: Optional.none()\n        };\n      });\n    };\n    var getIconsUrlMetaFromName = function (editor, name, suffix) {\n      return Optional.from(name).filter(function (name) {\n        return name.length > 0 && !IconManager.has(name);\n      }).map(function (name) {\n        return {\n          url: editor.editorManager.baseURL + '/icons/' + name + '/icons' + suffix + '.js',\n          name: Optional.some(name)\n        };\n      });\n    };\n    var loadIcons = function (scriptLoader, editor, suffix) {\n      var defaultIconsUrl = getIconsUrlMetaFromName(editor, 'default', suffix);\n      var customIconsUrl = getIconsUrlMetaFromUrl(editor).orThunk(function () {\n        return getIconsUrlMetaFromName(editor, getIconPackName(editor), '');\n      });\n      each$k(cat([\n        defaultIconsUrl,\n        customIconsUrl\n      ]), function (urlMeta) {\n        scriptLoader.add(urlMeta.url, noop, undefined, function () {\n          iconsLoadError(editor, urlMeta.url, urlMeta.name.getOrUndefined());\n        });\n      });\n    };\n    var loadPlugins = function (editor, suffix) {\n      Tools.each(getExternalPlugins$1(editor), function (url, name) {\n        PluginManager.load(name, url, noop, undefined, function () {\n          pluginLoadError(editor, url, name);\n        });\n        editor.settings.plugins += ' ' + name;\n      });\n      Tools.each(getPlugins(editor).split(/[ ,]/), function (plugin) {\n        plugin = Tools.trim(plugin);\n        if (plugin && !PluginManager.urls[plugin]) {\n          if (hasSkipLoadPrefix(plugin)) {\n            plugin = plugin.substr(1, plugin.length);\n            var dependencies = PluginManager.dependencies(plugin);\n            Tools.each(dependencies, function (depPlugin) {\n              var defaultSettings = {\n                prefix: 'plugins/',\n                resource: depPlugin,\n                suffix: '/plugin' + suffix + '.js'\n              };\n              var dep = PluginManager.createUrl(defaultSettings, depPlugin);\n              PluginManager.load(dep.resource, dep, noop, undefined, function () {\n                pluginLoadError(editor, dep.prefix + dep.resource + dep.suffix, dep.resource);\n              });\n            });\n          } else {\n            var url_2 = {\n              prefix: 'plugins/',\n              resource: plugin,\n              suffix: '/plugin' + suffix + '.js'\n            };\n            PluginManager.load(plugin, url_2, noop, undefined, function () {\n              pluginLoadError(editor, url_2.prefix + url_2.resource + url_2.suffix, plugin);\n            });\n          }\n        }\n      });\n    };\n    var loadScripts = function (editor, suffix) {\n      var scriptLoader = ScriptLoader.ScriptLoader;\n      loadTheme(scriptLoader, editor, suffix, function () {\n        loadLanguage(scriptLoader, editor);\n        loadIcons(scriptLoader, editor, suffix);\n        loadPlugins(editor, suffix);\n        scriptLoader.loadQueue(function () {\n          if (!editor.removed) {\n            init(editor);\n          }\n        }, editor, function () {\n          if (!editor.removed) {\n            init(editor);\n          }\n        });\n      });\n    };\n    var getStyleSheetLoader = function (element, editor) {\n      return instance.forElement(element, {\n        contentCssCors: hasContentCssCors(editor),\n        referrerPolicy: getReferrerPolicy(editor)\n      });\n    };\n    var render = function (editor) {\n      var id = editor.id;\n      I18n.setCode(getLanguageCode(editor));\n      var readyHandler = function () {\n        DOM$3.unbind(window, 'ready', readyHandler);\n        editor.render();\n      };\n      if (!EventUtils.Event.domLoaded) {\n        DOM$3.bind(window, 'ready', readyHandler);\n        return;\n      }\n      if (!editor.getElement()) {\n        return;\n      }\n      if (!Env.contentEditable) {\n        return;\n      }\n      var element = SugarElement.fromDom(editor.getElement());\n      var snapshot = clone$3(element);\n      editor.on('remove', function () {\n        eachr(element.dom.attributes, function (attr) {\n          return remove$6(element, attr.name);\n        });\n        setAll$1(element, snapshot);\n      });\n      editor.ui.styleSheetLoader = getStyleSheetLoader(element, editor);\n      if (!isInline(editor)) {\n        editor.orgVisibility = editor.getElement().style.visibility;\n        editor.getElement().style.visibility = 'hidden';\n      } else {\n        editor.inline = true;\n      }\n      var form = editor.getElement().form || DOM$3.getParent(id, 'form');\n      if (form) {\n        editor.formElement = form;\n        if (hasHiddenInput(editor) && !isTextareaOrInput(editor.getElement())) {\n          DOM$3.insertAfter(DOM$3.create('input', {\n            type: 'hidden',\n            name: id\n          }), id);\n          editor.hasHiddenInput = true;\n        }\n        editor.formEventDelegate = function (e) {\n          editor.fire(e.type, e);\n        };\n        DOM$3.bind(form, 'submit reset', editor.formEventDelegate);\n        editor.on('reset', function () {\n          editor.resetContent();\n        });\n        if (shouldPatchSubmit(editor) && !form.submit.nodeType && !form.submit.length && !form._mceOldSubmit) {\n          form._mceOldSubmit = form.submit;\n          form.submit = function () {\n            editor.editorManager.triggerSave();\n            editor.setDirty(false);\n            return form._mceOldSubmit(form);\n          };\n        }\n      }\n      editor.windowManager = WindowManager(editor);\n      editor.notificationManager = NotificationManager(editor);\n      if (isEncodingXml(editor)) {\n        editor.on('GetContent', function (e) {\n          if (e.save) {\n            e.content = DOM$3.encode(e.content);\n          }\n        });\n      }\n      if (shouldAddFormSubmitTrigger(editor)) {\n        editor.on('submit', function () {\n          if (editor.initialized) {\n            editor.save();\n          }\n        });\n      }\n      if (shouldAddUnloadTrigger(editor)) {\n        editor._beforeUnload = function () {\n          if (editor.initialized && !editor.destroyed && !editor.isHidden()) {\n            editor.save({\n              format: 'raw',\n              no_events: true,\n              set_dirty: false\n            });\n          }\n        };\n        editor.editorManager.on('BeforeUnload', editor._beforeUnload);\n      }\n      editor.editorManager.add(editor);\n      loadScripts(editor, editor.suffix);\n    };\n\n    var addVisual = function (editor, elm) {\n      return addVisual$1(editor, elm);\n    };\n\n    var legacyPropNames = {\n      'font-size': 'size',\n      'font-family': 'face'\n    };\n    var getSpecifiedFontProp = function (propName, rootElm, elm) {\n      var getProperty = function (elm) {\n        return getRaw(elm, propName).orThunk(function () {\n          if (name(elm) === 'font') {\n            return get$9(legacyPropNames, propName).bind(function (legacyPropName) {\n              return getOpt(elm, legacyPropName);\n            });\n          } else {\n            return Optional.none();\n          }\n        });\n      };\n      var isRoot = function (elm) {\n        return eq(SugarElement.fromDom(rootElm), elm);\n      };\n      return closest$1(SugarElement.fromDom(elm), function (elm) {\n        return getProperty(elm);\n      }, isRoot);\n    };\n    var normalizeFontFamily = function (fontFamily) {\n      return fontFamily.replace(/[\\'\\\"\\\\]/g, '').replace(/,\\s+/g, ',');\n    };\n    var getComputedFontProp = function (propName, elm) {\n      return Optional.from(DOMUtils.DOM.getStyle(elm, propName, true));\n    };\n    var getFontProp = function (propName) {\n      return function (rootElm, elm) {\n        return Optional.from(elm).map(SugarElement.fromDom).filter(isElement$6).bind(function (element) {\n          return getSpecifiedFontProp(propName, rootElm, element.dom).or(getComputedFontProp(propName, element.dom));\n        }).getOr('');\n      };\n    };\n    var getFontSize = getFontProp('font-size');\n    var getFontFamily = compose(normalizeFontFamily, getFontProp('font-family'));\n\n    var findFirstCaretElement = function (editor) {\n      return firstPositionIn(editor.getBody()).map(function (caret) {\n        var container = caret.container();\n        return isText$7(container) ? container.parentNode : container;\n      });\n    };\n    var getCaretElement = function (editor) {\n      return Optional.from(editor.selection.getRng()).bind(function (rng) {\n        var root = editor.getBody();\n        var atStartOfNode = rng.startContainer === root && rng.startOffset === 0;\n        return atStartOfNode ? Optional.none() : Optional.from(editor.selection.getStart(true));\n      });\n    };\n    var bindRange = function (editor, binder) {\n      return getCaretElement(editor).orThunk(curry(findFirstCaretElement, editor)).map(SugarElement.fromDom).filter(isElement$6).bind(binder);\n    };\n    var mapRange = function (editor, mapper) {\n      return bindRange(editor, compose1(Optional.some, mapper));\n    };\n\n    var fromFontSizeNumber = function (editor, value) {\n      if (/^[0-9.]+$/.test(value)) {\n        var fontSizeNumber = parseInt(value, 10);\n        if (fontSizeNumber >= 1 && fontSizeNumber <= 7) {\n          var fontSizes = getFontStyleValues(editor);\n          var fontClasses = getFontSizeClasses(editor);\n          if (fontClasses) {\n            return fontClasses[fontSizeNumber - 1] || value;\n          } else {\n            return fontSizes[fontSizeNumber - 1] || value;\n          }\n        } else {\n          return value;\n        }\n      } else {\n        return value;\n      }\n    };\n    var normalizeFontNames = function (font) {\n      var fonts = font.split(/\\s*,\\s*/);\n      return map$3(fonts, function (font) {\n        if (font.indexOf(' ') !== -1 && !(startsWith(font, '\"') || startsWith(font, '\\''))) {\n          return '\\'' + font + '\\'';\n        } else {\n          return font;\n        }\n      }).join(',');\n    };\n    var fontNameAction = function (editor, value) {\n      var font = fromFontSizeNumber(editor, value);\n      editor.formatter.toggle('fontname', { value: normalizeFontNames(font) });\n      editor.nodeChanged();\n    };\n    var fontNameQuery = function (editor) {\n      return mapRange(editor, function (elm) {\n        return getFontFamily(editor.getBody(), elm.dom);\n      }).getOr('');\n    };\n    var fontSizeAction = function (editor, value) {\n      editor.formatter.toggle('fontsize', { value: fromFontSizeNumber(editor, value) });\n      editor.nodeChanged();\n    };\n    var fontSizeQuery = function (editor) {\n      return mapRange(editor, function (elm) {\n        return getFontSize(editor.getBody(), elm.dom);\n      }).getOr('');\n    };\n\n    var lineHeightQuery = function (editor) {\n      return mapRange(editor, function (elm) {\n        var root = SugarElement.fromDom(editor.getBody());\n        var specifiedStyle = closest$1(elm, function (elm) {\n          return getRaw(elm, 'line-height');\n        }, curry(eq, root));\n        var computedStyle = function () {\n          var lineHeight = parseFloat(get$5(elm, 'line-height'));\n          var fontSize = parseFloat(get$5(elm, 'font-size'));\n          return String(lineHeight / fontSize);\n        };\n        return specifiedStyle.getOrThunk(computedStyle);\n      }).getOr('');\n    };\n    var lineHeightAction = function (editor, lineHeight) {\n      editor.formatter.toggle('lineheight', { value: String(lineHeight) });\n      editor.nodeChanged();\n    };\n\n    var processValue = function (value) {\n      if (typeof value !== 'string') {\n        var details = Tools.extend({\n          paste: value.paste,\n          data: { paste: value.paste }\n        }, value);\n        return {\n          content: value.content,\n          details: details\n        };\n      }\n      return {\n        content: value,\n        details: {}\n      };\n    };\n    var insertAtCaret = function (editor, value) {\n      var result = processValue(value);\n      insertContent(editor, result.content, result.details);\n    };\n\n    var each$4 = Tools.each;\n    var map = Tools.map, inArray = Tools.inArray;\n    var EditorCommands = function () {\n      function EditorCommands(editor) {\n        this.commands = {\n          state: {},\n          exec: {},\n          value: {}\n        };\n        this.editor = editor;\n        this.setupCommands(editor);\n      }\n      EditorCommands.prototype.execCommand = function (command, ui, value, args) {\n        var func, state = false;\n        var self = this;\n        if (self.editor.removed) {\n          return;\n        }\n        if (command.toLowerCase() !== 'mcefocus') {\n          if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint)$/.test(command) && (!args || !args.skip_focus)) {\n            self.editor.focus();\n          } else {\n            restore(self.editor);\n          }\n        }\n        args = self.editor.fire('BeforeExecCommand', {\n          command: command,\n          ui: ui,\n          value: value\n        });\n        if (args.isDefaultPrevented()) {\n          return false;\n        }\n        var customCommand = command.toLowerCase();\n        if (func = self.commands.exec[customCommand]) {\n          func(customCommand, ui, value);\n          self.editor.fire('ExecCommand', {\n            command: command,\n            ui: ui,\n            value: value\n          });\n          return true;\n        }\n        each$4(this.editor.plugins, function (p) {\n          if (p.execCommand && p.execCommand(command, ui, value)) {\n            self.editor.fire('ExecCommand', {\n              command: command,\n              ui: ui,\n              value: value\n            });\n            state = true;\n            return false;\n          }\n        });\n        if (state) {\n          return state;\n        }\n        if (self.editor.theme && self.editor.theme.execCommand && self.editor.theme.execCommand(command, ui, value)) {\n          self.editor.fire('ExecCommand', {\n            command: command,\n            ui: ui,\n            value: value\n          });\n          return true;\n        }\n        try {\n          state = self.editor.getDoc().execCommand(command, ui, value);\n        } catch (ex) {\n        }\n        if (state) {\n          self.editor.fire('ExecCommand', {\n            command: command,\n            ui: ui,\n            value: value\n          });\n          return true;\n        }\n        return false;\n      };\n      EditorCommands.prototype.queryCommandState = function (command) {\n        var func;\n        if (this.editor.quirks.isHidden() || this.editor.removed) {\n          return;\n        }\n        command = command.toLowerCase();\n        if (func = this.commands.state[command]) {\n          return func(command);\n        }\n        try {\n          return this.editor.getDoc().queryCommandState(command);\n        } catch (ex) {\n        }\n        return false;\n      };\n      EditorCommands.prototype.queryCommandValue = function (command) {\n        var func;\n        if (this.editor.quirks.isHidden() || this.editor.removed) {\n          return;\n        }\n        command = command.toLowerCase();\n        if (func = this.commands.value[command]) {\n          return func(command);\n        }\n        try {\n          return this.editor.getDoc().queryCommandValue(command);\n        } catch (ex) {\n        }\n      };\n      EditorCommands.prototype.addCommands = function (commandList, type) {\n        if (type === void 0) {\n          type = 'exec';\n        }\n        var self = this;\n        each$4(commandList, function (callback, command) {\n          each$4(command.toLowerCase().split(','), function (command) {\n            self.commands[type][command] = callback;\n          });\n        });\n      };\n      EditorCommands.prototype.addCommand = function (command, callback, scope) {\n        var _this = this;\n        command = command.toLowerCase();\n        this.commands.exec[command] = function (command, ui, value, args) {\n          return callback.call(scope || _this.editor, ui, value, args);\n        };\n      };\n      EditorCommands.prototype.queryCommandSupported = function (command) {\n        command = command.toLowerCase();\n        if (this.commands.exec[command]) {\n          return true;\n        }\n        try {\n          return this.editor.getDoc().queryCommandSupported(command);\n        } catch (ex) {\n        }\n        return false;\n      };\n      EditorCommands.prototype.addQueryStateHandler = function (command, callback, scope) {\n        var _this = this;\n        command = command.toLowerCase();\n        this.commands.state[command] = function () {\n          return callback.call(scope || _this.editor);\n        };\n      };\n      EditorCommands.prototype.addQueryValueHandler = function (command, callback, scope) {\n        var _this = this;\n        command = command.toLowerCase();\n        this.commands.value[command] = function () {\n          return callback.call(scope || _this.editor);\n        };\n      };\n      EditorCommands.prototype.hasCustomCommand = function (command) {\n        command = command.toLowerCase();\n        return !!this.commands.exec[command];\n      };\n      EditorCommands.prototype.execNativeCommand = function (command, ui, value) {\n        if (ui === undefined) {\n          ui = false;\n        }\n        if (value === undefined) {\n          value = null;\n        }\n        return this.editor.getDoc().execCommand(command, ui, value);\n      };\n      EditorCommands.prototype.isFormatMatch = function (name) {\n        return this.editor.formatter.match(name);\n      };\n      EditorCommands.prototype.toggleFormat = function (name, value) {\n        this.editor.formatter.toggle(name, value);\n        this.editor.nodeChanged();\n      };\n      EditorCommands.prototype.storeSelection = function (type) {\n        this.selectionBookmark = this.editor.selection.getBookmark(type);\n      };\n      EditorCommands.prototype.restoreSelection = function () {\n        this.editor.selection.moveToBookmark(this.selectionBookmark);\n      };\n      EditorCommands.prototype.setupCommands = function (editor) {\n        var self = this;\n        this.addCommands({\n          'mceResetDesignMode,mceBeginUndoLevel': noop,\n          'mceEndUndoLevel,mceAddUndoLevel': function () {\n            editor.undoManager.add();\n          },\n          'mceFocus': function (_command, _ui, value) {\n            focus(editor, value);\n          },\n          'Cut,Copy,Paste': function (command) {\n            var doc = editor.getDoc();\n            var failed;\n            try {\n              self.execNativeCommand(command);\n            } catch (ex) {\n              failed = true;\n            }\n            if (command === 'paste' && !doc.queryCommandEnabled(command)) {\n              failed = true;\n            }\n            if (failed || !doc.queryCommandSupported(command)) {\n              var msg = editor.translate('Your browser doesn\\'t support direct access to the clipboard. ' + 'Please use the Ctrl+X/C/V keyboard shortcuts instead.');\n              if (Env.mac) {\n                msg = msg.replace(/Ctrl\\+/g, '\\u2318+');\n              }\n              editor.notificationManager.open({\n                text: msg,\n                type: 'error'\n              });\n            }\n          },\n          'unlink': function () {\n            if (editor.selection.isCollapsed()) {\n              var elm = editor.dom.getParent(editor.selection.getStart(), 'a');\n              if (elm) {\n                editor.dom.remove(elm, true);\n              }\n              return;\n            }\n            editor.formatter.remove('link');\n          },\n          'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull,JustifyNone': function (command) {\n            var align = command.substring(7);\n            if (align === 'full') {\n              align = 'justify';\n            }\n            each$4('left,center,right,justify'.split(','), function (name) {\n              if (align !== name) {\n                editor.formatter.remove('align' + name);\n              }\n            });\n            if (align !== 'none') {\n              self.toggleFormat('align' + align);\n            }\n          },\n          'InsertUnorderedList,InsertOrderedList': function (command) {\n            var listParent;\n            self.execNativeCommand(command);\n            var listElm = editor.dom.getParent(editor.selection.getNode(), 'ol,ul');\n            if (listElm) {\n              listParent = listElm.parentNode;\n              if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {\n                self.storeSelection();\n                editor.dom.split(listParent, listElm);\n                self.restoreSelection();\n              }\n            }\n          },\n          'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {\n            self.toggleFormat(command);\n          },\n          'ForeColor,HiliteColor': function (command, ui, value) {\n            self.toggleFormat(command, { value: value });\n          },\n          'FontName': function (command, ui, value) {\n            fontNameAction(editor, value);\n          },\n          'FontSize': function (command, ui, value) {\n            fontSizeAction(editor, value);\n          },\n          'LineHeight': function (command, ui, value) {\n            lineHeightAction(editor, value);\n          },\n          'Lang': function (command, ui, lang) {\n            self.toggleFormat(command, {\n              value: lang.code,\n              customValue: lang.customCode\n            });\n          },\n          'RemoveFormat': function (command) {\n            editor.formatter.remove(command);\n          },\n          'mceBlockQuote': function () {\n            self.toggleFormat('blockquote');\n          },\n          'FormatBlock': function (command, ui, value) {\n            return self.toggleFormat(value || 'p');\n          },\n          'mceCleanup': function () {\n            var bookmark = editor.selection.getBookmark();\n            editor.setContent(editor.getContent());\n            editor.selection.moveToBookmark(bookmark);\n          },\n          'mceRemoveNode': function (command, ui, value) {\n            var node = value || editor.selection.getNode();\n            if (node !== editor.getBody()) {\n              self.storeSelection();\n              editor.dom.remove(node, true);\n              self.restoreSelection();\n            }\n          },\n          'mceSelectNodeDepth': function (command, ui, value) {\n            var counter = 0;\n            editor.dom.getParent(editor.selection.getNode(), function (node) {\n              if (node.nodeType === 1 && counter++ === value) {\n                editor.selection.select(node);\n                return false;\n              }\n            }, editor.getBody());\n          },\n          'mceSelectNode': function (command, ui, value) {\n            editor.selection.select(value);\n          },\n          'mceInsertContent': function (command, ui, value) {\n            insertAtCaret(editor, value);\n          },\n          'mceInsertRawHTML': function (command, ui, value) {\n            editor.selection.setContent('tiny_mce_marker');\n            var content = editor.getContent();\n            editor.setContent(content.replace(/tiny_mce_marker/g, function () {\n              return value;\n            }));\n          },\n          'mceInsertNewLine': function (command, ui, value) {\n            insert(editor, value);\n          },\n          'mceToggleFormat': function (command, ui, value) {\n            self.toggleFormat(value);\n          },\n          'mceSetContent': function (command, ui, value) {\n            editor.setContent(value);\n          },\n          'Indent,Outdent': function (command) {\n            handle(editor, command);\n          },\n          'mceRepaint': noop,\n          'InsertHorizontalRule': function () {\n            editor.execCommand('mceInsertContent', false, '<hr />');\n          },\n          'mceToggleVisualAid': function () {\n            editor.hasVisual = !editor.hasVisual;\n            editor.addVisual();\n          },\n          'mceReplaceContent': function (command, ui, value) {\n            editor.execCommand('mceInsertContent', false, value.replace(/\\{\\$selection\\}/g, editor.selection.getContent({ format: 'text' })));\n          },\n          'mceInsertLink': function (command, ui, value) {\n            if (typeof value === 'string') {\n              value = { href: value };\n            }\n            var anchor = editor.dom.getParent(editor.selection.getNode(), 'a');\n            value.href = value.href.replace(/ /g, '%20');\n            if (!anchor || !value.href) {\n              editor.formatter.remove('link');\n            }\n            if (value.href) {\n              editor.formatter.apply('link', value, anchor);\n            }\n          },\n          'selectAll': function () {\n            var editingHost = editor.dom.getParent(editor.selection.getStart(), isContentEditableTrue$4);\n            if (editingHost) {\n              var rng = editor.dom.createRng();\n              rng.selectNodeContents(editingHost);\n              editor.selection.setRng(rng);\n            }\n          },\n          'mceNewDocument': function () {\n            editor.setContent('');\n          },\n          'InsertLineBreak': function (command, ui, value) {\n            insert$1(editor, value);\n            return true;\n          }\n        });\n        var alignStates = function (name) {\n          return function () {\n            var selection = editor.selection;\n            var nodes = selection.isCollapsed() ? [editor.dom.getParent(selection.getNode(), editor.dom.isBlock)] : selection.getSelectedBlocks();\n            var matches = map(nodes, function (node) {\n              return !!editor.formatter.matchNode(node, name);\n            });\n            return inArray(matches, true) !== -1;\n          };\n        };\n        self.addCommands({\n          'JustifyLeft': alignStates('alignleft'),\n          'JustifyCenter': alignStates('aligncenter'),\n          'JustifyRight': alignStates('alignright'),\n          'JustifyFull': alignStates('alignjustify'),\n          'Bold,Italic,Underline,Strikethrough,Superscript,Subscript': function (command) {\n            return self.isFormatMatch(command);\n          },\n          'mceBlockQuote': function () {\n            return self.isFormatMatch('blockquote');\n          },\n          'Outdent': function () {\n            return canOutdent(editor);\n          },\n          'InsertUnorderedList,InsertOrderedList': function (command) {\n            var list = editor.dom.getParent(editor.selection.getNode(), 'ul,ol');\n            return list && (command === 'insertunorderedlist' && list.tagName === 'UL' || command === 'insertorderedlist' && list.tagName === 'OL');\n          }\n        }, 'state');\n        self.addCommands({\n          Undo: function () {\n            editor.undoManager.undo();\n          },\n          Redo: function () {\n            editor.undoManager.redo();\n          }\n        });\n        self.addQueryValueHandler('FontName', function () {\n          return fontNameQuery(editor);\n        }, this);\n        self.addQueryValueHandler('FontSize', function () {\n          return fontSizeQuery(editor);\n        }, this);\n        self.addQueryValueHandler('LineHeight', function () {\n          return lineHeightQuery(editor);\n        }, this);\n      };\n      return EditorCommands;\n    }();\n\n    var internalContentEditableAttr = 'data-mce-contenteditable';\n    var toggleClass = function (elm, cls, state) {\n      if (has(elm, cls) && state === false) {\n        remove$3(elm, cls);\n      } else if (state) {\n        add$1(elm, cls);\n      }\n    };\n    var setEditorCommandState = function (editor, cmd, state) {\n      try {\n        editor.getDoc().execCommand(cmd, false, String(state));\n      } catch (ex) {\n      }\n    };\n    var setContentEditable = function (elm, state) {\n      elm.dom.contentEditable = state ? 'true' : 'false';\n    };\n    var switchOffContentEditableTrue = function (elm) {\n      each$k(descendants(elm, '*[contenteditable=\"true\"]'), function (elm) {\n        set$1(elm, internalContentEditableAttr, 'true');\n        setContentEditable(elm, false);\n      });\n    };\n    var switchOnContentEditableTrue = function (elm) {\n      each$k(descendants(elm, '*[' + internalContentEditableAttr + '=\"true\"]'), function (elm) {\n        remove$6(elm, internalContentEditableAttr);\n        setContentEditable(elm, true);\n      });\n    };\n    var removeFakeSelection = function (editor) {\n      Optional.from(editor.selection.getNode()).each(function (elm) {\n        elm.removeAttribute('data-mce-selected');\n      });\n    };\n    var restoreFakeSelection = function (editor) {\n      editor.selection.setRng(editor.selection.getRng());\n    };\n    var toggleReadOnly = function (editor, state) {\n      var body = SugarElement.fromDom(editor.getBody());\n      toggleClass(body, 'mce-content-readonly', state);\n      if (state) {\n        editor.selection.controlSelection.hideResizeRect();\n        editor._selectionOverrides.hideFakeCaret();\n        removeFakeSelection(editor);\n        editor.readonly = true;\n        setContentEditable(body, false);\n        switchOffContentEditableTrue(body);\n      } else {\n        editor.readonly = false;\n        setContentEditable(body, true);\n        switchOnContentEditableTrue(body);\n        setEditorCommandState(editor, 'StyleWithCSS', false);\n        setEditorCommandState(editor, 'enableInlineTableEditing', false);\n        setEditorCommandState(editor, 'enableObjectResizing', false);\n        if (hasEditorOrUiFocus(editor)) {\n          editor.focus();\n        }\n        restoreFakeSelection(editor);\n        editor.nodeChanged();\n      }\n    };\n    var isReadOnly = function (editor) {\n      return editor.readonly;\n    };\n    var registerFilters = function (editor) {\n      editor.parser.addAttributeFilter('contenteditable', function (nodes) {\n        if (isReadOnly(editor)) {\n          each$k(nodes, function (node) {\n            node.attr(internalContentEditableAttr, node.attr('contenteditable'));\n            node.attr('contenteditable', 'false');\n          });\n        }\n      });\n      editor.serializer.addAttributeFilter(internalContentEditableAttr, function (nodes) {\n        if (isReadOnly(editor)) {\n          each$k(nodes, function (node) {\n            node.attr('contenteditable', node.attr(internalContentEditableAttr));\n          });\n        }\n      });\n      editor.serializer.addTempAttr(internalContentEditableAttr);\n    };\n    var registerReadOnlyContentFilters = function (editor) {\n      if (editor.serializer) {\n        registerFilters(editor);\n      } else {\n        editor.on('PreInit', function () {\n          registerFilters(editor);\n        });\n      }\n    };\n    var isClickEvent = function (e) {\n      return e.type === 'click';\n    };\n    var getAnchorHrefOpt = function (editor, elm) {\n      var isRoot = function (elm) {\n        return eq(elm, SugarElement.fromDom(editor.getBody()));\n      };\n      return closest$2(elm, 'a', isRoot).bind(function (a) {\n        return getOpt(a, 'href');\n      });\n    };\n    var processReadonlyEvents = function (editor, e) {\n      if (isClickEvent(e) && !VK.metaKeyPressed(e)) {\n        var elm = SugarElement.fromDom(e.target);\n        getAnchorHrefOpt(editor, elm).each(function (href) {\n          e.preventDefault();\n          if (/^#/.test(href)) {\n            var targetEl = editor.dom.select(href + ',[name=\"' + removeLeading(href, '#') + '\"]');\n            if (targetEl.length) {\n              editor.selection.scrollIntoView(targetEl[0], true);\n            }\n          } else {\n            window.open(href, '_blank', 'rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes');\n          }\n        });\n      }\n    };\n    var registerReadOnlySelectionBlockers = function (editor) {\n      editor.on('ShowCaret', function (e) {\n        if (isReadOnly(editor)) {\n          e.preventDefault();\n        }\n      });\n      editor.on('ObjectSelected', function (e) {\n        if (isReadOnly(editor)) {\n          e.preventDefault();\n        }\n      });\n    };\n\n    var nativeEvents = Tools.makeMap('focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange ' + 'mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover ' + 'draggesture dragdrop drop drag submit ' + 'compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel', ' ');\n    var EventDispatcher = function () {\n      function EventDispatcher(settings) {\n        this.bindings = {};\n        this.settings = settings || {};\n        this.scope = this.settings.scope || this;\n        this.toggleEvent = this.settings.toggleEvent || never;\n      }\n      EventDispatcher.isNative = function (name) {\n        return !!nativeEvents[name.toLowerCase()];\n      };\n      EventDispatcher.prototype.fire = function (name, args) {\n        var lcName = name.toLowerCase();\n        var event = normalize$3(lcName, args || {}, this.scope);\n        if (this.settings.beforeFire) {\n          this.settings.beforeFire(event);\n        }\n        var handlers = this.bindings[lcName];\n        if (handlers) {\n          for (var i = 0, l = handlers.length; i < l; i++) {\n            var callback = handlers[i];\n            if (callback.removed) {\n              continue;\n            }\n            if (callback.once) {\n              this.off(lcName, callback.func);\n            }\n            if (event.isImmediatePropagationStopped()) {\n              return event;\n            }\n            if (callback.func.call(this.scope, event) === false) {\n              event.preventDefault();\n              return event;\n            }\n          }\n        }\n        return event;\n      };\n      EventDispatcher.prototype.on = function (name, callback, prepend, extra) {\n        if (callback === false) {\n          callback = never;\n        }\n        if (callback) {\n          var wrappedCallback = {\n            func: callback,\n            removed: false\n          };\n          if (extra) {\n            Tools.extend(wrappedCallback, extra);\n          }\n          var names = name.toLowerCase().split(' ');\n          var i = names.length;\n          while (i--) {\n            var currentName = names[i];\n            var handlers = this.bindings[currentName];\n            if (!handlers) {\n              handlers = [];\n              this.toggleEvent(currentName, true);\n            }\n            if (prepend) {\n              handlers = __spreadArray([wrappedCallback], handlers, true);\n            } else {\n              handlers = __spreadArray(__spreadArray([], handlers, true), [wrappedCallback], false);\n            }\n            this.bindings[currentName] = handlers;\n          }\n        }\n        return this;\n      };\n      EventDispatcher.prototype.off = function (name, callback) {\n        var _this = this;\n        if (name) {\n          var names = name.toLowerCase().split(' ');\n          var i = names.length;\n          while (i--) {\n            var currentName = names[i];\n            var handlers = this.bindings[currentName];\n            if (!currentName) {\n              each$j(this.bindings, function (_value, bindingName) {\n                _this.toggleEvent(bindingName, false);\n                delete _this.bindings[bindingName];\n              });\n              return this;\n            }\n            if (handlers) {\n              if (!callback) {\n                handlers.length = 0;\n              } else {\n                var filteredHandlers = partition(handlers, function (handler) {\n                  return handler.func === callback;\n                });\n                handlers = filteredHandlers.fail;\n                this.bindings[currentName] = handlers;\n                each$k(filteredHandlers.pass, function (handler) {\n                  handler.removed = true;\n                });\n              }\n              if (!handlers.length) {\n                this.toggleEvent(name, false);\n                delete this.bindings[currentName];\n              }\n            }\n          }\n        } else {\n          each$j(this.bindings, function (_value, name) {\n            _this.toggleEvent(name, false);\n          });\n          this.bindings = {};\n        }\n        return this;\n      };\n      EventDispatcher.prototype.once = function (name, callback, prepend) {\n        return this.on(name, callback, prepend, { once: true });\n      };\n      EventDispatcher.prototype.has = function (name) {\n        name = name.toLowerCase();\n        return !(!this.bindings[name] || this.bindings[name].length === 0);\n      };\n      return EventDispatcher;\n    }();\n\n    var getEventDispatcher = function (obj) {\n      if (!obj._eventDispatcher) {\n        obj._eventDispatcher = new EventDispatcher({\n          scope: obj,\n          toggleEvent: function (name, state) {\n            if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) {\n              obj.toggleNativeEvent(name, state);\n            }\n          }\n        });\n      }\n      return obj._eventDispatcher;\n    };\n    var Observable = {\n      fire: function (name, args, bubble) {\n        var self = this;\n        if (self.removed && name !== 'remove' && name !== 'detach') {\n          return args;\n        }\n        var dispatcherArgs = getEventDispatcher(self).fire(name, args);\n        if (bubble !== false && self.parent) {\n          var parent_1 = self.parent();\n          while (parent_1 && !dispatcherArgs.isPropagationStopped()) {\n            parent_1.fire(name, dispatcherArgs, false);\n            parent_1 = parent_1.parent();\n          }\n        }\n        return dispatcherArgs;\n      },\n      on: function (name, callback, prepend) {\n        return getEventDispatcher(this).on(name, callback, prepend);\n      },\n      off: function (name, callback) {\n        return getEventDispatcher(this).off(name, callback);\n      },\n      once: function (name, callback) {\n        return getEventDispatcher(this).once(name, callback);\n      },\n      hasEventListeners: function (name) {\n        return getEventDispatcher(this).has(name);\n      }\n    };\n\n    var DOM$2 = DOMUtils.DOM;\n    var customEventRootDelegates;\n    var getEventTarget = function (editor, eventName) {\n      if (eventName === 'selectionchange') {\n        return editor.getDoc();\n      }\n      if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {\n        return editor.getDoc().documentElement;\n      }\n      var eventRoot = getEventRoot(editor);\n      if (eventRoot) {\n        if (!editor.eventRoot) {\n          editor.eventRoot = DOM$2.select(eventRoot)[0];\n        }\n        return editor.eventRoot;\n      }\n      return editor.getBody();\n    };\n    var isListening = function (editor) {\n      return !editor.hidden && !isReadOnly(editor);\n    };\n    var fireEvent = function (editor, eventName, e) {\n      if (isListening(editor)) {\n        editor.fire(eventName, e);\n      } else if (isReadOnly(editor)) {\n        processReadonlyEvents(editor, e);\n      }\n    };\n    var bindEventDelegate = function (editor, eventName) {\n      var delegate;\n      if (!editor.delegates) {\n        editor.delegates = {};\n      }\n      if (editor.delegates[eventName] || editor.removed) {\n        return;\n      }\n      var eventRootElm = getEventTarget(editor, eventName);\n      if (getEventRoot(editor)) {\n        if (!customEventRootDelegates) {\n          customEventRootDelegates = {};\n          editor.editorManager.on('removeEditor', function () {\n            if (!editor.editorManager.activeEditor) {\n              if (customEventRootDelegates) {\n                each$j(customEventRootDelegates, function (_value, name) {\n                  editor.dom.unbind(getEventTarget(editor, name));\n                });\n                customEventRootDelegates = null;\n              }\n            }\n          });\n        }\n        if (customEventRootDelegates[eventName]) {\n          return;\n        }\n        delegate = function (e) {\n          var target = e.target;\n          var editors = editor.editorManager.get();\n          var i = editors.length;\n          while (i--) {\n            var body = editors[i].getBody();\n            if (body === target || DOM$2.isChildOf(target, body)) {\n              fireEvent(editors[i], eventName, e);\n            }\n          }\n        };\n        customEventRootDelegates[eventName] = delegate;\n        DOM$2.bind(eventRootElm, eventName, delegate);\n      } else {\n        delegate = function (e) {\n          fireEvent(editor, eventName, e);\n        };\n        DOM$2.bind(eventRootElm, eventName, delegate);\n        editor.delegates[eventName] = delegate;\n      }\n    };\n    var EditorObservable = __assign(__assign({}, Observable), {\n      bindPendingEventDelegates: function () {\n        var self = this;\n        Tools.each(self._pendingNativeEvents, function (name) {\n          bindEventDelegate(self, name);\n        });\n      },\n      toggleNativeEvent: function (name, state) {\n        var self = this;\n        if (name === 'focus' || name === 'blur') {\n          return;\n        }\n        if (self.removed) {\n          return;\n        }\n        if (state) {\n          if (self.initialized) {\n            bindEventDelegate(self, name);\n          } else {\n            if (!self._pendingNativeEvents) {\n              self._pendingNativeEvents = [name];\n            } else {\n              self._pendingNativeEvents.push(name);\n            }\n          }\n        } else if (self.initialized) {\n          self.dom.unbind(getEventTarget(self, name), name, self.delegates[name]);\n          delete self.delegates[name];\n        }\n      },\n      unbindAllNativeEvents: function () {\n        var self = this;\n        var body = self.getBody();\n        var dom = self.dom;\n        if (self.delegates) {\n          each$j(self.delegates, function (value, name) {\n            self.dom.unbind(getEventTarget(self, name), name, value);\n          });\n          delete self.delegates;\n        }\n        if (!self.inline && body && dom) {\n          body.onload = null;\n          dom.unbind(self.getWin());\n          dom.unbind(self.getDoc());\n        }\n        if (dom) {\n          dom.unbind(body);\n          dom.unbind(self.getContainer());\n        }\n      }\n    });\n\n    var defaultModes = [\n      'design',\n      'readonly'\n    ];\n    var switchToMode = function (editor, activeMode, availableModes, mode) {\n      var oldMode = availableModes[activeMode.get()];\n      var newMode = availableModes[mode];\n      try {\n        newMode.activate();\n      } catch (e) {\n        console.error('problem while activating editor mode ' + mode + ':', e);\n        return;\n      }\n      oldMode.deactivate();\n      if (oldMode.editorReadOnly !== newMode.editorReadOnly) {\n        toggleReadOnly(editor, newMode.editorReadOnly);\n      }\n      activeMode.set(mode);\n      fireSwitchMode(editor, mode);\n    };\n    var setMode = function (editor, availableModes, activeMode, mode) {\n      if (mode === activeMode.get()) {\n        return;\n      } else if (!has$2(availableModes, mode)) {\n        throw new Error('Editor mode \\'' + mode + '\\' is invalid');\n      }\n      if (editor.initialized) {\n        switchToMode(editor, activeMode, availableModes, mode);\n      } else {\n        editor.on('init', function () {\n          return switchToMode(editor, activeMode, availableModes, mode);\n        });\n      }\n    };\n    var registerMode = function (availableModes, mode, api) {\n      var _a;\n      if (contains$3(defaultModes, mode)) {\n        throw new Error('Cannot override default mode ' + mode);\n      }\n      return __assign(__assign({}, availableModes), (_a = {}, _a[mode] = __assign(__assign({}, api), {\n        deactivate: function () {\n          try {\n            api.deactivate();\n          } catch (e) {\n            console.error('problem while deactivating editor mode ' + mode + ':', e);\n          }\n        }\n      }), _a));\n    };\n\n    var create$4 = function (editor) {\n      var activeMode = Cell('design');\n      var availableModes = Cell({\n        design: {\n          activate: noop,\n          deactivate: noop,\n          editorReadOnly: false\n        },\n        readonly: {\n          activate: noop,\n          deactivate: noop,\n          editorReadOnly: true\n        }\n      });\n      registerReadOnlyContentFilters(editor);\n      registerReadOnlySelectionBlockers(editor);\n      return {\n        isReadOnly: function () {\n          return isReadOnly(editor);\n        },\n        set: function (mode) {\n          return setMode(editor, availableModes.get(), activeMode, mode);\n        },\n        get: function () {\n          return activeMode.get();\n        },\n        register: function (mode, api) {\n          availableModes.set(registerMode(availableModes.get(), mode, api));\n        }\n      };\n    };\n\n    var each$3 = Tools.each, explode$1 = Tools.explode;\n    var keyCodeLookup = {\n      f1: 112,\n      f2: 113,\n      f3: 114,\n      f4: 115,\n      f5: 116,\n      f6: 117,\n      f7: 118,\n      f8: 119,\n      f9: 120,\n      f10: 121,\n      f11: 122,\n      f12: 123\n    };\n    var modifierNames = Tools.makeMap('alt,ctrl,shift,meta,access');\n    var parseShortcut = function (pattern) {\n      var key;\n      var shortcut = {};\n      each$3(explode$1(pattern.toLowerCase(), '+'), function (value) {\n        if (value in modifierNames) {\n          shortcut[value] = true;\n        } else {\n          if (/^[0-9]{2,}$/.test(value)) {\n            shortcut.keyCode = parseInt(value, 10);\n          } else {\n            shortcut.charCode = value.charCodeAt(0);\n            shortcut.keyCode = keyCodeLookup[value] || value.toUpperCase().charCodeAt(0);\n          }\n        }\n      });\n      var id = [shortcut.keyCode];\n      for (key in modifierNames) {\n        if (shortcut[key]) {\n          id.push(key);\n        } else {\n          shortcut[key] = false;\n        }\n      }\n      shortcut.id = id.join(',');\n      if (shortcut.access) {\n        shortcut.alt = true;\n        if (Env.mac) {\n          shortcut.ctrl = true;\n        } else {\n          shortcut.shift = true;\n        }\n      }\n      if (shortcut.meta) {\n        if (Env.mac) {\n          shortcut.meta = true;\n        } else {\n          shortcut.ctrl = true;\n          shortcut.meta = false;\n        }\n      }\n      return shortcut;\n    };\n    var Shortcuts = function () {\n      function Shortcuts(editor) {\n        this.shortcuts = {};\n        this.pendingPatterns = [];\n        this.editor = editor;\n        var self = this;\n        editor.on('keyup keypress keydown', function (e) {\n          if ((self.hasModifier(e) || self.isFunctionKey(e)) && !e.isDefaultPrevented()) {\n            each$3(self.shortcuts, function (shortcut) {\n              if (self.matchShortcut(e, shortcut)) {\n                self.pendingPatterns = shortcut.subpatterns.slice(0);\n                if (e.type === 'keydown') {\n                  self.executeShortcutAction(shortcut);\n                }\n                return true;\n              }\n            });\n            if (self.matchShortcut(e, self.pendingPatterns[0])) {\n              if (self.pendingPatterns.length === 1) {\n                if (e.type === 'keydown') {\n                  self.executeShortcutAction(self.pendingPatterns[0]);\n                }\n              }\n              self.pendingPatterns.shift();\n            }\n          }\n        });\n      }\n      Shortcuts.prototype.add = function (pattern, desc, cmdFunc, scope) {\n        var self = this;\n        var func = self.normalizeCommandFunc(cmdFunc);\n        each$3(explode$1(Tools.trim(pattern)), function (pattern) {\n          var shortcut = self.createShortcut(pattern, desc, func, scope);\n          self.shortcuts[shortcut.id] = shortcut;\n        });\n        return true;\n      };\n      Shortcuts.prototype.remove = function (pattern) {\n        var shortcut = this.createShortcut(pattern);\n        if (this.shortcuts[shortcut.id]) {\n          delete this.shortcuts[shortcut.id];\n          return true;\n        }\n        return false;\n      };\n      Shortcuts.prototype.normalizeCommandFunc = function (cmdFunc) {\n        var self = this;\n        var cmd = cmdFunc;\n        if (typeof cmd === 'string') {\n          return function () {\n            self.editor.execCommand(cmd, false, null);\n          };\n        } else if (Tools.isArray(cmd)) {\n          return function () {\n            self.editor.execCommand(cmd[0], cmd[1], cmd[2]);\n          };\n        } else {\n          return cmd;\n        }\n      };\n      Shortcuts.prototype.createShortcut = function (pattern, desc, cmdFunc, scope) {\n        var shortcuts = Tools.map(explode$1(pattern, '>'), parseShortcut);\n        shortcuts[shortcuts.length - 1] = Tools.extend(shortcuts[shortcuts.length - 1], {\n          func: cmdFunc,\n          scope: scope || this.editor\n        });\n        return Tools.extend(shortcuts[0], {\n          desc: this.editor.translate(desc),\n          subpatterns: shortcuts.slice(1)\n        });\n      };\n      Shortcuts.prototype.hasModifier = function (e) {\n        return e.altKey || e.ctrlKey || e.metaKey;\n      };\n      Shortcuts.prototype.isFunctionKey = function (e) {\n        return e.type === 'keydown' && e.keyCode >= 112 && e.keyCode <= 123;\n      };\n      Shortcuts.prototype.matchShortcut = function (e, shortcut) {\n        if (!shortcut) {\n          return false;\n        }\n        if (shortcut.ctrl !== e.ctrlKey || shortcut.meta !== e.metaKey) {\n          return false;\n        }\n        if (shortcut.alt !== e.altKey || shortcut.shift !== e.shiftKey) {\n          return false;\n        }\n        if (e.keyCode === shortcut.keyCode || e.charCode && e.charCode === shortcut.charCode) {\n          e.preventDefault();\n          return true;\n        }\n        return false;\n      };\n      Shortcuts.prototype.executeShortcutAction = function (shortcut) {\n        return shortcut.func ? shortcut.func.call(shortcut.scope) : null;\n      };\n      return Shortcuts;\n    }();\n\n    var create$3 = function () {\n      var buttons = {};\n      var menuItems = {};\n      var popups = {};\n      var icons = {};\n      var contextMenus = {};\n      var contextToolbars = {};\n      var sidebars = {};\n      var add = function (collection, type) {\n        return function (name, spec) {\n          return collection[name.toLowerCase()] = __assign(__assign({}, spec), { type: type });\n        };\n      };\n      var addIcon = function (name, svgData) {\n        return icons[name.toLowerCase()] = svgData;\n      };\n      return {\n        addButton: add(buttons, 'button'),\n        addGroupToolbarButton: add(buttons, 'grouptoolbarbutton'),\n        addToggleButton: add(buttons, 'togglebutton'),\n        addMenuButton: add(buttons, 'menubutton'),\n        addSplitButton: add(buttons, 'splitbutton'),\n        addMenuItem: add(menuItems, 'menuitem'),\n        addNestedMenuItem: add(menuItems, 'nestedmenuitem'),\n        addToggleMenuItem: add(menuItems, 'togglemenuitem'),\n        addAutocompleter: add(popups, 'autocompleter'),\n        addContextMenu: add(contextMenus, 'contextmenu'),\n        addContextToolbar: add(contextToolbars, 'contexttoolbar'),\n        addContextForm: add(contextToolbars, 'contextform'),\n        addSidebar: add(sidebars, 'sidebar'),\n        addIcon: addIcon,\n        getAll: function () {\n          return {\n            buttons: buttons,\n            menuItems: menuItems,\n            icons: icons,\n            popups: popups,\n            contextMenus: contextMenus,\n            contextToolbars: contextToolbars,\n            sidebars: sidebars\n          };\n        }\n      };\n    };\n\n    var registry = function () {\n      var bridge = create$3();\n      return {\n        addAutocompleter: bridge.addAutocompleter,\n        addButton: bridge.addButton,\n        addContextForm: bridge.addContextForm,\n        addContextMenu: bridge.addContextMenu,\n        addContextToolbar: bridge.addContextToolbar,\n        addIcon: bridge.addIcon,\n        addMenuButton: bridge.addMenuButton,\n        addMenuItem: bridge.addMenuItem,\n        addNestedMenuItem: bridge.addNestedMenuItem,\n        addSidebar: bridge.addSidebar,\n        addSplitButton: bridge.addSplitButton,\n        addToggleButton: bridge.addToggleButton,\n        addGroupToolbarButton: bridge.addGroupToolbarButton,\n        addToggleMenuItem: bridge.addToggleMenuItem,\n        getAll: bridge.getAll\n      };\n    };\n\n    var DOM$1 = DOMUtils.DOM;\n    var extend$3 = Tools.extend, each$2 = Tools.each;\n    var resolve = Tools.resolve;\n    var ie = Env.ie;\n    var Editor = function () {\n      function Editor(id, settings, editorManager) {\n        var _this = this;\n        this.plugins = {};\n        this.contentCSS = [];\n        this.contentStyles = [];\n        this.loadedCSS = {};\n        this.isNotDirty = false;\n        this.editorManager = editorManager;\n        this.documentBaseUrl = editorManager.documentBaseURL;\n        extend$3(this, EditorObservable);\n        this.settings = getEditorSettings(this, id, this.documentBaseUrl, editorManager.defaultSettings, settings);\n        if (this.settings.suffix) {\n          editorManager.suffix = this.settings.suffix;\n        }\n        this.suffix = editorManager.suffix;\n        if (this.settings.base_url) {\n          editorManager._setBaseUrl(this.settings.base_url);\n        }\n        this.baseUri = editorManager.baseURI;\n        if (this.settings.referrer_policy) {\n          ScriptLoader.ScriptLoader._setReferrerPolicy(this.settings.referrer_policy);\n          DOMUtils.DOM.styleSheetLoader._setReferrerPolicy(this.settings.referrer_policy);\n        }\n        AddOnManager.languageLoad = this.settings.language_load;\n        AddOnManager.baseURL = editorManager.baseURL;\n        this.id = id;\n        this.setDirty(false);\n        this.documentBaseURI = new URI(this.settings.document_base_url, { base_uri: this.baseUri });\n        this.baseURI = this.baseUri;\n        this.inline = !!this.settings.inline;\n        this.shortcuts = new Shortcuts(this);\n        this.editorCommands = new EditorCommands(this);\n        if (this.settings.cache_suffix) {\n          Env.cacheSuffix = this.settings.cache_suffix.replace(/^[\\?\\&]+/, '');\n        }\n        this.ui = {\n          registry: registry(),\n          styleSheetLoader: undefined,\n          show: noop,\n          hide: noop,\n          enable: noop,\n          disable: noop,\n          isDisabled: never\n        };\n        var self = this;\n        var modeInstance = create$4(self);\n        this.mode = modeInstance;\n        this.setMode = modeInstance.set;\n        editorManager.fire('SetupEditor', { editor: this });\n        this.execCallback('setup', this);\n        this.$ = DomQuery.overrideDefaults(function () {\n          return {\n            context: _this.inline ? _this.getBody() : _this.getDoc(),\n            element: _this.getBody()\n          };\n        });\n      }\n      Editor.prototype.render = function () {\n        render(this);\n      };\n      Editor.prototype.focus = function (skipFocus) {\n        this.execCommand('mceFocus', false, skipFocus);\n      };\n      Editor.prototype.hasFocus = function () {\n        return hasFocus(this);\n      };\n      Editor.prototype.execCallback = function (name) {\n        var x = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n          x[_i - 1] = arguments[_i];\n        }\n        var self = this;\n        var callback = self.settings[name], scope;\n        if (!callback) {\n          return;\n        }\n        if (self.callbackLookup && (scope = self.callbackLookup[name])) {\n          callback = scope.func;\n          scope = scope.scope;\n        }\n        if (typeof callback === 'string') {\n          scope = callback.replace(/\\.\\w+$/, '');\n          scope = scope ? resolve(scope) : 0;\n          callback = resolve(callback);\n          self.callbackLookup = self.callbackLookup || {};\n          self.callbackLookup[name] = {\n            func: callback,\n            scope: scope\n          };\n        }\n        return callback.apply(scope || self, x);\n      };\n      Editor.prototype.translate = function (text) {\n        return I18n.translate(text);\n      };\n      Editor.prototype.getParam = function (name, defaultVal, type) {\n        return getParam(this, name, defaultVal, type);\n      };\n      Editor.prototype.hasPlugin = function (name, loaded) {\n        var hasPlugin = contains$3(getPlugins(this).split(/[ ,]/), name);\n        if (hasPlugin) {\n          return loaded ? PluginManager.get(name) !== undefined : true;\n        } else {\n          return false;\n        }\n      };\n      Editor.prototype.nodeChanged = function (args) {\n        this._nodeChangeDispatcher.nodeChanged(args);\n      };\n      Editor.prototype.addCommand = function (name, callback, scope) {\n        this.editorCommands.addCommand(name, callback, scope);\n      };\n      Editor.prototype.addQueryStateHandler = function (name, callback, scope) {\n        this.editorCommands.addQueryStateHandler(name, callback, scope);\n      };\n      Editor.prototype.addQueryValueHandler = function (name, callback, scope) {\n        this.editorCommands.addQueryValueHandler(name, callback, scope);\n      };\n      Editor.prototype.addShortcut = function (pattern, desc, cmdFunc, scope) {\n        this.shortcuts.add(pattern, desc, cmdFunc, scope);\n      };\n      Editor.prototype.execCommand = function (cmd, ui, value, args) {\n        return this.editorCommands.execCommand(cmd, ui, value, args);\n      };\n      Editor.prototype.queryCommandState = function (cmd) {\n        return this.editorCommands.queryCommandState(cmd);\n      };\n      Editor.prototype.queryCommandValue = function (cmd) {\n        return this.editorCommands.queryCommandValue(cmd);\n      };\n      Editor.prototype.queryCommandSupported = function (cmd) {\n        return this.editorCommands.queryCommandSupported(cmd);\n      };\n      Editor.prototype.show = function () {\n        var self = this;\n        if (self.hidden) {\n          self.hidden = false;\n          if (self.inline) {\n            self.getBody().contentEditable = 'true';\n          } else {\n            DOM$1.show(self.getContainer());\n            DOM$1.hide(self.id);\n          }\n          self.load();\n          self.fire('show');\n        }\n      };\n      Editor.prototype.hide = function () {\n        var self = this, doc = self.getDoc();\n        if (!self.hidden) {\n          if (ie && doc && !self.inline) {\n            doc.execCommand('SelectAll');\n          }\n          self.save();\n          if (self.inline) {\n            self.getBody().contentEditable = 'false';\n            if (self === self.editorManager.focusedEditor) {\n              self.editorManager.focusedEditor = null;\n            }\n          } else {\n            DOM$1.hide(self.getContainer());\n            DOM$1.setStyle(self.id, 'display', self.orgDisplay);\n          }\n          self.hidden = true;\n          self.fire('hide');\n        }\n      };\n      Editor.prototype.isHidden = function () {\n        return !!this.hidden;\n      };\n      Editor.prototype.setProgressState = function (state, time) {\n        this.fire('ProgressState', {\n          state: state,\n          time: time\n        });\n      };\n      Editor.prototype.load = function (args) {\n        var self = this;\n        var elm = self.getElement(), html;\n        if (self.removed) {\n          return '';\n        }\n        if (elm) {\n          args = args || {};\n          args.load = true;\n          var value = isTextareaOrInput(elm) ? elm.value : elm.innerHTML;\n          html = self.setContent(value, args);\n          args.element = elm;\n          if (!args.no_events) {\n            self.fire('LoadContent', args);\n          }\n          args.element = elm = null;\n          return html;\n        }\n      };\n      Editor.prototype.save = function (args) {\n        var self = this;\n        var elm = self.getElement(), html, form;\n        if (!elm || !self.initialized || self.removed) {\n          return;\n        }\n        args = args || {};\n        args.save = true;\n        args.element = elm;\n        html = args.content = self.getContent(args);\n        if (!args.no_events) {\n          self.fire('SaveContent', args);\n        }\n        if (args.format === 'raw') {\n          self.fire('RawSaveContent', args);\n        }\n        html = args.content;\n        if (!isTextareaOrInput(elm)) {\n          if (args.is_removing || !self.inline) {\n            elm.innerHTML = html;\n          }\n          if (form = DOM$1.getParent(self.id, 'form')) {\n            each$2(form.elements, function (elm) {\n              if (elm.name === self.id) {\n                elm.value = html;\n                return false;\n              }\n            });\n          }\n        } else {\n          elm.value = html;\n        }\n        args.element = elm = null;\n        if (args.set_dirty !== false) {\n          self.setDirty(false);\n        }\n        return html;\n      };\n      Editor.prototype.setContent = function (content, args) {\n        return setContent(this, content, args);\n      };\n      Editor.prototype.getContent = function (args) {\n        return getContent(this, args);\n      };\n      Editor.prototype.insertContent = function (content, args) {\n        if (args) {\n          content = extend$3({ content: content }, args);\n        }\n        this.execCommand('mceInsertContent', false, content);\n      };\n      Editor.prototype.resetContent = function (initialContent) {\n        if (initialContent === undefined) {\n          setContent(this, this.startContent, { format: 'raw' });\n        } else {\n          setContent(this, initialContent);\n        }\n        this.undoManager.reset();\n        this.setDirty(false);\n        this.nodeChanged();\n      };\n      Editor.prototype.isDirty = function () {\n        return !this.isNotDirty;\n      };\n      Editor.prototype.setDirty = function (state) {\n        var oldState = !this.isNotDirty;\n        this.isNotDirty = !state;\n        if (state && state !== oldState) {\n          this.fire('dirty');\n        }\n      };\n      Editor.prototype.getContainer = function () {\n        var self = this;\n        if (!self.container) {\n          self.container = DOM$1.get(self.editorContainer || self.id + '_parent');\n        }\n        return self.container;\n      };\n      Editor.prototype.getContentAreaContainer = function () {\n        return this.contentAreaContainer;\n      };\n      Editor.prototype.getElement = function () {\n        if (!this.targetElm) {\n          this.targetElm = DOM$1.get(this.id);\n        }\n        return this.targetElm;\n      };\n      Editor.prototype.getWin = function () {\n        var self = this;\n        var elm;\n        if (!self.contentWindow) {\n          elm = self.iframeElement;\n          if (elm) {\n            self.contentWindow = elm.contentWindow;\n          }\n        }\n        return self.contentWindow;\n      };\n      Editor.prototype.getDoc = function () {\n        var self = this;\n        var win;\n        if (!self.contentDocument) {\n          win = self.getWin();\n          if (win) {\n            self.contentDocument = win.document;\n          }\n        }\n        return self.contentDocument;\n      };\n      Editor.prototype.getBody = function () {\n        var doc = this.getDoc();\n        return this.bodyElement || (doc ? doc.body : null);\n      };\n      Editor.prototype.convertURL = function (url, name, elm) {\n        var self = this, settings = self.settings;\n        if (settings.urlconverter_callback) {\n          return self.execCallback('urlconverter_callback', url, elm, true, name);\n        }\n        if (!settings.convert_urls || elm && elm.nodeName === 'LINK' || url.indexOf('file:') === 0 || url.length === 0) {\n          return url;\n        }\n        if (settings.relative_urls) {\n          return self.documentBaseURI.toRelative(url);\n        }\n        url = self.documentBaseURI.toAbsolute(url, settings.remove_script_host);\n        return url;\n      };\n      Editor.prototype.addVisual = function (elm) {\n        addVisual(this, elm);\n      };\n      Editor.prototype.remove = function () {\n        remove(this);\n      };\n      Editor.prototype.destroy = function (automatic) {\n        destroy(this, automatic);\n      };\n      Editor.prototype.uploadImages = function (callback) {\n        return this.editorUpload.uploadImages(callback);\n      };\n      Editor.prototype._scanForImages = function () {\n        return this.editorUpload.scanForImages();\n      };\n      Editor.prototype.addButton = function () {\n        throw new Error('editor.addButton has been removed in tinymce 5x, use editor.ui.registry.addButton or editor.ui.registry.addToggleButton or editor.ui.registry.addSplitButton instead');\n      };\n      Editor.prototype.addSidebar = function () {\n        throw new Error('editor.addSidebar has been removed in tinymce 5x, use editor.ui.registry.addSidebar instead');\n      };\n      Editor.prototype.addMenuItem = function () {\n        throw new Error('editor.addMenuItem has been removed in tinymce 5x, use editor.ui.registry.addMenuItem instead');\n      };\n      Editor.prototype.addContextToolbar = function () {\n        throw new Error('editor.addContextToolbar has been removed in tinymce 5x, use editor.ui.registry.addContextToolbar instead');\n      };\n      return Editor;\n    }();\n\n    var DOM = DOMUtils.DOM;\n    var explode = Tools.explode, each$1 = Tools.each, extend$2 = Tools.extend;\n    var instanceCounter = 0, boundGlobalEvents = false;\n    var beforeUnloadDelegate;\n    var legacyEditors = [];\n    var editors = [];\n    var isValidLegacyKey = function (id) {\n      return id !== 'length';\n    };\n    var globalEventDelegate = function (e) {\n      var type = e.type;\n      each$1(EditorManager.get(), function (editor) {\n        switch (type) {\n        case 'scroll':\n          editor.fire('ScrollWindow', e);\n          break;\n        case 'resize':\n          editor.fire('ResizeWindow', e);\n          break;\n        }\n      });\n    };\n    var toggleGlobalEvents = function (state) {\n      if (state !== boundGlobalEvents) {\n        if (state) {\n          DomQuery(window).on('resize scroll', globalEventDelegate);\n        } else {\n          DomQuery(window).off('resize scroll', globalEventDelegate);\n        }\n        boundGlobalEvents = state;\n      }\n    };\n    var removeEditorFromList = function (targetEditor) {\n      var oldEditors = editors;\n      delete legacyEditors[targetEditor.id];\n      for (var i = 0; i < legacyEditors.length; i++) {\n        if (legacyEditors[i] === targetEditor) {\n          legacyEditors.splice(i, 1);\n          break;\n        }\n      }\n      editors = filter$4(editors, function (editor) {\n        return targetEditor !== editor;\n      });\n      if (EditorManager.activeEditor === targetEditor) {\n        EditorManager.activeEditor = editors.length > 0 ? editors[0] : null;\n      }\n      if (EditorManager.focusedEditor === targetEditor) {\n        EditorManager.focusedEditor = null;\n      }\n      return oldEditors.length !== editors.length;\n    };\n    var purgeDestroyedEditor = function (editor) {\n      if (editor && editor.initialized && !(editor.getContainer() || editor.getBody()).parentNode) {\n        removeEditorFromList(editor);\n        editor.unbindAllNativeEvents();\n        editor.destroy(true);\n        editor.removed = true;\n        editor = null;\n      }\n      return editor;\n    };\n    var isQuirksMode = document.compatMode !== 'CSS1Compat';\n    var EditorManager = __assign(__assign({}, Observable), {\n      baseURI: null,\n      baseURL: null,\n      defaultSettings: {},\n      documentBaseURL: null,\n      suffix: null,\n      $: DomQuery,\n      majorVersion: '5',\n      minorVersion: '10.9',\n      releaseDate: '2023-11-15',\n      editors: legacyEditors,\n      i18n: I18n,\n      activeEditor: null,\n      focusedEditor: null,\n      settings: {},\n      setup: function () {\n        var self = this;\n        var baseURL, documentBaseURL, suffix = '';\n        documentBaseURL = URI.getDocumentBaseUrl(document.location);\n        if (/^[^:]+:\\/\\/\\/?[^\\/]+\\//.test(documentBaseURL)) {\n          documentBaseURL = documentBaseURL.replace(/[\\?#].*$/, '').replace(/[\\/\\\\][^\\/]+$/, '');\n          if (!/[\\/\\\\]$/.test(documentBaseURL)) {\n            documentBaseURL += '/';\n          }\n        }\n        var preInit = window.tinymce || window.tinyMCEPreInit;\n        if (preInit) {\n          baseURL = preInit.base || preInit.baseURL;\n          suffix = preInit.suffix;\n        } else {\n          var scripts = document.getElementsByTagName('script');\n          for (var i = 0; i < scripts.length; i++) {\n            var src = scripts[i].src || '';\n            if (src === '') {\n              continue;\n            }\n            var srcScript = src.substring(src.lastIndexOf('/'));\n            if (/tinymce(\\.full|\\.jquery|)(\\.min|\\.dev|)\\.js/.test(src)) {\n              if (srcScript.indexOf('.min') !== -1) {\n                suffix = '.min';\n              }\n              baseURL = src.substring(0, src.lastIndexOf('/'));\n              break;\n            }\n          }\n          if (!baseURL && document.currentScript) {\n            var src = document.currentScript.src;\n            if (src.indexOf('.min') !== -1) {\n              suffix = '.min';\n            }\n            baseURL = src.substring(0, src.lastIndexOf('/'));\n          }\n        }\n        self.baseURL = new URI(documentBaseURL).toAbsolute(baseURL);\n        self.documentBaseURL = documentBaseURL;\n        self.baseURI = new URI(self.baseURL);\n        self.suffix = suffix;\n        setup$l(self);\n      },\n      overrideDefaults: function (defaultSettings) {\n        var baseUrl = defaultSettings.base_url;\n        if (baseUrl) {\n          this._setBaseUrl(baseUrl);\n        }\n        var suffix = defaultSettings.suffix;\n        if (defaultSettings.suffix) {\n          this.suffix = suffix;\n        }\n        this.defaultSettings = defaultSettings;\n        var pluginBaseUrls = defaultSettings.plugin_base_urls;\n        if (pluginBaseUrls !== undefined) {\n          each$j(pluginBaseUrls, function (pluginBaseUrl, pluginName) {\n            AddOnManager.PluginManager.urls[pluginName] = pluginBaseUrl;\n          });\n        }\n      },\n      init: function (settings) {\n        var self = this;\n        var result;\n        var invalidInlineTargets = Tools.makeMap('area base basefont br col frame hr img input isindex link meta param embed source wbr track ' + 'colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu', ' ');\n        var isInvalidInlineTarget = function (settings, elm) {\n          return settings.inline && elm.tagName.toLowerCase() in invalidInlineTargets;\n        };\n        var createId = function (elm) {\n          var id = elm.id;\n          if (!id) {\n            id = get$9(elm, 'name').filter(function (name) {\n              return !DOM.get(name);\n            }).getOrThunk(DOM.uniqueId);\n            elm.setAttribute('id', id);\n          }\n          return id;\n        };\n        var execCallback = function (name) {\n          var callback = settings[name];\n          if (!callback) {\n            return;\n          }\n          return callback.apply(self, []);\n        };\n        var hasClass = function (elm, className) {\n          return className.constructor === RegExp ? className.test(elm.className) : DOM.hasClass(elm, className);\n        };\n        var findTargets = function (settings) {\n          var targets = [];\n          if (Env.browser.isIE() && Env.browser.version.major < 11) {\n            initError('TinyMCE does not support the browser you are using. For a list of supported' + ' browsers please see: https://www.tinymce.com/docs/get-started/system-requirements/');\n            return [];\n          } else if (isQuirksMode) {\n            initError('Failed to initialize the editor as the document is not in standards mode. ' + 'TinyMCE requires standards mode.');\n            return [];\n          }\n          if (settings.types) {\n            each$1(settings.types, function (type) {\n              targets = targets.concat(DOM.select(type.selector));\n            });\n            return targets;\n          } else if (settings.selector) {\n            return DOM.select(settings.selector);\n          } else if (settings.target) {\n            return [settings.target];\n          }\n          switch (settings.mode) {\n          case 'exact':\n            var l = settings.elements || '';\n            if (l.length > 0) {\n              each$1(explode(l), function (id) {\n                var elm = DOM.get(id);\n                if (elm) {\n                  targets.push(elm);\n                } else {\n                  each$1(document.forms, function (f) {\n                    each$1(f.elements, function (e) {\n                      if (e.name === id) {\n                        id = 'mce_editor_' + instanceCounter++;\n                        DOM.setAttrib(e, 'id', id);\n                        targets.push(e);\n                      }\n                    });\n                  });\n                }\n              });\n            }\n            break;\n          case 'textareas':\n          case 'specific_textareas':\n            each$1(DOM.select('textarea'), function (elm) {\n              if (settings.editor_deselector && hasClass(elm, settings.editor_deselector)) {\n                return;\n              }\n              if (!settings.editor_selector || hasClass(elm, settings.editor_selector)) {\n                targets.push(elm);\n              }\n            });\n            break;\n          }\n          return targets;\n        };\n        var provideResults = function (editors) {\n          result = editors;\n        };\n        var initEditors = function () {\n          var initCount = 0;\n          var editors = [];\n          var targets;\n          var createEditor = function (id, settings, targetElm) {\n            var editor = new Editor(id, settings, self);\n            editors.push(editor);\n            editor.on('init', function () {\n              if (++initCount === targets.length) {\n                provideResults(editors);\n              }\n            });\n            editor.targetElm = editor.targetElm || targetElm;\n            editor.render();\n          };\n          DOM.unbind(window, 'ready', initEditors);\n          execCallback('onpageload');\n          targets = DomQuery.unique(findTargets(settings));\n          if (settings.types) {\n            each$1(settings.types, function (type) {\n              Tools.each(targets, function (elm) {\n                if (DOM.is(elm, type.selector)) {\n                  createEditor(createId(elm), extend$2({}, settings, type), elm);\n                  return false;\n                }\n                return true;\n              });\n            });\n            return;\n          }\n          Tools.each(targets, function (elm) {\n            purgeDestroyedEditor(self.get(elm.id));\n          });\n          targets = Tools.grep(targets, function (elm) {\n            return !self.get(elm.id);\n          });\n          if (targets.length === 0) {\n            provideResults([]);\n          } else {\n            each$1(targets, function (elm) {\n              if (isInvalidInlineTarget(settings, elm)) {\n                initError('Could not initialize inline editor on invalid inline target element', elm);\n              } else {\n                createEditor(createId(elm), settings, elm);\n              }\n            });\n          }\n        };\n        self.settings = settings;\n        DOM.bind(window, 'ready', initEditors);\n        return new promiseObj(function (resolve) {\n          if (result) {\n            resolve(result);\n          } else {\n            provideResults = function (editors) {\n              resolve(editors);\n            };\n          }\n        });\n      },\n      get: function (id) {\n        if (arguments.length === 0) {\n          return editors.slice(0);\n        } else if (isString$1(id)) {\n          return find$3(editors, function (editor) {\n            return editor.id === id;\n          }).getOr(null);\n        } else if (isNumber(id)) {\n          return editors[id] ? editors[id] : null;\n        } else {\n          return null;\n        }\n      },\n      add: function (editor) {\n        var self = this;\n        var existingEditor = legacyEditors[editor.id];\n        if (existingEditor === editor) {\n          return editor;\n        }\n        if (self.get(editor.id) === null) {\n          if (isValidLegacyKey(editor.id)) {\n            legacyEditors[editor.id] = editor;\n          }\n          legacyEditors.push(editor);\n          editors.push(editor);\n        }\n        toggleGlobalEvents(true);\n        self.activeEditor = editor;\n        self.fire('AddEditor', { editor: editor });\n        if (!beforeUnloadDelegate) {\n          beforeUnloadDelegate = function (e) {\n            var event = self.fire('BeforeUnload');\n            if (event.returnValue) {\n              e.preventDefault();\n              e.returnValue = event.returnValue;\n              return event.returnValue;\n            }\n          };\n          window.addEventListener('beforeunload', beforeUnloadDelegate);\n        }\n        return editor;\n      },\n      createEditor: function (id, settings) {\n        return this.add(new Editor(id, settings, this));\n      },\n      remove: function (selector) {\n        var self = this;\n        var i, editor;\n        if (!selector) {\n          for (i = editors.length - 1; i >= 0; i--) {\n            self.remove(editors[i]);\n          }\n          return;\n        }\n        if (isString$1(selector)) {\n          each$1(DOM.select(selector), function (elm) {\n            editor = self.get(elm.id);\n            if (editor) {\n              self.remove(editor);\n            }\n          });\n          return;\n        }\n        editor = selector;\n        if (isNull(self.get(editor.id))) {\n          return null;\n        }\n        if (removeEditorFromList(editor)) {\n          self.fire('RemoveEditor', { editor: editor });\n        }\n        if (editors.length === 0) {\n          window.removeEventListener('beforeunload', beforeUnloadDelegate);\n        }\n        editor.remove();\n        toggleGlobalEvents(editors.length > 0);\n        return editor;\n      },\n      execCommand: function (cmd, ui, value) {\n        var self = this, editor = self.get(value);\n        switch (cmd) {\n        case 'mceAddEditor':\n          if (!self.get(value)) {\n            new Editor(value, self.settings, self).render();\n          }\n          return true;\n        case 'mceRemoveEditor':\n          if (editor) {\n            editor.remove();\n          }\n          return true;\n        case 'mceToggleEditor':\n          if (!editor) {\n            self.execCommand('mceAddEditor', false, value);\n            return true;\n          }\n          if (editor.isHidden()) {\n            editor.show();\n          } else {\n            editor.hide();\n          }\n          return true;\n        }\n        if (self.activeEditor) {\n          return self.activeEditor.execCommand(cmd, ui, value);\n        }\n        return false;\n      },\n      triggerSave: function () {\n        each$1(editors, function (editor) {\n          editor.save();\n        });\n      },\n      addI18n: function (code, items) {\n        I18n.add(code, items);\n      },\n      translate: function (text) {\n        return I18n.translate(text);\n      },\n      setActive: function (editor) {\n        var activeEditor = this.activeEditor;\n        if (this.activeEditor !== editor) {\n          if (activeEditor) {\n            activeEditor.fire('deactivate', { relatedTarget: editor });\n          }\n          editor.fire('activate', { relatedTarget: activeEditor });\n        }\n        this.activeEditor = editor;\n      },\n      _setBaseUrl: function (baseUrl) {\n        this.baseURL = new URI(this.documentBaseURL).toAbsolute(baseUrl.replace(/\\/+$/, ''));\n        this.baseURI = new URI(this.baseURL);\n      }\n    });\n    EditorManager.setup();\n\n    var min$1 = Math.min, max$1 = Math.max, round$1 = Math.round;\n    var relativePosition = function (rect, targetRect, rel) {\n      var x = targetRect.x;\n      var y = targetRect.y;\n      var w = rect.w;\n      var h = rect.h;\n      var targetW = targetRect.w;\n      var targetH = targetRect.h;\n      var relChars = (rel || '').split('');\n      if (relChars[0] === 'b') {\n        y += targetH;\n      }\n      if (relChars[1] === 'r') {\n        x += targetW;\n      }\n      if (relChars[0] === 'c') {\n        y += round$1(targetH / 2);\n      }\n      if (relChars[1] === 'c') {\n        x += round$1(targetW / 2);\n      }\n      if (relChars[3] === 'b') {\n        y -= h;\n      }\n      if (relChars[4] === 'r') {\n        x -= w;\n      }\n      if (relChars[3] === 'c') {\n        y -= round$1(h / 2);\n      }\n      if (relChars[4] === 'c') {\n        x -= round$1(w / 2);\n      }\n      return create$2(x, y, w, h);\n    };\n    var findBestRelativePosition = function (rect, targetRect, constrainRect, rels) {\n      var pos, i;\n      for (i = 0; i < rels.length; i++) {\n        pos = relativePosition(rect, targetRect, rels[i]);\n        if (pos.x >= constrainRect.x && pos.x + pos.w <= constrainRect.w + constrainRect.x && pos.y >= constrainRect.y && pos.y + pos.h <= constrainRect.h + constrainRect.y) {\n          return rels[i];\n        }\n      }\n      return null;\n    };\n    var inflate = function (rect, w, h) {\n      return create$2(rect.x - w, rect.y - h, rect.w + w * 2, rect.h + h * 2);\n    };\n    var intersect = function (rect, cropRect) {\n      var x1 = max$1(rect.x, cropRect.x);\n      var y1 = max$1(rect.y, cropRect.y);\n      var x2 = min$1(rect.x + rect.w, cropRect.x + cropRect.w);\n      var y2 = min$1(rect.y + rect.h, cropRect.y + cropRect.h);\n      if (x2 - x1 < 0 || y2 - y1 < 0) {\n        return null;\n      }\n      return create$2(x1, y1, x2 - x1, y2 - y1);\n    };\n    var clamp = function (rect, clampRect, fixedSize) {\n      var x1 = rect.x;\n      var y1 = rect.y;\n      var x2 = rect.x + rect.w;\n      var y2 = rect.y + rect.h;\n      var cx2 = clampRect.x + clampRect.w;\n      var cy2 = clampRect.y + clampRect.h;\n      var underflowX1 = max$1(0, clampRect.x - x1);\n      var underflowY1 = max$1(0, clampRect.y - y1);\n      var overflowX2 = max$1(0, x2 - cx2);\n      var overflowY2 = max$1(0, y2 - cy2);\n      x1 += underflowX1;\n      y1 += underflowY1;\n      if (fixedSize) {\n        x2 += underflowX1;\n        y2 += underflowY1;\n        x1 -= overflowX2;\n        y1 -= overflowY2;\n      }\n      x2 -= overflowX2;\n      y2 -= overflowY2;\n      return create$2(x1, y1, x2 - x1, y2 - y1);\n    };\n    var create$2 = function (x, y, w, h) {\n      return {\n        x: x,\n        y: y,\n        w: w,\n        h: h\n      };\n    };\n    var fromClientRect = function (clientRect) {\n      return create$2(clientRect.left, clientRect.top, clientRect.width, clientRect.height);\n    };\n    var Rect = {\n      inflate: inflate,\n      relativePosition: relativePosition,\n      findBestRelativePosition: findBestRelativePosition,\n      intersect: intersect,\n      clamp: clamp,\n      create: create$2,\n      fromClientRect: fromClientRect\n    };\n\n    var awaiter = function (resolveCb, rejectCb, timeout) {\n      if (timeout === void 0) {\n        timeout = 1000;\n      }\n      var done = false;\n      var timer = null;\n      var complete = function (completer) {\n        return function () {\n          var args = [];\n          for (var _i = 0; _i < arguments.length; _i++) {\n            args[_i] = arguments[_i];\n          }\n          if (!done) {\n            done = true;\n            if (timer !== null) {\n              clearTimeout(timer);\n              timer = null;\n            }\n            completer.apply(null, args);\n          }\n        };\n      };\n      var resolve = complete(resolveCb);\n      var reject = complete(rejectCb);\n      var start = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (!done && timer === null) {\n          timer = setTimeout(function () {\n            return reject.apply(null, args);\n          }, timeout);\n        }\n      };\n      return {\n        start: start,\n        resolve: resolve,\n        reject: reject\n      };\n    };\n    var create$1 = function () {\n      var tasks = {};\n      var resultFns = {};\n      var load = function (id, url) {\n        var loadErrMsg = 'Script at URL \"' + url + '\" failed to load';\n        var runErrMsg = 'Script at URL \"' + url + '\" did not call `tinymce.Resource.add(\\'' + id + '\\', data)` within 1 second';\n        if (tasks[id] !== undefined) {\n          return tasks[id];\n        } else {\n          var task = new promiseObj(function (resolve, reject) {\n            var waiter = awaiter(resolve, reject);\n            resultFns[id] = waiter.resolve;\n            ScriptLoader.ScriptLoader.loadScript(url, function () {\n              return waiter.start(runErrMsg);\n            }, function () {\n              return waiter.reject(loadErrMsg);\n            });\n          });\n          tasks[id] = task;\n          return task;\n        }\n      };\n      var add = function (id, data) {\n        if (resultFns[id] !== undefined) {\n          resultFns[id](data);\n          delete resultFns[id];\n        }\n        tasks[id] = promiseObj.resolve(data);\n      };\n      return {\n        load: load,\n        add: add\n      };\n    };\n    var Resource = create$1();\n\n    var each = Tools.each, extend$1 = Tools.extend;\n    var extendClass, initializing;\n    var Class = function () {\n    };\n    Class.extend = extendClass = function (props) {\n      var self = this;\n      var _super = self.prototype;\n      var Class = function () {\n        var i, mixins, mixin;\n        var self = this;\n        if (!initializing) {\n          if (self.init) {\n            self.init.apply(self, arguments);\n          }\n          mixins = self.Mixins;\n          if (mixins) {\n            i = mixins.length;\n            while (i--) {\n              mixin = mixins[i];\n              if (mixin.init) {\n                mixin.init.apply(self, arguments);\n              }\n            }\n          }\n        }\n      };\n      var dummy = function () {\n        return this;\n      };\n      var createMethod = function (name, fn) {\n        return function () {\n          var self = this;\n          var tmp = self._super;\n          self._super = _super[name];\n          var ret = fn.apply(self, arguments);\n          self._super = tmp;\n          return ret;\n        };\n      };\n      initializing = true;\n      var prototype = new self();\n      initializing = false;\n      if (props.Mixins) {\n        each(props.Mixins, function (mixin) {\n          for (var name_1 in mixin) {\n            if (name_1 !== 'init') {\n              props[name_1] = mixin[name_1];\n            }\n          }\n        });\n        if (_super.Mixins) {\n          props.Mixins = _super.Mixins.concat(props.Mixins);\n        }\n      }\n      if (props.Methods) {\n        each(props.Methods.split(','), function (name) {\n          props[name] = dummy;\n        });\n      }\n      if (props.Properties) {\n        each(props.Properties.split(','), function (name) {\n          var fieldName = '_' + name;\n          props[name] = function (value) {\n            var self = this;\n            if (value !== undefined) {\n              self[fieldName] = value;\n              return self;\n            }\n            return self[fieldName];\n          };\n        });\n      }\n      if (props.Statics) {\n        each(props.Statics, function (func, name) {\n          Class[name] = func;\n        });\n      }\n      if (props.Defaults && _super.Defaults) {\n        props.Defaults = extend$1({}, _super.Defaults, props.Defaults);\n      }\n      each$j(props, function (member, name) {\n        if (typeof member === 'function' && _super[name]) {\n          prototype[name] = createMethod(name, member);\n        } else {\n          prototype[name] = member;\n        }\n      });\n      Class.prototype = prototype;\n      Class.constructor = Class;\n      Class.extend = extendClass;\n      return Class;\n    };\n\n    var min = Math.min, max = Math.max, round = Math.round;\n    var Color = function (value) {\n      var self = {};\n      var r = 0, g = 0, b = 0;\n      var rgb2hsv = function (r, g, b) {\n        var h, s, v;\n        h = 0;\n        s = 0;\n        v = 0;\n        r = r / 255;\n        g = g / 255;\n        b = b / 255;\n        var minRGB = min(r, min(g, b));\n        var maxRGB = max(r, max(g, b));\n        if (minRGB === maxRGB) {\n          v = minRGB;\n          return {\n            h: 0,\n            s: 0,\n            v: v * 100\n          };\n        }\n        var d = r === minRGB ? g - b : b === minRGB ? r - g : b - r;\n        h = r === minRGB ? 3 : b === minRGB ? 1 : 5;\n        h = 60 * (h - d / (maxRGB - minRGB));\n        s = (maxRGB - minRGB) / maxRGB;\n        v = maxRGB;\n        return {\n          h: round(h),\n          s: round(s * 100),\n          v: round(v * 100)\n        };\n      };\n      var hsvToRgb = function (hue, saturation, brightness) {\n        hue = (parseInt(hue, 10) || 0) % 360;\n        saturation = parseInt(saturation, 10) / 100;\n        brightness = parseInt(brightness, 10) / 100;\n        saturation = max(0, min(saturation, 1));\n        brightness = max(0, min(brightness, 1));\n        if (saturation === 0) {\n          r = g = b = round(255 * brightness);\n          return;\n        }\n        var side = hue / 60;\n        var chroma = brightness * saturation;\n        var x = chroma * (1 - Math.abs(side % 2 - 1));\n        var match = brightness - chroma;\n        switch (Math.floor(side)) {\n        case 0:\n          r = chroma;\n          g = x;\n          b = 0;\n          break;\n        case 1:\n          r = x;\n          g = chroma;\n          b = 0;\n          break;\n        case 2:\n          r = 0;\n          g = chroma;\n          b = x;\n          break;\n        case 3:\n          r = 0;\n          g = x;\n          b = chroma;\n          break;\n        case 4:\n          r = x;\n          g = 0;\n          b = chroma;\n          break;\n        case 5:\n          r = chroma;\n          g = 0;\n          b = x;\n          break;\n        default:\n          r = g = b = 0;\n        }\n        r = round(255 * (r + match));\n        g = round(255 * (g + match));\n        b = round(255 * (b + match));\n      };\n      var toHex = function () {\n        var hex = function (val) {\n          val = parseInt(val, 10).toString(16);\n          return val.length > 1 ? val : '0' + val;\n        };\n        return '#' + hex(r) + hex(g) + hex(b);\n      };\n      var toRgb = function () {\n        return {\n          r: r,\n          g: g,\n          b: b\n        };\n      };\n      var toHsv = function () {\n        return rgb2hsv(r, g, b);\n      };\n      var parse = function (value) {\n        var matches;\n        if (typeof value === 'object') {\n          if ('r' in value) {\n            r = value.r;\n            g = value.g;\n            b = value.b;\n          } else if ('v' in value) {\n            hsvToRgb(value.h, value.s, value.v);\n          }\n        } else {\n          if (matches = /rgb\\s*\\(\\s*([0-9]+)\\s*,\\s*([0-9]+)\\s*,\\s*([0-9]+)[^\\)]*\\)/gi.exec(value)) {\n            r = parseInt(matches[1], 10);\n            g = parseInt(matches[2], 10);\n            b = parseInt(matches[3], 10);\n          } else if (matches = /#([0-F]{2})([0-F]{2})([0-F]{2})/gi.exec(value)) {\n            r = parseInt(matches[1], 16);\n            g = parseInt(matches[2], 16);\n            b = parseInt(matches[3], 16);\n          } else if (matches = /#([0-F])([0-F])([0-F])/gi.exec(value)) {\n            r = parseInt(matches[1] + matches[1], 16);\n            g = parseInt(matches[2] + matches[2], 16);\n            b = parseInt(matches[3] + matches[3], 16);\n          }\n        }\n        r = r < 0 ? 0 : r > 255 ? 255 : r;\n        g = g < 0 ? 0 : g > 255 ? 255 : g;\n        b = b < 0 ? 0 : b > 255 ? 255 : b;\n        return self;\n      };\n      if (value) {\n        parse(value);\n      }\n      self.toRgb = toRgb;\n      self.toHsv = toHsv;\n      self.toHex = toHex;\n      self.parse = parse;\n      return self;\n    };\n\n    var serialize = function (obj) {\n      var data = JSON.stringify(obj);\n      if (!isString$1(data)) {\n        return data;\n      }\n      return data.replace(/[\\u0080-\\uFFFF]/g, function (match) {\n        var hexCode = match.charCodeAt(0).toString(16);\n        return '\\\\u' + '0000'.substring(hexCode.length) + hexCode;\n      });\n    };\n    var JSONUtils = {\n      serialize: serialize,\n      parse: function (text) {\n        try {\n          return JSON.parse(text);\n        } catch (ex) {\n        }\n      }\n    };\n\n    var JSONP = {\n      callbacks: {},\n      count: 0,\n      send: function (settings) {\n        var self = this, dom = DOMUtils.DOM, count = settings.count !== undefined ? settings.count : self.count;\n        var id = 'tinymce_jsonp_' + count;\n        self.callbacks[count] = function (json) {\n          dom.remove(id);\n          delete self.callbacks[count];\n          settings.callback(json);\n        };\n        dom.add(dom.doc.body, 'script', {\n          id: id,\n          src: settings.url,\n          type: 'text/javascript'\n        });\n        self.count++;\n      }\n    };\n\n    var XHR = __assign(__assign({}, Observable), {\n      send: function (settings) {\n        var xhr, count = 0;\n        var ready = function () {\n          if (!settings.async || xhr.readyState === 4 || count++ > 10000) {\n            if (settings.success && count < 10000 && xhr.status === 200) {\n              settings.success.call(settings.success_scope, '' + xhr.responseText, xhr, settings);\n            } else if (settings.error) {\n              settings.error.call(settings.error_scope, count > 10000 ? 'TIMED_OUT' : 'GENERAL', xhr, settings);\n            }\n            xhr = null;\n          } else {\n            Delay.setTimeout(ready, 10);\n          }\n        };\n        settings.scope = settings.scope || this;\n        settings.success_scope = settings.success_scope || settings.scope;\n        settings.error_scope = settings.error_scope || settings.scope;\n        settings.async = settings.async !== false;\n        settings.data = settings.data || '';\n        XHR.fire('beforeInitialize', { settings: settings });\n        xhr = new XMLHttpRequest();\n        if (xhr.overrideMimeType) {\n          xhr.overrideMimeType(settings.content_type);\n        }\n        xhr.open(settings.type || (settings.data ? 'POST' : 'GET'), settings.url, settings.async);\n        if (settings.crossDomain) {\n          xhr.withCredentials = true;\n        }\n        if (settings.content_type) {\n          xhr.setRequestHeader('Content-Type', settings.content_type);\n        }\n        if (settings.requestheaders) {\n          Tools.each(settings.requestheaders, function (header) {\n            xhr.setRequestHeader(header.key, header.value);\n          });\n        }\n        xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n        xhr = XHR.fire('beforeSend', {\n          xhr: xhr,\n          settings: settings\n        }).xhr;\n        xhr.send(settings.data);\n        if (!settings.async) {\n          return ready();\n        }\n        Delay.setTimeout(ready, 10);\n      }\n    });\n\n    var extend = Tools.extend;\n    var JSONRequest = function () {\n      function JSONRequest(settings) {\n        this.settings = extend({}, settings);\n        this.count = 0;\n      }\n      JSONRequest.sendRPC = function (o) {\n        return new JSONRequest().send(o);\n      };\n      JSONRequest.prototype.send = function (args) {\n        var ecb = args.error, scb = args.success;\n        var xhrArgs = extend(this.settings, args);\n        xhrArgs.success = function (c, x) {\n          c = JSONUtils.parse(c);\n          if (typeof c === 'undefined') {\n            c = { error: 'JSON Parse error.' };\n          }\n          if (c.error) {\n            ecb.call(xhrArgs.error_scope || xhrArgs.scope, c.error, x);\n          } else {\n            scb.call(xhrArgs.success_scope || xhrArgs.scope, c.result);\n          }\n        };\n        xhrArgs.error = function (ty, x) {\n          if (ecb) {\n            ecb.call(xhrArgs.error_scope || xhrArgs.scope, ty, x);\n          }\n        };\n        xhrArgs.data = JSONUtils.serialize({\n          id: args.id || 'c' + this.count++,\n          method: args.method,\n          params: args.params\n        });\n        xhrArgs.content_type = 'application/json';\n        XHR.send(xhrArgs);\n      };\n      return JSONRequest;\n    }();\n\n    var create = function () {\n      return function () {\n        var data = {};\n        var keys = [];\n        var storage = {\n          getItem: function (key) {\n            var item = data[key];\n            return item ? item : null;\n          },\n          setItem: function (key, value) {\n            keys.push(key);\n            data[key] = String(value);\n          },\n          key: function (index) {\n            return keys[index];\n          },\n          removeItem: function (key) {\n            keys = keys.filter(function (k) {\n              return k === key;\n            });\n            delete data[key];\n          },\n          clear: function () {\n            keys = [];\n            data = {};\n          },\n          length: 0\n        };\n        Object.defineProperty(storage, 'length', {\n          get: function () {\n            return keys.length;\n          },\n          configurable: false,\n          enumerable: false\n        });\n        return storage;\n      }();\n    };\n\n    var localStorage;\n    try {\n      var test = '__storage_test__';\n      localStorage = window.localStorage;\n      localStorage.setItem(test, test);\n      localStorage.removeItem(test);\n    } catch (e) {\n      localStorage = create();\n    }\n    var LocalStorage = localStorage;\n\n    var publicApi = {\n      geom: { Rect: Rect },\n      util: {\n        Promise: promiseObj,\n        Delay: Delay,\n        Tools: Tools,\n        VK: VK,\n        URI: URI,\n        Class: Class,\n        EventDispatcher: EventDispatcher,\n        Observable: Observable,\n        I18n: I18n,\n        XHR: XHR,\n        JSON: JSONUtils,\n        JSONRequest: JSONRequest,\n        JSONP: JSONP,\n        LocalStorage: LocalStorage,\n        Color: Color,\n        ImageUploader: ImageUploader\n      },\n      dom: {\n        EventUtils: EventUtils,\n        Sizzle: Sizzle,\n        DomQuery: DomQuery,\n        TreeWalker: DomTreeWalker,\n        TextSeeker: TextSeeker,\n        DOMUtils: DOMUtils,\n        ScriptLoader: ScriptLoader,\n        RangeUtils: RangeUtils,\n        Serializer: DomSerializer,\n        StyleSheetLoader: StyleSheetLoader,\n        ControlSelection: ControlSelection,\n        BookmarkManager: BookmarkManager,\n        Selection: EditorSelection,\n        Event: EventUtils.Event\n      },\n      html: {\n        Styles: Styles,\n        Entities: Entities,\n        Node: AstNode,\n        Schema: Schema,\n        SaxParser: SaxParser,\n        DomParser: DomParser,\n        Writer: Writer,\n        Serializer: HtmlSerializer\n      },\n      Env: Env,\n      AddOnManager: AddOnManager,\n      Annotator: Annotator,\n      Formatter: Formatter,\n      UndoManager: UndoManager,\n      EditorCommands: EditorCommands,\n      WindowManager: WindowManager,\n      NotificationManager: NotificationManager,\n      EditorObservable: EditorObservable,\n      Shortcuts: Shortcuts,\n      Editor: Editor,\n      FocusManager: FocusManager,\n      EditorManager: EditorManager,\n      DOM: DOMUtils.DOM,\n      ScriptLoader: ScriptLoader.ScriptLoader,\n      PluginManager: PluginManager,\n      ThemeManager: ThemeManager,\n      IconManager: IconManager,\n      Resource: Resource,\n      trim: Tools.trim,\n      isArray: Tools.isArray,\n      is: Tools.is,\n      toArray: Tools.toArray,\n      makeMap: Tools.makeMap,\n      each: Tools.each,\n      map: Tools.map,\n      grep: Tools.grep,\n      inArray: Tools.inArray,\n      extend: Tools.extend,\n      create: Tools.create,\n      walk: Tools.walk,\n      createNS: Tools.createNS,\n      resolve: Tools.resolve,\n      explode: Tools.explode,\n      _addCacheSuffix: Tools._addCacheSuffix,\n      isOpera: Env.opera,\n      isWebKit: Env.webkit,\n      isIE: Env.ie,\n      isGecko: Env.gecko,\n      isMac: Env.mac\n    };\n    var tinymce = Tools.extend(EditorManager, publicApi);\n\n    var exportToModuleLoaders = function (tinymce) {\n      if (true) {\n        try {\n          module.exports = tinymce;\n        } catch (_) {\n        }\n      }\n    };\n    var exportToWindowGlobal = function (tinymce) {\n      window.tinymce = tinymce;\n      window.tinyMCE = tinymce;\n    };\n    exportToWindowGlobal(tinymce);\n    exportToModuleLoaders(tinymce);\n\n}());\n\n\n//# sourceURL=webpack://nocode-component/../../node_modules/tinymce/tinymce.js?");

/***/ })

}]);