lexical 0.6.3 → 0.6.4

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
@@ -826,6 +826,13 @@ function getEditorsToPropagate(editor) {
826
826
  function createUID() {
827
827
  return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
828
828
  }
829
+ function getAnchorTextFromDOM(anchorNode) {
830
+ if (anchorNode.nodeType === DOM_TEXT_TYPE) {
831
+ return anchorNode.nodeValue;
832
+ }
833
+
834
+ return null;
835
+ }
829
836
  function $updateSelectedTextFromDOM(isCompositionEnd, data) {
830
837
  // Update the text content with the latest composition text
831
838
  const domSelection = getDOMSelection();
@@ -840,12 +847,12 @@ function $updateSelectedTextFromDOM(isCompositionEnd, data) {
840
847
  focusOffset
841
848
  } = domSelection;
842
849
 
843
- if (anchorNode !== null && anchorNode.nodeType === DOM_TEXT_TYPE) {
850
+ if (anchorNode !== null) {
851
+ let textContent = getAnchorTextFromDOM(anchorNode);
844
852
  const node = $getNearestNodeFromDOMNode(anchorNode);
845
853
 
846
- if ($isTextNode(node)) {
847
- let textContent = anchorNode.nodeValue; // Data is intentionally truthy, as we check for boolean, null and empty string.
848
-
854
+ if (textContent !== null && $isTextNode(node)) {
855
+ // Data is intentionally truthy, as we check for boolean, null and empty string.
849
856
  if (textContent === COMPOSITION_SUFFIX && data) {
850
857
  const offset = data.length;
851
858
  textContent = data;
@@ -953,33 +960,6 @@ function $shouldInsertTextAfterOrBeforeTextNode(selection, node) {
953
960
  } else {
954
961
  return false;
955
962
  }
956
- } // This function is used to determine if Lexical should attempt to override
957
- // the default browser behavior for insertion of text and use its own internal
958
- // heuristics. This is an extremely important function, and makes much of Lexical
959
- // work as intended between different browsers and across word, line and character
960
- // boundary/formats. It also is important for text replacement, node schemas and
961
- // composition mechanics.
962
-
963
-
964
- function $shouldPreventDefaultAndInsertText(selection, text) {
965
- const anchor = selection.anchor;
966
- const focus = selection.focus;
967
- const anchorNode = anchor.getNode();
968
- const domSelection = getDOMSelection();
969
- const domAnchorNode = domSelection !== null ? domSelection.anchorNode : null;
970
- const anchorKey = anchor.key;
971
- const backingAnchorElement = getActiveEditor().getElementByKey(anchorKey);
972
- const textLength = text.length;
973
- return anchorKey !== focus.key || // If we're working with a non-text node.
974
- !$isTextNode(anchorNode) || // If we are replacing a range with a single character or grapheme, and not composing.
975
- (textLength < 2 || doesContainGrapheme(text)) && anchor.offset !== focus.offset && !anchorNode.isComposing() || // Any non standard text node.
976
- $isTokenOrSegmented(anchorNode) || // If the text length is more than a single character and we're either
977
- // dealing with this in "beforeinput" or where the node has already recently
978
- // been changed (thus is dirty).
979
- anchorNode.isDirty() && textLength > 1 || // If the DOM selection element is not the same as the backing node
980
- backingAnchorElement !== null && !anchorNode.isComposing() && domAnchorNode !== getDOMTextNode(backingAnchorElement) || // Check if we're changing from bold to italics, or some other format.
981
- anchorNode.getFormat() !== selection.format || // One last set of heuristics to check against.
982
- $shouldInsertTextAfterOrBeforeTextNode(selection, anchorNode);
983
963
  }
984
964
  function isTab(keyCode, altKey, ctrlKey, metaKey) {
985
965
  return keyCode === 9 && !altKey && !ctrlKey && !metaKey;
@@ -2284,12 +2264,43 @@ if (CAN_USE_BEFORE_INPUT) {
2284
2264
 
2285
2265
  let lastKeyDownTimeStamp = 0;
2286
2266
  let lastKeyCode = 0;
2267
+ let lastBeforeInputInsertTextTimeStamp = 0;
2287
2268
  let rootElementsRegistered = 0;
2288
2269
  let isSelectionChangeFromDOMUpdate = false;
2289
2270
  let isSelectionChangeFromMouseDown = false;
2290
2271
  let isInsertLineBreak = false;
2291
2272
  let isFirefoxEndingComposition = false;
2292
- let collapsedSelectionFormat = [0, 0, 'root', 0];
2273
+ let collapsedSelectionFormat = [0, 0, 'root', 0]; // This function is used to determine if Lexical should attempt to override
2274
+ // the default browser behavior for insertion of text and use its own internal
2275
+ // heuristics. This is an extremely important function, and makes much of Lexical
2276
+ // work as intended between different browsers and across word, line and character
2277
+ // boundary/formats. It also is important for text replacement, node schemas and
2278
+ // composition mechanics.
2279
+
2280
+ function $shouldPreventDefaultAndInsertText(selection, text, timeStamp, isBeforeInput) {
2281
+ const anchor = selection.anchor;
2282
+ const focus = selection.focus;
2283
+ const anchorNode = anchor.getNode();
2284
+ const domSelection = getDOMSelection();
2285
+ const domAnchorNode = domSelection !== null ? domSelection.anchorNode : null;
2286
+ const anchorKey = anchor.key;
2287
+ const backingAnchorElement = getActiveEditor().getElementByKey(anchorKey);
2288
+ const textLength = text.length;
2289
+ return anchorKey !== focus.key || // If we're working with a non-text node.
2290
+ !$isTextNode(anchorNode) || // If we are replacing a range with a single character or grapheme, and not composing.
2291
+ (!isBeforeInput && (!CAN_USE_BEFORE_INPUT || // We check to see if there has been
2292
+ // a recent beforeinput event for "textInput". If there has been one in the last
2293
+ // 50ms then we proceed as normal. However, if there is not, then this is likely
2294
+ // a dangling `input` event caused by execCommand('insertText').
2295
+ lastBeforeInputInsertTextTimeStamp < timeStamp + 50) || textLength < 2 || doesContainGrapheme(text)) && anchor.offset !== focus.offset && !anchorNode.isComposing() || // Any non standard text node.
2296
+ $isTokenOrSegmented(anchorNode) || // If the text length is more than a single character and we're either
2297
+ // dealing with this in "beforeinput" or where the node has already recently
2298
+ // been changed (thus is dirty).
2299
+ anchorNode.isDirty() && textLength > 1 || // If the DOM selection element is not the same as the backing node during beforeinput.
2300
+ (isBeforeInput || !CAN_USE_BEFORE_INPUT) && backingAnchorElement !== null && !anchorNode.isComposing() && domAnchorNode !== getDOMTextNode(backingAnchorElement) || // Check if we're changing from bold to italics, or some other format.
2301
+ anchorNode.getFormat() !== selection.format || // One last set of heuristics to check against.
2302
+ $shouldInsertTextAfterOrBeforeTextNode(selection, anchorNode);
2303
+ }
2293
2304
 
2294
2305
  function shouldSkipSelectionChange(domNode, offset) {
2295
2306
  return domNode !== null && domNode.nodeValue !== null && domNode.nodeType === DOM_TEXT_TYPE && offset !== 0 && offset !== domNode.nodeValue.length;
@@ -2525,11 +2536,12 @@ function onBeforeInput(event, editor) {
2525
2536
  const text = event.dataTransfer.getData('text/plain');
2526
2537
  event.preventDefault();
2527
2538
  selection.insertRawText(text);
2528
- } else if (data != null && $shouldPreventDefaultAndInsertText(selection, data)) {
2539
+ } else if (data != null && $shouldPreventDefaultAndInsertText(selection, data, event.timeStamp, true)) {
2529
2540
  event.preventDefault();
2530
2541
  dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data);
2531
2542
  }
2532
2543
 
2544
+ lastBeforeInputInsertTextTimeStamp = event.timeStamp;
2533
2545
  return;
2534
2546
  } // Prevent the browser from carrying out
2535
2547
  // the input event, so we can control the
@@ -2682,7 +2694,7 @@ function onInput(event, editor) {
2682
2694
  const selection = $getSelection();
2683
2695
  const data = event.data;
2684
2696
 
2685
- if (data != null && $isRangeSelection(selection) && $shouldPreventDefaultAndInsertText(selection, data)) {
2697
+ if (data != null && $isRangeSelection(selection) && $shouldPreventDefaultAndInsertText(selection, data, event.timeStamp, false)) {
2686
2698
  // Given we're over-riding the default behavior, we will need
2687
2699
  // to ensure to disable composition before dispatching the
2688
2700
  // insertText command for when changing the sequence for FF.
@@ -2691,7 +2703,22 @@ function onInput(event, editor) {
2691
2703
  isFirefoxEndingComposition = false;
2692
2704
  }
2693
2705
 
2694
- dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data);
2706
+ const anchor = selection.anchor;
2707
+ const anchorNode = anchor.getNode();
2708
+ const domSelection = getDOMSelection();
2709
+
2710
+ if (domSelection === null) {
2711
+ return;
2712
+ }
2713
+
2714
+ const offset = anchor.offset; // If the content is the same as inserted, then don't dispatch an insertion.
2715
+ // Given onInput doesn't take the current selection (it uses the previous)
2716
+ // we can compare that against what the DOM currently says.
2717
+
2718
+ if (!CAN_USE_BEFORE_INPUT || selection.isCollapsed() || !$isTextNode(anchorNode) || domSelection.anchorNode === null || anchorNode.getTextContent().slice(0, offset) + data + anchorNode.getTextContent().slice(offset + selection.focus.offset) !== getAnchorTextFromDOM(domSelection.anchorNode)) {
2719
+ dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data);
2720
+ }
2721
+
2695
2722
  const textLength = data.length; // Another hack for FF, as it's possible that the IME is still
2696
2723
  // open, even though compositionend has already fired (sigh).
2697
2724
 
@@ -3209,6 +3236,7 @@ function selectPointOnNode(point, node) {
3209
3236
  if ($isTextNode(nextSibling)) {
3210
3237
  key = nextSibling.__key;
3211
3238
  offset = 0;
3239
+ type = 'text';
3212
3240
  } else {
3213
3241
  const parentNode = node.getParent();
3214
3242
 
@@ -4284,8 +4312,18 @@ class RangeSelection {
4284
4312
  const childrenLength = children.length;
4285
4313
 
4286
4314
  if ($isElementNode(target)) {
4315
+ let firstChild = target.getFirstChild();
4316
+
4287
4317
  for (let s = 0; s < childrenLength; s++) {
4288
- target.append(children[s]);
4318
+ const child = children[s];
4319
+
4320
+ if (firstChild === null) {
4321
+ target.append(child);
4322
+ } else {
4323
+ firstChild.insertAfter(child);
4324
+ }
4325
+
4326
+ firstChild = child;
4289
4327
  }
4290
4328
  } else {
4291
4329
  for (let s = childrenLength - 1; s >= 0; s--) {
@@ -4400,7 +4438,11 @@ class RangeSelection {
4400
4438
  if (lastChild === null) {
4401
4439
  target.select();
4402
4440
  } else if ($isTextNode(lastChild)) {
4403
- lastChild.select();
4441
+ if (lastChild.getTextContent() === '') {
4442
+ lastChild.selectPrevious();
4443
+ } else {
4444
+ lastChild.select();
4445
+ }
4404
4446
  } else {
4405
4447
  lastChild.selectNext();
4406
4448
  }
@@ -6430,6 +6472,8 @@ class LexicalNode {
6430
6472
  // @ts-expect-error
6431
6473
  this.__type = this.constructor.getType();
6432
6474
  this.__parent = null;
6475
+ this.__prev = null;
6476
+ this.__next = null;
6433
6477
  $setNodeKey(this, key);
6434
6478
 
6435
6479
  {
@@ -7175,10 +7219,20 @@ class ElementNode extends LexicalNode {
7175
7219
 
7176
7220
  /** @internal */
7177
7221
 
7222
+ /** @internal */
7223
+
7224
+ /** @internal */
7225
+
7226
+ /** @internal */
7227
+
7178
7228
  /** @internal */
7179
7229
  constructor(key) {
7180
- super(key);
7230
+ super(key); // TODO: remove children and switch to using first/last as part of linked list work
7231
+
7181
7232
  this.__children = [];
7233
+ this.__first = null;
7234
+ this.__last = null;
7235
+ this.__size = 0;
7182
7236
  this.__format = 0;
7183
7237
  this.__indent = 0;
7184
7238
  this.__dir = null;
@@ -8401,15 +8455,24 @@ class TextNode extends LexicalNode {
8401
8455
 
8402
8456
  setMode(type) {
8403
8457
  const mode = TEXT_MODE_TO_TYPE[type];
8458
+
8459
+ if (this.__mode === mode) {
8460
+ return this;
8461
+ }
8462
+
8404
8463
  const self = this.getWritable();
8405
8464
  self.__mode = mode;
8406
8465
  return self;
8407
8466
  }
8408
8467
 
8409
8468
  setTextContent(text) {
8410
- const writableSelf = this.getWritable();
8411
- writableSelf.__text = text;
8412
- return writableSelf;
8469
+ if (this.__text === text) {
8470
+ return this;
8471
+ }
8472
+
8473
+ const self = this.getWritable();
8474
+ self.__text = text;
8475
+ return self;
8413
8476
  }
8414
8477
 
8415
8478
  select(_anchorOffset, _focusOffset) {
@@ -9452,7 +9515,7 @@ class LexicalEditor {
9452
9515
  * LICENSE file in the root directory of this source tree.
9453
9516
  *
9454
9517
  */
9455
- const VERSION = '0.6.3';
9518
+ const VERSION = '0.6.4';
9456
9519
 
9457
9520
  /**
9458
9521
  * Copyright (c) Meta Platforms, Inc. and affiliates.
package/Lexical.js.flow CHANGED
@@ -494,7 +494,6 @@ type TextPointType = {
494
494
  getNode: () => TextNode,
495
495
  set: (key: NodeKey, offset: number, type: 'text' | 'element') => void,
496
496
  getCharacterOffset: () => number,
497
- isAtNodeEnd: () => boolean,
498
497
  };
499
498
  export type ElementPoint = ElementPointType;
500
499
  type ElementPointType = {
@@ -505,7 +504,6 @@ type ElementPointType = {
505
504
  isBefore: (PointType) => boolean,
506
505
  getNode: () => ElementNode,
507
506
  set: (key: NodeKey, offset: number, type: 'text' | 'element') => void,
508
- isAtNodeEnd: () => boolean,
509
507
  };
510
508
  export type Point = PointType;
511
509
  type PointType = TextPointType | ElementPointType;
@@ -629,7 +627,8 @@ declare export class LineBreakNode extends LexicalNode {
629
627
  static importJSON(
630
628
  serializedLineBreakNode: SerializedLineBreakNode,
631
629
  ): LineBreakNode;
632
- exportJSON(): SerializedLexicalNode;
630
+ // $FlowExpectedError[incompatible-extend] 'linebreak' is a literal string
631
+ exportJSON(): SerializedLineBreakNode;
633
632
  }
634
633
  declare export function $createLineBreakNode(): LineBreakNode;
635
634
  declare export function $isLineBreakNode(
@@ -757,7 +756,8 @@ declare export class ParagraphNode extends ElementNode {
757
756
  static importJSON(
758
757
  serializedParagraphNode: SerializedParagraphNode,
759
758
  ): ParagraphNode;
760
- exportJSON(): SerializedElementNode;
759
+ // $FlowExpectedError[incompatible-extend] 'paragraph' is a literal string
760
+ exportJSON(): SerializedParagraphNode;
761
761
  }
762
762
  declare export function $createParagraphNode(): ParagraphNode;
763
763
  declare export function $isParagraphNode(
package/Lexical.prod.js CHANGED
@@ -7,183 +7,183 @@
7
7
  'use strict';let ba={},ca={},da={},ea={},ha={},ia={},ja={},ka={},la={},na={},p={},oa={},pa={},qa={},ra={},sa={},ta={},ua={},va={},ya={},za={},Aa={},Ba={},Ca={},Da={},Ea={},Fa={},Ga={},Ha={},Ia={},Ja={},Ka={},La={},Ma={};function r(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
8
  let t="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,Na=t&&"documentMode"in document?document.documentMode:null,u=t&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Oa=t&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Pa=t&&"InputEvent"in window&&!Na?"getTargetRanges"in new window.InputEvent("input"):!1,Qa=t&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Ra=t&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,
9
9
  Ta=Qa||Ra?"\u00a0":"\u200b",Ua=Oa?"\u00a0":Ta,Va=/^[^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]/,Wa=/^[^\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]/,Xa={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},Ya={directionless:1,unmergeable:2},
10
- Za={center:2,justify:4,left:1,right:3},$a={2:"center",4:"justify",1:"left",3:"right"},ab={normal:0,segmented:2,token:1},bb={0:"normal",2:"segmented",1:"token"},cb=!1,db=0;function eb(a){db=a.timeStamp}function fb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function gb(a){return a.getEditorState().read(()=>{let b=x();return null!==b?b.clone():null})}
11
- function hb(a,b,c){cb=!0;let d=100<performance.now()-db;try{A(a,()=>{let e=x()||gb(a);var f=new Map,g=a.getRootElement(),h=a._editorState;let k=!1,m="";for(var l=0;l<b.length;l++){var n=b[l],q=n.type,v=n.target,w=ib(v,h);if(!(null===w&&v!==g||C(w)))if("characterData"===q){if(n=d&&D(w))a:{n=e;q=v;var y=w;if(E(n)){var z=n.anchor.getNode();if(z.is(y)&&n.format!==z.getFormat()){n=!1;break a}}n=3===q.nodeType&&y.isAttached()}n&&(y=t?window.getSelection():null,q=n=null,null!==y&&y.anchorNode===v&&(n=y.anchorOffset,
12
- q=y.focusOffset),v=v.nodeValue,null!==v&&jb(w,v,n,q,!1))}else if("childList"===q){k=!0;q=n.addedNodes;for(y=0;y<q.length;y++){z=q[y];var B=kb(z),F=z.parentNode;null==F||null!==B||"BR"===z.nodeName&&fb(z,F,a)||(Oa&&(B=z.innerText||z.nodeValue)&&(m+=B),F.removeChild(z))}n=n.removedNodes;q=n.length;if(0<q){y=0;for(z=0;z<q;z++)F=n[z],"BR"===F.nodeName&&fb(F,v,a)&&(v.appendChild(F),y++);q!==y&&(v===g&&(w=h._nodeMap.get("root")),f.set(v,w))}}}if(0<f.size)for(let [T,aa]of f)if(G(aa))for(f=aa.__children,
10
+ Za={center:2,justify:4,left:1,right:3},$a={2:"center",4:"justify",1:"left",3:"right"},ab={normal:0,segmented:2,token:1},bb={0:"normal",2:"segmented",1:"token"},cb=!1,db=0;function eb(a){db=a.timeStamp}function fb(a,b,c){return b.__lexicalLineBreak===a||void 0!==a[`__lexicalKey_${c._key}`]}function gb(a){return a.getEditorState().read(()=>{let b=y();return null!==b?b.clone():null})}
11
+ function hb(a,b,c){cb=!0;let d=100<performance.now()-db;try{A(a,()=>{let e=y()||gb(a);var f=new Map,g=a.getRootElement(),h=a._editorState;let k=!1,m="";for(var l=0;l<b.length;l++){var n=b[l],q=n.type,v=n.target,w=ib(v,h);if(!(null===w&&v!==g||C(w)))if("characterData"===q){if(n=d&&D(w))a:{n=e;q=v;var x=w;if(E(n)){var z=n.anchor.getNode();if(z.is(x)&&n.format!==z.getFormat()){n=!1;break a}}n=3===q.nodeType&&x.isAttached()}n&&(x=t?window.getSelection():null,q=n=null,null!==x&&x.anchorNode===v&&(n=x.anchorOffset,
12
+ q=x.focusOffset),v=v.nodeValue,null!==v&&jb(w,v,n,q,!1))}else if("childList"===q){k=!0;q=n.addedNodes;for(x=0;x<q.length;x++){z=q[x];var B=kb(z),F=z.parentNode;null==F||null!==B||"BR"===z.nodeName&&fb(z,F,a)||(Oa&&(B=z.innerText||z.nodeValue)&&(m+=B),F.removeChild(z))}n=n.removedNodes;q=n.length;if(0<q){x=0;for(z=0;z<q;z++)F=n[z],"BR"===F.nodeName&&fb(F,v,a)&&(v.appendChild(F),x++);q!==x&&(v===g&&(w=h._nodeMap.get("root")),f.set(v,w))}}}if(0<f.size)for(let [T,aa]of f)if(G(aa))for(f=aa.__children,
13
13
  g=T.firstChild,h=0;h<f.length;h++)l=a.getElementByKey(f[h]),null!==l&&(null==g?(T.appendChild(l),g=l):g!==l&&T.replaceChild(l,g),g=g.nextSibling);else D(aa)&&aa.markDirty();f=c.takeRecords();if(0<f.length){for(g=0;g<f.length;g++)for(l=f[g],h=l.addedNodes,l=l.target,w=0;w<h.length;w++)v=h[w],n=v.parentNode,null==n||"BR"!==v.nodeName||fb(v,l,a)||n.removeChild(v);c.takeRecords()}null!==e&&(k&&(e.dirty=!0,lb(e)),Oa&&mb(a)&&e.insertRawText(m))})}finally{cb=!1}}
14
- function nb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();hb(a,c,b)}}function sb(a){0===db&&tb(a).addEventListener("textInput",eb,!0);a._observer=new MutationObserver((b,c)=>{hb(a,b,c)})}let ub=1,vb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
14
+ function nb(a){let b=a._observer;if(null!==b){let c=b.takeRecords();hb(a,c,b)}}function ob(a){0===db&&tb(a).addEventListener("textInput",eb,!0);a._observer=new MutationObserver((b,c)=>{hb(a,b,c)})}let ub=1,vb="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
15
15
  function wb(a,b,c){let d=a.getRootElement();try{var e;if(e=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){let f=document.activeElement,g=null!==f?f.nodeName:null;e=!C(ib(b))||"INPUT"!==g&&"TEXTAREA"!==g}return e&&xb(b)===a}catch(f){return!1}}function xb(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b)return b;a=a.parentNode}return null}function yb(a){return a.isToken()||a.isSegmented()}function zb(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}
16
16
  function Ab(a,b,c){b=Xa[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Bb(a){return D(a)||Cb(a)||C(a)}function Db(a,b){if(null!=b)a.__key=b;else{H();99<Eb&&r(14);b=I();var c=J(),d=""+ub++;c._nodeMap.set(d,a);G(a)?b._dirtyElements.set(d,!0):b._dirtyLeaves.add(d);b._cloneNotNeeded.add(d);b._dirtyType=1;a.__key=d}}function Fb(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&r(31);Gb(a);b.splice(c,1)}}
17
17
  function Hb(a){99<Eb&&r(14);var b=a.getLatest(),c=b.__parent,d=J();let e=I(),f=d._nodeMap;d=e._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;let g=f.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;e._dirtyType=1;G(a)?d.set(b,!0):e._dirtyLeaves.add(b)}function Gb(a){let b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Hb(b);null!==a&&Hb(a)}
18
18
  function K(a){H();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 Ib(){return M?null:I()._compositionKey}function L(a,b){a=(b||J())._nodeMap.get(a);return void 0===a?null:a}function kb(a,b){let c=I();a=a[`__lexicalKey_${c._key}`];return void 0!==a?L(a,b):null}function ib(a,b){for(;null!=a;){let c=kb(a,b);if(null!==c)return c;a=a.parentNode}return null}
19
19
  function Jb(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Kb(a){return a.read(()=>Lb().getTextContent())}function Mb(a,b){A(a,()=>{var c=J();if(!c.isEmpty())if("root"===b)Lb().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Lb(){return J()._nodeMap.get("root")}function lb(a){let b=J();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
20
20
  function Nb(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 Ob(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function Pb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Qb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
21
- function Rb(a,b){var c=t?window.getSelection():null;if(null!==c){var d=c.anchorNode,{anchorOffset:e,focusOffset:f}=c;if(null!==d&&3===d.nodeType&&(c=ib(d),D(c))){d=d.nodeValue;if(d===Ta&&b){let g=b.length;d=b;f=e=g}null!==d&&jb(c,d,e,f,a)}}}
22
- function jb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Ta&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Qa||Ra)f.remove();else{let h=I();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Sb(),f.isToken()||null!==Ib()&&!g||null!==e&&E(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=x(),E(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
21
+ function Rb(a,b){var c=t?window.getSelection():null;if(null!==c){var d=c.anchorNode,{anchorOffset:e,focusOffset:f}=c;if(null!==d&&(c=3===d.nodeType?d.nodeValue:null,d=ib(d),null!==c&&D(d))){if(c===Ta&&b){let g=b.length;c=b;f=e=g}null!==c&&jb(d,c,e,f,a)}}}
22
+ function jb(a,b,c,d,e){let f=a;if(f.isAttached()&&(e||!f.isDirty())){var g=f.isComposing();a=b;(g||e)&&b[b.length-1]===Ta&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(K(null),Qa||Ra)f.remove();else{let h=I();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=Sb(),f.isToken()||null!==Ib()&&!g||null!==e&&E(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=y(),E(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
23
23
  (c=f.getTextContent(),c=N(c),f.replace(c),f=c)),f.setTextContent(a))}}function Tb(a,b){if(b.isSegmented())return!0;if(!a.isCollapsed())return!1;a=a.anchor.offset;let c=b.getParentOrThrow(),d=b.isToken();return 0===a?((a=!b.canInsertTextBefore()||!c.canInsertTextBefore()||d)||(b=b.getPreviousSibling(),a=(D(b)||G(b)&&b.isInline())&&!b.canInsertTextAfter()),a):a===b.getTextContentSize()?!b.canInsertTextAfter()||!c.canInsertTextAfter()||d:!1}
24
- function Ub(a,b){let c=a.anchor,d=a.focus,e=c.getNode();var f=t?window.getSelection():null;f=null!==f?f.anchorNode:null;let g=c.key,h=I().getElementByKey(g),k=b.length;return g!==d.key||!D(e)||(2>k||Ob(b))&&c.offset!==d.offset&&!e.isComposing()||yb(e)||e.isDirty()&&1<k||null!==h&&!e.isComposing()&&f!==zb(h)||e.getFormat()!==a.format||Tb(a,e)}function Vb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}
25
- function Wb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&r(33),b=b.klass,d=a.get(b),void 0===d&&(d=new Map,a.set(b,d)),d.has(c)||d.set(c,e))}function Xb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
26
- function Yb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Xb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Xb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function mb(a){a=(a=tb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Zb(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
27
- function $b(a,b){a=a._keyToDOMMap.get(b);void 0===a&&r(75);return a}function ac(a,b=0){0!==b&&r(1);b=x();if(!E(b)||!G(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();bc(e,a)&&c.set(a.__key,0,"element");bc(f,a)&&d.set(a.__key,0,"element");return b}function bc(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function tb(a){a=a._window;null===a&&r(78);return a}
28
- function cc(a){for(a=a.getParentOrThrow();null!==a&&!ic(a);)a=a.getParentOrThrow();return a}function ic(a){return O(a)||G(a)&&a.isShadowRoot()}function jc(a){var b=I();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&r(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||r(98),b):a}function kc(a,b){a=a.getParent();if(O(a)&&!G(b)&&!C(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}
29
- function lc(a,b,c,d,e){a=a.__children;let f=a.length;for(let g=0;g<f;g++){let h=a[g],k=d.get(h);void 0!==k&&k.__parent===b&&(G(k)&&lc(k,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}function mc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(G(c)&&lc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
30
- function nc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function oc(a,b){let c=a.mergeWithSibling(b),d=I()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
31
- function pc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&D(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{nc(b,a)&&(a=oc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&D(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{nc(a,c)&&oc(a,c);break}}}function qc(a){rc(a.anchor);rc(a.focus);return a}
32
- function rc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(D(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!G(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",sc,S,tc,uc=!1,vc=!1,wc,xc=null,yc,zc,Ac,Bc,Cc,Dc;
33
- function Ec(a,b){let c=Ac.get(a);if(null!==b){let d=Fc(a);b.removeChild(d)}Bc.has(a)||S._keyToDOMMap.delete(a);G(c)&&(a=c.__children,Gc(a,0,a.length-1,null));void 0!==c&&Wb(Dc,tc,wc,c,"destroyed")}function Gc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Ec(e,d)}}function Hc(a,b){a.setProperty("text-align",b)}function Ic(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
34
- function Jc(a,b){a=a.style;0===b?Hc(a,""):1===b?Hc(a,"left"):2===b?Hc(a,"center"):3===b?Hc(a,"right"):4===b&&Hc(a,"justify")}
35
- function Kc(a,b,c){let d=Bc.get(a);void 0===d&&r(60);let e=d.createDOM(sc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);D(d)?e.setAttribute("data-lexical-text","true"):C(d)&&e.setAttribute("data-lexical-decorator","true");if(G(d)){a=d.__indent;0!==a&&Ic(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;let h=Q;Q="";Lc(f,0,g,e,null);Mc(d,e);Q=h}f=d.__format;0!==f&&Jc(e,f);d.isInline()||Nc(null,a,e);Zb(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),C(d)?(g=d.decorate(S,sc),
36
- null!==g&&Oc(a,g),e.contentEditable="false"):D(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Wb(Dc,tc,wc,d,"created");return e}function Lc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Kc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Pc(a,b){a=b.get(a[a.length-1]);return Cb(a)||C(a)&&a.isInline()}
37
- function Nc(a,b,c){a=null!==a&&(0===a.length||Pc(a,Ac));b=null!==b&&(0===b.length||Pc(b,Bc));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
38
- function Mc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==xc){let f=""===Q;if(f)var d=xc;else d=Q,d=Va.test(d)?"rtl":Wa.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=sc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"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);vc||(a.getWritable().__dir=d)}xc=
24
+ function Ub(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Vb(a,b,c,d,e){0!==c.size&&(c=d.__key,b=b.get(d.__type),void 0===b&&r(33),b=b.klass,d=a.get(b),void 0===d&&(d=new Map,a.set(b,d)),d.has(c)||d.set(c,e))}function Wb(a,b,c){let d=a.getParent(),e=c;null!==d&&(b&&0===c?(e=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(e=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?e-1:e)}
25
+ function Xb(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Wb(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Wb(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}function mb(a){a=(a=tb(a).event)&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Yb(a){return!O(a)&&!a.isLastChild()&&!a.isInline()}
26
+ function Zb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&r(75);return a}function $b(a,b=0){0!==b&&r(1);b=y();if(!E(b)||!G(a))return b;let {anchor:c,focus:d}=b,e=c.getNode(),f=d.getNode();ac(e,a)&&c.set(a.__key,0,"element");ac(f,a)&&d.set(a.__key,0,"element");return b}function ac(a,b){for(a=a.getParent();null!==a;){if(a.is(b))return!0;a=a.getParent()}return!1}function tb(a){a=a._window;null===a&&r(78);return a}
27
+ function bc(a){for(a=a.getParentOrThrow();null!==a&&!cc(a);)a=a.getParentOrThrow();return a}function cc(a){return O(a)||G(a)&&a.isShadowRoot()}function dc(a){var b=I();let c=a.constructor.getType();b=b._nodes.get(c);void 0===b&&r(97);b=b.replace;return null!==b?(b=b(a),b instanceof a.constructor||r(98),b):a}function jc(a,b){a=a.getParent();if(O(a)&&!G(b)&&!C(b))throw Error("Only element or decorator nodes can be inserted in to the root node");}
28
+ function kc(a,b,c,d,e){a=a.__children;let f=a.length;for(let g=0;g<f;g++){let h=a[g],k=d.get(h);void 0!==k&&k.__parent===b&&(G(k)&&kc(k,h,c,d,e),c.has(h)||e.delete(h),d.delete(h))}}function lc(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(let e of c){let f=b.get(e);void 0===f||f.isAttached()||(a.has(e)||c.delete(e),b.delete(e))}for(let [e]of d)c=b.get(e),void 0===c||c.isAttached()||(G(c)&&kc(c,e,a,b,d),a.has(e)||d.delete(e),b.delete(e))}
29
+ function mc(a,b){let c=a.__mode,d=a.__format;a=a.__style;let e=b.__mode,f=b.__format;b=b.__style;return(null===c||c===e)&&(null===d||d===f)&&(null===a||a===b)}function nc(a,b){let c=a.mergeWithSibling(b),d=I()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}
30
+ function oc(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&D(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{mc(b,a)&&(a=nc(b,a));break}for(var c;null!==(c=a.getNextSibling())&&D(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{mc(a,c)&&nc(a,c);break}}}function pc(a){qc(a.anchor);qc(a.focus);return a}
31
+ function qc(a){for(;"element"===a.type;){var b=a.getNode(),c=a.offset;c===b.getChildrenSize()?(b=b.getChildAtIndex(c-1),c=!0):(b=b.getChildAtIndex(c),c=!1);if(D(b)){a.set(b.__key,c?b.getTextContentSize():0,"text");break}else if(!G(b))break;a.set(b.__key,c?b.getChildrenSize():0,"element")}}let P="",Q="",R="",rc,S,sc,tc=!1,uc=!1,vc,wc=null,xc,yc,zc,Ac,Bc,Cc;
32
+ function Dc(a,b){let c=zc.get(a);if(null!==b){let d=Ec(a);b.removeChild(d)}Ac.has(a)||S._keyToDOMMap.delete(a);G(c)&&(a=c.__children,Fc(a,0,a.length-1,null));void 0!==c&&Vb(Cc,sc,vc,c,"destroyed")}function Fc(a,b,c,d){for(;b<=c;++b){let e=a[b];void 0!==e&&Dc(e,d)}}function Gc(a,b){a.setProperty("text-align",b)}function Hc(a,b){a.style.setProperty("padding-inline-start",0===b?"":20*b+"px")}
33
+ function Ic(a,b){a=a.style;0===b?Gc(a,""):1===b?Gc(a,"left"):2===b?Gc(a,"center"):3===b?Gc(a,"right"):4===b&&Gc(a,"justify")}
34
+ function Jc(a,b,c){let d=Ac.get(a);void 0===d&&r(60);let e=d.createDOM(rc,S);var f=S._keyToDOMMap;e["__lexicalKey_"+S._key]=a;f.set(a,e);D(d)?e.setAttribute("data-lexical-text","true"):C(d)&&e.setAttribute("data-lexical-decorator","true");if(G(d)){a=d.__indent;0!==a&&Hc(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;let h=Q;Q="";Kc(f,0,g,e,null);Lc(d,e);Q=h}f=d.__format;0!==f&&Ic(e,f);d.isInline()||Mc(null,a,e);Yb(d)&&(P+="\n\n",R+="\n\n")}else f=d.getTextContent(),C(d)?(g=d.decorate(S,rc),
35
+ null!==g&&Nc(a,g),e.contentEditable="false"):D(d)&&(d.isDirectionless()||(Q+=f)),P+=f,R+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));Vb(Cc,sc,vc,d,"created");return e}function Kc(a,b,c,d,e){let f=P;for(P="";b<=c;++b)Jc(a[b],d,e);d.__lexicalTextContent=P;P=f+P}function Oc(a,b){a=b.get(a[a.length-1]);return Cb(a)||C(a)&&a.isInline()}
36
+ function Mc(a,b,c){a=null!==a&&(0===a.length||Oc(a,zc));b=null!==b&&(0===b.length||Oc(b,Ac));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
37
+ function Lc(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==Q||c!==wc){let f=""===Q;if(f)var d=wc;else d=Q,d=Va.test(d)?"rtl":Wa.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=rc.theme;var e=null!==c?h[c]:void 0;let k=null!==d?h[d]:void 0;void 0!==e&&("string"===typeof e&&(e=e.split(" "),e=h[c]=e),g.remove(...e));null===d||f&&"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);uc||(a.getWritable().__dir=d)}wc=
39
38
  d;b.__lexicalDirTextContent=Q;b.__lexicalDir=d}}
40
- function Qc(a,b){var c=Ac.get(a),d=Bc.get(a);void 0!==c&&void 0!==d||r(61);var e=uc||zc.has(a)||yc.has(a);let f=$b(S,a);if(c===d&&!e)return G(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),D(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Wb(Dc,tc,wc,d,"updated");if(d.updateDOM(c,f,sc))return d=Kc(a,null,null),null===b&&r(62),b.replaceChild(d,f),Ec(a,null),d;if(G(c)&&G(d)){a=d.__indent;a!==c.__indent&&Ic(f,a);a=d.__format;
41
- a!==c.__format&&Jc(f,a);a=c.__children;c=d.__children;if(a!==c||e){var g=a,h=c;e=d;b=Q;Q="";let v=P;P="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Qc(l,f);else{var n=Fc(l);h=Kc(h,null,null);f.replaceChild(h,n);Ec(l,null)}}else if(0===k)0!==m&&Lc(h,0,m-1,f,null);else if(0===m)0!==k&&(l=null==f.__lexicalLineBreak,Gc(g,0,k-1,l?null:f),l&&(f.textContent=""));else{let w=k-1;k=m-1;let y=f.firstChild,z=0;for(m=0;z<=w&&m<=k;){var q=g[z];let B=h[m];if(q===B)y=Qc(B,f).nextSibling,
42
- z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let F=n.has(q),T=l.has(B);F?(T?(q=$b(S,B),q===y?y=Qc(B,f).nextSibling:(null!=y?f.insertBefore(q,y):f.appendChild(q),Qc(B,f)),z++):Kc(B,f,y),m++):(y=Fc(q).nextSibling,Ec(q,f),z++)}}l=z>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:S.getElementByKey(l),Lc(h,m,k,f,l)):n&&!l&&Gc(g,z,w,f)}Zb(e)&&(P+="\n\n");f.__lexicalTextContent=P;P=v+P;Mc(e,f);Q=b;O(d)||d.isInline()||Nc(a,c,f)}Zb(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),C(d)?(e=
43
- d.decorate(S,sc),null!==e&&Oc(a,e)):D(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!vc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Oc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Jb(S)}c[a]=b}function Fc(a){a=Cc.get(a);void 0===a&&r(75);return a}
44
- let U=Object.freeze({}),Xc=[["keydown",Rc],["mousedown",Sc],["compositionstart",Tc],["compositionend",Uc],["input",Vc],["click",Wc],["cut",U],["copy",U],["dragstart",U],["dragover",U],["dragend",U],["paste",U],["focus",U],["blur",U],["drop",U]];Pa&&Xc.push(["beforeinput",(a,b)=>Yc(a,b)]);let Zc=0,$c=0,ad=0,bd=!1,cd=!1,dd=!1,ed=!1,fd=[0,0,"root",0];function gd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
45
- function hd(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(bd&&(bd=!1,gd(d,e)&&gd(f,g)))return;A(b,()=>{if(!c)lb(null);else if(wb(b,d,f)){var h=x();if(E(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var l=tb(b).event;l=l?l.timeStamp:performance.now();let [n,q,v,w]=fd;l<w+200&&k.offset===q&&k.key===v?h.format=n:"text"===k.type?h.format=m.getFormat():"element"===k.type&&(h.format=0)}else{k=127;m=!1;l=h.getNodes();
46
- let n=l.length;for(let q=0;q<n;q++){let v=l[q];if(D(v)&&(m=!0,k&=v.getFormat(),0===k))break}h.format=m?k:0}}V(b,ba,void 0)}})}function Wc(a,b){A(b,()=>{let c=x(),d=t?window.getSelection():null,e=Sb();if(E(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Lb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ca,a)})}
47
- function Sc(a,b){let c=a.target;c instanceof Node&&A(b,()=>{C(ib(c))||(cd=!0)})}function id(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function jd(a,b){return a!==b||G(a)||G(b)||!a.isToken()||!b.isToken()}
48
- function Yc(a,b){let c=a.inputType;"deleteCompositionText"===c||Oa&&mb(b)||"insertCompositionText"!==c&&A(b,()=>{let d=x();if("deleteContentBackward"===c){if(null===d){var e=Sb();if(!E(e))return;lb(e.clone())}if(E(d)){229===$c&&a.timeStamp<Zc+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),Zc=0,setTimeout(()=>{A(b,()=>{K(null)})},30),E(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,da,!0));return}}if(E(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
49
- id(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,ea,!1)):"\n\n"===e?(a.preventDefault(),V(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&Ub(d,e)&&(a.preventDefault(),V(b,ia,e));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ia,a);break;case "insertFromComposition":K(null);V(b,
50
- ia,a);break;case "insertLineBreak":K(null);V(b,ea,!1);break;case "insertParagraph":K(null);dd?(dd=!1,V(b,ea,!1)):V(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ja,a);break;case "deleteByComposition":jd(g,f)&&V(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ka,void 0);break;case "deleteContent":V(b,da,!1);break;case "deleteWordBackward":V(b,la,!0);break;case "deleteWordForward":V(b,la,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
39
+ function Pc(a,b){var c=zc.get(a),d=Ac.get(a);void 0!==c&&void 0!==d||r(61);var e=tc||yc.has(a)||xc.has(a);let f=Zb(S,a);if(c===d&&!e)return G(c)?(d=f.__lexicalTextContent,void 0!==d&&(P+=d,R+=d),d=f.__lexicalDirTextContent,void 0!==d&&(Q+=d)):(d=c.getTextContent(),D(c)&&!c.isDirectionless()&&(Q+=d),R+=d,P+=d),f;c!==d&&e&&Vb(Cc,sc,vc,d,"updated");if(d.updateDOM(c,f,rc))return d=Jc(a,null,null),null===b&&r(62),b.replaceChild(d,f),Dc(a,null),d;if(G(c)&&G(d)){a=d.__indent;a!==c.__indent&&Hc(f,a);a=d.__format;
40
+ a!==c.__format&&Ic(f,a);a=c.__children;c=d.__children;if(a!==c||e){var g=a,h=c;e=d;b=Q;Q="";let v=P;P="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Pc(l,f);else{var n=Ec(l);h=Jc(h,null,null);f.replaceChild(h,n);Dc(l,null)}}else if(0===k)0!==m&&Kc(h,0,m-1,f,null);else if(0===m)0!==k&&(l=null==f.__lexicalLineBreak,Fc(g,0,k-1,l?null:f),l&&(f.textContent=""));else{let w=k-1;k=m-1;let x=f.firstChild,z=0;for(m=0;z<=w&&m<=k;){var q=g[z];let B=h[m];if(q===B)x=Pc(B,f).nextSibling,
41
+ z++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let F=n.has(q),T=l.has(B);F?(T?(q=Zb(S,B),q===x?x=Pc(B,f).nextSibling:(null!=x?f.insertBefore(q,x):f.appendChild(q),Pc(B,f)),z++):Jc(B,f,x),m++):(x=Ec(q).nextSibling,Dc(q,f),z++)}}l=z>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:S.getElementByKey(l),Kc(h,m,k,f,l)):n&&!l&&Fc(g,z,w,f)}Yb(e)&&(P+="\n\n");f.__lexicalTextContent=P;P=v+P;Lc(e,f);Q=b;O(d)||d.isInline()||Mc(a,c,f)}Yb(d)&&(P+="\n\n",R+="\n\n")}else c=d.getTextContent(),C(d)?(e=
42
+ d.decorate(S,rc),null!==e&&Nc(a,e)):D(d)&&!d.isDirectionless()&&(Q+=c),P+=c,R+=c;!uc&&O(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return f}function Nc(a,b){let c=S._pendingDecorators,d=S._decorators;if(null===c){if(d[a]===b)return;c=Jb(S)}c[a]=b}function Ec(a){a=Bc.get(a);void 0===a&&r(75);return a}
43
+ let U=Object.freeze({}),Wc=[["keydown",Qc],["mousedown",Rc],["compositionstart",Sc],["compositionend",Tc],["input",Uc],["click",Vc],["cut",U],["copy",U],["dragstart",U],["dragover",U],["dragend",U],["paste",U],["focus",U],["blur",U],["drop",U]];Pa&&Wc.push(["beforeinput",(a,b)=>Xc(a,b)]);let Yc=0,Zc=0,$c=0,ad=0,bd=!1,cd=!1,dd=!1,ed=!1,fd=[0,0,"root",0];
44
+ function gd(a,b,c,d){let e=a.anchor,f=a.focus,g=e.getNode();var h=t?window.getSelection():null;h=null!==h?h.anchorNode:null;let k=e.key,m=I().getElementByKey(k),l=b.length;return k!==f.key||!D(g)||(!d&&(!Pa||$c<c+50)||2>l||Ob(b))&&e.offset!==f.offset&&!g.isComposing()||yb(g)||g.isDirty()&&1<l||(d||!Pa)&&null!==m&&!g.isComposing()&&h!==zb(m)||g.getFormat()!==a.format||Tb(a,g)}function hd(a,b){return null!==a&&null!==a.nodeValue&&3===a.nodeType&&0!==b&&b!==a.nodeValue.length}
45
+ function id(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(bd&&(bd=!1,hd(d,e)&&hd(f,g)))return;A(b,()=>{if(!c)lb(null);else if(wb(b,d,f)){var h=y();if(E(h)){var k=h.anchor,m=k.getNode();if(h.isCollapsed()){"Range"===a.type&&a.anchorNode===a.focusNode&&(h.dirty=!0);var l=tb(b).event;l=l?l.timeStamp:performance.now();let [n,q,v,w]=fd;l<w+200&&k.offset===q&&k.key===v?h.format=n:"text"===k.type?h.format=m.getFormat():"element"===k.type&&(h.format=0)}else{k=127;m=!1;l=h.getNodes();
46
+ let n=l.length;for(let q=0;q<n;q++){let v=l[q];if(D(v)&&(m=!0,k&=v.getFormat(),0===k))break}h.format=m?k:0}}V(b,ba,void 0)}})}function Vc(a,b){A(b,()=>{let c=y(),d=t?window.getSelection():null,e=Sb();if(E(c)){let f=c.anchor,g=f.getNode();d&&"element"===f.type&&0===f.offset&&c.isCollapsed()&&!O(g)&&1===Lb().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}V(b,ca,a)})}
47
+ function Rc(a,b){let c=a.target;c instanceof Node&&A(b,()=>{C(ib(c))||(cd=!0)})}function jd(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function kd(a,b){return a!==b||G(a)||G(b)||!a.isToken()||!b.isToken()}
48
+ function Xc(a,b){let c=a.inputType;"deleteCompositionText"===c||Oa&&mb(b)||"insertCompositionText"!==c&&A(b,()=>{let d=y();if("deleteContentBackward"===c){if(null===d){var e=Sb();if(!E(e))return;lb(e.clone())}if(E(d)){229===Zc&&a.timeStamp<Yc+30&&b.isComposing()&&d.anchor.key===d.focus.key?(K(null),Yc=0,setTimeout(()=>{A(b,()=>{K(null)})},30),E(d)&&(e=d.anchor.getNode(),e.markDirty(),d.format=e.getFormat())):(a.preventDefault(),V(b,da,!0));return}}if(E(d)){e=a.data;d.dirty||!d.isCollapsed()||O(d.anchor.getNode())||
49
+ jd(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c||"insertTranspose"===c)"\n"===e?(a.preventDefault(),V(b,ea,!1)):"\n\n"===e?(a.preventDefault(),V(b,ha,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&gd(d,e,a.timeStamp,!0)&&(a.preventDefault(),V(b,ia,e)),$c=a.timeStamp;else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":V(b,ia,a);break;case "insertFromComposition":K(null);
50
+ V(b,ia,a);break;case "insertLineBreak":K(null);V(b,ea,!1);break;case "insertParagraph":K(null);dd?(dd=!1,V(b,ea,!1)):V(b,ha,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":V(b,ja,a);break;case "deleteByComposition":kd(g,f)&&V(b,ka,void 0);break;case "deleteByDrag":case "deleteByCut":V(b,ka,void 0);break;case "deleteContent":V(b,da,!1);break;case "deleteWordBackward":V(b,la,!0);break;case "deleteWordForward":V(b,la,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":V(b,
51
51
  na,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":V(b,na,!1);break;case "formatStrikeThrough":V(b,p,"strikethrough");break;case "formatBold":V(b,p,"bold");break;case "formatItalic":V(b,p,"italic");break;case "formatUnderline":V(b,p,"underline");break;case "historyUndo":V(b,oa,void 0);break;case "historyRedo":V(b,pa,void 0)}}})}
52
- function Vc(a,b){a.stopPropagation();A(b,()=>{var c=x(),d=a.data;null!=d&&E(c)&&Ub(c,d)?(ed&&(kd(b,d),ed=!1),V(b,ia,d),d=d.length,Oa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=d),Qa||Ra||!b.isComposing()||(Zc=0,K(null))):(Rb(!1),ed&&(kd(b,d||void 0),ed=!1));H();c=I();nb(c)})}
53
- function Tc(a,b){A(b,()=>{let c=x();if(E(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<Zc+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ia,Ua)}})}
54
- function kd(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=zb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&D(b)&&jb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=x(),E(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,ya,null);return}}Rb(!0,b)}function Uc(a,b){Oa?ed=!0:A(b,()=>{kd(b,a.data)})}
55
- function Rc(a,b){Zc=a.timeStamp;$c=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)dd=!0,V(b,ya,a);else if(32===c)V(b,za,a);else if(u&&e&&79===c)a.preventDefault(),dd=!0,V(b,ea,!0);else if(13!==c||d){var h=u?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,Aa,a):(a.preventDefault(),V(b,da,!0)):27===c?V(b,Ba,a):(h=u?d||g||f?
52
+ function Uc(a,b){a.stopPropagation();A(b,()=>{var c=y(),d=a.data;if(null!=d&&E(c)&&gd(c,d,a.timeStamp,!1)){ed&&(ld(b,d),ed=!1);var e=c.anchor,f=e.getNode(),g=t?window.getSelection():null;if(null===g)return;let h=e.offset;if(e=Pa&&!c.isCollapsed()&&D(f)&&null!==g.anchorNode)f=f.getTextContent().slice(0,h)+d+f.getTextContent().slice(h+c.focus.offset),g=g.anchorNode,e=f===(3===g.nodeType?g.nodeValue:null);e||V(b,ia,d);d=d.length;Oa&&1<d&&"insertCompositionText"===a.inputType&&!b.isComposing()&&(c.anchor.offset-=
53
+ d);Qa||Ra||!b.isComposing()||(Yc=0,K(null))}else Rb(!1),ed&&(ld(b,d||void 0),ed=!1);H();c=I();nb(c)})}function Sc(a,b){A(b,()=>{let c=y();if(E(c)&&!b.isComposing()){let d=c.anchor;K(d.key);(a.timeStamp<Yc+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&V(b,ia,Ua)}})}
54
+ function ld(a,b){var c=a._compositionKey;K(null);if(null!==c&&null!=b){if(""===b){b=L(c);a=zb(a.getElementByKey(c));null!==a&&null!==a.nodeValue&&D(b)&&jb(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=y(),E(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);V(a,ya,null);return}}Rb(!0,b)}function Tc(a,b){Oa?ed=!0:A(b,()=>{ld(b,a.data)})}
55
+ function Qc(a,b){Yc=a.timeStamp;Zc=a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:e,metaKey:f,altKey:g}=a;if(39!==c||e||f||g)if(39!==c||g||d||!e&&!f)if(37!==c||e||f||g)if(37!==c||g||d||!e&&!f)if(38!==c||e||f)if(40!==c||e||f)if(13===c&&d)dd=!0,V(b,ya,a);else if(32===c)V(b,za,a);else if(u&&e&&79===c)a.preventDefault(),dd=!0,V(b,ea,!0);else if(13!==c||d){var h=u?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?V(b,Aa,a):(a.preventDefault(),V(b,da,!0)):27===c?V(b,Ba,a):(h=u?d||g||f?
56
56
  !1:46===c||68===c&&e:e||g||f?!1:46===c,h?46===c?V(b,Ca,a):(a.preventDefault(),V(b,da,!1)):8===c&&(u?g:e)?(a.preventDefault(),V(b,la,!0)):46===c&&(u?g:e)?(a.preventDefault(),V(b,la,!1)):u&&f&&8===c?(a.preventDefault(),V(b,na,!0)):u&&f&&46===c?(a.preventDefault(),V(b,na,!1)):66===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"bold")):85===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"underline")):73===c&&!g&&(u?f:e)?(a.preventDefault(),V(b,p,"italic")):9!==c||g||e||f?90===c&&!d&&(u?f:e)?(a.preventDefault(),
57
- V(b,oa,void 0)):(h=u?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,pa,void 0)):ld(b._editorState._selection)&&(h=d?!1:67===c?u?f:e:!1,h?(a.preventDefault(),V(b,Ia,a)):(h=d?!1:88===c?u?f:e:!1,h&&(a.preventDefault(),V(b,Ja,a))))):V(b,Da,a))}else dd=!1,V(b,ya,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);else V(b,ra,a);else V(b,qa,a);(e||d||g||f)&&V(b,Ma,a)}}function md(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let nd=new Map;
58
- function od(){let a=t?window.getSelection():null;if(null!==a){var b=xb(a.anchorNode);if(null!==b){cd&&(cd=!1,A(b,()=>{var g=Sb(),h=a.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=pd(g,a,b),lb(g))}));var c=Pb(b);c=c[c.length-1];var d=c._key,e=nd.get(d),f=e||c;f!==b&&hd(a,f,!1);hd(a,b,!0);b!==c?nd.set(d,b):e&&nd.delete(d)}}}
59
- function qd(a,b){0===ad&&a.ownerDocument.addEventListener("selectionchange",od);ad++;a.__lexicalEditor=b;let c=md(a);for(let d=0;d<Xc.length;d++){let [e,f]=Xc[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return V(b,Ja,h);case "copy":return V(b,Ia,h);case "paste":return V(b,ja,h);case "dragstart":return V(b,Fa,h);case "dragover":return V(b,Ga,h);case "dragend":return V(b,
57
+ V(b,oa,void 0)):(h=u?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),V(b,pa,void 0)):md(b._editorState._selection)&&(h=d?!1:67===c?u?f:e:!1,h?(a.preventDefault(),V(b,Ia,a)):(h=d?!1:88===c?u?f:e:!1,h&&(a.preventDefault(),V(b,Ja,a))))):V(b,Da,a))}else dd=!1,V(b,ya,a);else V(b,va,a);else V(b,ua,a);else V(b,ta,a);else V(b,sa,a);else V(b,ra,a);else V(b,qa,a);(e||d||g||f)&&V(b,Ma,a)}}function nd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let od=new Map;
58
+ function pd(){let a=t?window.getSelection():null;if(null!==a){var b=xb(a.anchorNode);if(null!==b){cd&&(cd=!1,A(b,()=>{var g=Sb(),h=a.anchorNode;null!==h&&(h=h.nodeType,1===h||3===h)&&(g=qd(g,a,b),lb(g))}));var c=Pb(b);c=c[c.length-1];var d=c._key,e=od.get(d),f=e||c;f!==b&&id(a,f,!1);id(a,b,!0);b!==c?od.set(d,b):e&&od.delete(d)}}}
59
+ function rd(a,b){0===ad&&a.ownerDocument.addEventListener("selectionchange",pd);ad++;a.__lexicalEditor=b;let c=nd(a);for(let d=0;d<Wc.length;d++){let [e,f]=Wc[d],g="function"===typeof f?h=>{!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()&&f(h,b))}:h=>{if(!0!==h._lexicalHandled&&(h._lexicalHandled=!0,b.isEditable()))switch(e){case "cut":return V(b,Ja,h);case "copy":return V(b,Ia,h);case "paste":return V(b,ja,h);case "dragstart":return V(b,Fa,h);case "dragover":return V(b,Ga,h);case "dragend":return V(b,
60
60
  Ha,h);case "focus":return V(b,Ka,h);case "blur":return V(b,La,h);case "drop":return V(b,Ea,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
61
61
  class X{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(G(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}G(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=L(this.key);null===a&&r(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
62
- M||(Ib()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function rd(a,b){let c=b.__key,d=a.offset,e="element";if(D(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!G(b)){var f=b.getNextSibling();if(D(f))c=f.__key,d=0;else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function sd(a,b){if(G(b)){let c=b.getLastDescendant();G(c)||D(c)?rd(a,c):rd(a,b)}else rd(a,b)}
63
- function td(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=N(),g=O(d)?ud().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function vd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
64
- class wd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!ld(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 wd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
65
- b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(D(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=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);M||(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 E(a){return a instanceof xd}
66
- class yd{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 zd(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.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 yd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Ad(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
67
- b){let c=this.focus.getNode();return qc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&r(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&r(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=
68
- this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);Bd(f)||r(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Cd(g)||r(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];Dd(h)||r(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);G(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);M||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=
69
- a[c].getTextContent();return b}}function zd(a){return a instanceof yd}
70
- class xd{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 E(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();G(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
71
- b?b:a);G(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?G(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);M||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){vd(this.anchor,a.__key,b,"text");vd(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),[e,f]=Ad(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];if(G(m)&&!m.isInline())h||
72
- (g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,D(m)){let l=m.getTextContent();m===b?l=m===c?e<f?l.slice(e,f):l.slice(f,e):d?l.slice(e):l.slice(f):m===c&&(l=d?l.slice(0,f):l.slice(0,e));g+=l}else!C(m)&&!Cb(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=I(),c=b.getEditorState()._selection;a=Ed(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;vd(this.anchor,d.key,d.offset,d.type);vd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
73
- null}}clone(){let a=this.anchor,b=this.focus;return new xd(new X(a.key,a.offset,a.type),new X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Ab(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Xa[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 e=b[d];""!==e&&a.push(N(e));d!==c-1&&a.push(Fd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
74
- b.isBefore(c),e=this.format;d&&"element"===b.type?td(b,c,e):d||"element"!==c.type||td(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];D(b)||r(26);d=b.getTextContent().length;var m=b.getParentOrThrow(),l=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var n=b.getNextSibling();if(!D(n)||yb(n))n=N(),n.setFormat(e),m.canInsertTextAfter()?b.insertAfter(n):m.insertAfter(n);
62
+ M||(Ib()===e&&K(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function sd(a,b){let c=b.__key,d=a.offset,e="element";if(D(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!G(b)){var f=b.getNextSibling();if(D(f))c=f.__key,d=0,e="text";else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function td(a,b){if(G(b)){let c=b.getLastDescendant();G(c)||D(c)?sd(a,c):sd(a,b)}else sd(a,b)}
63
+ function ud(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=N(),g=O(d)?vd().append(f):f;f.setFormat(c);null===e?d.append(g):e.insertBefore(g);a.is(b)&&b.set(f.__key,0,"text");a.set(f.__key,0,"text")}function wd(a,b,c,d){a.key=b;a.offset=c;a.type=d}
64
+ class xd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!md(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 xd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
65
+ b){let c=this.getNodes(),d=c.length;var e=c[d-1];if(D(e))e=e.select();else{let f=e.getIndexWithinParent()+1;e=e.getParentOrThrow().select(f,f)}e.insertNodes(a,b);for(a=0;a<d;a++)c[a].remove();return!0}getNodes(){var a=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);M||(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 E(a){return a instanceof yd}
66
+ class zd{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 Ad(a)?this.gridKey===a.gridKey&&this.anchor.is(a.anchor)&&this.focus.is(a.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 zd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return Bd(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}insertNodes(a,
67
+ b){let c=this.focus.getNode();return pc(c.select(0,c.getChildrenSize())).insertNodes(a,b)}getShape(){var a=L(this.anchor.key);null===a&&r(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=L(this.focus.key);null===c&&r(22);var d=c.getIndexWithinParent();let e=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,e);a=Math.max(a,e);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){var a=
68
+ this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=L(this.gridKey);Cd(f)||r(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);Dd(g)||r(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];Ed(h)||r(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);G(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);M||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=
69
+ a[c].getTextContent();return b}}function Ad(a){return a instanceof zd}
70
+ class yd{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 E(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();G(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
71
+ b?b:a);G(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?G(a)&&0<a.getChildrenSize()?[]:[a]:a.getNodesBetween(d);M||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){wd(this.anchor,a.__key,b,"text");wd(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),[e,f]=Bd(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];if(G(m)&&!m.isInline())h||
72
+ (g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,D(m)){let l=m.getTextContent();m===b?l=m===c?e<f?l.slice(e,f):l.slice(f,e):d?l.slice(e):l.slice(f):m===c&&(l=d?l.slice(0,f):l.slice(0,e));g+=l}else!C(m)&&!Cb(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=I(),c=b.getEditorState()._selection;a=Fd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;wd(this.anchor,d.key,d.offset,d.type);wd(this.focus,e.key,e.offset,e.type);this._cachedNodes=
73
+ null}}clone(){let a=this.anchor,b=this.focus;return new yd(new X(a.key,a.offset,a.type),new X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Ab(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&Xa[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 e=b[d];""!==e&&a.push(N(e));d!==c-1&&a.push(Gd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||
74
+ b.isBefore(c),e=this.format;d&&"element"===b.type?ud(b,c,e):d||"element"!==c.type||ud(c,b,e);var f=this.getNodes(),g=f.length,h=d?c:b;c=(d?b:c).offset;var k=h.offset;b=f[0];D(b)||r(26);d=b.getTextContent().length;var m=b.getParentOrThrow(),l=f[g-1];if(this.isCollapsed()&&c===d&&(b.isSegmented()||b.isToken()||!b.canInsertTextAfter()||!m.canInsertTextAfter()&&null===b.getNextSibling())){var n=b.getNextSibling();if(!D(n)||yb(n))n=N(),n.setFormat(e),m.canInsertTextAfter()?b.insertAfter(n):m.insertAfter(n);
75
75
  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(!D(n)||yb(n))n=N(),n.setFormat(e),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=N(b.getTextContent()),m.setFormat(e),b.replace(m),b=m;else if(!(this.isCollapsed()||""===
76
- a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!G(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");Gd(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=N(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=N(a);f.setFormat(e);f.select();0===c?b.insertBefore(f):([g]=b.splitText(c),g.insertAfter(f));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
76
+ a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!G(n)||n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");Hd(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(b.isToken())a=N(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=N(a);f.setFormat(e);f.select();0===c?b.insertBefore(f):([g]=b.splitText(c),g.insertAfter(f));f.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=
77
77
  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=f)}else{e=new Set([...b.getParentKeys(),...l.getParentKeys()]);var q=G(b)?b:b.getParentOrThrow();m=G(l)?l:l.getParentOrThrow();n=l;if(!q.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?D(l)&&!l.isToken()&&k!==l.getTextContentSize()?
78
78
  (l.isSegmented()&&(h=N(l.getTextContent()),l.replace(h),l=h),l=l.spliceText(0,k,""),e.add(l.__key)):(h=l.getParentOrThrow(),h.canBeEmpty()||1!==h.getChildrenSize()?l.remove():h.remove()):e.add(l.__key);h=m.getChildren();k=new Set(f);l=q.is(m);q=q.isInline()&&null===b.getNextSibling()?q:b;for(let v=h.length-1;0<=v;v--){let w=h[v];if(w.is(b)||G(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(n)?l||q.insertAfter(w):w.remove())}if(!l)for(h=m,k=null;null!==h;){l=h.getChildren();m=l.length;if(0===
79
79
  m||l[m-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}b.isToken()?c===d?b.select():(a=N(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=f[a],e.has(b.__key)||b.remove()}}removeText(){this.insertText("")}formatText(a){if(this.isCollapsed())this.toggleFormat(a),K(null);else{var b=this.getNodes(),c=[];for(var d of b)D(d)&&c.push(d);var e=c.length;if(0===e)this.toggleFormat(a),
80
80
  K(null);else{d=this.anchor;var f=this.focus,g=this.isBackward();b=g?f:d;d=g?d:f;var h=0,k=c[0];f="element"===b.type?0:b.offset;"text"===b.type&&f===k.getTextContentSize()&&(h=1,k=c[1],f=0);if(null!=k){g=k.getFormatFlags(a,null);var m=e-1,l=c[m];e="text"===d.type?d.offset:l.getTextContentSize();if(k.is(l))f!==e&&(0===f&&e===k.getTextContentSize()?k.setFormat(g):(a=k.splitText(f,e),a=0===f?a[0]:a[1],a.setFormat(g),"text"===b.type&&b.set(a.__key,0,"text"),"text"===d.type&&d.set(a.__key,e-f,"text")),
81
81
  this.format=g);else{0!==f&&([,k]=k.splitText(f),f=0);k.setFormat(g);var n=l.getFormatFlags(a,g);0<e&&(e!==l.getTextContentSize()&&([l]=l.splitText(e)),l.setFormat(n));for(h+=1;h<m;h++){let q=c[h];if(!q.isToken()){let v=q.getFormatFlags(a,n);q.setFormat(v)}}"text"===b.type&&b.set(k.__key,f,"text");"text"===d.type&&d.set(l.__key,e,"text");this.format=g|n}}}}}insertNodes(a,b){if(!this.isCollapsed()){var c=this.isBackward()?this.anchor:this.focus,d=c.getNode().getNextSibling();d=d?d.getKey():null;c=(c=
82
82
  c.getNode().getPreviousSibling())?c.getKey():null;this.removeText();if(this.isCollapsed()&&"element"===this.focus.type){if(this.focus.key===d&&0===this.focus.offset){var e=N();this.focus.getNode().insertBefore(e)}else this.focus.key===c&&this.focus.offset===this.focus.getNode().getChildrenSize()&&(e=N(),this.focus.getNode().insertAfter(e));e&&(this.focus.set(e.__key,0,"text"),this.anchor.set(e.__key,0,"text"))}}d=this.anchor;c=d.offset;var f=d.getNode();e=f;"element"===d.type&&(e=d.getNode(),d=e.getChildAtIndex(c-
83
- 1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=ic(f)?null:f.getTopLevelElementOrThrow();if(D(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,m=null;for(let v=0;v<a.length;v++){var l=a[v];if(C(e)||!G(l)||l.isInline())k&&!C(l)&&ic(e.getParent())&&r(28);else{if(l.is(g)){if(G(e)&&e.isEmpty()&&e.canReplaceWith(l)){e.replace(l);
84
- e=l;k=!0;continue}var n=l.getFirstDescendant();if(Bb(n)){for(n=n.getParentOrThrow();n.isInline();)n=n.getParentOrThrow();m=n.getChildren();k=m.length;if(G(e))for(var q=0;q<k;q++)e.append(m[q]);else{for(q=k-1;0<=q;q--)e.insertAfter(m[q]);e=e.getParentOrThrow()}m=m[k-1];n.remove();k=!0;if(n.is(l))continue}}D(e)&&(null===h&&r(27),e=h)}k=!1;if(G(e)&&!e.isInline())if(m=l,C(l)&&!l.isInline())e=e.insertAfter(l);else if(G(l)){if(l.canBeEmpty()||!l.isEmpty())O(e)?(n=e.getChildAtIndex(c),null!==n?n.insertBefore(l):
85
- e.append(l),e=l):e=e.insertAfter(l)}else n=e.getFirstChild(),null!==n?n.insertBefore(l):e.append(l),e=l;else!G(l)||G(l)&&l.isInline()||C(e)&&!e.isInline()?(m=l,e=e.insertAfter(l)):(l=e.getParentOrThrow(),Cb(e)&&e.remove(),e=l,v--)}b&&(D(f)?f.select():(a=e.getPreviousSibling(),D(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(G(e)){if(a=D(m)?m:G(m)&&m.isInline()?m.getLastDescendant():e.getLastDescendant(),b||(null===a?e.select():D(a)?a.select():a.selectNext()),0!==
86
- d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!G(e)||Hd(c)||C(c)&&(!c.isInline()||c.isIsolated())?G(e)||Hd(c)?G(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),G(f)||r(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(D(e)?e.select():(b=e.getParentOrThrow(),a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();
87
- var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(ic(f)){e=ud();c=f.getChildAtIndex(b);e.select();null!==c?c.insertBefore(e):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=
88
- f.getParentOrThrow(),e=c.insertNewAfter(this),G(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this),null===g)this.insertLineBreak();else if(G(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=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=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),
89
- g.remove())}}insertLineBreak(a){let b=Fd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Ad(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Ad(this);if(0===b)return[];if(1===b)return D(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);D(f)&&
90
- (d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));D(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=Yb(d,b);if(C(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Id(),b.add(g.__key),lb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),D(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),G(a)?(c=
91
- a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(d=t?window.getSelection():null)if(d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&(e=d.getRangeAt(0),g=this.anchor.getNode(),g=O(g)?g:cc(g),this.applyDOMRange(e),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(let h=0;h<f.length;h++){let k=f[h];bc(k,g)?a.push(k):c=!0}c&&0<a.length&&(b?(b=a[0],G(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-
92
- 1],G(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==e.startContainer||d.anchorOffset!==e.startOffset)b=this.focus,f=this.anchor,d=f.key,e=f.offset,g=f.type,vd(f,b.key,b.offset,b.type),vd(b,d,e,g),this._cachedNodes=null}}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&G(d)&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getNextSibling()||d.getParentOrThrow().getNextSibling();
93
- if(G(e)&&!e.canExtractContents())return}e=Yb(c,a);if(C(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&G(d)&&0===d.getChildrenSize()?(d.remove(),a=Id(),a.add(e.__key),lb(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),e.is(d)||a&&b!==c||!a&&0!==b){Jd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),
94
- d.is(e)||a&&0!==b||!a&&b!==c)){Jd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Ob(b)||(a?e.offset=f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&("text"===this.anchor.type&&this.modify("extend",a,
95
- "lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function ld(a){return a instanceof wd}function Kd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
96
- function Ad(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]:[Kd(b),Kd(a)]}function Jd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>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))}
97
- function Ld(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var e=a.childNodes;var f=e.length;d===f&&(g=!0,d=f-1);e=Nb(e[d]);if(D(e))d=g?e.getTextContentSize():0;else{f=Nb(a);if(null===f)return null;if(G(f)){a=f.getChildAtIndex(d);if(b=G(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,d=0):(a=c,f=a.getParentOrThrow()));D(a)?(e=a,f=null,d=g?a.getTextContentSize():0):a!==f&&g&&d++}else d=f.getIndexWithinParent(),
83
+ 1),e=null===d?e:d);d=[];var g=f.getNextSiblings(),h=cc(f)?null:f.getTopLevelElementOrThrow();if(D(f))if(e=f.getTextContent().length,0===c&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),d.push(f);else if(c===e)e=f;else{if(f.isToken())return!1;[e,f]=f.splitText(c);d.push(f)}f=e;d.push(...g);g=a[0];var k=!1,m=null;for(let v=0;v<a.length;v++){var l=a[v];if(C(e)||!G(l)||l.isInline())k&&!C(l)&&cc(e.getParent())&&r(28);else{if(l.is(g)){if(G(e)&&e.isEmpty()&&e.canReplaceWith(l)){e.replace(l);
84
+ e=l;k=!0;continue}var n=l.getFirstDescendant();if(Bb(n)){for(n=n.getParentOrThrow();n.isInline();)n=n.getParentOrThrow();m=n.getChildren();k=m.length;if(G(e)){var q=e.getFirstChild();for(let w=0;w<k;w++){let x=m[w];null===q?e.append(x):q.insertAfter(x);q=x}}else{for(q=k-1;0<=q;q--)e.insertAfter(m[q]);e=e.getParentOrThrow()}m=m[k-1];n.remove();k=!0;if(n.is(l))continue}}D(e)&&(null===h&&r(27),e=h)}k=!1;if(G(e)&&!e.isInline())if(m=l,C(l)&&!l.isInline())e=e.insertAfter(l);else if(G(l)){if(l.canBeEmpty()||
85
+ !l.isEmpty())O(e)?(n=e.getChildAtIndex(c),null!==n?n.insertBefore(l):e.append(l),e=l):e=e.insertAfter(l)}else n=e.getFirstChild(),null!==n?n.insertBefore(l):e.append(l),e=l;else!G(l)||G(l)&&l.isInline()||C(e)&&!e.isInline()?(m=l,e=e.insertAfter(l)):(l=e.getParentOrThrow(),Cb(e)&&e.remove(),e=l,v--)}b&&(D(f)?f.select():(a=e.getPreviousSibling(),D(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(G(e)){if(a=D(m)?m:G(m)&&m.isInline()?m.getLastDescendant():e.getLastDescendant(),
86
+ b||(null===a?e.select():D(a)?""===a.getTextContent()?a.selectPrevious():a.select():a.selectNext()),0!==d.length)for(b=e,a=d.length-1;0<=a;a--)c=d[a],h=c.getParentOrThrow(),!G(e)||Id(c)||C(c)&&(!c.isInline()||c.isIsolated())?G(e)||Id(c)?G(c)&&!c.canInsertAfter(e)?(f=h.constructor.clone(h),G(f)||r(29),f.append(c),e.insertAfter(f)):e.insertAfter(c):(e.insertBefore(c),e=c):(b===e?e.append(c):e.insertBefore(c),e=c),h.isEmpty()&&!h.canBeEmpty()&&h.remove()}else b||(D(e)?e.select():(b=e.getParentOrThrow(),
87
+ a=e.getIndexWithinParent()+1,b.select(a,a)));return!0}insertParagraph(){this.isCollapsed()||this.removeText();var a=this.anchor,b=a.offset,c=[];if("text"===a.type){var d=a.getNode();var e=d.getNextSiblings().reverse();var f=d.getParentOrThrow();var g=f.isInline(),h=g?f.getTextContentSize():d.getTextContentSize();0===b?e.push(d):(g&&(c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(cc(f)){e=vd();c=f.getChildAtIndex(b);e.select();null!==
88
+ c?c.insertBefore(e):f.append(e);return}e=f.getChildren().slice(b).reverse()}d=e.length;if(0===b&&0<d&&f.isInline()){if(c=f.getParentOrThrow(),e=c.insertNewAfter(this),G(e))for(c=c.getChildren(),f=0;f<c.length;f++)e.append(c[f])}else if(g=f.insertNewAfter(this),null===g)this.insertLineBreak();else if(G(g))if(h=f.getFirstChild(),0===b&&(f.is(a.getNode())||h&&h.is(a.getNode()))&&0<d)f.insertBefore(g);else{f=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<
89
+ d;c++)b=e[c],null===f?g.append(b):f.insertBefore(b),f=b;g.canBeEmpty()||0!==g.getChildrenSize()?g.selectStart():(g.selectPrevious(),g.remove())}}insertLineBreak(a){let b=Gd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),O(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return Bd(this)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;let e=this.focus;var f=a[0];let g=a[c],[h,k]=Bd(this);if(0===b)return[];if(1===
90
+ b)return D(f)&&!this.isCollapsed()?(a=h>k?k:h,c=f.splitText(a,h>k?h:k),a=0===a?c[0]:c[1],null!=a?[a]:[]):[f];b=d.isBefore(e);D(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));D(g)&&(f=g.getTextContent().length,b=b?k:h,0===b?a.pop():b!==f&&([g]=g.splitText(b),a[c]=g));return a}modify(a,b,c){var d=this.focus,e=this.anchor,f="move"===a,g=Xb(d,b);if(C(g)&&!g.isIsolated())f&&g.isKeyboardSelectable()?(b=Jd(),b.add(g.__key),lb(b)):(a=b?g.getPreviousSibling():g.getNextSibling(),
91
+ D(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),G(a)?(c=a.__key,g=b?a.getChildrenSize():0):(g=g.getIndexWithinParent(),c=c.__key,b||g++),d.set(c,g,"element"),f&&e.set(c,g,"element")));else if(d=t?window.getSelection():null)if(d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&(e=d.getRangeAt(0),g=this.anchor.getNode(),g=O(g)?g:bc(g),this.applyDOMRange(e),this.dirty=!0,!f)){f=this.getNodes();a=[];c=!1;for(let h=0;h<f.length;h++){let k=
92
+ f[h];ac(k,g)?a.push(k):c=!0}c&&0<a.length&&(b?(b=a[0],G(b)?b.selectStart():b.getParentOrThrow().selectStart()):(b=a[a.length-1],G(b)?b.selectEnd():b.getParentOrThrow().selectEnd()));if(d.anchorNode!==e.startContainer||d.anchorOffset!==e.startOffset)b=this.focus,f=this.anchor,d=f.key,e=f.offset,g=f.type,wd(f,b.key,b.offset,b.type),wd(b,d,e,g),this._cachedNodes=null}}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,d=b.getNode();if(!a&&("element"===b.type&&G(d)&&b.offset===d.getChildrenSize()||
93
+ "text"===b.type&&b.offset===d.getTextContentSize())){var e=d.getNextSibling()||d.getParentOrThrow().getNextSibling();if(G(e)&&!e.canExtractContents())return}e=Xb(c,a);if(C(e)&&!e.isIsolated()){e.isKeyboardSelectable()&&G(d)&&0===d.getChildrenSize()?(d.remove(),a=Jd(),a.add(e.__key),lb(a)):e.remove();return}this.modify("extend",a,"character");if(!this.isCollapsed()){e="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==e&&e.isSegmented()){if(b=c.offset,c=e.getTextContentSize(),
94
+ e.is(d)||a&&b!==c||!a&&0!==b){Kd(e,a,b);return}}else if(null!==d&&d.isSegmented()&&(b=b.offset,c=d.getTextContentSize(),d.is(e)||a&&0!==b||!a&&b!==c)){Kd(d,a,b);return}d=this.anchor;e=this.focus;b=d.getNode();c=e.getNode();if(b===c&&"text"===d.type&&"text"===e.type){var f=d.offset,g=e.offset;let h=f<g;c=h?f:g;g=h?g:f;f=g-1;c!==f&&(b=b.getTextContent().slice(c,g),Ob(b)||(a?e.offset=f:d.offset=f))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
95
+ ("text"===this.anchor.type&&this.modify("extend",a,"lineboundary"),0===(a?this.focus:this.anchor).offset&&this.modify("extend",a,"character"));this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function md(a){return a instanceof xd}function Ld(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
96
+ function Bd(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]:[Ld(b),Ld(a)]}function Kd(a,b,c){let d=a.getTextContent().split(/(?=\s)/g),e=d.length,f=0,g=0;for(let h=0;h<e;h++){let k=d[h],m=h===e-1;g=f;f+=k.length;if(b&&f===c||f>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))}
97
+ function Md(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var e=a.childNodes;var f=e.length;d===f&&(g=!0,d=f-1);e=Nb(e[d]);if(D(e))d=g?e.getTextContentSize():0;else{f=Nb(a);if(null===f)return null;if(G(f)){a=f.getChildAtIndex(d);if(b=G(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(f=a,d=0):(a=c,f=a.getParentOrThrow()));D(a)?(e=a,f=null,d=g?a.getTextContentSize():0):a!==f&&g&&d++}else d=f.getIndexWithinParent(),
98
98
  d=0===b&&C(f)&&Nb(a)===f?d:d+1,f=f.getParentOrThrow();if(G(f))return new X(f.__key,d,"element")}}else e=Nb(a);return D(e)?new X(e.__key,d,"text"):null}
99
- function Ud(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&G(e)&&e.isInline()&&(b=e.getPreviousSibling(),D(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):G(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):D(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&G(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
100
- b)&&null===d&&G(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),D(b)&&(a.key=b.__key,a.offset=0)))}function Gd(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Ud(a,d,e);Ud(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=I();d.isComposing()&&d._compositionKey!==a.key&&E(c)&&(d=c.anchor,c=c.focus,vd(a,d.key,d.offset,d.type),vd(b,c.key,c.offset,c.type))}}
101
- function Ed(a,b,c,d,e,f){if(null===a||null===c||!wb(e,a,c))return null;b=Ld(a,b,E(f)?f.anchor:null);if(null===b)return null;d=Ld(c,d,E(f)?f.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=Nb(a),c=Nb(c),C(a)&&C(c)))return null;Gd(b,d,f);return[b,d]}function Hd(a){return G(a)&&!a.isInline()}function Vd(a,b,c,d,e,f){let g=J();a=new xd(new X(a,b,e),new X(c,d,f),0);a.dirty=!0;return g._selection=a}function Id(){return new wd(new Set)}
102
- function Wd(a){let b=a.getEditorState()._selection,c=t?window.getSelection():null;return ld(b)||zd(b)?b.clone():pd(b,c,a)}
103
- function pd(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!cb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!E(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&E(a)&&!wb(c,e,f))return a.clone()}else return a.clone();c=Ed(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new xd(h,k,E(a)?a.format:0)}
104
- function x(){return J()._selection}function Sb(){return I()._editorState._selection}
105
- function Xd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Yd(a));else{var k=a.isBackward();h=k?f:e;var m=h.getNode();e=k?e:f;f=e.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Yd(a)}}
106
- function Yd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())G(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),D(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(G(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);D(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}G(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
107
- 1):g.getChildAtIndex(e),D(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Zd(a,b){b=b.getEditorState()._selection;a=a._selection;if(E(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
108
- function $d(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,D(d)?(g=d.getTextContentSize(),h="text"):G(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,D(e)?h="text":G(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function ae(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}let Y=null,Z=null,M=!1,be=!1,Eb=0;function H(){M&&r(13)}
109
- function J(){null===Y&&r(15);return Y}function I(){null===Z&&r(16);return Z}function ce(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function de(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),D(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&pc(b)}
110
- function ee(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Ib(),f=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),D(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&pc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),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),void 0!==
111
- g&&void 0!==g&&g.__key!==e&&g.isAttached()&&ce(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Eb++}b._dirtyLeaves=c;b._dirtyElements=d}function fe(a,b){var c=b.get(a.type);void 0===c&&r(17);c=c.klass;a.type!==c.getType()&&r(18);c=c.importJSON(a);a=a.children;if(G(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=fe(a[d],b);c.append(e)}return c}function ge(a,b){let c=Y,d=M,e=Z;Y=a;M=!0;Z=null;try{return b()}finally{Y=c,M=d,Z=e}}
112
- function he(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless;if((null!==c||d)&&null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=Y,m=M,l=Z,n=a._updating,q=a._observer,v=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==q){Z=a;Y=b;M=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,z=a._dirtyLeaves;q.disconnect();Q=R=P="";uc=2===w;xc=null;S=a;sc=a._config;tc=a._nodes;wc=S._listeners.mutation;yc=y;zc=z;Ac=e._nodeMap;Bc=b._nodeMap;
113
- vc=b._readOnly;Cc=new Map(a._keyToDOMMap);var B=new Map;Dc=B;Qc("root",null);Dc=Cc=sc=Bc=Ac=zc=yc=tc=S=void 0;v=B}catch(W){W instanceof Error&&a._onError(W);if(be)throw W;ie(a,null,c,b);sb(a);a._dirtyType=2;be=!0;he(a);be=!1;return}finally{q.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,M=m,Z=l}}b._readOnly||(b._readOnly=!0);n=a._dirtyLeaves;q=a._dirtyElements;B=a._normalizedNodes;w=a._updateTags;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,
114
- a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);z=a._decorators;y=a._pendingDecorators||z;var F=b._nodeMap;for(Sa in y)F.has(Sa)||(y===z&&(y=Jb(a)),delete y[Sa]);d=d?null:t?window.getSelection():null;if(a._editable&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let W=d.anchorNode,wa=d.focusNode,Ge=d.anchorOffset,He=d.focusOffset,ob=document.activeElement;if(!w.has("collaboration")||ob===c)if(E(g)){var T=g.anchor,aa=g.focus,Md=T.key,xa=aa.key,Nd=$b(a,Md),Od=$b(a,xa),pb=
115
- T.offset,Pd=aa.offset,dc=g.format,Qd=g.isCollapsed();h=Nd;xa=Od;var Sa=!1;"text"===T.type&&(h=zb(Nd),Sa=T.getNode().getFormat()!==dc);"text"===aa.type&&(xa=zb(Od));if(null!==h&&null!==xa){if(Qd&&(null===f||Sa||E(f)&&f.format!==dc)){var Ie=performance.now();fd=[dc,pb,Md,Ie]}if(Ge===pb&&He===Pd&&W===h&&wa===xa&&("Range"!==d.type||!Qd)&&(null===c||null!==ob&&c.contains(ob)||c.focus({preventScroll:!0}),"element"!==T.type))break a;try{d.setBaseAndExtent(h,pb,xa,Pd);if(!w.has("skip-scroll-into-view")&&
116
- g.isCollapsed()&&null!==c&&c===ob){let ec=g instanceof xd&&"element"===g.anchor.type?h.childNodes[pb]||null:0<d.rangeCount?d.getRangeAt(0):null;if(null!==ec){let Je=ec.getBoundingClientRect(),Rd=c.ownerDocument,Sd=Rd.defaultView;if(null!==Sd)for(var {top:fc,bottom:gc}=Je,fa,ma;null!==c;){let hc=c===Rd.body;if(hc)fa=0,ma=tb(a).innerHeight;else{let qb=c.getBoundingClientRect();fa=qb.top;ma=qb.bottom}f=0;fc<fa?f=-(fa-fc):gc>ma&&(f=gc-ma);if(0!==f)if(hc)Sd.scrollBy(0,f);else{let qb=c.scrollTop;c.scrollTop+=
117
- f;let Td=c.scrollTop-qb;fc-=Td;gc-=Td}if(hc)break;let rb=c.assignedSlot||c.parentElement;c=null!==rb&&11===rb.nodeType?rb.host:rb}}}bd=!0}catch(ec){}}}else null!==f&&wb(a,W,wa)&&d.removeAllRanges()}}finally{Z=l,Y=k}}if(null!==v)for(k=v,l=Array.from(a._listeners.mutation),v=l.length,fa=0;fa<v;fa++){let [W,wa]=l[fa];ma=k.get(wa);void 0!==ma&&W(ma,{dirtyLeaves:n,updateTags:w})}k=a._pendingDecorators;null!==k&&(a._decorators=k,a._pendingDecorators=null,je("decorator",a,!0,k));k=Kb(e);l=Kb(b);k!==l&&je("textcontent",
118
- a,!0,l);je("update",a,!0,{dirtyElements:q,dirtyLeaves:n,editorState:b,normalizedNodes:B,prevEditorState:e,tags:w});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(e=0;e<m.length;e++)m[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [W,wa]=b;ke(a,W,wa)}}}function je(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
99
+ function Nd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&G(e)&&e.isInline()&&(b=e.getPreviousSibling(),D(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):G(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):D(d)&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&G(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type="element"):(c||
100
+ b)&&null===d&&G(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),D(b)&&(a.key=b.__key,a.offset=0)))}function Hd(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);Nd(a,d,e);Nd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=I();d.isComposing()&&d._compositionKey!==a.key&&E(c)&&(d=c.anchor,c=c.focus,wd(a,d.key,d.offset,d.type),wd(b,c.key,c.offset,c.type))}}
101
+ function Fd(a,b,c,d,e,f){if(null===a||null===c||!wb(e,a,c))return null;b=Md(a,b,E(f)?f.anchor:null);if(null===b)return null;d=Md(c,d,E(f)?f.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=Nb(a),c=Nb(c),C(a)&&C(c)))return null;Hd(b,d,f);return[b,d]}function Id(a){return G(a)&&!a.isInline()}function Wd(a,b,c,d,e,f){let g=J();a=new yd(new X(a,b,e),new X(c,d,f),0);a.dirty=!0;return g._selection=a}function Jd(){return new xd(new Set)}
102
+ function Xd(a){let b=a.getEditorState()._selection,c=t?window.getSelection():null;return md(b)||Ad(b)?b.clone():qd(b,c,a)}
103
+ function qd(a,b,c){var d=c._window;if(null===d)return null;var e=d.event,f=e?e.type:void 0;d="selectionchange"===f;e=!cb&&(d||"beforeinput"===f||"compositionstart"===f||"compositionend"===f||"click"===f&&e&&3===e.detail||"drop"===f||void 0===f);let g;if(!E(a)||e){if(null===b)return null;e=b.anchorNode;f=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(d&&E(a)&&!wb(c,e,f))return a.clone()}else return a.clone();c=Fd(e,g,f,b,c,a);if(null===c)return null;let [h,k]=c;return new yd(h,k,E(a)?a.format:0)}
104
+ function y(){return J()._selection}function Sb(){return I()._editorState._selection}
105
+ function Yd(a,b,c,d=1){var e=a.anchor,f=a.focus,g=e.getNode(),h=f.getNode();if(b.is(g)||b.is(h))if(g=b.__key,a.isCollapsed())b=e.offset,c<=b&&(c=Math.max(0,b+d),e.set(g,c,"element"),f.set(g,c,"element"),Zd(a));else{var k=a.isBackward();h=k?f:e;var m=h.getNode();e=k?e:f;f=e.getNode();b.is(m)&&(m=h.offset,c<=m&&h.set(g,Math.max(0,m+d),"element"));b.is(f)&&(b=e.offset,c<=b&&e.set(g,Math.max(0,b+d),"element"));Zd(a)}}
106
+ function Zd(a){var b=a.anchor,c=b.offset;let d=a.focus;var e=d.offset,f=b.getNode(),g=d.getNode();if(a.isCollapsed())G(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),D(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(G(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);D(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}G(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
107
+ 1):g.getChildAtIndex(e),D(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function $d(a,b){b=b.getEditorState()._selection;a=a._selection;if(E(a)){var c=a.anchor;let d=a.focus,e;"text"===c.type&&(e=c.getNode(),e.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),e!==c&&c.selectionTransform(b,a))}}
108
+ function ae(a,b,c,d,e){let f=null,g=0,h=null;null!==d?(f=d.__key,D(d)?(g=d.getTextContentSize(),h="text"):G(d)&&(g=d.getChildrenSize(),h="element")):null!==e&&(f=e.__key,D(e)?h="text":G(e)&&(h="element"));null!==f&&null!==h?a.set(f,g,h):(g=b.getIndexWithinParent(),-1===g&&(g=c.getChildrenSize()),a.set(c.__key,g,"element"))}function be(a,b,c,d,e){"text"===a.type?(a.key=c,b||(a.offset+=e)):a.offset>d.getIndexWithinParent()&&--a.offset}let Y=null,Z=null,M=!1,ce=!1,Eb=0;function H(){M&&r(13)}
109
+ function J(){null===Y&&r(15);return Y}function I(){null===Z&&r(16);return Z}function de(a,b,c){var d=b.__type;let e=a._nodes.get(d);void 0===e&&r(30);a=c.get(d);void 0===a&&(a=Array.from(e.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function ee(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(let c of b)b=a.get(c),D(b)&&b.isAttached()&&b.isSimpleText()&&!b.isUnmergeable()&&oc(b)}
110
+ function fe(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=Ib(),f=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),D(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&oc(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&de(b,g,f),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),void 0!==
111
+ g&&void 0!==g&&g.__key!==e&&g.isAttached()&&de(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Eb++}b._dirtyLeaves=c;b._dirtyElements=d}function ge(a,b){var c=b.get(a.type);void 0===c&&r(17);c=c.klass;a.type!==c.getType()&&r(18);c=c.importJSON(a);a=a.children;if(G(c)&&Array.isArray(a))for(let d=0;d<a.length;d++){let e=ge(a[d],b);c.append(e)}return c}function he(a,b){let c=Y,d=M,e=Z;Y=a;M=!0;Z=null;try{return b()}finally{Y=c,M=d,Z=e}}
112
+ function ie(a){var b=a._pendingEditorState,c=a._rootElement,d=a._headless;if((null!==c||d)&&null!==b){var e=a._editorState,f=e._selection,g=b._selection,h=0!==a._dirtyType,k=Y,m=M,l=Z,n=a._updating,q=a._observer,v=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==q){Z=a;Y=b;M=!1;a._updating=!0;try{var w=a._dirtyType,x=a._dirtyElements,z=a._dirtyLeaves;q.disconnect();Q=R=P="";tc=2===w;wc=null;S=a;rc=a._config;sc=a._nodes;vc=S._listeners.mutation;xc=x;yc=z;zc=e._nodeMap;Ac=b._nodeMap;
113
+ uc=b._readOnly;Bc=new Map(a._keyToDOMMap);var B=new Map;Cc=B;Pc("root",null);Cc=Bc=rc=Ac=zc=yc=xc=sc=S=void 0;v=B}catch(W){W instanceof Error&&a._onError(W);if(ce)throw W;je(a,null,c,b);ob(a);a._dirtyType=2;ce=!0;ie(a);ce=!1;return}finally{q.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,M=m,Z=l}}b._readOnly||(b._readOnly=!0);n=a._dirtyLeaves;q=a._dirtyElements;B=a._normalizedNodes;w=a._updateTags;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,
114
+ a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);z=a._decorators;x=a._pendingDecorators||z;var F=b._nodeMap;for(Sa in x)F.has(Sa)||(x===z&&(x=Jb(a)),delete x[Sa]);d=d?null:t?window.getSelection():null;if(a._editable&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let W=d.anchorNode,wa=d.focusNode,He=d.anchorOffset,Ie=d.focusOffset,pb=document.activeElement;if(!w.has("collaboration")||pb===c)if(E(g)){var T=g.anchor,aa=g.focus,Od=T.key,xa=aa.key,Pd=Zb(a,Od),Qd=Zb(a,xa),qb=
115
+ T.offset,Rd=aa.offset,ec=g.format,Sd=g.isCollapsed();h=Pd;xa=Qd;var Sa=!1;"text"===T.type&&(h=zb(Pd),Sa=T.getNode().getFormat()!==ec);"text"===aa.type&&(xa=zb(Qd));if(null!==h&&null!==xa){if(Sd&&(null===f||Sa||E(f)&&f.format!==ec)){var Je=performance.now();fd=[ec,qb,Od,Je]}if(He===qb&&Ie===Rd&&W===h&&wa===xa&&("Range"!==d.type||!Sd)&&(null===c||null!==pb&&c.contains(pb)||c.focus({preventScroll:!0}),"element"!==T.type))break a;try{d.setBaseAndExtent(h,qb,xa,Rd);if(!w.has("skip-scroll-into-view")&&
116
+ g.isCollapsed()&&null!==c&&c===pb){let fc=g instanceof yd&&"element"===g.anchor.type?h.childNodes[qb]||null:0<d.rangeCount?d.getRangeAt(0):null;if(null!==fc){let Ke=fc.getBoundingClientRect(),Td=c.ownerDocument,Ud=Td.defaultView;if(null!==Ud)for(var {top:gc,bottom:hc}=Ke,fa,ma;null!==c;){let ic=c===Td.body;if(ic)fa=0,ma=tb(a).innerHeight;else{let rb=c.getBoundingClientRect();fa=rb.top;ma=rb.bottom}f=0;gc<fa?f=-(fa-gc):hc>ma&&(f=hc-ma);if(0!==f)if(ic)Ud.scrollBy(0,f);else{let rb=c.scrollTop;c.scrollTop+=
117
+ f;let Vd=c.scrollTop-rb;gc-=Vd;hc-=Vd}if(ic)break;let sb=c.assignedSlot||c.parentElement;c=null!==sb&&11===sb.nodeType?sb.host:sb}}}bd=!0}catch(fc){}}}else null!==f&&wb(a,W,wa)&&d.removeAllRanges()}}finally{Z=l,Y=k}}if(null!==v)for(k=v,l=Array.from(a._listeners.mutation),v=l.length,fa=0;fa<v;fa++){let [W,wa]=l[fa];ma=k.get(wa);void 0!==ma&&W(ma,{dirtyLeaves:n,updateTags:w})}k=a._pendingDecorators;null!==k&&(a._decorators=k,a._pendingDecorators=null,ke("decorator",a,!0,k));k=Kb(e);l=Kb(b);k!==l&&ke("textcontent",
118
+ a,!0,l);ke("update",a,!0,{dirtyElements:q,dirtyLeaves:n,editorState:b,normalizedNodes:B,prevEditorState:e,tags:w});a._deferred=[];if(0!==m.length){b=a._updating;a._updating=!0;try{for(e=0;e<m.length;e++)m[e]()}finally{a._updating=b}}b=a._updates;if(0!==b.length&&(b=b.shift())){let [W,wa]=b;le(a,W,wa)}}}function ke(a,b,c,...d){let e=b._updating;b._updating=c;try{let f=Array.from(b._listeners[a]);for(a=0;a<f.length;a++)f[a].apply(null,d)}finally{b._updating=e}}
119
119
  function V(a,b,c){if(!1===a._updating||Z!==a){let f=!1;a.update(()=>{f=V(a,b,c)});return f}let d=Pb(a);for(let f=4;0<=f;f--)for(let g=0;g<d.length;g++){var e=d[g]._commands.get(b);if(void 0!==e&&(e=e[f],void 0!==e)){e=Array.from(e);let h=e.length;for(let k=0;k<h;k++)if(!0===e[k](c,a))return!0}}return!1}
120
- function le(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
121
- function ke(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new me(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=Y;let k=M,m=Z,l=a._updating;Y=g;M=!1;a._updating=!0;Z=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=Wd(a));let n=a._compositionKey;
122
- b();e=le(a,e);Zd(g,a);0!==a._dirtyType&&(e?de(g,a):ee(g,a),le(a),mc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let q=g._selection;if(E(q)){let v=g._nodeMap,w=q.focus.key;void 0!==v.get(q.anchor.key)&&void 0!==v.get(w)||r(19)}else ld(q)&&0===q._nodes.size&&(g._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();he(a);return}finally{Y=f,M=k,Z=m,
123
- a._updating=l,Eb=0}0!==a._dirtyType||ne(g,a)?g._flushSync?(g._flushSync=!1,he(a)):h&&vb(()=>{he(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function A(a,b,c){a._updating?a._updates.push([b,c]):ke(a,b,c)}
124
- function oe(a,b,c){H();var d=a.__key;let e=a.getParent();if(null!==e){var f=ac(a),g=!1;if(E(f)&&b){var h=f.anchor;let k=f.focus;h.key===d&&($d(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&($d(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=e.getWritable().__children;d=h.indexOf(d);-1===d&&r(31);Gb(a);h.splice(d,1);a.getWritable().__parent=null;E(f)&&b&&!g&&Xd(f,e,d,-1);c||ic(e)||e.canBeEmpty()||!e.isEmpty()||oe(e,b);O(e)&&e.isEmpty()&&e.selectEnd()}}
125
- function pe(a){a=L(a);null===a&&r(63);return a}
126
- class qe{static getType(){r(64)}static clone(){r(65)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;Db(this,a)}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=x();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return D(this)?b:E(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?
127
- !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&&r(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(ic(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&r(67);return a}getParents(){let a=[],b=this.getParent();for(;null!==
128
- 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=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(0,b).map(c=>pe(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;let b=
129
- 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=>pe(c))}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();G(this)&&b.unshift(this);G(a)&&c.unshift(a);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 e=b[d];if(c.has(e))return e}return null}is(a){return null==a?!1:this.__key===a.__key}isBefore(a){if(a.isParentOf(this))return!0;
130
- 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=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 e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===
131
- a)break;f=G(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&r(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}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&&r(69);return a}getWritable(){H();
132
- var a=J(),b=I();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=x();null!==f&&(f._cachedNodes=null);if(b.has(c))return Hb(d),d;f=d.constructor.clone(d);f.__parent=e;G(d)&&G(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):D(d)&&D(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Hb(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){r(70)}updateDOM(){r(71)}exportDOM(a){return{element:this.createDOM(a._config,
133
- a)}}exportJSON(){r(72)}static importJSON(){r(18)}remove(a){oe(this,!0,a)}replace(a){H();kc(this,a);let b=this.__key;a=a.getWritable();Fb(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let e=d.indexOf(this.__key),f=a.__key;-1===e&&r(31);d.splice(e,0,f);a.__parent=c.__key;oe(this,!1);Gb(a);d=x();E(d)&&(c=d.anchor,d=d.focus,c.key===b&&sd(c,a),d.key===b&&sd(d,a));Ib()===b&&K(f);return a}insertAfter(a){H();kc(this,a);var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let e=x();var f=
134
- a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(Fb(c),E(e)&&(h=d.__key,g=e.anchor,d=e.focus,g="element"===g.type&&g.key===h&&g.offset===f+1,h="element"===d.type&&d.key===h&&d.offset===f+1));f=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;let k=f.__children;b=k.indexOf(b.__key);-1===b&&r(31);k.splice(b+1,0,d);Gb(c);E(e)&&(Xd(e,f,b+1),c=f.__key,g&&e.anchor.set(c,b+2,"element"),h&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){H();kc(this,a);var b=this.getWritable(),c=a.getWritable();
135
- Fb(c);let d=this.getParentOrThrow().getWritable(),e=c.__key;c.__parent=b.__parent;let f=d.__children;b=f.indexOf(b.__key);-1===b&&r(31);f.splice(b,0,e);Gb(c);c=x();E(c)&&Xd(c,d,b);return a}selectPrevious(a,b){H();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):G(c)?c.select():D(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){H();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():G(c)?c.select(0,0):
136
- D(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class re extends qe{constructor(a){super(a)}decorate(){r(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function C(a){return a instanceof re}
137
- class se extends qe{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 $a[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===
120
+ function me(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){var d=c.shift();if(d){let [e,f]=d,g;void 0!==f&&(d=f.onUpdate,g=f.tag,f.skipTransforms&&(b=!0),d&&a._deferred.push(d),g&&a._updateTags.add(g));e()}}return b}
121
+ function le(a,b,c){let d=a._updateTags;var e,f=e=!1;if(void 0!==c){var g=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms||!1;f=c.discrete||!1}g&&a._deferred.push(g);c=a._editorState;g=a._pendingEditorState;let h=!1;if(null===g||g._readOnly)g=a._pendingEditorState=new ne(new Map((g||c)._nodeMap)),h=!0;g._flushSync=f;f=Y;let k=M,m=Z,l=a._updating;Y=g;M=!1;a._updating=!0;Z=a;try{h&&(a._headless?null!=c._selection&&(g._selection=c._selection.clone()):g._selection=Xd(a));let n=a._compositionKey;
122
+ b();e=me(a,e);$d(g,a);0!==a._dirtyType&&(e?ee(g,a):fe(g,a),me(a),lc(c,g,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&(g._flushSync=!0);let q=g._selection;if(E(q)){let v=g._nodeMap,w=q.focus.key;void 0!==v.get(q.anchor.key)&&void 0!==v.get(w)||r(19)}else md(q)&&0===q._nodes.size&&(g._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();ie(a);return}finally{Y=f,M=k,Z=m,
123
+ a._updating=l,Eb=0}0!==a._dirtyType||oe(g,a)?g._flushSync?(g._flushSync=!1,ie(a)):h&&vb(()=>{ie(a)}):(g._flushSync=!1,h&&(d.clear(),a._deferred=[],a._pendingEditorState=null))}function A(a,b,c){a._updating?a._updates.push([b,c]):le(a,b,c)}
124
+ function pe(a,b,c){H();var d=a.__key;let e=a.getParent();if(null!==e){var f=$b(a),g=!1;if(E(f)&&b){var h=f.anchor;let k=f.focus;h.key===d&&(ae(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(ae(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=e.getWritable().__children;d=h.indexOf(d);-1===d&&r(31);Gb(a);h.splice(d,1);a.getWritable().__parent=null;E(f)&&b&&!g&&Yd(f,e,d,-1);c||cc(e)||e.canBeEmpty()||!e.isEmpty()||pe(e,b);O(e)&&e.isEmpty()&&e.selectEnd()}}
125
+ function qe(a){a=L(a);null===a&&r(63);return a}
126
+ class re{static getType(){r(64)}static clone(){r(65)}constructor(a){this.__type=this.constructor.getType();this.__next=this.__prev=this.__parent=null;Db(this,a)}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=y();if(null==a)return!1;let b=a.getNodes().some(c=>c.__key===this.__key);return D(this)?b:E(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&
127
+ 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&&r(66);return a}getTopLevelElement(){let a=this;for(;null!==a;){let b=a.getParent();if(cc(b))return a;a=b}return null}getTopLevelElementOrThrow(){let a=this.getTopLevelElement();null===a&&r(67);return a}getParents(){let a=
128
+ [],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=this.getParent();if(null===a)return[];a=a.__children;let b=a.indexOf(this.__key);return a.slice(0,b).map(c=>qe(c))}getNextSibling(){var a=this.getParent();if(null===
129
+ 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=>qe(c))}getCommonAncestor(a){let b=this.getParents();var c=a.getParents();G(this)&&b.unshift(this);G(a)&&c.unshift(a);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 e=b[d];if(c.has(e))return e}return null}is(a){return null==
130
+ 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=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;
131
+ for(var e=this;;){var f=e.__key;d.has(f)||(d.add(f),c.push(e));if(e===a)break;f=G(e)?b?e.getFirstChild():e.getLastChild():null;if(null!==f)e=f;else if(f=b?e.getNextSibling():e.getPreviousSibling(),null!==f)e=f;else{e=e.getParentOrThrow();d.has(e.__key)||c.push(e);if(e===a)break;f=e;do null===f&&r(68),e=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(null!==e||d.has(f.__key)||c.push(f));while(null===e)}}b||c.reverse();return c}isDirty(){let a=I()._dirtyLeaves;return null!==a&&
132
+ a.has(this.__key)}getLatest(){let a=L(this.__key);null===a&&r(69);return a}getWritable(){H();var a=J(),b=I();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=y();null!==f&&(f._cachedNodes=null);if(b.has(c))return Hb(d),d;f=d.constructor.clone(d);f.__parent=e;G(d)&&G(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):D(d)&&D(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);
133
+ b.add(c);f.__key=c;Hb(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(){return this.getTextContent().length}createDOM(){r(70)}updateDOM(){r(71)}exportDOM(a){return{element:this.createDOM(a._config,a)}}exportJSON(){r(72)}static importJSON(){r(18)}remove(a){pe(this,!0,a)}replace(a){H();jc(this,a);let b=this.__key;a=a.getWritable();Fb(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let e=d.indexOf(this.__key),f=a.__key;-1===e&&r(31);d.splice(e,0,f);a.__parent=c.__key;
134
+ pe(this,!1);Gb(a);d=y();E(d)&&(c=d.anchor,d=d.focus,c.key===b&&td(c,a),d.key===b&&td(d,a));Ib()===b&&K(f);return a}insertAfter(a){H();jc(this,a);var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let e=y();var f=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(Fb(c),E(e)&&(h=d.__key,g=e.anchor,d=e.focus,g="element"===g.type&&g.key===h&&g.offset===f+1,h="element"===d.type&&d.key===h&&d.offset===f+1));f=this.getParentOrThrow().getWritable();d=c.__key;c.__parent=b.__parent;let k=f.__children;b=
135
+ k.indexOf(b.__key);-1===b&&r(31);k.splice(b+1,0,d);Gb(c);E(e)&&(Yd(e,f,b+1),c=f.__key,g&&e.anchor.set(c,b+2,"element"),h&&e.focus.set(c,b+2,"element"));return a}insertBefore(a){H();jc(this,a);var b=this.getWritable(),c=a.getWritable();Fb(c);let d=this.getParentOrThrow().getWritable(),e=c.__key;c.__parent=b.__parent;let f=d.__children;b=f.indexOf(b.__key);-1===b&&r(31);f.splice(b,0,e);Gb(c);c=y();E(c)&&Yd(c,d,b);return a}selectPrevious(a,b){H();let c=this.getPreviousSibling(),d=this.getParentOrThrow();
136
+ return null===c?d.select(0,0):G(c)?c.select():D(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){H();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():G(c)?c.select(0,0):D(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class se extends re{constructor(a){super(a)}decorate(){r(47)}isIsolated(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}}function C(a){return a instanceof se}
137
+ class te extends re{constructor(a){super(a);this.__children=[];this.__last=this.__first=null;this.__indent=this.__format=this.__size=0;this.__dir=null}getFormat(){return this.getLatest().__format}getFormatType(){let a=this.getFormat();return $a[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===
138
138
  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(){let a=[],b=this.getLatest().__children;for(let d=0;d<b.length;d++){var c=L(b[d]);D(c)?a.push(c):G(c)&&(c=c.getAllTextNodes(),a.push(...c))}return a}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(G(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
139
139
  this.getLastChild();for(;null!==a;){if(G(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],G(a)&&a.getLastDescendant()||a||null;a=b[a];return G(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&&r(45);return a}getLastChild(){let a=this.getLatest().__children,b=a.length;
140
- return 0===b?null:L(a[b-1])}getLastChildOrThrow(){let a=this.getLastChild();null===a&&r(96);return a}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:L(a)}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();G(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=Za[a],0!==(this.getFormat()&a)):!1}select(a,b){H();let c=x();var d=this.getChildrenSize();
141
- void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(E(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return Vd(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return G(a)||D(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return G(a)||D(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
140
+ return 0===b?null:L(a[b-1])}getLastChildOrThrow(){let a=this.getLastChild();null===a&&r(96);return a}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:L(a)}getTextContent(){let a="",b=this.getChildren(),c=b.length;for(let d=0;d<c;d++){let e=b[d];a+=e.getTextContent();G(e)&&d!==c-1&&!e.isInline()&&(a+="\n\n")}return a}getDirection(){return this.getLatest().__dir}hasFormat(a){return""!==a?(a=Za[a],0!==(this.getFormat()&a)):!1}select(a,b){H();let c=y();var d=this.getChildrenSize();
141
+ void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(E(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return Wd(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return G(a)||D(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return G(a)||D(a)?a.select():null!==a?a.selectNext():this.select()}clear(){let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){return this.splice(this.getChildrenSize(),
142
142
  0,a)}setDirection(a){let b=this.getWritable();b.__dir=a;return b}setFormat(a){this.getWritable().__format=""!==a?Za[a]:0;return this}setIndent(a){this.getWritable().__indent=a;return this}splice(a,b,c){let d=this.getWritable();var e=d.__key;let f=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){let m=c[k],l=m.getWritable();m.__key===e&&r(76);Fb(l);l.__parent=e;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Hb(c);(e=this.getChildAtIndex(a+b))&&Hb(e);a===f.length?(f.push(...h),a=[]):a=f.splice(a,
143
- b,...h);if(a.length&&(b=x(),E(b))){let k=new Set(a),m=new Set(h);h=q=>{for(q=q.getNode();q;){const v=q.__key;if(k.has(v)&&!m.has(v))return!0;q=q.getParent()}return!1};let {anchor:l,focus:n}=b;h(l)&&$d(l,l.getNode(),this,c,e);h(n)&&$d(n,n.getNode(),this,c,e);h=a.length;for(b=0;b<h;b++)c=L(a[b]),null!=c&&(c.getWritable().__parent=null);0!==f.length||this.canBeEmpty()||ic(this)||this.remove()}return d}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),
144
- 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}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function G(a){return a instanceof se}
145
- class te extends se{static getType(){return"root"}static clone(){return new te}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){r(51)}getTextContent(){let a=this.__cachedText;return!M&&0!==I()._dirtyType||null===a?super.getTextContent():a}remove(){r(52)}replace(){r(53)}insertBefore(){r(54)}insertAfter(){r(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];G(c)||C(c)||r(56)}return super.append(...a)}static importJSON(a){let b=Lb();b.setFormat(a.format);
146
- 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}}collapseAtStart(){return!0}}function O(a){return a instanceof te}function ne(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 ue(){return new me(new Map([["root",new te]]))}
147
- function ve(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&r(58);let c=b.children;if(G(a)){Array.isArray(c)||r(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=ve(a[d]);c.push(e)}}return b}
148
- class me{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 ge(this,a)}clone(a){a=new me(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return ge(this,()=>({root:ve(Lb())}))}}
149
- class we extends qe{static getType(){return"linebreak"}static clone(a){return new we(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:xe,priority:0}}}}static importJSON(){return Fd()}exportJSON(){return{type:"linebreak",version:1}}}function xe(){return{node:Fd()}}function Fd(){return jc(new we)}
150
- function Cb(a){return a instanceof we}function ye(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function ze(a,b){return b&1?"strong":b&2?"em":"span"}
151
- function Ae(a,b,c,d,e){a=d.classList;d=Vb(e,"base");void 0!==d&&a.add(...d);d=Vb(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Xa)h=Xa[k],d=Vb(e,k),void 0!==d&&(c&h?!f||"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))}
152
- function Be(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ta:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Oa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}
153
- class Ce extends qe{static getType(){return"text"}static clone(a){return new Ce(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 bb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Ib()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
154
- (this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Xa[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Ab(c,a,b)}createDOM(a){var b=this.__format,c=ye(this,b);let d=ze(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Be(this.__text,c,this);
155
- a=a.theme.text;void 0!==a&&Ae(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ye(this,e);let h=ye(this,f);var k=ze(this,e);let m=ze(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&r(48),a=g=document.createElement(m),Be(d,a,this),c=c.theme.text,void 0!==c&&Ae(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&r(49));Be(d,k,this);c=c.theme.text;
156
- void 0!==c&&e!==f&&Ae(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:De,priority:0}),b:()=>({conversion:Ee,priority:0}),code:()=>({conversion:Fe,priority:0}),em:()=>({conversion:Fe,priority:0}),i:()=>({conversion:Fe,priority:0}),span:()=>({conversion:Ke,priority:0}),strong:()=>({conversion:Fe,priority:0}),u:()=>({conversion:Fe,priority:0})}}static importJSON(a){let b=N(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);
143
+ b,...h);if(a.length&&(b=y(),E(b))){let k=new Set(a),m=new Set(h);h=q=>{for(q=q.getNode();q;){const v=q.__key;if(k.has(v)&&!m.has(v))return!0;q=q.getParent()}return!1};let {anchor:l,focus:n}=b;h(l)&&ae(l,l.getNode(),this,c,e);h(n)&&ae(n,n.getNode(),this,c,e);h=a.length;for(b=0;b<h;b++)c=L(a[b]),null!=c&&(c.getWritable().__parent=null);0!==f.length||this.canBeEmpty()||cc(this)||this.remove()}return d}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),
144
+ 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}isShadowRoot(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function G(a){return a instanceof te}
145
+ class ue extends te{static getType(){return"root"}static clone(){return new ue}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){r(51)}getTextContent(){let a=this.__cachedText;return!M&&0!==I()._dirtyType||null===a?super.getTextContent():a}remove(){r(52)}replace(){r(53)}insertBefore(){r(54)}insertAfter(){r(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];G(c)||C(c)||r(56)}return super.append(...a)}static importJSON(a){let b=Lb();b.setFormat(a.format);
146
+ 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}}collapseAtStart(){return!0}}function O(a){return a instanceof ue}function oe(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 ve(){return new ne(new Map([["root",new ue]]))}
147
+ function we(a){let b=a.exportJSON();b.type!==a.constructor.getType()&&r(58);let c=b.children;if(G(a)){Array.isArray(c)||r(59);a=a.getChildren();for(let d=0;d<a.length;d++){let e=we(a[d]);c.push(e)}}return b}
148
+ class ne{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 he(this,a)}clone(a){a=new ne(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return he(this,()=>({root:we(Lb())}))}}
149
+ class xe extends re{static getType(){return"linebreak"}static clone(a){return new xe(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:ye,priority:0}}}}static importJSON(){return Gd()}exportJSON(){return{type:"linebreak",version:1}}}function ye(){return{node:Gd()}}function Gd(){return dc(new xe)}
150
+ function Cb(a){return a instanceof xe}function ze(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function Ae(a,b){return b&1?"strong":b&2?"em":"span"}
151
+ function Be(a,b,c,d,e){a=d.classList;d=Ub(e,"base");void 0!==d&&a.add(...d);d=Ub(e,"underlineStrikethrough");let f=!1,g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(f=!0,g||a.add(...d)):g&&a.remove(...d));for(let k in Xa)h=Xa[k],d=Ub(e,k),void 0!==d&&(c&h?!f||"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))}
152
+ function Ce(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?Ta:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||Oa){c=b.length;let e=a.length,f=0,g=0;for(;f<c&&f<e&&b[f]===a[f];)f++;for(;g+f<c&&g+f<e&&b[c-g-1]===a[e-g-1];)g++;a=[f,c-f-g,a.slice(f,e-g)];let [h,k,m]=a;0!==k&&d.deleteData(h,k);d.insertData(h,m)}else d.nodeValue=a}
153
+ class De extends re{static getType(){return"text"}static clone(a){return new De(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 bb[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===Ib()}isSegmented(){return 2===this.getLatest().__mode}isDirectionless(){return 0!==
154
+ (this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=Xa[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(){return this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Ab(c,a,b)}createDOM(a){var b=this.__format,c=ze(this,b);let d=Ae(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;Ce(this.__text,c,this);
155
+ a=a.theme.text;void 0!==a&&Be(d,0,b,c,a);b=this.__style;""!==b&&(e.style.cssText=b);return e}updateDOM(a,b,c){let d=this.__text;var e=a.__format,f=this.__format,g=ze(this,e);let h=ze(this,f);var k=Ae(this,e);let m=Ae(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&r(48),a=g=document.createElement(m),Ce(d,a,this),c=c.theme.text,void 0!==c&&Be(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&r(49));Ce(d,k,this);c=c.theme.text;
156
+ void 0!==c&&e!==f&&Be(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:Ee,priority:0}),b:()=>({conversion:Fe,priority:0}),code:()=>({conversion:Ge,priority:0}),em:()=>({conversion:Ge,priority:0}),i:()=>({conversion:Ge,priority:0}),span:()=>({conversion:Le,priority:0}),strong:()=>({conversion:Ge,priority:0}),u:()=>({conversion:Ge,priority:0})}}static importJSON(a){let b=N(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);
157
157
  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){let b=this.getWritable();b.__format="string"===typeof a?Xa[a]:a;return b}setDetail(a){let b=this.getWritable();b.__detail="string"===typeof a?Ya[a]:a;return b}setStyle(a){let b=this.getWritable();b.__style=a;return b}toggleFormat(a){a=Xa[a];return this.setFormat(this.getFormat()^
158
- a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ab[a];let b=this.getWritable();b.__mode=a;return b}setTextContent(a){let b=this.getWritable();b.__text=a;return b}select(a,b){H();let c=x();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(E(c))d=Ib(),d!==c.anchor.key&&d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);
159
- else return Vd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=x();d&&E(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){H();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Ib(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);
160
- f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=c.__key;let l=b.getFormat(),n=b.getStyle(),q=b.__detail;g=!1;b.isSegmented()?(h=N(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=q,g=!0):(h=b.getWritable(),h.__text=m);b=x();h=[h];m=m.length;for(let y=1;y<f;y++){var v=a[y],w=v.length;v=N(v).getWritable();v.__format=l;v.__style=n;v.__detail=q;let z=v.__key;w=m+w;if(E(b)){let B=b.anchor,F=b.focus;B.key===d&&"text"===B.type&&B.offset>m&&B.offset<=w&&(B.key=z,
161
- B.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)}e===d&&K(z);m=w;v.__parent=k;h.push(v)}Gb(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(y=>y.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);E(b)&&Xd(b,c,d,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||r(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;Ib()===d&&K(c);let g=x();if(E(g)){let h=g.anchor,
162
- k=g.focus;null!==h&&h.key===d&&(ae(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(ae(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
163
- function Ke(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!D(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
164
- function Ee(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{D(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function De(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:N(a)}}let Le={code:"code",em:"italic",i:"italic",strong:"bold",u:"underline"};function Fe(a){let b=Le[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{D(c)&&c.toggleFormat(b);return c},node:null}}
165
- function N(a=""){return jc(new Ce(a))}function D(a){return a instanceof Ce}
166
- class Me extends se{static getType(){return"paragraph"}static clone(a){return new Me(a.__key)}createDOM(a){let b=document.createElement("p");a=Vb(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Ne,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
167
- 0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=ud();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=ud(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||D(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),
168
- !0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Ne(){return{node:ud()}}function ud(){return jc(new Me)}
169
- function ie(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=ue();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="",e.set("root",c))}
170
- function Oe(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 e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
171
- class Pe{constructor(a,b,c,d,e,f){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,editable:new Set,mutation:new Map,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=
158
+ a)}toggleDirectionless(){let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){let a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ab[a];if(this.__mode===a)return this;let b=this.getWritable();b.__mode=a;return b}setTextContent(a){if(this.__text===a)return this;let b=this.getWritable();b.__text=a;return b}select(a,b){H();let c=y();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(E(c))d=Ib(),d!==c.anchor.key&&
159
+ d!==c.focus.key||K(e),c.setTextNodeRange(this,a,this,b);else return Wd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=y();d&&E(k)&&(a+=g,k.setTextNodeRange(e,a,e,a));b=f.slice(0,h)+c+f.slice(h+b);e.__text=b;return e}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){H();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,e=Ib(),f=new Set(a);a=[];var g=c.length,h="";for(var k=0;k<g;k++)""!==
160
+ h&&f.has(k)&&(a.push(h),h=""),h+=c[k];""!==h&&a.push(h);f=a.length;if(0===f)return[];if(a[0]===c)return[b];var m=a[0];c=b.getParentOrThrow();k=c.__key;let l=b.getFormat(),n=b.getStyle(),q=b.__detail;g=!1;b.isSegmented()?(h=N(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=q,g=!0):(h=b.getWritable(),h.__text=m);b=y();h=[h];m=m.length;for(let x=1;x<f;x++){var v=a[x],w=v.length;v=N(v).getWritable();v.__format=l;v.__style=n;v.__detail=q;let z=v.__key;w=m+w;if(E(b)){let B=b.anchor,F=b.focus;B.key===
161
+ d&&"text"===B.type&&B.offset>m&&B.offset<=w&&(B.key=z,B.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)}e===d&&K(z);m=w;v.__parent=k;h.push(v)}Gb(this);e=c.getWritable().__children;d=e.indexOf(d);a=h.map(x=>x.__key);g?(e.splice(d,0,...a),this.remove()):e.splice(d,1,...a);E(b)&&Yd(b,c,d,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();b||a===this.getNextSibling()||r(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;
162
+ Ib()===d&&K(c);let g=y();if(E(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(be(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(be(k,b,c,a,f),g.dirty=!0)}c=a.__text;this.setTextContent(b?c+e:e+c);b=this.getWritable();a.remove();return b}isTextEntity(){return!1}}
163
+ function Le(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle,e="underline"===a.style.textDecoration,f=a.style.verticalAlign;return{forChild:g=>{if(!D(g))return g;b&&g.toggleFormat("bold");c&&g.toggleFormat("strikethrough");d&&g.toggleFormat("italic");e&&g.toggleFormat("underline");"sub"===f&&g.toggleFormat("subscript");"super"===f&&g.toggleFormat("superscript");return g},node:null}}
164
+ function Fe(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{D(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Ee(a,b,c){a=a.textContent||"";return!c&&/\n/.test(a)&&(a=a.replace(/\r?\n/gm," "),0===a.trim().length)?{node:null}:{node:N(a)}}let Me={code:"code",em:"italic",i:"italic",strong:"bold",u:"underline"};function Ge(a){let b=Me[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{D(c)&&c.toggleFormat(b);return c},node:null}}
165
+ function N(a=""){return dc(new De(a))}function D(a){return a instanceof De}
166
+ class Ne extends te{static getType(){return"paragraph"}static clone(a){return new Ne(a.__key)}createDOM(a){let b=document.createElement("p");a=Ub(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static importDOM(){return{p:()=>({conversion:Oe,priority:0})}}exportDOM(a){({element:a}=super.exportDOM(a));a&&this.isEmpty()&&a.append(document.createElement("br"));if(a){var b=this.getFormatType();a.style.textAlign=b;if(b=this.getDirection())a.dir=b;b=this.getIndent();
167
+ 0<b&&(a.style.textIndent=`${20*b}px`)}return{element:a}}static importJSON(a){let b=vd();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=vd(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||D(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),
168
+ !0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Oe(){return{node:vd()}}function vd(){return dc(new Ne)}
169
+ function je(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=ve();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="",e.set("root",c))}
170
+ function Pe(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 e=d();null!==e&&Object.keys(e).forEach(f=>{let g=b.get(f);void 0===g&&(g=[],b.set(f,g));g.push(e[f])})}});return b}
171
+ class Qe{constructor(a,b,c,d,e,f){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,editable:new Set,mutation:new Map,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=
172
172
  new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=Qb();this._onError=e;this._htmlConversions=f;this._editable=!0;this._headless=!1;this._window=null}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerEditableListener(a){let b=this._listeners.editable;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;
173
173
  b.add(a);return()=>{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&&r(35);let d=this._commands;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);let e=d.get(a);void 0===e&&r(36);let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
174
174
  b){void 0===this._nodes.get(a.getType())&&r(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&&r(37);let d=c.transforms;d.add(b);Mb(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 V(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
175
- this._rootElement;if(a!==b){let e=Vb(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;ie(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==ad&&(ad--,0===ad&&b.ownerDocument.removeEventListener("selectionchange",od));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Pb(c);d=d[d.length-1]._key;nd.get(d)===c&&nd.delete(d)}else nd.delete(c._key);b.__lexicalEditor=null}c=md(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
176
- []}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,sb(this),this._updateTags.add("history-merge"),he(this),this._config.disableEvents||qd(a,this),null!=e&&a.classList.add(...e)):this._window=null;je("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
177
- b){a.isEmpty()&&r(38);nb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),he(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);he(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ue(),d=Y,e=M,f=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
178
- new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;M=!1;Z=this;try{fe(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,M=e,Z=f}return c}update(a,b){A(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),A(this,()=>{let d=x(),e=Lb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
179
- a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=t?window.getSelection():null;null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,je("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Qe extends se{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
180
- function Dd(a){return a instanceof Qe}class Re extends se{}function Bd(a){return a instanceof Re}class Se extends se{}function Cd(a){return a instanceof Se}exports.$addUpdateTag=function(a){H();I()._updateTags.add(a)};exports.$applyNodeReplacement=jc;exports.$copyNode=function(a){a=a.constructor.clone(a);Db(a,null);return a};exports.$createLineBreakNode=Fd;exports.$createNodeSelection=Id;exports.$createParagraphNode=ud;
181
- exports.$createRangeSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new xd(a,b,0)};exports.$createTextNode=N;exports.$getDecoratorNode=Yb;exports.$getNearestNodeFromDOMNode=ib;exports.$getNearestRootOrShadowRoot=cc;exports.$getNodeByKey=L;exports.$getPreviousSelection=Sb;exports.$getRoot=Lb;exports.$getSelection=x;exports.$getTextContent=function(){let a=x();return null===a?"":a.getTextContent()};exports.$hasAncestor=bc;
182
- exports.$insertNodes=function(a,b){let c=x();null===c&&(c=Lb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=C;exports.$isElementNode=G;exports.$isInlineElementOrDecoratorNode=function(a){return G(a)&&a.isInline()||C(a)&&a.isInline()};exports.$isLeafNode=Bb;exports.$isLineBreakNode=Cb;exports.$isNodeSelection=ld;exports.$isParagraphNode=function(a){return a instanceof Me};exports.$isRangeSelection=E;exports.$isRootNode=O;exports.$isRootOrShadowRoot=ic;exports.$isTextNode=D;
183
- exports.$nodesOfType=function(a){var b=J();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=qc;exports.$parseSerializedNode=function(a){return fe(a,I()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=lb;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
175
+ this._rootElement;if(a!==b){let e=Ub(this._config.theme,"root");var c=this._pendingEditorState||this._editorState;this._rootElement=a;je(this,b,a,c);if(null!==b){if(!this._config.disableEvents){0!==ad&&(ad--,0===ad&&b.ownerDocument.removeEventListener("selectionchange",pd));c=b.__lexicalEditor;if(null!==c&&void 0!==c){if(null!==c._parentEditor){var d=Pb(c);d=d[d.length-1]._key;od.get(d)===c&&od.delete(d)}else od.delete(c._key);b.__lexicalEditor=null}c=nd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=
176
+ []}null!=e&&b.classList.remove(...e)}null!==a?(c=(c=a.ownerDocument)&&c.defaultView||null,d=a.style,d.userSelect="text",d.whiteSpace="pre-wrap",d.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._window=c,this._dirtyType=2,ob(this),this._updateTags.add("history-merge"),ie(this),this._config.disableEvents||rd(a,this),null!=e&&a.classList.add(...e)):this._window=null;ke("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,
177
+ b){a.isEmpty()&&r(38);nb(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),ie(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);ie(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=ve(),d=Y,e=M,f=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=
178
+ new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;M=!1;Z=this;try{ge(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,M=e,Z=f}return c}update(a,b){A(this,a,b)}focus(a,b={}){let c=this._rootElement;null!==c&&(c.setAttribute("autocapitalize","off"),A(this,()=>{let d=y(),e=Lb();null!==d?d.dirty=!0:0!==e.getChildrenSize()&&("rootStart"===b.defaultSelection?e.selectStart():e.selectEnd())},{onUpdate:()=>{c.removeAttribute("autocapitalize");
179
+ a&&a()}}),null===this._pendingEditorState&&c.removeAttribute("autocapitalize"))}blur(){var a=this._rootElement;null!==a&&a.blur();a=t?window.getSelection():null;null!==a&&a.removeAllRanges()}isEditable(){return this._editable}setEditable(a){this._editable!==a&&(this._editable=a,ke("editable",this,!0,a))}toJSON(){return{editorState:this._editorState.toJSON()}}}class Re extends te{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}
180
+ function Ed(a){return a instanceof Re}class Se extends te{}function Cd(a){return a instanceof Se}class Te extends te{}function Dd(a){return a instanceof Te}exports.$addUpdateTag=function(a){H();I()._updateTags.add(a)};exports.$applyNodeReplacement=dc;exports.$copyNode=function(a){a=a.constructor.clone(a);Db(a,null);return a};exports.$createLineBreakNode=Gd;exports.$createNodeSelection=Jd;exports.$createParagraphNode=vd;
181
+ exports.$createRangeSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new yd(a,b,0)};exports.$createTextNode=N;exports.$getDecoratorNode=Xb;exports.$getNearestNodeFromDOMNode=ib;exports.$getNearestRootOrShadowRoot=bc;exports.$getNodeByKey=L;exports.$getPreviousSelection=Sb;exports.$getRoot=Lb;exports.$getSelection=y;exports.$getTextContent=function(){let a=y();return null===a?"":a.getTextContent()};exports.$hasAncestor=ac;
182
+ exports.$insertNodes=function(a,b){let c=y();null===c&&(c=Lb().selectEnd());return c.insertNodes(a,b)};exports.$isDecoratorNode=C;exports.$isElementNode=G;exports.$isInlineElementOrDecoratorNode=function(a){return G(a)&&a.isInline()||C(a)&&a.isInline()};exports.$isLeafNode=Bb;exports.$isLineBreakNode=Cb;exports.$isNodeSelection=md;exports.$isParagraphNode=function(a){return a instanceof Ne};exports.$isRangeSelection=E;exports.$isRootNode=O;exports.$isRootOrShadowRoot=cc;exports.$isTextNode=D;
183
+ exports.$nodesOfType=function(a){var b=J();let c=b._readOnly,d=a.getType();b=b._nodeMap;let e=[];for(let [,f]of b)f instanceof a&&f.__type===d&&(c||f.isAttached())&&e.push(f);return e};exports.$normalizeSelection__EXPERIMENTAL=pc;exports.$parseSerializedNode=function(a){return ge(a,I()._nodes)};exports.$setCompositionKey=K;exports.$setSelection=lb;exports.BLUR_COMMAND=La;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};
184
184
  exports.CLICK_COMMAND=ca;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=la;
185
- exports.DEPRECATED_$createGridSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new yd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Dd;exports.DEPRECATED_$isGridNode=Bd;exports.DEPRECATED_$isGridRowNode=Cd;exports.DEPRECATED_$isGridSelection=zd;exports.DEPRECATED_GridCellNode=Qe;exports.DEPRECATED_GridNode=Re;exports.DEPRECATED_GridRowNode=Se;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
186
- exports.DecoratorNode=re;exports.ElementNode=se;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=p;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=va;exports.KEY_ARROW_LEFT_COMMAND=sa;exports.KEY_ARROW_RIGHT_COMMAND=qa;exports.KEY_ARROW_UP_COMMAND=ua;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Ca;exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ba;
187
- exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=we;exports.MOVE_TO_END=ra;exports.MOVE_TO_START=ta;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Me;exports.REDO_COMMAND=pa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=te;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=Ce;exports.UNDO_COMMAND=oa;exports.VERSION="0.6.3";exports.createCommand=function(){return{}};
188
- exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=ue(),h=b.namespace||(null!==e?e._config.namespace:Qb()),k=b.editorState,m=[te,Ce,we,Me,...(b.nodes||[])],l=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let q=m[c];var n=null;"function"!==typeof q&&(n=q,q=n.replace,n=n.with);let v=q.getType();a.set(v,{klass:q,replace:n,transforms:new Set})}d=new Pe(g,
189
- e,a,{disableEvents:f,namespace:h,theme:d},l?l:console.error,Oe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
185
+ exports.DEPRECATED_$createGridSelection=function(){let a=new X("root",0,"element"),b=new X("root",0,"element");return new zd("root",a,b)};exports.DEPRECATED_$isGridCellNode=Ed;exports.DEPRECATED_$isGridNode=Cd;exports.DEPRECATED_$isGridRowNode=Dd;exports.DEPRECATED_$isGridSelection=Ad;exports.DEPRECATED_GridCellNode=Re;exports.DEPRECATED_GridNode=Se;exports.DEPRECATED_GridRowNode=Te;exports.DRAGEND_COMMAND=Ha;exports.DRAGOVER_COMMAND=Ga;exports.DRAGSTART_COMMAND=Fa;exports.DROP_COMMAND=Ea;
186
+ exports.DecoratorNode=se;exports.ElementNode=te;exports.FOCUS_COMMAND=Ka;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=p;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=ea;exports.INSERT_PARAGRAPH_COMMAND=ha;exports.KEY_ARROW_DOWN_COMMAND=va;exports.KEY_ARROW_LEFT_COMMAND=sa;exports.KEY_ARROW_RIGHT_COMMAND=qa;exports.KEY_ARROW_UP_COMMAND=ua;exports.KEY_BACKSPACE_COMMAND=Aa;exports.KEY_DELETE_COMMAND=Ca;exports.KEY_ENTER_COMMAND=ya;exports.KEY_ESCAPE_COMMAND=Ba;
187
+ exports.KEY_MODIFIER_COMMAND=Ma;exports.KEY_SPACE_COMMAND=za;exports.KEY_TAB_COMMAND=Da;exports.LineBreakNode=xe;exports.MOVE_TO_END=ra;exports.MOVE_TO_START=ta;exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ja;exports.ParagraphNode=Ne;exports.REDO_COMMAND=pa;exports.REMOVE_TEXT_COMMAND=ka;exports.RootNode=ue;exports.SELECTION_CHANGE_COMMAND=ba;exports.TextNode=De;exports.UNDO_COMMAND=oa;exports.VERSION="0.6.4";exports.createCommand=function(){return{}};
188
+ exports.createEditor=function(a){var b=a||{},c=Z,d=b.theme||{};let e=void 0===a?c:b.parentEditor||null,f=b.disableEvents||!1,g=ve(),h=b.namespace||(null!==e?e._config.namespace:Qb()),k=b.editorState,m=[ue,De,xe,Ne,...(b.nodes||[])],l=b.onError;b=void 0!==b.editable?b.editable:!0;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let q=m[c];var n=null;"function"!==typeof q&&(n=q,q=n.replace,n=n.with);let v=q.getType();a.set(v,{klass:q,replace:n,transforms:new Set})}d=new Qe(g,
189
+ e,a,{disableEvents:f,namespace:h,theme:d},l?l:console.error,Pe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=2);return d}
package/LexicalNode.d.ts CHANGED
@@ -42,6 +42,10 @@ export declare class LexicalNode {
42
42
  __key: string;
43
43
  /** @internal */
44
44
  __parent: null | NodeKey;
45
+ /** @internal */
46
+ __prev: null | NodeKey;
47
+ /** @internal */
48
+ __next: null | NodeKey;
45
49
  static getType(): string;
46
50
  static clone(_data: unknown): LexicalNode;
47
51
  constructor(key?: NodeKey);
@@ -15,7 +15,6 @@ export declare type TextPointType = {
15
15
  _selection: RangeSelection | GridSelection;
16
16
  getNode: () => TextNode;
17
17
  is: (point: PointType) => boolean;
18
- isAtNodeEnd: () => boolean;
19
18
  isBefore: (point: PointType) => boolean;
20
19
  key: NodeKey;
21
20
  offset: number;
@@ -26,7 +25,6 @@ export declare type ElementPointType = {
26
25
  _selection: RangeSelection | GridSelection;
27
26
  getNode: () => ElementNode;
28
27
  is: (point: PointType) => boolean;
29
- isAtNodeEnd: () => boolean;
30
28
  isBefore: (point: PointType) => boolean;
31
29
  key: NodeKey;
32
30
  offset: number;
package/LexicalUtils.d.ts CHANGED
@@ -49,9 +49,10 @@ export declare function getTextNodeOffset(node: TextNode, moveSelectionToEnd: bo
49
49
  export declare function doesContainGrapheme(str: string): boolean;
50
50
  export declare function getEditorsToPropagate(editor: LexicalEditor): Array<LexicalEditor>;
51
51
  export declare function createUID(): string;
52
+ export declare function getAnchorTextFromDOM(anchorNode: Node): null | string;
52
53
  export declare function $updateSelectedTextFromDOM(isCompositionEnd: boolean, data?: string): void;
53
54
  export declare function $updateTextNodeFromDOMContent(textNode: TextNode, textContent: string, anchorOffset: null | number, focusOffset: null | number, compositionEnd: boolean): void;
54
- export declare function $shouldPreventDefaultAndInsertText(selection: RangeSelection, text: string): boolean;
55
+ export declare function $shouldInsertTextAfterOrBeforeTextNode(selection: RangeSelection, node: TextNode): boolean;
55
56
  export declare function isTab(keyCode: number, altKey: boolean, ctrlKey: boolean, metaKey: boolean): boolean;
56
57
  export declare function isBold(keyCode: number, altKey: boolean, metaKey: boolean, ctrlKey: boolean): boolean;
57
58
  export declare function isItalic(keyCode: number, altKey: boolean, metaKey: boolean, ctrlKey: boolean): boolean;
@@ -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.6.3";
8
+ export declare const VERSION = "0.6.4";
@@ -22,6 +22,12 @@ export declare class ElementNode extends LexicalNode {
22
22
  /** @internal */
23
23
  __children: Array<NodeKey>;
24
24
  /** @internal */
25
+ __first: null | NodeKey;
26
+ /** @internal */
27
+ __last: null | NodeKey;
28
+ /** @internal */
29
+ __size: number;
30
+ /** @internal */
25
31
  __format: number;
26
32
  /** @internal */
27
33
  __indent: number;
@@ -21,7 +21,7 @@ export declare class LineBreakNode extends LexicalNode {
21
21
  updateDOM(): false;
22
22
  static importDOM(): DOMConversionMap | null;
23
23
  static importJSON(serializedLineBreakNode: SerializedLineBreakNode): LineBreakNode;
24
- exportJSON(): SerializedLexicalNode;
24
+ exportJSON(): SerializedLineBreakNode;
25
25
  }
26
26
  export declare function $createLineBreakNode(): LineBreakNode;
27
27
  export declare function $isLineBreakNode(node: LexicalNode | null | undefined): node is LineBreakNode;
@@ -23,7 +23,7 @@ export declare class ParagraphNode extends ElementNode {
23
23
  static importDOM(): DOMConversionMap | null;
24
24
  exportDOM(editor: LexicalEditor): DOMExportOutput;
25
25
  static importJSON(serializedNode: SerializedParagraphNode): ParagraphNode;
26
- exportJSON(): SerializedElementNode;
26
+ exportJSON(): SerializedParagraphNode;
27
27
  insertNewAfter(): ParagraphNode;
28
28
  collapseAtStart(): boolean;
29
29
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.6.3",
12
+ "version": "0.6.4",
13
13
  "main": "Lexical.js",
14
14
  "repository": {
15
15
  "type": "git",