'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var classnames = require('classnames');
var DOMPurify = require('dompurify');
var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
var ramda = require('ramda');
var client = require('react-dom/client');
var constants = require('./chunk-D1TqtxZX.cjs.js');
var injectCss = require('./chunk-vQvjPR2x.cjs.js');
require('@bigbinary/neeto-cist');
require('./chunk-0DRyiTvN.cjs.js');
var index$1 = require('./chunk-fDeB4TwF.cjs.js');
var common = require('./chunk-OZAH-T0Z.cjs.js');
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
var Close = require('@bigbinary/neeto-icons/Close');
var Button = require('@bigbinary/neetoui/Button');
var Spinner = require('@bigbinary/neetoui/Spinner');
var ReactDOM = require('react-dom');
var reactI18next = require('react-i18next');
var jsxRuntime = require('react/jsx-runtime');
require('i18next');
require('yup');
require('./chunk-B83fTs8d.cjs.js');
require('react-dom/server');
require('@babel/runtime/helpers/toConsumableArray');

var css = "@charset \"UTF-8\";.neeto-editor__callout{border-radius:8px;margin:16px 0;padding:16px;position:relative}.neeto-editor__callout .callout-container{align-items:flex-start;display:flex;gap:12px}.neeto-editor__callout .callout-container .callout-emoji{flex-shrink:0;line-height:1}.neeto-editor__callout .callout-container .callout-content{flex-grow:1;min-width:0;outline:none}.neeto-editor__callout .callout-container .callout-content p{margin:0}.neeto-editor__callout .callout-container .callout-content h1:first-child,.neeto-editor__callout .callout-container .callout-content h2:first-child,.neeto-editor__callout .callout-container .callout-content h3:first-child,.neeto-editor__callout .callout-container .callout-content h4:first-child,.neeto-editor__callout .callout-container .callout-content h5:first-child,.neeto-editor__callout .callout-container .callout-content h6:first-child,.neeto-editor__callout .callout-container .callout-content>p:first-child{margin-top:0}.neeto-editor__callout--default{background-color:#f6f7f8;background-color:rgb(var(--neeto-editor-gray-100))}.neeto-editor__callout--info{background-color:#e2f2ff;background-color:rgb(var(--neeto-editor-info-100))}.neeto-editor__callout--warning{background-color:#fbf2e1;background-color:rgb(var(--neeto-editor-warning-100))}.neeto-editor__callout--error{background-color:#feecf0;background-color:rgb(var(--neeto-editor-error-100))}.neeto-editor__callout--success{background-color:#ebfffa;background-color:rgb(var(--neeto-editor-success-100))}.neeto-ui-dropdown__popup .neeto-ui-dropdown__popup-menu.neeto-editor-callout-dropdown{padding:8px;width:200px}.neeto-editor-callout-dropdown{display:flex;flex-direction:column;gap:8px}.neeto-editor-callout-dropdown .neeto-editor-callout-dropdown__section{width:100%}.neeto-editor-callout-dropdown .neeto-editor-callout-dropdown__section .neeto-editor-callout-dropdown__section-title{color:rgb(var(--neeto-ui-gray-600));font-size:10px;font-weight:500;letter-spacing:.5px;margin-bottom:4px;padding:0 4px;text-transform:uppercase}.neeto-editor-callout-dropdown .neeto-editor-callout-dropdown__section .neeto-editor-callout-dropdown__options-grid{display:flex;flex-direction:column;gap:2px}.neeto-editor-callout-dropdown__type-option{align-items:center;background:none;border:none;border-radius:4px;cursor:pointer;display:flex;font-size:12px;padding:6px 8px;text-align:left;transition:all .15s ease;width:100%}.neeto-editor-callout-dropdown__type-option .neeto-editor-callout-dropdown__type-emoji{align-items:center;display:flex;flex-shrink:0;font-size:14px;height:16px;justify-content:center;margin-right:8px;width:16px}.neeto-editor-callout-dropdown__type-option .neeto-editor-callout-dropdown__type-label{color:rgb(var(--neeto-ui-gray-800));flex:1;font-weight:500}.neeto-editor-callout-dropdown__type-option:hover{background-color:rgb(var(--neeto-ui-gray-50))}.neeto-editor-callout-dropdown__type-option--selected{background-color:rgb(var(--neeto-ui-primary-50));border:1px solid rgb(var(--neeto-ui-primary-200))}.neeto-editor-callout-dropdown__type-option--selected .neeto-editor-callout-dropdown__type-label{color:rgb(var(--neeto-ui-primary-900))}.neeto-editor-callout-dropdown__current-emoji{display:inline-block}.ProseMirror ul[data-type=todoList],.neeto-editor-content ul[data-type=todoList]{list-style:none;margin-left:0;padding:0}.ProseMirror ul[data-type=todoList] li,.neeto-editor-content ul[data-type=todoList] li{align-items:flex-start;display:flex;position:relative}.ProseMirror ul[data-type=todoList] li>label,.neeto-editor-content ul[data-type=todoList] li>label{flex:0 0 auto;margin-right:.5rem;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}.ProseMirror ul[data-type=todoList] li>div,.neeto-editor-content ul[data-type=todoList] li>div{flex:1 1 auto;min-height:1.5rem}.ProseMirror ul[data-type=todoList] input[type=checkbox],.neeto-editor-content ul[data-type=todoList] input[type=checkbox]{border-color:rgb(var(--neeto-ui-gray-800));border-radius:0;border-width:1px;color:rgb(var(--neeto-ui-primary-500));cursor:pointer;pointer-events:auto;position:relative;top:-2px;z-index:2}.ProseMirror ul[data-type=todoList] input[type=checkbox]:checked,.neeto-editor-content ul[data-type=todoList] input[type=checkbox]:checked{border-color:rgb(var(--neeto-ui-primary-500))}.ProseMirror ul[data-type=todoList] ul[data-type=todoList],.neeto-editor-content ul[data-type=todoList] ul[data-type=todoList]{margin:0}.ProseMirror ul[data-type=todoList] li[data-checked=true]>div p,.neeto-editor-content ul[data-type=todoList] li[data-checked=true]>div p{opacity:.65;text-decoration:line-through}.neeto-ui-theme--dark .hljs{background:#0d1117;color:#c9d1d9}.neeto-ui-theme--dark .hljs-doctag,.neeto-ui-theme--dark .hljs-keyword,.neeto-ui-theme--dark .hljs-meta .hljs-keyword,.neeto-ui-theme--dark .hljs-template-tag,.neeto-ui-theme--dark .hljs-template-variable,.neeto-ui-theme--dark .hljs-type,.neeto-ui-theme--dark .hljs-variable.language_{color:#ff7b72}.neeto-ui-theme--dark .hljs-title,.neeto-ui-theme--dark .hljs-title.class_,.neeto-ui-theme--dark .hljs-title.class_.inherited__,.neeto-ui-theme--dark .hljs-title.function_{color:#d2a8ff}.neeto-ui-theme--dark .hljs-attr,.neeto-ui-theme--dark .hljs-attribute,.neeto-ui-theme--dark .hljs-literal,.neeto-ui-theme--dark .hljs-meta,.neeto-ui-theme--dark .hljs-number,.neeto-ui-theme--dark .hljs-operator,.neeto-ui-theme--dark .hljs-selector-attr,.neeto-ui-theme--dark .hljs-selector-class,.neeto-ui-theme--dark .hljs-selector-id,.neeto-ui-theme--dark .hljs-variable{color:#79c0ff}.neeto-ui-theme--dark .hljs-meta .hljs-string,.neeto-ui-theme--dark .hljs-regexp,.neeto-ui-theme--dark .hljs-string{color:#a5d6ff}.neeto-ui-theme--dark .hljs-built_in,.neeto-ui-theme--dark .hljs-symbol{color:#ffa657}.neeto-ui-theme--dark .hljs-code,.neeto-ui-theme--dark .hljs-comment,.neeto-ui-theme--dark .hljs-formula{color:#8b949e}.neeto-ui-theme--dark .hljs-name,.neeto-ui-theme--dark .hljs-quote,.neeto-ui-theme--dark .hljs-selector-pseudo,.neeto-ui-theme--dark .hljs-selector-tag{color:#7ee787}.neeto-ui-theme--dark .hljs-subst{color:#c9d1d9}.neeto-ui-theme--dark .hljs-section{color:#1f6feb}.neeto-ui-theme--dark .hljs-bullet{color:#f2cc60}.neeto-ui-theme--dark .hljs-emphasis{color:#c9d1d9}.neeto-ui-theme--dark .hljs-strong{color:#c9d1d9;font-weight:700}.neeto-ui-theme--dark .hljs-addition{background-color:#033a16;color:#aff5b4}.neeto-ui-theme--dark .hljs-deletion{background-color:#67060c;color:#ffdcd7}.neeto-ui-theme--light .hljs{background:#f8f8f8;color:#333}.neeto-ui-theme--light .hljs-comment,.neeto-ui-theme--light .hljs-quote{color:#998}.neeto-ui-theme--light .hljs-keyword,.neeto-ui-theme--light .hljs-selector-tag,.neeto-ui-theme--light .hljs-subst{color:#333}.neeto-ui-theme--light .hljs-literal,.neeto-ui-theme--light .hljs-number,.neeto-ui-theme--light .hljs-tag .hljs-attr,.neeto-ui-theme--light .hljs-template-variable,.neeto-ui-theme--light .hljs-variable{color:teal}.neeto-ui-theme--light .hljs-doctag,.neeto-ui-theme--light .hljs-string{color:#d14}.neeto-ui-theme--light .hljs-section,.neeto-ui-theme--light .hljs-selector-id,.neeto-ui-theme--light .hljs-title{color:#900}.neeto-ui-theme--light .hljs-class .hljs-title,.neeto-ui-theme--light .hljs-type{color:#458}.neeto-ui-theme--light .hljs-attribute,.neeto-ui-theme--light .hljs-name,.neeto-ui-theme--light .hljs-tag{color:navy}.neeto-ui-theme--light .hljs-link,.neeto-ui-theme--light .hljs-regexp{color:#009926}.neeto-ui-theme--light .hljs-bullet,.neeto-ui-theme--light .hljs-symbol{color:#990073}.neeto-ui-theme--light .hljs-built_in,.neeto-ui-theme--light .hljs-builtin-name{color:#0086b3}.neeto-ui-theme--light .hljs-meta{color:#999}.neeto-ui-theme--light .hljs-deletion{background:#fdd}.neeto-ui-theme--light .hljs-addition{background:#dfd}.neeto-ui-theme--light,:root{--neeto-editor-white:255,255,255;--neeto-editor-black:12,17,29;--neeto-editor-gray-800:16,24,40;--neeto-editor-gray-700:29,41,57;--neeto-editor-gray-600:52,64,84;--neeto-editor-gray-500:135,146,157;--neeto-editor-gray-400:194,200,204;--neeto-editor-gray-300:216,220,222;--neeto-editor-gray-200:233,235,237;--neeto-editor-gray-100:246,247,248;--neeto-editor-gray-50:250,250,250;--neeto-editor-primary-800:0,102,83;--neeto-editor-primary-600:0,122,100;--neeto-editor-primary-500:0,128,104;--neeto-editor-primary-100:225,243,238;--neeto-editor-primary-50:240,249,247;--neeto-editor-accent-800:9,90,186;--neeto-editor-accent-600:13,102,208;--neeto-editor-accent-500:20,115,230;--neeto-editor-accent-100:230,244,255;--neeto-editor-accent-50:239,248,255;--neeto-editor-success-800:1,121,93;--neeto-editor-success-600:1,141,109;--neeto-editor-success-500:2,162,124;--neeto-editor-success-100:235,255,250;--neeto-editor-error-800:187,18,26;--neeto-editor-error-600:201,37,45;--neeto-editor-error-500:215,55,63;--neeto-editor-error-100:254,236,240;--neeto-editor-info-800:9,90,186;--neeto-editor-info-600:13,102,208;--neeto-editor-info-500:20,115,230;--neeto-editor-info-100:226,242,255;--neeto-editor-warning-800:189,100,13;--neeto-editor-warning-600:203,111,16;--neeto-editor-warning-500:218,123,17;--neeto-editor-warning-100:251,242,225;--neeto-editor-pastel-silver:232,233,237;--neeto-editor-pastel-red:255,229,229;--neeto-editor-pastel-yellow:254,243,197;--neeto-editor-pastel-green:211,249,232;--neeto-editor-pastel-blue:236,244,255;--neeto-editor-pastel-purple:238,235,255;--neeto-editor-pastel-pink:253,226,241;--neeto-editor-rounded-none:0;--neeto-editor-rounded-sm:3px;--neeto-editor-rounded:5px;--neeto-editor-rounded-md:6px;--neeto-editor-rounded-lg:8px;--neeto-editor-rounded-xl:12px;--neeto-editor-rounded-full:999px;--neeto-editor-font-thin:100;--neeto-editor-font-extralight:200;--neeto-editor-font-light:300;--neeto-editor-font-normal:400;--neeto-editor-font-medium:500;--neeto-editor-font-semibold:600;--neeto-editor-font-bold:700;--neeto-editor-font-extrabold:800;--neeto-editor-font-black:900;--neeto-editor-content-h1-margin:1.5rem 0 0.25rem;--neeto-editor-content-h2-margin:1.5rem 0 0.25rem;--neeto-editor-content-h3-margin:1.5rem 0 0.25rem;--neeto-editor-content-h4-margin:1.5rem 0 0.25rem;--neeto-editor-content-h5-margin:1.5rem 0 0.25rem;--neeto-editor-content-h6-margin:1.5rem 0 0.25rem;--neeto-editor-content-heading-font-weight:600;--neeto-editor-content-heading-font-weight-bold:bold;--neeto-editor-content-heading-color:12,17,29,1;--neeto-editor-content-heading-line-height:1.25;--neeto-editor-content-paragraph-color:54,55,55,1;--neeto-editor-content-paragraph-font-weight:400;--neeto-editor-content-paragraph-line-height:1.6;--neeto-editor-content-list-left-padding:2rem;--neeto-editor-content-list-margin-bottom:1rem;--neeto-editor-content-list-item-margin-bottom:0.5rem;--neeto-editor-content-list-item-margin-top:0.5rem;--neeto-editor-content-code-font-size:85%;--neeto-editor-content-code-background-color:246,248,250,1;--neeto-editor-content-code-line-number-color:89,99,110,1;--neeto-editor-content-code-color:31,35,40,1;--neeto-editor-content-code-padding:0.2em 0.4em;--neeto-editor-content-blockquote-color:89,99,110,1;--neeto-editor-content-blockquote-border-color:209,217,224,1;--neeto-editor-content-blockquote-border-left-width:4px;--neeto-editor-content-blockquote-margin-bottom:1rem;--neeto-editor-content-blockquote-padding-left:0.75rem;--neeto-editor-content-image-border-color:228,228,231;--neeto-editor-content-image-border-radius:8px;--neeto-editor-highlight-text-1:#32302c;--neeto-editor-highlight-text-2:#787774;--neeto-editor-highlight-text-3:#9f6b53;--neeto-editor-highlight-text-4:#d9730d;--neeto-editor-highlight-text-5:#cb912f;--neeto-editor-highlight-text-6:#448361;--neeto-editor-highlight-text-7:#337ea9;--neeto-editor-highlight-text-8:#9065b0;--neeto-editor-highlight-text-9:#c14c8a;--neeto-editor-highlight-text-10:#d44c47;--neeto-editor-highlight-bg-1:#ff0;--neeto-editor-highlight-bg-2:#f8f8f7;--neeto-editor-highlight-bg-3:#f4eeee;--neeto-editor-highlight-bg-4:#fbecdd;--neeto-editor-highlight-bg-5:#fbf3db;--neeto-editor-highlight-bg-6:#edf3ec;--neeto-editor-highlight-bg-7:#e7f3f8;--neeto-editor-highlight-bg-8:#f8f3fc;--neeto-editor-highlight-bg-9:#fcf1f6;--neeto-editor-highlight-bg-10:#fdebec}.neeto-ui-theme--dark{--neeto-editor-white:18,18,18;--neeto-editor-black:224,224,224;--neeto-editor-gray-50:10,10,10;--neeto-editor-gray-100:30,30,30;--neeto-editor-gray-200:44,44,44;--neeto-editor-gray-300:57,57,57;--neeto-editor-gray-400:73,73,73;--neeto-editor-gray-500:92,92,92;--neeto-editor-gray-600:124,124,124;--neeto-editor-gray-700:162,162,162;--neeto-editor-gray-800:200,200,200;--neeto-editor-primary-800:0,245,200;--neeto-editor-primary-600:0,224,183;--neeto-editor-primary-500:0,204,167;--neeto-editor-primary-100:0,61,49;--neeto-editor-primary-50:0,41,33;--neeto-editor-accent-800:142,189,245;--neeto-editor-accent-600:105,167,242;--neeto-editor-accent-500:67,144,239;--neeto-editor-accent-100:10,56,113;--neeto-editor-accent-50:7,37,75;--neeto-editor-error-800:247,109,116;--neeto-editor-error-600:236,91,98;--neeto-editor-error-500:227,72,80;--neeto-editor-error-100:129,33,38;--neeto-editor-success-800:0,245,200;--neeto-editor-success-600:0,224,183;--neeto-editor-success-500:0,204,167;--neeto-editor-success-100:0,61,49;--neeto-editor-warning-800:249,164,63;--neeto-editor-warning-600:242,148,35;--neeto-editor-warning-500:230,134,25;--neeto-editor-warning-100:131,74,11;--neeto-editor-info-800:142,189,245;--neeto-editor-info-600:105,167,242;--neeto-editor-info-500:67,144,239;--neeto-editor-info-100:10,56,113;--neeto-editor-pastel-silver:167,168,170;--neeto-editor-pastel-red:183,164,165;--neeto-editor-pastel-yellow:182,175,143;--neeto-editor-pastel-green:152,179,167;--neeto-editor-pastel-blue:170,175,183;--neeto-editor-pastel-purple:171,169,183;--neeto-editor-pastel-pink:181,162,174;--neeto-editor-content-heading-color:224,224,224,1;--neeto-editor-content-paragraph-color:224,224,224,1;--neeto-editor-content-code-background-color:21,27,35,1;--neeto-editor-content-code-line-number-color:89,99,110,1;--neeto-editor-content-code-color:240,246,252,1;--neeto-editor-content-blockquote-color:145,152,161,1;--neeto-editor-content-blockquote-border-color:61,68,77,1;--neeto-editor-highlight-text-1:#cdcdcd;--neeto-editor-highlight-text-2:#b4b4b4;--neeto-editor-highlight-text-3:#c89678;--neeto-editor-highlight-text-4:#f0b464;--neeto-editor-highlight-text-5:#e6be78;--neeto-editor-highlight-text-6:#78be96;--neeto-editor-highlight-text-7:#64b4dc;--neeto-editor-highlight-text-8:#be96e6;--neeto-editor-highlight-text-9:#dc78be;--neeto-editor-highlight-text-10:#e6786e;--neeto-editor-highlight-bg-1:#646400;--neeto-editor-highlight-bg-2:#323232;--neeto-editor-highlight-bg-3:#3c3232;--neeto-editor-highlight-bg-4:#503c28;--neeto-editor-highlight-bg-5:#5a5032;--neeto-editor-highlight-bg-6:#32503c;--neeto-editor-highlight-bg-7:#285064;--neeto-editor-highlight-bg-8:#503c64;--neeto-editor-highlight-bg-9:#643250;--neeto-editor-highlight-bg-10:#6e3232}.neeto-ui-theme--dark .neeto-editor-content.neeto-editor-size--small{--neeto-editor-content-heading-color:224,224,224,1;--neeto-editor-content-paragraph-color:224,224,224,1}.neeto-ui-theme--light .neeto-editor-content{--neeto-editor-content-heading-color:12,17,29,1;--neeto-editor-content-paragraph-color:54,55,55,1}.neeto-ui-theme--light .neeto-editor-content.neeto-editor-size--small{--neeto-editor-content-heading-color:31,35,40,1;--neeto-editor-content-paragraph-color:31,35,40,1}.neeto-editor-content{-moz-tab-size:2;-o-tab-size:2;tab-size:2;white-space:pre-wrap;word-break:break-word}.neeto-editor-content hr{border-color:#363737;border-color:rgba(var(--neeto-editor-content-paragraph-color));margin:.5rem 0;opacity:.2}.neeto-editor-content .table-responsive{-webkit-overflow-scrolling:touch;margin:1rem 0;overflow-x:auto}.neeto-editor-content.neeto-editor-size--small{--neeto-editor-content-heading-color:31,35,40,1;--neeto-editor-content-paragraph-color:31,35,40,1;--neeto-editor-content-h1-font-size:1.75rem;--neeto-editor-content-h2-font-size:1.3125rem;--neeto-editor-content-h3-font-size:1.09375rem;--neeto-editor-content-h4-font-size:0.875rem;--neeto-editor-content-h5-font-size:0.765625rem;--neeto-editor-content-h6-font-size:0.74375rem;--neeto-editor-content-paragraph-font-size:0.875rem;--neeto-editor-content-paragraph-line-height:1.5;--neeto-editor-content-list-left-padding:1.5rem;--neeto-editor-content-list-item-margin-bottom:0.25rem;--neeto-editor-content-list-item-margin-top:0.25rem}.neeto-editor-content.neeto-editor-size--medium{--neeto-editor-content-h1-font-size:2rem;--neeto-editor-content-h2-font-size:1.5rem;--neeto-editor-content-h3-font-size:1.25rem;--neeto-editor-content-h4-font-size:1rem;--neeto-editor-content-h5-font-size:0.875rem;--neeto-editor-content-h6-font-size:0.75rem;--neeto-editor-content-paragraph-font-size:1rem}@media only screen and (max-width:767px){.neeto-editor-content.neeto-editor-size--medium{--neeto-editor-content-h1-font-size:1.375rem;--neeto-editor-content-h2-font-size:1.25rem;--neeto-editor-content-h3-font-size:1.125rem}}.neeto-editor-content.neeto-editor-size--large{--neeto-editor-content-h1-font-size:2.375rem;--neeto-editor-content-h2-font-size:1.93rem;--neeto-editor-content-h3-font-size:1.633rem;--neeto-editor-content-h4-font-size:1.336rem;--neeto-editor-content-h5-font-size:0.986rem;--neeto-editor-content-h6-font-size:0.796rem;--neeto-editor-content-paragraph-font-size:1.125rem}@media only screen and (max-width:767px){.neeto-editor-content.neeto-editor-size--large{--neeto-editor-content-h1-font-size:2.125rem;--neeto-editor-content-h2-font-size:1.7266rem;--neeto-editor-content-h3-font-size:1.4609rem;--neeto-editor-content-h4-font-size:1.1953rem;--neeto-editor-content-h5-font-size:0.875rem;--neeto-editor-content-h6-font-size:0.75rem;--neeto-editor-content-paragraph-font-size:1rem}}.neeto-editor-content h1,.neeto-editor-content h2,.neeto-editor-content h3,.neeto-editor-content h4,.neeto-editor-content h5,.neeto-editor-content h6{color:#0c111d;color:rgba(var(--neeto-editor-content-heading-color));font-weight:600;font-weight:var(--neeto-editor-content-heading-font-weight)}.neeto-editor-content h1 strong,.neeto-editor-content h2 strong,.neeto-editor-content h3 strong,.neeto-editor-content h4 strong,.neeto-editor-content h5 strong,.neeto-editor-content h6 strong{font-weight:700!important;font-weight:var(--neeto-editor-content-heading-font-weight-bold)!important}.neeto-editor-content h1{font-size:var(--neeto-editor-content-h1-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h1-margin)}.neeto-editor-content h2{font-size:var(--neeto-editor-content-h2-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h2-margin)}.neeto-editor-content h3{font-size:var(--neeto-editor-content-h3-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h3-margin)}.neeto-editor-content h4{font-size:var(--neeto-editor-content-h4-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h4-margin)}.neeto-editor-content h5{font-size:var(--neeto-editor-content-h5-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h5-margin)}.neeto-editor-content h6{font-size:var(--neeto-editor-content-h6-font-size);margin:1.5rem 0 .25rem;margin:var(--neeto-editor-content-h6-margin)}.neeto-editor-content .header-wrapper{position:relative}.neeto-editor-content .header-wrapper__link{position:absolute;top:50%}.neeto-editor-content .header-wrapper h1,.neeto-editor-content .header-wrapper h2,.neeto-editor-content .header-wrapper h3,.neeto-editor-content .header-wrapper h4,.neeto-editor-content .header-wrapper h5,.neeto-editor-content .header-wrapper h6{line-height:1.25;line-height:var(--neeto-editor-content-heading-line-height);transition:color .15s ease-in}.neeto-editor-content .header-wrapper .header-link-icon-wrapper{align-items:center;display:flex;height:100%;left:-1.5625rem;opacity:0;position:absolute;transition:opacity .15s ease-in;width:1.5625rem}.neeto-editor-content .header-wrapper .header-link-icon-wrapper svg{fill:#006653;fill:rgb(var(--neeto-editor-primary-800));transition:fill .15s ease-in}.neeto-editor-content .header-wrapper:hover .header-link-icon-wrapper{opacity:1}.neeto-editor-content .header-wrapper:hover svg{fill:#095aba;fill:rgb(var(--neeto-editor-accent-800))}.neeto-editor-content p{color:#363737;color:rgba(var(--neeto-editor-content-paragraph-color));font-size:var(--neeto-editor-content-paragraph-font-size);font-weight:400;font-weight:var(--neeto-editor-content-paragraph-font-weight);line-height:1.6;line-height:var(--neeto-editor-content-paragraph-line-height);margin:0;min-height:1.3rem}.neeto-editor-content p:empty:after{content:\" \"}.neeto-editor-content p:last-child{margin-bottom:0}.neeto-editor-content p strong{font-weight:600!important}.neeto-editor-content div{color:#363737;color:rgba(var(--neeto-editor-content-paragraph-color));font-size:var(--neeto-editor-content-paragraph-font-size);font-weight:400;font-weight:var(--neeto-editor-content-paragraph-font-weight);line-height:1.6;line-height:var(--neeto-editor-content-paragraph-line-height)}.neeto-editor-content code{background-color:#f6f8fa;background-color:rgba(var(--neeto-editor-content-code-background-color));border-color:#f6f8fa;border-color:rgba(var(--neeto-editor-content-code-background-color));border-radius:3px;border-radius:var(--neeto-editor-rounded-sm);color:#1f2328;color:rgba(var(--neeto-editor-content-code-color));font-family:SFMono-Regular,Menlo,Consolas,PT Mono,Liberation Mono,Courier,monospace;font-size:85%;font-size:var(--neeto-editor-content-code-font-size);padding:.2em .4em;padding:var(--neeto-editor-content-code-padding)}.neeto-editor-content code *{font-size:inherit!important}.neeto-editor-content h1 code,.neeto-editor-content h2 code,.neeto-editor-content h3 code,.neeto-editor-content h4 code,.neeto-editor-content h5 code,.neeto-editor-content h6 code,.neeto-editor-content p code{font-size:85%;font-size:var(--neeto-editor-content-code-font-size)}.neeto-editor-content pre{background-color:#f6f8fa;background-color:rgba(var(--neeto-editor-content-code-background-color));border-color:#f6f8fa;border-color:rgba(var(--neeto-editor-content-code-background-color));border-radius:3px;border-radius:var(--neeto-editor-rounded-sm);counter-reset:line-number;font-size:var(--neeto-editor-content-paragraph-font-size);line-height:1.5;margin-bottom:1rem;margin-top:1rem;max-width:100%;padding:0;position:relative}.neeto-editor-content pre,.neeto-editor-content pre div{color:#1f2328;color:rgba(var(--neeto-editor-content-code-color))}.neeto-editor-content pre .neeto-editor-codeblock-options{align-items:center;display:flex;gap:.25rem;opacity:0;position:absolute;right:.25rem;top:.25rem;visibility:hidden}.neeto-editor-content pre .neeto-editor-codeblock-options__menu{display:flex;flex-direction:column;gap:.25rem}.neeto-editor-content pre .neeto-editor-codeblock-options__input{margin:.25rem}.neeto-editor-content pre:hover .copy-button,.neeto-editor-content pre:hover .neeto-editor-codeblock-options{opacity:1;visibility:visible}.neeto-editor-content pre .copy-button{opacity:0;position:absolute;right:.25rem;top:.25rem;visibility:hidden}.neeto-editor-content pre[data-linenumbers] .highlight-line{padding-left:3.125rem;position:relative}.neeto-editor-content pre[data-linenumbers] .highlight-line:before{align-items:center;color:#59636e;color:rgba(var(--neeto-editor-content-code-line-number-color));content:counter(line-number);counter-increment:line-number;display:flex;font-size:85%;font-weight:400;height:100%;justify-content:flex-end;left:0;padding-left:.625rem;padding-right:1rem;position:absolute;width:3.125rem}.neeto-editor-content pre[data-linenumbers] .highlight-line:last-child:before{content:\"\"}.neeto-editor-content pre>code{background-color:transparent;border-radius:0;border-width:0;color:inherit;display:block;font-size:85%;font-size:var(--neeto-editor-content-code-font-size);font-weight:400;line-height:inherit;overflow-x:auto;padding:.75rem;white-space:pre!important;width:100%}.neeto-editor-content pre[data-linenumbers]>code{padding-left:0}.neeto-editor-content blockquote{border-left-color:#d1d9e0;border-left-color:rgba(var(--neeto-editor-content-blockquote-border-color));border-left-width:4px;border-left-width:var(--neeto-editor-content-blockquote-border-left-width);color:#59636e;color:rgba(var(--neeto-editor-content-blockquote-color));font-weight:500;font-weight:var(--neeto-editor-font-medium);margin-bottom:1rem;margin-bottom:var(--neeto-editor-content-blockquote-margin-bottom);padding-left:.75rem;padding-left:var(--neeto-editor-content-blockquote-padding-left);quotes:\"“\" \"”\" \"‘\" \"’\"}.neeto-editor-content blockquote div,.neeto-editor-content blockquote p{color:inherit}.neeto-editor-content blockquote>p:after,.neeto-editor-content blockquote>p:before{content:\"\"!important}.neeto-editor-content ol,.neeto-editor-content ul{list-style:revert;margin-bottom:1rem;margin-bottom:var(--neeto-editor-content-list-margin-bottom);padding-left:2rem;padding-left:var(--neeto-editor-content-list-left-padding)}.neeto-editor-content ol li,.neeto-editor-content ul li{color:#363737;color:rgba(var(--neeto-editor-content-paragraph-color));font-size:var(--neeto-editor-content-paragraph-font-size);font-weight:400;font-weight:var(--neeto-editor-content-paragraph-font-weight);line-height:1.6;line-height:var(--neeto-editor-content-paragraph-line-height)}.neeto-editor-content ol li:before,.neeto-editor-content ul li:before{background-color:#363737;background-color:rgba(var(--neeto-editor-content-paragraph-color))}.neeto-editor-content ol.orderedList li>p,.neeto-editor-content ul.bulletList li>p{margin-bottom:.5rem;margin-bottom:var(--neeto-editor-content-list-item-margin-bottom);margin-top:.5rem;margin-top:var(--neeto-editor-content-list-item-margin-top)}.neeto-editor-content ol.orderedList+p,.neeto-editor-content ul.bulletList+p{margin-top:.5rem;margin-top:var(--neeto-editor-content-list-item-margin-top)}.neeto-editor-content a[href]{color:#095aba;color:rgb(var(--neeto-editor-accent-800));font-weight:inherit}.neeto-editor-content .neeto-editor__video-wrapper{display:flex;margin:1rem 0}.neeto-editor-content .neeto-editor__video-wrapper .neeto-editor__video-iframe{display:inline-block;height:auto!important;max-width:100%;vertical-align:top}.neeto-editor-content .neeto-editor__video-wrapper .neeto-editor__video-iframe iframe{aspect-ratio:16/9;width:100%}.neeto-editor-content .neeto-editor__video--left{justify-content:flex-start}.neeto-editor-content .neeto-editor__video--right{justify-content:flex-end}.neeto-editor-content .neeto-editor__video--center{justify-content:center}.neeto-editor-content mark{border-radius:3px;border-radius:var(--neeto-editor-rounded-sm);padding:0}.neeto-editor-content [data-type=mention],.neeto-editor-content [data-type=special-mention]{color:#095aba;color:rgb(var(--neeto-editor-accent-800))}.neeto-editor-content table{border:1px solid #d8dcde;border:1px solid rgba(var(--neeto-editor-gray-300));border-collapse:separate;border-radius:3px;border-radius:var(--neeto-editor-rounded-sm);border-spacing:0;min-width:300px;overflow:hidden;table-layout:fixed}.neeto-editor-content table td,.neeto-editor-content table th{border-left:1px solid #d8dcde;border-left:1px solid rgba(var(--neeto-editor-gray-300));border-top:1px solid #d8dcde;border-top:1px solid rgba(var(--neeto-editor-gray-300));padding:8px 12px;position:relative;text-align:left}.neeto-editor-content table td:first-child,.neeto-editor-content table th:first-child{border-left:none}.neeto-editor-content table th{background:#f6f7f8;background:rgb(var(--neeto-editor-gray-100));border-top:none}.neeto-editor-content table td{background:#fff;background:rgb(var(--neeto-editor-white))}.neeto-editor-content--hidden{display:none}.neeto-editor__image-wrapper{color:inherit!important;display:flex;font-weight:400!important;margin:1rem 0;padding-left:3px;text-decoration:none}.neeto-editor__image-wrapper figure{cursor:pointer;display:inline-block;margin:0;max-width:100%;overflow:hidden;position:relative;vertical-align:top}.neeto-editor__image-wrapper .neeto-editor__image{display:inline-block;height:auto!important;max-width:100%;min-height:52px;vertical-align:top}.neeto-editor__image-wrapper .neeto-editor__image img,.neeto-editor__image-wrapper .neeto-editor__image video{display:inline-block;height:auto;vertical-align:top!important;width:100%}.neeto-editor__image-wrapper .neeto-editor__image img.hidden,.neeto-editor__image-wrapper .neeto-editor__image video.hidden{display:none}.neeto-editor__image-wrapper .neeto-editor__image img{border:1px solid #e4e4e7;border-color:rgba(var(--neeto-editor-content-image-border-color));border-radius:8px;border-radius:var(--neeto-editor-content-image-border-radius);cursor:zoom-in}.neeto-editor__image-wrapper .neeto-editor__image-placeholder{align-items:center;border:1px solid;border-radius:8px;display:flex;height:200px;justify-content:center;width:400px}.neeto-editor__image-wrapper figcaption div{color:#344054;color:rgb(var(--neeto-editor-gray-600));font-size:.875rem;font-weight:400;font-weight:var(--neeto-editor-font-normal);line-height:1.4;text-align:center}.neeto-editor__image-wrapper figcaption div a{display:inline-block;margin:0;text-align:center}.neeto-editor__image-wrapper figcaption.is-empty div:before{color:#87929d;color:rgb(var(--neeto-editor-gray-500));content:\"Add a caption\";inset:0;position:absolute}.neeto-editor__image-wrapper:has(img:not([src])){display:none}.neeto-editor-content figcaption{color:#6b7280;font-size:.875rem;font-weight:400;line-height:1.4;max-width:100%;text-align:center}.neeto-editor__image--left{justify-content:flex-start}.neeto-editor__image--center{justify-content:center}.neeto-editor__image--right{justify-content:flex-end}.selected-text{background-color:#d8dcde;background-color:rgb(var(--neeto-editor-gray-300));padding:2px 0}.ne-image-preview-wrapper{align-items:center;background:rgba(16,24,40,.5);background:rgba(var(--neeto-editor-gray-800),.5);display:none;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%;z-index:999999}.ne-image-preview-wrapper.active{display:flex}.ne-image-preview-wrapper .ne-image-preview{background:#fff;background:rgb(var(--neeto-editor-white));display:flex;flex-direction:column;gap:10px;max-height:90vh;max-width:60vw;opacity:0;transition:opacity .1s ease-in-out}.ne-image-preview-wrapper .ne-image-preview img{background:#fff;background:rgb(var(--neeto-editor-white));max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain;overflow:hidden;padding:10px;width:-moz-fit-content;width:fit-content}.ne-image-preview-wrapper .ne-image-preview.image-loaded{align-items:center;background:transparent;border-radius:10px;display:flex;opacity:1}.ne-image-preview-wrapper .ne-image-preview__caption{color:#101828;color:rgb(var(--neeto-editor-gray-800));line-height:1.5;margin-top:auto;text-align:center;width:100%}.ne-image-preview-wrapper .close-button{align-items:center;background-color:#fff;background-color:rgb(var(--neeto-editor-white));border-radius:999px;border-radius:var(--neeto-editor-rounded-full);cursor:pointer;display:flex;height:30px;justify-content:center;position:absolute;right:12px;top:12px;width:30px}.ne-image-preview-wrapper .image-preview{max-height:70%;max-width:70%}.ne-image-preview-wrapper__spinner{position:absolute}.ne-image-preview-wrapper__spinner i{background-color:#d8dcde;background-color:rgb(var(--neeto-editor-gray-300))}";
injectCss.n(css,{});

var ImagePreview = function ImagePreview(_ref) {
  var imagePreviewDetails = _ref.imagePreviewDetails,
    setImagePreviewDetails = _ref.setImagePreviewDetails;
  var _useState = React.useState(true),
    _useState2 = _slicedToArray(_useState, 2),
    isLoading = _useState2[0],
    setIsLoading = _useState2[1];
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var imagePreviewRef = React.useRef(null);
  reactUtils.useOnClickOutside(imagePreviewRef, function () {
    return setImagePreviewDetails(null);
  }, {
    enabled: true
  });
  React.useEffect(function () {
    if (!imagePreviewRef.current) return;
    imagePreviewRef.current.setAttribute("tabindex", "-1");
    imagePreviewRef.current.focus();
  }, []);
  var handleKeyDown = function handleKeyDown(e) {
    e.stopPropagation();
    e.key === "Escape" && setImagePreviewDetails(null);
  };
  return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "ne-image-preview-wrapper active",
    children: [isLoading && /*#__PURE__*/jsxRuntime.jsx(Spinner, {
      className: "ne-image-preview-wrapper__spinner"
    }), !isLoading && /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "close-button",
      children: /*#__PURE__*/jsxRuntime.jsx(Button, {
        icon: Close,
        style: "secondary",
        onClick: function onClick() {
          return setImagePreviewDetails(null);
        }
      })
    }), /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: classnames("ne-image-preview", {
        "image-loaded": !isLoading
      }),
      children: [/*#__PURE__*/jsxRuntime.jsx("img", {
        alt: t("neetoEditor.editorContent.imagePreviewAltText"),
        ref: imagePreviewRef,
        src: imagePreviewDetails.src,
        onKeyDown: handleKeyDown,
        onLoad: function onLoad() {
          return setIsLoading(false);
        }
      }), imagePreviewDetails && /*#__PURE__*/jsxRuntime.jsx("p", {
        className: "ne-image-preview__caption",
        children: imagePreviewDetails.caption
      })]
    })]
  }), document.body);
};

var buildLinkSVG = function buildLinkSVG() {
  var svgNS = "http://www.w3.org/2000/svg";
  var svgWrapper = document.createElement("span");
  svgWrapper.classList.add("header-link-icon-wrapper");
  var svg = document.createElementNS(svgNS, "svg");
  svg.setAttribute("aria-hidden", "true");
  svg.setAttribute("height", "20");
  svg.setAttribute("viewBox", "0 0 16 16");
  svg.setAttribute("width", "20");
  var path = document.createElementNS(svgNS, "path");
  path.setAttribute("d", "M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z");
  svg.appendChild(path);
  svgWrapper.appendChild(svg);
  return svgWrapper;
};
var convertTextToId = function convertTextToId(text) {
  return text.trim().toLowerCase().replace(/[^a-z0-9\s]/g, "").replace(/\s+/g, "-");
};
var buildHeaderLinks = function buildHeaderLinks(editorContentNode) {
  var headerTags = editorContentNode.querySelectorAll("h1, h2, h3, h4, h5, h6");
  var usedIds = new Map();
  headerTags.forEach(function (heading) {
    if (heading.getAttribute("data-link") === "false") {
      return;
    }
    var headingId = convertTextToId(heading.textContent);
    if (usedIds.has(headingId)) {
      var count = usedIds.get(headingId);
      usedIds.set(headingId, count + 1);
      headingId = "".concat(headingId, "-").concat(count);
    } else usedIds.set(headingId, 1);
    heading.setAttribute("id", headingId);
    var wrapper = document.createElement("div");
    var anchor = document.createElement("a");
    wrapper.classList.add("header-wrapper");
    anchor.setAttribute("href", "#".concat(headingId));
    anchor.classList.add("header-wrapper__link");
    anchor.appendChild(buildLinkSVG());
    wrapper.appendChild(heading.cloneNode(true));
    wrapper.appendChild(anchor);
    heading.replaceWith(wrapper);
  });
};

var handleTodoCheckboxClick = function handleTodoCheckboxClick(event, editorContentRef, onChange) {
  if (!(event.target.type === "checkbox" && event.target.closest('ul[data-type="todoList"] li[data-type="taskItem"]'))) {
    return;
  }
  var checkbox = event.target;
  var listItem = checkbox.closest("li");
  if (listItem) {
    listItem.setAttribute("data-checked", checkbox.checked.toString());
    if (checkbox.checked) {
      checkbox.setAttribute("checked", "checked");
    } else {
      checkbox.removeAttribute("checked");
    }
    onChange === null || onChange === void 0 || onChange(editorContentRef === null || editorContentRef === void 0 ? void 0 : editorContentRef.innerHTML);
  }
};
var syncTodoCheckboxStates = function syncTodoCheckboxStates(editorContentRef) {
  if (!editorContentRef) return;
  var todoItems = editorContentRef.querySelectorAll("ul[data-type=\"todoList\"] li[data-type=\"taskItem\"]");
  todoItems.forEach(function (listItem) {
    var isChecked = listItem.getAttribute("data-checked") === "true";
    var checkbox = listItem.querySelector('input[type="checkbox"]');
    if (checkbox) {
      checkbox.checked = isChecked;
      if (isChecked) {
        checkbox.setAttribute("checked", "checked");
      } else {
        checkbox.removeAttribute("checked");
      }
    }
  });
};

var _excluded = ["content", "variables", "className", "size", "configuration", "onChange", "onClick"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var EditorContent = function EditorContent(_ref) {
  var _ref$content = _ref.content,
    content = _ref$content === void 0 ? "" : _ref$content,
    _ref$variables = _ref.variables,
    variables = _ref$variables === void 0 ? [] : _ref$variables,
    className = _ref.className,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? constants.EDITOR_SIZES.SMALL : _ref$size,
    _ref$configuration = _ref.configuration,
    configuration = _ref$configuration === void 0 ? common.EDITOR_CONTENT_DEFAULT_CONFIGURATION : _ref$configuration,
    onChange = _ref.onChange,
    onClick = _ref.onClick,
    otherProps = _objectWithoutProperties(_ref, _excluded);
  var _useState = React.useState(null),
    _useState2 = _slicedToArray(_useState, 2),
    imagePreviewDetails = _useState2[0],
    setImagePreviewDetails = _useState2[1];
  var editorContentRef = React.useRef(null);
  var htmlContent = index$1.convertPlainTextToHtml(index$1.substituteVariables(index$1.applySyntaxHighlightingAndLineNumbers(common.removeEmptyTags(content)), variables));
  var sanitize = DOMPurify.sanitize;
  var handleContentClick = function handleContentClick(event) {
    handleTodoCheckboxClick(event, editorContentRef.current, onChange);
    onClick === null || onClick === void 0 || onClick(event);
  };
  var injectCopyButtonToCodeBlocks = function injectCopyButtonToCodeBlocks() {
    var _editorContentRef$cur;
    var preTags = (_editorContentRef$cur = editorContentRef.current) === null || _editorContentRef$cur === void 0 ? void 0 : _editorContentRef$cur.querySelectorAll(".".concat(common.EDITOR_CONTENT_CLASS_NAME, " pre"));
    preTags.forEach(function (preTag) {
      var button = document.createElement("div");
      button.className = "neeto-editor-codeblock-options";
      var root = client.createRoot(button);
      root.render( /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
        size: "small",
        style: "tertiary",
        value: preTag.textContent
      }));
      preTag.appendChild(button);
    });
  };
  var bindImageClickListener = function bindImageClickListener() {
    var _editorContentRef$cur2;
    var figureTags = (_editorContentRef$cur2 = editorContentRef.current) === null || _editorContentRef$cur2 === void 0 ? void 0 : _editorContentRef$cur2.querySelectorAll(".".concat(common.EDITOR_CONTENT_CLASS_NAME, " figure"));
    figureTags.forEach(function (figureTag) {
      var image = figureTag.querySelector("img");
      var link = figureTag.querySelector("a");
      if (ramda.isNil(image) || ramda.isNil(link)) return;
      figureTag.addEventListener("click", function (event) {
        event.preventDefault();
        var caption = figureTag.querySelector("figcaption").innerText;
        setImagePreviewDetails({
          src: image.src,
          caption: caption
        });
      });
    });
  };
  React.useEffect(function () {
    injectCopyButtonToCodeBlocks();
    bindImageClickListener();
    syncTodoCheckboxStates(editorContentRef.current);
    index$1.applyLineHighlighting(editorContentRef.current);
    configuration.enableHeaderLinks && buildHeaderLinks(editorContentRef.current);
  }, [content]);
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
    children: [/*#__PURE__*/jsxRuntime.jsx("div", _objectSpread({
      "data-cy": "neeto-editor-content",
      ref: editorContentRef,
      className: classnames(common.EDITOR_CONTENT_CLASS_NAME, _defineProperty(_defineProperty({}, className, className), "neeto-editor-size--".concat(size), true)),
      dangerouslySetInnerHTML: {
        __html: sanitize(htmlContent, common.SANITIZE_OPTIONS)
      },
      onClick: handleContentClick
    }, otherProps)), imagePreviewDetails && /*#__PURE__*/jsxRuntime.jsx(ImagePreview, {
      imagePreviewDetails: imagePreviewDetails,
      setImagePreviewDetails: setImagePreviewDetails
    })]
  });
};
var index = /*#__PURE__*/React.memo(EditorContent);

module.exports = index;
//# sourceMappingURL=EditorContent.cjs.js.map
