lexical 0.1.17 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Lexical.dev.js +56 -58
- package/Lexical.prod.js +151 -153
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var lexical = require('lexical');
|
|
10
|
-
|
|
11
9
|
/**
|
|
12
10
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
13
11
|
*
|
|
@@ -6571,7 +6569,7 @@ function onSelectionChange(domSelection, editor, isActive) {
|
|
|
6571
6569
|
}
|
|
6572
6570
|
}
|
|
6573
6571
|
|
|
6574
|
-
editor.dispatchCommand(
|
|
6572
|
+
editor.dispatchCommand(SELECTION_CHANGE_COMMAND);
|
|
6575
6573
|
});
|
|
6576
6574
|
} // This is a work-around is mainly Chrome specific bug where if you select
|
|
6577
6575
|
// the contents of an empty block, you cannot easily unselect anything.
|
|
@@ -6597,7 +6595,7 @@ function onClick(event, editor) {
|
|
|
6597
6595
|
}
|
|
6598
6596
|
}
|
|
6599
6597
|
|
|
6600
|
-
editor.dispatchCommand(
|
|
6598
|
+
editor.dispatchCommand(CLICK_COMMAND, event);
|
|
6601
6599
|
});
|
|
6602
6600
|
}
|
|
6603
6601
|
|
|
@@ -6638,7 +6636,7 @@ function onBeforeInput(event, editor) {
|
|
|
6638
6636
|
// Used for Android
|
|
6639
6637
|
$setCompositionKey(null);
|
|
6640
6638
|
event.preventDefault();
|
|
6641
|
-
editor.dispatchCommand(
|
|
6639
|
+
editor.dispatchCommand(DELETE_CHARACTER_COMMAND, true);
|
|
6642
6640
|
return;
|
|
6643
6641
|
}
|
|
6644
6642
|
|
|
@@ -6656,10 +6654,10 @@ function onBeforeInput(event, editor) {
|
|
|
6656
6654
|
if (inputType === 'insertText') {
|
|
6657
6655
|
if (data === '\n') {
|
|
6658
6656
|
event.preventDefault();
|
|
6659
|
-
editor.dispatchCommand(
|
|
6657
|
+
editor.dispatchCommand(INSERT_LINE_BREAK_COMMAND);
|
|
6660
6658
|
} else if (data === '\n\n') {
|
|
6661
6659
|
event.preventDefault();
|
|
6662
|
-
editor.dispatchCommand(
|
|
6660
|
+
editor.dispatchCommand(INSERT_PARAGRAPH_COMMAND);
|
|
6663
6661
|
} else if (data == null && event.dataTransfer) {
|
|
6664
6662
|
// Gets around a Safari text replacement bug.
|
|
6665
6663
|
const text = event.dataTransfer.getData('text/plain');
|
|
@@ -6667,7 +6665,7 @@ function onBeforeInput(event, editor) {
|
|
|
6667
6665
|
selection.insertRawText(text);
|
|
6668
6666
|
} else if (data != null && $shouldPreventDefaultAndInsertText(selection, data, true)) {
|
|
6669
6667
|
event.preventDefault();
|
|
6670
|
-
editor.dispatchCommand(
|
|
6668
|
+
editor.dispatchCommand(INSERT_TEXT_COMMAND, data);
|
|
6671
6669
|
}
|
|
6672
6670
|
|
|
6673
6671
|
return;
|
|
@@ -6683,7 +6681,7 @@ function onBeforeInput(event, editor) {
|
|
|
6683
6681
|
case 'insertFromDrop':
|
|
6684
6682
|
case 'insertReplacementText':
|
|
6685
6683
|
{
|
|
6686
|
-
editor.dispatchCommand(
|
|
6684
|
+
editor.dispatchCommand(INSERT_TEXT_COMMAND, event);
|
|
6687
6685
|
break;
|
|
6688
6686
|
}
|
|
6689
6687
|
|
|
@@ -6691,7 +6689,7 @@ function onBeforeInput(event, editor) {
|
|
|
6691
6689
|
{
|
|
6692
6690
|
// This is the end of composition
|
|
6693
6691
|
$setCompositionKey(null);
|
|
6694
|
-
editor.dispatchCommand(
|
|
6692
|
+
editor.dispatchCommand(INSERT_TEXT_COMMAND, event);
|
|
6695
6693
|
break;
|
|
6696
6694
|
}
|
|
6697
6695
|
|
|
@@ -6699,7 +6697,7 @@ function onBeforeInput(event, editor) {
|
|
|
6699
6697
|
{
|
|
6700
6698
|
// Used for Android
|
|
6701
6699
|
$setCompositionKey(null);
|
|
6702
|
-
editor.dispatchCommand(
|
|
6700
|
+
editor.dispatchCommand(INSERT_LINE_BREAK_COMMAND);
|
|
6703
6701
|
break;
|
|
6704
6702
|
}
|
|
6705
6703
|
|
|
@@ -6707,21 +6705,21 @@ function onBeforeInput(event, editor) {
|
|
|
6707
6705
|
{
|
|
6708
6706
|
// Used for Android
|
|
6709
6707
|
$setCompositionKey(null);
|
|
6710
|
-
editor.dispatchCommand(
|
|
6708
|
+
editor.dispatchCommand(INSERT_PARAGRAPH_COMMAND);
|
|
6711
6709
|
break;
|
|
6712
6710
|
}
|
|
6713
6711
|
|
|
6714
6712
|
case 'insertFromPaste':
|
|
6715
6713
|
case 'insertFromPasteAsQuotation':
|
|
6716
6714
|
{
|
|
6717
|
-
editor.dispatchCommand(
|
|
6715
|
+
editor.dispatchCommand(PASTE_COMMAND, event);
|
|
6718
6716
|
break;
|
|
6719
6717
|
}
|
|
6720
6718
|
|
|
6721
6719
|
case 'deleteByComposition':
|
|
6722
6720
|
{
|
|
6723
6721
|
if ($canRemoveText(anchorNode, focusNode)) {
|
|
6724
|
-
editor.dispatchCommand(
|
|
6722
|
+
editor.dispatchCommand(REMOVE_TEXT_COMMAND);
|
|
6725
6723
|
}
|
|
6726
6724
|
|
|
6727
6725
|
break;
|
|
@@ -6730,32 +6728,32 @@ function onBeforeInput(event, editor) {
|
|
|
6730
6728
|
case 'deleteByDrag':
|
|
6731
6729
|
case 'deleteByCut':
|
|
6732
6730
|
{
|
|
6733
|
-
editor.dispatchCommand(
|
|
6731
|
+
editor.dispatchCommand(REMOVE_TEXT_COMMAND);
|
|
6734
6732
|
break;
|
|
6735
6733
|
}
|
|
6736
6734
|
|
|
6737
6735
|
case 'deleteContent':
|
|
6738
6736
|
{
|
|
6739
|
-
editor.dispatchCommand(
|
|
6737
|
+
editor.dispatchCommand(DELETE_CHARACTER_COMMAND, false);
|
|
6740
6738
|
break;
|
|
6741
6739
|
}
|
|
6742
6740
|
|
|
6743
6741
|
case 'deleteWordBackward':
|
|
6744
6742
|
{
|
|
6745
|
-
editor.dispatchCommand(
|
|
6743
|
+
editor.dispatchCommand(DELETE_WORD_COMMAND, true);
|
|
6746
6744
|
break;
|
|
6747
6745
|
}
|
|
6748
6746
|
|
|
6749
6747
|
case 'deleteWordForward':
|
|
6750
6748
|
{
|
|
6751
|
-
editor.dispatchCommand(
|
|
6749
|
+
editor.dispatchCommand(DELETE_WORD_COMMAND, false);
|
|
6752
6750
|
break;
|
|
6753
6751
|
}
|
|
6754
6752
|
|
|
6755
6753
|
case 'deleteHardLineBackward':
|
|
6756
6754
|
case 'deleteSoftLineBackward':
|
|
6757
6755
|
{
|
|
6758
|
-
editor.dispatchCommand(
|
|
6756
|
+
editor.dispatchCommand(DELETE_LINE_COMMAND, true);
|
|
6759
6757
|
break;
|
|
6760
6758
|
}
|
|
6761
6759
|
|
|
@@ -6763,43 +6761,43 @@ function onBeforeInput(event, editor) {
|
|
|
6763
6761
|
case 'deleteHardLineForward':
|
|
6764
6762
|
case 'deleteSoftLineForward':
|
|
6765
6763
|
{
|
|
6766
|
-
editor.dispatchCommand(
|
|
6764
|
+
editor.dispatchCommand(DELETE_LINE_COMMAND, false);
|
|
6767
6765
|
break;
|
|
6768
6766
|
}
|
|
6769
6767
|
|
|
6770
6768
|
case 'formatStrikeThrough':
|
|
6771
6769
|
{
|
|
6772
|
-
editor.dispatchCommand(
|
|
6770
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'strikethrough');
|
|
6773
6771
|
break;
|
|
6774
6772
|
}
|
|
6775
6773
|
|
|
6776
6774
|
case 'formatBold':
|
|
6777
6775
|
{
|
|
6778
|
-
editor.dispatchCommand(
|
|
6776
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
|
|
6779
6777
|
break;
|
|
6780
6778
|
}
|
|
6781
6779
|
|
|
6782
6780
|
case 'formatItalic':
|
|
6783
6781
|
{
|
|
6784
|
-
editor.dispatchCommand(
|
|
6782
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'italic');
|
|
6785
6783
|
break;
|
|
6786
6784
|
}
|
|
6787
6785
|
|
|
6788
6786
|
case 'formatUnderline':
|
|
6789
6787
|
{
|
|
6790
|
-
editor.dispatchCommand(
|
|
6788
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline');
|
|
6791
6789
|
break;
|
|
6792
6790
|
}
|
|
6793
6791
|
|
|
6794
6792
|
case 'historyUndo':
|
|
6795
6793
|
{
|
|
6796
|
-
editor.dispatchCommand(
|
|
6794
|
+
editor.dispatchCommand(UNDO_COMMAND);
|
|
6797
6795
|
break;
|
|
6798
6796
|
}
|
|
6799
6797
|
|
|
6800
6798
|
case 'historyRedo':
|
|
6801
6799
|
{
|
|
6802
|
-
editor.dispatchCommand(
|
|
6800
|
+
editor.dispatchCommand(REDO_COMMAND);
|
|
6803
6801
|
break;
|
|
6804
6802
|
}
|
|
6805
6803
|
|
|
@@ -6815,7 +6813,7 @@ function onInput(event, editor) {
|
|
|
6815
6813
|
const data = event.data;
|
|
6816
6814
|
|
|
6817
6815
|
if (data != null && $isRangeSelection(selection) && $shouldPreventDefaultAndInsertText(selection, data, false)) {
|
|
6818
|
-
editor.dispatchCommand(
|
|
6816
|
+
editor.dispatchCommand(INSERT_TEXT_COMMAND, data);
|
|
6819
6817
|
} else {
|
|
6820
6818
|
$updateSelectedTextFromDOM(editor, null);
|
|
6821
6819
|
} // Also flush any other mutations that might have occured
|
|
@@ -6839,7 +6837,7 @@ function onCompositionStart(event, editor) {
|
|
|
6839
6837
|
// to get inserted into the new node we create. If
|
|
6840
6838
|
// we don't do this, Safari will fail on us because
|
|
6841
6839
|
// there is no text node matching the selection.
|
|
6842
|
-
editor.dispatchCommand(
|
|
6840
|
+
editor.dispatchCommand(INSERT_TEXT_COMMAND, ' ');
|
|
6843
6841
|
}
|
|
6844
6842
|
}
|
|
6845
6843
|
});
|
|
@@ -6886,64 +6884,64 @@ function onKeyDown(event, editor) {
|
|
|
6886
6884
|
} = event;
|
|
6887
6885
|
|
|
6888
6886
|
if (isMoveForward(keyCode, ctrlKey, shiftKey, altKey, metaKey)) {
|
|
6889
|
-
editor.dispatchCommand(
|
|
6887
|
+
editor.dispatchCommand(KEY_ARROW_RIGHT_COMMAND, event);
|
|
6890
6888
|
} else if (isMoveBackward(keyCode, ctrlKey, shiftKey, altKey, metaKey)) {
|
|
6891
|
-
editor.dispatchCommand(
|
|
6889
|
+
editor.dispatchCommand(KEY_ARROW_LEFT_COMMAND, event);
|
|
6892
6890
|
} else if (isMoveUp(keyCode, ctrlKey, shiftKey, altKey, metaKey)) {
|
|
6893
|
-
editor.dispatchCommand(
|
|
6891
|
+
editor.dispatchCommand(KEY_ARROW_UP_COMMAND, event);
|
|
6894
6892
|
} else if (isMoveDown(keyCode, ctrlKey, shiftKey, altKey, metaKey)) {
|
|
6895
|
-
editor.dispatchCommand(
|
|
6893
|
+
editor.dispatchCommand(KEY_ARROW_DOWN_COMMAND, event);
|
|
6896
6894
|
} else if (isLineBreak(keyCode, shiftKey)) {
|
|
6897
|
-
editor.dispatchCommand(
|
|
6895
|
+
editor.dispatchCommand(KEY_ENTER_COMMAND, event);
|
|
6898
6896
|
} else if (isOpenLineBreak(keyCode, ctrlKey)) {
|
|
6899
6897
|
event.preventDefault();
|
|
6900
|
-
editor.dispatchCommand(
|
|
6898
|
+
editor.dispatchCommand(INSERT_LINE_BREAK_COMMAND, true);
|
|
6901
6899
|
} else if (isParagraph(keyCode, shiftKey)) {
|
|
6902
|
-
editor.dispatchCommand(
|
|
6900
|
+
editor.dispatchCommand(KEY_ENTER_COMMAND, event);
|
|
6903
6901
|
} else if (isDeleteBackward(keyCode, altKey, metaKey, ctrlKey)) {
|
|
6904
6902
|
if (isBackspace(keyCode)) {
|
|
6905
|
-
editor.dispatchCommand(
|
|
6903
|
+
editor.dispatchCommand(KEY_BACKSPACE_COMMAND, event);
|
|
6906
6904
|
} else {
|
|
6907
|
-
editor.dispatchCommand(
|
|
6905
|
+
editor.dispatchCommand(DELETE_CHARACTER_COMMAND, true);
|
|
6908
6906
|
}
|
|
6909
6907
|
} else if (isEscape(keyCode)) {
|
|
6910
|
-
editor.dispatchCommand(
|
|
6908
|
+
editor.dispatchCommand(KEY_ESCAPE_COMMAND, event);
|
|
6911
6909
|
} else if (isDeleteForward(keyCode, ctrlKey, shiftKey, altKey, metaKey)) {
|
|
6912
6910
|
if (isDelete(keyCode)) {
|
|
6913
|
-
editor.dispatchCommand(
|
|
6911
|
+
editor.dispatchCommand(KEY_DELETE_COMMAND, event);
|
|
6914
6912
|
} else {
|
|
6915
6913
|
event.preventDefault();
|
|
6916
|
-
editor.dispatchCommand(
|
|
6914
|
+
editor.dispatchCommand(DELETE_CHARACTER_COMMAND, false);
|
|
6917
6915
|
}
|
|
6918
6916
|
} else if (isDeleteWordBackward(keyCode, altKey, ctrlKey)) {
|
|
6919
6917
|
event.preventDefault();
|
|
6920
|
-
editor.dispatchCommand(
|
|
6918
|
+
editor.dispatchCommand(DELETE_WORD_COMMAND, true);
|
|
6921
6919
|
} else if (isDeleteWordForward(keyCode, altKey, ctrlKey)) {
|
|
6922
6920
|
event.preventDefault();
|
|
6923
|
-
editor.dispatchCommand(
|
|
6921
|
+
editor.dispatchCommand(DELETE_WORD_COMMAND, false);
|
|
6924
6922
|
} else if (isDeleteLineBackward(keyCode, metaKey)) {
|
|
6925
6923
|
event.preventDefault();
|
|
6926
|
-
editor.dispatchCommand(
|
|
6924
|
+
editor.dispatchCommand(DELETE_LINE_COMMAND, true);
|
|
6927
6925
|
} else if (isDeleteLineForward(keyCode, metaKey)) {
|
|
6928
6926
|
event.preventDefault();
|
|
6929
|
-
editor.dispatchCommand(
|
|
6927
|
+
editor.dispatchCommand(DELETE_LINE_COMMAND, false);
|
|
6930
6928
|
} else if (isBold(keyCode, metaKey, ctrlKey)) {
|
|
6931
6929
|
event.preventDefault();
|
|
6932
|
-
editor.dispatchCommand(
|
|
6930
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'bold');
|
|
6933
6931
|
} else if (isUnderline(keyCode, metaKey, ctrlKey)) {
|
|
6934
6932
|
event.preventDefault();
|
|
6935
|
-
editor.dispatchCommand(
|
|
6933
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'underline');
|
|
6936
6934
|
} else if (isItalic(keyCode, metaKey, ctrlKey)) {
|
|
6937
6935
|
event.preventDefault();
|
|
6938
|
-
editor.dispatchCommand(
|
|
6936
|
+
editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'italic');
|
|
6939
6937
|
} else if (isTab(keyCode, altKey, ctrlKey, metaKey)) {
|
|
6940
|
-
editor.dispatchCommand(
|
|
6938
|
+
editor.dispatchCommand(KEY_TAB_COMMAND, event);
|
|
6941
6939
|
} else if (isUndo(keyCode, shiftKey, metaKey, ctrlKey)) {
|
|
6942
6940
|
event.preventDefault();
|
|
6943
|
-
editor.dispatchCommand(
|
|
6941
|
+
editor.dispatchCommand(UNDO_COMMAND);
|
|
6944
6942
|
} else if (isRedo(keyCode, shiftKey, metaKey, ctrlKey)) {
|
|
6945
6943
|
event.preventDefault();
|
|
6946
|
-
editor.dispatchCommand(
|
|
6944
|
+
editor.dispatchCommand(REDO_COMMAND);
|
|
6947
6945
|
}
|
|
6948
6946
|
}
|
|
6949
6947
|
|
|
@@ -7017,25 +7015,25 @@ function addRootElementEvents(rootElement, editor) {
|
|
|
7017
7015
|
if (!editor.isReadOnly()) {
|
|
7018
7016
|
switch (eventName) {
|
|
7019
7017
|
case 'cut':
|
|
7020
|
-
return editor.dispatchCommand(
|
|
7018
|
+
return editor.dispatchCommand(CUT_COMMAND, event);
|
|
7021
7019
|
|
|
7022
7020
|
case 'copy':
|
|
7023
|
-
return editor.dispatchCommand(
|
|
7021
|
+
return editor.dispatchCommand(COPY_COMMAND, event);
|
|
7024
7022
|
|
|
7025
7023
|
case 'paste':
|
|
7026
|
-
return editor.dispatchCommand(
|
|
7024
|
+
return editor.dispatchCommand(PASTE_COMMAND, event);
|
|
7027
7025
|
|
|
7028
7026
|
case 'dragstart':
|
|
7029
|
-
return editor.dispatchCommand(
|
|
7027
|
+
return editor.dispatchCommand(DRAGSTART_COMMAND, event);
|
|
7030
7028
|
|
|
7031
7029
|
case 'focus':
|
|
7032
|
-
return editor.dispatchCommand(
|
|
7030
|
+
return editor.dispatchCommand(FOCUS_COMMAND, event);
|
|
7033
7031
|
|
|
7034
7032
|
case 'blur':
|
|
7035
|
-
return editor.dispatchCommand(
|
|
7033
|
+
return editor.dispatchCommand(BLUR_COMMAND, event);
|
|
7036
7034
|
|
|
7037
7035
|
case 'drop':
|
|
7038
|
-
return editor.dispatchCommand(
|
|
7036
|
+
return editor.dispatchCommand(DROP_COMMAND, event);
|
|
7039
7037
|
}
|
|
7040
7038
|
}
|
|
7041
7039
|
};
|
|
@@ -8393,7 +8391,7 @@ class LexicalEditor {
|
|
|
8393
8391
|
*
|
|
8394
8392
|
*
|
|
8395
8393
|
*/
|
|
8396
|
-
const VERSION = '0.1.
|
|
8394
|
+
const VERSION = '0.1.18';
|
|
8397
8395
|
|
|
8398
8396
|
/**
|
|
8399
8397
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
package/Lexical.prod.js
CHANGED
|
@@ -4,168 +4,166 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
function q(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
8
|
const aa=RegExp("^[^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]"),da=RegExp("^[^\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]"),ea={bold:1,code:16,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},fa={center:2,justify:4,left:1,right:3},ha={inert:3,normal:0,
|
|
9
|
-
segmented:2,token:1},ja="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ka=ja&&"documentMode"in document?document.documentMode:null,
|
|
10
|
-
function pa(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function qa(a,b){for(;null!=a;){const c=ya(a,b);if(null!==c)return c;a=a.parentNode}return null}function za(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Aa(a){return a.read(()=>Ba().getTextContent())}function Ca(a,b){Da(a,()=>{var c=
|
|
14
|
-
function Ea(a){
|
|
15
|
-
function Ia(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=qa(c),
|
|
16
|
-
function Ja(a,b,c,d,f){if(a.isAttached()&&(f||!a.isDirty())){var e=a.isComposing();let g=b;(e||f)&&"\u200b"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(f||g!==b)""===g?(e&&
|
|
17
|
-
function La(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=
|
|
18
|
-
b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||e):b=!1);return b}function Ma(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Na(a,b,c,d,f){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&
|
|
19
|
-
function Oa(a,b,c){const d=a.getParent();let f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function
|
|
20
|
-
function
|
|
21
|
-
function
|
|
22
|
-
function Xa(a,b){const c=a.mergeWithSibling(b),d=
|
|
23
|
-
function Za(a,b){
|
|
24
|
-
function bb(a){const b=
|
|
25
|
-
class cb{static getType(){
|
|
26
|
-
|
|
27
|
-
this;for(;null!==a;){const b=a.getParent();if(
|
|
28
|
-
b?null:
|
|
29
|
-
a.getParents();
|
|
30
|
-
b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const 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){const b=this.isBefore(a),c=[],d=new Set;var f=this;let e=null;for(;;){var g=f.__key;d.has(g)||(d.add(g),c.push(f));if(f===a)break;g=
|
|
31
|
-
d.has(g.__key)||c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&
|
|
32
|
-
d=this.getLatest(),f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return
|
|
33
|
-
Za(this,!0)}replace(a){
|
|
34
|
-
c=a.getWritable(),d=c.getParent();const f=
|
|
35
|
-
e&&f.anchor.set(c,b+2,"element"),g&&f.focus.set(c,b+2,"element"));return a}insertBefore(a){
|
|
36
|
-
return null===c?d.select(0,0):
|
|
9
|
+
segmented:2,token:1},ja="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ka=ja&&"documentMode"in document?document.documentMode:null,r=ja&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),la=ja&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ma=ja&&"InputEvent"in window&&!ka?"getTargetRanges"in new window.InputEvent("input"):!1;let na=0;const oa="function"===typeof queueMicrotask?queueMicrotask:a=>{Promise.resolve().then(a)};
|
|
10
|
+
function pa(a,b,c){const d=a.getRootElement();try{var f;if(f=null!==d&&d.contains(b)&&d.contains(c)&&null!==b){const e=document.activeElement,g=null!==e?e.nodeName:null;f=!t(qa(b))||"INPUT"!==g&&"TEXTAREA"!==g}return f&&ra(b)===a}catch(e){return!1}}function ra(a){for(;null!=a;){const b=a.__lexicalEditor;if(null!=b&&!b.isReadOnly())return b;a=a.parentNode}return null}function v(a){return a.isToken()||a.isInert()}function sa(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}
|
|
11
|
+
function ta(a,b,c){b=ea[b];return a&b&&(null===c||0===(c&b))?a^b:null===c||c&b?a|b:a}function va(a){return z(a)||wa(a)||t(a)}function A(a){99<xa&&q(26);var b=a.getLatest(),c=b.__parent,d=B();const f=C(),e=d._nodeMap;d=f._dirtyElements;if(null!==c)a:for(;null!==c;){if(d.has(c))break a;const g=e.get(c);if(void 0===g)break;d.set(c,!1);c=g.__parent}b=b.__key;f._dirtyType=1;E(a)?d.set(b,!0):f._dirtyLeaves.add(b)}
|
|
12
|
+
function G(a){const b=a.getPreviousSibling();a=a.getNextSibling();null!==b&&A(b);null!==a&&A(a)}function H(a){I();var b=C();const c=b._compositionKey;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||B())._nodeMap.get(a);return void 0===a?null:a}function ya(a,b){const c=C();a=a["__lexicalKey_"+c._key];return void 0!==a?J(a,b):null}
|
|
13
|
+
function qa(a,b){for(;null!=a;){const c=ya(a,b);if(null!==c)return c;a=a.parentNode}return null}function za(a){const b=Object.assign({},a._decorators);return a._pendingDecorators=b}function Aa(a){return a.read(()=>Ba().getTextContent())}function Ca(a,b){Da(a,()=>{var c=B();if(!c.isEmpty())if("root"===b)Ba().markDirty();else{c=c._nodeMap;for(const [,d]of c)d.markDirty()}},null===a._pendingEditorState?{tag:"history-merge"}:void 0)}function Ba(){return B()._nodeMap.get("root")}
|
|
14
|
+
function Ea(a){B()._selection=a}function Fa(a){var b=C(),c;a:{for(c=a;null!=c;){const 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 Ga(a){const b=[];for(;null!==a;)b.push(a),a=a._parentEditor;return b}function Ha(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}
|
|
15
|
+
function Ia(a,b){a=window.getSelection();if(null!==a){var c=a.anchorNode,{anchorOffset:d,focusOffset:f}=a;if(null!==c&&3===c.nodeType&&(a=qa(c),z(a))){c=c.nodeValue;const e=null!==b&&b.data;if("\u200b"===c&&e){const g=e.length;c=e;f=d=g}Ja(a,c,d,f,null!==b)}}}
|
|
16
|
+
function Ja(a,b,c,d,f){if(a.isAttached()&&(f||!a.isDirty())){var e=a.isComposing();let g=b;(e||f)&&"\u200b"===b[b.length-1]&&(g=b.slice(0,-1));b=a.getTextContent();if(f||g!==b)""===g?(e&&H(null),a.remove()):(f=a.getParent(),b=Ka(),v(a)||null!==C()._compositionKey&&!e||null!==f&&K(b)&&!f.canInsertTextBefore()&&0===b.anchor.offset?a.markDirty():(e=L(),K(e)&&null!==c&&null!==d&&(e.setTextNodeRange(a,c,a,d),a.isSegmented()&&(c=a.getTextContent(),c=M(c),a.replace(c),a=c)),a.setTextContent(g)))}}
|
|
17
|
+
function La(a,b,c){var d=a.anchor;const f=a.focus;var e=d.getNode(),g=window.getSelection();g=null!==g?g.anchorNode:null;const h=d.key,l=C().getElementByKey(h);(b=h!==f.key||!z(e)||d.offset!==f.offset&&!e.isComposing()||(c||e.isDirty())&&1<b.length||null!==l&&!e.isComposing()&&g!==sa(l)||e.getFormat()!==a.format)||(e.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=e.getParentOrThrow(),d=e.isToken(),a=0===b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),e=e.getTextContentSize()===
|
|
18
|
+
b&&(!e.canInsertTextBefore()||!c.canInsertTextBefore()||d),b=a||e):b=!1);return b}function Ma(a,b){var c=a[b];return"string"===typeof c?(c=c.split(" "),a[b]=c):c}function Na(a,b,c,d,f){0!==c.size&&(c=d.__type,d=d.__key,b=b.get(c),void 0===b&&q(66,c),b=b.klass,c=a.get(b),void 0===c&&(c=new Map,a.set(b,c)),c.has(d)||c.set(d,f))}
|
|
19
|
+
function Oa(a,b,c){const d=a.getParent();let f=c;null!==d&&(b&&0===c?(f=a.getIndexWithinParent(),a=d):b||c!==a.getChildrenSize()||(f=a.getIndexWithinParent()+1,a=d));return a.getChildAtIndex(b?f-1:f)}function Pa(a,b){var c=a.offset;if("element"===a.type)return a=a.getNode(),Oa(a,b,c);a=a.getNode();return b&&0===c||!b&&c===a.getTextContentSize()?(c=b?a.getPreviousSibling():a.getNextSibling(),null===c?Oa(a.getParentOrThrow(),b,a.getIndexWithinParent()+(b?0:1)):c):null}
|
|
20
|
+
function Qa(){var a=window.event;a=a&&a.inputType;return"insertFromPaste"===a||"insertFromPasteAsQuotation"===a}function Ra(a,b,c,d,f){a=a.__children;const e=a.length;for(let g=0;g<e;g++){const h=a[g],l=d.get(h);void 0!==l&&l.__parent===b&&(E(l)&&Ra(l,h,c,d,f),c.has(h)||f.delete(h),d.delete(h))}}
|
|
21
|
+
function Sa(a,b,c,d){a=a._nodeMap;b=b._nodeMap;for(const f of c){const e=b.get(f);void 0===e||e.isAttached()||(a.has(f)||c.delete(f),b.delete(f))}for(const [f]of d)c=b.get(f),void 0===c||c.isAttached()||(E(c)&&Ra(c,f,a,b,d),a.has(f)||d.delete(f),b.delete(f))}function Wa(a,b){const c=a.__mode,d=a.__format;a=a.__style;const f=b.__mode,e=b.__format;b=b.__style;return(null===c||c===f)&&(null===d||d===e)&&(null===a||a===b)}
|
|
22
|
+
function Xa(a,b){const c=a.mergeWithSibling(b),d=C()._normalizedNodes;d.add(a.__key);d.add(b.__key);return c}function Ya(a){if(""===a.__text&&a.isSimpleText()&&!a.isUnmergeable())a.remove();else{for(var b;null!==(b=a.getPreviousSibling())&&z(b)&&b.isSimpleText()&&!b.isUnmergeable();)if(""===b.__text)b.remove();else{Wa(b,a)&&(a=Xa(b,a));break}for(var c;null!==(c=a.getNextSibling())&&z(c)&&c.isSimpleText()&&!c.isUnmergeable();)if(""===c.__text)c.remove();else{Wa(a,c)&&Xa(a,c);break}}}
|
|
23
|
+
function Za(a,b){I();var c=a.__key;const d=a.getParent();if(null!==d){var f=L(),e=!1;if(K(f)&&b){var g=f.anchor;const h=f.focus;g.key===c&&($a(g,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0);h.key===c&&($a(h,a,d,a.getPreviousSibling(),a.getNextSibling()),e=!0)}g=d.getWritable().__children;c=g.indexOf(c);-1===c&&q(16);G(a);g.splice(c,1);a.getWritable().__parent=null;K(f)&&b&&!e&&ab(f,d,c,-1);null===d||N(d)||d.canBeEmpty()||!d.isEmpty()||Za(d,b);null!==d&&N(d)&&d.isEmpty()&&d.selectEnd()}}
|
|
24
|
+
function bb(a){const b=J(a);null===b&&q(39,a);return b}
|
|
25
|
+
class cb{static getType(){q(31,this.name)}static clone(){q(32,this.name)}constructor(a){this.__type=this.constructor.getType();this.__parent=null;if(null!=a)this.__key=a;else{I();99<xa&&q(26);a=C();var b=B(),c=""+na++;b._nodeMap.set(c,this);E(this)?a._dirtyElements.set(c,!0):a._dirtyLeaves.add(c);a._cloneNotNeeded.add(c);a._dirtyType=1;this.__key=c}}getType(){return this.__type}isAttached(){for(var a=this.__key;null!==a;){if("root"===a)return!0;a=J(a);if(null===a)break;a=a.__parent}return!1}isSelected(){const a=
|
|
26
|
+
L();if(null==a)return!1;const b=(new Set(a.getNodes().map(c=>c.__key))).has(this.__key);return z(this)?b:K(a)&&"element"===a.anchor.type&&"element"===a.focus.type&&a.anchor.key===a.focus.key&&a.anchor.offset===a.focus.offset?!1:b}getKey(){return this.__key}getIndexWithinParent(){const a=this.getParent();return null===a?-1:a.__children.indexOf(this.__key)}getParent(){const a=this.getLatest().__parent;return null===a?null:J(a)}getParentOrThrow(){const a=this.getParent();null===a&&q(33,this.__key);return a}getTopLevelElement(){let a=
|
|
27
|
+
this;for(;null!==a;){const b=a.getParent();if(N(b)&&E(a))return a;a=b}return null}getTopLevelElementOrThrow(){const a=this.getTopLevelElement();null===a&&q(34,this.__key);return a}getParents(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b),b=b.getParent();return a}getParentKeys(){const a=[];let b=this.getParent();for(;null!==b;)a.push(b.__key),b=b.getParent();return a}getPreviousSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.indexOf(this.__key);return 0>=
|
|
28
|
+
b?null:J(a[b-1])}getPreviousSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(0,b).map(c=>bb(c))}getNextSibling(){var a=this.getParent();if(null===a)return null;a=a.__children;const b=a.length,c=a.indexOf(this.__key);return c>=b-1?null:J(a[c+1])}getNextSiblings(){var a=this.getParent();if(null===a)return[];a=a.__children;const b=a.indexOf(this.__key);return a.slice(b+1).map(c=>bb(c))}getCommonAncestor(a){const b=this.getParents();var c=
|
|
29
|
+
a.getParents();E(this)&&b.unshift(this);E(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++){const f=b[d];if(c.has(f))return f}return null}is(a){return null==a?!1:this.getKey()===a.getKey()}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===
|
|
30
|
+
b){b=a.__children.indexOf(c.__key);break}c=a}return d<b}isParentOf(a){const 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){const b=this.isBefore(a),c=[],d=new Set;var f=this;let e=null;for(;;){var g=f.__key;d.has(g)||(d.add(g),c.push(f));if(f===a)break;g=E(f)?b?f.getFirstChild():f.getLastChild():null;if(null!==g)null===e&&(e=f),f=g;else if(g=b?f.getNextSibling():f.getPreviousSibling(),null!==g)f=g;else{g=f.getParentOrThrow();
|
|
31
|
+
d.has(g.__key)||c.push(g);if(g===a)break;f=g;g.is(e)&&(e=null);do null===f&&q(35),g=b?f.getNextSibling():f.getPreviousSibling(),f=f.getParent(),null!==f&&(f.is(e)&&(e=null),null!==g||d.has(f.__key)||c.push(f));while(null===g);f=g}}b||c.reverse();return c}isDirty(){const a=C()._dirtyLeaves;return null!==a&&a.has(this.__key)}isComposing(){return this.__key===C()._compositionKey}getLatest(){const a=J(this.__key);null===a&&q(36);return a}getWritable(){I();var a=B(),b=C();a=a._nodeMap;const c=this.__key,
|
|
32
|
+
d=this.getLatest(),f=d.__parent;b=b._cloneNotNeeded;if(b.has(c))return A(d),d;const e=d.constructor.clone(d);e.__parent=f;E(d)&&E(e)?(e.__children=Array.from(d.__children),e.__indent=d.__indent,e.__format=d.__format,e.__dir=d.__dir):z(d)&&z(e)?(e.__format=d.__format,e.__style=d.__style,e.__mode=d.__mode,e.__detail=d.__detail):t(d)&&t(e)&&(e.__state=d.__state);b.add(c);e.__key=c;A(e);a.set(c,e);return e}getTextContent(){return""}getTextContentSize(a,b){return this.getTextContent(a,b).length}createDOM(){q(37)}updateDOM(){q(38)}static convertDOM(){return null}remove(){I();
|
|
33
|
+
Za(this,!0)}replace(a){I();const b=this.__key;a=a.getWritable();var c=a.getParent();if(null!==c){c=c.getWritable().__children;var d=c.indexOf(a.__key);-1===d&&q(16);G(a);c.splice(d,1)}d=this.getParentOrThrow();var f=d.getWritable().__children;const e=f.indexOf(this.__key);c=a.__key;-1===e&&q(16);f.splice(e,0,c);a.__parent=d.__key;Za(this,!1);G(a);f=L();K(f)&&(d=f.anchor,f=f.focus,d.key===b&&db(d,a),f.key===b&&db(f,a));C()._compositionKey===b&&H(c);return a}insertAfter(a){I();var b=this.getWritable(),
|
|
34
|
+
c=a.getWritable(),d=c.getParent();const f=L();var e=!1,g=!1;if(null!==d){var h=d.getWritable().__children,l=h.indexOf(c.__key);-1===l&&q(16);G(c);if(K(f)){g=d.getKey();d=a.getIndexWithinParent();e=f.anchor;const k=f.focus;e="element"===e.type&&e.key===g&&e.offset===d+1;g="element"===k.type&&k.key===g&&k.offset===d+1}h.splice(l,1)}h=this.getParentOrThrow().getWritable();l=c.__key;c.__parent=b.__parent;d=h.__children;b=d.indexOf(b.__key);-1===b&&q(16);d.splice(b+1,0,l);G(c);K(f)&&(ab(f,h,b+1),c=h.getKey(),
|
|
35
|
+
e&&f.anchor.set(c,b+2,"element"),g&&f.focus.set(c,b+2,"element"));return a}insertBefore(a){I();var b=this.getWritable(),c=a.getWritable(),d=c.getParent();if(null!==d){d=d.getWritable().__children;var f=d.indexOf(c.__key);-1===f&&q(16);G(c);d.splice(f,1)}d=this.getParentOrThrow().getWritable();f=c.__key;c.__parent=b.__parent;const e=d.__children;b=e.indexOf(b.__key);-1===b&&q(16);e.splice(b,0,f);G(c);c=L();K(c)&&ab(c,d,b);return a}selectPrevious(a,b){I();const c=this.getPreviousSibling(),d=this.getParentOrThrow();
|
|
36
|
+
return null===c?d.select(0,0):E(c)?c.select():z(c)?c.select(a,b):(a=c.getIndexWithinParent()+1,d.select(a,a))}selectNext(a,b){I();const c=this.getNextSibling(),d=this.getParentOrThrow();return null===c?d.select():E(c)?c.select(0,0):z(c)?c.select(a,b):(a=c.getIndexWithinParent(),d.select(a,a))}markDirty(){this.getWritable()}}
|
|
37
37
|
class eb{constructor(a,b){this.id=a||Ha();this.editorState=b||null;this.editor=null}init(a){let b=this.editorState;"string"===typeof b&&(this.editorState=b=a.parseEditorState(b),null!==b&&a.setEditorState(b,{tag:"history-merge"}))}set(a){this.editor=a;this.editorState=a.getEditorState()}toJSON(){const a=this.editorState;return{editorState:null===a||"string"===typeof a?a:JSON.stringify(a.toJSON()),id:this.id,type:"editor"}}isEmpty(){return null===this.editorState}}
|
|
38
38
|
function fb(a,b){return new eb(a,b)}class gb{constructor(a,b){this._editor=a;this._observers=new Set;this._map=b||new Map}get(a){return this._map.get(a)}has(a){return this._map.has(a)}set(a,b){this._map.set(a,b);const c=this._observers;for(const d of c)d(a,b)}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}destroy(){this._observers.clear()}toJSON(){return{map:Array.from(this._map.entries()),type:"map"}}}function hb(a,b){return new gb(a,b)}
|
|
39
39
|
class ib{constructor(a,b){this._editor=a;this._observers=new Set;this._array=b||[]}observe(a){const b=this._observers;b.add(a);return()=>{b.delete(a)}}getLength(){return this._array.length}map(a){const b=[],c=this._array;for(let d=0;d<c.length;d++)b.push(a(c[d],d,c));return b}reduce(a,b){const c=this._array;for(let d=0;d<c.length;d++){const f=c[d];b=void 0!==b?a(b,f):f}return b}push(a){this.splice(this._array.length,0,a)}splice(a,b,c){void 0===c?this._array.splice(a,b):this._array.splice(a,b,c);const d=
|
|
40
|
-
Array.from(this._observers);for(let f=0;f<d.length;f++)d[f](a,b,c)}indexOf(a){return this._array.indexOf(a)}destroy(){this._observers.clear()}toJSON(){return{array:this._array,type:"array"}}}function jb(a,b){return new ib(a,b)}class kb extends cb{constructor(a,b){super(b);b=
|
|
41
|
-
function lb(a,b){if("string"===typeof b||"number"===typeof b||"boolean"===typeof b||null===b)var c=b;else if("object"===typeof b)if(c=b.type,"editor"===c)c=fb(b.id,b.editorState);else if("array"===c){b=b.array;c=[];for(let d=0;d<b.length;d++)c.push(lb(a,b[d]));c=jb(a,c)}else c=mb(a,b);else
|
|
42
|
-
function nb(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&
|
|
43
|
-
|
|
44
|
-
d=b.anchorCellKey,l=b.focusCellKey,null!=a||c!==e&&c!==d&&c!==l||(f.remappedSelection=a={...b,type:"grid"}),null!=a&&"grid"===a.type&&(c===e&&(a.gridKey=h),d===e&&(a.anchorCellKey=h),l===e&&(a.focusCellKey=h))));return g}let
|
|
40
|
+
Array.from(this._observers);for(let f=0;f<d.length;f++)d[f](a,b,c)}indexOf(a){return this._array.indexOf(a)}destroy(){this._observers.clear()}toJSON(){return{array:this._array,type:"array"}}}function jb(a,b){return new ib(a,b)}class kb extends cb{constructor(a,b){super(b);b=C();this.__state=a||hb(b)}decorate(){q(4)}isIsolated(){return!1}isTopLevel(){return!1}}function t(a){return a instanceof kb}
|
|
41
|
+
function lb(a,b){if("string"===typeof b||"number"===typeof b||"boolean"===typeof b||null===b)var c=b;else if("object"===typeof b)if(c=b.type,"editor"===c)c=fb(b.id,b.editorState);else if("array"===c){b=b.array;c=[];for(let d=0;d<b.length;d++)c.push(lb(a,b[d]));c=jb(a,c)}else c=mb(a,b);else q(48);return c}function mb(a,b){b=b.map;const c=new Map;for(let d=0;d<b.length;d++){const [f,e]=b[d];c.set(f,lb(a,e))}return hb(a,c)}
|
|
42
|
+
function nb(a,b,c,d,f={originalSelection:null}){var e=a.__type,g=c._nodes.get(e);void 0===g&&q(24,e);g=g.klass;e=a.__key;a.__key=void 0;g=g.clone(a);a.__key=e;const h=g.__key;N(g)&&B()._nodeMap.set("root",g);g.__parent=d;if(E(g)){d=a.__children;for(var l=0;l<d.length;l++){var k=b.get(d[l]);void 0!==k&&(k=nb(k,b,c,h,f).getKey(),g.__children.push(k))}g.__indent=a.__indent;g.__format=a.__format;g.__dir=a.__dir}else z(g)?(g.__format=a.__format,g.__style=a.__style,g.__mode=a.__mode,g.__detail=a.__detail):
|
|
43
|
+
t(g)&&(g.__state=mb(c,a.__state));b=null!=f?f.originalSelection:void 0;null!=b&&(a=f.remappedSelection,"range"===b.type?(c=b.anchor,b=b.focus,null!=a||e!==c.key&&e!==b.key||(f.remappedSelection=a={anchor:{...c},focus:{...b},type:"range"}),null!=a&&"range"===a.type&&(e===c.key&&(a.anchor.key=h),e===b.key&&(a.focus.key=h))):"node"===b.type?(b=b.nodes,e=b.indexOf(e),-1!==e&&(null==a&&(f.remappedSelection=a={nodes:[...b],type:"node"}),"node"===a.type&&a.nodes.splice(e,1,h))):"grid"===b.type&&(c=b.gridKey,
|
|
44
|
+
d=b.anchorCellKey,l=b.focusCellKey,null!=a||c!==e&&c!==d&&c!==l||(f.remappedSelection=a={...b,type:"grid"}),null!=a&&"grid"===a.type&&(c===e&&(a.gridKey=h),d===e&&(a.anchorCellKey=h),l===e&&(a.focusCellKey=h))));return g}let O="",P="",R="",ob,S,pb,qb=!1,rb=!1,sb,tb=null,ub,vb,wb,xb,yb,zb;function Ab(a,b){const c=wb.get(a);if(null!==b){const d=Bb(a);b.removeChild(d)}xb.has(a)||S._keyToDOMMap.delete(a);E(c)&&(a=c.__children,Cb(a,0,a.length-1,null));void 0!==c&&Na(zb,pb,sb,c,"destroyed")}
|
|
45
45
|
function Cb(a,b,c,d){for(;b<=c;++b){const f=a[b];void 0!==f&&Ab(f,d)}}function Db(a,b){a.setProperty("text-align",b)}function Eb(a,b){a.style.setProperty("padding-inline-start",0===b?"":40*b+"px")}function Fb(a,b){a=a.style;0===b?Db(a,""):1===b?Db(a,"left"):2===b?Db(a,"center"):3===b?Db(a,"right"):4===b&&Db(a,"justify")}
|
|
46
|
-
function Gb(a,b,c){const d=xb.get(a);void 0===d&&
|
|
47
|
-
|
|
46
|
+
function Gb(a,b,c){const d=xb.get(a);void 0===d&&q(42);const f=d.createDOM(ob,S);var e=S._keyToDOMMap;f["__lexicalKey_"+S._key]=a;e.set(a,f);z(d)?f.setAttribute("data-lexical-text","true"):t(d)&&f.setAttribute("data-lexical-decorator","true");if(E(d)){a=d.__indent;0!==a&&Eb(f,a);a=d.__children;var g=a.length;if(0!==g){e=a;--g;const h=P;P="";Hb(e,0,g,f,null);Ib(d,f);P=h}e=d.__format;0!==e&&Fb(f,e);Jb(null,a,f)}else e=d.getTextContent(),t(d)?(g=d.decorate(S),null!==g&&Kb(a,g),f.contentEditable="false"):
|
|
47
|
+
z(d)&&(d.isDirectionless()||(P+=e),d.isInert()&&(a=f.style,a.pointerEvents="none",a.userSelect="none",f.contentEditable="false",a.setProperty("-webkit-user-select","none"))),O+=e,R+=e;null!==b&&(null!=c?b.insertBefore(f,c):(c=b.__lexicalLineBreak,null!=c?b.insertBefore(f,c):b.appendChild(f)));Na(zb,pb,sb,d,"created");return f}function Hb(a,b,c,d,f){const e=O;for(O="";b<=c;++b)Gb(a[b],d,f);d.__lexicalTextContent=O;O=e+O}function Lb(a,b){a=b.get(a[a.length-1]);return wa(a)||t(a)}
|
|
48
48
|
function Jb(a,b,c){a=null!==a&&(0===a.length||Lb(a,wb));b=null!==b&&(0===b.length||Lb(b,xb));a?b||(b=c.__lexicalLineBreak,null!=b&&c.removeChild(b),c.__lexicalLineBreak=null):b&&(b=document.createElement("br"),c.__lexicalLineBreak=b,c.appendChild(b))}
|
|
49
|
-
function Ib(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==
|
|
50
|
-
|
|
51
|
-
function Mb(a,b){var c=wb.get(a),d=xb.get(a);void 0!==c&&void 0!==d||
|
|
52
|
-
a=d.__format,a!==c.__format&&Fb(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=
|
|
53
|
-
e).nextSibling,
|
|
54
|
-
(
|
|
55
|
-
function Pb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&
|
|
56
|
-
function Rb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=
|
|
49
|
+
function Ib(a,b){var c=b.__lexicalDir;if(b.__lexicalDirTextContent!==P||c!==tb){const e=""===P;if(e)var d=tb;else d=P,d=aa.test(d)?"rtl":da.test(d)?"ltr":null;if(d!==c){const g=b.classList,h=ob.theme;var f=null!==c?h[c]:void 0;let l=null!==d?h[d]:void 0;void 0!==f&&("string"===typeof f&&(f=f.split(" "),f=h[c]=f),g.remove(...f));null===d||e&&"ltr"===d?b.removeAttribute("dir"):(void 0!==l&&("string"===typeof l&&(c=l.split(" "),l=h[d]=c),g.add(...l)),b.dir=d);rb||(a.getWritable().__dir=d)}tb=d;b.__lexicalDirTextContent=
|
|
50
|
+
P;b.__lexicalDir=d}}
|
|
51
|
+
function Mb(a,b){var c=wb.get(a),d=xb.get(a);void 0!==c&&void 0!==d||q(43);var f=qb||vb.has(a)||ub.has(a);const e=Nb(S,a);if(c===d&&!f)return E(c)?(d=e.__lexicalTextContent,void 0!==d&&(O+=d,R+=d),d=e.__lexicalDirTextContent,void 0!==d&&(P+=d)):(d=c.getTextContent(),z(c)&&!c.isDirectionless()&&(P+=d),R+=d,O+=d),e;c!==d&&f&&Na(zb,pb,sb,d,"updated");if(d.updateDOM(c,e,ob))return d=Gb(a,null,null),null===b&&q(44),b.replaceChild(d,e),Ab(a,null),d;if(E(c)&&E(d)){if(a=d.__indent,a!==c.__indent&&Eb(e,a),
|
|
52
|
+
a=d.__format,a!==c.__format&&Fb(e,a),a=c.__children,c=d.__children,a!==c||f){var g=a,h=c;f=d;b=P;P="";const u=O;O="";var l=g.length,k=h.length;if(1===l&&1===k){var m=g[0];h=h[0];if(m===h)Mb(m,e);else{var n=Bb(m);h=Gb(h,null,null);e.replaceChild(h,n);Ab(m,null)}}else if(0===l)0!==k&&Hb(h,0,k-1,e,null);else if(0===k)0!==l&&(m=null==e.__lexicalLineBreak,Cb(g,0,l-1,m?null:e),m&&(e.textContent=""));else{const y=l-1;l=k-1;let x=e.firstChild,D=0;for(k=0;D<=y&&k<=l;){var p=g[D];const w=h[k];if(p===w)x=Mb(w,
|
|
53
|
+
e).nextSibling,D++,k++;else{void 0===m&&(m=new Set(g));void 0===n&&(n=new Set(h));const F=n.has(p),V=m.has(w);F?(V?(p=Nb(S,w),p===x?x=Mb(w,e).nextSibling:(null!=x?e.insertBefore(p,x):e.appendChild(p),Mb(w,e)),D++):Gb(w,e,x),k++):(x=Bb(p).nextSibling,Ab(p,e),D++)}}m=D>y;n=k>l;m&&!n?(m=h[l+1],m=void 0===m?null:S.getElementByKey(m),Hb(h,k,l,e,m)):n&&!m&&Cb(g,D,y,e)}e.__lexicalTextContent=O;O=u+O;Ib(f,e);P=b;N(d)||Jb(a,c,e)}}else c=d.getTextContent(),t(d)?(f=d.decorate(S),null!==f&&Kb(a,f)):z(d)&&!d.isDirectionless()&&
|
|
54
|
+
(P+=c),O+=c,R+=c;!rb&&N(d)&&d.__cachedText!==R&&(d=d.getWritable(),d.__cachedText=R);return e}function Kb(a,b){let c=S._pendingDecorators;const d=S._decorators;if(null===c){if(d[a]===b)return;c=za(S)}c[a]=b}function Bb(a){a=yb.get(a);void 0===a&&q(45);return a}function Nb(a,b){a=a._keyToDOMMap.get(b);void 0===a&&q(45);return a}let T=null,U=null,W=!1,Ob=!1,xa=0;function I(){W&&q(25)}function B(){null===T&&q(27);return T}function C(){null===U&&q(28);return U}
|
|
55
|
+
function Pb(a,b,c){var d=b.__type;const f=a._nodes.get(d);void 0===f&&q(23,d);a=c.get(d);void 0===a&&(a=Array.from(f.transforms),c.set(d,a));c=a.length;for(d=0;d<c&&(a[d](b),b.isAttached());d++);}function Qb(a,b){b=b._dirtyLeaves;a=a._nodeMap;for(const c of b)b=a.get(c),z(b)&&b.isSimpleText()&&!b.isUnmergeable()&&Ya(b)}
|
|
56
|
+
function Rb(a,b){const c=b._dirtyLeaves,d=b._dirtyElements;a=a._nodeMap;const f=C()._compositionKey,e=new Map;var g=c;let h=g.size;for(var l=d,k=l.size;0<h||0<k;){if(0<h){b._dirtyLeaves=new Set;for(const m of g)g=a.get(m),z(g)&&g.isSimpleText()&&!g.isUnmergeable()&&Ya(g),void 0!==g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Pb(b,g,e),c.add(m);g=b._dirtyLeaves;h=g.size;if(0<h){xa++;continue}}b._dirtyLeaves=new Set;b._dirtyElements=new Map;for(const m of l)l=m[0],k=m[1],"root"!==l&&k&&(g=a.get(l),void 0!==
|
|
57
57
|
g&&void 0!==g&&g.__key!==f&&g.isAttached()&&Pb(b,g,e),d.set(l,k));g=b._dirtyLeaves;h=g.size;l=b._dirtyElements;k=l.size;xa++}b._dirtyLeaves=c;b._dirtyElements=d}
|
|
58
|
-
function Sb(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=
|
|
59
|
-
yb=new Map(a._keyToDOMMap);const
|
|
60
|
-
|
|
61
|
-
ba||null!==
|
|
62
|
-
a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var
|
|
63
|
-
if(0!==b.length){const [ia,
|
|
64
|
-
function Yb(a,b,c){if(!1===a._updating||
|
|
65
|
-
function Xb(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new $b(new Map(c._nodeMap)),g=!0);const h=
|
|
66
|
-
(e._flushSync=!0);const p=e._selection;if(
|
|
67
|
-
a._pendingEditorState=null))}function Da(a,b,c){a._updating?a._updates.push([b,c]):Xb(a,b,c)}let ec=!1,fc=0;function gc(a){fc=a.timeStamp}function hc(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function
|
|
68
|
-
function
|
|
69
|
-
null==
|
|
70
|
-
f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,
|
|
71
|
-
function Vb(a){0===fc&&window.addEventListener("textInput",gc,!0);a._observer=new MutationObserver((b,c)=>{
|
|
72
|
-
class
|
|
73
|
-
c;
|
|
74
|
-
function
|
|
75
|
-
class
|
|
76
|
-
a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function
|
|
77
|
-
class
|
|
78
|
-
|
|
79
|
-
for(let l=c;l<=f;l++){var g=e[l];a.add(g);zc(g)||
|
|
80
|
-
class
|
|
81
|
-
a.__key,b,"text");
|
|
82
|
-
f):m.slice(0,d));g+=m}else!
|
|
83
|
-
!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(
|
|
84
|
-
b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=
|
|
85
|
-
return}}else{var m=b.getNextSibling();if(!
|
|
86
|
-
"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var n=
|
|
87
|
-
if(m.canBeEmpty()||n===m){for(n=h.length-1;0<=n;n--){const
|
|
88
|
-
for(a=1;a<g;a++)b=e[a],c=b.getKey(),f.has(c)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(
|
|
89
|
-
null))}if(d.is(f))
|
|
90
|
-
f.getKey()&&!m.isToken()&&(g=m.getFormatFlags(a,e),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),h=
|
|
91
|
-
c.push(f)}f=e;c.push(...g);g=a[0];var l=!1;for(let n=0;n<a.length;n++){const p=a[n];if(
|
|
92
|
-
|
|
93
|
-
e.getLastDescendant(),b||(null===a?e.select():
|
|
94
|
-
this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(
|
|
95
|
-
null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=Cc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),
|
|
96
|
-
if(0===b)return[];if(1===b)return
|
|
97
|
-
|
|
98
|
-
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(),
|
|
58
|
+
function Sb(a){var b=a._pendingEditorState,c=a._rootElement;if(null!==c&&null!==b){var d=a._editorState,f=d._selection,e=b._selection,g=0!==a._dirtyType;a._pendingEditorState=null;a._editorState=b;var h=T,l=W,k=U,m=a._updating;U=a;T=b;W=!1;a._updating=!0;try{var n=a._observer;let ia=null;if(g&&null!==n){var p=a._dirtyType,u=a._dirtyElements,y=a._dirtyLeaves;n.disconnect();try{P=R=O="";qb=2===p;tb=null;S=a;ob=a._config;pb=a._nodes;sb=S._listeners.mutation;ub=u;vb=y;wb=d._nodeMap;xb=b._nodeMap;rb=b._readOnly;
|
|
59
|
+
yb=new Map(a._keyToDOMMap);const ua=new Map;zb=ua;Mb("root",null);zb=yb=ob=xb=wb=vb=ub=pb=S=void 0;ia=ua}finally{n.observe(c,{characterData:!0,childList:!0,subtree:!0})}}const Ta=window.getSelection();if(null!==Ta&&(g||null===e||e.dirty)){n=Ta;const ua=n.anchorNode,tc=n.focusNode,wd=n.anchorOffset,xd=n.focusOffset,Ua=document.activeElement,ba=a._rootElement;if(!a._updateTags.has("collaboration")||Ua===ba)if(K(e)){var x=e.anchor,D=e.focus,w=D.key,F=Nb(a,x.key),V=Nb(a,w),uc=x.offset,vc=D.offset;f=F;
|
|
60
|
+
w=V;"text"===x.type&&(f=sa(F));"text"===D.type&&(w=sa(V));if(null!==f&&null!==w)if(wd!==uc||xd!==vc||ua!==f||tc!==w||"Range"===n.type&&e.isCollapsed())try{if(n.setBaseAndExtent(f,uc,w,vc),e.isCollapsed()&&ba===Ua){const ca=3===f.nodeType?f.parentNode:f;if(null!==ca){const Va=ca.getBoundingClientRect();if(Va.bottom>window.innerHeight)ca.scrollIntoView(!1);else if(0>Va.top)ca.scrollIntoView();else if(ba){const wc=ba.getBoundingClientRect();Va.bottom>wc.bottom?ca.scrollIntoView(!1):Va.top<wc.top&&ca.scrollIntoView()}a._updateTags.add("scroll-into-view")}}}catch(ca){}else null===
|
|
61
|
+
ba||null!==Ua&&ba.contains(Ua)||ba.focus({preventScroll:!0})}else null!==f&&pa(a,ua,tc)&&n.removeAllRanges()}var xc=ia;null!==xc&&Tb(a,d,b,xc)}catch(ia){a._onError(ia);Ob||(Ub(a,null,c,b),Vb(a),a._dirtyType=2,Ob=!0,Sb(a),Ob=!1);return}finally{a._updating=m,T=h,W=l,U=k}b._readOnly=!0;c=a._dirtyLeaves;e=a._dirtyElements;h=a._normalizedNodes;l=a._updateTags;g&&(a._dirtyType=0,a._cloneNotNeeded.clear(),a._dirtyLeaves=new Set,a._dirtyElements=new Map,a._normalizedNodes=new Set,a._updateTags=new Set);g=
|
|
62
|
+
a._decorators;k=a._pendingDecorators||g;m=b._nodeMap;for(var Q in k)m.has(Q)||(k===g&&(k=za(a)),delete k[Q]);Q=a._pendingDecorators;null!==Q&&(a._decorators=Q,a._pendingDecorators=null,Wb("decorator",a,!0,Q));Q=Aa(d);g=Aa(b);Q!==g&&Wb("textcontent",a,!0,g);Wb("update",a,!0,{dirtyElements:e,dirtyLeaves:c,editorState:b,normalizedNodes:h,prevEditorState:d,tags:l});b=a._deferred;a._deferred=[];if(0!==b.length){d=a._updating;a._updating=!0;try{for(Q=0;Q<b.length;Q++)b[Q]()}finally{a._updating=d}}b=a._updates;
|
|
63
|
+
if(0!==b.length){const [ia,Ta]=b.shift();Xb(a,ia,Ta)}}}function Tb(a,b,c,d){a._listeners.mutation.forEach((f,e)=>{f=d.get(f);void 0!==f&&e(f)})}function Wb(a,b,c,...d){const f=b._updating;b._updating=c;try{const e=Array.from(b._listeners[a]);for(a=0;a<e.length;a++)e[a](...d)}finally{b._updating=f}}
|
|
64
|
+
function Yb(a,b,c){if(!1===a._updating||U!==a){let e=!1;a.update(()=>{e=Yb(a,b,c)});return e}const d=Ga(a);for(let e=4;0<=e;e--)for(let g=0;g<d.length;g++){var f=d[g]._listeners.command.get(b);if(void 0!==f&&(f=f[e],void 0!==f))for(const h of f)if(!0===h(c,a))return!0}return!1}function Zb(a){const b=a._updates;let c=!1;for(;0!==b.length;){const [d,f]=b.shift();let e,g;void 0!==f&&(e=f.onUpdate,g=f.tag,f.skipTransforms&&(c=!0),e&&a._deferred.push(e),g&&a._updateTags.add(g));d()}return c}
|
|
65
|
+
function Xb(a,b,c){const d=a._updateTags;var f=!1;if(void 0!==c){var e=c.onUpdate;f=c.tag;null!=f&&d.add(f);f=c.skipTransforms}e&&a._deferred.push(e);c=a._editorState;e=a._pendingEditorState;let g=!1;null===e&&(e=a._pendingEditorState=new $b(new Map(c._nodeMap)),g=!0);const h=T,l=W,k=U,m=a._updating;T=e;W=!1;a._updating=!0;U=a;try{g&&(e._selection=ac(a));const n=a._compositionKey;b();f=Zb(a);bc(e,a);0!==a._dirtyType&&(f?Qb(e,a):Rb(e,a),Zb(a),Sa(c,e,a._dirtyLeaves,a._dirtyElements));n!==a._compositionKey&&
|
|
66
|
+
(e._flushSync=!0);const p=e._selection;if(K(p)){const u=e._nodeMap,y=p.focus.key;void 0!==u.get(p.anchor.key)&&void 0!==u.get(y)||q(30)}else cc(p)&&0===p._nodes.size&&(e._selection=null)}catch(n){a._onError(n);a._pendingEditorState=c;a._dirtyType=2;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();Sb(a);return}finally{T=h,W=l,U=k,a._updating=m,xa=0}0!==a._dirtyType||dc(e,a)?e._flushSync?(e._flushSync=!1,Sb(a)):g&&oa(()=>{Sb(a)}):(e._flushSync=!1,g&&(d.clear(),a._deferred=[],
|
|
67
|
+
a._pendingEditorState=null))}function Da(a,b,c){a._updating?a._updates.push([b,c]):Xb(a,b,c)}let ec=!1,fc=0;function gc(a){fc=a.timeStamp}function hc(a,b,c){return b.__lexicalLineBreak===a||void 0!==a["__lexicalKey_"+c._key]}function ic(a){return a.getEditorState().read(()=>{const b=L();return null!==b?b.clone():null})}
|
|
68
|
+
function jc(a,b,c){ec=!0;const d=100<performance.now()-fc;try{Da(a,()=>{var f=new Map,e=a.getRootElement(),g=a._editorState;let h=!1,l="";for(var k=0;k<b.length;k++){var m=b[k],n=m.type,p=m.target,u=qa(p,g);if(!t(u))if("characterData"===n){if(d&&3===p.nodeType&&z(u)&&u.isAttached()){m=window.getSelection();var y=n=null;null!==m&&m.anchorNode===p&&(n=m.anchorOffset,y=m.focusOffset);Ja(u,p.nodeValue,n,y,!1)}}else if("childList"===n){h=!0;n=m.addedNodes;for(y=0;y<n.length;y++){var x=n[y],D=ya(x),w=x.parentNode;
|
|
69
|
+
null==w||null!==D||"BR"===x.nodeName&&hc(x,w,a)||(la&&(D=x.innerText||x.nodeValue)&&(l+=D),w.removeChild(x))}m=m.removedNodes;n=m.length;if(0<n){y=0;for(x=0;x<n;x++)w=m[x],"BR"===w.nodeName&&hc(w,p,a)&&(p.appendChild(w),y++);n!==y&&(p===e&&(u=g._nodeMap.get("root")),f.set(p,u))}}}if(0<f.size)for(const [F,V]of f)if(E(V))for(f=V.__children,e=F.firstChild,g=0;g<f.length;g++)k=a.getElementByKey(f[g]),null!==k&&(null==e?(F.appendChild(k),e=k):e!==k&&F.replaceChild(k,e),e=e.nextSibling);else z(V)&&V.markDirty();
|
|
70
|
+
f=c.takeRecords();if(0<f.length){for(e=0;e<f.length;e++)for(k=f[e],g=k.addedNodes,k=k.target,u=0;u<g.length;u++)p=g[u],m=p.parentNode,null==m||"BR"!==p.nodeName||hc(p,k,a)||m.removeChild(p);c.takeRecords()}f=L()||ic(a);null!==f&&(h&&(f.dirty=!0,Ea(f)),la&&Qa()&&f.insertRawText(l))})}finally{ec=!1}}function kc(a){const b=a._observer;if(null!==b){const c=b.takeRecords();jc(a,c,b)}}
|
|
71
|
+
function Vb(a){0===fc&&window.addEventListener("textInput",gc,!0);a._observer=new MutationObserver((b,c)=>{jc(a,b,c)})}
|
|
72
|
+
class lc{constructor(a,b,c){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();const d=this.offset;a=a.offset;E(b)&&(b=b.getDescendantByIndex(d));E(c)&&(c=c.getDescendantByIndex(a));return b===c?d<a:b.isBefore(c)}getCharacterOffset(){return"text"===this.type?this.offset:0}getNode(){const a=J(this.key);null===a&&q(5);return a}set(a,b,c){const d=L(),f=this.key;this.key=a;this.offset=b;this.type=
|
|
73
|
+
c;W||(C()._compositionKey===f&&H(a),null===d||d.anchor!==this&&d.focus!==this||(d.dirty=!0))}}function X(a,b,c){return new lc(a,b,c)}function mc(a,b){const c=b.getKey();let d=a.offset,f="element";z(b)&&(f="text",b=b.getTextContentSize(),d>b&&(d=b));a.set(c,d,f)}function db(a,b){if(E(b)){const c=b.getLastDescendant();E(c)||z(c)?mc(a,c):mc(a,b)}else z(b)&&mc(a,b)}
|
|
74
|
+
function nc(a,b,c){const d=a.getNode(),f=d.getChildAtIndex(a.offset),e=M(),g=N(d)?oc().append(e):e;e.setFormat(c);null===f?d.append(g):f.insertBefore(g);a.is(b)&&b.set(e.getKey(),0,"text");a.set(e.getKey(),0,"text")}function Y(a,b,c,d){a.key=b;a.offset=c;a.type=d}
|
|
75
|
+
class pc{constructor(a){this.dirty=!1;this._nodes=a}is(a){if(!cc(a))return!1;const 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)}delete(a){this.dirty=!0;this._nodes.delete(a)}clear(){this.dirty=!0;this._nodes.clear()}has(a){return this._nodes.has(a)}clone(){return new pc(new Set(this._nodes))}extract(){return this.getNodes()}insertRawText(){}insertText(){}getNodes(){var a=this._nodes;const b=[];for(const c of a)a=J(c),null!==
|
|
76
|
+
a&&b.push(a);return b}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function K(a){return a instanceof qc}
|
|
77
|
+
class rc{constructor(a,b,c){this.gridKey=a;this.anchorCellKey=b;this.anchor=X(b,0,"element");this.focusCellKey=c;this.focus=X(c,0,"element");this.dirty=!1}is(a){return sc(a)?this.gridKey===a.gridKey&&this.anchorCellKey===a.anchorCellKey&&this.focusCellKey===a.focusCellKey:!1}set(a,b,c){this.dirty=!0;this.gridKey=a;this.anchorCellKey=b;this.focusCellKey=c}clone(){return new rc(this.gridKey,this.anchorCellKey,this.focusCellKey)}isCollapsed(){return!1}extract(){return this.getNodes()}insertRawText(){}insertText(){}getShape(){var a=
|
|
78
|
+
J(this.anchorCellKey);a||q(74);var b=a.getIndexWithinParent();a=a.getParentOrThrow().getIndexWithinParent();var c=J(this.focusCellKey);c||q(75);var d=c.getIndexWithinParent();const f=c.getParentOrThrow().getIndexWithinParent();c=Math.min(b,d);b=Math.max(b,d);d=Math.min(a,f);a=Math.max(a,f);return{fromX:Math.min(c,b),fromY:Math.min(d,a),toX:Math.max(c,b),toY:Math.max(d,a)}}getNodes(){const a=new Set,{fromX:b,fromY:c,toX:d,toY:f}=this.getShape();var e=J(this.gridKey);yc(e)||q(76);a.add(e);e=e.getChildren();
|
|
79
|
+
for(let l=c;l<=f;l++){var g=e[l];a.add(g);zc(g)||q(77);g=g.getChildren();for(let k=b;k<=d;k++){var h=g[k];Ac(h)||q(78);a.add(h);for(h=h.getChildren();0<h.length;){const m=h.shift();a.add(m);E(m)&&h.unshift(...m.getChildren())}}}return Array.from(a)}getTextContent(){const a=this.getNodes();let b="";for(let c=0;c<a.length;c++)b+=a[c].getTextContent();return b}}function sc(a){return a instanceof rc}
|
|
80
|
+
class qc{constructor(a,b,c){this.anchor=a;this.focus=b;this.dirty=!1;this.format=c}is(a){return K(a)?this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}isBackward(){return this.focus.isBefore(this.anchor)}isCollapsed(){return this.anchor.is(this.focus)}getNodes(){const a=this.anchor,b=this.focus;let c=a.getNode(),d=b.getNode();E(c)&&(c=c.getDescendantByIndex(a.offset));E(d)&&(d=d.getDescendantByIndex(b.offset));return c.is(d)?E(c)?[]:[c]:c.getNodesBetween(d)}setTextNodeRange(a,b,c,d){Y(this.anchor,
|
|
81
|
+
a.__key,b,"text");Y(this.focus,c.__key,d,"text");this.dirty=!0}getTextContent(){const a=this.getNodes();if(0===a.length)return"";const b=a[0],c=a[a.length-1];var d=this.anchor,f=this.focus;const e=d.isBefore(f);d=d.getCharacterOffset();f=f.getCharacterOffset();let g="",h=!0;for(let l=0;l<a.length;l++){const k=a[l];if(E(k)&&!k.isInline())h||(g+="\n"),h=k.isEmpty()?!1:!0;else if(h=!1,z(k)){let m=k.getTextContent();k===b?m=k===c?d<f?m.slice(d,f):m.slice(f,d):e?m.slice(d):m.slice(f):k===c&&(m=e?m.slice(0,
|
|
82
|
+
f):m.slice(0,d));g+=m}else!t(k)&&!wa(k)||k===c&&this.isCollapsed()||(g+=k.getTextContent())}return g}applyDOMRange(a){const b=C(),c=b.getEditorState()._selection;a=Bc(a.startContainer,a.startOffset,a.endContainer,a.endOffset,b,c);if(null!==a){var [d,f]=a;Y(this.anchor,d.key,d.offset,d.type);Y(this.focus,f.key,f.offset,f.type)}}clone(){const a=this.anchor,b=this.focus;return new qc(X(a.key,a.offset,a.type),X(b.key,b.offset,b.type),this.format)}toggleFormat(a){this.format=ta(this.format,a,null);this.dirty=
|
|
83
|
+
!0}hasFormat(a){return 0!==(this.format&ea[a])}insertRawText(a){const b=a.split(/\r?\n/);if(1===b.length)this.insertText(a);else{a=[];const c=b.length;for(let d=0;d<c;d++){const f=b[d];""!==f&&a.push(M(f));d!==c-1&&a.push(Cc())}this.insertNodes(a)}}insertText(a){var b=this.anchor,c=this.focus,d=this.isCollapsed()||b.isBefore(c),f=this.format;d&&"element"===b.type?nc(b,c,f):d||"element"!==c.type||nc(c,b,f);var e=this.getNodes(),g=e.length,h=d?c:b;c=(d?b:c).offset;var l=h.offset;b=e[0];z(b)||q(6);d=
|
|
84
|
+
b.getTextContent().length;var k=b.getParentOrThrow();if(!this.isCollapsed()||c!==d||!b.isSegmented()&&!b.isToken()&&b.canInsertTextAfter()&&k.canInsertTextAfter())if(!this.isCollapsed()||0!==c||!b.isSegmented()&&!b.isToken()&&b.canInsertTextBefore()&&k.canInsertTextBefore())b.isSegmented()&&c!==d&&(k=M(b.getTextContent()),b.replace(k),b=k);else{m=b.getPreviousSibling();if(!z(m)||v(m)||m.isSegmented())m=M(),k.canInsertTextBefore()?b.insertBefore(m):k.insertBefore(m);m.select();b=m;if(""!==a){this.insertText(a);
|
|
85
|
+
return}}else{var m=b.getNextSibling();if(!z(m)||v(m)||m.isSegmented())m=M(),k.canInsertTextAfter()?b.insertAfter(m):k.insertAfter(m);m.select(0,0);b=m;if(""!==a){this.insertText(a);return}}if(1===g)if(v(b))e=M(a),e.select(),b.replace(e);else{e=b.getFormat();if(c===l&&e!==f)if(""===b.getTextContent())b.setFormat(f);else{e=M(a);e.setFormat(f);e.select();0===c?b.insertBefore(e):([g]=b.splitText(c),g.insertAfter(e));return}b=b.spliceText(c,l-c,a,!0);""===b.getTextContent()?b.remove():b.isComposing()&&
|
|
86
|
+
"text"===this.anchor.type&&(this.anchor.offset-=a.length)}else{k=e[g-1];f=new Set([...b.getParentKeys(),...k.getParentKeys()]);var n=E(b)?b:b.getParentOrThrow();m=E(k)?k:k.getParentOrThrow();"text"===h.type&&(0!==l||""===k.getTextContent())||"element"===h.type&&k.getIndexWithinParent()<l?z(k)&&!v(k)&&l!==k.getTextContentSize()?(k.isSegmented()&&(h=M(k.getTextContent()),k.replace(h),k=h),k=k.spliceText(0,l,""),f.add(k.getKey())):k.remove():f.add(k.getKey());h=m.getChildren();l=new Set(e);const p=n.is(m);
|
|
87
|
+
if(m.canBeEmpty()||n===m){for(n=h.length-1;0<=n;n--){const u=h[n];if(u.is(b)||E(u)&&u.isParentOf(b))break;u.isAttached()&&(!l.has(u)||u.is(k)?p||b.insertAfter(u):u.remove())}if(!p)for(h=m,l=null;null!==h;){k=h.getChildren();m=k.length;if(0===m||k[m-1].is(l))f.delete(h.getKey()),l=h;h=h.getParent()}}else n.append(m);v(b)?c===d?b.select():(a=M(a),a.select(),b.replace(a)):(b=b.spliceText(c,d-c,a,!0),""===b.getTextContent()?b.remove():b.isComposing()&&"text"===this.anchor.type&&(this.anchor.offset-=a.length));
|
|
88
|
+
for(a=1;a<g;a++)b=e[a],c=b.getKey(),f.has(c)||b.remove()}}removeText(){this.insertText("")}formatText(a){const b=this.getNodes(),c=b.length-1;let d=b[0],f=b[c];if(this.isCollapsed())this.toggleFormat(a);else{var e=this.anchor,g=this.focus,h=d.getTextContent().length,l=g.offset,k=0;for(var m=0;m<b.length;m++){var n=b[m];if(z(n)){k=n.getFormatFlags(a,null);break}}var p=e.offset;n=(m=e.isBefore(g))?p:l;m=m?l:p;if(n===d.getTextContentSize()){const u=d.getNextSibling();z(u)&&(n=p=0,d=u,k=d.getFormatFlags(a,
|
|
89
|
+
null))}if(d.is(f))z(d)&&("element"===e.type&&"element"===g.type?(d.setFormat(k),d.select(n,m),this.format=k):(n=p>l?l:p,m=p>l?p:l,n!==m&&(0===n&&m===h?(d.setFormat(k),d.select(n,m)):(a=d.splitText(n,m),a=0===n?a[0]:a[1],a.setFormat(k),a.select(0,m-n)),this.format=k)));else for(z(d)&&(0!==n&&([,d]=d.splitText(n)),d.setFormat(k)),e=k,z(f)&&(e=f.getFormatFlags(a,k),k=f.getTextContent().length,0!==m&&(m!==k&&([f]=f.splitText(m)),f.setFormat(e))),k=1;k<c;k++)m=b[k],g=m.getKey(),z(m)&&g!==d.getKey()&&g!==
|
|
90
|
+
f.getKey()&&!m.isToken()&&(g=m.getFormatFlags(a,e),m.setFormat(g))}}insertNodes(a,b){this.isCollapsed()||this.removeText();var c=this.anchor,d=c.offset,f=c.getNode(),e=f;"element"===c.type&&(e=c.getNode(),c=e.getChildAtIndex(d-1),e=null===c?e:c);c=[];var g=f.getNextSiblings(),h=N(f)?null:f.getTopLevelElementOrThrow();if(z(f))if(e=f.getTextContent().length,0===d&&0!==e)e=f.getPreviousSibling(),e=null!==e?e:f.getParentOrThrow(),c.push(f);else if(d===e)e=f;else{if(v(f))return!1;[e,f]=f.splitText(d);
|
|
91
|
+
c.push(f)}f=e;c.push(...g);g=a[0];var l=!1;for(let n=0;n<a.length;n++){const p=a[n];if(E(p)){if(p.is(g)){if(E(e)&&e.isEmpty()&&e.canReplaceWith(p)){e.replace(p);e=p;l=!0;continue}var k=p.getFirstDescendant();if(va(k)){for(k=k.getParentOrThrow();k.isInline();)k=k.getParentOrThrow();l=k.getChildren();var m=l.length;if(E(e))for(let u=0;u<m;u++)e.append(l[u]);else{for(--m;0<=m;m--)e.insertAfter(l[m]);e=e.getParentOrThrow()}k.remove();l=!0;if(k.is(p))continue}}z(e)&&(null===h&&q(69),e=h)}else l&&!t(p)&&
|
|
92
|
+
N(e.getParent())&&q(7);l=!1;if(E(e))if(t(p)&&p.isTopLevel())e=e.insertAfter(p);else if(E(p)){if(p.canBeEmpty()||!p.isEmpty())N(e)?(k=e.getChildAtIndex(d),null!==k?k.insertBefore(p):e.append(p),e=p):e=e.insertAfter(p)}else k=e.getFirstChild(),null!==k?k.insertBefore(p):e.append(p),e=p;else!E(p)||t(e)&&e.isTopLevel()?e=e.insertAfter(p):(e=p.getParentOrThrow(),n--)}b&&(z(f)?f.select():(a=e.getPreviousSibling(),z(a)?a.select():(a=e.getIndexWithinParent(),e.getParentOrThrow().select(a,a))));if(E(e)){if(a=
|
|
93
|
+
e.getLastDescendant(),b||(null===a?e.select():z(a)?a.select():a.selectNext()),0!==c.length)for(b=c.length-1;0<=b;b--)a=c[b],d=a.getParentOrThrow(),E(e)&&!E(a)?(e.append(a),e=a):E(e)||E(a)?E(a)&&!a.canInsertAfter(e)?(h=d.constructor.clone(d),E(h)||q(8),h.append(a),e.insertAfter(h)):e.insertAfter(a):(e.insertBefore(a),e=a),d.isEmpty()&&!d.canBeEmpty()&&d.remove()}else b||(z(e)?e.select():(c=e.getParentOrThrow(),e=e.getIndexWithinParent()+1,c.select(e,e)));return!0}insertParagraph(){this.isCollapsed()||
|
|
94
|
+
this.removeText();var a=this.anchor,b=a.offset;if("text"===a.type){var c=a.getNode(),d=c.getTextContent().length;a=c.getNextSiblings().reverse();var f=c.getParentOrThrow();0===b?a.push(c):b!==d&&([,c]=c.splitText(b),a.push(c))}else{f=a.getNode();if(N(f)){a=oc();b=f.getChildAtIndex(b);a.select();null!==b?b.insertBefore(a):f.append(a);return}a=f.getChildren().slice(b).reverse()}c=f.insertNewAfter(this);if(null===c)this.insertLineBreak();else if(E(c))if(d=a.length,0===b&&0<d)f.insertBefore(c);else{b=
|
|
95
|
+
null;if(0!==d)for(f=0;f<d;f++){const e=a[f];null===b?c.append(e):b.insertBefore(e);b=e}c.canBeEmpty()||0!==c.getChildrenSize()?c.selectStart():(c.selectPrevious(),c.remove())}}insertLineBreak(a){const b=Cc();var c=this.anchor;"element"===c.type&&(c=c.getNode(),N(c)&&this.insertParagraph());a?this.insertNodes([b],!0):this.insertNodes([b])&&b.selectNext(0,0)}extract(){var a=this.getNodes(),b=a.length,c=b-1,d=this.anchor;const f=this.focus;var e=a[0];let g=a[c];var h=d.getCharacterOffset();const l=f.getCharacterOffset();
|
|
96
|
+
if(0===b)return[];if(1===b)return z(e)?(a=h>l?l:h,c=e.splitText(a,h>l?h:l),a=0===a?c[0]:c[1],null!=a?[a]:[]):[e];b=d.isBefore(f);z(e)&&(d=b?h:l,d===e.getTextContentSize()?a.shift():0!==d&&([,e]=e.splitText(d),a[0]=e));z(g)&&(e=g.getTextContent().length,h=b?l:h,0===h?a.pop():h!==e&&([g]=g.splitText(h),a[c]=g));return a}modify(a,b,c){var d=this.focus,f=this.anchor,e="move"===a;const g=Pa(d,b);if(t(g)&&!g.isIsolated()){var h=b?g.getPreviousSibling():g.getNextSibling();if(!z(h)){a=g.getParentOrThrow();
|
|
97
|
+
E(h)?(a=h.getKey(),h=b?h.getChildrenSize():0):(h=g.getIndexWithinParent(),a=a.getKey(),b||h++);d.set(a,h,"element");e&&f.set(a,h,"element");return}}d=window.getSelection();d.modify(a,b?"backward":"forward",c);0<d.rangeCount&&(b=d.getRangeAt(0),this.applyDOMRange(b),e||d.anchorNode===b.startContainer&&d.anchorOffset===b.startOffset||(e=this.focus,b=this.anchor,d=b.key,f=b.offset,h=b.type,Y(b,e.key,e.offset,e.type),Y(e,d,f,h)))}deleteCharacter(a){if(this.isCollapsed()){var b=this.anchor,c=this.focus,
|
|
98
|
+
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(),E(d)&&!d.canExtractContents()))return;this.modify("extend",a,"character");if(!this.isCollapsed()){var f="text"===c.type?c.getNode():null;d="text"===b.type?b.getNode():null;if(null!==f&&f.isSegmented()){if(b=c.offset,c=f.getTextContentSize(),f.is(d)||a&&b!==c||!a&&0!==b){Dc(f,a,b);return}}else if(null!==d&&d.isSegmented()&&
|
|
99
99
|
(b=b.offset,c=d.getTextContentSize(),d.is(f)||a&&0!==b||!a&&b!==c)){Dc(d,a,b);return}d=this.anchor;f=this.focus;b=d.getNode();c=f.getNode();if(b===c&&"text"===d.type&&"text"===f.type){var e=d.offset,g=f.offset;const h=e<g;c=h?e:g;g=h?g:e;e=g-1;c!==e&&(b=b.getTextContent().slice(c,g),/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(b)||(a?f.offset=e:d.offset=e))}}else if(a&&0===b.offset&&("element"===b.type?b.getNode():b.getNode().getParentOrThrow()).collapseAtStart(this))return}this.removeText()}deleteLine(a){this.isCollapsed()&&
|
|
100
|
-
this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function cc(a){return a instanceof
|
|
101
|
-
function Ec(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Fa(f[d]);if(
|
|
102
|
-
d=0===b&&
|
|
103
|
-
function Bc(a,b,c,d,f,e){if(null===a||null===c||!pa(f,a,c))return null;a=Ec(a,b,
|
|
104
|
-
0));f.isComposing()&&f._compositionKey!==a.key&&
|
|
105
|
-
function ac(a){var b=a.getEditorState()._selection,c=window.getSelection();if(cc(b)||
|
|
106
|
-
function
|
|
100
|
+
this.modify("extend",a,"lineboundary");this.removeText()}deleteWord(a){this.isCollapsed()&&this.modify("extend",a,"word");this.removeText()}}function cc(a){return a instanceof pc}function Dc(a,b,c){const d=a.getTextContent().split(/\s/g),f=d.length;let e=0,g=0;for(let h=0;h<f;h++){const l=d[h],k=h===f-1;g=e;e+=l.length;if(b&&e===c||e>c||k){d.splice(h,1);k&&(g=void 0);break}}b=d.join(" ");""===b?a.remove():(a.setTextContent(b),a.select(g,g))}
|
|
101
|
+
function Ec(a,b,c){var d=b;if(1===a.nodeType){let g=!1;var f=a.childNodes;var e=f.length;d===e&&(g=!0,d=e-1);f=Fa(f[d]);if(z(f))d=g?f.getTextContentSize():0;else{e=Fa(a);if(null===e)return null;if(E(e)){a=e.getChildAtIndex(d);if(b=E(a))b=a.getParent(),b=null===c||null===b||!b.canBeEmpty()||b!==c.getNode();b&&(c=g?a.getLastDescendant():a.getFirstDescendant(),null===c?(e=a,d=0):(a=c,e=a.getParentOrThrow()));z(a)?(f=a,e=null,d=g?f.getTextContentSize():0):a!==e&&g&&d++}else d=e.getIndexWithinParent(),
|
|
102
|
+
d=0===b&&t(e)&&Fa(a)===e?d:d+1,e=e.getParentOrThrow();if(E(e))return X(e.__key,d,"element")}}else f=Fa(a);return z(f)?X(f.__key,d,"text"):null}
|
|
103
|
+
function Bc(a,b,c,d,f,e){if(null===a||null===c||!pa(f,a,c))return null;a=Ec(a,b,K(e)?e.anchor:null);if(null===a)return null;c=Ec(c,d,K(e)?e.focus:null);if(null===c)return null;if("text"===a.type&&"text"===c.type){d=a.getNode();const g=c.getNode(),h=d.getTextContentSize(),l=a.offset,k=c.offset;d===g&&l===k?0===b&&(d=d.getPreviousSibling(),z(d)&&!d.isInert()&&(b=d.getTextContentSize(),d=d.__key,a.key=d,c.key=d,a.offset=b,c.offset=b)):l===h&&(b=d.getNextSibling(),z(b)&&!b.isInert()&&(a.key=b.__key,a.offset=
|
|
104
|
+
0));f.isComposing()&&f._compositionKey!==a.key&&K(e)&&(f=e.anchor,e=e.focus,Y(a,f.key,f.offset,f.type),Y(c,e.key,e.offset,e.type))}return[a,c]}function Fc(a,b,c,d,f,e){const g=B();a=new qc(X(a,b,f),X(c,d,e),0);a.dirty=!0;return g._selection=a}
|
|
105
|
+
function ac(a){var b=a.getEditorState()._selection,c=window.getSelection();if(cc(b)||sc(b))return b.clone();{var d=(d=window.event)&&d.type;d=!ec&&("selectionchange"===d||"beforeinput"===d||"compositionstart"===d||"compositionend"===d||"click"===d&&3===window.event.detail||void 0===d);let g,h;if(!K(b)||d)if(null===c)b=null;else if(d=c.anchorNode,g=c.focusNode,h=c.anchorOffset,c=c.focusOffset,a=Bc(d,h,g,c,a,b),null===a)b=null;else{var [f,e]=a;b=new qc(f,e,K(b)?b.format:0)}else b=b.clone()}return b}
|
|
106
|
+
function L(){return B()._selection}function Ka(){return C()._editorState._selection}function Gc(a){if(null!==a){if("range"===a.type)return new qc(X(a.anchor.key,a.anchor.offset,a.anchor.type),X(a.focus.key,a.focus.offset,a.focus.type),0);if("node"===a.type)return new pc(new Set(a.nodes));if("grid"===a.type)return new rc(a.gridKey,a.anchorCellKey,a.focusCellKey)}return null}
|
|
107
107
|
function ab(a,b,c,d=1){var f=a.anchor,e=a.focus,g=f.getNode(),h=e.getNode();if(b.is(g)||b.is(h))if(g=b.getKey(),a.isCollapsed())b=f.offset,c<=b&&(c=Math.max(0,b+d),f.set(g,c,"element"),e.set(g,c,"element"),Hc(a));else{var l=a.isBackward();h=l?e:f;var k=h.getNode();f=l?f:e;e=f.getNode();b.is(k)&&(k=h.offset,c<=k&&h.set(g,Math.max(0,k+d),"element"));b.is(e)&&(b=f.offset,c<=b&&f.set(g,Math.max(0,b+d),"element"));Hc(a)}}
|
|
108
|
-
function Hc(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())
|
|
109
|
-
c)?g.getChildAtIndex(c-1):g.getChildAtIndex(f),
|
|
110
|
-
function $a(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,
|
|
111
|
-
class Jc extends cb{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const d=
|
|
112
|
-
|
|
113
|
-
this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],
|
|
114
|
-
b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);
|
|
115
|
-
this.getFirstDescendant();return
|
|
116
|
-
if(null!==h){h=h.getWritable().__children;const l=h.indexOf(g.__key);-1===l&&
|
|
117
|
-
if(null!==l){l=l.getWritable().__children;const p=l.indexOf(n.__key);-1===p&&
|
|
118
|
-
null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||
|
|
119
|
-
class Kc extends Jc{static getType(){return"root"}static clone(){return new Kc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){
|
|
120
|
-
__dir:this.__dir,__format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function
|
|
121
|
-
class $b{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){a:{const c=
|
|
122
|
-
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:cc(a)?{nodes:Array.from(a._nodes),type:"node"}:
|
|
123
|
-
let Uc=!1,Vc=0;function
|
|
124
|
-
function Rc(a,b){b.update(()=>{const c=
|
|
125
|
-
function Tc(a,b){const c=a.inputType;"deleteCompositionText"===c||"insertCompositionText"===c||la&&
|
|
126
|
-
|
|
127
|
-
break;case "
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
function
|
|
131
|
-
function Nc(a,b){Uc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)b.dispatchCommand(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
a
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
class nd extends Jc{static getType(){return"paragraph"}static clone(a){return new nd(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Ma(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static convertDOM(){return{p:()=>({conversion:od,priority:0})}}insertNewAfter(){const a=tc(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||A(a[0])&&""===a[0].getTextContent().trim()){if(null!==
|
|
153
|
-
this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function od(){return{node:tc()}}function tc(){return new nd}
|
|
108
|
+
function Hc(a){var b=a.anchor,c=b.offset;const d=a.focus;var f=d.offset,e=b.getNode(),g=d.getNode();if(a.isCollapsed())E(e)&&(g=e.getChildrenSize(),g=(f=c>=g)?e.getChildAtIndex(g-1):e.getChildAtIndex(c),z(g)&&(c=0,f&&(c=g.getTextContentSize()),b.set(g.getKey(),c,"text"),d.set(g.getKey(),c,"text")));else{if(E(e)){const h=e.getChildrenSize();c=(a=c>=h)?e.getChildAtIndex(h-1):e.getChildAtIndex(c);z(c)&&(e=0,a&&(e=c.getTextContentSize()),b.set(c.getKey(),e,"text"))}E(g)&&(c=g.getChildrenSize(),f=(b=f>=
|
|
109
|
+
c)?g.getChildAtIndex(c-1):g.getChildAtIndex(f),z(f)&&(g=0,b&&(g=f.getTextContentSize()),d.set(f.getKey(),g,"text")))}}function bc(a,b){b=b.getEditorState()._selection;a=a._selection;if(K(a)){var c=a.anchor;const d=a.focus;let f;"text"===c.type&&(f=c.getNode(),f.selectionTransform(b,a));"text"===d.type&&(c=d.getNode(),f!==c&&c.selectionTransform(b,a))}}
|
|
110
|
+
function $a(a,b,c,d,f){let e=null,g=0,h=null;null!==d?(e=d.__key,z(d)?(g=d.getTextContentSize(),h="text"):E(d)&&(g=d.getChildrenSize(),h="element")):null!==f&&(e=f.__key,z(f)?h="text":E(f)&&(h="element"));null!==e&&null!==h?a.set(e,g,h):(g=b.getIndexWithinParent(),a.set(c.__key,g,"element"))}function Ic(a,b,c,d,f){"text"===a.type?(a.key=c,b||(a.offset+=f)):a.offset>d.getIndexWithinParent()&&--a.offset}
|
|
111
|
+
class Jc extends cb{constructor(a){super(a);this.__children=[];this.__indent=this.__format=0;this.__dir=null}getFormat(){return this.getLatest().__format}getIndent(){return this.getLatest().__indent}getChildren(){const a=this.getLatest().__children,b=[];for(let c=0;c<a.length;c++){const 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===this.getChildrenSize()}isDirty(){const a=
|
|
112
|
+
C()._dirtyElements;return null!==a&&a.has(this.__key)}getAllTextNodes(a){const b=[],c=this.getLatest().__children;for(let f=0;f<c.length;f++){var d=J(c[f]);!z(d)||!a&&d.isInert()?E(d)&&(d=d.getAllTextNodes(a),b.push(...d)):b.push(d)}return b}getFirstDescendant(){let a=this.getFirstChild();for(;null!==a;){if(E(a)){const b=a.getFirstChild();if(null!==b){a=b;continue}}break}return a}getLastDescendant(){let a=this.getLastChild();for(;null!==a;){if(E(a)){const b=a.getLastChild();if(null!==b){a=b;continue}}break}return a}getDescendantByIndex(a){const b=
|
|
113
|
+
this.getChildren(),c=b.length;if(0===c)return this;if(a>=c)return a=b[c-1],E(a)&&a.getLastDescendant()||a;a=b[a];return E(a)&&a.getFirstDescendant()||a}getFirstChild(){const a=this.getLatest().__children;return 0===a.length?null:J(a[0])}getFirstChildOrThrow(){const a=this.getFirstChild();null===a&&q(15,this.__key);return a}getLastChild(){const a=this.getLatest().__children,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,
|
|
114
|
+
b){let c="";const d=this.getChildren(),f=d.length;for(let e=0;e<f;e++){const g=d[e];c+=g.getTextContent(a,b);E(g)&&e!==f-1&&!g.isInline()&&(c+="\n\n")}return c}getDirection(){return this.__dir}hasFormat(a){a=fa[a];return 0!==(this.getFormat()&a)}select(a,b){I();const c=L();var d=this.getChildrenSize();void 0===a&&(a=d);void 0===b&&(b=d);d=this.__key;if(K(c))c.anchor.set(d,a,"element"),c.focus.set(d,b,"element"),c.dirty=!0;else return Fc(d,a,d,b,"element","element");return c}selectStart(){const a=
|
|
115
|
+
this.getFirstDescendant();return E(a)||z(a)?a.select(0,0):null!==a?a.selectPrevious():this.select(0,0)}selectEnd(){const a=this.getLastDescendant();return E(a)||z(a)?a.select():null!==a?a.selectNext():this.select()}clear(){I();const a=this.getWritable();this.getChildren().forEach(b=>b.remove());return a}append(...a){I();const b=this.getWritable(),c=b.__key,d=b.__children,f=a.length;var e=this.getLastChild();null!==e&&A(e);for(e=0;e<f;e++){var g=a[e];g.__key===c&&q(49);g=g.getWritable();var h=g.getParent();
|
|
116
|
+
if(null!==h){h=h.getWritable().__children;const l=h.indexOf(g.__key);-1===l&&q(16);h.splice(l,1)}g.__parent=c;d.push(g.__key)}return b}setDirection(a){I();const b=this.getWritable();b.__dir=a;return b}setFormat(a){I();this.getWritable().__format=fa[a];return this}setIndent(a){I();this.getWritable().__indent=a;return this}splice(a,b,c){I();const d=this.getWritable();var f=d.__key;const e=d.__children,g=c.length;var h=[];for(let k=0;k<g;k++){const m=c[k],n=m.getWritable();m.__key===f&&q(49);var l=n.getParent();
|
|
117
|
+
if(null!==l){l=l.getWritable().__children;const p=l.indexOf(n.__key);-1===p&&q(16);G(m);l.splice(p,1)}n.__parent=f;h.push(n.__key)}(c=this.getChildAtIndex(a-1))&&A(c);(f=this.getChildAtIndex(a+b))&&A(f);a=e.splice(a,b,...h);if(b&&(b=L(),K(b))){const k=new Set(a),m=new Set(h);h=u=>{for(u=u.getNode();u;){const y=u.__key;if(k.has(y)&&!m.has(y))return!0;u=u.getParent()}return!1};const {anchor:n,focus:p}=b;h(n)&&$a(n,n.getNode(),this,c,f);h(p)&&$a(p,p.getNode(),this,c,f);h=a.length;for(b=0;b<h;b++)c=J(a[b]),
|
|
118
|
+
null!=c&&(c.getWritable().__parent=null);0!==e.length||this.canBeEmpty()||N(this)||this.remove()}return d}insertNewAfter(){return null}canInsertTab(){return!1}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}}function E(a){return a instanceof Jc}
|
|
119
|
+
class Kc extends Jc{static getType(){return"root"}static clone(){return new Kc}constructor(){super("root");this.__cachedText=null}getTopLevelElementOrThrow(){q(70)}getTextContent(a,b){const c=this.__cachedText;return!W&&0!==C()._dirtyType||null===c||a&&!1===b?super.getTextContent(a,b):c}remove(){q(10)}replace(){q(11)}insertBefore(){q(12)}insertAfter(){q(13)}updateDOM(){return!1}append(...a){for(let b=0;b<a.length;b++){const c=a[b];E(c)||t(c)||q(46)}return super.append(...a)}toJSON(){return{__children:this.__children,
|
|
120
|
+
__dir:this.__dir,__format:this.__format,__indent:this.__indent,__key:"root",__parent:null,__type:"root"}}}function N(a){return a instanceof Kc}function dc(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 Lc(){return new $b(new Map([["root",new Kc]]))}
|
|
121
|
+
class $b{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){a:{const c=T,d=W,f=U;T=this;W=!0;U=null;try{var b=a();break a}finally{T=c,W=d,U=f}b=void 0}return b}clone(a){a=new $b(this._nodeMap,void 0===a?this._selection:a);a._readOnly=!0;return a}toJSON(){const a=this._selection;return{_nodeMap:Array.from(this._nodeMap.entries()),_selection:K(a)?{anchor:{key:a.anchor.key,offset:a.anchor.offset,
|
|
122
|
+
type:a.anchor.type},focus:{key:a.focus.key,offset:a.focus.offset,type:a.focus.type},type:"range"}:cc(a)?{nodes:Array.from(a._nodes),type:"node"}:sc(a)?{anchorCellKey:a.anchorCellKey,focusCellKey:a.focusCellKey,gridKey:a.gridKey,type:"grid"}:null}}}const Mc=Object.freeze({}),Sc=[["keydown",Nc],["compositionstart",Oc],["compositionend",Pc],["input",Qc],["click",Rc],["cut",Mc],["copy",Mc],["dragstart",Mc],["paste",Mc],["focus",Mc],["blur",Mc]];ma?Sc.push(["beforeinput",Tc]):Sc.push(["drop",Mc]);
|
|
123
|
+
let Uc=!1,Vc=0;function Wc(a,b,c){b.update(()=>{if(c){var d=L();if(K(d)&&d.isCollapsed()){"Range"===a.type&&(d.dirty=!0);var f=d.anchor;"text"===f.type?(f=f.getNode(),d.format=f.getFormat()):"element"===f.type&&(d.format=0)}b.dispatchCommand(Xc)}else Ea(null)})}
|
|
124
|
+
function Rc(a,b){b.update(()=>{const c=L();if(K(c)){var d=c.anchor;"element"===d.type&&0===d.offset&&c.isCollapsed()&&1===Ba().getChildrenSize()&&d.getNode().getTopLevelElementOrThrow().isEmpty()&&(d=b.getEditorState()._selection,null!==d&&c.is(d)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}b.dispatchCommand(Yc,a)})}
|
|
125
|
+
function Tc(a,b){const c=a.inputType;"deleteCompositionText"===c||"insertCompositionText"===c||la&&Qa()||b.update(()=>{const d=L();if(K(d))if("deleteContentBackward"===c)H(null),a.preventDefault(),b.dispatchCommand(Zc,!0);else{var f=a.data;if(!d.dirty&&d.isCollapsed()&&!N(d.anchor.getNode())&&a.getTargetRanges){var e=a.getTargetRanges()[0];e&&d.applyDOMRange(e)}var g=d.focus;e=d.anchor.getNode();g=g.getNode();if("insertText"===c)"\n"===f?(a.preventDefault(),b.dispatchCommand($c)):"\n\n"===f?(a.preventDefault(),
|
|
126
|
+
b.dispatchCommand(ad)):null==f&&a.dataTransfer?(f=a.dataTransfer.getData("text/plain"),a.preventDefault(),d.insertRawText(f)):null!=f&&La(d,f,!0)&&(a.preventDefault(),b.dispatchCommand(bd,f));else switch(a.preventDefault(),c){case "insertFromYank":case "insertFromDrop":case "insertReplacementText":b.dispatchCommand(bd,a);break;case "insertFromComposition":H(null);b.dispatchCommand(bd,a);break;case "insertLineBreak":H(null);b.dispatchCommand($c);break;case "insertParagraph":H(null);b.dispatchCommand(ad);
|
|
127
|
+
break;case "insertFromPaste":case "insertFromPasteAsQuotation":b.dispatchCommand(cd,a);break;case "deleteByComposition":e===g&&!E(e)&&!E(g)&&v(e)&&v(g)||b.dispatchCommand(dd);break;case "deleteByDrag":case "deleteByCut":b.dispatchCommand(dd);break;case "deleteContent":b.dispatchCommand(Zc,!1);break;case "deleteWordBackward":b.dispatchCommand(ed,!0);break;case "deleteWordForward":b.dispatchCommand(ed,!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":b.dispatchCommand(fd,!0);break;
|
|
128
|
+
case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":b.dispatchCommand(fd,!1);break;case "formatStrikeThrough":b.dispatchCommand(Z,"strikethrough");break;case "formatBold":b.dispatchCommand(Z,"bold");break;case "formatItalic":b.dispatchCommand(Z,"italic");break;case "formatUnderline":b.dispatchCommand(Z,"underline");break;case "historyUndo":b.dispatchCommand(gd);break;case "historyRedo":b.dispatchCommand(hd)}}})}
|
|
129
|
+
function Qc(a,b){a.stopPropagation();b.update(()=>{var c=L();const d=a.data;null!=d&&K(c)&&La(c,d,!1)?b.dispatchCommand(bd,d):Ia(b,null);I();c=C();kc(c)})}function Oc(a,b){b.update(()=>{const c=L();if(K(c)&&!b.isComposing()){const d=c.anchor;H(d.key);Uc&&"element"!==d.type&&c.isCollapsed()||b.dispatchCommand(bd," ")}})}
|
|
130
|
+
function Pc(a,b){b.update(()=>{var c=b._compositionKey;H(null);if(null!==c&&""===a.data){const d=J(c);c=sa(b.getElementByKey(c));null!==c&&z(d)&&Ja(d,c.nodeValue,null,null,!0)}else Ia(b,a)})}
|
|
131
|
+
function Nc(a,b){Uc="Unidentified"===a.key&&229===a.keyCode;if(!b.isComposing()){var {keyCode:c,shiftKey:d,ctrlKey:f,metaKey:e,altKey:g}=a;if(39!==c||f||e||g)if(37!==c||f||e||g)if(38!==c||f||e)if(40!==c||f||e)if(13===c&&d)b.dispatchCommand(id,a);else if(r&&f&&79===c)a.preventDefault(),b.dispatchCommand($c,!0);else if(13!==c||d){var h=r?g||e?!1:8===c||72===c&&f:f||g||e?!1:8===c;h?8===c?b.dispatchCommand(jd,a):b.dispatchCommand(Zc,!0):27===c?b.dispatchCommand(kd,a):(h=r?d||g||e?!1:46===c||68===c&&f:
|
|
132
|
+
f||g||e?!1:46===c,h?46===c?b.dispatchCommand(ld,a):(a.preventDefault(),b.dispatchCommand(Zc,!1)):8===c&&(r?g:f)?(a.preventDefault(),b.dispatchCommand(ed,!0)):46===c&&(r?g:f)?(a.preventDefault(),b.dispatchCommand(ed,!1)):r&&e&&8===c?(a.preventDefault(),b.dispatchCommand(fd,!0)):r&&e&&46===c?(a.preventDefault(),b.dispatchCommand(fd,!1)):66===c&&(r?e:f)?(a.preventDefault(),b.dispatchCommand(Z,"bold")):85===c&&(r?e:f)?(a.preventDefault(),b.dispatchCommand(Z,"underline")):73===c&&(r?e:f)?(a.preventDefault(),
|
|
133
|
+
b.dispatchCommand(Z,"italic")):9!==c||g||f||e?90===c&&!d&&(r?e:f)?(a.preventDefault(),b.dispatchCommand(gd)):(h=r?90===c&&e&&d:89===c&&f||90===c&&f&&d,h&&(a.preventDefault(),b.dispatchCommand(hd))):b.dispatchCommand(md,a))}else b.dispatchCommand(id,a);else b.dispatchCommand(nd,a);else b.dispatchCommand(od,a);else b.dispatchCommand(pd,a);else b.dispatchCommand(qd,a)}}function rd(a){let b=a.__lexicalEventHandles;void 0===b&&(b=[],a.__lexicalEventHandles=b);return b}const sd=new Map;
|
|
134
|
+
function td(){const a=window.getSelection(),b=ra(a.anchorNode);if(null!==b){var c=Ga(b);c=c[c.length-1];var d=c._key,f=sd.get(d),e=f||c;e!==b&&Wc(a,e,!1);Wc(a,b,!0);b!==c?sd.set(d,b):f&&sd.delete(d)}}
|
|
135
|
+
function ud(a,b){0===Vc&&a.ownerDocument.addEventListener("selectionchange",td);Vc++;a.__lexicalEditor=b;const c=rd(a);for(let d=0;d<Sc.length;d++){const [f,e]=Sc[d],g="function"===typeof e?h=>{b.isReadOnly()||e(h,b)}:h=>{if(!b.isReadOnly())switch(f){case "cut":return b.dispatchCommand(vd,h);case "copy":return b.dispatchCommand(yd,h);case "paste":return b.dispatchCommand(cd,h);case "dragstart":return b.dispatchCommand(zd,h);case "focus":return b.dispatchCommand(Ad,h);case "blur":return b.dispatchCommand(Bd,
|
|
136
|
+
h);case "drop":return b.dispatchCommand(Cd,h)}};a.addEventListener(f,g);c.push(()=>{a.removeEventListener(f,g)})}}class Dd extends cb{static getType(){return"linebreak"}static clone(a){return new Dd(a.__key)}constructor(a){super(a)}getTextContent(){return"\n"}createDOM(){return document.createElement("br")}updateDOM(){return!1}static convertDOM(){return{br:()=>({conversion:Ed,priority:0})}}}function Ed(){return{node:Cc()}}function Cc(){return new Dd}function wa(a){return a instanceof Dd}
|
|
137
|
+
function Fd(a,b){return b&1?"strong":b&2?"em":"span"}function Gd(a,b,c,d,f){a=d.classList;d=Ma(f,"base");void 0!==d&&a.add(...d);d=Ma(f,"underlineStrikethrough");let e=!1;const g=b&8&&b&4;var h=c&8&&c&4;void 0!==d&&(h?(e=!0,g||a.add(...d)):g&&a.remove(...d));for(const l in ea)h=ea[l],d=Ma(f,l),void 0!==d&&(c&h?!e||"underline"!==l&&"strikethrough"!==l?(0===(b&h)||g&&"underline"===l||"strikethrough"===l)&&a.add(...d):b&h&&a.remove(...d):b&h&&a.remove(...d))}
|
|
138
|
+
function Hd(a,b,c){const d=b.firstChild;c=c.isComposing();a+=c?"\u200b":"";if(null==d)b.textContent=a;else if(b=d.nodeValue,b!==a)if(c){c=b.length;const f=a.length;let e=0,g=0;for(;e<c&&e<f&&b[e]===a[e];)e++;for(;g+e<c&&g+e<f&&b[c-g-1]===a[f-g-1];)g++;a=[e,c-e-g,a.slice(e,f-g)];const [h,l,k]=a;0!==l&&d.deleteData(h,l);d.insertData(h,k)}else d.nodeValue=a}
|
|
139
|
+
class Id extends cb{static getType(){return"text"}static clone(a){return new Id(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}getStyle(){return this.getLatest().__style}isToken(){return 1===this.getLatest().__mode}isSegmented(){return 2===this.getLatest().__mode}isInert(){return 3===this.getLatest().__mode}isDirectionless(){return 0!==(this.getLatest().__detail&1)}isUnmergeable(){return 0!==
|
|
140
|
+
(this.getLatest().__detail&2)}hasFormat(a){a=ea[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){const c=this.getLatest().__format;return ta(c,a,b)}createDOM(a){var b=this.__format,c=b&16?"code":null;const d=Fd(this,b),f=document.createElement(null===c?d:c);let e=f;null!==c&&(e=document.createElement(d),f.appendChild(e));c=e;Hd(this.__text,
|
|
141
|
+
c,this);a=a.theme.text;void 0!==a&&Gd(d,0,b,c,a);b=this.__style;""!==b&&(f.style.cssText=b);return f}updateDOM(a,b,c){const d=this.__text;var f=a.__format,e=this.__format,g=f&16?"code":null;const h=e&16?"code":null;var l=Fd(this,f);const k=Fd(this,e);if((null===g?l:g)!==(null===h?k:h))return!0;if(g===h&&l!==k)return f=b.firstChild,null==f&&q(20),a=g=document.createElement(k),Hd(d,a,this),c=c.theme.text,void 0!==c&&Gd(k,0,e,a,c),b.replaceChild(g,f),!1;l=b;null!==h&&null!==g&&(l=b.firstChild,null==
|
|
142
|
+
l&&q(21));Hd(d,l,this);c=c.theme.text;void 0!==c&&f!==e&&Gd(k,f,e,l,c);e=this.__style;a.__style!==e&&(b.style.cssText=e);return!1}static convertDOM(){return{"#text":()=>({conversion:Jd,priority:0}),b:()=>({conversion:Kd,priority:0}),em:()=>({conversion:Ld,priority:0}),i:()=>({conversion:Ld,priority:0}),span:()=>({conversion:Md,priority:0}),strong:()=>({conversion:Ld,priority:0}),u:()=>({conversion:Ld,priority:0})}}selectionTransform(){}setFormat(a){I();const b=this.getWritable();this.getWritable().__format=
|
|
143
|
+
a;return b}setStyle(a){I();const b=this.getWritable();this.getWritable().__style=a;return b}toggleFormat(a){a=ea[a];return this.setFormat(this.getFormat()^a)}toggleDirectionless(){const a=this.getWritable();a.__detail^=1;return a}toggleUnmergeable(){const a=this.getWritable();a.__detail^=2;return a}setMode(a){a=ha[a];const b=this.getWritable();b.__mode=a;return b}setTextContent(a){I();const b=this.getWritable();b.__text=a;return b}select(a,b){I();const c=L();var d=this.getTextContent();const f=this.__key;
|
|
144
|
+
"string"===typeof d?(d=d.length,void 0===a&&(a=d),void 0===b&&(b=d)):b=a=0;if(K(c))d=C()._compositionKey,d!==c.anchor.key&&d!==c.focus.key||H(f),c.setTextNodeRange(this,a,this,b);else return Fc(f,a,f,b,"text","text");return c}spliceText(a,b,c,d){I();const f=this.getWritable(),e=f.__text,g=c.length;let h=a;0>h&&(h=g+h,0>h&&(h=0));const l=L();d&&K(l)&&(a+=g,l.setTextNodeRange(f,a,f,a));b=e.slice(0,h)+c+e.slice(h+b);return f.setTextContent(b)}canInsertTextBefore(){return!0}canInsertTextAfter(){return!0}splitText(...a){I();
|
|
145
|
+
var b=this.getLatest(),c=b.getTextContent(),d=b.__key,f=C()._compositionKey,e=new Set(a);a=[];var g=c.length,h="";for(var l=0;l<g;l++)""!==h&&e.has(l)&&(a.push(h),h=""),h+=c[l];""!==h&&a.push(h);e=a.length;if(0===e)return[];if(a[0]===c)return[b];var k=a[0];c=b.getParentOrThrow();l=c.__key;const m=b.getFormat(),n=b.getStyle(),p=b.__detail;g=!1;b.isSegmented()?(h=M(k),h.__parent=l,h.__format=m,h.__style=n,h.__detail=p,g=!0):(h=b.getWritable(),h.__text=k);b=L();h=[h];k=k.length;for(let x=1;x<e;x++){var u=
|
|
146
|
+
a[x],y=u.length;u=M(u).getWritable();u.__format=m;u.__style=n;u.__detail=p;const D=u.__key;y=k+y;if(K(b)){const w=b.anchor,F=b.focus;w.key===d&&"text"===w.type&&w.offset>k&&w.offset<=y&&(w.key=D,w.offset-=k,b.dirty=!0);F.key===d&&"text"===F.type&&F.offset>k&&F.offset<=y&&(F.key=D,F.offset-=k,b.dirty=!0)}f===d&&H(D);k=y;u.__parent=l;h.push(u)}G(this);f=c.getWritable().__children;d=f.indexOf(d);a=h.map(x=>x.__key);g?(f.splice(d,0,...a),this.remove()):f.splice(d,1,...a);K(b)&&ab(b,c,d,e-1);return h}mergeWithSibling(a){const b=
|
|
147
|
+
a===this.getPreviousSibling();b||a===this.getNextSibling()||q(22);const c=this.__key,d=a.__key,f=this.__text,e=f.length;C()._compositionKey===d&&H(c);const g=L();if(K(g)){const h=g.anchor,l=g.focus;null!==h&&h.key===d&&(Ic(h,b,c,a,e),g.dirty=!0);null!==l&&l.key===d&&(Ic(l,b,c,a,e),g.dirty=!0)}this.setTextContent(b?a.__text+f:f+a.__text);a.remove();return this.getLatest()}isTextEntity(){return!1}}
|
|
148
|
+
function Md(a){const b="700"===a.style.fontWeight;return{forChild:c=>{z(c)&&b&&c.toggleFormat("bold");return c},node:null}}function Kd(a){const b="normal"===a.style.fontWeight;return{forChild:c=>{z(c)&&!b&&c.toggleFormat("bold");return c},node:null}}function Jd(a){return{node:M(a.textContent)}}const Nd={em:"italic",i:"italic",strong:"bold",u:"underline"};function Ld(a){const b=Nd[a.nodeName.toLowerCase()];return void 0===b?{node:null}:{forChild:c=>{z(c)&&c.toggleFormat(b);return c},node:null}}
|
|
149
|
+
function M(a=""){return new Id(a)}function z(a){return a instanceof Id}
|
|
150
|
+
class Od extends Jc{static getType(){return"paragraph"}static clone(a){return new Od(a.__key)}constructor(a){super(a)}createDOM(a){const b=document.createElement("p");a=Ma(a.theme,"paragraph");void 0!==a&&b.classList.add(...a);return b}updateDOM(){return!1}static convertDOM(){return{p:()=>({conversion:Pd,priority:0})}}insertNewAfter(){const a=oc(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=this.getChildren();if(0===a.length||z(a[0])&&""===a[0].getTextContent().trim()){if(null!==
|
|
151
|
+
this.getNextSibling())return this.selectNext(),this.remove(),!0;if(null!==this.getPreviousSibling())return this.selectPrevious(),this.remove(),!0}return!1}}function Pd(){return{node:oc()}}function oc(){return new Od}
|
|
154
152
|
function Ub(a,b,c,d){const f=a._keyToDOMMap;f.clear();a._editorState=Lc();a._pendingEditorState=d;a._compositionKey=null;a._dirtyType=0;a._cloneNotNeeded.clear();a._dirtyLeaves=new Set;a._dirtyElements.clear();a._normalizedNodes=new Set;a._updateTags=new Set;a._updates=[];d=a._observer;null!==d&&(d.disconnect(),a._observer=null);null!==b&&(b.textContent="");null!==c&&(c.textContent="",f.set("root",c))}
|
|
155
|
-
function
|
|
156
|
-
class
|
|
153
|
+
function Qd(a){const b=new Map,c=new Set;a.forEach(d=>{d=d.klass.convertDOM;if(!c.has(d)){c.add(d);var f=d();null!==f&&Object.keys(f).forEach(e=>{let g=b.get(e);void 0===g&&(g=[],b.set(e,g));g.push(f[e])})}});return b}
|
|
154
|
+
class Rd{constructor(a,b,c,d,f,e){this._parentEditor=b;this._rootElement=null;this._editorState=a;this._compositionKey=this._pendingEditorState=null;this._deferred=[];this._keyToDOMMap=new Map;this._updates=[];this._updating=!1;this._listeners={command:new Map,decorator:new Set,mutation:new Map,readonly:new Set,root:new Set,textcontent:new Set,update:new Set};this._config=d;this._nodes=c;this._decorators={};this._pendingDecorators=null;this._dirtyType=0;this._cloneNotNeeded=new Set;this._dirtyLeaves=
|
|
157
155
|
new Set;this._dirtyElements=new Map;this._normalizedNodes=new Set;this._updateTags=new Set;this._observer=null;this._key=""+na++;this._onError=f;this._htmlConversions=e;this._readOnly=!1}isComposing(){return null!=this._compositionKey}registerUpdateListener(a){const b=this._listeners.update;b.add(a);return()=>{b.delete(a)}}registerReadOnlyListener(a){const b=this._listeners.readonly;b.add(a);return()=>{b.delete(a)}}registerDecoratorListener(a){const b=this._listeners.decorator;b.add(a);return()=>
|
|
158
|
-
{b.delete(a)}}registerTextContentListener(a){const b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){const 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&&
|
|
159
|
-
b){void 0===this._nodes.get(a.getType())&&
|
|
160
|
-
this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Ub(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Vc&&(Vc--,0===Vc&&b.ownerDocument.removeEventListener("selectionchange",
|
|
161
|
-
"text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Vb(this),this._updateTags.add("history-merge"),Sb(this),this._config.disableEvents||
|
|
162
|
-
Sb(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Sb(this)}parseEditorState(a){a=JSON.parse(a);var b=new Map;b=new $b(b);const c={originalSelection:a._selection},d=
|
|
163
|
-
()=>{const c=
|
|
164
|
-
class
|
|
165
|
-
exports.$getDecoratorNode=
|
|
166
|
-
exports.$isRootNode=
|
|
167
|
-
exports.
|
|
168
|
-
exports.
|
|
169
|
-
exports.
|
|
170
|
-
exports.createEditor=function(a){var b=a||{},c=b.namespace||Ha();const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Lc();a=b.editorState;const l=[Kc,
|
|
156
|
+
{b.delete(a)}}registerTextContentListener(a){const b=this._listeners.textcontent;b.add(a);return()=>{b.delete(a)}}registerRootListener(a){const 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&&q(56);const d=this._listeners.command;d.has(a)||d.set(a,[new Set,new Set,new Set,new Set,new Set]);const f=d.get(a);void 0===f&&q(81,a);const e=f[c];e.add(b);return()=>{e.delete(b);f.every(g=>0===g.size)&&d.delete(a)}}registerMutationListener(a,
|
|
157
|
+
b){void 0===this._nodes.get(a.getType())&&q(57,a.name);const c=this._listeners.mutation;c.set(b,a);return()=>{c.delete(b)}}registerNodeTransform(a,b){const c=a.getType(),d=this._nodes.get(c);void 0===d&&q(57,a.name);const f=d.transforms;f.add(b);Ca(this,c);return()=>{f.delete(b)}}hasNodes(a){for(let b=0;b<a.length;b++){const c=a[b].getType();if(!this._nodes.has(c))return!1}return!0}dispatchCommand(a,b){return Yb(this,a,b)}getDecorators(){return this._decorators}getRootElement(){return this._rootElement}setRootElement(a){const b=
|
|
158
|
+
this._rootElement;if(a!==b){var c=this._pendingEditorState||this._editorState;this._rootElement=a;Ub(this,b,a,c);if(null!==b&&!this._config.disableEvents){0!==Vc&&(Vc--,0===Vc&&b.ownerDocument.removeEventListener("selectionchange",td));c=b.__lexicalEditor;if(null!=c){if(null!==c._parentEditor){var d=Ga(c);d=d[d.length-1]._key;sd.get(d)===c&&sd.delete(d)}else sd.delete(c._key);b.__lexicalEditor=null}c=rd(b);for(d=0;d<c.length;d++)c[d]();b.__lexicalEventHandles=[]}null!==a&&(c=a.style,c.userSelect=
|
|
159
|
+
"text",c.whiteSpace="pre-wrap",c.wordBreak="break-word",a.setAttribute("data-lexical-editor","true"),this._dirtyType=2,Vb(this),this._updateTags.add("history-merge"),Sb(this),this._config.disableEvents||ud(a,this));Wb("root",this,!1,a,b)}}getElementByKey(a){return this._keyToDOMMap.get(a)||null}getEditorState(){return this._editorState}setEditorState(a,b){a.isEmpty()&&q(19);kc(this);const c=this._pendingEditorState,d=this._updateTags;b=void 0!==b?b.tag:null;null===c||c.isEmpty()||(null!=b&&d.add(b),
|
|
160
|
+
Sb(this));this._pendingEditorState=a;this._dirtyType=2;this._compositionKey=null;null!=b&&d.add(b);Sb(this)}parseEditorState(a){a=JSON.parse(a);var b=new Map;b=new $b(b);const c={originalSelection:a._selection},d=W,f=U;T=b;W=!1;U=this;try{const e=new Map(a._nodeMap),g=e.get("root");nb(g,e,this,null,c)}finally{T=b,W=d,U=f}b._selection=Gc(c.remappedSelection||c.originalSelection);return b}update(a,b){Da(this,a,b)}focus(a){const b=this._rootElement;null!==b&&(b.setAttribute("autocapitalize","off"),Da(this,
|
|
161
|
+
()=>{const c=L(),d=Ba();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=a;Wb("readonly",this,!0,a)}}class Sd extends Jc{constructor(a,b){super(b)}}function Ac(a){return a instanceof Sd}class Td extends Jc{}function yc(a){return a instanceof Td}
|
|
162
|
+
class Ud extends Jc{}function zc(a){return a instanceof Ud}const Xc={},Yc={},Zc={},$c={},ad={},bd={},cd={},dd={},ed={},fd={},Z={},gd={},hd={},qd={},pd={},od={},nd={},id={},jd={},kd={},ld={},md={},Cd={},zd={},yd={},vd={},Ad={},Bd={};exports.$createGridSelection=function(){return new rc("root","root","root")};exports.$createLineBreakNode=Cc;exports.$createNodeFromParse=function(a,b){I();const c=C();return nb(a,b,c,null)};exports.$createNodeSelection=function(){return new pc(new Set)};
|
|
163
|
+
exports.$createParagraphNode=oc;exports.$createRangeSelection=function(){const a=X("root",0,"element"),b=X("root",0,"element");return new qc(a,b,0)};exports.$createTextNode=M;exports.$getDecoratorNode=Pa;exports.$getNearestNodeFromDOMNode=qa;exports.$getNodeByKey=J;exports.$getPreviousSelection=Ka;exports.$getRoot=Ba;exports.$getSelection=L;exports.$isDecoratorNode=t;exports.$isElementNode=E;exports.$isGridCellNode=Ac;exports.$isGridNode=yc;exports.$isGridRowNode=zc;exports.$isGridSelection=sc;
|
|
164
|
+
exports.$isLeafNode=va;exports.$isLineBreakNode=wa;exports.$isNodeSelection=cc;exports.$isParagraphNode=function(a){return a instanceof Od};exports.$isRangeSelection=K;exports.$isRootNode=N;exports.$isTextNode=z;exports.$nodesOfType=function(a){var b=B();const c=b._readOnly,d=a.getType();b=b._nodeMap;const f=[];for(const [,e]of b)e instanceof a&&e.__type===d&&(c||e.isAttached())&&f.push(e);return f};exports.$setCompositionKey=H;exports.$setSelection=Ea;exports.BLUR_COMMAND=Bd;
|
|
165
|
+
exports.CAN_REDO_COMMAND={};exports.CAN_UNDO_COMMAND={};exports.CLEAR_EDITOR_COMMAND={};exports.CLEAR_HISTORY_COMMAND={};exports.CLICK_COMMAND=Yc;exports.COPY_COMMAND=yd;exports.CUT_COMMAND=vd;exports.DELETE_CHARACTER_COMMAND=Zc;exports.DELETE_LINE_COMMAND=fd;exports.DELETE_WORD_COMMAND=ed;exports.DRAGSTART_COMMAND=zd;exports.DROP_COMMAND=Cd;exports.DecoratorNode=kb;exports.ElementNode=Jc;exports.FOCUS_COMMAND=Ad;exports.FORMAT_ELEMENT_COMMAND={};exports.FORMAT_TEXT_COMMAND=Z;
|
|
166
|
+
exports.GridCellNode=Sd;exports.GridNode=Td;exports.GridRowNode=Ud;exports.INDENT_CONTENT_COMMAND={};exports.INSERT_LINE_BREAK_COMMAND=$c;exports.INSERT_PARAGRAPH_COMMAND=ad;exports.INSERT_TEXT_COMMAND=bd;exports.KEY_ARROW_DOWN_COMMAND=nd;exports.KEY_ARROW_LEFT_COMMAND=pd;exports.KEY_ARROW_RIGHT_COMMAND=qd;exports.KEY_ARROW_UP_COMMAND=od;exports.KEY_BACKSPACE_COMMAND=jd;exports.KEY_DELETE_COMMAND=ld;exports.KEY_ENTER_COMMAND=id;exports.KEY_ESCAPE_COMMAND=kd;exports.KEY_TAB_COMMAND=md;
|
|
167
|
+
exports.OUTDENT_CONTENT_COMMAND={};exports.PASTE_COMMAND=cd;exports.ParagraphNode=Od;exports.READ_ONLY_COMMAND={};exports.REDO_COMMAND=hd;exports.REMOVE_TEXT_COMMAND=dd;exports.SELECTION_CHANGE_COMMAND=Xc;exports.TextNode=Id;exports.UNDO_COMMAND=gd;exports.VERSION="0.1.18";exports.createCommand=function(){return{}};exports.createDecoratorArray=jb;exports.createDecoratorEditor=fb;exports.createDecoratorMap=hb;
|
|
168
|
+
exports.createEditor=function(a){var b=a||{},c=b.namespace||Ha();const d=b.theme||{},f=b.context||{},e=b.parentEditor||null,g=b.disableEvents||!1,h=Lc();a=b.editorState;const l=[Kc,Id,Dd,Od,...(b.nodes||[])],k=b.onError;b=b.readOnly||!1;const m=new Map;for(let n=0;n<l.length;n++){const p=l[n],u=p.getType();m.set(u,{klass:p,transforms:new Set})}c=new Rd(h,e,m,{context:f,disableEvents:g,namespace:c,theme:d},k,Qd(m),b);void 0!==a&&(c._pendingEditorState=a,c._dirtyType=2);return c};
|
|
171
169
|
exports.isDecoratorArray=function(a){return a instanceof ib};exports.isDecoratorEditor=function(a){return a instanceof eb};exports.isDecoratorMap=function(a){return a instanceof gb};
|