lexical 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.dev.js CHANGED
@@ -253,7 +253,7 @@ function $flushMutations$1(editor, mutations, observer) {
253
253
  updateEditor(editor, () => {
254
254
  const selection = $getSelection() || getLastSelection(editor);
255
255
  const badDOMTargets = new Map();
256
- const rootElement = editor.getRootElement(); // We use the current edtior state, as that reflects what is
256
+ const rootElement = editor.getRootElement(); // We use the current editor state, as that reflects what is
257
257
  // actually "on screen".
258
258
 
259
259
  const currentEditorState = editor._editorState;
@@ -2071,7 +2071,7 @@ function getPrevElementByKeyOrThrow(key) {
2071
2071
  */
2072
2072
  const PASS_THROUGH_COMMAND = Object.freeze({});
2073
2073
  const ANDROID_COMPOSITION_LATENCY = 30;
2074
- const rootElementEvents = [['keydown', onKeyDown], ['compositionstart', onCompositionStart], ['compositionend', onCompositionEnd], ['input', onInput], ['click', onClick], ['cut', PASS_THROUGH_COMMAND], ['copy', PASS_THROUGH_COMMAND], ['dragstart', PASS_THROUGH_COMMAND], ['dragover', PASS_THROUGH_COMMAND], ['paste', PASS_THROUGH_COMMAND], ['focus', PASS_THROUGH_COMMAND], ['blur', PASS_THROUGH_COMMAND], ['drop', PASS_THROUGH_COMMAND]];
2074
+ const rootElementEvents = [['keydown', onKeyDown], ['compositionstart', onCompositionStart], ['compositionend', onCompositionEnd], ['input', onInput], ['click', onClick], ['cut', PASS_THROUGH_COMMAND], ['copy', PASS_THROUGH_COMMAND], ['dragstart', PASS_THROUGH_COMMAND], ['dragover', PASS_THROUGH_COMMAND], ['dragend', PASS_THROUGH_COMMAND], ['paste', PASS_THROUGH_COMMAND], ['focus', PASS_THROUGH_COMMAND], ['blur', PASS_THROUGH_COMMAND], ['drop', PASS_THROUGH_COMMAND]];
2075
2075
 
2076
2076
  if (CAN_USE_BEFORE_INPUT) {
2077
2077
  rootElementEvents.push(['beforeinput', (event, editor) => onBeforeInput(event, editor)]);
@@ -5645,16 +5645,17 @@ function triggerTextContentListeners(editor, currentEditorState, pendingEditorSt
5645
5645
  }
5646
5646
 
5647
5647
  function triggerMutationListeners(editor, currentEditorState, pendingEditorState, mutatedNodes) {
5648
- const listeners = editor._listeners.mutation;
5649
- listeners.forEach((klass, listener) => {
5648
+ const listeners = Array.from(editor._listeners.mutation);
5649
+ const listenersLength = listeners.length;
5650
+
5651
+ for (let i = 0; i < listenersLength; i++) {
5652
+ const [listener, klass] = listeners[i];
5650
5653
  const mutatedNodesByType = mutatedNodes.get(klass);
5651
5654
 
5652
- if (mutatedNodesByType === undefined) {
5653
- return;
5655
+ if (mutatedNodesByType !== undefined) {
5656
+ listener(mutatedNodesByType);
5654
5657
  }
5655
-
5656
- listener(mutatedNodesByType);
5657
- });
5658
+ }
5658
5659
  }
5659
5660
 
5660
5661
  function triggerListeners(type, editor, isCurrentlyEnqueuingUpdates, ...payload) {
@@ -5690,11 +5691,14 @@ function triggerCommandListeners(editor, type, payload) {
5690
5691
  const listenerInPriorityOrder = commandListeners.get(type);
5691
5692
 
5692
5693
  if (listenerInPriorityOrder !== undefined) {
5693
- const listeners = listenerInPriorityOrder[i];
5694
+ const listenersSet = listenerInPriorityOrder[i];
5695
+
5696
+ if (listenersSet !== undefined) {
5697
+ const listeners = Array.from(listenersSet);
5698
+ const listenersLength = listeners.length;
5694
5699
 
5695
- if (listeners !== undefined) {
5696
- for (const listener of listeners) {
5697
- if (listener(payload, editor) === true) {
5700
+ for (let j = 0; j < listenersLength; j++) {
5701
+ if (listeners[j](payload, editor) === true) {
5698
5702
  return true;
5699
5703
  }
5700
5704
  }
@@ -6403,7 +6407,7 @@ class LexicalNode {
6403
6407
 
6404
6408
  if (latest === null) {
6405
6409
  {
6406
- throw Error(`Lexical node does not exist in active edtior state. Avoid using the same node references between nested closures from editor.read/editor.update.`);
6410
+ throw Error(`Lexical node does not exist in active editor state. Avoid using the same node references between nested closures from editor.read/editor.update.`);
6407
6411
  }
6408
6412
  }
6409
6413
 
@@ -8199,25 +8203,57 @@ function convertSpanElement(domNode) {
8199
8203
 
8200
8204
  const hasItalicFontStyle = span.style.fontStyle === 'italic'; // Google Docs uses span tags + text-decoration: underline for underline text
8201
8205
 
8202
- const hasUnderlineTextDecoration = span.style.textDecoration === 'underline';
8206
+ const hasUnderlineTextDecoration = span.style.textDecoration === 'underline'; // Google Docs uses span tags + vertical-align to specify subscript and superscript
8207
+
8208
+ const verticalAlign = span.style.verticalAlign; // Google Docs uses span tags + color, background-color for coloring
8209
+
8210
+ const backgroundColor = span.style.backgroundColor;
8211
+ const textColor = span.style.color; //TODO: font-size and coloring of subscript & superscript
8212
+
8203
8213
  return {
8204
8214
  forChild: lexicalNode => {
8205
- if ($isTextNode(lexicalNode) && hasBoldFontWeight) {
8215
+ if (!$isTextNode(lexicalNode)) {
8216
+ return lexicalNode;
8217
+ }
8218
+
8219
+ if (hasBoldFontWeight) {
8206
8220
  lexicalNode.toggleFormat('bold');
8207
8221
  }
8208
8222
 
8209
- if ($isTextNode(lexicalNode) && hasLinethroughTextDecoration) {
8223
+ if (hasLinethroughTextDecoration) {
8210
8224
  lexicalNode.toggleFormat('strikethrough');
8211
8225
  }
8212
8226
 
8213
- if ($isTextNode(lexicalNode) && hasItalicFontStyle) {
8227
+ if (hasItalicFontStyle) {
8214
8228
  lexicalNode.toggleFormat('italic');
8215
8229
  }
8216
8230
 
8217
- if ($isTextNode(lexicalNode) && hasUnderlineTextDecoration) {
8231
+ if (hasUnderlineTextDecoration) {
8218
8232
  lexicalNode.toggleFormat('underline');
8219
8233
  }
8220
8234
 
8235
+ if (verticalAlign === 'sub') {
8236
+ lexicalNode.toggleFormat('subscript');
8237
+ }
8238
+
8239
+ if (verticalAlign === 'super') {
8240
+ lexicalNode.toggleFormat('superscript');
8241
+ }
8242
+
8243
+ let cssString = '';
8244
+
8245
+ if (textColor && textColor !== 'rgb(0, 0, 0)') {
8246
+ cssString += `color: ${textColor};`;
8247
+ }
8248
+
8249
+ if (backgroundColor && backgroundColor !== 'transparent') {
8250
+ cssString += `background-color: ${backgroundColor};`;
8251
+ }
8252
+
8253
+ if (cssString !== '') {
8254
+ lexicalNode.setStyle(cssString);
8255
+ }
8256
+
8221
8257
  return lexicalNode;
8222
8258
  },
8223
8259
  node: null
@@ -8853,7 +8889,7 @@ class LexicalEditor {
8853
8889
  updateEditor(this, updateFn, options);
8854
8890
  }
8855
8891
 
8856
- focus(callbackFn) {
8892
+ focus(callbackFn, options = {}) {
8857
8893
  const rootElement = this._rootElement;
8858
8894
 
8859
8895
  if (rootElement !== null) {
@@ -8867,7 +8903,11 @@ class LexicalEditor {
8867
8903
  // Marking the selection dirty will force the selection back to it
8868
8904
  selection.dirty = true;
8869
8905
  } else if (root.getChildrenSize() !== 0) {
8870
- root.selectEnd();
8906
+ if (options.defaultSelection === 'rootStart') {
8907
+ root.selectStart();
8908
+ } else {
8909
+ root.selectEnd();
8910
+ }
8871
8911
  }
8872
8912
  }, {
8873
8913
  onUpdate: () => {
@@ -8921,7 +8961,7 @@ class LexicalEditor {
8921
8961
  * LICENSE file in the root directory of this source tree.
8922
8962
  *
8923
8963
  */
8924
- const VERSION = '0.3.6';
8964
+ const VERSION = '0.3.7';
8925
8965
 
8926
8966
  /**
8927
8967
  * Copyright (c) Meta Platforms, Inc. and affiliates.
package/Lexical.js.flow CHANGED
@@ -169,7 +169,7 @@ declare export class LexicalEditor {
169
169
  updateFn?: () => void,
170
170
  ): EditorState;
171
171
  update(updateFn: () => void, options?: EditorUpdateOptions): boolean;
172
- focus(callbackFn?: () => void): void;
172
+ focus(callbackFn?: () => void, options?: EditorFocusOptions): void;
173
173
  blur(): void;
174
174
  isReadOnly(): boolean;
175
175
  setReadOnly(readOnly: boolean): void;
@@ -180,6 +180,9 @@ type EditorUpdateOptions = {
180
180
  tag?: string,
181
181
  skipTransforms?: true,
182
182
  };
183
+ type EditorFocusOptions = {
184
+ defaultSelection?: 'rootStart' | 'rootEnd',
185
+ };
183
186
  type EditorSetOptions = {
184
187
  tag?: string,
185
188
  };
package/Lexical.prod.js CHANGED
@@ -4,177 +4,179 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- 'use strict';let ba={},ca={},da={},fa={},ha={},ia={},ka={},la={},ma={},na={},q={},oa={},pa={},qa={},ra={},sa={},va={},wa={},xa={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function t(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
- let Pa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Qa=Pa&&"documentMode"in document?document.documentMode:null,u=Pa&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ra=Pa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sa=Pa&&"InputEvent"in window&&!Qa?"getTargetRanges"in new window.InputEvent("input"):!1,Ta=Pa&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ua=Pa&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
7
+ 'use strict';let aa={},ba={},ca={},da={},fa={},ha={},ia={},ka={},la={},ma={},q={},na={},oa={},pa={},qa={},ra={},sa={},wa={},xa={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function t(a){throw Error(`Minified Lexical error #${a}; visit https://lexical.dev/docs/error?code=${a} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
+ let Na="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Qa=Na&&"documentMode"in document?document.documentMode:null,u=Na&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ra=Na&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Sa=Na&&"InputEvent"in window&&!Qa?"getTargetRanges"in new window.InputEvent("input"):!1,Ta=Na&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ua=Na&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
9
  !window.MSStream,Va=Ta||Ua?"\u00a0":"\u200b",Wa=Ra?"\u00a0":Va,Xa=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,Ya=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,Za={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},$a={directionless:1,
10
10
  unmergeable:2},ab={center:2,justify:4,left:1,right:3},bb={2:"center",4:"justify",1:"left",3:"right"},cb={inert:3,normal:0,segmented:2,token:1},db={3:"inert",0:"normal",2:"segmented",1:"token"},eb=!1,fb=0;function gb(a){fb=a.timeStamp}function hb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function ib(a){return a.getEditorState().read(()=>{let b=v();return null!==b?b.clone():null})}
11
11
  function jb(a,b,c){eb=!0;let d=100<performance.now()-fb;try{x(a,()=>{let f=v()||ib(a);var e=new Map,g=a.getRootElement(),h=a._editorState;let k=!1,m="";for(var l=0;l<b.length;l++){var n=b[l],r=n.type,p=n.target,w=kb(p,h);if(!A(w))if("characterData"===r){if(n=d&&B(w))a:{n=f;r=p;var y=w;if(C(n)){var z=n.anchor.getNode();if(z.is(y)&&n.format!==z.getFormat()){n=!1;break a}}n=3===r.nodeType&&y.isAttached()}n&&(y=window.getSelection(),r=n=null,null!==y&&y.anchorNode===p&&(n=y.anchorOffset,r=y.focusOffset),
12
- p=p.nodeValue,null!==p&&nb(w,p,n,r,!1))}else if("childList"===r){k=!0;r=n.addedNodes;for(y=0;y<r.length;y++){z=r[y];var D=ob(z),F=z.parentNode;null==F||null!==D||"BR"===z.nodeName&&hb(z,F,a)||(Ra&&(D=z.innerText||z.nodeValue)&&(m+=D),F.removeChild(z))}n=n.removedNodes;r=n.length;if(0<r){y=0;for(z=0;z<r;z++)F=n[z],"BR"===F.nodeName&&hb(F,p,a)&&(p.appendChild(F),y++);r!==y&&(p===g&&(w=h._nodeMap.get("root")),e.set(p,w))}}}if(0<e.size)for(let [ea,S]of e)if(E(S))for(e=S.__children,g=ea.firstChild,h=0;h<
13
- e.length;h++)l=a.getElementByKey(e[h]),null!==l&&(null==g?(ea.appendChild(l),g=l):g!==l&&ea.replaceChild(l,g),g=g.nextSibling);else B(S)&&S.markDirty();e=c.takeRecords();if(0<e.length){for(g=0;g<e.length;g++)for(l=e[g],h=l.addedNodes,l=l.target,w=0;w<h.length;w++)p=h[w],n=p.parentNode,null==n||"BR"!==p.nodeName||hb(p,l,a)||n.removeChild(p);c.takeRecords()}null!==f&&(k&&(f.dirty=!0,pb(f)),Ra&&qb()&&f.insertRawText(m))})}finally{eb=!1}}
14
- function rb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();jb(a,c,b)}}function sb(a){0===fb&&window.addEventListener("textInput",gb,!0);a._observer=new MutationObserver((b,c)=>{jb(a,b,c)})}let tb=1,ub="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
15
- function vb(a,b,c){let d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){let e=document.activeElement,g=null!==e?e.nodeName:null;f=!A(kb(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&wb(b)===a}catch(e){return!1}}function wb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function xb(a){return G(a)||a.isSegmented()}function G(a){return a.isToken()||a.isInert()}
16
- function yb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function zb(a,b,c){b=Za[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ab(a){return B(a)||Bb(a)||A(a)}function Cb(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&t(31);Db(a);b.splice(c,1)}}
17
- function Eb(a){99<Fb&&t(14);var b=a.getLatest(),c=b.__parent,d=H();let f=I(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;E(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function Db(a){let b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Eb(b);null!==a&&Eb(a)}
18
- function J(a){K();var b=I();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function L(a,b){a=(b||H())._nodeMap.get(a);return void 0===a?null:a}function ob(a,b){let c=I();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function kb(a,b){for(;null!=a;){let c=ob(a,b);if(null!==c)return c;a=a.parentNode}return null}
19
- function Gb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Hb(a){return a.read(()=>Ib().getTextContent())}function Jb(a,b){x(a,()=>{var c=H();if(!c.isEmpty())if("root"===b)Ib().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ib(){return H()._nodeMap.get("root")}function pb(a){let b=H();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
20
- function Kb(a){var b=I(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Lb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Mb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
21
- function Nb(a,b,c){a=window.getSelection();if(null!==a){var d=a.anchorNode,{anchorOffset:f,focusOffset:e}=a;if(null!==d&&3===d.nodeType&&(a=kb(d),B(a))){d=d.nodeValue;if(d===Va&&c){let g=c.length;d=c;e=f=g}null!==d&&nb(a,d,f,e,b)}}}
22
- function nb(a,b,c,d,f){let e=a;if(e.isAttached()&&(f||!e.isDirty())){var g=e.isComposing();a=b;(g||f)&&b[b.length-1]===Va&&(a=b.slice(0,-1));b=e.getTextContent();if(f||a!==b)if(""===a)if(J(null),Ta||Ua)e.remove();else{let h=I();setTimeout(()=>{h.update(()=>{e.isAttached()&&e.remove()})},20)}else f=e.getParent(),b=Ob(),G(e)||null!==I()._compositionKey&&!g||null!==f&&C(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?e.markDirty():(g=v(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(e,c,e,d),e.isSegmented()&&
12
+ p=p.nodeValue,null!==p&&lb(w,p,n,r,!1))}else if("childList"===r){k=!0;r=n.addedNodes;for(y=0;y<r.length;y++){z=r[y];var D=nb(z),F=z.parentNode;null==F||null!==D||"BR"===z.nodeName&&hb(z,F,a)||(Ra&&(D=z.innerText||z.nodeValue)&&(m+=D),F.removeChild(z))}n=n.removedNodes;r=n.length;if(0<r){y=0;for(z=0;z<r;z++)F=n[z],"BR"===F.nodeName&&hb(F,p,a)&&(p.appendChild(F),y++);r!==y&&(p===g&&(w=h._nodeMap.get("root")),e.set(p,w))}}}if(0<e.size)for(let [ea,S]of e)if(E(S))for(e=S.__children,g=ea.firstChild,h=0;h<
13
+ e.length;h++)l=a.getElementByKey(e[h]),null!==l&&(null==g?(ea.appendChild(l),g=l):g!==l&&ea.replaceChild(l,g),g=g.nextSibling);else B(S)&&S.markDirty();e=c.takeRecords();if(0<e.length){for(g=0;g<e.length;g++)for(l=e[g],h=l.addedNodes,l=l.target,w=0;w<h.length;w++)p=h[w],n=p.parentNode,null==n||"BR"!==p.nodeName||hb(p,l,a)||n.removeChild(p);c.takeRecords()}null!==f&&(k&&(f.dirty=!0,ob(f)),Ra&&pb()&&f.insertRawText(m))})}finally{eb=!1}}
14
+ function qb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();jb(a,c,b)}}function rb(a){0===fb&&window.addEventListener("textInput",gb,!0);a._observer=new MutationObserver((b,c)=>{jb(a,b,c)})}let sb=1,tb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
15
+ function ub(a,b,c){let d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){let e=document.activeElement,g=null!==e?e.nodeName:null;f=!A(kb(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&vb(b)===a}catch(e){return!1}}function vb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function wb(a){return G(a)||a.isSegmented()}function G(a){return a.isToken()||a.isInert()}
16
+ function xb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function yb(a,b,c){b=Za[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function zb(a){return B(a)||Ab(a)||A(a)}function Bb(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&t(31);Cb(a);b.splice(c,1)}}
17
+ function Db(a){99<Eb&&t(14);var b=a.getLatest(),c=b.__parent,d=H();let f=I(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;E(a)?d.set(b,!0):f._dirtyLeaves.add(b)}function Cb(a){let b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Db(b);null!==a&&Db(a)}
18
+ function J(a){K();var b=I();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=L(c),null!==b&&b.getWritable()),null!==a&&(a=L(a),null!==a&&a.getWritable()))}function L(a,b){a=(b||H())._nodeMap.get(a);return void 0===a?null:a}function nb(a,b){let c=I();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function kb(a,b){for(;null!=a;){let c=nb(a,b);if(null!==c)return c;a=a.parentNode}return null}
19
+ function Fb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Gb(a){return a.read(()=>Hb().getTextContent())}function Ib(a,b){x(a,()=>{var c=H();if(!c.isEmpty())if("root"===b)Hb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Hb(){return H()._nodeMap.get("root")}function ob(a){let b=H();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
20
+ function Jb(a){var b=I(),c;a:{for(c=a;null!=c;){let d=c[`__lexicalKey_${b._key}`];if(void 0!==d){c=d;break a}c=c.parentNode}c=null}return null===c?(b=b.getRootElement(),a===b?L("root"):null):L(c)}function Kb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Lb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
21
+ function Mb(a,b,c){a=window.getSelection();if(null!==a){var d=a.anchorNode,{anchorOffset:f,focusOffset:e}=a;if(null!==d&&3===d.nodeType&&(a=kb(d),B(a))){d=d.nodeValue;if(d===Va&&c){let g=c.length;d=c;e=f=g}null!==d&&lb(a,d,f,e,b)}}}
22
+ function lb(a,b,c,d,f){let e=a;if(e.isAttached()&&(f||!e.isDirty())){var g=e.isComposing();a=b;(g||f)&&b[b.length-1]===Va&&(a=b.slice(0,-1));b=e.getTextContent();if(f||a!==b)if(""===a)if(J(null),Ta||Ua)e.remove();else{let h=I();setTimeout(()=>{h.update(()=>{e.isAttached()&&e.remove()})},20)}else f=e.getParent(),b=Nb(),G(e)||null!==I()._compositionKey&&!g||null!==f&&C(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?e.markDirty():(g=v(),C(g)&&null!==c&&null!==d&&(g.setTextNodeRange(e,c,e,d),e.isSegmented()&&
23
23
  (c=e.getTextContent(),c=M(c),e.replace(c),e=c)),e.setTextContent(a))}}
24
- function Pb(a,b){var c=a.anchor,d=a.focus,f=c.getNode(),e=window.getSelection();e=null!==e?e.anchorNode:null;let g=c.key,h=I().getElementByKey(g);b=b.length;(c=g!==d.key||!B(f)||2>b&&c.offset!==d.offset&&!f.isComposing()||xb(f)||f.isDirty()&&1<b||null!==h&&!f.isComposing()&&e!==yb(h)||f.getFormat()!==a.format)||(f.isSegmented()?c=!0:a.isCollapsed()?(a=a.anchor.offset,c=f.getParentOrThrow(),d=f.isToken(),(b=0===a)&&!(b=!f.canInsertTextBefore()||!c.canInsertTextBefore()||d)&&(b=f.getPreviousSibling(),
25
- b=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),f=f.getTextContentSize()===a&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),c=b||f):c=!1);return c}function Qb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Rb(a,b,c,d,f){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&t(33),b=b.klass,d=a.get(b),void 0===d&&(d=new Map,a.set(b,d)),d.has(c)||d.set(c,f))}
26
- function Sb(a,b,c){let d=a.getParent(),f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Tb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Sb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Sb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
27
- function qb(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Xb(a){return!N(a)&&!a.isLastChild()&&!a.isInline()}function Yb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&t(34);return a}function Zb(a,b,c,d,f){a=a.__children;let e=a.length;for(let g=0;g<e;g++){let h=a[g],k=d.get(h);void 0!==k&&k.__parent===b&&(E(k)&&Zb(k,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
28
- function $b(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let f of c){let e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(let [f]of d)c=b.get(f),void 0===c||c.isAttached()||(E(c)&&Zb(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function ac(a,b){let c=a.__mode,d=a.__format;a=a.__style;let f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
29
- function bc(a,b){let c=a.mergeWithSibling(b),d=I()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function cc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{ac(b,a)&&(a=bc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{ac(a,c)&&bc(a,c);break}}}
30
- let O="",P="",Q="",dc,R,ec,fc=!1,gc=!1,hc,ic=null,jc,kc,lc,mc,nc,oc;function pc(a,b){let c=lc.get(a);if(null!==b){let d=qc(a);b.removeChild(d)}mc.has(a)||R._keyToDOMMap.delete(a);E(c)&&(a=c.__children,rc(a,0,a.length-1,null));void 0!==c&&Rb(oc,ec,hc,c,"destroyed")}function rc(a,b,c,d){for(;b<=c;++b){let f=a[b];void 0!==f&&pc(f,d)}}function sc(a,b){a.setProperty("text-align",b)}function tc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
31
- function uc(a,b){a=a.style;0===b?sc(a,""):1===b?sc(a,"left"):2===b?sc(a,"center"):3===b?sc(a,"right"):4===b&&sc(a,"justify")}
32
- function vc(a,b,c){let d=mc.get(a);void 0===d&&t(60);let f=d.createDOM(dc,R);var e=R._keyToDOMMap;f["__lexicalKey_"+R._key]=a;e.set(a,f);B(d)?f.setAttribute("data-lexical-text","true"):A(d)&&f.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;0!==a&&tc(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;let h=P;P="";wc(e,0,g,f,null);xc(d,f);P=h}e=d.__format;0!==e&&uc(f,e);yc(null,a,f);Xb(d)&&(O+="\n\n",Q+="\n\n")}else e=d.getTextContent(),A(d)?(g=d.decorate(R,dc),null!==g&&zc(a,
33
- g),f.contentEditable="false"):B(d)&&(d.isDirectionless()||(P+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),O+=e,Q+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Rb(oc,ec,hc,d,"created");return f}function wc(a,b,c,d,f){let e=O;for(O="";b<=c;++b)vc(a[b],d,f);d.__lexicalTextContent=O;O=e+O}
34
- function Ac(a,b){a=b.get(a[a.length-1]);return Bb(a)||A(a)}function yc(a,b,c){a=null!==a&&(0===a.length||Ac(a,lc));b=null!==b&&(0===b.length||Ac(b,mc));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
35
- function xc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==P||c!==ic){let e=""===P;if(e)var d=ic;else d=P,d=Xa.test(d)?"rtl":Ya.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=dc.theme;var f=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);gc||(a.getWritable().__dir=d)}ic=
24
+ function Ob(a,b){var c=a.anchor,d=a.focus,f=c.getNode(),e=window.getSelection();e=null!==e?e.anchorNode:null;let g=c.key,h=I().getElementByKey(g);b=b.length;(c=g!==d.key||!B(f)||2>b&&c.offset!==d.offset&&!f.isComposing()||wb(f)||f.isDirty()&&1<b||null!==h&&!f.isComposing()&&e!==xb(h)||f.getFormat()!==a.format)||(f.isSegmented()?c=!0:a.isCollapsed()?(a=a.anchor.offset,c=f.getParentOrThrow(),d=f.isToken(),(b=0===a)&&!(b=!f.canInsertTextBefore()||!c.canInsertTextBefore()||d)&&(b=f.getPreviousSibling(),
25
+ b=(B(b)||E(b)&&b.isInline())&&!b.canInsertTextAfter()),f=f.getTextContentSize()===a&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||d),c=b||f):c=!1);return c}function Pb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Qb(a,b,c,d,f){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&t(33),b=b.klass,d=a.get(b),void 0===d&&(d=new Map,a.set(b,d)),d.has(c)||d.set(c,f))}
26
+ function Rb(a,b,c){let d=a.getParent(),f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Sb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Rb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Rb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
27
+ function pb(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Tb(a){return!N(a)&&!a.isLastChild()&&!a.isInline()}function Xb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&t(34);return a}function Yb(a,b,c,d,f){a=a.__children;let e=a.length;for(let g=0;g<e;g++){let h=a[g],k=d.get(h);void 0!==k&&k.__parent===b&&(E(k)&&Yb(k,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
28
+ function Zb(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let f of c){let e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(let [f]of d)c=b.get(f),void 0===c||c.isAttached()||(E(c)&&Yb(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function $b(a,b){let c=a.__mode,d=a.__format;a=a.__style;let f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
29
+ function ac(a,b){let c=a.mergeWithSibling(b),d=I()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function bc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&B(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{$b(b,a)&&(a=ac(b,a));break}for(var c;null!==(c=a.getNextSibling())&&B(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{$b(a,c)&&ac(a,c);break}}}
30
+ let O="",P="",Q="",cc,R,dc,ec=!1,fc=!1,gc,hc=null,ic,jc,kc,lc,mc,nc;function oc(a,b){let c=kc.get(a);if(null!==b){let d=pc(a);b.removeChild(d)}lc.has(a)||R._keyToDOMMap.delete(a);E(c)&&(a=c.__children,qc(a,0,a.length-1,null));void 0!==c&&Qb(nc,dc,gc,c,"destroyed")}function qc(a,b,c,d){for(;b<=c;++b){let f=a[b];void 0!==f&&oc(f,d)}}function rc(a,b){a.setProperty("text-align",b)}function sc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
31
+ function tc(a,b){a=a.style;0===b?rc(a,""):1===b?rc(a,"left"):2===b?rc(a,"center"):3===b?rc(a,"right"):4===b&&rc(a,"justify")}
32
+ function uc(a,b,c){let d=lc.get(a);void 0===d&&t(60);let f=d.createDOM(cc,R);var e=R._keyToDOMMap;f["__lexicalKey_"+R._key]=a;e.set(a,f);B(d)?f.setAttribute("data-lexical-text","true"):A(d)&&f.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;0!==a&&sc(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;let h=P;P="";vc(e,0,g,f,null);wc(d,f);P=h}e=d.__format;0!==e&&tc(f,e);xc(null,a,f);Tb(d)&&(O+="\n\n",Q+="\n\n")}else e=d.getTextContent(),A(d)?(g=d.decorate(R,cc),null!==g&&yc(a,
33
+ g),f.contentEditable="false"):B(d)&&(d.isDirectionless()||(P+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),O+=e,Q+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Qb(nc,dc,gc,d,"created");return f}function vc(a,b,c,d,f){let e=O;for(O="";b<=c;++b)uc(a[b],d,f);d.__lexicalTextContent=O;O=e+O}
34
+ function zc(a,b){a=b.get(a[a.length-1]);return Ab(a)||A(a)}function xc(a,b,c){a=null!==a&&(0===a.length||zc(a,kc));b=null!==b&&(0===b.length||zc(b,lc));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
35
+ function wc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==P||c!==hc){let e=""===P;if(e)var d=hc;else d=P,d=Xa.test(d)?"rtl":Ya.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=cc.theme;var f=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==k&&("string"===typeof k&&(c=k.split(" "),k=h[d]=c),void 0!==k&&g.add(...k)),b.dir=d);fc||(a.getWritable().__dir=d)}hc=
36
36
  d;b.__lexicalDirTextContent=P;b.__lexicalDir=d}}
37
- function Bc(a,b){var c=lc.get(a),d=mc.get(a);void 0!==c&&void 0!==d||t(61);var f=fc||kc.has(a)||jc.has(a);let e=Yb(R,a);if(c===d&&!f)return E(c)?(d=e.__lexicalTextContent,void 0!==d&&(O+=d,Q+=d),d=e.__lexicalDirTextContent,void 0!==d&&(P+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(P+=d),Q+=d,O+=d),e;c!==d&&f&&Rb(oc,ec,hc,d,"updated");if(d.updateDOM(c,e,dc))return d=vc(a,null,null),null===b&&t(62),b.replaceChild(d,e),pc(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&tc(e,a);a=d.__format;
38
- a!==c.__format&&uc(e,a);a=c.__children;c=d.__children;if(a!==c||f){var g=a,h=c;f=d;b=P;P="";let p=O;O="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Bc(l,e);else{var n=qc(l);h=vc(h,null,null);e.replaceChild(h,n);pc(l,null)}}else if(0===k)0!==m&&wc(h,0,m-1,e,null);else if(0===m)0!==k&&(l=null==e.__lexicalLineBreak,rc(g,0,k-1,l?null:e),l&&(e.textContent=""));else{let w=k-1;k=m-1;let y=e.firstChild,z=0;for(m=0;z<=w&&m<=k;){var r=g[z];let D=h[m];if(r===D)y=Bc(D,e).nextSibling,
39
- z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let F=n.has(r),ea=l.has(D);F?(ea?(r=Yb(R,D),r===y?y=Bc(D,e).nextSibling:(null!=y?e.insertBefore(r,y):e.appendChild(r),Bc(D,e)),z++):vc(D,e,y),m++):(y=qc(r).nextSibling,pc(r,e),z++)}}l=z>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:R.getElementByKey(l),wc(h,m,k,e,l)):n&&!l&&rc(g,z,w,e)}Xb(f)&&(O+="\n\n");e.__lexicalTextContent=O;O=p+O;xc(f,e);P=b;N(d)||yc(a,c,e)}Xb(d)&&(O+="\n\n",Q+="\n\n")}else c=d.getTextContent(),A(d)?(f=d.decorate(R,
40
- dc),null!==f&&zc(a,f),O+=c,Q+=c):B(d)&&!d.isDirectionless()&&(P+=c),O+=c,Q+=c;!gc&&N(d)&&d.__cachedText!==Q&&(d=d.getWritable(),d.__cachedText=Q);return e}function zc(a,b){let c=R._pendingDecorators,d=R._decorators;if(null===c){if(d[a]===b)return;c=Gb(R)}c[a]=b}function qc(a){a=nc.get(a);void 0===a&&t(34);return a}
41
- let T=Object.freeze({}),Hc=[["keydown",Cc],["compositionstart",Dc],["compositionend",Ec],["input",Fc],["click",Gc],["cut",T],["copy",T],["dragstart",T],["dragover",T],["paste",T],["focus",T],["blur",T],["drop",T]];Sa&&Hc.push(["beforeinput",(a,b)=>Ic(a,b)]);let Jc=0,Kc=0,Lc=0,Mc=!1,Nc=!1,Oc=!1,Pc=[0,0,"root",0];function Qc(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
42
- function Rc(a,b,c){let {anchorNode:d,anchorOffset:f,focusNode:e,focusOffset:g}=a;if(Mc&&(Mc=!1,Qc(d,f)&&Qc(e,g)))return;x(b,()=>{if(!c)pb(null);else if(vb(b,d,e)){var h=v();if(C(h)){let m=h.anchor,l=m.getNode();if(h.isCollapsed()){"Range"===a.type&&(h.dirty=!0);var k=window.event;k=k?k.timeStamp:performance.now();let [n,r,p,w]=Pc;k<w+200&&m.offset===r&&m.key===p?h.format=n:"text"===m.type?h.format=l.getFormat():"element"===m.type&&(h.format=0)}else{k=h.focus;let n=k.getNode(),r=0;"text"===m.type&&
43
- (r|=l.getFormat());"text"!==k.type||l.is(n)||(r|=n.getFormat());h.format=r}}U(b,ba,void 0)}})}
44
- function Gc(a,b){x(b,()=>{var c=v(),d=window.getSelection();let f=Ob();if(C(c)){var e=c.anchor;let g=e.getNode();d&&"element"===e.type&&0===e.offset&&c.isCollapsed()&&!N(g)&&1===Ib().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==f&&c.is(f)&&(d.removeAllRanges(),c.dirty=!0)}else d&&Sc(c)&&d.isCollapsed&&(c=d.anchorNode,e=[1,3],null!==c&&e.includes(c.nodeType)&&(d=Tc(f,d,b),pb(d)));U(b,ca,a)})}function Uc(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}
45
- function Vc(a,b){return a!==b||E(a)||E(b)||!G(a)||!G(b)}
46
- function Ic(a,b){let c=a.inputType;if(!("deleteCompositionText"===c||Ra&&qb()))if("insertCompositionText"===c){let d=a.data;d&&x(b,()=>{var f=v();if(C(f)){let e=f.anchor,g=e.getNode(),h=g.getPreviousSibling();0===e.offset&&B(g)&&B(h)&&g.getTextContent()===Wa&&h.getFormat()!==f.format&&(f=h.getTextContent(),0===d.indexOf(f)&&(f=d.slice(f.length),U(b,ia,f),setTimeout(()=>{x(b,()=>{g.select()})},30)))}})}else x(b,()=>{let d=v();if("deleteContentBackward"===c){if(null===d){var f=Ob();if(!C(f))return;
47
- pb(f.clone())}if(C(d)){229===Kc&&a.timeStamp<Jc+30&&d.anchor.key===d.focus.key?(J(null),Jc=0,setTimeout(()=>{x(b,()=>{J(null)})},30),C(d)&&(f=d.anchor.getNode(),f.markDirty(),d.format=f.getFormat())):(a.preventDefault(),U(b,da,!1));return}}if(C(d)){f=a.data;d.dirty||!d.isCollapsed()||N(d.anchor.getNode())||Uc(d,a);var e=d.focus,g=d.anchor.getNode();e=e.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),U(b,fa,void 0)):"\n\n"===f?(a.preventDefault(),U(b,ha,void 0)):null==f&&a.dataTransfer?
48
- (f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Pb(d,f)&&(a.preventDefault(),U(b,ia,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":U(b,ia,a);break;case "insertFromComposition":J(null);U(b,ia,a);break;case "insertLineBreak":J(null);U(b,fa,void 0);break;case "insertParagraph":J(null);Nc?(Nc=!1,U(b,fa,void 0)):U(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":U(b,ka,a);
49
- break;case "deleteByComposition":Vc(g,e)&&U(b,la,void 0);break;case "deleteByDrag":case "deleteByCut":U(b,la,void 0);break;case "deleteContent":U(b,da,!1);break;case "deleteWordBackward":U(b,ma,!0);break;case "deleteWordForward":U(b,ma,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":U(b,na,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":U(b,na,!1);break;case "formatStrikeThrough":U(b,q,"strikethrough");break;case "formatBold":U(b,
50
- q,"bold");break;case "formatItalic":U(b,q,"italic");break;case "formatUnderline":U(b,q,"underline");break;case "historyUndo":U(b,oa,void 0);break;case "historyRedo":U(b,pa,void 0)}}})}function Fc(a,b){a.stopPropagation();x(b,()=>{var c=v(),d=a.data;null!=d&&C(c)&&Pb(c,d)?(Oc&&(Wc(b,d),Oc=!1),U(b,ia,d),d=d.length,Ra&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d),Ta||Ua||!b.isComposing()||(Jc=0,J(null))):(Nb(b,!1),Oc&&(Wc(b,d||void 0),Oc=!1));K();c=I();rb(c)})}
51
- function Dc(a,b){x(b,()=>{let c=v();if(C(c)&&!b.isComposing()){let d=c.anchor;J(d.key);(a.timeStamp<Jc+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&U(b,ia,Wa)}})}
52
- function Wc(a,b){var c=a._compositionKey;J(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=yb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&nb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=v(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);U(a,ya,null);return}}Nb(a,!0,b)}function Ec(a,b){Ra?Oc=!0:x(b,()=>{Wc(b,a.data)})}
53
- function Cc(a,b){Jc=a.timeStamp;Kc=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(39!==c||g||d||!f&&!e)if(37!==c||f||e||g)if(37!==c||g||d||!f&&!e)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)Nc=!0,U(b,ya,a);else if(32===c)U(b,za,a);else if(u&&f&&79===c)a.preventDefault(),Nc=!0,U(b,fa,!0);else if(13!==c||d){var h=u?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?U(b,Aa,a):(a.preventDefault(),U(b,da,!0)):27===c?U(b,Ba,a):(h=u?d||g||e?
54
- !1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?U(b,Ca,a):(a.preventDefault(),U(b,da,!1)):8===c&&(u?g:f)?(a.preventDefault(),U(b,ma,!0)):46===c&&(u?g:f)?(a.preventDefault(),U(b,ma,!1)):u&&e&&8===c?(a.preventDefault(),U(b,na,!0)):u&&e&&46===c?(a.preventDefault(),U(b,na,!1)):66===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"bold")):85===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"underline")):73===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"italic")):9!==c||g||f||e?90===c&&!d&&(u?e:f)?(a.preventDefault(),
55
- U(b,oa,void 0)):(h=u?90===c&&e&&d:89===c&&f||90===c&&f&&d,h?(a.preventDefault(),U(b,pa,void 0)):Sc(b._editorState._selection)&&(h=d?!1:67===c?u?e:f:!1,h?(a.preventDefault(),U(b,Ia,a)):(h=d?!1:88===c?u?e:f:!1,h&&(a.preventDefault(),U(b,Ja,a))))):U(b,Da,a))}else Nc=!1,U(b,ya,a);else U(b,xa,a);else U(b,wa,a);else U(b,va,a);else U(b,sa,a);else U(b,ra,a);else U(b,qa,a);(f||d||g||e)&&U(b,Ma,a)}}function Xc(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Yc=new Map;
56
- function Zc(){let a=window.getSelection();if(a){var b=wb(a.anchorNode);if(null!==b){var c=Lb(b);c=c[c.length-1];var d=c._key,f=Yc.get(d),e=f||c;e!==b&&Rc(a,e,!1);Rc(a,b,!0);b!==c?Yc.set(d,b):f&&Yc.delete(d)}}}
57
- function $c(a,b){0===Lc&&a.ownerDocument.addEventListener("selectionchange",Zc);Lc++;a.__lexicalEditor=b;let c=Xc(a);for(let d=0;d<Hc.length;d++){let [f,e]=Hc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return U(b,Ja,h);case "copy":return U(b,Ia,h);case "paste":return U(b,ka,h);case "dragstart":return U(b,Fa,h);case "dragover":return U(b,Ga,h);case "dragend":return U(b,Ha,h);case "focus":return U(b,Ka,h);case "blur":return U(b,La,h);case "drop":return U(b,
37
+ function Ac(a,b){var c=kc.get(a),d=lc.get(a);void 0!==c&&void 0!==d||t(61);var f=ec||jc.has(a)||ic.has(a);let e=Xb(R,a);if(c===d&&!f)return E(c)?(d=e.__lexicalTextContent,void 0!==d&&(O+=d,Q+=d),d=e.__lexicalDirTextContent,void 0!==d&&(P+=d)):(d=c.getTextContent(),B(c)&&!c.isDirectionless()&&(P+=d),Q+=d,O+=d),e;c!==d&&f&&Qb(nc,dc,gc,d,"updated");if(d.updateDOM(c,e,cc))return d=uc(a,null,null),null===b&&t(62),b.replaceChild(d,e),oc(a,null),d;if(E(c)&&E(d)){a=d.__indent;a!==c.__indent&&sc(e,a);a=d.__format;
38
+ a!==c.__format&&tc(e,a);a=c.__children;c=d.__children;if(a!==c||f){var g=a,h=c;f=d;b=P;P="";let p=O;O="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Ac(l,e);else{var n=pc(l);h=uc(h,null,null);e.replaceChild(h,n);oc(l,null)}}else if(0===k)0!==m&&vc(h,0,m-1,e,null);else if(0===m)0!==k&&(l=null==e.__lexicalLineBreak,qc(g,0,k-1,l?null:e),l&&(e.textContent=""));else{let w=k-1;k=m-1;let y=e.firstChild,z=0;for(m=0;z<=w&&m<=k;){var r=g[z];let D=h[m];if(r===D)y=Ac(D,e).nextSibling,
39
+ z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let F=n.has(r),ea=l.has(D);F?(ea?(r=Xb(R,D),r===y?y=Ac(D,e).nextSibling:(null!=y?e.insertBefore(r,y):e.appendChild(r),Ac(D,e)),z++):uc(D,e,y),m++):(y=pc(r).nextSibling,oc(r,e),z++)}}l=z>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:R.getElementByKey(l),vc(h,m,k,e,l)):n&&!l&&qc(g,z,w,e)}Tb(f)&&(O+="\n\n");e.__lexicalTextContent=O;O=p+O;wc(f,e);P=b;N(d)||xc(a,c,e)}Tb(d)&&(O+="\n\n",Q+="\n\n")}else c=d.getTextContent(),A(d)?(f=d.decorate(R,
40
+ cc),null!==f&&yc(a,f),O+=c,Q+=c):B(d)&&!d.isDirectionless()&&(P+=c),O+=c,Q+=c;!fc&&N(d)&&d.__cachedText!==Q&&(d=d.getWritable(),d.__cachedText=Q);return e}function yc(a,b){let c=R._pendingDecorators,d=R._decorators;if(null===c){if(d[a]===b)return;c=Fb(R)}c[a]=b}function pc(a){a=mc.get(a);void 0===a&&t(34);return a}
41
+ let T=Object.freeze({}),Gc=[["keydown",Bc],["compositionstart",Cc],["compositionend",Dc],["input",Ec],["click",Fc],["cut",T],["copy",T],["dragstart",T],["dragover",T],["dragend",T],["paste",T],["focus",T],["blur",T],["drop",T]];Sa&&Gc.push(["beforeinput",(a,b)=>Hc(a,b)]);let Ic=0,Jc=0,Kc=0,Lc=!1,Mc=!1,Nc=!1,Oc=[0,0,"root",0];function Pc(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
42
+ function Qc(a,b,c){let {anchorNode:d,anchorOffset:f,focusNode:e,focusOffset:g}=a;if(Lc&&(Lc=!1,Pc(d,f)&&Pc(e,g)))return;x(b,()=>{if(!c)ob(null);else if(ub(b,d,e)){var h=v();if(C(h)){let m=h.anchor,l=m.getNode();if(h.isCollapsed()){"Range"===a.type&&(h.dirty=!0);var k=window.event;k=k?k.timeStamp:performance.now();let [n,r,p,w]=Oc;k<w+200&&m.offset===r&&m.key===p?h.format=n:"text"===m.type?h.format=l.getFormat():"element"===m.type&&(h.format=0)}else{k=h.focus;let n=k.getNode(),r=0;"text"===m.type&&
43
+ (r|=l.getFormat());"text"!==k.type||l.is(n)||(r|=n.getFormat());h.format=r}}U(b,aa,void 0)}})}
44
+ function Fc(a,b){x(b,()=>{var c=v(),d=window.getSelection();let f=Nb();if(C(c)){var e=c.anchor;let g=e.getNode();d&&"element"===e.type&&0===e.offset&&c.isCollapsed()&&!N(g)&&1===Hb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==f&&c.is(f)&&(d.removeAllRanges(),c.dirty=!0)}else d&&Rc(c)&&d.isCollapsed&&(c=d.anchorNode,e=[1,3],null!==c&&e.includes(c.nodeType)&&(d=Sc(f,d,b),ob(d)));U(b,ba,a)})}function Tc(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}
45
+ function Uc(a,b){return a!==b||E(a)||E(b)||!G(a)||!G(b)}
46
+ function Hc(a,b){let c=a.inputType;if(!("deleteCompositionText"===c||Ra&&pb()))if("insertCompositionText"===c){let d=a.data;d&&x(b,()=>{var f=v();if(C(f)){let e=f.anchor,g=e.getNode(),h=g.getPreviousSibling();0===e.offset&&B(g)&&B(h)&&g.getTextContent()===Wa&&h.getFormat()!==f.format&&(f=h.getTextContent(),0===d.indexOf(f)&&(f=d.slice(f.length),U(b,ha,f),setTimeout(()=>{x(b,()=>{g.select()})},30)))}})}else x(b,()=>{let d=v();if("deleteContentBackward"===c){if(null===d){var f=Nb();if(!C(f))return;
47
+ ob(f.clone())}if(C(d)){229===Jc&&a.timeStamp<Ic+30&&d.anchor.key===d.focus.key?(J(null),Ic=0,setTimeout(()=>{x(b,()=>{J(null)})},30),C(d)&&(f=d.anchor.getNode(),f.markDirty(),d.format=f.getFormat())):(a.preventDefault(),U(b,ca,!1));return}}if(C(d)){f=a.data;d.dirty||!d.isCollapsed()||N(d.anchor.getNode())||Tc(d,a);var e=d.focus,g=d.anchor.getNode();e=e.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),U(b,da,void 0)):"\n\n"===f?(a.preventDefault(),U(b,fa,void 0)):null==f&&a.dataTransfer?
48
+ (f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&Ob(d,f)&&(a.preventDefault(),U(b,ha,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":U(b,ha,a);break;case "insertFromComposition":J(null);U(b,ha,a);break;case "insertLineBreak":J(null);U(b,da,void 0);break;case "insertParagraph":J(null);Mc?(Mc=!1,U(b,da,void 0)):U(b,fa,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":U(b,ia,a);
49
+ break;case "deleteByComposition":Uc(g,e)&&U(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":U(b,ka,void 0);break;case "deleteContent":U(b,ca,!1);break;case "deleteWordBackward":U(b,la,!0);break;case "deleteWordForward":U(b,la,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":U(b,ma,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":U(b,ma,!1);break;case "formatStrikeThrough":U(b,q,"strikethrough");break;case "formatBold":U(b,
50
+ q,"bold");break;case "formatItalic":U(b,q,"italic");break;case "formatUnderline":U(b,q,"underline");break;case "historyUndo":U(b,na,void 0);break;case "historyRedo":U(b,oa,void 0)}}})}function Ec(a,b){a.stopPropagation();x(b,()=>{var c=v(),d=a.data;null!=d&&C(c)&&Ob(c,d)?(Nc&&(Vc(b,d),Nc=!1),U(b,ha,d),d=d.length,Ra&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d),Ta||Ua||!b.isComposing()||(Ic=0,J(null))):(Mb(b,!1),Nc&&(Vc(b,d||void 0),Nc=!1));K();c=I();qb(c)})}
51
+ function Cc(a,b){x(b,()=>{let c=v();if(C(c)&&!b.isComposing()){let d=c.anchor;J(d.key);(a.timeStamp<Ic+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&U(b,ha,Wa)}})}
52
+ function Vc(a,b){var c=a._compositionKey;J(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=xb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&B(b)&&lb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=v(),C(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);U(a,ya,null);return}}Mb(a,!0,b)}function Dc(a,b){Ra?Nc=!0:x(b,()=>{Vc(b,a.data)})}
53
+ function Bc(a,b){Ic=a.timeStamp;Jc=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(39!==c||g||d||!f&&!e)if(37!==c||f||e||g)if(37!==c||g||d||!f&&!e)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)Mc=!0,U(b,ya,a);else if(32===c)U(b,za,a);else if(u&&f&&79===c)a.preventDefault(),Mc=!0,U(b,da,!0);else if(13!==c||d){var h=u?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?U(b,Aa,a):(a.preventDefault(),U(b,ca,!0)):27===c?U(b,Ba,a):(h=u?d||g||e?
54
+ !1:46===c||68===c&&f:f||g||e?!1:46===c,h?46===c?U(b,Ca,a):(a.preventDefault(),U(b,ca,!1)):8===c&&(u?g:f)?(a.preventDefault(),U(b,la,!0)):46===c&&(u?g:f)?(a.preventDefault(),U(b,la,!1)):u&&e&&8===c?(a.preventDefault(),U(b,ma,!0)):u&&e&&46===c?(a.preventDefault(),U(b,ma,!1)):66===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"bold")):85===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"underline")):73===c&&!g&&(u?e:f)?(a.preventDefault(),U(b,q,"italic")):9!==c||g||f||e?90===c&&!d&&(u?e:f)?(a.preventDefault(),
55
+ U(b,na,void 0)):(h=u?90===c&&e&&d:89===c&&f||90===c&&f&&d,h?(a.preventDefault(),U(b,oa,void 0)):Rc(b._editorState._selection)&&(h=d?!1:67===c?u?e:f:!1,h?(a.preventDefault(),U(b,Ia,a)):(h=d?!1:88===c?u?e:f:!1,h&&(a.preventDefault(),U(b,Ja,a))))):U(b,Da,a))}else Mc=!1,U(b,ya,a);else U(b,xa,a);else U(b,wa,a);else U(b,sa,a);else U(b,ra,a);else U(b,qa,a);else U(b,pa,a);(f||d||g||e)&&U(b,Ma,a)}}function Wc(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Xc=new Map;
56
+ function Yc(){let a=window.getSelection();if(a){var b=vb(a.anchorNode);if(null!==b){var c=Kb(b);c=c[c.length-1];var d=c._key,f=Xc.get(d),e=f||c;e!==b&&Qc(a,e,!1);Qc(a,b,!0);b!==c?Xc.set(d,b):f&&Xc.delete(d)}}}
57
+ function Zc(a,b){0===Kc&&a.ownerDocument.addEventListener("selectionchange",Yc);Kc++;a.__lexicalEditor=b;let c=Wc(a);for(let d=0;d<Gc.length;d++){let [f,e]=Gc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return U(b,Ja,h);case "copy":return U(b,Ia,h);case "paste":return U(b,ia,h);case "dragstart":return U(b,Fa,h);case "dragover":return U(b,Ga,h);case "dragend":return U(b,Ha,h);case "focus":return U(b,Ka,h);case "blur":return U(b,La,h);case "drop":return U(b,
58
58
  Ea,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,g)})}}
59
59
  class V{constructor(a,b,c){this._selection=null;this.key=a;this.offset=b;this.type=c}is(a){return this.key===a.key&&this.offset===a.offset&&this.type===a.type}isBefore(a){let b=this.getNode(),c=a.getNode(),d=this.offset;a=a.offset;if(E(b)){var f=b.getDescendantByIndex(d);b=null!=f?f:b}E(c)&&(f=c.getDescendantByIndex(a),c=null!=f?f:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&t(20);return a}set(a,b,c){let d=this._selection,f=this.key;this.key=a;this.offset=b;this.type=c;
60
- W||(I()._compositionKey===f&&J(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function ad(a,b){let c=b.__key,d=a.offset,f="element";if(B(b))f="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var e=b.getNextSibling();if(B(e))c=e.__key,d=0;else if(e=b.getParent())c=e.__key,d=b.getIndexWithinParent()+1}a.set(c,d,f)}function bd(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?ad(a,c):ad(a,b)}else ad(a,b)}
61
- function cd(a,b,c){let d=a.getNode(),f=d.getChildAtIndex(a.offset),e=M(),g=N(d)?dd().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function X(a,b,c,d){a.key=b;a.offset=c;a.type=d}
62
- class ed{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!Sc(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new ed(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=
63
- this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof fd}
60
+ X||(I()._compositionKey===f&&J(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function $c(a,b){let c=b.__key,d=a.offset,f="element";if(B(b))f="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!E(b)){var e=b.getNextSibling();if(B(e))c=e.__key,d=0;else if(e=b.getParent())c=e.__key,d=b.getIndexWithinParent()+1}a.set(c,d,f)}function ad(a,b){if(E(b)){let c=b.getLastDescendant();E(c)||B(c)?$c(a,c):$c(a,b)}else $c(a,b)}
61
+ function bd(a,b,c){let d=a.getNode(),f=d.getChildAtIndex(a.offset),e=M(),g=N(d)?cd().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.__key,0,"text");a.set(e.__key,0,"text")}function dd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
62
+ class ed{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!Rc(a))return!1;let b=this._nodes,c=a._nodes;return b.size===c.size&&Array.from(b).every(d=>c.has(d))}add(a){this.dirty=!0;this._nodes.add(a);this._cachedNodes=null}delete(a){this.dirty=!0;this._nodes.delete(a);this._cachedNodes=null}clear(){this.dirty=!0;this._nodes.clear();this._cachedNodes=null}has(a){return this._nodes.has(a)}clone(){return new ed(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=
63
+ this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=L(c),null!==b&&a.push(b);X||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function C(a){return a instanceof fd}
64
64
  class gd{constructor(a,b,c){this.gridKey=a;this.anchor=b;this.focus=c;this.dirty=!1;this._cachedNodes=null;b._selection=this;c._selection=this}is(a){return hd(a)?this.gridKey===a.gridKey&&this.anchor.is(this.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new gd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return id(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
65
65
  L(this.anchor.key);null===a&&t(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&t(22);var d=c.getIndexWithinParent();let f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=
66
- L(this.gridKey);jd(e)||t(23);a.add(e);e=e.getChildren();for(let k=c;k<=f;k++){var g=e[k];a.add(g);kd(g)||t(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];ld(h)||t(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);E(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function hd(a){return a instanceof gd}
66
+ L(this.gridKey);jd(e)||t(23);a.add(e);e=e.getChildren();for(let k=c;k<=f;k++){var g=e[k];a.add(g);kd(g)||t(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];ld(h)||t(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);E(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);X||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function hd(a){return a instanceof gd}
67
67
  class fd{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c;this._cachedNodes=null;a._selection=this;b._selection=this}is(a){return C(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus)&&this.format===a.format:!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){var a=this._cachedNodes;if(null!==a)return a;var b=this.anchor,c=this.focus;a=b.getNode();let d=c.getNode();E(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
68
- b?b:a);E(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?E(a)&&(0<a.getChildrenSize()||a.excludeFromCopy())?[]:[a]:a.getNodesBetween(d);W||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){X(this.anchor,a.__key,b,"text");X(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[f,e]=id(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];
69
- if(E(m)&&!m.isInline())h||(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,B(m)){let l=m.getTextContent();m===b?l=m===c?f<e?l.slice(f,e):l.slice(e,f):d?l.slice(f):l.slice(e):m===c&&(l=d?l.slice(0,e):l.slice(0,f));g+=l}else!A(m)&&!Bb(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=I(),c=b.getEditorState()._selection;a=md(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;X(this.anchor,d.key,d.offset,d.type);X(this.focus,f.key,f.offset,
70
- f.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new fd(new V(a.key,a.offset,a.type),new V(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=zb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Za[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let f=b[d];""!==f&&a.push(M(f));d!==c-1&&a.push(nd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,
71
- d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?cd(b,c,f):d||"element"!==c.type||cd(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=e[0];B(b)||t(26);d=b.getTextContent().length;var m=b.getParentOrThrow(),l=e[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var n=b.getNextSibling();if(!B(n)||xb(n))n=M(),n.setFormat(f),m.canInsertTextAfter()?b.insertAfter(n):
72
- m.insertAfter(n);n.select(0,0);b=n;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore()&&null===b.getPreviousSibling())){n=b.getPreviousSibling();if(!B(n)||xb(n))n=M(),n.setFormat(f),m.canInsertTextBefore()?b.insertBefore(n):m.insertBefore(n);n.select();b=n;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)m=M(b.getTextContent()),m.setFormat(f),b.replace(m),b=m;else if(!(this.isCollapsed()||
73
- ""===a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!E(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");od(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(G(b))a=M(a),a.select(),b.replace(a);else{e=b.getFormat();if(c===k&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=M(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));e.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
74
- a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=e)}else{f=new Set([...b.getParentKeys(),...l.getParentKeys()]);var r=E(b)?b:b.getParentOrThrow();m=E(l)?l:l.getParentOrThrow();n=l;if(!r.is(m)&&m.isInline()){do n=m,m=m.getParentOrThrow();while(m.isInline())}"text"===h.type&&(0!==k||""===l.getTextContent())||"element"===h.type&&l.getIndexWithinParent()<k?B(l)&&!G(l)&&k!==l.getTextContentSize()?
75
- (l.isSegmented()&&(h=M(l.getTextContent()),l.replace(h),l=h),l=l.spliceText(0,k,""),f.add(l.__key)):(h=l.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?l.remove():h.remove()):f.add(l.__key);h=m.getChildren();k=new Set(e);l=r.is(m);r=r.isInline()&&null===b.getNextSibling()?r:b;for(let p=h.length-1;0<=p;p--){let w=h[p];if(w.is(b)||E(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(n)?l||r.insertAfter(w):w.remove())}if(!l)for(h=m,k=null;null!==h;){l=h.getChildren();m=l.length;if(0===
76
- m||l[m-1].is(k))f.delete(h.__key),k=h;h=h.getParent()}G(b)?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){var b=this.getNodes();let c=[];for(var d of b)B(d)&&c.push(d);var f=0;b=c.length-1;d=c[0];let e=c[b];if(this.isCollapsed())this.toggleFormat(a),J(null);else{var g=
77
- this.anchor,h=this.focus,k=g.offset,m=h.offset,l=d.getFormatFlags(a,null),n=d.getTextContent().length,r=g.isBefore(h),p=r?m:k;k=r?k:m;k===d.getTextContentSize()&&1<c.length&&(l=c[1],k=0,f=1,d=l,n=l.getTextContentSize(),l=l.getFormatFlags(a,null));if(d.is(e))B(d)&&("element"===g.type&&"element"===h.type?(d.setFormat(l),d.select(k,p),this.format=l):k!==p&&(0===k&&p===n?(d.setFormat(l),d.select(k,p)):(a=d.splitText(k,p),a=0===k?a[0]:a[1],a.setFormat(l),a.select(0,p-k)),this.format=l));else for(B(d)&&
78
- k!==n&&(0!==k&&([,d]=d.splitText(k)),d.setFormat(l)),g=l,B(e)&&(g=e.getFormatFlags(a,l),h=e.getTextContent().length,0!==p&&(p!==h&&([e]=e.splitText(p)),e.setFormat(g))),this.format=l|g,p=f+1;p<b;p++)l=c[p],f=l.__key,B(l)&&f!==d.__key&&f!==e.__key&&!l.isToken()&&(f=l.getFormatFlags(a,g),l.setFormat(f))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),
79
- h=N(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),c.push(f);else if(d===e)e=f;else{if(G(f))return!1;[e,f]=f.splitText(d);c.push(f)}f=e;c.push(...g);g=a[0];var k=!1,m=null;for(let r=0;r<a.length;r++){let p=a[r];if(E(p)&&!p.isInline()){if(p.is(g)){if(E(e)&&e.isEmpty()&&e.canReplaceWith(p)){e.replace(p);e=p;k=!0;continue}var l=p.getFirstDescendant();if(Ab(l)){for(l=l.getParentOrThrow();l.isInline();)l=
68
+ b?b:a);E(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?E(a)&&(0<a.getChildrenSize()||a.excludeFromCopy())?[]:[a]:a.getNodesBetween(d);X||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){dd(this.anchor,a.__key,b,"text");dd(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[f,e]=id(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];
69
+ if(E(m)&&!m.isInline())h||(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,B(m)){let l=m.getTextContent();m===b?l=m===c?f<e?l.slice(f,e):l.slice(e,f):d?l.slice(f):l.slice(e):m===c&&(l=d?l.slice(0,e):l.slice(0,f));g+=l}else!A(m)&&!Ab(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=I(),c=b.getEditorState()._selection;a=md(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;dd(this.anchor,d.key,d.offset,d.type);dd(this.focus,f.key,
70
+ f.offset,f.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new fd(new V(a.key,a.offset,a.type),new V(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=yb(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Za[a])}insertRawText(a){let b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];let c=b.length;for(let d=0;d<c;d++){let f=b[d];""!==f&&a.push(M(f));d!==c-1&&a.push(nd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,
71
+ c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?bd(b,c,f):d||"element"!==c.type||bd(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=e[0];B(b)||t(26);d=b.getTextContent().length;var m=b.getParentOrThrow(),l=e[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var n=b.getNextSibling();if(!B(n)||wb(n))n=M(),n.setFormat(f),m.canInsertTextAfter()?
72
+ b.insertAfter(n):m.insertAfter(n);n.select(0,0);b=n;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore()&&null===b.getPreviousSibling())){n=b.getPreviousSibling();if(!B(n)||wb(n))n=M(),n.setFormat(f),m.canInsertTextBefore()?b.insertBefore(n):m.insertBefore(n);n.select();b=n;if(""!==a){this.insertText(a);return}}else if(b.isSegmented()&&c!==d)m=M(b.getTextContent()),m.setFormat(f),b.replace(m),b=m;
73
+ else if(!(this.isCollapsed()||""===a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!E(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");od(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(G(b))a=M(a),a.select(),b.replace(a);else{e=b.getFormat();if(c===k&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=M(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));e.isComposing()&&"text"===this.anchor.type&&
74
+ (this.anchor.offset-=a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():"text"===this.anchor.type&&(b.isComposing()?this.anchor.offset-=a.length:this.format=e)}else{f=new Set([...b.getParentKeys(),...l.getParentKeys()]);var r=E(b)?b:b.getParentOrThrow();m=E(l)?l:l.getParentOrThrow();n=l;if(!r.is(m)&&m.isInline()){do n=m,m=m.getParentOrThrow();while(m.isInline())}"text"===h.type&&(0!==k||""===l.getTextContent())||"element"===h.type&&l.getIndexWithinParent()<k?B(l)&&!G(l)&&
75
+ k!==l.getTextContentSize()?(l.isSegmented()&&(h=M(l.getTextContent()),l.replace(h),l=h),l=l.spliceText(0,k,""),f.add(l.__key)):(h=l.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?l.remove():h.remove()):f.add(l.__key);h=m.getChildren();k=new Set(e);l=r.is(m);r=r.isInline()&&null===b.getNextSibling()?r:b;for(let p=h.length-1;0<=p;p--){let w=h[p];if(w.is(b)||E(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(n)?l||r.insertAfter(w):w.remove())}if(!l)for(h=m,k=null;null!==h;){l=h.getChildren();
76
+ m=l.length;if(0===m||l[m-1].is(k))f.delete(h.__key),k=h;h=h.getParent()}G(b)?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));for(a=1;a<g;a++)b=e[a],f.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){var b=this.getNodes();let c=[];for(var d of b)B(d)&&c.push(d);var f=0;b=c.length-1;d=c[0];let e=c[b];if(this.isCollapsed())this.toggleFormat(a),
77
+ J(null);else{var g=this.anchor,h=this.focus,k=g.offset,m=h.offset,l=d.getFormatFlags(a,null),n=d.getTextContent().length,r=g.isBefore(h),p=r?m:k;k=r?k:m;k===d.getTextContentSize()&&1<c.length&&(l=c[1],k=0,f=1,d=l,n=l.getTextContentSize(),l=l.getFormatFlags(a,null));if(d.is(e))B(d)&&("element"===g.type&&"element"===h.type?(d.setFormat(l),d.select(k,p),this.format=l):k!==p&&(0===k&&p===n?(d.setFormat(l),d.select(k,p)):(a=d.splitText(k,p),a=0===k?a[0]:a[1],a.setFormat(l),a.select(0,p-k)),this.format=
78
+ l));else for(B(d)&&k!==n&&(0!==k&&([,d]=d.splitText(k)),d.setFormat(l)),g=l,B(e)&&(g=e.getFormatFlags(a,l),h=e.getTextContent().length,0!==p&&(p!==h&&([e]=e.splitText(p)),e.setFormat(g))),this.format=l|g,p=f+1;p<b;p++)l=c[p],f=l.__key,B(l)&&f!==d.__key&&f!==e.__key&&!l.isToken()&&(f=l.getFormatFlags(a,g),l.setFormat(f))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);
79
+ c=[];var g=f.getNextSiblings(),h=N(f)?null:f.getTopLevelElementOrThrow();if(B(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),c.push(f);else if(d===e)e=f;else{if(G(f))return!1;[e,f]=f.splitText(d);c.push(f)}f=e;c.push(...g);g=a[0];var k=!1,m=null;for(let r=0;r<a.length;r++){let p=a[r];if(E(p)&&!p.isInline()){if(p.is(g)){if(E(e)&&e.isEmpty()&&e.canReplaceWith(p)){e.replace(p);e=p;k=!0;continue}var l=p.getFirstDescendant();if(zb(l)){for(l=l.getParentOrThrow();l.isInline();)l=
80
80
  l.getParentOrThrow();m=l.getChildren();k=m.length;if(E(e))for(var n=0;n<k;n++)e.append(m[n]);else{for(n=k-1;0<=n;n--)e.insertAfter(m[n]);e=e.getParentOrThrow()}m=m[k-1];l.remove();k=!0;if(l.is(p))continue}}B(e)&&(null===h&&t(27),e=h)}else k&&!A(p)&&N(e.getParent())&&t(28);k=!1;if(E(e)&&!e.isInline())if(m=p,A(p)&&p.isTopLevel())e=e.insertAfter(p);else if(E(p)){if(p.canBeEmpty()||!p.isEmpty())N(e)?(l=e.getChildAtIndex(d),null!==l?l.insertBefore(p):e.append(p),e=p):e=e.insertAfter(p)}else l=e.getFirstChild(),
81
- null!==l?l.insertBefore(p):e.append(p),e=p;else!E(p)||E(p)&&p.isInline()||A(e)&&e.isTopLevel()||Bb(e)?(m=p,e=e.insertAfter(p)):(e=p.getParentOrThrow(),r--)}b&&(B(f)?f.select():(a=e.getPreviousSibling(),B(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(E(e)){if(a=B(m)?m:e.getLastDescendant(),b||(null===a?e.select():B(a)?a.select():a.selectNext()),0!==c.length)for(b=e,a=c.length-1;0<=a;a--)d=c[a],h=d.getParentOrThrow(),E(e)&&!pd(d)?(b===e?e.append(d):e.insertBefore(d),
81
+ null!==l?l.insertBefore(p):e.append(p),e=p;else!E(p)||E(p)&&p.isInline()||A(e)&&e.isTopLevel()||Ab(e)?(m=p,e=e.insertAfter(p)):(e=p.getParentOrThrow(),r--)}b&&(B(f)?f.select():(a=e.getPreviousSibling(),B(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(E(e)){if(a=B(m)?m:e.getLastDescendant(),b||(null===a?e.select():B(a)?a.select():a.selectNext()),0!==c.length)for(b=e,a=c.length-1;0<=a;a--)d=c[a],h=d.getParentOrThrow(),E(e)&&!pd(d)?(b===e?e.append(d):e.insertBefore(d),
82
82
  e=d):E(e)||pd(d)?E(d)&&!d.canInsertAfter(e)?(f=h.constructor.clone(h),E(f)||t(29),f.append(d),e.insertAfter(f)):e.insertAfter(d):(e.insertBefore(d),e=d),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(B(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+1,c.select(e,e)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var f=d.getNextSiblings().reverse();var e=d.getParentOrThrow();var g=e.isInline(),
83
- h=g?e.getTextContentSize():d.getTextContentSize();0===b?f.push(d):(g&&(c=e.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),f.push(d)))}else{e=a.getNode();if(N(e)){f=dd();c=e.getChildAtIndex(b);f.select();null!==c?c.insertBefore(f):e.append(f);return}f=e.getChildren().slice(b).reverse()}d=f.length;if(0===b&&0<d&&e.isInline()){if(c=e.getParentOrThrow(),f=c.insertNewAfter(this),E(f))for(c=c.getChildren(),e=0;e<c.length;e++)f.append(c[e])}else if(g=e.insertNewAfter(this),
83
+ h=g?e.getTextContentSize():d.getTextContentSize();0===b?f.push(d):(g&&(c=e.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),f.push(d)))}else{e=a.getNode();if(N(e)){f=cd();c=e.getChildAtIndex(b);f.select();null!==c?c.insertBefore(f):e.append(f);return}f=e.getChildren().slice(b).reverse()}d=f.length;if(0===b&&0<d&&e.isInline()){if(c=e.getParentOrThrow(),f=c.insertNewAfter(this),E(f))for(c=c.getChildren(),e=0;e<c.length;e++)f.append(c[e])}else if(g=e.insertNewAfter(this),
84
84
  null===g)this.insertLineBreak();else if(E(g))if(h=e.getFirstChild(),0===b&&(e.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)e.insertBefore(g);else{e=null;b=c.length;a=g.getParentOrThrow();if(0<b)for(h=0;h<b;h++)a.append(c[h]);if(0!==d)for(c=0;c<d;c++)b=f[c],null===e?g.append(b):e.insertBefore(b),e=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=nd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),N(c)&&this.insertParagraph());
85
85
  a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return id(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let f=this.focus;var e=a[0];let g=a[c],[h,k]=id(this);if(0===b)return[];if(1===b)return B(e)?(a=h>k?k:h,c=e.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);B(e)&&(d=b?h:k,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));B(g)&&(e=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==
86
- e&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a,g=Tb(d,b);if(A(g)&&!g.isIsolated())a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),e&&f.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),e&&f.set(c,g,"element"));else if(d=window.getSelection())d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&
87
- (b=d.getRangeAt(0),this.applyDOMRange(b),this.dirty=!0,e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,g=b.type,X(b,e.key,e.offset,e.type),X(e,d,f,g),this._cachedNodes=null))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&E(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),
86
+ e&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a,g=Sb(d,b);if(A(g)&&!g.isIsolated())a=b?g.getPreviousSibling():g.getNextSibling(),B(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),e&&f.set(g,b,"text")):(c=g.getParentOrThrow(),E(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),e&&f.set(c,g,"element"));else if(d=window.getSelection())d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&
87
+ (b=d.getRangeAt(0),this.applyDOMRange(b),this.dirty=!0,e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,g=b.type,dd(b,e.key,e.offset,e.type),dd(e,d,f,g),this._cachedNodes=null))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&E(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),
88
88
  E(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){qd(f,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){qd(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=
89
89
  d.offset,g=f.offset;let h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}
90
- function Sc(a){return a instanceof ed}function rd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function id(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[rd(b),rd(a)]}
90
+ function Rc(a){return a instanceof ed}function rd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function id(a){let b=a.anchor;a=a.focus;return"element"===b.type&&"element"===a.type&&b.key===a.key&&b.offset===a.offset?[0,0]:[rd(b),rd(a)]}
91
91
  function qd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),f=d.length,e=0,g=0;for(let h=0;h<f;h++){let k=d[h],m=h===f-1;g=e;e+=k.length;if(b&&e===c||e>c||m){d.splice(h,1);m&&(g=void 0);break}}b=d.join("").trim();""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
92
- function sd(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Kb(f[d]);if(B(f))d=g?f.getTextContentSize():0;else{e=Kb(a);if(null===e)return null;if(E(e)){a=e.getChildAtIndex(d);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));B(a)?(f=a,e=null,d=g?a.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
93
- d=0===b&&A(e)&&Kb(a)===e?d:d+1,e=e.getParentOrThrow();if(E(e))return new V(e.__key,d,"element")}}else f=Kb(a);return B(f)?new V(f.__key,d,"text"):null}
92
+ function sd(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Jb(f[d]);if(B(f))d=g?f.getTextContentSize():0;else{e=Jb(a);if(null===e)return null;if(E(e)){a=e.getChildAtIndex(d);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));B(a)?(f=a,e=null,d=g?a.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
93
+ d=0===b&&A(e)&&Jb(a)===e?d:d+1,e=e.getParentOrThrow();if(E(e))return new V(e.__key,d,"element")}}else f=Jb(a);return B(f)?new V(f.__key,d,"text"):null}
94
94
  function td(a,b,c){var d=a.offset,f=a.getNode();0===d?(d=f.getPreviousSibling(),f=f.getParent(),b)?(c||!b)&&null===d&&E(f)&&f.isInline()&&(b=f.getPreviousSibling(),B(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):E(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):B(d)&&!d.isInert()&&(a.key=d.__key,a.offset=d.getTextContent().length):d===f.getTextContent().length&&(d=f.getNextSibling(),f=f.getParent(),b&&E(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type=
95
- "element"):(c||b)&&null===d&&E(f)&&f.isInline()&&!f.canInsertTextAfter()&&(b=f.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function od(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let f=a.is(b);td(a,d,f);td(b,!d,f);f&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=I();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,X(a,d.key,d.offset,d.type),X(b,c.key,c.offset,c.type))}}
96
- function md(a,b,c,d,f,e){if(null===a||null===c||!vb(f,a,c))return null;b=sd(a,b,C(e)?e.anchor:null);if(null===b)return null;d=sd(c,d,C(e)?e.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=Kb(a),c=Kb(c),A(a)&&A(c)))return null;od(b,d,e);return[b,d]}function pd(a){return E(a)&&!a.isInline()}function ud(a,b,c,d,f,e){let g=H();a=new fd(new V(a,b,f),new V(c,d,e),0);a.dirty=!0;return g._selection=a}
97
- function vd(a){let b=a.getEditorState()._selection,c=window.getSelection();return Sc(b)||hd(b)?b.clone():Tc(b,c,a)}
98
- function Tc(a,b,c){var d=window.event,f=d?d.type:void 0;let e="selectionchange"===f;d=!eb&&(e||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&d&&3===d.detail||void 0===f);let g;if(!C(a)||d){if(null===b)return null;d=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(e&&C(a)&&!vb(c,d,f))return a.clone()}else return a.clone();c=md(d,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new fd(h,k,C(a)?a.format:0)}function v(){return H()._selection}
99
- function Ob(){return I()._editorState._selection}function wd(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),Dd(a));else{var k=a.isBackward();h=k?e:f;var m=h.getNode();f=k?f:e;e=f.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));Dd(a)}}
95
+ "element"):(c||b)&&null===d&&E(f)&&f.isInline()&&!f.canInsertTextAfter()&&(b=f.getNextSibling(),B(b)&&(a.key=b.__key,a.offset=0)))}function od(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let f=a.is(b);td(a,d,f);td(b,!d,f);f&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=I();d.isComposing()&&d._compositionKey!==a.key&&C(c)&&(d=c.anchor,c=c.focus,dd(a,d.key,d.offset,d.type),dd(b,c.key,c.offset,c.type))}}
96
+ function md(a,b,c,d,f,e){if(null===a||null===c||!ub(f,a,c))return null;b=sd(a,b,C(e)?e.anchor:null);if(null===b)return null;d=sd(c,d,C(e)?e.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=Jb(a),c=Jb(c),A(a)&&A(c)))return null;od(b,d,e);return[b,d]}function pd(a){return E(a)&&!a.isInline()}function ud(a,b,c,d,f,e){let g=H();a=new fd(new V(a,b,f),new V(c,d,e),0);a.dirty=!0;return g._selection=a}
97
+ function vd(a){let b=a.getEditorState()._selection,c=window.getSelection();return Rc(b)||hd(b)?b.clone():Sc(b,c,a)}
98
+ function Sc(a,b,c){var d=window.event,f=d?d.type:void 0;let e="selectionchange"===f;d=!eb&&(e||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&d&&3===d.detail||void 0===f);let g;if(!C(a)||d){if(null===b)return null;d=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(e&&C(a)&&!ub(c,d,f))return a.clone()}else return a.clone();c=md(d,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new fd(h,k,C(a)?a.format:0)}function v(){return H()._selection}
99
+ function Nb(){return I()._editorState._selection}function wd(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),Dd(a));else{var k=a.isBackward();h=k?e:f;var m=h.getNode();f=k?f:e;e=f.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));Dd(a)}}
100
100
  function Dd(a){var b=a.anchor,c=b.offset;let d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())E(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),B(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(E(e)){let h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);B(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.__key,e,"text"))}E(g)&&(c=g.getChildrenSize(),f=(b=f>=c)?g.getChildAtIndex(c-
101
101
  1):g.getChildAtIndex(f),B(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.__key,g,"text")))}}function Ed(a,b){b=b.getEditorState()._selection;a=a._selection;if(C(a)){var c=a.anchor;let d=a.focus,f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
102
- function Fd(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,B(f)?h="text":E(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Gd(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}let Y=null,Z=null,W=!1,Hd=!1,Fb=0;function K(){W&&t(13)}
103
- function H(){null===Y&&t(15);return Y}function I(){null===Z&&t(16);return Z}function Id(a,b,c){var d=b.__type;let f=a._nodes.get(d);void 0===f&&t(30);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Jd(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&cc(b)}
104
- function Kd(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let f=I()._compositionKey,e=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let l of g)g=a.get(l),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&cc(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Id(b,g,e),c.add(l);g=b._dirtyLeaves;h=g.size;if(0<h){Fb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let l of k)if(k=l[0],m=l[1],"root"===k||m)g=a.get(k),
105
- void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Id(b,g,e),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Fb++}b._dirtyLeaves=c;b._dirtyElements=d}function Ld(a,b){var c=b.get(a.type);void 0===c&&t(17);c=c.klass;a.type!==c.getType()&&t(18);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let f=Ld(a[d],b);c.append(f)}return c}function Md(a,b){let c=Y,d=W,f=Z;Y=a;W=!0;Z=null;try{return b()}finally{Y=c,W=d,Z=f}}
106
- function Nd(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless;if((null!==c||d)&&null!==b){var f=a._editorState,e=f._selection,g=b._selection,h=0!==a._dirtyType,k=Y,m=W,l=Z,n=a._updating,r=a._observer,p=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==r){Z=a;Y=b;W=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,z=a._dirtyLeaves;r.disconnect();P=Q=O="";fc=2===w;ic=null;R=a;dc=a._config;ec=a._nodes;hc=R._listeners.mutation;jc=y;kc=z;lc=f._nodeMap;mc=b._nodeMap;
107
- gc=b._readOnly;nc=new Map(a._keyToDOMMap);var D=new Map;oc=D;Bc("root",null);oc=nc=dc=mc=lc=kc=jc=ec=R=void 0;p=D}catch(aa){aa instanceof Error&&a._onError(aa);if(Hd)throw aa;Od(a,null,c,b);sb(a);a._dirtyType=2;Hd=!0;Nd(a);Hd=!1;return}finally{r.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,W=m,Z=l}}b._readOnly=!0;n=a._dirtyLeaves;r=a._dirtyElements;D=a._normalizedNodes;w=a._updateTags;z=a._pendingDecorators;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=
108
- new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);y=a._decorators;var F=a._pendingDecorators||y,ea=b._nodeMap;for(Na in F)ea.has(Na)||(F===y&&(F=Gb(a)),delete F[Na]);d=d?null:window.getSelection();if(!a._readOnly&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let aa=d.anchorNode,lb=d.focusNode,le=d.anchorOffset,me=d.focusOffset,mb=document.activeElement;if(!w.has("collaboration")||mb===c)if(C(g)){var S=g.anchor,Ub=g.focus,xd=S.key,ta=Ub.key,yd=Yb(a,xd),zd=Yb(a,
109
- ta),Vb=S.offset,Ad=Ub.offset,Wb=g.format,Bd=g.isCollapsed();h=yd;ta=zd;var Na=!1;"text"===S.type&&(h=yb(yd),Na=S.getNode().getFormat()!==Wb);"text"===Ub.type&&(ta=yb(zd));if(null!==h&&null!==ta){if(Bd&&(null===e||Na||C(e)&&e.format!==Wb)){var ne=performance.now();Pc=[Wb,Vb,xd,ne]}if(le===Vb&&me===Ad&&aa===h&&lb===ta&&("Range"!==d.type||!Bd)&&(null===c||null!==mb&&c.contains(mb)||c.focus({preventScroll:!0}),!Ua&&!Ta||"element"!==S.type))break a;try{d.setBaseAndExtent(h,Vb,ta,Ad);if(g.isCollapsed()&&
110
- null!==c&&c===mb){let Oa=S.getNode();if(E(Oa)){let ja=Oa.getDescendantByIndex(S.offset);null!==ja&&(Oa=ja)}let ua=a.getElementByKey(Oa.__key);if(null!==ua){let ja=ua.getBoundingClientRect();if(ja.bottom>window.innerHeight)ua.scrollIntoView(!1);else if(0>ja.top)ua.scrollIntoView();else{let Cd=c.getBoundingClientRect();Math.floor(ja.bottom)>Math.floor(Cd.bottom)?ua.scrollIntoView(!1):Math.floor(ja.top)<Math.floor(Cd.top)&&ua.scrollIntoView()}w.add("scroll-into-view")}}Mc=!0}catch(Oa){}}}else null!==
111
- e&&vb(a,aa,lb)&&d.removeAllRanges()}}finally{Z=l,Y=k}}null!==p&&Pd(a,f,b,p);null!==z&&(a._decorators=z,a._pendingDecorators=null,Qd("decorator",a,!0,z));c=Hb(f);e=Hb(b);c!==e&&Qd("textcontent",a,!0,e);Qd("update",a,!0,{dirtyElements:r,dirtyLeaves:n,editorState:b,normalizedNodes:D,prevEditorState:f,tags:w});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(f=0;f<m.length;f++)m[f]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [aa,lb]=b;Rd(a,aa,lb)}}}
112
- function Pd(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Qd(a,b,c,...d){let f=b._updating;b._updating=c;try{let e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a].apply(null,d)}finally{b._updating=f}}
113
- function U(a,b,c){if(!1===a._updating||Z!==a){let e=!1;a.update(()=>{e=U(a,b,c)});return e}let d=Lb(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(let h of f)if(!0===h(c,a))return!0}return!1}function Sd(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [f,e]=d,g;void 0!==e&&(d=e.onUpdate,g=e.tag,e.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));f()}}return b}
114
- function Rd(a,b,c){let d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms||!1}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new Td(new Map(c._nodeMap)),g=!0);let h=Y,k=W,m=Z,l=a._updating;Y=e;W=!1;a._updating=!0;Z=a;try{g&&!a._headless&&(e._selection=vd(a));let n=a._compositionKey;b();f=Sd(a,f);Ed(e,a);0!==a._dirtyType&&(f?Jd(e,a):Kd(e,a),Sd(a),$b(c,e,a._dirtyLeaves,a._dirtyElements));
115
- n!==a._compositionKey&&(e._flushSync=!0);let r=e._selection;if(C(r)){let p=e._nodeMap,w=r.focus.key;void 0!==p.get(r.anchor.key)&&void 0!==p.get(w)||t(19)}else Sc(r)&&0===r._nodes.size&&(e._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Nd(a);return}finally{Y=h,W=k,Z=m,a._updating=l,Fb=0}0!==a._dirtyType||Ud(e,a)?e._flushSync?(e._flushSync=!1,Nd(a)):g&&ub(()=>{Nd(a)}):(e._flushSync=
116
- !1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function x(a,b,c){a._updating?a._updates.push([b,c]):Rd(a,b,c)}
117
- function Vd(a,b,c){K();var d=a.__key;let f=a.getParent();if(null!==f){var e=v(),g=!1;if(C(e)&&b){var h=e.anchor;let k=e.focus;h.key===d&&(Fd(h,a,f,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Fd(k,a,f,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=f.getWritable().__children;d=h.indexOf(d);-1===d&&t(31);Db(a);h.splice(d,1);a.getWritable().__parent=null;C(e)&&b&&!g&&wd(e,f,d,-1);c||null===f||N(f)||f.canBeEmpty()||!f.isEmpty()||Vd(f,b);null!==f&&N(f)&&f.isEmpty()&&f.selectEnd()}}
118
- function Wd(a){a=L(a);null===a&&t(63);return a}
119
- class Xd{static getType(){t(64)}static clone(){t(65)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{K();99<Fb&&t(14);a=I();var b=H(),c=""+tb++;b._nodeMap.set(c,this);E(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=v();if(null==
102
+ function Fd(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,B(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,B(f)?h="text":E(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function Gd(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}let Y=null,Z=null,X=!1,Hd=!1,Eb=0;function K(){X&&t(13)}
103
+ function H(){null===Y&&t(15);return Y}function I(){null===Z&&t(16);return Z}function Id(a,b,c){var d=b.__type;let f=a._nodes.get(d);void 0===f&&t(30);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Jd(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),B(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&bc(b)}
104
+ function Kd(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let f=I()._compositionKey,e=new Map;var g=c;let h=g.size;for(var k=d,m=k.size;0<h||0<m;){if(0<h){b._dirtyLeaves=new Set;for(let l of g)g=a.get(l),B(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&bc(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Id(b,g,e),c.add(l);g=b._dirtyLeaves;h=g.size;if(0<h){Eb++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(let l of k)if(k=l[0],m=l[1],"root"===k||m)g=a.get(k),
105
+ void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Id(b,g,e),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Eb++}b._dirtyLeaves=c;b._dirtyElements=d}function Ld(a,b){var c=b.get(a.type);void 0===c&&t(17);c=c.klass;a.type!==c.getType()&&t(18);c=c.importJSON(a);a=a.children;if(E(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let f=Ld(a[d],b);c.append(f)}return c}function Md(a,b){let c=Y,d=X,f=Z;Y=a;X=!0;Z=null;try{return b()}finally{Y=c,X=d,Z=f}}
106
+ function Nd(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless;if((null!==c||d)&&null!==b){var f=a._editorState,e=f._selection,g=b._selection,h=0!==a._dirtyType,k=Y,m=X,l=Z,n=a._updating,r=a._observer,p=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==r){Z=a;Y=b;X=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,z=a._dirtyLeaves;r.disconnect();P=Q=O="";ec=2===w;hc=null;R=a;cc=a._config;dc=a._nodes;gc=R._listeners.mutation;ic=y;jc=z;kc=f._nodeMap;lc=b._nodeMap;
107
+ fc=b._readOnly;mc=new Map(a._keyToDOMMap);var D=new Map;nc=D;Ac("root",null);nc=mc=cc=lc=kc=jc=ic=dc=R=void 0;p=D}catch(W){W instanceof Error&&a._onError(W);if(Hd)throw W;Od(a,null,c,b);rb(a);a._dirtyType=2;Hd=!0;Nd(a);Hd=!1;return}finally{r.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,X=m,Z=l}}b._readOnly=!0;n=a._dirtyLeaves;r=a._dirtyElements;D=a._normalizedNodes;w=a._updateTags;z=a._pendingDecorators;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=
108
+ new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);y=a._decorators;var F=a._pendingDecorators||y,ea=b._nodeMap;for(Oa in F)ea.has(Oa)||(F===y&&(F=Fb(a)),delete F[Oa]);d=d?null:window.getSelection();if(!a._readOnly&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let W=d.anchorNode,ta=d.focusNode,le=d.anchorOffset,me=d.focusOffset,mb=document.activeElement;if(!w.has("collaboration")||mb===c)if(C(g)){var S=g.anchor,Ub=g.focus,xd=S.key,ua=Ub.key,yd=Xb(a,xd),zd=Xb(a,ua),
109
+ Vb=S.offset,Ad=Ub.offset,Wb=g.format,Bd=g.isCollapsed();h=yd;ua=zd;var Oa=!1;"text"===S.type&&(h=xb(yd),Oa=S.getNode().getFormat()!==Wb);"text"===Ub.type&&(ua=xb(zd));if(null!==h&&null!==ua){if(Bd&&(null===e||Oa||C(e)&&e.format!==Wb)){var ne=performance.now();Oc=[Wb,Vb,xd,ne]}if(le===Vb&&me===Ad&&W===h&&ta===ua&&("Range"!==d.type||!Bd)&&(null===c||null!==mb&&c.contains(mb)||c.focus({preventScroll:!0}),!Ua&&!Ta||"element"!==S.type))break a;try{d.setBaseAndExtent(h,Vb,ua,Ad);if(g.isCollapsed()&&null!==
110
+ c&&c===mb){let Pa=S.getNode();if(E(Pa)){let ja=Pa.getDescendantByIndex(S.offset);null!==ja&&(Pa=ja)}let va=a.getElementByKey(Pa.__key);if(null!==va){let ja=va.getBoundingClientRect();if(ja.bottom>window.innerHeight)va.scrollIntoView(!1);else if(0>ja.top)va.scrollIntoView();else{let Cd=c.getBoundingClientRect();Math.floor(ja.bottom)>Math.floor(Cd.bottom)?va.scrollIntoView(!1):Math.floor(ja.top)<Math.floor(Cd.top)&&va.scrollIntoView()}w.add("scroll-into-view")}}Lc=!0}catch(Pa){}}}else null!==e&&ub(a,
111
+ W,ta)&&d.removeAllRanges()}}finally{Z=l,Y=k}}if(null!==p)for(c=p,e=Array.from(a._listeners.mutation),g=e.length,k=0;k<g;k++){let [W,ta]=e[k];l=c.get(ta);void 0!==l&&W(l)}null!==z&&(a._decorators=z,a._pendingDecorators=null,Pd("decorator",a,!0,z));c=Gb(f);e=Gb(b);c!==e&&Pd("textcontent",a,!0,e);Pd("update",a,!0,{dirtyElements:r,dirtyLeaves:n,editorState:b,normalizedNodes:D,prevEditorState:f,tags:w});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(f=0;f<m.length;f++)m[f]()}finally{a._updating=
112
+ b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [W,ta]=b;Qd(a,W,ta)}}}function Pd(a,b,c,...d){let f=b._updating;b._updating=c;try{let e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a].apply(null,d)}finally{b._updating=f}}
113
+ function U(a,b,c){if(!1===a._updating||Z!==a){let e=!1;a.update(()=>{e=U(a,b,c)});return e}let d=Kb(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._commands.get(b);if(void 0!==f&&(f=f[e],void 0!==f)){f=Array.from(f);let h=f.length;for(let k=0;k<h;k++)if(!0===f[k](c,a))return!0}}return!1}
114
+ function Rd(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [f,e]=d,g;void 0!==e&&(d=e.onUpdate,g=e.tag,e.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));f()}}return b}
115
+ function Qd(a,b,c){let d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms||!1}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new Sd(new Map(c._nodeMap)),g=!0);let h=Y,k=X,m=Z,l=a._updating;Y=e;X=!1;a._updating=!0;Z=a;try{g&&!a._headless&&(e._selection=vd(a));let n=a._compositionKey;b();f=Rd(a,f);Ed(e,a);0!==a._dirtyType&&(f?Jd(e,a):Kd(e,a),Rd(a),Zb(c,e,a._dirtyLeaves,a._dirtyElements));
116
+ n!==a._compositionKey&&(e._flushSync=!0);let r=e._selection;if(C(r)){let p=e._nodeMap,w=r.focus.key;void 0!==p.get(r.anchor.key)&&void 0!==p.get(w)||t(19)}else Rc(r)&&0===r._nodes.size&&(e._selection=null)}catch(n){n instanceof Error&&a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Nd(a);return}finally{Y=h,X=k,Z=m,a._updating=l,Eb=0}0!==a._dirtyType||Td(e,a)?e._flushSync?(e._flushSync=!1,Nd(a)):g&&tb(()=>{Nd(a)}):(e._flushSync=
117
+ !1,g&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function x(a,b,c){a._updating?a._updates.push([b,c]):Qd(a,b,c)}
118
+ function Ud(a,b,c){K();var d=a.__key;let f=a.getParent();if(null!==f){var e=v(),g=!1;if(C(e)&&b){var h=e.anchor;let k=e.focus;h.key===d&&(Fd(h,a,f,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Fd(k,a,f,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=f.getWritable().__children;d=h.indexOf(d);-1===d&&t(31);Cb(a);h.splice(d,1);a.getWritable().__parent=null;C(e)&&b&&!g&&wd(e,f,d,-1);c||null===f||N(f)||f.canBeEmpty()||!f.isEmpty()||Ud(f,b);null!==f&&N(f)&&f.isEmpty()&&f.selectEnd()}}
119
+ function Vd(a){a=L(a);null===a&&t(63);return a}
120
+ class Wd{static getType(){t(64)}static clone(){t(65)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{K();99<Eb&&t(14);a=I();var b=H(),c=""+sb++;b._nodeMap.set(c,this);E(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=L(a);if(null===a)break;a=a.__parent}return!1}isSelected(){let a=v();if(null==
120
121
  a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return B(this)?b:C(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){let a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){let a=this.getLatest().__parent;return null===a?null:L(a)}getParentOrThrow(){let a=this.getParent();null===a&&t(66);return a}getTopLevelElement(){let a=this;for(;null!==
121
122
  a;){let b=a.getParent();if(N(b)&&E(a))return a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&t(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){let a=[],b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=a.indexOf(this.__key);return 0>=b?null:L(a[b-1])}getPreviousSiblings(){var a=
122
- this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(0,b).map(c=>Wd(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:L(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(b+1).map(c=>Wd(c))}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(a)&&c.unshift(a);
123
+ this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(0,b).map(c=>Vd(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:L(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(b+1).map(c=>Vd(c))}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();E(this)&&b.unshift(this);E(a)&&c.unshift(a);
123
124
  a=b.length;var d=c.length;if(0===a||0===d||b[a-1]!==c[d-1])return null;c=new Set(c);for(d=0;d<a;d++){let f=b[d];if(c.has(f))return f}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;if(this.isParentOf(a))return!1;var b=this.getCommonAncestor(a);let c=this;for(;;){var d=c.getParentOrThrow();if(d===b){d=d.__children.indexOf(c.__key);break}c=d}for(c=a;;){a=c.getParentOrThrow();if(a===b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){let b=
124
125
  this.__key;if(b===a.__key)return!1;for(;null!==a;){if(a.__key===b)return!0;a=a.getParent()}return!1}getNodesBetween(a){let b=this.isBefore(a),c=[],d=new Set;for(var f=this;;){var e=f.__key;d.has(e)||(d.add(e),c.push(f));if(f===a)break;e=E(f)?b?f.getFirstChild():f.getLastChild():null;if(null!==e)f=e;else if(e=b?f.getNextSibling():f.getPreviousSibling(),null!==e)f=e;else{f=f.getParentOrThrow();d.has(f.__key)||c.push(f);if(f===a)break;e=f;do null===e&&t(68),f=b?e.getNextSibling():e.getPreviousSibling(),
125
- e=e.getParent(),null!==e&&(null!==f||d.has(e.__key)||c.push(e));while(null===f)}}b||c.reverse();return c}isDirty(){let a=I()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&t(69);return a}getWritable(){K();var a=H(),b=I();a=a._nodeMap;let c=this.__key,d=this.getLatest(),f=d.__parent;b=b._cloneNotNeeded;var e=v();null!==e&&(e._cachedNodes=null);if(b.has(c))return Eb(d),d;e=d.constructor.clone(d);e.__parent=f;E(d)&&E(e)?(e.__children=Array.from(d.__children),
126
- e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):B(d)&&B(e)&&(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail);b.add(c);e.__key=c;Eb(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){t(70)}updateDOM(){t(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){t(72)}static importJSON(){t(18)}remove(a){K();Vd(this,!0,a)}replace(a){K();let b=this.__key;a=a.getWritable();
127
- Cb(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let f=d.indexOf(this.__key),e=a.__key;-1===f&&t(31);d.splice(f,0,e);a.__parent=c.__key;Vd(this,!1);Db(a);d=v();C(d)&&(c=d.anchor,d=d.focus,c.key===b&&bd(c,a),d.key===b&&bd(d,a));I()._compositionKey===b&&J(e);return a}insertAfter(a){K();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let f=v();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(Cb(c),C(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===
128
- e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;let k=e.__children;b=k.indexOf(b.__key);-1===b&&t(31);k.splice(b+1,0,d);Db(c);C(f)&&(wd(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a){K();var b=this.getWritable(),c=a.getWritable();Cb(c);let d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;let e=d.__children;b=e.indexOf(b.__key);-1===b&&
129
- t(31);e.splice(b,0,f);Db(c);c=v();C(c)&&wd(c,d,b);return a}selectPrevious(a,b){K();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){K();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
130
- class Yd extends Xd{constructor(a){super(a)}decorate(){t(47)}isIsolated(){return!1}isTopLevel(){return!1}}function A(a){return a instanceof Yd}
131
- class Zd extends Xd{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return bb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=L(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
126
+ e=e.getParent(),null!==e&&(null!==f||d.has(e.__key)||c.push(e));while(null===f)}}b||c.reverse();return c}isDirty(){let a=I()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&t(69);return a}getWritable(){K();var a=H(),b=I();a=a._nodeMap;let c=this.__key,d=this.getLatest(),f=d.__parent;b=b._cloneNotNeeded;var e=v();null!==e&&(e._cachedNodes=null);if(b.has(c))return Db(d),d;e=d.constructor.clone(d);e.__parent=f;E(d)&&E(e)?(e.__children=Array.from(d.__children),
127
+ e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):B(d)&&B(e)&&(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail);b.add(c);e.__key=c;Db(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){t(70)}updateDOM(){t(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){t(72)}static importJSON(){t(18)}remove(a){K();Ud(this,!0,a)}replace(a){K();let b=this.__key;a=a.getWritable();
128
+ Bb(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let f=d.indexOf(this.__key),e=a.__key;-1===f&&t(31);d.splice(f,0,e);a.__parent=c.__key;Ud(this,!1);Cb(a);d=v();C(d)&&(c=d.anchor,d=d.focus,c.key===b&&ad(c,a),d.key===b&&ad(d,a));I()._compositionKey===b&&J(e);return a}insertAfter(a){K();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let f=v();var e=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(Bb(c),C(f)&&(h=d.__key,g=f.anchor,d=f.focus,g="element"===g.type&&g.key===h&&g.offset===
129
+ e+1,h="element"===d.type&&d.key===h&&d.offset===e+1));e=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;let k=e.__children;b=k.indexOf(b.__key);-1===b&&t(31);k.splice(b+1,0,d);Cb(c);C(f)&&(wd(f,e,b+1),c=e.__key,g&&f.anchor.set(c,b+2,"element"),h&&f.focus.set(c,b+2,"element"));return a}insertBefore(a){K();var b=this.getWritable(),c=a.getWritable();Bb(c);let d=this.getParentOrThrow().getWritable(),f=c.__key;c.__parent=b.__parent;let e=d.__children;b=e.indexOf(b.__key);-1===b&&
130
+ t(31);e.splice(b,0,f);Cb(c);c=v();C(c)&&wd(c,d,b);return a}selectPrevious(a,b){K();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):E(c)?c.select():B(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){K();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):B(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
131
+ class Xd extends Wd{constructor(a){super(a)}decorate(){t(47)}isIsolated(){return!1}isTopLevel(){return!1}}function A(a){return a instanceof Xd}
132
+ class Yd extends Wd{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return bb[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=L(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
132
133
  this.getChildrenSize()}isDirty(){let a=I()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest();return a.getParentOrThrow().getLastChild()===a}getAllTextNodes(a){let b=[],c=this.getLatest().__children;for(let f=0;f<c.length;f++){var d=L(c[f]);!B(d)||!a&&d.isInert()?E(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(E(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
133
134
  this.getLastChild();for(;null!==a;){if(E(a)){let b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){let b=this.getChildren(),c=b.length;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a||null;a=b[a];return E(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__children;return 0===a.length?null:L(a[0])}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&t(45);return a}getLastChild(){let a=this.getLatest().__children,b=a.length;
134
135
  return 0===b?null:L(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:L(a)}getTextContent(a,b){let c="",d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){let g=d[e];c+=g.getTextContent(a,b);E(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=ab[a],0!==(this.getFormat()&a)):!1}select(a,b){K();let c=v();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(C(c))c.anchor.set(d,
135
136
  a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return ud(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return E(a)||B(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return E(a)||B(a)?a.select():null!==a?a.selectNext():this.select()}clear(){K();let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){K();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){K();
136
- let b=this.getWritable();b.__dir=a;return b}setFormat(a){K();this.getWritable().__format=""!==a?ab[a]:0;return this}setIndent(a){K();this.getWritable().__indent=a;return this}splice(a,b,c){K();let d=this.getWritable();var f=d.__key;let e=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){let m=c[k],l=m.getWritable();m.__key===f&&t(46);Cb(l);l.__parent=f;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Eb(c);(f=this.getChildAtIndex(a+b))&&Eb(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);
137
+ let b=this.getWritable();b.__dir=a;return b}setFormat(a){K();this.getWritable().__format=""!==a?ab[a]:0;return this}setIndent(a){K();this.getWritable().__indent=a;return this}splice(a,b,c){K();let d=this.getWritable();var f=d.__key;let e=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){let m=c[k],l=m.getWritable();m.__key===f&&t(46);Bb(l);l.__parent=f;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Db(c);(f=this.getChildAtIndex(a+b))&&Db(f);a===e.length?(e.push(...h),a=[]):a=e.splice(a,b,...h);
137
138
  if(a.length&&(b=v(),C(b))){let k=new Set(a),m=new Set(h);h=r=>{for(r=r.getNode();r;){const p=r.__key;if(k.has(p)&&!m.has(p))return!0;r=r.getParent()}return!1};let {anchor:l,focus:n}=b;h(l)&&Fd(l,l.getNode(),this,c,f);h(n)&&Fd(n,n.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=L(a[b]),null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||N(this)||this.remove()}return d}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),
138
- type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function E(a){return a instanceof Zd}
139
- class $d extends Zd{static getType(){return"root"}static clone(){return new $d}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(a,b){let c=this.__cachedText;return!W&&0!==I()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){t(52)}replace(){t(53)}insertBefore(){t(54)}insertAfter(){t(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||A(c)||t(56)}return super.append(...a)}static importJSON(a){let b=
140
- Ib();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function N(a){return a instanceof $d}function Ud(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function ae(){return new Td(new Map([["root",new $d]]))}
141
- function be(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&t(58);let c=b.children;if(E(a)){Array.isArray(c)||t(59);a=a.getChildren();for(let d=0;d<a.length;d++){let f=be(a[d]);c.push(f)}}return b}
142
- class Td{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return Md(this,a)}clone(a){a=new Td(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return Md(this,()=>({root:be(Ib())}))}}
143
- class ce extends Xd{static getType(){return"linebreak"}static clone(a){return new ce(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:de,priority:0}}}}static importJSON(){return nd()}exportJSON(){return{type:"linebreak",version:1}}}function de(){return{node:nd()}}function nd(){return new ce}
144
- function Bb(a){return a instanceof ce}function ee(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function fe(a,b){return b&1?"strong":b&2?"em":"span"}
145
- function ge(a,b,c,d,f){a=d.classList;d=Qb(f,"base");void 0!==d&&a.add(...d);d=Qb(f,"underlineStrikethrough");let e=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Za)h=Za[k],d=Qb(f,k),void 0!==d&&(c&h?!e||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
146
- function he(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Va:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Ra){c=b.length;let f=a.length,e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}
147
- class ie extends Xd{static getType(){return"text"}static clone(a){return new ie(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return db[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===I()._compositionKey}isSegmented(){return 2===
148
- this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Za[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return zb(c,a,b)}createDOM(a){var b=this.__format,
149
- c=ee(this,b);let d=fe(this,b),f=document.createElement(null===c?d:c),e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;he(this.__text,c,this);a=a.theme.text;void 0!==a&&ge(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){let d=this.__text;var f=a.__format,e=this.__format,g=ee(this,f);let h=ee(this,e);var k=fe(this,f);let m=fe(this,e);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return f=b.firstChild,null==f&&t(48),a=g=document.createElement(m),
150
- he(d,a,this),c=c.theme.text,void 0!==c&&ge(m,0,e,a,c),b.replaceChild(g,f),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&t(49));he(d,k,this);c=c.theme.text;void 0!==c&&f!==e&&ge(m,f,e,k,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:je,priority:0}),b:()=>({conversion:ke,priority:0}),em:()=>({conversion:oe,priority:0}),i:()=>({conversion:oe,priority:0}),span:()=>({conversion:pe,priority:0}),strong:()=>({conversion:oe,priority:0}),
151
- u:()=>({conversion:oe,priority:0})}}static importJSON(a){let b=M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){K();let b=this.getWritable();b.__format="string"===typeof a?Za[a]:a;return b}setDetail(a){K();let b=this.getWritable();b.__detail="string"===typeof a?
139
+ type:"element",version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function E(a){return a instanceof Yd}
140
+ class Zd extends Yd{static getType(){return"root"}static clone(){return new Zd}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){t(51)}getTextContent(a,b){let c=this.__cachedText;return!X&&0!==I()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){t(52)}replace(){t(53)}insertBefore(){t(54)}insertAfter(){t(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];E(c)||A(c)||t(56)}return super.append(...a)}static importJSON(a){let b=
141
+ Hb();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function N(a){return a instanceof Zd}function Td(a,b){b=b.getEditorState()._selection;a=a._selection;if(null!==a){if(a.dirty||!a.is(b))return!0}else if(null!==b)return!0;return!1}function $d(){return new Sd(new Map([["root",new Zd]]))}
142
+ function ae(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&t(58);let c=b.children;if(E(a)){Array.isArray(c)||t(59);a=a.getChildren();for(let d=0;d<a.length;d++){let f=ae(a[d]);c.push(f)}}return b}
143
+ class Sd{constructor(a,b){this._nodeMap=a;this._selection=b||null;this._readOnly=this._flushSync=!1}isEmpty(){return 1===this._nodeMap.size&&null===this._selection}read(a){return Md(this,a)}clone(a){a=new Sd(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return Md(this,()=>({root:ae(Hb())}))}}
144
+ class be extends Wd{static getType(){return"linebreak"}static clone(a){return new be(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static importDOM(){return{br:a=>{let b=a.parentElement;return null!=b&&b.firstChild===a&&b.lastChild===a?null:{conversion:ce,priority:0}}}}static importJSON(){return nd()}exportJSON(){return{type:"linebreak",version:1}}}function ce(){return{node:nd()}}function nd(){return new be}
145
+ function Ab(a){return a instanceof be}function de(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ee(a,b){return b&1?"strong":b&2?"em":"span"}
146
+ function fe(a,b,c,d,f){a=d.classList;d=Pb(f,"base");void 0!==d&&a.add(...d);d=Pb(f,"underlineStrikethrough");let e=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Za)h=Za[k],d=Pb(f,k),void 0!==d&&(c&h?!e||"underline"!==k&&"strikethrough"!==k?(0===(b&h)||g&&"underline"===k||"strikethrough"===k)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
147
+ function ge(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Va:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Ra){c=b.length;let f=a.length,e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}
148
+ class he extends Wd{static getType(){return"text"}static clone(a){return new he(a.__text,a.__key)}constructor(a,b){super(b);this.__text=a;this.__format=0;this.__style="";this.__detail=this.__mode=0}getFormat(){return this.getLatest().__format}getDetail(){return this.getLatest().__detail}getMode(){let a=this.getLatest();return db[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===I()._compositionKey}isSegmented(){return 2===
149
+ this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Za[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return yb(c,a,b)}createDOM(a){var b=this.__format,
150
+ c=de(this,b);let d=ee(this,b),f=document.createElement(null===c?d:c),e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;ge(this.__text,c,this);a=a.theme.text;void 0!==a&&fe(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){let d=this.__text;var f=a.__format,e=this.__format,g=de(this,f);let h=de(this,e);var k=ee(this,f);let m=ee(this,e);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return f=b.firstChild,null==f&&t(48),a=g=document.createElement(m),
151
+ ge(d,a,this),c=c.theme.text,void 0!==c&&fe(m,0,e,a,c),b.replaceChild(g,f),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&t(49));ge(d,k,this);c=c.theme.text;void 0!==c&&f!==e&&fe(m,f,e,k,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static importDOM(){return{"#text":()=>({conversion:ie,priority:0}),b:()=>({conversion:je,priority:0}),em:()=>({conversion:ke,priority:0}),i:()=>({conversion:ke,priority:0}),span:()=>({conversion:oe,priority:0}),strong:()=>({conversion:ke,priority:0}),
152
+ u:()=>({conversion:ke,priority:0})}}static importJSON(a){let b=M(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){K();let b=this.getWritable();b.__format="string"===typeof a?Za[a]:a;return b}setDetail(a){K();let b=this.getWritable();b.__detail="string"===typeof a?
152
153
  $a[a]:a;return b}setStyle(a){K();let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=Za[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){K();let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){K();let a=this.getWritable();a.__detail^=2;return a}setMode(a){K();a=cb[a];let b=this.getWritable();b.__mode=a;return b}setTextContent(a){K();let b=this.getWritable();b.__text=a;return b}select(a,b){K();let c=v();var d=this.getTextContent();let f=this.__key;"string"===
153
154
  typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(C(c))d=I()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||J(f),c.setTextNodeRange(this,a,this,b);else return ud(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){K();let f=this.getWritable(),e=f.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=v();d&&C(k)&&(a+=g,k.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);f.__text=b;return f}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){K();var b=
154
155
  this.getLatest(),c=b.getTextContent(),d=b.__key,f=I()._compositionKey,e=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&e.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);e=a.length;if(0===e)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=c.__key;let l=b.getFormat(),n=b.getStyle(),r=b.__detail;g=!1;b.isSegmented()?(h=M(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=r,g=!0):(h=b.getWritable(),h.__text=m);b=v();h=[h];m=m.length;for(let y=1;y<e;y++){var p=a[y],
155
- w=p.length;p=M(p).getWritable();p.__format=l;p.__style=n;p.__detail=r;let z=p.__key;w=m+w;if(C(b)){let D=b.anchor,F=b.focus;D.key===d&&"text"===D.type&&D.offset>m&&D.offset<=w&&(D.key=z,D.offset-=m,b.dirty=!0);F.key===d&&"text"===F.type&&F.offset>m&&F.offset<=w&&(F.key=z,F.offset-=m,b.dirty=!0)}f===d&&J(z);m=w;p.__parent=k;h.push(p)}Db(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);C(b)&&wd(b,c,d,e-1);return h}mergeWithSibling(a){var b=
156
+ w=p.length;p=M(p).getWritable();p.__format=l;p.__style=n;p.__detail=r;let z=p.__key;w=m+w;if(C(b)){let D=b.anchor,F=b.focus;D.key===d&&"text"===D.type&&D.offset>m&&D.offset<=w&&(D.key=z,D.offset-=m,b.dirty=!0);F.key===d&&"text"===F.type&&F.offset>m&&F.offset<=w&&(F.key=z,F.offset-=m,b.dirty=!0)}f===d&&J(z);m=w;p.__parent=k;h.push(p)}Cb(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(y=>y.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);C(b)&&wd(b,c,d,e-1);return h}mergeWithSibling(a){var b=
156
157
  a===this.getPreviousSibling();b||a===this.getNextSibling()||t(50);var c=this.__key;let d=a.__key,f=this.__text,e=f.length;I()._compositionKey===d&&J(c);let g=v();if(C(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Gd(h,b,c,a,e),g.dirty=!0);null!==k&&k.key===d&&(Gd(k,b,c,a,e),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+f:f+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
157
- function pe(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,f="underline"===a.style.textDecoration;return{forChild:e=>{B(e)&&b&&e.toggleFormat("bold");B(e)&&c&&e.toggleFormat("strikethrough");B(e)&&d&&e.toggleFormat("italic");B(e)&&f&&e.toggleFormat("underline");return e},node:null}}function ke(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}
158
- function je(a){let {parentElement:b}=a;a=a.textContent||"";let c=a.trim();return null!=b&&"pre"===b.tagName.toLowerCase()||0!==c.length||!a.includes("\n")?{node:M(a)}:{node:null}}let qe={em:"italic",i:"italic",strong:"bold",u:"underline"};function oe(a){let b=qe[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return new ie(a)}function B(a){return a instanceof ie}
159
- class re extends Zd{static getType(){return"paragraph"}static clone(a){return new re(a.__key)}createDOM(a){let b=document.createElement("p");a=Qb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:se,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));return{element:a}}static importJSON(a){let b=dd();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);
160
- return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=dd(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function se(){return{node:dd()}}
161
- function dd(){return new re}function Od(a,b,c,d){let f=a._keyToDOMMap;f.clear();a._editorState=ae();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
162
- function te(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
163
- class ue{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
164
- new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Mb();this._onError=f;this._htmlConversions=e;this._headless=this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){let b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;b.add(a);return()=>
158
+ function oe(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,f="underline"===a.style.textDecoration,e=a.style.verticalAlign,g=a.style.backgroundColor,h=a.style.color;return{forChild:k=>{if(!B(k))return k;b&&k.toggleFormat("bold");c&&k.toggleFormat("strikethrough");d&&k.toggleFormat("italic");f&&k.toggleFormat("underline");"sub"===e&&k.toggleFormat("subscript");"super"===e&&k.toggleFormat("superscript");let m="";h&&"rgb(0, 0, 0)"!==h&&(m+=
159
+ `color: ${h};`);g&&"transparent"!==g&&(m+=`background-color: ${g};`);""!==m&&k.setStyle(m);return k},node:null}}function je(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{B(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function ie(a){let {parentElement:b}=a;a=a.textContent||"";let c=a.trim();return null!=b&&"pre"===b.tagName.toLowerCase()||0!==c.length||!a.includes("\n")?{node:M(a)}:{node:null}}let pe={em:"italic",i:"italic",strong:"bold",u:"underline"};
160
+ function ke(a){let b=pe[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{B(c)&&c.toggleFormat(b);return c},node:null}}function M(a=""){return new he(a)}function B(a){return a instanceof he}
161
+ class qe extends Yd{static getType(){return"paragraph"}static clone(a){return new qe(a.__key)}createDOM(a){let b=document.createElement("p");a=Pb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:re,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));return{element:a}}static importJSON(a){let b=cd();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);
162
+ return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=cd(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||B(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function re(){return{node:cd()}}
163
+ function cd(){return new qe}function Od(a,b,c,d){let f=a._keyToDOMMap;f.clear();a._editorState=$d();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
164
+ function se(a){let b=new Map,c=new Set;a.forEach(d=>{d=null!=d.klass.importDOM?d.klass.importDOM.bind(d.klass):null;if(null!=d&&!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
165
+ class te{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
166
+ new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Lb();this._onError=f;this._htmlConversions=e;this._headless=this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){let b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;b.add(a);return()=>
165
167
  {b.delete(a)}}registerTextContentListener(a){let b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){let b=this._listeners.root;a(this._rootElement,null);b.add(a);return()=>{a(null,this._rootElement);b.delete(a)}}registerCommand(a,b,c){void 0===c&&t(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let f=d.get(a);void 0===f&&t(36);let e=f[c];e.add(b);return()=>{e.delete(b);f.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
166
- b){void 0===this._nodes.get(a.getType())&&t(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&t(37);let d=c.transforms;d.add(b);Jb(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return U(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
167
- this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Od(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Lc&&(Lc--,0===Lc&&b.ownerDocument.removeEventListener("selectionchange",Zc));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Lb(c);d=d[d.length-1]._key;Yc.get(d)===c&&Yc.delete(d)}else Yc.delete(c._key);b.__lexicalEditor=null}c=Xc(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,
168
- c.userSelect="text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,sb(this),this._updateTags.add("history-merge"),Nd(this),this._config.disableEvents||$c(a,this));Qd("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&t(38);rb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=
169
- b&&d.add(b),Nd(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);Nd(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ae(),d=Y,f=W,e=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;W=!1;Z=this;try{Ld(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=
170
- g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,W=f,Z=e}return c}update(a,b){x(this,a,b)}focus(a){let b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),x(this,()=>{let c=v(),d=Ib();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly!==
171
- a&&(this._readOnly=a,Qd("readonly",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class ve extends Zd{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function ld(a){return a instanceof ve}class we extends Zd{}function jd(a){return a instanceof we}class xe extends Zd{}function kd(a){return a instanceof xe}
172
- exports.$createGridSelection=function(){let a=new V("root",0,"element"),b=new V("root",0,"element");return new gd("root",a,b)};exports.$createLineBreakNode=nd;exports.$createNodeSelection=function(){return new ed(new Set)};exports.$createParagraphNode=dd;exports.$createRangeSelection=function(){let a=new V("root",0,"element"),b=new V("root",0,"element");return new fd(a,b,0)};exports.$createTextNode=M;exports.$getDecoratorNode=Tb;exports.$getNearestNodeFromDOMNode=kb;exports.$getNodeByKey=L;
173
- exports.$getPreviousSelection=Ob;exports.$getRoot=Ib;exports.$getSelection=v;exports.$isDecoratorNode=A;exports.$isElementNode=E;exports.$isGridCellNode=ld;exports.$isGridNode=jd;exports.$isGridRowNode=kd;exports.$isGridSelection=hd;exports.$isLeafNode=Ab;exports.$isLineBreakNode=Bb;exports.$isNodeSelection=Sc;exports.$isParagraphNode=function(a){return a instanceof re};exports.$isRangeSelection=C;exports.$isRootNode=N;exports.$isTextNode=B;
174
- exports.$nodesOfType=function(a){var b=H();let c=b._readOnly,d=a.getType();b=b._nodeMap;let f=[];for(let [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$parseSerializedNode=function(a){return Ld(a,I()._nodes)};exports.$setCompositionKey=J;exports.$setSelection=pb;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ca;
175
- exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ia;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=da;exports.DELETE_LINE_COMMAND=na;exports.DELETE_WORD_COMMAND=ma;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;exports.DecoratorNode=Yd;
176
- exports.ElementNode=Zd;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=q;exports.GridCellNode=ve;exports.GridNode=we;exports.GridRowNode=xe;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=fa;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=xa;exports.KEY_ARROW_LEFT_COMMAND=sa;exports.KEY_ARROW_RIGHT_COMMAND=qa;exports.KEY_ARROW_UP_COMMAND=wa;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Ca;
177
- exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ba;exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=ce;exports.MOVE_TO_END=ra;exports.MOVE_TO_START=va;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ka;exports.ParagraphNode=re;exports.REDO_COMMAND=pa;exports.REMOVE_TEXT_COMMAND=la;exports.RootNode=$d;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=ie;exports.UNDO_COMMAND=oa;exports.VERSION="0.3.6";
168
+ b){void 0===this._nodes.get(a.getType())&&t(37);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){a=a.getType();let c=this._nodes.get(a);void 0===c&&t(37);let d=c.transforms;d.add(b);Ib(this,a);return()=>{d.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){let c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return U(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
169
+ this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Od(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Kc&&(Kc--,0===Kc&&b.ownerDocument.removeEventListener("selectionchange",Yc));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Kb(c);d=d[d.length-1]._key;Xc.get(d)===c&&Xc.delete(d)}else Xc.delete(c._key);b.__lexicalEditor=null}c=Wc(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,
170
+ c.userSelect="text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,rb(this),this._updateTags.add("history-merge"),Nd(this),this._config.disableEvents||Zc(a,this));Pd("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&t(38);qb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=
171
+ b&&d.add(b),Nd(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);Nd(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=$d(),d=Y,f=X,e=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;X=!1;Z=this;try{Ld(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=
172
+ g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,X=f,Z=e}return c}update(a,b){x(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),x(this,()=>{let d=v(),f=Hb();null!==d?d.dirty=!0:0!==f.getChildrenSize()&&("rootStart"===b.defaultSelection?f.selectStart():f.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly!==
173
+ a&&(this._readOnly=a,Pd("readonly",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class ue extends Yd{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function ld(a){return a instanceof ue}class ve extends Yd{}function jd(a){return a instanceof ve}class we extends Yd{}function kd(a){return a instanceof we}
174
+ exports.$createGridSelection=function(){let a=new V("root",0,"element"),b=new V("root",0,"element");return new gd("root",a,b)};exports.$createLineBreakNode=nd;exports.$createNodeSelection=function(){return new ed(new Set)};exports.$createParagraphNode=cd;exports.$createRangeSelection=function(){let a=new V("root",0,"element"),b=new V("root",0,"element");return new fd(a,b,0)};exports.$createTextNode=M;exports.$getDecoratorNode=Sb;exports.$getNearestNodeFromDOMNode=kb;exports.$getNodeByKey=L;
175
+ exports.$getPreviousSelection=Nb;exports.$getRoot=Hb;exports.$getSelection=v;exports.$isDecoratorNode=A;exports.$isElementNode=E;exports.$isGridCellNode=ld;exports.$isGridNode=jd;exports.$isGridRowNode=kd;exports.$isGridSelection=hd;exports.$isLeafNode=zb;exports.$isLineBreakNode=Ab;exports.$isNodeSelection=Rc;exports.$isParagraphNode=function(a){return a instanceof qe};exports.$isRangeSelection=C;exports.$isRootNode=N;exports.$isTextNode=B;
176
+ exports.$nodesOfType=function(a){var b=H();let c=b._readOnly,d=a.getType();b=b._nodeMap;let f=[];for(let [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$parseSerializedNode=function(a){return Ld(a,I()._nodes)};exports.$setCompositionKey=J;exports.$setSelection=ob;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=ba;
177
+ exports.COMMAND_PRIORITY_CRITICAL=4;exports.COMMAND_PRIORITY_EDITOR=0;exports.COMMAND_PRIORITY_HIGH=3;exports.COMMAND_PRIORITY_LOW=1;exports.COMMAND_PRIORITY_NORMAL=2;exports.CONTROLLED_TEXT_INSERTION_COMMAND=ha;exports.COPY_COMMAND=Ia;exports.CUT_COMMAND=Ja;exports.DELETE_CHARACTER_COMMAND=ca;exports.DELETE_LINE_COMMAND=ma;exports.DELETE_WORD_COMMAND=la;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;exports.DecoratorNode=Xd;
178
+ exports.ElementNode=Yd;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=q;exports.GridCellNode=ue;exports.GridNode=ve;exports.GridRowNode=we;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=da;exports.INSERT_PARAGRAPH_COMMAND=fa;exports.KEY_ARROW_DOWN_COMMAND=xa;exports.KEY_ARROW_LEFT_COMMAND=ra;exports.KEY_ARROW_RIGHT_COMMAND=pa;exports.KEY_ARROW_UP_COMMAND=wa;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Ca;
179
+ exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ba;exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=be;exports.MOVE_TO_END=qa;exports.MOVE_TO_START=sa;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ia;exports.ParagraphNode=qe;exports.REDO_COMMAND=oa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=Zd;exports.SELECTION_CHANGE_COMMAND=aa;exports.TextNode=he;exports.UNDO_COMMAND=na;exports.VERSION="0.3.7";
178
180
  exports.createCommand=function(){return{}};
179
- exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let f=void 0===a?c:b.parentEditor||null,e=b.disableEvents||!1,g=ae(),h=b.namespace||(null!==f?f._config.namespace:Mb()),k=b.editorState,m=[$d,ie,ce,re,...(b.nodes||[])],l=b.onError;b=b.readOnly||!1;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let n=m[c],r=n.getType();a.set(r,{klass:n,transforms:new Set})}d=new ue(g,f,a,{disableEvents:e,namespace:h,theme:d},l?l:console.error,te(a),b);void 0!==k&&(d._pendingEditorState=
181
+ exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let f=void 0===a?c:b.parentEditor||null,e=b.disableEvents||!1,g=$d(),h=b.namespace||(null!==f?f._config.namespace:Lb()),k=b.editorState,m=[Zd,he,be,qe,...(b.nodes||[])],l=b.onError;b=b.readOnly||!1;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let n=m[c],r=n.getType();a.set(r,{klass:n,transforms:new Set})}d=new te(g,f,a,{disableEvents:e,namespace:h,theme:d},l?l:console.error,se(a),b);void 0!==k&&(d._pendingEditorState=
180
182
  k,d._dirtyType=2);return d}
@@ -31,6 +31,9 @@ export declare type EditorUpdateOptions = {
31
31
  export declare type EditorSetOptions = {
32
32
  tag?: string;
33
33
  };
34
+ export declare type EditorFocusOptions = {
35
+ defaultSelection?: 'rootStart' | 'rootEnd';
36
+ };
34
37
  export declare type EditorThemeClasses = {
35
38
  characterLimit?: EditorThemeClassName;
36
39
  code?: EditorThemeClassName;
@@ -190,7 +193,7 @@ export declare class LexicalEditor {
190
193
  setEditorState(editorState: EditorState, options?: EditorSetOptions): void;
191
194
  parseEditorState(maybeStringifiedEditorState: string | SerializedEditorState, updateFn?: () => void): EditorState;
192
195
  update(updateFn: () => void, options?: EditorUpdateOptions): void;
193
- focus(callbackFn?: () => void): void;
196
+ focus(callbackFn?: () => void, options?: EditorFocusOptions): void;
194
197
  blur(): void;
195
198
  isReadOnly(): boolean;
196
199
  setReadOnly(readOnly: boolean): void;
@@ -5,4 +5,4 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- export declare const VERSION = "0.3.6";
8
+ export declare const VERSION = "0.3.7";
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.3.6",
12
+ "version": "0.3.7",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",