@superdoc-dev/cli 0.15.0-next.9 → 0.16.0-next.1

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 (2) hide show
  1. package/dist/index.js +639 -268
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -68110,7 +68110,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68110
68110
  emptyOptions2 = {};
68111
68111
  });
68112
68112
 
68113
- // ../../packages/superdoc/dist/chunks/SuperConverter-C6hKp29w.es.js
68113
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DHtZjY65.es.js
68114
68114
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68115
68115
  const fieldValue = extension$1.config[field];
68116
68116
  if (typeof fieldValue === "function")
@@ -98267,7 +98267,33 @@ function importCommentData({ docx, editor, converter }) {
98267
98267
  function isReplacementPair(previous$1, current) {
98268
98268
  return previous$1.type !== current.type && previous$1.author === current.author && previous$1.date === current.date;
98269
98269
  }
98270
- function assignInternalId(element, idMap, context, insideTrackedChange) {
98270
+ function trackedChangeEntryFromElement(element) {
98271
+ return {
98272
+ type: element.name,
98273
+ author: element.attributes?.["w:author"] ?? "",
98274
+ date: element.attributes?.["w:date"] ?? ""
98275
+ };
98276
+ }
98277
+ function findNextSiblingTrackedChange(elements, startIndex) {
98278
+ if (!Array.isArray(elements))
98279
+ return null;
98280
+ for (let i$1 = startIndex;i$1 < elements.length; i$1 += 1) {
98281
+ const element = elements[i$1];
98282
+ if (TRACKED_CHANGE_NAMES.has(element?.name))
98283
+ return trackedChangeEntryFromElement(element);
98284
+ if (!PAIRING_TRANSPARENT_NAMES.has(element?.name))
98285
+ return null;
98286
+ }
98287
+ return null;
98288
+ }
98289
+ function isChildReplacementInsideDeletion(beforePrevious, previous$1, current, next) {
98290
+ if (!isReplacementPair(previous$1, current))
98291
+ return false;
98292
+ const touchesDifferentAuthorDeletionBefore = beforePrevious?.type === "w:del" && beforePrevious.author !== previous$1.author;
98293
+ const touchesDifferentAuthorDeletionAfter = next?.type === "w:del" && next.author !== previous$1.author;
98294
+ return touchesDifferentAuthorDeletionBefore || touchesDifferentAuthorDeletionAfter;
98295
+ }
98296
+ function assignInternalId(element, idMap, context, insideTrackedChange, nextTrackedChange = null) {
98271
98297
  const wordId = String(element.attributes?.["w:id"] ?? "");
98272
98298
  if (!wordId)
98273
98299
  return;
@@ -98276,18 +98302,18 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
98276
98302
  idMap.set(wordId, v4_default());
98277
98303
  return;
98278
98304
  }
98279
- const current = {
98280
- type: element.name,
98281
- author: element.attributes?.["w:author"] ?? "",
98282
- date: element.attributes?.["w:date"] ?? ""
98283
- };
98284
- if (context.replacements === "paired" && context.lastTrackedChange && isReplacementPair(context.lastTrackedChange, current)) {
98305
+ const current = trackedChangeEntryFromElement(element);
98306
+ const shouldPair = context.replacements === "paired";
98307
+ const shouldKeepChildSides = context.lastTrackedChange && isChildReplacementInsideDeletion(context.beforeLastTrackedChange, context.lastTrackedChange, current, nextTrackedChange);
98308
+ if (shouldPair && context.lastTrackedChange && !shouldKeepChildSides && isReplacementPair(context.lastTrackedChange, current)) {
98285
98309
  if (!idMap.has(wordId))
98286
98310
  idMap.set(wordId, context.lastTrackedChange.internalId);
98287
98311
  context.lastTrackedChange = null;
98312
+ context.beforeLastTrackedChange = null;
98288
98313
  } else {
98289
98314
  const internalId = idMap.get(wordId) ?? v4_default();
98290
98315
  idMap.set(wordId, internalId);
98316
+ context.beforeLastTrackedChange = context.lastTrackedChange;
98291
98317
  context.lastTrackedChange = {
98292
98318
  ...current,
98293
98319
  internalId
@@ -98297,20 +98323,25 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
98297
98323
  function walkElements(elements, idMap, context, insideTrackedChange = false) {
98298
98324
  if (!Array.isArray(elements))
98299
98325
  return;
98300
- for (const element of elements)
98326
+ for (let index2 = 0;index2 < elements.length; index2 += 1) {
98327
+ const element = elements[index2];
98301
98328
  if (TRACKED_CHANGE_NAMES.has(element.name)) {
98302
- assignInternalId(element, idMap, context, insideTrackedChange);
98329
+ assignInternalId(element, idMap, context, insideTrackedChange, findNextSiblingTrackedChange(elements, index2 + 1));
98303
98330
  if (element.elements)
98304
98331
  walkElements(element.elements, idMap, {
98332
+ beforeLastTrackedChange: null,
98305
98333
  lastTrackedChange: null,
98306
98334
  replacements: context.replacements
98307
98335
  }, true);
98308
98336
  } else {
98309
- if (!PAIRING_TRANSPARENT_NAMES.has(element.name))
98337
+ if (!PAIRING_TRANSPARENT_NAMES.has(element.name)) {
98310
98338
  context.lastTrackedChange = null;
98339
+ context.beforeLastTrackedChange = null;
98340
+ }
98311
98341
  if (element.elements)
98312
98342
  walkElements(element.elements, idMap, context, insideTrackedChange);
98313
98343
  }
98344
+ }
98314
98345
  }
98315
98346
  function buildTrackedChangeIdMapForPart(part, options = {}) {
98316
98347
  const root2 = part?.elements?.[0];
@@ -98319,6 +98350,7 @@ function buildTrackedChangeIdMapForPart(part, options = {}) {
98319
98350
  const replacements = options.replacements === "independent" ? "independent" : "paired";
98320
98351
  const idMap = /* @__PURE__ */ new Map;
98321
98352
  walkElements(root2.elements, idMap, {
98353
+ beforeLastTrackedChange: null,
98322
98354
  lastTrackedChange: null,
98323
98355
  replacements
98324
98356
  });
@@ -101851,12 +101883,21 @@ function getInlineIndex(editor) {
101851
101883
  function clearIndexCache(editor) {
101852
101884
  cacheByEditor.delete(editor);
101853
101885
  }
101886
+ function isVisibleTextModel(options) {
101887
+ return options?.textModel === "visible";
101888
+ }
101889
+ function hasTrackDeleteMark(node3) {
101890
+ return node3.marks?.some((mark) => mark.type.name === "trackDelete") ?? false;
101891
+ }
101892
+ function shouldSkipTextNode(node3, options) {
101893
+ return isVisibleTextModel(options) && hasTrackDeleteMark(node3);
101894
+ }
101854
101895
  function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
101855
101896
  if (segmentLength <= 1)
101856
101897
  return targetOffset <= segmentStart ? docFrom : docTo;
101857
101898
  return docFrom + (targetOffset - segmentStart);
101858
101899
  }
101859
- function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
101900
+ function pmPositionToTextOffset(blockNode, blockPos, pmPos, options) {
101860
101901
  const contentStart = blockPos + 1;
101861
101902
  if (pmPos <= contentStart)
101862
101903
  return 0;
@@ -101867,7 +101908,13 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
101867
101908
  return;
101868
101909
  if (node3.isText) {
101869
101910
  const text$2 = node3.text ?? "";
101870
- if (pmPos >= docPos + text$2.length)
101911
+ const endPos = docPos + text$2.length;
101912
+ if (shouldSkipTextNode(node3, options)) {
101913
+ if (pmPos < endPos)
101914
+ done = true;
101915
+ return;
101916
+ }
101917
+ if (pmPos >= endPos)
101871
101918
  offset += text$2.length;
101872
101919
  else {
101873
101920
  offset += Math.max(0, pmPos - docPos);
@@ -101907,10 +101954,12 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
101907
101954
  visitContent(blockNode, contentStart);
101908
101955
  return offset;
101909
101956
  }
101910
- function computeTextContentLength(blockNode) {
101957
+ function computeTextContentLength(blockNode, options) {
101911
101958
  let length3 = 0;
101912
101959
  const walk = (node3) => {
101913
101960
  if (node3.isText) {
101961
+ if (shouldSkipTextNode(node3, options))
101962
+ return;
101914
101963
  length3 += (node3.text ?? "").length;
101915
101964
  return;
101916
101965
  }
@@ -101937,7 +101986,7 @@ function computeTextContentLength(blockNode) {
101937
101986
  }
101938
101987
  return length3;
101939
101988
  }
101940
- function resolveTextRangeInBlock(blockNode, blockPos, range) {
101989
+ function resolveTextRangeInBlock(blockNode, blockPos, range, options) {
101941
101990
  if (range.start < 0 || range.end < range.start)
101942
101991
  return null;
101943
101992
  let offset = 0;
@@ -101969,7 +102018,7 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
101969
102018
  const walkNode$1 = (node3, docPos) => {
101970
102019
  if (node3.isText) {
101971
102020
  const text$2 = node3.text ?? "";
101972
- if (text$2.length > 0)
102021
+ if (text$2.length > 0 && !shouldSkipTextNode(node3, options))
101973
102022
  advanceSegment(text$2.length, docPos, docPos + text$2.length);
101974
102023
  return;
101975
102024
  }
@@ -101996,6 +102045,39 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
101996
102045
  to: toPos
101997
102046
  };
101998
102047
  }
102048
+ function textContentInBlock(blockNode, options) {
102049
+ let text$2 = "";
102050
+ const walkNode$1 = (node3) => {
102051
+ if (node3.isText) {
102052
+ if (!shouldSkipTextNode(node3, options))
102053
+ text$2 += node3.text ?? "";
102054
+ return;
102055
+ }
102056
+ if (node3.isLeaf) {
102057
+ text$2 += "";
102058
+ return;
102059
+ }
102060
+ let isFirstChild$1 = true;
102061
+ for (let i$1 = 0;i$1 < node3.childCount; i$1++) {
102062
+ const child = node3.child(i$1);
102063
+ if (child.isBlock && !isFirstChild$1)
102064
+ text$2 += `
102065
+ `;
102066
+ walkNode$1(child);
102067
+ isFirstChild$1 = false;
102068
+ }
102069
+ };
102070
+ let isFirstChild = true;
102071
+ for (let i$1 = 0;i$1 < blockNode.childCount; i$1++) {
102072
+ const child = blockNode.child(i$1);
102073
+ if (child.isBlock && !isFirstChild)
102074
+ text$2 += `
102075
+ `;
102076
+ walkNode$1(child);
102077
+ isFirstChild = false;
102078
+ }
102079
+ return text$2;
102080
+ }
101999
102081
  function buildTextWithTabs(schema, text$2, marks, opts = {}) {
102000
102082
  if (!text$2.includes("\t"))
102001
102083
  return schema.text(text$2, marks);
@@ -102019,7 +102101,7 @@ function parentAllowsNodeAt(tr, absPos, nodeType) {
102019
102101
  return true;
102020
102102
  return contentMatch.matchType(nodeType) != null;
102021
102103
  }
102022
- function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback) {
102104
+ function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback, options = {}) {
102023
102105
  const anyDoc = doc$2;
102024
102106
  if (typeof anyDoc.nodesBetween !== "function") {
102025
102107
  if (typeof anyDoc.textBetween === "function")
@@ -102040,6 +102122,8 @@ function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback) {
102040
102122
  return false;
102041
102123
  }
102042
102124
  if (node3.isText) {
102125
+ if (options.textModel === "visible" && node3.marks?.some((mark) => mark.type.name === "trackDelete"))
102126
+ return false;
102043
102127
  const start = Math.max(from5, pos) - pos;
102044
102128
  const end = Math.min(to, pos + node3.nodeSize) - pos;
102045
102129
  const text$2 = typeof node3.text === "string" ? node3.text : "".repeat(node3.nodeSize);
@@ -102108,7 +102192,7 @@ function resolveTextTarget(editor, target) {
102108
102192
  const block = matches$1[0];
102109
102193
  if (!block)
102110
102194
  return null;
102111
- return resolveTextRangeInBlock(block.node, block.pos, target.range);
102195
+ return resolveTextRangeInBlock(block.node, block.pos, target.range, { textModel: "visible" });
102112
102196
  }
102113
102197
  function resolveInlineInsertPosition(editor, at, operationName) {
102114
102198
  const firstSegment = at.segments[0];
@@ -102147,11 +102231,11 @@ function resolveDefaultInsertTarget(editor) {
102147
102231
  for (let i$1 = index2.candidates.length - 1;i$1 >= 0; i$1--) {
102148
102232
  const candidate = index2.candidates[i$1];
102149
102233
  if (topLevelPositions.has(candidate.pos) && isTextBlockCandidate(candidate)) {
102150
- const textLength = computeTextContentLength(candidate.node);
102234
+ const textLength = computeTextContentLength(candidate.node, { textModel: "visible" });
102151
102235
  const range = resolveTextRangeInBlock(candidate.node, candidate.pos, {
102152
102236
  start: textLength,
102153
102237
  end: textLength
102154
- });
102238
+ }, { textModel: "visible" });
102155
102239
  if (!range)
102156
102240
  continue;
102157
102241
  return {
@@ -105112,7 +105196,7 @@ function getTextAdapter(editor, input) {
105112
105196
  const doc$2 = resolveStoryRuntime(editor, input.in).editor.state.doc;
105113
105197
  return textBetweenWithTabs(doc$2, 0, doc$2.content.size, `
105114
105198
  `, `
105115
- `);
105199
+ `, { textModel: "visible" });
105116
105200
  }
105117
105201
  function getRawTrackedMarks(editor) {
105118
105202
  try {
@@ -123831,7 +123915,7 @@ var isRegExp = (value) => {
123831
123915
  if (id2)
123832
123916
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id2);
123833
123917
  return trackedChanges;
123834
- }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.37.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
123918
+ }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES2, VALID_APPEARANCES, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, BIBLIOGRAPHY_NAMESPACE_URI = "http://schemas.openxmlformats.org/officeDocument/2006/bibliography", CUSTOM_XML_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", DEFAULT_SELECTED_STYLE = "/APA.XSL", DEFAULT_STYLE_NAME = "APA", DEFAULT_VERSION = "6", API_TO_OOXML_SOURCE_TYPE, OOXML_TO_API_SOURCE_TYPE, SIMPLE_FIELD_TO_XML_TAG, XML_TAG_TO_SIMPLE_FIELD, import_lib2, FONT_FAMILY_FALLBACKS, DEFAULT_GENERIC_FALLBACK = "sans-serif", DEFAULT_FONT_SIZE_PT = 10, CURRENT_APP_VERSION = "1.38.0", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
123835
123919
  if (!runProps?.elements?.length || !state)
123836
123920
  return;
123837
123921
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -123865,7 +123949,7 @@ var isRegExp = (value) => {
123865
123949
  state.kern = kernNode.attributes["w:val"];
123866
123950
  }
123867
123951
  }, SuperConverter;
123868
- var init_SuperConverter_C6hKp29w_es = __esm(() => {
123952
+ var init_SuperConverter_DHtZjY65_es = __esm(() => {
123869
123953
  init_rolldown_runtime_Bg48TavK_es();
123870
123954
  init_jszip_C49i9kUs_es();
123871
123955
  init_xml_js_CqGKpaft_es();
@@ -162181,7 +162265,7 @@ var init_SuperConverter_C6hKp29w_es = __esm(() => {
162181
162265
  };
162182
162266
  });
162183
162267
 
162184
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ISx0N5AS.es.js
162268
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-lxRAue2X.es.js
162185
162269
  function parseSizeUnit(val = "0") {
162186
162270
  const length3 = val.toString() || "0";
162187
162271
  const value = Number.parseFloat(length3);
@@ -163316,7 +163400,7 @@ function applyDirectiveToMarks(marks, markKey2, directive, markType) {
163316
163400
  return otherMarks;
163317
163401
  }
163318
163402
  }
163319
- function captureRunsInRange(editor, blockPos, from5, to) {
163403
+ function captureRunsInRange(editor, blockPos, from5, to, options) {
163320
163404
  const blockNode = editor.state.doc.nodeAt(blockPos);
163321
163405
  if (!blockNode || from5 < 0 || to < from5 || from5 === to)
163322
163406
  return {
@@ -163341,9 +163425,12 @@ function captureRunsInRange(editor, blockPos, from5, to) {
163341
163425
  if (node3.isText) {
163342
163426
  const text4 = node3.text ?? "";
163343
163427
  if (text4.length > 0) {
163428
+ const marks = Array.isArray(node3.marks) ? node3.marks : [];
163429
+ if (options?.textModel === "visible" && marks.some((mark) => mark.type.name === "trackDelete"))
163430
+ return;
163344
163431
  const start = offset;
163345
163432
  const end = offset + text4.length;
163346
- maybePushRun(start, end, Array.isArray(node3.marks) ? node3.marks : []);
163433
+ maybePushRun(start, end, marks);
163347
163434
  offset = end;
163348
163435
  }
163349
163436
  return;
@@ -163624,6 +163711,12 @@ function applySetMarksToResolved(editor, existingMarks, setMarks) {
163624
163711
  }
163625
163712
  return marks;
163626
163713
  }
163714
+ function getCandidateText(editor, candidate, options) {
163715
+ if (candidate.node.childCount > 0)
163716
+ return textContentInBlock(candidate.node, options);
163717
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
163718
+ `, "");
163719
+ }
163627
163720
  function resolveUnknownBlockId(attrs) {
163628
163721
  if (!attrs)
163629
163722
  return;
@@ -163637,7 +163730,38 @@ function getAddressStartPos(editor, index2, address2) {
163637
163730
  return findBlockById(index2, address2)?.pos ?? Number.MAX_SAFE_INTEGER;
163638
163731
  return findInlineByAnchor(getInlineIndex(editor), address2)?.pos ?? Number.MAX_SAFE_INTEGER;
163639
163732
  }
163640
- function buildTextContext(editor, address2, matchFrom, matchTo, textRanges) {
163733
+ function buildTextContext(editor, address2, matchFrom, matchTo, textRanges, options) {
163734
+ if (textRanges?.length) {
163735
+ const index2 = getBlockIndex(editor);
163736
+ const firstRange = textRanges[0];
163737
+ const lastRange = textRanges[textRanges.length - 1];
163738
+ const firstBlock = index2.candidates.find((candidate) => candidate.nodeId === firstRange.blockId);
163739
+ const lastBlock = index2.candidates.find((candidate) => candidate.nodeId === lastRange.blockId);
163740
+ if (firstBlock && lastBlock) {
163741
+ const matchText = textRanges.map((range) => {
163742
+ const block = index2.candidates.find((candidate) => candidate.nodeId === range.blockId);
163743
+ if (!block)
163744
+ return "";
163745
+ return getCandidateText(editor, block, options).slice(range.range.start, range.range.end);
163746
+ }).join(`
163747
+ `);
163748
+ const firstText = getCandidateText(editor, firstBlock, options);
163749
+ const lastText = getCandidateText(editor, lastBlock, options);
163750
+ const leftContext = firstText.slice(Math.max(0, firstRange.range.start - SNIPPET_PADDING), firstRange.range.start);
163751
+ const snippet$1 = `${leftContext}${matchText}${lastText.slice(lastRange.range.end, lastRange.range.end + SNIPPET_PADDING)}`.replace(/ {2,}/g, " ");
163752
+ const prefix$1 = leftContext.replace(/ {2,}/g, " ");
163753
+ const normalizedMatch = matchText.replace(/ {2,}/g, " ");
163754
+ return {
163755
+ address: address2,
163756
+ snippet: snippet$1,
163757
+ highlightRange: {
163758
+ start: prefix$1.length,
163759
+ end: prefix$1.length + normalizedMatch.length
163760
+ },
163761
+ textRanges
163762
+ };
163763
+ }
163764
+ }
163641
163765
  const docSize = editor.state.doc.content.size;
163642
163766
  const snippetFrom = Math.max(0, matchFrom - SNIPPET_PADDING);
163643
163767
  const snippetTo = Math.min(docSize, matchTo + SNIPPET_PADDING);
@@ -163656,14 +163780,14 @@ function buildTextContext(editor, address2, matchFrom, matchTo, textRanges) {
163656
163780
  textRanges: textRanges?.length ? textRanges : undefined
163657
163781
  };
163658
163782
  }
163659
- function toTextAddress$1(editor, block, range) {
163783
+ function toTextAddress$1(editor, block, range, options) {
163660
163784
  const blockStart = block.pos + 1;
163661
163785
  const blockEnd = block.end - 1;
163662
163786
  if (range.from < blockStart || range.to > blockEnd)
163663
163787
  return;
163664
- const start = editor.state.doc.textBetween(blockStart, range.from, `
163788
+ const start = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.from, options) : editor.state.doc.textBetween(blockStart, range.from, `
163665
163789
  `, "").length;
163666
- const end = editor.state.doc.textBetween(blockStart, range.to, `
163790
+ const end = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.to, options) : editor.state.doc.textBetween(blockStart, range.to, `
163667
163791
  `, "").length;
163668
163792
  return {
163669
163793
  kind: "text",
@@ -163742,7 +163866,7 @@ function buildSearchPattern(selector, diagnostics) {
163742
163866
  const flags = selector.caseSensitive ? "g" : "gi";
163743
163867
  return new RegExp(flexible, flags);
163744
163868
  }
163745
- function executeTextSelector(editor, index2, query2, diagnostics) {
163869
+ function executeTextSelector(editor, index2, query2, diagnostics, options = {}) {
163746
163870
  if (query2.select.type !== "text") {
163747
163871
  addDiagnostic(diagnostics, `Text strategy received a non-text selector (type="${query2.select.type}").`);
163748
163872
  return {
@@ -163770,16 +163894,20 @@ function executeTextSelector(editor, index2, query2, diagnostics) {
163770
163894
  matches: [],
163771
163895
  total: 0
163772
163896
  };
163773
- const rawResult = requireEditorCommand(editor.commands?.search, "find (search)")(pattern, {
163897
+ const search2 = requireEditorCommand(editor.commands?.search, "find (search)");
163898
+ const searchModel = options.searchModel ?? "visible";
163899
+ const textOffsetOptions = { textModel: searchModel };
163900
+ pattern.lastIndex = 0;
163901
+ const rawResult = search2(pattern, {
163774
163902
  highlight: false,
163775
163903
  caseSensitive: selector.caseSensitive ?? false,
163776
163904
  maxMatches: Infinity,
163777
- searchModel: "visible"
163905
+ searchModel
163778
163906
  });
163779
163907
  if (!Array.isArray(rawResult))
163780
163908
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
163781
- const allMatches = rawResult;
163782
163909
  const scopeRange = scope.range;
163910
+ const allMatches = rawResult;
163783
163911
  const matches2 = scopeRange ? allMatches.filter((m) => m.from >= scopeRange.start && m.to <= scopeRange.end) : allMatches;
163784
163912
  const textBlocks = index2.candidates.filter(isTextBlockCandidate);
163785
163913
  const contexts = [];
@@ -163796,7 +163924,7 @@ function executeTextSelector(editor, index2, query2, diagnostics) {
163796
163924
  return;
163797
163925
  if (!source)
163798
163926
  source = block;
163799
- return toTextAddress$1(editor, block, range);
163927
+ return toTextAddress$1(editor, block, range, textOffsetOptions);
163800
163928
  }).filter((range) => Boolean(range));
163801
163929
  if (!source)
163802
163930
  source = findCandidateByPos(textBlocks, match.from) ?? findBlockByPos(index2, match.from);
@@ -163804,7 +163932,7 @@ function executeTextSelector(editor, index2, query2, diagnostics) {
163804
163932
  continue;
163805
163933
  const address2 = toBlockAddress(source);
163806
163934
  addresses.push(address2);
163807
- contexts.push(buildTextContext(editor, address2, match.from, match.to, textRanges));
163935
+ contexts.push(buildTextContext(editor, address2, match.from, match.to, textRanges, textOffsetOptions));
163808
163936
  }
163809
163937
  const paged = paginate(addresses, query2.offset, query2.limit);
163810
163938
  const pagedContexts = paginate(contexts, query2.offset, query2.limit).items;
@@ -163855,7 +163983,7 @@ function resolveTextPoint(editor, index2, point3) {
163855
163983
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
163856
163984
  start: point3.offset,
163857
163985
  end: point3.offset
163858
- });
163986
+ }, { textModel: "visible" });
163859
163987
  if (!resolved)
163860
163988
  throw new DocumentApiAdapterError("INVALID_TARGET", `Offset ${point3.offset} is out of range in block "${point3.blockId}".`, {
163861
163989
  field: "offset",
@@ -164062,11 +164190,11 @@ function validateInsertionContext(editor, index2, step3, stepIndex, anchorBlockI
164062
164190
  });
164063
164191
  }
164064
164192
  }
164065
- function resolveAbsoluteRange(editor, candidate, from5, to, stepId) {
164193
+ function resolveAbsoluteRange(editor, candidate, from5, to, stepId, options) {
164066
164194
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
164067
164195
  start: from5,
164068
164196
  end: to
164069
- });
164197
+ }, options);
164070
164198
  if (!resolved)
164071
164199
  throw planError("INVALID_INPUT", `text offset [${from5}, ${to}) out of range in block`, stepId);
164072
164200
  return {
@@ -164150,8 +164278,9 @@ function coalesceBlockRanges(stepId, blockId, ranges) {
164150
164278
  };
164151
164279
  }
164152
164280
  function buildRangeTarget(editor, step3, addr, candidate) {
164153
- const abs2 = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step3.id);
164154
- const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to) : undefined;
164281
+ const textOffsetOptions = { textModel: addr.textModel };
164282
+ const abs2 = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step3.id, textOffsetOptions);
164283
+ const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to, textOffsetOptions) : undefined;
164155
164284
  return {
164156
164285
  kind: "range",
164157
164286
  stepId: step3.id,
@@ -164166,7 +164295,7 @@ function buildRangeTarget(editor, step3, addr, candidate) {
164166
164295
  capturedStyle
164167
164296
  };
164168
164297
  }
164169
- function buildSpanTarget(editor, index2, step3, segments, matchId) {
164298
+ function buildSpanTarget(editor, index2, step3, segments, matchId, textModel = "visible") {
164170
164299
  validateSegmentOrder(editor, index2, segments, step3.id);
164171
164300
  const compiledSegments = [];
164172
164301
  const capturedStyles = [];
@@ -164175,7 +164304,8 @@ function buildSpanTarget(editor, index2, step3, segments, matchId) {
164175
164304
  const candidate = index2.candidates.find((c) => c.nodeId === seg.blockId);
164176
164305
  if (!candidate)
164177
164306
  throw planError("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step3.id);
164178
- const abs2 = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step3.id);
164307
+ const textOffsetOptions = { textModel };
164308
+ const abs2 = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step3.id, textOffsetOptions);
164179
164309
  compiledSegments.push({
164180
164310
  blockId: seg.blockId,
164181
164311
  from: seg.from,
@@ -164183,10 +164313,10 @@ function buildSpanTarget(editor, index2, step3, segments, matchId) {
164183
164313
  absFrom: abs2.absFrom,
164184
164314
  absTo: abs2.absTo
164185
164315
  });
164186
- const blockText = getBlockText(editor, candidate);
164316
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
164187
164317
  textParts.push(blockText.slice(seg.from, seg.to));
164188
164318
  if (step3.op === "text.rewrite" || step3.op === "format.apply")
164189
- capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to));
164319
+ capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to, textOffsetOptions));
164190
164320
  }
164191
164321
  return {
164192
164322
  kind: "span",
@@ -164224,12 +164354,14 @@ function validateSegmentOrder(_editor, index2, segments, stepId) {
164224
164354
  }
164225
164355
  }
164226
164356
  function resolveTextSelector(editor, index2, selector, within, stepId, options) {
164357
+ const textModel = options?.textModel ?? "visible";
164358
+ const textOffsetOptions = { textModel };
164227
164359
  if (selector.type === "text") {
164228
164360
  const result$1 = executeTextSelector(editor, index2, {
164229
164361
  select: selector,
164230
164362
  within,
164231
164363
  includeNodes: false
164232
- }, []);
164364
+ }, [], { searchModel: textModel });
164233
164365
  const addresses$1 = [];
164234
164366
  if (result$1.context)
164235
164367
  for (const ctx of result$1.context) {
@@ -164239,15 +164371,16 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
164239
164371
  const candidate = index2.candidates.find((c) => c.nodeId === coalesced.blockId);
164240
164372
  if (!candidate)
164241
164373
  continue;
164242
- const matchText = getBlockText(editor, candidate).slice(coalesced.from, coalesced.to);
164243
- const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to);
164374
+ const matchText = getBlockText(editor, candidate, textOffsetOptions).slice(coalesced.from, coalesced.to);
164375
+ const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to, textOffsetOptions);
164244
164376
  addresses$1.push({
164245
164377
  blockId: coalesced.blockId,
164246
164378
  from: coalesced.from,
164247
164379
  to: coalesced.to,
164248
164380
  text: matchText,
164249
164381
  marks: captured.runs.length > 0 ? captured.runs[0].marks : [],
164250
- blockPos: candidate.pos
164382
+ blockPos: candidate.pos,
164383
+ textModel
164251
164384
  });
164252
164385
  }
164253
164386
  return { addresses: addresses$1 };
@@ -164266,14 +164399,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
164266
164399
  if (!candidate)
164267
164400
  continue;
164268
164401
  if (isTextBlockCandidate(candidate)) {
164269
- const blockText = getBlockText(editor, candidate);
164402
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
164270
164403
  addresses.push({
164271
164404
  blockId: match.nodeId,
164272
164405
  from: 0,
164273
164406
  to: blockText.length,
164274
164407
  text: blockText,
164275
164408
  marks: [],
164276
- blockPos: candidate.pos
164409
+ blockPos: candidate.pos,
164410
+ textModel
164277
164411
  });
164278
164412
  } else
164279
164413
  addresses.push({
@@ -164282,12 +164416,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
164282
164416
  to: 0,
164283
164417
  text: "",
164284
164418
  marks: [],
164285
- blockPos: candidate.pos
164419
+ blockPos: candidate.pos,
164420
+ textModel
164286
164421
  });
164287
164422
  }
164288
164423
  return { addresses };
164289
164424
  }
164290
- function getBlockText(editor, candidate) {
164425
+ function getBlockText(editor, candidate, options = { textModel: "visible" }) {
164426
+ if (candidate.node && candidate.node.childCount > 0)
164427
+ return textContentInBlock(candidate.node, options);
164291
164428
  const blockStart = candidate.pos + 1;
164292
164429
  const blockEnd = candidate.end - 1;
164293
164430
  return editor.state.doc.textBetween(blockStart, blockEnd, `
@@ -164323,12 +164460,13 @@ function resolveV3TextRef(editor, index2, step3, refData) {
164323
164460
  to: seg.to,
164324
164461
  text: matchText,
164325
164462
  marks: [],
164326
- blockPos: candidate.pos
164463
+ blockPos: candidate.pos,
164464
+ textModel: "visible"
164327
164465
  }, candidate);
164328
164466
  target.matchId = refData.matchId;
164329
164467
  return [target];
164330
164468
  }
164331
- return [buildSpanTarget(editor, index2, step3, segments, refData.matchId)];
164469
+ return [buildSpanTarget(editor, index2, step3, segments, refData.matchId, "visible")];
164332
164470
  }
164333
164471
  function resolveV4TextRef(editor, index2, step3, refData) {
164334
164472
  if (refData.scope === "node" && refData.node?.nodeId)
@@ -164361,13 +164499,14 @@ function resolveV4TextRef(editor, index2, step3, refData) {
164361
164499
  to: seg.to,
164362
164500
  text: matchText,
164363
164501
  marks: [],
164364
- blockPos: candidate.pos
164502
+ blockPos: candidate.pos,
164503
+ textModel: "visible"
164365
164504
  }, candidate);
164366
164505
  if (refData.matchId)
164367
164506
  target.matchId = refData.matchId;
164368
164507
  return [target];
164369
164508
  }
164370
- return [buildSpanTarget(editor, index2, step3, segments, refData.matchId ?? `v4:${step3.id}`)];
164509
+ return [buildSpanTarget(editor, index2, step3, segments, refData.matchId ?? `v4:${step3.id}`, "visible")];
164371
164510
  }
164372
164511
  function resolveTextRef(editor, index2, step3, ref3) {
164373
164512
  const decoded = decodeRef(ref3);
@@ -164394,7 +164533,8 @@ function resolveBlockRef(editor, index2, step3, ref3) {
164394
164533
  to: blockText.length,
164395
164534
  text: blockText,
164396
164535
  marks: [],
164397
- blockPos: candidate.pos
164536
+ blockPos: candidate.pos,
164537
+ textModel: "visible"
164398
164538
  }, candidate)];
164399
164539
  }
164400
164540
  function dispatchRefHandler(editor, index2, step3, ref3) {
@@ -164441,7 +164581,8 @@ function buildWholeBlockRangeTarget(editor, step3, candidate) {
164441
164581
  to: blockText.length,
164442
164582
  text: blockText,
164443
164583
  marks: [],
164444
- blockPos: candidate.pos
164584
+ blockPos: candidate.pos,
164585
+ textModel: "visible"
164445
164586
  }, candidate);
164446
164587
  }
164447
164588
  return {
@@ -164524,7 +164665,7 @@ function captureStyleAtAbsoluteRange(editor, absFrom, absTo) {
164524
164665
  isUniform: checkUniformity(allRuns)
164525
164666
  };
164526
164667
  }
164527
- function resolveStepTargets(editor, index2, step3) {
164668
+ function resolveStepTargets(editor, index2, step3, options = {}) {
164528
164669
  const where = step3.where;
164529
164670
  const refWhere = isRefWhere(where) ? where : undefined;
164530
164671
  const selectWhere = isSelectWhere(where) ? where : undefined;
@@ -164539,7 +164680,10 @@ function resolveStepTargets(editor, index2, step3) {
164539
164680
  targets = resolveRefTargets(editor, index2, step3, refWhere);
164540
164681
  else if (selectWhere) {
164541
164682
  const isStructuralOp = step3.op === "structural.insert" || step3.op === "structural.replace";
164542
- targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step3.id, { allBlockTypes: isStructuralOp }).addresses.map((addr) => {
164683
+ targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step3.id, {
164684
+ allBlockTypes: isStructuralOp,
164685
+ textModel: options.selectTextModel ?? "visible"
164686
+ }).addresses.map((addr) => {
164543
164687
  const candidate = index2.candidates.find((c) => c.nodeId === addr.blockId);
164544
164688
  if (!candidate)
164545
164689
  throw planError("TARGET_NOT_FOUND", `block "${addr.blockId}" not in index`, step3.id);
@@ -164804,7 +164948,7 @@ function assertSingleStoryKey(steps) {
164804
164948
  });
164805
164949
  }
164806
164950
  }
164807
- function compilePlan(editor, steps) {
164951
+ function compilePlan(editor, steps, options = {}) {
164808
164952
  if (steps.length > 200)
164809
164953
  throw planError("INVALID_INPUT", `plan contains ${steps.length} steps, maximum is 200`);
164810
164954
  const compiledRevision = getRevision(editor);
@@ -164835,7 +164979,7 @@ function compilePlan(editor, steps) {
164835
164979
  throw planError("INVALID_INPUT", `unknown step op "${step3.op}"`, step3.id);
164836
164980
  if (isCreateOp(step3.op))
164837
164981
  validateCreateStepPosition(step3);
164838
- const targets = resolveStepTargets(editor, index2, step3);
164982
+ const targets = resolveStepTargets(editor, index2, step3, options);
164839
164983
  if (isCreateOp(step3.op) && targets.length > 0) {
164840
164984
  const position2 = step3.args.position ?? "after";
164841
164985
  const anchorBlockId = resolveCreateAnchorFromTargets(targets, position2, step3.id);
@@ -166968,7 +167112,7 @@ function executeCompiledPlan(editor, compiled, options = {}) {
166968
167112
  function executePlan(editor, input) {
166969
167113
  if (!input.steps?.length)
166970
167114
  throw planError("INVALID_INPUT", "plan must contain at least one step");
166971
- return executeCompiledPlan(editor, compilePlan(editor, input.steps), {
167115
+ return executeCompiledPlan(editor, compilePlan(editor, input.steps, { selectTextModel: input.changeMode === "tracked" ? "raw" : "visible" }), {
166972
167116
  changeMode: input.changeMode ?? "direct",
166973
167117
  expectedRevision: input.expectedRevision
166974
167118
  });
@@ -172530,8 +172674,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
172530
172674
  }
172531
172675
  };
172532
172676
  };
172533
- var init_create_headless_toolbar_ISx0N5AS_es = __esm(() => {
172534
- init_SuperConverter_C6hKp29w_es();
172677
+ var init_create_headless_toolbar_lxRAue2X_es = __esm(() => {
172678
+ init_SuperConverter_DHtZjY65_es();
172535
172679
  init_uuid_qzgm05fK_es();
172536
172680
  init_constants_D_X7xF4s_es();
172537
172681
  init_dist_B8HfvhaK_es();
@@ -221759,7 +221903,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
221759
221903
  init_remark_gfm_BhnWr3yf_es();
221760
221904
  });
221761
221905
 
221762
- // ../../packages/superdoc/dist/chunks/src-DQ_lu_9z.es.js
221906
+ // ../../packages/superdoc/dist/chunks/src-BlbgbalI.es.js
221763
221907
  function deleteProps(obj, propOrProps) {
221764
221908
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
221765
221909
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -221833,7 +221977,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
221833
221977
  }
221834
221978
  function getSuperdocVersion() {
221835
221979
  try {
221836
- return "1.37.0";
221980
+ return "1.38.0";
221837
221981
  } catch {
221838
221982
  return "unknown";
221839
221983
  }
@@ -234777,11 +234921,20 @@ function buildSelectionClipboardHtml(view, editor) {
234777
234921
  annotateCopiedSectionMetadata(container, view);
234778
234922
  return serializeSelectionAsWordHtml(container) || container.innerHTML || null;
234779
234923
  }
234780
- function projectContentNode(pmNode) {
234781
- return projectBlock(pmNode);
234924
+ function isVisibleProjection(options) {
234925
+ return options?.textModel === "visible";
234926
+ }
234927
+ function hasTrackDeleteMark$1(pmNode) {
234928
+ return pmNode.marks?.some((mark2) => mark2.type.name === "trackDelete") ?? false;
234782
234929
  }
234783
- function projectInlineNode(pmNode) {
234784
- return projectInline(pmNode);
234930
+ function projectContentNode(pmNode, options) {
234931
+ return projectBlock(pmNode, options);
234932
+ }
234933
+ function projectInlineNode(pmNode, options) {
234934
+ return projectInline(pmNode, options) ?? {
234935
+ kind: "run",
234936
+ run: { text: "" }
234937
+ };
234785
234938
  }
234786
234939
  function projectMarkBasedInline(editor, candidate) {
234787
234940
  const { nodeType, anchor, attrs } = candidate;
@@ -234831,8 +234984,9 @@ function resolveTextByBlockId(editor, anchor) {
234831
234984
  function projectDocument(editor, options) {
234832
234985
  const doc$12 = editor.state.doc;
234833
234986
  const body = [];
234987
+ const projectionOptions = { textModel: "visible" };
234834
234988
  doc$12.forEach((child) => {
234835
- body.push(projectBlock(child));
234989
+ body.push(projectBlock(child, projectionOptions));
234836
234990
  });
234837
234991
  const sections = projectSections(editor);
234838
234992
  const numbering = projectNumberingCatalog(editor);
@@ -234918,27 +235072,27 @@ function projectNumberingCatalog(editor) {
234918
235072
  }
234919
235073
  return Object.keys(catalog.definitions).length > 0 ? catalog : undefined;
234920
235074
  }
234921
- function projectBlock(pmNode) {
235075
+ function projectBlock(pmNode, options) {
234922
235076
  const typeName = pmNode.type.name;
234923
235077
  switch (typeName) {
234924
235078
  case "paragraph":
234925
- return projectParagraphOrHeading(pmNode);
235079
+ return projectParagraphOrHeading(pmNode, options);
234926
235080
  case "heading":
234927
- return projectHeadingNode(pmNode);
235081
+ return projectHeadingNode(pmNode, options);
234928
235082
  case "table":
234929
- return projectTable(pmNode);
235083
+ return projectTable(pmNode, options);
234930
235084
  case "bulletList":
234931
235085
  case "orderedList":
234932
- return projectList(pmNode, typeName === "orderedList");
235086
+ return projectList(pmNode, typeName === "orderedList", options);
234933
235087
  case "listItem":
234934
- return projectListItemAsContent(pmNode);
235088
+ return projectListItemAsContent(pmNode, options);
234935
235089
  case "image":
234936
235090
  return projectBlockImage(pmNode);
234937
235091
  case "tableOfContents":
234938
235092
  return projectToc(pmNode);
234939
235093
  case "sdt":
234940
235094
  case "structuredContentBlock":
234941
- return projectBlockSdt(pmNode);
235095
+ return projectBlockSdt(pmNode, options);
234942
235096
  case "sectionBreak":
234943
235097
  return projectSectionBreak(pmNode);
234944
235098
  case "pageBreak":
@@ -234947,22 +235101,22 @@ function projectBlock(pmNode) {
234947
235101
  case "drawing":
234948
235102
  return projectBlockDrawing(pmNode);
234949
235103
  default:
234950
- return projectFallbackBlock(pmNode);
235104
+ return projectFallbackBlock(pmNode, options);
234951
235105
  }
234952
235106
  }
234953
- function projectParagraphOrHeading(pmNode) {
235107
+ function projectParagraphOrHeading(pmNode, options) {
234954
235108
  const attrs = pmNode.attrs;
234955
235109
  const headingLevel = getHeadingLevel(attrs?.paragraphProperties?.styleId);
234956
235110
  if (headingLevel && headingLevel >= 1 && headingLevel <= 6)
234957
- return buildHeading(pmNode, attrs, headingLevel);
234958
- return buildParagraph(pmNode, attrs);
235111
+ return buildHeading(pmNode, attrs, headingLevel, options);
235112
+ return buildParagraph(pmNode, attrs, options);
234959
235113
  }
234960
- function projectHeadingNode(pmNode) {
235114
+ function projectHeadingNode(pmNode, options) {
234961
235115
  const attrs = pmNode.attrs;
234962
- return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1);
235116
+ return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1, options);
234963
235117
  }
234964
- function buildParagraph(pmNode, attrs) {
234965
- const inlines = projectInlineChildren(pmNode);
235118
+ function buildParagraph(pmNode, attrs, options) {
235119
+ const inlines = projectInlineChildren(pmNode, options);
234966
235120
  const result = {
234967
235121
  kind: "paragraph",
234968
235122
  id: resolveNodeId(pmNode),
@@ -234976,8 +235130,8 @@ function buildParagraph(pmNode, attrs) {
234976
235130
  result.paragraph.props = props;
234977
235131
  return result;
234978
235132
  }
234979
- function buildHeading(pmNode, attrs, level) {
234980
- const inlines = projectInlineChildren(pmNode);
235133
+ function buildHeading(pmNode, attrs, level, options) {
235134
+ const inlines = projectInlineChildren(pmNode, options);
234981
235135
  const result = {
234982
235136
  kind: "heading",
234983
235137
  id: resolveNodeId(pmNode),
@@ -234994,13 +235148,13 @@ function buildHeading(pmNode, attrs, level) {
234994
235148
  result.heading.props = props;
234995
235149
  return result;
234996
235150
  }
234997
- function projectTable(pmNode) {
235151
+ function projectTable(pmNode, options) {
234998
235152
  const attrs = pmNode.attrs;
234999
235153
  const pmAttrs = pmNode.attrs;
235000
235154
  const rows = [];
235001
235155
  pmNode.forEach((child) => {
235002
235156
  if (child.type.name === "tableRow")
235003
- rows.push(projectTableRow(child));
235157
+ rows.push(projectTableRow(child, options));
235004
235158
  });
235005
235159
  const result = {
235006
235160
  kind: "table",
@@ -235030,11 +235184,11 @@ function projectTable(pmNode) {
235030
235184
  }
235031
235185
  return result;
235032
235186
  }
235033
- function projectTableRow(pmNode) {
235187
+ function projectTableRow(pmNode, options) {
235034
235188
  const cells = [];
235035
235189
  pmNode.forEach((child) => {
235036
235190
  if (child.type.name === "tableCell" || child.type.name === "tableHeader")
235037
- cells.push(projectTableCell(child));
235191
+ cells.push(projectTableCell(child, options));
235038
235192
  });
235039
235193
  const row2 = { cells };
235040
235194
  const attrs = pmNode.attrs;
@@ -235047,11 +235201,11 @@ function projectTableRow(pmNode) {
235047
235201
  }
235048
235202
  return row2;
235049
235203
  }
235050
- function projectTableCell(pmNode) {
235204
+ function projectTableCell(pmNode, options) {
235051
235205
  const attrs = pmNode.attrs;
235052
235206
  const content3 = [];
235053
235207
  pmNode.forEach((child) => {
235054
- content3.push(projectBlock(child));
235208
+ content3.push(projectBlock(child, options));
235055
235209
  });
235056
235210
  const cell2 = { content: content3 };
235057
235211
  if (attrs?.colspan && attrs.colspan > 1)
@@ -235063,11 +235217,11 @@ function projectTableCell(pmNode) {
235063
235217
  cell2.props = { verticalAlign: vAlign };
235064
235218
  return cell2;
235065
235219
  }
235066
- function projectList(pmNode, ordered) {
235220
+ function projectList(pmNode, ordered, options) {
235067
235221
  const items = [];
235068
235222
  pmNode.forEach((child) => {
235069
235223
  if (child.type.name === "listItem")
235070
- items.push(projectListItem(child));
235224
+ items.push(projectListItem(child, options));
235071
235225
  });
235072
235226
  const result = {
235073
235227
  kind: "list",
@@ -235085,18 +235239,18 @@ function projectList(pmNode, ordered) {
235085
235239
  result.list.styleRef = attrs.listStyleId;
235086
235240
  return result;
235087
235241
  }
235088
- function projectListItem(pmNode) {
235242
+ function projectListItem(pmNode, options) {
235089
235243
  const content3 = [];
235090
235244
  pmNode.forEach((child) => {
235091
- content3.push(projectBlock(child));
235245
+ content3.push(projectBlock(child, options));
235092
235246
  });
235093
235247
  return {
235094
235248
  level: pmNode.attrs?.level ?? 0,
235095
235249
  content: content3
235096
235250
  };
235097
235251
  }
235098
- function projectListItemAsContent(pmNode) {
235099
- const inlines = projectInlineChildren(pmNode);
235252
+ function projectListItemAsContent(pmNode, options) {
235253
+ const inlines = projectInlineChildren(pmNode, options);
235100
235254
  return {
235101
235255
  kind: "paragraph",
235102
235256
  id: resolveNodeId(pmNode),
@@ -235145,10 +235299,10 @@ function extractSdtMetadata(attrs) {
235145
235299
  ...lock && lock !== "none" ? { lock } : {}
235146
235300
  };
235147
235301
  }
235148
- function projectBlockSdt(pmNode) {
235302
+ function projectBlockSdt(pmNode, options) {
235149
235303
  const children = [];
235150
235304
  pmNode.forEach((child) => {
235151
- children.push(projectBlock(child));
235305
+ children.push(projectBlock(child, options));
235152
235306
  });
235153
235307
  return {
235154
235308
  kind: "sdt",
@@ -235160,8 +235314,8 @@ function projectBlockSdt(pmNode) {
235160
235314
  }
235161
235315
  };
235162
235316
  }
235163
- function projectInlineSdt(pmNode) {
235164
- const inlines = projectInlineChildren(pmNode);
235317
+ function projectInlineSdt(pmNode, options) {
235318
+ const inlines = projectInlineChildren(pmNode, options);
235165
235319
  return {
235166
235320
  kind: "sdt",
235167
235321
  id: resolveSdtNodeId(pmNode),
@@ -235198,28 +235352,29 @@ function projectBlockDrawing(pmNode) {
235198
235352
  }
235199
235353
  };
235200
235354
  }
235201
- function projectFallbackBlock(pmNode) {
235202
- const inlines = projectInlineChildren(pmNode);
235355
+ function projectFallbackBlock(pmNode, options) {
235356
+ const inlines = projectInlineChildren(pmNode, options);
235203
235357
  return {
235204
235358
  kind: "paragraph",
235205
235359
  id: resolveNodeId(pmNode),
235206
235360
  paragraph: { inlines }
235207
235361
  };
235208
235362
  }
235209
- function projectInlineChildren(pmNode) {
235363
+ function projectInlineChildren(pmNode, options) {
235210
235364
  const inlines = [];
235211
235365
  pmNode.forEach((child) => {
235212
- const projected = projectInline(child);
235213
- inlines.push(projected);
235366
+ const projected = projectInline(child, options);
235367
+ if (projected)
235368
+ inlines.push(projected);
235214
235369
  });
235215
235370
  return inlines;
235216
235371
  }
235217
- function projectInline(pmNode) {
235372
+ function projectInline(pmNode, options) {
235218
235373
  if (pmNode.isText)
235219
- return projectTextRun(pmNode);
235374
+ return projectTextRun(pmNode, options);
235220
235375
  switch (pmNode.type.name) {
235221
235376
  case "run":
235222
- return projectRunNode(pmNode);
235377
+ return projectRunNode(pmNode, options);
235223
235378
  case "image":
235224
235379
  return projectInlineImage(pmNode);
235225
235380
  case "tab":
@@ -235236,21 +235391,23 @@ function projectInline(pmNode) {
235236
235391
  case "field":
235237
235392
  return projectInlineField(pmNode);
235238
235393
  case "structuredContent":
235239
- return projectInlineSdt(pmNode);
235394
+ return projectInlineSdt(pmNode, options);
235240
235395
  default:
235241
- return projectInlineFallback(pmNode);
235396
+ return projectInlineFallback(pmNode, options);
235242
235397
  }
235243
235398
  }
235244
- function projectRunNode(pmNode) {
235399
+ function projectRunNode(pmNode, options) {
235245
235400
  const runProperties = (pmNode.attrs ?? {}).runProperties;
235246
- const text5 = pmNode.textContent;
235401
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
235402
+ if (isVisibleProjection(options) && text5.length === 0)
235403
+ return null;
235247
235404
  let linkMark;
235248
235405
  pmNode.forEach((child) => {
235249
235406
  if (!linkMark)
235250
235407
  linkMark = child.marks?.find((m$1) => m$1.type.name === "link");
235251
235408
  });
235252
235409
  if (linkMark)
235253
- return buildHyperlinkFromRunNode(pmNode, linkMark);
235410
+ return buildHyperlinkFromRunNode(pmNode, linkMark, options);
235254
235411
  const run2 = {
235255
235412
  kind: "run",
235256
235413
  run: { text: text5 }
@@ -235263,11 +235420,14 @@ function projectRunNode(pmNode) {
235263
235420
  run2.run.props = props;
235264
235421
  return run2;
235265
235422
  }
235266
- function buildHyperlinkFromRunNode(pmNode, linkMark) {
235423
+ function buildHyperlinkFromRunNode(pmNode, linkMark, options) {
235267
235424
  const attrs = linkMark.attrs;
235425
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
235426
+ if (isVisibleProjection(options) && text5.length === 0)
235427
+ return null;
235268
235428
  const childRun = {
235269
235429
  kind: "run",
235270
- run: { text: pmNode.textContent }
235430
+ run: { text: text5 }
235271
235431
  };
235272
235432
  const runProperties = pmNode.attrs?.runProperties;
235273
235433
  const props = extractRunPropsFromRunProperties(runProperties);
@@ -235381,7 +235541,9 @@ function extractRunPropsFromRunProperties(runProperties) {
235381
235541
  }
235382
235542
  return hasProps ? props : undefined;
235383
235543
  }
235384
- function projectTextRun(pmNode) {
235544
+ function projectTextRun(pmNode, options) {
235545
+ if (isVisibleProjection(options) && hasTrackDeleteMark$1(pmNode))
235546
+ return null;
235385
235547
  const marks = pmNode.marks;
235386
235548
  const linkMark = marks.find((m$1) => m$1.type.name === "link");
235387
235549
  if (linkMark)
@@ -235476,10 +235638,13 @@ function projectInlineField(pmNode) {
235476
235638
  }
235477
235639
  };
235478
235640
  }
235479
- function projectInlineFallback(pmNode) {
235641
+ function projectInlineFallback(pmNode, options) {
235642
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent ?? "";
235643
+ if (isVisibleProjection(options) && text5.length === 0)
235644
+ return null;
235480
235645
  return {
235481
235646
  kind: "run",
235482
- run: { text: pmNode.textContent ?? "" }
235647
+ run: { text: text5 }
235483
235648
  };
235484
235649
  }
235485
235650
  function resolveNodeId(pmNode) {
@@ -236532,6 +236697,13 @@ function buildSelectionTargetFromTextRanges(textRanges, story) {
236532
236697
  target.story = story;
236533
236698
  return target;
236534
236699
  }
236700
+ function readCandidateVisibleText(editor, candidate) {
236701
+ const maybeNode = candidate.node;
236702
+ if (maybeNode && typeof maybeNode.childCount === "number" && maybeNode.childCount > 0)
236703
+ return textContentInBlock(maybeNode, { textModel: "visible" });
236704
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
236705
+ `, "");
236706
+ }
236535
236707
  function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyKey, resolverParams) {
236536
236708
  const index2 = getBlockIndex(editor);
236537
236709
  const doc$12 = editor.state.doc;
@@ -236584,10 +236756,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
236584
236756
  }
236585
236757
  });
236586
236758
  }
236587
- const blockStart = candidate.pos + 1;
236588
- const blockEnd = candidate.end - 1;
236589
- const blockText = doc$12.textBetween(blockStart, blockEnd, `
236590
- `, "");
236759
+ const blockText = readCandidateVisibleText(editor, candidate);
236591
236760
  const matchedText = blockText.slice(from$1, to);
236592
236761
  const node3 = doc$12.nodeAt(candidate.pos);
236593
236762
  const nodeType = node3?.type.name ?? "paragraph";
@@ -236596,7 +236765,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
236596
236765
  resolverParams,
236597
236766
  paragraphProperties: node3?.attrs?.paragraphProperties ?? null
236598
236767
  } : undefined;
236599
- const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to).runs);
236768
+ const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to, { textModel: "visible" }).runs);
236600
236769
  const blockRange = {
236601
236770
  start: from$1,
236602
236771
  end: to
@@ -236660,7 +236829,6 @@ function buildBlocksSnippet(editor, blocks2) {
236660
236829
  if (!editor.state?.doc || blocks2.length === 0)
236661
236830
  return;
236662
236831
  const index2 = getBlockIndex(editor);
236663
- const doc$12 = editor.state.doc;
236664
236832
  const matchText = blocks2.map((b$1) => b$1.text).join(`
236665
236833
  `);
236666
236834
  if (matchText.length >= 500)
@@ -236677,10 +236845,7 @@ function buildBlocksSnippet(editor, blocks2) {
236677
236845
  const firstBlock = blocks2[0];
236678
236846
  const firstCandidate = index2.candidates.find((c) => c.nodeId === firstBlock.blockId);
236679
236847
  if (firstCandidate) {
236680
- const blockStart = firstCandidate.pos + 1;
236681
- const blockEnd = firstCandidate.end - 1;
236682
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
236683
- `, "");
236848
+ const fullBlockText = readCandidateVisibleText(editor, firstCandidate);
236684
236849
  const contextStart = Math.max(0, firstBlock.range.start - contextEachSide);
236685
236850
  leftContext = fullBlockText.slice(contextStart, firstBlock.range.start);
236686
236851
  }
@@ -236688,10 +236853,7 @@ function buildBlocksSnippet(editor, blocks2) {
236688
236853
  const lastBlock = blocks2[blocks2.length - 1];
236689
236854
  const lastCandidate = index2.candidates.find((c) => c.nodeId === lastBlock.blockId);
236690
236855
  if (lastCandidate) {
236691
- const blockStart = lastCandidate.pos + 1;
236692
- const blockEnd = lastCandidate.end - 1;
236693
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
236694
- `, "");
236856
+ const fullBlockText = readCandidateVisibleText(editor, lastCandidate);
236695
236857
  const contextEnd = Math.min(fullBlockText.length, lastBlock.range.end + contextEachSide);
236696
236858
  rightContext = fullBlockText.slice(lastBlock.range.end, contextEnd);
236697
236859
  }
@@ -237017,12 +237179,12 @@ function projectMatchToSDNodeResult(editor, address2, blockIndex) {
237017
237179
  if (!found2)
237018
237180
  return null;
237019
237181
  return {
237020
- node: projectContentNode(found2.node),
237182
+ node: projectContentNode(found2.node, { textModel: "visible" }),
237021
237183
  address: address2
237022
237184
  };
237023
237185
  }
237024
237186
  return {
237025
- node: projectContentNode(candidate.node),
237187
+ node: projectContentNode(candidate.node, { textModel: "visible" }),
237026
237188
  address: address2
237027
237189
  };
237028
237190
  }
@@ -258896,7 +259058,7 @@ function extractParagraphText(paraNode, paraPos) {
258896
259058
  return;
258897
259059
  }
258898
259060
  if (node3.isText && node3.text) {
258899
- if (hasTrackDeleteMark(node3))
259061
+ if (hasTrackDeleteMark2(node3))
258900
259062
  return;
258901
259063
  const text5 = node3.text;
258902
259064
  const pmFrom = pos;
@@ -258929,7 +259091,7 @@ function extractParagraphText(paraNode, paraPos) {
258929
259091
  }
258930
259092
  }
258931
259093
  }
258932
- function hasTrackDeleteMark(node3) {
259094
+ function hasTrackDeleteMark2(node3) {
258933
259095
  return node3.marks?.some((m$1) => m$1.type.name === "trackDelete") ?? false;
258934
259096
  }
258935
259097
  function isNonTextInlineNode(typeName) {
@@ -282480,7 +282642,7 @@ var Node$13 = class Node$14 {
282480
282642
  }, isToolbarInput = (target) => {
282481
282643
  return !!target?.closest(".button-text-input") || target?.classList?.contains("button-text-input");
282482
282644
  }, isToolbarButton = (target) => {
282483
- return !!target?.closest(".toolbar-button") || target?.classList?.contains("toolbar-button");
282645
+ return !!target?.closest(".sd-toolbar-button") || !!target?.closest(".toolbar-button") || target?.classList?.contains("sd-toolbar-button") || target?.classList?.contains("toolbar-button");
282484
282646
  }, CustomSelection, History, createUndoPlugin = () => {
282485
282647
  return yUndoPlugin();
282486
282648
  }, Color, FontFamily, FontSize, LetterSpacing, TextAlign, toggleMarkCascade = (markName, options = {}) => ({ state, chain, editor }) => {
@@ -290473,7 +290635,8 @@ var Node$13 = class Node$14 {
290473
290635
  replacementGroupId: "",
290474
290636
  replacementSideId: "",
290475
290637
  sharedDeletionId: intent.replacementGroupHint || null,
290476
- recordSharedDeletionId: Boolean(intent.replacementGroupHint)
290638
+ recordSharedDeletionId: Boolean(intent.replacementGroupHint),
290639
+ reassignExistingDeletions: intent.source !== "native" && !intent.preserveExistingReviewState ? "different-user" : false
290477
290640
  });
290478
290641
  if (result.ok === false)
290479
290642
  return result;
@@ -290544,12 +290707,17 @@ var Node$13 = class Node$14 {
290544
290707
  }
290545
290708
  if (existingDelete) {
290546
290709
  const allExistingDeletes = node3.marks.filter((m$1) => m$1.type.name === TrackDeleteMarkName);
290547
- if (reassignExistingDeletions) {
290710
+ const isDifferentUserDeletion = !isSameUserHighConfidence(classifyOwnership({
290711
+ currentUser: ctx$1.currentIdentity,
290712
+ change: getChangeAuthorIdentity(existingDelete.attrs)
290713
+ }));
290714
+ if (reassignExistingDeletions === "all" || reassignExistingDeletions === "different-user" && isDifferentUserDeletion) {
290548
290715
  ops.push({
290549
290716
  kind: "reassign",
290550
290717
  from: segFrom,
290551
290718
  to: segTo,
290552
290719
  node: node3,
290720
+ parentId: existingDelete.attrs.id || existingDelete.attrs.overlapParentId || "",
290553
290721
  existingDeleteMarks: allExistingDeletes
290554
290722
  });
290555
290723
  return;
@@ -290590,7 +290758,7 @@ var Node$13 = class Node$14 {
290590
290758
  if (op.kind === "reassign") {
290591
290759
  const mark2 = makeDeleteMark(ctx$1, {
290592
290760
  id: deletionId,
290593
- overlapParentId: "",
290761
+ overlapParentId: op.parentId || "",
290594
290762
  replacementGroupId,
290595
290763
  replacementSideId
290596
290764
  });
@@ -290704,11 +290872,11 @@ var Node$13 = class Node$14 {
290704
290872
  }, compileOrdinaryTextReplace = (ctx$1, intent, sanitizedSlice, replacementParentId) => {
290705
290873
  const sharedId = intent.replacements === "paired" && !replacementParentId ? intent.replacementGroupHint || v4_default() : null;
290706
290874
  const replacementGroupId = sharedId ?? "";
290707
- let positionTo = intent.to;
290875
+ let positionTo = replacementParentId ? intent.from : intent.to;
290708
290876
  if (intent.from !== intent.to && intent.probeForDeletionSpan) {
290709
290877
  const probePos = Math.max(intent.from, intent.to - 1);
290710
290878
  const deletionSpan = findMarkPosition(ctx$1.tr.doc, probePos, TrackDeleteMarkName);
290711
- if (deletionSpan && deletionSpan.to > positionTo)
290879
+ if (!replacementParentId && deletionSpan && deletionSpan.to > positionTo)
290712
290880
  positionTo = deletionSpan.to;
290713
290881
  }
290714
290882
  const baseParentIsTextblock = ctx$1.tr.doc.resolve(positionTo).parent?.isTextblock;
@@ -290801,11 +290969,11 @@ var Node$13 = class Node$14 {
290801
290969
  let deletionMark = null;
290802
290970
  if (intent.from !== intent.to) {
290803
290971
  const stepsBefore = ctx$1.tr.steps.length;
290804
- const delResult = applyTrackedDelete(ctx$1, intent.from, intent.to, {
290972
+ const delResult = applyTrackedDelete(ctx$1, insertedLength > 0 && positionTo <= intent.from ? intent.from + insertedLength : intent.from, insertedLength > 0 && positionTo <= intent.from ? intent.to + insertedLength : intent.to, {
290805
290973
  replacementGroupId,
290806
290974
  replacementSideId: sharedId ? `${sharedId}#deleted` : "",
290807
290975
  sharedDeletionId: sharedId,
290808
- reassignExistingDeletions: Boolean(sharedId)
290976
+ reassignExistingDeletions: sharedId || replacementParentId ? "all" : false
290809
290977
  });
290810
290978
  if (delResult.ok === false)
290811
290979
  return delResult;
@@ -291298,13 +291466,14 @@ var Node$13 = class Node$14 {
291298
291466
  let intent;
291299
291467
  try {
291300
291468
  const preserveExistingReviewState = tr.getMeta("protectTrackedReviewState") === true;
291469
+ const source = tr.getMeta("inputType") === "programmatic" ? "document-api" : "native";
291301
291470
  if (step3.from === step3.to && step3.slice.content.size > 0)
291302
291471
  intent = makeTextInsertIntent({
291303
291472
  at: step3.from,
291304
291473
  content: step3.slice,
291305
291474
  user,
291306
291475
  date,
291307
- source: "native",
291476
+ source,
291308
291477
  preserveExistingReviewState
291309
291478
  });
291310
291479
  else if (step3.from !== step3.to && step3.slice.content.size === 0)
@@ -291313,7 +291482,7 @@ var Node$13 = class Node$14 {
291313
291482
  to: step3.to,
291314
291483
  user,
291315
291484
  date,
291316
- source: "native",
291485
+ source,
291317
291486
  preserveExistingReviewState
291318
291487
  });
291319
291488
  else if (step3.from !== step3.to && step3.slice.content.size > 0) {
@@ -291324,7 +291493,7 @@ var Node$13 = class Node$14 {
291324
291493
  replacements,
291325
291494
  user,
291326
291495
  date,
291327
- source: "native",
291496
+ source,
291328
291497
  preserveExistingReviewState
291329
291498
  });
291330
291499
  if (tr.steps.length === 1)
@@ -291584,7 +291753,7 @@ var Node$13 = class Node$14 {
291584
291753
  }
291585
291754
  });
291586
291755
  }
291587
- }, COMPOSITION_INPUT_TYPES, COMBINING_MARK_REGEX, graphemeSegmenter, DEAD_KEY_PLACEHOLDER_MARKS, getTextNodeAtPos = ({ doc: doc$12, pos }) => {
291756
+ }, COMPOSITION_INPUT_TYPES, COMBINING_MARK_REGEX, graphemeSegmenter, DEAD_KEY_PLACEHOLDER_MARKS, TRACKABLE_META_KEYS, PASSTHROUGH_META_KEYS, ALLOWED_META_KEYS, getTextNodeAtPos = ({ doc: doc$12, pos }) => {
291588
291757
  let found2 = null;
291589
291758
  doc$12.nodesBetween(Math.max(0, pos - 1), Math.min(doc$12.content.size, pos + 1), (node3, nodePos) => {
291590
291759
  if (found2 || !node3.isText || !node3.text)
@@ -291775,6 +291944,12 @@ var Node$13 = class Node$14 {
291775
291944
  ...existingMeta,
291776
291945
  ...extraMeta
291777
291946
  });
291947
+ }, copyPassthroughMeta = (sourceTr, targetTr) => {
291948
+ PASSTHROUGH_META_KEYS.forEach((key2) => {
291949
+ const value = sourceTr.getMeta(key2);
291950
+ if (value !== undefined)
291951
+ targetTr.setMeta(key2, value);
291952
+ });
291778
291953
  }, getPendingDeadKeyPlaceholder = ({ tr, newTr, user }) => {
291779
291954
  if (!isCompositionTransaction(tr) || tr.steps.length !== 1)
291780
291955
  return null;
@@ -291804,13 +291979,6 @@ var Node$13 = class Node$14 {
291804
291979
  authorEmail: user.email
291805
291980
  };
291806
291981
  }, trackedTransaction = ({ tr, state, user, replacements = "paired" }) => {
291807
- const onlyInputTypeMeta = [
291808
- "inputType",
291809
- "uiEvent",
291810
- "paste",
291811
- "pointer",
291812
- "composition"
291813
- ];
291814
291982
  const notAllowedMeta = [
291815
291983
  "historyUndo",
291816
291984
  "historyRedo",
@@ -291819,13 +291987,7 @@ var Node$13 = class Node$14 {
291819
291987
  const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
291820
291988
  const ySyncMeta = tr.getMeta(ySyncPluginKey);
291821
291989
  const pendingDeadKeyPlaceholder = TrackChangesBasePluginKey.getState(state)?.pendingDeadKeyPlaceholder ?? null;
291822
- const allowedMeta = new Set([
291823
- ...onlyInputTypeMeta,
291824
- ySyncPluginKey.key,
291825
- "forceTrackChanges",
291826
- "protectTrackedReviewState"
291827
- ]);
291828
- const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta2) => !allowedMeta.has(meta2));
291990
+ const hasDisallowedMeta = tr.meta && Object.keys(tr.meta).some((meta2) => !ALLOWED_META_KEYS.has(meta2));
291829
291991
  if (ySyncMeta?.isChangeOrigin || !tr.steps.length || hasDisallowedMeta && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
291830
291992
  if (pendingDeadKeyPlaceholder && !isCompositionTransaction(tr))
291831
291993
  mergeTrackChangesMeta(tr, { pendingDeadKeyPlaceholder: null });
@@ -291900,14 +292062,7 @@ var Node$13 = class Node$14 {
291900
292062
  else
291901
292063
  newTr.step(step3);
291902
292064
  });
291903
- if (tr.getMeta("inputType"))
291904
- newTr.setMeta("inputType", tr.getMeta("inputType"));
291905
- if (tr.getMeta("uiEvent"))
291906
- newTr.setMeta("uiEvent", tr.getMeta("uiEvent"));
291907
- if (tr.getMeta("composition") !== undefined)
291908
- newTr.setMeta("composition", tr.getMeta("composition"));
291909
- if (tr.getMeta("addToHistory") !== undefined)
291910
- newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
292065
+ copyPassthroughMeta(tr, newTr);
291911
292066
  mergeTrackChangesMeta(newTr, { pendingDeadKeyPlaceholder: getPendingDeadKeyPlaceholder({
291912
292067
  tr,
291913
292068
  newTr,
@@ -292450,6 +292605,7 @@ var Node$13 = class Node$14 {
292450
292605
  else if (change.type === CanonicalChangeType.Replacement) {
292451
292606
  const repResult = planReplacementDecision({
292452
292607
  ops,
292608
+ graph,
292453
292609
  change,
292454
292610
  decision,
292455
292611
  removedRanges,
@@ -292594,7 +292750,7 @@ var Node$13 = class Node$14 {
292594
292750
  });
292595
292751
  if (isFull)
292596
292752
  retired.add(change.id);
292597
- }, planReplacementDecision = ({ ops, change, decision, removedRanges, retired }) => {
292753
+ }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
292598
292754
  const inserted = change.insertedSegments;
292599
292755
  const deleted = change.deletedSegments;
292600
292756
  if (!inserted.length || !deleted.length)
@@ -292639,16 +292795,114 @@ var Node$13 = class Node$14 {
292639
292795
  cause: `reject-replacement-inserted:${change.id}`
292640
292796
  });
292641
292797
  }
292642
- for (const seg of deleted)
292798
+ const parentRestore = getParentRestoreContext({
292799
+ graph,
292800
+ change
292801
+ });
292802
+ for (const seg of deleted) {
292643
292803
  pushRemoveMarkOpsForSegment({
292644
292804
  ops,
292645
292805
  segment: seg,
292646
292806
  changeId: change.id,
292647
292807
  side: SegmentSide.Deleted
292648
292808
  });
292809
+ if (parentRestore?.mark)
292810
+ pushAddMarkOpsForSegment({
292811
+ ops,
292812
+ segment: seg,
292813
+ changeId: parentRestore.mark.attrs?.id || change.parent || change.id,
292814
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
292815
+ mark: parentRestore.mark
292816
+ });
292817
+ }
292818
+ for (const sibling of parentRestore?.siblingSegments ?? []) {
292819
+ pushRemoveMarkOpsForSegment({
292820
+ ops,
292821
+ segment: sibling,
292822
+ changeId: sibling.changeId,
292823
+ side: sibling.side
292824
+ });
292825
+ pushAddMarkOpsForSegment({
292826
+ ops,
292827
+ segment: sibling,
292828
+ changeId: parentRestore.mark.attrs?.id || sibling.changeId,
292829
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
292830
+ mark: parentRestore.mark
292831
+ });
292832
+ retired.add(sibling.changeId);
292833
+ }
292649
292834
  }
292650
292835
  retired.add(change.id);
292651
292836
  return { ok: true };
292837
+ }, getParentRestoreContext = ({ graph, change }) => {
292838
+ const explicit = getExplicitParentRestoreContext({
292839
+ graph,
292840
+ change
292841
+ });
292842
+ if (explicit)
292843
+ return explicit;
292844
+ return inferAdjacentParentRestoreContext({
292845
+ graph,
292846
+ change
292847
+ });
292848
+ }, getExplicitParentRestoreContext = ({ graph, change }) => {
292849
+ if (!change.parent)
292850
+ return null;
292851
+ const parent = graph.changes.get(change.parent);
292852
+ if (!parent)
292853
+ return null;
292854
+ if (parent.type === CanonicalChangeType.Insertion) {
292855
+ const mark2 = parent.insertedSegments[0]?.mark ?? null;
292856
+ return mark2 ? {
292857
+ mark: mark2,
292858
+ siblingSegments: []
292859
+ } : null;
292860
+ }
292861
+ if (parent.type === CanonicalChangeType.Deletion) {
292862
+ const mark2 = parent.deletedSegments[0]?.mark ?? null;
292863
+ return mark2 ? {
292864
+ mark: mark2,
292865
+ siblingSegments: []
292866
+ } : null;
292867
+ }
292868
+ return null;
292869
+ }, inferAdjacentParentRestoreContext = ({ graph, change }) => {
292870
+ if (!change.deletedSegments.length || !change.segments.length)
292871
+ return null;
292872
+ const from$1 = Math.min(...change.segments.map((segment) => segment.from));
292873
+ const to = Math.max(...change.segments.map((segment) => segment.to));
292874
+ const before2 = nearestSegmentBefore({
292875
+ graph,
292876
+ change,
292877
+ from: from$1
292878
+ });
292879
+ const after2 = nearestSegmentAfter({
292880
+ graph,
292881
+ change,
292882
+ to
292883
+ });
292884
+ if (!before2 || !after2)
292885
+ return null;
292886
+ if (!areParentRestorePeers(before2, after2))
292887
+ return null;
292888
+ return {
292889
+ mark: before2.mark,
292890
+ siblingSegments: after2.changeId === before2.changeId ? [] : [after2]
292891
+ };
292892
+ }, nearestSegmentBefore = ({ graph, change, from: from$1 }) => {
292893
+ return graph.segments.filter((segment) => segment.changeId !== change.id && segment.to <= from$1).sort((a2, b$1) => b$1.to - a2.to || b$1.from - a2.from)[0];
292894
+ }, nearestSegmentAfter = ({ graph, change, to }) => {
292895
+ return graph.segments.filter((segment) => segment.changeId !== change.id && segment.from >= to).sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to)[0];
292896
+ }, areParentRestorePeers = (left$1, right$1) => {
292897
+ if (!left$1 || !right$1)
292898
+ return false;
292899
+ if (left$1.side !== right$1.side)
292900
+ return false;
292901
+ if (left$1.side !== SegmentSide.Inserted && left$1.side !== SegmentSide.Deleted)
292902
+ return false;
292903
+ if (left$1.markType !== right$1.markType)
292904
+ return false;
292905
+ return left$1.attrs.author === right$1.attrs.author && left$1.attrs.authorEmail === right$1.attrs.authorEmail && left$1.attrs.date === right$1.attrs.date;
292652
292906
  }, planFormattingDecision = ({ ops, change, decision, retired }) => {
292653
292907
  for (const seg of change.formattingSegments)
292654
292908
  if (decision === "accept")
@@ -292790,6 +293044,21 @@ var Node$13 = class Node$14 {
292790
293044
  mark: run2.mark
292791
293045
  });
292792
293046
  }
293047
+ }, pushAddMarkOpsForSegment = ({ ops, segment, changeId, side, mark: mark2, from: from$1 = segment.from, to = segment.to }) => {
293048
+ for (const run2 of getSegmentMarkRuns(segment)) {
293049
+ const clippedFrom = Math.max(from$1, run2.from);
293050
+ const clippedTo = Math.min(to, run2.to);
293051
+ if (clippedFrom >= clippedTo)
293052
+ continue;
293053
+ ops.push({
293054
+ kind: "addMark",
293055
+ from: clippedFrom,
293056
+ to: clippedTo,
293057
+ changeId,
293058
+ side,
293059
+ mark: mark2
293060
+ });
293061
+ }
292793
293062
  }, getSegmentMarkRuns = (segment) => {
292794
293063
  return segment.markRuns?.length ? segment.markRuns : [{
292795
293064
  from: segment.from,
@@ -293797,7 +294066,7 @@ var Node$13 = class Node$14 {
293797
294066
  this.deco = deco;
293798
294067
  }
293799
294068
  }, searchKey, BLOCK_SEPARATOR = `
293800
- `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$1 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
294069
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
293801
294070
  const matches2 = [];
293802
294071
  for (const indexMatch of indexMatches) {
293803
294072
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
@@ -295894,7 +296163,7 @@ var Node$13 = class Node$14 {
295894
296163
  disabled: role !== "editor",
295895
296164
  attributes: {
295896
296165
  dropdownPosition: "right",
295897
- className: "toolbar-item--doc-mode",
296166
+ className: "sd-toolbar-item--doc-mode",
295898
296167
  ariaLabel: "Document mode"
295899
296168
  },
295900
296169
  options: [{
@@ -295982,7 +296251,7 @@ var Node$13 = class Node$14 {
295982
296251
  suppressActiveHighlight: true,
295983
296252
  disabled: false,
295984
296253
  attributes: {
295985
- className: "toolbar-item--linked-styles",
296254
+ className: "sd-toolbar-item--linked-styles",
295986
296255
  ariaLabel: "Linked styles"
295987
296256
  },
295988
296257
  options: [{
@@ -296065,8 +296334,7 @@ var Node$13 = class Node$14 {
296065
296334
  "clearFormatting",
296066
296335
  "copyFormat",
296067
296336
  "ruler",
296068
- "formattingMarks",
296069
- "tableOfContents"
296337
+ "formattingMarks"
296070
296338
  ];
296071
296339
  const itemsToHideSM = [
296072
296340
  "zoom",
@@ -296076,15 +296344,16 @@ var Node$13 = class Node$14 {
296076
296344
  ];
296077
296345
  const shouldUseLgCompactStyles = availableWidth <= RESPONSIVE_BREAKPOINTS.lg;
296078
296346
  const shouldIncludeFormattingMarks = superToolbar.config?.showFormattingMarksButton === true;
296347
+ const shouldIncludeTableOfContents = superToolbar.config?.showTableOfContentsButton === true;
296079
296348
  if (shouldUseLgCompactStyles)
296080
296349
  documentMode.attributes.value = {
296081
296350
  ...documentMode.attributes.value,
296082
- className: `${documentMode.attributes.value.className} toolbar-item--doc-mode-compact`
296351
+ className: `${documentMode.attributes.value.className} sd-toolbar-item--doc-mode-compact`
296083
296352
  };
296084
296353
  if (shouldUseLgCompactStyles)
296085
296354
  linkedStyles.attributes.value = {
296086
296355
  ...linkedStyles.attributes.value,
296087
- className: `${linkedStyles.attributes.value.className} toolbar-item--linked-styles-compact`
296356
+ className: `${linkedStyles.attributes.value.className} sd-toolbar-item--linked-styles-compact`
296088
296357
  };
296089
296358
  let toolbarItems = [
296090
296359
  undo$2,
@@ -296105,7 +296374,7 @@ var Node$13 = class Node$14 {
296105
296374
  separator,
296106
296375
  link2,
296107
296376
  image2,
296108
- tableOfContents,
296377
+ ...shouldIncludeTableOfContents ? [tableOfContents] : [],
296109
296378
  tableItem,
296110
296379
  tableActionsItem,
296111
296380
  separator,
@@ -297026,7 +297295,7 @@ var Node$13 = class Node$14 {
297026
297295
  domAvailabilityCache = false;
297027
297296
  return false;
297028
297297
  }
297029
- }, summaryVersion = "1.37.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
297298
+ }, summaryVersion = "1.38.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
297030
297299
  const container = document.createElement("div");
297031
297300
  container.innerHTML = html3;
297032
297301
  const result = [];
@@ -298211,7 +298480,7 @@ var Node$13 = class Node$14 {
298211
298480
  return () => {};
298212
298481
  const handle3 = setInterval(callback, intervalMs);
298213
298482
  return () => clearInterval(handle3);
298214
- }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.37.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
298483
+ }, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", import_lib4, CUSTOM_XML_DATA_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml", CUSTOM_XML_PROPS_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps", CUSTOM_XML_DATASTORE_NAMESPACE = "http://schemas.openxmlformats.org/officeDocument/2006/customXml", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.38.0", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, TRACKED_REVIEW_MARK_NAMES2, isTrackedReviewMark = (mark2) => Boolean(mark2?.type?.name && TRACKED_REVIEW_MARK_NAMES2.has(mark2.type.name)), trackedReviewMarkKey = (mark2) => {
298215
298484
  if (!isTrackedReviewMark(mark2))
298216
298485
  return null;
298217
298486
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -318943,13 +319212,13 @@ menclose::after {
318943
319212
  return;
318944
319213
  console.log(...args$1);
318945
319214
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
318946
- var init_src_DQ_lu_9z_es = __esm(() => {
319215
+ var init_src_BlbgbalI_es = __esm(() => {
318947
319216
  init_rolldown_runtime_Bg48TavK_es();
318948
- init_SuperConverter_C6hKp29w_es();
319217
+ init_SuperConverter_DHtZjY65_es();
318949
319218
  init_jszip_C49i9kUs_es();
318950
319219
  init_xml_js_CqGKpaft_es();
318951
319220
  init_uuid_qzgm05fK_es();
318952
- init_create_headless_toolbar_ISx0N5AS_es();
319221
+ init_create_headless_toolbar_lxRAue2X_es();
318953
319222
  init_constants_D_X7xF4s_es();
318954
319223
  init_dist_B8HfvhaK_es();
318955
319224
  init_unified_Dsuw2be5_es();
@@ -335934,6 +336203,26 @@ function print() { __p += __j.call(arguments, '') }
335934
336203
  ["~", "̃"],
335935
336204
  ["¨", "̈"]
335936
336205
  ]);
336206
+ TRACKABLE_META_KEYS = [
336207
+ "inputType",
336208
+ "uiEvent",
336209
+ "paste",
336210
+ "pointer",
336211
+ "composition",
336212
+ "superdocSlicePaste",
336213
+ "forceTrackChanges",
336214
+ "protectTrackedReviewState"
336215
+ ];
336216
+ PASSTHROUGH_META_KEYS = [
336217
+ "inputType",
336218
+ "uiEvent",
336219
+ "paste",
336220
+ "pointer",
336221
+ "composition",
336222
+ "addToHistory",
336223
+ "superdocSlicePaste"
336224
+ ];
336225
+ ALLOWED_META_KEYS = new Set([...TRACKABLE_META_KEYS, ySyncPluginKey.key]);
335937
336226
  TrackFormat = Mark3.create({
335938
336227
  name: TrackFormatMarkName,
335939
336228
  group: "track",
@@ -336668,12 +336957,12 @@ function print() { __p += __j.call(arguments, '') }
336668
336957
  onMouseenter: ($event) => activeUserIndex.value = index2,
336669
336958
  onMouseleave: _cache[0] || (_cache[0] = ($event) => activeUserIndex.value = null),
336670
336959
  key: user.email,
336671
- class: exports_vue.normalizeClass(["user-row", { selected: activeUserIndex.value === index2 }])
336960
+ class: exports_vue.normalizeClass(["user-row", { "sd-selected": activeUserIndex.value === index2 }])
336672
336961
  }, [user.name ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_2$17, [user.name ? (exports_vue.openBlock(), exports_vue.createElementBlock("span", _hoisted_3$13, exports_vue.toDisplayString(user.name), 1)) : exports_vue.createCommentVNode("", true), user.name && user.email ? (exports_vue.openBlock(), exports_vue.createElementBlock("span", _hoisted_4$9, " (" + exports_vue.toDisplayString(user.email) + ")", 1)) : exports_vue.createCommentVNode("", true)])) : (exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_5$7, [exports_vue.createElementVNode("span", null, exports_vue.toDisplayString(user.email), 1)]))], 42, _hoisted_1$22);
336673
336962
  }), 128))], 544);
336674
336963
  };
336675
336964
  }
336676
- }, [["__scopeId", "data-v-dde587fd"]]);
336965
+ }, [["__scopeId", "data-v-b9684aad"]]);
336677
336966
  popoverPluginKey = new PluginKey("popoverPlugin");
336678
336967
  PopoverPlugin = Extension.create({
336679
336968
  name: "popoverPlugin",
@@ -336782,7 +337071,7 @@ function print() { __p += __j.call(arguments, '') }
336782
337071
  const text5 = node3.text || "";
336783
337072
  if (!text5.length)
336784
337073
  return;
336785
- if (hasTrackDeleteMark$1(node3)) {
337074
+ if (hasTrackDeleteMark$2(node3)) {
336786
337075
  appendDeletionBarrier();
336787
337076
  return;
336788
337077
  }
@@ -336824,7 +337113,7 @@ function print() { __p += __j.call(arguments, '') }
336824
337113
  }
336825
337114
  #walkNode(node3, docPos, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
336826
337115
  if (node3.isText) {
336827
- if (searchModel === "visible" && hasTrackDeleteMark$1(node3)) {
337116
+ if (searchModel === "visible" && hasTrackDeleteMark$2(node3)) {
336828
337117
  if (context?.deletionBarrierActive)
336829
337118
  return offset$1;
336830
337119
  addSegment({
@@ -337212,8 +337501,13 @@ function print() { __p += __j.call(arguments, '') }
337212
337501
  if (dispatch)
337213
337502
  dispatch(tr);
337214
337503
  const presentationEditor = editor.presentationEditor;
337215
- if (!(presentationEditor?.scrollToPosition?.(from$1, { block: "center" }) ?? false)) {
337216
- Promise.resolve(presentationEditor?.scrollToPositionAsync?.(from$1, { block: "center" })).catch(() => {});
337504
+ const scrollOpts = {
337505
+ block: "center",
337506
+ ifNeeded: true,
337507
+ suppressSelectionSyncScroll: true
337508
+ };
337509
+ if (!(presentationEditor?.scrollToPosition?.(from$1, scrollOpts) ?? false)) {
337510
+ Promise.resolve(presentationEditor?.scrollToPositionAsync?.(from$1, scrollOpts)).catch(() => {});
337217
337511
  const { node: node3 } = editor.view.domAtPos(from$1);
337218
337512
  if (node3?.scrollIntoView)
337219
337513
  node3.scrollIntoView({
@@ -338135,7 +338429,7 @@ function print() { __p += __j.call(arguments, '') }
338135
338429
  }, null, 8, _hoisted_5$6)) : exports_vue.createCommentVNode("", true)])], 544);
338136
338430
  };
338137
338431
  }
338138
- }, [["__scopeId", "data-v-79953d57"]]);
338432
+ }, [["__scopeId", "data-v-5444b0c8"]]);
338139
338433
  isHighContrastMode = exports_vue.ref(false);
338140
338434
  toolbarIcons = {
338141
338435
  undo: rotate_left_solid_default,
@@ -338299,7 +338593,7 @@ function print() { __p += __j.call(arguments, '') }
338299
338593
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", { class: exports_vue.normalizeClass(["alignment-buttons", { "high-contrast": exports_vue.unref(isHighContrastMode$1) }]) }, [(exports_vue.openBlock(), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(alignmentButtons, (button, index2) => {
338300
338594
  return exports_vue.createElementVNode("div", {
338301
338595
  key: button.key,
338302
- class: "button-icon",
338596
+ class: "sd-button-icon",
338303
338597
  onClick: ($event) => select2(button.key),
338304
338598
  innerHTML: button.icon,
338305
338599
  "data-item": "btn-textAlign-option",
@@ -338313,7 +338607,7 @@ function print() { __p += __j.call(arguments, '') }
338313
338607
  }), 64))], 2);
338314
338608
  };
338315
338609
  }
338316
- }, [["__scopeId", "data-v-3f7f0d98"]]);
338610
+ }, [["__scopeId", "data-v-ceb338e0"]]);
338317
338611
  _hoisted_1$19 = [
338318
338612
  "onClick",
338319
338613
  "innerHTML",
@@ -338393,7 +338687,7 @@ function print() { __p += __j.call(arguments, '') }
338393
338687
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", { class: exports_vue.normalizeClass(["style-buttons-list", { "high-contrast": exports_vue.unref(isHighContrastMode$1) }]) }, [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(props.buttons, (button, index2) => {
338394
338688
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
338395
338689
  key: button.key,
338396
- class: exports_vue.normalizeClass(["button-icon", { selected: props.selectedStyle === button.key }]),
338690
+ class: exports_vue.normalizeClass(["sd-button-icon", { "sd-selected": props.selectedStyle === button.key }]),
338397
338691
  style: exports_vue.normalizeStyle(iconStyle.value),
338398
338692
  onClick: ($event) => select2(button.key),
338399
338693
  innerHTML: button.icon,
@@ -338407,7 +338701,7 @@ function print() { __p += __j.call(arguments, '') }
338407
338701
  }), 128))], 2);
338408
338702
  };
338409
338703
  }
338410
- }, [["__scopeId", "data-v-d374ab76"]]);
338704
+ }, [["__scopeId", "data-v-701c1d54"]]);
338411
338705
  bulletStyleButtons = [
338412
338706
  {
338413
338707
  key: "disc",
@@ -338525,7 +338819,7 @@ function print() { __p += __j.call(arguments, '') }
338525
338819
  return (_ctx, _cache) => {
338526
338820
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", { class: exports_vue.normalizeClass(["document-mode", { "high-contrast": exports_vue.unref(isHighContrastMode$1) }]) }, [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(__props.options, (option, index2) => {
338527
338821
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
338528
- class: exports_vue.normalizeClass(["option-item", { disabled: option.disabled }]),
338822
+ class: exports_vue.normalizeClass(["sd-option-item", { "sd-disabled": option.disabled }]),
338529
338823
  onClick: ($event) => handleClick$1(option),
338530
338824
  "data-item": "btn-documentMode-option",
338531
338825
  role: "menuitem",
@@ -338540,7 +338834,7 @@ function print() { __p += __j.call(arguments, '') }
338540
338834
  }), 256))], 2);
338541
338835
  };
338542
338836
  }
338543
- }, [["__scopeId", "data-v-8587478e"]]);
338837
+ }, [["__scopeId", "data-v-abd514d9"]]);
338544
338838
  _hoisted_1$17 = {
338545
338839
  key: 0,
338546
338840
  class: "linked-style-buttons",
@@ -338842,13 +339136,13 @@ function print() { __p += __j.call(arguments, '') }
338842
339136
  type: "text",
338843
339137
  name: "link",
338844
339138
  placeholder: "Type or paste a link",
338845
- class: exports_vue.normalizeClass({ error: urlError.value }),
339139
+ class: exports_vue.normalizeClass({ "sd-error": urlError.value }),
338846
339140
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => rawUrl.value = $event),
338847
339141
  readonly: isViewingMode.value,
338848
339142
  onKeydown: [exports_vue.withKeys(exports_vue.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
338849
339143
  }, null, 42, _hoisted_10$1), [[exports_vue.vModelText, rawUrl.value]]),
338850
339144
  exports_vue.createElementVNode("div", {
338851
- class: exports_vue.normalizeClass(["open-link-icon", { disabled: !validUrl.value }]),
339145
+ class: exports_vue.normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
338852
339146
  innerHTML: exports_vue.unref(toolbarIcons).openLink,
338853
339147
  onClick: openLink,
338854
339148
  "data-item": "btn-link-open"
@@ -338863,14 +339157,14 @@ function print() { __p += __j.call(arguments, '') }
338863
339157
  class: "remove-btn__icon",
338864
339158
  innerHTML: exports_vue.unref(toolbarIcons).removeLink
338865
339159
  }, null, 8, _hoisted_13), _cache[6] || (_cache[6] = exports_vue.createTextVNode(" Remove ", -1))])) : exports_vue.createCommentVNode("", true), exports_vue.createElementVNode("button", {
338866
- class: exports_vue.normalizeClass(["submit-btn", { "disable-btn": isDisabled.value }]),
339160
+ class: exports_vue.normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
338867
339161
  onClick: handleSubmit,
338868
339162
  "data-item": "btn-link-apply"
338869
339163
  }, " Apply ", 2)])) : exports_vue.createCommentVNode("", true)
338870
339164
  ])) : isAnchor.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_14, [exports_vue.createElementVNode("a", { onClick: _cache[4] || (_cache[4] = exports_vue.withModifiers(($event) => navigateToAnchor(rawUrl.value), ["stop", "prevent"])) }, "Go to " + exports_vue.toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)])) : exports_vue.createCommentVNode("", true)], 2);
338871
339165
  };
338872
339166
  }
338873
- }, [["__scopeId", "data-v-56a53c8c"]]);
339167
+ }, [["__scopeId", "data-v-c490d677"]]);
338874
339168
  _hoisted_1$15 = [
338875
339169
  "aria-label",
338876
339170
  "onClick",
@@ -338977,7 +339271,7 @@ function print() { __p += __j.call(arguments, '') }
338977
339271
  return (_ctx, _cache) => {
338978
339272
  return exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(__props.icons, (row2, rowIndex) => {
338979
339273
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
338980
- class: "option-row",
339274
+ class: "sd-option-row",
338981
339275
  key: rowIndex,
338982
339276
  role: "group",
338983
339277
  ref_for: true,
@@ -338985,7 +339279,7 @@ function print() { __p += __j.call(arguments, '') }
338985
339279
  ref: rowRefs
338986
339280
  }, [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(row2, (option, optionIndex) => {
338987
339281
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
338988
- class: "option",
339282
+ class: "sd-option",
338989
339283
  key: optionIndex,
338990
339284
  "aria-label": option.label,
338991
339285
  role: "menuitem",
@@ -338995,12 +339289,12 @@ function print() { __p += __j.call(arguments, '') }
338995
339289
  onClick: exports_vue.withModifiers(($event) => handleClick$1(option), ["stop", "prevent"]),
338996
339290
  onKeydown: exports_vue.withModifiers((event) => handleKeyDown$1(event, rowIndex, optionIndex, option), ["prevent"])
338997
339291
  }, [exports_vue.createElementVNode("div", {
338998
- class: "option__icon",
339292
+ class: "sd-option__icon",
338999
339293
  innerHTML: option.icon,
339000
339294
  style: exports_vue.normalizeStyle(option.style)
339001
339295
  }, null, 12, _hoisted_2$12), isActive$1.value(option) ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339002
339296
  key: 0,
339003
- class: "option__check",
339297
+ class: "sd-option__check",
339004
339298
  innerHTML: exports_vue.unref(toolbarIcons).colorOptionCheck,
339005
339299
  style: exports_vue.normalizeStyle(getCheckStyle(option.value, optionIndex))
339006
339300
  }, null, 12, _hoisted_3$9)) : exports_vue.createCommentVNode("", true)], 40, _hoisted_1$15);
@@ -339008,7 +339302,7 @@ function print() { __p += __j.call(arguments, '') }
339008
339302
  }), 128);
339009
339303
  };
339010
339304
  }
339011
- }, [["__scopeId", "data-v-59855ce7"]]);
339305
+ }, [["__scopeId", "data-v-30cad300"]]);
339012
339306
  _hoisted_1$14 = { class: "options-grid-wrap" };
339013
339307
  _hoisted_2$11 = ["innerHTML"];
339014
339308
  _hoisted_3$8 = { class: "option-grid-ctn" };
@@ -339164,9 +339458,9 @@ function print() { __p += __j.call(arguments, '') }
339164
339458
  let itemsCols = parseInt(item.dataset.cols, 10);
339165
339459
  let itemsRows = parseInt(item.dataset.rows, 10);
339166
339460
  if (itemsCols <= cols && itemsRows <= rows)
339167
- item.classList.add("selected");
339461
+ item.classList.add("sd-selected");
339168
339462
  else
339169
- item.classList.remove("selected");
339463
+ item.classList.remove("sd-selected");
339170
339464
  }
339171
339465
  };
339172
339466
  const handleClick$1 = ({ cols, rows }) => {
@@ -339259,7 +339553,7 @@ function print() { __p += __j.call(arguments, '') }
339259
339553
  }, exports_vue.toDisplayString(selectedRows.value) + " x " + exports_vue.toDisplayString(selectedCols.value), 9, _hoisted_2$10)], 2);
339260
339554
  };
339261
339555
  }
339262
- }, [["__scopeId", "data-v-5cefb109"]]);
339556
+ }, [["__scopeId", "data-v-168b91ce"]]);
339263
339557
  _hoisted_1$12 = { class: "toolbar-table-actions" };
339264
339558
  _hoisted_2$9 = [
339265
339559
  "onClick",
@@ -339295,7 +339589,7 @@ function print() { __p += __j.call(arguments, '') }
339295
339589
  }
339296
339590
  }, [["__scopeId", "data-v-652015c8"]]);
339297
339591
  _hoisted_1$11 = { class: "search-input-ctn" };
339298
- _hoisted_2$8 = { class: "row" };
339592
+ _hoisted_2$8 = { class: "sd-row" };
339299
339593
  _hoisted_3$6 = ["onKeydown"];
339300
339594
  SearchInput_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
339301
339595
  __name: "SearchInput",
@@ -339316,13 +339610,13 @@ function print() { __p += __j.call(arguments, '') }
339316
339610
  name: "search",
339317
339611
  placeholder: "Type search string",
339318
339612
  onKeydown: exports_vue.withKeys(exports_vue.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
339319
- }, null, 40, _hoisted_3$6), [[exports_vue.vModelText, searchValue.value]])]), exports_vue.createElementVNode("div", { class: "row submit" }, [exports_vue.createElementVNode("button", {
339320
- class: "submit-btn",
339613
+ }, null, 40, _hoisted_3$6), [[exports_vue.vModelText, searchValue.value]])]), exports_vue.createElementVNode("div", { class: "sd-row sd-submit" }, [exports_vue.createElementVNode("button", {
339614
+ class: "sd-submit-btn",
339321
339615
  onClick: handleSubmit
339322
339616
  }, "Apply")])]);
339323
339617
  };
339324
339618
  }
339325
- }, [["__scopeId", "data-v-bfe34b7b"]]);
339619
+ }, [["__scopeId", "data-v-d25821a5"]]);
339326
339620
  TOOLBAR_FONTS = [
339327
339621
  {
339328
339622
  label: "Georgia",
@@ -339489,7 +339783,7 @@ function print() { __p += __j.call(arguments, '') }
339489
339783
  HEADLESS_TOOLBAR_COMMANDS = [...new Set([...Object.values(HEADLESS_ITEM_MAP), ...TABLE_ACTION_COMMAND_IDS])];
339490
339784
  NON_HEADLESS_EXECUTE_ITEM_NAMES = new Set(["link"]);
339491
339785
  HEADLESS_EXECUTE_ITEMS = new Set(Object.keys(HEADLESS_ITEM_MAP).filter((itemName) => !NON_HEADLESS_EXECUTE_ITEM_NAMES.has(itemName)));
339492
- _hoisted_1$10 = { class: "toolbar-icon" };
339786
+ _hoisted_1$10 = { class: "sd-toolbar-icon" };
339493
339787
  _hoisted_2$7 = ["innerHTML"];
339494
339788
  ToolbarButtonIcon_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
339495
339789
  __name: "ToolbarButtonIcon",
@@ -339520,7 +339814,7 @@ function print() { __p += __j.call(arguments, '') }
339520
339814
  });
339521
339815
  return (_ctx, _cache) => {
339522
339816
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_1$10, [exports_vue.createElementVNode("div", {
339523
- class: exports_vue.normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
339817
+ class: exports_vue.normalizeClass(["sd-toolbar-icon__icon", [`sd-toolbar-icon__icon--${props.name}`]]),
339524
339818
  innerHTML: __props.icon
339525
339819
  }, null, 10, _hoisted_2$7), hasColorBar.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339526
339820
  key: 0,
@@ -339529,19 +339823,19 @@ function print() { __p += __j.call(arguments, '') }
339529
339823
  }, null, 4)) : exports_vue.createCommentVNode("", true)]);
339530
339824
  };
339531
339825
  }
339532
- }, [["__scopeId", "data-v-8c30c125"]]);
339826
+ }, [["__scopeId", "data-v-521c3d93"]]);
339533
339827
  _hoisted_1$9 = ["role", "aria-label"];
339534
339828
  _hoisted_2$6 = ["data-item"];
339535
339829
  _hoisted_3$5 = ["data-item"];
339536
339830
  _hoisted_4$4 = {
339537
339831
  key: 1,
339538
- class: "button-label"
339832
+ class: "sd-button-label"
339539
339833
  };
339540
339834
  _hoisted_5$2 = ["data-item", "aria-label"];
339541
339835
  _hoisted_6$1 = ["innerHTML"];
339542
339836
  _hoisted_7$1 = {
339543
339837
  key: 1,
339544
- class: "button-label"
339838
+ class: "sd-button-label"
339545
339839
  };
339546
339840
  _hoisted_8 = { key: 2 };
339547
339841
  _hoisted_9 = ["onKeydown", "id"];
@@ -339553,7 +339847,7 @@ function print() { __p += __j.call(arguments, '') }
339553
339847
  _hoisted_11 = ["innerHTML"];
339554
339848
  _hoisted_12 = {
339555
339849
  "aria-live": "polite",
339556
- class: "visually-hidden"
339850
+ class: "sd-visually-hidden"
339557
339851
  };
339558
339852
  ToolbarButton_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
339559
339853
  __name: "ToolbarButton",
@@ -339651,17 +339945,18 @@ function print() { __p += __j.call(arguments, '') }
339651
339945
  });
339652
339946
  return (_ctx, _cache) => {
339653
339947
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339654
- class: exports_vue.normalizeClass(["toolbar-item", exports_vue.unref(attributes).className]),
339948
+ class: exports_vue.normalizeClass(["sd-toolbar-item", exports_vue.unref(attributes).className]),
339655
339949
  style: exports_vue.normalizeStyle(getStyle.value),
339656
339950
  role: __props.isOverflowItem ? "menuitem" : "button",
339657
339951
  "aria-label": exports_vue.unref(attributes).ariaLabel,
339952
+ "data-sd-part": "toolbar-item",
339658
339953
  onClick: handleOuterClick,
339659
339954
  onKeydown: _cache[3] || (_cache[3] = exports_vue.withKeys(($event) => onEnterKeydown($event), ["enter"])),
339660
339955
  tabindex: "0"
339661
339956
  }, [exports_vue.createElementVNode("div", {
339662
- class: exports_vue.normalizeClass(["toolbar-button", {
339663
- active: exports_vue.unref(active),
339664
- disabled: exports_vue.unref(disabled),
339957
+ class: exports_vue.normalizeClass(["sd-toolbar-button", {
339958
+ "sd-active": exports_vue.unref(active),
339959
+ "sd-disabled": exports_vue.unref(disabled),
339665
339960
  narrow: __props.isNarrow,
339666
339961
  wide: __props.isWide,
339667
339962
  split: isSplit.value,
@@ -339672,13 +339967,13 @@ function print() { __p += __j.call(arguments, '') }
339672
339967
  }, [
339673
339968
  isSplit.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339674
339969
  key: 0,
339675
- class: "toolbar-button__main",
339970
+ class: "sd-toolbar-button__main",
339676
339971
  "data-item": `btn-${exports_vue.unref(name) || ""}-main`,
339677
339972
  onClick: _cache[0] || (_cache[0] = ($event) => handleSplitMainClick($event))
339678
339973
  }, [exports_vue.unref(icon) ? (exports_vue.openBlock(), exports_vue.createBlock(ToolbarButtonIcon_default, {
339679
339974
  key: 0,
339680
339975
  color: exports_vue.unref(iconColor),
339681
- class: "toolbar-icon",
339976
+ class: "sd-toolbar-icon",
339682
339977
  icon: exports_vue.unref(icon),
339683
339978
  name: exports_vue.unref(name)
339684
339979
  }, null, 8, [
@@ -339688,19 +339983,19 @@ function print() { __p += __j.call(arguments, '') }
339688
339983
  ])) : exports_vue.createCommentVNode("", true), exports_vue.unref(label) && !exports_vue.unref(hideLabel) && !exports_vue.unref(inlineTextInputVisible) ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_4$4, exports_vue.toDisplayString(exports_vue.unref(label)), 1)) : exports_vue.createCommentVNode("", true)], 8, _hoisted_3$5)) : exports_vue.createCommentVNode("", true),
339689
339984
  isSplit.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339690
339985
  key: 1,
339691
- class: "toolbar-button__caret",
339986
+ class: "sd-toolbar-button__caret",
339692
339987
  "data-item": `btn-${exports_vue.unref(name) || ""}-caret`,
339693
339988
  "aria-label": `${exports_vue.unref(attributes).ariaLabel} options`,
339694
339989
  role: "button"
339695
339990
  }, [exports_vue.createElementVNode("div", {
339696
- class: "dropdown-caret",
339991
+ class: "sd-dropdown-caret",
339697
339992
  innerHTML: caretIcon.value,
339698
339993
  style: exports_vue.normalizeStyle({ opacity: exports_vue.unref(disabled) ? 0.6 : 1 })
339699
339994
  }, null, 12, _hoisted_6$1)], 8, _hoisted_5$2)) : (exports_vue.openBlock(), exports_vue.createElementBlock(exports_vue.Fragment, { key: 2 }, [
339700
339995
  exports_vue.unref(icon) ? (exports_vue.openBlock(), exports_vue.createBlock(ToolbarButtonIcon_default, {
339701
339996
  key: 0,
339702
339997
  color: exports_vue.unref(iconColor),
339703
- class: "toolbar-icon",
339998
+ class: "sd-toolbar-icon",
339704
339999
  icon: exports_vue.unref(icon),
339705
340000
  name: exports_vue.unref(name)
339706
340001
  }, null, 8, [
@@ -339733,7 +340028,7 @@ function print() { __p += __j.call(arguments, '') }
339733
340028
  }, null, 40, _hoisted_10)), [[exports_vue.vModelText, inlineTextInput.value]])])) : exports_vue.createCommentVNode("", true),
339734
340029
  exports_vue.unref(hasCaret) ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
339735
340030
  key: 3,
339736
- class: "dropdown-caret",
340031
+ class: "sd-dropdown-caret",
339737
340032
  innerHTML: caretIcon.value,
339738
340033
  style: exports_vue.normalizeStyle({ opacity: exports_vue.unref(disabled) ? 0.6 : 1 })
339739
340034
  }, null, 12, _hoisted_11)) : exports_vue.createCommentVNode("", true)
@@ -339742,7 +340037,7 @@ function print() { __p += __j.call(arguments, '') }
339742
340037
  ], 10, _hoisted_2$6)], 46, _hoisted_1$9);
339743
340038
  };
339744
340039
  }
339745
- }, [["__scopeId", "data-v-dcf6ef0b"]]);
340040
+ }, [["__scopeId", "data-v-360f6a95"]]);
339746
340041
  _hoisted_1$8 = {
339747
340042
  class: "toolbar-separator",
339748
340043
  role: "separator",
@@ -339979,11 +340274,11 @@ function print() { __p += __j.call(arguments, '') }
339979
340274
  if (!value)
339980
340275
  return false;
339981
340276
  if (typeof value === "string")
339982
- return value.split(/\s+/).includes("selected");
340277
+ return value.split(/\s+/).includes("sd-selected");
339983
340278
  if (Array.isArray(value))
339984
340279
  return value.some(classHasSelected);
339985
340280
  if (typeof value === "object")
339986
- return Boolean(value.selected);
340281
+ return Boolean(value["sd-selected"]);
339987
340282
  return false;
339988
340283
  };
339989
340284
  const isOptionSelected = (option) => {
@@ -340174,12 +340469,14 @@ function print() { __p += __j.call(arguments, '') }
340174
340469
  ref_key: "triggerRef",
340175
340470
  ref: triggerRef,
340176
340471
  class: "toolbar-dropdown-trigger",
340472
+ "data-sd-part": "dropdown-trigger",
340177
340473
  onClick: onTriggerClick
340178
340474
  }, [exports_vue.renderSlot(_ctx.$slots, "trigger", {}, undefined, true)], 512), (exports_vue.openBlock(), exports_vue.createBlock(exports_vue.Teleport, { to: "body" }, [exports_vue.createVNode(exports_vue.Transition, { name: "fade-in-scale-up-transition" }, {
340179
340475
  default: exports_vue.withCtx(() => [isOpen.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", exports_vue.mergeProps({
340180
340476
  key: 0,
340181
340477
  ref_key: "menuRef",
340182
340478
  ref: menuRef,
340479
+ "data-sd-part": "dropdown-menu",
340183
340480
  class: mergedMenuClass.value,
340184
340481
  style: menuStyle.value
340185
340482
  }, computedMenuAttrs.value), [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(__props.options, (option, index2) => {
@@ -340191,8 +340488,8 @@ function print() { __p += __j.call(arguments, '') }
340191
340488
  option.class,
340192
340489
  option.props?.class,
340193
340490
  {
340194
- disabled: option.disabled,
340195
- render: isRenderOption(option)
340491
+ "sd-disabled": option.disabled,
340492
+ "sd-render": isRenderOption(option)
340196
340493
  }
340197
340494
  ]],
340198
340495
  tabindex: "-1",
@@ -340209,7 +340506,7 @@ function print() { __p += __j.call(arguments, '') }
340209
340506
  })]))]);
340210
340507
  };
340211
340508
  }
340212
- }, [["__scopeId", "data-v-261e2a66"]]);
340509
+ }, [["__scopeId", "data-v-302f7d86"]]);
340213
340510
  SdTooltip_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
340214
340511
  __name: "SdTooltip",
340215
340512
  props: {
@@ -340560,7 +340857,7 @@ function print() { __p += __j.call(arguments, '') }
340560
340857
  ...option,
340561
340858
  props: {
340562
340859
  ...option.props,
340563
- class: isSelected ? "selected" : ""
340860
+ class: isSelected ? "sd-selected" : ""
340564
340861
  }
340565
340862
  };
340566
340863
  });
@@ -340573,7 +340870,7 @@ function print() { __p += __j.call(arguments, '') }
340573
340870
  };
340574
340871
  const moveToNextButton = (e) => {
340575
340872
  const currentButton = e.target;
340576
- const nextButton = e.target.closest(".toolbar-item-ctn").nextElementSibling;
340873
+ const nextButton = e.target.closest(".sd-toolbar-item-ctn").nextElementSibling;
340577
340874
  if (nextButton) {
340578
340875
  currentButton.setAttribute("tabindex", "-1");
340579
340876
  nextButton.setAttribute("tabindex", "0");
@@ -340582,7 +340879,7 @@ function print() { __p += __j.call(arguments, '') }
340582
340879
  };
340583
340880
  const moveToPreviousButton = (e) => {
340584
340881
  const currentButton = e.target;
340585
- const previousButton = e.target.closest(".toolbar-item-ctn").previousElementSibling;
340882
+ const previousButton = e.target.closest(".sd-toolbar-item-ctn").previousElementSibling;
340586
340883
  if (previousButton) {
340587
340884
  currentButton.setAttribute("tabindex", "-1");
340588
340885
  previousButton.setAttribute("tabindex", "0");
@@ -340660,7 +340957,7 @@ function print() { __p += __j.call(arguments, '') }
340660
340957
  }
340661
340958
  };
340662
340959
  const handleFocus = (e) => {
340663
- const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("disabled"));
340960
+ const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("sd-disabled"));
340664
340961
  if (firstButton) {
340665
340962
  firstButton.setAttribute("tabindex", "0");
340666
340963
  firstButton.focus();
@@ -340716,8 +341013,8 @@ function print() { __p += __j.call(arguments, '') }
340716
341013
  class: exports_vue.normalizeClass([{
340717
341014
  narrow: item.isNarrow.value,
340718
341015
  wide: item.isWide.value,
340719
- disabled: item.disabled.value
340720
- }, "toolbar-item-ctn"]),
341016
+ "sd-disabled": item.disabled.value
341017
+ }, "sd-toolbar-item-ctn"]),
340721
341018
  onKeydown: (e) => handleKeyDown$1(e, item),
340722
341019
  ref_for: true,
340723
341020
  ref_key: "toolbarItemRefs",
@@ -340736,7 +341033,7 @@ function print() { __p += __j.call(arguments, '') }
340736
341033
  show: getExpanded(item),
340737
341034
  "content-style": { fontFamily: props.uiFontFamily },
340738
341035
  placement: "bottom-start",
340739
- class: "toolbar-button sd-editor-toolbar-dropdown",
341036
+ class: "sd-toolbar-button sd-editor-toolbar-dropdown",
340740
341037
  onSelect: (key2, option) => handleSelect(item, option),
340741
341038
  "onUpdate:show": (open2) => handleDropdownUpdateShowForItem(open2, item),
340742
341039
  style: exports_vue.normalizeStyle(item.dropdownStyles.value),
@@ -340813,7 +341110,7 @@ function print() { __p += __j.call(arguments, '') }
340813
341110
  }), 128))], 36);
340814
341111
  };
340815
341112
  }
340816
- }, [["__scopeId", "data-v-109576cd"]]);
341113
+ }, [["__scopeId", "data-v-9c3524ec"]]);
340817
341114
  Toolbar_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
340818
341115
  __name: "Toolbar",
340819
341116
  emits: [
@@ -340907,6 +341204,7 @@ function print() { __p += __j.call(arguments, '') }
340907
341204
  key: exports_vue.unref(toolbarKey),
340908
341205
  role: "toolbar",
340909
341206
  "aria-label": "Toolbar",
341207
+ "data-sd-part": "toolbar",
340910
341208
  "data-editor-ui-surface": "",
340911
341209
  onMousedown: handleToolbarMousedown
340912
341210
  }, [
@@ -340958,7 +341256,7 @@ function print() { __p += __j.call(arguments, '') }
340958
341256
  ], 32);
340959
341257
  };
340960
341258
  }
340961
- }, [["__scopeId", "data-v-bae4cd8a"]]);
341259
+ }, [["__scopeId", "data-v-b83d488a"]]);
340962
341260
  toolbarTexts = {
340963
341261
  bold: "Bold",
340964
341262
  fontFamily: "Font",
@@ -341047,7 +341345,8 @@ function print() { __p += __j.call(arguments, '') }
341047
341345
  aiApiKey: null,
341048
341346
  aiEndpoint: null,
341049
341347
  customButtons: [],
341050
- showFormattingMarksButton: false
341348
+ showFormattingMarksButton: false,
341349
+ showTableOfContentsButton: false
341051
341350
  };
341052
341351
  toolbarItems = [];
341053
341352
  overflowItems = [];
@@ -347073,6 +347372,7 @@ function print() { __p += __j.call(arguments, '') }
347073
347372
  #isRerendering = false;
347074
347373
  #selectionSync = new SelectionSyncCoordinator;
347075
347374
  #shouldScrollSelectionIntoView = false;
347375
+ #suppressSelectionScrollUntilRaf = false;
347076
347376
  #dragDropIndicatorPos = null;
347077
347377
  #epochMapper = new EpochPositionMapper;
347078
347378
  #layoutEpoch = 0;
@@ -348745,6 +349045,19 @@ function print() { __p += __j.call(arguments, '') }
348745
349045
  }
348746
349046
  return null;
348747
349047
  }
349048
+ #isElementFullyVisibleInScrollContainer(el) {
349049
+ const rect = el.getBoundingClientRect();
349050
+ const viewport$1 = this.#scrollContainer instanceof Window ? {
349051
+ top: 0,
349052
+ bottom: this.#scrollContainer.innerHeight
349053
+ } : this.#scrollContainer instanceof Element ? this.#scrollContainer.getBoundingClientRect() : this.#visibleHost?.ownerDocument?.defaultView ? {
349054
+ top: 0,
349055
+ bottom: this.#visibleHost.ownerDocument.defaultView.innerHeight
349056
+ } : null;
349057
+ if (!viewport$1)
349058
+ return false;
349059
+ return rect.top >= viewport$1.top && rect.bottom <= viewport$1.bottom;
349060
+ }
348748
349061
  scrollToPosition(pos, options = {}) {
348749
349062
  if (this.#focusScrollRafId != null) {
348750
349063
  const win = this.#visibleHost.ownerDocument?.defaultView;
@@ -348759,7 +349072,7 @@ function print() { __p += __j.call(arguments, '') }
348759
349072
  return false;
348760
349073
  const clampedPos = Math.max(0, Math.min(pos, doc$12.content.size));
348761
349074
  const behavior = options.behavior ?? "auto";
348762
- const block = options.block ?? "center";
349075
+ const requestedBlock = options.block ?? "center";
348763
349076
  const layout = this.#layoutState.layout;
348764
349077
  const sessionMode = this.#headerFooterSession?.session?.mode ?? "body";
348765
349078
  if (layout && sessionMode === "body") {
@@ -348779,7 +349092,9 @@ function print() { __p += __j.call(arguments, '') }
348779
349092
  if (pageIndex != null) {
348780
349093
  const pageEl = getPageElementByIndex(this.#viewportHost, pageIndex);
348781
349094
  if (pageEl) {
348782
- const elToScroll = this.#findElementAtPosition(pageEl, clampedPos) ?? pageEl;
349095
+ const targetEl = this.#findElementAtPosition(pageEl, clampedPos);
349096
+ const elToScroll = targetEl ?? pageEl;
349097
+ const block = options.ifNeeded && targetEl && this.#isElementFullyVisibleInScrollContainer(targetEl) ? "nearest" : requestedBlock;
348783
349098
  elToScroll.scrollIntoView({
348784
349099
  block,
348785
349100
  inline: "nearest",
@@ -348787,7 +349102,9 @@ function print() { __p += __j.call(arguments, '') }
348787
349102
  });
348788
349103
  this.#shouldScrollSelectionIntoView = false;
348789
349104
  const win = this.#visibleHost.ownerDocument?.defaultView;
348790
- if (win)
349105
+ if (win) {
349106
+ if (options.suppressSelectionSyncScroll)
349107
+ this.#suppressSelectionScrollUntilRaf = true;
348791
349108
  win.requestAnimationFrame(() => {
348792
349109
  elToScroll.scrollIntoView({
348793
349110
  block,
@@ -348795,7 +349112,9 @@ function print() { __p += __j.call(arguments, '') }
348795
349112
  behavior
348796
349113
  });
348797
349114
  this.#shouldScrollSelectionIntoView = false;
349115
+ this.#suppressSelectionScrollUntilRaf = false;
348798
349116
  });
349117
+ }
348799
349118
  return true;
348800
349119
  }
348801
349120
  }
@@ -348929,12 +349248,24 @@ function print() { __p += __j.call(arguments, '') }
348929
349248
  console.warn(`[PresentationEditor] scrollToPositionAsync: Page ${pageIndex} failed to mount within timeout`);
348930
349249
  return false;
348931
349250
  }
348932
- return this.scrollToPosition(pos, options);
349251
+ return this.scrollToPosition(pos, {
349252
+ ...options,
349253
+ ifNeeded: false
349254
+ });
348933
349255
  }
348934
349256
  async scrollContentControlIntoView(entityId, options = {}) {
349257
+ const pos = this.#resolveContentControlCaretPos(entityId);
349258
+ if (pos == null)
349259
+ return false;
349260
+ return this.scrollToPositionAsync(pos, {
349261
+ behavior: options.behavior ?? "smooth",
349262
+ block: options.block ?? "center"
349263
+ });
349264
+ }
349265
+ #resolveContentControlCaretPos(entityId) {
348935
349266
  const editor = this.#editor;
348936
349267
  if (!editor || typeof entityId !== "string" || entityId.length === 0)
348937
- return false;
349268
+ return null;
348938
349269
  let found2 = null;
348939
349270
  editor.state.doc.descendants((node3, pos) => {
348940
349271
  if (found2)
@@ -348950,7 +349281,7 @@ function print() { __p += __j.call(arguments, '') }
348950
349281
  return true;
348951
349282
  });
348952
349283
  if (!found2)
348953
- return false;
349284
+ return null;
348954
349285
  let contentPos = found2.pos + 1;
348955
349286
  let textFound = false;
348956
349287
  found2.node?.descendants((child, rel) => {
@@ -348963,10 +349294,48 @@ function print() { __p += __j.call(arguments, '') }
348963
349294
  }
348964
349295
  return true;
348965
349296
  });
348966
- return this.scrollToPositionAsync(contentPos, {
349297
+ return contentPos;
349298
+ }
349299
+ async focusContentControl(entityId, options = {}) {
349300
+ const editor = this.#editor;
349301
+ if (!editor)
349302
+ return {
349303
+ success: false,
349304
+ reason: "not-ready"
349305
+ };
349306
+ if (typeof entityId !== "string" || entityId.length === 0)
349307
+ return {
349308
+ success: false,
349309
+ reason: "invalid-id"
349310
+ };
349311
+ const pos = this.#resolveContentControlCaretPos(entityId);
349312
+ if (pos == null)
349313
+ return {
349314
+ success: false,
349315
+ reason: "not-found"
349316
+ };
349317
+ if (typeof editor.commands?.setTextSelection !== "function")
349318
+ return {
349319
+ success: false,
349320
+ reason: "not-ready"
349321
+ };
349322
+ if (!await this.scrollToPositionAsync(pos, {
348967
349323
  behavior: options.behavior ?? "smooth",
348968
349324
  block: options.block ?? "center"
348969
- });
349325
+ }))
349326
+ return {
349327
+ success: false,
349328
+ reason: "not-reachable"
349329
+ };
349330
+ if (!editor.commands.setTextSelection({
349331
+ from: pos,
349332
+ to: pos
349333
+ }))
349334
+ return {
349335
+ success: false,
349336
+ reason: "not-reachable"
349337
+ };
349338
+ return { success: true };
348970
349339
  }
348971
349340
  async scrollToPage(pageNumber, scrollBehavior = "smooth") {
348972
349341
  const layout = this.#layoutState.layout;
@@ -351156,6 +351525,8 @@ function print() { __p += __j.call(arguments, '') }
351156
351525
  }
351157
351526
  }
351158
351527
  #scrollActiveEndIntoView(pageIndex) {
351528
+ if (this.#suppressSelectionScrollUntilRaf)
351529
+ return;
351159
351530
  if (!!!this.#painterHost.querySelector(`[data-page-index="${pageIndex}"]`)) {
351160
351531
  this.#scrollPageIntoView(pageIndex);
351161
351532
  return;
@@ -353282,11 +353653,11 @@ function print() { __p += __j.call(arguments, '') }
353282
353653
  ]);
353283
353654
  });
353284
353655
 
353285
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-VNl09TSQ.es.js
353656
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BKVodoDg.es.js
353286
353657
  var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
353287
- var init_create_super_doc_ui_VNl09TSQ_es = __esm(() => {
353288
- init_SuperConverter_C6hKp29w_es();
353289
- init_create_headless_toolbar_ISx0N5AS_es();
353658
+ var init_create_super_doc_ui_BKVodoDg_es = __esm(() => {
353659
+ init_SuperConverter_DHtZjY65_es();
353660
+ init_create_headless_toolbar_lxRAue2X_es();
353290
353661
  MOD_ALIASES = new Set([
353291
353662
  "Mod",
353292
353663
  "Meta",
@@ -353328,16 +353699,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
353328
353699
 
353329
353700
  // ../../packages/superdoc/dist/super-editor.es.js
353330
353701
  var init_super_editor_es = __esm(() => {
353331
- init_src_DQ_lu_9z_es();
353332
- init_SuperConverter_C6hKp29w_es();
353702
+ init_src_BlbgbalI_es();
353703
+ init_SuperConverter_DHtZjY65_es();
353333
353704
  init_jszip_C49i9kUs_es();
353334
353705
  init_xml_js_CqGKpaft_es();
353335
- init_create_headless_toolbar_ISx0N5AS_es();
353706
+ init_create_headless_toolbar_lxRAue2X_es();
353336
353707
  init_constants_D_X7xF4s_es();
353337
353708
  init_dist_B8HfvhaK_es();
353338
353709
  init_unified_Dsuw2be5_es();
353339
353710
  init_DocxZipper_nv_KfOqb_es();
353340
- init_create_super_doc_ui_VNl09TSQ_es();
353711
+ init_create_super_doc_ui_BKVodoDg_es();
353341
353712
  init_ui_C5PAS9hY_es();
353342
353713
  init_eventemitter3_BnGqBE_Q_es();
353343
353714
  init_errors_CNaD6vcg_es();