lexxy 0.1.14.beta → 0.1.16.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascript/lexxy.js +688 -268
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.min.js +2 -2
- data/app/assets/javascript/lexxy.min.js.br +0 -0
- data/app/assets/javascript/lexxy.min.js.gz +0 -0
- data/app/views/action_text/attachables/_remote_video.html.erb +3 -3
- data/lib/lexxy/version.rb +1 -1
- metadata +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DirectUpload } from '@rails/activestorage';
|
|
2
2
|
|
|
3
|
-
/*! @license DOMPurify 3.
|
|
3
|
+
/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
|
|
4
4
|
|
|
5
5
|
const {
|
|
6
6
|
entries,
|
|
@@ -29,12 +29,18 @@ if (!seal) {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
if (!apply) {
|
|
32
|
-
apply = function apply(
|
|
33
|
-
|
|
32
|
+
apply = function apply(func, thisArg) {
|
|
33
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
34
|
+
args[_key - 2] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
return func.apply(thisArg, args);
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
if (!construct) {
|
|
37
|
-
construct = function construct(Func
|
|
40
|
+
construct = function construct(Func) {
|
|
41
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
42
|
+
args[_key2 - 1] = arguments[_key2];
|
|
43
|
+
}
|
|
38
44
|
return new Func(...args);
|
|
39
45
|
};
|
|
40
46
|
}
|
|
@@ -63,8 +69,8 @@ function unapply(func) {
|
|
|
63
69
|
if (thisArg instanceof RegExp) {
|
|
64
70
|
thisArg.lastIndex = 0;
|
|
65
71
|
}
|
|
66
|
-
for (var
|
|
67
|
-
args[
|
|
72
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
73
|
+
args[_key3 - 1] = arguments[_key3];
|
|
68
74
|
}
|
|
69
75
|
return apply(func, thisArg, args);
|
|
70
76
|
};
|
|
@@ -75,12 +81,12 @@ function unapply(func) {
|
|
|
75
81
|
* @param func - The constructor function to be wrapped and called.
|
|
76
82
|
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
77
83
|
*/
|
|
78
|
-
function unconstruct(
|
|
84
|
+
function unconstruct(Func) {
|
|
79
85
|
return function () {
|
|
80
|
-
for (var
|
|
81
|
-
args[
|
|
86
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
87
|
+
args[_key4] = arguments[_key4];
|
|
82
88
|
}
|
|
83
|
-
return construct(
|
|
89
|
+
return construct(Func, args);
|
|
84
90
|
};
|
|
85
91
|
}
|
|
86
92
|
/**
|
|
@@ -179,8 +185,8 @@ function lookupGetter(object, prop) {
|
|
|
179
185
|
return fallbackValue;
|
|
180
186
|
}
|
|
181
187
|
|
|
182
|
-
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
183
|
-
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
188
|
+
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
189
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
184
190
|
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
185
191
|
// List of SVG elements that are disallowed by default.
|
|
186
192
|
// We still need to know them so that we can do namespace
|
|
@@ -193,8 +199,8 @@ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mgly
|
|
|
193
199
|
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
194
200
|
const text = freeze(['#text']);
|
|
195
201
|
|
|
196
|
-
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
197
|
-
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
202
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
203
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
198
204
|
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
199
205
|
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
200
206
|
|
|
@@ -292,7 +298,7 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
292
298
|
function createDOMPurify() {
|
|
293
299
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
294
300
|
const DOMPurify = root => createDOMPurify(root);
|
|
295
|
-
DOMPurify.version = '3.
|
|
301
|
+
DOMPurify.version = '3.3.0';
|
|
296
302
|
DOMPurify.removed = [];
|
|
297
303
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
298
304
|
// Not running in a browser, provide a factory function
|
|
@@ -403,6 +409,21 @@ function createDOMPurify() {
|
|
|
403
409
|
let FORBID_TAGS = null;
|
|
404
410
|
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
405
411
|
let FORBID_ATTR = null;
|
|
412
|
+
/* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
|
|
413
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
414
|
+
tagCheck: {
|
|
415
|
+
writable: true,
|
|
416
|
+
configurable: false,
|
|
417
|
+
enumerable: true,
|
|
418
|
+
value: null
|
|
419
|
+
},
|
|
420
|
+
attributeCheck: {
|
|
421
|
+
writable: true,
|
|
422
|
+
configurable: false,
|
|
423
|
+
enumerable: true,
|
|
424
|
+
value: null
|
|
425
|
+
}
|
|
426
|
+
}));
|
|
406
427
|
/* Decide if ARIA attributes are okay */
|
|
407
428
|
let ALLOW_ARIA_ATTR = true;
|
|
408
429
|
/* Decide if custom data attributes are okay */
|
|
@@ -595,16 +616,24 @@ function createDOMPurify() {
|
|
|
595
616
|
}
|
|
596
617
|
/* Merge configuration parameters */
|
|
597
618
|
if (cfg.ADD_TAGS) {
|
|
598
|
-
if (
|
|
599
|
-
|
|
619
|
+
if (typeof cfg.ADD_TAGS === 'function') {
|
|
620
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
621
|
+
} else {
|
|
622
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
623
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
624
|
+
}
|
|
625
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
600
626
|
}
|
|
601
|
-
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
602
627
|
}
|
|
603
628
|
if (cfg.ADD_ATTR) {
|
|
604
|
-
if (
|
|
605
|
-
|
|
629
|
+
if (typeof cfg.ADD_ATTR === 'function') {
|
|
630
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
631
|
+
} else {
|
|
632
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
633
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
634
|
+
}
|
|
635
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
606
636
|
}
|
|
607
|
-
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
608
637
|
}
|
|
609
638
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
610
639
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
@@ -912,7 +941,7 @@ function createDOMPurify() {
|
|
|
912
941
|
return true;
|
|
913
942
|
}
|
|
914
943
|
/* Remove element if anything forbids its presence */
|
|
915
|
-
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
944
|
+
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
|
|
916
945
|
/* Check if we have a custom element to handle */
|
|
917
946
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
918
947
|
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
@@ -984,12 +1013,12 @@ function createDOMPurify() {
|
|
|
984
1013
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
985
1014
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
986
1015
|
We don't need to check the value; it's always URI safe. */
|
|
987
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1016
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
988
1017
|
if (
|
|
989
1018
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
990
1019
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
991
1020
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
992
|
-
_isBasicCustomElement(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)) ||
|
|
1021
|
+
_isBasicCustomElement(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, lcTag)) ||
|
|
993
1022
|
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
994
1023
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
995
1024
|
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))) ; else {
|
|
@@ -1068,7 +1097,12 @@ function createDOMPurify() {
|
|
|
1068
1097
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1069
1098
|
}
|
|
1070
1099
|
/* Work around a security issue with comments inside attributes */
|
|
1071
|
-
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1100
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
|
|
1101
|
+
_removeAttribute(name, currentNode);
|
|
1102
|
+
continue;
|
|
1103
|
+
}
|
|
1104
|
+
/* Make sure we cannot easily use animated hrefs, even if animations are allowed */
|
|
1105
|
+
if (lcName === 'attributename' && stringMatch(value, 'href')) {
|
|
1072
1106
|
_removeAttribute(name, currentNode);
|
|
1073
1107
|
continue;
|
|
1074
1108
|
}
|
|
@@ -1349,7 +1383,7 @@ purify.addHook("uponSanitizeElement", (node, data) => {
|
|
|
1349
1383
|
*
|
|
1350
1384
|
*/
|
|
1351
1385
|
|
|
1352
|
-
function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const e="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,n=e&&"documentMode"in document?document.documentMode:null,r=e&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i=e&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!e||!("InputEvent"in window)||n)&&"getTargetRanges"in new window.InputEvent("input"),o=e&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),l=e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=e&&/Android/.test(navigator.userAgent),a=e&&/^(?=.*Chrome).*/i.test(navigator.userAgent),u=e&&c&&a,f$1=e&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!a;function d$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const h$4=1,g$3=3,_$3=9,p$1=11,y$4=0,m$4=1,x$3=2,C$3=0,S$4=1,v$4=2,b$2=4,N$3=8,A$2=128,O$3=1792|(112|(3|b$2|N$3)|A$2),D$4=1,P$3=2,F$2=3,L$3=4,I$5=5,z$5=6,K$3=o||l||f$1?" ":"",B$3="\n\n",R$5=i?" ":K$3,W$4="֑-߿יִ-﷽ﹰ-ﻼ",J$5="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",U$4=new RegExp("^[^"+J$5+"]*["+W$4+"]"),$$3=new RegExp("^[^"+W$4+"]*["+J$5+"]"),j$4={bold:1,capitalize:1024,code:16,highlight:A$2,italic:2,lowercase:256,strikethrough:b$2,subscript:32,superscript:64,underline:N$3,uppercase:512},V$3={directionless:1,unmergeable:2},Y$3={center:P$3,end:z$5,justify:L$3,left:D$4,right:F$2,start:I$5},H$1={[P$3]:"center",[z$5]:"end",[L$3]:"justify",[D$4]:"left",[F$2]:"right",[I$5]:"start"},q$4={normal:0,segmented:2,token:1},G$4={[C$3]:"normal",[v$4]:"segmented",[S$4]:"token"},X$4="$";function Q$3(t,e,n,r,i,s){let o=t.getFirstChild();for(;null!==o;){const t=o.__key;o.__parent===e&&(di(o)&&Q$3(o,t,n,r,i,s),n.has(t)||s.delete(t),i.push(t)),o=o.getNextSibling();}}const Z$3=100;let tt$2=false,et$2=0;function nt$2(t){et$2=t.timeStamp;}function rt$3(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==ds(t,n)}function it$4(t,e,n){const r=lo(Xs(n));let i=null,s=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,s=r.focusOffset);const o=t.nodeValue;null!==o&&Ns(e,o,i,s,false);}function st$3(t,e,n){if(cr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return ts(e)&&n.isAttached()}function ot$3(t,e,n,r){for(let i=t;i&&!No(i);i=$s(i)){const t=ds(i,e);if(void 0!==t){const e=us(t,n);if(e)return _i(e)||!fo(i)?void 0:[i,e]}else if(i===r)return [r,ys(n)]}}function lt$2(t,e,n){tt$2=true;const r=performance.now()-et$2>Z$3;try{ci(t,(()=>{const s=Nr()||function(t){return t.getEditorState().read((()=>{const t=Nr();return null!==t?t.clone():null}))}(t),o=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=ot$3(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&Qn(y)&&ts(g)&&st$3(s,g,y)&&it$4(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],s=fs(r),o=r.parentNode;if(null!=o&&r!==a&&null===s&&!rt$3(r,o,t)){if(i){const t=(fo(r)?r.innerText:null)||r.nodeValue;t&&(f+=t);}o.removeChild(r);}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(rt$3(r,g,t)||a===r)&&(g.appendChild(r),e++);}r!==e&&o.set(p,y);}}}if(o.size>0)for(const[e,n]of o)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],s=n.parentNode;null==s||"BR"!==n.nodeName||rt$3(n,i,t)||s.removeChild(n);}}n.takeRecords();}null!==s&&(u&&ms(s),i&&Rs(t)&&s.insertRawText(f));}));}finally{tt$2=false;}}function ct$3(t){const e=t._observer;if(null!==e){lt$2(t,e.takeRecords(),e);}}function at$1(t){!function(t){0===et$2&&Xs(t).addEventListener("textInput",nt$2,true);}(t),t._observer=new MutationObserver(((e,n)=>{lt$2(t,e,n);}));}let pt$4 = class pt{constructor(t,e=new Map,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedConfigMap=e,this.unknownState=n,this.knownState=r;const s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(e,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);return yt$4(t)?{[X$4]:t}:{}}getWritable(t){if(this.node===t)return this;const e=new Map(this.knownState),n=yt$4(r=this.unknownState)&&{...r};var r;if(n)for(const t of e.keys())delete n[t.key];return new pt(t,this.sharedConfigMap,yt$4(n),e,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||this.size++,r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState={},t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);this.unknownState=yt$4(this.unknownState);}};function yt$4(t){if(t)for(const e in t)return t}function mt$4(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new pt$4(e);return e.__state=n,n}function xt$3(t,e){const n=t.__mode,r=t.__format,i=t.__style,s=e.__mode,o=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===s)&&(null===r||r===o)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set,r=(t,e)=>{for(const[r,i]of t.knownState){if(n.has(r.key))continue;n.add(r.key);const t=e?e.getValue(r):r.defaultValue;if(t!==i&&!r.isEqual(t,i))return true}return false},i=(t,e)=>{const{unknownState:r}=t,i=e?e.unknownState:void 0;if(r)for(const[t,e]of Object.entries(r))if(!n.has(t)&&(n.add(t),e!==(i?i[t]:void 0)))return true;return false};return !(t&&r(t,e)||e&&r(e,t)||t&&i(t,e)||e&&i(e,t))}(c,a))}function Ct$2(t,e){const n=t.mergeWithSibling(e),r=qr()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function St$3(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&Qn(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(xt$3(e,r)){r=Ct$2(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&Qn(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(xt$3(r,n)){r=Ct$2(r,n);break}break}n.remove();}}else r.remove();}function vt$4(t){return kt$1(t.anchor),kt$1(t.focus),t}function kt$1(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),Qn(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!di(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let Tt$3,bt$1,Nt$3,wt$3,Et$2,Mt$1,At$1,Ot$1,Dt$1,Pt$2,Ft$2="",Lt$2="",It$2=null,zt="",Kt="",Bt$1=false,Rt$1=false,Wt=null;function Jt(t,e){const n=At$1.get(t);if(null!==e){const n=se$1(t);n.parentNode===e&&e.removeChild(n);}if(Ot$1.has(t)||bt$1._keyToDOMMap.delete(t),di(n)){const t=te(n,At$1);Ut(t,0,t.length-1,null);} void 0!==n&&Is(Pt$2,Nt$3,wt$3,n,"destroyed");}function Ut(t,e,n,r){let i=e;for(;i<=n;++i){const e=t[i];void 0!==e&&Jt(e,r);}}function $t$1(t,e){t.setProperty("text-align",e);}const jt="40px";function Vt(t,e){const n=Tt$3.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||jt;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`);}function Yt(t,e){const n=t.style;0===e?$t$1(n,""):e===D$4?$t$1(n,"left"):e===P$3?$t$1(n,"center"):e===F$2?$t$1(n,"right"):e===L$3?$t$1(n,"justify"):e===I$5?$t$1(n,"start"):e===z$5&&$t$1(n,"end");}function Ht(e,n){const r=Ot$1.get(e);void 0===r&&t(60);const i=r.createDOM(Tt$3,bt$1);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,bt$1),Qn(r)?i.setAttribute("data-lexical-text","true"):_i(r)&&i.setAttribute("data-lexical-decorator","true"),di(r)){const t=r.__indent,e=r.__size;if(0!==t&&Vt(i,t),0!==e){const t=e-1;!function(t,e,n,r){const i=Lt$2;Lt$2="",qt(t,n,0,e,n.getDOMSlot(r)),Qt(n,r),Lt$2=i;}(te(r,Ot$1),t,r,i);}const n=r.__format;0!==n&&Yt(i,n),r.isInline()||Xt(null,r,i),Js(r)&&(Ft$2+=B$3,Kt+=B$3);}else {const t=r.getTextContent();if(_i(r)){const t=r.decorate(bt$1,Tt$3);null!==t&&ne(e,t),i.contentEditable="false";}else Qn(r)&&(r.isDirectionless()||(Lt$2+=t));Ft$2+=t,Kt+=t;}return null!==n&&n.insertChild(i),Is(Pt$2,Nt$3,wt$3,r,"created"),i}function qt(t,e,n,r,i){const s=Ft$2;Ft$2="";let o=n;for(;o<=r;++o){Ht(t[o],i);const e=Ot$1.get(t[o]);null!==e&&Qn(e)&&(null===It$2&&(It$2=e.getFormat()),""===zt&&(zt=e.getStyle()));}Js(e)&&(Ft$2+=B$3);i.element.__lexicalTextContent=Ft$2,Ft$2=s+Ft$2;}function Gt(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return Fn(t)?"line-break":_i(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Xt(t,e,n){const r=Gt(t,At$1),i=Gt(e,Ot$1);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function Qt(t,e){const n=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(n!==Lt$2||r!==Wt){const n=""===Lt$2,i=n?Wt:function(t){if(U$4.test(t))return "rtl";if($$3.test(t))return "ltr";return null}(Lt$2);if(i!==r){const s=e.classList,o=Tt$3.theme;let l=null!==r?o[r]:void 0,c=null!==i?o[i]:void 0;if(void 0!==l){if("string"==typeof l){const t=d$2(l);l=o[r]=t;}s.remove(...l);}if(null===i||n&&"ltr"===i)e.removeAttribute("dir");else {if(void 0!==c){if("string"==typeof c){const t=d$2(c);c=o[i]=t;} void 0!==c&&s.add(...c);}e.dir=i;}if(!Rt$1){t.getWritable().__dir=i;}}Wt=i,e.__lexicalDirTextContent=Lt$2,e.__lexicalDir=i;}}function Zt(e,n,r){const i=Lt$2;var s;Lt$2="",It$2=null,zt="",function(e,n,r){const i=Ft$2,s=e.__size,o=n.__size;Ft$2="";const l=r.element;if(1===s&&1===o){const t=e.__first,r=n.__first;if(t===r)ee(t,l);else {const e=se$1(t),n=Ht(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const s=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(s)}throw i}Jt(t,null);}const i=Ot$1.get(r);Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}else {const i=te(e,At$1),c=te(n,Ot$1);if(i.length!==s&&t(227),c.length!==o&&t(228),0===s)0!==o&&qt(c,n,0,o-1,r);else if(0===o){if(0!==s){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Ut(i,0,s-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,s){const o=r-1,l=i-1;let c,a,u=s.getFirstChild(),f=0,d=0;for(;f<=o&&d<=l;){const t=e[f],r=n[d];if(t===r)u=re$1(ee(r,s.element)),f++,d++;else { void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const i=a.has(t),o=c.has(r);if(i)if(o){const t=Us(bt$1,r);t===u?u=re$1(ee(r,s.element)):(s.withBefore(u).insertChild(t),ee(r,s.element)),f++,d++;}else Ht(r,s.withBefore(u)),d++;else u=re$1(se$1(t)),Jt(t,s.element),f++;}const i=Ot$1.get(r);null!==i&&Qn(i)&&(null===It$2&&(It$2=i.getFormat()),""===zt&&(zt=i.getStyle()));}const h=f>o,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:bt$1.getElementByKey(e);qt(n,t,d,l,s.withBefore(r));}else g&&!h&&Ut(e,f,o,s.element);}(n,i,c,s,o,r);}Js(n)&&(Ft$2+=B$3);l.__lexicalTextContent=Ft$2,Ft$2=i+Ft$2;}(e,n,n.getDOMSlot(r)),Qt(n,r),s=n,null==It$2||It$2===s.__textFormat||Rt$1||s.setTextFormat(It$2),function(t){""===zt||zt===t.__textStyle||Rt$1||t.setTextStyle(zt);}(n),Lt$2=i;}function te(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function ee(e,n){const r=At$1.get(e);let i=Ot$1.get(e);void 0!==r&&void 0!==i||t(61);const s=Bt$1||Mt$1.has(e)||Et$2.has(e),o=Us(bt$1,e);if(r===i&&!s){if(di(r)){const t=o.__lexicalTextContent;void 0!==t&&(Ft$2+=t,Kt+=t);const e=o.__lexicalDirTextContent;void 0!==e&&(Lt$2+=e);}else {const t=r.getTextContent();Qn(r)&&!r.isDirectionless()&&(Lt$2+=t),Kt+=t,Ft$2+=t;}return o}if(r!==i&&s&&Is(Pt$2,Nt$3,wt$3,i,"updated"),i.updateDOM(r,o,Tt$3)){const r=Ht(e,null);return null===n&&t(62),n.replaceChild(r,o),Jt(e,null),r}if(di(r)&&di(i)){const t=i.__indent;t!==r.__indent&&Vt(o,t);const e=i.__format;e!==r.__format&&Yt(o,e),s&&(Zt(r,i,o),yi(i)||i.isInline()||Xt(r,i,o)),Js(i)&&(Ft$2+=B$3,Kt+=B$3);}else {const t=i.getTextContent();if(_i(i)){const t=i.decorate(bt$1,Tt$3);null!==t&&ne(e,t);}else Qn(i)&&!i.isDirectionless()&&(Lt$2+=t);Ft$2+=t,Kt+=t;}if(!Rt$1&&yi(i)&&i.__cachedText!==Kt){const t=i.getWritable();t.__cachedText=Kt,i=t;}return o}function ne(t,e){let n=bt$1._pendingDecorators;const r=bt$1._decorators;if(null===n){if(r[t]===e)return;n=gs(bt$1);}n[t]=e;}function re$1(t){let e=t.nextSibling;return null!==e&&e===bt$1._blockCursorElement&&(e=e.nextSibling),e}function ie$1(t,e,n,r,i,s){Ft$2="",Kt="",Lt$2="",Bt$1=r===x$3,Wt=null,bt$1=n,Tt$3=n._config,Nt$3=n._nodes,wt$3=bt$1._listeners.mutation,Et$2=i,Mt$1=s,At$1=t._nodeMap,Ot$1=e._nodeMap,Rt$1=e._readOnly,Dt$1=new Map(n._keyToDOMMap);const o=new Map;return Pt$2=o,ee("root",null),bt$1=void 0,Nt$3=void 0,Et$2=void 0,Mt$1=void 0,At$1=void 0,Ot$1=void 0,Tt$3=void 0,Dt$1=void 0,Pt$2=void 0,o}function se$1(e){const n=Dt$1.get(e);return void 0===n&&t(75,e),n}function oe$1(t){return {type:t}}const le$1=oe$1("SELECTION_CHANGE_COMMAND"),ce$1=oe$1("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),ae$1=oe$1("CLICK_COMMAND"),ue$1=oe$1("DELETE_CHARACTER_COMMAND"),fe$1=oe$1("INSERT_LINE_BREAK_COMMAND"),de$1=oe$1("INSERT_PARAGRAPH_COMMAND"),he$1=oe$1("CONTROLLED_TEXT_INSERTION_COMMAND"),ge$1=oe$1("PASTE_COMMAND"),_e$1=oe$1("REMOVE_TEXT_COMMAND"),pe$1=oe$1("DELETE_WORD_COMMAND"),ye$1=oe$1("DELETE_LINE_COMMAND"),me=oe$1("FORMAT_TEXT_COMMAND"),xe$1=oe$1("UNDO_COMMAND"),Ce$1=oe$1("REDO_COMMAND"),Se$1=oe$1("KEYDOWN_COMMAND"),ve$1=oe$1("KEY_ARROW_RIGHT_COMMAND"),ke$1=oe$1("MOVE_TO_END"),Te$1=oe$1("KEY_ARROW_LEFT_COMMAND"),be$1=oe$1("MOVE_TO_START"),Ne$1=oe$1("KEY_ARROW_UP_COMMAND"),we$1=oe$1("KEY_ARROW_DOWN_COMMAND"),Ee$1=oe$1("KEY_ENTER_COMMAND"),Me$1=oe$1("KEY_SPACE_COMMAND"),Ae$1=oe$1("KEY_BACKSPACE_COMMAND"),Oe$1=oe$1("KEY_ESCAPE_COMMAND"),De$1=oe$1("KEY_DELETE_COMMAND"),Pe$1=oe$1("KEY_TAB_COMMAND"),Fe$1=oe$1("INSERT_TAB_COMMAND"),Le$1=oe$1("INDENT_CONTENT_COMMAND"),Ie$1=oe$1("OUTDENT_CONTENT_COMMAND"),ze$1=oe$1("DROP_COMMAND"),Ke$1=oe$1("FORMAT_ELEMENT_COMMAND"),Be$1=oe$1("DRAGSTART_COMMAND"),Re$1=oe$1("DRAGOVER_COMMAND"),We$1=oe$1("DRAGEND_COMMAND"),Je$1=oe$1("COPY_COMMAND"),Ue$1=oe$1("CUT_COMMAND"),$e$1=oe$1("SELECT_ALL_COMMAND"),je$1=oe$1("CLEAR_EDITOR_COMMAND"),Ve=oe$1("CLEAR_HISTORY_COMMAND"),Ye=oe$1("CAN_REDO_COMMAND"),He$1=oe$1("CAN_UNDO_COMMAND"),qe$1=oe$1("FOCUS_COMMAND"),Ge$1=oe$1("BLUR_COMMAND"),Xe$1=oe$1("KEY_MODIFIER_COMMAND"),Qe$1=Object.freeze({}),Ze$1=30,tn=[["keydown",function(t,e){if(en=t.timeStamp,nn=t.key,e.isComposing())return;if(Ws(e,Se$1,t))return;if(null==t.key)return;if(fn&&Ds(t))return ci(e,(()=>{Sn(e,dn);})),fn=false,void(dn="");if(function(t){return Ms(t,"ArrowRight",{shiftKey:"any"})}(t))Ws(e,ve$1,t);else if(function(t){return Ms(t,"ArrowRight",As)}(t))Ws(e,ke$1,t);else if(function(t){return Ms(t,"ArrowLeft",{shiftKey:"any"})}(t))Ws(e,Te$1,t);else if(function(t){return Ms(t,"ArrowLeft",As)}(t))Ws(e,be$1,t);else if(function(t){return Ms(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Ws(e,Ne$1,t);else if(function(t){return Ms(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Ws(e,we$1,t);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))an=true,Ws(e,Ee$1,t);else if(function(t){return " "===t.key}(t))Ws(e,Me$1,t);else if(function(t){return r&&Ms(t,"o",{ctrlKey:true})}(t))t.preventDefault(),an=true,Ws(e,fe$1,true);else if(function(t){return Ms(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))an=false,Ws(e,Ee$1,t);else if(function(t){return Ms(t,"Backspace",{shiftKey:"any"})||r&&Ms(t,"h",{ctrlKey:true})}(t))Ds(t)?Ws(e,Ae$1,t):(t.preventDefault(),Ws(e,ue$1,true));else if(function(t){return "Escape"===t.key}(t))Ws(e,Oe$1,t);else if(function(t){return Ms(t,"Delete",{})||r&&Ms(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),Ws(e,ue$1,false)):Ws(e,De$1,t);else if(function(t){return Ms(t,"Backspace",Os)}(t))t.preventDefault(),Ws(e,pe$1,true);else if(function(t){return Ms(t,"Delete",Os)}(t))t.preventDefault(),Ws(e,pe$1,false);else if(function(t){return r&&Ms(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),Ws(e,ye$1,true);else if(function(t){return r&&(Ms(t,"Delete",{metaKey:true})||Ms(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),Ws(e,ye$1,false);else if(function(t){return Ms(t,"b",As)}(t))t.preventDefault(),Ws(e,me,"bold");else if(function(t){return Ms(t,"u",As)}(t))t.preventDefault(),Ws(e,me,"underline");else if(function(t){return Ms(t,"i",As)}(t))t.preventDefault(),Ws(e,me,"italic");else if(function(t){return Ms(t,"Tab",{shiftKey:"any"})}(t))Ws(e,Pe$1,t);else if(function(t){return Ms(t,"z",As)}(t))t.preventDefault(),Ws(e,xe$1,void 0);else if(function(t){if(r)return Ms(t,"z",{metaKey:true,shiftKey:true});return Ms(t,"y",{ctrlKey:true})||Ms(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),Ws(e,Ce$1,void 0);else {const n=e._editorState._selection;null===n||cr(n)?Ps(t)&&(t.preventDefault(),Ws(e,$e$1,t)):!function(t){return Ms(t,"c",As)}(t)?!function(t){return Ms(t,"x",As)}(t)?Ps(t)&&(t.preventDefault(),Ws(e,$e$1,t)):(t.preventDefault(),Ws(e,Ue$1,t)):(t.preventDefault(),Ws(e,Je$1,t));}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&Ws(e,Xe$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;ho(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&ci(e,(()=>{Vi(n)||(cn=true);}));}],["compositionstart",function(t,e){ci(e,(()=>{const n=Nr();if(cr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();cs(r.key),(t.timeStamp<en+Ze$1||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||Qn(i)&&i.getStyle()!==n.style)&&Ws(e,he$1,R$5);}}));}],["compositionend",function(t,e){i?un=true:l||!o&&!f$1?ci(e,(()=>{Sn(e,t.data);})):(fn=true,dn=t.data);}],["input",function(t,e){t.stopPropagation(),ci(e,(()=>{if(fo(t.target)&&Vi(t.target))return;const n=Nr(),r=t.data,c=Cn(t);if(null!=r&&cr(n)&&_n(n,c,r,t.timeStamp,false)){un&&(Sn(e,r),un=false);const c=n.anchor.getNode(),a=lo(Xs(e));if(null===a)return;const u=n.isBackward(),d=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&Qn(c)&&null!==a.anchorNode&&c.getTextContent().slice(0,d)+r+c.getTextContent().slice(d+h)===Ts(a.anchorNode)||Ws(e,he$1,r);const g=r.length;i&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),o||l||f$1||!e.isComposing()||(en=0,cs(null));}else {bs(false,e,null!==r?r:void 0),un&&(Sn(e,r||void 0),un=false);}!function(){Vr();const t=qr();ct$3(t);}();}),{event:t}),sn=null;}],["click",function(t,e){ci(e,(()=>{const n=Nr(),r=lo(Xs(e)),i=wr();if(r)if(cr(n)){const e=n.anchor,s=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!yi(s)&&1===ps().getChildrenSize()&&s.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(s!==n.focus.getNode()){const t=function(t,e){let n=t;for(;n!==ps()&&null!=n;){if(e(n))return n;n=n.getParent();}return null}(s,(t=>di(t)&&!t.isInline()));di(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(fo(n)||ts(n)){ms(br(i,r,e,t));}}Ws(e,ae$1,t);}));}],["cut",Qe$1],["copy",Qe$1],["dragstart",Qe$1],["dragover",Qe$1],["dragend",Qe$1],["paste",Qe$1],["focus",Qe$1],["blur",Qe$1],["drop",Qe$1]];s&&tn.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,s=Cn(e);if("deleteCompositionText"===r||i&&Rs(n))return;if("insertCompositionText"===r)return;ci(n,(()=>{const i=Nr();if("deleteContentBackward"===r){if(null===i){const t=wr();if(!cr(t))return;ms(t.clone());}if(cr(i)){const r=i.anchor.key===i.focus.key;if(o=e.timeStamp,"MediaLast"===nn&&o<en+Ze$1&&n.isComposing()&&r){if(cs(null),en=0,setTimeout((()=>{ci(n,(()=>{cs(null);}));}),Ze$1),cr(i)){const e=i.anchor.getNode();e.markDirty(),Qn(e)||t(142),xn(i,e);}}else {cs(null),e.preventDefault();const t=i.anchor.getNode(),s=t.getTextContent(),o=t.canInsertTextAfter(),l=0===i.anchor.offset&&i.focus.offset===s.length;let c=u&&r&&!l&&o;if(c&&i.isCollapsed()&&(c=!_i(Bs(i.anchor,true))),!c){Ws(n,ue$1,true);const t=Nr();u&&cr(t)&&t.isCollapsed()&&(hn=t,setTimeout((()=>hn=null)));}}return}}var o;if(!cr(i))return;const c=e.data;null!==sn&&bs(false,n,sn),i.dirty&&null===sn||!i.isCollapsed()||yi(i.anchor.getNode())||null===s||i.applyDOMRange(s),sn=null;const a=i.anchor,f=i.focus,d=a.getNode(),h=f.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":Ws(n,he$1,e);break;case "insertFromComposition":cs(null),Ws(n,he$1,e);break;case "insertLineBreak":cs(null),Ws(n,fe$1,false);break;case "insertParagraph":cs(null),an&&!l?(an=false,Ws(n,fe$1,false)):Ws(n,de$1,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":Ws(n,ge$1,e);break;case "deleteByComposition":(function(t,e){return t!==e||di(t)||di(e)||!Qi(t)||!Qi(e)})(d,h)&&Ws(n,_e$1,e);break;case "deleteByDrag":case "deleteByCut":Ws(n,_e$1,e);break;case "deleteContent":Ws(n,ue$1,false);break;case "deleteWordBackward":Ws(n,pe$1,true);break;case "deleteWordForward":Ws(n,pe$1,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":Ws(n,ye$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":Ws(n,ye$1,false);break;case "formatStrikeThrough":Ws(n,me,"strikethrough");break;case "formatBold":Ws(n,me,"bold");break;case "formatItalic":Ws(n,me,"italic");break;case "formatUnderline":Ws(n,me,"underline");break;case "historyUndo":Ws(n,xe$1,void 0);break;case "historyRedo":Ws(n,Ce$1,void 0);}else {if("\n"===c)e.preventDefault(),Ws(n,fe$1,false);else if(c===B$3)e.preventDefault(),Ws(n,de$1,void 0);else if(null==c&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),i.insertRawText(t);}else null!=c&&_n(i,s,c,e.timeStamp,true)?(e.preventDefault(),Ws(n,he$1,c)):sn=c;rn=e.timeStamp;}}));}(e,n)]);let en=0,nn=null,rn=0,sn=null;const on=new WeakMap;let ln=false,cn=false,an=false,un=false,fn=false,dn="",hn=null,gn=[0,"",0,"root",0];function _n(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=qr(),u=lo(Xs(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!Qn(c)||(!i&&(!s||rn<r+50)||c.isDirty()&&g<2||Ss(n))&&o.offset!==l.offset&&!c.isComposing()||Zi(c)||c.isDirty()&&g>1||(i||!s)&&null!==h&&!c.isComposing()&&f!==ns(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=Qi(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (Qn(e)||di(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function pn(t,e){return ts(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function yn(e,n,r){const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:l}=e;ln&&(ln=false,pn(i,s)&&pn(o,l)&&!hn)||ci(n,(()=>{if(!r)return void ms(null);if(!Hi(n,i,o))return;let c=Nr();if(hn&&cr(c)&&c.isCollapsed()){const t=c.anchor,e=hn.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=hn.clone(),ms(c));}if(hn=null,cr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const s=Xs(n).event,o=s?s.timeStamp:performance.now(),[l,a,u,f,d]=gn,h=ps(),g=false===n.isComposing()&&""===h.getTextContent();if(o<d+200&&r.offset===u&&r.key===f)mn(c,l,a);else if("text"===r.type)Qn(i)||t(141),xn(c,i);else if("element"===r.type&&!g){di(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();mn(t,n,r);}(c,e):mn(c,0,"");}}else {const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,o=c.isBackward(),a=o?l:s,u=o?s:l,f=o?e:t,d=o?t:e;let h=O$3,g=false;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(Qn(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=true,h&=e.getFormat(),0===h))break}c.format=g?h:0;}}Ws(n,le$1,void 0);}));}function mn(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=true);}function xn(t,e){mn(t,e.getFormat(),e.getStyle());}function Cn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function Sn(t,e){const n=t._compositionKey;if(cs(null),null!==n&&null!=e){if(""===e){const e=us(n),r=ns(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&Qn(e)&&Ns(e,r.nodeValue,null,null,true))}if("\n"===e[e.length-1]){const e=Nr();if(cr(e)){const n=e.focus;return e.anchor.set(n.key,n.offset,n.type),void Ws(t,Ee$1,null)}}}bs(true,t,e);}function vn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const kn=new Map;function Tn(t){const e=co(t.target);if(null===e)return;const n=Gi(e.anchorNode);if(null===n)return;cn&&(cn=false,ci(n,(()=>{const r=wr(),i=e.anchorNode;if(fo(i)||ts(i)){ms(br(r,e,n,t));}})));const r=vs(n),i=r[r.length-1],s=i._key,o=kn.get(s),l=o||i;l!==n&&yn(e,l,false),yn(e,n,true),n!==i?kn.set(s,n):o&&kn.delete(s);}function bn(t){t._lexicalHandled=true;}function Nn(t){return true===t._lexicalHandled}function En(e){const n=e.ownerDocument,r=on.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),on.set(n,i),0===i&&n.removeEventListener("selectionchange",Tn);const s=Xi(e);qi(s)?(!function(t){if(null!==t._parentEditor){const e=vs(t),n=e[e.length-1]._key;kn.get(n)===t&&kn.delete(n);}else kn.delete(t._key);}(s),e.__lexicalEditor=null):s&&t(198);const o=vn(e);for(let t=0;t<o.length;t++)o[t]();e.__lexicalEventHandles=[];}function Mn(t,e,n){Vr();const r=t.__key,i=t.getParent();if(null===i)return;const s=function(t){const e=Nr();if(!cr(e)||!di(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),s=r.getNode();qs(i,t)&&n.set(t.__key,0,"element");qs(s,t)&&r.set(t.__key,0,"element");return e}(t);let o=false;if(cr(s)&&e){const e=s.anchor,n=s.focus;e.key===r&&(Ar(e,t,i,t.getPreviousSibling(),t.getNextSibling()),o=true),n.key===r&&(Ar(n,t,i,t.getPreviousSibling(),t.getNextSibling()),o=true);}else ur(s)&&e&&t.isSelected()&&t.selectPrevious();if(cr(s)&&e&&!o){const e=t.getIndexWithinParent();os(t),Er(s,i,e,-1);}else os(t);n||to(i)||i.canBeEmpty()||!i.isEmpty()||Mn(i,e),e&&s&&yi(i)&&i.isEmpty()&&i.selectEnd();}class An{static getType(){t(64,this.name);}static clone(e){t(65,this.name);}afterCloneFrom(t){this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state;}constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:true,enumerable:false,value:void 0,writable:true}),ss(this,t);}getType(){return this.__type}isInline(){t(137,this.constructor.name);}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return true;const e=us(t);if(null===e)break;t=e.__parent;}return false}isSelected(t){const e=t||Nr();if(null==e)return false;const n=e.getNodes().some((t=>t.__key===this.__key));if(Qn(this))return n;if(cr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(_i(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:us(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(to(n))return di(e)||e===this&&_i(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:us(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:us(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=di(this)?this:this.getParent(),n=di(t)?t:t.getParent(),r=e&&n?ol(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=ol(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===rl(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=ol(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let s=this;for(;null!==s;){const o=s.__key;if(i.has(o)||(i.add(o),r.push(s)),s===e)break;const l=di(s)?n?s.getFirstChild():s.getLastChild():null;if(null!==l){s=l;continue}const c=n?s.getNextSibling():s.getPreviousSibling();if(null!==c){s=c;continue}const a=s.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);s=u;}return n||r.reverse(),r}isDirty(){const t=qr()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){const e=us(this.__key);return null===e&&t(113),e}getWritable(){Vr();const t=Hr(),e=qr(),n=t._nodeMap,r=this.__key,i=this.getLatest(),s=e._cloneNotNeeded,o=Nr();if(null!==o&&o.setCachedNodes(null),s.has(r))return ls(i),i;const l=ko(i);return s.add(r),ls(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable();return (e||n.__state)&&mt$4(t).updateFromJSON(e),n}(this,t.$)}static transform(){return null}remove(t){Mn(this,true,t);}replace(e,n){Vr();let r=Nr();null!==r&&(r=r.clone()),ro(this,e);const i=this.getLatest(),s=this.__key,o=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;os(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(Mn(i,false,true),null===u)c.__first=o;else {u.getWritable().__next=o;}if(l.__prev=d,null===f)c.__last=o;else {f.getWritable().__prev=o;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(di(this)&&di(l)||t(139),this.getChildren().forEach((t=>{l.append(t);}))),cr(r)){ms(r);const t=r.anchor,e=r.focus;t.key===s&&or(t,l),e.key===s&&or(e,l);}return as()===s&&cs(o),l}insertAfter(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),s=Nr();let o=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(os(r),cr(s)){const t=i.__key,n=s.anchor,r=s.focus;o="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&cr(s)){const t=this.getIndexWithinParent();Er(s,a,t+1);const e=a.__key;o&&s.anchor.set(e,t+2,"element"),l&&s.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){Vr(),ro(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;os(r);const s=this.getPreviousSibling(),o=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===s)o.__first=i;else {s.getWritable().__next=i;}o.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Nr();if(e&&cr(a)){Er(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Pi()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){Vr();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(di(n))return n.select();if(!Qn(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){Vr();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(di(n))return n.select(0,0);if(!Qn(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}class On extends An{static getType(){return "linebreak"}static clone(t){return new On(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&Ln(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&po(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&Ln(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&Ln(r))return true}return false}(t)?null:{conversion:Dn,priority:0}}}static importJSON(t){return Pn().updateFromJSON(t)}}function Dn(t){return {node:Pn()}}function Pn(){return no(new On)}function Fn(t){return t instanceof On}function Ln(t){return ts(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function In(t,e){return 16&e?"code":e&A$2?"mark":32&e?"sub":64&e?"sup":null}function zn(t,e){return 1&e?"strong":2&e?"em":"span"}function Kn(t,e,n,r,i){const s=r.classList;let o=Ls(i,"base");void 0!==o&&s.add(...o),o=Ls(i,"underlineStrikethrough");let l=false;const c=e&N$3&&e&b$2;void 0!==o&&(n&N$3&&n&b$2?(l=true,c||s.add(...o)):c&&s.remove(...o));for(const t in j$4){const r=j$4[t];if(o=Ls(i,t),void 0!==o)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&s.remove(...o);continue}e&r&&(!c||"underline"!==t)&&"strikethrough"!==t||s.add(...o);}else e&r&&s.remove(...o);}}function Bn(t,e,n){const r=e.firstChild,s=n.isComposing(),o=t+(s?K$3:"");if(null==r)e.textContent=o;else {const t=r.nodeValue;if(t!==o)if(s||i){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,s=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;s+i<n&&s+i<r&&t[n-s-1]===e[r-s-1];)s++;return [i,n-i-s,e.slice(i,r-s)]}(t,o);0!==n&&r.deleteData(e,n),r.insertData(e,i);}else r.nodeValue=o;}}function Rn(t,e,n,r,i,s){Bn(i,t,e);const o=s.theme.text;void 0!==o&&Kn(0,0,r,t,o);}function Wn(t,e){const n=document.createElement(e);return n.appendChild(t),n}class Jn extends An{static getType(){return "text"}static clone(t){return new Jn(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail;}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0;}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return G$4[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===as()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return !!(1&this.getLatest().__detail)}isUnmergeable(){return !!(2&this.getLatest().__detail)}hasFormat(t){const e=j$4[t];return !!(this.getFormat()&e)}isSimpleText(){return "text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return rs(this.getLatest().__format,t,e)}canHaveFormat(){return true}isInline(){return true}createDOM(t,e){const n=this.__format,r=In(0,n),i=zn(0,n),s=null===r?i:r,o=document.createElement(s);let l=o;this.hasFormat("code")&&o.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),o.appendChild(l));Rn(l,this,0,n,this.__text,t);const c=this.__style;return ""!==c&&(o.style.cssText=c),o}updateDOM(e,n,r){const i=this.__text,s=e.__format,o=this.__format,l=In(0,s),c=In(0,o),a=zn(0,s),u=zn(0,o);if((null===l?a:l)!==(null===c?u:c))return true;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const s=document.createElement(u);return Rn(s,this,0,o,i,r),n.replaceChild(s,e),false}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),Bn(i,f,this);const d=r.theme.text;void 0!==d&&s!==o&&Kn(0,s,o,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),false}static importDOM(){return {"#text":()=>({conversion:Yn,priority:0}),b:()=>({conversion:$n,priority:0}),code:()=>({conversion:Gn,priority:0}),em:()=>({conversion:Gn,priority:0}),i:()=>({conversion:Gn,priority:0}),mark:()=>({conversion:Gn,priority:0}),s:()=>({conversion:Gn,priority:0}),span:()=>({conversion:Un,priority:0}),strong:()=>({conversion:Gn,priority:0}),sub:()=>({conversion:Gn,priority:0}),sup:()=>({conversion:Gn,priority:0}),u:()=>({conversion:Gn,priority:0})}}static importJSON(t){return Xn().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return fo(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Wn(n,"b")),this.hasFormat("italic")&&(n=Wn(n,"i")),this.hasFormat("strikethrough")&&(n=Wn(n,"s")),this.hasFormat("underline")&&(n=Wn(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?j$4[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?V$3[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=rs(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=q$4[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){Vr();let n=t,r=e;const i=Nr(),s=this.getTextContent(),o=this.__key;if("string"==typeof s){const t=s.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!cr(i))return Sr(o,n,o,r,"text","text");{const t=as();t!==i.anchor.key&&t!==i.focus.key||cs(o),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),s=i.__text,o=n.length;let l=t;l<0&&(l=o+l,l<0&&(l=0));const c=Nr();if(r&&cr(c)){const e=t+o;c.setTextNodeRange(i,e,i,e);}const a=s.slice(0,l)+n+s.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){Vr();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=as(),s=n.length;t.sort(((t,e)=>t-e)),t.push(s);const o=[],l=t.length;for(let e=0,r=0;e<s&&r<=l;r++){const i=t[r];i>e&&(o.push(n.slice(e,i)),e=i);}const c=o.length;if(1===c)return [e];const a=o[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=Nr();if(cr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=Xn(a),f.__format=d,f.__style=h,f.__detail=g,_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const e=Xn(o[t]);e.__format=d,e.__style=h,e.__detail=g;const n=e.__key;i===r&&cs(n),x.push(e);}const C=p?p.offset:null,S=y?y.offset:null;let v=0;for(const t of x){if(!p&&!y)break;const e=v+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=v&&(p.set(t.getKey(),C-v,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&ls(e);null!==n&&ls(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),cr(m)&&Er(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,s=this.__text,o=s.length;as()===i&&cs(r);const l=Nr();if(cr(l)){const t=l.anchor,s=l.focus;null!==t&&t.key===i&&Or(t,n,r,e,o),null!==s&&s.key===i&&Or(s,n,r,e,o);}const c=e.__text,a=n?c+s:s+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function Un(t){return {forChild:Zn(t.style),node:null}}function $n(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:Zn(e.style,n?void 0:"bold"),node:null}}const jn=new WeakMap;function Vn(t){if(!fo(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function Yn(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=jn.get(n))&&!Vn(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)jn.set(r[t],i);return i}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(Pn()):"\t"===n?e.push(er()):""!==n&&e.push(Xn(n));}return {node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return {node:null};if(" "===r[0]){let t=n,e=true;for(;null!==t&&null!==(t=Hn(t,false));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=Hn(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:Xn(r)}}function Hn(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,fo(n)){const t=n.style.display;if(""===t&&!_o(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(ts(n))return n;if("BR"===n.nodeName)return null}}const qn={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function Gn(t){const e=qn[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:Zn(t.style,e),node:null}}function Xn(t=""){return no(new Jn(t))}function Qn(t){return t instanceof Jn}function Zn(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,s=r.includes("line-through"),o="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>Qn(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),s&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),o&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class tr extends Jn{static getType(){return "tab"}static clone(t){return new tr(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=Ls(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return er().updateFromJSON(t)}setTextContent(e){return "\t"!==e&&""!==e&&t(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function er(){return no(new tr)}function nr(t){return t instanceof tr}class rr{constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return nl(pl(ll(this,"next")),pl(ll(t,"next")))<0}getNode(){const e=us(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,s=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,jr()||(as()===s&&cs(t),null!==i&&(i.setCachedNodes(null),i.dirty=true)));}}function ir(t,e,n){return new rr(t,e,n)}function sr(t,e){let n=e.__key,r=t.offset,i="element";if(Qn(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t);}else if(!di(e)){const t=e.getNextSibling();if(Qn(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function or(t,e){if(di(e)){const n=e.getLastDescendant();di(n)||Qn(n)?sr(t,n):sr(t,e);}else sr(t,e);}class lr{constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!ur(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every((t=>n.has(t)))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new lr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(Qn(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove();}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=us(t);null!==e&&n.push(e);}return jr()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((Nr()||wr())===this&&t[0]){const e=Jo(t[0],"next");al(tl(e,e));}for(const e of t)e.remove();}}function cr(t){return t instanceof ar}class ar{constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){return !!cr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,s=new Set;for(const n of t)if(Ko(n)){const{origin:t}=n;0===e.length?i.add(t):(s.add(t),e.push(t));}else {const{origin:t}=n;di(t)&&s.has(t)||e.push(t);}r&&e.push(r.caret.origin);if(zo(t.focus)&&di(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=Vo(t.focus.origin,"previous");Ko(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=Ho(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!di(t)||s.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=pl(t.anchor),r=pl(t.anchor.getFlipped()),i=t=>Lo(t)?t.origin:t.getNodeAtCaret(),s=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(s);}return e}(xl(fl(this),"next"));return jr()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,s=r.isBefore(i),[o,l]=dr(this);let c="",a=true;for(let u=0;u<t.length;u++){const f=t[u];if(di(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=false,Qn(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=o<l?t.slice(o,l):t.slice(l,o)):t=s?t.slice(o):t.slice(l):f===n&&(t=s?t.slice(0,l):t.slice(0,o)),c+=t;}else !_i(f)&&!Fn(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent());}return c}applyDOMRange(t){const e=qr(),n=e.getEditorState()._selection,r=xr(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,s]=r;this.anchor.set(i.key,i.offset,i.type,true),this.focus.set(s.key,s.offset,s.type,true),vt$4(this);}clone(){const t=this.anchor,e=this.focus;return new ar(ir(t.key,t.offset,t.type),ir(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=rs(this.format,t,null),this.dirty=true;}setStyle(t){this.style=t,this.dirty=true;}hasFormat(t){const e=j$4[t];return !!(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(Pn()):"\t"===r?n.push(er()):n.push(Xn(r));}this.insertNodes(n);}insertText(e){const n=this.anchor,r=this.focus,i=this.format,s=this.style;let o=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(o=r,l=n),"element"===o.type&&function(t,e,n,r){const i=t.getNode(),s=i.getChildAtIndex(t.offset),o=Xn(),l=yi(i)?Pi().append(o):o;o.setFormat(n),o.setStyle(r),null===s?i.append(l):s.insertBefore(l),t.is(e)&&e.set(o.__key,0,"text"),t.set(o.__key,0,"text");}(o,l,i,s),"element"===l.type&&cl(l,pl(ll(l,"next")));const c=o.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];Qn(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(o.key,a,"text")),this.isCollapsed()&&c===h&&(Zi(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(Qn(t)&&t.canInsertTextBefore()&&!Zi(t)||(t=Xn(),t.setFormat(i),t.setStyle(s),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(Zi(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(Qn(t)&&!Zi(t)||(t=Xn(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=Xn(d.getTextContent());t.setFormat(i),d.replace(t),d=t;}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||di(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),mr(this.anchor,this.focus,null),void this.insertText(e)}if(1===f){if(Qi(d)){const t=Xn(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===s){if(nr(d)){const t=Xn(e);return t.setFormat(i),t.setStyle(s),t.select(),void d.replace(t)}}else {if(""!==d.getTextContent()){const t=Xn(e);if(t.setFormat(i),t.setStyle(s),t.select(),0===c)d.insertBefore(t,false);else {const[e]=d.splitText(c);e.insertAfter(t,false);}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(i),d.setStyle(s);}const r=a-c;d=d.spliceText(c,r,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n));}else {const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=di(d)?d:d.getParentOrThrow();let r=di(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow();}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(Qn(_)&&!Qi(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=Xn(_.getTextContent());_.replace(t),_=t;}yi(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key);}else {const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove();}else t.add(_.__key);const s=r.getChildren(),o=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=s.length-1;t>=0;t--){const e=s[t];if(e.is(d)||di(e)&&e.isParentOf(d))break;e.isAttached()&&(!o.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(Qi(d))if(c===h)d.select();else {const t=Xn(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove();}}}removeText(){const t=Nr()===this;ul(this,_l(fl(this))),t&&Nr()!==this&&ms(this);}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void cs(null);const n=this.getNodes(),r=[];for(const t of n)Qn(t)&&r.push(t);const i=e=>{n.forEach((n=>{if(di(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}}));},s=r.length;if(0===s)return this.toggleFormat(t),cs(null),void i(e);const o=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:o,u=c?o:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=s-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(Zi(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||Zi(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||Zi(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Nr();return cr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=mo(n,yo),i=e[e.length-1];if(di(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=Ir(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some((t=>(di(t)||_i(t))&&!t.isInline()))){di(r)||t(211,n.constructor.name,n.getType());const s=Ir(this);return r.splice(s,0,e),void i.selectEnd()}const s=function(t){const e=Pi();let n=null;for(let r=0;r<t.length;r++){const i=t[r],s=Fn(i);if(s||_i(i)&&i.isInline()||di(i)&&i.isInline()||Qn(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),s))continue;null!==n&&n.append(i);}else e.append(i),n=null;}return e}(e),o=s.getLastDescendant(),l=s.getChildren(),c=!di(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;di(f=u)&&yo(f)&&!f.isEmpty()&&di(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(di(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n,r){const i=n.getParentOrThrow().getLastChild();let s=n;const o=[n];for(;s!==i;)s.getNextSibling()||t(140),s=s.getNextSibling(),o.push(s);let l=e;for(const t of o)l=l.insertAfter(t);}(r,u));const d=mo(o,yo);c&&di(d)&&(c.canMergeWhenEmpty()||yo(a))&&(d.append(...c.getChildren()),c.remove()),di(r)&&r.isEmpty()&&r.remove(),o.selectEnd();const h=di(r)?r.getLastChild():null;Fn(h)&&d!==r&&h.remove();}insertParagraph(){if("root"===this.anchor.key){const t=Pi();return ps().splice(this.anchor.offset,0,[t]),t.select(),t}const e=Ir(this),n=mo(this.anchor.getNode(),yo);di(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],s=n.insertNewAfter(this,false);return s?(s.append(...i),s.selectStart(),s):null}insertLineBreak(t){const e=Pn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n);}}extract(){const t=this.getNodes(),e=t.length,n=e-1,r=this.anchor,i=this.focus;let s=t[0],o=t[n];const[l,c]=dr(this);if(0===e)return [];if(1===e){if(Qn(s)&&!this.isCollapsed()){const t=l>c?c:l,e=l>c?l:c,n=s.splitText(t,e),r=0===t?n[0]:n[1];return null!=r?[r]:[]}return [s]}const a=r.isBefore(i);if(Qn(s)){const e=a?l:c;e===s.getTextContentSize()?t.shift():0!==e&&([,s]=s.splitText(e),t[0]=s);}if(Qn(o)){const e=o.getTextContent().length,r=a?c:l;0===r?t.pop():r!==e&&([o]=o.splitText(r),t[n]=o);}return t}modify(t,e,n){if(Kr(this,t,e,n))return;const r="move"===t,i=qr(),s=lo(Xs(i));if(!s)return;const o=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===o||!di(c)||c.isInline()||c.canBeEmpty()||oo(o,i,l),this.dirty){let t=Us(i,this.anchor.key),e=Us(i,this.focus.key);"text"===this.anchor.type&&(t=ns(t)),"text"===this.focus.type&&(e=ns(e)),t&&e&&Dr(s,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(s,t,e?"backward":"forward",n),s.rangeCount>0){const t=s.getRangeAt(0),n=this.anchor.getNode(),i=yi(n)?n:Zs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let o=false;for(let t=0;t<n.length;t++){const e=n[t];qs(e,i)?r.push(e):o=true;}if(o&&r.length>0)if(e){const t=r[0];di(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];di(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}s.anchorNode===t.startContainer&&s.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,s=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,s,true);}(this);}}"lineboundary"===n&&Kr(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&di(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(di(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=Qo(ll(e,t?"previous":"next"));if(r.getTextSlices().every((t=>null===t||0===t.distance))){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(Ko(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(di(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=pl(e);ul(this,tl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(zo(e)){if(di(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(_i(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&di(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=kr();t.add(e.origin.getKey()),ms(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return ul(this,tl(!e.origin.isEmpty()&&n.isEmpty()?dl(Jo(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&hr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,s=r.getTextContentSize();if(r.is(n)||t&&e!==s||!t&&0!==e)return void _r(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,s=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==s)return void _r(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),s=r.getNode();if(i===s&&"text"===n.type&&"text"===r.type){const t=n.offset,s=r.offset,o=t<s,l=o?t:s,c=o?s:t,a=c-1;if(l!==a){(function(t){return !(Ss(t)||gr(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type));}}}(this,t);}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&yi(t.getParent())&&null===t.getPreviousSibling()&&hr(this,t);}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText();}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word");}this.removeText();}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return [this.anchor,this.focus]}}function ur(t){return t instanceof lr}function fr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function dr(t){const e=t.getStartEndPoints();if(null===e)return [0,0];const[n,r]=e;return "element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[fr(n),fr(r)]}function hr(t,e){for(let n=e;n;n=n.getParent()){if(di(n)){if(n.collapseAtStart(t))return true;if(to(n))break}if(n.getPreviousSibling())break}return false}const gr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return ()=>false})();function _r(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),s=i.length;let o=0,l=0;for(let t=0;t<s;t++){const r=t===s-1;if(l=o,o+=i[t].length,e&&o===n||o>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function pr(e,n,r,i){let s,o=n;if(fo(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;o===a&&(l=true,o=a-1);let f=c[o],d=false;if(f===u)f=c[o+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&o--;}}if(s=xs(f),Qn(s))o=Cs(s,l);else {let c=xs(e);if(null===c)return null;if(di(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,o]=u.resolveChildIndex(c,a,e,n),di(c)||t(215),l&&o>=c.getChildrenSize()&&(o=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(o);if(di(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=di(f)?f:f.getParentOrThrow()),o=0;}Qn(f)?(s=f,c=null,o=Cs(f,l)):f!==c&&l&&!d&&(di(c)||t(216),o=Math.min(c.getChildrenSize(),o+1));}else {const t=c.getIndexWithinParent();o=0===n&&_i(c)&&xs(e)===c?t:t+1,c=c.getParentOrThrow();}if(di(c))return ir(c.__key,o,"element")}}else s=xs(e);return Qn(s)?ir(s.__key,o,"text"):null}function yr(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),s=i.getParent();if(e){if((n||!e)&&null===r&&di(s)&&s.isInline()){const e=s.getPreviousSibling();Qn(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else di(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):Qn(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),s=i.getParent();if(e&&di(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&di(s)&&s.isInline()&&!s.canInsertTextAfter()){const e=s.getNextSibling();Qn(e)&&t.set(e.__key,0,"text");}}}function mr(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),i=t.is(e);yr(t,r,i),yr(e,!r,i),i&&e.set(t.key,t.offset,t.type);const s=qr();if(s.isComposing()&&s._compositionKey!==t.key&&cr(n)){const r=n.anchor,i=n.focus;t.set(r.key,r.offset,r.type,true),e.set(i.key,i.offset,i.type,true);}}}function xr(t,e,n,r,i,s){if(null===t||null===n||!Hi(i,t,n))return null;const o=pr(t,e,cr(s)?s.anchor:null,i);if(null===o)return null;const l=pr(n,r,cr(s)?s.focus:null,i);if(null===l)return null;if("element"===o.type&&"element"===l.type){const e=xs(t),r=xs(n);if(_i(e)&&_i(r))return null}return mr(o,l,s),[o,l]}function Cr(t){return di(t)&&!t.isInline()}function Sr(t,e,n,r,i,s){const o=Hr(),l=new ar(ir(t,e,i),ir(n,r,s),0,"");return l.dirty=true,o._selection=l,l}function vr(){const t=ir("root",0,"element"),e=ir("root",0,"element");return new ar(t,e,0,"")}function kr(){return new lr(new Set)}function br(t,e,n,r){const i=n._window;if(null===i)return null;const s=r||i.event,o=s?s.type:void 0,l="selectionchange"===o,c=!tt$2&&(l||"beforeinput"===o||"compositionstart"===o||"compositionend"===o||"click"===o&&s&&3===s.detail||"drop"===o||void 0===o);let a,u,f,d;if(cr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,l&&cr(t)&&!Hi(n,a,u))return t.clone();const h=xr(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new ar(g,_,cr(t)?t.format:0,cr(t)?t.style:"")}function Nr(){return Hr()._selection}function wr(){return qr()._editorState._selection}function Er(t,e,n,r=1){const i=t.anchor,s=t.focus,o=i.getNode(),l=s.getNode();if(!e.is(o)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),s.set(c,n,"element"),Mr(t);}}else {const o=t.isBackward(),l=o?s:i,a=l.getNode(),u=o?i:s,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element");}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element");}}Mr(t);}function Mr(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,s=e.getNode(),o=r.getNode();if(t.isCollapsed()){if(!di(s))return;const t=s.getChildrenSize(),i=n>=t,o=i?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(o)){let t=0;i&&(t=o.getTextContentSize()),e.set(o.__key,t,"text"),r.set(o.__key,t,"text");}}else {if(di(s)){const t=s.getChildrenSize(),r=n>=t,i=r?s.getChildAtIndex(t-1):s.getChildAtIndex(n);if(Qn(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(di(o)){const t=o.getChildrenSize(),e=i>=t,n=e?o.getChildAtIndex(t-1):o.getChildAtIndex(i);if(Qn(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}}function Ar(t,e,n,r,i){let s=null,o=0,l=null;null!==r?(s=r.__key,Qn(r)?(o=r.getTextContentSize(),l="text"):di(r)&&(o=r.getChildrenSize(),l="element")):null!==i&&(s=i.__key,Qn(i)?l="text":di(i)&&(l="element")),null!==s&&null!==l?t.set(s,o,l):(o=e.getIndexWithinParent(),-1===o&&(o=n.getChildrenSize()),t.set(n.__key,o,"element"));}function Or(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Dr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Pr(t,e,n,r,i,s,o){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has(Ni)&&f!==s||null!==f&&Yi(f))return;if(!cr(e))return void(null!==t&&Hi(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Us(n,g),y=Us(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,v=e.isCollapsed();let k=p,T=y,b=false;if("text"===d.type){k=ns(p);const t=d.getNode();b=t.getFormat()!==C||t.getStyle()!==S;}else cr(t)&&"text"===t.anchor.type&&(b=true);var N,w,E,M,A;if(("text"===h.type&&(T=ns(y)),null!==k&&null!==T)&&(v&&(null===t||b||cr(t)&&(t.format!==C||t.style!==S))&&(N=C,w=S,E=m,M=g,A=performance.now(),gn=[N,w,E,M,A]),a!==m||u!==x||l!==k||c!==T||"Range"===r.type&&v||(null!==f&&s.contains(f)||s.focus({preventScroll:true}),"element"===d.type))){if(Dr(r,k,m,T,x),!i.has(Ei)&&e.isCollapsed()&&null!==s&&s===document.activeElement){const t=cr(e)&&"element"===e.anchor.type?k.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=js(n),i=Gs(r);if(null===r||null===i)return;let{top:s,bottom:o}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=Xs(t).innerHeight;else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(s<l?n=-(l-s):o>c&&(n=o-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;s-=e,o-=e;}if(e)break;a=$s(a);}}(n,e,s);}}ln=true;}}function Fr(t){let e=Nr()||wr();null===e&&(e=ps().selectEnd()),e.insertNodes(t);}function Ir(e){let n=e;e.isCollapsed()||n.removeText();const r=Nr();cr(r)&&(n=r),cr(n)||t(161);const i=n.anchor;let s=i.getNode(),o=i.offset;for(;!yo(s);){const t=s;if([s,o]=zr(s,o),t.is(s))break}return o}function zr(t,e){const n=t.getParent();if(!n){const t=Pi();return ps().append(t),t.select(),[ps(),0]}if(Qn(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!di(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new ar(ir(t.__key,e,"element"),ir(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function Kr(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const s=ll(t.focus,n?"previous":"next"),o="lineboundary"===r,l="move"===e;let c=s,a="decorators-and-blocks"===i;if(!yl(c)){for(const t of c){a=false;const{origin:e}=t;if(!_i(e)||e.isIsolated()||(c=t,!o||!e.isInline()))break}if(a)for(const t of Qo(s).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(Ko(t))t.origin.isInline()||(c=t);else {if(di(t.origin))continue;_i(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===s)return false;if(l&&!o&&_i(c.origin)&&c.origin.isKeyboardSelectable()){const t=kr();return t.add(c.origin.getKey()),ms(t),true}return c=pl(c),l&&cl(t.anchor,c),cl(t.focus,c),a||!o}let Br=null,Rr=null,Wr=false,Jr=false,Ur=0;const $r={characterData:true,childList:true,subtree:true};function jr(){return Wr||null!==Br&&Br._readOnly}function Vr(){Wr&&t(13);}function Yr(){Ur>99&&t(14);}function Hr(){return null===Br&&t(195,Gr()),Br}function qr(){return null===Rr&&t(196,Gr()),Rr}function Gr(){let t=0;const e=new Set,n=Ji.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=Xi(r);if(qi(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function Xr(){return Rr}function Qr(e,n,r){const i=n.__type,s=function(e,n){const r=e._nodes.get(n);void 0===r&&t(30,n);return r}(e,i);let o=r.get(i);void 0===o&&(o=Array.from(s.transforms),r.set(i,o));const l=o.length;for(let t=0;t<l&&(o[t](n),n.isAttached());t++);}function Zr(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function ti(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t);}function ei(t){return ni(t,qr()._nodes)}function ni(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const s=i.klass;e.type!==s.getType()&&t(18,s.name);const o=s.importJSON(e),l=e.children;if(di(o)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=ni(l[t],n);o.append(e);}return o}function ri(t,e,n){const r=Br,i=Wr,s=Rr;Br=e,Wr=true,Rr=t;try{return n()}finally{Br=r,Wr=i,Rr=s;}}function ii(t,e){const n=t._pendingEditorState,r=t._rootElement,i=t._headless||null===r;if(null===n)return;const s=t._editorState,o=s._selection,l=n._selection,c=t._dirtyType!==y$4,a=Br,u=Wr,f=Rr,h=t._updating,g=t._observer;let _=null;if(t._pendingEditorState=null,t._editorState=n,!i&&c&&null!==g){Rr=t,Br=n,Wr=false,t._updating=true;try{const e=t._dirtyType,r=t._dirtyElements,i=t._dirtyLeaves;g.disconnect(),_=ie$1(s,n,t,e,r,i);}catch(e){if(e instanceof Error&&t._onError(e),Jr)throw e;return Ri(t,null,r,n),at$1(t),t._dirtyType=x$3,Jr=true,ii(t,s),void(Jr=false)}finally{g.observe(r,$r),t._updating=h,Br=a,Wr=u,Rr=f;}}n._readOnly||(n._readOnly=true);const p=t._dirtyLeaves,m=t._dirtyElements,C=t._normalizedNodes,S=t._updateTags,v=t._deferred;c&&(t._dirtyType=y$4,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let s;for(s in r)i.has(s)||(r===n&&(r=gs(t)),delete r[s]);}(t,n);const k=i?null:lo(Xs(t));if(t._editable&&null!==k&&(c||null===l||l.dirty)&&null!==r&&!S.has(Mi)){Rr=t,Br=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&oo(e,t,r),Pr(o,l,t,k,S,r);}!function(t,e,n){let r=t._blockCursorElement;if(cr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,s=i.getNode(),o=i.offset;let l=!1,c=null;if(o===s.getChildrenSize()){so(s.getChildAtIndex(o-1))&&(l=!0);}else {const e=s.getChildAtIndex(o);if(null!==e&&so(e)){const n=e.getPreviousSibling();(null===n||so(n))&&(l=!0,c=t.getElementByKey(e.__key));}}if(l){const n=t.getElementByKey(s.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=d$2(r);r=e.blockCursor=t;}void 0!==r&&n.classList.add(...r);}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&oo(r,t,e);}(t,r,l);}finally{null!==g&&g.observe(r,$r),Rr=f,Br=a;}}null!==_&&function(t,e,n,r,i){const s=Array.from(t._listeners.mutation),o=s.length;for(let t=0;t<o;t++){const[o,l]=s[t],c=e.get(l);void 0!==c&&o(c,{dirtyLeaves:r,prevEditorState:i,updateTags:n});}}(t,_,S,p,s),cr(l)||null===l||null!==o&&o.is(l)||t.dispatchCommand(le$1,void 0);const T=t._pendingDecorators;null!==T&&(t._decorators=T,t._pendingDecorators=null,si("decorator",t,true,T)),function(t,e,n){const r=_s(e),i=_s(n);r!==i&&si("textcontent",t,true,i);}(t,e||s,n),si("update",t,true,{dirtyElements:m,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:C,prevEditorState:e||s,tags:S}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=true;try{for(let t=0;t<e.length;t++)e[t]();}finally{t._updating=n;}}}(t,v),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;li(t,e,r);}}}(t);}function si(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=Array.from(e._listeners[t]);for(let t=0;t<n.length;t++)n[t].apply(null,r);}finally{e._updating=i;}}function oi(e,n){const r=e._updates;let i=n||false;for(;0!==r.length;){const n=r.shift();if(n){const[r,s]=n;let o;if(void 0!==s){if(o=s.onUpdate,s.skipTransforms&&(i=true),s.discrete){const n=e._pendingEditorState;null===n&&t(191),n._flushSync=true;}o&&e._deferred.push(o),ti(e,s.tag);}r();}}return i}function li(e,n,r){const i=e._updateTags;let s,o=false,l=false;void 0!==r&&(s=r.onUpdate,ti(e,r.tag),o=r.skipTransforms||false,l=r.discrete||false),s&&e._deferred.push(s);const c=e._editorState;let a=e._pendingEditorState,u=false;(null===a||a._readOnly)&&(a=e._pendingEditorState=mi(a||c),u=true),a._flushSync=l;const f=Br,d=Wr,h=Rr,g=e._updating;Br=a,Wr=false,e._updating=true,Rr=e;const _=e._headless||null===e.getRootElement();try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=lo(Xs(t));return cr(n)||null==n?br(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),o=oi(e,o),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(cr(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r);}}}(a,e),e._dirtyType!==y$4&&(o?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);Qn(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&St$3(e);}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,s=as(),o=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);Qn(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&St$3(r),void 0!==r&&Zr(r,s)&&Qr(e,r,o),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){Ur++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&Zr(c,s)&&Qr(e,c,o);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Ur++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),oi(e),function(t,e,n,r){const i=t._nodeMap,s=e._nodeMap,o=[];for(const[t]of r){const e=s.get(t);void 0!==e&&(e.isAttached()||(di(e)&&Q$3(e,t,i,s,o,r),i.has(t)||r.delete(t),o.push(t)));}for(const t of o)s.delete(t);for(const t of n){const e=s.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),s.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const s=a._selection;if(cr(s)){const e=a._nodeMap,n=s.anchor.key,r=s.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else ur(s)&&0===s._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=x$3,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void ii(e)}finally{Br=f,Wr=d,Rr=h,e._updating=g,Ur=0;}const p=e._dirtyType!==y$4||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,ii(e)):u&&ji((()=>{ii(e);})):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function ci(t,e,n){Rr===t&&void 0===n?e():li(t,e,n);}class ai{constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new ai(this.element,t,this.after)}withAfter(t){return new ai(this.element,this.before,t)}withElement(t){return this.element===t?this:new ai(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(l||o);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=ui(e,n);i.push(r);const s=ui(e,this.element);let o=t.getIndexWithinParent();for(let t=0;t<s.length;t++){const e=i[t],n=s[t];if(void 0===e||e<n)break;if(e>n){o+=1;break}}return [t.getParentOrThrow(),o]}}function ui(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class fi extends An{constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__first=t.__first,this.__last=t.__last,this.__size=t.__size,this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return H$1[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=qr()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(Qn(e)&&t.push(e),di(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;di(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;di(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return di(t)&&t.getLastDescendant()||t||null}const r=e[t];return di(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:us(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:us(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++;}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),di(i)&&r!==n-1&&!i.isInline()&&(t+=B$3);}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),di(i)&&r!==n-1&&!i.isInline()&&(t+=B$3.length);}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=Y$3[t];return !!(this.getFormat()&e)}return false}hasTextFormat(t){const e=j$4[t];return !!(this.getTextFormat()&e)}getFormatFlags(t,e){return rs(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){Vr();const n=Nr();let r=t,i=e;const s=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(Qn(t)||di(t))return t.select(0,0)}else if(!(void 0!==t&&t!==s||void 0!==e&&e!==s)){const t=this.getLastChild();if(Qn(t)||di(t))return t.select()} void 0===r&&(r=s),void 0===i&&(i=s);const o=this.__key;return cr(n)?(n.anchor.set(o,r,"element"),n.focus.set(o,i,"element"),n.dirty=true,n):Sr(o,r,o,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach((t=>t.remove())),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?Y$3[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){const i=r.length,s=this.getChildrenSize(),o=this.getWritable();e+n<=s||t(226,String(e),String(n),String(s));const l=o.__key,c=[],a=[],u=this.getChildAtIndex(e+n);let f=null,d=s-n+i;if(0!==e)if(e===s)f=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(f=t.getPreviousSibling());}if(n>0){let e=null===f?this.getFirstChild():f.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;os(e.getWritable()),a.push(r),e=n;}}let h=f;for(let e=0;e<i;e++){const n=r[e];null!==h&&n.is(h)&&(f=h=h.getPreviousSibling());const i=n.getWritable();i.__parent===l&&d--,os(i);const s=n.__key;if(null===h)o.__first=s,i.__prev=null;else {const t=h.getWritable();t.__next=s,i.__prev=t.__key;}n.__key===l&&t(76),i.__parent=l,c.push(s),h=n;}if(e+n===s){if(null!==h){h.getWritable().__next=null,o.__last=h.__key;}}else if(null!==u){const t=u.getWritable();if(null!==h){const e=h.getWritable();t.__prev=h.__key,e.__next=u.__key;}else t.__prev=null;}if(o.__size=d,a.length){const t=Nr();if(cr(t)){const e=new Set(a),n=new Set(c),{anchor:r,focus:i}=t;hi(r,e,n)&&Ar(r,r.getNode(),this,f,u),hi(i,e,n)&&Ar(i,i.getNode(),this,f,u),0!==d||this.canBeEmpty()||to(this)||this.remove();}}return o}getDOMSlot(t){return new ai(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function di(t){return t instanceof fi}function hi(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class gi extends An{decorate(e,n){t(47);}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function _i(t){return t instanceof gi}class pi extends fi{static getType(){return "root"}static clone(){return new pi}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !jr()&&qr()._dirtyType!==y$4||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)di(e)||_i(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return ps().updateFromJSON(t)}collapseAtStart(){return true}}function yi(t){return t instanceof pi}function mi(t){return new Si(new Map(t._nodeMap))}function xi(){return new Si(new Map([["root",new pi]]))}function Ci(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),di(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const s=e.getChildren();for(let t=0;t<s.length;t++){const e=Ci(s[t]);i.push(e);}}return n}class Si{constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=false,this._readOnly=false;}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return ri(e&&e.editor||null,this,t)}clone(t){const e=new Si(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=true,e}toJSON(){return ri(null,this,(()=>({root:Ci(ps())})))}}const vi="historic",ki="history-push",Ti="history-merge",bi="paste",Ni="collaboration",Ei="skip-scroll-into-view",Mi="skip-dom-selection";class Ai extends fi{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Oi extends fi{static getType(){return "paragraph"}static clone(t){return new Oi(t.__key)}createDOM(t){const e=document.createElement("p"),n=Ls(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:Di,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(fo(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Pi().updateFromJSON(t)}exportJSON(){return {...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=Pi();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||Qn(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function Di(t){const e=Pi();return t.style&&(e.setFormat(t.style.textAlign),To(t,e)),{node:e}}function Pi(){return no(new Oi)}function Fi(t){return t instanceof Oi}const Li=0,Ii=1,zi=2,Ki=3,Bi=4;function Ri(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=xi(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=y$4,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const s=t._observer;null!==s&&(s.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function Wi(t){const e=t||{},n=Xr(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,s=e.disableEvents||false,o=xi(),l=e.namespace||(null!==i?i._config.namespace:ks()),c=e.editorState,a=[pi,Jn,On,tr,Oi,Ai,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null;}const i=e.getType(),s=e.transform(),o=new Set;null!==s&&o.add(s),h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,transforms:o});}}const g=new Ji(o,i,h,{disableEvents:s,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach((e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);}));};return t.forEach((t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);})),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=x$3),g}class Ji{constructor(t,e,n,r,i,s,o,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=y$4,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=ks(),this._onError=i,this._htmlConversions=s,this._editable=o,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t);}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t);}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t);}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t);}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t);}}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const s=i.get(e);void 0===s&&t(36,String(e));const o=s[r];return o.add(n),()=>{o.delete(n),s.every((t=>0===t.size))&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;i.set(e,r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=vo(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=vo(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update((()=>{for(const t of r)for(const e of t.keys()){const t=us(e);t&&t.markDirty();}}),null===t._pendingEditorState?{tag:Ti}:void 0);}(this,r.map((t=>t.klass.getType()))),()=>{r.forEach((t=>t.transforms.delete(e)));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Ws(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=Ls(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Ri(this,e,t,r),null!==e&&(this._config.disableEvents||En(e),null!=n&&e.classList.remove(...n)),null!==t){const e=Gs(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=x$3,at$1(this),this._updateTags.add(Ti),ii(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument,r=on.get(n);(void 0===r||r<1)&&n.addEventListener("selectionchange",Tn),on.set(n,(r||0)+1),t.__lexicalEditor=e;const i=vn(t);for(let n=0;n<tn.length;n++){const[r,s]=tn[n],o="function"==typeof s?t=>{Nn(t)||(bn(t),(e.isEditable()||"click"===r)&&s(t,e));}:t=>{if(Nn(t))return;bn(t);const n=e.isEditable();switch(r){case "cut":return n&&Ws(e,Ue$1,t);case "copy":return Ws(e,Je$1,t);case "paste":return n&&Ws(e,ge$1,t);case "dragstart":return n&&Ws(e,Be$1,t);case "dragover":return n&&Ws(e,Re$1,t);case "dragend":return n&&Ws(e,We$1,t);case "focus":return n&&Ws(e,qe$1,t);case "blur":return n&&Ws(e,Ge$1,t);case "drop":return n&&Ws(e,ze$1,t)}};t.addEventListener(r,o),i.push((()=>{t.removeEventListener(r,o);}));}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Ti),ii(this);si("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=mi(e),r._selection=e._selection?e._selection.clone():null),ct$3(this);const i=this._pendingEditorState,s=this._updateTags,o=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=o&&s.add(o),ii(this)),this._pendingEditorState=r,this._dirtyType=x$3,this._dirtyElements.set("root",false),this._compositionKey=null,null!=o&&s.add(o),this._updating||ii(this);}parseEditorState(t,e){return function(t,e,n){const r=xi(),i=Br,s=Wr,o=Rr,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,Br=r,Wr=false,Rr=e;try{const i=e._nodes;ni(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,Br=i,Wr=s,Rr=o;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return ii(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):li(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),ci(this,(()=>{const r=Nr(),i=ps();null!==r?r.dirty||ms(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),Ys("focus"),Hs((()=>{n.removeAttribute("autocapitalize"),t&&t();}));})),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=lo(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,si("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}Ji.version="0.32.1+prod.esm";let Ui=1;const ji="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function Vi(t){return _i(hs(t))}function Yi(t){const e=document.activeElement;if(!fo(e))return false;const n=e.nodeName;return _i(hs(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==Xi(e))}function Hi(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!Yi(e)&&Gi(e)===t}catch(t){return false}}function qi(t){return t instanceof Ji}function Gi(t){let e=t;for(;null!=e;){const t=Xi(e);if(qi(t))return t;e=$s(e);}return null}function Xi(t){return t?t.__lexicalEditor:null}function Qi(t){return nr(t)||t.isToken()}function Zi(t){return Qi(t)||t.isSegmented()}function ts(t){return ho(t)&&t.nodeType===g$3}function es(t){return ho(t)&&t.nodeType===_$3}function ns(t){let e=t;for(;null!=e;){if(ts(e))return e;e=e.firstChild;}return null}function rs(t,e,n){const r=j$4[e];if(null!==n&&(t&r)==(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function is(t){return Qn(t)||Fn(t)||_i(t)}function ss(t,e){if(null!=e)return void(t.__key=e);Vr(),Yr();const n=qr(),r=Hr(),i=""+Ui++;r._nodeMap.set(i,t),di(t)?n._dirtyElements.set(i,true):n._dirtyLeaves.add(i),n._cloneNotNeeded.add(i),n._dirtyType=m$4,t.__key=i;}function os(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),s=t.getNextSibling(),o=null!==s?s.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==s?s.getWritable():null;null===i&&(r.__first=o),null===s&&(r.__last=l),null!==c&&(c.__next=o),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function ls(t){Yr();const e=t.getLatest(),n=e.__parent,r=Hr(),i=qr(),s=r._nodeMap,o=i._dirtyElements;null!==n&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(n,s,o);const l=e.__key;i._dirtyType=m$4,di(t)?o.set(l,true):i._dirtyLeaves.add(l);}function cs(t){Vr();const e=qr(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=us(n);null!==t&&t.getWritable();}if(null!==t){const e=us(t);null!==e&&e.getWritable();}}}function as(){if(jr())return null;return qr()._compositionKey}function us(t,e){const n=(e||Hr())._nodeMap.get(t);return void 0===n?null:n}function fs(t,e){const n=ds(t,qr());return void 0!==n?us(n,e):null}function ds(t,e){return t[`__lexicalKey_${e._key}`]}function hs(t,e){let n=t;for(;null!=n;){const t=fs(n,e);if(null!==t)return t;n=$s(n);}return null}function gs(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function _s(t){return t.read((()=>ps().getTextContent()))}function ps(){return ys(Hr())}function ys(t){return t._nodeMap.get("root")}function ms(t){Vr();const e=Hr();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function xs(t){const e=qr(),n=function(t,e){let n=t;for(;null!=n;){const t=ds(n,e);if(void 0!==t)return t;n=$s(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?us("root"):null}return us(n)}function Cs(t,e){return e?t.getTextContentSize():0}function Ss(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function vs(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function ks(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Ts(t){return ts(t)?t.nodeValue:null}function bs(t,e,n){const r=lo(Xs(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:s,focusOffset:o}=r;if(null!==i){let e=Ts(i);const r=hs(i);if(null!==e&&Qn(r)){if(e===K$3&&n){const t=n.length;e=n,s=t,o=t;}null!==e&&Ns(r,e,s,o,t);}}}function Ns(t,e,n,r,i){let s=t;if(s.isAttached()&&(i||!s.isDirty())){const c=s.isComposing();let a=e;(c||i)&&e[e.length-1]===K$3&&(a=e.slice(0,-1));const u=s.getTextContent();if(i||a!==u){if(""===a){if(cs(null),o||l||f$1)s.remove();else {const t=qr();setTimeout((()=>{t.update((()=>{s.isAttached()&&s.remove();}));}),20);}return}const e=s.getParent(),i=wr(),u=s.getTextContentSize(),d=as(),h=s.getKey();if(s.isToken()||null!==d&&h===d&&!c||cr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!s.canInsertTextBefore()&&!c||i.focus.key===t.__key&&i.focus.offset===u&&!s.canInsertTextAfter()&&!c))return void s.markDirty();const g=Nr();if(!cr(g)||null===n||null===r)return void s.setTextContent(a);if(g.setTextNodeRange(s,n,s,r),s.isSegmented()){const t=Xn(s.getTextContent());s.replace(t),s=t;}s.setTextContent(a);}}}function ws(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Es(t,e){return ws(t,e,"altKey")&&ws(t,e,"ctrlKey")&&ws(t,e,"shiftKey")&&ws(t,e,"metaKey")}function Ms(t,e,n){return Es(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const As={ctrlKey:!r,metaKey:r},Os={altKey:r,ctrlKey:!r};function Ds(t){return "Backspace"===t.key}function Ps(t){return Ms(t,"a",As)}function Fs(t){const e=ps();if(cr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),vt$4(t),t}{const t=e.select(0,e.getChildrenSize());return ms(vt$4(t)),t}}function Ls(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=d$2(i);return n[e]=t,t}return i}function Is(e,n,r,i,s){if(0===r.size)return;const o=i.__type,l=i.__key,c=n.get(o);void 0===c&&t(33,o);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===s;(void 0===f||d)&&u.set(l,d?"updated":s);}function Ks(t,e,n){const r=t.getParent();let i=n,s=t;return null!==r&&(e&&0===n?(i=s.getIndexWithinParent(),s=r):e||n!==s.getChildrenSize()||(i=s.getIndexWithinParent()+1,s=r)),s.getChildAtIndex(e?i-1:i)}function Bs(t,e){const n=t.offset;if("element"===t.type){return Ks(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Ks(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Rs(t){const e=Xs(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Ws(t,e,n){return function(t,e,n){const r=vs(t);for(let i=4;i>=0;i--)for(let s=0;s<r.length;s++){const o=r[s],l=o._commands.get(e);if(void 0!==l){const e=l[i];if(void 0!==e){const r=Array.from(e),i=r.length;let s=false;if(ci(o,(()=>{for(let e=0;e<i;e++)if(r[e](n,t))return void(s=true)})),s)return s}}}return false}(t,e,n)}function Js(t){return !yi(t)&&!t.isLastChild()&&!t.isInline()}function Us(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function $s(t){const e=t.assignedSlot||t.parentElement;return go(e)?e.host:e}function js(t){return es(t)?t:fo(t)?t.ownerDocument:null}function Ys(t){Vr();qr()._updateTags.add(t);}function Hs(t){Vr();qr()._deferred.push(t);}function qs(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return true;n=n.getParent();}return false}function Gs(t){const e=js(t);return e?e.defaultView:null}function Xs(e){const n=e._window;return null===n&&t(78),n}function Zs(t){let e=t.getParentOrThrow();for(;null!==e;){if(to(e))return e;e=e.getParentOrThrow();}return e}function to(t){return yi(t)||di(t)&&t.isShadowRoot()}function no(e){const n=qr(),r=e.constructor.getType(),i=n._nodes.get(r);void 0===i&&t(200,e.constructor.name,r);const{replace:s,replaceWithKlass:o}=i;if(null!==s){const n=s(e),i=n.constructor;return null!==o?n instanceof o||t(201,o.name,o.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function ro(e,n){!yi(e.getParent())||di(n)||_i(n)||t(99);}function io(e){const n=us(e);return null===n&&t(63,e),n}function so(t){return (_i(t)||di(t)&&!t.canBeEmpty())&&!t.isInline()}function oo(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t);}function lo(t){return e?(t||window).getSelection():null}function co(t){const e=Gs(t);return e?e.getSelection():null}function uo(t){return fo(t)&&"A"===t.tagName}function fo(t){return ho(t)&&t.nodeType===h$4}function ho(t){return "object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function go(t){return ho(t)&&t.nodeType===p$1}function _o(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function po(t){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==t.nodeName.match(e)}function yo(t){if(_i(t)&&!t.isInline())return true;if(!di(t)||to(t))return false;const e=t.getFirstChild(),n=null===e||Fn(e)||Qn(e)||e.isInline();return !t.isInline()&&false!==t.canBeEmpty()&&n}function mo(t,e){let n=t;for(;null!==n&&null!==n.getParent()&&!e(n);)n=n.getParentOrThrow();return e(n)?n:null}function xo(){return qr()}const Co=new WeakMap,So=new Map;function vo(e){if(!e._readOnly&&e.isEmpty())return So;e._readOnly||t(192);let n=Co.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r);}return e}(e),Co.set(e,n)),n}function ko(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function To(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r);}function No(t){return true===t.__lexicalUnmanaged}const wo={next:"previous",previous:"next"};class Eo{constructor(t){this.origin=t;}[Symbol.iterator](){return el({hasNext:zo,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return Jo(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return Jo(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let s=this;const o=this.getParentAtCaret(),l=new Map;for(let t=s.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e);}for(const e of i){if(l.size>0){const n=s.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||s.origin.is(e));else {const t=e.getParent();t&&t.is(o)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else s.insert(e);s=Jo(e,this.direction);}for(const t of l.values())t.remove();return this}}class Mo extends Eo{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Vo(t,this.direction)}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Mo&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Ao={root:yi,shadowRoot:to};function Oo(t){return wo[t]}function Do(t,e="root"){return Ao[e](t)?null:t}class Po extends Eo{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Jo(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return di(this.origin)?Vo(this.origin,this.direction):null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=Oo(this.direction);return Jo(this.getNodeAtCaret(),t)||Vo(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Po&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Fo extends Eo{type="text";constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:Uo(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return Jo(Do(this.getParentAtCaret(),t),this.direction)}getFlipped(){return Uo(this.origin,Oo(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Fo&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof Po||t instanceof Fo)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return Jo(this.origin,this.direction)}}function Lo(t){return t instanceof Fo}function zo(t){return t instanceof Po}function Ko(t){return t instanceof Mo}const Bo={next:class extends Fo{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Fo{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Ro={next:class extends Po{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Po{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Wo={next:class extends Mo{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Mo{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function Jo(t,e){return t?new Ro[e](t):null}function Uo(t,e,n){return t?new Bo[e](t,$o(t,n)):null}function $o(t,e){const n=t.getTextContentSize();let r="next"===e?n:"previous"===e?0:e;return (r<0||r>n)&&(!function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}(284,String(e),String(n),t.getKey()),r=r<0?0:n),r}function jo(t,e){return new Go(t,e)}function Vo(t,e){return di(t)?new Wo[e](t):null}function Yo(t){return t&&t.getChildCaret()||t}function Ho(t){return t&&Yo(t.getAdjacentCaret())}class qo{type="node-caret-range";constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new qo(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return Lo(e)?function(t,e){const{direction:n,origin:r}=t,i=$o(r,"focus"===e?Oo(n):n);return jo(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [jo(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=Lo(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Lo(n),i=e=>e.isSameNodeCaret(n)?null:Ho(e)||e.getParentCaret(t);return el({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class Go{type="slice";constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return Uo(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function Qo(t){return tl(t,Jo(ps(),t.direction))}function Zo(t){return tl(t,t)}function tl(e,n){return e.direction!==n.direction&&t(265),new qo(e,n,e.direction)}function el(t){const{initial:e,hasNext:n,step:r,map:i}=t;let s=e;return {[Symbol.iterator](){return this},next(){if(!n(s))return {done:true,value:void 0};const t={done:false,value:i(s)};return s=r(s),t}}}function nl(e,n){const r=ol(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case "same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case "ancestor":return "child"===e.type?-1:1;case "descendant":return "child"===n.type?1:-1;case "branch":return rl(r)}}function rl(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let s=e,o=n;for(;s&&o;s=s.getNextSibling(),o=o.getNextSibling()){if(s.__key===i)return -1;if(o.__key===r)return 1}return null===s?1:-1}function il(t,e){return e.is(t)}function sl(t){return di(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function ol(e,n){if(e.is(n))return {commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=sl(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,s]=sl(n);i;s=i,i=i.getParent()){const o=r.get(i);if(void 0!==o)return null===o?(il(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===s?(il(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((di(o)||il(e,o))&&(di(s)||il(n,s))&&i.is(o.getParent())&&i.is(s.getParent())||t(278),{a:o,b:s,commonAncestor:i,type:"branch"})}return null}function ll(e,n){const{type:r,key:i,offset:s}=e,o=io(e.key);return "text"===r?(Qn(o)||t(266,o.getType(),i),Uo(o,n,s)):(di(o)||t(267,o.getType(),i),Cl(o,e.offset,n))}function cl(e,n){const{origin:r,direction:i}=n,s="next"===i;Lo(n)?e.set(r.getKey(),n.offset,"text"):zo(n)?Qn(r)?e.set(r.getKey(),$o(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(s?1:0),"element"):(Ko(n)&&di(r)||t(268),e.set(r.getKey(),s?0:r.getChildrenSize(),"element"));}function al(t){const e=Nr(),n=cr(e)?e:vr();return ul(n,t),ms(n),n}function ul(t,e){cl(t.anchor,e.anchor),cl(t.focus,e.focus);}function fl(t){const{anchor:e,focus:n}=t,r=ll(e,"next"),i=ll(n,"next"),s=nl(r,i)<=0?"next":"previous";return tl(ml(r,s),ml(i,s))}function dl(t){const{direction:e,origin:n}=t,r=Jo(n,Oo(e)).getNodeAtCaret();return r?Jo(r,e):Vo(n.getParentOrThrow(),e)}function hl(t,e="root"){const n=[t];for(let r=Ko(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(dl(r));return n}function gl(t){return !!t&&t.origin.isAttached()}function _l(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let s=n;const o=xl(e,i),l=hl(o.anchor,r),c=hl(o.focus.getFlipped(),r),a=new Set,u=[];for(const t of o.iterNodeCarets(r))if(Ko(t))a.add(t.origin.getKey());else if(zo(t)){const{origin:e}=t;di(e)&&!a.has(e.getKey())||u.push(e);}for(const t of u)t.remove();for(const t of o.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=dl(Jo(e,i)),o=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===s||"token"===o&&0!==t.distance)r.remove();else if(0!==t.distance){s="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===o){const t=e.origin,n=Xn(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=Uo(n,i,e.offset);}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped());}}let f,d;for(const t of l)if(gl(t)){f=pl(t);break}for(const t of c)if(gl(t)){d=pl(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const s=r.getParents().reverse();s.push(r);const o=i.getParents().reverse();o.push(i);const l=Math.min(s.length,o.length);let c;for(c=0;c<l&&s[c]===o[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(to(i))return;!n&&e(i)&&(n=i);}return n},u=a(s,yo),f=u&&a(o,(t=>n.has(t.getKey())&&yo(t)));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;Vo(t,"previous").splice(0,e.getChildren()),e.remove();}const g=[f,d,...l,...c].find(gl);if(g){return Zo(ml(pl(g),e.direction))}t(269,JSON.stringify(l.map((t=>t.origin.__key))));}function pl(t){const e=function(t){let e=t;for(;Ko(e);){const t=Ho(e);if(!Ko(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(Qn(e.origin))return Lo(e)?e:Uo(e.origin,n,n);const r=e.getAdjacentCaret();return zo(r)&&Qn(r.origin)?Uo(r.origin,n,Oo(n)):e}function yl(t){return Lo(t)&&t.offset!==$o(t.origin,t.direction)}function ml(t,e){return t.direction===e?t:t.getFlipped()}function xl(t,e){return t.direction===e?t:tl(ml(t.focus,e),ml(t.anchor,e))}function Cl(t,e,n){let r=Vo(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t;}return ml(r,n)}
|
|
1386
|
+
function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);n.search=r.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,r=n&&"documentMode"in document?document.documentMode:null,i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),o=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||r)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),c=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,a=n&&/Android/.test(navigator.userAgent),u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&a&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&i&&!u;function h$1(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}const g$1=0,_$2=1,p=2,T$3=128,b$4=1,w$4=2,E$4=3,O$2=4,M$5=5,A$3=6,P$3=l||c||d?" ":"",D$3="\n\n",F$5=o?" ":P$3,L$2="֑-߿יִ-﷽ﹰ-ﻼ",I$3="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",K$4=new RegExp("^[^"+I$3+"]*["+L$2+"]"),z$4=new RegExp("^[^"+L$2+"]*["+I$3+"]"),R$4={bold:1,capitalize:1024,code:16,highlight:T$3,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},B$3={directionless:1,unmergeable:2},W$6={center:2,end:6,justify:4,left:1,right:3,start:5},J$5={[w$4]:"center",[A$3]:"end",[O$2]:"justify",[b$4]:"left",[E$4]:"right",[M$5]:"start"},j$2={normal:0,segmented:2,token:1},$$4={[g$1]:"normal",[p]:"segmented",[_$2]:"token"},V$5="$config";function Y$4(t,e,n,r,i,o){let s=t.getFirstChild();for(;null!==s;){const t=s.__key;s.__parent===e&&(Si(s)&&Y$4(s,t,n,r,i,o),n.has(t)||o.delete(t),i.push(t)),s=s.getNextSibling();}}let q$4=false,H$2=0;function G$4(t){H$2=t.timeStamp;}function X$4(t,e,n){const r="BR"===t.nodeName,i=e.__lexicalLineBreak;return i&&(t===i||r&&t.previousSibling===i)||r&&void 0!==So(t,n)}function Q$5(t,e,n){const r=ps(ss(n));let i=null,o=null;null!==r&&r.anchorNode===t&&(i=r.anchorOffset,o=r.focusOffset);const s=t.nodeValue;null!==s&&Fo(e,s,i,o,false);}function Z$4(t,e,n){if(yr(t)){const e=t.anchor.getNode();if(e.is(n)&&t.format!==e.getFormat())return false}return co(e)&&n.isAttached()}function tt$3(t,e,n,r){for(let i=t;i&&!Fs(i);i=Zo(i)){const t=So(i,e);if(void 0!==t){const e=xo(t,n);if(e)return Ti(e)||!Cs(i)?void 0:[i,e]}else if(i===r)return [r,bo(n)]}}function et$4(t,e,n){q$4=true;const r=performance.now()-H$2>100;try{yi(t,()=>{const i=Lr()||function(t){return t.getEditorState().read(()=>{const t=Lr();return null!==t?t.clone():null})}(t),s=new Map,l=t.getRootElement(),c=t._editorState,a=t._blockCursorElement;let u=!1,f="";for(let n=0;n<e.length;n++){const d=e[n],h=d.type,g=d.target,_=tt$3(g,t,c,l);if(!_)continue;const[p,y]=_;if("characterData"===h)r&&lr(y)&&co(g)&&Z$4(i,g,y)&&Q$5(g,y,t);else if("childList"===h){u=!0;const e=d.addedNodes;for(let n=0;n<e.length;n++){const r=e[n],i=Co(r),s=r.parentNode;if(null!=s&&r!==a&&null===i&&!X$4(r,s,t)){if(o){const t=(Cs(r)?r.innerText:null)||r.nodeValue;t&&(f+=t);}s.removeChild(r);}}const n=d.removedNodes,r=n.length;if(r>0){let e=0;for(let i=0;i<r;i++){const r=n[i];(X$4(r,g,t)||a===r)&&(g.appendChild(r),e++);}r!==e&&s.set(p,y);}}}if(s.size>0)for(const[e,n]of s)n.reconcileObservedMutation(e,t);const d=n.takeRecords();if(d.length>0){for(let e=0;e<d.length;e++){const n=d[e],r=n.addedNodes,i=n.target;for(let e=0;e<r.length;e++){const n=r[e],o=n.parentNode;null==o||"BR"!==n.nodeName||X$4(n,i,t)||o.removeChild(n);}}n.takeRecords();}null!==i&&(u&&wo(i),o&&Ho(t)&&i.insertRawText(f));});}finally{q$4=false;}}function nt$4(t){const e=t._observer;if(null!==e){et$4(t,e.takeRecords(),e);}}function rt$3(t){!function(t){0===H$2&&ss(t).addEventListener("textInput",G$4,true);}(t),t._observer=new MutationObserver((e,n)=>{et$4(t,e,n);});}let it$3 = class it{key;parse;unparse;isEqual;defaultValue;constructor(t,e){this.key=t,this.parse=e.parse.bind(e),this.unparse=(e.unparse||gt$3).bind(e),this.isEqual=(e.isEqual||Object.is).bind(e),this.defaultValue=this.parse(void 0);}};function ot$4(t,e){return new it$3(t,e)}function st$4(t,e,n="latest"){const r=("latest"===n?t.getLatest():t).__state;return r?r.getValue(e):e.defaultValue}function ct$4(t,e,n){let r;if(ei(),"function"==typeof n){const i=t.getLatest(),o=st$4(i,e);if(r=n(o),e.isEqual(o,r))return i}else r=n;const i=t.getWritable();return ft$2(i).updateFromKnown(e,r),i}function at$2(t){const e=new Map,n=new Set;for(let r="function"==typeof t?t:t.replace;r.prototype&&void 0!==r.prototype.getType;r=Object.getPrototypeOf(r)){const{ownNodeConfig:t}=Is(r);if(t&&t.stateConfigs)for(const r of t.stateConfigs){let t;"stateConfig"in r?(t=r.stateConfig,r.flat&&n.add(t.key)):t=r,e.set(t.key,t);}}return {flatKeys:n,sharedConfigMap:e}}let ut$3 = class ut{node;knownState;unknownState;sharedNodeState;size;constructor(t,e,n=void 0,r=new Map,i=void 0){this.node=t,this.sharedNodeState=e,this.unknownState=n,this.knownState=r;const{sharedConfigMap:o}=this.sharedNodeState,s=void 0!==i?i:function(t,e,n){let r=n.size;if(e)for(const i in e){const e=t.get(i);e&&n.has(e)||r++;}return r}(o,n,r);this.size=s;}getValue(t){const e=this.knownState.get(t);if(void 0!==e)return e;this.sharedNodeState.sharedConfigMap.set(t.key,t);let n=t.defaultValue;if(this.unknownState&&t.key in this.unknownState){const e=this.unknownState[t.key];void 0!==e&&(n=t.parse(e)),this.updateFromKnown(t,n);}return n}getInternalState(){return [this.unknownState,this.knownState]}toJSON(){const t={...this.unknownState},e={};for(const[e,n]of this.knownState)e.isEqual(n,e.defaultValue)?delete t[e.key]:t[e.key]=e.unparse(n);for(const n of this.sharedNodeState.flatKeys)n in t&&(e[n]=t[n],delete t[n]);return ht$4(t)&&(e.$=t),e}getWritable(t){if(this.node===t)return this;const{sharedNodeState:e,unknownState:n}=this,r=new Map(this.knownState);return new ut(t,e,function(t,e,n){let r;if(n)for(const[i,o]of Object.entries(n)){const n=t.get(i);n?e.has(n)||e.set(n,n.parse(o)):(r=r||{},r[i]=o);}return r}(e.sharedConfigMap,r,n),r,this.size)}updateFromKnown(t,e){const n=t.key;this.sharedNodeState.sharedConfigMap.set(n,t);const{knownState:r,unknownState:i}=this;r.has(t)||i&&n in i||(i&&(delete i[n],this.unknownState=ht$4(i)),this.size++),r.set(t,e);}updateFromUnknown(t,e){const n=this.sharedNodeState.sharedConfigMap.get(t);n?this.updateFromKnown(n,n.parse(e)):(this.unknownState=this.unknownState||{},t in this.unknownState||this.size++,this.unknownState[t]=e);}updateFromJSON(t){const{knownState:e}=this;for(const t of e.keys())e.set(t,t.defaultValue);if(this.size=e.size,this.unknownState=void 0,t)for(const[e,n]of Object.entries(t))this.updateFromUnknown(e,n);}};function ft$2(t){const e=t.getWritable(),n=e.__state?e.__state.getWritable(e):new ut$3(e,dt$3(e));return e.__state=n,n}function dt$3(t){return t.__state?t.__state.sharedNodeState:Gi(bs(),t.getType()).sharedNodeState}function ht$4(t){if(t)for(const e in t)return t}function gt$3(t){return t}function _t$3(t,e,n){for(const[r,i]of e.knownState){if(t.has(r.key))continue;t.add(r.key);const e=n?n.getValue(r):r.defaultValue;if(e!==i&&!r.isEqual(e,i))return true}return false}function pt$3(t,e,n){const{unknownState:r}=e,i=n?n.unknownState:void 0;if(r)for(const[e,n]of Object.entries(r)){if(t.has(e))continue;t.add(e);if(n!==(i?i[e]:void 0))return true}return false}function yt$3(t,e){const n=t.__state;return n&&n.node===t?n.getWritable(e):n}function mt$1(t,e){const n=t.__mode,r=t.__format,i=t.__style,o=e.__mode,s=e.__format,l=e.__style,c=t.__state,a=e.__state;return (null===n||n===o)&&(null===r||r===s)&&(null===i||i===l)&&(null===t.__state||c===a||function(t,e){if(t===e)return true;if(t&&e&&t.size!==e.size)return false;const n=new Set;return !(t&&_t$3(n,t,e)||e&&_t$3(n,e,t)||t&&pt$3(n,t,e)||e&&pt$3(n,e,t))}(c,a))}function xt$5(t,e){const n=t.mergeWithSibling(e),r=ii()._normalizedNodes;return r.add(t.__key),r.add(e.__key),n}function Ct$4(t){let e,n,r=t;if(""!==r.__text||!r.isSimpleText()||r.isUnmergeable()){for(;null!==(e=r.getPreviousSibling())&&lr(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(""!==e.__text){if(mt$1(e,r)){r=xt$5(e,r);break}break}e.remove();}for(;null!==(n=r.getNextSibling())&&lr(n)&&n.isSimpleText()&&!n.isUnmergeable();){if(""!==n.__text){if(mt$1(r,n)){r=xt$5(r,n);break}break}n.remove();}}else r.remove();}function St$5(t){return vt$3(t.anchor),vt$3(t.focus),t}function vt$3(t){for(;"element"===t.type;){const e=t.getNode(),n=t.offset;let r,i;if(n===e.getChildrenSize()?(r=e.getChildAtIndex(n-1),i=true):(r=e.getChildAtIndex(n),i=false),lr(r)){t.set(r.__key,i?r.getTextContentSize():0,"text",true);break}if(!Si(r))break;t.set(r.__key,i?r.getChildrenSize():0,"element",true);}}let kt$5,Tt$4,Nt$4,bt$5,wt$5,Et$4,Ot$3,Mt$3,At$4,Pt$4,Dt$3="",Ft$2=null,Lt$4="",It$3="",Kt$2=false,zt$2=false;function Rt$2(t,e){const n=Ot$3.get(t);if(null!==e){const n=ne$1(t);n.parentNode===e&&e.removeChild(n);}if(Mt$3.has(t)||Tt$4._keyToDOMMap.delete(t),Si(n)){const t=Xt(n,Ot$3);Bt$2(t,0,t.length-1,null);} void 0!==n&&Uo(Pt$4,Nt$4,bt$5,n,"destroyed");}function Bt$2(t,e,n,r){let i=e;for(;i<=n;++i){const e=t[i];void 0!==e&&Rt$2(e,r);}}function Wt$1(t,e){t.setProperty("text-align",e);}const Jt$1="40px";function jt$3(t,e){const n=kt$5.theme.indent;if("string"==typeof n){const r=t.classList.contains(n);e>0&&!r?t.classList.add(n):e<1&&r&&t.classList.remove(n);}const r=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||Jt$1;t.style.setProperty("padding-inline-start",0===e?"":`calc(${e} * ${r})`);}function $t$1(t,e){const n=t.style;0===e?Wt$1(n,""):1===e?Wt$1(n,"left"):2===e?Wt$1(n,"center"):3===e?Wt$1(n,"right"):4===e?Wt$1(n,"justify"):5===e?Wt$1(n,"start"):6===e&&Wt$1(n,"end");}function Ut$2(t,e){const n=function(t){const e=t.__dir;if(null!==e)return e;if(bi(t))return null;const n=t.getParentOrThrow();return bi(n)&&null===n.__dir?"auto":null}(e);null!==n?t.dir=n:t.removeAttribute("dir");}function Vt(e,n){const r=Mt$3.get(e);void 0===r&&t(60);const i=r.createDOM(kt$5,Tt$4);if(function(t,e,n){const r=n._keyToDOMMap;((function(t,e,n){const r=`__lexicalKey_${e._key}`;t[r]=n;}))(e,n,t),r.set(t,e);}(e,i,Tt$4),lr(r)?i.setAttribute("data-lexical-text","true"):Ti(r)&&i.setAttribute("data-lexical-decorator","true"),Si(r)){const t=r.__indent,e=r.__size;if(Ut$2(i,r),0!==t&&jt$3(i,t),0!==e){const t=e-1;Yt(Xt(r,Mt$3),r,0,t,r.getDOMSlot(i));}const n=r.__format;0!==n&&$t$1(i,n),r.isInline()||Ht$1(null,r,i),Xo(r)&&(Dt$3+=D$3,It$3+=D$3);}else {const t=r.getTextContent();if(Ti(r)){const t=r.decorate(Tt$4,kt$5);null!==t&&Zt(e,t),i.contentEditable="false";}Dt$3+=t,It$3+=t;}return null!==n&&n.insertChild(i),Uo(Pt$4,Nt$4,bt$5,r,"created"),i}function Yt(t,e,n,r,i){const o=Dt$3;Dt$3="";let s=n;for(;s<=r;++s){Vt(t[s],i);const e=Mt$3.get(t[s]);null!==e&&lr(e)&&(null===Ft$2&&(Ft$2=e.getFormat()),""===Lt$4&&(Lt$4=e.getStyle()));}Xo(e)&&(Dt$3+=D$3);i.element.__lexicalTextContent=Dt$3,Dt$3=o+Dt$3;}function qt(t,e){if(t){const n=t.__last;if(n){const t=e.get(n);if(t)return jn(t)?"line-break":Ti(t)&&t.isInline()?"decorator":null}return "empty"}return null}function Ht$1(t,e,n){const r=qt(t,Ot$3),i=qt(e,Mt$3);r!==i&&e.getDOMSlot(n).setManagedLineBreak(i);}function Gt$1(e,n,r){var i;Ft$2=null,Lt$4="",function(e,n,r){const i=Dt$3,o=e.__size,s=n.__size;Dt$3="";const l=r.element;if(1===o&&1===s){const t=e.__first,r=n.__first;if(t===r)Qt(t,l);else {const e=ne$1(t),n=Vt(r,null);try{l.replaceChild(n,e);}catch(i){if("object"==typeof i&&null!=i){const o=`${i.toString()} Parent: ${l.tagName}, new child: {tag: ${n.tagName} key: ${r}}, old child: {tag: ${e.tagName}, key: ${t}}.`;throw new Error(o)}throw i}Rt$2(t,null);}const i=Mt$3.get(r);lr(i)&&(null===Ft$2&&(Ft$2=i.getFormat()),""===Lt$4&&(Lt$4=i.getStyle()));}else {const i=Xt(e,Ot$3),c=Xt(n,Mt$3);if(i.length!==o&&t(227),c.length!==s&&t(228),0===o)0!==s&&Yt(c,n,0,s-1,r);else if(0===s){if(0!==o){const t=null==r.after&&null==r.before&&null==r.element.__lexicalLineBreak;Bt$2(i,0,o-1,t?null:l),t&&(l.textContent="");}}else !function(t,e,n,r,i,o){const s=r-1,l=i-1;let c,a,u=o.getFirstChild(),f=0,d=0;for(;f<=s&&d<=l;){const t=e[f],r=n[d];if(t===r)u=te$1(Qt(r,o.element)),f++,d++;else { void 0===c&&(c=new Set(e)),void 0===a&&(a=new Set(n));const i=a.has(t),s=c.has(r);if(i)if(s){const t=Qo(Tt$4,r);t===u?u=te$1(Qt(r,o.element)):(o.withBefore(u).insertChild(t),Qt(r,o.element)),f++,d++;}else Vt(r,o.withBefore(u)),d++;else u=te$1(ne$1(t)),Rt$2(t,o.element),f++;}const i=Mt$3.get(r);null!==i&&lr(i)&&(null===Ft$2&&(Ft$2=i.getFormat()),""===Lt$4&&(Lt$4=i.getStyle()));}const h=f>s,g=d>l;if(h&&!g){const e=n[l+1],r=void 0===e?null:Tt$4.getElementByKey(e);Yt(n,t,d,l,o.withBefore(r));}else g&&!h&&Bt$2(e,f,s,o.element);}(n,i,c,o,s,r);}Xo(n)&&(Dt$3+=D$3);l.__lexicalTextContent=Dt$3,Dt$3=i+Dt$3;}(e,n,n.getDOMSlot(r)),i=n,null==Ft$2||Ft$2===i.__textFormat||zt$2||i.setTextFormat(Ft$2),function(t){""===Lt$4||Lt$4===t.__textStyle||zt$2||t.setTextStyle(Lt$4);}(n);}function Xt(e,n){const r=[];let i=e.__first;for(;null!==i;){const e=n.get(i);void 0===e&&t(101),r.push(i),i=e.__next;}return r}function Qt(e,n){const r=Ot$3.get(e);let i=Mt$3.get(e);void 0!==r&&void 0!==i||t(61);const o=Kt$2||Et$4.has(e)||wt$5.has(e),s=Qo(Tt$4,e);if(r===i&&!o){if(Si(r)){const t=s.__lexicalTextContent;void 0!==t&&(Dt$3+=t,It$3+=t);}else {const t=r.getTextContent();It$3+=t,Dt$3+=t;}return s}if(r!==i&&o&&Uo(Pt$4,Nt$4,bt$5,i,"updated"),i.updateDOM(r,s,kt$5)){const r=Vt(e,null);return null===n&&t(62),n.replaceChild(r,s),Rt$2(e,null),r}if(Si(r)&&Si(i)){const t=i.__indent;(Kt$2||t!==r.__indent)&&jt$3(s,t);const e=i.__format;if((Kt$2||e!==r.__format)&&$t$1(s,e),o&&(Gt$1(r,i,s),bi(i)||i.isInline()||Ht$1(r,i,s)),Xo(i)&&(Dt$3+=D$3,It$3+=D$3),(Kt$2||i.__dir!==r.__dir)&&(Ut$2(s,i),bi(i)&&!Kt$2))for(const t of i.getChildren())if(Si(t)){Ut$2(Qo(Tt$4,t.getKey()),t);}}else {const t=i.getTextContent();if(Ti(i)){const t=i.decorate(Tt$4,kt$5);null!==t&&Zt(e,t);}Dt$3+=t,It$3+=t;}if(!zt$2&&bi(i)&&i.__cachedText!==It$3){const t=i.getWritable();t.__cachedText=It$3,i=t;}return s}function Zt(t,e){let n=Tt$4._pendingDecorators;const r=Tt$4._decorators;if(null===n){if(r[t]===e)return;n=ko(Tt$4);}n[t]=e;}function te$1(t){let e=t.nextSibling;return null!==e&&e===Tt$4._blockCursorElement&&(e=e.nextSibling),e}function ee$1(t,e,n,r,i,o){Dt$3="",It$3="",Kt$2=2===r,Tt$4=n,kt$5=n._config,Nt$4=n._nodes,bt$5=Tt$4._listeners.mutation,wt$5=i,Et$4=o,Ot$3=t._nodeMap,Mt$3=e._nodeMap,zt$2=e._readOnly,At$4=new Map(n._keyToDOMMap);const s=new Map;return Pt$4=s,Qt("root",null),Tt$4=void 0,Nt$4=void 0,wt$5=void 0,Et$4=void 0,Ot$3=void 0,Mt$3=void 0,kt$5=void 0,At$4=void 0,Pt$4=void 0,s}function ne$1(e){const n=At$4.get(e);return void 0===n&&t(75,e),n}function re$1(t){return {type:t}}const ie$1=re$1("SELECTION_CHANGE_COMMAND"),oe$1=re$1("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),se$1=re$1("CLICK_COMMAND"),le$1=re$1("DELETE_CHARACTER_COMMAND"),ce$1=re$1("INSERT_LINE_BREAK_COMMAND"),ae$1=re$1("INSERT_PARAGRAPH_COMMAND"),ue$1=re$1("CONTROLLED_TEXT_INSERTION_COMMAND"),fe$1=re$1("PASTE_COMMAND"),de$1=re$1("REMOVE_TEXT_COMMAND"),he$1=re$1("DELETE_WORD_COMMAND"),ge$1=re$1("DELETE_LINE_COMMAND"),_e$1=re$1("FORMAT_TEXT_COMMAND"),pe$1=re$1("UNDO_COMMAND"),ye$1=re$1("REDO_COMMAND"),me$1=re$1("KEYDOWN_COMMAND"),xe=re$1("KEY_ARROW_RIGHT_COMMAND"),Ce$1=re$1("MOVE_TO_END"),Se$1=re$1("KEY_ARROW_LEFT_COMMAND"),ve$1=re$1("MOVE_TO_START"),ke$1=re$1("KEY_ARROW_UP_COMMAND"),Te$1=re$1("KEY_ARROW_DOWN_COMMAND"),Ne$1=re$1("KEY_ENTER_COMMAND"),be$1=re$1("KEY_SPACE_COMMAND"),we$1=re$1("KEY_BACKSPACE_COMMAND"),Ee$1=re$1("KEY_ESCAPE_COMMAND"),Oe$1=re$1("KEY_DELETE_COMMAND"),Me$1=re$1("KEY_TAB_COMMAND"),Ae$1=re$1("INSERT_TAB_COMMAND"),Pe$1=re$1("INDENT_CONTENT_COMMAND"),De$1=re$1("OUTDENT_CONTENT_COMMAND"),Fe$1=re$1("DROP_COMMAND"),Le$1=re$1("FORMAT_ELEMENT_COMMAND"),Ie$1=re$1("DRAGSTART_COMMAND"),Ke$1=re$1("DRAGOVER_COMMAND"),ze$1=re$1("DRAGEND_COMMAND"),Re$1=re$1("COPY_COMMAND"),Be$1=re$1("CUT_COMMAND"),We$1=re$1("SELECT_ALL_COMMAND"),Je$1=re$1("CLEAR_EDITOR_COMMAND"),je$1=re$1("CLEAR_HISTORY_COMMAND"),$e$1=re$1("CAN_REDO_COMMAND"),Ue$1=re$1("CAN_UNDO_COMMAND"),Ve$1=re$1("FOCUS_COMMAND"),Ye=re$1("BLUR_COMMAND"),qe$1=re$1("KEY_MODIFIER_COMMAND"),He$1=Object.freeze({}),Ge$1=[["keydown",function(t,e){if(Xe$1=t.timeStamp,Qe$1=t.key,e.isComposing())return;if(Go(e,me$1,t))return;if(null==t.key)return;if(cn&&Wo(t))return yi(e,()=>{mn(e,an);}),cn=false,void(an="");if(function(t){return zo(t,"ArrowRight",{shiftKey:"any"})}(t))Go(e,xe,t);else if(function(t){return zo(t,"ArrowRight",Ro)}(t))Go(e,Ce$1,t);else if(function(t){return zo(t,"ArrowLeft",{shiftKey:"any"})}(t))Go(e,Se$1,t);else if(function(t){return zo(t,"ArrowLeft",Ro)}(t))Go(e,ve$1,t);else if(function(t){return zo(t,"ArrowUp",{altKey:"any",shiftKey:"any"})}(t))Go(e,ke$1,t);else if(function(t){return zo(t,"ArrowDown",{altKey:"any",shiftKey:"any"})}(t))Go(e,Te$1,t);else if(function(t){return zo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any",shiftKey:true})}(t))sn=true,Go(e,Ne$1,t);else if(function(t){return " "===t.key}(t))Go(e,be$1,t);else if(function(t){return i&&zo(t,"o",{ctrlKey:true})}(t))t.preventDefault(),sn=true,Go(e,ce$1,true);else if(function(t){return zo(t,"Enter",{altKey:"any",ctrlKey:"any",metaKey:"any"})}(t))sn=false,Go(e,Ne$1,t);else if(function(t){return zo(t,"Backspace",{shiftKey:"any"})||i&&zo(t,"h",{ctrlKey:true})}(t))Wo(t)?Go(e,we$1,t):(t.preventDefault(),Go(e,le$1,true));else if(function(t){return "Escape"===t.key}(t))Go(e,Ee$1,t);else if(function(t){return zo(t,"Delete",{})||i&&zo(t,"d",{ctrlKey:true})}(t))!function(t){return "Delete"===t.key}(t)?(t.preventDefault(),Go(e,le$1,false)):Go(e,Oe$1,t);else if(function(t){return zo(t,"Backspace",Bo)}(t))t.preventDefault(),Go(e,he$1,true);else if(function(t){return zo(t,"Delete",Bo)}(t))t.preventDefault(),Go(e,he$1,false);else if(function(t){return i&&zo(t,"Backspace",{metaKey:true})}(t))t.preventDefault(),Go(e,ge$1,true);else if(function(t){return i&&(zo(t,"Delete",{metaKey:true})||zo(t,"k",{ctrlKey:true}))}(t))t.preventDefault(),Go(e,ge$1,false);else if(function(t){return zo(t,"b",Ro)}(t))t.preventDefault(),Go(e,_e$1,"bold");else if(function(t){return zo(t,"u",Ro)}(t))t.preventDefault(),Go(e,_e$1,"underline");else if(function(t){return zo(t,"i",Ro)}(t))t.preventDefault(),Go(e,_e$1,"italic");else if(function(t){return zo(t,"Tab",{shiftKey:"any"})}(t))Go(e,Me$1,t);else if(function(t){return zo(t,"z",Ro)}(t))t.preventDefault(),Go(e,pe$1,void 0);else if(function(t){if(i)return zo(t,"z",{metaKey:true,shiftKey:true});return zo(t,"y",{ctrlKey:true})||zo(t,"z",{ctrlKey:true,shiftKey:true})}(t))t.preventDefault(),Go(e,ye$1,void 0);else {const n=e._editorState._selection;null===n||yr(n)?Jo(t)&&(t.preventDefault(),Go(e,We$1,t)):!function(t){return zo(t,"c",Ro)}(t)?!function(t){return zo(t,"x",Ro)}(t)?Jo(t)&&(t.preventDefault(),Go(e,We$1,t)):(t.preventDefault(),Go(e,Be$1,t)):(t.preventDefault(),Go(e,Re$1,t));}(function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey})(t)&&Go(e,qe$1,t);}],["pointerdown",function(t,e){const n=t.target,r=t.pointerType;Ss(n)&&"touch"!==r&&"pen"!==r&&0===t.button&&yi(e,()=>{Zi(n)||(on=true);});}],["compositionstart",function(t,e){yi(e,()=>{const n=Lr();if(yr(n)&&!e.isComposing()){const r=n.anchor,i=n.anchor.getNode();yo(r.key),(t.timeStamp<Xe$1+30||"element"===r.type||!n.isCollapsed()||i.getFormat()!==n.format||lr(i)&&i.getStyle()!==n.style)&&Go(e,ue$1,F$5);}});}],["compositionend",function(t,e){o?ln=true:c||!l&&!d?yi(e,()=>{mn(e,t.data);}):(cn=true,an=t.data);}],["input",function(t,e){t.stopPropagation(),yi(e,()=>{if(Cs(t.target)&&Zi(t.target))return;const n=Lr(),r=t.data,i=yn(t);if(null!=r&&yr(n)&&dn(n,i,r,t.timeStamp,false)){ln&&(mn(e,r),ln=false);const i=n.anchor.getNode(),a=ps(ss(e));if(null===a)return;const u=n.isBackward(),f=u?n.anchor.offset:n.focus.offset,h=u?n.focus.offset:n.anchor.offset;s&&!n.isCollapsed()&&lr(i)&&null!==a.anchorNode&&i.getTextContent().slice(0,f)+r+i.getTextContent().slice(f+h)===Po(a.anchorNode)||Go(e,ue$1,r);const g=r.length;o&&g>1&&"insertCompositionText"===t.inputType&&!e.isComposing()&&(n.anchor.offset-=g),l||c||d||!e.isComposing()||(Xe$1=0,yo(null));}else {Do(false,e,null!==r?r:void 0),ln&&(mn(e,r||void 0),ln=false);}!function(){ei();const t=ii();nt$4(t);}();},{event:t}),tn=null;}],["click",function(t,e){yi(e,()=>{const n=Lr(),r=ps(ss(e)),i=Ir();if(r)if(yr(n)){const e=n.anchor,o=e.getNode();if("element"===e.type&&0===e.offset&&n.isCollapsed()&&!bi(o)&&1===No().getChildrenSize()&&o.getTopLevelElementOrThrow().isEmpty()&&null!==i&&n.is(i))r.removeAllRanges(),n.dirty=true;else if(3===t.detail&&!n.isCollapsed()){if(o!==n.focus.getNode()){const t=zs(o,t=>Si(t)&&!t.isInline());Si(t)&&t.select(0);}}}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=r.anchorNode;if(Cs(n)||co(n)){wo(Fr(i,r,e,t));}}Go(e,se$1,t);});}],["cut",He$1],["copy",He$1],["dragstart",He$1],["dragover",He$1],["dragend",He$1],["paste",He$1],["focus",He$1],["blur",He$1],["drop",He$1]];s&&Ge$1.push(["beforeinput",(e,n)=>function(e,n){const r=e.inputType,i=yn(e);if("deleteCompositionText"===r||o&&Ho(n))return;if("insertCompositionText"===r)return;yi(n,()=>{const o=Lr();if("deleteContentBackward"===r){if(null===o){const t=Ir();if(!yr(t))return;wo(t.clone());}if(yr(o)){const r=o.anchor.key===o.focus.key;if(s=e.timeStamp,"MediaLast"===Qe$1&&s<Xe$1+30&&n.isComposing()&&r){if(yo(null),Xe$1=0,setTimeout(()=>{yi(n,()=>{yo(null);});},30),yr(o)){const e=o.anchor.getNode();e.markDirty(),lr(e)||t(142),pn(o,e);}}else {yo(null),e.preventDefault();const t=o.anchor.getNode(),i=t.getTextContent(),s=t.canInsertTextAfter(),l=0===o.anchor.offset&&o.focus.offset===i.length;let c=f&&r&&!l&&s;if(c&&o.isCollapsed()&&(c=!Ti(qo(o.anchor,true))),!c){Go(n,le$1,true);const t=Lr();f&&yr(t)&&t.isCollapsed()&&(un=t,setTimeout(()=>un=null));}}return}}var s;if(!yr(o))return;const l=e.data;null!==tn&&Do(false,n,tn),o.dirty&&null===tn||!o.isCollapsed()||bi(o.anchor.getNode())||null===i||o.applyDOMRange(i),tn=null;const a=o.anchor,u=o.focus,d=a.getNode(),h=u.getNode();if("insertText"!==r&&"insertTranspose"!==r)switch(e.preventDefault(),r){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":Go(n,ue$1,e);break;case "insertFromComposition":yo(null),Go(n,ue$1,e);break;case "insertLineBreak":yo(null),Go(n,ce$1,false);break;case "insertParagraph":yo(null),sn&&!c?(sn=false,Go(n,ce$1,false)):Go(n,ae$1,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":Go(n,fe$1,e);break;case "deleteByComposition":(function(t,e){return t!==e||Si(t)||Si(e)||!so(t)||!so(e)})(d,h)&&Go(n,de$1,e);break;case "deleteByDrag":case "deleteByCut":Go(n,de$1,e);break;case "deleteContent":Go(n,le$1,false);break;case "deleteWordBackward":Go(n,he$1,true);break;case "deleteWordForward":Go(n,he$1,false);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":Go(n,ge$1,true);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":Go(n,ge$1,false);break;case "formatStrikeThrough":Go(n,_e$1,"strikethrough");break;case "formatBold":Go(n,_e$1,"bold");break;case "formatItalic":Go(n,_e$1,"italic");break;case "formatUnderline":Go(n,_e$1,"underline");break;case "historyUndo":Go(n,pe$1,void 0);break;case "historyRedo":Go(n,ye$1,void 0);}else {if("\n"===l)e.preventDefault(),Go(n,ce$1,false);else if(l===D$3)e.preventDefault(),Go(n,ae$1,void 0);else if(null==l&&e.dataTransfer){const t=e.dataTransfer.getData("text/plain");e.preventDefault(),o.insertRawText(t);}else null!=l&&dn(o,i,l,e.timeStamp,true)?(e.preventDefault(),Go(n,ue$1,l)):tn=l;Ze$1=e.timeStamp;}});}(e,n)]);let Xe$1=0,Qe$1=null,Ze$1=0,tn=null;const en=new WeakMap,nn=new WeakMap;let rn=false,on=false,sn=false,ln=false,cn=false,an="",un=null,fn=[0,"",0,"root",0];function dn(t,e,n,r,i){const o=t.anchor,l=t.focus,c=o.getNode(),a=ii(),u=ps(ss(a)),f=null!==u?u.anchorNode:null,d=o.key,h=a.getElementByKey(d),g=n.length;return d!==l.key||!lr(c)||(!i&&(!s||Ze$1<r+50)||c.isDirty()&&g<2||Oo(n))&&o.offset!==l.offset&&!c.isComposing()||lo(c)||c.isDirty()&&g>1||(i||!s)&&null!==h&&!c.isComposing()&&f!==uo(h)||null!==u&&null!==e&&(!e.collapsed||e.startContainer!==u.anchorNode||e.startOffset!==u.anchorOffset)||c.getFormat()!==t.format||c.getStyle()!==t.style||function(t,e){if(e.isSegmented())return true;if(!t.isCollapsed())return false;const n=t.anchor.offset,r=e.getParentOrThrow(),i=so(e);return 0===n?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||i||function(t){const e=t.getPreviousSibling();return (lr(e)||Si(e)&&e.isInline())&&!e.canInsertTextAfter()}(e):n===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||i)}(t,c)}function hn(t,e){return co(t)&&null!==t.nodeValue&&0!==e&&e!==t.nodeValue.length}function gn(e,n,r){const{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=e;rn&&(rn=false,hn(i,o)&&hn(s,l)&&!un)||yi(n,()=>{if(!r)return void wo(null);if(!eo(n,i,s))return;let c=Lr();if(un&&yr(c)&&c.isCollapsed()){const t=c.anchor,e=un.anchor;(t.key===e.key&&t.offset===e.offset+1||1===t.offset&&e.getNode().is(t.getNode().getPreviousSibling()))&&(c=un.clone(),wo(c));}if(un=null,yr(c)){const r=c.anchor,i=r.getNode();if(c.isCollapsed()){"Range"===e.type&&e.anchorNode===e.focusNode&&(c.dirty=true);const o=ss(n).event,s=o?o.timeStamp:performance.now(),[l,a,u,f,d]=fn,h=No(),g=false===n.isComposing()&&""===h.getTextContent();if(s<d+200&&r.offset===u&&r.key===f)_n(c,l,a);else if("text"===r.type)lr(i)||t(141),pn(c,i);else if("element"===r.type&&!g){Si(i)||t(259);const e=r.getNode();e.isEmpty()?function(t,e){const n=e.getTextFormat(),r=e.getTextStyle();_n(t,n,r);}(c,e):_n(c,0,"");}}else {const t=r.key,e=c.focus.key,n=c.getNodes(),i=n.length,s=c.isBackward(),a=s?l:o,u=s?o:l,f=s?e:t,d=s?t:e;let h=2047,g=false;for(let t=0;t<i;t++){const e=n[t],r=e.getTextContentSize();if(lr(e)&&0!==r&&!(0===t&&e.__key===f&&a===r||t===i-1&&e.__key===d&&0===u)&&(g=true,h&=e.getFormat(),0===h))break}c.format=g?h:0;}}Go(n,ie$1,void 0);});}function _n(t,e,n){t.format===e&&t.style===n||(t.format=e,t.style=n,t.dirty=true);}function pn(t,e){_n(t,e.getFormat(),e.getStyle());}function yn(t){if(!t.getTargetRanges)return null;const e=t.getTargetRanges();return 0===e.length?null:e[0]}function mn(t,e){const n=t._compositionKey;if(yo(null),null!==n&&null!=e){if(""===e){const e=xo(n),r=uo(t.getElementByKey(n));return void(null!==r&&null!==r.nodeValue&&lr(e)&&Fo(e,r.nodeValue,null,null,true))}if("\n"===e[e.length-1]){const e=Lr();if(yr(e)){const n=e.focus;return e.anchor.set(n.key,n.offset,n.type),void Go(t,Ne$1,null)}}}Do(true,t,e);}function xn(t){let e=t.__lexicalEventHandles;return void 0===e&&(e=[],t.__lexicalEventHandles=e),e}const Cn=new Map;function Sn(t){const e=ys(t.target);if(null===e)return;const n=ro(e.anchorNode);if(null===n)return;on&&(on=false,yi(n,()=>{const r=Ir(),i=e.anchorNode;if(Cs(i)||co(i)){wo(Fr(r,e,n,t));}}));const r=Mo(n),i=r[r.length-1],o=i._key,s=Cn.get(o),l=s||i;l!==n&&gn(e,l,false),gn(e,n,true),n!==i?Cn.set(o,n):s&&Cn.delete(o);}function vn(t){t._lexicalHandled=true;}function kn(t){return true===t._lexicalHandled}function Nn(e){const n=en.get(e);if(void 0===n)return void 0;const r=nn.get(n);if(void 0===r)return void 0;const i=r-1;i>=0||t(164),en.delete(e),nn.set(n,i),0===i&&n.removeEventListener("selectionchange",Sn);const o=io(e);no(o)?(!function(t){if(null!==t._parentEditor){const e=Mo(t),n=e[e.length-1]._key;Cn.get(n)===t&&Cn.delete(n);}else Cn.delete(t._key);}(o),e.__lexicalEditor=null):o&&t(198);const s=xn(e);for(let t=0;t<s.length;t++)s[t]();e.__lexicalEventHandles=[];}function bn(t,e,n){ei();const r=t.__key,i=t.getParent();if(null===i)return;const o=function(t){const e=Lr();if(!yr(e)||!Si(t))return e;const{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();is(i,t)&&n.set(t.__key,0,"element");is(o,t)&&r.set(t.__key,0,"element");return e}(t);let s=false;if(yr(o)&&e){const e=o.anchor,n=o.focus;e.key===r&&(Rr(e,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true),n.key===r&&(Rr(n,t,i,t.getPreviousSibling(),t.getNextSibling()),s=true);}else xr(o)&&e&&t.isSelected()&&t.selectPrevious();if(yr(o)&&e&&!s){const e=t.getIndexWithinParent();_o(t),Kr(o,i,e,-1);}else _o(t);n||as(i)||i.canBeEmpty()||!i.isEmpty()||bn(i,e),e&&o&&bi(i)&&i.isEmpty()&&i.selectEnd();}function wn(t){return t}const En=Symbol.for("ephemeral");function On(t){return t[En]||false}class Mn{__type;__key;__parent;__prev;__next;__state;static getType(){const{ownNodeType:e}=Is(this);return void 0===e&&t(64,this.name),e}static clone(e){t(65,this.name);}$config(){return {}}config(t,e){const n=e.extends||Object.getPrototypeOf(this.constructor);return Object.assign(e,{extends:n,type:t}),{[t]:e}}afterCloneFrom(t){this.__key===t.__key?(this.__parent=t.__parent,this.__next=t.__next,this.__prev=t.__prev,this.__state=t.__state):t.__state&&(this.__state=t.__state.getWritable(this));}static importDOM;constructor(t){this.__type=this.constructor.getType(),this.__parent=null,this.__prev=null,this.__next=null,Object.defineProperty(this,"__state",{configurable:true,enumerable:false,value:void 0,writable:true}),go(this,t);}getType(){return this.__type}isInline(){t(137,this.constructor.name);}isAttached(){let t=this.__key;for(;null!==t;){if("root"===t)return true;const e=xo(t);if(null===e)break;t=e.__parent;}return false}isSelected(t){const e=t||Lr();if(null==e)return false;const n=e.getNodes().some(t=>t.__key===this.__key);if(lr(this))return n;if(yr(e)&&"element"===e.anchor.type&&"element"===e.focus.type){if(e.isCollapsed())return false;const t=this.getParent();if(Ti(this)&&this.isInline()&&t){const n=e.isBackward()?e.focus:e.anchor;if(t.is(n.getNode())&&n.offset===t.getChildrenSize()&&this.is(t.getLastChild()))return false}}return n}getKey(){return this.__key}getIndexWithinParent(){const t=this.getParent();if(null===t)return -1;let e=t.getFirstChild(),n=0;for(;null!==e;){if(this.is(e))return n;n++,e=e.getNextSibling();}return -1}getParent(){const t=this.getLatest().__parent;return null===t?null:xo(t)}getParentOrThrow(){const e=this.getParent();return null===e&&t(66,this.__key),e}getTopLevelElement(){let e=this;for(;null!==e;){const n=e.getParent();if(as(n))return Si(e)||e===this&&Ti(e)||t(194),e;e=n;}return null}getTopLevelElementOrThrow(){const e=this.getTopLevelElement();return null===e&&t(67,this.__key),e}getParents(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e),e=e.getParent();return t}getParentKeys(){const t=[];let e=this.getParent();for(;null!==e;)t.push(e.__key),e=e.getParent();return t}getPreviousSibling(){const t=this.getLatest().__prev;return null===t?null:xo(t)}getPreviousSiblings(){const t=[],e=this.getParent();if(null===e)return t;let n=e.getFirstChild();for(;null!==n&&!n.is(this);)t.push(n),n=n.getNextSibling();return t}getNextSibling(){const t=this.getLatest().__next;return null===t?null:xo(t)}getNextSiblings(){const t=[];let e=this.getNextSibling();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getCommonAncestor(t){const e=Si(this)?this:this.getParent(),n=Si(t)?t:t.getParent(),r=e&&n?ml(e,n):null;return r?r.commonAncestor:null}is(t){return null!=t&&this.__key===t.__key}isBefore(e){const n=ml(this,e);return null!==n&&("descendant"===n.type||("branch"===n.type?-1===_l(n):("same"!==n.type&&"ancestor"!==n.type&&t(279),false)))}isParentOf(t){const e=ml(this,t);return null!==e&&"ancestor"===e.type}getNodesBetween(e){const n=this.isBefore(e),r=[],i=new Set;let o=this;for(;null!==o;){const s=o.__key;if(i.has(s)||(i.add(s),r.push(o)),o===e)break;const l=Si(o)?n?o.getFirstChild():o.getLastChild():null;if(null!==l){o=l;continue}const c=n?o.getNextSibling():o.getPreviousSibling();if(null!==c){o=c;continue}const a=o.getParentOrThrow();if(i.has(a.__key)||r.push(a),a===e)break;let u=null,f=a;do{if(null===f&&t(68),u=n?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null===f)break;null!==u||i.has(f.__key)||r.push(f);}while(null===u);o=u;}return n||r.reverse(),r}isDirty(){const t=ii()._dirtyLeaves;return null!==t&&t.has(this.__key)}getLatest(){if(On(this))return this;const e=xo(this.__key);return null===e&&t(113),e}getWritable(){if(On(this))return this;ei();const t=ri(),e=ii(),n=t._nodeMap,r=this.__key,i=this.getLatest(),o=e._cloneNotNeeded,s=Lr();if(null!==s&&s.setCachedNodes(null),o.has(r))return po(i),i;const l=Ms(i);return o.add(r),po(l),n.set(r,l),l}getTextContent(){return ""}getTextContentSize(){return this.getTextContent().length}createDOM(e,n){t(70);}updateDOM(e,n,r){t(71);}exportDOM(t){return {element:this.createDOM(t._config,t)}}exportJSON(){const t=this.__state?this.__state.toJSON():void 0;return {type:this.__type,version:1,...t}}static importJSON(e){t(18,this.name);}updateFromJSON(t){return function(t,e){const n=t.getWritable(),r=e.$;let i=r;for(const t of dt$3(n).flatKeys)t in e&&(void 0!==i&&i!==r||(i={...r}),i[t]=e[t]);return (n.__state||i)&&ft$2(t).updateFromJSON(i),n}(this,t)}static transform(){return null}remove(t){bn(this,true,t);}replace(e,n){ei();let r=Lr();null!==r&&(r=r.clone()),ds(this,e);const i=this.getLatest(),o=this.__key,s=e.__key,l=e.getWritable(),c=this.getParentOrThrow().getWritable(),a=c.__size;_o(l);const u=i.getPreviousSibling(),f=i.getNextSibling(),d=i.__prev,h=i.__next,g=i.__parent;if(bn(i,false,true),null===u)c.__first=s;else {u.getWritable().__next=s;}if(l.__prev=d,null===f)c.__last=s;else {f.getWritable().__prev=s;}if(l.__next=h,l.__parent=g,c.__size=a,n&&(Si(this)&&Si(l)||t(139),this.getChildren().forEach(t=>{l.append(t);})),yr(r)){wo(r);const t=r.anchor,e=r.focus;t.key===o&&_r(t,l),e.key===o&&_r(e,l);}return mo()===o&&yo(s),l}insertAfter(t,e=true){ei(),ds(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.getParent(),o=Lr();let s=false,l=false;if(null!==i){const e=t.getIndexWithinParent();if(_o(r),yr(o)){const t=i.__key,n=o.anchor,r=o.focus;s="element"===n.type&&n.key===t&&n.offset===e+1,l="element"===r.type&&r.key===t&&r.offset===e+1;}}const c=this.getNextSibling(),a=this.getParentOrThrow().getWritable(),u=r.__key,f=n.__next;if(null===c)a.__last=u;else {c.getWritable().__prev=u;}if(a.__size++,n.__next=u,r.__next=f,r.__prev=n.__key,r.__parent=n.__parent,e&&yr(o)){const t=this.getIndexWithinParent();Kr(o,a,t+1);const e=a.__key;s&&o.anchor.set(e,t+2,"element"),l&&o.focus.set(e,t+2,"element");}return t}insertBefore(t,e=true){ei(),ds(this,t);const n=this.getWritable(),r=t.getWritable(),i=r.__key;_o(r);const o=this.getPreviousSibling(),s=this.getParentOrThrow().getWritable(),l=n.__prev,c=this.getIndexWithinParent();if(null===o)s.__first=i;else {o.getWritable().__next=i;}s.__size++,n.__prev=i,r.__prev=l,r.__next=n.__key,r.__parent=n.__parent;const a=Lr();if(e&&yr(a)){Kr(a,this.getParentOrThrow(),c);}return t}isParentRequired(){return false}createParentElementNode(){return Li()}selectStart(){return this.selectPrevious()}selectEnd(){return this.selectNext(0,0)}selectPrevious(t,e){ei();const n=this.getPreviousSibling(),r=this.getParentOrThrow();if(null===n)return r.select(0,0);if(Si(n))return n.select();if(!lr(n)){const t=n.getIndexWithinParent()+1;return r.select(t,t)}return n.select(t,e)}selectNext(t,e){ei();const n=this.getNextSibling(),r=this.getParentOrThrow();if(null===n)return r.select();if(Si(n))return n.select(0,0);if(!lr(n)){const t=n.getIndexWithinParent();return r.select(t,t)}return n.select(t,e)}markDirty(){this.getWritable();}reconcileObservedMutation(t,e){this.markDirty();}}const An="historic",Pn="history-push",Dn="history-merge",Fn="paste",Ln="collaboration",Kn="skip-scroll-into-view",zn="skip-dom-selection",Rn="skip-selection-focus";class Bn extends Mn{static getType(){return "linebreak"}static clone(t){return new Bn(t.__key)}constructor(t){super(t);}getTextContent(){return "\n"}createDOM(){return document.createElement("br")}updateDOM(){return false}isInline(){return true}static importDOM(){return {br:t=>function(t){const e=t.parentElement;if(null!==e&&Ts(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&$n(n)){const n=e.lastChild;if(n===t||n.previousSibling===t&&$n(n))return true}}return false}(t)||function(t){const e=t.parentElement;if(null!==e&&Ts(e)){const n=e.firstChild;if(n===t||n.nextSibling===t&&$n(n))return false;const r=e.lastChild;if(r===t||r.previousSibling===t&&$n(r))return true}return false}(t)?null:{conversion:Wn,priority:0}}}static importJSON(t){return Jn().updateFromJSON(t)}}function Wn(t){return {node:Jn()}}function Jn(){return fs(new Bn)}function jn(t){return t instanceof Bn}function $n(t){return co(t)&&/^( |\t|\r?\n)+$/.test(t.textContent||"")}function Un(t,e){return 16&e?"code":e&T$3?"mark":32&e?"sub":64&e?"sup":null}function Vn(t,e){return 1&e?"strong":2&e?"em":"span"}function Yn(t,e,n,r,i){const o=r.classList;let s=$o(i,"base");void 0!==s&&o.add(...s),s=$o(i,"underlineStrikethrough");let l=false;const c=8&e&&4&e;void 0!==s&&(8&n&&4&n?(l=true,c||o.add(...s)):c&&o.remove(...s));for(const t in R$4){const r=R$4[t];if(s=$o(i,t),void 0!==s)if(n&r){if(l&&("underline"===t||"strikethrough"===t)){e&r&&o.remove(...s);continue}(0===(e&r)||c&&"underline"===t||"strikethrough"===t)&&o.add(...s);}else e&r&&o.remove(...s);}}function qn(t,e,n){const r=e.firstChild,i=n.isComposing(),s=t+(i?P$3:"");if(null==r)e.textContent=s;else {const t=r.nodeValue;if(t!==s)if(i||o){const[e,n,i]=function(t,e){const n=t.length,r=e.length;let i=0,o=0;for(;i<n&&i<r&&t[i]===e[i];)i++;for(;o+i<n&&o+i<r&&t[n-o-1]===e[r-o-1];)o++;return [i,n-i-o,e.slice(i,r-o)]}(t,s);0!==n&&r.deleteData(e,n),r.insertData(e,i);}else r.nodeValue=s;}}function Hn(t,e,n,r,i,o){qn(i,t,e);const s=o.theme.text;void 0!==s&&Yn(0,0,r,t,s);}function Gn(t,e){const n=document.createElement(e);return n.appendChild(t),n}class Xn extends Mn{__text;__format;__style;__mode;__detail;static getType(){return "text"}static clone(t){return new Xn(t.__text,t.__key)}afterCloneFrom(t){super.afterCloneFrom(t),this.__text=t.__text,this.__format=t.__format,this.__style=t.__style,this.__mode=t.__mode,this.__detail=t.__detail;}constructor(t="",e){super(e),this.__text=t,this.__format=0,this.__style="",this.__mode=0,this.__detail=0;}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){const t=this.getLatest();return $$4[t.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===mo()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return !!(1&this.getLatest().__detail)}isUnmergeable(){return !!(2&this.getLatest().__detail)}hasFormat(t){const e=R$4[t];return 0!==(this.getFormat()&e)}isSimpleText(){return "text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(t,e){return fo(this.getLatest().__format,t,e)}canHaveFormat(){return true}isInline(){return true}createDOM(t,e){const n=this.__format,r=Un(0,n),i=Vn(0,n),o=null===r?i:r,s=document.createElement(o);let l=s;this.hasFormat("code")&&s.setAttribute("spellcheck","false"),null!==r&&(l=document.createElement(i),s.appendChild(l));Hn(l,this,0,n,this.__text,t);const c=this.__style;return ""!==c&&(s.style.cssText=c),s}updateDOM(e,n,r){const i=this.__text,o=e.__format,s=this.__format,l=Un(0,o),c=Un(0,s),a=Vn(0,o),u=Vn(0,s);if((null===l?a:l)!==(null===c?u:c))return true;if(l===c&&a!==u){const e=n.firstChild;null==e&&t(48);const o=document.createElement(u);return Hn(o,this,0,s,i,r),n.replaceChild(o,e),false}let f=n;null!==c&&null!==l&&(f=n.firstChild,null==f&&t(49)),qn(i,f,this);const d=r.theme.text;void 0!==d&&o!==s&&Yn(0,o,s,f,d);const h=e.__style,g=this.__style;return h!==g&&(n.style.cssText=g),false}static importDOM(){return {"#text":()=>({conversion:nr,priority:0}),b:()=>({conversion:Zn,priority:0}),code:()=>({conversion:or,priority:0}),em:()=>({conversion:or,priority:0}),i:()=>({conversion:or,priority:0}),mark:()=>({conversion:or,priority:0}),s:()=>({conversion:or,priority:0}),span:()=>({conversion:Qn,priority:0}),strong:()=>({conversion:or,priority:0}),sub:()=>({conversion:or,priority:0}),sup:()=>({conversion:or,priority:0}),u:()=>({conversion:or,priority:0})}}static importJSON(t){return sr().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTextContent(t.text).setFormat(t.format).setDetail(t.detail).setMode(t.mode).setStyle(t.style)}exportDOM(e){let{element:n}=super.exportDOM(e);return Cs(n)||t(132),n.style.whiteSpace="pre-wrap",this.hasFormat("lowercase")?n.style.textTransform="lowercase":this.hasFormat("uppercase")?n.style.textTransform="uppercase":this.hasFormat("capitalize")&&(n.style.textTransform="capitalize"),this.hasFormat("bold")&&(n=Gn(n,"b")),this.hasFormat("italic")&&(n=Gn(n,"i")),this.hasFormat("strikethrough")&&(n=Gn(n,"s")),this.hasFormat("underline")&&(n=Gn(n,"u")),{element:n}}exportJSON(){return {detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),...super.exportJSON()}}selectionTransform(t,e){}setFormat(t){const e=this.getWritable();return e.__format="string"==typeof t?R$4[t]:t,e}setDetail(t){const e=this.getWritable();return e.__detail="string"==typeof t?B$3[t]:t,e}setStyle(t){const e=this.getWritable();return e.__style=t,e}toggleFormat(t){const e=fo(this.getFormat(),t,null);return this.setFormat(e)}toggleDirectionless(){const t=this.getWritable();return t.__detail^=1,t}toggleUnmergeable(){const t=this.getWritable();return t.__detail^=2,t}setMode(t){const e=j$2[t];if(this.__mode===e)return this;const n=this.getWritable();return n.__mode=e,n}setTextContent(t){if(this.__text===t)return this;const e=this.getWritable();return e.__text=t,e}select(t,e){ei();let n=t,r=e;const i=Lr(),o=this.getTextContent(),s=this.__key;if("string"==typeof o){const t=o.length;void 0===n&&(n=t),void 0===r&&(r=t);}else n=0,r=0;if(!yr(i))return Mr(s,n,s,r,"text","text");{const t=mo();t!==i.anchor.key&&t!==i.focus.key||yo(s),i.setTextNodeRange(this,n,this,r);}return i}selectStart(){return this.select(0,0)}selectEnd(){const t=this.getTextContentSize();return this.select(t,t)}spliceText(t,e,n,r){const i=this.getWritable(),o=i.__text,s=n.length;let l=t;l<0&&(l=s+l,l<0&&(l=0));const c=Lr();if(r&&yr(c)){const e=t+s;c.setTextNodeRange(i,e,i,e);}const a=o.slice(0,l)+n+o.slice(l+e);return i.__text=a,i}canInsertTextBefore(){return true}canInsertTextAfter(){return true}splitText(...t){ei();const e=this.getLatest(),n=e.getTextContent();if(""===n)return [];const r=e.__key,i=mo(),o=n.length;t.sort((t,e)=>t-e),t.push(o);const s=[],l=t.length;for(let e=0,r=0;e<o&&r<=l;r++){const i=t[r];i>e&&(s.push(n.slice(e,i)),e=i);}const c=s.length;if(1===c)return [e];const a=s[0],u=e.getParent();let f;const d=e.getFormat(),h=e.getStyle(),g=e.__detail;let _=false,p=null,y=null;const m=Lr();if(yr(m)){const[t,e]=m.isBackward()?[m.focus,m.anchor]:[m.anchor,m.focus];"text"===t.type&&t.key===r&&(p=t),"text"===e.type&&e.key===r&&(y=e);}e.isSegmented()?(f=sr(a),f.__format=d,f.__style=h,f.__detail=g,f.__state=yt$3(e,f),_=true):f=e.setTextContent(a);const x=[f];for(let t=1;t<c;t++){const n=sr(s[t]);n.__format=d,n.__style=h,n.__detail=g,n.__state=yt$3(e,n);const o=n.__key;i===r&&yo(o),x.push(n);}const C=p?p.offset:null,S=y?y.offset:null;let v=0;for(const t of x){if(!p&&!y)break;const e=v+t.getTextContentSize();if(null!==p&&null!==C&&C<=e&&C>=v&&(p.set(t.getKey(),C-v,"text"),C<e&&(p=null)),null!==y&&null!==S&&S<=e&&S>=v){y.set(t.getKey(),S-v,"text");break}v=e;}if(null!==u){!function(t){const e=t.getPreviousSibling(),n=t.getNextSibling();null!==e&&po(e);null!==n&&po(n);}(this);const t=u.getWritable(),e=this.getIndexWithinParent();_?(t.splice(e,0,x),this.remove()):t.splice(e,1,x),yr(m)&&Kr(m,u,e,c-1);}return x}mergeWithSibling(e){const n=e===this.getPreviousSibling();n||e===this.getNextSibling()||t(50);const r=this.__key,i=e.__key,o=this.__text,s=o.length;mo()===i&&yo(r);const l=Lr();if(yr(l)){const t=l.anchor,o=l.focus;null!==t&&t.key===i&&Br(t,n,r,e,s),null!==o&&o.key===i&&Br(o,n,r,e,s);}const c=e.__text,a=n?c+o:o+c;this.setTextContent(a);const u=this.getWritable();return e.remove(),u}isTextEntity(){return false}}function Qn(t){return {forChild:cr(t.style),node:null}}function Zn(t){const e=t,n="normal"===e.style.fontWeight;return {forChild:cr(e.style,n?void 0:"bold"),node:null}}const tr=new WeakMap;function er(t){if(!Cs(t))return false;if("PRE"===t.nodeName)return true;const e=t.style.whiteSpace;return "string"==typeof e&&e.startsWith("pre")}function nr(e){const n=e;null===e.parentElement&&t(129);let r=n.textContent||"";if(null!==function(t){let e,n=t.parentNode;const r=[t];for(;null!==n&&void 0===(e=tr.get(n))&&!er(n);)r.push(n),n=n.parentNode;const i=void 0===e?n:e;for(let t=0;t<r.length;t++)tr.set(r[t],i);return i}(n)){const t=r.split(/(\r?\n|\t)/),e=[],n=t.length;for(let r=0;r<n;r++){const n=t[r];"\n"===n||"\r\n"===n?e.push(Jn()):"\t"===n?e.push(ur()):""!==n&&e.push(sr(n));}return {node:e}}if(r=r.replace(/\r/g,"").replace(/[ \t\n]+/g," "),""===r)return {node:null};if(" "===r[0]){let t=n,e=true;for(;null!==t&&null!==(t=rr(t,false));){const n=t.textContent||"";if(n.length>0){/[ \t\n]$/.test(n)&&(r=r.slice(1)),e=false;break}}e&&(r=r.slice(1));}if(" "===r[r.length-1]){let t=n,e=true;for(;null!==t&&null!==(t=rr(t,true));){if((t.textContent||"").replace(/^( |\t|\r?\n)+/,"").length>0){e=false;break}}e&&(r=r.slice(0,r.length-1));}return ""===r?{node:null}:{node:sr(r)}}function rr(t,e){let n=t;for(;;){let t;for(;null===(t=e?n.nextSibling:n.previousSibling);){const t=n.parentElement;if(null===t)return null;n=t;}if(n=t,Cs(n)){const t=n.style.display;if(""===t&&!ks(n)||""!==t&&!t.startsWith("inline"))return null}let r=n;for(;null!==(r=e?n.firstChild:n.lastChild);)n=r;if(co(n))return n;if("BR"===n.nodeName)return null}}const ir={code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"};function or(t){const e=ir[t.nodeName.toLowerCase()];return void 0===e?{node:null}:{forChild:cr(t.style,e),node:null}}function sr(t=""){return fs(new Xn(t))}function lr(t){return t instanceof Xn}function cr(t,e){const n=t.fontWeight,r=t.textDecoration.split(" "),i="700"===n||"bold"===n,o=r.includes("line-through"),s="italic"===t.fontStyle,l=r.includes("underline"),c=t.verticalAlign;return t=>lr(t)?(i&&!t.hasFormat("bold")&&t.toggleFormat("bold"),o&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),s&&!t.hasFormat("italic")&&t.toggleFormat("italic"),l&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==c||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==c||t.hasFormat("superscript")||t.toggleFormat("superscript"),e&&!t.hasFormat(e)&&t.toggleFormat(e),t):t}class ar extends Xn{static getType(){return "tab"}static clone(t){return new ar(t.__key)}constructor(t){super("\t",t),this.__detail=2;}static importDOM(){return null}createDOM(t){const e=super.createDOM(t),n=$o(t.theme,"tab");if(void 0!==n){e.classList.add(...n);}return e}static importJSON(t){return ur().updateFromJSON(t)}setTextContent(t){return "\t"!==t&&""!==t&&e(126),super.setTextContent("\t")}spliceText(e,n,r,i){return ""===r&&0===n||"\t"===r&&1===n||t(286),this}setDetail(e){return 2!==e&&t(127),this}setMode(e){return "normal"!==e&&t(128),this}canInsertTextBefore(){return false}canInsertTextAfter(){return false}}function ur(){return fs(new ar)}function fr(t){return t instanceof ar}class dr{key;offset;type;_selection;constructor(t,e,n){this._selection=null,this.key=t,this.offset=e,this.type=n;}is(t){return this.key===t.key&&this.offset===t.offset&&this.type===t.type}isBefore(t){if(this.key===t.key)return this.offset<t.offset;return gl(El(xl(this,"next")),El(xl(t,"next")))<0}getNode(){const e=xo(this.key);return null===e&&t(20),e}set(t,e,n,r){const i=this._selection,o=this.key;r&&this.key===t&&this.offset===e&&this.type===n||(this.key=t,this.offset=e,this.type=n,ti()||(mo()===o&&yo(t),null!==i&&(i.setCachedNodes(null),i.dirty=true)));}}function hr(t,e,n){return new dr(t,e,n)}function gr(t,e){let n=e.__key,r=t.offset,i="element";if(lr(e)){i="text";const t=e.getTextContentSize();r>t&&(r=t);}else if(!Si(e)){const t=e.getNextSibling();if(lr(t))n=t.__key,r=0,i="text";else {const t=e.getParent();t&&(n=t.__key,r=e.getIndexWithinParent()+1);}}t.set(n,r,i);}function _r(t,e){if(Si(e)){const n=e.getLastDescendant();Si(n)||lr(n)?gr(t,n):gr(t,e);}else gr(t,e);}class pr{_nodes;_cachedNodes;dirty;constructor(t){this._cachedNodes=null,this._nodes=t,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){if(!xr(t))return false;const e=this._nodes,n=t._nodes;return e.size===n.size&&Array.from(e).every(t=>n.has(t))}isCollapsed(){return false}isBackward(){return false}getStartEndPoints(){return null}add(t){this.dirty=true,this._nodes.add(t),this._cachedNodes=null;}delete(t){this.dirty=true,this._nodes.delete(t),this._cachedNodes=null;}clear(){this.dirty=true,this._nodes.clear(),this._cachedNodes=null;}has(t){return this._nodes.has(t)}clone(){return new pr(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(t){}insertText(){}insertNodes(t){const e=this.getNodes(),n=e.length,r=e[n-1];let i;if(lr(r))i=r.select();else {const t=r.getIndexWithinParent()+1;i=r.getParentOrThrow().select(t,t);}i.insertNodes(t);for(let t=0;t<n;t++)e[t].remove();}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=this._nodes,n=[];for(const t of e){const e=xo(t);null!==e&&n.push(e);}return ti()||(this._cachedNodes=n),n}getTextContent(){const t=this.getNodes();let e="";for(let n=0;n<t.length;n++)e+=t[n].getTextContent();return e}deleteNodes(){const t=this.getNodes();if((Lr()||Ir())===this&&t[0]){const e=tl(t[0],"next");Sl(dl(e,e));}for(const e of t)e.remove();}}function yr(t){return t instanceof mr}class mr{format;style;anchor;focus;_cachedNodes;dirty;constructor(t,e,n,r){this.anchor=t,this.focus=e,t._selection=this,e._selection=this,this._cachedNodes=null,this.format=n,this.style=r,this.dirty=false;}getCachedNodes(){return this._cachedNodes}setCachedNodes(t){this._cachedNodes=t;}is(t){return !!yr(t)&&(this.anchor.is(t.anchor)&&this.focus.is(t.focus)&&this.format===t.format&&this.style===t.style)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const t=this._cachedNodes;if(null!==t)return t;const e=function(t){const e=[],[n,r]=t.getTextSlices();n&&e.push(n.caret.origin);const i=new Set,o=new Set;for(const n of t)if(Gs(n)){const{origin:t}=n;0===e.length?i.add(t):(o.add(t),e.push(t));}else {const{origin:t}=n;Si(t)&&o.has(t)||e.push(t);}r&&e.push(r.caret.origin);if(Hs(t.focus)&&Si(t.focus.origin)&&null===t.focus.getNodeAtCaret())for(let n=il(t.focus.origin,"previous");Gs(n)&&i.has(n.origin)&&!n.origin.isEmpty()&&n.origin.is(e[e.length-1]);n=sl(n))i.delete(n.origin),e.pop();for(;e.length>1;){const t=e[e.length-1];if(!Si(t)||o.has(t)||t.isEmpty()||i.has(t))break;e.pop();}if(0===e.length&&t.isCollapsed()){const n=El(t.anchor),r=El(t.anchor.getFlipped()),i=t=>Ys(t)?t.origin:t.getNodeAtCaret(),o=i(n)||i(r)||(t.anchor.getNodeAtCaret()?n.origin:r.origin);e.push(o);}return e}(Al(kl(this),"next"));return ti()||(this._cachedNodes=e),e}setTextNodeRange(t,e,n,r){this.anchor.set(t.__key,e,"text"),this.focus.set(n.__key,r,"text");}getTextContent(){const t=this.getNodes();if(0===t.length)return "";const e=t[0],n=t[t.length-1],r=this.anchor,i=this.focus,o=r.isBefore(i),[s,l]=Sr(this);let c="",a=true;for(let u=0;u<t.length;u++){const f=t[u];if(Si(f)&&!f.isInline())a||(c+="\n"),a=!f.isEmpty();else if(a=false,lr(f)){let t=f.getTextContent();f===e?f===n?"element"===r.type&&"element"===i.type&&i.offset!==r.offset||(t=s<l?t.slice(s,l):t.slice(l,s)):t=o?t.slice(s):t.slice(l):f===n&&(t=o?t.slice(0,l):t.slice(0,s)),c+=t;}else !Ti(f)&&!jn(f)||f===n&&this.isCollapsed()||(c+=f.getTextContent());}return c}applyDOMRange(t){const e=ii(),n=e.getEditorState()._selection,r=Er(t.startContainer,t.startOffset,t.endContainer,t.endOffset,e,n);if(null===r)return;const[i,o]=r;this.anchor.set(i.key,i.offset,i.type,true),this.focus.set(o.key,o.offset,o.type,true),St$5(this);}clone(){const t=this.anchor,e=this.focus;return new mr(hr(t.key,t.offset,t.type),hr(e.key,e.offset,e.type),this.format,this.style)}toggleFormat(t){this.format=fo(this.format,t,null),this.dirty=true;}setFormat(t){this.format=t,this.dirty=true;}setStyle(t){this.style=t,this.dirty=true;}hasFormat(t){const e=R$4[t];return 0!==(this.format&e)}insertRawText(t){const e=t.split(/(\r?\n|\t)/),n=[],r=e.length;for(let t=0;t<r;t++){const r=e[t];"\n"===r||"\r\n"===r?n.push(Jn()):"\t"===r?n.push(ur()):n.push(sr(r));}this.insertNodes(n);}insertText(e){const n=this.anchor,r=this.focus,i=this.format,o=this.style;let s=n,l=r;!this.isCollapsed()&&r.isBefore(n)&&(s=r,l=n),"element"===s.type&&function(t,e,n,r){const i=t.getNode(),o=i.getChildAtIndex(t.offset),s=sr();if(s.setFormat(n),s.setStyle(r),Ii(o))o.splice(0,0,[s]);else {const t=bi(i)?Li().append(s):s;null===o?i.append(t):o.insertBefore(t);}t.is(e)&&e.set(s.__key,0,"text"),t.set(s.__key,0,"text");}(s,l,i,o),"element"===l.type&&Cl(l,El(xl(l,"next")));const c=s.offset;let a=l.offset;const u=this.getNodes(),f=u.length;let d=u[0];lr(d)||t(26);const h=d.getTextContent().length,g=d.getParentOrThrow();let _=u[f-1];if(1===f&&"element"===l.type&&(a=h,l.set(s.key,a,"text")),this.isCollapsed()&&c===h&&(lo(d)||!d.canInsertTextAfter()||!g.canInsertTextAfter()&&null===d.getNextSibling())){let t=d.getNextSibling();if(lr(t)&&t.canInsertTextBefore()&&!lo(t)||(t=sr(),t.setFormat(i),t.setStyle(o),g.canInsertTextAfter()?d.insertAfter(t):g.insertAfter(t)),t.select(0,0),d=t,""!==e)return void this.insertText(e)}else if(this.isCollapsed()&&0===c&&(lo(d)||!d.canInsertTextBefore()||!g.canInsertTextBefore()&&null===d.getPreviousSibling())){let t=d.getPreviousSibling();if(lr(t)&&!lo(t)||(t=sr(),t.setFormat(i),g.canInsertTextBefore()?d.insertBefore(t):g.insertBefore(t)),t.select(),d=t,""!==e)return void this.insertText(e)}else if(d.isSegmented()&&c!==h){const t=sr(d.getTextContent());t.setFormat(i),d.replace(t),d=t;}else if(!this.isCollapsed()&&""!==e){const t=_.getParent();if(!g.canInsertTextBefore()||!g.canInsertTextAfter()||Si(t)&&(!t.canInsertTextBefore()||!t.canInsertTextAfter()))return this.insertText(""),wr(this.anchor,this.focus,null),void this.insertText(e)}if(1===f){if(so(d)){const t=sr(e);return t.select(),void d.replace(t)}const t=d.getFormat(),n=d.getStyle();if(c!==a||t===i&&n===o){if(fr(d)){const t=sr(e);return t.setFormat(i),t.setStyle(o),t.select(),void d.replace(t)}}else {if(""!==d.getTextContent()){const t=sr(e);if(t.setFormat(i),t.setStyle(o),t.select(),0===c)d.insertBefore(t,false);else {const[e]=d.splitText(c);e.insertAfter(t,false);}return void(t.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length))}d.setFormat(i),d.setStyle(o);}const r=a-c;d=d.spliceText(c,r,e,true),""===d.getTextContent()?d.remove():"text"===this.anchor.type&&(d.isComposing()?this.anchor.offset-=e.length:(this.format=t,this.style=n));}else {const t=new Set([...d.getParentKeys(),..._.getParentKeys()]),n=Si(d)?d:d.getParentOrThrow();let r=Si(_)?_:_.getParentOrThrow(),i=_;if(!n.is(r)&&r.isInline())do{i=r,r=r.getParentOrThrow();}while(r.isInline());if("text"===l.type&&(0!==a||""===_.getTextContent())||"element"===l.type&&_.getIndexWithinParent()<a)if(lr(_)&&!so(_)&&a!==_.getTextContentSize()){if(_.isSegmented()){const t=sr(_.getTextContent());_.replace(t),_=t;}bi(l.getNode())||"text"!==l.type||(_=_.spliceText(0,a,"")),t.add(_.__key);}else {const t=_.getParentOrThrow();t.canBeEmpty()||1!==t.getChildrenSize()?_.remove():t.remove();}else t.add(_.__key);const o=r.getChildren(),s=new Set(u),g=n.is(r),p=n.isInline()&&null===d.getNextSibling()?n:d;for(let t=o.length-1;t>=0;t--){const e=o[t];if(e.is(d)||Si(e)&&e.isParentOf(d))break;e.isAttached()&&(!s.has(e)||e.is(i)?g||p.insertAfter(e,false):e.remove());}if(!g){let e=r,n=null;for(;null!==e;){const r=e.getChildren(),i=r.length;(0===i||r[i-1].is(n))&&(t.delete(e.__key),n=e),e=e.getParent();}}if(so(d))if(c===h)d.select();else {const t=sr(e);t.select(),d.replace(t);}else d=d.spliceText(c,h-c,e,true),""===d.getTextContent()?d.remove():d.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=e.length);for(let e=1;e<f;e++){const n=u[e],r=n.__key;t.has(r)||n.remove();}}}removeText(){const t=Lr()===this;vl(this,wl(kl(this))),t&&Lr()!==this&&wo(this);}formatText(t,e=null){if(this.isCollapsed())return this.toggleFormat(t),void yo(null);const n=this.getNodes(),r=[];for(const t of n)lr(t)&&r.push(t);const i=e=>{n.forEach(n=>{if(Si(n)){const r=n.getFormatFlags(t,e);n.setTextFormat(r);}});},o=r.length;if(0===o)return this.toggleFormat(t),yo(null),void i(e);const s=this.anchor,l=this.focus,c=this.isBackward(),a=c?l:s,u=c?s:l;let f=0,d=r[0],h="element"===a.type?0:a.offset;if("text"===a.type&&h===d.getTextContentSize()&&(f=1,d=r[1],h=0),null==d)return;const g=d.getFormatFlags(t,e);i(g);const _=o-1;let p=r[_];const y="text"===u.type?u.offset:p.getTextContentSize();if(d.is(p)){if(h===y)return;if(lo(d)||0===h&&y===d.getTextContentSize())d.setFormat(g);else {const t=d.splitText(h,y),e=0===h?t[0]:t[1];e.setFormat(g),"text"===a.type&&a.set(e.__key,0,"text"),"text"===u.type&&u.set(e.__key,y-h,"text");}return void(this.format=g)}0===h||lo(d)||([,d]=d.splitText(h),h=0),d.setFormat(g);const m=p.getFormatFlags(t,g);y>0&&(y===p.getTextContentSize()||lo(p)||([p]=p.splitText(y)),p.setFormat(m));for(let e=f+1;e<_;e++){const n=r[e],i=n.getFormatFlags(t,m);n.setFormat(i);}"text"===a.type&&a.set(d.__key,h,"text"),"text"===u.type&&u.set(p.__key,y,"text"),this.format=g|m;}insertNodes(e){if(0===e.length)return;if(this.isCollapsed()||this.removeText(),"root"===this.anchor.key){this.insertParagraph();const n=Lr();return yr(n)||t(134),n.insertNodes(e)}const n=(this.isBackward()?this.focus:this.anchor).getNode(),r=zs(n,Ns),i=e[e.length-1];if(Si(r)&&"__language"in r){if("__language"in e[0])this.insertText(e[0].getTextContent());else {const t=Ur(this);r.splice(t,0,e),i.selectEnd();}return}if(!e.some(t=>(Si(t)||Ti(t))&&!t.isInline())){Si(r)||t(211,n.constructor.name,n.getType());const o=Ur(this);return r.splice(o,0,e),void i.selectEnd()}const o=function(t){const e=Li();let n=null;for(let r=0;r<t.length;r++){const i=t[r],o=jn(i);if(o||Ti(i)&&i.isInline()||Si(i)&&i.isInline()||lr(i)||i.isParentRequired()){if(null===n&&(n=i.createParentElementNode(),e.append(n),o))continue;null!==n&&n.append(i);}else e.append(i),n=null;}return e}(e),s=o.getLastDescendant(),l=o.getChildren(),c=!Si(r)||!r.isEmpty()?this.insertParagraph():null,a=l[l.length-1];let u=l[0];var f;Si(f=u)&&Ns(f)&&!f.isEmpty()&&Si(r)&&(!r.isEmpty()||r.canMergeWhenEmpty())&&(Si(r)||t(211,n.constructor.name,n.getType()),r.append(...u.getChildren()),u=l[1]),u&&(null===r&&t(212,n.constructor.name,n.getType()),function(e,n){const r=n.getParentOrThrow().getLastChild();let i=n;const o=[n];for(;i!==r;)i.getNextSibling()||t(140),i=i.getNextSibling(),o.push(i);let s=e;for(const t of o)s=s.insertAfter(t);}(r,u));const d=zs(s,Ns);c&&Si(d)&&(c.canMergeWhenEmpty()||Ns(a))&&(d.append(...c.getChildren()),c.remove()),Si(r)&&r.isEmpty()&&r.remove(),s.selectEnd();const h=Si(r)?r.getLastChild():null;jn(h)&&d!==r&&h.remove();}insertParagraph(){if("root"===this.anchor.key){const t=Li();return No().splice(this.anchor.offset,0,[t]),t.select(),t}const e=Ur(this),n=zs(this.anchor.getNode(),Ns);Si(n)||t(213);const r=n.getChildAtIndex(e),i=r?[r,...r.getNextSiblings()]:[],o=n.insertNewAfter(this,false);return o?(o.append(...i),o.selectStart(),o):null}insertLineBreak(t){const e=Jn();if(this.insertNodes([e]),t){const t=e.getParentOrThrow(),n=e.getIndexWithinParent();t.select(n,n);}}extract(){const t=[...this.getNodes()],e=t.length;let n=t[0],r=t[e-1];const[i,o]=Sr(this),s=this.isBackward(),[l,c]=s?[this.focus,this.anchor]:[this.anchor,this.focus],[a,u]=s?[o,i]:[i,o];if(0===e)return [];if(1===e){if(lr(n)&&!this.isCollapsed()){const t=n.splitText(a,u),e=0===a?t[0]:t[1];return e?(l.set(e.getKey(),0,"text"),c.set(e.getKey(),e.getTextContentSize(),"text"),[e]):[]}return [n]}if(lr(n)&&(a===n.getTextContentSize()?t.shift():0!==a&&([,n]=n.splitText(a),t[0]=n,l.set(n.getKey(),0,"text"))),lr(r)){const e=r.getTextContent().length;0===u?t.pop():u!==e&&([r]=r.splitText(u),t[t.length-1]=r,c.set(r.getKey(),r.getTextContentSize(),"text"));}return t}modify(t,e,n){if(Yr(this,t,e,n))return;const r="move"===t,i=ii(),o=ps(ss(i));if(!o)return;const s=i._blockCursorElement,l=i._rootElement,c=this.focus.getNode();if(null===l||null===s||!Si(c)||c.isInline()||c.canBeEmpty()||_s(s,i,l),this.dirty){let t=Qo(i,this.anchor.key),e=Qo(i,this.focus.key);"text"===this.anchor.type&&(t=uo(t)),"text"===this.focus.type&&(e=uo(e)),t&&e&&Wr(o,t,this.anchor.offset,e,this.focus.offset);}if(function(t,e,n,r){t.modify(e,n,r);}(o,t,e?"backward":"forward",n),o.rangeCount>0){const t=o.getRangeAt(0),n=this.anchor.getNode(),i=bi(n)?n:cs(n);if(this.applyDOMRange(t),this.dirty=true,!r){const n=this.getNodes(),r=[];let s=false;for(let t=0;t<n.length;t++){const e=n[t];is(e,i)?r.push(e):s=true;}if(s&&r.length>0)if(e){const t=r[0];Si(t)?t.selectStart():t.getParentOrThrow().selectStart();}else {const t=r[r.length-1];Si(t)?t.selectEnd():t.getParentOrThrow().selectEnd();}o.anchorNode===t.startContainer&&o.anchorOffset===t.startOffset||function(t){const e=t.focus,n=t.anchor,r=n.key,i=n.offset,o=n.type;n.set(e.key,e.offset,e.type,true),e.set(r,i,o,true);}(this);}}"lineboundary"===n&&Yr(this,t,e,n,"decorators");}forwardDeletion(t,e,n){if(!n&&("element"===t.type&&Si(e)&&t.offset===e.getChildrenSize()||"text"===t.type&&t.offset===e.getTextContentSize())){const t=e.getParent(),n=e.getNextSibling()||(null===t?null:t.getNextSibling());if(Si(n)&&n.isShadowRoot())return true}return false}deleteCharacter(t){const e=this.isCollapsed();if(this.isCollapsed()){const e=this.anchor;let n=e.getNode();if(this.forwardDeletion(e,n,t))return;const r=ul(xl(e,t?"previous":"next"));if(r.getTextSlices().every(t=>null===t||0===t.distance)){let t={type:"initial"};for(const e of r.iterNodeCarets("shadowRoot"))if(Gs(e))if(e.origin.isInline());else {if(e.origin.isShadowRoot()){if("merge-block"===t.type)break;if(Si(r.anchor.origin)&&r.anchor.origin.isEmpty()){const t=El(e);vl(this,dl(t,t)),r.anchor.origin.remove();}return}"merge-next-block"!==t.type&&"merge-block"!==t.type||(t={block:t.block,caret:e,type:"merge-block"});}else {if("merge-block"===t.type)break;if(Hs(e)){if(Si(e.origin)){if(e.origin.isInline()){if(!e.origin.isParentOf(r.anchor.origin))break}else t={block:e.origin,type:"merge-next-block"};continue}if(Ti(e.origin)){if(e.origin.isIsolated());else if("merge-next-block"===t.type&&(e.origin.isKeyboardSelectable()||!e.origin.isInline())&&Si(r.anchor.origin)&&r.anchor.origin.isEmpty()){r.anchor.origin.remove();const t=Pr();t.add(e.origin.getKey()),wo(t);}else e.origin.remove();return}break}}if("merge-block"===t.type){const{caret:e,block:n}=t;return vl(this,dl(!e.origin.isEmpty()&&n.isEmpty()?Tl(tl(n,e.direction)):r.anchor,e)),this.removeText()}}const i=this.focus;if(this.modify("extend",t,"character"),this.isCollapsed()){if(t&&0===e.offset&&vr(this,e.getNode()))return}else {const r="text"===i.type?i.getNode():null;if(n="text"===e.type?e.getNode():null,null!==r&&r.isSegmented()){const e=i.offset,o=r.getTextContentSize();if(r.is(n)||t&&e!==o||!t&&0!==e)return void Tr(r,t,e)}else if(null!==n&&n.isSegmented()){const i=e.offset,o=n.getTextContentSize();if(n.is(r)||t&&0!==i||!t&&i!==o)return void Tr(n,t,i)}!function(t,e){const n=t.anchor,r=t.focus,i=n.getNode(),o=r.getNode();if(i===o&&"text"===n.type&&"text"===r.type){const t=n.offset,o=r.offset,s=t<o,l=s?t:o,c=s?o:t,a=c-1;if(l!==a){(function(t){return !(Oo(t)||kr(t))})(i.getTextContent().slice(l,c))&&(e?r.set(r.key,a,r.type):n.set(n.key,a,n.type));}}}(this,t);}}if(this.removeText(),t&&!e&&this.isCollapsed()&&"element"===this.anchor.type&&0===this.anchor.offset){const t=this.anchor.getNode();t.isEmpty()&&bi(t.getParent())&&null===t.getPreviousSibling()&&vr(this,t);}}deleteLine(t){this.isCollapsed()&&this.modify("extend",t,"lineboundary"),this.isCollapsed()?this.deleteCharacter(t):this.removeText();}deleteWord(t){if(this.isCollapsed()){const e=this.anchor,n=e.getNode();if(this.forwardDeletion(e,n,t))return;this.modify("extend",t,"word");}this.removeText();}isBackward(){return this.focus.isBefore(this.anchor)}getStartEndPoints(){return [this.anchor,this.focus]}}function xr(t){return t instanceof pr}function Cr(t){const e=t.offset;if("text"===t.type)return e;const n=t.getNode();return e===n.getChildrenSize()?n.getTextContent().length:0}function Sr(t){const e=t.getStartEndPoints();if(null===e)return [0,0];const[n,r]=e;return "element"===n.type&&"element"===r.type&&n.key===r.key&&n.offset===r.offset?[0,0]:[Cr(n),Cr(r)]}function vr(t,e){for(let n=e;n;n=n.getParent()){if(Si(n)){if(n.collapseAtStart(t))return true;if(as(n))break}if(n.getPreviousSibling())break}return false}const kr=(()=>{try{const t=new RegExp("\\p{Emoji}","u"),e=t.test.bind(t);if(e("❤️")&&e("#️⃣")&&e("👍"))return e}catch(t){}return ()=>false})();function Tr(t,e,n){const r=t,i=r.getTextContent().split(/(?=\s)/g),o=i.length;let s=0,l=0;for(let t=0;t<o;t++){const r=t===o-1;if(l=s,s+=i[t].length,e&&s===n||s>n||r){i.splice(t,1),r&&(l=void 0);break}}const c=i.join("").trim();""===c?r.remove():(r.setTextContent(c),r.select(l,l));}function Nr(e,n,r,i){let o,s=n;if(Cs(e)){let l=false;const c=e.childNodes,a=c.length,u=i._blockCursorElement;s===a&&(l=true,s=a-1);let f=c[s],d=false;if(f===u)f=c[s+1],d=true;else if(null!==u){const t=u.parentNode;if(e===t){n>Array.prototype.indexOf.call(t.children,u)&&s--;}}if(o=Eo(f),lr(o))s=nl(o,l?"next":"previous");else {let c=Eo(e);if(null===c)return null;if(Si(c)){const a=i.getElementByKey(c.getKey());null===a&&t(214);const u=c.getDOMSlot(a);[c,s]=u.resolveChildIndex(c,a,e,n),Si(c)||t(215),l&&s>=c.getChildrenSize()&&(s=Math.max(0,c.getChildrenSize()-1));let f=c.getChildAtIndex(s);if(Si(f)&&function(t,e,n){const r=t.getParent();return null===n||null===r||!r.canBeEmpty()||r!==n.getNode()}(f,0,r)){const t=l?f.getLastDescendant():f.getFirstDescendant();null===t?c=f:(f=t,c=Si(f)?f:f.getParentOrThrow()),s=0;}lr(f)?(o=f,c=null,s=nl(f,l?"next":"previous")):f!==c&&l&&!d&&(Si(c)||t(216),s=Math.min(c.getChildrenSize(),s+1));}else {const t=c.getIndexWithinParent();s=0===n&&Ti(c)&&Eo(e)===c?t:t+1,c=c.getParentOrThrow();}if(Si(c))return hr(c.__key,s,"element")}}else o=Eo(e);return lr(o)?hr(o.__key,nl(o,s,"clamp"),"text"):null}function br(t,e,n){const r=t.offset,i=t.getNode();if(0===r){const r=i.getPreviousSibling(),o=i.getParent();if(e){if((n||!e)&&null===r&&Si(o)&&o.isInline()){const e=o.getPreviousSibling();lr(e)&&t.set(e.__key,e.getTextContent().length,"text");}}else Si(r)&&!n&&r.isInline()?t.set(r.__key,r.getChildrenSize(),"element"):lr(r)&&t.set(r.__key,r.getTextContent().length,"text");}else if(r===i.getTextContent().length){const r=i.getNextSibling(),o=i.getParent();if(e&&Si(r)&&r.isInline())t.set(r.__key,0,"element");else if((n||e)&&null===r&&Si(o)&&o.isInline()&&!o.canInsertTextAfter()){const e=o.getNextSibling();lr(e)&&t.set(e.__key,0,"text");}}}function wr(t,e,n){if("text"===t.type&&"text"===e.type){const r=t.isBefore(e),i=t.is(e);br(t,r,i),br(e,!r,i),i&&e.set(t.key,t.offset,t.type);const o=ii();if(o.isComposing()&&o._compositionKey!==t.key&&yr(n)){const r=n.anchor,i=n.focus;t.set(r.key,r.offset,r.type,true),e.set(i.key,i.offset,i.type,true);}}}function Er(t,e,n,r,i,o){if(null===t||null===n||!eo(i,t,n))return null;const s=Nr(t,e,yr(o)?o.anchor:null,i);if(null===s)return null;const l=Nr(n,r,yr(o)?o.focus:null,i);if(null===l)return null;if("element"===s.type&&"element"===l.type){const e=Eo(t),r=Eo(n);if(Ti(e)&&Ti(r))return null}return wr(s,l,o),[s,l]}function Or(t){return Si(t)&&!t.isInline()}function Mr(t,e,n,r,i,o){const s=ri(),l=new mr(hr(t,e,i),hr(n,r,o),0,"");return l.dirty=true,s._selection=l,l}function Ar(){const t=hr("root",0,"element"),e=hr("root",0,"element");return new mr(t,e,0,"")}function Pr(){return new pr(new Set)}function Fr(t,e,n,r){const i=n._window;if(null===i)return null;const o=r||i.event,s=o?o.type:void 0,l="selectionchange"===s,c=!q$4&&(l||"beforeinput"===s||"compositionstart"===s||"compositionend"===s||"click"===s&&o&&3===o.detail||"drop"===s||void 0===s);let a,u,f,d;if(yr(t)&&!c)return t.clone();if(null===e)return null;if(a=e.anchorNode,u=e.focusNode,f=e.anchorOffset,d=e.focusOffset,(l||void 0===s)&&yr(t)&&!eo(n,a,u))return t.clone();const h=Er(a,f,u,d,n,t);if(null===h)return null;const[g,_]=h;return new mr(g,_,yr(t)?t.format:0,yr(t)?t.style:"")}function Lr(){return ri()._selection}function Ir(){return ii()._editorState._selection}function Kr(t,e,n,r=1){const i=t.anchor,o=t.focus,s=i.getNode(),l=o.getNode();if(!e.is(s)&&!e.is(l))return;const c=e.__key;if(t.isCollapsed()){const e=i.offset;if(n<=e&&r>0||n<e&&r<0){const n=Math.max(0,e+r);i.set(c,n,"element"),o.set(c,n,"element"),zr(t);}}else {const s=t.isBackward(),l=s?o:i,a=l.getNode(),u=s?i:o,f=u.getNode();if(e.is(a)){const t=l.offset;(n<=t&&r>0||n<t&&r<0)&&l.set(c,Math.max(0,t+r),"element");}if(e.is(f)){const t=u.offset;(n<=t&&r>0||n<t&&r<0)&&u.set(c,Math.max(0,t+r),"element");}}zr(t);}function zr(t){const e=t.anchor,n=e.offset,r=t.focus,i=r.offset,o=e.getNode(),s=r.getNode();if(t.isCollapsed()){if(!Si(o))return;const t=o.getChildrenSize(),i=n>=t,s=i?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(lr(s)){let t=0;i&&(t=s.getTextContentSize()),e.set(s.__key,t,"text"),r.set(s.__key,t,"text");}return}if(Si(o)){const t=o.getChildrenSize(),r=n>=t,i=r?o.getChildAtIndex(t-1):o.getChildAtIndex(n);if(lr(i)){let t=0;r&&(t=i.getTextContentSize()),e.set(i.__key,t,"text");}}if(Si(s)){const t=s.getChildrenSize(),e=i>=t,n=e?s.getChildAtIndex(t-1):s.getChildAtIndex(i);if(lr(n)){let t=0;e&&(t=n.getTextContentSize()),r.set(n.__key,t,"text");}}}function Rr(t,e,n,r,i){let o=null,s=0,l=null;null!==r?(o=r.__key,lr(r)?(s=r.getTextContentSize(),l="text"):Si(r)&&(s=r.getChildrenSize(),l="element")):null!==i&&(o=i.__key,lr(i)?l="text":Si(i)&&(l="element")),null!==o&&null!==l?t.set(o,s,l):(s=e.getIndexWithinParent(),-1===s&&(s=n.getChildrenSize()),t.set(n.__key,s,"element"));}function Br(t,e,n,r,i){"text"===t.type?t.set(n,t.offset+(e?0:i),"text"):t.offset>r.getIndexWithinParent()&&t.set(t.key,t.offset-1,"element");}function Wr(t,e,n,r,i){try{t.setBaseAndExtent(e,n,r,i);}catch(t){}}function Jr(t,e,n,r,i,o,s){const l=r.anchorNode,c=r.focusNode,a=r.anchorOffset,u=r.focusOffset,f=document.activeElement;if(i.has(Ln)&&f!==o||null!==f&&to(f))return;if(!yr(e))return void(null!==t&&eo(n,l,c)&&r.removeAllRanges());const d=e.anchor,h=e.focus,g=d.key,_=h.key,p=Qo(n,g),y=Qo(n,_),m=d.offset,x=h.offset,C=e.format,S=e.style,v=e.isCollapsed();let k=p,T=y,N=false;if("text"===d.type){k=uo(p);const t=d.getNode();N=t.getFormat()!==C||t.getStyle()!==S;}else yr(t)&&"text"===t.anchor.type&&(N=true);var b,w,E,O,M;if(("text"===h.type&&(T=uo(y)),null!==k&&null!==T)&&(v&&(null===t||N||yr(t)&&(t.format!==C||t.style!==S))&&(b=C,w=S,E=m,O=g,M=performance.now(),fn=[b,w,E,O,M]),a!==m||u!==x||l!==k||c!==T||"Range"===r.type&&v||(null!==f&&o.contains(f)||i.has(Rn)||o.focus({preventScroll:true}),"element"===d.type))){if(Wr(r,k,m,T,x),!i.has(Kn)&&e.isCollapsed()&&null!==o&&o===document.activeElement){const t=yr(e)&&"element"===e.anchor.type?k.childNodes[m]||null:r.rangeCount>0?r.getRangeAt(0):null;if(null!==t){let e;if(t instanceof Text){const n=document.createRange();n.selectNode(t),e=n.getBoundingClientRect();}else e=t.getBoundingClientRect();!function(t,e,n){const r=ts(n),i=os(r);if(null===r||null===i)return;let{top:o,bottom:s}=e,l=0,c=0,a=n;for(;null!==a;){const e=a===r.body;if(e)l=0,c=ss(t).innerHeight;else {const t=a.getBoundingClientRect();l=t.top,c=t.bottom;}let n=0;if(o<l?n=-(l-o):s>c&&(n=s-c),0!==n)if(e)i.scrollBy(0,n);else {const t=a.scrollTop;a.scrollTop+=n;const e=a.scrollTop-t;o-=e,s-=e;}if(e)break;a=Zo(a);}}(n,e,o);}}rn=true;}}function jr(t){let e=Lr()||Ir();null===e&&(e=No().selectEnd()),e.insertNodes(t);}function Ur(e){let n=e;e.isCollapsed()||n.removeText();const r=Lr();yr(r)&&(n=r),yr(n)||t(161);const i=n.anchor;let o=i.getNode(),s=i.offset;for(;!Ns(o);){const t=o;if([o,s]=Vr(o,s),t.is(o))break}return s}function Vr(t,e){const n=t.getParent();if(!n){const t=Li();return No().append(t),t.select(),[No(),0]}if(lr(t)){const r=t.splitText(e);if(0===r.length)return [n,t.getIndexWithinParent()];const i=0===e?0:1;return [n,r[0].getIndexWithinParent()+i]}if(!Si(t)||0===e)return [n,t.getIndexWithinParent()];const r=t.getChildAtIndex(e);if(r){const n=new mr(hr(t.__key,e,"element"),hr(t.__key,e,"element"),0,""),i=t.insertNewAfter(n);i&&i.append(r,...r.getNextSiblings());}return [n,t.getIndexWithinParent()+1]}function Yr(t,e,n,r,i="decorators-and-blocks"){if("move"===e&&"character"===r&&!t.isCollapsed()){const[e,r]=n===t.isBackward()?[t.focus,t.anchor]:[t.anchor,t.focus];return r.set(e.key,e.offset,e.type),true}const o=xl(t.focus,n?"previous":"next"),s="lineboundary"===r,l="move"===e;let c=o,a="decorators-and-blocks"===i;if(!Ol(c)){for(const t of c){a=false;const{origin:e}=t;if(!Ti(e)||e.isIsolated()||(c=t,!s||!e.isInline()))break}if(a)for(const t of ul(o).iterNodeCarets("extend"===e?"shadowRoot":"root")){if(Gs(t))t.origin.isInline()||(c=t);else {if(Si(t.origin))continue;Ti(t.origin)&&!t.origin.isInline()&&(c=t);}break}}if(c===o)return false;if(l&&!s&&Ti(c.origin)&&c.origin.isKeyboardSelectable()){const t=Pr();return t.add(c.origin.getKey()),wo(t),true}return c=El(c),l&&Cl(t.anchor,c),Cl(t.focus,c),a||!s}let qr=null,Hr=null,Gr=false,Xr=false,Qr=0;const Zr={characterData:true,childList:true,subtree:true};function ti(){return Gr||null!==qr&&qr._readOnly}function ei(){Gr&&t(13);}function ni(){Qr>99&&t(14);}function ri(){return null===qr&&t(195,oi()),qr}function ii(){return null===Hr&&t(196,oi()),Hr}function oi(){let t=0;const e=new Set,n=Ui.version;if("undefined"!=typeof window)for(const r of document.querySelectorAll("[contenteditable]")){const i=io(r);if(no(i))t++;else if(i){let t=String(i.constructor.version||"<0.17.1");t===n&&(t+=" (separately built, likely a bundler configuration issue)"),e.add(t);}}let r=` Detected on the page: ${t} compatible editor(s) with version ${n}`;return e.size&&(r+=` and incompatible editors with versions ${Array.from(e).join(", ")}`),r}function si(){return Hr}function li(t,e,n){const r=e.__type,i=Gi(t,r);let o=n.get(r);void 0===o&&(o=Array.from(i.transforms),n.set(r,o));const s=o.length;for(let t=0;t<s&&(o[t](e),e.isAttached());t++);}function ci(t,e){return void 0!==t&&t.__key!==e&&t.isAttached()}function ai(t,e){if(!e)return;const n=t._updateTags;let r=e;Array.isArray(e)||(r=[e]);for(const t of r)n.add(t);}function ui(t){return fi(t,ii()._nodes)}function fi(e,n){const r=e.type,i=n.get(r);void 0===i&&t(17,r);const o=i.klass;e.type!==o.getType()&&t(18,o.name);const s=o.importJSON(e),l=e.children;if(Si(s)&&Array.isArray(l))for(let t=0;t<l.length;t++){const e=fi(l[t],n);s.append(e);}return s}function di(t,e,n){const r=qr,i=Gr,o=Hr;qr=e,Gr=true,Hr=t;try{return n()}finally{qr=r,Gr=i,Hr=o;}}function hi(t,e){const n=t._pendingEditorState,r=t._rootElement,i=t._headless||null===r;if(null===n)return;const o=t._editorState,s=o._selection,l=n._selection,c=0!==t._dirtyType,a=qr,u=Gr,f=Hr,d=t._updating,g=t._observer;let _=null;if(t._pendingEditorState=null,t._editorState=n,!i&&c&&null!==g){Hr=t,qr=n,Gr=false,t._updating=true;try{const e=t._dirtyType,r=t._dirtyElements,i=t._dirtyLeaves;g.disconnect(),_=ee$1(o,n,t,e,r,i);}catch(e){if(e instanceof Error&&t._onError(e),Xr)throw e;return Ji(t,null,r,n),rt$3(t),t._dirtyType=2,Xr=true,hi(t,o),void(Xr=false)}finally{g.observe(r,Zr),t._updating=d,qr=a,Gr=u,Hr=f;}}n._readOnly||(n._readOnly=true);const p=t._dirtyLeaves,y=t._dirtyElements,m=t._normalizedNodes,x=t._updateTags,C=t._deferred;c&&(t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements=new Map,t._normalizedNodes=new Set,t._updateTags=new Set),function(t,e){const n=t._decorators;let r=t._pendingDecorators||n;const i=e._nodeMap;let o;for(o in r)i.has(o)||(r===n&&(r=ko(t)),delete r[o]);}(t,n);const S=i?null:ps(ss(t));if(t._editable&&null!==S&&(c||null===l||l.dirty||!l.is(s))&&null!==r&&!x.has(zn)){Hr=t,qr=n;try{if(null!==g&&g.disconnect(),c||null===l||l.dirty){const e=t._blockCursorElement;null!==e&&_s(e,t,r),Jr(s,l,t,S,x,r);}!function(t,e,n){let r=t._blockCursorElement;if(yr(n)&&n.isCollapsed()&&"element"===n.anchor.type&&e.contains(document.activeElement)){const i=n.anchor,o=i.getNode(),s=i.offset;let l=!1,c=null;if(s===o.getChildrenSize()){gs(o.getChildAtIndex(s-1))&&(l=!0);}else {const e=o.getChildAtIndex(s);if(null!==e&&gs(e)){const n=e.getPreviousSibling();(null===n||gs(n))&&(l=!0,c=t.getElementByKey(e.__key));}}if(l){const n=t.getElementByKey(o.__key);return null===r&&(t._blockCursorElement=r=function(t){const e=t.theme,n=document.createElement("div");n.contentEditable="false",n.setAttribute("data-lexical-cursor","true");let r=e.blockCursor;if(void 0!==r){if("string"==typeof r){const t=h$1(r);r=e.blockCursor=t;}void 0!==r&&n.classList.add(...r);}return n}(t._config)),e.style.caretColor="transparent",void(null===c?n.appendChild(r):n.insertBefore(r,c))}}null!==r&&_s(r,t,e);}(t,r,l);}finally{null!==g&&g.observe(r,Zr),Hr=f,qr=a;}}null!==_&&function(t,e,n,r,i){const o=Array.from(t._listeners.mutation),s=o.length;for(let t=0;t<s;t++){const[s,l]=o[t];for(const t of l){const o=e.get(t);void 0!==o&&s(o,{dirtyLeaves:r,prevEditorState:i,updateTags:n});}}}(t,_,x,p,o),yr(l)||null===l||null!==s&&s.is(l)||t.dispatchCommand(ie$1,void 0);const v=t._pendingDecorators;null!==v&&(t._decorators=v,t._pendingDecorators=null,gi("decorator",t,true,v)),function(t,e,n){const r=To(e),i=To(n);r!==i&&gi("textcontent",t,true,i);}(t,e||o,n),gi("update",t,true,{dirtyElements:y,dirtyLeaves:p,editorState:n,mutatedNodes:_,normalizedNodes:m,prevEditorState:e||o,tags:x}),function(t,e){if(t._deferred=[],0!==e.length){const n=t._updating;t._updating=true;try{for(let t=0;t<e.length;t++)e[t]();}finally{t._updating=n;}}}(t,C),function(t){const e=t._updates;if(0!==e.length){const n=e.shift();if(n){const[e,r]=n;pi(t,e,r);}}}(t);}function gi(t,e,n,...r){const i=e._updating;e._updating=n;try{const n=Array.from(e._listeners[t]);for(let t=0;t<n.length;t++)n[t].apply(null,r);}finally{e._updating=i;}}function _i(e,n){const r=e._updates;let i=n||false;for(;0!==r.length;){const n=r.shift();if(n){const[r,o]=n,s=e._pendingEditorState;let l;void 0!==o&&(l=o.onUpdate,o.skipTransforms&&(i=true),o.discrete&&(null===s&&t(191),s._flushSync=true),l&&e._deferred.push(l),ai(e,o.tag)),null==s?pi(e,r,o):r();}}return i}function pi(e,n,r){const i=e._updateTags;let o,s=false,l=false;void 0!==r&&(o=r.onUpdate,ai(e,r.tag),s=r.skipTransforms||false,l=r.discrete||false),o&&e._deferred.push(o);const c=e._editorState;let a=e._pendingEditorState,u=false;(null===a||a._readOnly)&&(a=e._pendingEditorState=wi(a||c),u=true),a._flushSync=l;const f=qr,d=Gr,h=Hr,g=e._updating;qr=a,Gr=false,e._updating=true,Hr=e;const _=e._headless||null===e.getRootElement();Yi(null);try{u&&(_?null!==c._selection&&(a._selection=c._selection.clone()):a._selection=function(t,e){const n=t.getEditorState()._selection,r=ps(ss(t));return yr(n)||null==n?Fr(n,r,t,e):n.clone()}(e,r&&r.event||null));const i=e._compositionKey;n(),s=_i(e,s),function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(yr(r)){const t=r.anchor,e=r.focus;let i;if("text"===t.type&&(i=t.getNode(),i.selectionTransform(n,r)),"text"===e.type){const t=e.getNode();i!==t&&t.selectionTransform(n,r);}}}(a,e),0!==e._dirtyType&&(s?function(t,e){const n=e._dirtyLeaves,r=t._nodeMap;for(const t of n){const e=r.get(t);lr(e)&&e.isAttached()&&e.isSimpleText()&&!e.isUnmergeable()&&Ct$4(e);}}(a,e):function(t,e){const n=e._dirtyLeaves,r=e._dirtyElements,i=t._nodeMap,o=mo(),s=new Map;let l=n,c=l.size,a=r,u=a.size;for(;c>0||u>0;){if(c>0){e._dirtyLeaves=new Set;for(const t of l){const r=i.get(t);lr(r)&&r.isAttached()&&r.isSimpleText()&&!r.isUnmergeable()&&Ct$4(r),void 0!==r&&ci(r,o)&&li(e,r,s),n.add(t);}if(l=e._dirtyLeaves,c=l.size,c>0){Qr++;continue}}e._dirtyLeaves=new Set,e._dirtyElements=new Map,a.delete("root")&&a.set("root",!0);for(const t of a){const n=t[0],l=t[1];if(r.set(n,l),!l)continue;const c=i.get(n);void 0!==c&&ci(c,o)&&li(e,c,s);}l=e._dirtyLeaves,c=l.size,a=e._dirtyElements,u=a.size,Qr++;}e._dirtyLeaves=n,e._dirtyElements=r;}(a,e),_i(e),function(t,e,n,r){const i=t._nodeMap,o=e._nodeMap,s=[];for(const[t]of r){const e=o.get(t);void 0!==e&&(e.isAttached()||(Si(e)&&Y$4(e,t,i,o,s,r),i.has(t)||r.delete(t),s.push(t)));}for(const t of s)o.delete(t);for(const t of n){const e=o.get(t);void 0===e||e.isAttached()||(i.has(t)||n.delete(t),o.delete(t));}}(c,a,e._dirtyLeaves,e._dirtyElements));i!==e._compositionKey&&(a._flushSync=!0);const o=a._selection;if(yr(o)){const e=a._nodeMap,n=o.anchor.key,r=o.focus.key;void 0!==e.get(n)&&void 0!==e.get(r)||t(19);}else xr(o)&&0===o._nodes.size&&(a._selection=null);}catch(t){return t instanceof Error&&e._onError(t),e._pendingEditorState=c,e._dirtyType=2,e._cloneNotNeeded.clear(),e._dirtyLeaves=new Set,e._dirtyElements.clear(),void hi(e)}finally{qr=f,Gr=d,Hr=h,e._updating=g,Qr=0;}const p=0!==e._dirtyType||e._deferred.length>0||function(t,e){const n=e.getEditorState()._selection,r=t._selection;if(null!==r){if(r.dirty||!r.is(n))return true}else if(null!==n)return true;return false}(a,e);p?a._flushSync?(a._flushSync=false,hi(e)):u&&Qi(()=>{hi(e);}):(a._flushSync=false,u&&(i.clear(),e._deferred=[],e._pendingEditorState=null));}function yi(t,e,n){Hr===t&&void 0===n?e():pi(t,e,n);}class mi{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null;}withBefore(t){return new mi(this.element,t,this.after)}withAfter(t){return new mi(this.element,this.before,t)}withElement(t){return this.element===t?this:new mi(t,this.before,this.after)}insertChild(e){const n=this.before||this.getManagedLineBreak();return null!==n&&n.parentElement!==this.element&&t(222),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(223),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(224),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.after?this.after.nextSibling:this.element.firstChild;return t===this.before||t===this.getManagedLineBreak()?null:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(null===t)this.removeManagedLineBreak();else {const e="decorator"===t&&(d||c||l);this.insertManagedLineBreak(e);}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0;}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak();}const n=this.element,r=this.before,i=document.createElement("br");if(n.insertBefore(i,r),t){const t=document.createElement("img");t.setAttribute("data-lexical-linebreak","true"),t.style.cssText="display: inline !important; border: 0px !important; margin: 0px !important;",t.alt="",n.insertBefore(t,i),n.__lexicalLineBreak=t;}else n.__lexicalLineBreak=i;}getFirstChildOffset(){let t=0;for(let e=this.after;null!==e;e=e.previousSibling)t++;return t}resolveChildIndex(t,e,n,r){if(n===this.element){const e=this.getFirstChildOffset();return [t,Math.min(e+t.getChildrenSize(),Math.max(e,r))]}const i=xi(e,n);i.push(r);const o=xi(e,this.element);let s=t.getIndexWithinParent();for(let t=0;t<o.length;t++){const e=i[t],n=o[t];if(void 0===e||e<n)break;if(e>n){s+=1;break}}return [t.getParentOrThrow(),s]}}function xi(e,n){const r=[];let i=n;for(;i!==e&&null!==i;i=i.parentNode){let t=0;for(let e=i.previousSibling;null!==e;e=e.previousSibling)t++;r.push(t);}return i!==e&&t(225),r.reverse()}class Ci extends Mn{__first;__last;__size;__format;__style;__indent;__dir;__textFormat;__textStyle;constructor(t){super(t),this.__first=null,this.__last=null,this.__size=0,this.__format=0,this.__style="",this.__indent=0,this.__dir=null,this.__textFormat=0,this.__textStyle="";}afterCloneFrom(t){super.afterCloneFrom(t),this.__key===t.__key&&(this.__first=t.__first,this.__last=t.__last,this.__size=t.__size),this.__indent=t.__indent,this.__format=t.__format,this.__style=t.__style,this.__dir=t.__dir,this.__textFormat=t.__textFormat,this.__textStyle=t.__textStyle;}getFormat(){return this.getLatest().__format}getFormatType(){const t=this.getFormat();return J$5[t]||""}getStyle(){return this.getLatest().__style}getIndent(){return this.getLatest().__indent}getChildren(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e),e=e.getNextSibling();return t}getChildrenKeys(){const t=[];let e=this.getFirstChild();for(;null!==e;)t.push(e.__key),e=e.getNextSibling();return t}getChildrenSize(){return this.getLatest().__size}isEmpty(){return 0===this.getChildrenSize()}isDirty(){const t=ii()._dirtyElements;return null!==t&&t.has(this.__key)}isLastChild(){const t=this.getLatest(),e=this.getParentOrThrow().getLastChild();return null!==e&&e.is(t)}getAllTextNodes(){const t=[];let e=this.getFirstChild();for(;null!==e;){if(lr(e)&&t.push(e),Si(e)){const n=e.getAllTextNodes();t.push(...n);}e=e.getNextSibling();}return t}getFirstDescendant(){let t=this.getFirstChild();for(;Si(t);){const e=t.getFirstChild();if(null===e)break;t=e;}return t}getLastDescendant(){let t=this.getLastChild();for(;Si(t);){const e=t.getLastChild();if(null===e)break;t=e;}return t}getDescendantByIndex(t){const e=this.getChildren(),n=e.length;if(t>=n){const t=e[n-1];return Si(t)&&t.getLastDescendant()||t||null}const r=e[t];return Si(r)&&r.getFirstDescendant()||r||null}getFirstChild(){const t=this.getLatest().__first;return null===t?null:xo(t)}getFirstChildOrThrow(){const e=this.getFirstChild();return null===e&&t(45,this.__key),e}getLastChild(){const t=this.getLatest().__last;return null===t?null:xo(t)}getLastChildOrThrow(){const e=this.getLastChild();return null===e&&t(96,this.__key),e}getChildAtIndex(t){const e=this.getChildrenSize();let n,r;if(t<e/2){for(n=this.getFirstChild(),r=0;null!==n&&r<=t;){if(r===t)return n;n=n.getNextSibling(),r++;}return null}for(n=this.getLastChild(),r=e-1;null!==n&&r>=t;){if(r===t)return n;n=n.getPreviousSibling(),r--;}return null}getTextContent(){let t="";const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContent(),Si(i)&&r!==n-1&&!i.isInline()&&(t+=D$3);}return t}getTextContentSize(){let t=0;const e=this.getChildren(),n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=i.getTextContentSize(),Si(i)&&r!==n-1&&!i.isInline()&&(t+=2);}return t}getDirection(){return this.getLatest().__dir}getTextFormat(){return this.getLatest().__textFormat}hasFormat(t){if(""!==t){const e=W$6[t];return 0!==(this.getFormat()&e)}return false}hasTextFormat(t){const e=R$4[t];return 0!==(this.getTextFormat()&e)}getFormatFlags(t,e){return fo(this.getLatest().__textFormat,t,e)}getTextStyle(){return this.getLatest().__textStyle}select(t,e){ei();const n=Lr();let r=t,i=e;const o=this.getChildrenSize();if(!this.canBeEmpty())if(0===t&&0===e){const t=this.getFirstChild();if(lr(t)||Si(t))return t.select(0,0)}else if(!(void 0!==t&&t!==o||void 0!==e&&e!==o)){const t=this.getLastChild();if(lr(t)||Si(t))return t.select()} void 0===r&&(r=o),void 0===i&&(i=o);const s=this.__key;return yr(n)?(n.anchor.set(s,r,"element"),n.focus.set(s,i,"element"),n.dirty=true,n):Mr(s,r,s,i,"element","element")}selectStart(){const t=this.getFirstDescendant();return t?t.selectStart():this.select()}selectEnd(){const t=this.getLastDescendant();return t?t.selectEnd():this.select()}clear(){const t=this.getWritable();return this.getChildren().forEach(t=>t.remove()),t}append(...t){return this.splice(this.getChildrenSize(),0,t)}setDirection(t){const e=this.getWritable();return e.__dir=t,e}setFormat(t){return this.getWritable().__format=""!==t?W$6[t]:0,this}setStyle(t){return this.getWritable().__style=t||"",this}setTextFormat(t){const e=this.getWritable();return e.__textFormat=t,e}setTextStyle(t){const e=this.getWritable();return e.__textStyle=t,e}setIndent(t){return this.getWritable().__indent=t,this}splice(e,n,r){On(this)&&t(324,this.__key,this.__type);const i=this.getChildrenSize(),o=this.getWritable();e+n<=i||t(226,String(e),String(n),String(i));const s=o.__key,l=[],c=[],a=this.getChildAtIndex(e+n);let u=null,f=i-n+r.length;if(0!==e)if(e===i)u=this.getLastChild();else {const t=this.getChildAtIndex(e);null!==t&&(u=t.getPreviousSibling());}if(n>0){let e=null===u?this.getFirstChild():u.getNextSibling();for(let r=0;r<n;r++){null===e&&t(100);const n=e.getNextSibling(),r=e.__key;_o(e.getWritable()),c.push(r),e=n;}}let d=u;for(const e of r){null!==d&&e.is(d)&&(u=d=d.getPreviousSibling());const n=e.getWritable();n.__parent===s&&f--,_o(n);const r=e.__key;if(null===d)o.__first=r,n.__prev=null;else {const t=d.getWritable();t.__next=r,n.__prev=t.__key;}e.__key===s&&t(76),n.__parent=s,l.push(r),d=e;}if(e+n===i){if(null!==d){d.getWritable().__next=null,o.__last=d.__key;}}else if(null!==a){const t=a.getWritable();if(null!==d){const e=d.getWritable();t.__prev=d.__key,e.__next=a.__key;}else t.__prev=null;}if(o.__size=f,c.length){const t=Lr();if(yr(t)){const e=new Set(c),n=new Set(l),{anchor:r,focus:i}=t;vi(r,e,n)&&Rr(r,r.getNode(),this,u,a),vi(i,e,n)&&Rr(i,i.getNode(),this,u,a),0!==f||this.canBeEmpty()||as(this)||this.remove();}}return o}getDOMSlot(t){return new mi(t)}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){const t=this.getIndent();t>0&&(e.style.paddingInlineStart=40*t+"px");const n=this.getDirection();n&&(e.dir=n);}return {element:e}}exportJSON(){const t={children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),...super.exportJSON()},e=this.getTextFormat(),n=this.getTextStyle();return 0!==e&&(t.textFormat=e),""!==n&&(t.textStyle=n),t}updateFromJSON(t){return super.updateFromJSON(t).setFormat(t.format).setIndent(t.indent).setDirection(t.direction).setTextFormat(t.textFormat||0).setTextStyle(t.textStyle||"")}insertNewAfter(t,e){return null}canIndent(){return true}collapseAtStart(t){return false}excludeFromCopy(t){return false}canReplaceWith(t){return true}canInsertAfter(t){return true}canBeEmpty(){return true}canInsertTextBefore(){return true}canInsertTextAfter(){return true}isInline(){return false}isShadowRoot(){return false}canMergeWith(t){return false}extractWithChild(t,e,n){return false}canMergeWhenEmpty(){return false}reconcileObservedMutation(t,e){const n=this.getDOMSlot(t);let r=n.getFirstChild();for(let t=this.getFirstChild();t;t=t.getNextSibling()){const i=e.getElementByKey(t.getKey());null!==i&&(null==r?(n.insertChild(i),r=i):r!==i&&n.replaceChild(i,r),r=r.nextSibling);}}}function Si(t){return t instanceof Ci}function vi(t,e,n){let r=t.getNode();for(;r;){const t=r.__key;if(e.has(t)&&!n.has(t))return true;r=r.getParent();}return false}class ki extends Mn{decorate(t,e){return null}isIsolated(){return false}isInline(){return true}isKeyboardSelectable(){return true}}function Ti(t){return t instanceof ki}class Ni extends Ci{__cachedText;static getType(){return "root"}static clone(){return new Ni}constructor(){super("root"),this.__cachedText=null;}getTopLevelElementOrThrow(){t(51);}getTextContent(){const t=this.__cachedText;return !ti()&&0!==ii()._dirtyType||null===t?super.getTextContent():t}remove(){t(52);}replace(e){t(53);}insertBefore(e){t(54);}insertAfter(e){t(55);}updateDOM(t,e){return false}splice(e,n,r){for(const e of r)Si(e)||Ti(e)||t(282);return super.splice(e,n,r)}static importJSON(t){return No().updateFromJSON(t)}collapseAtStart(){return true}}function bi(t){return t instanceof Ni}function wi(t){return new Ai(new Map(t._nodeMap))}function Ei(){return new Ai(new Map([["root",new Ni]]))}function Oi(e){const n=e.exportJSON(),r=e.constructor;if(n.type!==r.getType()&&t(130,r.name),Si(e)){const i=n.children;Array.isArray(i)||t(59,r.name);const o=e.getChildren();for(let t=0;t<o.length;t++){const e=Oi(o[t]);i.push(e);}}return n}function Mi(t){return t instanceof Ai}class Ai{_nodeMap;_selection;_flushSync;_readOnly;constructor(t,e){this._nodeMap=t,this._selection=e||null,this._flushSync=false,this._readOnly=false;}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(t,e){return di(e&&e.editor||null,this,t)}clone(t){const e=new Ai(this._nodeMap,void 0===t?this._selection:t);return e._readOnly=true,e}toJSON(){return di(null,this,()=>({root:Oi(No())}))}}class Pi extends Ci{static getType(){return "artificial"}createDOM(t){return document.createElement("div")}}class Di extends Ci{static getType(){return "paragraph"}static clone(t){return new Di(t.__key)}createDOM(t){const e=document.createElement("p"),n=$o(t.theme,"paragraph");if(void 0!==n){e.classList.add(...n);}return e}updateDOM(t,e,n){return false}static importDOM(){return {p:t=>({conversion:Fi,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);}return {element:e}}static importJSON(t){return Li().updateFromJSON(t)}exportJSON(){return {...super.exportJSON(),textFormat:this.getTextFormat(),textStyle:this.getTextStyle()}}insertNewAfter(t,e){const n=Li();n.setTextFormat(t.format),n.setTextStyle(t.style);const r=this.getDirection();return n.setDirection(r),n.setFormat(this.getFormatType()),n.setStyle(this.getStyle()),this.insertAfter(n,e),n}collapseAtStart(){const t=this.getChildren();if(0===t.length||lr(t[0])&&""===t[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),true;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),true}return false}}function Fi(t){const e=Li();return t.style&&(e.setFormat(t.style.textAlign),Ps(t,e)),{node:e}}function Li(){return fs(new Di)}function Ii(t){return t instanceof Di}const Ki=0,zi=1,Ri=2,Bi=3,Wi=4;function Ji(t,e,n,r){const i=t._keyToDOMMap;i.clear(),t._editorState=Ei(),t._pendingEditorState=r,t._compositionKey=null,t._dirtyType=0,t._cloneNotNeeded.clear(),t._dirtyLeaves=new Set,t._dirtyElements.clear(),t._normalizedNodes=new Set,t._updateTags=new Set,t._updates=[],t._blockCursorElement=null;const o=t._observer;null!==o&&(o.disconnect(),t._observer=null),null!==e&&(e.textContent=""),null!==n&&(n.textContent="",i.set("root",n));}function ji(t){const e=new Set,n=new Set;let r=t;for(;r;){const{ownNodeConfig:t}=Is(r),i=r.transform;if(!n.has(i)){n.add(i);const t=r.transform();t&&e.add(t);}if(t){const n=t.$transform;n&&e.add(n),r=t.extends;}else {const t=Object.getPrototypeOf(r);r=t.prototype instanceof Mn&&t!==Mn?t:void 0;}}return e}function $i(t){const e=t||{},n=si(),r=e.theme||{},i=void 0===t?n:e.parentEditor||null,o=e.disableEvents||false,s=Ei(),l=e.namespace||(null!==i?i._config.namespace:Ao()),c=e.editorState,a=[Ni,Xn,Bn,ar,Di,Pi,...e.nodes||[]],{onError:u,html:f}=e,d=void 0===e.editable||e.editable;let h;if(void 0===t&&null!==n)h=n._nodes;else {h=new Map;for(let t=0;t<a.length;t++){let e=a[t],n=null,r=null;if("function"!=typeof e){const t=e;e=t.replace,n=t.with,r=t.withKlass||null;}Is(e);const i=e.getType(),o=ji(e);h.set(i,{exportDOM:f&&f.export?f.export.get(e):void 0,klass:e,replace:n,replaceWithKlass:r,sharedNodeState:at$2(a[t]),transforms:o});}}const g=new Ui(s,i,h,{disableEvents:o,namespace:l,theme:r},u||console.error,function(t,e){const n=new Map,r=new Set,i=t=>{Object.keys(t).forEach(e=>{let r=n.get(e);void 0===r&&(r=[],n.set(e,r)),r.push(t[e]);});};return t.forEach(t=>{const e=t.klass.importDOM;if(null==e||r.has(e))return;r.add(e);const n=e.call(t.klass);null!==n&&i(n);}),e&&i(e),n}(h,f?f.import:void 0),d,t);return void 0!==c&&(g._pendingEditorState=c,g._dirtyType=2),g}class Ui{static version;_headless;_parentEditor;_rootElement;_editorState;_pendingEditorState;_compositionKey;_deferred;_keyToDOMMap;_updates;_updating;_listeners;_commands;_nodes;_decorators;_pendingDecorators;_config;_dirtyType;_cloneNotNeeded;_dirtyLeaves;_dirtyElements;_normalizedNodes;_updateTags;_observer;_key;_onError;_htmlConversions;_window;_editable;_blockCursorElement;_createEditorArgs;constructor(t,e,n,r,i,o,s,l){this._createEditorArgs=l,this._parentEditor=e,this._rootElement=null,this._editorState=t,this._pendingEditorState=null,this._compositionKey=null,this._deferred=[],this._keyToDOMMap=new Map,this._updates=[],this._updating=false,this._listeners={decorator:new Set,editable:new Set,mutation:new Map,root:new Set,textcontent:new Set,update:new Set},this._commands=new Map,this._config=r,this._nodes=n,this._decorators={},this._pendingDecorators=null,this._dirtyType=0,this._cloneNotNeeded=new Set,this._dirtyLeaves=new Set,this._dirtyElements=new Map,this._normalizedNodes=new Set,this._updateTags=new Set,this._observer=null,this._key=Ao(),this._onError=i,this._htmlConversions=o,this._editable=s,this._headless=null!==e&&e._headless,this._window=null,this._blockCursorElement=null;}isComposing(){return null!=this._compositionKey}registerUpdateListener(t){const e=this._listeners.update;return e.add(t),()=>{e.delete(t);}}registerEditableListener(t){const e=this._listeners.editable;return e.add(t),()=>{e.delete(t);}}registerDecoratorListener(t){const e=this._listeners.decorator;return e.add(t),()=>{e.delete(t);}}registerTextContentListener(t){const e=this._listeners.textcontent;return e.add(t),()=>{e.delete(t);}}registerRootListener(t){const e=this._listeners.root;return t(this._rootElement,null),e.add(t),()=>{t(null,this._rootElement),e.delete(t);}}registerCommand(e,n,r){ void 0===r&&t(35);const i=this._commands;i.has(e)||i.set(e,[new Set,new Set,new Set,new Set,new Set]);const o=i.get(e);void 0===o&&t(36,String(e));const s=o[r];return s.add(n),()=>{s.delete(n),o.every(t=>0===t.size)&&i.delete(e);}}registerMutationListener(t,e,n){const r=this.resolveRegisteredNodeAfterReplacements(this.getRegisteredNode(t)).klass,i=this._listeners.mutation;let o=i.get(e);void 0===o&&(o=new Set,i.set(e,o)),o.add(r);const s=n&&n.skipInitialization;return void 0!==s&&s||this.initializeMutationListener(e,r),()=>{o.delete(r),0===o.size&&i.delete(e);}}getRegisteredNode(e){const n=this._nodes.get(e.getType());return void 0===n&&t(37,e.name),n}resolveRegisteredNodeAfterReplacements(t){for(;t.replaceWithKlass;)t=this.getRegisteredNode(t.replaceWithKlass);return t}initializeMutationListener(t,e){const n=this._editorState,r=Os(n).get(e.getType());if(!r)return;const i=new Map;for(const t of r.keys())i.set(t,"created");i.size>0&&t(i,{dirtyLeaves:new Set,prevEditorState:n,updateTags:new Set(["registerMutationListener"])});}registerNodeTransformToKlass(t,e){const n=this.getRegisteredNode(t);return n.transforms.add(e),n}registerNodeTransform(t,e){const n=this.registerNodeTransformToKlass(t,e),r=[n],i=n.replaceWithKlass;if(null!=i){const t=this.registerNodeTransformToKlass(i,e);r.push(t);}return function(t,e){const n=Os(t.getEditorState()),r=[];for(const t of e){const e=n.get(t);e&&r.push(e);}if(0===r.length)return;t.update(()=>{for(const t of r)for(const e of t.keys()){const t=xo(e);t&&t.markDirty();}},null===t._pendingEditorState?{tag:Dn}:void 0);}(this,r.map(t=>t.klass.getType())),()=>{r.forEach(t=>t.transforms.delete(e));}}hasNode(t){return this._nodes.has(t.getType())}hasNodes(t){return t.every(this.hasNode.bind(this))}dispatchCommand(t,e){return Go(this,t,e)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(t){const e=this._rootElement;if(t!==e){const n=$o(this._config.theme,"root"),r=this._pendingEditorState||this._editorState;if(this._rootElement=t,Ji(this,e,t,r),null!==e&&(this._config.disableEvents||Nn(e),null!=n&&e.classList.remove(...n)),null!==t){const e=os(t),r=t.style;r.userSelect="text",r.whiteSpace="pre-wrap",r.wordBreak="break-word",t.setAttribute("data-lexical-editor","true"),this._window=e,this._dirtyType=2,rt$3(this),this._updateTags.add(Dn),hi(this),this._config.disableEvents||function(t,e){const n=t.ownerDocument;en.set(t,n);const r=nn.get(n)??0;r<1&&n.addEventListener("selectionchange",Sn),nn.set(n,r+1),t.__lexicalEditor=e;const i=xn(t);for(let n=0;n<Ge$1.length;n++){const[r,o]=Ge$1[n],s="function"==typeof o?t=>{kn(t)||(vn(t),(e.isEditable()||"click"===r)&&o(t,e));}:t=>{if(kn(t))return;vn(t);const n=e.isEditable();switch(r){case "cut":return n&&Go(e,Be$1,t);case "copy":return Go(e,Re$1,t);case "paste":return n&&Go(e,fe$1,t);case "dragstart":return n&&Go(e,Ie$1,t);case "dragover":return n&&Go(e,Ke$1,t);case "dragend":return n&&Go(e,ze$1,t);case "focus":return n&&Go(e,Ve$1,t);case "blur":return n&&Go(e,Ye,t);case "drop":return n&&Go(e,Fe$1,t)}};t.addEventListener(r,s),i.push(()=>{t.removeEventListener(r,s);});}}(t,this),null!=n&&t.classList.add(...n);}else this._window=null,this._updateTags.add(Dn),hi(this);gi("root",this,false,t,e);}}getElementByKey(t){return this._keyToDOMMap.get(t)||null}getEditorState(){return this._editorState}setEditorState(e,n){e.isEmpty()&&t(38);let r=e;r._readOnly&&(r=wi(e),r._selection=e._selection?e._selection.clone():null),nt$4(this);const i=this._pendingEditorState,o=this._updateTags,s=void 0!==n?n.tag:null;null===i||i.isEmpty()||(null!=s&&o.add(s),hi(this)),this._pendingEditorState=r,this._dirtyType=2,this._dirtyElements.set("root",false),this._compositionKey=null,null!=s&&o.add(s),this._updating||hi(this);}parseEditorState(t,e){return function(t,e,n){const r=Ei(),i=qr,o=Gr,s=Hr,l=e._dirtyElements,c=e._dirtyLeaves,a=e._cloneNotNeeded,u=e._dirtyType;e._dirtyElements=new Map,e._dirtyLeaves=new Set,e._cloneNotNeeded=new Set,e._dirtyType=0,qr=r,Gr=false,Hr=e,Yi(null);try{const i=e._nodes;fi(t.root,i),n&&n(),r._readOnly=!0;}catch(t){t instanceof Error&&e._onError(t);}finally{e._dirtyElements=l,e._dirtyLeaves=c,e._cloneNotNeeded=a,e._dirtyType=u,qr=i,Gr=o,Hr=s;}return r}("string"==typeof t?JSON.parse(t):t,this,e)}read(t){return hi(this),this.getEditorState().read(t,{editor:this})}update(t,e){!function(t,e,n){t._updating?t._updates.push([e,n]):pi(t,e,n);}(this,t,e);}focus(t,e={}){const n=this._rootElement;null!==n&&(n.setAttribute("autocapitalize","off"),yi(this,()=>{const r=Lr(),i=No();null!==r?r.dirty||wo(r.clone()):0!==i.getChildrenSize()&&("rootStart"===e.defaultSelection?i.selectStart():i.selectEnd()),ns("focus"),rs(()=>{n.removeAttribute("autocapitalize"),t&&t();});}),null===this._pendingEditorState&&n.removeAttribute("autocapitalize"));}blur(){const t=this._rootElement;null!==t&&t.blur();const e=ps(this._window);null!==e&&e.removeAllRanges();}isEditable(){return this._editable}setEditable(t){this._editable!==t&&(this._editable=t,gi("editable",this,true,t));}toJSON(){return {editorState:this._editorState.toJSON()}}}Ui.version="0.38.2+prod.esm";let Vi=null;function Yi(t){Vi=t;}let qi=1;function Gi(e,n){const r=Xi(e,n);return void 0===r&&t(30,n),r}function Xi(t,e){return t._nodes.get(e)}const Qi="function"==typeof queueMicrotask?queueMicrotask:t=>{Promise.resolve().then(t);};function Zi(t){return Ti(vo(t))}function to(t){const e=document.activeElement;if(!Cs(e))return false;const n=e.nodeName;return Ti(vo(t))&&("INPUT"===n||"TEXTAREA"===n||"true"===e.contentEditable&&null==io(e))}function eo(t,e,n){const r=t.getRootElement();try{return null!==r&&r.contains(e)&&r.contains(n)&&null!==e&&!to(e)&&ro(e)===t}catch(t){return false}}function no(t){return t instanceof Ui}function ro(t){let e=t;for(;null!=e;){const t=io(e);if(no(t))return t;e=Zo(e);}return null}function io(t){return t?t.__lexicalEditor:null}function oo(t){return K$4.test(t)?"rtl":z$4.test(t)?"ltr":null}function so(t){return fr(t)||t.isToken()}function lo(t){return so(t)||t.isSegmented()}function co(t){return Ss(t)&&3===t.nodeType}function ao(t){return Ss(t)&&9===t.nodeType}function uo(t){let e=t;for(;null!=e;){if(co(e))return e;e=e.firstChild;}return null}function fo(t,e,n){const r=R$4[e];if(null!==n&&(t&r)===(n&r))return t;let i=t^r;return "subscript"===e?i&=-65:"superscript"===e?i&=-33:"lowercase"===e?(i&=-513,i&=-1025):"uppercase"===e?(i&=-257,i&=-1025):"capitalize"===e&&(i&=-257,i&=-513),i}function ho(t){return lr(t)||jn(t)||Ti(t)}function go(t,e){const n=function(){const t=Vi;return Vi=null,t}();if(null!=(e=e||n&&n.__key))return void(t.__key=e);ei(),ni();const r=ii(),i=ri(),o=""+qi++;i._nodeMap.set(o,t),Si(t)?r._dirtyElements.set(o,true):r._dirtyLeaves.add(o),r._cloneNotNeeded.add(o),r._dirtyType=1,t.__key=o;}function _o(t){const e=t.getParent();if(null!==e){const n=t.getWritable(),r=e.getWritable(),i=t.getPreviousSibling(),o=t.getNextSibling(),s=null!==o?o.__key:null,l=null!==i?i.__key:null,c=null!==i?i.getWritable():null,a=null!==o?o.getWritable():null;null===i&&(r.__first=s),null===o&&(r.__last=l),null!==c&&(c.__next=s),null!==a&&(a.__prev=l),n.__prev=null,n.__next=null,n.__parent=null,r.__size--;}}function po(e){ni(),On(e)&&t(323,e.__key,e.__type);const n=e.getLatest(),r=n.__parent,i=ri(),o=ii(),s=i._nodeMap,l=o._dirtyElements;null!==r&&function(t,e,n){let r=t;for(;null!==r;){if(n.has(r))return;const t=e.get(r);if(void 0===t)break;n.set(r,false),r=t.__parent;}}(r,s,l);const c=n.__key;o._dirtyType=1,Si(e)?l.set(c,true):o._dirtyLeaves.add(c);}function yo(t){ei();const e=ii(),n=e._compositionKey;if(t!==n){if(e._compositionKey=t,null!==n){const t=xo(n);null!==t&&t.getWritable();}if(null!==t){const e=xo(t);null!==e&&e.getWritable();}}}function mo(){if(ti())return null;return ii()._compositionKey}function xo(t,e){const n=(e||ri())._nodeMap.get(t);return void 0===n?null:n}function Co(t,e){const n=So(t,ii());return void 0!==n?xo(n,e):null}function So(t,e){return t[`__lexicalKey_${e._key}`]}function vo(t,e){let n=t;for(;null!=n;){const t=Co(n,e);if(null!==t)return t;n=Zo(n);}return null}function ko(t){const e=t._decorators,n=Object.assign({},e);return t._pendingDecorators=n,n}function To(t){return t.read(()=>No().getTextContent())}function No(){return bo(ri())}function bo(t){return t._nodeMap.get("root")}function wo(t){ei();const e=ri();null!==t&&(t.dirty=true,t.setCachedNodes(null)),e._selection=t;}function Eo(t){const e=ii(),n=function(t,e){let n=t;for(;null!=n;){const t=So(n,e);if(void 0!==t)return t;n=Zo(n);}return null}(t,e);if(null===n){return t===e.getRootElement()?xo("root"):null}return xo(n)}function Oo(t){return /[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function Mo(t){const e=[];let n=t;for(;null!==n;)e.push(n),n=n._parentEditor;return e}function Ao(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}function Po(t){return co(t)?t.nodeValue:null}function Do(t,e,n){const r=ps(ss(e));if(null===r)return;const i=r.anchorNode;let{anchorOffset:o,focusOffset:s}=r;if(null!==i){let e=Po(i);const r=vo(i);if(null!==e&&lr(r)){if(e===P$3&&n){const t=n.length;e=n,o=t,s=t;}null!==e&&Fo(r,e,o,s,t);}}}function Fo(t,e,n,r,i){let o=t;if(o.isAttached()&&(i||!o.isDirty())){const s=o.isComposing();let a=e;(s||i)&&e[e.length-1]===P$3&&(a=e.slice(0,-1));const u=o.getTextContent();if(i||a!==u){if(""===a){if(yo(null),l||c||d)o.remove();else {const t=ii();setTimeout(()=>{t.update(()=>{o.isAttached()&&o.remove();});},20);}return}const e=o.getParent(),i=Ir(),u=o.getTextContentSize(),f=mo(),h=o.getKey();if(o.isToken()||null!==f&&h===f&&!s||yr(i)&&(null!==e&&!e.canInsertTextBefore()&&0===i.anchor.offset||i.anchor.key===t.__key&&0===i.anchor.offset&&!o.canInsertTextBefore()&&!s||i.focus.key===t.__key&&i.focus.offset===u&&!o.canInsertTextAfter()&&!s))return void o.markDirty();const g=Lr();if(!yr(g)||null===n||null===r)return void Lo(o,a,g);if(g.setTextNodeRange(o,n,o,r),o.isSegmented()){const t=sr(o.getTextContent());o.replace(t),o=t;}Lo(o,a,g);}}}function Lo(t,e,n){if(t.setTextContent(e),yr(n)){const e=t.getKey();for(const r of ["anchor","focus"]){const i=n[r];"text"===i.type&&i.key===e&&(i.offset=nl(t,i.offset,"clamp"));}}}function Io(t,e,n){const r=e[n]||false;return "any"===r||r===t[n]}function Ko(t,e){return Io(t,e,"altKey")&&Io(t,e,"ctrlKey")&&Io(t,e,"shiftKey")&&Io(t,e,"metaKey")}function zo(t,e,n){return Ko(t,n)&&t.key.toLowerCase()===e.toLowerCase()}const Ro={ctrlKey:!i,metaKey:i},Bo={altKey:i,ctrlKey:!i};function Wo(t){return "Backspace"===t.key}function Jo(t){return zo(t,"a",Ro)}function jo(t){const e=No();if(yr(t)){const e=t.anchor,n=t.focus,r=e.getNode().getTopLevelElementOrThrow().getParentOrThrow();return e.set(r.getKey(),0,"element"),n.set(r.getKey(),r.getChildrenSize(),"element"),St$5(t),t}{const t=e.select(0,e.getChildrenSize());return wo(St$5(t)),t}}function $o(t,e){ void 0===t.__lexicalClassNameCache&&(t.__lexicalClassNameCache={});const n=t.__lexicalClassNameCache,r=n[e];if(void 0!==r)return r;const i=t[e];if("string"==typeof i){const t=h$1(i);return n[e]=t,t}return i}function Uo(e,n,r,i,o){if(0===r.size)return;const s=i.__type,l=i.__key,c=n.get(s);void 0===c&&t(33,s);const a=c.klass;let u=e.get(a);void 0===u&&(u=new Map,e.set(a,u));const f=u.get(l),d="destroyed"===f&&"created"===o;(void 0===f||d)&&u.set(l,d?"updated":o);}function Yo(t,e,n){const r=t.getParent();let i=n,o=t;return null!==r&&(e&&0===n?(i=o.getIndexWithinParent(),o=r):e||n!==o.getChildrenSize()||(i=o.getIndexWithinParent()+1,o=r)),o.getChildAtIndex(e?i-1:i)}function qo(t,e){const n=t.offset;if("element"===t.type){return Yo(t.getNode(),e,n)}{const r=t.getNode();if(e&&0===n||!e&&n===r.getTextContentSize()){const t=e?r.getPreviousSibling():r.getNextSibling();return null===t?Yo(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):t}}return null}function Ho(t){const e=ss(t).event,n=e&&e.inputType;return "insertFromPaste"===n||"insertFromPasteAsQuotation"===n}function Go(t,e,n){return function(t,e,n){const r=Mo(t);for(let i=4;i>=0;i--)for(let o=0;o<r.length;o++){const s=r[o],l=s._commands.get(e);if(void 0!==l){const e=l[i];if(void 0!==e){const r=Array.from(e),i=r.length;let o=false;if(yi(s,()=>{for(let e=0;e<i;e++)if(r[e](n,t))return void(o=true)}),o)return o}}}return false}(t,e,n)}function Xo(t){return !bi(t)&&!t.isLastChild()&&!t.isInline()}function Qo(e,n){const r=e._keyToDOMMap.get(n);return void 0===r&&t(75,n),r}function Zo(t){const e=t.assignedSlot||t.parentElement;return vs(e)?e.host:e}function ts(t){return ao(t)?t:Cs(t)?t.ownerDocument:null}function ns(t){ei();ii()._updateTags.add(t);}function rs(t){ei();ii()._deferred.push(t);}function is(t,e){let n=t.getParent();for(;null!==n;){if(n.is(e))return true;n=n.getParent();}return false}function os(t){const e=ts(t);return e?e.defaultView:null}function ss(e){const n=e._window;return null===n&&t(78),n}function cs(t){let e=t.getParentOrThrow();for(;null!==e;){if(as(e))return e;e=e.getParentOrThrow();}return e}function as(t){return bi(t)||Si(t)&&t.isShadowRoot()}function fs(e){const n=ii(),r=e.getType(),i=Xi(n,r);void 0===i&&t(200,e.constructor.name,r);const{replace:o,replaceWithKlass:s}=i;if(null!==o){const n=o(e),i=n.constructor;return null!==s?n instanceof s||t(201,s.name,s.getType(),i.name,i.getType(),e.constructor.name,r):n instanceof e.constructor&&i!==e.constructor||t(202,i.name,i.getType(),e.constructor.name,r),n.__key===e.__key&&t(203,e.constructor.name,r,i.name,i.getType()),n}return e}function ds(e,n){!bi(e.getParent())||Si(n)||Ti(n)||t(99);}function hs(e){const n=xo(e);return null===n&&t(63,e),n}function gs(t){return (Ti(t)||Si(t)&&!t.canBeEmpty())&&!t.isInline()}function _s(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=t.parentElement;null!==r&&r.removeChild(t);}function ps(t){return n?(t||window).getSelection():null}function ys(t){const e=os(t);return e?e.getSelection():null}function xs(t){return Cs(t)&&"A"===t.tagName}function Cs(t){return Ss(t)&&1===t.nodeType}function Ss(t){return "object"==typeof t&&null!==t&&"nodeType"in t&&"number"==typeof t.nodeType}function vs(t){return Ss(t)&&11===t.nodeType}function ks(t){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|mark|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return null!==t.nodeName.match(e)}function Ts(t){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return null!==t.nodeName.match(e)}function Ns(t){if(Ti(t)&&!t.isInline())return true;if(!Si(t)||as(t))return false;const e=t.getFirstChild(),n=null===e||jn(e)||lr(e)||e.isInline();return !t.isInline()&&false!==t.canBeEmpty()&&n}function bs(){return ii()}const ws=new WeakMap,Es=new Map;function Os(e){if(!e._readOnly&&e.isEmpty())return Es;e._readOnly||t(192);let n=ws.get(e);return n||(n=function(t){const e=new Map;for(const[n,r]of t._nodeMap){const t=r.__type;let i=e.get(t);i||(i=new Map,e.set(t,i)),i.set(n,r);}return e}(e),ws.set(e,n)),n}function Ms(t){const e=t.constructor.clone(t);return e.afterCloneFrom(t),e}function As(t){return (e=Ms(t))[En]=true,e;var e;}function Ps(t,e){const n=parseInt(t.style.paddingInlineStart,10)||0,r=Math.round(n/40);e.setIndent(r);}function Fs(t){return true===t.__lexicalUnmanaged}function Ls(t,e){return function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(t,e)&&t[e]!==Mn[e]}function Is(e){const n=V$5 in e.prototype?e.prototype[V$5]():void 0,r=function(e){if(!(e===Mn||e.prototype instanceof Mn)){let n="<unknown>",r="<unknown>";try{n=e.getType();}catch(t){}try{Ui.version&&(r=JSON.parse(Ui.version));}catch(t){}t(290,e.name,n,r);}return e===ki||e===Ci||e===Mn}(e),i=!r&&Ls(e,"getType")?e.getType():void 0;let o,s=i;if(n)if(i)o=n[i];else for(const[t,e]of Object.entries(n))s=t,o=e;if(!r&&s&&(Ls(e,"getType")||(e.getType=()=>s),Ls(e,"clone")||(e.clone=t=>(Yi(t),new e)),Ls(e,"importJSON")||(e.importJSON=o&&o.$importJSON||(t=>(new e).updateFromJSON(t))),!Ls(e,"importDOM")&&o)){const{importDOM:t}=o;t&&(e.importDOM=()=>t);}return {ownNodeConfig:o,ownNodeType:s}}function Ks(t){const e=bs();ei();return new(e.resolveRegisteredNodeAfterReplacements(e.getRegisteredNode(t)).klass)}const zs=(t,e)=>{let n=t;for(;null!=n&&!bi(n);){if(e(n))return n;n=n.getParent();}return null},Rs={next:"previous",previous:"next"};class Bs{origin;constructor(t){this.origin=t;}[Symbol.iterator](){return hl({hasNext:Hs,initial:this.getAdjacentCaret(),map:t=>t,step:t=>t.getAdjacentCaret()})}getAdjacentCaret(){return tl(this.getNodeAtCaret(),this.direction)}getSiblingCaret(){return tl(this.origin,this.direction)}remove(){const t=this.getNodeAtCaret();return t&&t.remove(),this}replaceOrInsert(t,e){const n=this.getNodeAtCaret();return t.is(this.origin)||t.is(n)||(null===n?this.insert(t):n.replace(t,e)),this}splice(e,n,r="next"){const i=r===this.direction?n:Array.from(n).reverse();let o=this;const s=this.getParentAtCaret(),l=new Map;for(let t=o.getAdjacentCaret();null!==t&&l.size<e;t=t.getAdjacentCaret()){const e=t.origin.getWritable();l.set(e.getKey(),e);}for(const e of i){if(l.size>0){const n=o.getNodeAtCaret();if(n)if(l.delete(n.getKey()),l.delete(e.getKey()),n.is(e)||o.origin.is(e));else {const t=e.getParent();t&&t.is(s)&&e.remove(),n.replace(e);}else null===n&&t(263,Array.from(l).join(" "));}else o.insert(e);o=tl(e,this.direction);}for(const t of l.values())t.remove();return this}}class Ws extends Bs{type="child";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:il(t,this.direction)}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=js(this.direction);return tl(this.getNodeAtCaret(),t)||il(this.origin,t)}getParentAtCaret(){return this.origin}getChildCaret(){return this}isSameNodeCaret(t){return t instanceof Ws&&this.direction===t.direction&&this.origin.is(t.origin)}isSamePointCaret(t){return this.isSameNodeCaret(t)}}const Js={root:bi,shadowRoot:as};function js(t){return Rs[t]}function $s(t,e="root"){return Js[e](t)?null:t}class Us extends Bs{type="sibling";getLatest(){const t=this.origin.getLatest();return t===this.origin?this:tl(t,this.direction)}getSiblingCaret(){return this}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return Si(this.origin)?il(this.origin,this.direction):null}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){const t=js(this.direction);return tl(this.getNodeAtCaret(),t)||il(this.origin.getParentOrThrow(),t)}isSamePointCaret(t){return t instanceof Us&&this.direction===t.direction&&this.origin.is(t.origin)}isSameNodeCaret(t){return (t instanceof Us||t instanceof Vs)&&this.direction===t.direction&&this.origin.is(t.origin)}}class Vs extends Bs{type="text";offset;constructor(t,e){super(t),this.offset=e;}getLatest(){const t=this.origin.getLatest();return t===this.origin?this:el(t,this.direction,this.offset)}getParentAtCaret(){return this.origin.getParent()}getChildCaret(){return null}getParentCaret(t="root"){return tl($s(this.getParentAtCaret(),t),this.direction)}getFlipped(){return el(this.origin,js(this.direction),this.offset)}isSamePointCaret(t){return t instanceof Vs&&this.direction===t.direction&&this.origin.is(t.origin)&&this.offset===t.offset}isSameNodeCaret(t){return (t instanceof Us||t instanceof Vs)&&this.direction===t.direction&&this.origin.is(t.origin)}getSiblingCaret(){return tl(this.origin,this.direction)}}function Ys(t){return t instanceof Vs}function Hs(t){return t instanceof Us}function Gs(t){return t instanceof Ws}const Xs={next:class extends Vs{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Vs{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Qs={next:class extends Us{direction="next";getNodeAtCaret(){return this.origin.getNextSibling()}insert(t){return this.origin.insertAfter(t),this}},previous:class extends Us{direction="previous";getNodeAtCaret(){return this.origin.getPreviousSibling()}insert(t){return this.origin.insertBefore(t),this}}},Zs={next:class extends Ws{direction="next";getNodeAtCaret(){return this.origin.getFirstChild()}insert(t){return this.origin.splice(0,0,[t]),this}},previous:class extends Ws{direction="previous";getNodeAtCaret(){return this.origin.getLastChild()}insert(t){return this.origin.splice(this.origin.getChildrenSize(),0,[t]),this}}};function tl(t,e){return t?new Qs[e](t):null}function el(t,e,n){return t?new Xs[e](t,nl(t,n)):null}function nl(t,n,r="error"){const i=t.getTextContentSize();let o="next"===n?i:"previous"===n?0:n;return (o<0||o>i)&&("clamp"!==r&&e(284,String(n),String(i),t.getKey()),o=o<0?0:i),o}function rl(t,e){return new cl(t,e)}function il(t,e){return Si(t)?new Zs[e](t):null}function ol(t){return t&&t.getChildCaret()||t}function sl(t){return t&&ol(t.getAdjacentCaret())}class ll{type="node-caret-range";direction;anchor;focus;constructor(t,e,n){this.anchor=t,this.focus=e,this.direction=n;}getLatest(){const t=this.anchor.getLatest(),e=this.focus.getLatest();return t===this.anchor&&e===this.focus?this:new ll(t,e,this.direction)}isCollapsed(){return this.anchor.isSamePointCaret(this.focus)}getTextSlices(){const t=t=>{const e=this[t].getLatest();return Ys(e)?function(t,e){const{direction:n,origin:r}=t,i=nl(r,"focus"===e?js(n):n);return rl(t,i-t.offset)}(e,t):null},e=t("anchor"),n=t("focus");if(e&&n){const{caret:t}=e,{caret:r}=n;if(t.isSameNodeCaret(r))return [rl(t,r.offset-t.offset),null]}return [e,n]}iterNodeCarets(t="root"){const e=Ys(this.anchor)?this.anchor.getSiblingCaret():this.anchor.getLatest(),n=this.focus.getLatest(),r=Ys(n),i=e=>e.isSameNodeCaret(n)?null:sl(e)||e.getParentCaret(t);return hl({hasNext:t=>null!==t&&!(r&&n.isSameNodeCaret(t)),initial:e.isSameNodeCaret(n)?null:i(e),map:t=>t,step:i})}[Symbol.iterator](){return this.iterNodeCarets("root")}}class cl{type="slice";caret;distance;constructor(t,e){this.caret=t,this.distance=e;}getSliceIndices(){const{distance:t,caret:{offset:e}}=this,n=e+t;return n<e?[n,e]:[e,n]}getTextContent(){const[t,e]=this.getSliceIndices();return this.caret.origin.getTextContent().slice(t,e)}getTextContentSize(){return Math.abs(this.distance)}removeTextSlice(){const{caret:{origin:t,direction:e}}=this,[n,r]=this.getSliceIndices(),i=t.getTextContent();return el(t.setTextContent(i.slice(0,n)+i.slice(r)),e,n)}}function ul(t){return dl(t,tl(No(),t.direction))}function fl(t){return dl(t,t)}function dl(e,n){return e.direction!==n.direction&&t(265),new ll(e,n,e.direction)}function hl(t){const{initial:e,hasNext:n,step:r,map:i}=t;let o=e;return {[Symbol.iterator](){return this},next(){if(!n(o))return {done:true,value:void 0};const t={done:false,value:i(o)};return o=r(o),t}}}function gl(e,n){const r=ml(e.origin,n.origin);switch(null===r&&t(275,e.origin.getKey(),n.origin.getKey()),r.type){case "same":{const t="text"===e.type,r="text"===n.type;return t&&r?function(t,e){return Math.sign(t-e)}(e.offset,n.offset):e.type===n.type?0:t?-1:r?1:"child"===e.type?-1:1}case "ancestor":return "child"===e.type?-1:1;case "descendant":return "child"===n.type?1:-1;case "branch":return _l(r)}}function _l(t){const{a:e,b:n}=t,r=e.__key,i=n.__key;let o=e,s=n;for(;o&&s;o=o.getNextSibling(),s=s.getNextSibling()){if(o.__key===i)return -1;if(s.__key===r)return 1}return null===o?1:-1}function pl(t,e){return e.is(t)}function yl(t){return Si(t)?[t.getLatest(),null]:[t.getParent(),t.getLatest()]}function ml(e,n){if(e.is(n))return {commonAncestor:e,type:"same"};const r=new Map;for(let[t,n]=yl(e);t;n=t,t=t.getParent())r.set(t,n);for(let[i,o]=yl(n);i;o=i,i=i.getParent()){const s=r.get(i);if(void 0!==s)return null===s?(pl(e,i)||t(276),{commonAncestor:i,type:"ancestor"}):null===o?(pl(n,i)||t(277),{commonAncestor:i,type:"descendant"}):((Si(s)||pl(e,s))&&(Si(o)||pl(n,o))&&i.is(s.getParent())&&i.is(o.getParent())||t(278),{a:s,b:o,commonAncestor:i,type:"branch"})}return null}function xl(e,n){const{type:r,key:i,offset:o}=e,s=hs(e.key);return "text"===r?(lr(s)||t(266,s.getType(),i),el(s,n,o)):(Si(s)||t(267,s.getType(),i),Pl(s,e.offset,n))}function Cl(e,n){const{origin:r,direction:i}=n,o="next"===i;Ys(n)?e.set(r.getKey(),n.offset,"text"):Hs(n)?lr(r)?e.set(r.getKey(),nl(r,i),"text"):e.set(r.getParentOrThrow().getKey(),r.getIndexWithinParent()+(o?1:0),"element"):(Gs(n)&&Si(r)||t(268),e.set(r.getKey(),o?0:r.getChildrenSize(),"element"));}function Sl(t){const e=Lr(),n=yr(e)?e:Ar();return vl(n,t),wo(n),n}function vl(t,e){Cl(t.anchor,e.anchor),Cl(t.focus,e.focus);}function kl(t){const{anchor:e,focus:n}=t,r=xl(e,"next"),i=xl(n,"next"),o=gl(r,i)<=0?"next":"previous";return dl(Ml(r,o),Ml(i,o))}function Tl(t){const{direction:e,origin:n}=t,r=tl(n,js(e)).getNodeAtCaret();return r?tl(r,e):il(n.getParentOrThrow(),e)}function Nl(t,e="root"){const n=[t];for(let r=Gs(t)?t.getParentCaret(e):t.getSiblingCaret();null!==r;r=r.getParentCaret(e))n.push(Tl(r));return n}function bl(t){return !!t&&t.origin.isAttached()}function wl(e,n="removeEmptySlices"){if(e.isCollapsed())return e;const r="root",i="next";let o=n;const s=Al(e,i),l=Nl(s.anchor,r),c=Nl(s.focus.getFlipped(),r),a=new Set,u=[];for(const t of s.iterNodeCarets(r))if(Gs(t))a.add(t.origin.getKey());else if(Hs(t)){const{origin:e}=t;Si(e)&&!a.has(e.getKey())||u.push(e);}for(const t of u)t.remove();for(const t of s.getTextSlices()){if(!t)continue;const{origin:e}=t.caret,n=e.getTextContentSize(),r=Tl(tl(e,i)),s=e.getMode();if(Math.abs(t.distance)===n&&"removeEmptySlices"===o||"token"===s&&0!==t.distance)r.remove();else if(0!==t.distance){o="removeEmptySlices";let e=t.removeTextSlice();const n=t.caret.origin;if("segmented"===s){const t=e.origin,n=sr(t.getTextContent()).setStyle(t.getStyle()).setFormat(t.getFormat());r.replaceOrInsert(n),e=el(n,i,e.offset);}n.is(l[0].origin)&&(l[0]=e),n.is(c[0].origin)&&(c[0]=e.getFlipped());}}let f,d;for(const t of l)if(bl(t)){f=El(t);break}for(const t of c)if(bl(t)){d=El(t);break}const h=function(t,e,n){if(!t||!e)return null;const r=t.getParentAtCaret(),i=e.getParentAtCaret();if(!r||!i)return null;const o=r.getParents().reverse();o.push(r);const s=i.getParents().reverse();s.push(i);const l=Math.min(o.length,s.length);let c;for(c=0;c<l&&o[c]===s[c];c++);const a=(t,e)=>{let n;for(let r=c;r<t.length;r++){const i=t[r];if(as(i))return;!n&&e(i)&&(n=i);}return n},u=a(o,Ns),f=u&&a(s,t=>n.has(t.getKey())&&Ns(t));return u&&f?[u,f]:null}(f,d,a);if(h){const[t,e]=h;il(t,"previous").splice(0,e.getChildren()),e.remove();}const g=[f,d,...l,...c].find(bl);if(g){return fl(Ml(El(g),e.direction))}t(269,JSON.stringify(l.map(t=>t.origin.__key)));}function El(t){const e=function(t){let e=t;for(;Gs(e);){const t=sl(e);if(!Gs(t))break;e=t;}return e}(t.getLatest()),{direction:n}=e;if(lr(e.origin))return Ys(e)?e:el(e.origin,n,n);const r=e.getAdjacentCaret();return Hs(r)&&lr(r.origin)?el(r.origin,n,js(n)):e}function Ol(t){return Ys(t)&&t.offset!==nl(t.origin,t.direction)}function Ml(t,e){return t.direction===e?t:t.getFlipped()}function Al(t,e){return t.direction===e?t:dl(Ml(t.focus,e),Ml(t.anchor,e))}function Pl(t,e,n){let r=il(t,"next");for(let t=0;t<e;t++){const t=r.getAdjacentCaret();if(null===t)break;r=t;}return Ml(r,n)}function Kl(t){return t}function zl(...t){return t}function Bl(t){return t}function Wl(t,e){if(!e||t===e)return t;for(const n in e)if(t[n]!==e[n])return {...t,...e};return t}
|
|
1353
1387
|
|
|
1354
1388
|
function getNonce() {
|
|
1355
1389
|
const element = document.head.querySelector("meta[name=csp-nonce]");
|
|
@@ -1364,7 +1398,7 @@ function getNonce() {
|
|
|
1364
1398
|
*
|
|
1365
1399
|
*/
|
|
1366
1400
|
|
|
1367
|
-
const
|
|
1401
|
+
const P$2=new Map;function F$4(e){const t={};if(!e)return t;const n=e.split(";");for(const e of n)if(""!==e){const[n,o]=e.split(/:([^]+)/);n&&o&&(t[n.trim()]=o.trim());}return t}function b$3(e){let t=P$2.get(e);return void 0===t&&(t=F$4(e),P$2.set(e,t)),t}function O$1(e){const n=bs().getElementByKey(e.getKey());if(null===n)return null;const o=n.ownerDocument.defaultView;return null===o?null:o.getComputedStyle(n)}function z$3(e){return O$1(bi(e)?e:e.getParentOrThrow())}function A$2(e){const t=z$3(e);return null!==t&&"rtl"===t.direction}function M$4(e,t,n="self"){const o=e.getStartEndPoints();if(t.isSelected(e)&&!lo(t)&&null!==o){const[l,r]=o,s=e.isBackward(),i=l.getNode(),c=r.getNode(),f=t.is(i),u=t.is(c);if(f||u){const[o,l]=Sr(e),r=i.is(c),f=t.is(s?c:i),u=t.is(s?i:c);let d,p=0;if(r)p=o>l?l:o,d=o>l?o:l;else if(f){p=s?l:o,d=void 0;}else if(u){p=0,d=s?o:l;}const h=t.__text.slice(p,d);h!==t.__text&&("clone"===n&&(t=As(t)),t.__text=h);}}return t}function $$3(e){const t=e.getStyle(),n=F$4(t);P$2.set(t,n);}function Q$4(e){const t=Y$3(e);return null!==t&&"vertical-rl"===t.writingMode}function Y$3(e){const t=e.anchor.getNode();return Si(t)?O$1(t):z$3(t)}function Z$3(e,t){let n=Q$4(e)?!t:t;te(e)&&(n=!n);const l=xl(e.focus,n?"previous":"next");if(Ol(l))return false;for(const e of ul(l)){if(Gs(e))return !e.origin.isInline();if(!Si(e.origin)){if(Ti(e.origin))return true;break}}return false}function ee(e,t,n,o){e.modify(t?"extend":"move",n,o);}function te(e){const t=Y$3(e);return null!==t&&"rtl"===t.direction}function ne(e,t,n){const o=te(e);let l;l=Q$4(e)||o?!n:n,ee(e,t,l,"character");}
|
|
1368
1402
|
|
|
1369
1403
|
/**
|
|
1370
1404
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -1374,7 +1408,7 @@ const C$2=new Map;function I$4(e){const t={};if(!e)return t;const n=e.split(";")
|
|
|
1374
1408
|
*
|
|
1375
1409
|
*/
|
|
1376
1410
|
|
|
1377
|
-
function
|
|
1411
|
+
function R$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const T$2="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,B$2=T$2&&"documentMode"in document?document.documentMode:null;!(!T$2||!("InputEvent"in window)||B$2)&&"getTargetRanges"in new window.InputEvent("input");function F$3(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function U$4(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function lt$3(t,...e){const n=F$3(...e);n.length>0&&t.classList.add(...n);}function ut$2(t,...e){const n=F$3(...e);n.length>0&&t.classList.remove(...n);}function ft$1(t){return t?t.getAdjacentCaret():null}function wt$4(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function xt$4(t){const e=zs(t,t=>Si(t)&&!t.isInline());return Si(e)||R$3(4,t.__key),e}function Lt$3(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}
|
|
1378
1412
|
|
|
1379
1413
|
/**
|
|
1380
1414
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -1384,7 +1418,7 @@ function P$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URL
|
|
|
1384
1418
|
*
|
|
1385
1419
|
*/
|
|
1386
1420
|
|
|
1387
|
-
function w$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function I$2(t){let e=1,n=t.getParent();for(;null!=n;){if(Z$2(n)){const t=n.getParent();if(ot$2(t)){e++,n=t.getParent();continue}w$2(40);}return e}return e}function D$3(t){let e=t.getParent();ot$2(e)||w$2(40);let n=e;for(;null!==n;)n=n.getParent(),ot$2(n)&&(e=n);return e}function M$5(t){let e=[];const n=t.getChildren().filter(Z$2);for(let t=0;t<n.length;t++){const r=n[t],i=r.getFirstChild();ot$2(i)?e=e.concat(M$5(i)):e.push(r);}return e}function R$3(t){return Z$2(t)&&ot$2(t.getFirstChild())}function J$3(t){return Y$2().append(t)}function B$1(t,e){return Z$2(t)&&(0===e.length||1===e.length&&t.is(e[0])&&0===t.getChildrenSize())}function W$2(t){const e=Nr();if(null!==e){let n=e.getNodes();if(cr(e)){const r=e.getStartEndPoints();null===r&&w$2(143);const[i]=r,s=i.getNode(),o=s.getParent();if(to(s)){const t=s.getFirstChild();if(t)n=t.selectStart().getNodes();else {const t=Pi();s.append(t),n=t.select().getNodes();}}else if(B$1(s,n)){const e=st$2(t);if(to(o)){s.replace(e);const t=Y$2();di(s)&&(t.setFormat(s.getFormatType()),t.setIndent(s.getIndent())),e.append(t);}else if(Z$2(s)){const t=s.getParentOrThrow();K$2(e,t.getChildren()),t.replace(e);}return}}const r=new Set;for(let e=0;e<n.length;e++){const i=n[e];if(di(i)&&i.isEmpty()&&!Z$2(i)&&!r.has(i.getKey())){U$3(i,t);continue}let s=is(i)?i.getParent():Z$2(i)&&i.isEmpty()?i:null;for(;null!=s;){const e=s.getKey();if(ot$2(s)){if(!r.has(e)){const n=st$2(t);K$2(n,s.getChildren()),s.replace(n),r.add(e);}break}{const n=s.getParent();if(to(n)&&!r.has(e)){r.add(e),U$3(s,t);break}s=n;}}}}}function K$2(t,e){t.splice(t.getChildrenSize(),0,e);}function U$3(t,e){if(ot$2(t))return t;const n=t.getPreviousSibling(),r=t.getNextSibling(),i=Y$2();let s;if(K$2(i,t.getChildren()),ot$2(n)&&e===n.getListType())n.append(i),ot$2(r)&&e===r.getListType()&&(K$2(n,r.getChildren()),r.remove()),s=n;else if(ot$2(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(i),s=r;else {const n=st$2(e);n.append(i),t.replace(n),s=n;}return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),t.remove(),s}function V$2(t,e){const n=t.getLastChild(),r=e.getFirstChild();n&&r&&R$3(n)&&R$3(r)&&(V$2(n.getFirstChild(),r.getFirstChild()),r.remove());const i=e.getChildren();i.length>0&&t.append(...i),e.remove();}function z$3(){const e=Nr();if(cr(e)){const n=new Set,r=e.getNodes(),i=e.anchor.getNode();if(B$1(i,r))n.add(D$3(i));else for(let e=0;e<r.length;e++){const i=r[e];if(is(i)){const e=vt$3(i,j$2);null!=e&&n.add(D$3(e));}}for(const t of n){let n=t;const r=M$5(t);for(const t of r){const r=Pi().setTextStyle(e.style).setTextFormat(e.format);K$2(r,t.getChildren()),n.insertAfter(r),n=r,t.__key===e.anchor.key&&cl(e.anchor,pl(Vo(r,"next"))),t.__key===e.focus.key&&cl(e.focus,pl(Vo(r,"next"))),t.remove();}t.remove();}}}function $$2(t){const e=new Set;if(R$3(t)||e.has(t.getKey()))return;const n=t.getParent(),r=t.getNextSibling(),i=t.getPreviousSibling();if(R$3(r)&&R$3(i)){const n=i.getFirstChild();if(ot$2(n)){n.append(t);const i=r.getFirstChild();if(ot$2(i)){K$2(n,i.getChildren()),r.remove(),e.add(r.getKey());}}}else if(R$3(r)){const e=r.getFirstChild();if(ot$2(e)){const n=e.getFirstChild();null!==n&&n.insertBefore(t);}}else if(R$3(i)){const e=i.getFirstChild();ot$2(e)&&e.append(t);}else if(ot$2(n)){const e=Y$2().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=st$2(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());e.append(s),s.append(t),i?i.insertAfter(e):r?r.insertBefore(e):n.append(e);}}function q$2(t){if(R$3(t))return;const e=t.getParent(),n=e?e.getParent():void 0;if(ot$2(n?n.getParent():void 0)&&Z$2(n)&&ot$2(e)){const r=e?e.getFirstChild():void 0,i=e?e.getLastChild():void 0;if(t.is(r))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(i))n.insertAfter(t),e.isEmpty()&&n.remove();else {const r=e.getListType(),i=Y$2(),s=st$2(r);i.append(s),t.getPreviousSiblings().forEach((t=>s.append(t)));const o=Y$2(),l=st$2(r);o.append(l),K$2(l,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(t);}}}function H(){const t=Nr();if(!cr(t)||!t.isCollapsed())return false;const e=t.anchor.getNode();if(!Z$2(e)||0!==e.getChildrenSize())return false;const n=D$3(e),r=e.getParent();ot$2(r)||w$2(40);const i=r.getParent();let s;if(to(i))s=Pi(),n.insertAfter(s);else {if(!Z$2(i))return false;s=Y$2(),i.insertAfter(s);}s.setTextStyle(t.style).setTextFormat(t.format).select();const o=e.getNextSiblings();if(o.length>0){const t=st$2(r.getListType());if(Z$2(s)){const e=Y$2();e.append(t),s.insertAfter(e);}else s.insertAfter(t);t.append(...o);}return function(t){let e=t;for(;null==e.getNextSibling()&&null==e.getPreviousSibling();){const t=e.getParent();if(null==t||!Z$2(t)&&!ot$2(t))break;e=t;}e.remove();}(e),true}function X$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}let j$2 = class j extends fi{static getType(){return "listitem"}static clone(t){return new j(t.__value,t.__checked,t.__key)}constructor(t,e,n){super(n),this.__value=void 0===t?1:t,this.__checked=e;}createDOM(t){const e=document.createElement("li");return this.updateListItemDOM(null,e,t),e}updateListItemDOM(t,r,i){const s=this.getParent();ot$2(s)&&"check"===s.getListType()&&function(t,e,n,r){ot$2(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"));}(r,this,t),r.value=this.__value,function(t,r,i){const s=[],o=[],l=r.list,c=l?l.listitem:void 0;let a;l&&l.nested&&(a=l.nested.listitem);void 0!==c&&s.push(...X$2(c));if(l){const t=i.getParent(),e=ot$2(t)&&"check"===t.getListType(),n=i.getChecked();e&&!n||o.push(l.listitemUnchecked),e&&n||o.push(l.listitemChecked),e&&s.push(n?l.listitemChecked:l.listitemUnchecked);}if(void 0!==a){const t=X$2(a);i.getChildren().some((t=>ot$2(t)))?s.push(...t):o.push(...t);}o.length>0&&it$3(t,...o);s.length>0&&rt$2(t,...s);}(r,i.theme,this);const o=t?t.__style:"",l=this.__style;o!==l&&(""===l?r.removeAttribute("style"):r.style.cssText=l),function(t,e,n){const r=B$2(e.__textStyle);for(const e in r)t.style.setProperty(`--listitem-marker-${e}`,r[e]);if(n)for(const e in B$2(n.__textStyle))e in r||t.style.removeProperty(`--listitem-marker-${e}`);}(r,this,t);}updateDOM(t,e,n){const r=e;return this.updateListItemDOM(t,r,n),false}static transform(){return t=>{if(Z$2(t)||w$2(144),null==t.__checked)return;const e=t.getParent();ot$2(e)&&"check"!==e.getListType()&&null!=t.getChecked()&&t.setChecked(void 0);}}static importDOM(){return {li:()=>({conversion:G$2,priority:0})}}static importJSON(t){return Y$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const e=this.createDOM(t._config),n=this.getFormatType();n&&(e.style.textAlign=n);const r=this.getDirection();return r&&(e.dir=r),{element:e}}exportJSON(){return {...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let e=0;e<t.length;e++){const n=t[e];if(di(n)&&this.canMergeWith(n)){const t=n.getChildren();this.append(...t),n.remove();}else super.append(n);}return this}replace(t,e){if(Z$2(t))return super.replace(t);this.setIndent(0);const n=this.getParentOrThrow();if(!ot$2(n))return t;if(n.__first===this.getKey())n.insertBefore(t);else if(n.__last===this.getKey())n.insertAfter(t);else {const e=st$2(n.getListType());let r=this.getNextSibling();for(;r;){const t=r;r=r.getNextSibling(),e.append(t);}n.insertAfter(t),t.insertAfter(e);}return e&&(di(t)||w$2(139),this.getChildren().forEach((e=>{t.append(e);}))),this.remove(),0===n.getChildrenSize()&&n.remove(),t}insertAfter(t,e=true){const n=this.getParentOrThrow();if(ot$2(n)||w$2(39),Z$2(t))return super.insertAfter(t,e);const r=this.getNextSiblings();if(n.insertAfter(t,e),0!==r.length){const i=st$2(n.getListType());r.forEach((t=>i.append(t))),t.insertAfter(i,e);}return t}remove(t){const e=this.getPreviousSibling(),n=this.getNextSibling();super.remove(t),e&&n&&R$3(e)&&R$3(n)&&(V$2(e.getFirstChild(),n.getFirstChild()),n.remove());}insertNewAfter(t,e=true){const n=Y$2().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,e),n}collapseAtStart(t){const e=Pi();this.getChildren().forEach((t=>e.append(t)));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=Z$2(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else {n.insertBefore(e),n.remove();const r=t.anchor,i=t.focus,s=e.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,i.offset,"element");}else n.insertBefore(e),this.remove();return true}getValue(){return this.getLatest().__value}setValue(t){const e=this.getWritable();return e.__value=t,e}getChecked(){const t=this.getLatest();let e;const n=this.getParent();return ot$2(n)&&(e=n.getListType()),"check"===e?Boolean(t.__checked):void 0}setChecked(t){const e=this.getWritable();return e.__checked=t,e}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(null===t||!this.isAttached())return this.getLatest().__indent;let e=t.getParentOrThrow(),n=0;for(;Z$2(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){"number"!=typeof t&&w$2(117),(t=Math.floor(t))>=0||w$2(199);let e=this.getIndent();for(;e!==t;)e<t?($$2(this),e++):(q$2(this),e--);return this}canInsertAfter(t){return Z$2(t)}canReplaceWith(t){return Z$2(t)}canMergeWith(t){return Z$2(t)||Fi(t)}extractWithChild(t,e){if(!cr(e))return false;const n=e.anchor.getNode(),r=e.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===e.getTextContent().length}isParentRequired(){return true}createParentElementNode(){return st$2("bullet")}canMergeWhenEmpty(){return true}};function G$2(t){if(t.classList.contains("task-list-item"))for(const e of t.children)if("INPUT"===e.tagName)return Q$2(e);const e=t.getAttribute("aria-checked");return {node:Y$2("true"===e||"false"!==e&&void 0)}}function Q$2(t){if(!("checkbox"===t.getAttribute("type")))return {node:null};return {node:Y$2(t.hasAttribute("checked"))}}function Y$2(t){return no(new j$2(void 0,t))}function Z$2(t){return t instanceof j$2}let tt$1 = class tt extends fi{static getType(){return "list"}static clone(t){const e=t.__listType||it$2[t.__tag];return new tt(e,t.__start,t.__key)}constructor(t="number",e=1,n){super(n);const r=it$2[t]||t;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=e;}getTag(){return this.__tag}setListType(t){const e=this.getWritable();return e.__listType=t,e.__tag="number"===t?"ol":"ul",e}getListType(){return this.__listType}getStart(){return this.__start}setStart(t){const e=this.getWritable();return e.__start=t,e}createDOM(t,e){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,et$1(r,t.theme,this),r}updateDOM(t,e,n){return t.__tag!==this.__tag||(et$1(e,n.theme,this),false)}static transform(){return t=>{ot$2(t)||w$2(163),function(t){const e=t.getNextSibling();ot$2(e)&&t.getListType()===e.getListType()&&V$2(t,e);}(t),function(t){const e="check"!==t.getListType();let n=t.getStart();for(const r of t.getChildren())Z$2(r)&&(r.getValue()!==n&&r.setValue(n),e&&null!=r.getLatest().__checked&&r.setChecked(void 0),ot$2(r.getFirstChild())||n++);}(t);}}static importDOM(){return {ol:()=>({conversion:rt$1,priority:0}),ul:()=>({conversion:rt$1,priority:0})}}static importJSON(t){return st$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const e=this.createDOM(t._config,t);return fo(e)&&(1!==this.__start&&e.setAttribute("start",String(this.__start)),"check"===this.__listType&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return {...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return false}canIndent(){return false}splice(t,e,n){let r=n;for(let t=0;t<n.length;t++){const e=n[t];Z$2(e)||(r===n&&(r=[...n]),r[t]=Y$2().append(!di(e)||ot$2(e)||e.isInline()?e:Xn(e.getTextContent())));}return super.splice(t,e,r)}extractWithChild(t){return Z$2(t)}};function et$1(t,r,i){const s=[],o=[],l=r.list;if(void 0!==l){const t=l[`${i.__tag}Depth`]||[],e=I$2(i)-1,n=e%t.length,r=t[n],c=l[i.__tag];let a;const u=l.nested,g=l.checklist;if(void 0!==u&&u.list&&(a=u.list),void 0!==c&&s.push(c),void 0!==g&&"check"===i.__listType&&s.push(g),void 0!==r){s.push(...X$2(r));for(let e=0;e<t.length;e++)e!==n&&o.push(i.__tag+e);}if(void 0!==a){const t=X$2(a);e>1?s.push(...t):o.push(...t);}}o.length>0&&it$3(t,...o),s.length>0&&rt$2(t,...s);}function nt$1(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(Z$2(r)){e.push(r);const t=r.getChildren();t.length>1&&t.forEach((t=>{ot$2(t)&&e.push(J$3(t));}));}else e.push(J$3(r));}return e}function rt$1(t){const e=t.nodeName.toLowerCase();let n=null;if("ol"===e){n=st$2("number",t.start);}else "ul"===e&&(n=function(t){if("check"===t.getAttribute("__lexicallisttype")||t.classList.contains("contains-task-list"))return true;for(const e of t.childNodes)if(fo(e)&&e.hasAttribute("aria-checked"))return true;return false}(t)?st$2("check"):st$2("bullet"));return {after:nt$1,node:n}}const it$2={ol:"number",ul:"bullet"};function st$2(t="number",e=1){return no(new tt$1(t,e))}function ot$2(t){return t instanceof tt$1}const ft$2=oe$1("INSERT_UNORDERED_LIST_COMMAND"),pt$3=oe$1("INSERT_ORDERED_LIST_COMMAND"),mt$3=oe$1("REMOVE_LIST_COMMAND");function _t$3(t){return j$3(t.registerCommand(pt$3,(()=>(W$2("number"),true)),Ii),t.registerCommand(ft$2,(()=>(W$2("bullet"),true)),Ii),t.registerCommand(mt$3,(()=>(z$3(),true)),Ii),t.registerCommand(de$1,(()=>H()),Ii),t.registerNodeTransform(j$2,(t=>{const e=t.getFirstChild();if(e){if(Qn(e)){const n=e.getStyle(),r=e.getFormat();t.getTextStyle()!==n&&t.setTextStyle(n),t.getTextFormat()!==r&&t.setTextFormat(r);}}else {const e=Nr();cr(e)&&(e.style!==t.getTextStyle()||e.format!==t.getTextFormat())&&e.isCollapsed()&&t.is(e.anchor.getNode())&&t.setTextStyle(e.style).setTextFormat(e.format);}})),t.registerNodeTransform(Jn,(t=>{const e=t.getParent();if(Z$2(e)&&t.is(e.getFirstChild())){const n=t.getStyle(),r=t.getFormat();n===e.getTextStyle()&&r===e.getTextFormat()||e.setTextStyle(n).setTextFormat(r);}})))}
|
|
1421
|
+
const T$1=Symbol.for("preact-signals");function B$1(){if(Z$2>1)return void Z$2--;let t,e=false;for(;void 0!==V$4;){let n=V$4;for(V$4=void 0,J$4++;void 0!==n;){const i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&Y$2(n))try{n.c();}catch(n){e||(t=n,e=true);}n=i;}}if(J$4=0,Z$2--,e)throw t}function F$2(t){if(Z$2>0)return t();Z$2++;try{return t()}finally{B$1();}}let G$3,V$4;function W$5(t){const e=G$3;G$3=void 0;try{return t()}finally{G$3=e;}}let Z$2=0,J$4=0,H$1=0;function q$3(t){if(void 0===G$3)return;let e=t.n;return void 0===e||e.t!==G$3?(e={i:0,S:t,p:G$3.s,n:void 0,t:G$3,e:void 0,x:void 0,r:e},void 0!==G$3.s&&(G$3.s.n=e),G$3.s=e,t.n=e,32&G$3.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=G$3.s,e.n=void 0,G$3.s.n=e,G$3.s=e),e):void 0}function Q$3(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function X$3(t,e){return new Q$3(t,e)}function Y$2(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return true;return false}function tt$2(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function et$3(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t;}t.s=e;}function nt$3(t,e){Q$3.call(this,void 0),this.x=t,this.s=void 0,this.g=H$1-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name;}function ot$3(t){const e=t.u;if(t.u=void 0,"function"==typeof e){Z$2++;const n=G$3;G$3=void 0;try{e();}catch(e){throw t.f&=-2,t.f|=8,st$3(t),e}finally{G$3=n,B$1();}}}function st$3(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ot$3(t);}function rt$2(t){if(G$3!==this)throw new Error("Out-of-order effect");et$3(this),G$3=t,this.f&=-2,8&this.f&&st$3(this),B$1();}function ct$3(t,e){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==e?void 0:e.name;}function dt$2(t,e){const n=new ct$3(t,e);try{n.c();}catch(t){throw n.d(),t}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function at$1(t,e={}){const n={};for(const i in t){const o=e[i],s=X$3(void 0===o?t[i]:o);n[i]=s;}return n}Q$3.prototype.brand=T$1,Q$3.prototype.h=function(){return true},Q$3.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:W$5(()=>{var t;null==(t=this.W)||t.call(this);}));},Q$3.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&W$5(()=>{var t;null==(t=this.Z)||t.call(this);}));}},Q$3.prototype.subscribe=function(t){return dt$2(()=>{const e=this.value,n=G$3;G$3=void 0;try{t(e);}finally{G$3=n;}},{name:"sub"})},Q$3.prototype.valueOf=function(){return this.value},Q$3.prototype.toString=function(){return this.value+""},Q$3.prototype.toJSON=function(){return this.value},Q$3.prototype.peek=function(){const t=G$3;G$3=void 0;try{return this.value}finally{G$3=t;}},Object.defineProperty(Q$3.prototype,"value",{get(){const t=q$3(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(J$4>100)throw new Error("Cycle detected");this.v=t,this.i++,H$1++,Z$2++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N();}finally{B$1();}}}}),nt$3.prototype=new Q$3,nt$3.prototype.h=function(){if(this.f&=-3,1&this.f)return false;if(32==(36&this.f))return true;if(this.f&=-5,this.g===H$1)return true;if(this.g=H$1,this.f|=1,this.i>0&&!Y$2(this))return this.f&=-2,true;const t=G$3;try{tt$2(this),G$3=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++);}catch(t){this.v=t,this.f|=16,this.i++;}return G$3=t,et$3(this),this.f&=-2,true},nt$3.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t);}Q$3.prototype.S.call(this,t);},nt$3.prototype.U=function(t){if(void 0!==this.t&&(Q$3.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t);}},nt$3.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N();}},Object.defineProperty(nt$3.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=q$3(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),ct$3.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t);}finally{t();}},ct$3.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ot$3(this),tt$2(this),Z$2++;const t=G$3;return G$3=this,rt$2.bind(this,t)},ct$3.prototype.N=function(){2&this.f||(this.f|=2,this.o=V$4,V$4=this);},ct$3.prototype.d=function(){this.f|=8,1&this.f||st$3(this);},ct$3.prototype.dispose=function(){this.d();};function pt$2(t){return ("function"==typeof t.nodes?t.nodes():t.nodes)||[]}function xt$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function yt$2(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)n[t]=yt$2(n[t],i[t]);return t}return e}const St$4=0,Et$3=1,bt$4=2,wt$3=3,Nt$3=4,Ot$2=5,Rt$1=6,Mt$2=7;function Ct$3(t){return t.id===St$4}function Dt$2(t){return t.id===bt$4}function _t$2(t){return function(t){return t.id===Et$3}(t)||xt$3(305,String(t.id),String(Et$3)),Object.assign(t,{id:bt$4})}const It$2=new Set;let jt$2 = class jt{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:St$4};}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):Wl;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Dt$2(e)||xt$3(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(t,e,n){return Object.assign(t,{config:e,id:wt$3,registerState:n})}(e,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(t,o.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:Nt$3,initResult:e,registerState:n})}(o,s,i);}build(t){const e=this.state;let n;e.id!==Nt$3&&xt$3(307,String(e.id),String(Ot$2)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:Ot$2,output:e,registerState:n})}(e,n,i);}register(t,e){this._signal=e;const n=this.state;n.id!==Ot$2&&xt$3(308,String(n.id),String(Ot$2));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:Rt$1})}(n),()=>{const t=this.state;t.id!==Mt$2&&xt$3(309,String(n.id),String(Mt$2)),this.state=function(t){return Object.assign(t,{id:Ot$2})}(t),i&&i();}}afterRegistration(t){const e=this.state;let n;return e.id!==Rt$1&&xt$3(310,String(e.id),String(Rt$1)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:Mt$2})}(e),n}getSignal(){return void 0===this._signal&&xt$3(311),this._signal}getInitResult(){ void 0===this.extension.init&&xt$3(312,this.extension.name);const t=this.state;return function(t){return t.id>=Nt$3}(t)||xt$3(313,String(t.id),String(Nt$3)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=wt$3}(t)||xt$3(314,String(t.id),String(wt$3)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&xt$3(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&xt$3(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=Mt$2}(t)||xt$3(316,String(t.id),String(Mt$2)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||It$2}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;((function(t){return t.id>=Ot$2}))(t)||xt$3(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output};}return this._dependency}};const At$3={tag:Dn};function Pt$3(){const t=No();t.isEmpty()&&t.append(Li());}const Kt$1=Kl({config:Bl({setOptions:At$3,updateOptions:At$3}),init:({$initialEditorState:t=Pt$3})=>({$initialEditorState:t,initialized:false}),afterRegistration(t,{updateOptions:e,setOptions:n},i){const o=i.getInitResult();if(!o.initialized){o.initialized=true;const{$initialEditorState:i}=o;if(Mi(i))t.setEditorState(i,n);else if("function"==typeof i)t.update(()=>{i(t);},e);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,n);}}return ()=>{}},name:"@lexical/extension/InitialState",nodes:[Ni,Xn,Bn,ar,Di]}),kt$4=Symbol.for("@lexical/extension/LexicalBuilder");function zt$1(){}function Ut$1(t){throw t}function Lt$2(t){return Array.isArray(t)?t:[t]}const Tt$3="0.38.2+prod.esm";let Bt$1 = class Bt{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Tt$3,this.roots=t;for(const e of t)this.addExtension(e);}static fromExtensions(t){const e=[Lt$2(Kt$1)];for(const n of t)e.push(Lt$2(n));return new Bt(e)}static maybeFromEditor(t){const e=t[kt$4];return e&&(e.PACKAGE_VERSION!==Tt$3&&xt$3(292,e.PACKAGE_VERSION,Tt$3),e instanceof Bt||xt$3(293)),e}static fromEditor(t){const e=Bt.maybeFromEditor(t);return void 0===e&&xt$3(294),e}constructEditor(){const{$initialEditorState:t,onError:e,...n}=this.buildCreateEditorArgs(),i=Object.assign($i({...n,...e?{onError:t=>{e(t,i);}}:{}}),{[kt$4]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=zt$1;function e(){try{t();}finally{t=zt$1;}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=U$4(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&xt$3(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);i?i.set(e,n):this.outgoingConfigEdges.set(t,new Map([[e,n]]));const o=this.incomingEdges.get(e);o?o.add(t):this.incomingEdges.set(e,new Set([t]));}addExtension(t){ void 0!==this._sortedExtensionReps&&xt$3(296);const e=Lt$2(t),[n]=e;"string"!=typeof n.name&&xt$3(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&xt$3(298,n.name),!i){i=new jt$2(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&xt$3(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&xt$3(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=Lt$2(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e);}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[]);}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let o=n.state;if(Dt$2(o))return;const s=n.extension.name;var r;Ct$3(o)||xt$3(300,s,i||"[unknown]"),Ct$3(r=o)||xt$3(304,String(r.id),String(St$4)),o=Object.assign(r,{id:Et$3}),n.state=o;const c=this.outgoingConfigEdges.get(s);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,s);}o=_t$2(o),n.state=o,t.push(n);};for(const t of this.extensionNameMap.values())Ct$3(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t);}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&xt$3(301,t.name);for(const t of e)n.configs.add(t);}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),n=new AbortController,i=[()=>n.abort()],o=n.signal;for(const n of e){const e=n.register(t,o);e&&i.push(e);}for(const n of e){const e=n.afterRegistration(t);e&&i.push(e);}return U$4(...i)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const c of r){const{extension:r}=c;if(void 0!==r.onError&&(t.onError=r.onError),void 0!==r.disableEvents&&(t.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(t.parentEditor=r.parentEditor),void 0!==r.editable&&(t.editable=r.editable),void 0!==r.namespace&&(t.namespace=r.namespace),void 0!==r.$initialEditorState&&(t.$initialEditorState=r.$initialEditorState),r.nodes)for(const t of pt$2(r)){if("function"!=typeof t){const e=n.get(t.replace);e&&xt$3(302,r.name,t.replace.name,e.extension.name),n.set(t.replace,c);}e.add(t);}if(r.html){if(r.html.export)for(const[t,e]of r.html.export.entries())i.set(t,e);r.html.import&&Object.assign(o,r.html.import);}r.theme&&yt$2(s,r.theme);}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=[...e]);const c=Object.keys(o).length>0,d=i.size>0;(c||d)&&(t.html={},c&&(t.html.import=o),d&&(t.html.export=i));for(const e of r)e.init(t);return t.onError||(t.onError=Ut$1),t}};function Gt(t,e){const n=Bt$1.fromEditor(t).extensionNameMap.get(e);return n?n.getExtensionDependency():void 0}
|
|
1388
1422
|
|
|
1389
1423
|
/**
|
|
1390
1424
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -1394,7 +1428,7 @@ function w$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URL
|
|
|
1394
1428
|
*
|
|
1395
1429
|
*/
|
|
1396
1430
|
|
|
1397
|
-
function h$3(e,n){const t=n.body?n.body.childNodes:[];let o=[];const l=[];for(let n=0;n<t.length;n++){const r=t[n];if(!x$2.has(r.nodeName)){const n=y$3(r,e,l,false);null!==n&&(o=o.concat(n));}}return function(e){for(const n of e)n.getNextSibling()instanceof Ai&&n.insertAfter(Pn());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove();}}(l),o}function m$3(e,n){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),l=ps().getChildren();for(let o=0;o<l.length;o++){g$2(e,l[o],t,n);}return t.innerHTML}function g$2(t,o,c,u=null){let f=null===u||o.isSelected(u);const a=di(o)&&o.excludeFromCopy("html");let d=o;if(null!==u){let n=ko(o);n=Qn(n)&&null!==u?b$1(u,n):n,d=n;}const p=di(d)?d.getChildren():[],h=t._nodes.get(d.getType());let m;m=h&&void 0!==h.exportDOM?h.exportDOM(t,d):d.exportDOM(t);const{element:x,after:y}=m;if(!x)return false;const w=document.createDocumentFragment();for(let e=0;e<p.length;e++){const n=p[e],r=g$2(t,n,w,u);!f&&di(o)&&r&&o.extractWithChild(n,u,"html")&&(f=true);}if(f&&!a){if((fo(x)||go(x))&&x.append(w),c.append(x),y){const e=y.call(d,x);e&&(go(x)?x.replaceChildren(e):x.replaceWith(e));}}else c.append(w);return f}const x$2=new Set(["STYLE","SCRIPT"]);function y$3(e,n,o,r,i=new Map,s){let h=[];if(x$2.has(e.nodeName))return h;let m=null;const g=function(e,n){const{nodeName:t}=e,o=n._htmlConversions.get(t.toLowerCase());let l=null;if(void 0!==o)for(const n of o){const t=n(e);null!==t&&(null===l||(l.priority||0)<=(t.priority||0))&&(l=t);}return null!==l?l.conversion:null}(e,n),b=g?g(e):null;let C=null;if(null!==b){C=b.after;const n=b.node;if(m=Array.isArray(n)?n[n.length-1]:n,null!==m){for(const[,e]of i)if(m=e(m,s),!m)break;m&&h.push(...Array.isArray(n)?n:[m]);}null!=b.forChild&&i.set(e.nodeName,b.forChild);}const S=e.childNodes;let v=[];const N=(null==m||!to(m))&&(null!=m&&Cr(m)||r);for(let e=0;e<S.length;e++)v.push(...y$3(S[e],n,o,N,new Map(i),m));return null!=C&&(v=C(v)),po(e)&&(v=w$1(e,v,N?()=>{const e=new Ai;return o.push(e),e}:Pi)),null==m?v.length>0?h=h.concat(v):po(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return _o(e.nextSibling)&&_o(e.previousSibling)}(e)&&(h=h.concat(Pn())):di(m)&&m.append(...v),h}function w$1(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e<n.length;e++){const i=n[e];if(Cr(i))o&&!i.getFormat()&&i.setFormat(o),l.push(i);else if(r.push(i),e===n.length-1||e<n.length-1&&Cr(n[e+1])){const e=t();e.setFormat(o),e.append(...r),l.push(e),r=[];}}return l}
|
|
1431
|
+
function K$3(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function W$4(t){let e=1,n=t.getParent();for(;null!=n;){if(ot$2(n)){const t=n.getParent();if(dt$1(t)){e++,n=t.getParent();continue}K$3(40);}return e}return e}function J$3(t){let e=t.getParent();dt$1(e)||K$3(40);let n=e;for(;null!==n;)n=n.getParent(),dt$1(n)&&(e=n);return e}function U$3(t){let e=[];const n=t.getChildren().filter(ot$2);for(let t=0;t<n.length;t++){const r=n[t],i=r.getFirstChild();dt$1(i)?e=e.concat(U$3(i)):e.push(r);}return e}function $$2(t){return ot$2(t)&&dt$1(t.getFirstChild())}function V$3(t){return st$2().append(t)}function z$2(t,e){return ot$2(t)&&(0===e.length||1===e.length&&t.is(e[0])&&0===t.getChildrenSize())}function j$1(t){const e=Lr();if(null!==e){let n=e.getNodes();if(yr(e)){const r=e.getStartEndPoints();null===r&&K$3(143);const[i]=r,s=i.getNode(),o=s.getParent();if(as(s)){const t=s.getFirstChild();if(t)n=t.selectStart().getNodes();else {const t=Li();s.append(t),n=t.select().getNodes();}}else if(z$2(s,n)){const e=ht$3(t);if(as(o)){s.replace(e);const t=st$2();Si(s)&&(t.setFormat(s.getFormatType()),t.setIndent(s.getIndent())),e.append(t);}else if(ot$2(s)){const t=s.getParentOrThrow();q$2(e,t.getChildren()),t.replace(e);}return}}const r=new Set;for(let e=0;e<n.length;e++){const i=n[e];if(Si(i)&&i.isEmpty()&&!ot$2(i)&&!r.has(i.getKey())){H(i,t);continue}let s=ho(i)?i.getParent():ot$2(i)&&i.isEmpty()?i:null;for(;null!=s;){const e=s.getKey();if(dt$1(s)){if(!r.has(e)){const n=ht$3(t);q$2(n,s.getChildren()),s.replace(n),r.add(e);}break}{const n=s.getParent();if(as(n)&&!r.has(e)){r.add(e),H(s,t);break}s=n;}}}}}function q$2(t,e){t.splice(t.getChildrenSize(),0,e);}function H(t,e){if(dt$1(t))return t;const n=t.getPreviousSibling(),r=t.getNextSibling(),i=st$2();let s;if(q$2(i,t.getChildren()),dt$1(n)&&e===n.getListType())n.append(i),dt$1(r)&&e===r.getListType()&&(q$2(n,r.getChildren()),r.remove()),s=n;else if(dt$1(r)&&e===r.getListType())r.getFirstChildOrThrow().insertBefore(i),s=r;else {const n=ht$3(e);n.append(i),t.replace(n),s=n;}return i.setFormat(t.getFormatType()),i.setIndent(t.getIndent()),t.remove(),s}function X$2(t,e){const n=t.getLastChild(),r=e.getFirstChild();n&&r&&$$2(n)&&$$2(r)&&(X$2(n.getFirstChild(),r.getFirstChild()),r.remove());const i=e.getChildren();i.length>0&&t.append(...i),e.remove();}function G$2(){const t=Lr();if(yr(t)){const e=new Set,r=t.getNodes(),i=t.anchor.getNode();if(z$2(i,r))e.add(J$3(i));else for(let t=0;t<r.length;t++){const i=r[t];if(ho(i)){const t=wt$4(i,nt$2);null!=t&&e.add(J$3(t));}}for(const n of e){let e=n;const r=U$3(n);for(const n of r){const r=Li().setTextStyle(t.style).setTextFormat(t.format);q$2(r,n.getChildren()),e.insertAfter(r),e=r,n.__key===t.anchor.key&&Cl(t.anchor,El(il(r,"next"))),n.__key===t.focus.key&&Cl(t.focus,El(il(r,"next"))),n.remove();}n.remove();}}}function Q$2(t){const e="check"!==t.getListType();let n=t.getStart();for(const r of t.getChildren())ot$2(r)&&(r.getValue()!==n&&r.setValue(n),e&&null!=r.getLatest().__checked&&r.setChecked(void 0),dt$1(r.getFirstChild())||n++);}function Y$1(t){const e=new Set;if($$2(t)||e.has(t.getKey()))return;const n=t.getParent(),r=t.getNextSibling(),i=t.getPreviousSibling();if($$2(r)&&$$2(i)){const n=i.getFirstChild();if(dt$1(n)){n.append(t);const i=r.getFirstChild();if(dt$1(i)){q$2(n,i.getChildren()),r.remove(),e.add(r.getKey());}}}else if($$2(r)){const e=r.getFirstChild();if(dt$1(e)){const n=e.getFirstChild();null!==n&&n.insertBefore(t);}}else if($$2(i)){const e=i.getFirstChild();dt$1(e)&&e.append(t);}else if(dt$1(n)){const e=st$2().setTextFormat(t.getTextFormat()).setTextStyle(t.getTextStyle()),s=ht$3(n.getListType()).setTextFormat(n.getTextFormat()).setTextStyle(n.getTextStyle());e.append(s),s.append(t),i?i.insertAfter(e):r?r.insertBefore(e):n.append(e);}}function Z$1(t){if($$2(t))return;const e=t.getParent(),n=e?e.getParent():void 0;if(dt$1(n?n.getParent():void 0)&&ot$2(n)&&dt$1(e)){const r=e?e.getFirstChild():void 0,i=e?e.getLastChild():void 0;if(t.is(r))n.insertBefore(t),e.isEmpty()&&n.remove();else if(t.is(i))n.insertAfter(t),e.isEmpty()&&n.remove();else {const r=e.getListType(),i=st$2(),s=ht$3(r);i.append(s),t.getPreviousSiblings().forEach(t=>s.append(t));const o=st$2(),l=ht$3(r);o.append(l),q$2(l,t.getNextSiblings()),n.insertBefore(i),n.insertAfter(o),n.replace(t);}}}function tt$1(){const t=Lr();if(!yr(t)||!t.isCollapsed())return false;const e=t.anchor.getNode();if(!ot$2(e)||0!==e.getChildrenSize())return false;const n=J$3(e),r=e.getParent();dt$1(r)||K$3(40);const i=r.getParent();let s;if(as(i))s=Li(),n.insertAfter(s);else {if(!ot$2(i))return false;s=st$2(),i.insertAfter(s);}s.setTextStyle(t.style).setTextFormat(t.format).select();const o=e.getNextSiblings();if(o.length>0){const t=ht$3(r.getListType());if(ot$2(s)){const e=st$2();e.append(t),s.insertAfter(e);}else s.insertAfter(t);t.append(...o);}return function(t){let e=t;for(;null==e.getNextSibling()&&null==e.getPreviousSibling();){const t=e.getParent();if(null==t||!ot$2(t)&&!dt$1(t))break;e=t;}e.remove();}(e),true}function et$2(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}let nt$2 = class nt extends Ci{__value;__checked;$config(){return this.config("listitem",{$transform:t=>{if(null==t.__checked)return;const e=t.getParent();dt$1(e)&&"check"!==e.getListType()&&null!=t.getChecked()&&t.setChecked(void 0);},extends:Ci,importDOM:wn({li:()=>({conversion:rt$1,priority:0})})})}constructor(t=1,e=void 0,n){super(n),this.__value=void 0===t?1:t,this.__checked=e;}afterCloneFrom(t){super.afterCloneFrom(t),this.__value=t.__value,this.__checked=t.__checked;}createDOM(t){const e=document.createElement("li");return this.updateListItemDOM(null,e,t),e}updateListItemDOM(t,e,n){!function(t,e,n){const r=e.getParent();!dt$1(r)||"check"!==r.getListType()||dt$1(e.getFirstChild())?(t.removeAttribute("role"),t.removeAttribute("tabIndex"),t.removeAttribute("aria-checked")):(t.setAttribute("role","checkbox"),t.setAttribute("tabIndex","-1"),n&&e.__checked===n.__checked||t.setAttribute("aria-checked",e.getChecked()?"true":"false"));}(e,this,t),e.value=this.__value,function(t,e,n){const s=[],o=[],l=e.list,c=l?l.listitem:void 0;let a;l&&l.nested&&(a=l.nested.listitem);void 0!==c&&s.push(...et$2(c));if(l){const t=n.getParent(),e=dt$1(t)&&"check"===t.getListType(),r=n.getChecked();e&&!r||o.push(l.listitemUnchecked),e&&r||o.push(l.listitemChecked),e&&s.push(r?l.listitemChecked:l.listitemUnchecked);}if(void 0!==a){const t=et$2(a);n.getChildren().some(t=>dt$1(t))?s.push(...t):o.push(...t);}o.length>0&&ut$2(t,...o);s.length>0&<$3(t,...s);}(e,n.theme,this);const s=t?t.__style:"",o=this.__style;s!==o&&(""===o?e.removeAttribute("style"):e.style.cssText=o),function(t,e,n){const r=b$3(e.__textStyle);for(const e in r)t.style.setProperty(`--listitem-marker-${e}`,r[e]);if(n)for(const e in b$3(n.__textStyle))e in r||t.style.removeProperty(`--listitem-marker-${e}`);}(e,this,t);}updateDOM(t,e,n){const r=e;return this.updateListItemDOM(t,r,n),false}updateFromJSON(t){return super.updateFromJSON(t).setValue(t.value).setChecked(t.checked)}exportDOM(t){const e=this.createDOM(t._config),n=this.getFormatType();n&&(e.style.textAlign=n);const r=this.getDirection();return r&&(e.dir=r),{element:e}}exportJSON(){return {...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...t){for(let e=0;e<t.length;e++){const n=t[e];if(Si(n)&&this.canMergeWith(n)){const t=n.getChildren();this.append(...t),n.remove();}else super.append(n);}return this}replace(t,e){if(ot$2(t))return super.replace(t);this.setIndent(0);const n=this.getParentOrThrow();if(!dt$1(n))return t;if(n.__first===this.getKey())n.insertBefore(t);else if(n.__last===this.getKey())n.insertAfter(t);else {const e=ht$3(n.getListType());let r=this.getNextSibling();for(;r;){const t=r;r=r.getNextSibling(),e.append(t);}n.insertAfter(t),t.insertAfter(e);}return e&&(Si(t)||K$3(139),this.getChildren().forEach(e=>{t.append(e);})),this.remove(),0===n.getChildrenSize()&&n.remove(),t}insertAfter(t,e=true){const n=this.getParentOrThrow();if(dt$1(n)||K$3(39),ot$2(t))return super.insertAfter(t,e);const r=this.getNextSiblings();if(n.insertAfter(t,e),0!==r.length){const i=ht$3(n.getListType());r.forEach(t=>i.append(t)),t.insertAfter(i,e);}return t}remove(t){const e=this.getPreviousSibling(),n=this.getNextSibling();super.remove(t),e&&n&&$$2(e)&&$$2(n)&&(X$2(e.getFirstChild(),n.getFirstChild()),n.remove());}insertNewAfter(t,e=true){const n=st$2().updateFromJSON(this.exportJSON()).setChecked(!this.getChecked()&&void 0);return this.insertAfter(n,e),n}collapseAtStart(t){const e=Li();this.getChildren().forEach(t=>e.append(t));const n=this.getParentOrThrow(),r=n.getParentOrThrow(),i=ot$2(r);if(1===n.getChildrenSize())if(i)n.remove(),r.select();else {n.insertBefore(e),n.remove();const r=t.anchor,i=t.focus,s=e.getKey();"element"===r.type&&r.getNode().is(this)&&r.set(s,r.offset,"element"),"element"===i.type&&i.getNode().is(this)&&i.set(s,i.offset,"element");}else n.insertBefore(e),this.remove();return true}getValue(){return this.getLatest().__value}setValue(t){const e=this.getWritable();return e.__value=t,e}getChecked(){const t=this.getLatest();let e;const n=this.getParent();return dt$1(n)&&(e=n.getListType()),"check"===e?Boolean(t.__checked):void 0}setChecked(t){const e=this.getWritable();return e.__checked=t,e}toggleChecked(){const t=this.getWritable();return t.setChecked(!t.__checked)}getIndent(){const t=this.getParent();if(null===t||!this.isAttached())return this.getLatest().__indent;let e=t.getParentOrThrow(),n=0;for(;ot$2(e);)e=e.getParentOrThrow().getParentOrThrow(),n++;return n}setIndent(t){"number"!=typeof t&&K$3(117),(t=Math.floor(t))>=0||K$3(199);let e=this.getIndent();for(;e!==t;)e<t?(Y$1(this),e++):(Z$1(this),e--);return this}canInsertAfter(t){return ot$2(t)}canReplaceWith(t){return ot$2(t)}canMergeWith(t){return ot$2(t)||Ii(t)}extractWithChild(t,e){if(!yr(e))return false;const n=e.anchor.getNode(),r=e.focus.getNode();return this.isParentOf(n)&&this.isParentOf(r)&&this.getTextContent().length===e.getTextContent().length}isParentRequired(){return true}createParentElementNode(){return ht$3("bullet")}canMergeWhenEmpty(){return true}};function rt$1(t){if(t.classList.contains("task-list-item"))for(const e of t.children)if("INPUT"===e.tagName)return it$2(e);if(t.classList.contains("joplin-checkbox"))for(const e of t.children)if(e.classList.contains("checkbox-wrapper")&&e.children.length>0&&"INPUT"===e.children[0].tagName)return it$2(e.children[0]);const e=t.getAttribute("aria-checked");return {node:st$2("true"===e||"false"!==e&&void 0)}}function it$2(t){if(!("checkbox"===t.getAttribute("type")))return {node:null};return {node:st$2(t.hasAttribute("checked"))}}function st$2(t){return fs(new nt$2(void 0,t))}function ot$2(t){return t instanceof nt$2}let lt$2 = class lt extends Ci{__tag;__start;__listType;$config(){return this.config("list",{$transform:t=>{!function(t){const e=t.getNextSibling();dt$1(e)&&t.getListType()===e.getListType()&&X$2(t,e);}(t),Q$2(t);},extends:Ci,importDOM:wn({ol:()=>({conversion:gt$2,priority:0}),ul:()=>({conversion:gt$2,priority:0})})})}constructor(t="number",e=1,n){super(n);const r=ut$1[t]||t;this.__listType=r,this.__tag="number"===r?"ol":"ul",this.__start=e;}afterCloneFrom(t){super.afterCloneFrom(t),this.__listType=t.__listType,this.__tag=t.__tag,this.__start=t.__start;}getTag(){return this.getLatest().__tag}setListType(t){const e=this.getWritable();return e.__listType=t,e.__tag="number"===t?"ol":"ul",e}getListType(){return this.getLatest().__listType}getStart(){return this.getLatest().__start}setStart(t){const e=this.getWritable();return e.__start=t,e}createDOM(t,e){const n=this.__tag,r=document.createElement(n);return 1!==this.__start&&r.setAttribute("start",String(this.__start)),r.__lexicalListType=this.__listType,ct$2(r,t.theme,this),r}updateDOM(t,e,n){return t.__tag!==this.__tag||t.__listType!==this.__listType||(ct$2(e,n.theme,this),false)}updateFromJSON(t){return super.updateFromJSON(t).setListType(t.listType).setStart(t.start)}exportDOM(t){const e=this.createDOM(t._config,t);return Cs(e)&&(1!==this.__start&&e.setAttribute("start",String(this.__start)),"check"===this.__listType&&e.setAttribute("__lexicalListType","check")),{element:e}}exportJSON(){return {...super.exportJSON(),listType:this.getListType(),start:this.getStart(),tag:this.getTag()}}canBeEmpty(){return false}canIndent(){return false}splice(t,e,n){let r=n;for(let t=0;t<n.length;t++){const e=n[t];ot$2(e)||(r===n&&(r=[...n]),r[t]=st$2().append(!Si(e)||dt$1(e)||e.isInline()?e:sr(e.getTextContent())));}return super.splice(t,e,r)}extractWithChild(t){return ot$2(t)}};function ct$2(t,e,n){const s=[],o=[],l=e.list;if(void 0!==l){const t=l[`${n.__tag}Depth`]||[],e=W$4(n)-1,r=e%t.length,i=t[r],c=l[n.__tag];let a;const g=l.nested,u=l.checklist;if(void 0!==g&&g.list&&(a=g.list),void 0!==c&&s.push(c),void 0!==u&&"check"===n.__listType&&s.push(u),void 0!==i){s.push(...et$2(i));for(let e=0;e<t.length;e++)e!==r&&o.push(n.__tag+e);}if(void 0!==a){const t=et$2(a);e>1?s.push(...t):o.push(...t);}}o.length>0&&ut$2(t,...o),s.length>0&<$3(t,...s);}function at(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];if(ot$2(r)){e.push(r);const t=r.getChildren();t.length>1&&t.forEach(t=>{dt$1(t)&&e.push(V$3(t));});}else e.push(V$3(r));}return e}function gt$2(t){const e=t.nodeName.toLowerCase();let n=null;if("ol"===e){n=ht$3("number",t.start);}else "ul"===e&&(n=function(t){if("check"===t.getAttribute("__lexicallisttype")||t.classList.contains("contains-task-list")||"1"===t.getAttribute("data-is-checklist"))return true;for(const e of t.childNodes)if(Cs(e)&&e.hasAttribute("aria-checked"))return true;return false}(t)?ht$3("check"):ht$3("bullet"));return {after:at,node:n}}const ut$1={ol:"number",ul:"bullet"};function ht$3(t="number",e=1){return fs(new lt$2(t,e))}function dt$1(t){return t instanceof lt$2}const vt$2=re$1("UPDATE_LIST_START_COMMAND"),St$3=re$1("INSERT_UNORDERED_LIST_COMMAND"),xt$2=re$1("INSERT_ORDERED_LIST_COMMAND"),kt$3=re$1("REMOVE_LIST_COMMAND");function bt$3(t){return U$4(t.registerCommand(xt$2,()=>(j$1("number"),true),zi),t.registerCommand(vt$2,t=>{const{listNodeKey:e,newStart:n}=t,r=xo(e);return !!dt$1(r)&&("number"===r.getListType()&&(r.setStart(n),Q$2(r)),true)},zi),t.registerCommand(St$3,()=>(j$1("bullet"),true),zi),t.registerCommand(kt$3,()=>(G$2(),true),zi),t.registerCommand(ae$1,()=>tt$1(),zi),t.registerNodeTransform(nt$2,t=>{const e=t.getFirstChild();if(e){if(lr(e)){const n=e.getStyle(),r=e.getFormat();t.getTextStyle()!==n&&t.setTextStyle(n),t.getTextFormat()!==r&&t.setTextFormat(r);}}else {const e=Lr();yr(e)&&(e.style!==t.getTextStyle()||e.format!==t.getTextFormat())&&e.isCollapsed()&&t.is(e.anchor.getNode())&&t.setTextStyle(e.style).setTextFormat(e.format);}}),t.registerNodeTransform(Xn,t=>{const e=t.getParent();if(ot$2(e)&&t.is(e.getFirstChild())){const n=t.getStyle(),r=t.getFormat();n===e.getTextStyle()&&r===e.getTextFormat()||e.setTextStyle(n).setTextFormat(r);}}))}
|
|
1398
1432
|
|
|
1399
1433
|
/**
|
|
1400
1434
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -1404,7 +1438,7 @@ function h$3(e,n){const t=n.body?n.body.childNodes:[];let o=[];const l=[];for(le
|
|
|
1404
1438
|
*
|
|
1405
1439
|
*/
|
|
1406
1440
|
|
|
1407
|
-
function
|
|
1441
|
+
function m$1(e,n){const t=ao(n)?n.body.childNodes:n.childNodes;let l=[];const r=[];for(const n of t)if(!w$3.has(n.nodeName)){const t=y$2(n,e,r,false);null!==t&&(l=l.concat(t));}return function(e){for(const n of e)n.getNextSibling()instanceof Pi&&n.insertAfter(Jn());for(const n of e){const e=n.getChildren();for(const t of e)n.insertBefore(t);n.remove();}}(r),l}function g(e,n){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const t=document.createElement("div"),o=No().getChildren();for(let l=0;l<o.length;l++){x$2(e,o[l],t,n);}return t.innerHTML}function x$2(t,o,l,u=null){let f=null===u||o.isSelected(u);const a=Si(o)&&o.excludeFromCopy("html");let d=o;null!==u&&lr(o)&&(d=M$4(u,o,"clone"));const p=Si(d)?d.getChildren():[],h=Xi(t,d.getType());let m;m=h&&void 0!==h.exportDOM?h.exportDOM(t,d):d.exportDOM(t);const{element:g,after:w}=m;if(!g)return false;const y=document.createDocumentFragment();for(let e=0;e<p.length;e++){const n=p[e],l=x$2(t,n,y,u);!f&&Si(o)&&l&&o.extractWithChild(n,u,"html")&&(f=true);}if(f&&!a){if((Cs(g)||vs(g))&&g.append(y),l.append(g),w){const e=w.call(d,g);e&&(vs(g)?g.replaceChildren(e):g.replaceWith(e));}}else l.append(y);return f}const w$3=new Set(["STYLE","SCRIPT"]);function y$2(e,n,o,l,i=new Map,s){let c=[];if(w$3.has(e.nodeName))return c;let m=null;const g=function(e,n){const{nodeName:t}=e,o=n._htmlConversions.get(t.toLowerCase());let l=null;if(void 0!==o)for(const n of o){const t=n(e);null!==t&&(null===l||(l.priority||0)<=(t.priority||0))&&(l=t);}return null!==l?l.conversion:null}(e,n),x=g?g(e):null;let b=null;if(null!==x){b=x.after;const n=x.node;if(m=Array.isArray(n)?n[n.length-1]:n,null!==m){for(const[,e]of i)if(m=e(m,s),!m)break;m&&c.push(...Array.isArray(n)?n:[m]);}null!=x.forChild&&i.set(e.nodeName,x.forChild);}const S=e.childNodes;let v=[];const N=(null==m||!as(m))&&(null!=m&&Or(m)||l);for(let e=0;e<S.length;e++)v.push(...y$2(S[e],n,o,N,new Map(i),m));return null!=b&&(v=b(v)),Ts(e)&&(v=C$2(e,v,N?()=>{const e=new Pi;return o.push(e),e}:Li)),null==m?v.length>0?c=c.concat(v):Ts(e)&&function(e){if(null==e.nextSibling||null==e.previousSibling)return false;return ks(e.nextSibling)&&ks(e.previousSibling)}(e)&&(c=c.concat(Jn())):Si(m)&&m.append(...v),c}function C$2(e,n,t){const o=e.style.textAlign,l=[];let r=[];for(let e=0;e<n.length;e++){const i=n[e];if(Or(i))o&&!i.getFormat()&&i.setFormat(o),l.push(i);else if(r.push(i),e===n.length-1||e<n.length-1&&Or(n[e+1])){const e=t();e.setFormat(o),e.append(...r),l.push(e),r=[];}}return l}
|
|
1408
1442
|
|
|
1409
1443
|
/**
|
|
1410
1444
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -1414,7 +1448,17 @@ function y$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URL
|
|
|
1414
1448
|
*
|
|
1415
1449
|
*/
|
|
1416
1450
|
|
|
1417
|
-
function
|
|
1451
|
+
function v$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function D$2(e,n=Lr()){return null==n&&v$2(166),yr(n)&&n.isCollapsed()||0===n.getNodes().length?"":g(e,n)}function S$1(t,e=Lr()){return null==e&&v$2(166),yr(e)&&e.isCollapsed()||0===e.getNodes().length?null:JSON.stringify(E$3(t,e))}function R$2(t,n,o){const r=t.getData("application/x-lexical-editor");if(r)try{const t=JSON.parse(r);if(t.namespace===o._config.namespace&&Array.isArray(t.nodes)){return A$1(o,L$1(t.nodes),n)}}catch(t){console.error(t);}const c=t.getData("text/html"),a=t.getData("text/plain");if(c&&a!==c)try{const t=(new DOMParser).parseFromString(function(t){if(window.trustedTypes&&window.trustedTypes.createPolicy){return window.trustedTypes.createPolicy("lexical",{createHTML:t=>t}).createHTML(t)}return t}(c),"text/html");return A$1(o,m$1(o,t),n)}catch(t){console.error(t);}const u=a||t.getData("text/uri-list");if(null!=u)if(yr(n)){const t=u.split(/(\r?\n|\t)/);""===t[t.length-1]&&t.pop();for(let e=0;e<t.length;e++){const n=Lr();if(yr(n)){const o=t[e];"\n"===o||"\r\n"===o?n.insertParagraph():"\t"===o?n.insertNodes([ur()]):n.insertText(o);}}}else n.insertRawText(u);}function A$1(t,e,n){t.dispatchCommand(oe$1,{nodes:e,selection:n})||(n.insertNodes(e),function(t){if(yr(t)&&t.isCollapsed()){const e=t.anchor;let n=null;const o=xl(e,"previous");if(o)if(Ys(o))n=o.origin;else {const t=dl(o,il(No(),"next").getFlipped());for(const e of t){if(lr(e.origin)){n=e.origin;break}if(Si(e.origin)&&!e.origin.isInline())break}}if(n&&lr(n)){const e=n.getFormat(),o=n.getStyle();t.format===e&&t.style===o||(t.format=e,t.style=o,t.dirty=true);}}}(n));}function P$1(t,e,n,r=[]){let i=null===e||n.isSelected(e);const l=Si(n)&&n.excludeFromCopy("html");let s=n;null!==e&&lr(s)&&(s=M$4(e,s,"clone"));const c=Si(s)?s.getChildren():[],a=function(t){const e=t.exportJSON(),n=t.constructor;if(e.type!==n.getType()&&v$2(58,n.name),Si(t)){const t=e.children;Array.isArray(t)||v$2(59,n.name);}return e}(s);lr(s)&&0===s.getTextContentSize()&&(i=false);for(let o=0;o<c.length;o++){const r=c[o],l=P$1(t,e,r,a.children);!i&&Si(n)&&l&&n.extractWithChild(r,e,"clone")&&(i=true);}if(i&&!l)r.push(a);else if(Array.isArray(a.children))for(let t=0;t<a.children.length;t++){const e=a.children[t];r.push(e);}return i}function E$3(t,e){const n=[],o=No().getChildren();for(let r=0;r<o.length;r++){P$1(t,e,o[r],n);}return {namespace:t._config.namespace,nodes:n}}function L$1(t){const e=[];for(let o=0;o<t.length;o++){const r=t[o],i=ui(r);lr(i)&&$$3(i),e.push(i);}return e}let b$2=null;async function F$1(t,e,n){if(null!==b$2)return false;if(null!==e)return new Promise((o,r)=>{t.update(()=>{o(M$3(t,e,n));});});const o=t.getRootElement(),i=t._window||window,l=i.document,s=ps(i);if(null===o||null===s)return false;const c=l.createElement("span");c.style.cssText="position: fixed; top: -1000px;",c.append(l.createTextNode("#")),o.append(c);const a=new Range;return a.setStart(c,0),a.setEnd(c,1),s.removeAllRanges(),s.addRange(a),new Promise((e,o)=>{const s=t.registerCommand(Re$1,o=>(Lt$3(o,ClipboardEvent)&&(s(),null!==b$2&&(i.clearTimeout(b$2),b$2=null),e(M$3(t,o,n))),true),Wi);b$2=i.setTimeout(()=>{s(),b$2=null,e(false);},50),l.execCommand("copy"),c.remove();})}function M$3(t,e,n){if(void 0===n){const e=ps(t._window),o=Lr();if(!o||o.isCollapsed())return false;if(!e)return false;const r=e.anchorNode,l=e.focusNode;if(null!==r&&null!==l&&!eo(t,r,l))return false;n=_$1(o);}e.preventDefault();const o=e.clipboardData;return null!==o&&(J$2(o,n),true)}const O=[["text/html",D$2],["application/x-lexical-editor",S$1]];function _$1(t=Lr()){const e={"text/plain":t?t.getTextContent():""};if(t){const n=bs();for(const[o,r]of O){const i=r(n,t);null!==i&&(e[o]=i);}}return e}function J$2(t,e){for(const[n]of O) void 0===e[n]&&t.setData(n,"");for(const n in e){const o=e[n];void 0!==o&&t.setData(n,o);}}
|
|
1452
|
+
|
|
1453
|
+
/**
|
|
1454
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1455
|
+
*
|
|
1456
|
+
* This source code is licensed under the MIT license found in the
|
|
1457
|
+
* LICENSE file in the root directory of this source tree.
|
|
1458
|
+
*
|
|
1459
|
+
*/
|
|
1460
|
+
|
|
1461
|
+
function gt$1(t,e){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(t,e);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(t,e);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const pt$1="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,ht$2=pt$1&&"documentMode"in document?document.documentMode:null,vt$1=pt$1&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ct$2=!(!pt$1||!("InputEvent"in window)||ht$2)&&"getTargetRanges"in new window.InputEvent("input"),yt$1=pt$1&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xt$1=pt$1&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Dt$1=pt$1&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Nt$2=pt$1&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&vt$1&&!Dt$1,wt$2=re$1("DRAG_DROP_PASTE_FILE");let Et$2 = class Et extends Ci{static getType(){return "quote"}static clone(t){return new Et(t.__key)}createDOM(t){const e=document.createElement("blockquote");return lt$3(e,t.theme.quote),e}updateDOM(t,e){return false}static importDOM(){return {blockquote:t=>({conversion:Ft$1,priority:0})}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return _t$1().updateFromJSON(t)}insertNewAfter(t,e){const n=Li(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,e),n}collapseAtStart(){const t=Li();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}canMergeWhenEmpty(){return true}};function _t$1(){return fs(new Et$2)}function Ot$1(t){return t instanceof Et$2}let Pt$2 = class Pt extends Ci{__tag;static getType(){return "heading"}static clone(t){return new Pt(t.__tag,t.__key)}constructor(t,e){super(e),this.__tag=t;}getTag(){return this.__tag}setTag(t){const e=this.getWritable();return this.__tag=t,e}createDOM(t){const e=this.__tag,n=document.createElement(e),r=t.theme.heading;if(void 0!==r){const t=r[e];lt$3(n,t);}return n}updateDOM(t,e,n){return t.__tag!==this.__tag}static importDOM(){return {h1:t=>({conversion:At$2,priority:0}),h2:t=>({conversion:At$2,priority:0}),h3:t=>({conversion:At$2,priority:0}),h4:t=>({conversion:At$2,priority:0}),h5:t=>({conversion:At$2,priority:0}),h6:t=>({conversion:At$2,priority:0}),p:t=>{const e=t.firstChild;return null!==e&&Tt$2(e)?{conversion:()=>({node:null}),priority:3}:null},span:t=>Tt$2(t)?{conversion:t=>({node:St$2("h1")}),priority:3}:null}}exportDOM(t){const{element:e}=super.exportDOM(t);if(Cs(e)){this.isEmpty()&&e.append(document.createElement("br"));const t=this.getFormatType();t&&(e.style.textAlign=t);const n=this.getDirection();n&&(e.dir=n);}return {element:e}}static importJSON(t){return St$2(t.tag).updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setTag(t.tag)}exportJSON(){return {...super.exportJSON(),tag:this.getTag()}}insertNewAfter(t,e=true){const n=t?t.anchor.offset:0,r=this.getLastDescendant(),o=!r||t&&t.anchor.key===r.getKey()&&n===r.getTextContentSize()||!t?Li():St$2(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,e),0===n&&!this.isEmpty()&&t){const t=Li();t.select(),this.replace(t,true);}return o}collapseAtStart(){const t=this.isEmpty()?Li():St$2(this.getTag());return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}extractWithChild(){return true}};function Tt$2(t){return "span"===t.nodeName.toLowerCase()&&"26pt"===t.style.fontSize}function At$2(t){const e=t.nodeName.toLowerCase();let n=null;return "h1"!==e&&"h2"!==e&&"h3"!==e&&"h4"!==e&&"h5"!==e&&"h6"!==e||(n=St$2(e),null!==t.style&&(Ps(t,n),n.setFormat(t.style.textAlign))),{node:n}}function Ft$1(t){const e=_t$1();return null!==t.style&&(e.setFormat(t.style.textAlign),Ps(t,e)),{node:e}}function St$2(t="h1"){return fs(new Pt$2(t))}function It$1(t){return t instanceof Pt$2}function Mt$1(t){let e=null;if(Lt$3(t,DragEvent)?e=t.dataTransfer:Lt$3(t,ClipboardEvent)&&(e=t.clipboardData),null===e)return [false,[],false];const n=e.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return [r,Array.from(e.files),o]}function bt$2(t){const e=Lr();if(!yr(e))return false;const n=new Set,r=e.getNodes();for(let e=0;e<r.length;e++){const o=r[e],i=o.getKey();if(n.has(i))continue;const s=zs(o,t=>Si(t)&&!t.isInline());if(null===s)continue;const c=s.getKey();s.canIndent()&&!n.has(c)&&(n.add(c),t(s));}return n.size>0}function Kt(t){const e=vo(t);return Ti(e)}function kt$2(t){for(const e of ["lowercase","uppercase","capitalize"])t.hasFormat(e)&&t.toggleFormat(e);}function Jt(n){return U$4(n.registerCommand(se$1,t=>{const e=Lr();return !!xr(e)&&(e.clear(),true)},Ki),n.registerCommand(le$1,t=>{const e=Lr();return yr(e)?(e.deleteCharacter(t),true):!!xr(e)&&(e.deleteNodes(),true)},Ki),n.registerCommand(he$1,t=>{const e=Lr();return !!yr(e)&&(e.deleteWord(t),true)},Ki),n.registerCommand(ge$1,t=>{const e=Lr();return !!yr(e)&&(e.deleteLine(t),true)},Ki),n.registerCommand(ue$1,e=>{const r=Lr();if("string"==typeof e)null!==r&&r.insertText(e);else {if(null===r)return false;const o=e.dataTransfer;if(null!=o)R$2(o,r,n);else if(yr(r)){const t=e.data;return t&&r.insertText(t),true}}return true},Ki),n.registerCommand(de$1,()=>{const t=Lr();return !!yr(t)&&(t.removeText(),true)},Ki),n.registerCommand(_e$1,t=>{const e=Lr();return !!yr(e)&&(e.formatText(t),true)},Ki),n.registerCommand(Le$1,t=>{const e=Lr();if(!yr(e)&&!xr(e))return false;const n=e.getNodes();for(const e of n){const n=zs(e,t=>Si(t)&&!t.isInline());null!==n&&n.setFormat(t);}return true},Ki),n.registerCommand(ce$1,t=>{const e=Lr();return !!yr(e)&&(e.insertLineBreak(t),true)},Ki),n.registerCommand(ae$1,()=>{const t=Lr();return !!yr(t)&&(t.insertParagraph(),true)},Ki),n.registerCommand(Ae$1,()=>(jr([ur()]),true),Ki),n.registerCommand(Pe$1,()=>bt$2(t=>{const e=t.getIndent();t.setIndent(e+1);}),Ki),n.registerCommand(De$1,()=>bt$2(t=>{const e=t.getIndent();e>0&&t.setIndent(Math.max(0,e-1));}),Ki),n.registerCommand(ke$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectPrevious(),true}else if(yr(e)){const n=qo(e.focus,true);if(!t.shiftKey&&Ti(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),t.preventDefault(),true}return false},Ki),n.registerCommand(Te$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),n[0].selectNext(0,0),true}else if(yr(e)){if(function(t){const e=t.focus;return "root"===e.key&&e.offset===No().getChildrenSize()}(e))return t.preventDefault(),true;const n=qo(e.focus,false);if(!t.shiftKey&&Ti(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),t.preventDefault(),true}return false},Ki),n.registerCommand(Se$1,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$2(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),true}if(!yr(e))return false;if(Z$3(e,true)){const n=t.shiftKey;return t.preventDefault(),ne(e,n,true),true}return false},Ki),n.registerCommand(xe,t=>{const e=Lr();if(xr(e)){const n=e.getNodes();if(n.length>0)return t.preventDefault(),A$2(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),true}if(!yr(e))return false;const n=t.shiftKey;return !!Z$3(e,false)&&(t.preventDefault(),ne(e,n,false),true)},Ki),n.registerCommand(we$1,t=>{if(Kt(t.target))return false;const e=Lr();if(yr(e)){if(function(t){if(!t.isCollapsed())return false;const{anchor:e}=t;if(0!==e.offset)return false;const n=e.getNode();if(bi(n))return false;const r=xt$4(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(e))return t.preventDefault(),n.dispatchCommand(De$1,void 0);if(xt$1&&"ko-KR"===navigator.language)return false}else if(!xr(e))return false;return t.preventDefault(),n.dispatchCommand(le$1,true)},Ki),n.registerCommand(Oe$1,t=>{if(Kt(t.target))return false;const e=Lr();return !(!yr(e)&&!xr(e))&&(t.preventDefault(),n.dispatchCommand(le$1,false))},Ki),n.registerCommand(Ne$1,t=>{const e=Lr();if(!yr(e))return false;if(kt$2(e),null!==t){if((xt$1||yt$1||Nt$2)&&Ct$2)return false;if(t.preventDefault(),t.shiftKey)return n.dispatchCommand(ce$1,false)}return n.dispatchCommand(ae$1,void 0)},Ki),n.registerCommand(Ee$1,()=>{const t=Lr();return !!yr(t)&&(n.blur(),true)},Ki),n.registerCommand(Fe$1,t=>{const[,e]=Mt$1(t);if(e.length>0){const r=gt$1(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=vo(o);if(null!==i){const e=Ar();if(lr(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else {const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element");}const n=St$5(e);wo(n);}n.dispatchCommand(wt$2,e);}return t.preventDefault(),true}const r=Lr();return !!yr(r)},Ki),n.registerCommand(Ie$1,t=>{const[e]=Mt$1(t),n=Lr();return !(e&&!yr(n))},Ki),n.registerCommand(Ke$1,t=>{const[e]=Mt$1(t),n=Lr();if(e&&!yr(n))return false;const r=gt$1(t.clientX,t.clientY);if(null!==r){const e=vo(r.node);Ti(e)&&t.preventDefault();}return true},Ki),n.registerCommand(We$1,()=>(jo(),true),Ki),n.registerCommand(Re$1,t=>(F$1(n,Lt$3(t,ClipboardEvent)?t:null),true),Ki),n.registerCommand(Be$1,t=>(async function(t,n){await F$1(n,Lt$3(t,ClipboardEvent)?t:null),n.update(()=>{const t=Lr();yr(t)?t.removeText():xr(t)&&t.getNodes().forEach(t=>t.remove());});}(t,n),true),Ki),n.registerCommand(fe$1,e=>{const[,r,o]=Mt$1(e);if(r.length>0&&!o)return n.dispatchCommand(wt$2,r),true;if(Ss(e.target)&&to(e.target))return false;return null!==Lr()&&(function(e,n){e.preventDefault(),n.update(()=>{const r=Lr(),o=Lt$3(e,InputEvent)||Lt$3(e,KeyboardEvent)?null:e.clipboardData;null!=o&&null!==r&&R$2(o,r,n);},{tag:Fn});}(e,n),true)},Ki),n.registerCommand(be$1,t=>{const e=Lr();return yr(e)&&kt$2(e),false},Ki),n.registerCommand(Me$1,t=>{const e=Lr();return yr(e)&&kt$2(e),false},Ki))}
|
|
1418
1462
|
|
|
1419
1463
|
/* **********************************************
|
|
1420
1464
|
Begin prism-core.js
|
|
@@ -5059,7 +5103,7 @@ Prism.languages.swift['string-literal'].forEach(function (rule) {
|
|
|
5059
5103
|
*
|
|
5060
5104
|
*/
|
|
5061
5105
|
|
|
5062
|
-
function D$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M$3=globalThis.Prism||window.Prism,z$2=t=>{try{return !!t&&M$3.languages.hasOwnProperty(t)}catch(t){return false}};function J$2(e,n){for(const r of e.childNodes){if(fo(r)&&r.tagName===n)return true;J$2(r,n);}return false}const E$2="data-language",F$1="data-highlight-language";let K$1 = class K extends fi{static getType(){return "code"}static clone(t){return new K(t.__language,t.__key)}constructor(t,e){super(e),this.__language=t||void 0,this.__isSyntaxHighlightSupported=z$2(t);}createDOM(t){const n=document.createElement("code");rt$2(n,t.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();return r&&(n.setAttribute(E$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(F$1,r)),n}updateDOM(t,e,n){const r=this.__language,o=t.__language;return r?r!==o&&(e.setAttribute(E$2,r),this.__isSyntaxHighlightSupported&&e.setAttribute(F$1,r)):o&&(e.removeAttribute(E$2),t.__isSyntaxHighlightSupported&&e.removeAttribute(F$1)),false}exportDOM(t){const n=document.createElement("pre");rt$2(n,t._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();return r&&(n.setAttribute(E$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(F$1,r)),{element:n}}static importDOM(){return {code:t=>null!=t.textContent&&(/\r?\n/.test(t.textContent)||J$2(t,"BR"))?{conversion:q$1,priority:1}:null,div:()=>({conversion:U$2,priority:1}),pre:()=>({conversion:q$1,priority:0}),table:t=>X$1(t)?{conversion:W$1,priority:3}:null,td:t=>{const e=t,n=e.closest("table");return e.classList.contains("js-file-line")||n&&X$1(n)?{conversion:$$1,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&X$1(e)?{conversion:$$1,priority:3}:null}}}static importJSON(t){return R$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language)}exportJSON(){return {...super.exportJSON(),language:this.getLanguage()}}insertNewAfter(t,e=true){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const t=Pi();return this.insertAfter(t,e),t}const{anchor:o,focus:i}=t,g=(o.isBefore(i)?o:i).getNode();if(Qn(g)){let t=ut(g);const e=[];for(;;)if(nr(t))e.push(er()),t=t.getNextSibling();else {if(!st$1(t))break;{let n=0;const r=t.getTextContent(),o=t.getTextContentSize();for(;n<o&&" "===r[n];)n++;if(0!==n&&e.push(it$1(" ".repeat(n))),n!==o)break;t=t.getNextSibling();}}const n=g.splitText(o.offset)[0],r=0===o.offset?0:1,i=n.getIndexWithinParent()+r,s=g.getParentOrThrow(),l=[Pn(),...e];s.splice(i,0,l);const p=e[e.length-1];p?p.select():0===o.offset?n.selectPrevious():n.getNextSibling().selectNext(0,0);}if(I$1(g)){const{offset:e}=t.anchor;g.splice(e,0,[Pn()]),g.select(e+1,e+1);}return null}canIndent(){return false}collapseAtStart(){const t=Pi();return this.getChildren().forEach((e=>t.append(e))),this.replace(t),true}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e.__isSyntaxHighlightSupported=z$2(t),e}getLanguage(){return this.getLatest().__language}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}};function R$1(t){return no(new K$1(t))}function I$1(t){return t instanceof K$1}function q$1(t){return {node:R$1(t.getAttribute(E$2))}}function U$2(t){const e=t,n=Q$1(e);return n||function(t){let e=t.parentElement;for(;null!==e;){if(Q$1(e))return true;e=e.parentElement;}return false}(e)?{node:n?R$1():null}:{node:null}}function W$1(){return {node:R$1()}}function $$1(){return {node:null}}function Q$1(t){return null!==t.style.fontFamily.match("monospace")}function X$1(t){return t.classList.contains("js-file-line-container")}const G$1="javascript",V$1={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},Y$1={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function Z$1(t){return Y$1[t]||t}class rt extends Jn{constructor(t="",e,n){super(t,n),this.__highlightType=e;}static getType(){return "code-highlight"}static clone(t){return new rt(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return false}createDOM(t){const n=super.createDOM(t),r=ot$1(t.theme,this.__highlightType);return rt$2(n,r),n}updateDOM(t,r,o){const i=super.updateDOM(t,r,o),s=ot$1(o.theme,t.__highlightType),l=ot$1(o.theme,this.__highlightType);return s!==l&&(s&&it$3(r,s),l&&rt$2(r,l)),i}static importJSON(t){return it$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return {...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return true}createParentElementNode(){return R$1()}}function ot$1(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function it$1(t="",e){return no(new rt(t,e))}function st$1(t){return t instanceof rt}function lt$1(t,e){let n=t;for(let o=Jo(t,e);o&&(st$1(o.origin)||nr(o.origin));o=ct$2(o))n=o.origin;return n}function ut(t){return lt$1(t,"previous")}function ct$1(t){return lt$1(t,"next")}const at={defaultLanguage:G$1,tokenize(t,e){return M$3.tokenize(t,M$3.languages[e||""]||M$3.languages[this.defaultLanguage])}};function gt$1(t,e){let n=null,r=null,o=t,i=e,s=t.getTextContent();for(;;){if(0===i){if(o=o.getPreviousSibling(),null===o)break;if(st$1(o)||nr(o)||Fn(o)||D$1(167),Fn(o)){n={node:o,offset:1};break}i=Math.max(0,o.getTextContentSize()-1),s=o.getTextContent();}else i--;const t=s[i];st$1(o)&&" "!==t&&(r={node:o,offset:i});}if(null!==r)return r;let l=null;if(e<t.getTextContentSize())st$1(t)&&(l=t.getTextContent()[e]);else {const e=t.getNextSibling();st$1(e)&&(l=e.getTextContent()[0]);}if(null!==l&&" "!==l)return n;{const r=function(t,e){let n=t,r=e,o=t.getTextContent(),i=t.getTextContentSize();for(;;){if(!st$1(n)||r===i){if(n=n.getNextSibling(),null===n||Fn(n))return null;st$1(n)&&(r=0,o=n.getTextContent(),i=n.getTextContentSize());}if(st$1(n)){if(" "!==o[r])return {node:n,offset:r};r++;}}}(t,e);return null!==r?r:n}}function pt$1(t){const e=ct$1(t);return Fn(e)&&D$1(168),e}function ft(t,e,n){const r=t.getParent();I$1(r)?mt$1(r,e,n):st$1(t)&&t.replace(Xn(t.__text));}function ht$1(t,e){const n=e.getElementByKey(t.getKey());if(null===n)return;const r=t.getChildren(),o=r.length;if(o===n.__cachedChildrenLength)return;n.__cachedChildrenLength=o;let i="1",s=1;for(let t=0;t<o;t++)Fn(r[t])&&(i+="\n"+ ++s);n.setAttribute("data-gutter",i);}const dt$1=new Set;function mt$1(t,e,n){const r=t.getKey();dt$1.has(r)||(dt$1.add(r),void 0===t.getLanguage()&&t.setLanguage(n.defaultLanguage),e.update((()=>{!function(t,e){const n=us(t);if(!I$1(n)||!n.isAttached())return;const r=Nr();if(!cr(r))return void e();const o=r.anchor,i=o.offset,s="element"===o.type&&Fn(n.getChildAtIndex(o.offset-1));let u=0;if(!s){const t=o.getNode();u=i+t.getPreviousSiblings().reduce(((t,e)=>t+e.getTextContentSize()),0);}if(!e())return;if(s)return void o.getNode().select(i,i);n.getChildren().some((t=>{const e=Qn(t);if(e||Fn(t)){const n=t.getTextContentSize();if(e&&n>=u)return t.select(u,u),true;u-=n;}return false}));}(r,(()=>{const e=us(r);if(!I$1(e)||!e.isAttached())return false;const o=e.getTextContent(),i=xt$1(n.tokenize(o,e.getLanguage()||n.defaultLanguage)),s=function(t,e){let n=0;for(;n<t.length&&yt$1(t[n],e[n]);)n++;const r=t.length,o=e.length,i=Math.min(r,o)-n;let s=0;for(;s<i;)if(s++,!yt$1(t[r-s],e[o-s])){s--;break}const l=n,u=r-s,c=e.slice(n,o-s);return {from:l,nodesForReplacement:c,to:u}}(e.getChildren(),i),{from:l,to:u,nodesForReplacement:c}=s;return !(l===u&&!c.length)&&(t.splice(l,u-l,c),true)}));}),{onUpdate:()=>{dt$1.delete(r);},skipTransforms:true}));}function xt$1(t,e){const n=[];for(const r of t)if("string"==typeof r){const t=r.split(/(\n|\t)/),o=t.length;for(let r=0;r<o;r++){const o=t[r];"\n"===o||"\r\n"===o?n.push(Pn()):"\t"===o?n.push(er()):o.length>0&&n.push(it$1(o,e));}}else {const{content:t}=r;"string"==typeof t?n.push(...xt$1([t],r.type)):Array.isArray(t)&&n.push(...xt$1(t,r.type));}return n}function yt$1(t,e){return st$1(t)&&st$1(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||nr(t)&&nr(e)||Fn(t)&&Fn(e)}function St$1(t){if(!cr(t))return false;const e=t.anchor.getNode(),n=I$1(e)?e:e.getParent(),r=t.focus.getNode(),o=I$1(r)?r:r.getParent();return I$1(n)&&n.is(o)}function _t$1(t){const e=t.getNodes(),n=[];if(1===e.length&&I$1(e[0]))return n;let r=[];for(let t=0;t<e.length;t++){const o=e[t];st$1(o)||nr(o)||Fn(o)||D$1(169),Fn(o)?r.length>0&&(n.push(r),r=[]):r.push(o);}if(r.length>0){const e=t.isBackward()?t.anchor:t.focus,o=ir(r[0].getKey(),0,"text");e.is(o)||n.push(r);}return n}function vt$1(t){const e=Nr();if(!cr(e)||!St$1(e))return false;const n=_t$1(e),r=n.length;if(0===r&&e.isCollapsed())return t===Le$1&&e.insertNodes([er()]),true;if(0===r&&t===Le$1&&"\n"===e.getTextContent()){const t=er(),n=Pn(),r=e.isBackward()?"previous":"next";return e.insertNodes([t,n]),al(xl(tl(Uo(t,"next",0),pl(Jo(n,"next"))),r)),true}for(let o=0;o<r;o++){const r=n[o];if(r.length>0){let n=r[0];if(0===o&&(n=ut(n)),t===Le$1){const t=er();if(n.insertBefore(t),0===o){const r=e.isBackward()?"focus":"anchor",o=ir(n.getKey(),0,"text");e[r].is(o)&&e[r].set(t.getKey(),0,"text");}}else nr(n)&&n.remove();}}return true}function Tt$1(t,e){const n=Nr();if(!cr(n))return false;const{anchor:r,focus:o}=n,i=r.offset,s=o.offset,l=r.getNode(),c=o.getNode(),a=t===Ne$1;if(!St$1(n)||!st$1(l)&&!nr(l)||!st$1(c)&&!nr(c))return false;if(!e.altKey){if(n.isCollapsed()){const t=l.getParentOrThrow();if(a&&0===i&&null===l.getPreviousSibling()){if(null===t.getPreviousSibling())return t.selectPrevious(),e.preventDefault(),true}else if(!a&&i===l.getTextContentSize()&&null===l.getNextSibling()){if(null===t.getNextSibling())return t.selectNext(),e.preventDefault(),true}}return false}let g,p;if(l.isBefore(c)?(g=ut(l),p=ct$1(c)):(g=ut(c),p=ct$1(l)),null==g||null==p)return false;const f=g.getNodesBetween(p);for(let t=0;t<f.length;t++){const e=f[t];if(!st$1(e)&&!nr(e)&&!Fn(e))return false}e.preventDefault(),e.stopPropagation();const d=a?g.getPreviousSibling():p.getNextSibling();if(!Fn(d))return true;const m=a?d.getPreviousSibling():d.getNextSibling();if(null==m)return true;const S=st$1(m)||nr(m)||Fn(m)?a?ut(m):ct$1(m):null;let _=null!=S?S:m;return d.remove(),f.forEach((t=>t.remove())),t===Ne$1?(f.forEach((t=>_.insertBefore(t))),_.insertBefore(d)):(_.insertAfter(d),_=d,f.forEach((t=>{_.insertAfter(t),_=t;}))),n.setTextNodeRange(l,i,c,s),true}function Ct(t,e){const n=Nr();if(!cr(n))return false;const{anchor:r,focus:o}=n,i=r.getNode(),s=o.getNode(),l=t===be$1;if(!St$1(n)||!st$1(i)&&!nr(i)||!st$1(s)&&!nr(s))return false;if(l){const t=gt$1(s,o.offset);if(null!==t){const{node:e,offset:r}=t;Fn(e)?e.selectNext(0,0):n.setTextNodeRange(e,r,e,r);}else s.getParentOrThrow().selectStart();}else {pt$1(s).select();}return e.preventDefault(),e.stopPropagation(),true}function Nt$1(t,e){if(!t.hasNodes([K$1,rt]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==e&&(e=at);const n=[];return true!==t._headless&&n.push(t.registerMutationListener(K$1,(e=>{t.update((()=>{for(const[n,r]of e)if("destroyed"!==r){const e=us(n);null!==e&&ht$1(e,t);}}));}),{skipInitialization:false})),n.push(t.registerNodeTransform(K$1,(n=>mt$1(n,t,e))),t.registerNodeTransform(Jn,(n=>ft(n,t,e))),t.registerNodeTransform(rt,(n=>ft(n,t,e))),t.registerCommand(Pe$1,(e=>{const n=function(t){const e=Nr();if(!cr(e)||!St$1(e))return null;const n=t?Ie$1:Le$1,r=t?Ie$1:Fe$1,o=e.anchor,i=e.focus;if(o.is(i))return r;const s=_t$1(e);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&D$1(285),e.isBackward()?(u=i,c=o):(u=o,c=i);const a=ut(l[0]),g=ct$1(l[0]),p=ir(a.getKey(),0,"text"),f=ir(g.getKey(),g.getTextContentSize(),"text");return u.isBefore(p)||f.isBefore(c)?n:p.isBefore(u)||c.isBefore(f)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),true)}),Ii),t.registerCommand(Fe$1,(()=>!!St$1(Nr())&&(Fr([er()]),true)),Ii),t.registerCommand(Le$1,(t=>vt$1(Le$1)),Ii),t.registerCommand(Ie$1,(t=>vt$1(Ie$1)),Ii),t.registerCommand(Ne$1,(t=>{const e=Nr();if(!cr(e))return false;const{anchor:n}=e,r=n.getNode();return !!St$1(e)&&(e.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&I$1(r.getParentOrThrow())?(t.preventDefault(),true):Tt$1(Ne$1,t))}),Ii),t.registerCommand(we$1,(t=>{const e=Nr();if(!cr(e))return false;const{anchor:n}=e,r=n.getNode();return !!St$1(e)&&(e.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&I$1(r.getParentOrThrow())?(t.preventDefault(),true):Tt$1(we$1,t))}),Ii),t.registerCommand(be$1,(t=>Ct(be$1,t)),Ii),t.registerCommand(ke$1,(t=>Ct(ke$1,t)),Ii)),j$3(...n)}
|
|
5106
|
+
function I$2(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const M$2="javascript";function R$1(e,n){for(const r of e.childNodes){if(Cs(r)&&r.tagName===n)return true;R$1(r,n);}return false}const K$2="data-language",$$1="data-highlight-language",W$3="data-theme";let q$1 = class q extends Ci{__language;__theme;__isSyntaxHighlightSupported;static getType(){return "code"}static clone(t){return new q(t.__language,t.__key)}constructor(t,e){super(e),this.__language=t||void 0,this.__isSyntaxHighlightSupported=false,this.__theme=void 0;}afterCloneFrom(t){super.afterCloneFrom(t),this.__language=t.__language,this.__theme=t.__theme,this.__isSyntaxHighlightSupported=t.__isSyntaxHighlightSupported;}createDOM(t){const n=document.createElement("code");lt$3(n,t.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(K$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute($$1,r));const i=this.getTheme();i&&n.setAttribute(W$3,i);const o=this.getStyle();return o&&n.setAttribute("style",o),n}updateDOM(t,e,n){const r=this.__language,i=t.__language;r?r!==i&&e.setAttribute(K$2,r):i&&e.removeAttribute(K$2);const o=this.__isSyntaxHighlightSupported;t.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&e.setAttribute($$1,r):e.removeAttribute($$1):o&&r&&e.setAttribute($$1,r);const s=this.__theme,l=t.__theme;s?s!==l&&e.setAttribute(W$3,s):l&&e.removeAttribute(W$3);const u=this.__style,c=t.__style;return u?u!==c&&e.setAttribute("style",u):c&&e.removeAttribute("style"),false}exportDOM(t){const n=document.createElement("pre");lt$3(n,t._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(K$2,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute($$1,r));const i=this.getTheme();i&&n.setAttribute(W$3,i);const o=this.getStyle();return o&&n.setAttribute("style",o),{element:n}}static importDOM(){return {code:t=>null!=t.textContent&&(/\r?\n/.test(t.textContent)||R$1(t,"BR"))?{conversion:Q$1,priority:1}:null,div:()=>({conversion:G$1,priority:1}),pre:()=>({conversion:Q$1,priority:0}),table:t=>tt(t)?{conversion:V$2,priority:3}:null,td:t=>{const e=t,n=e.closest("table");return e.classList.contains("js-file-line")||n&&tt(n)?{conversion:Y,priority:3}:null},tr:t=>{const e=t.closest("table");return e&&tt(e)?{conversion:Y,priority:3}:null}}}static importJSON(t){return U$2().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setLanguage(t.language).setTheme(t.theme)}exportJSON(){return {...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(t,e=true){const n=this.getChildren(),r=n.length;if(r>=2&&"\n"===n[r-1].getTextContent()&&"\n"===n[r-2].getTextContent()&&t.isCollapsed()&&t.anchor.key===this.__key&&t.anchor.offset===r){n[r-1].remove(),n[r-2].remove();const t=Li();return this.insertAfter(t,e),t}const{anchor:i,focus:o}=t,a=(i.isBefore(o)?i:o).getNode();if(lr(a)){let t=st$1(a);const e=[];for(;;)if(fr(t))e.push(ur()),t=t.getNextSibling();else {if(!it$1(t))break;{let n=0;const r=t.getTextContent(),i=t.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&e.push(rt(" ".repeat(n))),n!==i)break;t=t.getNextSibling();}}const n=a.splitText(i.offset)[0],r=0===i.offset?0:1,o=n.getIndexWithinParent()+r,s=a.getParentOrThrow(),l=[Jn(),...e];s.splice(o,0,l);const f=e[e.length-1];f?f.select():0===i.offset?n.selectPrevious():n.getNextSibling().selectNext(0,0);}if(X$1(a)){const{offset:e}=t.anchor;a.splice(e,0,[Jn()]),a.select(e+1,e+1);}return null}canIndent(){return false}collapseAtStart(){const t=Li();return this.getChildren().forEach(e=>t.append(e)),this.replace(t),true}setLanguage(t){const e=this.getWritable();return e.__language=t||void 0,e}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(t){const e=this.getWritable();return e.__isSyntaxHighlightSupported=t,e}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(t){const e=this.getWritable();return e.__theme=t||void 0,e}getTheme(){return this.getLatest().__theme}};function U$2(t,e){return Ks(q$1).setLanguage(t).setTheme(e)}function X$1(t){return t instanceof q$1}function Q$1(t){return {node:U$2(t.getAttribute(K$2))}}function G$1(t){const e=t,n=Z(e);return n||function(t){let e=t.parentElement;for(;null!==e;){if(Z(e))return true;e=e.parentElement;}return false}(e)?{node:n?U$2():null}:{node:null}}function V$2(){return {node:U$2()}}function Y(){return {node:null}}function Z(t){return null!==t.style.fontFamily.match("monospace")}function tt(t){return t.classList.contains("js-file-line-container")}let et$1 = class et extends Xn{__highlightType;constructor(t="",e,n){super(t,n),this.__highlightType=e;}static getType(){return "code-highlight"}static clone(t){return new et(t.__text,t.__highlightType||void 0,t.__key)}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(t){const e=this.getWritable();return e.__highlightType=t||void 0,e}canHaveFormat(){return false}createDOM(t){const n=super.createDOM(t),r=nt$1(t.theme,this.__highlightType);return lt$3(n,r),n}updateDOM(t,r,i){const o=super.updateDOM(t,r,i),s=nt$1(i.theme,t.__highlightType),l=nt$1(i.theme,this.__highlightType);return s!==l&&(s&&ut$2(r,s),l&<$3(r,l)),o}static importJSON(t){return rt().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setHighlightType(t.highlightType)}exportJSON(){return {...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(t){return this}isParentRequired(){return true}createParentElementNode(){return U$2()}};function nt$1(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function rt(t="",e){return fs(new et$1(t,e))}function it$1(t){return t instanceof et$1}function ot$1(t,e){let n=t;for(let i=tl(t,e);i&&(it$1(i.origin)||fr(i.origin));i=ft$1(i))n=i.origin;return n}function st$1(t){return ot$1(t,"previous")}function lt$1(t){return ot$1(t,"next")}function ut(t){const e=st$1(t),n=lt$1(t);let r=e;for(;null!==r;){if(it$1(r)){const t=oo(r.getTextContent());if(null!==t)return t}if(r===n)break;r=r.getNextSibling();}const i=e.getParent();if(Si(i)){const t=i.getDirection();if("ltr"===t||"rtl"===t)return t}return null}function ct$1(t,e){let n=null,r=null,i=t,o=e,s=t.getTextContent();for(;;){if(0===o){if(i=i.getPreviousSibling(),null===i)break;if(it$1(i)||fr(i)||jn(i)||I$2(167),jn(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent();}else o--;const t=s[o];it$1(i)&&" "!==t&&(r={node:i,offset:o});}if(null!==r)return r;let l=null;if(e<t.getTextContentSize())it$1(t)&&(l=t.getTextContent()[e]);else {const e=t.getNextSibling();it$1(e)&&(l=e.getTextContent()[0]);}if(null!==l&&" "!==l)return n;{const r=function(t,e){let n=t,r=e,i=t.getTextContent(),o=t.getTextContentSize();for(;;){if(!it$1(n)||r===o){if(n=n.getNextSibling(),null===n||jn(n))return null;it$1(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize());}if(it$1(n)){if(" "!==i[r])return {node:n,offset:r};r++;}}}(t,e);return null!==r?r:n}}function gt(t){const e=lt$1(t);return jn(e)&&I$2(168),e}!function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var e={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(e).forEach(function(n){var r=e[n],i=[];/^\w+$/.test(n)||i.push(/\w+/.exec(n)[0]),"diff"===n&&i.push("bold"),t.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:i,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:true},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}};}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:e});}(Prism);const ft=globalThis.Prism||window.Prism,pt={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",powershell:"PowerShell",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},ht$1={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function dt(t){return ht$1[t]||t}function St$1(t){return "string"==typeof t?t:Array.isArray(t)?t.map(St$1).join(""):St$1(t.content)}function vt(t,e){const n=/^diff-([\w-]+)/i.exec(e),r=t.getTextContent();let i=ft.tokenize(r,ft.languages[n?"diff":e]);return n&&(i=function(t,e){const n=e,r=ft.languages[n],i={tokens:t},o=ft.languages.diff.PREFIXES;for(const t of i.tokens){if("string"==typeof t||!(t.type in o)||!Array.isArray(t.content))continue;const e=t.type;let n=0;const i=()=>(n++,new ft.Token("prefix",o[e],e.replace(/^(\w+).*/,"$1"))),s=t.content.filter(t=>"string"==typeof t||"prefix"!==t.type),l=t.content.length-s.length,u=ft.tokenize(St$1(s),r);u.unshift(i());const c=/\r\n|\n/g,g=t=>{const e=[];c.lastIndex=0;let r,o=0;for(;n<l&&(r=c.exec(t));){const n=r.index+r[0].length;e.push(t.slice(o,n)),o=n,e.push(i());}if(0!==e.length)return o<t.length&&e.push(t.slice(o)),e},a=t=>{for(let e=0;e<t.length&&n<l;e++){const n=t[e];if("string"==typeof n){const r=g(n);r&&(t.splice(e,1,...r),e+=r.length-1);}else if("string"==typeof n.content){const t=g(n.content);t&&(n.content=t);}else Array.isArray(n.content)?a(n.content):a([n.content]);}};a(u),n<l&&u.push(i()),t.content=u;}return i.tokens}(i,n[1])),Tt$1(i)}function Tt$1(t,e){const n=[];for(const r of t)if("string"==typeof r){const t=r.split(/(\n|\t)/),i=t.length;for(let r=0;r<i;r++){const i=t[r];"\n"===i||"\r\n"===i?n.push(Jn()):"\t"===i?n.push(ur()):i.length>0&&n.push(rt(i,e));}}else {const{content:t,alias:e}=r;"string"==typeof t?n.push(...Tt$1([t],"prefix"===r.type&&"string"==typeof e?e:r.type)):Array.isArray(t)&&n.push(...Tt$1(t,"unchanged"===r.type?void 0:r.type));}return n}const bt$1={$tokenize(t,e){return vt(t,e||this.defaultLanguage)},defaultLanguage:M$2,tokenize(t,e){return ft.tokenize(t,ft.languages[e||""]||ft.languages[this.defaultLanguage])}};function Ct$1(t,e,n){const r=t.getParent();X$1(r)?wt$1(r,e,n):it$1(t)&&t.replace(sr(t.__text));}function Nt$1(t,e){const n=e.getElementByKey(t.getKey());if(null===n)return;const r=t.getChildren(),i=r.length;if(i===n.__cachedChildrenLength)return;n.__cachedChildrenLength=i;let o="1",s=1;for(let t=0;t<i;t++)jn(r[t])&&(o+="\n"+ ++s);n.setAttribute("data-gutter",o);}const jt$1=new Set;function wt$1(t,e,n){const r=t.getKey();void 0===t.getLanguage()&&t.setLanguage(n.defaultLanguage);const i=t.getLanguage()||n.defaultLanguage;if(!function(t){const e=function(t){const e=/^diff-([\w-]+)/i.exec(t);return e?e[1]:null}(t),n=e||t;try{return !!n&&ft.languages.hasOwnProperty(n)}catch(t){return false}}(i))return t.getIsSyntaxHighlightSupported()&&t.setIsSyntaxHighlightSupported(false),void async function(){}();t.getIsSyntaxHighlightSupported()||t.setIsSyntaxHighlightSupported(true),jt$1.has(r)||(jt$1.add(r),e.update(()=>{!function(t,e){const n=xo(t);if(!X$1(n)||!n.isAttached())return;const r=Lr();if(!yr(r))return void e();const i=r.anchor,o=i.offset,s="element"===i.type&&jn(n.getChildAtIndex(i.offset-1));let u=0;if(!s){const t=i.getNode();u=o+t.getPreviousSiblings().reduce((t,e)=>t+e.getTextContentSize(),0);}if(!e())return;if(s)return void i.getNode().select(o,o);n.getChildren().some(t=>{const e=lr(t);if(e||jn(t)){const n=t.getTextContentSize();if(e&&n>=u)return t.select(u,u),true;u-=n;}return false});}(r,()=>{const e=xo(r);if(!X$1(e)||!e.isAttached())return false;const i=e.getLanguage()||n.defaultLanguage,o=n.$tokenize(e,i),s=function(t,e){let n=0;for(;n<t.length&&kt$1(t[n],e[n]);)n++;const r=t.length,i=e.length,o=Math.min(r,i)-n;let s=0;for(;s<o;)if(s++,!kt$1(t[r-s],e[i-s])){s--;break}const l=n,u=r-s,c=e.slice(n,i-s);return {from:l,nodesForReplacement:c,to:u}}(e.getChildren(),o),{from:l,to:u,nodesForReplacement:c}=s;return !(l===u&&!c.length)&&(t.splice(l,u-l,c),true)});},{onUpdate:()=>{jt$1.delete(r);},skipTransforms:true}));}function kt$1(t,e){return it$1(t)&&it$1(e)&&t.__text===e.__text&&t.__highlightType===e.__highlightType||fr(t)&&fr(e)||jn(t)&&jn(e)}function At$1(t){if(!yr(t))return false;const e=t.anchor.getNode(),n=X$1(e)?e:e.getParent(),r=t.focus.getNode(),i=X$1(r)?r:r.getParent();return X$1(n)&&n.is(i)}function Pt$1(t){const e=t.getNodes(),n=[];if(1===e.length&&X$1(e[0]))return n;let r=[];for(let t=0;t<e.length;t++){const i=e[t];it$1(i)||fr(i)||jn(i)||I$2(169),jn(i)?r.length>0&&(n.push(r),r=[]):r.push(i);}if(r.length>0){const e=t.isBackward()?t.anchor:t.focus,i=hr(r[0].getKey(),0,"text");e.is(i)||n.push(r);}return n}function Lt$1(t){const e=Lr();if(!yr(e)||!At$1(e))return false;const n=Pt$1(e),r=n.length;if(0===r&&e.isCollapsed())return t===Pe$1&&e.insertNodes([ur()]),true;if(0===r&&t===Pe$1&&"\n"===e.getTextContent()){const t=ur(),n=Jn(),r=e.isBackward()?"previous":"next";return e.insertNodes([t,n]),Sl(Al(dl(el(t,"next",0),El(tl(n,"next"))),r)),true}for(let i=0;i<r;i++){const r=n[i];if(r.length>0){let n=r[0];if(0===i&&(n=st$1(n)),t===Pe$1){const t=ur();if(n.insertBefore(t),0===i){const r=e.isBackward()?"focus":"anchor",i=hr(n.getKey(),0,"text");e[r].is(i)&&e[r].set(t.getKey(),0,"text");}}else fr(n)&&n.remove();}}return true}function Ot(t,e){const n=Lr();if(!yr(n))return false;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),c=i.getNode(),g=t===ke$1;if(!At$1(n)||!it$1(l)&&!fr(l)||!it$1(c)&&!fr(c))return false;if(!e.altKey){if(n.isCollapsed()){const t=l.getParentOrThrow();if(g&&0===o&&null===l.getPreviousSibling()){if(null===t.getPreviousSibling())return t.selectPrevious(),e.preventDefault(),true}else if(!g&&o===l.getTextContentSize()&&null===l.getNextSibling()){if(null===t.getNextSibling())return t.selectNext(),e.preventDefault(),true}}return false}let a,f;if(l.isBefore(c)?(a=st$1(l),f=lt$1(c)):(a=st$1(c),f=lt$1(l)),null==a||null==f)return false;const p=a.getNodesBetween(f);for(let t=0;t<p.length;t++){const e=p[t];if(!it$1(e)&&!fr(e)&&!jn(e))return false}e.preventDefault(),e.stopPropagation();const h=g?a.getPreviousSibling():f.getNextSibling();if(!jn(h))return true;const d=g?h.getPreviousSibling():h.getNextSibling();if(null==d)return true;const m=it$1(d)||fr(d)||jn(d)?g?st$1(d):lt$1(d):null;let x=null!=m?m:d;return h.remove(),p.forEach(t=>t.remove()),t===ke$1?(p.forEach(t=>x.insertBefore(t)),x.insertBefore(h)):(x.insertAfter(h),x=h,p.forEach(t=>{x.insertAfter(t),x=t;})),n.setTextNodeRange(l,o,c,s),true}function Ht(t,e){const n=Lr();if(!yr(n))return false;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=t===ve$1;if(!At$1(n)||!it$1(o)&&!fr(o)||!it$1(s)&&!fr(s))return false;const c=s;if("rtl"===ut(c)?!l:l){const t=ct$1(c,i.offset);if(null!==t){const{node:e,offset:r}=t;jn(e)?e.selectNext(0,0):n.setTextNodeRange(e,r,e,r);}else c.getParentOrThrow().selectStart();}else {gt(c).select();}return e.preventDefault(),e.stopPropagation(),true}function Et$1(t,e){if(!t.hasNodes([q$1,et$1]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==e&&(e=bt$1);const n=[];return true!==t._headless&&n.push(t.registerMutationListener(q$1,e=>{t.getEditorState().read(()=>{for(const[n,r]of e)if("destroyed"!==r){const e=xo(n);null!==e&&Nt$1(e,t);}});},{skipInitialization:false})),n.push(t.registerNodeTransform(q$1,n=>wt$1(n,t,e)),t.registerNodeTransform(Xn,n=>Ct$1(n,t,e)),t.registerNodeTransform(et$1,n=>Ct$1(n,t,e)),t.registerCommand(Me$1,e=>{const n=function(t){const e=Lr();if(!yr(e)||!At$1(e))return null;const n=t?De$1:Pe$1,r=t?De$1:Ae$1,i=e.anchor,o=e.focus;if(i.is(o))return r;const s=Pt$1(e);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&I$2(285),e.isBackward()?(u=o,c=i):(u=i,c=o);const g=st$1(l[0]),a=lt$1(l[0]),f=hr(g.getKey(),0,"text"),p=hr(a.getKey(),a.getTextContentSize(),"text");return u.isBefore(f)||p.isBefore(c)?n:f.isBefore(u)||c.isBefore(p)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),true)},zi),t.registerCommand(Ae$1,()=>!!At$1(Lr())&&(jr([ur()]),true),zi),t.registerCommand(Pe$1,t=>Lt$1(Pe$1),zi),t.registerCommand(De$1,t=>Lt$1(De$1),zi),t.registerCommand(ke$1,t=>{const e=Lr();if(!yr(e))return false;const{anchor:n}=e,r=n.getNode();return !!At$1(e)&&(e.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&X$1(r.getParentOrThrow())?(t.preventDefault(),true):Ot(ke$1,t))},zi),t.registerCommand(Te$1,t=>{const e=Lr();if(!yr(e))return false;const{anchor:n}=e,r=n.getNode();return !!At$1(e)&&(e.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&X$1(r.getParentOrThrow())?(t.preventDefault(),true):Ot(Te$1,t))},zi),t.registerCommand(ve$1,t=>Ht(ve$1,t),zi),t.registerCommand(Ce$1,t=>Ht(Ce$1,t),zi)),U$4(...n)}
|
|
5063
5107
|
|
|
5064
5108
|
/**
|
|
5065
5109
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5069,12 +5113,12 @@ function D$1(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URL
|
|
|
5069
5113
|
*
|
|
5070
5114
|
*/
|
|
5071
5115
|
|
|
5072
|
-
const
|
|
5116
|
+
const R=new Set(["http:","https:","mailto:","sms:","tel:"]);let y$1 = class y extends Ci{__url;__target;__rel;__title;static getType(){return "link"}static clone(t){return new y(t.__url,{rel:t.__rel,target:t.__target,title:t.__title},t.__key)}constructor(t="",e={},n){super(n);const{target:r=null,rel:i=null,title:l=null}=e;this.__url=t,this.__target=r,this.__rel=i,this.__title=l;}createDOM(e){const n=document.createElement("a");return this.updateLinkDOM(null,n,e),lt$3(n,e.theme.link),n}updateLinkDOM(t,n,r){if(xs(n)){t&&t.__url===this.__url||(n.href=this.sanitizeUrl(this.__url));for(const e of ["target","rel","title"]){const r=`__${e}`,i=this[r];t&&t[r]===i||(i?n[e]=i:n.removeAttribute(e));}}}updateDOM(t,e,n){return this.updateLinkDOM(t,e,n),false}static importDOM(){return {a:t=>({conversion:N$1,priority:1})}}static importJSON(t){return D$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setURL(t.url).setRel(t.rel||null).setTarget(t.target||null).setTitle(t.title||null)}sanitizeUrl(t){t=W$2(t);try{const e=new URL(W$2(t));if(!R.has(e.protocol))return "about:blank"}catch(e){return t}return t}exportJSON(){return {...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),url:this.getURL()}}getURL(){return this.getLatest().__url}setURL(t){const e=this.getWritable();return e.__url=t,e}getTarget(){return this.getLatest().__target}setTarget(t){const e=this.getWritable();return e.__target=t,e}getRel(){return this.getLatest().__rel}setRel(t){const e=this.getWritable();return e.__rel=t,e}getTitle(){return this.getLatest().__title}setTitle(t){const e=this.getWritable();return e.__title=t,e}insertNewAfter(t,e=true){const n=D$1(this.__url,{rel:this.__rel,target:this.__target,title:this.__title});return this.insertAfter(n,e),n}canInsertTextBefore(){return false}canInsertTextAfter(){return false}canBeEmpty(){return false}isInline(){return true}extractWithChild(t,e,n){if(!yr(e))return false;const r=e.anchor.getNode(),i=e.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&e.getTextContent().length>0}isEmailURI(){return this.__url.startsWith("mailto:")}isWebSiteURI(){return this.__url.startsWith("https://")||this.__url.startsWith("http://")}};function N$1(t){let n=null;if(xs(t)){const e=t.textContent;(null!==e&&""!==e||t.children.length>0)&&(n=D$1(t.getAttribute("href")||"",{rel:t.getAttribute("rel"),target:t.getAttribute("target"),title:t.getAttribute("title")}));}return {node:n}}function D$1(t="",e){return fs(new y$1(t,e))}function w$2(t){return t instanceof y$1}class A extends y$1{__isUnlinked;constructor(t="",e={},n){super(t,e,n),this.__isUnlinked=void 0!==e.isUnlinked&&null!==e.isUnlinked&&e.isUnlinked;}static getType(){return "autolink"}static clone(t){return new A(t.__url,{isUnlinked:t.__isUnlinked,rel:t.__rel,target:t.__target,title:t.__title},t.__key)}getIsUnlinked(){return this.__isUnlinked}setIsUnlinked(t){const e=this.getWritable();return e.__isUnlinked=t,e}createDOM(t){return this.__isUnlinked?document.createElement("span"):super.createDOM(t)}updateDOM(t,e,n){return super.updateDOM(t,e,n)||t.__isUnlinked!==this.__isUnlinked}static importJSON(t){return I$1().updateFromJSON(t)}updateFromJSON(t){return super.updateFromJSON(t).setIsUnlinked(t.isUnlinked||false)}static importDOM(){return null}exportJSON(){return {...super.exportJSON(),isUnlinked:this.__isUnlinked}}insertNewAfter(t,e=true){const n=this.getParentOrThrow().insertNewAfter(t,e);if(Si(n)){const t=I$1(this.__url,{isUnlinked:this.__isUnlinked,rel:this.__rel,target:this.__target,title:this.__title});return n.append(t),t}return null}}function I$1(t="",e){return fs(new A(t,e))}function E$2(t){return t instanceof A}function M$1(t,e){if("element"===t.type){const n=t.getNode();Si(n)||function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(252);return n.getChildren()[t.offset+e]||null}return null}function J$1(t,e={}){let r;if(t&&"object"==typeof t){const{url:n,...i}=t;r=n,e={...i,...e};}else r=t;const{target:i,title:l}=e,s=void 0===e.rel?"noreferrer":e.rel,u=Lr();if(null===u||!yr(u)&&!xr(u))return;if(xr(u)){const t=u.getNodes();if(0===t.length)return;return void t.forEach(t=>{if(null===r){const e=zs(t,t=>!E$2(t)&&w$2(t));e&&(e.insertBefore(t),0===e.getChildren().length&&e.remove());}else {const e=zs(t,t=>!E$2(t)&&w$2(t));if(e)e.setURL(r),void 0!==i&&e.setTarget(i),void 0!==s&&e.setRel(s);else {const e=D$1(r,{rel:s,target:i});t.insertBefore(e),e.append(t);}}})}const h=u.extract();if(null===r){const t=new Set;return void h.forEach(e=>{const n=e.getParent();if(w$2(n)&&!E$2(n)){const e=n.getKey();if(t.has(e))return;!function(t,e){const n=new Set(e.filter(e=>t.isParentOf(e)).map(t=>t.getKey())),r=t.getChildren(),i=r.filter(t=>n.has(t.getKey()));if(i.length===r.length)return r.forEach(e=>t.insertBefore(e)),void t.remove();const l=r.findIndex(t=>n.has(t.getKey())),s=r.findLastIndex(t=>n.has(t.getKey())),o=0===l,u=s===r.length-1;if(o)i.forEach(e=>t.insertBefore(e));else if(u)for(let e=i.length-1;e>=0;e--)t.insertAfter(i[e]);else {for(let e=i.length-1;e>=0;e--)t.insertAfter(i[e]);const e=r.slice(s+1);if(e.length>0){const n=D$1(t.getURL(),{rel:t.getRel(),target:t.getTarget(),title:t.getTitle()});i[i.length-1].insertAfter(n),e.forEach(t=>n.append(t));}}}(n,h),t.add(e);}})}const p=new Set,_=t=>{p.has(t.getKey())||(p.add(t.getKey()),t.setURL(r),void 0!==i&&t.setTarget(i),void 0!==s&&t.setRel(s),void 0!==l&&t.setTitle(l));};if(1===h.length){const t=h[0],e=zs(t,w$2);if(null!==e)return _(e)}!function(t){const e=Lr();if(!yr(e))return t();const n=St$5(e),r=n.isBackward(),i=M$1(n.anchor,r?-1:0),l=M$1(n.focus,r?0:-1);t();if(i||l){const t=Lr();if(yr(t)){const e=t.clone();if(i){const t=i.getParent();t&&e.anchor.set(t.getKey(),i.getIndexWithinParent()+(r?1:0),"element");}if(l){const t=l.getParent();t&&e.focus.set(t.getKey(),l.getIndexWithinParent()+(r?0:1),"element");}wo(St$5(e));}}}(()=>{let t=null;for(const e of h){if(!e.isAttached())continue;const o=zs(e,w$2);if(o){_(o);continue}if(Si(e)){if(!e.isInline())continue;if(w$2(e)){if(!(E$2(e)||null!==t&&t.getParentOrThrow().isParentOf(e))){_(e),t=e;continue}for(const t of e.getChildren())e.insertBefore(t);e.remove();continue}}const u=e.getPreviousSibling();w$2(u)&&u.is(t)?u.append(e):(t=D$1(r,{rel:s,target:i,title:l}),e.insertAfter(t),t.append(e));}});}const K$1=/^\+?[0-9\s()-]{5,}$/;function W$2(t){return t.match(/^[a-z][a-z0-9+.-]*:/i)||t.match(/^[/#.]/)?t:t.includes("@")?`mailto:${t}`:K$1.test(t)?`tel:${t}`:`https://${t}`}
|
|
5073
5117
|
|
|
5074
5118
|
function getNearestListItemNode(node) {
|
|
5075
5119
|
let current = node;
|
|
5076
5120
|
while (current !== null) {
|
|
5077
|
-
if (
|
|
5121
|
+
if (ot$2(current)) return current
|
|
5078
5122
|
current = current.getParent();
|
|
5079
5123
|
}
|
|
5080
5124
|
return null
|
|
@@ -5083,7 +5127,7 @@ function getNearestListItemNode(node) {
|
|
|
5083
5127
|
function getListType(node) {
|
|
5084
5128
|
let current = node;
|
|
5085
5129
|
while (current) {
|
|
5086
|
-
if (
|
|
5130
|
+
if (dt$1(current)) {
|
|
5087
5131
|
return current.getListType()
|
|
5088
5132
|
}
|
|
5089
5133
|
current = current.getParent();
|
|
@@ -5232,8 +5276,8 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
5232
5276
|
}
|
|
5233
5277
|
|
|
5234
5278
|
#updateButtonStates() {
|
|
5235
|
-
const selection =
|
|
5236
|
-
if (!
|
|
5279
|
+
const selection = Lr();
|
|
5280
|
+
if (!yr(selection)) return
|
|
5237
5281
|
|
|
5238
5282
|
const anchorNode = selection.anchor.getNode();
|
|
5239
5283
|
if (!anchorNode.getParent()) { return }
|
|
@@ -5243,11 +5287,11 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
5243
5287
|
const isBold = selection.hasFormat("bold");
|
|
5244
5288
|
const isItalic = selection.hasFormat("italic");
|
|
5245
5289
|
const isStrikethrough = selection.hasFormat("strikethrough");
|
|
5246
|
-
const isInCode =
|
|
5290
|
+
const isInCode = X$1(topLevelElement) || selection.hasFormat("code");
|
|
5247
5291
|
const isInList = this.#isInList(anchorNode);
|
|
5248
5292
|
const listType = getListType(anchorNode);
|
|
5249
|
-
const isInQuote =
|
|
5250
|
-
const isInHeading =
|
|
5293
|
+
const isInQuote = Ot$1(topLevelElement);
|
|
5294
|
+
const isInHeading = It$1(topLevelElement);
|
|
5251
5295
|
const isInLink = this.#isInLink(anchorNode);
|
|
5252
5296
|
|
|
5253
5297
|
this.#setButtonPressed("bold", isBold);
|
|
@@ -5266,7 +5310,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
5266
5310
|
#isInList(node) {
|
|
5267
5311
|
let current = node;
|
|
5268
5312
|
while (current) {
|
|
5269
|
-
if (
|
|
5313
|
+
if (dt$1(current) || ot$2(current)) return true
|
|
5270
5314
|
current = current.getParent();
|
|
5271
5315
|
}
|
|
5272
5316
|
return false
|
|
@@ -5275,7 +5319,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
5275
5319
|
#isInLink(node) {
|
|
5276
5320
|
let current = node;
|
|
5277
5321
|
while (current) {
|
|
5278
|
-
if (
|
|
5322
|
+
if (w$2(current)) return true
|
|
5279
5323
|
current = current.getParent();
|
|
5280
5324
|
}
|
|
5281
5325
|
return false
|
|
@@ -5421,7 +5465,7 @@ customElements.define("lexxy-toolbar", LexicalToolbarElement);
|
|
|
5421
5465
|
*
|
|
5422
5466
|
*/
|
|
5423
5467
|
|
|
5424
|
-
function
|
|
5468
|
+
function z$1(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o):n[t]=[o]);}return n}function U$1(t){const e=z$1(t,t=>t.type);return {element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const W$1=/[!-/:-@[-`{-~\s]/;function V$1(t){return lr(t)&&!t.hasFormat("code")}function et(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const nt=/^(\s*)(\d{1,})\.\s/,ot=/^(\s*)[-*+]\s/,it=/^(#{1,6})\s/,st=/^>\s/,lt=/^[ \t]*```([\w-]+)?/,ct=/[ \t]*```$/,mt=ot$4("mdListMarker",{parse:t=>"string"==typeof t&&/^[-*+]$/.test(t)?t:"-"}),ht=t=>(e,n,o,r)=>{const i=t(o);i.append(...n),e.replace(i),r||i.select(0,0);};const xt=t=>(e,n,o,r)=>{const i=e.getPreviousSibling(),s=e.getNextSibling(),l=st$2("check"===t?"x"===o[3]:void 0),c=o[0].trim()[0],f="bullet"!==t&&"check"!==t||c!==mt.parse(c)?void 0:c;if(dt$1(s)&&s.getListType()===t){f&&ct$4(s,mt,f);const t=s.getFirstChild();null!==t?t.insertBefore(l):s.append(l),e.remove();}else if(dt$1(i)&&i.getListType()===t)f&&ct$4(i,mt,f),i.append(l),e.remove();else {const n=ht$3(t,"number"===t?Number(o[2]):void 0);f&&ct$4(n,mt,f),n.append(l),e.replace(n);}l.append(...n),r||l.select(0,0);const a=function(t){const e=t.match(/\t/g),n=t.match(/ /g);let o=0;return e&&(o+=e.length),n&&(o+=Math.floor(n.length/4)),o}(o[1]);a&&l.setIndent(a);},Tt=(t,e,n)=>{const o=[],r=t.getChildren();let i=0;for(const s of r)if(ot$2(s)){if(1===s.getChildrenSize()){const t=s.getFirstChild();if(dt$1(t)){o.push(Tt(t,e,n+1));continue}}const r=" ".repeat(4*n),l=t.getListType(),c=st$4(t,mt),f="number"===l?`${t.getStart()+i}. `:"check"===l?`${c} [${s.getChecked()?"x":" "}] `:c+" ";o.push(r+f+e(s)),i++;}return o.join("\n")},Et={dependencies:[Pt$2],export:(t,e)=>{if(!It$1(t))return null;const n=Number(t.getTag().slice(1));return "#".repeat(n)+" "+e(t)},regExp:it,replace:ht(t=>{const e="h"+t[1].length;return St$2(e)}),type:"element"},Ct={dependencies:[Et$2],export:(t,e)=>{if(!Ot$1(t))return null;const n=e(t).split("\n"),o=[];for(const t of n)o.push("> "+t);return o.join("\n")},regExp:st,replace:(t,e,n,o)=>{if(o){const n=t.getPreviousSibling();if(Ot$1(n))return n.splice(n.getChildrenSize(),0,[Jn(),...e]),void t.remove()}const r=_t$1();r.append(...e),t.replace(r),o||r.select(0,0);},type:"element"},yt={dependencies:[q$1],export:t=>{if(!X$1(t))return null;const e=t.getTextContent();return "```"+(t.getLanguage()||"")+(e?"\n"+e:"")+"\n```"},regExpEnd:{optional:true,regExp:ct},regExpStart:lt,replace:(t,e,n,o,r,i)=>{let s,c;if(!e&&r){if(1===r.length)o?(s=U$2(),c=n[1]+r[0]):(s=U$2(n[1]),c=r[0].startsWith(" ")?r[0].slice(1):r[0]);else {if(s=U$2(n[1]),0===r[0].trim().length)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();c=r.join("\n");}const e=sr(c);s.append(e),t.append(s);}else e&&ht(t=>U$2(t?t[1]:void 0))(t,e,n,i);},type:"multiline-element"},$t={dependencies:[lt$2,nt$2],export:(t,e)=>dt$1(t)?Tt(t,e,0):null,regExp:ot,replace:xt("bullet"),type:"element"},St={dependencies:[lt$2,nt$2],export:(t,e)=>dt$1(t)?Tt(t,e,0):null,regExp:nt,replace:xt("number"),type:"element"},bt={format:["code"],tag:"`",type:"text-format"},Ft={format:["highlight"],tag:"==",type:"text-format"},It={format:["bold","italic"],tag:"***",type:"text-format"},wt={format:["bold","italic"],intraword:false,tag:"___",type:"text-format"},Nt={format:["bold"],tag:"**",type:"text-format"},kt={format:["bold"],intraword:false,tag:"__",type:"text-format"},Rt={format:["strikethrough"],tag:"~~",type:"text-format"},Lt={format:["italic"],tag:"*",type:"text-format"},_t={format:["italic"],intraword:false,tag:"_",type:"text-format"},Pt={dependencies:[y$1],export:(t,e,n)=>{if(!w$2(t)||E$2(t))return null;const o=t.getTitle(),r=e(t);return o?`[${r}](${t.getURL()} "${o}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{const[,n,o,r]=e,i=D$1(o,{title:r}),s=n.split("[").length-1,c=n.split("]").length-1;let f=n,a="";if(s<c)return;if(s>c){const t=n.split("[");a="["+t[0],f=t.slice(1).join("[");}const u=sr(f);return u.setFormat(t.getFormat()),i.append(u),t.replace(i),a&&i.insertBefore(sr(a)),u},trigger:")",type:"text-match"},Bt=[Et,Ct,$t,St],Mt=[yt],jt=[bt,It,wt,Nt,kt,Ft,Lt,_t,Rt],At=[Pt],zt=[...Bt,...Mt,...jt,...At];function Ut(t,e,n){const o=n.length;for(let r=e;r>=o;r--){const e=r-o;if(Wt(t,e,n,0,o)&&" "!==t[e+o])return e}return -1}function Wt(t,e,n,o,r){for(let i=0;i<r;i++)if(t[e+i]!==n[o+i])return false;return true}function Dt(t,n=zt){const o=U$1(n),r=z$1(o.textFormat,({tag:t})=>t[t.length-1]),l=z$1(o.textMatch,({trigger:t})=>t);for(const e of n){const n=e.type;if("element"===n||"text-match"===n||"multiline-element"===n){const n=e.dependencies;for(const e of n)t.hasNode(e)||et(173,e.getType());}}const c=(t,n,c)=>{(function(t,e,n,o){const r=t.getParent();if(!as(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExp:r,replace:s}of o){const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,false))return i.remove(),true}}return false})(t,n,c,o.element)||function(t,e,n,o){const r=t.getParent();if(!as(r)||t.getFirstChild()!==e)return false;const i=e.getTextContent();if(" "!==i[n-1])return false;for(const{regExpStart:r,replace:s,regExpEnd:l}of o){if(l&&!("optional"in l)||l&&"optional"in l&&!l.optional)continue;const o=i.match(r);if(o&&o[0].length===(o[0].endsWith(" ")?n:n-1)){const r=e.getNextSiblings(),[i,l]=e.splitText(n);if(false!==s(t,l?[l,...r]:r,o,null,null,false))return i.remove(),true}}return false}(t,n,c,o.multilineElement)||function(t,e,n){let o=t.getTextContent();const r=n[o[e-1]];if(null==r)return false;e<o.length&&(o=o.slice(0,e));for(const e of r){if(!e.replace||!e.regExp)continue;const n=o.match(e.regExp);if(null===n)continue;const r=n.index||0,i=r+n[0].length;let s;return 0===r?[s]=t.splitText(i):[,s]=t.splitText(r,i),s.selectNext(0,0),e.replace(s,n),true}return false}(n,c,l)||function(t,n,o){const r=t.getTextContent(),l=n-1,c=r[l],f=o[c];if(!f)return false;for(const n of f){const{tag:o}=n,f=o.length,a=l-f+1;if(f>1&&!Wt(r,a,o,0,f))continue;if(" "===r[a-1])continue;const u=r[l+1];if(false===n.intraword&&u&&!W$1.test(u))continue;const g=t;let p=g,d=Ut(r,a,o),h=p;for(;d<0&&(h=h.getPreviousSibling())&&!jn(h);)if(lr(h)){if(h.hasFormat("code"))continue;const t=h.getTextContent();p=h,d=Ut(t,t.length,o);}if(d<0)continue;if(p===g&&d+f===a)continue;const E=p.getTextContent();if(d>0&&E[d-1]===c)continue;const C=E[d-1];if(false===n.intraword&&C&&!W$1.test(C))continue;const y=g.getTextContent(),$=y.slice(0,a)+y.slice(l+1);g.setTextContent($);const v=p===g?$:E;p.setTextContent(v.slice(0,d)+v.slice(d+f));const S=Lr(),b=Ar();wo(b);const F=l-f*(p===g?2:1)+1;b.anchor.set(p.__key,d,"text"),b.focus.set(g.__key,F,"text");for(const t of n.format)b.hasFormat(t)||b.formatText(t);b.anchor.set(b.focus.key,b.focus.offset,b.focus.type);for(const t of n.format)b.hasFormat(t)&&b.toggleFormat(t);return yr(S)&&(b.format=S.format),true}}(n,c,r);};return t.registerUpdateListener(({tags:n,dirtyLeaves:o,editorState:r,prevEditorState:i})=>{if(n.has(Ln)||n.has(An))return;if(t.isComposing())return;const l=r.read(Lr),f=i.read(Lr);if(!yr(f)||!yr(l)||!l.isCollapsed()||l.is(f))return;const a=l.anchor.key,u=l.anchor.offset,g=r._nodeMap.get(a);!lr(g)||!o.has(a)||1!==u&&u>f.anchor.offset+1||t.update(()=>{if(!V$1(g))return;const t=g.getParent();null===t||X$1(t)||c(t,g,l.anchor.offset);});})}
|
|
5425
5469
|
|
|
5426
5470
|
/**
|
|
5427
5471
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -5431,7 +5475,7 @@ function M$2(t,e){const n={};for(const o of t){const t=e(o);t&&(n[t]?n[t].push(o
|
|
|
5431
5475
|
*
|
|
5432
5476
|
*/
|
|
5433
5477
|
|
|
5434
|
-
|
|
5478
|
+
function x$1(t,e,n,r,o){if(null===t||0===n.size&&0===r.size&&!o)return 0;const i=e._selection,a=t._selection;if(o)return 1;if(!(yr(i)&&yr(a)&&a.isCollapsed()&&i.isCollapsed()))return 0;const s=function(t,e,n){const r=t._nodeMap,o=[];for(const t of e){const e=r.get(t);void 0!==e&&o.push(e);}for(const[t,e]of n){if(!e)continue;const n=r.get(t);void 0===n||bi(n)||o.push(n);}return o}(e,n,r);if(0===s.length)return 0;if(s.length>1){const n=e._nodeMap,r=n.get(i.anchor.key),o=n.get(a.anchor.key);return r&&o&&!t._nodeMap.has(r.__key)&&lr(r)&&1===r.__text.length&&1===i.anchor.offset?2:0}const c=s[0],d=t._nodeMap.get(c.__key);if(!lr(d)||!lr(c)||d.__mode!==c.__mode)return 0;const u=d.__text,l=c.__text;if(u===l)return 0;const f=i.anchor,p=a.anchor;if(f.key!==p.key||"text"!==f.type)return 0;const h=f.offset,m=p.offset,y=l.length-u.length;return 1===y&&m===h-1?2:-1===y&&m===h+1?3:-1===y&&m===h?4:0}function C$1(t,e){let n=Date.now(),r=0;return (o,i,a,s,c,d)=>{const u=Date.now();if(d.has(An))return r=0,n=u,2;const l=x$1(o,i,s,c,t.isComposing()),f=(()=>{const f=null===a||a.editor===t,p=d.has(Pn);if(!p&&f&&d.has(Dn))return 0;if(null===o)return 1;const h=i._selection;if(!(s.size>0||c.size>0))return null!==h?0:2;const m="number"==typeof e?e:e.peek();if(false===p&&0!==l&&l===r&&u<n+m&&f)return 0;if(1===s.size){if(function(t,e,n){const r=e._nodeMap.get(t),o=n._nodeMap.get(t),i=e._selection,a=n._selection;return !(yr(i)&&yr(a)&&"element"===i.anchor.type&&"element"===i.focus.type&&"text"===a.anchor.type&&"text"===a.focus.type||!lr(r)||!lr(o)||r.__parent!==o.__parent)&&JSON.stringify(e.read(()=>r.exportJSON()))===JSON.stringify(n.read(()=>o.exportJSON()))}(Array.from(s)[0],o,i))return 0}return 1})();return n=u,r=l,f}}function v$1(t){t.undoStack=[],t.redoStack=[],t.current=null;}function b$1(t,e,n){const r=C$1(t,n),i=U$4(t.registerCommand(pe$1,()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==r.length){const o=e.current,i=r.pop();null!==o&&(n.push(o),t.dispatchCommand($e$1,true)),0===r.length&&t.dispatchCommand(Ue$1,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:An});}}(t,e),true),Ki),t.registerCommand(ye$1,()=>(function(t,e){const n=e.redoStack,r=e.undoStack;if(0!==n.length){const o=e.current;null!==o&&(r.push(o),t.dispatchCommand(Ue$1,true));const i=n.pop();0===n.length&&t.dispatchCommand($e$1,false),e.current=i||null,i&&i.editor.setEditorState(i.editorState,{tag:An});}}(t,e),true),Ki),t.registerCommand(Je$1,()=>(v$1(e),false),Ki),t.registerCommand(je$1,()=>(v$1(e),t.dispatchCommand($e$1,false),t.dispatchCommand(Ue$1,false),true),Ki),t.registerUpdateListener(({editorState:n,prevEditorState:o,dirtyLeaves:i,dirtyElements:a,tags:s})=>{const c=e.current,d=e.redoStack,u=e.undoStack,l=null===c?null:c.editorState;if(null!==c&&n===l)return;const f=r(o,n,c,i,a,s);if(1===f)0!==d.length&&(e.redoStack=[],t.dispatchCommand($e$1,false)),null!==c&&(u.push({...c}),t.dispatchCommand(Ue$1,true));else if(2===f)return;e.current={editor:t,editorState:n};}));return i}function w$1(){return {current:null,redoStack:[],undoStack:[]}}const E$1=Kl({build:(e,{delay:n,createInitialHistoryState:r,disabled:o})=>at$1({delay:n,disabled:o,historyState:r(e)}),config:Bl({createInitialHistoryState:w$1,delay:300,disabled:"undefined"==typeof window}),name:"@lexical/history/History",register:(t,n,r)=>{const o=r.getOutput();return dt$2(()=>o.disabled.value?void 0:b$1(t,o.historyState.value,o.delay))}});Kl({dependencies:[zl(E$1,{createInitialHistoryState:()=>{throw new Error("SharedHistory did not inherit parent history")},disabled:true})],name:"@lexical/history/SharedHistory",register(t,o,i){const{output:a}=i.getDependency(E$1),s=function(t){return t?Gt(t,E$1.name):null}(t._parentEditor);if(!s)return ()=>{};const c=s.output;return dt$2(()=>F$2(()=>{a.delay.value=c.delay.value,a.historyState.value=c.historyState.value,a.disabled.value=c.disabled.value;}))}});
|
|
5435
5479
|
|
|
5436
5480
|
var theme = {
|
|
5437
5481
|
text: {
|
|
@@ -5566,7 +5610,7 @@ function bytesToHumanSize(bytes) {
|
|
|
5566
5610
|
return `${ value.toFixed(2) } ${ sizes[i] }`
|
|
5567
5611
|
}
|
|
5568
5612
|
|
|
5569
|
-
class ActionTextAttachmentNode extends
|
|
5613
|
+
class ActionTextAttachmentNode extends ki {
|
|
5570
5614
|
static getType() {
|
|
5571
5615
|
return "action_text_attachment"
|
|
5572
5616
|
}
|
|
@@ -5935,7 +5979,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
|
|
|
5935
5979
|
const src = this.blobUrlTemplate
|
|
5936
5980
|
.replace(":signed_id", blob.signed_id)
|
|
5937
5981
|
.replace(":filename", encodeURIComponent(blob.filename));
|
|
5938
|
-
const latest =
|
|
5982
|
+
const latest = xo(this.getKey());
|
|
5939
5983
|
if (latest) {
|
|
5940
5984
|
latest.replace(new ActionTextAttachmentNode({
|
|
5941
5985
|
sgid: blob.attachable_sgid,
|
|
@@ -5949,7 +5993,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
|
|
|
5949
5993
|
height: image?.naturalHeight
|
|
5950
5994
|
}));
|
|
5951
5995
|
}
|
|
5952
|
-
}, { tag:
|
|
5996
|
+
}, { tag: Dn });
|
|
5953
5997
|
}
|
|
5954
5998
|
|
|
5955
5999
|
async #loadFigurePreviewFromBlob(blob, figure) {
|
|
@@ -5970,7 +6014,7 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
|
|
|
5970
6014
|
}
|
|
5971
6015
|
}
|
|
5972
6016
|
|
|
5973
|
-
class HorizontalDividerNode extends
|
|
6017
|
+
class HorizontalDividerNode extends ki {
|
|
5974
6018
|
static getType() {
|
|
5975
6019
|
return "horizontal_divider"
|
|
5976
6020
|
}
|
|
@@ -6076,15 +6120,15 @@ class CommandDispatcher {
|
|
|
6076
6120
|
}
|
|
6077
6121
|
|
|
6078
6122
|
dispatchBold() {
|
|
6079
|
-
this.editor.dispatchCommand(
|
|
6123
|
+
this.editor.dispatchCommand(_e$1, "bold");
|
|
6080
6124
|
}
|
|
6081
6125
|
|
|
6082
6126
|
dispatchItalic() {
|
|
6083
|
-
this.editor.dispatchCommand(
|
|
6127
|
+
this.editor.dispatchCommand(_e$1, "italic");
|
|
6084
6128
|
}
|
|
6085
6129
|
|
|
6086
6130
|
dispatchStrikethrough() {
|
|
6087
|
-
this.editor.dispatchCommand(
|
|
6131
|
+
this.editor.dispatchCommand(_e$1, "strikethrough");
|
|
6088
6132
|
}
|
|
6089
6133
|
|
|
6090
6134
|
dispatchLink(url) {
|
|
@@ -6096,7 +6140,7 @@ class CommandDispatcher {
|
|
|
6096
6140
|
}
|
|
6097
6141
|
|
|
6098
6142
|
dispatchInsertUnorderedList() {
|
|
6099
|
-
const selection =
|
|
6143
|
+
const selection = Lr();
|
|
6100
6144
|
if (!selection) return
|
|
6101
6145
|
|
|
6102
6146
|
const anchorNode = selection.anchor.getNode();
|
|
@@ -6104,12 +6148,12 @@ class CommandDispatcher {
|
|
|
6104
6148
|
if (this.selection.isInsideList && anchorNode && getListType(anchorNode) === "bullet") {
|
|
6105
6149
|
this.contents.unwrapSelectedListItems();
|
|
6106
6150
|
} else {
|
|
6107
|
-
this.editor.dispatchCommand(
|
|
6151
|
+
this.editor.dispatchCommand(St$3, undefined);
|
|
6108
6152
|
}
|
|
6109
6153
|
}
|
|
6110
6154
|
|
|
6111
6155
|
dispatchInsertOrderedList() {
|
|
6112
|
-
const selection =
|
|
6156
|
+
const selection = Lr();
|
|
6113
6157
|
if (!selection) return
|
|
6114
6158
|
|
|
6115
6159
|
const anchorNode = selection.anchor.getNode();
|
|
@@ -6117,20 +6161,20 @@ class CommandDispatcher {
|
|
|
6117
6161
|
if (this.selection.isInsideList && anchorNode && getListType(anchorNode) === "number") {
|
|
6118
6162
|
this.contents.unwrapSelectedListItems();
|
|
6119
6163
|
} else {
|
|
6120
|
-
this.editor.dispatchCommand(
|
|
6164
|
+
this.editor.dispatchCommand(xt$2, undefined);
|
|
6121
6165
|
}
|
|
6122
6166
|
}
|
|
6123
6167
|
|
|
6124
6168
|
dispatchInsertQuoteBlock() {
|
|
6125
|
-
this.contents.
|
|
6169
|
+
this.contents.toggleNodeWrappingAllSelectedNodes((node) => Ot$1(node), () => _t$1());
|
|
6126
6170
|
}
|
|
6127
6171
|
|
|
6128
6172
|
dispatchInsertCodeBlock() {
|
|
6129
6173
|
this.editor.update(() => {
|
|
6130
6174
|
if (this.selection.hasSelectedWordsInSingleLine) {
|
|
6131
|
-
this.editor.dispatchCommand(
|
|
6175
|
+
this.editor.dispatchCommand(_e$1, "code");
|
|
6132
6176
|
} else {
|
|
6133
|
-
this.contents.toggleNodeWrappingAllSelectedLines((node) =>
|
|
6177
|
+
this.contents.toggleNodeWrappingAllSelectedLines((node) => X$1(node), () => new q$1("plain"));
|
|
6134
6178
|
}
|
|
6135
6179
|
});
|
|
6136
6180
|
}
|
|
@@ -6143,12 +6187,12 @@ class CommandDispatcher {
|
|
|
6143
6187
|
|
|
6144
6188
|
dispatchRotateHeadingFormat() {
|
|
6145
6189
|
this.editor.update(() => {
|
|
6146
|
-
const selection =
|
|
6147
|
-
if (!
|
|
6190
|
+
const selection = Lr();
|
|
6191
|
+
if (!yr(selection)) return
|
|
6148
6192
|
|
|
6149
6193
|
const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow();
|
|
6150
6194
|
let nextTag = "h2";
|
|
6151
|
-
if (
|
|
6195
|
+
if (It$1(topLevelElement)) {
|
|
6152
6196
|
const currentTag = topLevelElement.getTag();
|
|
6153
6197
|
if (currentTag === "h2") {
|
|
6154
6198
|
nextTag = "h3";
|
|
@@ -6162,7 +6206,7 @@ class CommandDispatcher {
|
|
|
6162
6206
|
}
|
|
6163
6207
|
|
|
6164
6208
|
if (nextTag) {
|
|
6165
|
-
this.contents.insertNodeWrappingEachSelectedLine(() =>
|
|
6209
|
+
this.contents.insertNodeWrappingEachSelectedLine(() => St$2(nextTag));
|
|
6166
6210
|
} else {
|
|
6167
6211
|
this.contents.removeFormattingFromSelectedLines();
|
|
6168
6212
|
}
|
|
@@ -6189,11 +6233,11 @@ class CommandDispatcher {
|
|
|
6189
6233
|
}
|
|
6190
6234
|
|
|
6191
6235
|
dispatchUndo() {
|
|
6192
|
-
this.editor.dispatchCommand(
|
|
6236
|
+
this.editor.dispatchCommand(pe$1, undefined);
|
|
6193
6237
|
}
|
|
6194
6238
|
|
|
6195
6239
|
dispatchRedo() {
|
|
6196
|
-
this.editor.dispatchCommand(
|
|
6240
|
+
this.editor.dispatchCommand(ye$1, undefined);
|
|
6197
6241
|
}
|
|
6198
6242
|
|
|
6199
6243
|
#registerCommands() {
|
|
@@ -6202,7 +6246,7 @@ class CommandDispatcher {
|
|
|
6202
6246
|
this.#registerCommandHandler(command, 0, this[methodName].bind(this));
|
|
6203
6247
|
}
|
|
6204
6248
|
|
|
6205
|
-
this.#registerCommandHandler(
|
|
6249
|
+
this.#registerCommandHandler(fe$1, zi, this.dispatchPaste.bind(this));
|
|
6206
6250
|
}
|
|
6207
6251
|
|
|
6208
6252
|
#registerCommandHandler(command, priority, handler) {
|
|
@@ -6213,9 +6257,9 @@ class CommandDispatcher {
|
|
|
6213
6257
|
#toggleLink(url) {
|
|
6214
6258
|
this.editor.update(() => {
|
|
6215
6259
|
if (url === null) {
|
|
6216
|
-
|
|
6260
|
+
J$1(null);
|
|
6217
6261
|
} else {
|
|
6218
|
-
|
|
6262
|
+
J$1(url);
|
|
6219
6263
|
}
|
|
6220
6264
|
});
|
|
6221
6265
|
}
|
|
@@ -6313,8 +6357,8 @@ class Selection {
|
|
|
6313
6357
|
}
|
|
6314
6358
|
|
|
6315
6359
|
set current(selection) {
|
|
6316
|
-
if (
|
|
6317
|
-
this._current =
|
|
6360
|
+
if (xr(selection)) {
|
|
6361
|
+
this._current = Lr();
|
|
6318
6362
|
this.#syncSelectedClasses();
|
|
6319
6363
|
} else {
|
|
6320
6364
|
this.editor.update(() => {
|
|
@@ -6346,13 +6390,13 @@ class Selection {
|
|
|
6346
6390
|
|
|
6347
6391
|
placeCursorAtTheEnd() {
|
|
6348
6392
|
this.editor.update(() => {
|
|
6349
|
-
|
|
6393
|
+
No().selectEnd();
|
|
6350
6394
|
});
|
|
6351
6395
|
}
|
|
6352
6396
|
|
|
6353
6397
|
get hasSelectedWordsInSingleLine() {
|
|
6354
|
-
const selection =
|
|
6355
|
-
if (!
|
|
6398
|
+
const selection = Lr();
|
|
6399
|
+
if (!yr(selection)) return false
|
|
6356
6400
|
|
|
6357
6401
|
if (selection.isCollapsed()) return false
|
|
6358
6402
|
|
|
@@ -6368,7 +6412,7 @@ class Selection {
|
|
|
6368
6412
|
|
|
6369
6413
|
const nodes = selection.getNodes();
|
|
6370
6414
|
for (const node of nodes) {
|
|
6371
|
-
if (
|
|
6415
|
+
if (jn(node)) {
|
|
6372
6416
|
return false
|
|
6373
6417
|
}
|
|
6374
6418
|
}
|
|
@@ -6377,8 +6421,8 @@ class Selection {
|
|
|
6377
6421
|
}
|
|
6378
6422
|
|
|
6379
6423
|
get isInsideList() {
|
|
6380
|
-
const selection =
|
|
6381
|
-
if (!
|
|
6424
|
+
const selection = Lr();
|
|
6425
|
+
if (!yr(selection)) return false
|
|
6382
6426
|
|
|
6383
6427
|
const anchorNode = selection.anchor.getNode();
|
|
6384
6428
|
return getNearestListItemNode(anchorNode) !== null
|
|
@@ -6388,11 +6432,11 @@ class Selection {
|
|
|
6388
6432
|
const { anchorNode, offset } = this.#getCollapsedSelectionData();
|
|
6389
6433
|
if (!anchorNode) return null
|
|
6390
6434
|
|
|
6391
|
-
if (
|
|
6435
|
+
if (lr(anchorNode)) {
|
|
6392
6436
|
return this.#getNodeAfterTextNode(anchorNode, offset)
|
|
6393
6437
|
}
|
|
6394
6438
|
|
|
6395
|
-
if (
|
|
6439
|
+
if (Si(anchorNode)) {
|
|
6396
6440
|
return this.#getNodeAfterElementNode(anchorNode, offset)
|
|
6397
6441
|
}
|
|
6398
6442
|
|
|
@@ -6403,11 +6447,11 @@ class Selection {
|
|
|
6403
6447
|
const { anchorNode, offset } = this.#getCollapsedSelectionData();
|
|
6404
6448
|
if (!anchorNode) return null
|
|
6405
6449
|
|
|
6406
|
-
if (
|
|
6450
|
+
if (lr(anchorNode)) {
|
|
6407
6451
|
return this.#getNextNodeFromTextEnd(anchorNode)
|
|
6408
6452
|
}
|
|
6409
6453
|
|
|
6410
|
-
if (
|
|
6454
|
+
if (Si(anchorNode)) {
|
|
6411
6455
|
return this.#getNodeAfterElementNode(anchorNode, offset)
|
|
6412
6456
|
}
|
|
6413
6457
|
|
|
@@ -6418,11 +6462,11 @@ class Selection {
|
|
|
6418
6462
|
const { anchorNode, offset } = this.#getCollapsedSelectionData();
|
|
6419
6463
|
if (!anchorNode) return null
|
|
6420
6464
|
|
|
6421
|
-
if (
|
|
6465
|
+
if (lr(anchorNode)) {
|
|
6422
6466
|
return this.#getNodeBeforeTextNode(anchorNode, offset)
|
|
6423
6467
|
}
|
|
6424
6468
|
|
|
6425
|
-
if (
|
|
6469
|
+
if (Si(anchorNode)) {
|
|
6426
6470
|
return this.#getNodeBeforeElementNode(anchorNode, offset)
|
|
6427
6471
|
}
|
|
6428
6472
|
|
|
@@ -6433,11 +6477,11 @@ class Selection {
|
|
|
6433
6477
|
const { anchorNode, offset } = this.#getCollapsedSelectionData();
|
|
6434
6478
|
if (!anchorNode) return null
|
|
6435
6479
|
|
|
6436
|
-
if (
|
|
6480
|
+
if (lr(anchorNode)) {
|
|
6437
6481
|
return this.#getPreviousNodeFromTextStart(anchorNode)
|
|
6438
6482
|
}
|
|
6439
6483
|
|
|
6440
|
-
if (
|
|
6484
|
+
if (Si(anchorNode)) {
|
|
6441
6485
|
return this.#getNodeBeforeElementNode(anchorNode, offset)
|
|
6442
6486
|
}
|
|
6443
6487
|
|
|
@@ -6463,17 +6507,17 @@ class Selection {
|
|
|
6463
6507
|
}
|
|
6464
6508
|
|
|
6465
6509
|
#processSelectionChangeCommands() {
|
|
6466
|
-
this.editor.registerCommand(
|
|
6467
|
-
this.editor.registerCommand(
|
|
6468
|
-
this.editor.registerCommand(
|
|
6469
|
-
this.editor.registerCommand(
|
|
6510
|
+
this.editor.registerCommand(Se$1, this.#selectPreviousNode.bind(this), zi);
|
|
6511
|
+
this.editor.registerCommand(xe, this.#selectNextNode.bind(this), zi);
|
|
6512
|
+
this.editor.registerCommand(ke$1, this.#selectPreviousTopLevelNode.bind(this), zi);
|
|
6513
|
+
this.editor.registerCommand(Te$1, this.#selectNextTopLevelNode.bind(this), zi);
|
|
6470
6514
|
|
|
6471
|
-
this.editor.registerCommand(
|
|
6472
|
-
this.editor.registerCommand(
|
|
6515
|
+
this.editor.registerCommand(Oe$1, this.#deleteSelectedOrNext.bind(this), zi);
|
|
6516
|
+
this.editor.registerCommand(we$1, this.#deletePreviousOrNext.bind(this), zi);
|
|
6473
6517
|
|
|
6474
|
-
this.editor.registerCommand(
|
|
6475
|
-
this.current =
|
|
6476
|
-
},
|
|
6518
|
+
this.editor.registerCommand(ie$1, () => {
|
|
6519
|
+
this.current = Lr();
|
|
6520
|
+
}, zi);
|
|
6477
6521
|
}
|
|
6478
6522
|
|
|
6479
6523
|
#listenForNodeSelections() {
|
|
@@ -6482,11 +6526,11 @@ class Selection {
|
|
|
6482
6526
|
|
|
6483
6527
|
const { key } = event.detail;
|
|
6484
6528
|
this.editor.update(() => {
|
|
6485
|
-
const node =
|
|
6529
|
+
const node = xo(key);
|
|
6486
6530
|
if (node) {
|
|
6487
|
-
const selection =
|
|
6531
|
+
const selection = Pr();
|
|
6488
6532
|
selection.add(node.getKey());
|
|
6489
|
-
|
|
6533
|
+
wo(selection);
|
|
6490
6534
|
}
|
|
6491
6535
|
this.editor.focus();
|
|
6492
6536
|
});
|
|
@@ -6504,20 +6548,20 @@ class Selection {
|
|
|
6504
6548
|
this.editor.getRootElement().addEventListener("keydown", (event) => {
|
|
6505
6549
|
if (isPrintableCharacter(event)) {
|
|
6506
6550
|
this.editor.update(() => {
|
|
6507
|
-
const selection =
|
|
6551
|
+
const selection = Lr();
|
|
6508
6552
|
|
|
6509
|
-
if (
|
|
6553
|
+
if (yr(selection) && selection.isCollapsed()) {
|
|
6510
6554
|
const anchorNode = selection.anchor.getNode();
|
|
6511
6555
|
const offset = selection.anchor.offset;
|
|
6512
6556
|
|
|
6513
6557
|
const nodeBefore = this.#getNodeBeforePosition(anchorNode, offset);
|
|
6514
6558
|
const nodeAfter = this.#getNodeAfterPosition(anchorNode, offset);
|
|
6515
6559
|
|
|
6516
|
-
if (nodeBefore instanceof
|
|
6560
|
+
if (nodeBefore instanceof ki && !nodeBefore.isInline()) {
|
|
6517
6561
|
event.preventDefault();
|
|
6518
6562
|
this.#contents.createParagraphAfterNode(nodeBefore, event.key);
|
|
6519
6563
|
return
|
|
6520
|
-
} else if (nodeAfter instanceof
|
|
6564
|
+
} else if (nodeAfter instanceof ki && !nodeAfter.isInline()) {
|
|
6521
6565
|
event.preventDefault();
|
|
6522
6566
|
this.#contents.createParagraphBeforeNode(nodeAfter, event.key);
|
|
6523
6567
|
return
|
|
@@ -6529,20 +6573,20 @@ class Selection {
|
|
|
6529
6573
|
}
|
|
6530
6574
|
|
|
6531
6575
|
#getNodeBeforePosition(node, offset) {
|
|
6532
|
-
if (
|
|
6576
|
+
if (lr(node) && offset === 0) {
|
|
6533
6577
|
return node.getPreviousSibling()
|
|
6534
6578
|
}
|
|
6535
|
-
if (
|
|
6579
|
+
if (Si(node) && offset > 0) {
|
|
6536
6580
|
return node.getChildAtIndex(offset - 1)
|
|
6537
6581
|
}
|
|
6538
6582
|
return null
|
|
6539
6583
|
}
|
|
6540
6584
|
|
|
6541
6585
|
#getNodeAfterPosition(node, offset) {
|
|
6542
|
-
if (
|
|
6586
|
+
if (lr(node) && offset === node.getTextContentSize()) {
|
|
6543
6587
|
return node.getNextSibling()
|
|
6544
6588
|
}
|
|
6545
|
-
if (
|
|
6589
|
+
if (Si(node)) {
|
|
6546
6590
|
return node.getChildAtIndex(offset)
|
|
6547
6591
|
}
|
|
6548
6592
|
return null
|
|
@@ -6663,14 +6707,14 @@ class Selection {
|
|
|
6663
6707
|
}
|
|
6664
6708
|
|
|
6665
6709
|
#getTopLevelElementFromSelection() {
|
|
6666
|
-
const selection =
|
|
6710
|
+
const selection = Lr();
|
|
6667
6711
|
if (!selection) return null
|
|
6668
6712
|
|
|
6669
|
-
if (
|
|
6713
|
+
if (xr(selection)) {
|
|
6670
6714
|
return this.#getTopLevelFromNodeSelection(selection)
|
|
6671
6715
|
}
|
|
6672
6716
|
|
|
6673
|
-
if (
|
|
6717
|
+
if (yr(selection)) {
|
|
6674
6718
|
return this.#getTopLevelFromRangeSelection(selection)
|
|
6675
6719
|
}
|
|
6676
6720
|
|
|
@@ -6698,25 +6742,25 @@ class Selection {
|
|
|
6698
6742
|
}
|
|
6699
6743
|
|
|
6700
6744
|
#createAndSelectNewParagraph() {
|
|
6701
|
-
const root =
|
|
6702
|
-
const newParagraph =
|
|
6745
|
+
const root = No();
|
|
6746
|
+
const newParagraph = Li();
|
|
6703
6747
|
root.append(newParagraph);
|
|
6704
6748
|
newParagraph.selectStart();
|
|
6705
6749
|
}
|
|
6706
6750
|
|
|
6707
6751
|
#selectInLexical(node) {
|
|
6708
|
-
if (!node || !(node instanceof
|
|
6752
|
+
if (!node || !(node instanceof ki)) return
|
|
6709
6753
|
|
|
6710
6754
|
this.editor.update(() => {
|
|
6711
|
-
const selection =
|
|
6755
|
+
const selection = Pr();
|
|
6712
6756
|
selection.add(node.getKey());
|
|
6713
|
-
|
|
6757
|
+
wo(selection);
|
|
6714
6758
|
});
|
|
6715
6759
|
}
|
|
6716
6760
|
|
|
6717
6761
|
#deleteSelectedOrNext() {
|
|
6718
6762
|
const node = this.nodeAfterCursor;
|
|
6719
|
-
if (node instanceof
|
|
6763
|
+
if (node instanceof ki) {
|
|
6720
6764
|
this.#selectInLexical(node);
|
|
6721
6765
|
} else {
|
|
6722
6766
|
this.#contents.deleteSelectedNodes();
|
|
@@ -6727,7 +6771,7 @@ class Selection {
|
|
|
6727
6771
|
|
|
6728
6772
|
#deletePreviousOrNext() {
|
|
6729
6773
|
const node = this.nodeBeforeCursor;
|
|
6730
|
-
if (node instanceof
|
|
6774
|
+
if (node instanceof ki) {
|
|
6731
6775
|
this.#selectInLexical(node);
|
|
6732
6776
|
} else {
|
|
6733
6777
|
this.#contents.deleteSelectedNodes();
|
|
@@ -6737,7 +6781,7 @@ class Selection {
|
|
|
6737
6781
|
}
|
|
6738
6782
|
|
|
6739
6783
|
#getValidSelectionRange() {
|
|
6740
|
-
const lexicalSelection =
|
|
6784
|
+
const lexicalSelection = Lr();
|
|
6741
6785
|
if (!lexicalSelection || !lexicalSelection.isCollapsed()) return null
|
|
6742
6786
|
|
|
6743
6787
|
const nativeSelection = window.getSelection();
|
|
@@ -6820,8 +6864,8 @@ class Selection {
|
|
|
6820
6864
|
}
|
|
6821
6865
|
|
|
6822
6866
|
#getCollapsedSelectionData() {
|
|
6823
|
-
const selection =
|
|
6824
|
-
if (!
|
|
6867
|
+
const selection = Lr();
|
|
6868
|
+
if (!yr(selection) || !selection.isCollapsed()) {
|
|
6825
6869
|
return { anchorNode: null, offset: 0 }
|
|
6826
6870
|
}
|
|
6827
6871
|
|
|
@@ -6837,7 +6881,7 @@ class Selection {
|
|
|
6837
6881
|
}
|
|
6838
6882
|
|
|
6839
6883
|
#getNextNodeFromTextEnd(anchorNode) {
|
|
6840
|
-
if (anchorNode.getNextSibling() instanceof
|
|
6884
|
+
if (anchorNode.getNextSibling() instanceof ki) {
|
|
6841
6885
|
return anchorNode.getNextSibling()
|
|
6842
6886
|
}
|
|
6843
6887
|
const parent = anchorNode.getParent();
|
|
@@ -6859,7 +6903,7 @@ class Selection {
|
|
|
6859
6903
|
}
|
|
6860
6904
|
|
|
6861
6905
|
#getPreviousNodeFromTextStart(anchorNode) {
|
|
6862
|
-
if (anchorNode.getPreviousSibling() instanceof
|
|
6906
|
+
if (anchorNode.getPreviousSibling() instanceof ki) {
|
|
6863
6907
|
return anchorNode.getPreviousSibling()
|
|
6864
6908
|
}
|
|
6865
6909
|
const parent = anchorNode.getParent();
|
|
@@ -6890,7 +6934,7 @@ class Selection {
|
|
|
6890
6934
|
}
|
|
6891
6935
|
}
|
|
6892
6936
|
|
|
6893
|
-
class CustomActionTextAttachmentNode extends
|
|
6937
|
+
class CustomActionTextAttachmentNode extends ki {
|
|
6894
6938
|
static getType() {
|
|
6895
6939
|
return "custom_action_text_attachment"
|
|
6896
6940
|
}
|
|
@@ -6917,7 +6961,7 @@ class CustomActionTextAttachmentNode extends gi {
|
|
|
6917
6961
|
const nodes = [];
|
|
6918
6962
|
const previousSibling = attachment.previousSibling;
|
|
6919
6963
|
if (previousSibling && previousSibling.nodeType === Node.TEXT_NODE && /\s$/.test(previousSibling.textContent)) {
|
|
6920
|
-
nodes.push(
|
|
6964
|
+
nodes.push(sr(" "));
|
|
6921
6965
|
}
|
|
6922
6966
|
|
|
6923
6967
|
nodes.push(new CustomActionTextAttachmentNode({
|
|
@@ -6926,7 +6970,7 @@ class CustomActionTextAttachmentNode extends gi {
|
|
|
6926
6970
|
contentType: attachment.getAttribute("content-type")
|
|
6927
6971
|
}));
|
|
6928
6972
|
|
|
6929
|
-
nodes.push(
|
|
6973
|
+
nodes.push(sr(" "));
|
|
6930
6974
|
|
|
6931
6975
|
return { node: nodes }
|
|
6932
6976
|
},
|
|
@@ -6989,35 +7033,302 @@ class CustomActionTextAttachmentNode extends gi {
|
|
|
6989
7033
|
}
|
|
6990
7034
|
}
|
|
6991
7035
|
|
|
7036
|
+
class FormatEscaper {
|
|
7037
|
+
constructor(editorElement) {
|
|
7038
|
+
this.editorElement = editorElement;
|
|
7039
|
+
this.editor = editorElement.editor;
|
|
7040
|
+
}
|
|
7041
|
+
|
|
7042
|
+
monitor() {
|
|
7043
|
+
this.editor.registerCommand(
|
|
7044
|
+
Ne$1,
|
|
7045
|
+
(event) => this.#handleEnterKey(event),
|
|
7046
|
+
Bi
|
|
7047
|
+
);
|
|
7048
|
+
}
|
|
7049
|
+
|
|
7050
|
+
#handleEnterKey(event) {
|
|
7051
|
+
const selection = Lr();
|
|
7052
|
+
if (!yr(selection)) return false
|
|
7053
|
+
|
|
7054
|
+
const anchorNode = selection.anchor.getNode();
|
|
7055
|
+
|
|
7056
|
+
return this.#handleLists(event, anchorNode)
|
|
7057
|
+
|| this.#handleBlockquotes(event, anchorNode)
|
|
7058
|
+
}
|
|
7059
|
+
|
|
7060
|
+
#handleLists(event, anchorNode) {
|
|
7061
|
+
if (this.#shouldEscapeFromEmptyListItem(anchorNode) || this.#shouldEscapeFromEmptyParagraphInListItem(anchorNode)) {
|
|
7062
|
+
event.preventDefault();
|
|
7063
|
+
this.#escapeFromList(anchorNode);
|
|
7064
|
+
return true
|
|
7065
|
+
}
|
|
7066
|
+
|
|
7067
|
+
return false
|
|
7068
|
+
}
|
|
7069
|
+
|
|
7070
|
+
#handleBlockquotes(event, anchorNode) {
|
|
7071
|
+
if (this.#shouldEscapeFromEmptyParagraphInBlockquote(anchorNode)) {
|
|
7072
|
+
event.preventDefault();
|
|
7073
|
+
this.#escapeFromBlockquote(anchorNode);
|
|
7074
|
+
return true
|
|
7075
|
+
}
|
|
7076
|
+
|
|
7077
|
+
return false
|
|
7078
|
+
}
|
|
7079
|
+
|
|
7080
|
+
#shouldEscapeFromEmptyListItem(node) {
|
|
7081
|
+
const listItem = this.#getListItemNode(node);
|
|
7082
|
+
if (!listItem) return false
|
|
7083
|
+
|
|
7084
|
+
return this.#isNodeEmpty(listItem)
|
|
7085
|
+
}
|
|
7086
|
+
|
|
7087
|
+
#shouldEscapeFromEmptyParagraphInListItem(node) {
|
|
7088
|
+
const paragraph = this.#getParagraphNode(node);
|
|
7089
|
+
if (!paragraph) return false
|
|
7090
|
+
|
|
7091
|
+
if (!this.#isNodeEmpty(paragraph)) return false
|
|
7092
|
+
|
|
7093
|
+
const parent = paragraph.getParent();
|
|
7094
|
+
return parent && ot$2(parent)
|
|
7095
|
+
}
|
|
7096
|
+
|
|
7097
|
+
#isNodeEmpty(node) {
|
|
7098
|
+
if (node.getTextContent().trim() !== "") return false
|
|
7099
|
+
|
|
7100
|
+
const children = node.getChildren();
|
|
7101
|
+
if (children.length === 0) return true
|
|
7102
|
+
|
|
7103
|
+
return children.every(child => {
|
|
7104
|
+
if (jn(child)) return true
|
|
7105
|
+
return this.#isNodeEmpty(child)
|
|
7106
|
+
})
|
|
7107
|
+
}
|
|
7108
|
+
|
|
7109
|
+
#getListItemNode(node) {
|
|
7110
|
+
let currentNode = node;
|
|
7111
|
+
|
|
7112
|
+
while (currentNode) {
|
|
7113
|
+
if (ot$2(currentNode)) {
|
|
7114
|
+
return currentNode
|
|
7115
|
+
}
|
|
7116
|
+
currentNode = currentNode.getParent();
|
|
7117
|
+
}
|
|
7118
|
+
|
|
7119
|
+
return null
|
|
7120
|
+
}
|
|
7121
|
+
|
|
7122
|
+
#escapeFromList(anchorNode) {
|
|
7123
|
+
const listItem = this.#getListItemNode(anchorNode);
|
|
7124
|
+
if (!listItem) return
|
|
7125
|
+
|
|
7126
|
+
const parentList = listItem.getParent();
|
|
7127
|
+
if (!parentList || !dt$1(parentList)) return
|
|
7128
|
+
|
|
7129
|
+
const blockquote = parentList.getParent();
|
|
7130
|
+
const isInBlockquote = blockquote && Ot$1(blockquote);
|
|
7131
|
+
|
|
7132
|
+
if (isInBlockquote) {
|
|
7133
|
+
const listItemsAfter = this.#getListItemSiblingsAfter(listItem);
|
|
7134
|
+
const nonEmptyListItems = listItemsAfter.filter(item => !this.#isNodeEmpty(item));
|
|
7135
|
+
|
|
7136
|
+
if (nonEmptyListItems.length > 0) {
|
|
7137
|
+
this.#splitBlockquoteWithList(blockquote, parentList, listItem, nonEmptyListItems);
|
|
7138
|
+
return
|
|
7139
|
+
}
|
|
7140
|
+
}
|
|
7141
|
+
|
|
7142
|
+
const paragraph = Li();
|
|
7143
|
+
parentList.insertAfter(paragraph);
|
|
7144
|
+
|
|
7145
|
+
listItem.remove();
|
|
7146
|
+
paragraph.selectStart();
|
|
7147
|
+
}
|
|
7148
|
+
|
|
7149
|
+
#shouldEscapeFromEmptyParagraphInBlockquote(node) {
|
|
7150
|
+
const paragraph = this.#getParagraphNode(node);
|
|
7151
|
+
if (!paragraph) return false
|
|
7152
|
+
|
|
7153
|
+
if (!this.#isNodeEmpty(paragraph)) return false
|
|
7154
|
+
|
|
7155
|
+
const parent = paragraph.getParent();
|
|
7156
|
+
return parent && Ot$1(parent)
|
|
7157
|
+
}
|
|
7158
|
+
|
|
7159
|
+
#getParagraphNode(node) {
|
|
7160
|
+
let currentNode = node;
|
|
7161
|
+
|
|
7162
|
+
while (currentNode) {
|
|
7163
|
+
if (Ii(currentNode)) {
|
|
7164
|
+
return currentNode
|
|
7165
|
+
}
|
|
7166
|
+
currentNode = currentNode.getParent();
|
|
7167
|
+
}
|
|
7168
|
+
|
|
7169
|
+
return null
|
|
7170
|
+
}
|
|
7171
|
+
|
|
7172
|
+
#escapeFromBlockquote(anchorNode) {
|
|
7173
|
+
const paragraph = this.#getParagraphNode(anchorNode);
|
|
7174
|
+
if (!paragraph) return
|
|
7175
|
+
|
|
7176
|
+
const blockquote = paragraph.getParent();
|
|
7177
|
+
if (!blockquote || !Ot$1(blockquote)) return
|
|
7178
|
+
|
|
7179
|
+
const siblingsAfter = this.#getSiblingsAfter(paragraph);
|
|
7180
|
+
const nonEmptySiblings = siblingsAfter.filter(sibling => !this.#isNodeEmpty(sibling));
|
|
7181
|
+
|
|
7182
|
+
if (nonEmptySiblings.length > 0) {
|
|
7183
|
+
this.#splitBlockquote(blockquote, paragraph, nonEmptySiblings);
|
|
7184
|
+
} else {
|
|
7185
|
+
const newParagraph = Li();
|
|
7186
|
+
blockquote.insertAfter(newParagraph);
|
|
7187
|
+
paragraph.remove();
|
|
7188
|
+
newParagraph.selectStart();
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
#getSiblingsAfter(node) {
|
|
7193
|
+
const siblings = [];
|
|
7194
|
+
let sibling = node.getNextSibling();
|
|
7195
|
+
|
|
7196
|
+
while (sibling) {
|
|
7197
|
+
siblings.push(sibling);
|
|
7198
|
+
sibling = sibling.getNextSibling();
|
|
7199
|
+
}
|
|
7200
|
+
|
|
7201
|
+
return siblings
|
|
7202
|
+
}
|
|
7203
|
+
|
|
7204
|
+
#getListItemSiblingsAfter(listItem) {
|
|
7205
|
+
const siblings = [];
|
|
7206
|
+
let sibling = listItem.getNextSibling();
|
|
7207
|
+
|
|
7208
|
+
while (sibling) {
|
|
7209
|
+
if (ot$2(sibling)) {
|
|
7210
|
+
siblings.push(sibling);
|
|
7211
|
+
}
|
|
7212
|
+
sibling = sibling.getNextSibling();
|
|
7213
|
+
}
|
|
7214
|
+
|
|
7215
|
+
return siblings
|
|
7216
|
+
}
|
|
7217
|
+
|
|
7218
|
+
#splitBlockquoteWithList(blockquote, parentList, emptyListItem, listItemsAfter) {
|
|
7219
|
+
const blockquoteSiblingsAfterList = this.#getSiblingsAfter(parentList);
|
|
7220
|
+
const nonEmptyBlockquoteSiblings = blockquoteSiblingsAfterList.filter(sibling => !this.#isNodeEmpty(sibling));
|
|
7221
|
+
|
|
7222
|
+
const middleParagraph = Li();
|
|
7223
|
+
blockquote.insertAfter(middleParagraph);
|
|
7224
|
+
|
|
7225
|
+
const newList = ht$3(parentList.getListType());
|
|
7226
|
+
|
|
7227
|
+
const newBlockquote = _t$1();
|
|
7228
|
+
middleParagraph.insertAfter(newBlockquote);
|
|
7229
|
+
newBlockquote.append(newList);
|
|
7230
|
+
|
|
7231
|
+
listItemsAfter.forEach(item => {
|
|
7232
|
+
newList.append(item);
|
|
7233
|
+
});
|
|
7234
|
+
|
|
7235
|
+
nonEmptyBlockquoteSiblings.forEach(sibling => {
|
|
7236
|
+
newBlockquote.append(sibling);
|
|
7237
|
+
});
|
|
7238
|
+
|
|
7239
|
+
emptyListItem.remove();
|
|
7240
|
+
|
|
7241
|
+
this.#removeTrailingEmptyListItems(parentList);
|
|
7242
|
+
this.#removeTrailingEmptyNodes(newBlockquote);
|
|
7243
|
+
|
|
7244
|
+
if (parentList.getChildrenSize() === 0) {
|
|
7245
|
+
parentList.remove();
|
|
7246
|
+
|
|
7247
|
+
if (blockquote.getChildrenSize() === 0) {
|
|
7248
|
+
blockquote.remove();
|
|
7249
|
+
}
|
|
7250
|
+
} else {
|
|
7251
|
+
this.#removeTrailingEmptyNodes(blockquote);
|
|
7252
|
+
}
|
|
7253
|
+
|
|
7254
|
+
middleParagraph.selectStart();
|
|
7255
|
+
}
|
|
7256
|
+
|
|
7257
|
+
#removeTrailingEmptyListItems(list) {
|
|
7258
|
+
const items = list.getChildren();
|
|
7259
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
7260
|
+
const item = items[i];
|
|
7261
|
+
if (ot$2(item) && this.#isNodeEmpty(item)) {
|
|
7262
|
+
item.remove();
|
|
7263
|
+
} else {
|
|
7264
|
+
break
|
|
7265
|
+
}
|
|
7266
|
+
}
|
|
7267
|
+
}
|
|
7268
|
+
|
|
7269
|
+
#removeTrailingEmptyNodes(blockquote) {
|
|
7270
|
+
const children = blockquote.getChildren();
|
|
7271
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
7272
|
+
const child = children[i];
|
|
7273
|
+
if (this.#isNodeEmpty(child)) {
|
|
7274
|
+
child.remove();
|
|
7275
|
+
} else {
|
|
7276
|
+
break
|
|
7277
|
+
}
|
|
7278
|
+
}
|
|
7279
|
+
}
|
|
7280
|
+
|
|
7281
|
+
#splitBlockquote(blockquote, emptyParagraph, siblingsAfter) {
|
|
7282
|
+
const newParagraph = Li();
|
|
7283
|
+
blockquote.insertAfter(newParagraph);
|
|
7284
|
+
|
|
7285
|
+
const newBlockquote = _t$1();
|
|
7286
|
+
newParagraph.insertAfter(newBlockquote);
|
|
7287
|
+
|
|
7288
|
+
siblingsAfter.forEach(sibling => {
|
|
7289
|
+
newBlockquote.append(sibling);
|
|
7290
|
+
});
|
|
7291
|
+
|
|
7292
|
+
emptyParagraph.remove();
|
|
7293
|
+
|
|
7294
|
+
this.#removeTrailingEmptyNodes(blockquote);
|
|
7295
|
+
this.#removeTrailingEmptyNodes(newBlockquote);
|
|
7296
|
+
|
|
7297
|
+
newParagraph.selectStart();
|
|
7298
|
+
}
|
|
7299
|
+
}
|
|
7300
|
+
|
|
6992
7301
|
class Contents {
|
|
6993
7302
|
constructor(editorElement) {
|
|
6994
7303
|
this.editorElement = editorElement;
|
|
6995
7304
|
this.editor = editorElement.editor;
|
|
7305
|
+
|
|
7306
|
+
new FormatEscaper(editorElement).monitor();
|
|
6996
7307
|
}
|
|
6997
7308
|
|
|
6998
7309
|
insertHtml(html) {
|
|
6999
7310
|
this.editor.update(() => {
|
|
7000
|
-
const selection =
|
|
7311
|
+
const selection = Lr();
|
|
7001
7312
|
|
|
7002
|
-
if (!
|
|
7313
|
+
if (!yr(selection)) return
|
|
7003
7314
|
|
|
7004
|
-
const nodes =
|
|
7315
|
+
const nodes = m$1(this.editor, parseHtml(html));
|
|
7005
7316
|
selection.insertNodes(nodes);
|
|
7006
7317
|
});
|
|
7007
7318
|
}
|
|
7008
7319
|
|
|
7009
7320
|
insertAtCursor(node) {
|
|
7010
7321
|
this.editor.update(() => {
|
|
7011
|
-
const selection =
|
|
7322
|
+
const selection = Lr();
|
|
7012
7323
|
const selectedNodes = selection?.getNodes();
|
|
7013
7324
|
|
|
7014
|
-
if (
|
|
7015
|
-
|
|
7016
|
-
} else if (
|
|
7325
|
+
if (yr(selection)) {
|
|
7326
|
+
jr([ node ]);
|
|
7327
|
+
} else if (xr(selection) && selectedNodes && selectedNodes.length > 0) {
|
|
7017
7328
|
const lastNode = selectedNodes[selectedNodes.length - 1];
|
|
7018
7329
|
lastNode.insertAfter(node);
|
|
7019
7330
|
} else {
|
|
7020
|
-
const root =
|
|
7331
|
+
const root = No();
|
|
7021
7332
|
root.append(node);
|
|
7022
7333
|
}
|
|
7023
7334
|
});
|
|
@@ -7025,8 +7336,8 @@ class Contents {
|
|
|
7025
7336
|
|
|
7026
7337
|
insertNodeWrappingEachSelectedLine(newNodeFn) {
|
|
7027
7338
|
this.editor.update(() => {
|
|
7028
|
-
const selection =
|
|
7029
|
-
if (!
|
|
7339
|
+
const selection = Lr();
|
|
7340
|
+
if (!yr(selection)) return
|
|
7030
7341
|
|
|
7031
7342
|
const selectedNodes = selection.extract();
|
|
7032
7343
|
|
|
@@ -7044,8 +7355,8 @@ class Contents {
|
|
|
7044
7355
|
|
|
7045
7356
|
toggleNodeWrappingAllSelectedLines(isFormatAppliedFn, newNodeFn) {
|
|
7046
7357
|
this.editor.update(() => {
|
|
7047
|
-
const selection =
|
|
7048
|
-
if (!
|
|
7358
|
+
const selection = Lr();
|
|
7359
|
+
if (!yr(selection)) return
|
|
7049
7360
|
|
|
7050
7361
|
const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow();
|
|
7051
7362
|
|
|
@@ -7053,31 +7364,34 @@ class Contents {
|
|
|
7053
7364
|
if (isFormatAppliedFn(topLevelElement)) {
|
|
7054
7365
|
this.removeFormattingFromSelectedLines();
|
|
7055
7366
|
} else {
|
|
7056
|
-
this
|
|
7367
|
+
this.#insertNodeWrappingAllSelectedLines(newNodeFn);
|
|
7057
7368
|
}
|
|
7058
7369
|
});
|
|
7059
7370
|
}
|
|
7060
7371
|
|
|
7061
|
-
|
|
7372
|
+
toggleNodeWrappingAllSelectedNodes(isFormatAppliedFn, newNodeFn) {
|
|
7062
7373
|
this.editor.update(() => {
|
|
7063
|
-
const selection =
|
|
7064
|
-
if (!
|
|
7374
|
+
const selection = Lr();
|
|
7375
|
+
if (!yr(selection)) return
|
|
7065
7376
|
|
|
7066
|
-
|
|
7067
|
-
|
|
7377
|
+
const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow();
|
|
7378
|
+
|
|
7379
|
+
// Check if format is already applied
|
|
7380
|
+
if (isFormatAppliedFn(topLevelElement)) {
|
|
7381
|
+
this.#unwrap(topLevelElement);
|
|
7068
7382
|
} else {
|
|
7069
|
-
this.#
|
|
7383
|
+
this.#insertNodeWrappingAllSelectedNodes(newNodeFn);
|
|
7070
7384
|
}
|
|
7071
7385
|
});
|
|
7072
7386
|
}
|
|
7073
7387
|
|
|
7074
7388
|
removeFormattingFromSelectedLines() {
|
|
7075
7389
|
this.editor.update(() => {
|
|
7076
|
-
const selection =
|
|
7077
|
-
if (!
|
|
7390
|
+
const selection = Lr();
|
|
7391
|
+
if (!yr(selection)) return
|
|
7078
7392
|
|
|
7079
7393
|
const topLevelElement = selection.anchor.getNode().getTopLevelElementOrThrow();
|
|
7080
|
-
const paragraph =
|
|
7394
|
+
const paragraph = Li();
|
|
7081
7395
|
paragraph.append(...topLevelElement.getChildren());
|
|
7082
7396
|
topLevelElement.replace(paragraph);
|
|
7083
7397
|
});
|
|
@@ -7087,8 +7401,8 @@ class Contents {
|
|
|
7087
7401
|
let result = false;
|
|
7088
7402
|
|
|
7089
7403
|
this.editor.read(() => {
|
|
7090
|
-
const selection =
|
|
7091
|
-
result =
|
|
7404
|
+
const selection = Lr();
|
|
7405
|
+
result = yr(selection) && !selection.isCollapsed();
|
|
7092
7406
|
});
|
|
7093
7407
|
|
|
7094
7408
|
return result
|
|
@@ -7096,8 +7410,8 @@ class Contents {
|
|
|
7096
7410
|
|
|
7097
7411
|
unwrapSelectedListItems() {
|
|
7098
7412
|
this.editor.update(() => {
|
|
7099
|
-
const selection =
|
|
7100
|
-
if (!
|
|
7413
|
+
const selection = Lr();
|
|
7414
|
+
if (!yr(selection)) return
|
|
7101
7415
|
|
|
7102
7416
|
const { listItems, parentLists } = this.#collectSelectedListItems(selection);
|
|
7103
7417
|
if (listItems.size > 0) {
|
|
@@ -7112,12 +7426,12 @@ class Contents {
|
|
|
7112
7426
|
let linkNodeKey = null;
|
|
7113
7427
|
|
|
7114
7428
|
this.editor.update(() => {
|
|
7115
|
-
const textNode =
|
|
7116
|
-
const linkNode =
|
|
7429
|
+
const textNode = sr(url);
|
|
7430
|
+
const linkNode = D$1(url);
|
|
7117
7431
|
linkNode.append(textNode);
|
|
7118
7432
|
|
|
7119
|
-
const selection =
|
|
7120
|
-
if (
|
|
7433
|
+
const selection = Lr();
|
|
7434
|
+
if (yr(selection)) {
|
|
7121
7435
|
selection.insertNodes([ linkNode ]);
|
|
7122
7436
|
linkNodeKey = linkNode.getKey();
|
|
7123
7437
|
}
|
|
@@ -7130,7 +7444,7 @@ class Contents {
|
|
|
7130
7444
|
if (!this.hasSelectedText()) return
|
|
7131
7445
|
|
|
7132
7446
|
this.editor.update(() => {
|
|
7133
|
-
|
|
7447
|
+
J$1(url);
|
|
7134
7448
|
});
|
|
7135
7449
|
}
|
|
7136
7450
|
|
|
@@ -7138,13 +7452,13 @@ class Contents {
|
|
|
7138
7452
|
let result = "";
|
|
7139
7453
|
|
|
7140
7454
|
this.editor.getEditorState().read(() => {
|
|
7141
|
-
const selection =
|
|
7455
|
+
const selection = Lr();
|
|
7142
7456
|
if (!selection || !selection.isCollapsed()) return
|
|
7143
7457
|
|
|
7144
7458
|
const anchor = selection.anchor;
|
|
7145
7459
|
const anchorNode = anchor.getNode();
|
|
7146
7460
|
|
|
7147
|
-
if (!
|
|
7461
|
+
if (!lr(anchorNode)) return
|
|
7148
7462
|
|
|
7149
7463
|
const fullText = anchorNode.getTextContent();
|
|
7150
7464
|
const offset = anchor.offset;
|
|
@@ -7164,13 +7478,13 @@ class Contents {
|
|
|
7164
7478
|
let result = false;
|
|
7165
7479
|
|
|
7166
7480
|
this.editor.getEditorState().read(() => {
|
|
7167
|
-
const selection =
|
|
7481
|
+
const selection = Lr();
|
|
7168
7482
|
if (!selection || !selection.isCollapsed()) return
|
|
7169
7483
|
|
|
7170
7484
|
const anchor = selection.anchor;
|
|
7171
7485
|
const anchorNode = anchor.getNode();
|
|
7172
7486
|
|
|
7173
|
-
if (!
|
|
7487
|
+
if (!lr(anchorNode)) return
|
|
7174
7488
|
|
|
7175
7489
|
const fullText = anchorNode.getTextContent();
|
|
7176
7490
|
const offset = anchor.offset;
|
|
@@ -7198,25 +7512,25 @@ class Contents {
|
|
|
7198
7512
|
}
|
|
7199
7513
|
|
|
7200
7514
|
createParagraphAfterNode(node, text) {
|
|
7201
|
-
const newParagraph =
|
|
7515
|
+
const newParagraph = Li();
|
|
7202
7516
|
node.insertAfter(newParagraph);
|
|
7203
7517
|
newParagraph.selectStart();
|
|
7204
7518
|
|
|
7205
7519
|
// Insert the typed text
|
|
7206
7520
|
if (text) {
|
|
7207
|
-
newParagraph.append(
|
|
7521
|
+
newParagraph.append(sr(text));
|
|
7208
7522
|
newParagraph.select(1, 1); // Place cursor after the text
|
|
7209
7523
|
}
|
|
7210
7524
|
}
|
|
7211
7525
|
|
|
7212
7526
|
createParagraphBeforeNode(node, text) {
|
|
7213
|
-
const newParagraph =
|
|
7527
|
+
const newParagraph = Li();
|
|
7214
7528
|
node.insertBefore(newParagraph);
|
|
7215
7529
|
newParagraph.selectStart();
|
|
7216
7530
|
|
|
7217
7531
|
// Insert the typed text
|
|
7218
7532
|
if (text) {
|
|
7219
|
-
newParagraph.append(
|
|
7533
|
+
newParagraph.append(sr(text));
|
|
7220
7534
|
newParagraph.select(1, 1); // Place cursor after the text
|
|
7221
7535
|
}
|
|
7222
7536
|
}
|
|
@@ -7237,14 +7551,14 @@ class Contents {
|
|
|
7237
7551
|
this.editor.update(() => {
|
|
7238
7552
|
const uploadedImageNode = new ActionTextAttachmentUploadNode({ file: file, uploadUrl: uploadUrl, blobUrlTemplate: blobUrlTemplate, editor: this.editor });
|
|
7239
7553
|
this.insertAtCursor(uploadedImageNode);
|
|
7240
|
-
}, { tag:
|
|
7554
|
+
}, { tag: Dn });
|
|
7241
7555
|
}
|
|
7242
7556
|
|
|
7243
7557
|
async deleteSelectedNodes() {
|
|
7244
7558
|
let focusNode = null;
|
|
7245
7559
|
|
|
7246
7560
|
this.editor.update(() => {
|
|
7247
|
-
if (
|
|
7561
|
+
if (xr(this.#selection.current)) {
|
|
7248
7562
|
const nodesToRemove = this.#selection.current.getNodes();
|
|
7249
7563
|
if (nodesToRemove.length === 0) return
|
|
7250
7564
|
|
|
@@ -7264,18 +7578,18 @@ class Contents {
|
|
|
7264
7578
|
|
|
7265
7579
|
replaceNodeWithHTML(nodeKey, html, options = {}) {
|
|
7266
7580
|
this.editor.update(() => {
|
|
7267
|
-
const node =
|
|
7581
|
+
const node = xo(nodeKey);
|
|
7268
7582
|
if (!node) return
|
|
7269
7583
|
|
|
7270
|
-
const selection =
|
|
7584
|
+
const selection = Lr();
|
|
7271
7585
|
let wasSelected = false;
|
|
7272
7586
|
|
|
7273
|
-
if (
|
|
7587
|
+
if (yr(selection)) {
|
|
7274
7588
|
const selectedNodes = selection.getNodes();
|
|
7275
7589
|
wasSelected = selectedNodes.includes(node) || selectedNodes.some(n => n.getParent() === node);
|
|
7276
7590
|
|
|
7277
7591
|
if (wasSelected) {
|
|
7278
|
-
|
|
7592
|
+
wo(null);
|
|
7279
7593
|
}
|
|
7280
7594
|
}
|
|
7281
7595
|
|
|
@@ -7290,7 +7604,7 @@ class Contents {
|
|
|
7290
7604
|
|
|
7291
7605
|
insertHTMLBelowNode(nodeKey, html, options = {}) {
|
|
7292
7606
|
this.editor.update(() => {
|
|
7293
|
-
const node =
|
|
7607
|
+
const node = xo(nodeKey);
|
|
7294
7608
|
if (!node) return
|
|
7295
7609
|
|
|
7296
7610
|
let previousNode = node;
|
|
@@ -7307,6 +7621,80 @@ class Contents {
|
|
|
7307
7621
|
return this.editorElement.selection
|
|
7308
7622
|
}
|
|
7309
7623
|
|
|
7624
|
+
#unwrap(node) {
|
|
7625
|
+
const children = node.getChildren();
|
|
7626
|
+
|
|
7627
|
+
children.forEach((child) => {
|
|
7628
|
+
node.insertBefore(child);
|
|
7629
|
+
});
|
|
7630
|
+
|
|
7631
|
+
node.remove();
|
|
7632
|
+
}
|
|
7633
|
+
|
|
7634
|
+
#insertNodeWrappingAllSelectedNodes(newNodeFn) {
|
|
7635
|
+
this.editor.update(() => {
|
|
7636
|
+
const selection = Lr();
|
|
7637
|
+
if (!yr(selection)) return
|
|
7638
|
+
|
|
7639
|
+
const selectedNodes = selection.extract();
|
|
7640
|
+
if (selectedNodes.length === 0) return
|
|
7641
|
+
|
|
7642
|
+
const topLevelElements = new Set();
|
|
7643
|
+
selectedNodes.forEach((node) => {
|
|
7644
|
+
const topLevel = node.getTopLevelElementOrThrow();
|
|
7645
|
+
topLevelElements.add(topLevel);
|
|
7646
|
+
});
|
|
7647
|
+
|
|
7648
|
+
const elements = this.#removeTrailingEmptyParagraphs(Array.from(topLevelElements));
|
|
7649
|
+
if (elements.length === 0) return
|
|
7650
|
+
|
|
7651
|
+
const wrappingNode = newNodeFn();
|
|
7652
|
+
elements[0].insertBefore(wrappingNode);
|
|
7653
|
+
elements.forEach((element) => {
|
|
7654
|
+
wrappingNode.append(element);
|
|
7655
|
+
});
|
|
7656
|
+
|
|
7657
|
+
wo(null);
|
|
7658
|
+
});
|
|
7659
|
+
}
|
|
7660
|
+
|
|
7661
|
+
#removeTrailingEmptyParagraphs(elements) {
|
|
7662
|
+
let lastNonEmptyIndex = elements.length - 1;
|
|
7663
|
+
|
|
7664
|
+
// Find the last non-empty paragraph
|
|
7665
|
+
while (lastNonEmptyIndex >= 0) {
|
|
7666
|
+
const element = elements[lastNonEmptyIndex];
|
|
7667
|
+
if (!Ii(element) || !this.#isElementEmpty(element)) {
|
|
7668
|
+
break
|
|
7669
|
+
}
|
|
7670
|
+
lastNonEmptyIndex--;
|
|
7671
|
+
}
|
|
7672
|
+
|
|
7673
|
+
return elements.slice(0, lastNonEmptyIndex + 1)
|
|
7674
|
+
}
|
|
7675
|
+
|
|
7676
|
+
#isElementEmpty(element) {
|
|
7677
|
+
// Check text content first
|
|
7678
|
+
if (element.getTextContent().trim() !== "") return false
|
|
7679
|
+
|
|
7680
|
+
// Check if it only contains line breaks
|
|
7681
|
+
const children = element.getChildren();
|
|
7682
|
+
return children.length === 0 || children.every(child => jn(child))
|
|
7683
|
+
}
|
|
7684
|
+
|
|
7685
|
+
#insertNodeWrappingAllSelectedLines(newNodeFn) {
|
|
7686
|
+
this.editor.update(() => {
|
|
7687
|
+
const selection = Lr();
|
|
7688
|
+
if (!yr(selection)) return
|
|
7689
|
+
|
|
7690
|
+
if (selection.isCollapsed()) {
|
|
7691
|
+
this.#wrapCurrentLine(selection, newNodeFn);
|
|
7692
|
+
} else {
|
|
7693
|
+
this.#wrapMultipleSelectedLines(selection, newNodeFn);
|
|
7694
|
+
}
|
|
7695
|
+
});
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7310
7698
|
#wrapCurrentLine(selection, newNodeFn) {
|
|
7311
7699
|
const anchorNode = selection.anchor.getNode();
|
|
7312
7700
|
const topLevelElement = anchorNode.getTopLevelElementOrThrow();
|
|
@@ -7316,7 +7704,7 @@ class Contents {
|
|
|
7316
7704
|
wrappingNode.append(...topLevelElement.getChildren());
|
|
7317
7705
|
topLevelElement.replace(wrappingNode);
|
|
7318
7706
|
} else {
|
|
7319
|
-
|
|
7707
|
+
jr([ newNodeFn() ]);
|
|
7320
7708
|
}
|
|
7321
7709
|
}
|
|
7322
7710
|
|
|
@@ -7338,13 +7726,13 @@ class Contents {
|
|
|
7338
7726
|
.map((node) => this.#getParagraphFromNode(node))
|
|
7339
7727
|
.filter(Boolean);
|
|
7340
7728
|
|
|
7341
|
-
|
|
7729
|
+
wo(null);
|
|
7342
7730
|
return selectedParagraphs
|
|
7343
7731
|
}
|
|
7344
7732
|
|
|
7345
7733
|
#getParagraphFromNode(node) {
|
|
7346
|
-
if (
|
|
7347
|
-
if (
|
|
7734
|
+
if (Ii(node)) return node
|
|
7735
|
+
if (lr(node) && node.getParent() && Ii(node.getParent())) {
|
|
7348
7736
|
return node.getParent()
|
|
7349
7737
|
}
|
|
7350
7738
|
return null
|
|
@@ -7372,9 +7760,9 @@ class Contents {
|
|
|
7372
7760
|
const lines = Array.from(lineSet);
|
|
7373
7761
|
|
|
7374
7762
|
lines.forEach((lineText, index) => {
|
|
7375
|
-
wrappingNode.append(
|
|
7763
|
+
wrappingNode.append(sr(lineText));
|
|
7376
7764
|
if (index < lines.length - 1) {
|
|
7377
|
-
wrappingNode.append(
|
|
7765
|
+
wrappingNode.append(Jn());
|
|
7378
7766
|
}
|
|
7379
7767
|
});
|
|
7380
7768
|
|
|
@@ -7399,7 +7787,7 @@ class Contents {
|
|
|
7399
7787
|
// with node.remove()
|
|
7400
7788
|
nodes.forEach((node) => {
|
|
7401
7789
|
const parent = node.getParent();
|
|
7402
|
-
if (!
|
|
7790
|
+
if (!Si(parent)) return
|
|
7403
7791
|
|
|
7404
7792
|
const children = parent.getChildren();
|
|
7405
7793
|
const index = children.indexOf(node);
|
|
@@ -7418,13 +7806,13 @@ class Contents {
|
|
|
7418
7806
|
}
|
|
7419
7807
|
|
|
7420
7808
|
#selectAfterDeletion(focusNode) {
|
|
7421
|
-
const root =
|
|
7809
|
+
const root = No();
|
|
7422
7810
|
if (root.getChildrenSize() === 0) {
|
|
7423
|
-
const newParagraph =
|
|
7811
|
+
const newParagraph = Li();
|
|
7424
7812
|
root.append(newParagraph);
|
|
7425
7813
|
newParagraph.selectStart();
|
|
7426
7814
|
} else if (focusNode) {
|
|
7427
|
-
if (
|
|
7815
|
+
if (lr(focusNode) || Ii(focusNode)) {
|
|
7428
7816
|
focusNode.selectEnd();
|
|
7429
7817
|
} else {
|
|
7430
7818
|
focusNode.selectNext(0, 0);
|
|
@@ -7442,7 +7830,7 @@ class Contents {
|
|
|
7442
7830
|
if (listItem) {
|
|
7443
7831
|
listItems.add(listItem);
|
|
7444
7832
|
const parentList = listItem.getParent();
|
|
7445
|
-
if (parentList &&
|
|
7833
|
+
if (parentList && dt$1(parentList)) {
|
|
7446
7834
|
parentLists.add(parentList);
|
|
7447
7835
|
}
|
|
7448
7836
|
}
|
|
@@ -7466,9 +7854,9 @@ class Contents {
|
|
|
7466
7854
|
|
|
7467
7855
|
#convertListItemToParagraph(listItem) {
|
|
7468
7856
|
const parentList = listItem.getParent();
|
|
7469
|
-
if (!parentList || !
|
|
7857
|
+
if (!parentList || !dt$1(parentList)) return null
|
|
7470
7858
|
|
|
7471
|
-
const paragraph =
|
|
7859
|
+
const paragraph = Li();
|
|
7472
7860
|
const sublists = this.#extractSublistsAndContent(listItem, paragraph);
|
|
7473
7861
|
|
|
7474
7862
|
listItem.insertAfter(paragraph);
|
|
@@ -7482,7 +7870,7 @@ class Contents {
|
|
|
7482
7870
|
const sublists = [];
|
|
7483
7871
|
|
|
7484
7872
|
listItem.getChildren().forEach((child) => {
|
|
7485
|
-
if (
|
|
7873
|
+
if (dt$1(child)) {
|
|
7486
7874
|
sublists.push(child);
|
|
7487
7875
|
} else {
|
|
7488
7876
|
paragraph.append(child);
|
|
@@ -7500,7 +7888,7 @@ class Contents {
|
|
|
7500
7888
|
|
|
7501
7889
|
#removeEmptyParentLists(parentLists) {
|
|
7502
7890
|
for (const parentList of parentLists) {
|
|
7503
|
-
if (
|
|
7891
|
+
if (dt$1(parentList) && parentList.getChildrenSize() === 0) {
|
|
7504
7892
|
parentList.remove();
|
|
7505
7893
|
}
|
|
7506
7894
|
}
|
|
@@ -7521,21 +7909,21 @@ class Contents {
|
|
|
7521
7909
|
|
|
7522
7910
|
#selectParagraphRange(firstParagraph, lastParagraph) {
|
|
7523
7911
|
firstParagraph.selectStart();
|
|
7524
|
-
const currentSelection =
|
|
7525
|
-
if (currentSelection &&
|
|
7912
|
+
const currentSelection = Lr();
|
|
7913
|
+
if (currentSelection && yr(currentSelection)) {
|
|
7526
7914
|
currentSelection.anchor.set(firstParagraph.getKey(), 0, "element");
|
|
7527
7915
|
currentSelection.focus.set(lastParagraph.getKey(), lastParagraph.getChildrenSize(), "element");
|
|
7528
7916
|
}
|
|
7529
7917
|
}
|
|
7530
7918
|
|
|
7531
7919
|
#getTextAnchorData() {
|
|
7532
|
-
const selection =
|
|
7920
|
+
const selection = Lr();
|
|
7533
7921
|
if (!selection || !selection.isCollapsed()) return { anchorNode: null, offset: 0 }
|
|
7534
7922
|
|
|
7535
7923
|
const anchor = selection.anchor;
|
|
7536
7924
|
const anchorNode = anchor.getNode();
|
|
7537
7925
|
|
|
7538
|
-
if (!
|
|
7926
|
+
if (!lr(anchorNode)) return { anchorNode: null, offset: 0 }
|
|
7539
7927
|
|
|
7540
7928
|
return { anchorNode, offset: anchor.offset }
|
|
7541
7929
|
}
|
|
@@ -7551,8 +7939,8 @@ class Contents {
|
|
|
7551
7939
|
const textBeforeString = fullText.slice(0, lastIndex);
|
|
7552
7940
|
const textAfterCursor = fullText.slice(offset);
|
|
7553
7941
|
|
|
7554
|
-
const textNodeBefore =
|
|
7555
|
-
const textNodeAfter =
|
|
7942
|
+
const textNodeBefore = sr(textBeforeString);
|
|
7943
|
+
const textNodeAfter = sr(textAfterCursor || " ");
|
|
7556
7944
|
|
|
7557
7945
|
anchorNode.replace(textNodeBefore);
|
|
7558
7946
|
|
|
@@ -7573,13 +7961,13 @@ class Contents {
|
|
|
7573
7961
|
}
|
|
7574
7962
|
|
|
7575
7963
|
#appendLineBreakIfNeeded(paragraph) {
|
|
7576
|
-
if (
|
|
7964
|
+
if (Ii(paragraph) && !this.editorElement.isSingleLineMode) {
|
|
7577
7965
|
const children = paragraph.getChildren();
|
|
7578
7966
|
const last = children[children.length - 1];
|
|
7579
7967
|
const beforeLast = children[children.length - 2];
|
|
7580
7968
|
|
|
7581
|
-
if (
|
|
7582
|
-
paragraph.append(
|
|
7969
|
+
if (lr(last) && last.getTextContent() === "" && (beforeLast && !lr(beforeLast))) {
|
|
7970
|
+
paragraph.append(Jn());
|
|
7583
7971
|
}
|
|
7584
7972
|
}
|
|
7585
7973
|
}
|
|
@@ -7595,8 +7983,8 @@ class Contents {
|
|
|
7595
7983
|
}
|
|
7596
7984
|
|
|
7597
7985
|
#createHtmlNodeWith(html) {
|
|
7598
|
-
const htmlNodes =
|
|
7599
|
-
return htmlNodes[0] ||
|
|
7986
|
+
const htmlNodes = m$1(this.editor, parseHtml(html));
|
|
7987
|
+
return htmlNodes[0] || Li()
|
|
7600
7988
|
}
|
|
7601
7989
|
|
|
7602
7990
|
#shouldUploadFile(file) {
|
|
@@ -7605,7 +7993,7 @@ class Contents {
|
|
|
7605
7993
|
}
|
|
7606
7994
|
|
|
7607
7995
|
/**
|
|
7608
|
-
* marked v16.
|
|
7996
|
+
* marked v16.4.1 - a markdown parser
|
|
7609
7997
|
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
7610
7998
|
* https://github.com/markedjs/marked
|
|
7611
7999
|
*/
|
|
@@ -7615,32 +8003,32 @@ class Contents {
|
|
|
7615
8003
|
* The code in this file is generated from files in ./src/
|
|
7616
8004
|
*/
|
|
7617
8005
|
|
|
7618
|
-
function L(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var
|
|
7619
|
-
]`).replace("lheading",
|
|
8006
|
+
function L(){return {async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var T=L();function G(u){T=u;}var I={exec:()=>null};function h(u,e=""){let t=typeof u=="string"?u:u.source,n={replace:(r,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(m.caret,"$1"),t=t.replace(r,s),n},getRegex:()=>new RegExp(t,e)};return n}var m={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:u=>new RegExp(`^( {0,3}${u})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}#`),htmlBeginRegex:u=>new RegExp(`^ {0,${Math.min(3,u-1)}}<(?:[a-z].*>|!--)`,"i")},be=/^(?:[ \t]*(?:\n|$))+/,Re=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Te=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Oe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,F=/(?:[*+-]|\d{1,9}[.)])/,ie=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,oe=h(ie).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),we=h(ie).replace(/bull/g,F).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),j=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ye=/^[^\n]+/,Q=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Pe=h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Q).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Se=h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,F).getRegex(),v="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$e=h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U).replace("tag",v).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae=h(j).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),_e=h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ae).getRegex(),K={blockquote:_e,code:Re,def:Pe,fences:Te,heading:Oe,hr:E,html:$e,lheading:oe,list:Se,newline:be,paragraph:ae,table:I,text:ye},re=h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex(),Le={...K,lheading:we,table:re,paragraph:h(j).replace("hr",E).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",re).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",v).getRegex()},Me={...K,html:h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:I,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:h(j).replace("hr",E).replace("heading",` *#{1,6} *[^
|
|
8007
|
+
]`).replace("lheading",oe).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ze=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ae=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,le=/^( {2,}|\\)\n(?!\s*$)/,Ie=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,W=/[\s\p{P}\p{S}]/u,ue=/[^\s\p{P}\p{S}]/u,Ee=h(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,W).getRegex(),pe=/(?!~)[\p{P}\p{S}]/u,Ce=/(?!~)[\s\p{P}\p{S}]/u,Be=/(?:[^\s\p{P}\p{S}]|~)/u,qe=h(/link|code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("code",/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ce=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ve=h(ce,"u").replace(/punct/g,D).getRegex(),De=h(ce,"u").replace(/punct/g,pe).getRegex(),he="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",He=h(he,"gu").replace(/notPunctSpace/g,ue).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ze=h(he,"gu").replace(/notPunctSpace/g,Be).replace(/punctSpace/g,Ce).replace(/punct/g,pe).getRegex(),Ge=h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ue).replace(/punctSpace/g,W).replace(/punct/g,D).getRegex(),Ne=h(/\\(punct)/,"gu").replace(/punct/g,D).getRegex(),Fe=h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),je=h(U).replace("(?:-->|$)","-->").getRegex(),Qe=h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",je).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),q=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,Ue=h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",q).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),de=h(/^!?\[(label)\]\[(ref)\]/).replace("label",q).replace("ref",Q).getRegex(),ke=h(/^!?\[(ref)\](?:\[\])?/).replace("ref",Q).getRegex(),Ke=h("reflink|nolink(?!\\()","g").replace("reflink",de).replace("nolink",ke).getRegex(),se=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,X={_backpedal:I,anyPunctuation:Ne,autolink:Fe,blockSkip:qe,br:le,code:Ae,del:I,emStrongLDelim:ve,emStrongRDelimAst:He,emStrongRDelimUnd:Ge,escape:ze,link:Ue,nolink:ke,punctuation:Ee,reflink:de,reflinkSearch:Ke,tag:Qe,text:Ie,url:I},We={...X,link:h(/^!?\[(label)\]\((.*?)\)/).replace("label",q).getRegex(),reflink:h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q).getRegex()},N={...X,emStrongRDelimAst:Ze,emStrongLDelim:De,url:h(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",se).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:h(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",se).getRegex()},Xe={...N,br:h(le).replace("{2,}","*").getRegex(),text:h(N.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},C={normal:K,gfm:Le,pedantic:Me},M={normal:X,gfm:N,breaks:Xe,pedantic:We};var Je={"&":"&","<":"<",">":">",'"':""","'":"'"},ge=u=>Je[u];function w(u,e){if(e){if(m.escapeTest.test(u))return u.replace(m.escapeReplace,ge)}else if(m.escapeTestNoEncode.test(u))return u.replace(m.escapeReplaceNoEncode,ge);return u}function J(u){try{u=encodeURI(u).replace(m.percentDecode,"%");}catch{return null}return u}function V(u,e){let t=u.replace(m.findPipe,(i,s,o)=>{let a=false,l=s;for(;--l>=0&&o[l]==="\\";)a=!a;return a?"|":" |"}),n=t.split(m.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(m.slashPipe,"|");return n}function z(u,e,t){let n=u.length;if(n===0)return "";let r=0;for(;r<n;){let i=u.charAt(n-r-1);if(i===e&&true)r++;else break}return u.slice(0,n-r)}function fe(u,e){if(u.indexOf(e[1])===-1)return -1;let t=0;for(let n=0;n<u.length;n++)if(u[n]==="\\")n++;else if(u[n]===e[0])t++;else if(u[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function me(u,e,t,n,r){let i=e.href,s=e.title||null,o=u[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=true;let a={type:u[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:o,tokens:n.inlineTokens(o)};return n.state.inLink=false,a}function Ve(u,e,t){let n=u.match(t.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
|
|
7620
8008
|
`).map(i=>{let s=i.match(t.other.beginningSpace);if(s===null)return i;let[o]=s;return o.length>=r.length?i.slice(r.length):i}).join(`
|
|
7621
|
-
`)}var y=class{options;rules;lexer;constructor(e){this.options=e||
|
|
7622
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=
|
|
8009
|
+
`)}var y=class{options;rules;lexer;constructor(e){this.options=e||T;}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return {type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return {type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:z(n,`
|
|
8010
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Ve(n,t[3]||"",this.rules);return {type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=z(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim());}return {type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return {type:"hr",raw:z(t[0],`
|
|
7623
8011
|
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=z(t[0],`
|
|
7624
8012
|
`).split(`
|
|
7625
|
-
`),r="",i="",s=[];for(;n.length>0;){let o=false,a=[],
|
|
7626
|
-
`),c
|
|
8013
|
+
`),r="",i="",s=[];for(;n.length>0;){let o=false,a=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),o=true;else if(!o)a.push(n[l]);else break;n=n.slice(l);let c=a.join(`
|
|
8014
|
+
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
7627
8015
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
7628
|
-
${
|
|
7629
|
-
${
|
|
8016
|
+
${c}`:c,i=i?`${i}
|
|
8017
|
+
${p}`:p;let g=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.blockTokens(p,s,true),this.lexer.state.top=g,n.length===0)break;let d=s.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let R=d,f=R.raw+`
|
|
7630
8018
|
`+n.join(`
|
|
7631
|
-
`),
|
|
8019
|
+
`),O=this.blockquote(f);s[s.length-1]=O,r=r.substring(0,r.length-R.raw.length)+O.raw,i=i.substring(0,i.length-R.text.length)+O.text;break}else if(d?.type==="list"){let R=d,f=R.raw+`
|
|
7632
8020
|
`+n.join(`
|
|
7633
|
-
`),
|
|
7634
|
-
`);continue}}return {type:"blockquote",raw:r,tokens:s,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:false,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=false;for(;e;){let
|
|
7635
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,H=>" ".repeat(3*H.length)),
|
|
7636
|
-
`,1)[0],
|
|
7637
|
-
`,e=e.substring(
|
|
7638
|
-
`,1)[0],A;if(
|
|
7639
|
-
`+A.slice(
|
|
7640
|
-
`+
|
|
7641
|
-
`,e=e.substring(Z.length+1),
|
|
7642
|
-
`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:s.align[o]});for(let o of i)s.rows.push(V(o,s.header.length).map((a,
|
|
7643
|
-
`?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=z(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=
|
|
8021
|
+
`),O=this.list(f);s[s.length-1]=O,r=r.substring(0,r.length-d.raw.length)+O.raw,i=i.substring(0,i.length-R.raw.length)+O.raw,n=f.substring(s.at(-1).raw.length).split(`
|
|
8022
|
+
`);continue}}return {type:"blockquote",raw:r,tokens:s,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:false,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=false;for(;e;){let l=false,c="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let g=t[2].split(`
|
|
8023
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,H=>" ".repeat(3*H.length)),d=e.split(`
|
|
8024
|
+
`,1)[0],R=!g.trim(),f=0;if(this.options.pedantic?(f=2,p=g.trimStart()):R?f=t[1].length+1:(f=t[2].search(this.rules.other.nonSpaceChar),f=f>4?1:f,p=g.slice(f),f+=t[1].length),R&&this.rules.other.blankLine.test(d)&&(c+=d+`
|
|
8025
|
+
`,e=e.substring(d.length+1),l=true),!l){let H=this.rules.other.nextBulletRegex(f),ee=this.rules.other.hrRegex(f),te=this.rules.other.fencesBeginRegex(f),ne=this.rules.other.headingBeginRegex(f),xe=this.rules.other.htmlBeginRegex(f);for(;e;){let Z=e.split(`
|
|
8026
|
+
`,1)[0],A;if(d=Z,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),A=d):A=d.replace(this.rules.other.tabCharGlobal," "),te.test(d)||ne.test(d)||xe.test(d)||H.test(d)||ee.test(d))break;if(A.search(this.rules.other.nonSpaceChar)>=f||!d.trim())p+=`
|
|
8027
|
+
`+A.slice(f);else {if(R||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(g)||ne.test(g)||ee.test(g))break;p+=`
|
|
8028
|
+
`+d;}!R&&!d.trim()&&(R=true),c+=Z+`
|
|
8029
|
+
`,e=e.substring(Z.length+1),g=A.slice(f);}}i.loose||(o?i.loose=true:this.rules.other.doubleBlankLine.test(c)&&(o=true));let O=null,Y;this.options.gfm&&(O=this.rules.other.listIsTask.exec(p),O&&(Y=O[0]!=="[ ] ",p=p.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:c,task:!!O,checked:Y,loose:false,text:p,tokens:[]}),i.raw+=c;}let a=i.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let l=0;l<i.items.length;l++)if(this.lexer.state.top=false,i.items[l].tokens=this.lexer.blockTokens(i.items[l].text,[]),!i.loose){let c=i.items[l].tokens.filter(g=>g.type==="space"),p=c.length>0&&c.some(g=>this.rules.other.anyLine.test(g.raw));i.loose=p;}if(i.loose)for(let l=0;l<i.items.length;l++)i.items[l].loose=true;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return {type:"html",block:true,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return {type:"def",tag:n,raw:t[0],href:r,title:i}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=V(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
8030
|
+
`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?s.align.push("right"):this.rules.other.tableAlignCenter.test(o)?s.align.push("center"):this.rules.other.tableAlignLeft.test(o)?s.align.push("left"):s.align.push(null);for(let o=0;o<n.length;o++)s.header.push({text:n[o],tokens:this.lexer.inline(n[o]),header:true,align:s.align[o]});for(let o of i)s.rows.push(V(o,s.header.length).map((a,l)=>({text:a,tokens:this.lexer.inline(a),header:false,align:s.align[l]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return {type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
8031
|
+
`?t[1].slice(0,-1):t[1];return {type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return {type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return {type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return !this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=true:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=false),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=true:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=false),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:false,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=z(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else {let s=fe(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]="";}}let r=t[2],i="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],i=s[3]);}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),me(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let s=n[0].charAt(0);return {type:"text",raw:s,text:s}}return me(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){let s=[...r[0]].length-1,o,a,l=s,c=0,p=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(r=p.exec(t))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(a=[...o].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&s%3&&!((s+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);let g=[...r[0]][0].length,d=e.slice(0,s+r.index+g+a);if(Math.min(s,a)%2){let f=d.slice(1,-1);return {type:"em",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}let R=d.slice(2,-2);return {type:"strong",raw:d,text:R,tokens:this.lexer.inlineTokens(R)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),i=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&i&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return {type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return {type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let n,r;if(t[2]==="@")n=t[0],r="mailto:"+n;else {let i;do i=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(i!==t[0]);n=t[0],t[1]==="www."?r="http://"+t[0]:r=t[0];}return {type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return {type:"text",raw:t[0],text:t[0],escaped:n}}}};var x=class u{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||T,this.options.tokenizer=this.options.tokenizer||new y,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:false,inRawBlock:false,top:true};let t={other:m,block:C.normal,inline:M.normal};this.options.pedantic?(t.block=C.pedantic,t.inline=M.pedantic):this.options.gfm&&(t.block=C.gfm,this.options.breaks?t.inline=M.breaks:t.inline=M.gfm),this.tokenizer.rules=t;}static get rules(){return {block:C,inline:M}}static lex(e,t){return new u(t).lex(e)}static lexInline(e,t){return new u(t).inlineTokens(e)}lex(e){e=e.replace(m.carriageReturn,`
|
|
7644
8032
|
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens);}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=false){for(this.options.pedantic&&(e=e.replace(m.tabCharGlobal," ").replace(m.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(s=>(r=s.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),true):false))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let s=t.at(-1);r.raw.length===1&&s!==void 0?s.raw+=`
|
|
7645
8033
|
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
7646
8034
|
`)?"":`
|
|
@@ -7648,13 +8036,13 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=true,this.lexer.block
|
|
|
7648
8036
|
`+r.text,this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="paragraph"||s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
7649
8037
|
`)?"":`
|
|
7650
8038
|
`)+r.raw,s.text+=`
|
|
7651
|
-
`+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(
|
|
8039
|
+
`+r.raw,this.inlineQueue.at(-1).src=s.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let s=1/0,o=e.slice(1),a;this.options.extensions.startBlock.forEach(l=>{a=l.call({lexer:this},o),typeof a=="number"&&a>=0&&(s=Math.min(s,a));}),s<1/0&&s>=0&&(i=e.substring(0,s+1));}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(`
|
|
7652
8040
|
`)?"":`
|
|
7653
8041
|
`)+r.raw,s.text+=`
|
|
7654
8042
|
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let s=t.at(-1);s?.type==="text"?(s.raw+=(s.raw.endsWith(`
|
|
7655
8043
|
`)?"":`
|
|
7656
8044
|
`)+r.raw,s.text+=`
|
|
7657
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=false,s="";for(;e;){i||(s=""),i=false;let o;if(this.options.extensions?.inline?.some(
|
|
8045
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r);continue}if(e){let s="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=true,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let o=Object.keys(this.tokens.links);if(o.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)o.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=false,s="";for(;e;){i||(s=""),i=false;let o;if(this.options.extensions?.inline?.some(l=>(o=l.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),true):false))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let l=t.at(-1);o.type==="text"&&l?.type==="text"?(l.raw+=o.raw,l.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,s)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let a=e;if(this.options.extensions?.startInline){let l=1/0,c=e.slice(1),p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},c),typeof p=="number"&&p>=0&&(l=Math.min(l,p));}),l<1/0&&l>=0&&(a=e.substring(0,l+1));}if(o=this.tokenizer.inlineText(a)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=true;let l=t.at(-1);l?.type==="text"?(l.raw+=o.raw,l.text+=o.text):t.push(o);continue}if(e){let l="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return t}};var P=class{options;parser;constructor(e){this.options=e||T;}space(e){return ""}code({text:e,lang:t,escaped:n}){let r=(t||"").match(m.notSpaceStart)?.[0],i=e.replace(m.endingNewline,"")+`
|
|
7658
8046
|
`;return r?'<pre><code class="language-'+w(r)+'">'+(n?i:w(i,true))+`</code></pre>
|
|
7659
8047
|
`:"<pre><code>"+(n?i:w(i,true))+`</code></pre>
|
|
7660
8048
|
`}blockquote({tokens:e}){return `<blockquote>
|
|
@@ -7672,9 +8060,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
7672
8060
|
`}tablerow({text:e}){return `<tr>
|
|
7673
8061
|
${e}</tr>
|
|
7674
8062
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return (e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
7675
|
-
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${w(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=J(e);if(i===null)return r;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+w(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=J(e);if(i===null)return w(n);e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${w(t)}"`),s+=">",s}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:w(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}};var
|
|
7676
|
-
`+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a,escaped:true}]}):n+=a;continue}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let s=i;switch(s.type){case "escape":{n+=t.text(s);break}case "html":{n+=t.html(s);break}case "link":{n+=t.link(s);break}case "image":{n+=t.image(s);break}case "strong":{n+=t.strong(s);break}case "em":{n+=t.em(s);break}case "codespan":{n+=t.codespan(s);break}case "br":{n+=t.br(s);break}case "del":{n+=t.del(s);break}case "text":{n+=t.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var S=class{options;block;constructor(e){this.options=e||
|
|
7677
|
-
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+w(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var _=new B;function
|
|
8063
|
+
`}strong({tokens:e}){return `<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return `<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return `<code>${w(e,true)}</code>`}br(e){return "<br>"}del({tokens:e}){return `<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=J(e);if(i===null)return r;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+w(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=J(e);if(i===null)return w(n);e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${w(t)}"`),s+=">",s}text(e){return "tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:w(e.text)}};var $=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return ""+e}image({text:e}){return ""+e}br(){return ""}};var b=class u{options;renderer;textRenderer;constructor(e){this.options=e||T,this.options.renderer=this.options.renderer||new P,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new $;}static parse(e,t){return new u(t).parse(e)}static parseInline(e,t){return new u(t).parseInline(e)}parse(e,t=true){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=i,a=this.options.extensions.renderers[o.type].call({parser:this},o);if(a!==false||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(o.type)){n+=a||"";continue}}let s=i;switch(s.type){case "space":{n+=this.renderer.space(s);continue}case "hr":{n+=this.renderer.hr(s);continue}case "heading":{n+=this.renderer.heading(s);continue}case "code":{n+=this.renderer.code(s);continue}case "table":{n+=this.renderer.table(s);continue}case "blockquote":{n+=this.renderer.blockquote(s);continue}case "list":{n+=this.renderer.list(s);continue}case "html":{n+=this.renderer.html(s);continue}case "def":{n+=this.renderer.def(s);continue}case "paragraph":{n+=this.renderer.paragraph(s);continue}case "text":{let o=s,a=this.renderer.text(o);for(;r+1<e.length&&e[r+1].type==="text";)o=e[++r],a+=`
|
|
8064
|
+
`+this.renderer.text(o);t?n+=this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a,escaped:true}]}):n+=a;continue}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let o=this.options.extensions.renderers[i.type].call({parser:this},i);if(o!==false||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=o||"";continue}}let s=i;switch(s.type){case "escape":{n+=t.text(s);break}case "html":{n+=t.html(s);break}case "link":{n+=t.link(s);break}case "image":{n+=t.image(s);break}case "strong":{n+=t.strong(s);break}case "em":{n+=t.em(s);break}case "codespan":{n+=t.codespan(s);break}case "br":{n+=t.br(s);break}case "del":{n+=t.del(s);break}case "text":{n+=t.text(s);break}default:{let o='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return n}};var S=class{options;block;constructor(e){this.options=e||T;}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?x.lex:x.lexInline}provideParser(){return this.block?b.parse:b.parseInline}};var B=class{defaults=L();options=this.setOptions;parse=this.parseMarkdown(true);parseInline=this.parseMarkdown(false);Parser=b;Renderer=P;TextRenderer=$;Lexer=x;Tokenizer=y;Hooks=S;constructor(...e){this.use(...e);}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case "table":{let i=r;for(let s of i.header)n=n.concat(this.walkTokens(s.tokens,t));for(let s of i.rows)for(let o of s)n=n.concat(this.walkTokens(o.tokens,t));break}case "list":{let i=r;n=n.concat(this.walkTokens(i.items,t));break}default:{let i=r;this.defaults.extensions?.childTokens?.[i.type]?this.defaults.extensions.childTokens[i.type].forEach(s=>{let o=i[s].flat(1/0);n=n.concat(this.walkTokens(o,t));}):i.tokens&&(n=n.concat(this.walkTokens(i.tokens,t)));}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...n};if(r.async=this.defaults.async||r.async||false,n.extensions&&(n.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=t.renderers[i.name];s?t.renderers[i.name]=function(...o){let a=i.renderer.apply(this,o);return a===false&&(a=s.apply(this,o)),a}:t.renderers[i.name]=i.renderer;}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]));}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens);}),r.extensions=t),n.renderer){let i=this.defaults.renderer||new P(this.defaults);for(let s in n.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let o=s,a=n.renderer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p||""};}r.renderer=i;}if(n.tokenizer){let i=this.defaults.tokenizer||new y(this.defaults);for(let s in n.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let o=s,a=n.tokenizer[o],l=i[o];i[o]=(...c)=>{let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p};}r.tokenizer=i;}if(n.hooks){let i=this.defaults.hooks||new S;for(let s in n.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let o=s,a=n.hooks[o],l=i[o];S.passThroughHooks.has(s)?i[o]=c=>{if(this.defaults.async&&S.passThroughHooksRespectAsync.has(s))return (async()=>{let g=await a.call(i,c);return l.call(i,g)})();let p=a.call(i,c);return l.call(i,p)}:i[o]=(...c)=>{if(this.defaults.async)return (async()=>{let g=await a.apply(i,c);return g===false&&(g=await l.apply(i,c)),g})();let p=a.apply(i,c);return p===false&&(p=l.apply(i,c)),p};}r.hooks=i;}if(n.walkTokens){let i=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(o){let a=[];return a.push(s.call(this,o)),i&&(a=a.concat(i.call(this,o))),a};}this.defaults={...this.defaults,...r};}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return x.lex(e,t??this.defaults)}parser(e,t){return b.parse(e,t??this.defaults)}parseMarkdown(e){return (n,r)=>{let i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===true&&i.async===false)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return (async()=>{let a=s.hooks?await s.hooks.preprocess(n):n,c=await(s.hooks?await s.hooks.provideLexer():e?x.lex:x.lexInline)(a,s),p=s.hooks?await s.hooks.processAllTokens(c):c;s.walkTokens&&await Promise.all(this.walkTokens(p,s.walkTokens));let d=await(s.hooks?await s.hooks.provideParser():e?b.parse:b.parseInline)(p,s);return s.hooks?await s.hooks.postprocess(d):d})().catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let l=(s.hooks?s.hooks.provideLexer():e?x.lex:x.lexInline)(n,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let p=(s.hooks?s.hooks.provideParser():e?b.parse:b.parseInline)(l,s);return s.hooks&&(p=s.hooks.postprocess(p)),p}catch(a){return o(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
8065
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+w(n.message+"",true)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}};var _=new B;function k(u,e){return _.parse(u,e)}k.options=k.setOptions=function(u){return _.setOptions(u),k.defaults=_.defaults,G(k.defaults),k};k.getDefaults=L;k.defaults=T;k.use=function(...u){return _.use(...u),k.defaults=_.defaults,G(k.defaults),k};k.walkTokens=function(u,e){return _.walkTokens(u,e)};k.parseInline=_.parseInline;k.Parser=b;k.parser=b.parse;k.Renderer=P;k.TextRenderer=$;k.Lexer=x;k.lexer=x.lex;k.Tokenizer=y;k.Hooks=S;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;b.parse;x.lex;
|
|
7678
8066
|
|
|
7679
8067
|
function isUrl(string) {
|
|
7680
8068
|
try {
|
|
@@ -7707,7 +8095,7 @@ class Clipboard {
|
|
|
7707
8095
|
|
|
7708
8096
|
if (!clipboardData) return false
|
|
7709
8097
|
|
|
7710
|
-
if (this.#isOnlyPlainTextPasted(clipboardData)) {
|
|
8098
|
+
if (this.#isOnlyPlainTextPasted(clipboardData) && !this.#isPastingIntoCodeBlock()) {
|
|
7711
8099
|
this.#pastePlainText(clipboardData);
|
|
7712
8100
|
event.preventDefault();
|
|
7713
8101
|
return true
|
|
@@ -7721,6 +8109,27 @@ class Clipboard {
|
|
|
7721
8109
|
return types.length === 1 && types[0] === "text/plain"
|
|
7722
8110
|
}
|
|
7723
8111
|
|
|
8112
|
+
#isPastingIntoCodeBlock() {
|
|
8113
|
+
let result = false;
|
|
8114
|
+
|
|
8115
|
+
this.editor.getEditorState().read(() => {
|
|
8116
|
+
const selection = Lr();
|
|
8117
|
+
if (!yr(selection)) return
|
|
8118
|
+
|
|
8119
|
+
let currentNode = selection.anchor.getNode();
|
|
8120
|
+
|
|
8121
|
+
while (currentNode) {
|
|
8122
|
+
if (X$1(currentNode)) {
|
|
8123
|
+
result = true;
|
|
8124
|
+
return
|
|
8125
|
+
}
|
|
8126
|
+
currentNode = currentNode.getParent();
|
|
8127
|
+
}
|
|
8128
|
+
});
|
|
8129
|
+
|
|
8130
|
+
return result
|
|
8131
|
+
}
|
|
8132
|
+
|
|
7724
8133
|
#pastePlainText(clipboardData) {
|
|
7725
8134
|
const item = clipboardData.items[0];
|
|
7726
8135
|
item.getAsString((text) => {
|
|
@@ -7748,7 +8157,7 @@ class Clipboard {
|
|
|
7748
8157
|
}
|
|
7749
8158
|
|
|
7750
8159
|
#pasteMarkdown(text) {
|
|
7751
|
-
const html =
|
|
8160
|
+
const html = k(text);
|
|
7752
8161
|
this.contents.insertHtml(html);
|
|
7753
8162
|
}
|
|
7754
8163
|
|
|
@@ -7832,7 +8241,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7832
8241
|
|
|
7833
8242
|
formResetCallback() {
|
|
7834
8243
|
this.value = this.#initialValue;
|
|
7835
|
-
this.editor.dispatchCommand(
|
|
8244
|
+
this.editor.dispatchCommand(je$1, undefined);
|
|
7836
8245
|
}
|
|
7837
8246
|
|
|
7838
8247
|
get form() {
|
|
@@ -7869,7 +8278,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7869
8278
|
get value() {
|
|
7870
8279
|
if (!this.cachedValue) {
|
|
7871
8280
|
this.editor?.getEditorState().read(() => {
|
|
7872
|
-
this.cachedValue = sanitize(
|
|
8281
|
+
this.cachedValue = sanitize(g(this.editor, null));
|
|
7873
8282
|
});
|
|
7874
8283
|
}
|
|
7875
8284
|
|
|
@@ -7878,8 +8287,8 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7878
8287
|
|
|
7879
8288
|
set value(html) {
|
|
7880
8289
|
this.editor.update(() => {
|
|
7881
|
-
|
|
7882
|
-
const root =
|
|
8290
|
+
ns(zn);
|
|
8291
|
+
const root = No();
|
|
7883
8292
|
root.clear();
|
|
7884
8293
|
if (html !== "") root.append(...this.#parseHtmlIntoLexicalNodes(html));
|
|
7885
8294
|
root.select();
|
|
@@ -7895,13 +8304,13 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7895
8304
|
|
|
7896
8305
|
#parseHtmlIntoLexicalNodes(html) {
|
|
7897
8306
|
if (!html) html = "<p></p>";
|
|
7898
|
-
const nodes =
|
|
8307
|
+
const nodes = m$1(this.editor, parseHtml(`<div>${html}</div>`));
|
|
7899
8308
|
// Custom decorator block elements such action-text-attachments get wrapped into <p> automatically by Lexical.
|
|
7900
8309
|
// We flatten those.
|
|
7901
8310
|
return nodes.map(node => {
|
|
7902
8311
|
if (node.getType() === "paragraph" && node.getChildrenSize() === 1) {
|
|
7903
8312
|
const child = node.getFirstChild();
|
|
7904
|
-
if (child instanceof
|
|
8313
|
+
if (child instanceof ki && !child.isInline()) {
|
|
7905
8314
|
return child
|
|
7906
8315
|
}
|
|
7907
8316
|
}
|
|
@@ -7923,7 +8332,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7923
8332
|
#createEditor() {
|
|
7924
8333
|
this.editorContentElement = this.editorContentElement || this.#createEditorContentElement();
|
|
7925
8334
|
|
|
7926
|
-
const editor =
|
|
8335
|
+
const editor = $i({
|
|
7927
8336
|
namespace: "LexicalEditor",
|
|
7928
8337
|
onError(error) {
|
|
7929
8338
|
throw error
|
|
@@ -7939,14 +8348,14 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
7939
8348
|
|
|
7940
8349
|
get #lexicalNodes() {
|
|
7941
8350
|
const nodes = [
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
8351
|
+
Et$2,
|
|
8352
|
+
Pt$2,
|
|
8353
|
+
lt$2,
|
|
8354
|
+
nt$2,
|
|
8355
|
+
q$1,
|
|
8356
|
+
et$1,
|
|
8357
|
+
y$1,
|
|
8358
|
+
A,
|
|
7950
8359
|
HorizontalDividerNode,
|
|
7951
8360
|
|
|
7952
8361
|
CustomActionTextAttachmentNode,
|
|
@@ -8041,16 +8450,16 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8041
8450
|
}
|
|
8042
8451
|
|
|
8043
8452
|
#registerComponents() {
|
|
8044
|
-
|
|
8045
|
-
this.historyState =
|
|
8046
|
-
|
|
8047
|
-
|
|
8453
|
+
Jt(this.editor);
|
|
8454
|
+
this.historyState = w$1();
|
|
8455
|
+
b$1(this.editor, this.historyState, 20);
|
|
8456
|
+
bt$3(this.editor);
|
|
8048
8457
|
this.#registerCodeHiglightingComponents();
|
|
8049
|
-
|
|
8458
|
+
Dt(this.editor, zt);
|
|
8050
8459
|
}
|
|
8051
8460
|
|
|
8052
8461
|
#registerCodeHiglightingComponents() {
|
|
8053
|
-
|
|
8462
|
+
Et$1(this.editor);
|
|
8054
8463
|
this.append(createElement("lexxy-code-language-picker"));
|
|
8055
8464
|
}
|
|
8056
8465
|
|
|
@@ -8059,7 +8468,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8059
8468
|
const { key, values } = event.detail;
|
|
8060
8469
|
|
|
8061
8470
|
this.editor.update(() => {
|
|
8062
|
-
const node =
|
|
8471
|
+
const node = xo(key);
|
|
8063
8472
|
|
|
8064
8473
|
if (node instanceof ActionTextAttachmentNode) {
|
|
8065
8474
|
const updatedNode = node.getWritable();
|
|
@@ -8072,7 +8481,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8072
8481
|
#handleEnter() {
|
|
8073
8482
|
// We can't prevent these externally using regular keydown because Lexical handles it first.
|
|
8074
8483
|
this.editor.registerCommand(
|
|
8075
|
-
|
|
8484
|
+
Ne$1,
|
|
8076
8485
|
(event) => {
|
|
8077
8486
|
// Prevent CTRL+ENTER
|
|
8078
8487
|
if (event.ctrlKey || event.metaKey) {
|
|
@@ -8088,7 +8497,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
8088
8497
|
|
|
8089
8498
|
return false
|
|
8090
8499
|
},
|
|
8091
|
-
|
|
8500
|
+
Ri
|
|
8092
8501
|
);
|
|
8093
8502
|
}
|
|
8094
8503
|
|
|
@@ -8210,12 +8619,12 @@ class LinkDialog extends HTMLElement {
|
|
|
8210
8619
|
let url = "";
|
|
8211
8620
|
|
|
8212
8621
|
this.#editor.getEditorState().read(() => {
|
|
8213
|
-
const selection =
|
|
8214
|
-
if (!
|
|
8622
|
+
const selection = Lr();
|
|
8623
|
+
if (!yr(selection)) return
|
|
8215
8624
|
|
|
8216
8625
|
let node = selection.getNodes()[0];
|
|
8217
8626
|
while (node && node.getParent()) {
|
|
8218
|
-
if (
|
|
8627
|
+
if (w$2(node)) {
|
|
8219
8628
|
url = node.getURL();
|
|
8220
8629
|
break
|
|
8221
8630
|
}
|
|
@@ -8421,16 +8830,16 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8421
8830
|
#addTriggerListener() {
|
|
8422
8831
|
const unregister = this.#editor.registerUpdateListener(() => {
|
|
8423
8832
|
this.#editor.read(() => {
|
|
8424
|
-
const selection =
|
|
8833
|
+
const selection = Lr();
|
|
8425
8834
|
if (!selection) return
|
|
8426
8835
|
let node;
|
|
8427
|
-
if (
|
|
8836
|
+
if (yr(selection)) {
|
|
8428
8837
|
node = selection.anchor.getNode();
|
|
8429
|
-
} else if (
|
|
8838
|
+
} else if (xr(selection)) {
|
|
8430
8839
|
[ node ] = selection.getNodes();
|
|
8431
8840
|
}
|
|
8432
8841
|
|
|
8433
|
-
if (node &&
|
|
8842
|
+
if (node && lr(node)) {
|
|
8434
8843
|
const text = node.getTextContent().trim();
|
|
8435
8844
|
const lastChar = [ ...text ].pop();
|
|
8436
8845
|
|
|
@@ -8457,8 +8866,8 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8457
8866
|
|
|
8458
8867
|
async #showPopover() {
|
|
8459
8868
|
this.popoverElement ??= await this.#buildPopover();
|
|
8869
|
+
this.#resetPopoverPosition();
|
|
8460
8870
|
await this.#filterOptions();
|
|
8461
|
-
this.#positionPopover();
|
|
8462
8871
|
this.popoverElement.classList.toggle("lexxy-prompt-menu--visible", true);
|
|
8463
8872
|
this.#selectFirstOption();
|
|
8464
8873
|
|
|
@@ -8470,11 +8879,11 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8470
8879
|
|
|
8471
8880
|
#registerKeyListeners() {
|
|
8472
8881
|
// We can't use a regular keydown for Enter as Lexical handles it first
|
|
8473
|
-
this.keyListeners.push(this.#editor.registerCommand(
|
|
8474
|
-
this.keyListeners.push(this.#editor.registerCommand(
|
|
8882
|
+
this.keyListeners.push(this.#editor.registerCommand(Ne$1, this.#handleSelectedOption.bind(this), Bi));
|
|
8883
|
+
this.keyListeners.push(this.#editor.registerCommand(Me$1, this.#handleSelectedOption.bind(this), Bi));
|
|
8475
8884
|
|
|
8476
8885
|
if (this.#doesSpaceSelect) {
|
|
8477
|
-
this.keyListeners.push(this.#editor.registerCommand(
|
|
8886
|
+
this.keyListeners.push(this.#editor.registerCommand(be$1, this.#handleSelectedOption.bind(this), Bi));
|
|
8478
8887
|
}
|
|
8479
8888
|
}
|
|
8480
8889
|
|
|
@@ -8513,19 +8922,29 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8513
8922
|
const contentRect = this.#editorContentElement.getBoundingClientRect();
|
|
8514
8923
|
const verticalOffset = contentRect.top - editorRect.top;
|
|
8515
8924
|
|
|
8516
|
-
this.popoverElement.
|
|
8925
|
+
if (!this.popoverElement.hasAttribute("data-anchored")) {
|
|
8926
|
+
this.popoverElement.style.left = `${x}px`;
|
|
8927
|
+
this.popoverElement.toggleAttribute("data-anchored", true);
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8517
8930
|
this.popoverElement.style.top = `${y + verticalOffset}px`;
|
|
8518
8931
|
this.popoverElement.style.bottom = "auto";
|
|
8519
8932
|
|
|
8520
8933
|
const popoverRect = this.popoverElement.getBoundingClientRect();
|
|
8521
8934
|
const isClippedAtBottom = popoverRect.bottom > window.innerHeight;
|
|
8522
8935
|
|
|
8523
|
-
if (isClippedAtBottom) {
|
|
8524
|
-
this.popoverElement.style.
|
|
8525
|
-
this.popoverElement.style.
|
|
8936
|
+
if (isClippedAtBottom || this.popoverElement.hasAttribute("data-clipped-at-bottom")) {
|
|
8937
|
+
this.popoverElement.style.top = `${y + verticalOffset - popoverRect.height - fontSize}px`;
|
|
8938
|
+
this.popoverElement.style.bottom = "auto";
|
|
8939
|
+
this.popoverElement.toggleAttribute("data-clipped-at-bottom", true);
|
|
8526
8940
|
}
|
|
8527
8941
|
}
|
|
8528
8942
|
|
|
8943
|
+
#resetPopoverPosition() {
|
|
8944
|
+
this.popoverElement.removeAttribute("data-clipped-at-bottom");
|
|
8945
|
+
this.popoverElement.removeAttribute("data-anchored");
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8529
8948
|
async #hidePopover() {
|
|
8530
8949
|
this.#clearSelection();
|
|
8531
8950
|
this.popoverElement.classList.toggle("lexxy-prompt-menu--visible", false);
|
|
@@ -8551,6 +8970,7 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8551
8970
|
|
|
8552
8971
|
if (this.#editorContents.containsTextBackUntil(this.trigger)) {
|
|
8553
8972
|
await this.#showFilteredOptions();
|
|
8973
|
+
this.#positionPopover();
|
|
8554
8974
|
} else {
|
|
8555
8975
|
this.#hidePopover();
|
|
8556
8976
|
}
|
|
@@ -8649,7 +9069,7 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
8649
9069
|
|
|
8650
9070
|
#insertTemplateAsEditableText(template, stringToReplace) {
|
|
8651
9071
|
this.#editor.update(() => {
|
|
8652
|
-
const nodes =
|
|
9072
|
+
const nodes = m$1(this.#editor, parseHtml(`${template.innerHTML}`));
|
|
8653
9073
|
this.#editorContents.replaceTextBackUntil(stringToReplace, nodes);
|
|
8654
9074
|
});
|
|
8655
9075
|
}
|
|
@@ -8726,7 +9146,7 @@ class CodeLanguagePicker extends HTMLElement {
|
|
|
8726
9146
|
}
|
|
8727
9147
|
|
|
8728
9148
|
get #languages() {
|
|
8729
|
-
const languages = { ...
|
|
9149
|
+
const languages = { ...pt };
|
|
8730
9150
|
|
|
8731
9151
|
if (!languages.ruby) languages.ruby = "Ruby";
|
|
8732
9152
|
|
|
@@ -8764,18 +9184,18 @@ class CodeLanguagePicker extends HTMLElement {
|
|
|
8764
9184
|
}
|
|
8765
9185
|
|
|
8766
9186
|
#getCurrentCodeNode() {
|
|
8767
|
-
const selection =
|
|
9187
|
+
const selection = Lr();
|
|
8768
9188
|
|
|
8769
|
-
if (!
|
|
9189
|
+
if (!yr(selection)) {
|
|
8770
9190
|
return null
|
|
8771
9191
|
}
|
|
8772
9192
|
|
|
8773
9193
|
const anchorNode = selection.anchor.getNode();
|
|
8774
9194
|
const parentNode = anchorNode.getParent();
|
|
8775
9195
|
|
|
8776
|
-
if (
|
|
9196
|
+
if (X$1(anchorNode)) {
|
|
8777
9197
|
return anchorNode
|
|
8778
|
-
} else if (
|
|
9198
|
+
} else if (X$1(parentNode)) {
|
|
8779
9199
|
return parentNode
|
|
8780
9200
|
}
|
|
8781
9201
|
|
|
@@ -8792,7 +9212,7 @@ class CodeLanguagePicker extends HTMLElement {
|
|
|
8792
9212
|
|
|
8793
9213
|
#updateLanguagePickerWith(language) {
|
|
8794
9214
|
if (this.languagePickerElement && language) {
|
|
8795
|
-
const normalizedLanguage =
|
|
9215
|
+
const normalizedLanguage = dt(language);
|
|
8796
9216
|
this.languagePickerElement.value = normalizedLanguage;
|
|
8797
9217
|
}
|
|
8798
9218
|
}
|