lexical 0.3.0 → 0.3.3

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.d.ts CHANGED
@@ -6,7 +6,6 @@
6
6
  *
7
7
  */
8
8
 
9
- import {Spread} from 'libdefs/globals';
10
9
  import {Class} from 'utility-types';
11
10
 
12
11
  /**
@@ -232,6 +231,7 @@ export type EditorThemeClasses = {
232
231
  h3?: EditorThemeClassName;
233
232
  h4?: EditorThemeClassName;
234
233
  h5?: EditorThemeClassName;
234
+ h6?: EditorThemeClassName;
235
235
  };
236
236
  // Handle other generic values
237
237
  [key: string]:
@@ -249,6 +249,7 @@ export type EditorThemeClasses = {
249
249
  };
250
250
 
251
251
  export type EditorConfig = {
252
+ namespace: string;
252
253
  theme: EditorThemeClasses;
253
254
  disableEvents?: boolean;
254
255
  };
@@ -262,6 +263,7 @@ export const COMMAND_PRIORITY_CRITICAL = 4;
262
263
  export type IntentionallyMarkedAsDirtyElement = boolean;
263
264
  export function createEditor(editorConfig?: {
264
265
  editorState?: EditorState;
266
+ namespace: string;
265
267
  theme?: EditorThemeClasses;
266
268
  parentEditor?: LexicalEditor;
267
269
  nodes?: ReadonlyArray<Class<LexicalNode>>;
@@ -779,7 +781,7 @@ export function $getDecoratorNode(
779
781
  focus: Point,
780
782
  isBackward: boolean,
781
783
  ): null | LexicalNode;
782
-
784
+ export function generateRandomKey(): string;
783
785
  export type EventHandler = (event: Event, editor: LexicalEditor) => void;
784
786
 
785
787
  /**
@@ -790,6 +792,8 @@ export declare var VERSION: string;
790
792
  /**
791
793
  * Serialization/Deserialization
792
794
  * */
795
+ export type Spread<T1, T2> = {[K in Exclude<keyof T1, keyof T2>]: T1[K]} & T2;
796
+
793
797
  interface InternalSerializedNode {
794
798
  children?: Array<InternalSerializedNode>;
795
799
  type: string;
package/Lexical.dev.js CHANGED
@@ -354,7 +354,7 @@ function initMutationObserver(editor) {
354
354
  * LICENSE file in the root directory of this source tree.
355
355
  *
356
356
  */
357
- let keyCounter = 0;
357
+ let keyCounter = 1;
358
358
  function generateRandomKey() {
359
359
  return '' + keyCounter++;
360
360
  }
@@ -735,6 +735,9 @@ function getEditorsToPropagate(editor) {
735
735
 
736
736
  return editorsToPropagate;
737
737
  }
738
+ function createUID() {
739
+ return Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
740
+ }
738
741
  function $updateSelectedTextFromDOM(editor, isCompositionEnd, data) {
739
742
  // Update the text content with the latest composition text
740
743
  const domSelection = getDOMSelection();
@@ -950,6 +953,24 @@ function isRedo(keyCode, shiftKey, metaKey, ctrlKey) {
950
953
 
951
954
  return keyCode === 89 && ctrlKey || keyCode === 90 && ctrlKey && shiftKey;
952
955
  }
956
+ function isCopy(keyCode, shiftKey, metaKey, ctrlKey) {
957
+ if (shiftKey) {
958
+ return false;
959
+ }
960
+
961
+ if (keyCode === 67) {
962
+ return IS_APPLE ? metaKey : ctrlKey;
963
+ }
964
+ }
965
+ function isCut(keyCode, shiftKey, metaKey, ctrlKey) {
966
+ if (shiftKey) {
967
+ return false;
968
+ }
969
+
970
+ if (keyCode === 88) {
971
+ return IS_APPLE ? metaKey : ctrlKey;
972
+ }
973
+ }
953
974
 
954
975
  function isArrowLeft(keyCode) {
955
976
  return keyCode === 37;
@@ -1152,11 +1173,12 @@ function scrollIntoViewIfNeeded(editor, anchor, rootElement, tags) {
1152
1173
  } else if (rect.top < 0) {
1153
1174
  element.scrollIntoView();
1154
1175
  } else {
1155
- const rootRect = rootElement.getBoundingClientRect();
1176
+ const rootRect = rootElement.getBoundingClientRect(); // Rects can returning decimal numbers that differ due to rounding
1177
+ // differences. So let's normalize the values.
1156
1178
 
1157
- if (rect.bottom > rootRect.bottom) {
1179
+ if (Math.floor(rect.bottom) > Math.floor(rootRect.bottom)) {
1158
1180
  element.scrollIntoView(false);
1159
- } else if (rect.top < rootRect.top) {
1181
+ } else if (Math.floor(rect.top) < Math.floor(rootRect.top)) {
1160
1182
  element.scrollIntoView();
1161
1183
  }
1162
1184
  }
@@ -2119,18 +2141,24 @@ function onSelectionChange(domSelection, editor, isActive) {
2119
2141
  function onClick(event, editor) {
2120
2142
  updateEditor(editor, () => {
2121
2143
  const selection = $getSelection();
2144
+ const domSelection = getDOMSelection();
2145
+ const lastSelection = $getPreviousSelection();
2122
2146
 
2123
2147
  if ($isRangeSelection(selection)) {
2124
2148
  const anchor = selection.anchor;
2125
2149
  const anchorNode = anchor.getNode();
2126
2150
 
2127
- if (anchor.type === 'element' && anchor.offset === 0 && selection.isCollapsed() && !$isRootNode(anchorNode) && $getRoot().getChildrenSize() === 1 && anchorNode.getTopLevelElementOrThrow().isEmpty()) {
2128
- const lastSelection = $getPreviousSelection();
2151
+ if (anchor.type === 'element' && anchor.offset === 0 && selection.isCollapsed() && !$isRootNode(anchorNode) && $getRoot().getChildrenSize() === 1 && anchorNode.getTopLevelElementOrThrow().isEmpty() && lastSelection !== null && selection.is(lastSelection)) {
2152
+ domSelection.removeAllRanges();
2153
+ selection.dirty = true;
2154
+ }
2155
+ } else if ($isNodeSelection(selection) && domSelection.isCollapsed) {
2156
+ const domAnchor = domSelection.anchorNode; // If the user is attempting to click selection back onto text, then
2157
+ // we should attempt create a range selection.
2129
2158
 
2130
- if (lastSelection !== null && selection.is(lastSelection)) {
2131
- getDOMSelection().removeAllRanges();
2132
- selection.dirty = true;
2133
- }
2159
+ if (domAnchor !== null && domAnchor.nodeType === DOM_TEXT_TYPE) {
2160
+ const newSelection = internalCreateRangeSelection(lastSelection, domSelection, editor);
2161
+ $setSelection(newSelection);
2134
2162
  }
2135
2163
  }
2136
2164
 
@@ -2411,9 +2439,8 @@ function onInput(event, editor) {
2411
2439
  updateEditor(editor, () => {
2412
2440
  const selection = $getSelection();
2413
2441
  const data = event.data;
2414
- const possibleTextReplacement = event.inputType === 'insertText' && data != null && data.length > 1 && !doesContainGrapheme(data);
2415
2442
 
2416
- if (data != null && $isRangeSelection(selection) && (possibleTextReplacement || $shouldPreventDefaultAndInsertText(selection, data))) {
2443
+ if (data != null && $isRangeSelection(selection) && $shouldPreventDefaultAndInsertText(selection, data)) {
2417
2444
  // Given we're over-riding the default behavior, we will need
2418
2445
  // to ensure to disable composition before dispatching the
2419
2446
  // insertText command for when changing the sequence for FF.
@@ -2422,24 +2449,7 @@ function onInput(event, editor) {
2422
2449
  isFirefoxEndingComposition = false;
2423
2450
  }
2424
2451
 
2425
- dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data);
2426
-
2427
- if (possibleTextReplacement) {
2428
- // If the DOM selection offset is higher than the existing
2429
- // offset, then restore the offset as it's likely correct
2430
- // in the case of text replacements.
2431
- const {
2432
- anchorOffset
2433
- } = window.getSelection();
2434
- const anchor = selection.anchor;
2435
- const focus = selection.focus;
2436
-
2437
- if (anchorOffset > anchor.offset) {
2438
- anchor.set(anchor.key, anchorOffset, anchor.type);
2439
- focus.set(anchor.key, anchorOffset, anchor.type);
2440
- }
2441
- } // This ensures consistency on Android.
2442
-
2452
+ dispatchCommand(editor, CONTROLLED_TEXT_INSERTION_COMMAND, data); // This ensures consistency on Android.
2443
2453
 
2444
2454
  if (!IS_SAFARI && !IS_IOS && editor.isComposing()) {
2445
2455
  lastKeyDownTimeStamp = 0;
@@ -2620,6 +2630,18 @@ function onKeyDown(event, editor) {
2620
2630
  } else if (isRedo(keyCode, shiftKey, metaKey, ctrlKey)) {
2621
2631
  event.preventDefault();
2622
2632
  dispatchCommand(editor, REDO_COMMAND, undefined);
2633
+ } else {
2634
+ const prevSelection = editor._editorState._selection;
2635
+
2636
+ if ($isNodeSelection(prevSelection)) {
2637
+ if (isCopy(keyCode, shiftKey, metaKey, ctrlKey)) {
2638
+ event.preventDefault();
2639
+ dispatchCommand(editor, COPY_COMMAND, event);
2640
+ } else if (isCut(keyCode, shiftKey, metaKey, ctrlKey)) {
2641
+ event.preventDefault();
2642
+ dispatchCommand(editor, CUT_COMMAND, event);
2643
+ }
2644
+ }
2623
2645
  }
2624
2646
 
2625
2647
  if (isModifier(ctrlKey, shiftKey, altKey, metaKey)) {
@@ -4748,7 +4770,6 @@ function internalCreateSelection(editor) {
4748
4770
 
4749
4771
  return internalCreateRangeSelection(lastSelection, domSelection, editor);
4750
4772
  }
4751
-
4752
4773
  function internalCreateRangeSelection(lastSelection, domSelection, editor) {
4753
4774
  // When we create a selection, we try to use the previous
4754
4775
  // selection where possible, unless an actual user selection
@@ -4797,7 +4818,6 @@ function internalCreateRangeSelection(lastSelection, domSelection, editor) {
4797
4818
  const [resolvedAnchorPoint, resolvedFocusPoint] = resolvedSelectionPoints;
4798
4819
  return new RangeSelection(resolvedAnchorPoint, resolvedFocusPoint, !$isRangeSelection(lastSelection) ? 0 : lastSelection.format);
4799
4820
  }
4800
-
4801
4821
  function $getSelection() {
4802
4822
  const editorState = getActiveEditorState();
4803
4823
  return editorState._selection;
@@ -5433,6 +5453,9 @@ function commitPendingUpdates(editor) {
5433
5453
  isAttemptingToRecoverFromReconcilerError = true;
5434
5454
  commitPendingUpdates(editor);
5435
5455
  isAttemptingToRecoverFromReconcilerError = false;
5456
+ } else {
5457
+ // To avoid a possible situation of infinite loops, lets throw
5458
+ throw error;
5436
5459
  }
5437
5460
 
5438
5461
  return;
@@ -5790,6 +5813,9 @@ function updateEditor(editor, updateFn, options) {
5790
5813
  beginUpdate(editor, updateFn, options);
5791
5814
  }
5792
5815
  }
5816
+ function internalGetActiveEditor() {
5817
+ return activeEditor;
5818
+ }
5793
5819
 
5794
5820
  /* eslint-disable no-constant-condition */
5795
5821
  function removeNode(nodeToRemove, restoreSelection, preserveEmptyParent) {
@@ -5858,6 +5884,7 @@ function $getNodeByKeyOrThrow(key) {
5858
5884
  return node;
5859
5885
  }
5860
5886
  class LexicalNode {
5887
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
5861
5888
  // Flow doesn't support abstract classes unfortunately, so we can't _force_
5862
5889
  // subclasses of Node to implement statics. All subclasses of Node should have
5863
5890
  // a static getType and clone method though. We define getType and clone here so we can call it
@@ -6347,21 +6374,51 @@ class LexicalNode {
6347
6374
  }
6348
6375
 
6349
6376
  exportDOM(editor) {
6350
- if ($isDecoratorNode(this)) {
6351
- const element = editor.getElementByKey(this.getKey());
6352
- return {
6353
- element: element ? element.cloneNode() : null
6354
- };
6355
- }
6356
-
6357
6377
  const element = this.createDOM(editor._config, editor);
6378
+ const serializedNode = this.exportJSON();
6379
+ element.setAttribute('data-lexical-node-type', this.__type);
6380
+ element.setAttribute('data-lexical-node-json', JSON.stringify(serializedNode));
6381
+ element.setAttribute('data-lexical-editor-key', editor._key);
6358
6382
  return {
6359
6383
  element
6360
6384
  };
6361
6385
  }
6362
6386
 
6363
6387
  static importDOM() {
6364
- return null;
6388
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6389
+ const proto = this.prototype.constructor;
6390
+ return {
6391
+ // Catch-all key because we don't know the nodeName of the element returned by exportDOM.
6392
+ '*': domNode => {
6393
+ if (!(domNode instanceof HTMLElement)) return null;
6394
+ const editorKey = domNode.getAttribute('data-lexical-editor-key');
6395
+ const nodeType = domNode.getAttribute('data-lexical-node-type');
6396
+ if (editorKey == null || nodeType == null) return null;
6397
+ const editor = getActiveEditor();
6398
+
6399
+ if (editorKey === editor.getKey() && nodeType === proto.getType()) {
6400
+ try {
6401
+ const json = domNode.getAttribute('data-lexical-node-json');
6402
+
6403
+ if (json != null) {
6404
+ const serializedNode = JSON.parse(json);
6405
+ const node = proto.importJSON(serializedNode);
6406
+ return {
6407
+ conversion: () => ({
6408
+ node
6409
+ }),
6410
+ // Max priority because of the 'data-lexical-node-type' attribute
6411
+ // matching the one on node klass guarantees a match.
6412
+ priority: 4
6413
+ }; // eslint-disable-next-line no-empty
6414
+ } // eslint-disable-next-line no-empty
6415
+
6416
+ } catch {}
6417
+ }
6418
+
6419
+ return null;
6420
+ }
6421
+ };
6365
6422
  }
6366
6423
 
6367
6424
  exportJSON() {
@@ -7494,7 +7551,9 @@ function setTextContent(nextText, dom, node) {
7494
7551
  dom.textContent = text;
7495
7552
  } else {
7496
7553
  const nodeValue = firstChild.nodeValue;
7497
- if (nodeValue !== text) if (isComposing) {
7554
+ if (nodeValue !== text) if (isComposing || IS_FIREFOX) {
7555
+ // We also use the diff composed text for general text in FF to avoid
7556
+ // the spellcheck red line from flickering.
7498
7557
  const [index, remove, insert] = diffComposedText(nodeValue, text);
7499
7558
 
7500
7559
  if (remove !== 0) {
@@ -8318,7 +8377,7 @@ function initializeConversionCache(nodes) {
8318
8377
  const handledConversions = new Set();
8319
8378
  nodes.forEach(node => {
8320
8379
  // @ts-expect-error TODO Replace Class utility type with InstanceType
8321
- const importDOM = node.klass.importDOM;
8380
+ const importDOM = node.klass.importDOM.bind(node.klass); // debugger;
8322
8381
 
8323
8382
  if (handledConversions.has(importDOM)) {
8324
8383
  return;
@@ -8343,70 +8402,78 @@ function initializeConversionCache(nodes) {
8343
8402
  return conversionCache;
8344
8403
  }
8345
8404
 
8346
- function createEditor(editorConfig = {}) {
8347
- const config = editorConfig;
8405
+ function createEditor(editorConfig) {
8406
+ const config = editorConfig || {};
8407
+ const activeEditor = internalGetActiveEditor();
8348
8408
  const theme = config.theme || {};
8349
- const parentEditor = config.parentEditor || null;
8409
+ const parentEditor = editorConfig === undefined ? activeEditor : config.parentEditor || null;
8350
8410
  const disableEvents = config.disableEvents || false;
8351
8411
  const editorState = createEmptyEditorState();
8412
+ const namespace = config.namespace || (parentEditor !== null ? parentEditor._config.namespace : createUID());
8352
8413
  const initialEditorState = config.editorState;
8353
8414
  const nodes = [RootNode, TextNode, LineBreakNode, ParagraphNode, ...(config.nodes || [])];
8354
8415
  const onError = config.onError;
8355
8416
  const isReadOnly = config.readOnly || false;
8356
- const registeredNodes = new Map();
8417
+ let registeredNodes;
8357
8418
 
8358
- for (let i = 0; i < nodes.length; i++) {
8359
- const klass = nodes[i]; // Ensure custom nodes implement required methods.
8360
- // @ts-ignore
8419
+ if (editorConfig === undefined && activeEditor !== null) {
8420
+ registeredNodes = activeEditor._nodes;
8421
+ } else {
8422
+ registeredNodes = new Map();
8361
8423
 
8362
- {
8363
- const name = klass.name;
8364
-
8365
- if (name !== 'RootNode') {
8366
- const proto = klass.prototype;
8367
- ['getType', 'clone'].forEach(method => {
8368
- // eslint-disable-next-line no-prototype-builtins
8369
- if (!klass.hasOwnProperty(method)) {
8370
- console.warn(`${name} must implement static "${method}" method`);
8371
- }
8372
- });
8424
+ for (let i = 0; i < nodes.length; i++) {
8425
+ const klass = nodes[i]; // Ensure custom nodes implement required methods.
8426
+ // @ts-ignore
8373
8427
 
8374
- if (proto instanceof DecoratorNode || proto instanceof ElementNode) {
8375
- // eslint-disable-next-line no-prototype-builtins
8376
- if (!klass.hasOwnProperty('importDOM')) {
8377
- console.warn(`${name} should implement "importDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
8378
- }
8379
- }
8428
+ {
8429
+ const name = klass.name;
8430
+
8431
+ if (name !== 'RootNode') {
8432
+ const proto = klass.prototype;
8433
+ ['getType', 'clone'].forEach(method => {
8434
+ // eslint-disable-next-line no-prototype-builtins
8435
+ if (!klass.hasOwnProperty(method)) {
8436
+ console.warn(`${name} must implement static "${method}" method`);
8437
+ }
8438
+ });
8380
8439
 
8381
- if (proto instanceof DecoratorNode) {
8382
- // eslint-disable-next-line no-prototype-builtins
8383
- if (!proto.hasOwnProperty('decorate')) {
8384
- console.warn(`${this.constructor.name} must implement "decorate" method`);
8440
+ if ( // eslint-disable-next-line no-prototype-builtins
8441
+ !klass.hasOwnProperty('importDOM') && // eslint-disable-next-line no-prototype-builtins
8442
+ klass.hasOwnProperty('exportDOM')) {
8443
+ console.warn(`${name} should implement "importDOM" if using a custom "exportDOM" method to ensure HTML serialization (important for copy & paste) works as expected`);
8385
8444
  }
8386
- } // eslint-disable-next-line no-prototype-builtins
8387
-
8388
8445
 
8389
- if (!klass.hasOwnProperty('importJSON')) {
8390
- console.warn(`${name} should implement "importJSON" method to ensure JSON serialization works as expected`);
8391
- } // eslint-disable-next-line no-prototype-builtins
8446
+ if (proto instanceof DecoratorNode) {
8447
+ // eslint-disable-next-line no-prototype-builtins
8448
+ if (!proto.hasOwnProperty('decorate')) {
8449
+ console.warn(`${this.constructor.name} must implement "decorate" method`);
8450
+ }
8451
+ }
8392
8452
 
8453
+ if ( // eslint-disable-next-line no-prototype-builtins
8454
+ !klass.hasOwnProperty('importJSON')) {
8455
+ console.warn(`${name} should implement "importJSON" method to ensure JSON and default HTML serialization works as expected`);
8456
+ }
8393
8457
 
8394
- if (!proto.hasOwnProperty('exportJSON')) {
8395
- console.warn(`${name} should implement "exportJSON" method to ensure JSON serialization works as expected`);
8458
+ if ( // eslint-disable-next-line no-prototype-builtins
8459
+ !proto.hasOwnProperty('exportJSON')) {
8460
+ console.warn(`${name} should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected`);
8461
+ }
8396
8462
  }
8397
- }
8398
- } // @ts-expect-error TODO Replace Class utility type with InstanceType
8463
+ } // @ts-expect-error TODO Replace Class utility type with InstanceType
8399
8464
 
8400
8465
 
8401
- const type = klass.getType();
8402
- registeredNodes.set(type, {
8403
- klass,
8404
- transforms: new Set()
8405
- });
8466
+ const type = klass.getType();
8467
+ registeredNodes.set(type, {
8468
+ klass,
8469
+ transforms: new Set()
8470
+ });
8471
+ }
8406
8472
  }
8407
8473
 
8408
8474
  const editor = new LexicalEditor(editorState, parentEditor, registeredNodes, {
8409
8475
  disableEvents,
8476
+ namespace,
8410
8477
  theme
8411
8478
  }, onError, initializeConversionCache(registeredNodes), isReadOnly);
8412
8479
 
@@ -8461,7 +8528,7 @@ class LexicalEditor {
8461
8528
 
8462
8529
  this._observer = null; // Used for identifying owning editors
8463
8530
 
8464
- this._key = generateRandomKey();
8531
+ this._key = createUID();
8465
8532
  this._onError = onError;
8466
8533
  this._htmlConversions = htmlConversions;
8467
8534
  this._readOnly = false;
@@ -8769,7 +8836,7 @@ class LexicalEditor {
8769
8836
  * LICENSE file in the root directory of this source tree.
8770
8837
  *
8771
8838
  */
8772
- const VERSION = '0.3.0';
8839
+ const VERSION = '0.3.3';
8773
8840
 
8774
8841
  /**
8775
8842
  * Copyright (c) Meta Platforms, Inc. and affiliates.
package/Lexical.js.flow CHANGED
@@ -231,12 +231,14 @@ export type EditorThemeClasses = {
231
231
  h3?: EditorThemeClassName,
232
232
  h4?: EditorThemeClassName,
233
233
  h5?: EditorThemeClassName,
234
+ h6?: EditorThemeClassName,
234
235
  },
235
236
  // Handle other generic values
236
237
  [string]: EditorThemeClassName | {[string]: EditorThemeClassName},
237
238
  };
238
239
  export type EditorConfig = {
239
240
  theme: EditorThemeClasses,
241
+ namespace: string,
240
242
  disableEvents?: boolean,
241
243
  };
242
244
  export type CommandListenerPriority = 0 | 1 | 2 | 3 | 4;
@@ -249,6 +251,7 @@ export const COMMAND_PRIORITY_CRITICAL = 4;
249
251
  export type IntentionallyMarkedAsDirtyElement = boolean;
250
252
  declare export function createEditor(editorConfig?: {
251
253
  editorState?: EditorState,
254
+ namespace: string,
252
255
  theme?: EditorThemeClasses,
253
256
  parentEditor?: LexicalEditor,
254
257
  nodes?: $ReadOnlyArray<Class<LexicalNode>>,
@@ -803,7 +806,7 @@ declare export function $getDecoratorNode(
803
806
  focus: Point,
804
807
  isBackward: boolean,
805
808
  ): null | LexicalNode;
806
-
809
+ declare export function generateRandomKey(): string;
807
810
  export type EventHandler = (event: Event, editor: LexicalEditor) => void;
808
811
 
809
812
  /**
package/Lexical.prod.js CHANGED
@@ -5,20 +5,20 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';function p(a){throw Error(`Minified Lexical error #${a}; see codes.json for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}
8
- let aa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ba=aa&&"documentMode"in document?document.documentMode:null,t=aa&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ca=aa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),fa=aa&&"InputEvent"in window&&!ba?"getTargetRanges"in new window.InputEvent("input"):!1,ha=aa&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ia=aa&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
- !window.MSStream,ja=ha||ia?"\u00a0":"\u200b",ka=ca?"\u00a0":ja,la=/^[^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]/,ma=/^[^\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]/,na={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},oa={center:2,justify:4,
10
- left:1,right:3},sa={2:"center",4:"justify",1:"left",3:"right"},ta={inert:3,normal:0,segmented:2,token:1},ua={3:"inert",0:"normal",2:"segmented",1:"token"},va=!1,wa=0;function xa(a){wa=a.timeStamp}function ya(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function za(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
8
+ let aa="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ba=aa&&"documentMode"in document?document.documentMode:null,t=aa&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ca=aa&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ha=aa&&"InputEvent"in window&&!ba?"getTargetRanges"in new window.InputEvent("input"):!1,ia=aa&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ja=aa&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&
9
+ !window.MSStream,ka=ia||ja?"\u00a0":"\u200b",la=ca?"\u00a0":ka,ma=/^[^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]/,na=/^[^\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]/,oa={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},pa={center:2,justify:4,
10
+ left:1,right:3},qa={2:"center",4:"justify",1:"left",3:"right"},ra={inert:3,normal:0,segmented:2,token:1},ua={3:"inert",0:"normal",2:"segmented",1:"token"},va=!1,wa=0;function xa(a){wa=a.timeStamp}function ya(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function za(a){return a.getEditorState().read(()=>{let b=u();return null!==b?b.clone():null})}
11
11
  function Aa(a,b,c){va=!0;let d=100<performance.now()-wa;try{v(a,()=>{var e=new Map,f=a.getRootElement(),g=a._editorState;let h=!1,k="";for(var m=0;m<b.length;m++){var l=b[m],n=l.type,r=l.target,q=Ba(r,g);if(!x(q))if("characterData"===n){if(d&&3===r.nodeType&&A(q)&&q.isAttached()){l=window.getSelection();var w=n=null;null!==l&&l.anchorNode===r&&(n=l.anchorOffset,w=l.focusOffset);Ca(q,r.nodeValue,n,w,!1)}}else if("childList"===n){h=!0;n=l.addedNodes;for(w=0;w<n.length;w++){var y=n[w],E=Da(y),z=y.parentNode;
12
- null==z||null!==E||"BR"===y.nodeName&&ya(y,z,a)||(ca&&(E=y.innerText||y.nodeValue)&&(k+=E),z.removeChild(y))}l=l.removedNodes;n=l.length;if(0<n){w=0;for(y=0;y<n;y++)z=l[y],"BR"===z.nodeName&&ya(z,r,a)&&(r.appendChild(z),w++);n!==w&&(r===f&&(q=g._nodeMap.get("root")),e.set(r,q))}}}if(0<e.size)for(let [H,V]of e)if(B(V))for(e=V.__children,f=H.firstChild,g=0;g<e.length;g++)m=a.getElementByKey(e[g]),null!==m&&(null==f?(H.appendChild(m),f=m):f!==m&&H.replaceChild(m,f),f=f.nextSibling);else A(V)&&V.markDirty();
12
+ null==z||null!==E||"BR"===y.nodeName&&ya(y,z,a)||(ca&&(E=y.innerText||y.nodeValue)&&(k+=E),z.removeChild(y))}l=l.removedNodes;n=l.length;if(0<n){w=0;for(y=0;y<n;y++)z=l[y],"BR"===z.nodeName&&ya(z,r,a)&&(r.appendChild(z),w++);n!==w&&(r===f&&(q=g._nodeMap.get("root")),e.set(r,q))}}}if(0<e.size)for(let [G,V]of e)if(B(V))for(e=V.__children,f=G.firstChild,g=0;g<e.length;g++)m=a.getElementByKey(e[g]),null!==m&&(null==f?(G.appendChild(m),f=m):f!==m&&G.replaceChild(m,f),f=f.nextSibling);else A(V)&&V.markDirty();
13
13
  e=c.takeRecords();if(0<e.length){for(f=0;f<e.length;f++)for(m=e[f],g=m.addedNodes,m=m.target,q=0;q<g.length;q++)r=g[q],l=r.parentNode,null==l||"BR"!==r.nodeName||ya(r,m,a)||l.removeChild(r);c.takeRecords()}e=u()||za(a);null!==e&&(h&&(e.dirty=!0,Ea(e)),ca&&Fa()&&e.insertRawText(k))})}finally{va=!1}}function Ga(a){let b=a._observer;if(null!==b){let c=b.takeRecords();Aa(a,c,b)}}function Ha(a){0===wa&&window.addEventListener("textInput",xa,!0);a._observer=new MutationObserver((b,c)=>{Aa(a,b,c)})}
14
- let Ia=0,La="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function Ma(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=!x(Ba(b))||"INPUT"!==g&&"TEXTAREA"!==g}return e&&Na(b)===a}catch(f){return!1}}function Na(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function Oa(a){return C(a)||a.isSegmented()}
15
- function C(a){return a.isToken()||a.isInert()}function Pa(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Qa(a,b,c){b=na[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ra(a){return A(a)||Sa(a)||x(a)}function Ta(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&p(31);Ua(a);b.splice(c,1)}}
14
+ let Ia=1,Ja="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};function Ka(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=!x(Ba(b))||"INPUT"!==g&&"TEXTAREA"!==g}return e&&Na(b)===a}catch(f){return!1}}function Na(a){for(;null!=a;){let b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function Oa(a){return C(a)||a.isSegmented()}
15
+ function C(a){return a.isToken()||a.isInert()}function Pa(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function Qa(a,b,c){b=oa[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function Ra(a){return A(a)||Sa(a)||x(a)}function Ta(a){var b=a.getParent();if(null!==b){b=b.getWritable().__children;let c=b.indexOf(a.__key);-1===c&&p(31);Ua(a);b.splice(c,1)}}
16
16
  function Va(a){99<Wa&&p(14);var b=a.getLatest(),c=b.__parent,d=D();let e=F(),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;B(a)?d.set(b,!0):e._dirtyLeaves.add(b)}function Ua(a){let b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&Va(b);null!==a&&Va(a)}
17
- function G(a){I();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=J(c),null!==b&&b.getWritable()),null!==a&&(a=J(a),null!==a&&a.getWritable()))}function J(a,b){a=(b||D())._nodeMap.get(a);return void 0===a?null:a}function Da(a,b){let c=F();a=a["__lexicalKey_"+c._key];return void 0!==a?J(a,b):null}function Ba(a,b){for(;null!=a;){let c=Da(a,b);if(null!==c)return c;a=a.parentNode}return null}
17
+ function H(a){I();var b=F();let c=b._compositionKey;a!==c&&(b._compositionKey=a,null!==c&&(b=J(c),null!==b&&b.getWritable()),null!==a&&(a=J(a),null!==a&&a.getWritable()))}function J(a,b){a=(b||D())._nodeMap.get(a);return void 0===a?null:a}function Da(a,b){let c=F();a=a["__lexicalKey_"+c._key];return void 0!==a?J(a,b):null}function Ba(a,b){for(;null!=a;){let c=Da(a,b);if(null!==c)return c;a=a.parentNode}return null}
18
18
  function Xa(a){let b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Ya(a){return a.read(()=>Za().getTextContent())}function $a(a,b){v(a,()=>{var c=D();if(!c.isEmpty())if("root"===b)Za().markDirty();else{c=c._nodeMap;for(let [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Za(){return D()._nodeMap.get("root")}function Ea(a){let b=D();null!==a&&(a.dirty=!0,a._cachedNodes=null);b._selection=a}
19
- function ab(a){var b=F(),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?J("root"):null):J(c)}function bb(a){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(a)}function cb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}
20
- function db(a,b,c){a=window.getSelection();if(null!==a){var d=a.anchorNode,{anchorOffset:e,focusOffset:f}=a;if(null!==d&&3===d.nodeType&&(a=Ba(d),A(a))){d=d.nodeValue;if(d===ja&&c){let g=c.length;d=c;f=e=g}Ca(a,d,e,f,b)}}}
21
- function Ca(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]===ja&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(G(null),ha||ia)f.remove();else{let h=F();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=eb(),C(f)||null!==F()._compositionKey&&!g||null!==e&&K(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),K(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
19
+ function ab(a){var b=F(),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?J("root"):null):J(c)}function bb(a){let b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function cb(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
20
+ function db(a,b,c){a=window.getSelection();if(null!==a){var d=a.anchorNode,{anchorOffset:e,focusOffset:f}=a;if(null!==d&&3===d.nodeType&&(a=Ba(d),A(a))){d=d.nodeValue;if(d===ka&&c){let g=c.length;d=c;f=e=g}Ca(a,d,e,f,b)}}}
21
+ function Ca(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]===ka&&(a=b.slice(0,-1));b=f.getTextContent();if(e||a!==b)if(""===a)if(H(null),ia||ja)f.remove();else{let h=F();setTimeout(()=>{h.update(()=>{f.isAttached()&&f.remove()})},20)}else e=f.getParent(),b=eb(),C(f)||null!==F()._compositionKey&&!g||null!==e&&K(b)&&!e.canInsertTextBefore()&&0===b.anchor.offset?f.markDirty():(g=u(),K(g)&&null!==c&&null!==d&&(g.setTextNodeRange(f,c,f,d),f.isSegmented()&&
22
22
  (c=f.getTextContent(),c=L(c),f.replace(c),f=c)),f.setTextContent(a))}}
23
23
  function fb(a,b){var c=a.anchor,d=a.focus,e=c.getNode(),f=window.getSelection();f=null!==f?f.anchorNode:null;let g=c.key,h=F().getElementByKey(g);b=b.length;(c=g!==d.key||!A(e)||2>b&&c.offset!==d.offset&&!e.isComposing()||Oa(e)||e.isDirty()&&1<b||null!==h&&!e.isComposing()&&f!==Pa(h)||e.getFormat()!==a.format)||(e.isSegmented()?c=!0:a.isCollapsed()?(c=a.anchor.offset,d=e.getParentOrThrow(),b=e.isToken(),a=0===c&&(!e.canInsertTextBefore()||!d.canInsertTextBefore()||b),e=e.getTextContentSize()===c&&
24
24
  (!e.canInsertTextBefore()||!d.canInsertTextBefore()||b),c=a||e):c=!1);return c}function gb(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function hb(a,b,c,d,e){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&p(33,c),b=b.klass,c=a.get(b),void 0===c&&(c=new Map,a.set(b,c)),c.has(d)||c.set(d,e))}
@@ -31,67 +31,68 @@ function Kb(a,b){a=a.style;0===b?Ib(a,""):1===b?Ib(a,"left"):2===b?Ib(a,"center"
31
31
  function Lb(a,b,c){let d=Cb.get(a);void 0===d&&p(60);let e=d.createDOM(tb,Q);var f=Q._keyToDOMMap;e["__lexicalKey_"+Q._key]=a;f.set(a,e);A(d)?e.setAttribute("data-lexical-text","true"):x(d)&&e.setAttribute("data-lexical-decorator","true");if(B(d)){a=d.__indent;0!==a&&Jb(e,a);a=d.__children;var g=a.length;if(0!==g){f=a;--g;let h=O;O="";Mb(f,0,g,e,null);Nb(d,e);O=h}f=d.__format;0!==f&&Kb(e,f);Ob(null,a,e);kb(d)&&(N+="\n\n",P+="\n\n")}else f=d.getTextContent(),x(d)?(g=d.decorate(Q),null!==g&&Pb(a,g),
32
32
  e.contentEditable="false"):A(d)&&(d.isDirectionless()||(O+=f),d.isInert()&&(a=e.style,a.pointerEvents="none",a.userSelect="none",e.contentEditable="false",a.setProperty("-webkit-user-select","none"))),N+=f,P+=f;null!==b&&(null!=c?b.insertBefore(e,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(e,c):b.appendChild(e)));hb(Eb,ub,xb,d,"created");return e}function Mb(a,b,c,d,e){let f=N;for(N="";b<=c;++b)Lb(a[b],d,e);d.__lexicalTextContent=N;N=f+N}
33
33
  function Qb(a,b){a=b.get(a[a.length-1]);return Sa(a)||x(a)}function Ob(a,b,c){a=null!==a&&(0===a.length||Qb(a,Bb));b=null!==b&&(0===b.length||Qb(b,Cb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
34
- function Nb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==yb){let f=""===O;if(f)var d=yb;else d=O,d=la.test(d)?"rtl":ma.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=tb.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),g.add(...k)),b.dir=d);wb||(a.getWritable().__dir=d)}yb=d;b.__lexicalDirTextContent=
34
+ function Nb(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==O||c!==yb){let f=""===O;if(f)var d=yb;else d=O,d=ma.test(d)?"rtl":na.test(d)?"ltr":null;if(d!==c){let g=b.classList,h=tb.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),g.add(...k)),b.dir=d);wb||(a.getWritable().__dir=d)}yb=d;b.__lexicalDirTextContent=
35
35
  O;b.__lexicalDir=d}}
36
36
  function Rb(a,b){var c=Bb.get(a),d=Cb.get(a);void 0!==c&&void 0!==d||p(61);var e=vb||Ab.has(a)||zb.has(a);let f=nb(Q,a);if(c===d&&!e)return B(c)?(d=f.__lexicalTextContent,void 0!==d&&(N+=d,P+=d),d=f.__lexicalDirTextContent,void 0!==d&&(O+=d)):(d=c.getTextContent(),A(c)&&!c.isDirectionless()&&(O+=d),P+=d,N+=d),f;c!==d&&e&&hb(Eb,ub,xb,d,"updated");if(d.updateDOM(c,f,tb))return d=Lb(a,null,null),null===b&&p(62),b.replaceChild(d,f),Fb(a,null),d;if(B(c)&&B(d)){a=d.__indent;a!==c.__indent&&Jb(f,a);a=d.__format;
37
37
  a!==c.__format&&Kb(f,a);a=c.__children;c=d.__children;if(a!==c||e){var g=a,h=c;e=d;b=O;O="";let q=N;N="";var k=g.length,m=h.length;if(1===k&&1===m){var l=g[0];h=h[0];if(l===h)Rb(l,f);else{var n=Gb(l);h=Lb(h,null,null);f.replaceChild(h,n);Fb(l,null)}}else if(0===k)0!==m&&Mb(h,0,m-1,f,null);else if(0===m)0!==k&&(l=null==f.__lexicalLineBreak,Hb(g,0,k-1,l?null:f),l&&(f.textContent=""));else{let w=k-1;k=m-1;let y=f.firstChild,E=0;for(m=0;E<=w&&m<=k;){var r=g[E];let z=h[m];if(r===z)y=Rb(z,f).nextSibling,
38
- E++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let H=n.has(r),V=l.has(z);H?(V?(r=nb(Q,z),r===y?y=Rb(z,f).nextSibling:(null!=y?f.insertBefore(r,y):f.appendChild(r),Rb(z,f)),E++):Lb(z,f,y),m++):(y=Gb(r).nextSibling,Fb(r,f),E++)}}l=E>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:Q.getElementByKey(l),Mb(h,m,k,f,l)):n&&!l&&Hb(g,E,w,f)}kb(e)&&(N+="\n\n");f.__lexicalTextContent=N;N=q+N;Nb(e,f);O=b;M(d)||Ob(a,c,f)}kb(d)&&(N+="\n\n",P+="\n\n")}else c=d.getTextContent(),x(d)?(e=d.decorate(Q),
38
+ E++,m++;else{void 0===l&&(l=new Set(g));void 0===n&&(n=new Set(h));let G=n.has(r),V=l.has(z);G?(V?(r=nb(Q,z),r===y?y=Rb(z,f).nextSibling:(null!=y?f.insertBefore(r,y):f.appendChild(r),Rb(z,f)),E++):Lb(z,f,y),m++):(y=Gb(r).nextSibling,Fb(r,f),E++)}}l=E>w;n=m>k;l&&!n?(l=h[k+1],l=void 0===l?null:Q.getElementByKey(l),Mb(h,m,k,f,l)):n&&!l&&Hb(g,E,w,f)}kb(e)&&(N+="\n\n");f.__lexicalTextContent=N;N=q+N;Nb(e,f);O=b;M(d)||Ob(a,c,f)}kb(d)&&(N+="\n\n",P+="\n\n")}else c=d.getTextContent(),x(d)?(e=d.decorate(Q),
39
39
  null!==e&&Pb(a,e),N+=c,P+=c):A(d)&&!d.isDirectionless()&&(O+=c),N+=c,P+=c;!wb&&M(d)&&d.__cachedText!==P&&(d=d.getWritable(),d.__cachedText=P);return f}function Pb(a,b){let c=Q._pendingDecorators,d=Q._decorators;if(null===c){if(d[a]===b)return;c=Xa(Q)}c[a]=b}function Gb(a){a=Db.get(a);void 0===a&&p(34);return a}
40
- let Vb={},Wb={},Xb={},Yb={},Zb={},$b={},ac={},bc={},cc={},dc={},R={},ec={},fc={},gc={},hc={},ic={},jc={},kc={},lc={},mc={},nc={},oc={},pc={},qc={},rc={},sc={},tc={},uc={},vc={},wc={},xc={},yc={},zc={},Ac={},S=Object.freeze({}),Gc=[["keydown",Bc],["compositionstart",Cc],["compositionend",Dc],["input",Ec],["click",Fc],["cut",S],["copy",S],["dragstart",S],["dragover",S],["paste",S],["focus",S],["blur",S],["drop",S]];fa&&Gc.push(["beforeinput",Hc]);let Ic=0,Jc=0,Kc=!1,Lc=!1,Mc=!1,Nc=[0,0,"root",0];
41
- function Oc(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Kc&&(Kc=!1,null!==d&&3===d.nodeType&&0!==e&&e!==d.nodeValue.length&&null!==f&&3===f.nodeType&&0!==g&&g!==f.nodeValue.length))return;v(b,()=>{if(!c)Ea(null);else if(Ma(b,d,f)){var h=u();if(K(h)){let m=h.anchor,l=m.getNode();if(h.isCollapsed()){"Range"===a.type&&(h.dirty=!0);var k=window.event;k=k?k.timeStamp:performance.now();let [n,r,q,w]=Nc;k<w+200&&m.offset===r&&m.key===q?h.format=n:"text"===m.type?h.format=l.getFormat():
42
- "element"===m.type&&(h.format=0)}else{k=h.focus;let n=k.getNode(),r=0;"text"===m.type&&(r|=l.getFormat());"text"!==k.type||l.is(n)||(r|=n.getFormat());h.format=r}}T(b,Vb,void 0)}})}function Fc(a,b){v(b,()=>{let c=u();if(K(c)){var d=c.anchor;let e=d.getNode();"element"===d.type&&0===d.offset&&c.isCollapsed()&&!M(e)&&1===Za().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&(d=eb(),null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}T(b,Wb,a)})}
43
- function Pc(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}function Qc(a,b){return a!==b||B(a)||B(b)||!C(a)||!C(b)}
44
- function Hc(a,b){let c=a.inputType;if(!("deleteCompositionText"===c||ca&&Fa()))if("insertCompositionText"===c){let d=a.data;d&&v(b,()=>{var e=u();if(K(e)){let f=e.anchor,g=f.getNode(),h=g.getPreviousSibling();0===f.offset&&A(g)&&A(h)&&g.getTextContent()===ka&&h.getFormat()!==e.format&&(e=h.getTextContent(),0===d.indexOf(e)&&(e=d.slice(e.length),T(b,$b,e),setTimeout(()=>{v(b,()=>{g.select()})},30)))}})}else v(b,()=>{var d=u();if("deleteContentBackward"===c){if(null===d){d=eb();if(!K(d))return;Ea(d.clone())}G(null);
45
- a.preventDefault();Ic=0;T(b,Xb,!0);setTimeout(()=>{v(b,()=>{G(null)})},30)}else if(K(d)){var e=a.data;d.dirty||!d.isCollapsed()||M(d.anchor.getNode())||Pc(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c)"\n"===e?(a.preventDefault(),T(b,Yb,void 0)):"\n\n"===e?(a.preventDefault(),T(b,Zb,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&fb(d,e)&&(a.preventDefault(),T(b,$b,e));else switch(a.preventDefault(),
46
- c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":T(b,$b,a);break;case "insertFromComposition":G(null);T(b,$b,a);break;case "insertLineBreak":G(null);T(b,Yb,void 0);break;case "insertParagraph":G(null);Lc?(Lc=!1,T(b,Yb,void 0)):T(b,Zb,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":T(b,ac,a);break;case "deleteByComposition":Qc(g,f)&&T(b,bc,void 0);break;case "deleteByDrag":case "deleteByCut":T(b,bc,void 0);break;case "deleteContent":T(b,Xb,!1);break;
40
+ let Sb={},Tb={},Xb={},Yb={},Zb={},$b={},ac={},bc={},cc={},dc={},R={},ec={},fc={},gc={},hc={},ic={},jc={},kc={},lc={},mc={},nc={},oc={},pc={},qc={},rc={},sc={},tc={},uc={},vc={},wc={},xc={},yc={},zc={},Ac={},S=Object.freeze({}),Gc=[["keydown",Bc],["compositionstart",Cc],["compositionend",Dc],["input",Ec],["click",Fc],["cut",S],["copy",S],["dragstart",S],["dragover",S],["paste",S],["focus",S],["blur",S],["drop",S]];ha&&Gc.push(["beforeinput",Hc]);let Ic=0,Jc=0,Kc=!1,Lc=!1,Mc=!1,Nc=[0,0,"root",0];
41
+ function Oc(a,b,c){let {anchorNode:d,anchorOffset:e,focusNode:f,focusOffset:g}=a;if(Kc&&(Kc=!1,null!==d&&3===d.nodeType&&0!==e&&e!==d.nodeValue.length&&null!==f&&3===f.nodeType&&0!==g&&g!==f.nodeValue.length))return;v(b,()=>{if(!c)Ea(null);else if(Ka(b,d,f)){var h=u();if(K(h)){let m=h.anchor,l=m.getNode();if(h.isCollapsed()){"Range"===a.type&&(h.dirty=!0);var k=window.event;k=k?k.timeStamp:performance.now();let [n,r,q,w]=Nc;k<w+200&&m.offset===r&&m.key===q?h.format=n:"text"===m.type?h.format=l.getFormat():
42
+ "element"===m.type&&(h.format=0)}else{k=h.focus;let n=k.getNode(),r=0;"text"===m.type&&(r|=l.getFormat());"text"!==k.type||l.is(n)||(r|=n.getFormat());h.format=r}}T(b,Sb,void 0)}})}
43
+ function Fc(a,b){v(b,()=>{var c=u(),d=window.getSelection();let e=eb();if(K(c)){let f=c.anchor,g=f.getNode();"element"===f.type&&0===f.offset&&c.isCollapsed()&&!M(g)&&1===Za().getChildrenSize()&&g.getTopLevelElementOrThrow().isEmpty()&&null!==e&&c.is(e)&&(d.removeAllRanges(),c.dirty=!0)}else Pc(c)&&d.isCollapsed&&(c=d.anchorNode,null!==c&&3===c.nodeType&&(d=Qc(e,d,b),Ea(d)));T(b,Tb,a)})}function Rc(a,b){b.getTargetRanges&&(b=b.getTargetRanges()[0])&&a.applyDOMRange(b)}
44
+ function Sc(a,b){return a!==b||B(a)||B(b)||!C(a)||!C(b)}
45
+ function Hc(a,b){let c=a.inputType;if(!("deleteCompositionText"===c||ca&&Fa()))if("insertCompositionText"===c){let d=a.data;d&&v(b,()=>{var e=u();if(K(e)){let f=e.anchor,g=f.getNode(),h=g.getPreviousSibling();0===f.offset&&A(g)&&A(h)&&g.getTextContent()===la&&h.getFormat()!==e.format&&(e=h.getTextContent(),0===d.indexOf(e)&&(e=d.slice(e.length),T(b,$b,e),setTimeout(()=>{v(b,()=>{g.select()})},30)))}})}else v(b,()=>{var d=u();if("deleteContentBackward"===c){if(null===d){d=eb();if(!K(d))return;Ea(d.clone())}H(null);
46
+ a.preventDefault();Ic=0;T(b,Xb,!0);setTimeout(()=>{v(b,()=>{H(null)})},30)}else if(K(d)){var e=a.data;d.dirty||!d.isCollapsed()||M(d.anchor.getNode())||Rc(d,a);var f=d.focus,g=d.anchor.getNode();f=f.getNode();if("insertText"===c)"\n"===e?(a.preventDefault(),T(b,Yb,void 0)):"\n\n"===e?(a.preventDefault(),T(b,Zb,void 0)):null==e&&a.dataTransfer?(e=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(e)):null!=e&&fb(d,e)&&(a.preventDefault(),T(b,$b,e));else switch(a.preventDefault(),
47
+ c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":T(b,$b,a);break;case "insertFromComposition":H(null);T(b,$b,a);break;case "insertLineBreak":H(null);T(b,Yb,void 0);break;case "insertParagraph":H(null);Lc?(Lc=!1,T(b,Yb,void 0)):T(b,Zb,void 0);break;case "insertFromPaste":case "insertFromPasteAsQuotation":T(b,ac,a);break;case "deleteByComposition":Sc(g,f)&&T(b,bc,void 0);break;case "deleteByDrag":case "deleteByCut":T(b,bc,void 0);break;case "deleteContent":T(b,Xb,!1);break;
47
48
  case "deleteWordBackward":T(b,cc,!0);break;case "deleteWordForward":T(b,cc,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":T(b,dc,!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":T(b,dc,!1);break;case "formatStrikeThrough":T(b,R,"strikethrough");break;case "formatBold":T(b,R,"bold");break;case "formatItalic":T(b,R,"italic");break;case "formatUnderline":T(b,R,"underline");break;case "historyUndo":T(b,ec,void 0);break;case "historyRedo":T(b,
48
- fc,void 0)}}})}function Ec(a,b){a.stopPropagation();v(b,()=>{var c=u(),d=a.data,e="insertText"===a.inputType&&null!=d&&1<d.length&&!bb(d);null!=d&&K(c)&&(e||fb(c,d))?(Mc&&(Rc(b,d),Mc=!1),T(b,$b,d),e&&({anchorOffset:d}=window.getSelection(),e=c.anchor,c=c.focus,d>e.offset&&(e.set(e.key,d,e.type),c.set(e.key,d,e.type))),ha||ia||!b.isComposing()||(Ic=0,G(null))):(db(b,!1),Mc&&(Rc(b,d),Mc=!1));I();c=F();Ga(c)})}
49
- function Cc(a,b){v(b,()=>{let c=u();if(K(c)&&!b.isComposing()){let d=c.anchor;G(d.key);(a.timeStamp<Ic+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&T(b,$b,ka)}})}function Rc(a,b){var c=a._compositionKey;G(null);if(null!==c&&null!=b){if(""===b){b=J(c);a=Pa(a.getElementByKey(c));null!==a&&A(b)&&Ca(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),K(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);T(a,mc,null);return}}db(a,!0,b)}
50
- function Dc(a,b){ca?Mc=!0:v(b,()=>{Rc(b,a.data)})}
49
+ fc,void 0)}}})}function Ec(a,b){a.stopPropagation();v(b,()=>{var c=u();let d=a.data;null!=d&&K(c)&&fb(c,d)?(Mc&&(Tc(b,d),Mc=!1),T(b,$b,d),ia||ja||!b.isComposing()||(Ic=0,H(null))):(db(b,!1),Mc&&(Tc(b,d),Mc=!1));I();c=F();Ga(c)})}function Cc(a,b){v(b,()=>{let c=u();if(K(c)&&!b.isComposing()){let d=c.anchor;H(d.key);(a.timeStamp<Ic+30||"element"===d.type||!c.isCollapsed()||c.anchor.getNode().getFormat()!==c.format)&&T(b,$b,la)}})}
50
+ function Tc(a,b){var c=a._compositionKey;H(null);if(null!==c&&null!=b){if(""===b){b=J(c);a=Pa(a.getElementByKey(c));null!==a&&A(b)&&Ca(b,a.nodeValue,null,null,!0);return}if("\n"===b[b.length-1]&&(c=u(),K(c))){b=c.focus;c.anchor.set(b.key,b.offset,b.type);T(a,mc,null);return}}db(a,!0,b)}function Dc(a,b){ca?Mc=!0:v(b,()=>{Tc(b,a.data)})}
51
51
  function Bc(a,b){Ic=a.timeStamp;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)Lc=!0,T(b,mc,a);else if(32===c)T(b,nc,a);else if(t&&e&&79===c)a.preventDefault(),Lc=!0,T(b,Yb,!0);else if(13!==c||d){var h=t?g||f?!1:8===c||72===c&&e:e||g||f?!1:8===c;h?8===c?T(b,oc,a):(a.preventDefault(),T(b,Xb,!0)):27===c?T(b,pc,a):(h=t?d||g||f?!1:46===c||68===
52
52
  c&&e:e||g||f?!1:46===c,h?46===c?T(b,qc,a):(a.preventDefault(),T(b,Xb,!1)):8===c&&(t?g:e)?(a.preventDefault(),T(b,cc,!0)):46===c&&(t?g:e)?(a.preventDefault(),T(b,cc,!1)):t&&f&&8===c?(a.preventDefault(),T(b,dc,!0)):t&&f&&46===c?(a.preventDefault(),T(b,dc,!1)):66===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,R,"bold")):85===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,R,"underline")):73===c&&!g&&(t?f:e)?(a.preventDefault(),T(b,R,"italic")):9!==c||g||e||f?90===c&&!d&&(t?f:e)?(a.preventDefault(),T(b,ec,void 0)):
53
- (h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h&&(a.preventDefault(),T(b,fc,void 0))):T(b,rc,a))}else Lc=!1,T(b,mc,a);else T(b,lc,a);else T(b,kc,a);else T(b,jc,a);else T(b,ic,a);else T(b,hc,a);else T(b,gc,a);(e||d||g||f)&&T(b,Ac,a)}}function Sc(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Tc=new Map;
54
- function Uc(){let a=window.getSelection(),b=Na(a.anchorNode);if(null!==b){var c=cb(b);c=c[c.length-1];var d=c._key,e=Tc.get(d),f=e||c;f!==b&&Oc(a,f,!1);Oc(a,b,!0);b!==c?Tc.set(d,b):e&&Tc.delete(d)}}
55
- function Vc(a,b){0===Jc&&a.ownerDocument.addEventListener("selectionchange",Uc);Jc++;a.__lexicalEditor=b;let c=Sc(a);for(let d=0;d<Gc.length;d++){let [e,f]=Gc[d],g="function"===typeof f?h=>{b.isReadOnly()||f(h,b)}:h=>{if(!b.isReadOnly())switch(e){case "cut":return T(b,xc,h);case "copy":return T(b,wc,h);case "paste":return T(b,ac,h);case "dragstart":return T(b,tc,h);case "dragover":return T(b,uc,h);case "dragend":return T(b,vc,h);case "focus":return T(b,yc,h);case "blur":return T(b,zc,h);case "drop":return T(b,
53
+ (h=t?90===c&&f&&d:89===c&&e||90===c&&e&&d,h?(a.preventDefault(),T(b,fc,void 0)):Pc(b._editorState._selection)&&(h=d?!1:67===c?t?f:e:void 0,h?(a.preventDefault(),T(b,wc,a)):(h=d?!1:88===c?t?f:e:void 0,h&&(a.preventDefault(),T(b,xc,a))))):T(b,rc,a))}else Lc=!1,T(b,mc,a);else T(b,lc,a);else T(b,kc,a);else T(b,jc,a);else T(b,ic,a);else T(b,hc,a);else T(b,gc,a);(e||d||g||f)&&T(b,Ac,a)}}function Uc(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}let Vc=new Map;
54
+ function Wc(){let a=window.getSelection(),b=Na(a.anchorNode);if(null!==b){var c=bb(b);c=c[c.length-1];var d=c._key,e=Vc.get(d),f=e||c;f!==b&&Oc(a,f,!1);Oc(a,b,!0);b!==c?Vc.set(d,b):e&&Vc.delete(d)}}
55
+ function Xc(a,b){0===Jc&&a.ownerDocument.addEventListener("selectionchange",Wc);Jc++;a.__lexicalEditor=b;let c=Uc(a);for(let d=0;d<Gc.length;d++){let [e,f]=Gc[d],g="function"===typeof f?h=>{b.isReadOnly()||f(h,b)}:h=>{if(!b.isReadOnly())switch(e){case "cut":return T(b,xc,h);case "copy":return T(b,wc,h);case "paste":return T(b,ac,h);case "dragstart":return T(b,tc,h);case "dragover":return T(b,uc,h);case "dragend":return T(b,vc,h);case "focus":return T(b,yc,h);case "blur":return T(b,zc,h);case "drop":return T(b,
56
56
  sc,h)}};a.addEventListener(e,g);c.push(()=>{a.removeEventListener(e,g)})}}
57
57
  class U{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(B(b)){var e=b.getDescendantByIndex(d);b=null!=e?e:b}B(c)&&(e=c.getDescendantByIndex(a),c=null!=e?e:c);return b===c?d<a:b.isBefore(c)}getNode(){let a=J(this.key);null===a&&p(20);return a}set(a,b,c){let d=this._selection,e=this.key;this.key=a;this.offset=b;this.type=c;
58
- W||(F()._compositionKey===e&&G(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function Wc(a,b){let c=b.__key,d=a.offset,e="element";if(A(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!B(b)){var f=b.getNextSibling();if(A(f))c=f.__key,d=0;else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function Xc(a,b){if(B(b)){let c=b.getLastDescendant();B(c)||A(c)?Wc(a,c):Wc(a,b)}else Wc(a,b)}
59
- function Yc(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=L(),g=M(d)?Zc().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 X(a,b,c,d){a.key=b;a.offset=c;a.type=d}
60
- class $c{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!ad(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 $c(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=
61
- this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=J(c),null!==b&&a.push(b);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function K(a){return a instanceof bd}
62
- class cd{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 dd(a)?this.gridKey===a.gridKey&&this.anchor.is(this.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new cd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return ed(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
58
+ W||(F()._compositionKey===e&&H(a),null!==d&&(d._cachedNodes=null,d.dirty=!0))}}function Yc(a,b){let c=b.__key,d=a.offset,e="element";if(A(b))e="text",b=b.getTextContentSize(),d>b&&(d=b);else if(!B(b)){var f=b.getNextSibling();if(A(f))c=f.__key,d=0;else if(f=b.getParent())c=f.__key,d=b.getIndexWithinParent()+1}a.set(c,d,e)}function Zc(a,b){if(B(b)){let c=b.getLastDescendant();B(c)||A(c)?Yc(a,c):Yc(a,b)}else Yc(a,b)}
59
+ function $c(a,b,c){let d=a.getNode(),e=d.getChildAtIndex(a.offset),f=L(),g=M(d)?ad().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 X(a,b,c,d){a.key=b;a.offset=c;a.type=d}
60
+ class bd{constructor(a){this.dirty=!1;this._nodes=a;this._cachedNodes=null}is(a){if(!Pc(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 bd(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=
61
+ this._cachedNodes;if(null!==a)return a;var b=this._nodes;a=[];for(let c of b)b=J(c),null!==b&&a.push(b);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function K(a){return a instanceof cd}
62
+ class dd{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 ed(a)?this.gridKey===a.gridKey&&this.anchor.is(this.focus):!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchor.key=b;this.focus.key=c;this._cachedNodes=null}clone(){return new dd(this.gridKey,this.anchor,this.focus)}isCollapsed(){return!1}isBackward(){return this.focus.isBefore(this.anchor)}getCharacterOffsets(){return fd(this)}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
63
63
  J(this.anchor.key);null===a&&p(21);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=J(this.focus.key);null===c&&p(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=this._cachedNodes;if(null!==a)return a;a=new Set;let {fromX:b,fromY:c,toX:d,toY:e}=this.getShape();var f=
64
- J(this.gridKey);fd(f)||p(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);gd(g)||p(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];hd(h)||p(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);B(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function dd(a){return a instanceof cd}
65
- class bd{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 K(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();B(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
66
- b?b:a);B(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?B(a)&&(0<a.getChildrenSize()||a.excludeFromCopy())?[]:[a]:a.getNodesBetween(d);W||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){X(this.anchor,a.__key,b,"text");X(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=ed(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];
67
- if(B(m)&&!m.isInline())h||(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,A(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!x(m)&&!Sa(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;a=id(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;X(this.anchor,d.key,d.offset,d.type);X(this.focus,e.key,e.offset,
68
- e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new bd(new U(a.key,a.offset,a.type),new U(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Qa(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&na[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(L(e));d!==c-1&&a.push(jd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,
69
- d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?Yc(b,c,e):d||"element"!==c.type||Yc(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];A(b)||p(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())){var n=b.getNextSibling();if(!A(n)||Oa(n))n=L(),m.canInsertTextAfter()?b.insertAfter(n):m.insertAfter(n);n.select(0,0);
64
+ J(this.gridKey);gd(f)||p(23);a.add(f);f=f.getChildren();for(let k=c;k<=e;k++){var g=f[k];a.add(g);hd(g)||p(24);g=g.getChildren();for(let m=b;m<=d;m++){var h=g[m];id(h)||p(25);a.add(h);for(h=h.getChildren();0<h.length;){let l=h.shift();a.add(l);B(l)&&h.unshift(...l.getChildren())}}}a=Array.from(a);W||(this._cachedNodes=a);return a}getTextContent(){let a=this.getNodes(),b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function ed(a){return a instanceof dd}
65
+ class cd{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 K(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();B(a)&&(b=a.getDescendantByIndex(b.offset),a=null!=
66
+ b?b:a);B(d)&&(c=d.getDescendantByIndex(c.offset),d=null!=c?c:d);a=a.is(d)?B(a)&&(0<a.getChildrenSize()||a.excludeFromCopy())?[]:[a]:a.getNodesBetween(d);W||(this._cachedNodes=a);return a}setTextNodeRange(a,b,c,d){X(this.anchor,a.__key,b,"text");X(this.focus,c.__key,d,"text");this._cachedNodes=null;this.dirty=!0}getTextContent(){let a=this.getNodes();if(0===a.length)return"";let b=a[0],c=a[a.length-1],d=this.anchor.isBefore(this.focus),[e,f]=fd(this),g="",h=!0;for(let k=0;k<a.length;k++){let m=a[k];
67
+ if(B(m)&&!m.isInline())h||(g+="\n"),h=m.isEmpty()?!1:!0;else if(h=!1,A(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!x(m)&&!Sa(m)||m===c&&this.isCollapsed()||(g+=m.getTextContent())}return g}applyDOMRange(a){let b=F(),c=b.getEditorState()._selection;a=jd(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,e]=a;X(this.anchor,d.key,d.offset,d.type);X(this.focus,e.key,e.offset,
68
+ e.type);this._cachedNodes=null}}clone(){let a=this.anchor,b=this.focus;return new cd(new U(a.key,a.offset,a.type),new U(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=Qa(this.format,a,null);this.dirty=!0}hasFormat(a){return 0!==(this.format&oa[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(L(e));d!==c-1&&a.push(kd())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,
69
+ d=this.isCollapsed()||b.isBefore(c),e=this.format;d&&"element"===b.type?$c(b,c,e):d||"element"!==c.type||$c(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];A(b)||p(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())){var n=b.getNextSibling();if(!A(n)||Oa(n))n=L(),m.canInsertTextAfter()?b.insertAfter(n):m.insertAfter(n);n.select(0,0);
70
70
  b=n;if(""!==a){this.insertText(a);return}}else if(this.isCollapsed()&&0===c&&(b.isSegmented()||b.isToken()||!b.canInsertTextBefore()||!m.canInsertTextBefore())){n=b.getPreviousSibling();if(!A(n)||Oa(n))n=L(),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=L(b.getTextContent()),b.replace(m),b=m;else if(!(this.isCollapsed()||""===a||(n=l.getParent(),m.canInsertTextBefore()&&m.canInsertTextAfter()&&(!B(n)||
71
- n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");kd(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(C(b))a=L(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=L(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-=a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():
71
+ n.canInsertTextBefore()&&n.canInsertTextAfter())))){this.insertText("");ld(this.anchor,this.focus,null);this.insertText(a);return}if(1===g)if(C(b))a=L(a),a.select(),b.replace(a);else{f=b.getFormat();if(c===k&&f!==e)if(""===b.getTextContent())b.setFormat(e);else{f=L(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-=a.length);return}b=b.spliceText(c,k-c,a,!0);""===b.getTextContent()?b.remove():
72
72
  b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{e=new Set([...b.getParentKeys(),...l.getParentKeys()]);var r=B(b)?b:b.getParentOrThrow();m=B(l)?l:l.getParentOrThrow();n=l;if(!r.is(m)&&m.isInline()){do n=m,m=m.getParentOrThrow();while(m.isInline())}"text"===h.type&&(0!==k||""===l.getTextContent())||"element"===h.type&&l.getIndexWithinParent()<k?A(l)&&!C(l)&&k!==l.getTextContentSize()?(l.isSegmented()&&(h=L(l.getTextContent()),l.replace(h),l=h),l=l.spliceText(0,k,""),
73
73
  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=r.is(m);r=r.isInline()&&null===b.getNextSibling()?r:b;for(let q=h.length-1;0<=q;q--){let w=h[q];if(w.is(b)||B(w)&&w.isParentOf(b))break;w.isAttached()&&(!k.has(w)||w.is(n)?l||r.insertAfter(w):w.remove())}if(!l)for(h=m,k=null;null!==h;){l=h.getChildren();m=l.length;if(0===m||l[m-1].is(k))e.delete(h.__key),k=h;h=h.getParent()}C(b)?c===d?b.select():(a=
74
- L(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){let b=this.getNodes(),c=b.length-1,d=b[0],e=b[c];if(this.isCollapsed())this.toggleFormat(a),G(null);else{var f=this.anchor,g=this.focus,h=g.offset,k=0,m=d.getTextContent().length;for(var l=0;l<b.length;l++){var n=b[l];if(A(n)){k=n.getFormatFlags(a,
74
+ L(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){let b=this.getNodes(),c=b.length-1,d=b[0],e=b[c];if(this.isCollapsed())this.toggleFormat(a),H(null);else{var f=this.anchor,g=this.focus,h=g.offset,k=0,m=d.getTextContent().length;for(var l=0;l<b.length;l++){var n=b[l];if(A(n)){k=n.getFormatFlags(a,
75
75
  null);break}}var r=f.offset;n=(l=f.isBefore(g))?r:h;l=l?h:r;if(n===d.getTextContentSize()){let q=d.getNextSibling();B(q)&&q.isInline()&&(q=q.getFirstChild());A(q)&&(n=r=0,d=q,m=q.getTextContent().length,k=d.getFormatFlags(a,null))}if(d.is(e))A(d)&&("element"===f.type&&"element"===g.type?(d.setFormat(k),d.select(n,l),this.format=k):(n=r>h?h:r,l=r>h?r:h,n!==l&&(0===n&&l===m?(d.setFormat(k),d.select(n,l)):(a=d.splitText(n,l),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,l-n)),this.format=k)));else for(A(d)&&
76
76
  (0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),f=k,A(e)&&(f=e.getFormatFlags(a,k),k=e.getTextContent().length,0!==l&&(l!==k&&([e]=e.splitText(l)),e.setFormat(f))),k=1;k<c;k++)l=b[k],g=l.__key,A(l)&&g!==d.__key&&g!==e.__key&&!l.isToken()&&(g=l.getFormatFlags(a,f),l.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,e=c.getNode(),f=e;"element"===c.type&&(f=c.getNode(),c=f.getChildAtIndex(d-1),f=null===c?f:c);c=[];var g=e.getNextSiblings(),h=M(e)?null:e.getTopLevelElementOrThrow();
77
77
  if(A(e))if(f=e.getTextContent().length,0===d&&0!==f)f=e.getPreviousSibling(),f=null!==f?f:e.getParentOrThrow(),c.push(e);else if(d===f)f=e;else{if(C(e))return!1;[f,e]=e.splitText(d);c.push(e)}let k=f;c.push(...g);g=a[0];var m=!1;e=null;for(let r=0;r<a.length;r++){let q=a[r];if(B(q)&&!q.isInline()){if(q.is(g)){if(B(f)&&f.isEmpty()&&f.canReplaceWith(q)){f.replace(q);f=q;m=!0;continue}var l=q.getFirstDescendant();if(Ra(l)){for(l=l.getParentOrThrow();l.isInline();)l=l.getParentOrThrow();m=l.getChildren();
78
78
  var n=m.length;if(B(f))for(let w=0;w<n;w++)e=m[w],f.append(e);else{for(--n;0<=n;n--)e=m[n],f.insertAfter(e);f=f.getParentOrThrow()}l.remove();m=!0;if(l.is(q))continue}}A(f)&&(null===h&&p(27),f=h)}else m&&!x(q)&&M(f.getParent())&&p(28);m=!1;if(B(f)&&!f.isInline())if(e=q,x(q)&&q.isTopLevel())f=f.insertAfter(q);else if(B(q)){if(q.canBeEmpty()||!q.isEmpty())M(f)?(l=f.getChildAtIndex(d),null!==l?l.insertBefore(q):f.append(q),f=q):f=f.insertAfter(q)}else l=f.getFirstChild(),null!==l?l.insertBefore(q):f.append(q),
79
79
  f=q;else!B(q)||B(q)&&q.isInline()||x(f)&&f.isTopLevel()?(e=q,f=f.insertAfter(q)):(f=q.getParentOrThrow(),r--)}b&&(A(k)?k.select():(a=f.getPreviousSibling(),A(a)?a.select():(a=f.getIndexWithinParent(),f.getParentOrThrow().select(a,a))));if(B(f)){if(a=A(e)?e:f.getLastDescendant(),b||(null===a?f.select():A(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),B(f)&&!B(a)?(f.append(a),f=a):B(f)||B(a)?B(a)&&!a.canInsertAfter(f)?(h=d.constructor.clone(d),B(h)||
80
80
  p(29),h.append(a),f.insertAfter(h)):f.insertAfter(a):(f.insertBefore(a),f=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(A(f)?f.select():(c=f.getParentOrThrow(),f=f.getIndexWithinParent()+1,c.select(f,f)));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&&
81
- (c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(M(f)){e=Zc();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=f.getParentOrThrow(),e=c.insertNewAfter(this),B(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(B(g))if(h=f.getFirstChild(),0===
82
- 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(),g.remove())}}insertLineBreak(a){let b=jd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return ed(this)}extract(){var a=
83
- 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]=ed(this);if(0===b)return[];if(1===b)return A(f)?(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);A(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));A(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=jb(d,b);x(g)&&!g.isIsolated()?
81
+ (c=f.getNextSiblings()),b===h||g&&b===d.getTextContentSize()||([,d]=d.splitText(b),e.push(d)))}else{f=a.getNode();if(M(f)){e=ad();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=f.getParentOrThrow(),e=c.insertNewAfter(this),B(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(B(g))if(h=f.getFirstChild(),0===
82
+ 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(),g.remove())}}insertLineBreak(a){let b=kd();var c=this.anchor;"element"===c.type&&(c=c.getNode(),M(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}getCharacterOffsets(){return fd(this)}extract(){var a=
83
+ 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]=fd(this);if(0===b)return[];if(1===b)return A(f)?(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);A(f)&&(d=b?h:k,d===f.getTextContentSize()?a.shift():0!==d&&([,f]=f.splitText(d),a[0]=f));A(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=jb(d,b);x(g)&&!g.isIsolated()?
84
84
  (a=b?g.getPreviousSibling():g.getNextSibling(),A(a)?(g=a.__key,b=b?a.getTextContent().length:0,d.set(g,b,"text"),f&&e.set(g,b,"text")):(c=g.getParentOrThrow(),B(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"))):(d=window.getSelection(),d.modify(a,b?"backward":"forward",c),0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),this.dirty=!0,f||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(f=this.focus,
85
85
  b=this.anchor,d=b.key,e=b.offset,g=b.type,X(b,f.key,f.offset,f.type),X(f,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&&b.offset===d.getChildrenSize()||"text"===b.type&&b.offset===d.getTextContentSize())&&(d=d.getNextSibling()||d.getParentOrThrow().getNextSibling(),B(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var e="text"===c.type?c.getNode():null;
86
- 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){ld(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)){ld(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),bb(b)||(a?e.offset=f:d.offset=f))}}else if(a&&
87
- 0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function ad(a){return a instanceof $c}function md(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}
88
- function ed(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]:[md(b),md(a)]}function ld(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))}
89
- function nd(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=ab(e[d]);if(A(e))d=g?e.getTextContentSize():0;else{f=ab(a);if(null===f)return null;if(B(f)){a=f.getChildAtIndex(d);if(b=B(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()));A(a)?(e=a,f=null,d=g?a.getTextContentSize():0):a!==f&&g&&d++}else d=f.getIndexWithinParent(),
86
+ 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){md(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)){md(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),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||
87
+ (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()&&this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function Pc(a){return a instanceof bd}
88
+ function nd(a){let b=a.offset;if("text"===a.type)return b;a=a.getNode();return b===a.getChildrenSize()?a.getTextContent().length:0}function fd(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]:[nd(b),nd(a)]}
89
+ function md(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))}
90
+ function od(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=ab(e[d]);if(A(e))d=g?e.getTextContentSize():0;else{f=ab(a);if(null===f)return null;if(B(f)){a=f.getChildAtIndex(d);if(b=B(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()));A(a)?(e=a,f=null,d=g?a.getTextContentSize():0):a!==f&&g&&d++}else d=f.getIndexWithinParent(),
90
91
  d=0===b&&x(f)&&ab(a)===f?d:d+1,f=f.getParentOrThrow();if(B(f))return new U(f.__key,d,"element")}}else e=ab(a);return A(e)?new U(e.__key,d,"text"):null}
91
- function od(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&B(e)&&e.isInline()&&(b=e.getPreviousSibling(),A(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):B(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):A(d)&&!d.isInert()&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&B(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type=
92
- "element"):(c||b)&&null===d&&B(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),A(b)&&(a.key=b.__key,a.offset=0)))}function kd(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);od(a,d,e);od(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&K(c)&&(d=c.anchor,c=c.focus,X(a,d.key,d.offset,d.type),X(b,c.key,c.offset,c.type))}}
93
- function id(a,b,c,d,e,f){if(null===a||null===c||!Ma(e,a,c))return null;b=nd(a,b,K(f)?f.anchor:null);if(null===b)return null;d=nd(c,d,K(f)?f.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=ab(a),c=ab(c),x(a)&&x(c)))return null;kd(b,d,f);return[b,d]}function pd(a,b,c,d,e,f){let g=D();a=new bd(new U(a,b,e),new U(c,d,f),0);a.dirty=!0;return g._selection=a}function qd(a){let b=a.getEditorState()._selection,c=window.getSelection();return ad(b)||dd(b)?b.clone():rd(b,c,a)}
94
- function rd(a,b,c){var d=window.event,e=d?d.type:void 0;let f="selectionchange"===e;d=!va&&(f||"beforeinput"===e||"compositionstart"===e||"compositionend"===e||"click"===e&&d&&3===d.detail||void 0===e);let g;if(!K(a)||d){if(null===b)return null;d=b.anchorNode;e=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(f&&K(a)&&!Ma(c,d,e))return a.clone()}else return a.clone();c=id(d,g,e,b,c,a);if(null===c)return null;let [h,k]=c;return new bd(h,k,K(a)?a.format:0)}function u(){return D()._selection}
92
+ function pd(a,b,c){var d=a.offset,e=a.getNode();0===d?(d=e.getPreviousSibling(),e=e.getParent(),b)?(c||!b)&&null===d&&B(e)&&e.isInline()&&(b=e.getPreviousSibling(),A(b)&&(a.key=b.__key,a.offset=b.getTextContent().length)):B(d)&&!c&&d.isInline()?(a.key=d.__key,a.offset=d.getChildrenSize(),a.type="element"):A(d)&&!d.isInert()&&(a.key=d.__key,a.offset=d.getTextContent().length):d===e.getTextContent().length&&(d=e.getNextSibling(),e=e.getParent(),b&&B(d)&&d.isInline()?(a.key=d.__key,a.offset=0,a.type=
93
+ "element"):(c||b)&&null===d&&B(e)&&e.isInline()&&!e.canInsertTextAfter()&&(b=e.getNextSibling(),A(b)&&(a.key=b.__key,a.offset=0)))}function ld(a,b,c){if("text"===a.type&&"text"===b.type){var d=a.isBefore(b);let e=a.is(b);pd(a,d,e);pd(b,!d,e);e&&(b.key=a.key,b.offset=a.offset,b.type=a.type);d=F();d.isComposing()&&d._compositionKey!==a.key&&K(c)&&(d=c.anchor,c=c.focus,X(a,d.key,d.offset,d.type),X(b,c.key,c.offset,c.type))}}
94
+ function jd(a,b,c,d,e,f){if(null===a||null===c||!Ka(e,a,c))return null;b=od(a,b,K(f)?f.anchor:null);if(null===b)return null;d=od(c,d,K(f)?f.focus:null);if(null===d||"element"===b.type&&"element"===d.type&&(a=ab(a),c=ab(c),x(a)&&x(c)))return null;ld(b,d,f);return[b,d]}function qd(a,b,c,d,e,f){let g=D();a=new cd(new U(a,b,e),new U(c,d,f),0);a.dirty=!0;return g._selection=a}function rd(a){let b=a.getEditorState()._selection,c=window.getSelection();return Pc(b)||ed(b)?b.clone():Qc(b,c,a)}
95
+ function Qc(a,b,c){var d=window.event,e=d?d.type:void 0;let f="selectionchange"===e;d=!va&&(f||"beforeinput"===e||"compositionstart"===e||"compositionend"===e||"click"===e&&d&&3===d.detail||void 0===e);let g;if(!K(a)||d){if(null===b)return null;d=b.anchorNode;e=b.focusNode;g=b.anchorOffset;b=b.focusOffset;if(f&&K(a)&&!Ka(c,d,e))return a.clone()}else return a.clone();c=jd(d,g,e,b,c,a);if(null===c)return null;let [h,k]=c;return new cd(h,k,K(a)?a.format:0)}function u(){return D()._selection}
95
96
  function eb(){return F()._editorState._selection}function sd(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"),td(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"));td(a)}}
96
97
  function td(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())B(f)&&(g=f.getChildrenSize(),g=(e=c>=g)?f.getChildAtIndex(g-1):f.getChildAtIndex(c),A(g)&&(c=0,e&&(c=g.getTextContentSize()),b.set(g.__key,c,"text"),d.set(g.__key,c,"text")));else{if(B(f)){let h=f.getChildrenSize();c=(a=c>=h)?f.getChildAtIndex(h-1):f.getChildAtIndex(c);A(c)&&(f=0,a&&(f=c.getTextContentSize()),b.set(c.__key,f,"text"))}B(g)&&(c=g.getChildrenSize(),e=(b=e>=c)?g.getChildAtIndex(c-
97
98
  1):g.getChildAtIndex(e),A(e)&&(g=0,b&&(g=e.getTextContentSize()),d.set(e.__key,g,"text")))}}function Ad(a,b){b=b.getEditorState()._selection;a=a._selection;if(K(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))}}
@@ -100,15 +101,15 @@ function D(){null===Y&&p(15);return Y}function F(){null===Z&&p(16);return Z}func
100
101
  function Gd(a,b){let c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;let e=F()._compositionKey,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),A(g)&&g.isAttached()&&g.isSimpleText()&&!g.isUnmergeable()&&sb(g),void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Ed(b,g,f),c.add(l);g=b._dirtyLeaves;h=g.size;if(0<h){Wa++;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),
101
102
  void 0!==g&&void 0!==g&&g.__key!==e&&g.isAttached()&&Ed(b,g,f),d.set(k,m);g=b._dirtyLeaves;h=g.size;k=b._dirtyElements;m=k.size;Wa++}b._dirtyLeaves=c;b._dirtyElements=d}function Hd(a,b){var c=a.type,d=b.get(c);void 0===d&&p(17,c);c=d.klass;a.type!==c.getType()&&p(18,c.name);c=c.importJSON(a);a=a.children;if(B(c)&&Array.isArray(a))for(d=0;d<a.length;d++){let e=Hd(a[d],b);c.append(e)}return c}function Id(a,b){let c=Y,d=W,e=Z;Y=a;W=!0;Z=null;try{return b()}finally{Y=c,W=d,Z=e}}
102
103
  function Jd(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=W,l=Z,n=a._updating,r=a._observer,q=null;a._pendingEditorState=null;a._editorState=b;if(!d&&h&&null!==r){Z=a;Y=b;W=!1;a._updating=!0;try{var w=a._dirtyType,y=a._dirtyElements,E=a._dirtyLeaves;r.disconnect();O=P=N="";vb=2===w;yb=null;Q=a;tb=a._config;ub=a._nodes;xb=Q._listeners.mutation;zb=y;Ab=E;Bb=e._nodeMap;Cb=b._nodeMap;
103
- wb=b._readOnly;Db=new Map(a._keyToDOMMap);var z=new Map;Eb=z;Rb("root",null);Eb=Db=tb=Cb=Bb=Ab=zb=ub=Q=void 0;q=z}catch(pa){a._onError(pa);Dd||(Kd(a,null,c,b),Ha(a),a._dirtyType=2,Dd=!0,Jd(a),Dd=!1);return}finally{r.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,W=m,Z=l}}b._readOnly=!0;n=a._dirtyLeaves;r=a._dirtyElements;z=a._normalizedNodes;w=a._updateTags;E=a._pendingDecorators;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
104
- new Map,a._normalizedNodes=new Set,a._updateTags=new Set);y=a._decorators;var H=a._pendingDecorators||y,V=b._nodeMap;for(Ja in H)V.has(Ja)||(H===y&&(H=Xa(a)),delete H[Ja]);d=d?null:window.getSelection();if(!a._readOnly&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let pa=d.anchorNode,lb=d.focusNode,he=d.anchorOffset,ie=d.focusOffset,mb=document.activeElement;if(!w.has("collaboration")||mb===c)if(K(g)){var da=g.anchor,Sb=g.focus,ud=da.key,qa=Sb.key,vd=nb(a,ud),wd=nb(a,qa),Tb=da.offset,xd=Sb.offset,
105
- Ub=g.format,yd=g.isCollapsed();h=vd;qa=wd;var Ja=!1;"text"===da.type&&(h=Pa(vd),Ja=da.getNode().getFormat()!==Ub);"text"===Sb.type&&(qa=Pa(wd));if(null!==h&&null!==qa){if(yd&&(null===f||Ja||K(f)&&f.format!==Ub)){var je=performance.now();Nc=[Ub,Tb,ud,je]}if(he===Tb&&ie===xd&&pa===h&&lb===qa&&("Range"!==d.type||!yd)&&(null!==mb&&c.contains(mb)||c.focus({preventScroll:!0}),!ia&&!ha||"element"!==da.type))break a;try{d.setBaseAndExtent(h,Tb,qa,xd);if(g.isCollapsed()&&c===mb){let Ka=da.getNode();if(B(Ka)){let ea=
106
- Ka.getDescendantByIndex(da.offset);null!==ea&&(Ka=ea)}let ra=a.getElementByKey(Ka.__key);if(null!==ra){let ea=ra.getBoundingClientRect();if(ea.bottom>window.innerHeight)ra.scrollIntoView(!1);else if(0>ea.top)ra.scrollIntoView();else{let zd=c.getBoundingClientRect();ea.bottom>zd.bottom?ra.scrollIntoView(!1):ea.top<zd.top&&ra.scrollIntoView()}w.add("scroll-into-view")}}Kc=!0}catch(Ka){}}}else null!==f&&Ma(a,pa,lb)&&d.removeAllRanges()}}finally{Z=l,Y=k}}null!==q&&Ld(a,e,b,q);null!==E&&(a._decorators=
107
- E,a._pendingDecorators=null,Md("decorator",a,!0,E));c=Ya(e);f=Ya(b);c!==f&&Md("textcontent",a,!0,f);Md("update",a,!0,{dirtyElements:r,dirtyLeaves:n,editorState:b,normalizedNodes:z,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){let [pa,lb]=b.shift();Nd(a,pa,lb)}}}function Ld(a,b,c,d){a._listeners.mutation.forEach((e,f)=>{e=d.get(e);void 0!==e&&f(e)})}
108
- function Md(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}}function T(a,b,c){if(!1===a._updating||Z!==a){let f=!1;a.update(()=>{f=T(a,b,c)});return f}let d=cb(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))for(let h of e)if(!0===h(c,a))return!0}return!1}
109
- function Od(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){let [d,e]=c.shift(),f,g;void 0!==e&&(f=e.onUpdate,g=e.tag,e.skipTransforms&&(b=!0),f&&a._deferred.push(f),g&&a._updateTags.add(g));d()}return b}
110
- function Nd(a,b,c){let d=a._updateTags;var e=!1;if(void 0!==c){var f=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms}f&&a._deferred.push(f);c=a._editorState;f=a._pendingEditorState;let g=!1;null===f&&(f=a._pendingEditorState=new Pd(new Map(c._nodeMap)),g=!0);let h=Y,k=W,m=Z,l=a._updating;Y=f;W=!1;a._updating=!0;Z=a;try{g&&!a._headless&&(f._selection=qd(a));let n=a._compositionKey;b();e=Od(a,e);Ad(f,a);0!==a._dirtyType&&(e?Fd(f,a):Gd(f,a),Od(a),pb(c,f,a._dirtyLeaves,a._dirtyElements));n!==
111
- a._compositionKey&&(f._flushSync=!0);let r=f._selection;if(K(r)){let q=f._nodeMap,w=r.focus.key;void 0!==q.get(r.anchor.key)&&void 0!==q.get(w)||p(19)}else ad(r)&&0===r._nodes.size&&(f._selection=null)}catch(n){a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Jd(a);return}finally{Y=h,W=k,Z=m,a._updating=l,Wa=0}0!==a._dirtyType||Qd(f,a)?f._flushSync?(f._flushSync=!1,Jd(a)):g&&La(()=>{Jd(a)}):(f._flushSync=!1,g&&(d.clear(),
104
+ wb=b._readOnly;Db=new Map(a._keyToDOMMap);var z=new Map;Eb=z;Rb("root",null);Eb=Db=tb=Cb=Bb=Ab=zb=ub=Q=void 0;q=z}catch(da){a._onError(da);if(Dd)throw da;Kd(a,null,c,b);Ha(a);a._dirtyType=2;Dd=!0;Jd(a);Dd=!1;return}finally{r.observe(c,{characterData:!0,childList:!0,subtree:!0}),a._updating=n,Y=k,W=m,Z=l}}b._readOnly=!0;n=a._dirtyLeaves;r=a._dirtyElements;z=a._normalizedNodes;w=a._updateTags;E=a._pendingDecorators;m=a._deferred;h&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=
105
+ new Map,a._normalizedNodes=new Set,a._updateTags=new Set);y=a._decorators;var G=a._pendingDecorators||y,V=b._nodeMap;for(La in G)V.has(La)||(G===y&&(G=Xa(a)),delete G[La]);d=d?null:window.getSelection();if(!a._readOnly&&null!==d&&(h||null===g||g.dirty)){Z=a;Y=b;try{a:{let da=d.anchorNode,lb=d.focusNode,he=d.anchorOffset,ie=d.focusOffset,mb=document.activeElement;if(!w.has("collaboration")||mb===c)if(K(g)){var ea=g.anchor,Ub=g.focus,ud=ea.key,sa=Ub.key,vd=nb(a,ud),wd=nb(a,sa),Vb=ea.offset,xd=Ub.offset,
106
+ Wb=g.format,yd=g.isCollapsed();h=vd;sa=wd;var La=!1;"text"===ea.type&&(h=Pa(vd),La=ea.getNode().getFormat()!==Wb);"text"===Ub.type&&(sa=Pa(wd));if(null!==h&&null!==sa){if(yd&&(null===f||La||K(f)&&f.format!==Wb)){var je=performance.now();Nc=[Wb,Vb,ud,je]}if(he===Vb&&ie===xd&&da===h&&lb===sa&&("Range"!==d.type||!yd)&&(null!==mb&&c.contains(mb)||c.focus({preventScroll:!0}),!ja&&!ia||"element"!==ea.type))break a;try{d.setBaseAndExtent(h,Vb,sa,xd);if(g.isCollapsed()&&c===mb){let Ma=ea.getNode();if(B(Ma)){let fa=
107
+ Ma.getDescendantByIndex(ea.offset);null!==fa&&(Ma=fa)}let ta=a.getElementByKey(Ma.__key);if(null!==ta){let fa=ta.getBoundingClientRect();if(fa.bottom>window.innerHeight)ta.scrollIntoView(!1);else if(0>fa.top)ta.scrollIntoView();else{let zd=c.getBoundingClientRect();Math.floor(fa.bottom)>Math.floor(zd.bottom)?ta.scrollIntoView(!1):Math.floor(fa.top)<Math.floor(zd.top)&&ta.scrollIntoView()}w.add("scroll-into-view")}}Kc=!0}catch(Ma){}}}else null!==f&&Ka(a,da,lb)&&d.removeAllRanges()}}finally{Z=l,Y=k}}null!==
108
+ q&&Ld(a,e,b,q);null!==E&&(a._decorators=E,a._pendingDecorators=null,Md("decorator",a,!0,E));c=Ya(e);f=Ya(b);c!==f&&Md("textcontent",a,!0,f);Md("update",a,!0,{dirtyElements:r,dirtyLeaves:n,editorState:b,normalizedNodes:z,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){let [da,lb]=b.shift();Nd(a,da,lb)}}}
109
+ function Ld(a,b,c,d){a._listeners.mutation.forEach((e,f)=>{e=d.get(e);void 0!==e&&f(e)})}function Md(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}}
110
+ function T(a,b,c){if(!1===a._updating||Z!==a){let f=!1;a.update(()=>{f=T(a,b,c)});return f}let d=bb(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))for(let h of e)if(!0===h(c,a))return!0}return!1}function Od(a,b){let c=a._updates;for(b=b||!1;0!==c.length;){let [d,e]=c.shift(),f,g;void 0!==e&&(f=e.onUpdate,g=e.tag,e.skipTransforms&&(b=!0),f&&a._deferred.push(f),g&&a._updateTags.add(g));d()}return b}
111
+ function Nd(a,b,c){let d=a._updateTags;var e=!1;if(void 0!==c){var f=c.onUpdate;e=c.tag;null!=e&&d.add(e);e=c.skipTransforms}f&&a._deferred.push(f);c=a._editorState;f=a._pendingEditorState;let g=!1;null===f&&(f=a._pendingEditorState=new Pd(new Map(c._nodeMap)),g=!0);let h=Y,k=W,m=Z,l=a._updating;Y=f;W=!1;a._updating=!0;Z=a;try{g&&!a._headless&&(f._selection=rd(a));let n=a._compositionKey;b();e=Od(a,e);Ad(f,a);0!==a._dirtyType&&(e?Fd(f,a):Gd(f,a),Od(a),pb(c,f,a._dirtyLeaves,a._dirtyElements));n!==
112
+ a._compositionKey&&(f._flushSync=!0);let r=f._selection;if(K(r)){let q=f._nodeMap,w=r.focus.key;void 0!==q.get(r.anchor.key)&&void 0!==q.get(w)||p(19)}else Pc(r)&&0===r._nodes.size&&(f._selection=null)}catch(n){a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Jd(a);return}finally{Y=h,W=k,Z=m,a._updating=l,Wa=0}0!==a._dirtyType||Qd(f,a)?f._flushSync?(f._flushSync=!1,Jd(a)):g&&Ja(()=>{Jd(a)}):(f._flushSync=!1,g&&(d.clear(),
112
113
  a._deferred=[],a._pendingEditorState=null))}function v(a,b,c){a._updating?a._updates.push([b,c]):Nd(a,b,c)}
113
114
  function Rd(a,b,c){I();var d=a.__key;let e=a.getParent();if(null!==e){var f=u(),g=!1;if(K(f)&&b){var h=f.anchor;let k=f.focus;h.key===d&&(Bd(h,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0);k.key===d&&(Bd(k,a,e,a.getPreviousSibling(),a.getNextSibling()),g=!0)}h=e.getWritable().__children;d=h.indexOf(d);-1===d&&p(31);Ua(a);h.splice(d,1);a.getWritable().__parent=null;K(f)&&b&&!g&&sd(f,e,d,-1);c||null===e||M(e)||e.canBeEmpty()||!e.isEmpty()||Rd(e,b);null!==e&&M(e)&&e.isEmpty()&&e.selectEnd()}}
114
115
  function Sd(a){let b=J(a);null===b&&p(63,a);return b}
@@ -119,56 +120,58 @@ this;for(;null!==a;){let b=a.getParent();if(M(b)&&B(a))return a;a=b}return null}
119
120
  b.unshift(this);B(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;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);
120
121
  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===a)break;f=B(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&&p(68),e=
121
122
  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=F()._dirtyLeaves;return null!==a&&a.has(this.__key)}getLatest(){let a=J(this.__key);null===a&&p(69);return a}getWritable(){I();var a=D(),b=F();a=a._nodeMap;let c=this.__key,d=this.getLatest(),e=d.__parent;b=b._cloneNotNeeded;var f=u();null!==f&&(f._cachedNodes=null);if(b.has(c))return Va(d),d;f=d.constructor.clone(d);f.__parent=e;B(d)&&
122
- B(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):A(d)&&A(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Va(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){p(70)}updateDOM(){p(71)}exportDOM(a){return x(this)?(a=a.getElementByKey(this.getKey()),{element:a?a.cloneNode():null}):{element:this.createDOM(a._config,
123
- a)}}static importDOM(){return null}exportJSON(){p(72)}static importJSON(){p(18,this.name)}remove(a){I();Rd(this,!0,a)}replace(a){I();let b=this.__key;a=a.getWritable();Ta(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let e=d.indexOf(this.__key),f=a.__key;-1===e&&p(31);d.splice(e,0,f);a.__parent=c.__key;Rd(this,!1);Ua(a);d=u();K(d)&&(c=d.anchor,d=d.focus,c.key===b&&Xc(c,a),d.key===b&&Xc(d,a));F()._compositionKey===b&&G(f);return a}insertAfter(a){I();var b=this.getWritable(),c=a.getWritable(),
124
- d=c.getParent();let e=u();var f=a.getIndexWithinParent(),g=!1,h=!1;null!==d&&(Ta(c),K(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&&p(31);k.splice(b+1,0,d);Ua(c);K(e)&&(sd(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){I();var b=this.getWritable(),
125
- c=a.getWritable();Ta(c);let d=this.getParentOrThrow().getWritable(),e=c.__key;c.__parent=b.__parent;let f=d.__children;b=f.indexOf(b.__key);-1===b&&p(31);f.splice(b,0,e);Ua(c);c=u();K(c)&&sd(c,d,b);return a}selectPrevious(a,b){I();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):B(c)?c.select():A(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():B(c)?
126
- c.select(0,0):A(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}class Ud extends Td{constructor(a){super(a)}decorate(){p(47)}isIsolated(){return!1}isTopLevel(){return!1}}function x(a){return a instanceof Ud}
127
- class Vd extends Td{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 sa[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=J(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
123
+ B(f)?(f.__children=Array.from(d.__children),f.__indent=d.__indent,f.__format=d.__format,f.__dir=d.__dir):A(d)&&A(f)&&(f.__format=d.__format,f.__style=d.__style,f.__mode=d.__mode,f.__detail=d.__detail);b.add(c);f.__key=c;Va(f);a.set(c,f);return f}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){p(70)}updateDOM(){p(71)}exportDOM(a){let b=this.createDOM(a._config,a),c=this.exportJSON();b.setAttribute("data-lexical-node-type",this.__type);b.setAttribute("data-lexical-node-json",
124
+ JSON.stringify(c));b.setAttribute("data-lexical-editor-key",a._key);return{element:b}}static importDOM(){let a=this.prototype.constructor;return{"*":b=>{if(!(b instanceof HTMLElement))return null;let c=b.getAttribute("data-lexical-editor-key"),d=b.getAttribute("data-lexical-node-type");if(null==c||null==d)return null;let e=F();if(c===e.getKey()&&d===a.getType())try{let f=b.getAttribute("data-lexical-node-json");if(null!=f){let g=JSON.parse(f),h=a.importJSON(g);return{conversion:()=>({node:h}),priority:4}}}catch{}return null}}}exportJSON(){p(72)}static importJSON(){p(18,
125
+ this.name)}remove(a){I();Rd(this,!0,a)}replace(a){I();let b=this.__key;a=a.getWritable();Ta(a);var c=this.getParentOrThrow(),d=c.getWritable().__children;let e=d.indexOf(this.__key),f=a.__key;-1===e&&p(31);d.splice(e,0,f);a.__parent=c.__key;Rd(this,!1);Ua(a);d=u();K(d)&&(c=d.anchor,d=d.focus,c.key===b&&Zc(c,a),d.key===b&&Zc(d,a));F()._compositionKey===b&&H(f);return a}insertAfter(a){I();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();let e=u();var f=a.getIndexWithinParent(),g=!1,h=!1;null!==
126
+ d&&(Ta(c),K(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&&p(31);k.splice(b+1,0,d);Ua(c);K(e)&&(sd(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){I();var b=this.getWritable(),c=a.getWritable();Ta(c);let d=this.getParentOrThrow().getWritable(),
127
+ e=c.__key;c.__parent=b.__parent;let f=d.__children;b=f.indexOf(b.__key);-1===b&&p(31);f.splice(b,0,e);Ua(c);c=u();K(c)&&sd(c,d,b);return a}selectPrevious(a,b){I();let c=this.getPreviousSibling(),d=this.getParentOrThrow();return null===c?d.select(0,0):B(c)?c.select():A(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();let c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():B(c)?c.select(0,0):A(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,
128
+ a))}markDirty(){this.getWritable()}}class Ud extends Td{constructor(a){super(a)}decorate(){p(47)}isIsolated(){return!1}isTopLevel(){return!1}}function x(a){return a instanceof Ud}
129
+ class Vd extends Td{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 qa[a]||""}getIndent(){return this.getLatest().__indent}getChildren(){let a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){let d=J(a[c]);null!==d&&b.push(d)}return b}getChildrenKeys(){return this.getLatest().__children}getChildrenSize(){return this.getLatest().__children.length}isEmpty(){return 0===
128
130
  this.getChildrenSize()}isDirty(){let a=F()._dirtyElements;return null!==a&&a.has(this.__key)}isLastChild(){let a=this.getLatest();return a.getParentOrThrow().getLastChild()===a}getAllTextNodes(a){let b=[],c=this.getLatest().__children;for(let e=0;e<c.length;e++){var d=J(c[e]);!A(d)||!a&&d.isInert()?B(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(B(a)){let b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=
129
131
  this.getLastChild();for(;null!==a;){if(B(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],B(a)&&a.getLastDescendant()||a||null;a=b[a];return B(a)&&a.getFirstDescendant()||a||null}getFirstChild(){let a=this.getLatest().__children;return 0===a.length?null:J(a[0])}getFirstChildOrThrow(){let a=this.getFirstChild();null===a&&p(45,this.__key);return a}getLastChild(){let a=this.getLatest().__children,
130
- b=a.length;return 0===b?null:J(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:J(a)}getTextContent(a,b){let c="",d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){let g=d[f];c+=g.getTextContent(a,b);B(g)&&f!==e-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=oa[a];return 0!==(this.getFormat()&a)}select(a,b){I();let c=u();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(K(c))c.anchor.set(d,
131
- a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return pd(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return B(a)||A(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return B(a)||A(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){I();
132
- let b=this.getWritable();b.__dir=a;return b}setFormat(a){I();this.getWritable().__format=oa[a]||0;return this}setIndent(a){I();this.getWritable().__indent=a;return this}splice(a,b,c){I();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&&p(46);Ta(l);l.__parent=e;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Va(c);(e=this.getChildAtIndex(a+b))&&Va(e);a===f.length?(f.push(...h),a=[]):a=f.splice(a,b,...h);if(a.length&&
132
+ b=a.length;return 0===b?null:J(a[b-1])}getChildAtIndex(a){a=this.getLatest().__children[a];return void 0===a?null:J(a)}getTextContent(a,b){let c="",d=this.getChildren(),e=d.length;for(let f=0;f<e;f++){let g=d[f];c+=g.getTextContent(a,b);B(g)&&f!==e-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.getLatest().__dir}hasFormat(a){a=pa[a];return 0!==(this.getFormat()&a)}select(a,b){I();let c=u();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(K(c))c.anchor.set(d,
133
+ a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return qd(d,a,d,b,"element","element");return c}selectStart(){let a=this.getFirstDescendant();return B(a)||A(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){let a=this.getLastDescendant();return B(a)||A(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();let a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();return this.splice(this.getChildrenSize(),0,a)}setDirection(a){I();
134
+ let b=this.getWritable();b.__dir=a;return b}setFormat(a){I();this.getWritable().__format=pa[a]||0;return this}setIndent(a){I();this.getWritable().__indent=a;return this}splice(a,b,c){I();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&&p(46);Ta(l);l.__parent=e;h.push(l.__key)}(c=this.getChildAtIndex(a-1))&&Va(c);(e=this.getChildAtIndex(a+b))&&Va(e);a===f.length?(f.push(...h),a=[]):a=f.splice(a,b,...h);if(a.length&&
133
135
  (b=u(),K(b))){let k=new Set(a),m=new Set(h);h=r=>{for(r=r.getNode();r;){const q=r.__key;if(k.has(q)&&!m.has(q))return!0;r=r.getParent()}return!1};let {anchor:l,focus:n}=b;h(l)&&Bd(l,l.getNode(),this,c,e);h(n)&&Bd(n,n.getNode(),this,c,e);h=a.length;for(b=0;b<h;b++)c=J(a[b]),null!=c&&(c.getWritable().__parent=null);0!==f.length||this.canBeEmpty()||M(this)||this.remove()}return d}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"element",
134
136
  version:1}}insertNewAfter(){return null}canInsertTab(){return!1}canIndent(){return!0}collapseAtStart(){return!1}excludeFromCopy(){return!1}canExtractContents(){return!0}canReplaceWith(){return!0}canInsertAfter(){return!0}canBeEmpty(){return!0}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}isInline(){return!1}canMergeWith(){return!1}extractWithChild(){return!1}}function B(a){return a instanceof Vd}
135
137
  class Wd extends Vd{static getType(){return"root"}static clone(){return new Wd}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){p(51)}getTextContent(a,b){let c=this.__cachedText;return!W&&0!==F()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){p(52)}replace(){p(53)}insertBefore(){p(54)}insertAfter(){p(55)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){let c=a[b];B(c)||x(c)||p(56)}return super.append(...a)}static importJSON(a){let b=
136
138
  Za();b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{children:[],direction:this.getDirection(),format:this.getFormatType(),indent:this.getIndent(),type:"root",version:1}}}function M(a){return a instanceof Wd}function Qd(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 Xd(){return new Pd(new Map([["root",new Wd]]))}
137
139
  function Yd(a){let b=a.exportJSON();var c=a.constructor;b.type!==c.getType()&&p(58,c.name);let d=b.children;if(B(a))for(Array.isArray(d)||p(59,c.name),a=a.getChildren(),c=0;c<a.length;c++){let e=Yd(a[c]);d.push(e)}return b}
138
140
  class Pd{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 Id(this,a)}clone(a){a=new Pd(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){return Id(this,()=>({root:Yd(Za())}))}}
139
- class Zd extends Td{static getType(){return"linebreak"}static clone(a){return new Zd(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:$d,priority:0}}}}static importJSON(){return jd()}exportJSON(){return{type:"linebreak",version:1}}}function $d(){return{node:jd()}}function jd(){return new Zd}
141
+ class Zd extends Td{static getType(){return"linebreak"}static clone(a){return new Zd(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:$d,priority:0}}}}static importJSON(){return kd()}exportJSON(){return{type:"linebreak",version:1}}}function $d(){return{node:kd()}}function kd(){return new Zd}
140
142
  function Sa(a){return a instanceof Zd}function ae(a,b){return b&16?"code":b&32?"sub":b&64?"sup":null}function be(a,b){return b&1?"strong":b&2?"em":"span"}
141
- function ce(a,b,c,d,e){a=d.classList;d=gb(e,"base");void 0!==d&&a.add(...d);d=gb(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 na)h=na[k],d=gb(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))}
142
- function de(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?ja:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){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}
143
+ function ce(a,b,c,d,e){a=d.classList;d=gb(e,"base");void 0!==d&&a.add(...d);d=gb(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 oa)h=oa[k],d=gb(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))}
144
+ function de(a,b,c){let d=b.firstChild;c=c.isComposing();a+=c?ka:"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c||ca){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}
143
145
  class ee extends Td{static getType(){return"text"}static clone(a){return new ee(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 ua[a.__mode]}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isComposing(){return this.__key===F()._compositionKey}isSegmented(){return 2===
144
- this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=na[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Qa(c,a,b)}createDOM(a){var b=this.__format,
146
+ this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==(this.getLatest().__detail&2)}hasFormat(a){a=oa[a];return 0!==(this.getFormat()&a)}isSimpleText(){return"text"===this.__type&&0===this.__mode}getTextContent(a,b){return!a&&this.isInert()||!1===b&&this.isDirectionless()?"":this.getLatest().__text}getFormatFlags(a,b){let c=this.getLatest().__format;return Qa(c,a,b)}createDOM(a){var b=this.__format,
145
147
  c=ae(this,b);let d=be(this,b),e=document.createElement(null===c?d:c),f=e;null!==c&&(f=document.createElement(d),e.appendChild(f));c=f;de(this.__text,c,this);a=a.theme.text;void 0!==a&&ce(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=ae(this,e);let h=ae(this,f);var k=be(this,e);let m=be(this,f);if((null===g?k:g)!==(null===h?m:h))return!0;if(g===h&&k!==m)return e=b.firstChild,null==e&&p(48),a=g=document.createElement(m),
146
148
  de(d,a,this),c=c.theme.text,void 0!==c&&ce(m,0,f,a,c),b.replaceChild(g,e),!1;k=b;null!==h&&null!==g&&(k=b.firstChild,null==k&&p(49));de(d,k,this);c=c.theme.text;void 0!==c&&e!==f&&ce(m,e,f,k,c);f=this.__style;a.__style!==f&&(b.style.cssText=f);return!1}static importDOM(){return{"#text":()=>({conversion:fe,priority:0}),b:()=>({conversion:ge,priority:0}),em:()=>({conversion:ke,priority:0}),i:()=>({conversion:ke,priority:0}),span:()=>({conversion:le,priority:0}),strong:()=>({conversion:ke,priority:0}),
147
149
  u:()=>({conversion:ke,priority:0})}}static importJSON(a){let b=L(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{detail:this.getDetail(),format:this.getFormat(),mode:this.getMode(),style:this.getStyle(),text:this.getTextContent(),type:"text",version:1}}selectionTransform(){}setFormat(a){I();let b=this.getWritable();b.__format=a;return b}setDetail(a){I();let b=this.getWritable();b.__detail=a;return b}setStyle(a){I();let b=this.getWritable();
148
- b.__style=a;return b}toggleFormat(a){a=na[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){I();let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){I();let a=this.getWritable();a.__detail^=2;return a}setMode(a){I();a=ta[a];let b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();let b=this.getWritable();b.__text=a;return b}select(a,b){I();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&
149
- (b=d)):b=a=0;if(K(c))d=F()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||G(e),c.setTextNodeRange(this,a,this,b);else return pd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){I();let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&K(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){I();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,
150
+ b.__style=a;return b}toggleFormat(a){a=oa[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){I();let a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){I();let a=this.getWritable();a.__detail^=2;return a}setMode(a){I();a=ra[a];let b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();let b=this.getWritable();b.__text=a;return b}select(a,b){I();let c=u();var d=this.getTextContent();let e=this.__key;"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&
151
+ (b=d)):b=a=0;if(K(c))d=F()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||H(e),c.setTextNodeRange(this,a,this,b);else return qd(e,a,e,b,"text","text");return c}spliceText(a,b,c,d){I();let e=this.getWritable(),f=e.__text,g=c.length,h=a;0>h&&(h=g+h,0>h&&(h=0));let k=u();d&&K(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){I();var b=this.getLatest(),c=b.getTextContent(),d=b.__key,
150
152
  e=F()._compositionKey,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);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(),r=b.__detail;g=!1;b.isSegmented()?(h=L(m),h.__parent=k,h.__format=l,h.__style=n,h.__detail=r,g=!0):(h=b.getWritable(),h.__text=m);b=u();h=[h];m=m.length;for(let y=1;y<f;y++){var q=a[y],w=q.length;q=L(q).getWritable();q.__format=l;
151
- q.__style=n;q.__detail=r;let E=q.__key;w=m+w;if(K(b)){let z=b.anchor,H=b.focus;z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=w&&(z.key=E,z.offset-=m,b.dirty=!0);H.key===d&&"text"===H.type&&H.offset>m&&H.offset<=w&&(H.key=E,H.offset-=m,b.dirty=!0)}e===d&&G(E);m=w;q.__parent=k;h.push(q)}Ua(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);K(b)&&sd(b,c,d,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();
152
- b||a===this.getNextSibling()||p(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;F()._compositionKey===d&&G(c);let g=u();if(K(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Cd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Cd(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}}
153
+ q.__style=n;q.__detail=r;let E=q.__key;w=m+w;if(K(b)){let z=b.anchor,G=b.focus;z.key===d&&"text"===z.type&&z.offset>m&&z.offset<=w&&(z.key=E,z.offset-=m,b.dirty=!0);G.key===d&&"text"===G.type&&G.offset>m&&G.offset<=w&&(G.key=E,G.offset-=m,b.dirty=!0)}e===d&&H(E);m=w;q.__parent=k;h.push(q)}Ua(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);K(b)&&sd(b,c,d,f-1);return h}mergeWithSibling(a){var b=a===this.getPreviousSibling();
154
+ b||a===this.getNextSibling()||p(50);var c=this.__key;let d=a.__key,e=this.__text,f=e.length;F()._compositionKey===d&&H(c);let g=u();if(K(g)){let h=g.anchor,k=g.focus;null!==h&&h.key===d&&(Cd(h,b,c,a,f),g.dirty=!0);null!==k&&k.key===d&&(Cd(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}}
153
155
  function le(a){let b="700"===a.style.fontWeight,c="line-through"===a.style.textDecoration,d="italic"===a.style.fontStyle;return{forChild:e=>{A(e)&&b&&e.toggleFormat("bold");A(e)&&c&&e.toggleFormat("strikethrough");A(e)&&d&&e.toggleFormat("italic");return e},node:null}}function ge(a){let b="normal"===a.style.fontWeight;return{forChild:c=>{A(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function fe(a){return{node:L(a.textContent)}}let me={em:"italic",i:"italic",strong:"bold",u:"underline"};
154
156
  function ke(a){let b=me[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{A(c)&&c.toggleFormat(b);return c},node:null}}function L(a=""){return new ee(a)}function A(a){return a instanceof ee}
155
- class ne extends Vd{static getType(){return"paragraph"}static clone(a){return new ne(a.__key)}createDOM(a){let b=document.createElement("p");a=gb(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&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}static importJSON(a){let b=Zc();b.setFormat(a.format);b.setIndent(a.indent);
156
- b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=Zc(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||A(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}
157
- function oe(){return{node:Zc()}}function Zc(){return new ne}function Kd(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=Xd();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))}
158
- function pe(a){let b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM;if(!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}
157
+ class ne extends Vd{static getType(){return"paragraph"}static clone(a){return new ne(a.__key)}createDOM(a){let b=document.createElement("p");a=gb(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&&0===this.getTextContentSize()&&a.append(document.createElement("br"));return{element:a}}static importJSON(a){let b=ad();b.setFormat(a.format);b.setIndent(a.indent);
158
+ b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),type:"paragraph",version:1}}insertNewAfter(){let a=ad(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){let a=this.getChildren();if(0===a.length||A(a[0])&&""===a[0].getTextContent().trim()){if(null!==this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}
159
+ function oe(){return{node:ad()}}function ad(){return new ne}function Kd(a,b,c,d){let e=a._keyToDOMMap;e.clear();a._editorState=Xd();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))}
160
+ function pe(a){let b=new Map,c=new Set;a.forEach(d=>{d=d.klass.importDOM.bind(d.klass);if(!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}
159
161
  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,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._commands=new Map;this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
160
- new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+Ia++;this._onError=e;this._htmlConversions=f;this._headless=this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){let b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;b.add(a);return()=>
162
+ new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=cb();this._onError=e;this._htmlConversions=f;this._headless=this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){let b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){let b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){let b=this._listeners.decorator;b.add(a);return()=>
161
163
  {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&&p(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&&p(36,String(a));let f=e[c];f.add(b);return()=>{f.delete(b);e.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
162
164
  b){void 0===this._nodes.get(a.getType())&&p(37,a.name);let c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){let c=a.getType(),d=this._nodes.get(c);void 0===d&&p(37,a.name);let e=d.transforms;e.add(b);$a(this,c);return()=>{e.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 T(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}getKey(){return this._key}setRootElement(a){let b=
163
- this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Kd(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Jc&&(Jc--,0===Jc&&b.ownerDocument.removeEventListener("selectionchange",Uc));c=b.__lexicalEditor;if(null!==c||void 0!==c){if(null!==c._parentEditor){var d=cb(c);d=d[d.length-1]._key;Tc.get(d)===c&&Tc.delete(d)}else Tc.delete(c._key);b.__lexicalEditor=null}c=Sc(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,
164
- c.userSelect="text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Ha(this),this._updateTags.add("history-merge"),Jd(this),this._config.disableEvents||Vc(a,this));Md("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&p(38);Ga(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=
165
+ this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Kd(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Jc&&(Jc--,0===Jc&&b.ownerDocument.removeEventListener("selectionchange",Wc));c=b.__lexicalEditor;if(null!==c||void 0!==c){if(null!==c._parentEditor){var d=bb(c);d=d[d.length-1]._key;Vc.get(d)===c&&Vc.delete(d)}else Vc.delete(c._key);b.__lexicalEditor=null}c=Uc(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,
166
+ c.userSelect="text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Ha(this),this._updateTags.add("history-merge"),Jd(this),this._config.disableEvents||Xc(a,this));Md("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&p(38);Ga(this);let c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=
165
167
  b&&d.add(b),Jd(this));this._pendingEditorState=a;this._dirtyType=2;this._dirtyElements.set("root",!1);this._compositionKey=null;null!=b&&d.add(b);Jd(this)}parseEditorState(a,b){a="string"===typeof a?JSON.parse(a):a;let c=Xd(),d=Y,e=W,f=Z,g=this._dirtyElements,h=this._dirtyLeaves,k=this._cloneNotNeeded,m=this._dirtyType;this._dirtyElements=new Map;this._dirtyLeaves=new Set;this._cloneNotNeeded=new Set;this._dirtyType=0;Y=c;W=!1;Z=this;try{Hd(a.root,this._nodes),b&&b(),c._readOnly=!0}finally{this._dirtyElements=
166
168
  g,this._dirtyLeaves=h,this._cloneNotNeeded=k,this._dirtyType=m,Y=d,W=e,Z=f}return c}update(a,b){v(this,a,b)}focus(a){let b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),v(this,()=>{let c=u(),d=Za();null!==c?c.dirty=!0:0!==d.getChildrenSize()&&d.selectEnd()},{onUpdate:()=>{b.removeAttribute("autocapitalize");a&&a()}}))}blur(){var a=this._rootElement;null!==a&&a.blur();a=window.getSelection();null!==a&&a.removeAllRanges()}isReadOnly(){return this._readOnly}setReadOnly(a){this._readOnly=
167
- a;Md("readonly",this,!0,a)}toJSON(){return{editorState:this._editorState}}}class re extends Vd{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function hd(a){return a instanceof re}class se extends Vd{}function fd(a){return a instanceof se}class te extends Vd{}function gd(a){return a instanceof te}exports.$createGridSelection=function(){let a=new U("root",0,"element"),b=new U("root",0,"element");return new cd("root",a,b)};
168
- exports.$createLineBreakNode=jd;exports.$createNodeSelection=function(){return new $c(new Set)};exports.$createParagraphNode=Zc;exports.$createRangeSelection=function(){let a=new U("root",0,"element"),b=new U("root",0,"element");return new bd(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=jb;exports.$getNearestNodeFromDOMNode=Ba;exports.$getNodeByKey=J;exports.$getPreviousSelection=eb;exports.$getRoot=Za;exports.$getSelection=u;exports.$isDecoratorNode=x;exports.$isElementNode=B;
169
- exports.$isGridCellNode=hd;exports.$isGridNode=fd;exports.$isGridRowNode=gd;exports.$isGridSelection=dd;exports.$isLeafNode=Ra;exports.$isLineBreakNode=Sa;exports.$isNodeSelection=ad;exports.$isParagraphNode=function(a){return a instanceof ne};exports.$isRangeSelection=K;exports.$isRootNode=M;exports.$isTextNode=A;exports.$nodesOfType=function(a){var b=D();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};
170
- exports.$parseSerializedNode=function(a){return Hd(a,F()._nodes)};exports.$setCompositionKey=G;exports.$setSelection=Ea;exports.BLUR_COMMAND=zc;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Wb;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=$b;
169
+ a;Md("readonly",this,!0,a)}toJSON(){return{editorState:this._editorState}}}class re extends Vd{constructor(a,b){super(b);this.__colSpan=a}exportJSON(){return{...super.exportJSON(),colSpan:this.__colSpan}}}function id(a){return a instanceof re}class se extends Vd{}function gd(a){return a instanceof se}class te extends Vd{}function hd(a){return a instanceof te}exports.$createGridSelection=function(){let a=new U("root",0,"element"),b=new U("root",0,"element");return new dd("root",a,b)};
170
+ exports.$createLineBreakNode=kd;exports.$createNodeSelection=function(){return new bd(new Set)};exports.$createParagraphNode=ad;exports.$createRangeSelection=function(){let a=new U("root",0,"element"),b=new U("root",0,"element");return new cd(a,b,0)};exports.$createTextNode=L;exports.$getDecoratorNode=jb;exports.$getNearestNodeFromDOMNode=Ba;exports.$getNodeByKey=J;exports.$getPreviousSelection=eb;exports.$getRoot=Za;exports.$getSelection=u;exports.$isDecoratorNode=x;exports.$isElementNode=B;
171
+ exports.$isGridCellNode=id;exports.$isGridNode=gd;exports.$isGridRowNode=hd;exports.$isGridSelection=ed;exports.$isLeafNode=Ra;exports.$isLineBreakNode=Sa;exports.$isNodeSelection=Pc;exports.$isParagraphNode=function(a){return a instanceof ne};exports.$isRangeSelection=K;exports.$isRootNode=M;exports.$isTextNode=A;exports.$nodesOfType=function(a){var b=D();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};
172
+ exports.$parseSerializedNode=function(a){return Hd(a,F()._nodes)};exports.$setCompositionKey=H;exports.$setSelection=Ea;exports.BLUR_COMMAND=zc;exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Tb;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=$b;
171
173
  exports.COPY_COMMAND=wc;exports.CUT_COMMAND=xc;exports.DELETE_CHARACTER_COMMAND=Xb;exports.DELETE_LINE_COMMAND=dc;exports.DELETE_WORD_COMMAND=cc;exports.DRAGEND_COMMAND=vc;exports.DRAGOVER_COMMAND=uc;exports.DRAGSTART_COMMAND=tc;exports.DROP_COMMAND=sc;exports.DecoratorNode=Ud;exports.ElementNode=Vd;exports.FOCUS_COMMAND=yc;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=R;exports.GridCellNode=re;exports.GridNode=se;exports.GridRowNode=te;exports.INDENT_CONTENT_COMMAND={};
172
174
  exports.INSERT_LINE_BREAK_COMMAND=Yb;exports.INSERT_PARAGRAPH_COMMAND=Zb;exports.KEY_ARROW_DOWN_COMMAND=lc;exports.KEY_ARROW_LEFT_COMMAND=ic;exports.KEY_ARROW_RIGHT_COMMAND=gc;exports.KEY_ARROW_UP_COMMAND=kc;exports.KEY_BACKSPACE_COMMAND=oc;exports.KEY_DELETE_COMMAND=qc;exports.KEY_ENTER_COMMAND=mc;exports.KEY_ESCAPE_COMMAND=pc;exports.KEY_MODIFIER_COMMAND=Ac;exports.KEY_SPACE_COMMAND=nc;exports.KEY_TAB_COMMAND=rc;exports.LineBreakNode=Zd;exports.MOVE_TO_END=hc;exports.MOVE_TO_START=jc;
173
- exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ac;exports.ParagraphNode=ne;exports.REDO_COMMAND=fc;exports.REMOVE_TEXT_COMMAND=bc;exports.RootNode=Wd;exports.SELECTION_CHANGE_COMMAND=Vb;exports.TextNode=ee;exports.UNDO_COMMAND=ec;exports.VERSION="0.3.0";exports.createCommand=function(){return{}};
174
- exports.createEditor=function(a={}){var b=a.theme||{};let c=a.parentEditor||null,d=a.disableEvents||!1,e=Xd(),f=a.editorState,g=[Wd,ee,Zd,ne,...(a.nodes||[])],h=a.onError;a=a.readOnly||!1;let k=new Map;for(let m=0;m<g.length;m++){let l=g[m],n=l.getType();k.set(n,{klass:l,transforms:new Set})}b=new qe(e,c,k,{disableEvents:d,theme:b},h,pe(k),a);void 0!==f&&(b._pendingEditorState=f,b._dirtyType=2);return b}
175
+ exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=ac;exports.ParagraphNode=ne;exports.REDO_COMMAND=fc;exports.REMOVE_TEXT_COMMAND=bc;exports.RootNode=Wd;exports.SELECTION_CHANGE_COMMAND=Sb;exports.TextNode=ee;exports.UNDO_COMMAND=ec;exports.VERSION="0.3.3";exports.createCommand=function(){return{}};
176
+ 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=Xd(),h=b.namespace||(null!==e?e._config.namespace:cb()),k=b.editorState,m=[Wd,ee,Zd,ne,...(b.nodes||[])],l=b.onError;b=b.readOnly||!1;if(void 0===a&&null!==c)a=c._nodes;else for(a=new Map,c=0;c<m.length;c++){let n=m[c],r=n.getType();a.set(r,{klass:n,transforms:new Set})}d=new qe(g,e,a,{disableEvents:f,namespace:h,theme:d},l,pe(a),b);void 0!==k&&(d._pendingEditorState=k,d._dirtyType=
177
+ 2);return d}
package/README.md CHANGED
@@ -37,6 +37,7 @@ An editor instance can be created from the `lexical` package and accepts an opti
37
37
  import {createEditor} from 'lexical';
38
38
 
39
39
  const config = {
40
+ namespace: 'MyEditor',
40
41
  theme: {
41
42
  ...
42
43
  },
package/package.json CHANGED
@@ -9,12 +9,15 @@
9
9
  "rich-text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.3.0",
12
+ "version": "0.3.3",
13
13
  "main": "Lexical.js",
14
14
  "typings": "Lexical.d.ts",
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "https://github.com/facebook/lexical",
18
18
  "directory": "packages/lexical"
19
+ },
20
+ "devDependencies": {
21
+ "utility-types": "^3.10.0"
19
22
  }
20
23
  }