@lexical/code-core 0.49.1-nightly.20260824.0 → 0.49.1-nightly.20260826.0

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.
@@ -775,16 +775,16 @@ function isMonospaceDescendant(node) {
775
775
  * the cost of these rules is never paid against unrelated `<tr>` /
776
776
  * `<td>` pastes.
777
777
  */
778
- const GitHubCodeTableOverlayRules = /* @__PURE__ */html.defineOverlayRules([/* @__PURE__ */html.defineImportRule({
778
+ const GitHubCodeTableOverlayRules = /* @__PURE__ */html.defineOverlayRules([{
779
779
  $import: (ctx, el) => ctx.$importChildren(el),
780
- match: html.sel.tag('tr', 'td'),
780
+ match: /* @__PURE__ */html.sel.tag('tr', 'td'),
781
781
  name: '@lexical/code/github-code-table/unwrap'
782
- })]);
783
- const PreRule = /* @__PURE__ */html.defineImportRule({
782
+ }]);
783
+ const PreRule = {
784
784
  $import: (ctx, el) => [$createCodeNode(el.getAttribute(LANGUAGE_DATA_ATTRIBUTE), el.getAttribute(THEME_DATA_ATTRIBUTE)).splice(0, 0, ctx.$importChildren(el))],
785
- match: html.sel.tag('pre'),
785
+ match: /* @__PURE__ */html.sel.tag('pre'),
786
786
  name: '@lexical/code/pre'
787
- });
787
+ };
788
788
 
789
789
  /**
790
790
  * Multi-line `<code>` (containing newlines or `<br>`) is treated as a
@@ -792,7 +792,7 @@ const PreRule = /* @__PURE__ */html.defineImportRule({
792
792
  * defers to the inline-format rule from `CoreImportExtension` so it
793
793
  * becomes a TextNode with IS_CODE.
794
794
  */
795
- const MultilineCodeRule = /* @__PURE__ */html.defineImportRule({
795
+ const MultilineCodeRule = {
796
796
  $import: (ctx, el, $next) => {
797
797
  const text = el.textContent || '';
798
798
  const isMultiLine = /\r?\n/.test(text) || el.querySelector('br') !== null;
@@ -801,9 +801,9 @@ const MultilineCodeRule = /* @__PURE__ */html.defineImportRule({
801
801
  }
802
802
  return [$createCodeNode(el.getAttribute(LANGUAGE_DATA_ATTRIBUTE), el.getAttribute(THEME_DATA_ATTRIBUTE)).splice(0, 0, ctx.$importChildren(el))];
803
803
  },
804
- match: html.sel.tag('code'),
804
+ match: /* @__PURE__ */html.sel.tag('code'),
805
805
  name: '@lexical/code/code-multiline'
806
- });
806
+ };
807
807
 
808
808
  /**
809
809
  * True for elements carrying BOTH `font-family: …monospace…` and
@@ -907,7 +907,7 @@ function looksLikeVscodePaste(root) {
907
907
  * around per-line `<div>`s and `<br>`s. Emits a single CodeNode whose
908
908
  * text is the wrapper's lines joined by `\n`.
909
909
  */
910
- const VscodeWrapperRule = /* @__PURE__ */html.defineImportRule({
910
+ const VscodeWrapperRule = {
911
911
  $import: (_ctx, el, $next) => {
912
912
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
913
913
  return $next();
@@ -918,9 +918,9 @@ const VscodeWrapperRule = /* @__PURE__ */html.defineImportRule({
918
918
  }
919
919
  return [$createCodeNode().splice(0, 0, lexical.$generateNodesFromRawText(lines.join('\n')))];
920
920
  },
921
- match: html.sel.tag('div'),
921
+ match: /* @__PURE__ */html.sel.tag('div'),
922
922
  name: '@lexical/code/vscode-wrapper'
923
- });
923
+ };
924
924
 
925
925
  /**
926
926
  * Match the first of a run of consecutive monospace+pre `<div>` /
@@ -929,7 +929,7 @@ const VscodeWrapperRule = /* @__PURE__ */html.defineImportRule({
929
929
  * subsequent sibling in the same run, the prev-sibling check below
930
930
  * returns `[]` so the run is only emitted once.
931
931
  */
932
- const VscodeLineRunRule = /* @__PURE__ */html.defineImportRule({
932
+ const VscodeLineRunRule = {
933
933
  $import: (_ctx, el, $next) => {
934
934
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
935
935
  return $next();
@@ -950,9 +950,9 @@ const VscodeLineRunRule = /* @__PURE__ */html.defineImportRule({
950
950
  }
951
951
  return [$createCodeNode().splice(0, 0, lexical.$generateNodesFromRawText(lines.join('\n')))];
952
952
  },
953
- match: html.sel.tag('div', 'br'),
953
+ match: /* @__PURE__ */html.sel.tag('div', 'br'),
954
954
  name: '@lexical/code/vscode-line-run'
955
- });
955
+ };
956
956
  const VscodeCodePasteOverlay = /* @__PURE__ */html.defineOverlayRules([VscodeWrapperRule, VscodeLineRunRule]);
957
957
 
958
958
  /**
@@ -991,7 +991,7 @@ const $installVscodeCodePasteOverlay = (dom, ctx, $next) => {
991
991
  * wrapper just unwrap so their text content flows into the surrounding
992
992
  * CodeNode.
993
993
  */
994
- const DivRule = /* @__PURE__ */html.defineImportRule({
994
+ const DivRule = {
995
995
  $import: (ctx, el, $next) => {
996
996
  if (isMonospaceElement(el)) {
997
997
  return [$createCodeNode().splice(0, 0, ctx.$importChildren(el))];
@@ -1002,9 +1002,9 @@ const DivRule = /* @__PURE__ */html.defineImportRule({
1002
1002
  }
1003
1003
  return $next();
1004
1004
  },
1005
- match: html.sel.tag('div'),
1005
+ match: /* @__PURE__ */html.sel.tag('div'),
1006
1006
  name: '@lexical/code/div'
1007
- });
1007
+ };
1008
1008
 
1009
1009
  /**
1010
1010
  * GitHub raw-file-view `<table class="js-file-line-container">` becomes
@@ -1013,13 +1013,13 @@ const DivRule = /* @__PURE__ */html.defineImportRule({
1013
1013
  * subtree unwrap unconditionally — without paying the predicate cost
1014
1014
  * on every other `<tr>` / `<td>` paste elsewhere.
1015
1015
  */
1016
- const GitHubCodeTableRule = /* @__PURE__ */html.defineImportRule({
1016
+ const GitHubCodeTableRule = {
1017
1017
  $import: (ctx, el) => [$createCodeNode().splice(0, 0, ctx.$importChildren(el, {
1018
1018
  rules: GitHubCodeTableOverlayRules
1019
1019
  }))],
1020
- match: html.sel.tag('table').classAll('js-file-line-container'),
1020
+ match: /* @__PURE__ */html.sel.tag('table').classAll('js-file-line-container'),
1021
1021
  name: '@lexical/code/github-code-table'
1022
- });
1022
+ };
1023
1023
 
1024
1024
  /**
1025
1025
  * Stray `<td class="js-file-line">` (cell with the explicit GitHub code-
@@ -1027,11 +1027,11 @@ const GitHubCodeTableRule = /* @__PURE__ */html.defineImportRule({
1027
1027
  * descendant text flows up into whatever context the cell is in. The
1028
1028
  * class is part of the selector itself, so no runtime guard.
1029
1029
  */
1030
- const GitHubCodeCellByClassRule = /* @__PURE__ */html.defineImportRule({
1030
+ const GitHubCodeCellByClassRule = {
1031
1031
  $import: (ctx, el) => ctx.$importChildren(el),
1032
- match: html.sel.tag('td').classAll('js-file-line'),
1032
+ match: /* @__PURE__ */html.sel.tag('td').classAll('js-file-line'),
1033
1033
  name: '@lexical/code/github-code-cell-by-class'
1034
- });
1034
+ };
1035
1035
 
1036
1036
  /**
1037
1037
  * Import rules for {@link CodeNode}.
@@ -1064,15 +1064,15 @@ GitHubCodeTableRule, GitHubCodeCellByClassRule, MultilineCodeRule, PreRule, DivR
1064
1064
  /**
1065
1065
  * Add code blocks to the editor (syntax highlighting provided separately)
1066
1066
  */
1067
- const CodeExtension = /* @__PURE__ */lexical.defineExtension({
1067
+ const CodeExtension = {
1068
1068
  dependencies: [
1069
1069
  // DOMImportExtension support for the nodes registered here. Inert
1070
1070
  // unless the editor routes HTML through the pipeline (e.g. via
1071
1071
  // ClipboardDOMImportExtension or $generateNodesFromDOMViaExtension).
1072
- html.CoreImportExtension, /* @__PURE__ */lexical.configExtension(html.DOMImportExtension, {
1072
+ html.CoreImportExtension, ([html.DOMImportExtension, {
1073
1073
  preprocess: [$installVscodeCodePasteOverlay],
1074
1074
  rules: CodeImportRules
1075
- })],
1075
+ }])],
1076
1076
  name: '@lexical/code',
1077
1077
  nodes: () => [CodeNode, CodeHighlightNode],
1078
1078
  register(editor) {
@@ -1091,7 +1091,7 @@ const CodeExtension = /* @__PURE__ */lexical.defineExtension({
1091
1091
  }
1092
1092
  }));
1093
1093
  }
1094
- });
1094
+ };
1095
1095
 
1096
1096
  /**
1097
1097
  * Bundles {@link CodeImportRules} together with the runtime
@@ -1102,10 +1102,10 @@ const CodeExtension = /* @__PURE__ */lexical.defineExtension({
1102
1102
  * {@link CodeImportRules} (and `CoreImportExtension`) itself — depend on
1103
1103
  * it directly instead.
1104
1104
  */
1105
- const CodeImportExtension = /* @__PURE__ */lexical.defineExtension({
1105
+ const CodeImportExtension = {
1106
1106
  dependencies: [CodeExtension],
1107
1107
  name: '@lexical/code/Import'
1108
- });
1108
+ };
1109
1109
 
1110
1110
  function $isSelectionInCode(selection) {
1111
1111
  if (!lexical.$isRangeSelection(selection)) {
@@ -1561,13 +1561,13 @@ function registerCodeIndentation(editor, tabSize, escapeWithArrows) {
1561
1561
  * Code blocks without syntax highlighting can use this extension on its
1562
1562
  * own.
1563
1563
  */
1564
- const CodeIndentExtension = /* @__PURE__ */lexical.defineExtension({
1564
+ const CodeIndentExtension = {
1565
1565
  build: (editor, config) => extension.namedSignals(config),
1566
- config: /* @__PURE__ */lexical.safeCast({
1566
+ config: {
1567
1567
  disabled: false,
1568
1568
  escapeWithArrows: false,
1569
1569
  tabSize: undefined
1570
- }),
1570
+ },
1571
1571
  dependencies: [CodeExtension],
1572
1572
  name: '@lexical/code-indent',
1573
1573
  register: (editor, config, state) => {
@@ -1579,7 +1579,7 @@ const CodeIndentExtension = /* @__PURE__ */lexical.defineExtension({
1579
1579
  return registerCodeIndentation(editor, stores.tabSize.value, stores.escapeWithArrows.value);
1580
1580
  });
1581
1581
  }
1582
- });
1582
+ };
1583
1583
 
1584
1584
  exports.$createCodeHighlightNode = $createCodeHighlightNode;
1585
1585
  exports.$createCodeNode = $createCodeNode;
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { defineImportRule, sel, ImportOverlays, defineOverlayRules, CoreImportExtension, DOMImportExtension } from '@lexical/html';
10
- import { getTextDirection, $isElementNode, $isTabNode, $isLineBreakNode, tokenizeRawText, $createTabNode, $createLineBreakNode, $getSiblingCaret, $create, ElementNode, $getDocument, addClassNamesToElement, setDOMStyleFromCSS, $getEditor, $isTextNode, $createParagraphNode, isHTMLElement, $applyNodeReplacement, TextNode, removeClassNamesFromElement, isDOMDocumentNode, isDOMTextNode, $generateNodesFromRawText, defineExtension, mergeRegister, KEY_ENTER_COMMAND, $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, TabNode, configExtension, safeCast, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_TAB_COMMAND, INSERT_TAB_COMMAND, $insertNodes, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, MOVE_TO_START, MOVE_TO_END, $createPoint, $setSelectionFromCaretRange, $getCaretRangeInDirection, $getCaretRange, $getTextPointCaret, $normalizeCaret } from 'lexical';
9
+ import { sel, ImportOverlays, defineOverlayRules, CoreImportExtension, DOMImportExtension } from '@lexical/html';
10
+ import { getTextDirection, $isElementNode, $isTabNode, $isLineBreakNode, tokenizeRawText, $createTabNode, $createLineBreakNode, $getSiblingCaret, $create, ElementNode, $getDocument, addClassNamesToElement, setDOMStyleFromCSS, $getEditor, $isTextNode, $createParagraphNode, isHTMLElement, $applyNodeReplacement, TextNode, removeClassNamesFromElement, isDOMDocumentNode, isDOMTextNode, $generateNodesFromRawText, mergeRegister, KEY_ENTER_COMMAND, $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, TabNode, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_TAB_COMMAND, INSERT_TAB_COMMAND, $insertNodes, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, MOVE_TO_START, MOVE_TO_END, $createPoint, $setSelectionFromCaretRange, $getCaretRangeInDirection, $getCaretRange, $getTextPointCaret, $normalizeCaret } from 'lexical';
11
11
  import { getPeerDependencyFromEditor, effect, namedSignals } from '@lexical/extension';
12
12
  import { $onEscapeDown, $onEscapeUp } from '@lexical/utils';
13
13
 
@@ -773,16 +773,16 @@ function isMonospaceDescendant(node) {
773
773
  * the cost of these rules is never paid against unrelated `<tr>` /
774
774
  * `<td>` pastes.
775
775
  */
776
- const GitHubCodeTableOverlayRules = /* @__PURE__ */defineOverlayRules([/* @__PURE__ */defineImportRule({
776
+ const GitHubCodeTableOverlayRules = /* @__PURE__ */defineOverlayRules([{
777
777
  $import: (ctx, el) => ctx.$importChildren(el),
778
- match: sel.tag('tr', 'td'),
778
+ match: /* @__PURE__ */sel.tag('tr', 'td'),
779
779
  name: '@lexical/code/github-code-table/unwrap'
780
- })]);
781
- const PreRule = /* @__PURE__ */defineImportRule({
780
+ }]);
781
+ const PreRule = {
782
782
  $import: (ctx, el) => [$createCodeNode(el.getAttribute(LANGUAGE_DATA_ATTRIBUTE), el.getAttribute(THEME_DATA_ATTRIBUTE)).splice(0, 0, ctx.$importChildren(el))],
783
- match: sel.tag('pre'),
783
+ match: /* @__PURE__ */sel.tag('pre'),
784
784
  name: '@lexical/code/pre'
785
- });
785
+ };
786
786
 
787
787
  /**
788
788
  * Multi-line `<code>` (containing newlines or `<br>`) is treated as a
@@ -790,7 +790,7 @@ const PreRule = /* @__PURE__ */defineImportRule({
790
790
  * defers to the inline-format rule from `CoreImportExtension` so it
791
791
  * becomes a TextNode with IS_CODE.
792
792
  */
793
- const MultilineCodeRule = /* @__PURE__ */defineImportRule({
793
+ const MultilineCodeRule = {
794
794
  $import: (ctx, el, $next) => {
795
795
  const text = el.textContent || '';
796
796
  const isMultiLine = /\r?\n/.test(text) || el.querySelector('br') !== null;
@@ -799,9 +799,9 @@ const MultilineCodeRule = /* @__PURE__ */defineImportRule({
799
799
  }
800
800
  return [$createCodeNode(el.getAttribute(LANGUAGE_DATA_ATTRIBUTE), el.getAttribute(THEME_DATA_ATTRIBUTE)).splice(0, 0, ctx.$importChildren(el))];
801
801
  },
802
- match: sel.tag('code'),
802
+ match: /* @__PURE__ */sel.tag('code'),
803
803
  name: '@lexical/code/code-multiline'
804
- });
804
+ };
805
805
 
806
806
  /**
807
807
  * True for elements carrying BOTH `font-family: …monospace…` and
@@ -905,7 +905,7 @@ function looksLikeVscodePaste(root) {
905
905
  * around per-line `<div>`s and `<br>`s. Emits a single CodeNode whose
906
906
  * text is the wrapper's lines joined by `\n`.
907
907
  */
908
- const VscodeWrapperRule = /* @__PURE__ */defineImportRule({
908
+ const VscodeWrapperRule = {
909
909
  $import: (_ctx, el, $next) => {
910
910
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
911
911
  return $next();
@@ -916,9 +916,9 @@ const VscodeWrapperRule = /* @__PURE__ */defineImportRule({
916
916
  }
917
917
  return [$createCodeNode().splice(0, 0, $generateNodesFromRawText(lines.join('\n')))];
918
918
  },
919
- match: sel.tag('div'),
919
+ match: /* @__PURE__ */sel.tag('div'),
920
920
  name: '@lexical/code/vscode-wrapper'
921
- });
921
+ };
922
922
 
923
923
  /**
924
924
  * Match the first of a run of consecutive monospace+pre `<div>` /
@@ -927,7 +927,7 @@ const VscodeWrapperRule = /* @__PURE__ */defineImportRule({
927
927
  * subsequent sibling in the same run, the prev-sibling check below
928
928
  * returns `[]` so the run is only emitted once.
929
929
  */
930
- const VscodeLineRunRule = /* @__PURE__ */defineImportRule({
930
+ const VscodeLineRunRule = {
931
931
  $import: (_ctx, el, $next) => {
932
932
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
933
933
  return $next();
@@ -948,9 +948,9 @@ const VscodeLineRunRule = /* @__PURE__ */defineImportRule({
948
948
  }
949
949
  return [$createCodeNode().splice(0, 0, $generateNodesFromRawText(lines.join('\n')))];
950
950
  },
951
- match: sel.tag('div', 'br'),
951
+ match: /* @__PURE__ */sel.tag('div', 'br'),
952
952
  name: '@lexical/code/vscode-line-run'
953
- });
953
+ };
954
954
  const VscodeCodePasteOverlay = /* @__PURE__ */defineOverlayRules([VscodeWrapperRule, VscodeLineRunRule]);
955
955
 
956
956
  /**
@@ -989,7 +989,7 @@ const $installVscodeCodePasteOverlay = (dom, ctx, $next) => {
989
989
  * wrapper just unwrap so their text content flows into the surrounding
990
990
  * CodeNode.
991
991
  */
992
- const DivRule = /* @__PURE__ */defineImportRule({
992
+ const DivRule = {
993
993
  $import: (ctx, el, $next) => {
994
994
  if (isMonospaceElement(el)) {
995
995
  return [$createCodeNode().splice(0, 0, ctx.$importChildren(el))];
@@ -1000,9 +1000,9 @@ const DivRule = /* @__PURE__ */defineImportRule({
1000
1000
  }
1001
1001
  return $next();
1002
1002
  },
1003
- match: sel.tag('div'),
1003
+ match: /* @__PURE__ */sel.tag('div'),
1004
1004
  name: '@lexical/code/div'
1005
- });
1005
+ };
1006
1006
 
1007
1007
  /**
1008
1008
  * GitHub raw-file-view `<table class="js-file-line-container">` becomes
@@ -1011,13 +1011,13 @@ const DivRule = /* @__PURE__ */defineImportRule({
1011
1011
  * subtree unwrap unconditionally — without paying the predicate cost
1012
1012
  * on every other `<tr>` / `<td>` paste elsewhere.
1013
1013
  */
1014
- const GitHubCodeTableRule = /* @__PURE__ */defineImportRule({
1014
+ const GitHubCodeTableRule = {
1015
1015
  $import: (ctx, el) => [$createCodeNode().splice(0, 0, ctx.$importChildren(el, {
1016
1016
  rules: GitHubCodeTableOverlayRules
1017
1017
  }))],
1018
- match: sel.tag('table').classAll('js-file-line-container'),
1018
+ match: /* @__PURE__ */sel.tag('table').classAll('js-file-line-container'),
1019
1019
  name: '@lexical/code/github-code-table'
1020
- });
1020
+ };
1021
1021
 
1022
1022
  /**
1023
1023
  * Stray `<td class="js-file-line">` (cell with the explicit GitHub code-
@@ -1025,11 +1025,11 @@ const GitHubCodeTableRule = /* @__PURE__ */defineImportRule({
1025
1025
  * descendant text flows up into whatever context the cell is in. The
1026
1026
  * class is part of the selector itself, so no runtime guard.
1027
1027
  */
1028
- const GitHubCodeCellByClassRule = /* @__PURE__ */defineImportRule({
1028
+ const GitHubCodeCellByClassRule = {
1029
1029
  $import: (ctx, el) => ctx.$importChildren(el),
1030
- match: sel.tag('td').classAll('js-file-line'),
1030
+ match: /* @__PURE__ */sel.tag('td').classAll('js-file-line'),
1031
1031
  name: '@lexical/code/github-code-cell-by-class'
1032
- });
1032
+ };
1033
1033
 
1034
1034
  /**
1035
1035
  * Import rules for {@link CodeNode}.
@@ -1062,15 +1062,15 @@ GitHubCodeTableRule, GitHubCodeCellByClassRule, MultilineCodeRule, PreRule, DivR
1062
1062
  /**
1063
1063
  * Add code blocks to the editor (syntax highlighting provided separately)
1064
1064
  */
1065
- const CodeExtension = /* @__PURE__ */defineExtension({
1065
+ const CodeExtension = {
1066
1066
  dependencies: [
1067
1067
  // DOMImportExtension support for the nodes registered here. Inert
1068
1068
  // unless the editor routes HTML through the pipeline (e.g. via
1069
1069
  // ClipboardDOMImportExtension or $generateNodesFromDOMViaExtension).
1070
- CoreImportExtension, /* @__PURE__ */configExtension(DOMImportExtension, {
1070
+ CoreImportExtension, ([DOMImportExtension, {
1071
1071
  preprocess: [$installVscodeCodePasteOverlay],
1072
1072
  rules: CodeImportRules
1073
- })],
1073
+ }])],
1074
1074
  name: '@lexical/code',
1075
1075
  nodes: () => [CodeNode, CodeHighlightNode],
1076
1076
  register(editor) {
@@ -1089,7 +1089,7 @@ const CodeExtension = /* @__PURE__ */defineExtension({
1089
1089
  }
1090
1090
  }));
1091
1091
  }
1092
- });
1092
+ };
1093
1093
 
1094
1094
  /**
1095
1095
  * Bundles {@link CodeImportRules} together with the runtime
@@ -1100,10 +1100,10 @@ const CodeExtension = /* @__PURE__ */defineExtension({
1100
1100
  * {@link CodeImportRules} (and `CoreImportExtension`) itself — depend on
1101
1101
  * it directly instead.
1102
1102
  */
1103
- const CodeImportExtension = /* @__PURE__ */defineExtension({
1103
+ const CodeImportExtension = {
1104
1104
  dependencies: [CodeExtension],
1105
1105
  name: '@lexical/code/Import'
1106
- });
1106
+ };
1107
1107
 
1108
1108
  function $isSelectionInCode(selection) {
1109
1109
  if (!$isRangeSelection(selection)) {
@@ -1559,13 +1559,13 @@ function registerCodeIndentation(editor, tabSize, escapeWithArrows) {
1559
1559
  * Code blocks without syntax highlighting can use this extension on its
1560
1560
  * own.
1561
1561
  */
1562
- const CodeIndentExtension = /* @__PURE__ */defineExtension({
1562
+ const CodeIndentExtension = {
1563
1563
  build: (editor, config) => namedSignals(config),
1564
- config: /* @__PURE__ */safeCast({
1564
+ config: {
1565
1565
  disabled: false,
1566
1566
  escapeWithArrows: false,
1567
1567
  tabSize: undefined
1568
- }),
1568
+ },
1569
1569
  dependencies: [CodeExtension],
1570
1570
  name: '@lexical/code-indent',
1571
1571
  register: (editor, config, state) => {
@@ -1577,6 +1577,6 @@ const CodeIndentExtension = /* @__PURE__ */defineExtension({
1577
1577
  return registerCodeIndentation(editor, stores.tabSize.value, stores.escapeWithArrows.value);
1578
1578
  });
1579
1579
  }
1580
- });
1580
+ };
1581
1581
 
1582
1582
  export { $createCodeHighlightNode, $createCodeNode, $getCodeLineDirection, $getEndOfCodeInLine, $getFirstCodeNodeOfLine, $getLastCodeNodeOfLine, $getStartOfCodeInLine, $isCodeHighlightNode, $isCodeNode, $outdentLeadingSpaces, $plainifyCodeContent, CodeExtension, CodeHighlightNode, CodeImportExtension, CodeImportRules, CodeIndentExtension, CodeNode, DEFAULT_CODE_LANGUAGE, getDefaultCodeLanguage, registerCodeIndentation };
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/html"),t=require("lexical"),n=require("@lexical/extension"),r=require("@lexical/utils");function i(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function o(e,n){let r=e;for(let i=t.$getSiblingCaret(e,n);i&&(y(i.origin)||t.$isTabNode(i.origin));i=i.getAdjacentCaret())r=i.origin;return r}function s(e){return o(e,"previous")}function l(e){return o(e,"next")}function a(e){const n=s(e),r=l(e);let i=n;for(;null!==i;){if(y(i)){const e=t.getTextDirection(i.getTextContent());if(null!==e)return e}if(i===r)break;i=i.getNextSibling()}const o=n.getParent();if(t.$isElementNode(o)){const e=o.getDirection();if("ltr"===e||"rtl"===e)return e}return null}function c(e,n){let r=null,o=null,s=e,l=n,a=e.getTextContent();for(;;){if(0===l){const e=s.getPreviousSibling();if(null===e){s=null;break}if(y(e)||t.$isTabNode(e)||t.$isLineBreakNode(e)||i(167),s=e,t.$isLineBreakNode(s)){r={node:s,offset:1};break}l=Math.max(0,s.getTextContentSize()-1),a=s.getTextContent()}else l--;const e=a[l];y(s)&&" "!==e&&(o={node:s,offset:l})}if(null!==o)return o;let c=null;if(n<e.getTextContentSize())y(e)&&(c=e.getTextContent()[n]);else{const t=e.getNextSibling();y(t)&&(c=t.getTextContent()[0])}if(null!==c&&" "!==c)return r;{const i=function(e,n){let r=e,i=n,o=e.getTextContent(),s=e.getTextContentSize();for(;;){if(!y(r)||i===s){if(r=r.getNextSibling(),null===r||t.$isLineBreakNode(r))return null;y(r)&&(i=0,o=r.getTextContent(),s=r.getTextContentSize())}if(y(r)){if(" "!==o[i])return{node:r,offset:i};i++}}}(e,n);return null!==i?i:r}}function u(e){const n=l(e);return t.$isLineBreakNode(n)&&i(168),n}function g(e,t,n){if(!Number.isInteger(t)||t<=0)return!1;const r=e.getTextContent(),i=/^ +/.exec(r);if(!i)return!1;const o=Math.min(t,i[0].length),s=e.getKey(),l=n.anchor.key===s&&"text"===n.anchor.type?n.anchor.offset:null,a=n.focus.key===s&&"text"===n.focus.type?n.focus.offset:null;return e.spliceText(0,o,""),null!==l&&n.anchor.set(s,Math.max(0,l-o),"text"),null!==a&&n.focus.set(s,Math.max(0,a-o),"text"),!0}const d="javascript";function f(e,n){for(const r of e.childNodes){if(t.isHTMLElement(r)&&r.tagName===n)return!0;if(f(r,n))return!0}return!1}const h="data-language",p="data-highlight-language",N="data-theme",m=()=>{};class _ extends t.ElementNode{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:t.ElementNode,importDOM:{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||f(e,"BR"))?{conversion:C,priority:1}:null,div:()=>({conversion:O,priority:1}),pre:()=>({conversion:C,priority:0}),table:e=>b(e)?{conversion:S,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&b(n)?{conversion:$,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&b(t)?{conversion:$,priority:3}:null}}})}constructor(e=void 0,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const n=t.$getDocument().createElement("code");t.addClassNamesToElement(n,e.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(h,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(p,r));const i=this.getTheme();i&&n.setAttribute(N,i);const o=this.getStyle();return o&&t.setDOMStyleFromCSS(n.style,o),n}updateDOM(e,n,r){const i=this.__language,o=e.__language;i?i!==o&&n.setAttribute(h,i):o&&n.removeAttribute(h);const s=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&o?s&&i?i!==o&&n.setAttribute(p,i):n.removeAttribute(p):s&&i&&n.setAttribute(p,i);const l=this.__theme,a=e.__theme;l?l!==a&&n.setAttribute(N,l):a&&n.removeAttribute(N);const c=this.__style,u=e.__style;return c!==u&&t.setDOMStyleFromCSS(n.style,c,u),!1}exportDOM(e){const n=t.$getDocument().createElement("pre");t.addClassNamesToElement(n,e._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(h,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(p,r));const i=this.getTheme();i&&n.setAttribute(N,i);const o=this.getStyle();return o&&t.setDOMStyleFromCSS(n.style,o),{element:n}}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,r=!0){if(!n.getPeerDependencyFromEditor(t.$getEditor(),"@lexical/code")){m();const t=A(e);if(t)return t}const{anchor:i,focus:o}=e,l=(i.isBefore(o)?i:o).getNode();if(t.$isTextNode(l)){let e=s(l);const n=[];for(;;)if(t.$isTabNode(e))n.push(t.$createTabNode()),e=e.getNextSibling();else{if(!y(e))break;{let t=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;t<i&&" "===r[t];)t++;if(0!==t&&n.push(D(" ".repeat(t))),t!==i)break;e=e.getNextSibling()}}const r=l.splitText(i.offset)[0],o=0===i.offset?0:1,a=r.getIndexWithinParent()+o,c=l.getParentOrThrow(),u=[t.$createLineBreakNode(),...n];c.splice(a,0,u);const g=n[n.length-1];g?g.select():0===i.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(x(l)){const{offset:n}=e.anchor;l.splice(n,0,[t.$createLineBreakNode()]),l.select(n+1,n+1)}return null}canIndent(){return!1}collapseAtStart(){const e=t.$createParagraphNode();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}}function T(e,n){return t.$create(_).setLanguage(e).setTheme(n)}function x(e){return e instanceof _}function C(e){return{node:T(e.getAttribute(h),e.getAttribute(N))}}function O(e){const t=e,n=M(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(M(t))return!0;t=t.parentElement}return!1}(t)?{node:n?T():null}:{node:null}}function S(){return{node:T()}}function $(){return{node:null}}function M(e){return null!==e.style.fontFamily.match("monospace")}function b(e){return e.classList.contains("js-file-line-container")}function A(e){const{anchor:n}=e;if(e.isCollapsed()&&"element"===n.type){const e=n.getNode();if(x(e)){const r=e.getChildrenSize();if(r>=2&&n.offset===r){const n=e.getLastChild();if(t.$isLineBreakNode(n)&&t.$isLineBreakNode(n.getPreviousSibling())){const n=t.$createParagraphNode();return e.splice(r-2,2,[]).insertAfter(n,!1),n.select(),n}}}}return null}class E extends t.TextNode{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}$config(){return this.config("code-highlight",{extends:t.TextNode})}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const n=super.createDOM(e),r=R(e.theme,this.__highlightType);return t.addClassNamesToElement(n,r),n}updateDOM(e,n,r){const i=super.updateDOM(e,n,r),o=R(r.theme,e.__highlightType),s=R(r.theme,this.__highlightType);return o!==s&&(o&&t.removeClassNamesFromElement(n,o),s&&t.addClassNamesToElement(n,s)),i}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return T()}}function R(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function D(e="",n){return t.$applyNodeReplacement(new E(e,n))}function y(e){return e instanceof E}const v="data-language",I="data-theme";function L(e){return null!==e.style.fontFamily.match("monospace")}function P(e){let t=e.parentElement;for(;null!==t;){if(L(t))return!0;t=t.parentElement}return!1}const B=/* @__PURE__ */e.defineOverlayRules([/* @__PURE__ */e.defineImportRule({$import:(e,t)=>e.$importChildren(t),match:e.sel.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"})]),W=/* @__PURE__ */e.defineImportRule({$import:(e,t)=>[T(t.getAttribute(v),t.getAttribute(I)).splice(0,0,e.$importChildren(t))],match:e.sel.tag("pre"),name:"@lexical/code/pre"}),k=/* @__PURE__ */e.defineImportRule({$import:(e,t,n)=>{const r=t.textContent||"";return/\r?\n/.test(r)||null!==t.querySelector("br")?[T(t.getAttribute(v),t.getAttribute(I)).splice(0,0,e.$importChildren(t))]:n()},match:e.sel.tag("code"),name:"@lexical/code/code-multiline"});function H(e){if(!t.isHTMLElement(e))return!1;const n=e.style.fontFamily,r=e.style.whiteSpace;return"string"==typeof n&&/monospace/i.test(n)&&"string"==typeof r&&r.startsWith("pre")}function w(e){let n=!1;const r=[];let i="",o=!1;const s=()=>{o&&(r.push(i),i="",o=!1)};for(const l of Array.from(e.childNodes))if(t.isHTMLElement(l))"DIV"===l.tagName?(s(),r.push(l.textContent||""),n=!0):"BR"===l.tagName?(s(),r.push(""),n=!0):(i+=l.textContent||"",o=!0);else if(t.isDOMTextNode(l)){const e=l.textContent||"";e.length>0&&(i+=e,o=!0)}return s(),n?r:null}function F(e){for(const n of Array.from(e.children)){if(t.isHTMLElement(n)&&H(n)){if(null!==w(n))return!0;const e=n.nextElementSibling;if(e&&H(e))return!0;continue}if(F(n))return!0}return!1}const Y=/* @__PURE__ */e.defineImportRule({$import:(e,n,r)=>{if(!H(n)||P(n))return r();const i=w(n);return null===i||0===i.length?r():[T().splice(0,0,t.$generateNodesFromRawText(i.join("\n")))]},match:e.sel.tag("div"),name:"@lexical/code/vscode-wrapper"}),K=/* @__PURE__ */e.defineImportRule({$import:(e,n,r)=>{if(!H(n)||P(n))return r();const i=n.previousElementSibling;if(i&&H(i))return[];const o=[];let s=n;for(;s&&H(s);)o.push("BR"===s.tagName?"":s.textContent||""),s=s.nextElementSibling;return o.length<2?r():[T().splice(0,0,t.$generateNodesFromRawText(o.join("\n")))]},match:e.sel.tag("div","br"),name:"@lexical/code/vscode-line-run"}),U=/* @__PURE__ */e.defineOverlayRules([Y,K]),z=/* @__PURE__ */e.defineImportRule({$import:(e,t,n)=>L(t)?[T().splice(0,0,e.$importChildren(t))]:P(t)?e.$importChildren(t):n(),match:e.sel.tag("div"),name:"@lexical/code/div"}),j=[/* @__PURE__ */e.defineImportRule({$import:(e,t)=>[T().splice(0,0,e.$importChildren(t,{rules:B}))],match:e.sel.tag("table").classAll("js-file-line-container"),name:"@lexical/code/github-code-table"}),/* @__PURE__ */e.defineImportRule({$import:(e,t)=>e.$importChildren(t),match:e.sel.tag("td").classAll("js-file-line"),name:"@lexical/code/github-code-cell-by-class"}),k,W,z],J=/* @__PURE__ */t.defineExtension({dependencies:[e.CoreImportExtension,/* @__PURE__ */t.configExtension(e.DOMImportExtension,{preprocess:[(n,r,i)=>{F(t.isDOMDocumentNode(n)?n.body:n)&&r.session.update(e.ImportOverlays,e=>[...e,U]),i()}],rules:j})],name:"@lexical/code",nodes:()=>[_,E],register:e=>t.mergeRegister(e.registerCommand(t.KEY_ENTER_COMMAND,e=>{const n=t.$getSelection();return!(!t.$isRangeSelection(n)||!A(n))&&(null!==e&&e.preventDefault(),!0)},t.COMMAND_PRIORITY_LOW),e.registerNodeTransform(t.TabNode,e=>{0!==e.getFormat()&&x(e.getParent())&&e.setFormat(0)}))}),q=/* @__PURE__ */t.defineExtension({dependencies:[J],name:"@lexical/code/Import"});function V(e){if(!t.$isRangeSelection(e))return!1;const n=e.anchor.getNode(),r=x(n)?n:n.getParent(),i=e.focus.getNode(),o=x(i)?i:i.getParent();return x(r)&&r.is(o)}function G(e){const n=e.getNodes(),r=[];if(1===n.length&&x(n[0]))return r;let o=[];for(let e=0;e<n.length;e++){const s=n[e];y(s)||t.$isTabNode(s)||t.$isLineBreakNode(s)||i(169),t.$isLineBreakNode(s)?o.length>0&&(r.push(o),o=[]):o.push(s)}if(o.length>0){const n=e.isBackward()?e.anchor:e.focus,i=t.$createPoint(o[0].getKey(),0,"text");n.is(i)||r.push(o)}return r}function Q(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r)||!V(r))return!1;const i=G(r),o=i.length;if(0===o&&r.isCollapsed())return e===t.INDENT_CONTENT_COMMAND?r.insertNodes([t.$createTabNode()]):function(e,n){const r=e.anchor.getNode();if(!y(r)&&!t.$isTabNode(r))return;const i=s(r);t.$isTabNode(i)?i.remove():void 0!==n&&y(i)&&g(i,n,e)}(r,n),!0;if(0===o&&e===t.INDENT_CONTENT_COMMAND&&"\n"===r.getTextContent()){const e=t.$createTabNode(),n=t.$createLineBreakNode(),i=r.isBackward()?"previous":"next";return r.insertNodes([e,n]),t.$setSelectionFromCaretRange(t.$getCaretRangeInDirection(t.$getCaretRange(t.$getTextPointCaret(e,"next",0),t.$normalizeCaret(t.$getSiblingCaret(n,"next"))),i)),!0}for(let l=0;l<o;l++){const o=i[l];if(o.length>0){let i=o[0];if(0===l&&(i=s(i)),e===t.INDENT_CONTENT_COMMAND){const e=t.$createTabNode();if(i.insertBefore(e),0===l){const n=r.isBackward()?"focus":"anchor",o=t.$createPoint(i.getKey(),0,"text");r[n].is(o)&&r[n].set(e.getKey(),0,"text")}}else t.$isTabNode(i)?i.remove():void 0!==n&&y(i)&&g(i,n,r)}}return!0}function X(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r))return!1;const{anchor:i,focus:o}=r,a=i.offset,c=o.offset,u=i.getNode(),g=o.getNode(),d=e===t.KEY_ARROW_UP_COMMAND;if(!V(r)||!y(u)&&!t.$isTabNode(u)||!y(g)&&!t.$isTabNode(g))return!1;if(!n.altKey){if(r.isCollapsed()){const e=u.getParentOrThrow();if(d&&0===a&&null===u.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),n.preventDefault(),!1}else if(!d&&a===u.getTextContentSize()&&null===u.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),n.preventDefault(),!1}}return!1}let f,h;if(u.isBefore(g)?(f=s(u),h=l(g)):(f=s(g),h=l(u)),null==f||null==h)return!1;const p=f.getNodesBetween(h);for(let e=0;e<p.length;e++){const n=p[e];if(!y(n)&&!t.$isTabNode(n)&&!t.$isLineBreakNode(n))return!1}n.preventDefault(),n.stopPropagation();const N=d?f.getPreviousSibling():h.getNextSibling();if(!t.$isLineBreakNode(N))return!0;const m=d?N.getPreviousSibling():N.getNextSibling();if(null==m)return!0;const _=t.$isLineBreakNode(m),T=_||!y(m)&&!t.$isTabNode(m)?null:d?s(m):l(m);let x=null!=T?T:m;return N.remove(),p.forEach(e=>e.remove()),_?(p.forEach(e=>{x.insertAfter(e),x=e}),x.insertAfter(N)):e===t.KEY_ARROW_UP_COMMAND?(p.forEach(e=>x.insertBefore(e)),x.insertBefore(N)):(x.insertAfter(N),x=N,p.forEach(e=>{x.insertAfter(e),x=e})),r.setTextNodeRange(u,a,g,c),!0}function Z(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r))return!1;const{anchor:i,focus:o}=r,s=i.getNode(),l=o.getNode(),g=e===t.MOVE_TO_START;if(!V(r)||!y(s)&&!t.$isTabNode(s)||!y(l)&&!t.$isTabNode(l))return!1;const d=l,f="rtl"===a(d)?!g:g,h=i.key,p=i.offset,N=i.type;if(f){const e=c(d,o.offset);if(null!==e){const{node:n,offset:i}=e;t.$isLineBreakNode(n)?n.selectNext(0,0):r.setTextNodeRange(n,i,n,i)}else d.getParentOrThrow().selectStart()}else{u(d).select()}return n.shiftKey&&r.anchor.set(h,p,N),n.preventDefault(),n.stopPropagation(),!0}function ee(e,n,o){return t.mergeRegister(...o?[e.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>!e.altKey&&r.$onEscapeDown(x,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_RIGHT_COMMAND,e=>r.$onEscapeDown(x,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>!e.altKey&&r.$onEscapeUp(x,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_LEFT_COMMAND,e=>r.$onEscapeUp(x,e),t.COMMAND_PRIORITY_LOW)]:[],e.registerCommand(t.KEY_TAB_COMMAND,n=>{const r=function(e){const n=t.$getSelection();if(!t.$isRangeSelection(n)||!V(n))return null;const r=e?t.OUTDENT_CONTENT_COMMAND:t.INDENT_CONTENT_COMMAND,o=e?t.OUTDENT_CONTENT_COMMAND:t.INSERT_TAB_COMMAND,a=n.anchor,c=n.focus;if(a.is(c))return o;const u=G(n);if(1!==u.length)return r;const g=u[0];let d,f;0===g.length&&i(285),n.isBackward()?(d=c,f=a):(d=a,f=c);const h=s(g[0]),p=l(g[0]),N=t.$createPoint(h.getKey(),0,"text"),m=t.$createPoint(p.getKey(),p.getTextContentSize(),"text");return d.isBefore(N)||m.isBefore(f)?r:N.isBefore(d)||f.isBefore(m)?o:r}(n.shiftKey);return null!==r&&(n.preventDefault(),e.dispatchCommand(r),!0)},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.INSERT_TAB_COMMAND,()=>!!V(t.$getSelection())&&(t.$insertNodes([t.$createTabNode()]),!0),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.INDENT_CONTENT_COMMAND,()=>Q(t.INDENT_CONTENT_COMMAND),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.OUTDENT_CONTENT_COMMAND,()=>Q(t.OUTDENT_CONTENT_COMMAND,n),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>{const n=t.$getSelection();if(!t.$isRangeSelection(n))return!1;const{anchor:r}=n,i=r.getNode();if(!V(n))return!1;const o=i.getParent();return n.isCollapsed()&&0===r.offset&&null===i.getPreviousSibling()&&x(o)&&null===o.getPreviousSibling()?(e.preventDefault(),!0):X(t.KEY_ARROW_UP_COMMAND,e)},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>{const n=t.$getSelection();if(!t.$isRangeSelection(n))return!1;const{anchor:r}=n,i=r.getNode();return!!V(n)&&(n.isCollapsed()&&r.offset===i.getTextContentSize()&&null===i.getNextSibling()&&x(i.getParentOrThrow())&&null===i.getParentOrThrow().getNextSibling()?(e.preventDefault(),!0):X(t.KEY_ARROW_DOWN_COMMAND,e))},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.MOVE_TO_START,e=>Z(t.MOVE_TO_START,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.MOVE_TO_END,e=>Z(t.MOVE_TO_END,e),t.COMMAND_PRIORITY_LOW))}const te=/* @__PURE__ */t.defineExtension({build:(e,t)=>n.namedSignals(t),config:/* @__PURE__ */t.safeCast({disabled:!1,escapeWithArrows:!1,tabSize:void 0}),dependencies:[J],name:"@lexical/code-indent",register:(e,t,r)=>{const i=r.getOutput();return n.effect(()=>{if(!i.disabled.value)return ee(e,i.tabSize.value,i.escapeWithArrows.value)})}});exports.$createCodeHighlightNode=D,exports.$createCodeNode=T,exports.$getCodeLineDirection=a,exports.$getEndOfCodeInLine=u,exports.$getFirstCodeNodeOfLine=s,exports.$getLastCodeNodeOfLine=l,exports.$getStartOfCodeInLine=c,exports.$isCodeHighlightNode=y,exports.$isCodeNode=x,exports.$outdentLeadingSpaces=g,exports.$plainifyCodeContent=function(e){const n=[];return t.tokenizeRawText(e,{linebreak:()=>n.push(t.$createLineBreakNode()),tab:()=>n.push(t.$createTabNode()),text:e=>n.push(D(e))}),n},exports.CodeExtension=J,exports.CodeHighlightNode=E,exports.CodeImportExtension=q,exports.CodeImportRules=j,exports.CodeIndentExtension=te,exports.CodeNode=_,exports.DEFAULT_CODE_LANGUAGE=d,exports.getDefaultCodeLanguage=()=>d,exports.registerCodeIndentation=ee;
9
+ "use strict";var e=require("@lexical/html"),t=require("lexical"),n=require("@lexical/extension"),r=require("@lexical/utils");function i(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function o(e,n){let r=e;for(let i=t.$getSiblingCaret(e,n);i&&(R(i.origin)||t.$isTabNode(i.origin));i=i.getAdjacentCaret())r=i.origin;return r}function s(e){return o(e,"previous")}function l(e){return o(e,"next")}function a(e){const n=s(e),r=l(e);let i=n;for(;null!==i;){if(R(i)){const e=t.getTextDirection(i.getTextContent());if(null!==e)return e}if(i===r)break;i=i.getNextSibling()}const o=n.getParent();if(t.$isElementNode(o)){const e=o.getDirection();if("ltr"===e||"rtl"===e)return e}return null}function c(e,n){let r=null,o=null,s=e,l=n,a=e.getTextContent();for(;;){if(0===l){const e=s.getPreviousSibling();if(null===e){s=null;break}if(R(e)||t.$isTabNode(e)||t.$isLineBreakNode(e)||i(167),s=e,t.$isLineBreakNode(s)){r={node:s,offset:1};break}l=Math.max(0,s.getTextContentSize()-1),a=s.getTextContent()}else l--;const e=a[l];R(s)&&" "!==e&&(o={node:s,offset:l})}if(null!==o)return o;let c=null;if(n<e.getTextContentSize())R(e)&&(c=e.getTextContent()[n]);else{const t=e.getNextSibling();R(t)&&(c=t.getTextContent()[0])}if(null!==c&&" "!==c)return r;{const i=function(e,n){let r=e,i=n,o=e.getTextContent(),s=e.getTextContentSize();for(;;){if(!R(r)||i===s){if(r=r.getNextSibling(),null===r||t.$isLineBreakNode(r))return null;R(r)&&(i=0,o=r.getTextContent(),s=r.getTextContentSize())}if(R(r)){if(" "!==o[i])return{node:r,offset:i};i++}}}(e,n);return null!==i?i:r}}function u(e){const n=l(e);return t.$isLineBreakNode(n)&&i(168),n}function g(e,t,n){if(!Number.isInteger(t)||t<=0)return!1;const r=e.getTextContent(),i=/^ +/.exec(r);if(!i)return!1;const o=Math.min(t,i[0].length),s=e.getKey(),l=n.anchor.key===s&&"text"===n.anchor.type?n.anchor.offset:null,a=n.focus.key===s&&"text"===n.focus.type?n.focus.offset:null;return e.spliceText(0,o,""),null!==l&&n.anchor.set(s,Math.max(0,l-o),"text"),null!==a&&n.focus.set(s,Math.max(0,a-o),"text"),!0}const d="javascript";function f(e,n){for(const r of e.childNodes){if(t.isHTMLElement(r)&&r.tagName===n)return!0;if(f(r,n))return!0}return!1}const h="data-language",p="data-highlight-language",N="data-theme",m=()=>{};class _ extends t.ElementNode{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:t.ElementNode,importDOM:{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||f(e,"BR"))?{conversion:x,priority:1}:null,div:()=>({conversion:O,priority:1}),pre:()=>({conversion:x,priority:0}),table:e=>b(e)?{conversion:S,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&b(n)?{conversion:$,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&b(t)?{conversion:$,priority:3}:null}}})}constructor(e=void 0,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const n=t.$getDocument().createElement("code");t.addClassNamesToElement(n,e.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(h,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(p,r));const i=this.getTheme();i&&n.setAttribute(N,i);const o=this.getStyle();return o&&t.setDOMStyleFromCSS(n.style,o),n}updateDOM(e,n,r){const i=this.__language,o=e.__language;i?i!==o&&n.setAttribute(h,i):o&&n.removeAttribute(h);const s=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&o?s&&i?i!==o&&n.setAttribute(p,i):n.removeAttribute(p):s&&i&&n.setAttribute(p,i);const l=this.__theme,a=e.__theme;l?l!==a&&n.setAttribute(N,l):a&&n.removeAttribute(N);const c=this.__style,u=e.__style;return c!==u&&t.setDOMStyleFromCSS(n.style,c,u),!1}exportDOM(e){const n=t.$getDocument().createElement("pre");t.addClassNamesToElement(n,e._config.theme.code),n.setAttribute("spellcheck","false");const r=this.getLanguage();r&&(n.setAttribute(h,r),this.getIsSyntaxHighlightSupported()&&n.setAttribute(p,r));const i=this.getTheme();i&&n.setAttribute(N,i);const o=this.getStyle();return o&&t.setDOMStyleFromCSS(n.style,o),{element:n}}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,r=!0){if(!n.getPeerDependencyFromEditor(t.$getEditor(),"@lexical/code")){m();const t=A(e);if(t)return t}const{anchor:i,focus:o}=e,l=(i.isBefore(o)?i:o).getNode();if(t.$isTextNode(l)){let e=s(l);const n=[];for(;;)if(t.$isTabNode(e))n.push(t.$createTabNode()),e=e.getNextSibling();else{if(!R(e))break;{let t=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;t<i&&" "===r[t];)t++;if(0!==t&&n.push(y(" ".repeat(t))),t!==i)break;e=e.getNextSibling()}}const r=l.splitText(i.offset)[0],o=0===i.offset?0:1,a=r.getIndexWithinParent()+o,c=l.getParentOrThrow(),u=[t.$createLineBreakNode(),...n];c.splice(a,0,u);const g=n[n.length-1];g?g.select():0===i.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(C(l)){const{offset:n}=e.anchor;l.splice(n,0,[t.$createLineBreakNode()]),l.select(n+1,n+1)}return null}canIndent(){return!1}collapseAtStart(){const e=t.$createParagraphNode();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}}function T(e,n){return t.$create(_).setLanguage(e).setTheme(n)}function C(e){return e instanceof _}function x(e){return{node:T(e.getAttribute(h),e.getAttribute(N))}}function O(e){const t=e,n=M(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(M(t))return!0;t=t.parentElement}return!1}(t)?{node:n?T():null}:{node:null}}function S(){return{node:T()}}function $(){return{node:null}}function M(e){return null!==e.style.fontFamily.match("monospace")}function b(e){return e.classList.contains("js-file-line-container")}function A(e){const{anchor:n}=e;if(e.isCollapsed()&&"element"===n.type){const e=n.getNode();if(C(e)){const r=e.getChildrenSize();if(r>=2&&n.offset===r){const n=e.getLastChild();if(t.$isLineBreakNode(n)&&t.$isLineBreakNode(n.getPreviousSibling())){const n=t.$createParagraphNode();return e.splice(r-2,2,[]).insertAfter(n,!1),n.select(),n}}}}return null}class D extends t.TextNode{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}$config(){return this.config("code-highlight",{extends:t.TextNode})}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const n=super.createDOM(e),r=E(e.theme,this.__highlightType);return t.addClassNamesToElement(n,r),n}updateDOM(e,n,r){const i=super.updateDOM(e,n,r),o=E(r.theme,e.__highlightType),s=E(r.theme,this.__highlightType);return o!==s&&(o&&t.removeClassNamesFromElement(n,o),s&&t.addClassNamesToElement(n,s)),i}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return T()}}function E(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function y(e="",n){return t.$applyNodeReplacement(new D(e,n))}function R(e){return e instanceof D}const v="data-language",L="data-theme";function I(e){return null!==e.style.fontFamily.match("monospace")}function P(e){let t=e.parentElement;for(;null!==t;){if(I(t))return!0;t=t.parentElement}return!1}const B=/* @__PURE__ */e.defineOverlayRules([{$import:(e,t)=>e.$importChildren(t),match:/* @__PURE__ */e.sel.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),W={$import:(e,t)=>[T(t.getAttribute(v),t.getAttribute(L)).splice(0,0,e.$importChildren(t))],match:/* @__PURE__ */e.sel.tag("pre"),name:"@lexical/code/pre"},k={$import:(e,t,n)=>{const r=t.textContent||"";return/\r?\n/.test(r)||null!==t.querySelector("br")?[T(t.getAttribute(v),t.getAttribute(L)).splice(0,0,e.$importChildren(t))]:n()},match:/* @__PURE__ */e.sel.tag("code"),name:"@lexical/code/code-multiline"};function H(e){if(!t.isHTMLElement(e))return!1;const n=e.style.fontFamily,r=e.style.whiteSpace;return"string"==typeof n&&/monospace/i.test(n)&&"string"==typeof r&&r.startsWith("pre")}function w(e){let n=!1;const r=[];let i="",o=!1;const s=()=>{o&&(r.push(i),i="",o=!1)};for(const l of Array.from(e.childNodes))if(t.isHTMLElement(l))"DIV"===l.tagName?(s(),r.push(l.textContent||""),n=!0):"BR"===l.tagName?(s(),r.push(""),n=!0):(i+=l.textContent||"",o=!0);else if(t.isDOMTextNode(l)){const e=l.textContent||"";e.length>0&&(i+=e,o=!0)}return s(),n?r:null}function F(e){for(const n of Array.from(e.children)){if(t.isHTMLElement(n)&&H(n)){if(null!==w(n))return!0;const e=n.nextElementSibling;if(e&&H(e))return!0;continue}if(F(n))return!0}return!1}const Y={$import:(e,n,r)=>{if(!H(n)||P(n))return r();const i=w(n);return null===i||0===i.length?r():[T().splice(0,0,t.$generateNodesFromRawText(i.join("\n")))]},match:/* @__PURE__ */e.sel.tag("div"),name:"@lexical/code/vscode-wrapper"},K={$import:(e,n,r)=>{if(!H(n)||P(n))return r();const i=n.previousElementSibling;if(i&&H(i))return[];const o=[];let s=n;for(;s&&H(s);)o.push("BR"===s.tagName?"":s.textContent||""),s=s.nextElementSibling;return o.length<2?r():[T().splice(0,0,t.$generateNodesFromRawText(o.join("\n")))]},match:/* @__PURE__ */e.sel.tag("div","br"),name:"@lexical/code/vscode-line-run"},U=/* @__PURE__ */e.defineOverlayRules([Y,K]),z={$import:(e,t,n)=>I(t)?[T().splice(0,0,e.$importChildren(t))]:P(t)?e.$importChildren(t):n(),match:/* @__PURE__ */e.sel.tag("div"),name:"@lexical/code/div"},j=[{$import:(e,t)=>[T().splice(0,0,e.$importChildren(t,{rules:B}))],match:/* @__PURE__ */e.sel.tag("table").classAll("js-file-line-container"),name:"@lexical/code/github-code-table"},{$import:(e,t)=>e.$importChildren(t),match:/* @__PURE__ */e.sel.tag("td").classAll("js-file-line"),name:"@lexical/code/github-code-cell-by-class"},k,W,z],J={dependencies:[e.CoreImportExtension,[e.DOMImportExtension,{preprocess:[(n,r,i)=>{F(t.isDOMDocumentNode(n)?n.body:n)&&r.session.update(e.ImportOverlays,e=>[...e,U]),i()}],rules:j}]],name:"@lexical/code",nodes:()=>[_,D],register:e=>t.mergeRegister(e.registerCommand(t.KEY_ENTER_COMMAND,e=>{const n=t.$getSelection();return!(!t.$isRangeSelection(n)||!A(n))&&(null!==e&&e.preventDefault(),!0)},t.COMMAND_PRIORITY_LOW),e.registerNodeTransform(t.TabNode,e=>{0!==e.getFormat()&&C(e.getParent())&&e.setFormat(0)}))},q={dependencies:[J],name:"@lexical/code/Import"};function V(e){if(!t.$isRangeSelection(e))return!1;const n=e.anchor.getNode(),r=C(n)?n:n.getParent(),i=e.focus.getNode(),o=C(i)?i:i.getParent();return C(r)&&r.is(o)}function G(e){const n=e.getNodes(),r=[];if(1===n.length&&C(n[0]))return r;let o=[];for(let e=0;e<n.length;e++){const s=n[e];R(s)||t.$isTabNode(s)||t.$isLineBreakNode(s)||i(169),t.$isLineBreakNode(s)?o.length>0&&(r.push(o),o=[]):o.push(s)}if(o.length>0){const n=e.isBackward()?e.anchor:e.focus,i=t.$createPoint(o[0].getKey(),0,"text");n.is(i)||r.push(o)}return r}function Q(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r)||!V(r))return!1;const i=G(r),o=i.length;if(0===o&&r.isCollapsed())return e===t.INDENT_CONTENT_COMMAND?r.insertNodes([t.$createTabNode()]):function(e,n){const r=e.anchor.getNode();if(!R(r)&&!t.$isTabNode(r))return;const i=s(r);t.$isTabNode(i)?i.remove():void 0!==n&&R(i)&&g(i,n,e)}(r,n),!0;if(0===o&&e===t.INDENT_CONTENT_COMMAND&&"\n"===r.getTextContent()){const e=t.$createTabNode(),n=t.$createLineBreakNode(),i=r.isBackward()?"previous":"next";return r.insertNodes([e,n]),t.$setSelectionFromCaretRange(t.$getCaretRangeInDirection(t.$getCaretRange(t.$getTextPointCaret(e,"next",0),t.$normalizeCaret(t.$getSiblingCaret(n,"next"))),i)),!0}for(let l=0;l<o;l++){const o=i[l];if(o.length>0){let i=o[0];if(0===l&&(i=s(i)),e===t.INDENT_CONTENT_COMMAND){const e=t.$createTabNode();if(i.insertBefore(e),0===l){const n=r.isBackward()?"focus":"anchor",o=t.$createPoint(i.getKey(),0,"text");r[n].is(o)&&r[n].set(e.getKey(),0,"text")}}else t.$isTabNode(i)?i.remove():void 0!==n&&R(i)&&g(i,n,r)}}return!0}function X(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r))return!1;const{anchor:i,focus:o}=r,a=i.offset,c=o.offset,u=i.getNode(),g=o.getNode(),d=e===t.KEY_ARROW_UP_COMMAND;if(!V(r)||!R(u)&&!t.$isTabNode(u)||!R(g)&&!t.$isTabNode(g))return!1;if(!n.altKey){if(r.isCollapsed()){const e=u.getParentOrThrow();if(d&&0===a&&null===u.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),n.preventDefault(),!1}else if(!d&&a===u.getTextContentSize()&&null===u.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),n.preventDefault(),!1}}return!1}let f,h;if(u.isBefore(g)?(f=s(u),h=l(g)):(f=s(g),h=l(u)),null==f||null==h)return!1;const p=f.getNodesBetween(h);for(let e=0;e<p.length;e++){const n=p[e];if(!R(n)&&!t.$isTabNode(n)&&!t.$isLineBreakNode(n))return!1}n.preventDefault(),n.stopPropagation();const N=d?f.getPreviousSibling():h.getNextSibling();if(!t.$isLineBreakNode(N))return!0;const m=d?N.getPreviousSibling():N.getNextSibling();if(null==m)return!0;const _=t.$isLineBreakNode(m),T=_||!R(m)&&!t.$isTabNode(m)?null:d?s(m):l(m);let C=null!=T?T:m;return N.remove(),p.forEach(e=>e.remove()),_?(p.forEach(e=>{C.insertAfter(e),C=e}),C.insertAfter(N)):e===t.KEY_ARROW_UP_COMMAND?(p.forEach(e=>C.insertBefore(e)),C.insertBefore(N)):(C.insertAfter(N),C=N,p.forEach(e=>{C.insertAfter(e),C=e})),r.setTextNodeRange(u,a,g,c),!0}function Z(e,n){const r=t.$getSelection();if(!t.$isRangeSelection(r))return!1;const{anchor:i,focus:o}=r,s=i.getNode(),l=o.getNode(),g=e===t.MOVE_TO_START;if(!V(r)||!R(s)&&!t.$isTabNode(s)||!R(l)&&!t.$isTabNode(l))return!1;const d=l,f="rtl"===a(d)?!g:g,h=i.key,p=i.offset,N=i.type;if(f){const e=c(d,o.offset);if(null!==e){const{node:n,offset:i}=e;t.$isLineBreakNode(n)?n.selectNext(0,0):r.setTextNodeRange(n,i,n,i)}else d.getParentOrThrow().selectStart()}else{u(d).select()}return n.shiftKey&&r.anchor.set(h,p,N),n.preventDefault(),n.stopPropagation(),!0}function ee(e,n,o){return t.mergeRegister(...o?[e.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>!e.altKey&&r.$onEscapeDown(C,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_RIGHT_COMMAND,e=>r.$onEscapeDown(C,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>!e.altKey&&r.$onEscapeUp(C,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_LEFT_COMMAND,e=>r.$onEscapeUp(C,e),t.COMMAND_PRIORITY_LOW)]:[],e.registerCommand(t.KEY_TAB_COMMAND,n=>{const r=function(e){const n=t.$getSelection();if(!t.$isRangeSelection(n)||!V(n))return null;const r=e?t.OUTDENT_CONTENT_COMMAND:t.INDENT_CONTENT_COMMAND,o=e?t.OUTDENT_CONTENT_COMMAND:t.INSERT_TAB_COMMAND,a=n.anchor,c=n.focus;if(a.is(c))return o;const u=G(n);if(1!==u.length)return r;const g=u[0];let d,f;0===g.length&&i(285),n.isBackward()?(d=c,f=a):(d=a,f=c);const h=s(g[0]),p=l(g[0]),N=t.$createPoint(h.getKey(),0,"text"),m=t.$createPoint(p.getKey(),p.getTextContentSize(),"text");return d.isBefore(N)||m.isBefore(f)?r:N.isBefore(d)||f.isBefore(m)?o:r}(n.shiftKey);return null!==r&&(n.preventDefault(),e.dispatchCommand(r),!0)},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.INSERT_TAB_COMMAND,()=>!!V(t.$getSelection())&&(t.$insertNodes([t.$createTabNode()]),!0),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.INDENT_CONTENT_COMMAND,()=>Q(t.INDENT_CONTENT_COMMAND),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.OUTDENT_CONTENT_COMMAND,()=>Q(t.OUTDENT_CONTENT_COMMAND,n),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_UP_COMMAND,e=>{const n=t.$getSelection();if(!t.$isRangeSelection(n))return!1;const{anchor:r}=n,i=r.getNode();if(!V(n))return!1;const o=i.getParent();return n.isCollapsed()&&0===r.offset&&null===i.getPreviousSibling()&&C(o)&&null===o.getPreviousSibling()?(e.preventDefault(),!0):X(t.KEY_ARROW_UP_COMMAND,e)},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.KEY_ARROW_DOWN_COMMAND,e=>{const n=t.$getSelection();if(!t.$isRangeSelection(n))return!1;const{anchor:r}=n,i=r.getNode();return!!V(n)&&(n.isCollapsed()&&r.offset===i.getTextContentSize()&&null===i.getNextSibling()&&C(i.getParentOrThrow())&&null===i.getParentOrThrow().getNextSibling()?(e.preventDefault(),!0):X(t.KEY_ARROW_DOWN_COMMAND,e))},t.COMMAND_PRIORITY_LOW),e.registerCommand(t.MOVE_TO_START,e=>Z(t.MOVE_TO_START,e),t.COMMAND_PRIORITY_LOW),e.registerCommand(t.MOVE_TO_END,e=>Z(t.MOVE_TO_END,e),t.COMMAND_PRIORITY_LOW))}const te={build:(e,t)=>n.namedSignals(t),config:{disabled:!1,escapeWithArrows:!1,tabSize:void 0},dependencies:[J],name:"@lexical/code-indent",register:(e,t,r)=>{const i=r.getOutput();return n.effect(()=>{if(!i.disabled.value)return ee(e,i.tabSize.value,i.escapeWithArrows.value)})}};exports.$createCodeHighlightNode=y,exports.$createCodeNode=T,exports.$getCodeLineDirection=a,exports.$getEndOfCodeInLine=u,exports.$getFirstCodeNodeOfLine=s,exports.$getLastCodeNodeOfLine=l,exports.$getStartOfCodeInLine=c,exports.$isCodeHighlightNode=R,exports.$isCodeNode=C,exports.$outdentLeadingSpaces=g,exports.$plainifyCodeContent=function(e){const n=[];return t.tokenizeRawText(e,{linebreak:()=>n.push(t.$createLineBreakNode()),tab:()=>n.push(t.$createTabNode()),text:e=>n.push(y(e))}),n},exports.CodeExtension=J,exports.CodeHighlightNode=D,exports.CodeImportExtension=q,exports.CodeImportRules=j,exports.CodeIndentExtension=te,exports.CodeNode=_,exports.DEFAULT_CODE_LANGUAGE=d,exports.getDefaultCodeLanguage=()=>d,exports.registerCodeIndentation=ee;
@@ -6,5 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{defineImportRule as e,sel as t,ImportOverlays as n,defineOverlayRules as r,CoreImportExtension as i,DOMImportExtension as o}from"@lexical/html";import{getTextDirection as s,$isElementNode as l,$isTabNode as u,$isLineBreakNode as c,tokenizeRawText as a,$createTabNode as g,$createLineBreakNode as f,$getSiblingCaret as h,$create as p,ElementNode as d,$getDocument as m,addClassNamesToElement as x,setDOMStyleFromCSS as S,$getEditor as b,$isTextNode as y,$createParagraphNode as _,isHTMLElement as v,$applyNodeReplacement as C,TextNode as N,removeClassNamesFromElement as T,isDOMDocumentNode as A,isDOMTextNode as P,$generateNodesFromRawText as O,defineExtension as w,mergeRegister as H,KEY_ENTER_COMMAND as $,$getSelection as D,$isRangeSelection as B,COMMAND_PRIORITY_LOW as L,TabNode as E,configExtension as k,safeCast as F,KEY_ARROW_DOWN_COMMAND as M,KEY_ARROW_RIGHT_COMMAND as z,KEY_ARROW_UP_COMMAND as K,KEY_ARROW_LEFT_COMMAND as I,KEY_TAB_COMMAND as j,INSERT_TAB_COMMAND as J,$insertNodes as R,INDENT_CONTENT_COMMAND as W,OUTDENT_CONTENT_COMMAND as q,MOVE_TO_START as U,MOVE_TO_END as V,$createPoint as G,$setSelectionFromCaretRange as Q,$getCaretRangeInDirection as X,$getCaretRange as Y,$getTextPointCaret as Z,$normalizeCaret as ee}from"lexical";import{getPeerDependencyFromEditor as te,effect as ne,namedSignals as re}from"@lexical/extension";import{$onEscapeDown as ie,$onEscapeUp as oe}from"@lexical/utils";
10
- /*@__INLINE__*/function se(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function le(e,t){let n=e;for(let r=h(e,t);r&&(Ee(r.origin)||u(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function ue(e){return le(e,"previous")}function ce(e){return le(e,"next")}function ae(e){const t=ue(e),n=ce(e);let r=t;for(;null!==r;){if(Ee(r)){const e=s(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(l(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}function ge(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){const e=i.getPreviousSibling();if(null===e){i=null;break}if(Ee(e)||u(e)||c(e)||se(167),i=e,c(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];Ee(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let l=null;if(t<e.getTextContentSize())Ee(e)&&(l=e.getTextContent()[t]);else{const t=e.getNextSibling();Ee(t)&&(l=t.getTextContent()[0])}if(null!==l&&" "!==l)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!Ee(n)||r===o){if(n=n.getNextSibling(),null===n||c(n))return null;Ee(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if(Ee(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}function fe(e){const t=ce(e);return c(t)&&se(168),t}function he(e){const t=[];return a(e,{linebreak:()=>t.push(f()),tab:()=>t.push(g()),text:e=>t.push(Le(e))}),t}function pe(e,t,n){if(!Number.isInteger(t)||t<=0)return!1;const r=e.getTextContent(),i=/^ +/.exec(r);if(!i)return!1;const o=Math.min(t,i[0].length),s=e.getKey(),l=n.anchor.key===s&&"text"===n.anchor.type?n.anchor.offset:null,u=n.focus.key===s&&"text"===n.focus.type?n.focus.offset:null;return e.spliceText(0,o,""),null!==l&&n.anchor.set(s,Math.max(0,l-o),"text"),null!==u&&n.focus.set(s,Math.max(0,u-o),"text"),!0}const de="javascript",me=()=>de;function xe(e,t){for(const n of e.childNodes){if(v(n)&&n.tagName===t)return!0;if(xe(n,t))return!0}return!1}const Se="data-language",be="data-highlight-language",ye="data-theme",_e=()=>{};class ve extends d{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:d,importDOM:{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||xe(e,"BR"))?{conversion:Te,priority:1}:null,div:()=>({conversion:Ae,priority:1}),pre:()=>({conversion:Te,priority:0}),table:e=>He(e)?{conversion:Pe,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&He(n)?{conversion:Oe,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&He(t)?{conversion:Oe,priority:3}:null}}})}constructor(e=void 0,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=m().createElement("code");x(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Se,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(be,n));const r=this.getTheme();r&&t.setAttribute(ye,r);const i=this.getStyle();return i&&S(t.style,i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(Se,r):i&&t.removeAttribute(Se);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(be,r):t.removeAttribute(be):o&&r&&t.setAttribute(be,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(ye,s):l&&t.removeAttribute(ye);const u=this.__style,c=e.__style;return u!==c&&S(t.style,u,c),!1}exportDOM(e){const t=m().createElement("pre");x(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(Se,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(be,n));const r=this.getTheme();r&&t.setAttribute(ye,r);const i=this.getStyle();return i&&S(t.style,i),{element:t}}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!te(b(),"@lexical/code")){_e();const t=$e(e);if(t)return t}const{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(y(i)){let e=ue(i);const t=[];for(;;)if(u(e))t.push(g()),e=e.getNextSibling();else{if(!Ee(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(Le(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const r=i.splitText(n.offset)[0],o=0===n.offset?0:1,s=r.getIndexWithinParent()+o,l=i.getParentOrThrow(),c=[f(),...t];l.splice(s,0,c);const a=t[t.length-1];a?a.select():0===n.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(Ne(i)){const{offset:t}=e.anchor;i.splice(t,0,[f()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=_();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}}function Ce(e,t){return p(ve).setLanguage(e).setTheme(t)}function Ne(e){return e instanceof ve}function Te(e){return{node:Ce(e.getAttribute(Se),e.getAttribute(ye))}}function Ae(e){const t=e,n=we(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(we(t))return!0;t=t.parentElement}return!1}(t)?{node:n?Ce():null}:{node:null}}function Pe(){return{node:Ce()}}function Oe(){return{node:null}}function we(e){return null!==e.style.fontFamily.match("monospace")}function He(e){return e.classList.contains("js-file-line-container")}function $e(e){const{anchor:t}=e;if(e.isCollapsed()&&"element"===t.type){const e=t.getNode();if(Ne(e)){const n=e.getChildrenSize();if(n>=2&&t.offset===n){const t=e.getLastChild();if(c(t)&&c(t.getPreviousSibling())){const t=_();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}class De extends N{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}$config(){return this.config("code-highlight",{extends:N})}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e),n=Be(e.theme,this.__highlightType);return x(t,n),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=Be(n.theme,e.__highlightType),o=Be(n.theme,this.__highlightType);return i!==o&&(i&&T(t,i),o&&x(t,o)),r}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return Ce()}}function Be(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function Le(e="",t){return C(new De(e,t))}function Ee(e){return e instanceof De}const ke="data-language",Fe="data-theme";function Me(e){return null!==e.style.fontFamily.match("monospace")}function ze(e){let t=e.parentElement;for(;null!==t;){if(Me(t))return!0;t=t.parentElement}return!1}const Ke=/* @__PURE__ */r([/* @__PURE__ */e({$import:(e,t)=>e.$importChildren(t),match:t.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"})]),Ie=/* @__PURE__ */e({$import:(e,t)=>[Ce(t.getAttribute(ke),t.getAttribute(Fe)).splice(0,0,e.$importChildren(t))],match:t.tag("pre"),name:"@lexical/code/pre"}),je=/* @__PURE__ */e({$import:(e,t,n)=>{const r=t.textContent||"";return/\r?\n/.test(r)||null!==t.querySelector("br")?[Ce(t.getAttribute(ke),t.getAttribute(Fe)).splice(0,0,e.$importChildren(t))]:n()},match:t.tag("code"),name:"@lexical/code/code-multiline"});function Je(e){if(!v(e))return!1;const t=e.style.fontFamily,n=e.style.whiteSpace;return"string"==typeof t&&/monospace/i.test(t)&&"string"==typeof n&&n.startsWith("pre")}function Re(e){let t=!1;const n=[];let r="",i=!1;const o=()=>{i&&(n.push(r),r="",i=!1)};for(const s of Array.from(e.childNodes))if(v(s))"DIV"===s.tagName?(o(),n.push(s.textContent||""),t=!0):"BR"===s.tagName?(o(),n.push(""),t=!0):(r+=s.textContent||"",i=!0);else if(P(s)){const e=s.textContent||"";e.length>0&&(r+=e,i=!0)}return o(),t?n:null}function We(e){for(const t of Array.from(e.children)){if(v(t)&&Je(t)){if(null!==Re(t))return!0;const e=t.nextElementSibling;if(e&&Je(e))return!0;continue}if(We(t))return!0}return!1}const qe=/* @__PURE__ */r([/* @__PURE__ */e({$import:(e,t,n)=>{if(!Je(t)||ze(t))return n();const r=Re(t);return null===r||0===r.length?n():[Ce().splice(0,0,O(r.join("\n")))]},match:t.tag("div"),name:"@lexical/code/vscode-wrapper"}),/* @__PURE__ */e({$import:(e,t,n)=>{if(!Je(t)||ze(t))return n();const r=t.previousElementSibling;if(r&&Je(r))return[];const i=[];let o=t;for(;o&&Je(o);)i.push("BR"===o.tagName?"":o.textContent||""),o=o.nextElementSibling;return i.length<2?n():[Ce().splice(0,0,O(i.join("\n")))]},match:t.tag("div","br"),name:"@lexical/code/vscode-line-run"})]),Ue=/* @__PURE__ */e({$import:(e,t,n)=>Me(t)?[Ce().splice(0,0,e.$importChildren(t))]:ze(t)?e.$importChildren(t):n(),match:t.tag("div"),name:"@lexical/code/div"}),Ve=[/* @__PURE__ */e({$import:(e,t)=>[Ce().splice(0,0,e.$importChildren(t,{rules:Ke}))],match:t.tag("table").classAll("js-file-line-container"),name:"@lexical/code/github-code-table"}),/* @__PURE__ */e({$import:(e,t)=>e.$importChildren(t),match:t.tag("td").classAll("js-file-line"),name:"@lexical/code/github-code-cell-by-class"}),je,Ie,Ue],Ge=/* @__PURE__ */w({dependencies:[i,/* @__PURE__ */k(o,{preprocess:[(e,t,r)=>{We(A(e)?e.body:e)&&t.session.update(n,e=>[...e,qe]),r()}],rules:Ve})],name:"@lexical/code",nodes:()=>[ve,De],register:e=>H(e.registerCommand($,e=>{const t=D();return!(!B(t)||!$e(t))&&(null!==e&&e.preventDefault(),!0)},L),e.registerNodeTransform(E,e=>{0!==e.getFormat()&&Ne(e.getParent())&&e.setFormat(0)}))}),Qe=/* @__PURE__ */w({dependencies:[Ge],name:"@lexical/code/Import"});function Xe(e){if(!B(e))return!1;const t=e.anchor.getNode(),n=Ne(t)?t:t.getParent(),r=e.focus.getNode(),i=Ne(r)?r:r.getParent();return Ne(n)&&n.is(i)}function Ye(e){const t=e.getNodes(),n=[];if(1===t.length&&Ne(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];Ee(i)||u(i)||c(i)||se(169),c(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=G(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function Ze(e,t){const n=D();if(!B(n)||!Xe(n))return!1;const r=Ye(n),i=r.length;if(0===i&&n.isCollapsed())return e===W?n.insertNodes([g()]):function(e,t){const n=e.anchor.getNode();if(!Ee(n)&&!u(n))return;const r=ue(n);u(r)?r.remove():void 0!==t&&Ee(r)&&pe(r,t,e)}(n,t),!0;if(0===i&&e===W&&"\n"===n.getTextContent()){const e=g(),t=f(),r=n.isBackward()?"previous":"next";return n.insertNodes([e,t]),Q(X(Y(Z(e,"next",0),ee(h(t,"next"))),r)),!0}for(let o=0;o<i;o++){const i=r[o];if(i.length>0){let r=i[0];if(0===o&&(r=ue(r)),e===W){const e=g();if(r.insertBefore(e),0===o){const t=n.isBackward()?"focus":"anchor",i=G(r.getKey(),0,"text");n[t].is(i)&&n[t].set(e.getKey(),0,"text")}}else u(r)?r.remove():void 0!==t&&Ee(r)&&pe(r,t,n)}}return!0}function et(e,t){const n=D();if(!B(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,l=r.getNode(),a=i.getNode(),g=e===K;if(!Xe(n)||!Ee(l)&&!u(l)||!Ee(a)&&!u(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=l.getParentOrThrow();if(g&&0===o&&null===l.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!1}else if(!g&&o===l.getTextContentSize()&&null===l.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!1}}return!1}let f,h;if(l.isBefore(a)?(f=ue(l),h=ce(a)):(f=ue(a),h=ce(l)),null==f||null==h)return!1;const p=f.getNodesBetween(h);for(let e=0;e<p.length;e++){const t=p[e];if(!Ee(t)&&!u(t)&&!c(t))return!1}t.preventDefault(),t.stopPropagation();const d=g?f.getPreviousSibling():h.getNextSibling();if(!c(d))return!0;const m=g?d.getPreviousSibling():d.getNextSibling();if(null==m)return!0;const x=c(m),S=x||!Ee(m)&&!u(m)?null:g?ue(m):ce(m);let b=null!=S?S:m;return d.remove(),p.forEach(e=>e.remove()),x?(p.forEach(e=>{b.insertAfter(e),b=e}),b.insertAfter(d)):e===K?(p.forEach(e=>b.insertBefore(e)),b.insertBefore(d)):(b.insertAfter(d),b=d,p.forEach(e=>{b.insertAfter(e),b=e})),n.setTextNodeRange(l,o,a,s),!0}function tt(e,t){const n=D();if(!B(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),l=e===U;if(!Xe(n)||!Ee(o)&&!u(o)||!Ee(s)&&!u(s))return!1;const a=s,g="rtl"===ae(a)?!l:l,f=r.key,h=r.offset,p=r.type;if(g){const e=ge(a,i.offset);if(null!==e){const{node:t,offset:r}=e;c(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else{fe(a).select()}return t.shiftKey&&n.anchor.set(f,h,p),t.preventDefault(),t.stopPropagation(),!0}function nt(e,t,n){return H(...n?[e.registerCommand(M,e=>!e.altKey&&ie(Ne,e),L),e.registerCommand(z,e=>ie(Ne,e),L),e.registerCommand(K,e=>!e.altKey&&oe(Ne,e),L),e.registerCommand(I,e=>oe(Ne,e),L)]:[],e.registerCommand(j,t=>{const n=function(e){const t=D();if(!B(t)||!Xe(t))return null;const n=e?q:W,r=e?q:J,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=Ye(t);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&se(285),t.isBackward()?(u=o,c=i):(u=i,c=o);const a=ue(l[0]),g=ce(l[0]),f=G(a.getKey(),0,"text"),h=G(g.getKey(),g.getTextContentSize(),"text");return u.isBefore(f)||h.isBefore(c)?n:f.isBefore(u)||c.isBefore(h)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n),!0)},L),e.registerCommand(J,()=>!!Xe(D())&&(R([g()]),!0),L),e.registerCommand(W,()=>Ze(W),L),e.registerCommand(q,()=>Ze(q,t),L),e.registerCommand(K,e=>{const t=D();if(!B(t))return!1;const{anchor:n}=t,r=n.getNode();if(!Xe(t))return!1;const i=r.getParent();return t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&Ne(i)&&null===i.getPreviousSibling()?(e.preventDefault(),!0):et(K,e)},L),e.registerCommand(M,e=>{const t=D();if(!B(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Xe(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&Ne(r.getParentOrThrow())&&null===r.getParentOrThrow().getNextSibling()?(e.preventDefault(),!0):et(M,e))},L),e.registerCommand(U,e=>tt(U,e),L),e.registerCommand(V,e=>tt(V,e),L))}const rt=/* @__PURE__ */w({build:(e,t)=>re(t),config:/* @__PURE__ */F({disabled:!1,escapeWithArrows:!1,tabSize:void 0}),dependencies:[Ge],name:"@lexical/code-indent",register:(e,t,n)=>{const r=n.getOutput();return ne(()=>{if(!r.disabled.value)return nt(e,r.tabSize.value,r.escapeWithArrows.value)})}});export{Le as $createCodeHighlightNode,Ce as $createCodeNode,ae as $getCodeLineDirection,fe as $getEndOfCodeInLine,ue as $getFirstCodeNodeOfLine,ce as $getLastCodeNodeOfLine,ge as $getStartOfCodeInLine,Ee as $isCodeHighlightNode,Ne as $isCodeNode,pe as $outdentLeadingSpaces,he as $plainifyCodeContent,Ge as CodeExtension,De as CodeHighlightNode,Qe as CodeImportExtension,Ve as CodeImportRules,rt as CodeIndentExtension,ve as CodeNode,de as DEFAULT_CODE_LANGUAGE,me as getDefaultCodeLanguage,nt as registerCodeIndentation};
9
+ import{sel as e,ImportOverlays as t,defineOverlayRules as n,CoreImportExtension as r,DOMImportExtension as i}from"@lexical/html";import{getTextDirection as o,$isElementNode as s,$isTabNode as l,$isLineBreakNode as u,tokenizeRawText as c,$createTabNode as a,$createLineBreakNode as g,$getSiblingCaret as f,$create as h,ElementNode as p,$getDocument as d,addClassNamesToElement as m,setDOMStyleFromCSS as x,$getEditor as S,$isTextNode as b,$createParagraphNode as y,isHTMLElement as _,$applyNodeReplacement as v,TextNode as C,removeClassNamesFromElement as N,isDOMDocumentNode as T,isDOMTextNode as A,$generateNodesFromRawText as P,mergeRegister as O,KEY_ENTER_COMMAND as w,$getSelection as H,$isRangeSelection as $,COMMAND_PRIORITY_LOW as D,TabNode as B,KEY_ARROW_DOWN_COMMAND as L,KEY_ARROW_RIGHT_COMMAND as E,KEY_ARROW_UP_COMMAND as k,KEY_ARROW_LEFT_COMMAND as F,KEY_TAB_COMMAND as M,INSERT_TAB_COMMAND as z,$insertNodes as K,INDENT_CONTENT_COMMAND as I,OUTDENT_CONTENT_COMMAND as j,MOVE_TO_START as J,MOVE_TO_END as R,$createPoint as W,$setSelectionFromCaretRange as q,$getCaretRangeInDirection as U,$getCaretRange as V,$getTextPointCaret as G,$normalizeCaret as Q}from"lexical";import{getPeerDependencyFromEditor as X,effect as Y,namedSignals as Z}from"@lexical/extension";import{$onEscapeDown as ee,$onEscapeUp as te}from"@lexical/utils";
10
+ /*@__INLINE__*/function ne(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function re(e,t){let n=e;for(let r=f(e,t);r&&($e(r.origin)||l(r.origin));r=r.getAdjacentCaret())n=r.origin;return n}function ie(e){return re(e,"previous")}function oe(e){return re(e,"next")}function se(e){const t=ie(e),n=oe(e);let r=t;for(;null!==r;){if($e(r)){const e=o(r.getTextContent());if(null!==e)return e}if(r===n)break;r=r.getNextSibling()}const i=t.getParent();if(s(i)){const e=i.getDirection();if("ltr"===e||"rtl"===e)return e}return null}function le(e,t){let n=null,r=null,i=e,o=t,s=e.getTextContent();for(;;){if(0===o){const e=i.getPreviousSibling();if(null===e){i=null;break}if($e(e)||l(e)||u(e)||ne(167),i=e,u(i)){n={node:i,offset:1};break}o=Math.max(0,i.getTextContentSize()-1),s=i.getTextContent()}else o--;const e=s[o];$e(i)&&" "!==e&&(r={node:i,offset:o})}if(null!==r)return r;let c=null;if(t<e.getTextContentSize())$e(e)&&(c=e.getTextContent()[t]);else{const t=e.getNextSibling();$e(t)&&(c=t.getTextContent()[0])}if(null!==c&&" "!==c)return n;{const r=function(e,t){let n=e,r=t,i=e.getTextContent(),o=e.getTextContentSize();for(;;){if(!$e(n)||r===o){if(n=n.getNextSibling(),null===n||u(n))return null;$e(n)&&(r=0,i=n.getTextContent(),o=n.getTextContentSize())}if($e(n)){if(" "!==i[r])return{node:n,offset:r};r++}}}(e,t);return null!==r?r:n}}function ue(e){const t=oe(e);return u(t)&&ne(168),t}function ce(e){const t=[];return c(e,{linebreak:()=>t.push(g()),tab:()=>t.push(a()),text:e=>t.push(He(e))}),t}function ae(e,t,n){if(!Number.isInteger(t)||t<=0)return!1;const r=e.getTextContent(),i=/^ +/.exec(r);if(!i)return!1;const o=Math.min(t,i[0].length),s=e.getKey(),l=n.anchor.key===s&&"text"===n.anchor.type?n.anchor.offset:null,u=n.focus.key===s&&"text"===n.focus.type?n.focus.offset:null;return e.spliceText(0,o,""),null!==l&&n.anchor.set(s,Math.max(0,l-o),"text"),null!==u&&n.focus.set(s,Math.max(0,u-o),"text"),!0}const ge="javascript",fe=()=>ge;function he(e,t){for(const n of e.childNodes){if(_(n)&&n.tagName===t)return!0;if(he(n,t))return!0}return!1}const pe="data-language",de="data-highlight-language",me="data-theme",xe=()=>{};class Se extends p{__language;__theme;__isSyntaxHighlightSupported;$config(){return this.config("code",{extends:p,importDOM:{code:e=>null!=e.textContent&&(/\r?\n/.test(e.textContent)||he(e,"BR"))?{conversion:_e,priority:1}:null,div:()=>({conversion:ve,priority:1}),pre:()=>({conversion:_e,priority:0}),table:e=>Ae(e)?{conversion:Ce,priority:3}:null,td:e=>{const t=e,n=t.closest("table");return t.classList.contains("js-file-line")||n&&Ae(n)?{conversion:Ne,priority:3}:null},tr:e=>{const t=e.closest("table");return t&&Ae(t)?{conversion:Ne,priority:3}:null}}})}constructor(e=void 0,t){super(t),this.__language=e||void 0,this.__isSyntaxHighlightSupported=!1,this.__theme=void 0}afterCloneFrom(e){super.afterCloneFrom(e),this.__language=e.__language,this.__theme=e.__theme,this.__isSyntaxHighlightSupported=e.__isSyntaxHighlightSupported}createDOM(e){const t=d().createElement("code");m(t,e.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(pe,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(de,n));const r=this.getTheme();r&&t.setAttribute(me,r);const i=this.getStyle();return i&&x(t.style,i),t}updateDOM(e,t,n){const r=this.__language,i=e.__language;r?r!==i&&t.setAttribute(pe,r):i&&t.removeAttribute(pe);const o=this.__isSyntaxHighlightSupported;e.__isSyntaxHighlightSupported&&i?o&&r?r!==i&&t.setAttribute(de,r):t.removeAttribute(de):o&&r&&t.setAttribute(de,r);const s=this.__theme,l=e.__theme;s?s!==l&&t.setAttribute(me,s):l&&t.removeAttribute(me);const u=this.__style,c=e.__style;return u!==c&&x(t.style,u,c),!1}exportDOM(e){const t=d().createElement("pre");m(t,e._config.theme.code),t.setAttribute("spellcheck","false");const n=this.getLanguage();n&&(t.setAttribute(pe,n),this.getIsSyntaxHighlightSupported()&&t.setAttribute(de,n));const r=this.getTheme();r&&t.setAttribute(me,r);const i=this.getStyle();return i&&x(t.style,i),{element:t}}updateFromJSON(e){return super.updateFromJSON(e).setLanguage(e.language).setTheme(e.theme)}exportJSON(){return{...super.exportJSON(),language:this.getLanguage(),theme:this.getTheme()}}insertNewAfter(e,t=!0){if(!X(S(),"@lexical/code")){xe();const t=Pe(e);if(t)return t}const{anchor:n,focus:r}=e,i=(n.isBefore(r)?n:r).getNode();if(b(i)){let e=ie(i);const t=[];for(;;)if(l(e))t.push(a()),e=e.getNextSibling();else{if(!$e(e))break;{let n=0;const r=e.getTextContent(),i=e.getTextContentSize();for(;n<i&&" "===r[n];)n++;if(0!==n&&t.push(He(" ".repeat(n))),n!==i)break;e=e.getNextSibling()}}const r=i.splitText(n.offset)[0],o=0===n.offset?0:1,s=r.getIndexWithinParent()+o,u=i.getParentOrThrow(),c=[g(),...t];u.splice(s,0,c);const f=t[t.length-1];f?f.select():0===n.offset?r.selectPrevious():r.getNextSibling().selectNext(0,0)}if(ye(i)){const{offset:t}=e.anchor;i.splice(t,0,[g()]),i.select(t+1,t+1)}return null}canIndent(){return!1}collapseAtStart(){const e=y();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}setLanguage(e){const t=this.getWritable();return t.__language=e||void 0,t}getLanguage(){return this.getLatest().__language}setIsSyntaxHighlightSupported(e){const t=this.getWritable();return t.__isSyntaxHighlightSupported=e,t}getIsSyntaxHighlightSupported(){return this.getLatest().__isSyntaxHighlightSupported}setTheme(e){const t=this.getWritable();return t.__theme=e||void 0,t}getTheme(){return this.getLatest().__theme}}function be(e,t){return h(Se).setLanguage(e).setTheme(t)}function ye(e){return e instanceof Se}function _e(e){return{node:be(e.getAttribute(pe),e.getAttribute(me))}}function ve(e){const t=e,n=Te(t);return n||function(e){let t=e.parentElement;for(;null!==t;){if(Te(t))return!0;t=t.parentElement}return!1}(t)?{node:n?be():null}:{node:null}}function Ce(){return{node:be()}}function Ne(){return{node:null}}function Te(e){return null!==e.style.fontFamily.match("monospace")}function Ae(e){return e.classList.contains("js-file-line-container")}function Pe(e){const{anchor:t}=e;if(e.isCollapsed()&&"element"===t.type){const e=t.getNode();if(ye(e)){const n=e.getChildrenSize();if(n>=2&&t.offset===n){const t=e.getLastChild();if(u(t)&&u(t.getPreviousSibling())){const t=y();return e.splice(n-2,2,[]).insertAfter(t,!1),t.select(),t}}}}return null}class Oe extends C{__highlightType;constructor(e="",t,n){super(e,n),this.__highlightType=t}$config(){return this.config("code-highlight",{extends:C})}afterCloneFrom(e){super.afterCloneFrom(e),this.__highlightType=e.__highlightType}getHighlightType(){return this.getLatest().__highlightType}setHighlightType(e){const t=this.getWritable();return t.__highlightType=e||void 0,t}canHaveFormat(){return!1}createDOM(e){const t=super.createDOM(e),n=we(e.theme,this.__highlightType);return m(t,n),t}updateDOM(e,t,n){const r=super.updateDOM(e,t,n),i=we(n.theme,e.__highlightType),o=we(n.theme,this.__highlightType);return i!==o&&(i&&N(t,i),o&&m(t,o)),r}updateFromJSON(e){return super.updateFromJSON(e).setHighlightType(e.highlightType)}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType()}}setFormat(e){return this}isParentRequired(){return!0}createParentElementNode(){return be()}}function we(e,t){return t&&e&&e.codeHighlight&&e.codeHighlight[t]}function He(e="",t){return v(new Oe(e,t))}function $e(e){return e instanceof Oe}const De="data-language",Be="data-theme";function Le(e){return null!==e.style.fontFamily.match("monospace")}function Ee(e){let t=e.parentElement;for(;null!==t;){if(Le(t))return!0;t=t.parentElement}return!1}const ke=/* @__PURE__ */n([{$import:(e,t)=>e.$importChildren(t),match:/* @__PURE__ */e.tag("tr","td"),name:"@lexical/code/github-code-table/unwrap"}]),Fe={$import:(e,t)=>[be(t.getAttribute(De),t.getAttribute(Be)).splice(0,0,e.$importChildren(t))],match:/* @__PURE__ */e.tag("pre"),name:"@lexical/code/pre"},Me={$import:(e,t,n)=>{const r=t.textContent||"";return/\r?\n/.test(r)||null!==t.querySelector("br")?[be(t.getAttribute(De),t.getAttribute(Be)).splice(0,0,e.$importChildren(t))]:n()},match:/* @__PURE__ */e.tag("code"),name:"@lexical/code/code-multiline"};function ze(e){if(!_(e))return!1;const t=e.style.fontFamily,n=e.style.whiteSpace;return"string"==typeof t&&/monospace/i.test(t)&&"string"==typeof n&&n.startsWith("pre")}function Ke(e){let t=!1;const n=[];let r="",i=!1;const o=()=>{i&&(n.push(r),r="",i=!1)};for(const s of Array.from(e.childNodes))if(_(s))"DIV"===s.tagName?(o(),n.push(s.textContent||""),t=!0):"BR"===s.tagName?(o(),n.push(""),t=!0):(r+=s.textContent||"",i=!0);else if(A(s)){const e=s.textContent||"";e.length>0&&(r+=e,i=!0)}return o(),t?n:null}function Ie(e){for(const t of Array.from(e.children)){if(_(t)&&ze(t)){if(null!==Ke(t))return!0;const e=t.nextElementSibling;if(e&&ze(e))return!0;continue}if(Ie(t))return!0}return!1}const je=/* @__PURE__ */n([{$import:(e,t,n)=>{if(!ze(t)||Ee(t))return n();const r=Ke(t);return null===r||0===r.length?n():[be().splice(0,0,P(r.join("\n")))]},match:/* @__PURE__ */e.tag("div"),name:"@lexical/code/vscode-wrapper"},{$import:(e,t,n)=>{if(!ze(t)||Ee(t))return n();const r=t.previousElementSibling;if(r&&ze(r))return[];const i=[];let o=t;for(;o&&ze(o);)i.push("BR"===o.tagName?"":o.textContent||""),o=o.nextElementSibling;return i.length<2?n():[be().splice(0,0,P(i.join("\n")))]},match:/* @__PURE__ */e.tag("div","br"),name:"@lexical/code/vscode-line-run"}]),Je={$import:(e,t,n)=>Le(t)?[be().splice(0,0,e.$importChildren(t))]:Ee(t)?e.$importChildren(t):n(),match:/* @__PURE__ */e.tag("div"),name:"@lexical/code/div"},Re=[{$import:(e,t)=>[be().splice(0,0,e.$importChildren(t,{rules:ke}))],match:/* @__PURE__ */e.tag("table").classAll("js-file-line-container"),name:"@lexical/code/github-code-table"},{$import:(e,t)=>e.$importChildren(t),match:/* @__PURE__ */e.tag("td").classAll("js-file-line"),name:"@lexical/code/github-code-cell-by-class"},Me,Fe,Je],We={dependencies:[r,[i,{preprocess:[(e,n,r)=>{Ie(T(e)?e.body:e)&&n.session.update(t,e=>[...e,je]),r()}],rules:Re}]],name:"@lexical/code",nodes:()=>[Se,Oe],register:e=>O(e.registerCommand(w,e=>{const t=H();return!(!$(t)||!Pe(t))&&(null!==e&&e.preventDefault(),!0)},D),e.registerNodeTransform(B,e=>{0!==e.getFormat()&&ye(e.getParent())&&e.setFormat(0)}))},qe={dependencies:[We],name:"@lexical/code/Import"};function Ue(e){if(!$(e))return!1;const t=e.anchor.getNode(),n=ye(t)?t:t.getParent(),r=e.focus.getNode(),i=ye(r)?r:r.getParent();return ye(n)&&n.is(i)}function Ve(e){const t=e.getNodes(),n=[];if(1===t.length&&ye(t[0]))return n;let r=[];for(let e=0;e<t.length;e++){const i=t[e];$e(i)||l(i)||u(i)||ne(169),u(i)?r.length>0&&(n.push(r),r=[]):r.push(i)}if(r.length>0){const t=e.isBackward()?e.anchor:e.focus,i=W(r[0].getKey(),0,"text");t.is(i)||n.push(r)}return n}function Ge(e,t){const n=H();if(!$(n)||!Ue(n))return!1;const r=Ve(n),i=r.length;if(0===i&&n.isCollapsed())return e===I?n.insertNodes([a()]):function(e,t){const n=e.anchor.getNode();if(!$e(n)&&!l(n))return;const r=ie(n);l(r)?r.remove():void 0!==t&&$e(r)&&ae(r,t,e)}(n,t),!0;if(0===i&&e===I&&"\n"===n.getTextContent()){const e=a(),t=g(),r=n.isBackward()?"previous":"next";return n.insertNodes([e,t]),q(U(V(G(e,"next",0),Q(f(t,"next"))),r)),!0}for(let o=0;o<i;o++){const i=r[o];if(i.length>0){let r=i[0];if(0===o&&(r=ie(r)),e===I){const e=a();if(r.insertBefore(e),0===o){const t=n.isBackward()?"focus":"anchor",i=W(r.getKey(),0,"text");n[t].is(i)&&n[t].set(e.getKey(),0,"text")}}else l(r)?r.remove():void 0!==t&&$e(r)&&ae(r,t,n)}}return!0}function Qe(e,t){const n=H();if(!$(n))return!1;const{anchor:r,focus:i}=n,o=r.offset,s=i.offset,c=r.getNode(),a=i.getNode(),g=e===k;if(!Ue(n)||!$e(c)&&!l(c)||!$e(a)&&!l(a))return!1;if(!t.altKey){if(n.isCollapsed()){const e=c.getParentOrThrow();if(g&&0===o&&null===c.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!1}else if(!g&&o===c.getTextContentSize()&&null===c.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!1}}return!1}let f,h;if(c.isBefore(a)?(f=ie(c),h=oe(a)):(f=ie(a),h=oe(c)),null==f||null==h)return!1;const p=f.getNodesBetween(h);for(let e=0;e<p.length;e++){const t=p[e];if(!$e(t)&&!l(t)&&!u(t))return!1}t.preventDefault(),t.stopPropagation();const d=g?f.getPreviousSibling():h.getNextSibling();if(!u(d))return!0;const m=g?d.getPreviousSibling():d.getNextSibling();if(null==m)return!0;const x=u(m),S=x||!$e(m)&&!l(m)?null:g?ie(m):oe(m);let b=null!=S?S:m;return d.remove(),p.forEach(e=>e.remove()),x?(p.forEach(e=>{b.insertAfter(e),b=e}),b.insertAfter(d)):e===k?(p.forEach(e=>b.insertBefore(e)),b.insertBefore(d)):(b.insertAfter(d),b=d,p.forEach(e=>{b.insertAfter(e),b=e})),n.setTextNodeRange(c,o,a,s),!0}function Xe(e,t){const n=H();if(!$(n))return!1;const{anchor:r,focus:i}=n,o=r.getNode(),s=i.getNode(),c=e===J;if(!Ue(n)||!$e(o)&&!l(o)||!$e(s)&&!l(s))return!1;const a=s,g="rtl"===se(a)?!c:c,f=r.key,h=r.offset,p=r.type;if(g){const e=le(a,i.offset);if(null!==e){const{node:t,offset:r}=e;u(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else{ue(a).select()}return t.shiftKey&&n.anchor.set(f,h,p),t.preventDefault(),t.stopPropagation(),!0}function Ye(e,t,n){return O(...n?[e.registerCommand(L,e=>!e.altKey&&ee(ye,e),D),e.registerCommand(E,e=>ee(ye,e),D),e.registerCommand(k,e=>!e.altKey&&te(ye,e),D),e.registerCommand(F,e=>te(ye,e),D)]:[],e.registerCommand(M,t=>{const n=function(e){const t=H();if(!$(t)||!Ue(t))return null;const n=e?j:I,r=e?j:z,i=t.anchor,o=t.focus;if(i.is(o))return r;const s=Ve(t);if(1!==s.length)return n;const l=s[0];let u,c;0===l.length&&ne(285),t.isBackward()?(u=o,c=i):(u=i,c=o);const a=ie(l[0]),g=oe(l[0]),f=W(a.getKey(),0,"text"),h=W(g.getKey(),g.getTextContentSize(),"text");return u.isBefore(f)||h.isBefore(c)?n:f.isBefore(u)||c.isBefore(h)?r:n}(t.shiftKey);return null!==n&&(t.preventDefault(),e.dispatchCommand(n),!0)},D),e.registerCommand(z,()=>!!Ue(H())&&(K([a()]),!0),D),e.registerCommand(I,()=>Ge(I),D),e.registerCommand(j,()=>Ge(j,t),D),e.registerCommand(k,e=>{const t=H();if(!$(t))return!1;const{anchor:n}=t,r=n.getNode();if(!Ue(t))return!1;const i=r.getParent();return t.isCollapsed()&&0===n.offset&&null===r.getPreviousSibling()&&ye(i)&&null===i.getPreviousSibling()?(e.preventDefault(),!0):Qe(k,e)},D),e.registerCommand(L,e=>{const t=H();if(!$(t))return!1;const{anchor:n}=t,r=n.getNode();return!!Ue(t)&&(t.isCollapsed()&&n.offset===r.getTextContentSize()&&null===r.getNextSibling()&&ye(r.getParentOrThrow())&&null===r.getParentOrThrow().getNextSibling()?(e.preventDefault(),!0):Qe(L,e))},D),e.registerCommand(J,e=>Xe(J,e),D),e.registerCommand(R,e=>Xe(R,e),D))}const Ze={build:(e,t)=>Z(t),config:{disabled:!1,escapeWithArrows:!1,tabSize:void 0},dependencies:[We],name:"@lexical/code-indent",register:(e,t,n)=>{const r=n.getOutput();return Y(()=>{if(!r.disabled.value)return Ye(e,r.tabSize.value,r.escapeWithArrows.value)})}};export{He as $createCodeHighlightNode,be as $createCodeNode,se as $getCodeLineDirection,ue as $getEndOfCodeInLine,ie as $getFirstCodeNodeOfLine,oe as $getLastCodeNodeOfLine,le as $getStartOfCodeInLine,$e as $isCodeHighlightNode,ye as $isCodeNode,ae as $outdentLeadingSpaces,ce as $plainifyCodeContent,We as CodeExtension,Oe as CodeHighlightNode,qe as CodeImportExtension,Re as CodeImportRules,Ze as CodeIndentExtension,Se as CodeNode,ge as DEFAULT_CODE_LANGUAGE,fe as getDefaultCodeLanguage,Ye as registerCodeIndentation};
package/package.json CHANGED
@@ -8,15 +8,15 @@
8
8
  "code"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.49.1-nightly.20260824.0",
11
+ "version": "0.49.1-nightly.20260826.0",
12
12
  "main": "./dist/LexicalCodeCore.js",
13
13
  "types": "./dist/typescript-too-old.d.ts",
14
14
  "dependencies": {
15
- "@lexical/extension": "0.49.1-nightly.20260824.0",
16
- "@lexical/html": "0.49.1-nightly.20260824.0",
17
- "@lexical/internal": "0.49.1-nightly.20260824.0",
18
- "@lexical/utils": "0.49.1-nightly.20260824.0",
19
- "lexical": "0.49.1-nightly.20260824.0"
15
+ "@lexical/extension": "0.49.1-nightly.20260826.0",
16
+ "@lexical/html": "0.49.1-nightly.20260826.0",
17
+ "@lexical/utils": "0.49.1-nightly.20260826.0",
18
+ "lexical": "0.49.1-nightly.20260826.0",
19
+ "@lexical/internal": "0.49.1-nightly.20260826.0"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -28,13 +28,13 @@ import {$exitCodeNodeOnEnter, $isCodeNode, CodeNode} from './CodeNode';
28
28
  /**
29
29
  * Add code blocks to the editor (syntax highlighting provided separately)
30
30
  */
31
- export const CodeExtension = /* @__PURE__ */ defineExtension({
31
+ export const CodeExtension = defineExtension({
32
32
  dependencies: [
33
33
  // DOMImportExtension support for the nodes registered here. Inert
34
34
  // unless the editor routes HTML through the pipeline (e.g. via
35
35
  // ClipboardDOMImportExtension or $generateNodesFromDOMViaExtension).
36
36
  CoreImportExtension,
37
- /* @__PURE__ */ configExtension(DOMImportExtension, {
37
+ configExtension(DOMImportExtension, {
38
38
  preprocess: [$installVscodeCodePasteOverlay],
39
39
  rules: CodeImportRules,
40
40
  }),
@@ -75,7 +75,7 @@ export const CodeExtension = /* @__PURE__ */ defineExtension({
75
75
  * {@link CodeImportRules} (and `CoreImportExtension`) itself — depend on
76
76
  * it directly instead.
77
77
  */
78
- export const CodeImportExtension = /* @__PURE__ */ defineExtension({
78
+ export const CodeImportExtension = defineExtension({
79
79
  dependencies: [CodeExtension],
80
80
  name: '@lexical/code/Import',
81
81
  });
@@ -54,15 +54,15 @@ function isMonospaceDescendant(node: HTMLElement): boolean {
54
54
  * the cost of these rules is never paid against unrelated `<tr>` /
55
55
  * `<td>` pastes.
56
56
  */
57
- const GitHubCodeTableOverlayRules = /* @__PURE__ */ defineOverlayRules([
58
- /* @__PURE__ */ defineImportRule({
57
+ const GitHubCodeTableOverlayRules = defineOverlayRules([
58
+ defineImportRule({
59
59
  $import: (ctx, el) => ctx.$importChildren(el),
60
60
  match: sel.tag('tr', 'td'),
61
61
  name: '@lexical/code/github-code-table/unwrap',
62
62
  }),
63
63
  ]);
64
64
 
65
- const PreRule = /* @__PURE__ */ defineImportRule({
65
+ const PreRule = defineImportRule({
66
66
  $import: (ctx, el) => [
67
67
  $createCodeNode(
68
68
  el.getAttribute(LANGUAGE_DATA_ATTRIBUTE),
@@ -79,7 +79,7 @@ const PreRule = /* @__PURE__ */ defineImportRule({
79
79
  * defers to the inline-format rule from `CoreImportExtension` so it
80
80
  * becomes a TextNode with IS_CODE.
81
81
  */
82
- const MultilineCodeRule = /* @__PURE__ */ defineImportRule({
82
+ const MultilineCodeRule = defineImportRule({
83
83
  $import: (ctx, el, $next) => {
84
84
  const text = el.textContent || '';
85
85
  const isMultiLine = /\r?\n/.test(text) || el.querySelector('br') !== null;
@@ -204,7 +204,7 @@ function looksLikeVscodePaste(root: ParentNode): boolean {
204
204
  * around per-line `<div>`s and `<br>`s. Emits a single CodeNode whose
205
205
  * text is the wrapper's lines joined by `\n`.
206
206
  */
207
- const VscodeWrapperRule = /* @__PURE__ */ defineImportRule({
207
+ const VscodeWrapperRule = defineImportRule({
208
208
  $import: (_ctx, el, $next) => {
209
209
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
210
210
  return $next();
@@ -232,7 +232,7 @@ const VscodeWrapperRule = /* @__PURE__ */ defineImportRule({
232
232
  * subsequent sibling in the same run, the prev-sibling check below
233
233
  * returns `[]` so the run is only emitted once.
234
234
  */
235
- const VscodeLineRunRule = /* @__PURE__ */ defineImportRule({
235
+ const VscodeLineRunRule = defineImportRule({
236
236
  $import: (_ctx, el, $next) => {
237
237
  if (!isMonospacePreElement(el) || isMonospaceDescendant(el)) {
238
238
  return $next();
@@ -263,7 +263,7 @@ const VscodeLineRunRule = /* @__PURE__ */ defineImportRule({
263
263
  name: '@lexical/code/vscode-line-run',
264
264
  });
265
265
 
266
- const VscodeCodePasteOverlay = /* @__PURE__ */ defineOverlayRules([
266
+ const VscodeCodePasteOverlay = defineOverlayRules([
267
267
  VscodeWrapperRule,
268
268
  VscodeLineRunRule,
269
269
  ]);
@@ -311,7 +311,7 @@ export const $installVscodeCodePasteOverlay: DOMPreprocessFn = (
311
311
  * wrapper just unwrap so their text content flows into the surrounding
312
312
  * CodeNode.
313
313
  */
314
- const DivRule = /* @__PURE__ */ defineImportRule({
314
+ const DivRule = defineImportRule({
315
315
  $import: (ctx, el, $next) => {
316
316
  if (isMonospaceElement(el)) {
317
317
  return [$createCodeNode().splice(0, 0, ctx.$importChildren(el))];
@@ -333,7 +333,7 @@ const DivRule = /* @__PURE__ */ defineImportRule({
333
333
  * subtree unwrap unconditionally — without paying the predicate cost
334
334
  * on every other `<tr>` / `<td>` paste elsewhere.
335
335
  */
336
- const GitHubCodeTableRule = /* @__PURE__ */ defineImportRule({
336
+ const GitHubCodeTableRule = defineImportRule({
337
337
  $import: (ctx, el) => [
338
338
  $createCodeNode().splice(
339
339
  0,
@@ -351,7 +351,7 @@ const GitHubCodeTableRule = /* @__PURE__ */ defineImportRule({
351
351
  * descendant text flows up into whatever context the cell is in. The
352
352
  * class is part of the selector itself, so no runtime guard.
353
353
  */
354
- const GitHubCodeCellByClassRule = /* @__PURE__ */ defineImportRule({
354
+ const GitHubCodeCellByClassRule = defineImportRule({
355
355
  $import: (ctx, el) => ctx.$importChildren(el),
356
356
  match: sel.tag('td').classAll('js-file-line'),
357
357
  name: '@lexical/code/github-code-cell-by-class',
@@ -717,9 +717,9 @@ export interface CodeIndentConfig {
717
717
  * Code blocks without syntax highlighting can use this extension on its
718
718
  * own.
719
719
  */
720
- export const CodeIndentExtension = /* @__PURE__ */ defineExtension({
720
+ export const CodeIndentExtension = defineExtension({
721
721
  build: (editor, config) => namedSignals(config),
722
- config: /* @__PURE__ */ safeCast<CodeIndentConfig>({
722
+ config: safeCast<CodeIndentConfig>({
723
723
  disabled: false,
724
724
  escapeWithArrows: false,
725
725
  tabSize: undefined,