@mx-space/cli 0.15.0 → 0.15.2

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/{Lexical.dev-Cck4n26y.mjs → Lexical.dev-Df5TNMgP.mjs} +129 -96
  3. package/dist/{Lexical.node-D6wf2D5M.mjs → Lexical.node-B064E4Hy.mjs} +1 -1
  4. package/dist/{Lexical.prod-DCwS1oTq.mjs → Lexical.prod-DRFSwoE7.mjs} +6 -4
  5. package/dist/{LexicalClipboard.dev-CMkPHV7O.mjs → LexicalClipboard.dev-ClOWeg5v.mjs} +18 -14
  6. package/dist/{LexicalClipboard.node-m4nZ7IYw.mjs → LexicalClipboard.node-BJBLWpEi.mjs} +1 -1
  7. package/dist/{LexicalClipboard.prod-B_rN1vE1.mjs → LexicalClipboard.prod-Ytt65eQo.mjs} +10 -10
  8. package/dist/{LexicalCodeCore.dev-DyJw3i8V.mjs → LexicalCodeCore.dev-CzEPINOT.mjs} +43 -25
  9. package/dist/{LexicalCodeCore.prod-DPXLHQLF.mjs → LexicalCodeCore.prod-DOVk7lL_.mjs} +6 -6
  10. package/dist/{LexicalDragon.dev-ZkNfMwrE.mjs → LexicalDragon.dev-DxePN9fP.mjs} +2 -2
  11. package/dist/{LexicalDragon.node-Ds9oLUFh.mjs → LexicalDragon.node-DBwaqStp.mjs} +1 -1
  12. package/dist/{LexicalDragon.prod-B58ic2av.mjs → LexicalDragon.prod-Bji84-Hq.mjs} +2 -2
  13. package/dist/{LexicalExtension.dev-DvwHs1Xv.mjs → LexicalExtension.dev-DtSRyjbf.mjs} +25 -13
  14. package/dist/{LexicalExtension.node-5OymZQfy.mjs → LexicalExtension.node-3nsS5NjU.mjs} +1 -1
  15. package/dist/{LexicalExtension.prod-Ce0T5smQ.mjs → LexicalExtension.prod-Ddk0ja_6.mjs} +16 -13
  16. package/dist/{LexicalHeadless.dev-DA0WldSR.mjs → LexicalHeadless.dev-DdWJsPoH.mjs} +1 -1
  17. package/dist/{LexicalHeadless.prod-1kQgKB6c.mjs → LexicalHeadless.prod-CH74ZDMt.mjs} +1 -1
  18. package/dist/{LexicalHtml.dev-BDB7CUrx.mjs → LexicalHtml.dev-DN7QIb_7.mjs} +20 -14
  19. package/dist/{LexicalHtml.node-DpVNt7It.mjs → LexicalHtml.node-DAwuaPeI.mjs} +1 -1
  20. package/dist/{LexicalHtml.prod-HkxM5scw.mjs → LexicalHtml.prod-X4eTHEfI.mjs} +4 -4
  21. package/dist/{LexicalLink.dev-C5zNJlrm.mjs → LexicalLink.dev-owitIl6I.mjs} +28 -21
  22. package/dist/{LexicalLink.prod-Bkt9hQAt.mjs → LexicalLink.prod-BZ7ZZkVD.mjs} +6 -5
  23. package/dist/{LexicalList.dev-B7VgME-m.mjs → LexicalList.dev-CUbi09Yo.mjs} +4 -4
  24. package/dist/{LexicalList.prod-B8c7TDjH.mjs → LexicalList.prod-pUsUZa0r.mjs} +4 -4
  25. package/dist/{LexicalMarkdown.dev-B5z9kLbV.mjs → LexicalMarkdown.dev-S2yWckH9.mjs} +40 -29
  26. package/dist/{LexicalMarkdown.prod-wKzw7FFH.mjs → LexicalMarkdown.prod-TRkMWfmC.mjs} +10 -7
  27. package/dist/{LexicalRichText.dev-CUd6Li5F.mjs → LexicalRichText.dev-Y3ybFF2S.mjs} +15 -11
  28. package/dist/{LexicalRichText.node-BKfaQ-CH.mjs → LexicalRichText.node-wNAi2Z4i.mjs} +4 -4
  29. package/dist/{LexicalRichText.prod-SBewjJHx.mjs → LexicalRichText.prod-HLxqZ6hQ.mjs} +17 -11
  30. package/dist/{LexicalSelection.dev-D27JOCqj.mjs → LexicalSelection.dev-CyhKOKbs.mjs} +28 -24
  31. package/dist/{LexicalSelection.node-DBEwPjBu.mjs → LexicalSelection.node-BCuHMbzl.mjs} +1 -1
  32. package/dist/{LexicalSelection.prod-OaYhXHOL.mjs → LexicalSelection.prod-RebDJliC.mjs} +2 -2
  33. package/dist/{LexicalTable.dev-6IFFOAE0.mjs → LexicalTable.dev-DN3ezVey.mjs} +33 -28
  34. package/dist/{LexicalTable.prod-2CaLZ7fH.mjs → LexicalTable.prod-B0MioVyq.mjs} +10 -9
  35. package/dist/{LexicalUtils.dev-DJA7J_7v.mjs → LexicalUtils.dev-Bw6LFRlt.mjs} +8 -5
  36. package/dist/{LexicalUtils.node-Df9oPTlA.mjs → LexicalUtils.node-BPKMFN80.mjs} +1 -1
  37. package/dist/{LexicalUtils.prod-Bb7V4Ewg.mjs → LexicalUtils.prod-CJYQVQJO.mjs} +7 -6
  38. package/dist/bin/mxs.mjs +1 -1
  39. package/dist/{esm-DLzrv7gD.mjs → esm-7vSMGlFz.mjs} +428 -505
  40. package/dist/esm-ZrfYH2y2.mjs +2 -0
  41. package/dist/index.mjs +1 -1
  42. package/dist/{mxs-BIRW5Axj.mjs → mxs-DKv-4ZTg.mjs} +1091 -806
  43. package/dist/{rolldown-runtime-JspESFgx.mjs → rolldown-runtime-B4iAMlE-.mjs} +1 -1
  44. package/dist/vendor/litexml/cli.mjs +113 -42
  45. package/dist/vendor/litexml/litexml-html-preview-client.css +575 -997
  46. package/dist/vendor/litexml/litexml-html-preview-client.js +8177 -7143
  47. package/dist/vendor/litexml/style.css +9 -5
  48. package/package.json +28 -25
  49. package/skills/safety.md +1 -1
  50. package/LICENSE +0 -33
  51. package/dist/esm-CDcJmHkG.mjs +0 -2
package/README.md CHANGED
@@ -694,7 +694,7 @@ The variant (`article` / `note`) is auto-detected from the envelope root. Overri
694
694
 
695
695
  ## Skill bundle
696
696
 
697
- `mxs skill` exposes the bundled AI-agent documentation directly from the CLI binary. Chapters are shipped inside the published `@mx-space/cli` package; liteXML chapters are pulled live from `@haklex/rich-litexml` at runtime (requires `@haklex/rich-litexml@>=0.16.0`).
697
+ `mxs skill` exposes the bundled AI-agent documentation directly from the CLI binary. Chapters are shipped inside the published `@mx-space/cli` package; liteXML chapters are pulled live from `@haklex/rich-litexml` at runtime (requires `@haklex/rich-litexml@>=0.36.1`).
698
698
 
699
699
  | Command | Behaviour |
700
700
  | -------------------------------- | ---------------------------------------------------------- |
@@ -75,8 +75,10 @@ const NON_BREAKING_SPACE = "\xA0";
75
75
  const COMPOSITION_SUFFIX = IS_SAFARI || IS_IOS || IS_APPLE_WEBKIT ? NON_BREAKING_SPACE : "​";
76
76
  const DOUBLE_LINE_BREAK = "\n\n";
77
77
  const COMPOSITION_START_CHAR = IS_FIREFOX ? NON_BREAKING_SPACE : COMPOSITION_SUFFIX;
78
- const RTL_REGEX = /* @__PURE__ */ new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]");
79
- const LTR_REGEX = /* @__PURE__ */ new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]");
78
+ const RTL = "֑-߿יִ-﷽ﹰ-ﻼ";
79
+ const LTR = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿";
80
+ const RTL_REGEX = new RegExp("^[^" + LTR + "]*[" + RTL + "]");
81
+ const LTR_REGEX = new RegExp("^[^" + RTL + "]*[" + LTR + "]");
80
82
  const TEXT_TYPE_TO_FORMAT = {
81
83
  bold: 1,
82
84
  capitalize: IS_CAPITALIZE,
@@ -3289,9 +3291,7 @@ function $handleBeforeInput(event) {
3289
3291
  case "historyUndo":
3290
3292
  dispatchCommand(editor, UNDO_COMMAND);
3291
3293
  break;
3292
- case "historyRedo":
3293
- dispatchCommand(editor, REDO_COMMAND);
3294
- break;
3294
+ case "historyRedo": dispatchCommand(editor, REDO_COMMAND);
3295
3295
  }
3296
3296
  return true;
3297
3297
  }
@@ -3495,19 +3495,21 @@ function $handleKeyDown(event) {
3495
3495
  } else if (isParagraph(event)) {
3496
3496
  inputState.isInsertLineBreak = false;
3497
3497
  dispatchCommand(editor, KEY_ENTER_COMMAND, event);
3498
- } else if (isDeleteBackward(event)) if (isBackspace(event)) {
3499
- if (dispatchCommand(editor, KEY_BACKSPACE_COMMAND, event)) markHandledSelectionCommandInsertText(inputState);
3500
- } else {
3501
- event.preventDefault();
3502
- dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
3503
- }
3504
- else if (isEscape(event)) dispatchCommand(editor, KEY_ESCAPE_COMMAND, event);
3505
- else if (isDeleteForward(event)) if (isDelete(event)) dispatchCommand(editor, KEY_DELETE_COMMAND, event);
3506
- else {
3507
- event.preventDefault();
3508
- dispatchCommand(editor, DELETE_CHARACTER_COMMAND, false);
3509
- }
3510
- else if (isDeleteWordBackward(event)) {
3498
+ } else if (isDeleteBackward(event)) {
3499
+ if (isBackspace(event)) {
3500
+ if (dispatchCommand(editor, KEY_BACKSPACE_COMMAND, event)) markHandledSelectionCommandInsertText(inputState);
3501
+ } else {
3502
+ event.preventDefault();
3503
+ dispatchCommand(editor, DELETE_CHARACTER_COMMAND, true);
3504
+ }
3505
+ } else if (isEscape(event)) dispatchCommand(editor, KEY_ESCAPE_COMMAND, event);
3506
+ else if (isDeleteForward(event)) {
3507
+ if (isDelete(event)) dispatchCommand(editor, KEY_DELETE_COMMAND, event);
3508
+ else {
3509
+ event.preventDefault();
3510
+ dispatchCommand(editor, DELETE_CHARACTER_COMMAND, false);
3511
+ }
3512
+ } else if (isDeleteWordBackward(event)) {
3511
3513
  event.preventDefault();
3512
3514
  dispatchCommand(editor, DELETE_WORD_COMMAND, true);
3513
3515
  } else if (isDeleteWordForward(event)) {
@@ -4693,10 +4695,14 @@ var LexicalNode = class {
4693
4695
  $setSelection(selection);
4694
4696
  const anchor = selection.anchor;
4695
4697
  const focus = selection.focus;
4696
- if (anchor.key === toReplaceKey) if (includeChildren && anchor.type === "element") anchor.set(writableReplaceWith.__key, prevSizeBeforeChildrenTransfer + anchor.offset, "element");
4697
- else $moveSelectionPointToEnd(anchor, writableReplaceWith);
4698
- if (focus.key === toReplaceKey) if (includeChildren && focus.type === "element") focus.set(writableReplaceWith.__key, prevSizeBeforeChildrenTransfer + focus.offset, "element");
4699
- else $moveSelectionPointToEnd(focus, writableReplaceWith);
4698
+ if (anchor.key === toReplaceKey) {
4699
+ if (includeChildren && anchor.type === "element") anchor.set(writableReplaceWith.__key, prevSizeBeforeChildrenTransfer + anchor.offset, "element");
4700
+ else $moveSelectionPointToEnd(anchor, writableReplaceWith);
4701
+ }
4702
+ if (focus.key === toReplaceKey) {
4703
+ if (includeChildren && focus.type === "element") focus.set(writableReplaceWith.__key, prevSizeBeforeChildrenTransfer + focus.offset, "element");
4704
+ else $moveSelectionPointToEnd(focus, writableReplaceWith);
4705
+ }
4700
4706
  }
4701
4707
  if ($getCompositionKey() === toReplaceKey) $setCompositionKey(key);
4702
4708
  return writableReplaceWith;
@@ -5064,8 +5070,10 @@ function getStyleObjectFromCSS(css) {
5064
5070
  }
5065
5071
  if (chunkStart === -1) chunkStart = i;
5066
5072
  }
5067
- if (chunkStart !== -1) if (isParsingValue) currentValue += css.slice(chunkStart, length);
5068
- else currentProperty += css.slice(chunkStart, length);
5073
+ if (chunkStart !== -1) {
5074
+ if (isParsingValue) currentValue += css.slice(chunkStart, length);
5075
+ else currentProperty += css.slice(chunkStart, length);
5076
+ }
5069
5077
  const property = currentProperty.trim();
5070
5078
  const value = currentValue.trim();
5071
5079
  if (property !== "" && value !== "") styles[property] = value;
@@ -6097,11 +6105,13 @@ function $insertTextAtPoint(selection, text, format, style) {
6097
6105
  textNode.setFormat(format);
6098
6106
  textNode.setStyle(style);
6099
6107
  const parent = anchorNode.getParentOrThrow();
6100
- if (offset === 0) if (parent.isInline() && !anchorNode.__prev) parent.insertBefore(textNode);
6101
- else anchorNode.insertBefore(textNode, false);
6102
- else if (offset === anchorNode.getTextContentSize()) if (parent.isInline() && !anchorNode.__next) parent.insertAfter(textNode);
6103
- else anchorNode.insertAfter(textNode, false);
6104
- else {
6108
+ if (offset === 0) {
6109
+ if (parent.isInline() && !anchorNode.__prev) parent.insertBefore(textNode);
6110
+ else anchorNode.insertBefore(textNode, false);
6111
+ } else if (offset === anchorNode.getTextContentSize()) {
6112
+ if (parent.isInline() && !anchorNode.__next) parent.insertAfter(textNode);
6113
+ else anchorNode.insertAfter(textNode, false);
6114
+ } else {
6105
6115
  const [before] = anchorNode.splitText(offset);
6106
6116
  before.insertAfter(textNode, false);
6107
6117
  }
@@ -6334,10 +6344,11 @@ var RangeSelection = class RangeSelection {
6334
6344
  prevWasElement = false;
6335
6345
  if ($isTextNode(node)) {
6336
6346
  let text = node.getTextContent();
6337
- if (node === firstNode) if (node === lastNode) {
6338
- if (anchor.type !== "element" || focus.type !== "element" || focus.offset === anchor.offset) text = anchorOffset < focusOffset ? text.slice(anchorOffset, focusOffset) : text.slice(focusOffset, anchorOffset);
6339
- } else text = isBefore ? text.slice(anchorOffset) : text.slice(focusOffset);
6340
- else if (node === lastNode) text = isBefore ? text.slice(0, focusOffset) : text.slice(0, anchorOffset);
6347
+ if (node === firstNode) {
6348
+ if (node === lastNode) {
6349
+ if (anchor.type !== "element" || focus.type !== "element" || focus.offset === anchor.offset) text = anchorOffset < focusOffset ? text.slice(anchorOffset, focusOffset) : text.slice(focusOffset, anchorOffset);
6350
+ } else text = isBefore ? text.slice(anchorOffset) : text.slice(focusOffset);
6351
+ } else if (node === lastNode) text = isBefore ? text.slice(0, focusOffset) : text.slice(0, anchorOffset);
6341
6352
  textContent += text;
6342
6353
  } else if (($isDecoratorNode(node) || $isLineBreakNode(node)) && (node !== lastNode || !this.isCollapsed())) textContent += node.getTextContent();
6343
6354
  }
@@ -6500,12 +6511,14 @@ var RangeSelection = class RangeSelection {
6500
6511
  const atStartOfInline = anchorParent.isInline() && offset === 0 && !anchorNode.__prev;
6501
6512
  const atEndOfInline = anchorParent.isInline() && offset === anchorSize && !anchorNode.__next;
6502
6513
  const formatDiffers = anchorNode.getFormat() !== format || anchorNode.getStyle() !== style;
6503
- if (atStartOfInline || atEndOfInline || formatDiffers) if (anchorNode.getTextContent() === "" && !atStartOfInline && !atEndOfInline) {
6504
- anchorNode.setFormat(format);
6505
- anchorNode.setStyle(style);
6506
- } else {
6507
- $insertTextAtPoint(this, text, format, style);
6508
- return;
6514
+ if (atStartOfInline || atEndOfInline || formatDiffers) {
6515
+ if (anchorNode.getTextContent() === "" && !atStartOfInline && !atEndOfInline) {
6516
+ anchorNode.setFormat(format);
6517
+ anchorNode.setStyle(style);
6518
+ } else {
6519
+ $insertTextAtPoint(this, text, format, style);
6520
+ return;
6521
+ }
6509
6522
  }
6510
6523
  anchorNode.spliceText(offset, 0, text, true);
6511
6524
  if (anchorNode.isComposing() && this.anchor.type === "text") this.anchor.set(this.anchor.key, this.anchor.offset - text.length, this.anchor.type);
@@ -6759,19 +6772,21 @@ var RangeSelection = class RangeSelection {
6759
6772
  if (granularity === "character" && $isTextNode(focusNode) && focusNode.isUnmergeable()) {
6760
6773
  if (isBackward ? this.focus.offset === 0 : this.focus.offset === focusNode.getTextContentSize()) {
6761
6774
  const sibling = $getSiblingCaret(focusNode, isBackward ? "previous" : "next").getNodeAtCaret();
6762
- if ($isTextNode(sibling)) if (collapse) {
6763
- const sibKeyedDOM = editor.getElementByKey(sibling.getKey());
6764
- const sibDOM = sibKeyedDOM ? $getDOMTextNode(sibling, sibKeyedDOM, editor) : null;
6765
- if (sibDOM) {
6766
- const sibOffset = isBackward ? sibDOM.length : 0;
6767
- setDOMSelectionBaseAndExtent(domSelection, sibDOM, sibOffset, sibDOM, sibOffset);
6775
+ if ($isTextNode(sibling)) {
6776
+ if (collapse) {
6777
+ const sibKeyedDOM = editor.getElementByKey(sibling.getKey());
6778
+ const sibDOM = sibKeyedDOM ? $getDOMTextNode(sibling, sibKeyedDOM, editor) : null;
6779
+ if (sibDOM) {
6780
+ const sibOffset = isBackward ? sibDOM.length : 0;
6781
+ setDOMSelectionBaseAndExtent(domSelection, sibDOM, sibOffset, sibDOM, sibOffset);
6782
+ }
6783
+ } else {
6784
+ const sibLen = sibling.getTextContentSize();
6785
+ if (isBackward) this.focus.set(sibling.__key, sibLen - 1, "text");
6786
+ else this.focus.set(sibling.__key, 1, "text");
6787
+ this.dirty = true;
6788
+ return;
6768
6789
  }
6769
- } else {
6770
- const sibLen = sibling.getTextContentSize();
6771
- if (isBackward) this.focus.set(sibling.__key, sibLen - 1, "text");
6772
- else this.focus.set(sibling.__key, 1, "text");
6773
- this.dirty = true;
6774
- return;
6775
6790
  }
6776
6791
  }
6777
6792
  }
@@ -7313,8 +7328,10 @@ function $updateCaretSelectionForUnicodeCharacter(selection, isBackward) {
7313
7328
  const endOffset = isBefore ? focusOffset : anchorOffset;
7314
7329
  const characterOffset = endOffset - 1;
7315
7330
  if (startOffset !== characterOffset) {
7316
- if (shouldDeleteExactlyOneCodeUnit(anchorNode.getTextContent().slice(startOffset, endOffset))) if (isBackward) focus.set(focus.key, characterOffset, focus.type);
7317
- else anchor.set(anchor.key, characterOffset, anchor.type);
7331
+ if (shouldDeleteExactlyOneCodeUnit(anchorNode.getTextContent().slice(startOffset, endOffset))) {
7332
+ if (isBackward) focus.set(focus.key, characterOffset, focus.type);
7333
+ else anchor.set(anchor.key, characterOffset, anchor.type);
7334
+ }
7318
7335
  }
7319
7336
  }
7320
7337
  }
@@ -8008,10 +8025,12 @@ function $getNodesFromCaretRangeCompat(range) {
8008
8025
  }
8009
8026
  while (nodes.length > 1) {
8010
8027
  const lastIncludedNode = nodes[nodes.length - 1];
8011
- if ($isElementNode(lastIncludedNode)) if (seenElements.has(lastIncludedNode) || lastIncludedNode.isEmpty() || seenAncestors.has(lastIncludedNode));
8012
- else {
8013
- nodes.pop();
8014
- continue;
8028
+ if ($isElementNode(lastIncludedNode)) {
8029
+ if (seenElements.has(lastIncludedNode) || lastIncludedNode.isEmpty() || seenAncestors.has(lastIncludedNode));
8030
+ else {
8031
+ nodes.pop();
8032
+ continue;
8033
+ }
8015
8034
  }
8016
8035
  break;
8017
8036
  }
@@ -8605,9 +8624,11 @@ function $beginUpdate(editor, updateFn, options) {
8605
8624
  const headless = editor._headless || editor.getRootElement() === null;
8606
8625
  setPendingNodeToClone(null);
8607
8626
  try {
8608
- if (editorStateWasCloned) if (headless) {
8609
- if (currentEditorState._selection !== null) pendingEditorState._selection = currentEditorState._selection.clone();
8610
- } else pendingEditorState._selection = $internalCreateSelection(editor, options && options.event || null);
8627
+ if (editorStateWasCloned) {
8628
+ if (headless) {
8629
+ if (currentEditorState._selection !== null) pendingEditorState._selection = currentEditorState._selection.clone();
8630
+ } else pendingEditorState._selection = $internalCreateSelection(editor, options && options.event || null);
8631
+ }
8611
8632
  const startingCompositionKey = editor._compositionKey;
8612
8633
  updateFn();
8613
8634
  skipTransforms = $processNestedUpdates(editor, skipTransforms);
@@ -8667,11 +8688,12 @@ function $beginUpdate(editor, updateFn, options) {
8667
8688
  * within an update
8668
8689
  */
8669
8690
  function updateEditorSync(editor, updateFn, options) {
8670
- if (activeEditor === editor && options === void 0) if (isCurrentlyReadOnlyMode()) {
8671
- console.warn("updateEditorSync: an editor update (e.g. a command listener that mutates the editor) ran while a read-only context was on the stack. This most commonly happens when a command is dispatched from inside editor.read(). The update has been deferred to a fresh writable update so it still applies, but dispatching mutations from a read-only context is an anti-pattern — dispatch after editor.read() returns, or via queueMicrotask.");
8672
- $beginUpdate(editor, updateFn, options);
8673
- } else updateFn();
8674
- else $beginUpdate(editor, updateFn, options);
8691
+ if (activeEditor === editor && options === void 0) {
8692
+ if (isCurrentlyReadOnlyMode()) {
8693
+ console.warn("updateEditorSync: an editor update (e.g. a command listener that mutates the editor) ran while a read-only context was on the stack. This most commonly happens when a command is dispatched from inside editor.read(). The update has been deferred to a fresh writable update so it still applies, but dispatching mutations from a read-only context is an anti-pattern — dispatch after editor.read() returns, or via queueMicrotask.");
8694
+ $beginUpdate(editor, updateFn, options);
8695
+ } else updateFn();
8696
+ } else $beginUpdate(editor, updateFn, options);
8675
8697
  }
8676
8698
  function updateEditor(editor, updateFn, options) {
8677
8699
  if (editor._updating) editor._updates.push([updateFn, options]);
@@ -9114,10 +9136,12 @@ var ElementNode = class extends LexicalNode {
9114
9136
  const nodeAfterRange = this.getChildAtIndex(start + deleteCount);
9115
9137
  let nodeBeforeRange = null;
9116
9138
  let newSize = oldSize - deleteCount + nodesToInsert.length;
9117
- if (start !== 0) if (start === oldSize) nodeBeforeRange = this.getLastChild();
9118
- else {
9119
- const node = this.getChildAtIndex(start);
9120
- if (node !== null) nodeBeforeRange = node.getPreviousSibling();
9139
+ if (start !== 0) {
9140
+ if (start === oldSize) nodeBeforeRange = this.getLastChild();
9141
+ else {
9142
+ const node = this.getChildAtIndex(start);
9143
+ if (node !== null) nodeBeforeRange = node.getPreviousSibling();
9144
+ }
9121
9145
  }
9122
9146
  if (deleteCount > 0) {
9123
9147
  let nodeToDelete = nodeBeforeRange === null ? this.getFirstChild() : nodeBeforeRange.getNextSibling();
@@ -10561,8 +10585,10 @@ var LexicalEditor = class {
10561
10585
  const root = $getRoot();
10562
10586
  if (selection !== null) {
10563
10587
  if (!selection.dirty) $setSelection(selection.clone());
10564
- } else if (root.getChildrenSize() !== 0) if (options.defaultSelection === "rootStart") root.selectStart();
10565
- else root.selectEnd();
10588
+ } else if (root.getChildrenSize() !== 0) {
10589
+ if (options.defaultSelection === "rootStart") root.selectStart();
10590
+ else root.selectEnd();
10591
+ }
10566
10592
  $addUpdateTag(FOCUS_TAG);
10567
10593
  $onUpdate(() => {
10568
10594
  rootElement.removeAttribute("autocapitalize");
@@ -10778,8 +10804,10 @@ function errorOnNodeKeyConstructorMismatch(node, existingKey, pendingNode) {
10778
10804
  if (pendingNode) {
10779
10805
  if (!(existingKey === pendingNode.__key)) formatDevErrorMessage(`Lexical node with constructor ${node.constructor.name} (type ${node.getType()}) has an incorrect clone implementation, got ${String(existingKey)} for nodeKey when expecting ${pendingNode.__key}`);
10780
10806
  }
10781
- if (existingNode && existingNode.constructor !== node.constructor) if (node.constructor.name !== existingNode.constructor.name) formatDevErrorMessage(`Lexical node with constructor ${node.constructor.name} attempted to re-use key from node in active editor state with constructor ${existingNode.constructor.name}. Keys must not be re-used when the type is changed.`);
10782
- else formatDevErrorMessage(`Lexical node with constructor ${node.constructor.name} attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.`);
10807
+ if (existingNode && existingNode.constructor !== node.constructor) {
10808
+ if (node.constructor.name !== existingNode.constructor.name) formatDevErrorMessage(`Lexical node with constructor ${node.constructor.name} attempted to re-use key from node in active editor state with constructor ${existingNode.constructor.name}. Keys must not be re-used when the type is changed.`);
10809
+ else formatDevErrorMessage(`Lexical node with constructor ${node.constructor.name} attempted to re-use key from node in active editor state with different constructor with the same name (possibly due to invalid Hot Module Replacement). Keys must not be re-used when the type is changed.`);
10810
+ }
10783
10811
  }
10784
10812
  function internalMarkParentElementsAsDirty(parentKey, nodeMap, dirtyElements) {
10785
10813
  let nextParentKey = parentKey;
@@ -11428,13 +11456,15 @@ function scrollIntoViewIfNeeded(editor, selectionRect, rootElement) {
11428
11456
  let diff = 0;
11429
11457
  if (currentTop < targetTop) diff = -(targetTop - currentTop);
11430
11458
  else if (currentBottom > targetBottom) diff = currentBottom - targetBottom;
11431
- if (diff !== 0) if (isBodyElement) defaultView.scrollBy(0, diff);
11432
- else {
11433
- const scrollTop = element.scrollTop;
11434
- element.scrollTop += diff;
11435
- const yOffset = element.scrollTop - scrollTop;
11436
- currentTop -= yOffset;
11437
- currentBottom -= yOffset;
11459
+ if (diff !== 0) {
11460
+ if (isBodyElement) defaultView.scrollBy(0, diff);
11461
+ else {
11462
+ const scrollTop = element.scrollTop;
11463
+ element.scrollTop += diff;
11464
+ const yOffset = element.scrollTop - scrollTop;
11465
+ currentTop -= yOffset;
11466
+ currentBottom -= yOffset;
11467
+ }
11438
11468
  }
11439
11469
  if (isBodyElement) break;
11440
11470
  element = getParentElement(element);
@@ -12441,17 +12471,19 @@ function getStaticNodeConfig(klass) {
12441
12471
  const nodeType = ownGetType && !(SYNTHESIZED_GET_TYPE in ownGetType) ? ownGetType.call(klass) : void 0;
12442
12472
  let ownNodeConfig;
12443
12473
  let ownNodeType = nodeType;
12444
- if (nodeConfigRecord) if (nodeType) ownNodeConfig = nodeConfigRecord[nodeType];
12445
- else {
12446
- for (const [k, v] of Object.entries(nodeConfigRecord)) {
12447
- ownNodeType = k;
12448
- ownNodeConfig = v;
12449
- }
12450
- if (!ownNodeConfig) for (const symbolKey of Object.getOwnPropertySymbols(nodeConfigRecord)) {
12451
- const symbolConfig = nodeConfigRecord[symbolKey];
12452
- if (symbolConfig) {
12453
- ownNodeConfig = symbolConfig;
12454
- break;
12474
+ if (nodeConfigRecord) {
12475
+ if (nodeType) ownNodeConfig = nodeConfigRecord[nodeType];
12476
+ else {
12477
+ for (const [k, v] of Object.entries(nodeConfigRecord)) {
12478
+ ownNodeType = k;
12479
+ ownNodeConfig = v;
12480
+ }
12481
+ if (!ownNodeConfig) for (const symbolKey of Object.getOwnPropertySymbols(nodeConfigRecord)) {
12482
+ const symbolConfig = nodeConfigRecord[symbolKey];
12483
+ if (symbolConfig) {
12484
+ ownNodeConfig = symbolConfig;
12485
+ break;
12486
+ }
12455
12487
  }
12456
12488
  }
12457
12489
  }
@@ -13696,9 +13728,10 @@ function $setPointFromCaret(point, caret) {
13696
13728
  const { origin, direction } = caret;
13697
13729
  const isNext = direction === "next";
13698
13730
  if ($isTextPointCaret(caret)) point.set(origin.getKey(), caret.offset, "text");
13699
- else if ($isSiblingCaret(caret)) if ($isTextNode(origin)) point.set(origin.getKey(), $getTextNodeOffset(origin, direction), "text");
13700
- else point.set(origin.getParentOrThrow().getKey(), origin.getIndexWithinParent() + (isNext ? 1 : 0), "element");
13701
- else {
13731
+ else if ($isSiblingCaret(caret)) {
13732
+ if ($isTextNode(origin)) point.set(origin.getKey(), $getTextNodeOffset(origin, direction), "text");
13733
+ else point.set(origin.getParentOrThrow().getKey(), origin.getIndexWithinParent() + (isNext ? 1 : 0), "element");
13734
+ } else {
13702
13735
  if (!($isChildCaret(caret) && $isElementNode(origin))) formatDevErrorMessage(`$setPointFromCaret: exhaustiveness check`);
13703
13736
  point.set(origin.getKey(), isNext ? 0 : origin.getChildrenSize(), "element");
13704
13737
  }
@@ -13889,8 +13922,8 @@ function $getBlockMergeTargets(anchor, focus, seenStart) {
13889
13922
  const focusElements = focusParent.getParents().reverse();
13890
13923
  focusElements.push(focusParent);
13891
13924
  const maxLen = Math.min(anchorElements.length, focusElements.length);
13892
- let commonAncestorCount;
13893
- for (commonAncestorCount = 0; commonAncestorCount < maxLen && anchorElements[commonAncestorCount] === focusElements[commonAncestorCount]; commonAncestorCount++);
13925
+ let commonAncestorCount = 0;
13926
+ for (; commonAncestorCount < maxLen && anchorElements[commonAncestorCount] === focusElements[commonAncestorCount]; commonAncestorCount++);
13894
13927
  const $getBlock = (arr, predicate) => {
13895
13928
  let block;
13896
13929
  for (let i = commonAncestorCount; i < arr.length; i++) {
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  */
9
- const mod = await (process.env.NODE_ENV !== "production" ? import("./Lexical.dev-Cck4n26y.mjs") : import("./Lexical.prod-DCwS1oTq.mjs"));
9
+ const mod = await (process.env.NODE_ENV !== "production" ? import("./Lexical.dev-Df5TNMgP.mjs") : import("./Lexical.prod-DRFSwoE7.mjs"));
10
10
  const $addUpdateTag = mod.$addUpdateTag;
11
11
  const $applyNodeReplacement = mod.$applyNodeReplacement;
12
12
  const $assumeActiveEditor = mod.$assumeActiveEditor;
@@ -50,8 +50,10 @@ const M = 6;
50
50
  const A = a || l || d ? "\xA0" : "​";
51
51
  const D = "\n\n";
52
52
  const F = i ? "\xA0" : A;
53
- const L = /* @__PURE__ */ new RegExp("^[^A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]*[֑-߿יִ-﷽ﹰ-ﻼ]");
54
- const K = /* @__PURE__ */ new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*[A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿]");
53
+ const P = "֑-߿יִ-﷽ﹰ-ﻼ";
54
+ const I = "A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿";
55
+ const L = new RegExp("^[^" + I + "]*[" + P + "]");
56
+ const K = new RegExp("^[^" + P + "]*[" + I + "]");
55
57
  const z = {
56
58
  bold: 1,
57
59
  capitalize: 1024,
@@ -6996,8 +6998,8 @@ function cu(e, n = "removeEmptySlices") {
6996
6998
  const s = r.getParents().reverse();
6997
6999
  s.push(r);
6998
7000
  const l = Math.min(i.length, s.length);
6999
- let c;
7000
- for (c = 0; c < l && i[c] === s[c]; c++);
7001
+ let c = 0;
7002
+ for (; c < l && i[c] === s[c]; c++);
7001
7003
  const a = (t, e) => {
7002
7004
  let n;
7003
7005
  for (let o = c; o < t.length; o++) {
@@ -1,8 +1,8 @@
1
- import { c as configExtension, d as getPeerDependencyFromEditor, r as $getPeerDependency } from "./LexicalExtension.node-5OymZQfy.mjs";
2
- import { $r as isHTMLElement, A as $getChildCaret, Br as getRootOwnerDocument, Ct as $isTextPointCaret, D as $getCaretRange, Er as findAllLexicalElementsDeep, G as $getSelection, Ir as getEditorPropertyFromDOMNode, It as $setSelectionFromCaretRange, J as $getSlotFrame, Jr as isDOMShadowRoot, L as $getEditor, Mr as getDOMSelectionPoints, N as $getCollapsedCaretRange, O as $getCaretRangeInDirection, Ot as $parseSerializedNode, Pr as getDOMShadowRoots, Q as $getTextPointCaret, Rr as getParentElement, St as $isTextNode, Tr as defineExtension, W as $getRoot, X as $getSlotNames, Xt as COMMAND_PRIORITY_CRITICAL, _ as $createTabNode, _i as shallowMergeConfig, a as $caretRangeFromSelection, ai as isSelectionWithinEditor, bi as tokenizeRawText, c as $comparePointCaretNext, ft as $isNodeSelection, i as $caretFromPoint, in as COPY_COMMAND, j as $getChildCaretAtIndex, jr as getDOMSelection, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, mt as $isRangeSelection, ot as $isElementNode, pi as safeCast, q as $getSlot, ri as isLexicalEditor, z as $getNearestNodeFromDOMNode, zt as $splitAtPointCaretNext } from "./Lexical.node-D6wf2D5M.mjs";
3
- import { c as CoreImportExtension, d as ImportSource, f as ImportSourceDataTransfer, h as contextValue, i as $generateNodesFromDOMViaExtension, n as $generateHtmlFromNodes, r as $generateNodesFromDOM } from "./LexicalHtml.node-DpVNt7It.mjs";
4
- import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-DBEwPjBu.mjs";
5
- import { m as objectKlassEquals } from "./LexicalUtils.node-Df9oPTlA.mjs";
1
+ import { c as configExtension, d as getPeerDependencyFromEditor, r as $getPeerDependency } from "./LexicalExtension.node-3nsS5NjU.mjs";
2
+ import { $r as isHTMLElement, A as $getChildCaret, Br as getRootOwnerDocument, Ct as $isTextPointCaret, D as $getCaretRange, Er as findAllLexicalElementsDeep, G as $getSelection, Ir as getEditorPropertyFromDOMNode, It as $setSelectionFromCaretRange, J as $getSlotFrame, Jr as isDOMShadowRoot, L as $getEditor, Mr as getDOMSelectionPoints, N as $getCollapsedCaretRange, O as $getCaretRangeInDirection, Ot as $parseSerializedNode, Pr as getDOMShadowRoots, Q as $getTextPointCaret, Rr as getParentElement, St as $isTextNode, Tr as defineExtension, W as $getRoot, X as $getSlotNames, Xt as COMMAND_PRIORITY_CRITICAL, _ as $createTabNode, _i as shallowMergeConfig, a as $caretRangeFromSelection, ai as isSelectionWithinEditor, bi as tokenizeRawText, c as $comparePointCaretNext, ft as $isNodeSelection, i as $caretFromPoint, in as COPY_COMMAND, j as $getChildCaretAtIndex, jr as getDOMSelection, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, mt as $isRangeSelection, ot as $isElementNode, pi as safeCast, q as $getSlot, ri as isLexicalEditor, z as $getNearestNodeFromDOMNode, zt as $splitAtPointCaretNext } from "./Lexical.node-B064E4Hy.mjs";
3
+ import { c as CoreImportExtension, d as ImportSource, f as ImportSourceDataTransfer, h as contextValue, i as $generateNodesFromDOMViaExtension, n as $generateHtmlFromNodes, r as $generateNodesFromDOM } from "./LexicalHtml.node-DAwuaPeI.mjs";
4
+ import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-BCuHMbzl.mjs";
5
+ import { m as objectKlassEquals } from "./LexicalUtils.node-BPKMFN80.mjs";
6
6
  //#region ../../node_modules/.pnpm/@lexical+clipboard@0.49.0_typescript@6.0.3/node_modules/@lexical/clipboard/dist/LexicalClipboard.dev.mjs
7
7
  /**
8
8
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -240,7 +240,8 @@ const $defaultLexicalEditorImporter = (data, selection, $next) => {
240
240
  const $defaultHtmlImporter = (data, selection, $next) => {
241
241
  try {
242
242
  const editor = $getEditor();
243
- $insertGeneratedNodes(editor, $generateNodesFromDOM(editor, new DOMParser().parseFromString(trustHTML(data), "text/html")), selection);
243
+ const dom = new DOMParser().parseFromString(trustHTML(data), "text/html");
244
+ $insertGeneratedNodes(editor, $generateNodesFromDOM(editor, dom), selection);
244
245
  return true;
245
246
  } catch (error) {
246
247
  console.error(error);
@@ -459,7 +460,8 @@ const ClipboardImportExtension = /* @__PURE__ */ defineExtension({
459
460
  */
460
461
  const ClipboardDOMImportExtension = /* @__PURE__ */ defineExtension({
461
462
  dependencies: [CoreImportExtension, /* @__PURE__ */ configExtension(ClipboardImportExtension, { $importMimeType: { "text/html": [(html, selection, _$next, dataTransfer) => {
462
- const nodes = $generateNodesFromDOMViaExtension(new DOMParser().parseFromString(trustHTML(html), "text/html"), { context: [contextValue(ImportSource, "paste"), contextValue(ImportSourceDataTransfer, dataTransfer)] });
463
+ const dom = new DOMParser().parseFromString(trustHTML(html), "text/html");
464
+ const nodes = $generateNodesFromDOMViaExtension(dom, { context: [contextValue(ImportSource, "paste"), contextValue(ImportSourceDataTransfer, dataTransfer)] });
463
465
  $insertGeneratedNodes($getEditor(), nodes, selection);
464
466
  return true;
465
467
  }] } })],
@@ -657,13 +659,15 @@ function $updateSelectionOnInsert(selection) {
657
659
  const anchor = selection.anchor;
658
660
  let nodeToInspect = null;
659
661
  const anchorCaret = $caretFromPoint(anchor, "previous");
660
- if (anchorCaret) if ($isTextPointCaret(anchorCaret)) nodeToInspect = anchorCaret.origin;
661
- else {
662
- const range = $getCaretRange(anchorCaret, $getChildCaret($getRoot(), "next").getFlipped());
663
- for (const caret of range) if ($isTextNode(caret.origin)) {
664
- nodeToInspect = caret.origin;
665
- break;
666
- } else if ($isElementNode(caret.origin) && !caret.origin.isInline()) break;
662
+ if (anchorCaret) {
663
+ if ($isTextPointCaret(anchorCaret)) nodeToInspect = anchorCaret.origin;
664
+ else {
665
+ const range = $getCaretRange(anchorCaret, $getChildCaret($getRoot(), "next").getFlipped());
666
+ for (const caret of range) if ($isTextNode(caret.origin)) {
667
+ nodeToInspect = caret.origin;
668
+ break;
669
+ } else if ($isElementNode(caret.origin) && !caret.origin.isInline()) break;
670
+ }
667
671
  }
668
672
  if (nodeToInspect && $isTextNode(nodeToInspect)) {
669
673
  const newFormat = nodeToInspect.getFormat();
@@ -6,7 +6,7 @@
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  *
8
8
  */
9
- const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalClipboard.dev-CMkPHV7O.mjs") : import("./LexicalClipboard.prod-B_rN1vE1.mjs"));
9
+ const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalClipboard.dev-ClOWeg5v.mjs") : import("./LexicalClipboard.prod-Ytt65eQo.mjs"));
10
10
  mod.$exportMimeTypeFromSelection;
11
11
  mod.$generateJSONFromSelectedNodes;
12
12
  mod.$generateNodesFromSerializedNodes;
@@ -1,8 +1,8 @@
1
- import { c as configExtension, d as getPeerDependencyFromEditor, r as $getPeerDependency } from "./LexicalExtension.node-5OymZQfy.mjs";
2
- import { $r as isHTMLElement, A as $getChildCaret, Br as getRootOwnerDocument, Ct as $isTextPointCaret, D as $getCaretRange, Er as findAllLexicalElementsDeep, G as $getSelection, Ir as getEditorPropertyFromDOMNode, It as $setSelectionFromCaretRange, J as $getSlotFrame, Jr as isDOMShadowRoot, L as $getEditor, Mr as getDOMSelectionPoints, N as $getCollapsedCaretRange, O as $getCaretRangeInDirection, Ot as $parseSerializedNode, Pr as getDOMShadowRoots, Q as $getTextPointCaret, Rr as getParentElement, St as $isTextNode, Tr as defineExtension, W as $getRoot, X as $getSlotNames, Xt as COMMAND_PRIORITY_CRITICAL, _ as $createTabNode, _i as shallowMergeConfig, a as $caretRangeFromSelection, ai as isSelectionWithinEditor, bi as tokenizeRawText, c as $comparePointCaretNext, ft as $isNodeSelection, i as $caretFromPoint, in as COPY_COMMAND, j as $getChildCaretAtIndex, jr as getDOMSelection, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, mt as $isRangeSelection, ot as $isElementNode, pi as safeCast, q as $getSlot, ri as isLexicalEditor, z as $getNearestNodeFromDOMNode, zt as $splitAtPointCaretNext } from "./Lexical.node-D6wf2D5M.mjs";
3
- import { c as CoreImportExtension, d as ImportSource, f as ImportSourceDataTransfer, h as contextValue, i as $generateNodesFromDOMViaExtension, n as $generateHtmlFromNodes, r as $generateNodesFromDOM } from "./LexicalHtml.node-DpVNt7It.mjs";
4
- import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-DBEwPjBu.mjs";
5
- import { m as objectKlassEquals } from "./LexicalUtils.node-Df9oPTlA.mjs";
1
+ import { c as configExtension, d as getPeerDependencyFromEditor, r as $getPeerDependency } from "./LexicalExtension.node-3nsS5NjU.mjs";
2
+ import { $r as isHTMLElement, A as $getChildCaret, Br as getRootOwnerDocument, Ct as $isTextPointCaret, D as $getCaretRange, Er as findAllLexicalElementsDeep, G as $getSelection, Ir as getEditorPropertyFromDOMNode, It as $setSelectionFromCaretRange, J as $getSlotFrame, Jr as isDOMShadowRoot, L as $getEditor, Mr as getDOMSelectionPoints, N as $getCollapsedCaretRange, O as $getCaretRangeInDirection, Ot as $parseSerializedNode, Pr as getDOMShadowRoots, Q as $getTextPointCaret, Rr as getParentElement, St as $isTextNode, Tr as defineExtension, W as $getRoot, X as $getSlotNames, Xt as COMMAND_PRIORITY_CRITICAL, _ as $createTabNode, _i as shallowMergeConfig, a as $caretRangeFromSelection, ai as isSelectionWithinEditor, bi as tokenizeRawText, c as $comparePointCaretNext, ft as $isNodeSelection, i as $caretFromPoint, in as COPY_COMMAND, j as $getChildCaretAtIndex, jr as getDOMSelection, lr as SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, mt as $isRangeSelection, ot as $isElementNode, pi as safeCast, q as $getSlot, ri as isLexicalEditor, z as $getNearestNodeFromDOMNode, zt as $splitAtPointCaretNext } from "./Lexical.node-B064E4Hy.mjs";
3
+ import { c as CoreImportExtension, d as ImportSource, f as ImportSourceDataTransfer, h as contextValue, i as $generateNodesFromDOMViaExtension, n as $generateHtmlFromNodes, r as $generateNodesFromDOM } from "./LexicalHtml.node-DAwuaPeI.mjs";
4
+ import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-BCuHMbzl.mjs";
5
+ import { m as objectKlassEquals } from "./LexicalUtils.node-BPKMFN80.mjs";
6
6
  //#region ../../node_modules/.pnpm/@lexical+clipboard@0.49.0_typescript@6.0.3/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.mjs
7
7
  /**
8
8
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -33,7 +33,7 @@ function et(r, i, l = null) {
33
33
  if (null !== e && l.contains(e)) {
34
34
  const t = function(t, e, n, o) {
35
35
  const r = o.createRange(), i = (t) => e < t.top ? t.top - e : e > t.bottom ? e - t.bottom : 0, l = (e) => t < e.left ? e.left - t : t > e.right ? t - e.right : 0, c = o.createTreeWalker(n, NodeFilter.SHOW_TEXT);
36
- let s = null, u = Infinity, a = Infinity;
36
+ let s = null, u = 1 / 0, a = 1 / 0;
37
37
  for (let t = c.nextNode(); t; t = c.nextNode()) {
38
38
  r.selectNodeContents(t);
39
39
  for (const e of r.getClientRects()) {
@@ -42,7 +42,7 @@ function et(r, i, l = null) {
42
42
  }
43
43
  }
44
44
  if (null === s) return null;
45
- let f = 0, p = Infinity, d = Infinity;
45
+ let f = 0, p = 1 / 0, d = 1 / 0;
46
46
  for (let e = 0; e <= s.length; e++) {
47
47
  r.setStart(s, e), r.collapse(!0);
48
48
  const n = r.getBoundingClientRect(), o = i(n), l = Math.abs(t - n.left);
@@ -113,8 +113,8 @@ const lt = {
113
113
  }],
114
114
  "text/html": [(t, e, n) => {
115
115
  try {
116
- const n = $getEditor();
117
- return Mt(n, $generateNodesFromDOM(n, new DOMParser().parseFromString(rt(t), "text/html")), e), !0;
116
+ const n = $getEditor(), o = new DOMParser().parseFromString(rt(t), "text/html");
117
+ return Mt(n, $generateNodesFromDOM(n, o), e), !0;
118
118
  } catch (t) {
119
119
  return console.error(t), n();
120
120
  }
@@ -177,7 +177,7 @@ const at = /* @__PURE__ */ defineExtension({
177
177
  });
178
178
  const ft = /* @__PURE__ */ defineExtension({
179
179
  dependencies: [CoreImportExtension, /* @__PURE__ */ configExtension(at, { $importMimeType: { "text/html": [(t, e, n, o) => {
180
- const l = $generateNodesFromDOMViaExtension(new DOMParser().parseFromString(rt(t), "text/html"), { context: [contextValue(ImportSource, "paste"), contextValue(ImportSourceDataTransfer, o)] });
180
+ const r = new DOMParser().parseFromString(rt(t), "text/html"), l = $generateNodesFromDOMViaExtension(r, { context: [contextValue(ImportSource, "paste"), contextValue(ImportSourceDataTransfer, o)] });
181
181
  return Mt($getEditor(), l, e), !0;
182
182
  }] } })],
183
183
  name: "@lexical/clipboard/DOMImport"