@superdoc-dev/mcp 0.10.0 → 0.11.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +860 -388
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -14569,7 +14569,7 @@ function finalize(ctx, schema) {
14569
14569
  result.$schema = "http://json-schema.org/draft-07/schema#";
14570
14570
  } else if (ctx.target === "draft-04") {
14571
14571
  result.$schema = "http://json-schema.org/draft-04/schema#";
14572
- } else if (ctx.target === "openapi-3.0") {} else {}
14572
+ } else if (ctx.target === "openapi-3.0") {}
14573
14573
  if (ctx.external?.uri) {
14574
14574
  const id = ctx.external.registry.get(schema)?.id;
14575
14575
  if (!id)
@@ -14834,7 +14834,7 @@ var formatMap, stringProcessor = (schema, ctx, _json, _params) => {
14834
14834
  if (val === undefined) {
14835
14835
  if (ctx.unrepresentable === "throw") {
14836
14836
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
14837
- } else {}
14837
+ }
14838
14838
  } else if (typeof val === "bigint") {
14839
14839
  if (ctx.unrepresentable === "throw") {
14840
14840
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -52208,7 +52208,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
52208
52208
  emptyOptions2 = {};
52209
52209
  });
52210
52210
 
52211
- // ../../packages/superdoc/dist/chunks/SuperConverter-C6hKp29w.es.js
52211
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DHtZjY65.es.js
52212
52212
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
52213
52213
  const fieldValue = extension$1.config[field];
52214
52214
  if (typeof fieldValue === "function")
@@ -82365,7 +82365,33 @@ function importCommentData({ docx, editor, converter }) {
82365
82365
  function isReplacementPair(previous$1, current) {
82366
82366
  return previous$1.type !== current.type && previous$1.author === current.author && previous$1.date === current.date;
82367
82367
  }
82368
- function assignInternalId(element, idMap, context, insideTrackedChange) {
82368
+ function trackedChangeEntryFromElement(element) {
82369
+ return {
82370
+ type: element.name,
82371
+ author: element.attributes?.["w:author"] ?? "",
82372
+ date: element.attributes?.["w:date"] ?? ""
82373
+ };
82374
+ }
82375
+ function findNextSiblingTrackedChange(elements, startIndex) {
82376
+ if (!Array.isArray(elements))
82377
+ return null;
82378
+ for (let i$1 = startIndex;i$1 < elements.length; i$1 += 1) {
82379
+ const element = elements[i$1];
82380
+ if (TRACKED_CHANGE_NAMES.has(element?.name))
82381
+ return trackedChangeEntryFromElement(element);
82382
+ if (!PAIRING_TRANSPARENT_NAMES.has(element?.name))
82383
+ return null;
82384
+ }
82385
+ return null;
82386
+ }
82387
+ function isChildReplacementInsideDeletion(beforePrevious, previous$1, current, next) {
82388
+ if (!isReplacementPair(previous$1, current))
82389
+ return false;
82390
+ const touchesDifferentAuthorDeletionBefore = beforePrevious?.type === "w:del" && beforePrevious.author !== previous$1.author;
82391
+ const touchesDifferentAuthorDeletionAfter = next?.type === "w:del" && next.author !== previous$1.author;
82392
+ return touchesDifferentAuthorDeletionBefore || touchesDifferentAuthorDeletionAfter;
82393
+ }
82394
+ function assignInternalId(element, idMap, context, insideTrackedChange, nextTrackedChange = null) {
82369
82395
  const wordId = String(element.attributes?.["w:id"] ?? "");
82370
82396
  if (!wordId)
82371
82397
  return;
@@ -82374,18 +82400,18 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
82374
82400
  idMap.set(wordId, v4_default());
82375
82401
  return;
82376
82402
  }
82377
- const current = {
82378
- type: element.name,
82379
- author: element.attributes?.["w:author"] ?? "",
82380
- date: element.attributes?.["w:date"] ?? ""
82381
- };
82382
- if (context.replacements === "paired" && context.lastTrackedChange && isReplacementPair(context.lastTrackedChange, current)) {
82403
+ const current = trackedChangeEntryFromElement(element);
82404
+ const shouldPair = context.replacements === "paired";
82405
+ const shouldKeepChildSides = context.lastTrackedChange && isChildReplacementInsideDeletion(context.beforeLastTrackedChange, context.lastTrackedChange, current, nextTrackedChange);
82406
+ if (shouldPair && context.lastTrackedChange && !shouldKeepChildSides && isReplacementPair(context.lastTrackedChange, current)) {
82383
82407
  if (!idMap.has(wordId))
82384
82408
  idMap.set(wordId, context.lastTrackedChange.internalId);
82385
82409
  context.lastTrackedChange = null;
82410
+ context.beforeLastTrackedChange = null;
82386
82411
  } else {
82387
82412
  const internalId = idMap.get(wordId) ?? v4_default();
82388
82413
  idMap.set(wordId, internalId);
82414
+ context.beforeLastTrackedChange = context.lastTrackedChange;
82389
82415
  context.lastTrackedChange = {
82390
82416
  ...current,
82391
82417
  internalId
@@ -82395,20 +82421,25 @@ function assignInternalId(element, idMap, context, insideTrackedChange) {
82395
82421
  function walkElements(elements, idMap, context, insideTrackedChange = false) {
82396
82422
  if (!Array.isArray(elements))
82397
82423
  return;
82398
- for (const element of elements)
82424
+ for (let index2 = 0;index2 < elements.length; index2 += 1) {
82425
+ const element = elements[index2];
82399
82426
  if (TRACKED_CHANGE_NAMES.has(element.name)) {
82400
- assignInternalId(element, idMap, context, insideTrackedChange);
82427
+ assignInternalId(element, idMap, context, insideTrackedChange, findNextSiblingTrackedChange(elements, index2 + 1));
82401
82428
  if (element.elements)
82402
82429
  walkElements(element.elements, idMap, {
82430
+ beforeLastTrackedChange: null,
82403
82431
  lastTrackedChange: null,
82404
82432
  replacements: context.replacements
82405
82433
  }, true);
82406
82434
  } else {
82407
- if (!PAIRING_TRANSPARENT_NAMES.has(element.name))
82435
+ if (!PAIRING_TRANSPARENT_NAMES.has(element.name)) {
82408
82436
  context.lastTrackedChange = null;
82437
+ context.beforeLastTrackedChange = null;
82438
+ }
82409
82439
  if (element.elements)
82410
82440
  walkElements(element.elements, idMap, context, insideTrackedChange);
82411
82441
  }
82442
+ }
82412
82443
  }
82413
82444
  function buildTrackedChangeIdMapForPart(part, options = {}) {
82414
82445
  const root2 = part?.elements?.[0];
@@ -82417,6 +82448,7 @@ function buildTrackedChangeIdMapForPart(part, options = {}) {
82417
82448
  const replacements = options.replacements === "independent" ? "independent" : "paired";
82418
82449
  const idMap = /* @__PURE__ */ new Map;
82419
82450
  walkElements(root2.elements, idMap, {
82451
+ beforeLastTrackedChange: null,
82420
82452
  lastTrackedChange: null,
82421
82453
  replacements
82422
82454
  });
@@ -85949,12 +85981,21 @@ function getInlineIndex(editor) {
85949
85981
  function clearIndexCache(editor) {
85950
85982
  cacheByEditor.delete(editor);
85951
85983
  }
85984
+ function isVisibleTextModel(options) {
85985
+ return options?.textModel === "visible";
85986
+ }
85987
+ function hasTrackDeleteMark(node2) {
85988
+ return node2.marks?.some((mark) => mark.type.name === "trackDelete") ?? false;
85989
+ }
85990
+ function shouldSkipTextNode(node2, options) {
85991
+ return isVisibleTextModel(options) && hasTrackDeleteMark(node2);
85992
+ }
85952
85993
  function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
85953
85994
  if (segmentLength <= 1)
85954
85995
  return targetOffset <= segmentStart ? docFrom : docTo;
85955
85996
  return docFrom + (targetOffset - segmentStart);
85956
85997
  }
85957
- function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
85998
+ function pmPositionToTextOffset(blockNode, blockPos, pmPos, options) {
85958
85999
  const contentStart = blockPos + 1;
85959
86000
  if (pmPos <= contentStart)
85960
86001
  return 0;
@@ -85965,7 +86006,13 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
85965
86006
  return;
85966
86007
  if (node2.isText) {
85967
86008
  const text$2 = node2.text ?? "";
85968
- if (pmPos >= docPos + text$2.length)
86009
+ const endPos = docPos + text$2.length;
86010
+ if (shouldSkipTextNode(node2, options)) {
86011
+ if (pmPos < endPos)
86012
+ done = true;
86013
+ return;
86014
+ }
86015
+ if (pmPos >= endPos)
85969
86016
  offset += text$2.length;
85970
86017
  else {
85971
86018
  offset += Math.max(0, pmPos - docPos);
@@ -86005,10 +86052,12 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
86005
86052
  visitContent(blockNode, contentStart);
86006
86053
  return offset;
86007
86054
  }
86008
- function computeTextContentLength(blockNode) {
86055
+ function computeTextContentLength(blockNode, options) {
86009
86056
  let length = 0;
86010
86057
  const walk = (node2) => {
86011
86058
  if (node2.isText) {
86059
+ if (shouldSkipTextNode(node2, options))
86060
+ return;
86012
86061
  length += (node2.text ?? "").length;
86013
86062
  return;
86014
86063
  }
@@ -86035,7 +86084,7 @@ function computeTextContentLength(blockNode) {
86035
86084
  }
86036
86085
  return length;
86037
86086
  }
86038
- function resolveTextRangeInBlock(blockNode, blockPos, range) {
86087
+ function resolveTextRangeInBlock(blockNode, blockPos, range, options) {
86039
86088
  if (range.start < 0 || range.end < range.start)
86040
86089
  return null;
86041
86090
  let offset = 0;
@@ -86067,7 +86116,7 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
86067
86116
  const walkNode$1 = (node2, docPos) => {
86068
86117
  if (node2.isText) {
86069
86118
  const text$2 = node2.text ?? "";
86070
- if (text$2.length > 0)
86119
+ if (text$2.length > 0 && !shouldSkipTextNode(node2, options))
86071
86120
  advanceSegment(text$2.length, docPos, docPos + text$2.length);
86072
86121
  return;
86073
86122
  }
@@ -86094,6 +86143,39 @@ function resolveTextRangeInBlock(blockNode, blockPos, range) {
86094
86143
  to: toPos
86095
86144
  };
86096
86145
  }
86146
+ function textContentInBlock(blockNode, options) {
86147
+ let text$2 = "";
86148
+ const walkNode$1 = (node2) => {
86149
+ if (node2.isText) {
86150
+ if (!shouldSkipTextNode(node2, options))
86151
+ text$2 += node2.text ?? "";
86152
+ return;
86153
+ }
86154
+ if (node2.isLeaf) {
86155
+ text$2 += "";
86156
+ return;
86157
+ }
86158
+ let isFirstChild$1 = true;
86159
+ for (let i$1 = 0;i$1 < node2.childCount; i$1++) {
86160
+ const child = node2.child(i$1);
86161
+ if (child.isBlock && !isFirstChild$1)
86162
+ text$2 += `
86163
+ `;
86164
+ walkNode$1(child);
86165
+ isFirstChild$1 = false;
86166
+ }
86167
+ };
86168
+ let isFirstChild = true;
86169
+ for (let i$1 = 0;i$1 < blockNode.childCount; i$1++) {
86170
+ const child = blockNode.child(i$1);
86171
+ if (child.isBlock && !isFirstChild)
86172
+ text$2 += `
86173
+ `;
86174
+ walkNode$1(child);
86175
+ isFirstChild = false;
86176
+ }
86177
+ return text$2;
86178
+ }
86097
86179
  function buildTextWithTabs(schema, text$2, marks, opts = {}) {
86098
86180
  if (!text$2.includes("\t"))
86099
86181
  return schema.text(text$2, marks);
@@ -86117,7 +86199,7 @@ function parentAllowsNodeAt(tr, absPos, nodeType) {
86117
86199
  return true;
86118
86200
  return contentMatch.matchType(nodeType) != null;
86119
86201
  }
86120
- function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback) {
86202
+ function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback, options = {}) {
86121
86203
  const anyDoc = doc$2;
86122
86204
  if (typeof anyDoc.nodesBetween !== "function") {
86123
86205
  if (typeof anyDoc.textBetween === "function")
@@ -86138,6 +86220,8 @@ function textBetweenWithTabs(doc$2, from2, to, blockSeparator, leafFallback) {
86138
86220
  return false;
86139
86221
  }
86140
86222
  if (node2.isText) {
86223
+ if (options.textModel === "visible" && node2.marks?.some((mark) => mark.type.name === "trackDelete"))
86224
+ return false;
86141
86225
  const start = Math.max(from2, pos) - pos;
86142
86226
  const end = Math.min(to, pos + node2.nodeSize) - pos;
86143
86227
  const text$2 = typeof node2.text === "string" ? node2.text : "".repeat(node2.nodeSize);
@@ -86206,7 +86290,7 @@ function resolveTextTarget(editor, target) {
86206
86290
  const block = matches$1[0];
86207
86291
  if (!block)
86208
86292
  return null;
86209
- return resolveTextRangeInBlock(block.node, block.pos, target.range);
86293
+ return resolveTextRangeInBlock(block.node, block.pos, target.range, { textModel: "visible" });
86210
86294
  }
86211
86295
  function resolveInlineInsertPosition(editor, at, operationName) {
86212
86296
  const firstSegment = at.segments[0];
@@ -86245,11 +86329,11 @@ function resolveDefaultInsertTarget(editor) {
86245
86329
  for (let i$1 = index2.candidates.length - 1;i$1 >= 0; i$1--) {
86246
86330
  const candidate = index2.candidates[i$1];
86247
86331
  if (topLevelPositions.has(candidate.pos) && isTextBlockCandidate(candidate)) {
86248
- const textLength = computeTextContentLength(candidate.node);
86332
+ const textLength = computeTextContentLength(candidate.node, { textModel: "visible" });
86249
86333
  const range = resolveTextRangeInBlock(candidate.node, candidate.pos, {
86250
86334
  start: textLength,
86251
86335
  end: textLength
86252
- });
86336
+ }, { textModel: "visible" });
86253
86337
  if (!range)
86254
86338
  continue;
86255
86339
  return {
@@ -89210,7 +89294,7 @@ function getTextAdapter(editor, input) {
89210
89294
  const doc$2 = resolveStoryRuntime(editor, input.in).editor.state.doc;
89211
89295
  return textBetweenWithTabs(doc$2, 0, doc$2.content.size, `
89212
89296
  `, `
89213
- `);
89297
+ `, { textModel: "visible" });
89214
89298
  }
89215
89299
  function getRawTrackedMarks(editor) {
89216
89300
  try {
@@ -107929,7 +108013,7 @@ var isRegExp = (value) => {
107929
108013
  if (id)
107930
108014
  return trackedChanges.filter(({ mark }) => mark.attrs.id === id);
107931
108015
  return trackedChanges;
107932
- }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, 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 }) => {
108016
+ }, groupedCache, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", SDT_INLINE_NAME = "structuredContent", SDT_NODE_TYPES, VALID_CONTROL_TYPES, VALID_LOCK_MODES, 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 }) => {
107933
108017
  if (!runProps?.elements?.length || !state)
107934
108018
  return;
107935
108019
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -107963,7 +108047,7 @@ var isRegExp = (value) => {
107963
108047
  state.kern = kernNode.attributes["w:val"];
107964
108048
  }
107965
108049
  }, SuperConverter;
107966
- var init_SuperConverter_C6hKp29w_es = __esm(() => {
108050
+ var init_SuperConverter_DHtZjY65_es = __esm(() => {
107967
108051
  init_rolldown_runtime_Bg48TavK_es();
107968
108052
  init_jszip_C49i9kUs_es();
107969
108053
  init_xml_js_CqGKpaft_es();
@@ -146279,7 +146363,7 @@ var init_SuperConverter_C6hKp29w_es = __esm(() => {
146279
146363
  };
146280
146364
  });
146281
146365
 
146282
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-ISx0N5AS.es.js
146366
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-lxRAue2X.es.js
146283
146367
  function parseSizeUnit(val = "0") {
146284
146368
  const length = val.toString() || "0";
146285
146369
  const value = Number.parseFloat(length);
@@ -147414,7 +147498,7 @@ function applyDirectiveToMarks(marks, markKey2, directive, markType) {
147414
147498
  return otherMarks;
147415
147499
  }
147416
147500
  }
147417
- function captureRunsInRange(editor, blockPos, from2, to) {
147501
+ function captureRunsInRange(editor, blockPos, from2, to, options) {
147418
147502
  const blockNode = editor.state.doc.nodeAt(blockPos);
147419
147503
  if (!blockNode || from2 < 0 || to < from2 || from2 === to)
147420
147504
  return {
@@ -147439,9 +147523,12 @@ function captureRunsInRange(editor, blockPos, from2, to) {
147439
147523
  if (node2.isText) {
147440
147524
  const text4 = node2.text ?? "";
147441
147525
  if (text4.length > 0) {
147526
+ const marks = Array.isArray(node2.marks) ? node2.marks : [];
147527
+ if (options?.textModel === "visible" && marks.some((mark) => mark.type.name === "trackDelete"))
147528
+ return;
147442
147529
  const start = offset;
147443
147530
  const end = offset + text4.length;
147444
- maybePushRun(start, end, Array.isArray(node2.marks) ? node2.marks : []);
147531
+ maybePushRun(start, end, marks);
147445
147532
  offset = end;
147446
147533
  }
147447
147534
  return;
@@ -147722,6 +147809,12 @@ function applySetMarksToResolved(editor, existingMarks, setMarks) {
147722
147809
  }
147723
147810
  return marks;
147724
147811
  }
147812
+ function getCandidateText(editor, candidate, options) {
147813
+ if (candidate.node.childCount > 0)
147814
+ return textContentInBlock(candidate.node, options);
147815
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
147816
+ `, "");
147817
+ }
147725
147818
  function resolveUnknownBlockId(attrs) {
147726
147819
  if (!attrs)
147727
147820
  return;
@@ -147735,7 +147828,38 @@ function getAddressStartPos(editor, index2, address) {
147735
147828
  return findBlockById(index2, address)?.pos ?? Number.MAX_SAFE_INTEGER;
147736
147829
  return findInlineByAnchor(getInlineIndex(editor), address)?.pos ?? Number.MAX_SAFE_INTEGER;
147737
147830
  }
147738
- function buildTextContext(editor, address, matchFrom, matchTo, textRanges) {
147831
+ function buildTextContext(editor, address, matchFrom, matchTo, textRanges, options) {
147832
+ if (textRanges?.length) {
147833
+ const index2 = getBlockIndex(editor);
147834
+ const firstRange = textRanges[0];
147835
+ const lastRange = textRanges[textRanges.length - 1];
147836
+ const firstBlock = index2.candidates.find((candidate) => candidate.nodeId === firstRange.blockId);
147837
+ const lastBlock = index2.candidates.find((candidate) => candidate.nodeId === lastRange.blockId);
147838
+ if (firstBlock && lastBlock) {
147839
+ const matchText = textRanges.map((range) => {
147840
+ const block = index2.candidates.find((candidate) => candidate.nodeId === range.blockId);
147841
+ if (!block)
147842
+ return "";
147843
+ return getCandidateText(editor, block, options).slice(range.range.start, range.range.end);
147844
+ }).join(`
147845
+ `);
147846
+ const firstText = getCandidateText(editor, firstBlock, options);
147847
+ const lastText = getCandidateText(editor, lastBlock, options);
147848
+ const leftContext = firstText.slice(Math.max(0, firstRange.range.start - SNIPPET_PADDING), firstRange.range.start);
147849
+ const snippet$1 = `${leftContext}${matchText}${lastText.slice(lastRange.range.end, lastRange.range.end + SNIPPET_PADDING)}`.replace(/ {2,}/g, " ");
147850
+ const prefix$1 = leftContext.replace(/ {2,}/g, " ");
147851
+ const normalizedMatch = matchText.replace(/ {2,}/g, " ");
147852
+ return {
147853
+ address,
147854
+ snippet: snippet$1,
147855
+ highlightRange: {
147856
+ start: prefix$1.length,
147857
+ end: prefix$1.length + normalizedMatch.length
147858
+ },
147859
+ textRanges
147860
+ };
147861
+ }
147862
+ }
147739
147863
  const docSize = editor.state.doc.content.size;
147740
147864
  const snippetFrom = Math.max(0, matchFrom - SNIPPET_PADDING);
147741
147865
  const snippetTo = Math.min(docSize, matchTo + SNIPPET_PADDING);
@@ -147754,14 +147878,14 @@ function buildTextContext(editor, address, matchFrom, matchTo, textRanges) {
147754
147878
  textRanges: textRanges?.length ? textRanges : undefined
147755
147879
  };
147756
147880
  }
147757
- function toTextAddress$1(editor, block, range) {
147881
+ function toTextAddress$1(editor, block, range, options) {
147758
147882
  const blockStart = block.pos + 1;
147759
147883
  const blockEnd = block.end - 1;
147760
147884
  if (range.from < blockStart || range.to > blockEnd)
147761
147885
  return;
147762
- const start = editor.state.doc.textBetween(blockStart, range.from, `
147886
+ const start = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.from, options) : editor.state.doc.textBetween(blockStart, range.from, `
147763
147887
  `, "").length;
147764
- const end = editor.state.doc.textBetween(blockStart, range.to, `
147888
+ const end = block.node.childCount > 0 ? pmPositionToTextOffset(block.node, block.pos, range.to, options) : editor.state.doc.textBetween(blockStart, range.to, `
147765
147889
  `, "").length;
147766
147890
  return {
147767
147891
  kind: "text",
@@ -147840,7 +147964,7 @@ function buildSearchPattern(selector, diagnostics) {
147840
147964
  const flags = selector.caseSensitive ? "g" : "gi";
147841
147965
  return new RegExp(flexible, flags);
147842
147966
  }
147843
- function executeTextSelector(editor, index2, query, diagnostics) {
147967
+ function executeTextSelector(editor, index2, query, diagnostics, options = {}) {
147844
147968
  if (query.select.type !== "text") {
147845
147969
  addDiagnostic(diagnostics, `Text strategy received a non-text selector (type="${query.select.type}").`);
147846
147970
  return {
@@ -147868,16 +147992,20 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147868
147992
  matches: [],
147869
147993
  total: 0
147870
147994
  };
147871
- const rawResult = requireEditorCommand(editor.commands?.search, "find (search)")(pattern, {
147995
+ const search2 = requireEditorCommand(editor.commands?.search, "find (search)");
147996
+ const searchModel = options.searchModel ?? "visible";
147997
+ const textOffsetOptions = { textModel: searchModel };
147998
+ pattern.lastIndex = 0;
147999
+ const rawResult = search2(pattern, {
147872
148000
  highlight: false,
147873
148001
  caseSensitive: selector.caseSensitive ?? false,
147874
148002
  maxMatches: Infinity,
147875
- searchModel: "visible"
148003
+ searchModel
147876
148004
  });
147877
148005
  if (!Array.isArray(rawResult))
147878
148006
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
147879
- const allMatches = rawResult;
147880
148007
  const scopeRange = scope.range;
148008
+ const allMatches = rawResult;
147881
148009
  const matches2 = scopeRange ? allMatches.filter((m) => m.from >= scopeRange.start && m.to <= scopeRange.end) : allMatches;
147882
148010
  const textBlocks = index2.candidates.filter(isTextBlockCandidate);
147883
148011
  const contexts = [];
@@ -147894,7 +148022,7 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147894
148022
  return;
147895
148023
  if (!source)
147896
148024
  source = block;
147897
- return toTextAddress$1(editor, block, range);
148025
+ return toTextAddress$1(editor, block, range, textOffsetOptions);
147898
148026
  }).filter((range) => Boolean(range));
147899
148027
  if (!source)
147900
148028
  source = findCandidateByPos(textBlocks, match.from) ?? findBlockByPos(index2, match.from);
@@ -147902,7 +148030,7 @@ function executeTextSelector(editor, index2, query, diagnostics) {
147902
148030
  continue;
147903
148031
  const address = toBlockAddress(source);
147904
148032
  addresses.push(address);
147905
- contexts.push(buildTextContext(editor, address, match.from, match.to, textRanges));
148033
+ contexts.push(buildTextContext(editor, address, match.from, match.to, textRanges, textOffsetOptions));
147906
148034
  }
147907
148035
  const paged = paginate(addresses, query.offset, query.limit);
147908
148036
  const pagedContexts = paginate(contexts, query.offset, query.limit).items;
@@ -147953,7 +148081,7 @@ function resolveTextPoint(editor, index2, point3) {
147953
148081
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
147954
148082
  start: point3.offset,
147955
148083
  end: point3.offset
147956
- });
148084
+ }, { textModel: "visible" });
147957
148085
  if (!resolved)
147958
148086
  throw new DocumentApiAdapterError("INVALID_TARGET", `Offset ${point3.offset} is out of range in block "${point3.blockId}".`, {
147959
148087
  field: "offset",
@@ -148160,11 +148288,11 @@ function validateInsertionContext(editor, index2, step2, stepIndex, anchorBlockI
148160
148288
  });
148161
148289
  }
148162
148290
  }
148163
- function resolveAbsoluteRange(editor, candidate, from2, to, stepId) {
148291
+ function resolveAbsoluteRange(editor, candidate, from2, to, stepId, options) {
148164
148292
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
148165
148293
  start: from2,
148166
148294
  end: to
148167
- });
148295
+ }, options);
148168
148296
  if (!resolved)
148169
148297
  throw planError("INVALID_INPUT", `text offset [${from2}, ${to}) out of range in block`, stepId);
148170
148298
  return {
@@ -148248,8 +148376,9 @@ function coalesceBlockRanges(stepId, blockId, ranges) {
148248
148376
  };
148249
148377
  }
148250
148378
  function buildRangeTarget(editor, step2, addr, candidate) {
148251
- const abs = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step2.id);
148252
- const capturedStyle = step2.op === "text.rewrite" || step2.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to) : undefined;
148379
+ const textOffsetOptions = { textModel: addr.textModel };
148380
+ const abs = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step2.id, textOffsetOptions);
148381
+ const capturedStyle = step2.op === "text.rewrite" || step2.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to, textOffsetOptions) : undefined;
148253
148382
  return {
148254
148383
  kind: "range",
148255
148384
  stepId: step2.id,
@@ -148264,7 +148393,7 @@ function buildRangeTarget(editor, step2, addr, candidate) {
148264
148393
  capturedStyle
148265
148394
  };
148266
148395
  }
148267
- function buildSpanTarget(editor, index2, step2, segments, matchId) {
148396
+ function buildSpanTarget(editor, index2, step2, segments, matchId, textModel = "visible") {
148268
148397
  validateSegmentOrder(editor, index2, segments, step2.id);
148269
148398
  const compiledSegments = [];
148270
148399
  const capturedStyles = [];
@@ -148273,7 +148402,8 @@ function buildSpanTarget(editor, index2, step2, segments, matchId) {
148273
148402
  const candidate = index2.candidates.find((c) => c.nodeId === seg.blockId);
148274
148403
  if (!candidate)
148275
148404
  throw planError("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step2.id);
148276
- const abs = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step2.id);
148405
+ const textOffsetOptions = { textModel };
148406
+ const abs = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step2.id, textOffsetOptions);
148277
148407
  compiledSegments.push({
148278
148408
  blockId: seg.blockId,
148279
148409
  from: seg.from,
@@ -148281,10 +148411,10 @@ function buildSpanTarget(editor, index2, step2, segments, matchId) {
148281
148411
  absFrom: abs.absFrom,
148282
148412
  absTo: abs.absTo
148283
148413
  });
148284
- const blockText = getBlockText(editor, candidate);
148414
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
148285
148415
  textParts.push(blockText.slice(seg.from, seg.to));
148286
148416
  if (step2.op === "text.rewrite" || step2.op === "format.apply")
148287
- capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to));
148417
+ capturedStyles.push(captureRunsInRange(editor, candidate.pos, seg.from, seg.to, textOffsetOptions));
148288
148418
  }
148289
148419
  return {
148290
148420
  kind: "span",
@@ -148322,12 +148452,14 @@ function validateSegmentOrder(_editor, index2, segments, stepId) {
148322
148452
  }
148323
148453
  }
148324
148454
  function resolveTextSelector(editor, index2, selector, within, stepId, options) {
148455
+ const textModel = options?.textModel ?? "visible";
148456
+ const textOffsetOptions = { textModel };
148325
148457
  if (selector.type === "text") {
148326
148458
  const result$1 = executeTextSelector(editor, index2, {
148327
148459
  select: selector,
148328
148460
  within,
148329
148461
  includeNodes: false
148330
- }, []);
148462
+ }, [], { searchModel: textModel });
148331
148463
  const addresses$1 = [];
148332
148464
  if (result$1.context)
148333
148465
  for (const ctx of result$1.context) {
@@ -148337,15 +148469,16 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148337
148469
  const candidate = index2.candidates.find((c) => c.nodeId === coalesced.blockId);
148338
148470
  if (!candidate)
148339
148471
  continue;
148340
- const matchText = getBlockText(editor, candidate).slice(coalesced.from, coalesced.to);
148341
- const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to);
148472
+ const matchText = getBlockText(editor, candidate, textOffsetOptions).slice(coalesced.from, coalesced.to);
148473
+ const captured = captureRunsInRange(editor, candidate.pos, coalesced.from, coalesced.to, textOffsetOptions);
148342
148474
  addresses$1.push({
148343
148475
  blockId: coalesced.blockId,
148344
148476
  from: coalesced.from,
148345
148477
  to: coalesced.to,
148346
148478
  text: matchText,
148347
148479
  marks: captured.runs.length > 0 ? captured.runs[0].marks : [],
148348
- blockPos: candidate.pos
148480
+ blockPos: candidate.pos,
148481
+ textModel
148349
148482
  });
148350
148483
  }
148351
148484
  return { addresses: addresses$1 };
@@ -148364,14 +148497,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148364
148497
  if (!candidate)
148365
148498
  continue;
148366
148499
  if (isTextBlockCandidate(candidate)) {
148367
- const blockText = getBlockText(editor, candidate);
148500
+ const blockText = getBlockText(editor, candidate, textOffsetOptions);
148368
148501
  addresses.push({
148369
148502
  blockId: match.nodeId,
148370
148503
  from: 0,
148371
148504
  to: blockText.length,
148372
148505
  text: blockText,
148373
148506
  marks: [],
148374
- blockPos: candidate.pos
148507
+ blockPos: candidate.pos,
148508
+ textModel
148375
148509
  });
148376
148510
  } else
148377
148511
  addresses.push({
@@ -148380,12 +148514,15 @@ function resolveTextSelector(editor, index2, selector, within, stepId, options)
148380
148514
  to: 0,
148381
148515
  text: "",
148382
148516
  marks: [],
148383
- blockPos: candidate.pos
148517
+ blockPos: candidate.pos,
148518
+ textModel
148384
148519
  });
148385
148520
  }
148386
148521
  return { addresses };
148387
148522
  }
148388
- function getBlockText(editor, candidate) {
148523
+ function getBlockText(editor, candidate, options = { textModel: "visible" }) {
148524
+ if (candidate.node && candidate.node.childCount > 0)
148525
+ return textContentInBlock(candidate.node, options);
148389
148526
  const blockStart = candidate.pos + 1;
148390
148527
  const blockEnd = candidate.end - 1;
148391
148528
  return editor.state.doc.textBetween(blockStart, blockEnd, `
@@ -148421,12 +148558,13 @@ function resolveV3TextRef(editor, index2, step2, refData) {
148421
148558
  to: seg.to,
148422
148559
  text: matchText,
148423
148560
  marks: [],
148424
- blockPos: candidate.pos
148561
+ blockPos: candidate.pos,
148562
+ textModel: "visible"
148425
148563
  }, candidate);
148426
148564
  target.matchId = refData.matchId;
148427
148565
  return [target];
148428
148566
  }
148429
- return [buildSpanTarget(editor, index2, step2, segments, refData.matchId)];
148567
+ return [buildSpanTarget(editor, index2, step2, segments, refData.matchId, "visible")];
148430
148568
  }
148431
148569
  function resolveV4TextRef(editor, index2, step2, refData) {
148432
148570
  if (refData.scope === "node" && refData.node?.nodeId)
@@ -148459,13 +148597,14 @@ function resolveV4TextRef(editor, index2, step2, refData) {
148459
148597
  to: seg.to,
148460
148598
  text: matchText,
148461
148599
  marks: [],
148462
- blockPos: candidate.pos
148600
+ blockPos: candidate.pos,
148601
+ textModel: "visible"
148463
148602
  }, candidate);
148464
148603
  if (refData.matchId)
148465
148604
  target.matchId = refData.matchId;
148466
148605
  return [target];
148467
148606
  }
148468
- return [buildSpanTarget(editor, index2, step2, segments, refData.matchId ?? `v4:${step2.id}`)];
148607
+ return [buildSpanTarget(editor, index2, step2, segments, refData.matchId ?? `v4:${step2.id}`, "visible")];
148469
148608
  }
148470
148609
  function resolveTextRef(editor, index2, step2, ref2) {
148471
148610
  const decoded = decodeRef(ref2);
@@ -148492,7 +148631,8 @@ function resolveBlockRef(editor, index2, step2, ref2) {
148492
148631
  to: blockText.length,
148493
148632
  text: blockText,
148494
148633
  marks: [],
148495
- blockPos: candidate.pos
148634
+ blockPos: candidate.pos,
148635
+ textModel: "visible"
148496
148636
  }, candidate)];
148497
148637
  }
148498
148638
  function dispatchRefHandler(editor, index2, step2, ref2) {
@@ -148539,7 +148679,8 @@ function buildWholeBlockRangeTarget(editor, step2, candidate) {
148539
148679
  to: blockText.length,
148540
148680
  text: blockText,
148541
148681
  marks: [],
148542
- blockPos: candidate.pos
148682
+ blockPos: candidate.pos,
148683
+ textModel: "visible"
148543
148684
  }, candidate);
148544
148685
  }
148545
148686
  return {
@@ -148622,7 +148763,7 @@ function captureStyleAtAbsoluteRange(editor, absFrom, absTo) {
148622
148763
  isUniform: checkUniformity(allRuns)
148623
148764
  };
148624
148765
  }
148625
- function resolveStepTargets(editor, index2, step2) {
148766
+ function resolveStepTargets(editor, index2, step2, options = {}) {
148626
148767
  const where = step2.where;
148627
148768
  const refWhere = isRefWhere(where) ? where : undefined;
148628
148769
  const selectWhere = isSelectWhere(where) ? where : undefined;
@@ -148637,7 +148778,10 @@ function resolveStepTargets(editor, index2, step2) {
148637
148778
  targets = resolveRefTargets(editor, index2, step2, refWhere);
148638
148779
  else if (selectWhere) {
148639
148780
  const isStructuralOp = step2.op === "structural.insert" || step2.op === "structural.replace";
148640
- targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step2.id, { allBlockTypes: isStructuralOp }).addresses.map((addr) => {
148781
+ targets = resolveTextSelector(editor, index2, selectWhere.select, selectWhere.within, step2.id, {
148782
+ allBlockTypes: isStructuralOp,
148783
+ textModel: options.selectTextModel ?? "visible"
148784
+ }).addresses.map((addr) => {
148641
148785
  const candidate = index2.candidates.find((c) => c.nodeId === addr.blockId);
148642
148786
  if (!candidate)
148643
148787
  throw planError("TARGET_NOT_FOUND", `block "${addr.blockId}" not in index`, step2.id);
@@ -148902,7 +149046,7 @@ function assertSingleStoryKey(steps) {
148902
149046
  });
148903
149047
  }
148904
149048
  }
148905
- function compilePlan(editor, steps) {
149049
+ function compilePlan(editor, steps, options = {}) {
148906
149050
  if (steps.length > 200)
148907
149051
  throw planError("INVALID_INPUT", `plan contains ${steps.length} steps, maximum is 200`);
148908
149052
  const compiledRevision = getRevision(editor);
@@ -148933,7 +149077,7 @@ function compilePlan(editor, steps) {
148933
149077
  throw planError("INVALID_INPUT", `unknown step op "${step2.op}"`, step2.id);
148934
149078
  if (isCreateOp(step2.op))
148935
149079
  validateCreateStepPosition(step2);
148936
- const targets = resolveStepTargets(editor, index2, step2);
149080
+ const targets = resolveStepTargets(editor, index2, step2, options);
148937
149081
  if (isCreateOp(step2.op) && targets.length > 0) {
148938
149082
  const position2 = step2.args.position ?? "after";
148939
149083
  const anchorBlockId = resolveCreateAnchorFromTargets(targets, position2, step2.id);
@@ -151066,7 +151210,7 @@ function executeCompiledPlan(editor, compiled, options = {}) {
151066
151210
  function executePlan(editor, input) {
151067
151211
  if (!input.steps?.length)
151068
151212
  throw planError("INVALID_INPUT", "plan must contain at least one step");
151069
- return executeCompiledPlan(editor, compilePlan(editor, input.steps), {
151213
+ return executeCompiledPlan(editor, compilePlan(editor, input.steps, { selectTextModel: input.changeMode === "tracked" ? "raw" : "visible" }), {
151070
151214
  changeMode: input.changeMode ?? "direct",
151071
151215
  expectedRevision: input.expectedRevision
151072
151216
  });
@@ -156628,8 +156772,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
156628
156772
  }
156629
156773
  };
156630
156774
  };
156631
- var init_create_headless_toolbar_ISx0N5AS_es = __esm(() => {
156632
- init_SuperConverter_C6hKp29w_es();
156775
+ var init_create_headless_toolbar_lxRAue2X_es = __esm(() => {
156776
+ init_SuperConverter_DHtZjY65_es();
156633
156777
  init_uuid_qzgm05fK_es();
156634
156778
  init_constants_D_X7xF4s_es();
156635
156779
  init_dist_B8HfvhaK_es();
@@ -186102,8 +186246,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
186102
186246
  patchFlag |= 2048;
186103
186247
  }
186104
186248
  root2.codegenNode = createVNodeCall(context, helper(FRAGMENT), undefined, root2.children, patchFlag, undefined, undefined, true, undefined, false);
186105
- } else
186106
- ;
186249
+ }
186107
186250
  }
186108
186251
  function traverseChildren(parent, context) {
186109
186252
  let i4 = 0;
@@ -211379,7 +211522,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
211379
211522
  init_remark_gfm_BhnWr3yf_es();
211380
211523
  });
211381
211524
 
211382
- // ../../packages/superdoc/dist/chunks/src-Bm7Xq4ys.es.js
211525
+ // ../../packages/superdoc/dist/chunks/src-BlbgbalI.es.js
211383
211526
  function deleteProps(obj, propOrProps) {
211384
211527
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
211385
211528
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -211453,7 +211596,7 @@ function prosemirrorToYXmlFragment(doc$12, xmlFragment) {
211453
211596
  }
211454
211597
  function getSuperdocVersion() {
211455
211598
  try {
211456
- return "1.37.0";
211599
+ return "1.38.0";
211457
211600
  } catch {
211458
211601
  return "unknown";
211459
211602
  }
@@ -224397,11 +224540,20 @@ function buildSelectionClipboardHtml(view, editor) {
224397
224540
  annotateCopiedSectionMetadata(container, view);
224398
224541
  return serializeSelectionAsWordHtml(container) || container.innerHTML || null;
224399
224542
  }
224400
- function projectContentNode(pmNode) {
224401
- return projectBlock(pmNode);
224543
+ function isVisibleProjection(options) {
224544
+ return options?.textModel === "visible";
224545
+ }
224546
+ function hasTrackDeleteMark$1(pmNode) {
224547
+ return pmNode.marks?.some((mark2) => mark2.type.name === "trackDelete") ?? false;
224402
224548
  }
224403
- function projectInlineNode(pmNode) {
224404
- return projectInline(pmNode);
224549
+ function projectContentNode(pmNode, options) {
224550
+ return projectBlock(pmNode, options);
224551
+ }
224552
+ function projectInlineNode(pmNode, options) {
224553
+ return projectInline(pmNode, options) ?? {
224554
+ kind: "run",
224555
+ run: { text: "" }
224556
+ };
224405
224557
  }
224406
224558
  function projectMarkBasedInline(editor, candidate) {
224407
224559
  const { nodeType, anchor, attrs } = candidate;
@@ -224451,8 +224603,9 @@ function resolveTextByBlockId(editor, anchor) {
224451
224603
  function projectDocument(editor, options) {
224452
224604
  const doc$12 = editor.state.doc;
224453
224605
  const body = [];
224606
+ const projectionOptions = { textModel: "visible" };
224454
224607
  doc$12.forEach((child) => {
224455
- body.push(projectBlock(child));
224608
+ body.push(projectBlock(child, projectionOptions));
224456
224609
  });
224457
224610
  const sections = projectSections(editor);
224458
224611
  const numbering = projectNumberingCatalog(editor);
@@ -224538,27 +224691,27 @@ function projectNumberingCatalog(editor) {
224538
224691
  }
224539
224692
  return Object.keys(catalog.definitions).length > 0 ? catalog : undefined;
224540
224693
  }
224541
- function projectBlock(pmNode) {
224694
+ function projectBlock(pmNode, options) {
224542
224695
  const typeName = pmNode.type.name;
224543
224696
  switch (typeName) {
224544
224697
  case "paragraph":
224545
- return projectParagraphOrHeading(pmNode);
224698
+ return projectParagraphOrHeading(pmNode, options);
224546
224699
  case "heading":
224547
- return projectHeadingNode(pmNode);
224700
+ return projectHeadingNode(pmNode, options);
224548
224701
  case "table":
224549
- return projectTable(pmNode);
224702
+ return projectTable(pmNode, options);
224550
224703
  case "bulletList":
224551
224704
  case "orderedList":
224552
- return projectList(pmNode, typeName === "orderedList");
224705
+ return projectList(pmNode, typeName === "orderedList", options);
224553
224706
  case "listItem":
224554
- return projectListItemAsContent(pmNode);
224707
+ return projectListItemAsContent(pmNode, options);
224555
224708
  case "image":
224556
224709
  return projectBlockImage(pmNode);
224557
224710
  case "tableOfContents":
224558
224711
  return projectToc(pmNode);
224559
224712
  case "sdt":
224560
224713
  case "structuredContentBlock":
224561
- return projectBlockSdt(pmNode);
224714
+ return projectBlockSdt(pmNode, options);
224562
224715
  case "sectionBreak":
224563
224716
  return projectSectionBreak(pmNode);
224564
224717
  case "pageBreak":
@@ -224567,22 +224720,22 @@ function projectBlock(pmNode) {
224567
224720
  case "drawing":
224568
224721
  return projectBlockDrawing(pmNode);
224569
224722
  default:
224570
- return projectFallbackBlock(pmNode);
224723
+ return projectFallbackBlock(pmNode, options);
224571
224724
  }
224572
224725
  }
224573
- function projectParagraphOrHeading(pmNode) {
224726
+ function projectParagraphOrHeading(pmNode, options) {
224574
224727
  const attrs = pmNode.attrs;
224575
224728
  const headingLevel = getHeadingLevel(attrs?.paragraphProperties?.styleId);
224576
224729
  if (headingLevel && headingLevel >= 1 && headingLevel <= 6)
224577
- return buildHeading(pmNode, attrs, headingLevel);
224578
- return buildParagraph(pmNode, attrs);
224730
+ return buildHeading(pmNode, attrs, headingLevel, options);
224731
+ return buildParagraph(pmNode, attrs, options);
224579
224732
  }
224580
- function projectHeadingNode(pmNode) {
224733
+ function projectHeadingNode(pmNode, options) {
224581
224734
  const attrs = pmNode.attrs;
224582
- return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1);
224735
+ return buildHeading(pmNode, attrs, pmNode.attrs?.level ?? getHeadingLevel(attrs?.paragraphProperties?.styleId) ?? 1, options);
224583
224736
  }
224584
- function buildParagraph(pmNode, attrs) {
224585
- const inlines = projectInlineChildren(pmNode);
224737
+ function buildParagraph(pmNode, attrs, options) {
224738
+ const inlines = projectInlineChildren(pmNode, options);
224586
224739
  const result = {
224587
224740
  kind: "paragraph",
224588
224741
  id: resolveNodeId(pmNode),
@@ -224596,8 +224749,8 @@ function buildParagraph(pmNode, attrs) {
224596
224749
  result.paragraph.props = props;
224597
224750
  return result;
224598
224751
  }
224599
- function buildHeading(pmNode, attrs, level) {
224600
- const inlines = projectInlineChildren(pmNode);
224752
+ function buildHeading(pmNode, attrs, level, options) {
224753
+ const inlines = projectInlineChildren(pmNode, options);
224601
224754
  const result = {
224602
224755
  kind: "heading",
224603
224756
  id: resolveNodeId(pmNode),
@@ -224614,13 +224767,13 @@ function buildHeading(pmNode, attrs, level) {
224614
224767
  result.heading.props = props;
224615
224768
  return result;
224616
224769
  }
224617
- function projectTable(pmNode) {
224770
+ function projectTable(pmNode, options) {
224618
224771
  const attrs = pmNode.attrs;
224619
224772
  const pmAttrs = pmNode.attrs;
224620
224773
  const rows = [];
224621
224774
  pmNode.forEach((child) => {
224622
224775
  if (child.type.name === "tableRow")
224623
- rows.push(projectTableRow(child));
224776
+ rows.push(projectTableRow(child, options));
224624
224777
  });
224625
224778
  const result = {
224626
224779
  kind: "table",
@@ -224650,11 +224803,11 @@ function projectTable(pmNode) {
224650
224803
  }
224651
224804
  return result;
224652
224805
  }
224653
- function projectTableRow(pmNode) {
224806
+ function projectTableRow(pmNode, options) {
224654
224807
  const cells = [];
224655
224808
  pmNode.forEach((child) => {
224656
224809
  if (child.type.name === "tableCell" || child.type.name === "tableHeader")
224657
- cells.push(projectTableCell(child));
224810
+ cells.push(projectTableCell(child, options));
224658
224811
  });
224659
224812
  const row2 = { cells };
224660
224813
  const attrs = pmNode.attrs;
@@ -224667,11 +224820,11 @@ function projectTableRow(pmNode) {
224667
224820
  }
224668
224821
  return row2;
224669
224822
  }
224670
- function projectTableCell(pmNode) {
224823
+ function projectTableCell(pmNode, options) {
224671
224824
  const attrs = pmNode.attrs;
224672
224825
  const content3 = [];
224673
224826
  pmNode.forEach((child) => {
224674
- content3.push(projectBlock(child));
224827
+ content3.push(projectBlock(child, options));
224675
224828
  });
224676
224829
  const cell2 = { content: content3 };
224677
224830
  if (attrs?.colspan && attrs.colspan > 1)
@@ -224683,11 +224836,11 @@ function projectTableCell(pmNode) {
224683
224836
  cell2.props = { verticalAlign: vAlign };
224684
224837
  return cell2;
224685
224838
  }
224686
- function projectList(pmNode, ordered) {
224839
+ function projectList(pmNode, ordered, options) {
224687
224840
  const items = [];
224688
224841
  pmNode.forEach((child) => {
224689
224842
  if (child.type.name === "listItem")
224690
- items.push(projectListItem(child));
224843
+ items.push(projectListItem(child, options));
224691
224844
  });
224692
224845
  const result = {
224693
224846
  kind: "list",
@@ -224705,18 +224858,18 @@ function projectList(pmNode, ordered) {
224705
224858
  result.list.styleRef = attrs.listStyleId;
224706
224859
  return result;
224707
224860
  }
224708
- function projectListItem(pmNode) {
224861
+ function projectListItem(pmNode, options) {
224709
224862
  const content3 = [];
224710
224863
  pmNode.forEach((child) => {
224711
- content3.push(projectBlock(child));
224864
+ content3.push(projectBlock(child, options));
224712
224865
  });
224713
224866
  return {
224714
224867
  level: pmNode.attrs?.level ?? 0,
224715
224868
  content: content3
224716
224869
  };
224717
224870
  }
224718
- function projectListItemAsContent(pmNode) {
224719
- const inlines = projectInlineChildren(pmNode);
224871
+ function projectListItemAsContent(pmNode, options) {
224872
+ const inlines = projectInlineChildren(pmNode, options);
224720
224873
  return {
224721
224874
  kind: "paragraph",
224722
224875
  id: resolveNodeId(pmNode),
@@ -224765,10 +224918,10 @@ function extractSdtMetadata(attrs) {
224765
224918
  ...lock && lock !== "none" ? { lock } : {}
224766
224919
  };
224767
224920
  }
224768
- function projectBlockSdt(pmNode) {
224921
+ function projectBlockSdt(pmNode, options) {
224769
224922
  const children = [];
224770
224923
  pmNode.forEach((child) => {
224771
- children.push(projectBlock(child));
224924
+ children.push(projectBlock(child, options));
224772
224925
  });
224773
224926
  return {
224774
224927
  kind: "sdt",
@@ -224780,8 +224933,8 @@ function projectBlockSdt(pmNode) {
224780
224933
  }
224781
224934
  };
224782
224935
  }
224783
- function projectInlineSdt(pmNode) {
224784
- const inlines = projectInlineChildren(pmNode);
224936
+ function projectInlineSdt(pmNode, options) {
224937
+ const inlines = projectInlineChildren(pmNode, options);
224785
224938
  return {
224786
224939
  kind: "sdt",
224787
224940
  id: resolveSdtNodeId(pmNode),
@@ -224818,28 +224971,29 @@ function projectBlockDrawing(pmNode) {
224818
224971
  }
224819
224972
  };
224820
224973
  }
224821
- function projectFallbackBlock(pmNode) {
224822
- const inlines = projectInlineChildren(pmNode);
224974
+ function projectFallbackBlock(pmNode, options) {
224975
+ const inlines = projectInlineChildren(pmNode, options);
224823
224976
  return {
224824
224977
  kind: "paragraph",
224825
224978
  id: resolveNodeId(pmNode),
224826
224979
  paragraph: { inlines }
224827
224980
  };
224828
224981
  }
224829
- function projectInlineChildren(pmNode) {
224982
+ function projectInlineChildren(pmNode, options) {
224830
224983
  const inlines = [];
224831
224984
  pmNode.forEach((child) => {
224832
- const projected = projectInline(child);
224833
- inlines.push(projected);
224985
+ const projected = projectInline(child, options);
224986
+ if (projected)
224987
+ inlines.push(projected);
224834
224988
  });
224835
224989
  return inlines;
224836
224990
  }
224837
- function projectInline(pmNode) {
224991
+ function projectInline(pmNode, options) {
224838
224992
  if (pmNode.isText)
224839
- return projectTextRun(pmNode);
224993
+ return projectTextRun(pmNode, options);
224840
224994
  switch (pmNode.type.name) {
224841
224995
  case "run":
224842
- return projectRunNode(pmNode);
224996
+ return projectRunNode(pmNode, options);
224843
224997
  case "image":
224844
224998
  return projectInlineImage(pmNode);
224845
224999
  case "tab":
@@ -224856,21 +225010,23 @@ function projectInline(pmNode) {
224856
225010
  case "field":
224857
225011
  return projectInlineField(pmNode);
224858
225012
  case "structuredContent":
224859
- return projectInlineSdt(pmNode);
225013
+ return projectInlineSdt(pmNode, options);
224860
225014
  default:
224861
- return projectInlineFallback(pmNode);
225015
+ return projectInlineFallback(pmNode, options);
224862
225016
  }
224863
225017
  }
224864
- function projectRunNode(pmNode) {
225018
+ function projectRunNode(pmNode, options) {
224865
225019
  const runProperties = (pmNode.attrs ?? {}).runProperties;
224866
- const text5 = pmNode.textContent;
225020
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
225021
+ if (isVisibleProjection(options) && text5.length === 0)
225022
+ return null;
224867
225023
  let linkMark;
224868
225024
  pmNode.forEach((child) => {
224869
225025
  if (!linkMark)
224870
225026
  linkMark = child.marks?.find((m$1) => m$1.type.name === "link");
224871
225027
  });
224872
225028
  if (linkMark)
224873
- return buildHyperlinkFromRunNode(pmNode, linkMark);
225029
+ return buildHyperlinkFromRunNode(pmNode, linkMark, options);
224874
225030
  const run2 = {
224875
225031
  kind: "run",
224876
225032
  run: { text: text5 }
@@ -224883,11 +225039,14 @@ function projectRunNode(pmNode) {
224883
225039
  run2.run.props = props;
224884
225040
  return run2;
224885
225041
  }
224886
- function buildHyperlinkFromRunNode(pmNode, linkMark) {
225042
+ function buildHyperlinkFromRunNode(pmNode, linkMark, options) {
224887
225043
  const attrs = linkMark.attrs;
225044
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent;
225045
+ if (isVisibleProjection(options) && text5.length === 0)
225046
+ return null;
224888
225047
  const childRun = {
224889
225048
  kind: "run",
224890
- run: { text: pmNode.textContent }
225049
+ run: { text: text5 }
224891
225050
  };
224892
225051
  const runProperties = pmNode.attrs?.runProperties;
224893
225052
  const props = extractRunPropsFromRunProperties(runProperties);
@@ -225001,7 +225160,9 @@ function extractRunPropsFromRunProperties(runProperties) {
225001
225160
  }
225002
225161
  return hasProps ? props : undefined;
225003
225162
  }
225004
- function projectTextRun(pmNode) {
225163
+ function projectTextRun(pmNode, options) {
225164
+ if (isVisibleProjection(options) && hasTrackDeleteMark$1(pmNode))
225165
+ return null;
225005
225166
  const marks = pmNode.marks;
225006
225167
  const linkMark = marks.find((m$1) => m$1.type.name === "link");
225007
225168
  if (linkMark)
@@ -225096,10 +225257,13 @@ function projectInlineField(pmNode) {
225096
225257
  }
225097
225258
  };
225098
225259
  }
225099
- function projectInlineFallback(pmNode) {
225260
+ function projectInlineFallback(pmNode, options) {
225261
+ const text5 = isVisibleProjection(options) ? textContentInBlock(pmNode, options) : pmNode.textContent ?? "";
225262
+ if (isVisibleProjection(options) && text5.length === 0)
225263
+ return null;
225100
225264
  return {
225101
225265
  kind: "run",
225102
- run: { text: pmNode.textContent ?? "" }
225266
+ run: { text: text5 }
225103
225267
  };
225104
225268
  }
225105
225269
  function resolveNodeId(pmNode) {
@@ -226152,6 +226316,13 @@ function buildSelectionTargetFromTextRanges(textRanges, story) {
226152
226316
  target.story = story;
226153
226317
  return target;
226154
226318
  }
226319
+ function readCandidateVisibleText(editor, candidate) {
226320
+ const maybeNode = candidate.node;
226321
+ if (maybeNode && typeof maybeNode.childCount === "number" && maybeNode.childCount > 0)
226322
+ return textContentInBlock(maybeNode, { textModel: "visible" });
226323
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
226324
+ `, "");
226325
+ }
226155
226326
  function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyKey, resolverParams) {
226156
226327
  const index2 = getBlockIndex(editor);
226157
226328
  const doc$12 = editor.state.doc;
@@ -226204,10 +226375,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
226204
226375
  }
226205
226376
  });
226206
226377
  }
226207
- const blockStart = candidate.pos + 1;
226208
- const blockEnd = candidate.end - 1;
226209
- const blockText = doc$12.textBetween(blockStart, blockEnd, `
226210
- `, "");
226378
+ const blockText = readCandidateVisibleText(editor, candidate);
226211
226379
  const matchedText = blockText.slice(from$1, to);
226212
226380
  const node2 = doc$12.nodeAt(candidate.pos);
226213
226381
  const nodeType = node2?.type.name ?? "paragraph";
@@ -226216,7 +226384,7 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
226216
226384
  resolverParams,
226217
226385
  paragraphProperties: node2?.attrs?.paragraphProperties ?? null
226218
226386
  } : undefined;
226219
- const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to).runs);
226387
+ const coalesced = coalesceRuns(captureRunsInRange(editor, candidate.pos, from$1, to, { textModel: "visible" }).runs);
226220
226388
  const blockRange = {
226221
226389
  start: from$1,
226222
226390
  end: to
@@ -226280,7 +226448,6 @@ function buildBlocksSnippet(editor, blocks2) {
226280
226448
  if (!editor.state?.doc || blocks2.length === 0)
226281
226449
  return;
226282
226450
  const index2 = getBlockIndex(editor);
226283
- const doc$12 = editor.state.doc;
226284
226451
  const matchText = blocks2.map((b$1) => b$1.text).join(`
226285
226452
  `);
226286
226453
  if (matchText.length >= 500)
@@ -226297,10 +226464,7 @@ function buildBlocksSnippet(editor, blocks2) {
226297
226464
  const firstBlock = blocks2[0];
226298
226465
  const firstCandidate = index2.candidates.find((c) => c.nodeId === firstBlock.blockId);
226299
226466
  if (firstCandidate) {
226300
- const blockStart = firstCandidate.pos + 1;
226301
- const blockEnd = firstCandidate.end - 1;
226302
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
226303
- `, "");
226467
+ const fullBlockText = readCandidateVisibleText(editor, firstCandidate);
226304
226468
  const contextStart = Math.max(0, firstBlock.range.start - contextEachSide);
226305
226469
  leftContext = fullBlockText.slice(contextStart, firstBlock.range.start);
226306
226470
  }
@@ -226308,10 +226472,7 @@ function buildBlocksSnippet(editor, blocks2) {
226308
226472
  const lastBlock = blocks2[blocks2.length - 1];
226309
226473
  const lastCandidate = index2.candidates.find((c) => c.nodeId === lastBlock.blockId);
226310
226474
  if (lastCandidate) {
226311
- const blockStart = lastCandidate.pos + 1;
226312
- const blockEnd = lastCandidate.end - 1;
226313
- const fullBlockText = doc$12.textBetween(blockStart, blockEnd, `
226314
- `, "");
226475
+ const fullBlockText = readCandidateVisibleText(editor, lastCandidate);
226315
226476
  const contextEnd = Math.min(fullBlockText.length, lastBlock.range.end + contextEachSide);
226316
226477
  rightContext = fullBlockText.slice(lastBlock.range.end, contextEnd);
226317
226478
  }
@@ -226637,12 +226798,12 @@ function projectMatchToSDNodeResult(editor, address, blockIndex) {
226637
226798
  if (!found2)
226638
226799
  return null;
226639
226800
  return {
226640
- node: projectContentNode(found2.node),
226801
+ node: projectContentNode(found2.node, { textModel: "visible" }),
226641
226802
  address
226642
226803
  };
226643
226804
  }
226644
226805
  return {
226645
- node: projectContentNode(candidate.node),
226806
+ node: projectContentNode(candidate.node, { textModel: "visible" }),
226646
226807
  address
226647
226808
  };
226648
226809
  }
@@ -248383,7 +248544,7 @@ function extractParagraphText(paraNode, paraPos) {
248383
248544
  return;
248384
248545
  }
248385
248546
  if (node2.isText && node2.text) {
248386
- if (hasTrackDeleteMark(node2))
248547
+ if (hasTrackDeleteMark2(node2))
248387
248548
  return;
248388
248549
  const text5 = node2.text;
248389
248550
  const pmFrom = pos;
@@ -248416,7 +248577,7 @@ function extractParagraphText(paraNode, paraPos) {
248416
248577
  }
248417
248578
  }
248418
248579
  }
248419
- function hasTrackDeleteMark(node2) {
248580
+ function hasTrackDeleteMark2(node2) {
248420
248581
  return node2.marks?.some((m$1) => m$1.type.name === "trackDelete") ?? false;
248421
248582
  }
248422
248583
  function isNonTextInlineNode(typeName) {
@@ -271967,7 +272128,7 @@ var Node$13 = class Node$14 {
271967
272128
  }, isToolbarInput = (target) => {
271968
272129
  return !!target?.closest(".button-text-input") || target?.classList?.contains("button-text-input");
271969
272130
  }, isToolbarButton = (target) => {
271970
- return !!target?.closest(".toolbar-button") || target?.classList?.contains("toolbar-button");
272131
+ return !!target?.closest(".sd-toolbar-button") || !!target?.closest(".toolbar-button") || target?.classList?.contains("sd-toolbar-button") || target?.classList?.contains("toolbar-button");
271971
272132
  }, CustomSelection, History, createUndoPlugin = () => {
271972
272133
  return yUndoPlugin();
271973
272134
  }, Color, FontFamily, FontSize, LetterSpacing, TextAlign, toggleMarkCascade = (markName, options = {}) => ({ state, chain, editor }) => {
@@ -279960,7 +280121,8 @@ var Node$13 = class Node$14 {
279960
280121
  replacementGroupId: "",
279961
280122
  replacementSideId: "",
279962
280123
  sharedDeletionId: intent.replacementGroupHint || null,
279963
- recordSharedDeletionId: Boolean(intent.replacementGroupHint)
280124
+ recordSharedDeletionId: Boolean(intent.replacementGroupHint),
280125
+ reassignExistingDeletions: intent.source !== "native" && !intent.preserveExistingReviewState ? "different-user" : false
279964
280126
  });
279965
280127
  if (result.ok === false)
279966
280128
  return result;
@@ -280031,12 +280193,17 @@ var Node$13 = class Node$14 {
280031
280193
  }
280032
280194
  if (existingDelete) {
280033
280195
  const allExistingDeletes = node2.marks.filter((m$1) => m$1.type.name === TrackDeleteMarkName);
280034
- if (reassignExistingDeletions) {
280196
+ const isDifferentUserDeletion = !isSameUserHighConfidence(classifyOwnership({
280197
+ currentUser: ctx$1.currentIdentity,
280198
+ change: getChangeAuthorIdentity(existingDelete.attrs)
280199
+ }));
280200
+ if (reassignExistingDeletions === "all" || reassignExistingDeletions === "different-user" && isDifferentUserDeletion) {
280035
280201
  ops.push({
280036
280202
  kind: "reassign",
280037
280203
  from: segFrom,
280038
280204
  to: segTo,
280039
280205
  node: node2,
280206
+ parentId: existingDelete.attrs.id || existingDelete.attrs.overlapParentId || "",
280040
280207
  existingDeleteMarks: allExistingDeletes
280041
280208
  });
280042
280209
  return;
@@ -280077,7 +280244,7 @@ var Node$13 = class Node$14 {
280077
280244
  if (op.kind === "reassign") {
280078
280245
  const mark2 = makeDeleteMark(ctx$1, {
280079
280246
  id: deletionId,
280080
- overlapParentId: "",
280247
+ overlapParentId: op.parentId || "",
280081
280248
  replacementGroupId,
280082
280249
  replacementSideId
280083
280250
  });
@@ -280191,11 +280358,11 @@ var Node$13 = class Node$14 {
280191
280358
  }, compileOrdinaryTextReplace = (ctx$1, intent, sanitizedSlice, replacementParentId) => {
280192
280359
  const sharedId = intent.replacements === "paired" && !replacementParentId ? intent.replacementGroupHint || v4_default() : null;
280193
280360
  const replacementGroupId = sharedId ?? "";
280194
- let positionTo = intent.to;
280361
+ let positionTo = replacementParentId ? intent.from : intent.to;
280195
280362
  if (intent.from !== intent.to && intent.probeForDeletionSpan) {
280196
280363
  const probePos = Math.max(intent.from, intent.to - 1);
280197
280364
  const deletionSpan = findMarkPosition(ctx$1.tr.doc, probePos, TrackDeleteMarkName);
280198
- if (deletionSpan && deletionSpan.to > positionTo)
280365
+ if (!replacementParentId && deletionSpan && deletionSpan.to > positionTo)
280199
280366
  positionTo = deletionSpan.to;
280200
280367
  }
280201
280368
  const baseParentIsTextblock = ctx$1.tr.doc.resolve(positionTo).parent?.isTextblock;
@@ -280288,11 +280455,11 @@ var Node$13 = class Node$14 {
280288
280455
  let deletionMark = null;
280289
280456
  if (intent.from !== intent.to) {
280290
280457
  const stepsBefore = ctx$1.tr.steps.length;
280291
- const delResult = applyTrackedDelete(ctx$1, intent.from, intent.to, {
280458
+ 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, {
280292
280459
  replacementGroupId,
280293
280460
  replacementSideId: sharedId ? `${sharedId}#deleted` : "",
280294
280461
  sharedDeletionId: sharedId,
280295
- reassignExistingDeletions: Boolean(sharedId)
280462
+ reassignExistingDeletions: sharedId || replacementParentId ? "all" : false
280296
280463
  });
280297
280464
  if (delResult.ok === false)
280298
280465
  return delResult;
@@ -280785,13 +280952,14 @@ var Node$13 = class Node$14 {
280785
280952
  let intent;
280786
280953
  try {
280787
280954
  const preserveExistingReviewState = tr.getMeta("protectTrackedReviewState") === true;
280955
+ const source = tr.getMeta("inputType") === "programmatic" ? "document-api" : "native";
280788
280956
  if (step2.from === step2.to && step2.slice.content.size > 0)
280789
280957
  intent = makeTextInsertIntent({
280790
280958
  at: step2.from,
280791
280959
  content: step2.slice,
280792
280960
  user,
280793
280961
  date: date6,
280794
- source: "native",
280962
+ source,
280795
280963
  preserveExistingReviewState
280796
280964
  });
280797
280965
  else if (step2.from !== step2.to && step2.slice.content.size === 0)
@@ -280800,7 +280968,7 @@ var Node$13 = class Node$14 {
280800
280968
  to: step2.to,
280801
280969
  user,
280802
280970
  date: date6,
280803
- source: "native",
280971
+ source,
280804
280972
  preserveExistingReviewState
280805
280973
  });
280806
280974
  else if (step2.from !== step2.to && step2.slice.content.size > 0) {
@@ -280811,7 +280979,7 @@ var Node$13 = class Node$14 {
280811
280979
  replacements,
280812
280980
  user,
280813
280981
  date: date6,
280814
- source: "native",
280982
+ source,
280815
280983
  preserveExistingReviewState
280816
280984
  });
280817
280985
  if (tr.steps.length === 1)
@@ -281923,6 +282091,7 @@ var Node$13 = class Node$14 {
281923
282091
  else if (change.type === CanonicalChangeType.Replacement) {
281924
282092
  const repResult = planReplacementDecision({
281925
282093
  ops,
282094
+ graph,
281926
282095
  change,
281927
282096
  decision,
281928
282097
  removedRanges,
@@ -282067,7 +282236,7 @@ var Node$13 = class Node$14 {
282067
282236
  });
282068
282237
  if (isFull)
282069
282238
  retired.add(change.id);
282070
- }, planReplacementDecision = ({ ops, change, decision, removedRanges, retired }) => {
282239
+ }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
282071
282240
  const inserted = change.insertedSegments;
282072
282241
  const deleted = change.deletedSegments;
282073
282242
  if (!inserted.length || !deleted.length)
@@ -282112,16 +282281,114 @@ var Node$13 = class Node$14 {
282112
282281
  cause: `reject-replacement-inserted:${change.id}`
282113
282282
  });
282114
282283
  }
282115
- for (const seg of deleted)
282284
+ const parentRestore = getParentRestoreContext({
282285
+ graph,
282286
+ change
282287
+ });
282288
+ for (const seg of deleted) {
282116
282289
  pushRemoveMarkOpsForSegment({
282117
282290
  ops,
282118
282291
  segment: seg,
282119
282292
  changeId: change.id,
282120
282293
  side: SegmentSide.Deleted
282121
282294
  });
282295
+ if (parentRestore?.mark)
282296
+ pushAddMarkOpsForSegment({
282297
+ ops,
282298
+ segment: seg,
282299
+ changeId: parentRestore.mark.attrs?.id || change.parent || change.id,
282300
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
282301
+ mark: parentRestore.mark
282302
+ });
282303
+ }
282304
+ for (const sibling of parentRestore?.siblingSegments ?? []) {
282305
+ pushRemoveMarkOpsForSegment({
282306
+ ops,
282307
+ segment: sibling,
282308
+ changeId: sibling.changeId,
282309
+ side: sibling.side
282310
+ });
282311
+ pushAddMarkOpsForSegment({
282312
+ ops,
282313
+ segment: sibling,
282314
+ changeId: parentRestore.mark.attrs?.id || sibling.changeId,
282315
+ side: parentRestore.mark.type.name === "trackInsert" ? SegmentSide.Inserted : SegmentSide.Deleted,
282316
+ mark: parentRestore.mark
282317
+ });
282318
+ retired.add(sibling.changeId);
282319
+ }
282122
282320
  }
282123
282321
  retired.add(change.id);
282124
282322
  return { ok: true };
282323
+ }, getParentRestoreContext = ({ graph, change }) => {
282324
+ const explicit = getExplicitParentRestoreContext({
282325
+ graph,
282326
+ change
282327
+ });
282328
+ if (explicit)
282329
+ return explicit;
282330
+ return inferAdjacentParentRestoreContext({
282331
+ graph,
282332
+ change
282333
+ });
282334
+ }, getExplicitParentRestoreContext = ({ graph, change }) => {
282335
+ if (!change.parent)
282336
+ return null;
282337
+ const parent = graph.changes.get(change.parent);
282338
+ if (!parent)
282339
+ return null;
282340
+ if (parent.type === CanonicalChangeType.Insertion) {
282341
+ const mark2 = parent.insertedSegments[0]?.mark ?? null;
282342
+ return mark2 ? {
282343
+ mark: mark2,
282344
+ siblingSegments: []
282345
+ } : null;
282346
+ }
282347
+ if (parent.type === CanonicalChangeType.Deletion) {
282348
+ const mark2 = parent.deletedSegments[0]?.mark ?? null;
282349
+ return mark2 ? {
282350
+ mark: mark2,
282351
+ siblingSegments: []
282352
+ } : null;
282353
+ }
282354
+ return null;
282355
+ }, inferAdjacentParentRestoreContext = ({ graph, change }) => {
282356
+ if (!change.deletedSegments.length || !change.segments.length)
282357
+ return null;
282358
+ const from$1 = Math.min(...change.segments.map((segment) => segment.from));
282359
+ const to = Math.max(...change.segments.map((segment) => segment.to));
282360
+ const before = nearestSegmentBefore({
282361
+ graph,
282362
+ change,
282363
+ from: from$1
282364
+ });
282365
+ const after = nearestSegmentAfter({
282366
+ graph,
282367
+ change,
282368
+ to
282369
+ });
282370
+ if (!before || !after)
282371
+ return null;
282372
+ if (!areParentRestorePeers(before, after))
282373
+ return null;
282374
+ return {
282375
+ mark: before.mark,
282376
+ siblingSegments: after.changeId === before.changeId ? [] : [after]
282377
+ };
282378
+ }, nearestSegmentBefore = ({ graph, change, from: from$1 }) => {
282379
+ 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];
282380
+ }, nearestSegmentAfter = ({ graph, change, to }) => {
282381
+ 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];
282382
+ }, areParentRestorePeers = (left$1, right$1) => {
282383
+ if (!left$1 || !right$1)
282384
+ return false;
282385
+ if (left$1.side !== right$1.side)
282386
+ return false;
282387
+ if (left$1.side !== SegmentSide.Inserted && left$1.side !== SegmentSide.Deleted)
282388
+ return false;
282389
+ if (left$1.markType !== right$1.markType)
282390
+ return false;
282391
+ 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;
282125
282392
  }, planFormattingDecision = ({ ops, change, decision, retired }) => {
282126
282393
  for (const seg of change.formattingSegments)
282127
282394
  if (decision === "accept")
@@ -282263,6 +282530,21 @@ var Node$13 = class Node$14 {
282263
282530
  mark: run2.mark
282264
282531
  });
282265
282532
  }
282533
+ }, pushAddMarkOpsForSegment = ({ ops, segment, changeId, side, mark: mark2, from: from$1 = segment.from, to = segment.to }) => {
282534
+ for (const run2 of getSegmentMarkRuns(segment)) {
282535
+ const clippedFrom = Math.max(from$1, run2.from);
282536
+ const clippedTo = Math.min(to, run2.to);
282537
+ if (clippedFrom >= clippedTo)
282538
+ continue;
282539
+ ops.push({
282540
+ kind: "addMark",
282541
+ from: clippedFrom,
282542
+ to: clippedTo,
282543
+ changeId,
282544
+ side,
282545
+ mark: mark2
282546
+ });
282547
+ }
282266
282548
  }, getSegmentMarkRuns = (segment) => {
282267
282549
  return segment.markRuns?.length ? segment.markRuns : [{
282268
282550
  from: segment.from,
@@ -283270,7 +283552,7 @@ var Node$13 = class Node$14 {
283270
283552
  this.deco = deco;
283271
283553
  }
283272
283554
  }, searchKey, BLOCK_SEPARATOR = `
283273
- `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$1 = (node2) => node2?.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 }) => {
283555
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node2) => node2?.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 }) => {
283274
283556
  const matches2 = [];
283275
283557
  for (const indexMatch of indexMatches) {
283276
283558
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
@@ -285367,7 +285649,7 @@ var Node$13 = class Node$14 {
285367
285649
  disabled: role !== "editor",
285368
285650
  attributes: {
285369
285651
  dropdownPosition: "right",
285370
- className: "toolbar-item--doc-mode",
285652
+ className: "sd-toolbar-item--doc-mode",
285371
285653
  ariaLabel: "Document mode"
285372
285654
  },
285373
285655
  options: [{
@@ -285455,7 +285737,7 @@ var Node$13 = class Node$14 {
285455
285737
  suppressActiveHighlight: true,
285456
285738
  disabled: false,
285457
285739
  attributes: {
285458
- className: "toolbar-item--linked-styles",
285740
+ className: "sd-toolbar-item--linked-styles",
285459
285741
  ariaLabel: "Linked styles"
285460
285742
  },
285461
285743
  options: [{
@@ -285538,8 +285820,7 @@ var Node$13 = class Node$14 {
285538
285820
  "clearFormatting",
285539
285821
  "copyFormat",
285540
285822
  "ruler",
285541
- "formattingMarks",
285542
- "tableOfContents"
285823
+ "formattingMarks"
285543
285824
  ];
285544
285825
  const itemsToHideSM = [
285545
285826
  "zoom",
@@ -285549,15 +285830,16 @@ var Node$13 = class Node$14 {
285549
285830
  ];
285550
285831
  const shouldUseLgCompactStyles = availableWidth <= RESPONSIVE_BREAKPOINTS.lg;
285551
285832
  const shouldIncludeFormattingMarks = superToolbar.config?.showFormattingMarksButton === true;
285833
+ const shouldIncludeTableOfContents = superToolbar.config?.showTableOfContentsButton === true;
285552
285834
  if (shouldUseLgCompactStyles)
285553
285835
  documentMode.attributes.value = {
285554
285836
  ...documentMode.attributes.value,
285555
- className: `${documentMode.attributes.value.className} toolbar-item--doc-mode-compact`
285837
+ className: `${documentMode.attributes.value.className} sd-toolbar-item--doc-mode-compact`
285556
285838
  };
285557
285839
  if (shouldUseLgCompactStyles)
285558
285840
  linkedStyles.attributes.value = {
285559
285841
  ...linkedStyles.attributes.value,
285560
- className: `${linkedStyles.attributes.value.className} toolbar-item--linked-styles-compact`
285842
+ className: `${linkedStyles.attributes.value.className} sd-toolbar-item--linked-styles-compact`
285561
285843
  };
285562
285844
  let toolbarItems = [
285563
285845
  undo$2,
@@ -285578,7 +285860,7 @@ var Node$13 = class Node$14 {
285578
285860
  separator,
285579
285861
  link2,
285580
285862
  image2,
285581
- tableOfContents,
285863
+ ...shouldIncludeTableOfContents ? [tableOfContents] : [],
285582
285864
  tableItem,
285583
285865
  tableActionsItem,
285584
285866
  separator,
@@ -286499,7 +286781,7 @@ var Node$13 = class Node$14 {
286499
286781
  domAvailabilityCache = false;
286500
286782
  return false;
286501
286783
  }
286502
- }, summaryVersion = "1.37.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
286784
+ }, summaryVersion = "1.38.0", nodeKeys, markKeys, transformListsInCopiedContent = (html3) => {
286503
286785
  const container = document.createElement("div");
286504
286786
  container.innerHTML = html3;
286505
286787
  const result = [];
@@ -287684,7 +287966,7 @@ var Node$13 = class Node$14 {
287684
287966
  return () => {};
287685
287967
  const handle3 = setInterval(callback, intervalMs);
287686
287968
  return () => clearInterval(handle3);
287687
- }, 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) => {
287969
+ }, 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) => {
287688
287970
  if (!isTrackedReviewMark(mark2))
287689
287971
  return null;
287690
287972
  const id2 = typeof mark2.attrs?.id === "string" ? mark2.attrs.id : "";
@@ -308416,13 +308698,13 @@ menclose::after {
308416
308698
  return;
308417
308699
  console.log(...args$1);
308418
308700
  }, 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;
308419
- var init_src_Bm7Xq4ys_es = __esm(() => {
308701
+ var init_src_BlbgbalI_es = __esm(() => {
308420
308702
  init_rolldown_runtime_Bg48TavK_es();
308421
- init_SuperConverter_C6hKp29w_es();
308703
+ init_SuperConverter_DHtZjY65_es();
308422
308704
  init_jszip_C49i9kUs_es();
308423
308705
  init_xml_js_CqGKpaft_es();
308424
308706
  init_uuid_qzgm05fK_es();
308425
- init_create_headless_toolbar_ISx0N5AS_es();
308707
+ init_create_headless_toolbar_lxRAue2X_es();
308426
308708
  init_constants_D_X7xF4s_es();
308427
308709
  init_dist_B8HfvhaK_es();
308428
308710
  init_unified_Dsuw2be5_es();
@@ -326161,12 +326443,12 @@ function print() { __p += __j.call(arguments, '') }
326161
326443
  onMouseenter: ($event) => activeUserIndex.value = index2,
326162
326444
  onMouseleave: _cache[0] || (_cache[0] = ($event) => activeUserIndex.value = null),
326163
326445
  key: user.email,
326164
- class: exports_vue.normalizeClass(["user-row", { selected: activeUserIndex.value === index2 }])
326446
+ class: exports_vue.normalizeClass(["user-row", { "sd-selected": activeUserIndex.value === index2 }])
326165
326447
  }, [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);
326166
326448
  }), 128))], 544);
326167
326449
  };
326168
326450
  }
326169
- }, [["__scopeId", "data-v-dde587fd"]]);
326451
+ }, [["__scopeId", "data-v-b9684aad"]]);
326170
326452
  popoverPluginKey = new PluginKey("popoverPlugin");
326171
326453
  PopoverPlugin = Extension.create({
326172
326454
  name: "popoverPlugin",
@@ -326275,7 +326557,7 @@ function print() { __p += __j.call(arguments, '') }
326275
326557
  const text5 = node2.text || "";
326276
326558
  if (!text5.length)
326277
326559
  return;
326278
- if (hasTrackDeleteMark$1(node2)) {
326560
+ if (hasTrackDeleteMark$2(node2)) {
326279
326561
  appendDeletionBarrier();
326280
326562
  return;
326281
326563
  }
@@ -326317,7 +326599,7 @@ function print() { __p += __j.call(arguments, '') }
326317
326599
  }
326318
326600
  #walkNode(node2, docPos, offset$1, addSegment, searchModel = DEFAULT_SEARCH_MODEL$1, context = null) {
326319
326601
  if (node2.isText) {
326320
- if (searchModel === "visible" && hasTrackDeleteMark$1(node2)) {
326602
+ if (searchModel === "visible" && hasTrackDeleteMark$2(node2)) {
326321
326603
  if (context?.deletionBarrierActive)
326322
326604
  return offset$1;
326323
326605
  addSegment({
@@ -327633,7 +327915,7 @@ function print() { __p += __j.call(arguments, '') }
327633
327915
  }, null, 8, _hoisted_5$6)) : exports_vue.createCommentVNode("", true)])], 544);
327634
327916
  };
327635
327917
  }
327636
- }, [["__scopeId", "data-v-79953d57"]]);
327918
+ }, [["__scopeId", "data-v-5444b0c8"]]);
327637
327919
  isHighContrastMode = exports_vue.ref(false);
327638
327920
  toolbarIcons = {
327639
327921
  undo: rotate_left_solid_default,
@@ -327797,7 +328079,7 @@ function print() { __p += __j.call(arguments, '') }
327797
328079
  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) => {
327798
328080
  return exports_vue.createElementVNode("div", {
327799
328081
  key: button.key,
327800
- class: "button-icon",
328082
+ class: "sd-button-icon",
327801
328083
  onClick: ($event) => select2(button.key),
327802
328084
  innerHTML: button.icon,
327803
328085
  "data-item": "btn-textAlign-option",
@@ -327811,7 +328093,7 @@ function print() { __p += __j.call(arguments, '') }
327811
328093
  }), 64))], 2);
327812
328094
  };
327813
328095
  }
327814
- }, [["__scopeId", "data-v-3f7f0d98"]]);
328096
+ }, [["__scopeId", "data-v-ceb338e0"]]);
327815
328097
  _hoisted_1$19 = [
327816
328098
  "onClick",
327817
328099
  "innerHTML",
@@ -327891,7 +328173,7 @@ function print() { __p += __j.call(arguments, '') }
327891
328173
  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) => {
327892
328174
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
327893
328175
  key: button.key,
327894
- class: exports_vue.normalizeClass(["button-icon", { selected: props.selectedStyle === button.key }]),
328176
+ class: exports_vue.normalizeClass(["sd-button-icon", { "sd-selected": props.selectedStyle === button.key }]),
327895
328177
  style: exports_vue.normalizeStyle(iconStyle.value),
327896
328178
  onClick: ($event) => select2(button.key),
327897
328179
  innerHTML: button.icon,
@@ -327905,7 +328187,7 @@ function print() { __p += __j.call(arguments, '') }
327905
328187
  }), 128))], 2);
327906
328188
  };
327907
328189
  }
327908
- }, [["__scopeId", "data-v-d374ab76"]]);
328190
+ }, [["__scopeId", "data-v-701c1d54"]]);
327909
328191
  bulletStyleButtons = [
327910
328192
  {
327911
328193
  key: "disc",
@@ -328023,7 +328305,7 @@ function print() { __p += __j.call(arguments, '') }
328023
328305
  return (_ctx, _cache) => {
328024
328306
  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) => {
328025
328307
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
328026
- class: exports_vue.normalizeClass(["option-item", { disabled: option.disabled }]),
328308
+ class: exports_vue.normalizeClass(["sd-option-item", { "sd-disabled": option.disabled }]),
328027
328309
  onClick: ($event) => handleClick$1(option),
328028
328310
  "data-item": "btn-documentMode-option",
328029
328311
  role: "menuitem",
@@ -328038,7 +328320,7 @@ function print() { __p += __j.call(arguments, '') }
328038
328320
  }), 256))], 2);
328039
328321
  };
328040
328322
  }
328041
- }, [["__scopeId", "data-v-8587478e"]]);
328323
+ }, [["__scopeId", "data-v-abd514d9"]]);
328042
328324
  _hoisted_1$17 = {
328043
328325
  key: 0,
328044
328326
  class: "linked-style-buttons",
@@ -328340,13 +328622,13 @@ function print() { __p += __j.call(arguments, '') }
328340
328622
  type: "text",
328341
328623
  name: "link",
328342
328624
  placeholder: "Type or paste a link",
328343
- class: exports_vue.normalizeClass({ error: urlError.value }),
328625
+ class: exports_vue.normalizeClass({ "sd-error": urlError.value }),
328344
328626
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => rawUrl.value = $event),
328345
328627
  readonly: isViewingMode.value,
328346
328628
  onKeydown: [exports_vue.withKeys(exports_vue.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]), _cache[3] || (_cache[3] = ($event) => urlError.value = false)]
328347
328629
  }, null, 42, _hoisted_10$1), [[exports_vue.vModelText, rawUrl.value]]),
328348
328630
  exports_vue.createElementVNode("div", {
328349
- class: exports_vue.normalizeClass(["open-link-icon", { disabled: !validUrl.value }]),
328631
+ class: exports_vue.normalizeClass(["open-link-icon", { "sd-disabled": !validUrl.value }]),
328350
328632
  innerHTML: exports_vue.unref(toolbarIcons).openLink,
328351
328633
  onClick: openLink,
328352
328634
  "data-item": "btn-link-open"
@@ -328361,14 +328643,14 @@ function print() { __p += __j.call(arguments, '') }
328361
328643
  class: "remove-btn__icon",
328362
328644
  innerHTML: exports_vue.unref(toolbarIcons).removeLink
328363
328645
  }, null, 8, _hoisted_13), _cache[6] || (_cache[6] = exports_vue.createTextVNode(" Remove ", -1))])) : exports_vue.createCommentVNode("", true), exports_vue.createElementVNode("button", {
328364
- class: exports_vue.normalizeClass(["submit-btn", { "disable-btn": isDisabled.value }]),
328646
+ class: exports_vue.normalizeClass(["sd-submit-btn", { "disable-btn": isDisabled.value }]),
328365
328647
  onClick: handleSubmit,
328366
328648
  "data-item": "btn-link-apply"
328367
328649
  }, " Apply ", 2)])) : exports_vue.createCommentVNode("", true)
328368
328650
  ])) : 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);
328369
328651
  };
328370
328652
  }
328371
- }, [["__scopeId", "data-v-56a53c8c"]]);
328653
+ }, [["__scopeId", "data-v-c490d677"]]);
328372
328654
  _hoisted_1$15 = [
328373
328655
  "aria-label",
328374
328656
  "onClick",
@@ -328475,7 +328757,7 @@ function print() { __p += __j.call(arguments, '') }
328475
328757
  return (_ctx, _cache) => {
328476
328758
  return exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(__props.icons, (row2, rowIndex) => {
328477
328759
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
328478
- class: "option-row",
328760
+ class: "sd-option-row",
328479
328761
  key: rowIndex,
328480
328762
  role: "group",
328481
328763
  ref_for: true,
@@ -328483,7 +328765,7 @@ function print() { __p += __j.call(arguments, '') }
328483
328765
  ref: rowRefs
328484
328766
  }, [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(row2, (option, optionIndex) => {
328485
328767
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
328486
- class: "option",
328768
+ class: "sd-option",
328487
328769
  key: optionIndex,
328488
328770
  "aria-label": option.label,
328489
328771
  role: "menuitem",
@@ -328493,12 +328775,12 @@ function print() { __p += __j.call(arguments, '') }
328493
328775
  onClick: exports_vue.withModifiers(($event) => handleClick$1(option), ["stop", "prevent"]),
328494
328776
  onKeydown: exports_vue.withModifiers((event) => handleKeyDown$1(event, rowIndex, optionIndex, option), ["prevent"])
328495
328777
  }, [exports_vue.createElementVNode("div", {
328496
- class: "option__icon",
328778
+ class: "sd-option__icon",
328497
328779
  innerHTML: option.icon,
328498
328780
  style: exports_vue.normalizeStyle(option.style)
328499
328781
  }, null, 12, _hoisted_2$12), isActive$1.value(option) ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
328500
328782
  key: 0,
328501
- class: "option__check",
328783
+ class: "sd-option__check",
328502
328784
  innerHTML: exports_vue.unref(toolbarIcons).colorOptionCheck,
328503
328785
  style: exports_vue.normalizeStyle(getCheckStyle(option.value, optionIndex))
328504
328786
  }, null, 12, _hoisted_3$9)) : exports_vue.createCommentVNode("", true)], 40, _hoisted_1$15);
@@ -328506,7 +328788,7 @@ function print() { __p += __j.call(arguments, '') }
328506
328788
  }), 128);
328507
328789
  };
328508
328790
  }
328509
- }, [["__scopeId", "data-v-59855ce7"]]);
328791
+ }, [["__scopeId", "data-v-30cad300"]]);
328510
328792
  _hoisted_1$14 = { class: "options-grid-wrap" };
328511
328793
  _hoisted_2$11 = ["innerHTML"];
328512
328794
  _hoisted_3$8 = { class: "option-grid-ctn" };
@@ -328662,9 +328944,9 @@ function print() { __p += __j.call(arguments, '') }
328662
328944
  let itemsCols = parseInt(item.dataset.cols, 10);
328663
328945
  let itemsRows = parseInt(item.dataset.rows, 10);
328664
328946
  if (itemsCols <= cols && itemsRows <= rows)
328665
- item.classList.add("selected");
328947
+ item.classList.add("sd-selected");
328666
328948
  else
328667
- item.classList.remove("selected");
328949
+ item.classList.remove("sd-selected");
328668
328950
  }
328669
328951
  };
328670
328952
  const handleClick$1 = ({ cols, rows }) => {
@@ -328757,7 +329039,7 @@ function print() { __p += __j.call(arguments, '') }
328757
329039
  }, exports_vue.toDisplayString(selectedRows.value) + " x " + exports_vue.toDisplayString(selectedCols.value), 9, _hoisted_2$10)], 2);
328758
329040
  };
328759
329041
  }
328760
- }, [["__scopeId", "data-v-5cefb109"]]);
329042
+ }, [["__scopeId", "data-v-168b91ce"]]);
328761
329043
  _hoisted_1$12 = { class: "toolbar-table-actions" };
328762
329044
  _hoisted_2$9 = [
328763
329045
  "onClick",
@@ -328793,7 +329075,7 @@ function print() { __p += __j.call(arguments, '') }
328793
329075
  }
328794
329076
  }, [["__scopeId", "data-v-652015c8"]]);
328795
329077
  _hoisted_1$11 = { class: "search-input-ctn" };
328796
- _hoisted_2$8 = { class: "row" };
329078
+ _hoisted_2$8 = { class: "sd-row" };
328797
329079
  _hoisted_3$6 = ["onKeydown"];
328798
329080
  SearchInput_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
328799
329081
  __name: "SearchInput",
@@ -328814,13 +329096,13 @@ function print() { __p += __j.call(arguments, '') }
328814
329096
  name: "search",
328815
329097
  placeholder: "Type search string",
328816
329098
  onKeydown: exports_vue.withKeys(exports_vue.withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
328817
- }, null, 40, _hoisted_3$6), [[exports_vue.vModelText, searchValue.value]])]), exports_vue.createElementVNode("div", { class: "row submit" }, [exports_vue.createElementVNode("button", {
328818
- class: "submit-btn",
329099
+ }, null, 40, _hoisted_3$6), [[exports_vue.vModelText, searchValue.value]])]), exports_vue.createElementVNode("div", { class: "sd-row sd-submit" }, [exports_vue.createElementVNode("button", {
329100
+ class: "sd-submit-btn",
328819
329101
  onClick: handleSubmit
328820
329102
  }, "Apply")])]);
328821
329103
  };
328822
329104
  }
328823
- }, [["__scopeId", "data-v-bfe34b7b"]]);
329105
+ }, [["__scopeId", "data-v-d25821a5"]]);
328824
329106
  TOOLBAR_FONTS = [
328825
329107
  {
328826
329108
  label: "Georgia",
@@ -328987,7 +329269,7 @@ function print() { __p += __j.call(arguments, '') }
328987
329269
  HEADLESS_TOOLBAR_COMMANDS = [...new Set([...Object.values(HEADLESS_ITEM_MAP), ...TABLE_ACTION_COMMAND_IDS])];
328988
329270
  NON_HEADLESS_EXECUTE_ITEM_NAMES = new Set(["link"]);
328989
329271
  HEADLESS_EXECUTE_ITEMS = new Set(Object.keys(HEADLESS_ITEM_MAP).filter((itemName) => !NON_HEADLESS_EXECUTE_ITEM_NAMES.has(itemName)));
328990
- _hoisted_1$10 = { class: "toolbar-icon" };
329272
+ _hoisted_1$10 = { class: "sd-toolbar-icon" };
328991
329273
  _hoisted_2$7 = ["innerHTML"];
328992
329274
  ToolbarButtonIcon_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
328993
329275
  __name: "ToolbarButtonIcon",
@@ -329018,7 +329300,7 @@ function print() { __p += __j.call(arguments, '') }
329018
329300
  });
329019
329301
  return (_ctx, _cache) => {
329020
329302
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", _hoisted_1$10, [exports_vue.createElementVNode("div", {
329021
- class: exports_vue.normalizeClass(["toolbar-icon__icon", [`toolbar-icon__icon--${props.name}`]]),
329303
+ class: exports_vue.normalizeClass(["sd-toolbar-icon__icon", [`sd-toolbar-icon__icon--${props.name}`]]),
329022
329304
  innerHTML: __props.icon
329023
329305
  }, null, 10, _hoisted_2$7), hasColorBar.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
329024
329306
  key: 0,
@@ -329027,19 +329309,19 @@ function print() { __p += __j.call(arguments, '') }
329027
329309
  }, null, 4)) : exports_vue.createCommentVNode("", true)]);
329028
329310
  };
329029
329311
  }
329030
- }, [["__scopeId", "data-v-8c30c125"]]);
329312
+ }, [["__scopeId", "data-v-521c3d93"]]);
329031
329313
  _hoisted_1$9 = ["role", "aria-label"];
329032
329314
  _hoisted_2$6 = ["data-item"];
329033
329315
  _hoisted_3$5 = ["data-item"];
329034
329316
  _hoisted_4$4 = {
329035
329317
  key: 1,
329036
- class: "button-label"
329318
+ class: "sd-button-label"
329037
329319
  };
329038
329320
  _hoisted_5$2 = ["data-item", "aria-label"];
329039
329321
  _hoisted_6$1 = ["innerHTML"];
329040
329322
  _hoisted_7$1 = {
329041
329323
  key: 1,
329042
- class: "button-label"
329324
+ class: "sd-button-label"
329043
329325
  };
329044
329326
  _hoisted_8 = { key: 2 };
329045
329327
  _hoisted_9 = ["onKeydown", "id"];
@@ -329051,7 +329333,7 @@ function print() { __p += __j.call(arguments, '') }
329051
329333
  _hoisted_11 = ["innerHTML"];
329052
329334
  _hoisted_12 = {
329053
329335
  "aria-live": "polite",
329054
- class: "visually-hidden"
329336
+ class: "sd-visually-hidden"
329055
329337
  };
329056
329338
  ToolbarButton_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
329057
329339
  __name: "ToolbarButton",
@@ -329149,17 +329431,18 @@ function print() { __p += __j.call(arguments, '') }
329149
329431
  });
329150
329432
  return (_ctx, _cache) => {
329151
329433
  return exports_vue.openBlock(), exports_vue.createElementBlock("div", {
329152
- class: exports_vue.normalizeClass(["toolbar-item", exports_vue.unref(attributes).className]),
329434
+ class: exports_vue.normalizeClass(["sd-toolbar-item", exports_vue.unref(attributes).className]),
329153
329435
  style: exports_vue.normalizeStyle(getStyle.value),
329154
329436
  role: __props.isOverflowItem ? "menuitem" : "button",
329155
329437
  "aria-label": exports_vue.unref(attributes).ariaLabel,
329438
+ "data-sd-part": "toolbar-item",
329156
329439
  onClick: handleOuterClick,
329157
329440
  onKeydown: _cache[3] || (_cache[3] = exports_vue.withKeys(($event) => onEnterKeydown($event), ["enter"])),
329158
329441
  tabindex: "0"
329159
329442
  }, [exports_vue.createElementVNode("div", {
329160
- class: exports_vue.normalizeClass(["toolbar-button", {
329161
- active: exports_vue.unref(active),
329162
- disabled: exports_vue.unref(disabled),
329443
+ class: exports_vue.normalizeClass(["sd-toolbar-button", {
329444
+ "sd-active": exports_vue.unref(active),
329445
+ "sd-disabled": exports_vue.unref(disabled),
329163
329446
  narrow: __props.isNarrow,
329164
329447
  wide: __props.isWide,
329165
329448
  split: isSplit.value,
@@ -329170,13 +329453,13 @@ function print() { __p += __j.call(arguments, '') }
329170
329453
  }, [
329171
329454
  isSplit.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
329172
329455
  key: 0,
329173
- class: "toolbar-button__main",
329456
+ class: "sd-toolbar-button__main",
329174
329457
  "data-item": `btn-${exports_vue.unref(name) || ""}-main`,
329175
329458
  onClick: _cache[0] || (_cache[0] = ($event) => handleSplitMainClick($event))
329176
329459
  }, [exports_vue.unref(icon) ? (exports_vue.openBlock(), exports_vue.createBlock(ToolbarButtonIcon_default, {
329177
329460
  key: 0,
329178
329461
  color: exports_vue.unref(iconColor),
329179
- class: "toolbar-icon",
329462
+ class: "sd-toolbar-icon",
329180
329463
  icon: exports_vue.unref(icon),
329181
329464
  name: exports_vue.unref(name)
329182
329465
  }, null, 8, [
@@ -329186,19 +329469,19 @@ function print() { __p += __j.call(arguments, '') }
329186
329469
  ])) : 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),
329187
329470
  isSplit.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
329188
329471
  key: 1,
329189
- class: "toolbar-button__caret",
329472
+ class: "sd-toolbar-button__caret",
329190
329473
  "data-item": `btn-${exports_vue.unref(name) || ""}-caret`,
329191
329474
  "aria-label": `${exports_vue.unref(attributes).ariaLabel} options`,
329192
329475
  role: "button"
329193
329476
  }, [exports_vue.createElementVNode("div", {
329194
- class: "dropdown-caret",
329477
+ class: "sd-dropdown-caret",
329195
329478
  innerHTML: caretIcon.value,
329196
329479
  style: exports_vue.normalizeStyle({ opacity: exports_vue.unref(disabled) ? 0.6 : 1 })
329197
329480
  }, null, 12, _hoisted_6$1)], 8, _hoisted_5$2)) : (exports_vue.openBlock(), exports_vue.createElementBlock(exports_vue.Fragment, { key: 2 }, [
329198
329481
  exports_vue.unref(icon) ? (exports_vue.openBlock(), exports_vue.createBlock(ToolbarButtonIcon_default, {
329199
329482
  key: 0,
329200
329483
  color: exports_vue.unref(iconColor),
329201
- class: "toolbar-icon",
329484
+ class: "sd-toolbar-icon",
329202
329485
  icon: exports_vue.unref(icon),
329203
329486
  name: exports_vue.unref(name)
329204
329487
  }, null, 8, [
@@ -329231,7 +329514,7 @@ function print() { __p += __j.call(arguments, '') }
329231
329514
  }, null, 40, _hoisted_10)), [[exports_vue.vModelText, inlineTextInput.value]])])) : exports_vue.createCommentVNode("", true),
329232
329515
  exports_vue.unref(hasCaret) ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", {
329233
329516
  key: 3,
329234
- class: "dropdown-caret",
329517
+ class: "sd-dropdown-caret",
329235
329518
  innerHTML: caretIcon.value,
329236
329519
  style: exports_vue.normalizeStyle({ opacity: exports_vue.unref(disabled) ? 0.6 : 1 })
329237
329520
  }, null, 12, _hoisted_11)) : exports_vue.createCommentVNode("", true)
@@ -329240,7 +329523,7 @@ function print() { __p += __j.call(arguments, '') }
329240
329523
  ], 10, _hoisted_2$6)], 46, _hoisted_1$9);
329241
329524
  };
329242
329525
  }
329243
- }, [["__scopeId", "data-v-dcf6ef0b"]]);
329526
+ }, [["__scopeId", "data-v-360f6a95"]]);
329244
329527
  _hoisted_1$8 = {
329245
329528
  class: "toolbar-separator",
329246
329529
  role: "separator",
@@ -329477,11 +329760,11 @@ function print() { __p += __j.call(arguments, '') }
329477
329760
  if (!value)
329478
329761
  return false;
329479
329762
  if (typeof value === "string")
329480
- return value.split(/\s+/).includes("selected");
329763
+ return value.split(/\s+/).includes("sd-selected");
329481
329764
  if (Array.isArray(value))
329482
329765
  return value.some(classHasSelected);
329483
329766
  if (typeof value === "object")
329484
- return Boolean(value.selected);
329767
+ return Boolean(value["sd-selected"]);
329485
329768
  return false;
329486
329769
  };
329487
329770
  const isOptionSelected = (option) => {
@@ -329672,12 +329955,14 @@ function print() { __p += __j.call(arguments, '') }
329672
329955
  ref_key: "triggerRef",
329673
329956
  ref: triggerRef,
329674
329957
  class: "toolbar-dropdown-trigger",
329958
+ "data-sd-part": "dropdown-trigger",
329675
329959
  onClick: onTriggerClick
329676
329960
  }, [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" }, {
329677
329961
  default: exports_vue.withCtx(() => [isOpen.value ? (exports_vue.openBlock(), exports_vue.createElementBlock("div", exports_vue.mergeProps({
329678
329962
  key: 0,
329679
329963
  ref_key: "menuRef",
329680
329964
  ref: menuRef,
329965
+ "data-sd-part": "dropdown-menu",
329681
329966
  class: mergedMenuClass.value,
329682
329967
  style: menuStyle.value
329683
329968
  }, computedMenuAttrs.value), [(exports_vue.openBlock(true), exports_vue.createElementBlock(exports_vue.Fragment, null, exports_vue.renderList(__props.options, (option, index2) => {
@@ -329689,8 +329974,8 @@ function print() { __p += __j.call(arguments, '') }
329689
329974
  option.class,
329690
329975
  option.props?.class,
329691
329976
  {
329692
- disabled: option.disabled,
329693
- render: isRenderOption(option)
329977
+ "sd-disabled": option.disabled,
329978
+ "sd-render": isRenderOption(option)
329694
329979
  }
329695
329980
  ]],
329696
329981
  tabindex: "-1",
@@ -329707,7 +329992,7 @@ function print() { __p += __j.call(arguments, '') }
329707
329992
  })]))]);
329708
329993
  };
329709
329994
  }
329710
- }, [["__scopeId", "data-v-261e2a66"]]);
329995
+ }, [["__scopeId", "data-v-302f7d86"]]);
329711
329996
  SdTooltip_default = /* @__PURE__ */ __plugin_vue_export_helper_default(/* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
329712
329997
  __name: "SdTooltip",
329713
329998
  props: {
@@ -330058,7 +330343,7 @@ function print() { __p += __j.call(arguments, '') }
330058
330343
  ...option,
330059
330344
  props: {
330060
330345
  ...option.props,
330061
- class: isSelected ? "selected" : ""
330346
+ class: isSelected ? "sd-selected" : ""
330062
330347
  }
330063
330348
  };
330064
330349
  });
@@ -330071,7 +330356,7 @@ function print() { __p += __j.call(arguments, '') }
330071
330356
  };
330072
330357
  const moveToNextButton = (e) => {
330073
330358
  const currentButton = e.target;
330074
- const nextButton = e.target.closest(".toolbar-item-ctn").nextElementSibling;
330359
+ const nextButton = e.target.closest(".sd-toolbar-item-ctn").nextElementSibling;
330075
330360
  if (nextButton) {
330076
330361
  currentButton.setAttribute("tabindex", "-1");
330077
330362
  nextButton.setAttribute("tabindex", "0");
@@ -330080,7 +330365,7 @@ function print() { __p += __j.call(arguments, '') }
330080
330365
  };
330081
330366
  const moveToPreviousButton = (e) => {
330082
330367
  const currentButton = e.target;
330083
- const previousButton = e.target.closest(".toolbar-item-ctn").previousElementSibling;
330368
+ const previousButton = e.target.closest(".sd-toolbar-item-ctn").previousElementSibling;
330084
330369
  if (previousButton) {
330085
330370
  currentButton.setAttribute("tabindex", "-1");
330086
330371
  previousButton.setAttribute("tabindex", "0");
@@ -330158,7 +330443,7 @@ function print() { __p += __j.call(arguments, '') }
330158
330443
  }
330159
330444
  };
330160
330445
  const handleFocus = (e) => {
330161
- const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("disabled"));
330446
+ const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("sd-disabled"));
330162
330447
  if (firstButton) {
330163
330448
  firstButton.setAttribute("tabindex", "0");
330164
330449
  firstButton.focus();
@@ -330214,8 +330499,8 @@ function print() { __p += __j.call(arguments, '') }
330214
330499
  class: exports_vue.normalizeClass([{
330215
330500
  narrow: item.isNarrow.value,
330216
330501
  wide: item.isWide.value,
330217
- disabled: item.disabled.value
330218
- }, "toolbar-item-ctn"]),
330502
+ "sd-disabled": item.disabled.value
330503
+ }, "sd-toolbar-item-ctn"]),
330219
330504
  onKeydown: (e) => handleKeyDown$1(e, item),
330220
330505
  ref_for: true,
330221
330506
  ref_key: "toolbarItemRefs",
@@ -330234,7 +330519,7 @@ function print() { __p += __j.call(arguments, '') }
330234
330519
  show: getExpanded(item),
330235
330520
  "content-style": { fontFamily: props.uiFontFamily },
330236
330521
  placement: "bottom-start",
330237
- class: "toolbar-button sd-editor-toolbar-dropdown",
330522
+ class: "sd-toolbar-button sd-editor-toolbar-dropdown",
330238
330523
  onSelect: (key2, option) => handleSelect(item, option),
330239
330524
  "onUpdate:show": (open) => handleDropdownUpdateShowForItem(open, item),
330240
330525
  style: exports_vue.normalizeStyle(item.dropdownStyles.value),
@@ -330311,7 +330596,7 @@ function print() { __p += __j.call(arguments, '') }
330311
330596
  }), 128))], 36);
330312
330597
  };
330313
330598
  }
330314
- }, [["__scopeId", "data-v-109576cd"]]);
330599
+ }, [["__scopeId", "data-v-9c3524ec"]]);
330315
330600
  Toolbar_default = /* @__PURE__ */ __plugin_vue_export_helper_default({
330316
330601
  __name: "Toolbar",
330317
330602
  emits: [
@@ -330405,6 +330690,7 @@ function print() { __p += __j.call(arguments, '') }
330405
330690
  key: exports_vue.unref(toolbarKey),
330406
330691
  role: "toolbar",
330407
330692
  "aria-label": "Toolbar",
330693
+ "data-sd-part": "toolbar",
330408
330694
  "data-editor-ui-surface": "",
330409
330695
  onMousedown: handleToolbarMousedown
330410
330696
  }, [
@@ -330456,7 +330742,7 @@ function print() { __p += __j.call(arguments, '') }
330456
330742
  ], 32);
330457
330743
  };
330458
330744
  }
330459
- }, [["__scopeId", "data-v-bae4cd8a"]]);
330745
+ }, [["__scopeId", "data-v-b83d488a"]]);
330460
330746
  toolbarTexts = {
330461
330747
  bold: "Bold",
330462
330748
  fontFamily: "Font",
@@ -330545,7 +330831,8 @@ function print() { __p += __j.call(arguments, '') }
330545
330831
  aiApiKey: null,
330546
330832
  aiEndpoint: null,
330547
330833
  customButtons: [],
330548
- showFormattingMarksButton: false
330834
+ showFormattingMarksButton: false,
330835
+ showTableOfContentsButton: false
330549
330836
  };
330550
330837
  toolbarItems = [];
330551
330838
  overflowItems = [];
@@ -342852,11 +343139,11 @@ function print() { __p += __j.call(arguments, '') }
342852
343139
  ]);
342853
343140
  });
342854
343141
 
342855
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DKJYU_qM.es.js
343142
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-BKVodoDg.es.js
342856
343143
  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;
342857
- var init_create_super_doc_ui_DKJYU_qM_es = __esm(() => {
342858
- init_SuperConverter_C6hKp29w_es();
342859
- init_create_headless_toolbar_ISx0N5AS_es();
343144
+ var init_create_super_doc_ui_BKVodoDg_es = __esm(() => {
343145
+ init_SuperConverter_DHtZjY65_es();
343146
+ init_create_headless_toolbar_lxRAue2X_es();
342860
343147
  MOD_ALIASES = new Set([
342861
343148
  "Mod",
342862
343149
  "Meta",
@@ -342898,16 +343185,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
342898
343185
 
342899
343186
  // ../../packages/superdoc/dist/super-editor.es.js
342900
343187
  var init_super_editor_es = __esm(() => {
342901
- init_src_Bm7Xq4ys_es();
342902
- init_SuperConverter_C6hKp29w_es();
343188
+ init_src_BlbgbalI_es();
343189
+ init_SuperConverter_DHtZjY65_es();
342903
343190
  init_jszip_C49i9kUs_es();
342904
343191
  init_xml_js_CqGKpaft_es();
342905
- init_create_headless_toolbar_ISx0N5AS_es();
343192
+ init_create_headless_toolbar_lxRAue2X_es();
342906
343193
  init_constants_D_X7xF4s_es();
342907
343194
  init_dist_B8HfvhaK_es();
342908
343195
  init_unified_Dsuw2be5_es();
342909
343196
  init_DocxZipper_nv_KfOqb_es();
342910
- init_create_super_doc_ui_DKJYU_qM_es();
343197
+ init_create_super_doc_ui_BKVodoDg_es();
342911
343198
  init_ui_C5PAS9hY_es();
342912
343199
  init_eventemitter3_BnGqBE_Q_es();
342913
343200
  init_errors_CNaD6vcg_es();
@@ -364775,14 +365062,27 @@ var init_index_cache = __esm(() => {
364775
365062
  cacheByEditor2 = new WeakMap;
364776
365063
  });
364777
365064
 
365065
+ // ../../packages/super-editor/src/editors/v1/extensions/track-changes/constants.js
365066
+ var TrackInsertMarkName2 = "trackInsert", TrackDeleteMarkName2 = "trackDelete", TrackFormatMarkName2 = "trackFormat";
365067
+ var init_constants = () => {};
365068
+
364778
365069
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/text-offset-resolver.ts
365070
+ function isVisibleTextModel2(options) {
365071
+ return options?.textModel === "visible";
365072
+ }
365073
+ function hasTrackDeleteMark3(node3) {
365074
+ return node3.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2) ?? false;
365075
+ }
365076
+ function shouldSkipTextNode2(node3, options) {
365077
+ return isVisibleTextModel2(options) && hasTrackDeleteMark3(node3);
365078
+ }
364779
365079
  function resolveSegmentPosition3(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
364780
365080
  if (segmentLength <= 1) {
364781
365081
  return targetOffset <= segmentStart ? docFrom : docTo;
364782
365082
  }
364783
365083
  return docFrom + (targetOffset - segmentStart);
364784
365084
  }
364785
- function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
365085
+ function pmPositionToTextOffset2(blockNode, blockPos, pmPos, options) {
364786
365086
  const contentStart = blockPos + 1;
364787
365087
  if (pmPos <= contentStart)
364788
365088
  return 0;
@@ -364794,6 +365094,11 @@ function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
364794
365094
  if (node3.isText) {
364795
365095
  const text5 = node3.text ?? "";
364796
365096
  const endPos = docPos + text5.length;
365097
+ if (shouldSkipTextNode2(node3, options)) {
365098
+ if (pmPos < endPos)
365099
+ done = true;
365100
+ return;
365101
+ }
364797
365102
  if (pmPos >= endPos) {
364798
365103
  offset2 += text5.length;
364799
365104
  } else {
@@ -364837,10 +365142,12 @@ function pmPositionToTextOffset2(blockNode, blockPos, pmPos) {
364837
365142
  visitContent(blockNode, contentStart);
364838
365143
  return offset2;
364839
365144
  }
364840
- function computeTextContentLength2(blockNode) {
365145
+ function computeTextContentLength2(blockNode, options) {
364841
365146
  let length3 = 0;
364842
365147
  const walk = (node3) => {
364843
365148
  if (node3.isText) {
365149
+ if (shouldSkipTextNode2(node3, options))
365150
+ return;
364844
365151
  length3 += (node3.text ?? "").length;
364845
365152
  return;
364846
365153
  }
@@ -364867,7 +365174,7 @@ function computeTextContentLength2(blockNode) {
364867
365174
  }
364868
365175
  return length3;
364869
365176
  }
364870
- function resolveTextRangeInBlock2(blockNode, blockPos, range) {
365177
+ function resolveTextRangeInBlock2(blockNode, blockPos, range, options) {
364871
365178
  if (range.start < 0 || range.end < range.start)
364872
365179
  return null;
364873
365180
  let offset2 = 0;
@@ -364902,7 +365209,7 @@ function resolveTextRangeInBlock2(blockNode, blockPos, range) {
364902
365209
  const walkNode3 = (node3, docPos) => {
364903
365210
  if (node3.isText) {
364904
365211
  const text5 = node3.text ?? "";
364905
- if (text5.length > 0) {
365212
+ if (text5.length > 0 && !shouldSkipTextNode2(node3, options)) {
364906
365213
  advanceSegment(text5.length, docPos, docPos + text5.length);
364907
365214
  }
364908
365215
  return;
@@ -364924,6 +365231,43 @@ function resolveTextRangeInBlock2(blockNode, blockPos, range) {
364924
365231
  return null;
364925
365232
  return { from: fromPos, to: toPos };
364926
365233
  }
365234
+ function textContentInBlock2(blockNode, options) {
365235
+ let text5 = "";
365236
+ const walkNode3 = (node3) => {
365237
+ if (node3.isText) {
365238
+ if (!shouldSkipTextNode2(node3, options)) {
365239
+ text5 += node3.text ?? "";
365240
+ }
365241
+ return;
365242
+ }
365243
+ if (node3.isLeaf) {
365244
+ text5 += "";
365245
+ return;
365246
+ }
365247
+ let isFirstChild2 = true;
365248
+ for (let i4 = 0;i4 < node3.childCount; i4++) {
365249
+ const child = node3.child(i4);
365250
+ if (child.isBlock && !isFirstChild2)
365251
+ text5 += `
365252
+ `;
365253
+ walkNode3(child);
365254
+ isFirstChild2 = false;
365255
+ }
365256
+ };
365257
+ let isFirstChild = true;
365258
+ for (let i4 = 0;i4 < blockNode.childCount; i4++) {
365259
+ const child = blockNode.child(i4);
365260
+ if (child.isBlock && !isFirstChild)
365261
+ text5 += `
365262
+ `;
365263
+ walkNode3(child);
365264
+ isFirstChild = false;
365265
+ }
365266
+ return text5;
365267
+ }
365268
+ var init_text_offset_resolver = __esm(() => {
365269
+ init_constants();
365270
+ });
364927
365271
 
364928
365272
  // ../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js
364929
365273
  function findDiffStart2(a2, b2, pos) {
@@ -367165,7 +367509,7 @@ function parentAllowsNodeAt2(tr, absPos, nodeType) {
367165
367509
  return true;
367166
367510
  return contentMatch.matchType(nodeType) != null;
367167
367511
  }
367168
- function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367512
+ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback, options = {}) {
367169
367513
  const anyDoc = doc5;
367170
367514
  if (typeof anyDoc.nodesBetween !== "function") {
367171
367515
  if (typeof anyDoc.textBetween === "function") {
@@ -367187,6 +367531,9 @@ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367187
367531
  return false;
367188
367532
  }
367189
367533
  if (node3.isText) {
367534
+ if (options.textModel === "visible" && node3.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2)) {
367535
+ return false;
367536
+ }
367190
367537
  const start2 = Math.max(from3, pos) - pos;
367191
367538
  const end = Math.min(to, pos + node3.nodeSize) - pos;
367192
367539
  const text5 = typeof node3.text === "string" ? node3.text : "".repeat(node3.nodeSize);
@@ -367216,6 +367563,7 @@ function textBetweenWithTabs2(doc5, from3, to, blockSeparator, leafFallback) {
367216
367563
  }
367217
367564
  var init_text_with_tabs = __esm(() => {
367218
367565
  init_dist2();
367566
+ init_constants();
367219
367567
  });
367220
367568
 
367221
367569
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/text-mutation-resolution.ts
@@ -367266,7 +367614,7 @@ function resolveTextTarget2(editor, target) {
367266
367614
  const block = matches3[0];
367267
367615
  if (!block)
367268
367616
  return null;
367269
- return resolveTextRangeInBlock2(block.node, block.pos, target.range);
367617
+ return resolveTextRangeInBlock2(block.node, block.pos, target.range, { textModel: "visible" });
367270
367618
  }
367271
367619
  function resolveInlineInsertPosition2(editor, at, operationName) {
367272
367620
  const firstSegment = at.segments[0];
@@ -367313,8 +367661,8 @@ function resolveDefaultInsertTarget2(editor) {
367313
367661
  for (let i4 = index2.candidates.length - 1;i4 >= 0; i4--) {
367314
367662
  const candidate = index2.candidates[i4];
367315
367663
  if (topLevelPositions.has(candidate.pos) && isTextBlockCandidate2(candidate)) {
367316
- const textLength = computeTextContentLength2(candidate.node);
367317
- const range = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: textLength, end: textLength });
367664
+ const textLength = computeTextContentLength2(candidate.node, { textModel: "visible" });
367665
+ const range = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: textLength, end: textLength }, { textModel: "visible" });
367318
367666
  if (!range)
367319
367667
  continue;
367320
367668
  return {
@@ -367448,6 +367796,7 @@ var init_adapter_utils = __esm(() => {
367448
367796
  init_src();
367449
367797
  init_index_cache();
367450
367798
  init_node_address_resolver();
367799
+ init_text_offset_resolver();
367451
367800
  init_text_mutation_resolution();
367452
367801
  init_errors4();
367453
367802
  init_text_with_tabs();
@@ -371201,11 +371550,17 @@ var init_sections_resolver = __esm(() => {
371201
371550
  });
371202
371551
 
371203
371552
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/sd-projection.ts
371204
- function projectContentNode2(pmNode) {
371205
- return projectBlock2(pmNode);
371553
+ function isVisibleProjection2(options) {
371554
+ return options?.textModel === "visible";
371206
371555
  }
371207
- function projectInlineNode2(pmNode) {
371208
- return projectInline2(pmNode);
371556
+ function hasTrackDeleteMark4(pmNode) {
371557
+ return pmNode.marks?.some((mark2) => mark2.type.name === TrackDeleteMarkName2) ?? false;
371558
+ }
371559
+ function projectContentNode2(pmNode, options) {
371560
+ return projectBlock2(pmNode, options);
371561
+ }
371562
+ function projectInlineNode2(pmNode, options) {
371563
+ return projectInline2(pmNode, options) ?? { kind: "run", run: { text: "" } };
371209
371564
  }
371210
371565
  function projectMarkBasedInline2(editor, candidate) {
371211
371566
  const { nodeType, anchor, attrs } = candidate;
@@ -371250,8 +371605,9 @@ function resolveTextByBlockId2(editor, anchor) {
371250
371605
  function projectDocument2(editor, options) {
371251
371606
  const doc5 = editor.state.doc;
371252
371607
  const body = [];
371608
+ const projectionOptions = { textModel: "visible" };
371253
371609
  doc5.forEach((child) => {
371254
- body.push(projectBlock2(child));
371610
+ body.push(projectBlock2(child, projectionOptions));
371255
371611
  });
371256
371612
  const sections = projectSections2(editor);
371257
371613
  const numbering = projectNumberingCatalog2(editor);
@@ -371340,27 +371696,27 @@ function projectNumberingCatalog2(editor) {
371340
371696
  }
371341
371697
  return Object.keys(catalog.definitions).length > 0 ? catalog : undefined;
371342
371698
  }
371343
- function projectBlock2(pmNode) {
371699
+ function projectBlock2(pmNode, options) {
371344
371700
  const typeName = pmNode.type.name;
371345
371701
  switch (typeName) {
371346
371702
  case "paragraph":
371347
- return projectParagraphOrHeading2(pmNode);
371703
+ return projectParagraphOrHeading2(pmNode, options);
371348
371704
  case "heading":
371349
- return projectHeadingNode2(pmNode);
371705
+ return projectHeadingNode2(pmNode, options);
371350
371706
  case "table":
371351
- return projectTable2(pmNode);
371707
+ return projectTable2(pmNode, options);
371352
371708
  case "bulletList":
371353
371709
  case "orderedList":
371354
- return projectList2(pmNode, typeName === "orderedList");
371710
+ return projectList2(pmNode, typeName === "orderedList", options);
371355
371711
  case "listItem":
371356
- return projectListItemAsContent2(pmNode);
371712
+ return projectListItemAsContent2(pmNode, options);
371357
371713
  case "image":
371358
371714
  return projectBlockImage2(pmNode);
371359
371715
  case "tableOfContents":
371360
371716
  return projectToc2(pmNode);
371361
371717
  case "sdt":
371362
371718
  case "structuredContentBlock":
371363
- return projectBlockSdt2(pmNode);
371719
+ return projectBlockSdt2(pmNode, options);
371364
371720
  case "sectionBreak":
371365
371721
  return projectSectionBreak2(pmNode);
371366
371722
  case "pageBreak":
@@ -371369,25 +371725,25 @@ function projectBlock2(pmNode) {
371369
371725
  case "drawing":
371370
371726
  return projectBlockDrawing2(pmNode);
371371
371727
  default:
371372
- return projectFallbackBlock2(pmNode);
371728
+ return projectFallbackBlock2(pmNode, options);
371373
371729
  }
371374
371730
  }
371375
- function projectParagraphOrHeading2(pmNode) {
371731
+ function projectParagraphOrHeading2(pmNode, options) {
371376
371732
  const attrs = pmNode.attrs;
371377
371733
  const headingLevel = getHeadingLevel2(attrs?.paragraphProperties?.styleId);
371378
371734
  if (headingLevel && headingLevel >= 1 && headingLevel <= 6) {
371379
- return buildHeading2(pmNode, attrs, headingLevel);
371735
+ return buildHeading2(pmNode, attrs, headingLevel, options);
371380
371736
  }
371381
- return buildParagraph2(pmNode, attrs);
371737
+ return buildParagraph2(pmNode, attrs, options);
371382
371738
  }
371383
- function projectHeadingNode2(pmNode) {
371739
+ function projectHeadingNode2(pmNode, options) {
371384
371740
  const attrs = pmNode.attrs;
371385
371741
  const rawLevel = pmNode.attrs?.level;
371386
371742
  const level = rawLevel ?? getHeadingLevel2(attrs?.paragraphProperties?.styleId) ?? 1;
371387
- return buildHeading2(pmNode, attrs, level);
371743
+ return buildHeading2(pmNode, attrs, level, options);
371388
371744
  }
371389
- function buildParagraph2(pmNode, attrs) {
371390
- const inlines = projectInlineChildren2(pmNode);
371745
+ function buildParagraph2(pmNode, attrs, options) {
371746
+ const inlines = projectInlineChildren2(pmNode, options);
371391
371747
  const result = {
371392
371748
  kind: "paragraph",
371393
371749
  id: resolveNodeId2(pmNode),
@@ -371401,8 +371757,8 @@ function buildParagraph2(pmNode, attrs) {
371401
371757
  result.paragraph.props = props;
371402
371758
  return result;
371403
371759
  }
371404
- function buildHeading2(pmNode, attrs, level) {
371405
- const inlines = projectInlineChildren2(pmNode);
371760
+ function buildHeading2(pmNode, attrs, level, options) {
371761
+ const inlines = projectInlineChildren2(pmNode, options);
371406
371762
  const result = {
371407
371763
  kind: "heading",
371408
371764
  id: resolveNodeId2(pmNode),
@@ -371416,13 +371772,13 @@ function buildHeading2(pmNode, attrs, level) {
371416
371772
  result.heading.props = props;
371417
371773
  return result;
371418
371774
  }
371419
- function projectTable2(pmNode) {
371775
+ function projectTable2(pmNode, options) {
371420
371776
  const attrs = pmNode.attrs;
371421
371777
  const pmAttrs = pmNode.attrs;
371422
371778
  const rows = [];
371423
371779
  pmNode.forEach((child) => {
371424
371780
  if (child.type.name === "tableRow") {
371425
- rows.push(projectTableRow2(child));
371781
+ rows.push(projectTableRow2(child, options));
371426
371782
  }
371427
371783
  });
371428
371784
  const result = {
@@ -371454,11 +371810,11 @@ function projectTable2(pmNode) {
371454
371810
  }
371455
371811
  return result;
371456
371812
  }
371457
- function projectTableRow2(pmNode) {
371813
+ function projectTableRow2(pmNode, options) {
371458
371814
  const cells = [];
371459
371815
  pmNode.forEach((child) => {
371460
371816
  if (child.type.name === "tableCell" || child.type.name === "tableHeader") {
371461
- cells.push(projectTableCell2(child));
371817
+ cells.push(projectTableCell2(child, options));
371462
371818
  }
371463
371819
  });
371464
371820
  const row2 = { cells };
@@ -371472,11 +371828,11 @@ function projectTableRow2(pmNode) {
371472
371828
  }
371473
371829
  return row2;
371474
371830
  }
371475
- function projectTableCell2(pmNode) {
371831
+ function projectTableCell2(pmNode, options) {
371476
371832
  const attrs = pmNode.attrs;
371477
371833
  const content3 = [];
371478
371834
  pmNode.forEach((child) => {
371479
- content3.push(projectBlock2(child));
371835
+ content3.push(projectBlock2(child, options));
371480
371836
  });
371481
371837
  const cell2 = { content: content3 };
371482
371838
  if (attrs?.colspan && attrs.colspan > 1)
@@ -371490,11 +371846,11 @@ function projectTableCell2(pmNode) {
371490
371846
  }
371491
371847
  return cell2;
371492
371848
  }
371493
- function projectList2(pmNode, ordered) {
371849
+ function projectList2(pmNode, ordered, options) {
371494
371850
  const items = [];
371495
371851
  pmNode.forEach((child) => {
371496
371852
  if (child.type.name === "listItem") {
371497
- items.push(projectListItem2(child));
371853
+ items.push(projectListItem2(child, options));
371498
371854
  }
371499
371855
  });
371500
371856
  const result = {
@@ -371510,10 +371866,10 @@ function projectList2(pmNode, ordered) {
371510
371866
  result.list.styleRef = attrs.listStyleId;
371511
371867
  return result;
371512
371868
  }
371513
- function projectListItem2(pmNode) {
371869
+ function projectListItem2(pmNode, options) {
371514
371870
  const content3 = [];
371515
371871
  pmNode.forEach((child) => {
371516
- content3.push(projectBlock2(child));
371872
+ content3.push(projectBlock2(child, options));
371517
371873
  });
371518
371874
  const item = {
371519
371875
  level: pmNode.attrs?.level ?? 0,
@@ -371521,8 +371877,8 @@ function projectListItem2(pmNode) {
371521
371877
  };
371522
371878
  return item;
371523
371879
  }
371524
- function projectListItemAsContent2(pmNode) {
371525
- const inlines = projectInlineChildren2(pmNode);
371880
+ function projectListItemAsContent2(pmNode, options) {
371881
+ const inlines = projectInlineChildren2(pmNode, options);
371526
371882
  return {
371527
371883
  kind: "paragraph",
371528
371884
  id: resolveNodeId2(pmNode),
@@ -371568,10 +371924,10 @@ function extractSdtMetadata2(attrs) {
371568
371924
  ...lock && lock !== "none" ? { lock } : {}
371569
371925
  };
371570
371926
  }
371571
- function projectBlockSdt2(pmNode) {
371927
+ function projectBlockSdt2(pmNode, options) {
371572
371928
  const children = [];
371573
371929
  pmNode.forEach((child) => {
371574
- children.push(projectBlock2(child));
371930
+ children.push(projectBlock2(child, options));
371575
371931
  });
371576
371932
  return {
371577
371933
  kind: "sdt",
@@ -371583,8 +371939,8 @@ function projectBlockSdt2(pmNode) {
371583
371939
  }
371584
371940
  };
371585
371941
  }
371586
- function projectInlineSdt2(pmNode) {
371587
- const inlines = projectInlineChildren2(pmNode);
371942
+ function projectInlineSdt2(pmNode, options) {
371943
+ const inlines = projectInlineChildren2(pmNode, options);
371588
371944
  return {
371589
371945
  kind: "sdt",
371590
371946
  id: resolveSdtNodeId2(pmNode),
@@ -371623,29 +371979,30 @@ function projectBlockDrawing2(pmNode) {
371623
371979
  }
371624
371980
  };
371625
371981
  }
371626
- function projectFallbackBlock2(pmNode) {
371627
- const inlines = projectInlineChildren2(pmNode);
371982
+ function projectFallbackBlock2(pmNode, options) {
371983
+ const inlines = projectInlineChildren2(pmNode, options);
371628
371984
  return {
371629
371985
  kind: "paragraph",
371630
371986
  id: resolveNodeId2(pmNode),
371631
371987
  paragraph: { inlines }
371632
371988
  };
371633
371989
  }
371634
- function projectInlineChildren2(pmNode) {
371990
+ function projectInlineChildren2(pmNode, options) {
371635
371991
  const inlines = [];
371636
371992
  pmNode.forEach((child) => {
371637
- const projected = projectInline2(child);
371638
- inlines.push(projected);
371993
+ const projected = projectInline2(child, options);
371994
+ if (projected)
371995
+ inlines.push(projected);
371639
371996
  });
371640
371997
  return inlines;
371641
371998
  }
371642
- function projectInline2(pmNode) {
371999
+ function projectInline2(pmNode, options) {
371643
372000
  if (pmNode.isText) {
371644
- return projectTextRun2(pmNode);
372001
+ return projectTextRun2(pmNode, options);
371645
372002
  }
371646
372003
  switch (pmNode.type.name) {
371647
372004
  case "run":
371648
- return projectRunNode2(pmNode);
372005
+ return projectRunNode2(pmNode, options);
371649
372006
  case "image":
371650
372007
  return projectInlineImage2(pmNode);
371651
372008
  case "tab":
@@ -371662,15 +372019,17 @@ function projectInline2(pmNode) {
371662
372019
  case "field":
371663
372020
  return projectInlineField2(pmNode);
371664
372021
  case "structuredContent":
371665
- return projectInlineSdt2(pmNode);
372022
+ return projectInlineSdt2(pmNode, options);
371666
372023
  default:
371667
- return projectInlineFallback2(pmNode);
372024
+ return projectInlineFallback2(pmNode, options);
371668
372025
  }
371669
372026
  }
371670
- function projectRunNode2(pmNode) {
372027
+ function projectRunNode2(pmNode, options) {
371671
372028
  const attrs = pmNode.attrs ?? {};
371672
372029
  const runProperties = attrs.runProperties;
371673
- const text5 = pmNode.textContent;
372030
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent;
372031
+ if (isVisibleProjection2(options) && text5.length === 0)
372032
+ return null;
371674
372033
  let linkMark;
371675
372034
  pmNode.forEach((child) => {
371676
372035
  if (!linkMark) {
@@ -371678,7 +372037,7 @@ function projectRunNode2(pmNode) {
371678
372037
  }
371679
372038
  });
371680
372039
  if (linkMark) {
371681
- return buildHyperlinkFromRunNode2(pmNode, linkMark);
372040
+ return buildHyperlinkFromRunNode2(pmNode, linkMark, options);
371682
372041
  }
371683
372042
  const run2 = { kind: "run", run: { text: text5 } };
371684
372043
  const styleRef = typeof runProperties?.rStyle === "string" ? runProperties.rStyle : typeof runProperties?.styleId === "string" ? runProperties.styleId : undefined;
@@ -371689,11 +372048,14 @@ function projectRunNode2(pmNode) {
371689
372048
  run2.run.props = props;
371690
372049
  return run2;
371691
372050
  }
371692
- function buildHyperlinkFromRunNode2(pmNode, linkMark) {
372051
+ function buildHyperlinkFromRunNode2(pmNode, linkMark, options) {
371693
372052
  const attrs = linkMark.attrs;
372053
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent;
372054
+ if (isVisibleProjection2(options) && text5.length === 0)
372055
+ return null;
371694
372056
  const childRun = {
371695
372057
  kind: "run",
371696
- run: { text: pmNode.textContent }
372058
+ run: { text: text5 }
371697
372059
  };
371698
372060
  const runProperties = pmNode.attrs?.runProperties;
371699
372061
  const props = extractRunPropsFromRunProperties2(runProperties);
@@ -371808,7 +372170,9 @@ function extractRunPropsFromRunProperties2(runProperties) {
371808
372170
  }
371809
372171
  return hasProps ? props : undefined;
371810
372172
  }
371811
- function projectTextRun2(pmNode) {
372173
+ function projectTextRun2(pmNode, options) {
372174
+ if (isVisibleProjection2(options) && hasTrackDeleteMark4(pmNode))
372175
+ return null;
371812
372176
  const marks = pmNode.marks;
371813
372177
  const linkMark = marks.find((m2) => m2.type.name === "link");
371814
372178
  if (linkMark) {
@@ -371895,10 +372259,13 @@ function projectInlineField2(pmNode) {
371895
372259
  }
371896
372260
  };
371897
372261
  }
371898
- function projectInlineFallback2(pmNode) {
372262
+ function projectInlineFallback2(pmNode, options) {
372263
+ const text5 = isVisibleProjection2(options) ? textContentInBlock2(pmNode, options) : pmNode.textContent ?? "";
372264
+ if (isVisibleProjection2(options) && text5.length === 0)
372265
+ return null;
371899
372266
  return {
371900
372267
  kind: "run",
371901
- run: { text: pmNode.textContent ?? "" }
372268
+ run: { text: text5 }
371902
372269
  };
371903
372270
  }
371904
372271
  function resolveNodeId2(pmNode) {
@@ -372136,6 +372503,8 @@ var init_sd_projection = __esm(() => {
372136
372503
  init_node_address_resolver();
372137
372504
  init_toc_switches();
372138
372505
  init_sections_resolver();
372506
+ init_text_offset_resolver();
372507
+ init_constants();
372139
372508
  BULLET_FORMATS2 = new Set(["bullet"]);
372140
372509
  LOCK_MODE_TO_SDT_LOCK2 = {
372141
372510
  unlocked: "none",
@@ -383767,6 +384136,13 @@ var init_node_info_resolver = __esm(() => {
383767
384136
  });
383768
384137
 
383769
384138
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/find/common.ts
384139
+ function getCandidateText2(editor, candidate, options) {
384140
+ if (candidate.node.childCount > 0) {
384141
+ return textContentInBlock2(candidate.node, options);
384142
+ }
384143
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
384144
+ `, "");
384145
+ }
383770
384146
  function resolveUnknownBlockId2(attrs) {
383771
384147
  if (!attrs)
383772
384148
  return;
@@ -383784,7 +384160,39 @@ function getAddressStartPos2(editor, index2, address2) {
383784
384160
  const inline = findInlineByAnchor2(inlineIndex, address2);
383785
384161
  return inline?.pos ?? Number.MAX_SAFE_INTEGER;
383786
384162
  }
383787
- function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges) {
384163
+ function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges, options) {
384164
+ if (textRanges?.length) {
384165
+ const index2 = getBlockIndex2(editor);
384166
+ const firstRange = textRanges[0];
384167
+ const lastRange = textRanges[textRanges.length - 1];
384168
+ const firstBlock = index2.candidates.find((candidate) => candidate.nodeId === firstRange.blockId);
384169
+ const lastBlock = index2.candidates.find((candidate) => candidate.nodeId === lastRange.blockId);
384170
+ if (firstBlock && lastBlock) {
384171
+ const matchText = textRanges.map((range) => {
384172
+ const block = index2.candidates.find((candidate) => candidate.nodeId === range.blockId);
384173
+ if (!block)
384174
+ return "";
384175
+ return getCandidateText2(editor, block, options).slice(range.range.start, range.range.end);
384176
+ }).join(`
384177
+ `);
384178
+ const firstText = getCandidateText2(editor, firstBlock, options);
384179
+ const lastText = getCandidateText2(editor, lastBlock, options);
384180
+ const leftContext = firstText.slice(Math.max(0, firstRange.range.start - SNIPPET_PADDING2), firstRange.range.start);
384181
+ const rightContext = lastText.slice(lastRange.range.end, lastRange.range.end + SNIPPET_PADDING2);
384182
+ const snippet2 = `${leftContext}${matchText}${rightContext}`.replace(/ {2,}/g, " ");
384183
+ const prefix3 = leftContext.replace(/ {2,}/g, " ");
384184
+ const normalizedMatch = matchText.replace(/ {2,}/g, " ");
384185
+ return {
384186
+ address: address2,
384187
+ snippet: snippet2,
384188
+ highlightRange: {
384189
+ start: prefix3.length,
384190
+ end: prefix3.length + normalizedMatch.length
384191
+ },
384192
+ textRanges
384193
+ };
384194
+ }
384195
+ }
383788
384196
  const docSize = editor.state.doc.content.size;
383789
384197
  const snippetFrom = Math.max(0, matchFrom - SNIPPET_PADDING2);
383790
384198
  const snippetTo = Math.min(docSize, matchTo + SNIPPET_PADDING2);
@@ -383804,14 +384212,14 @@ function buildTextContext2(editor, address2, matchFrom, matchTo, textRanges) {
383804
384212
  textRanges: textRanges?.length ? textRanges : undefined
383805
384213
  };
383806
384214
  }
383807
- function toTextAddress3(editor, block, range) {
384215
+ function toTextAddress3(editor, block, range, options) {
383808
384216
  const blockStart = block.pos + 1;
383809
384217
  const blockEnd = block.end - 1;
383810
384218
  if (range.from < blockStart || range.to > blockEnd)
383811
384219
  return;
383812
- const start2 = editor.state.doc.textBetween(blockStart, range.from, `
384220
+ const start2 = block.node.childCount > 0 ? pmPositionToTextOffset2(block.node, block.pos, range.from, options) : editor.state.doc.textBetween(blockStart, range.from, `
383813
384221
  `, "").length;
383814
- const end = editor.state.doc.textBetween(blockStart, range.to, `
384222
+ const end = block.node.childCount > 0 ? pmPositionToTextOffset2(block.node, block.pos, range.to, options) : editor.state.doc.textBetween(blockStart, range.to, `
383815
384223
  `, "").length;
383816
384224
  return {
383817
384225
  kind: "text",
@@ -383870,6 +384278,7 @@ var init_common = __esm(() => {
383870
384278
  init_node_address_resolver();
383871
384279
  init_inline_address_resolver();
383872
384280
  init_adapter_utils();
384281
+ init_text_offset_resolver();
383873
384282
  DUAL_KIND_TYPES2 = new Set(["sdt", "image"]);
383874
384283
  KNOWN_BLOCK_PM_NODE_TYPES2 = new Set([
383875
384284
  "paragraph",
@@ -384034,7 +384443,7 @@ function buildSearchPattern2(selector, diagnostics) {
384034
384443
  const flags = selector.caseSensitive ? "g" : "gi";
384035
384444
  return new RegExp(flexible, flags);
384036
384445
  }
384037
- function executeTextSelector2(editor, index2, query2, diagnostics) {
384446
+ function executeTextSelector2(editor, index2, query2, diagnostics, options = {}) {
384038
384447
  if (query2.select.type !== "text") {
384039
384448
  addDiagnostic2(diagnostics, `Text strategy received a non-text selector (type="${query2.select.type}").`);
384040
384449
  return { matches: [], total: 0 };
@@ -384051,17 +384460,20 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384051
384460
  if (!pattern)
384052
384461
  return { matches: [], total: 0 };
384053
384462
  const search4 = requireEditorCommand2(editor.commands?.search, "find (search)");
384463
+ const searchModel = options.searchModel ?? "visible";
384464
+ const textOffsetOptions = { textModel: searchModel };
384465
+ pattern.lastIndex = 0;
384054
384466
  const rawResult = search4(pattern, {
384055
384467
  highlight: false,
384056
384468
  caseSensitive: selector.caseSensitive ?? false,
384057
384469
  maxMatches: Infinity,
384058
- searchModel: "visible"
384470
+ searchModel
384059
384471
  });
384060
384472
  if (!Array.isArray(rawResult)) {
384061
384473
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "Editor search command returned an unexpected result format.");
384062
384474
  }
384063
- const allMatches = rawResult;
384064
384475
  const scopeRange = scope.range;
384476
+ const allMatches = rawResult;
384065
384477
  const matches3 = scopeRange ? allMatches.filter((m2) => m2.from >= scopeRange.start && m2.to <= scopeRange.end) : allMatches;
384066
384478
  const textBlocks = index2.candidates.filter(isTextBlockCandidate2);
384067
384479
  const contexts = [];
@@ -384075,7 +384487,7 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384075
384487
  return;
384076
384488
  if (!source)
384077
384489
  source = block;
384078
- return toTextAddress3(editor, block, range);
384490
+ return toTextAddress3(editor, block, range, textOffsetOptions);
384079
384491
  }).filter((range) => Boolean(range));
384080
384492
  if (!source) {
384081
384493
  source = findCandidateByPos2(textBlocks, match2.from) ?? findBlockByPos2(index2, match2.from);
@@ -384084,7 +384496,7 @@ function executeTextSelector2(editor, index2, query2, diagnostics) {
384084
384496
  continue;
384085
384497
  const address2 = toBlockAddress2(source);
384086
384498
  addresses.push(address2);
384087
- contexts.push(buildTextContext2(editor, address2, match2.from, match2.to, textRanges));
384499
+ contexts.push(buildTextContext2(editor, address2, match2.from, match2.to, textRanges, textOffsetOptions));
384088
384500
  }
384089
384501
  const paged = paginate2(addresses, query2.offset, query2.limit);
384090
384502
  const pagedContexts = paginate2(contexts, query2.offset, query2.limit).items;
@@ -384190,7 +384602,7 @@ var init_mark_directives = __esm(() => {
384190
384602
  });
384191
384603
 
384192
384604
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/style-resolver.ts
384193
- function captureRunsInRange2(editor, blockPos, from4, to) {
384605
+ function captureRunsInRange2(editor, blockPos, from4, to, options) {
384194
384606
  const doc6 = editor.state.doc;
384195
384607
  const blockNode = doc6.nodeAt(blockPos);
384196
384608
  if (!blockNode || from4 < 0 || to < from4 || from4 === to) {
@@ -384214,9 +384626,12 @@ function captureRunsInRange2(editor, blockPos, from4, to) {
384214
384626
  if (node3.isText) {
384215
384627
  const text5 = node3.text ?? "";
384216
384628
  if (text5.length > 0) {
384629
+ const marks = Array.isArray(node3.marks) ? node3.marks : [];
384630
+ if (options?.textModel === "visible" && marks.some((mark2) => mark2.type.name === TrackDeleteMarkName2)) {
384631
+ return;
384632
+ }
384217
384633
  const start2 = offset2;
384218
384634
  const end = offset2 + text5.length;
384219
- const marks = Array.isArray(node3.marks) ? node3.marks : [];
384220
384635
  maybePushRun(start2, end, marks);
384221
384636
  offset2 = end;
384222
384637
  }
@@ -384511,6 +384926,7 @@ var init_style_resolver = __esm(() => {
384511
384926
  init_src();
384512
384927
  init_errors6();
384513
384928
  init_mark_directives();
384929
+ init_constants();
384514
384930
  CORE_MARK_KEYS = ["bold", "italic", "underline", "strike"];
384515
384931
  CORE_MARK_NAMES2 = new Set(CORE_MARK_KEYS);
384516
384932
  METADATA_MARK_NAMES2 = new Set([
@@ -385492,6 +385908,14 @@ function buildSelectionTargetFromTextRanges2(textRanges, story) {
385492
385908
  target.story = story;
385493
385909
  return target;
385494
385910
  }
385911
+ function readCandidateVisibleText2(editor, candidate) {
385912
+ const maybeNode = candidate.node;
385913
+ if (maybeNode && typeof maybeNode.childCount === "number" && maybeNode.childCount > 0) {
385914
+ return textContentInBlock2(maybeNode, { textModel: "visible" });
385915
+ }
385916
+ return editor.state.doc.textBetween(candidate.pos + 1, candidate.end - 1, `
385917
+ `, "");
385918
+ }
385495
385919
  function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, storyKey, resolverParams) {
385496
385920
  const index2 = getBlockIndex2(editor);
385497
385921
  const doc6 = editor.state.doc;
@@ -385536,10 +385960,7 @@ function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, story
385536
385960
  });
385537
385961
  }
385538
385962
  }
385539
- const blockStart = candidate.pos + 1;
385540
- const blockEnd = candidate.end - 1;
385541
- const blockText = doc6.textBetween(blockStart, blockEnd, `
385542
- `, "");
385963
+ const blockText = readCandidateVisibleText2(editor, candidate);
385543
385964
  const matchedText = blockText.slice(from4, to);
385544
385965
  const node3 = doc6.nodeAt(candidate.pos);
385545
385966
  const nodeType = node3?.type.name ?? "paragraph";
@@ -385548,7 +385969,7 @@ function buildMatchBlocks2(editor, textRanges, evaluatedRevision, matchId, story
385548
385969
  resolverParams,
385549
385970
  paragraphProperties: node3?.attrs?.paragraphProperties ?? null
385550
385971
  } : undefined;
385551
- const captured = captureRunsInRange2(editor, candidate.pos, from4, to);
385972
+ const captured = captureRunsInRange2(editor, candidate.pos, from4, to, { textModel: "visible" });
385552
385973
  const coalesced = coalesceRuns2(captured.runs);
385553
385974
  const blockRange = { start: from4, end: to };
385554
385975
  const runs2 = coalesced.map((run2, runIdx) => ({
@@ -385601,7 +386022,6 @@ function buildBlocksSnippet2(editor, blocks2) {
385601
386022
  if (!editor.state?.doc || blocks2.length === 0)
385602
386023
  return;
385603
386024
  const index2 = getBlockIndex2(editor);
385604
- const doc6 = editor.state.doc;
385605
386025
  const matchText = blocks2.map((b2) => b2.text).join(`
385606
386026
  `);
385607
386027
  if (matchText.length >= SNIPPET_MAX_LENGTH2) {
@@ -385616,10 +386036,7 @@ function buildBlocksSnippet2(editor, blocks2) {
385616
386036
  const firstBlock = blocks2[0];
385617
386037
  const firstCandidate = index2.candidates.find((c) => c.nodeId === firstBlock.blockId);
385618
386038
  if (firstCandidate) {
385619
- const blockStart = firstCandidate.pos + 1;
385620
- const blockEnd = firstCandidate.end - 1;
385621
- const fullBlockText = doc6.textBetween(blockStart, blockEnd, `
385622
- `, "");
386039
+ const fullBlockText = readCandidateVisibleText2(editor, firstCandidate);
385623
386040
  const contextStart = Math.max(0, firstBlock.range.start - contextEachSide);
385624
386041
  leftContext = fullBlockText.slice(contextStart, firstBlock.range.start);
385625
386042
  }
@@ -385627,10 +386044,7 @@ function buildBlocksSnippet2(editor, blocks2) {
385627
386044
  const lastBlock = blocks2[blocks2.length - 1];
385628
386045
  const lastCandidate = index2.candidates.find((c) => c.nodeId === lastBlock.blockId);
385629
386046
  if (lastCandidate) {
385630
- const blockStart = lastCandidate.pos + 1;
385631
- const blockEnd = lastCandidate.end - 1;
385632
- const fullBlockText = doc6.textBetween(blockStart, blockEnd, `
385633
- `, "");
386047
+ const fullBlockText = readCandidateVisibleText2(editor, lastCandidate);
385634
386048
  const contextEnd = Math.min(fullBlockText.length, lastBlock.range.end + contextEachSide);
385635
386049
  rightContext = fullBlockText.slice(lastBlock.range.end, contextEnd);
385636
386050
  }
@@ -385815,6 +386229,7 @@ var init_query_match_adapter = __esm(() => {
385815
386229
  init_errors6();
385816
386230
  init_match_style_helpers();
385817
386231
  init_resolve_story_runtime();
386232
+ init_text_offset_resolver();
385818
386233
  });
385819
386234
 
385820
386235
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/find-adapter.ts
@@ -385934,12 +386349,12 @@ function projectMatchToSDNodeResult2(editor, address2, blockIndex) {
385934
386349
  if (!found3)
385935
386350
  return null;
385936
386351
  return {
385937
- node: projectContentNode2(found3.node),
386352
+ node: projectContentNode2(found3.node, { textModel: "visible" }),
385938
386353
  address: address2
385939
386354
  };
385940
386355
  }
385941
386356
  return {
385942
- node: projectContentNode2(candidate.node),
386357
+ node: projectContentNode2(candidate.node, { textModel: "visible" }),
385943
386358
  address: address2
385944
386359
  };
385945
386360
  }
@@ -386114,7 +386529,7 @@ function getTextAdapter2(editor, input2) {
386114
386529
  const doc6 = runtime.editor.state.doc;
386115
386530
  return textBetweenWithTabs2(doc6, 0, doc6.content.size, `
386116
386531
  `, `
386117
- `);
386532
+ `, { textModel: "visible" });
386118
386533
  }
386119
386534
  var init_get_text_adapter = __esm(() => {
386120
386535
  init_resolve_story_runtime();
@@ -387093,7 +387508,7 @@ var init_codes = __esm(() => {
387093
387508
 
387094
387509
  // ../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/constants.js
387095
387510
  var constants;
387096
- var init_constants = __esm(() => {
387511
+ var init_constants2 = __esm(() => {
387097
387512
  constants = {
387098
387513
  attentionSideAfter: 2,
387099
387514
  attentionSideBefore: 1,
@@ -387352,7 +387767,7 @@ var init_values = __esm(() => {
387352
387767
  // ../../node_modules/.pnpm/micromark-util-symbol@2.0.1/node_modules/micromark-util-symbol/lib/default.js
387353
387768
  var init_default2 = __esm(() => {
387354
387769
  init_codes();
387355
- init_constants();
387770
+ init_constants2();
387356
387771
  init_types6();
387357
387772
  init_values();
387358
387773
  });
@@ -405849,10 +406264,6 @@ var init_mergeTextNodes = __esm(() => {
405849
406264
  init_objectIncludes();
405850
406265
  });
405851
406266
 
405852
- // ../../packages/super-editor/src/editors/v1/extensions/track-changes/constants.js
405853
- var TrackInsertMarkName2 = "trackInsert", TrackDeleteMarkName2 = "trackDelete", TrackFormatMarkName2 = "trackFormat";
405854
- var init_constants2 = () => {};
405855
-
405856
406267
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v2/importer/markImporter.js
405857
406268
  function parseMarks2(property, unknownMarks = [], docx = null) {
405858
406269
  const marks = [];
@@ -406065,7 +406476,7 @@ function getStrikeValue2(attributes) {
406065
406476
  }
406066
406477
  var init_markImporter = __esm(() => {
406067
406478
  init_SuperConverter();
406068
- init_constants2();
406479
+ init_constants();
406069
406480
  init_helpers();
406070
406481
  init_rpr();
406071
406482
  init_styles3();
@@ -406873,7 +407284,7 @@ var cloneMark3 = (mark2) => {
406873
407284
  return runs2;
406874
407285
  };
406875
407286
  var init_track_change_helpers = __esm(() => {
406876
- init_constants2();
407287
+ init_constants();
406877
407288
  });
406878
407289
 
406879
407290
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/helpers.js
@@ -406922,7 +407333,7 @@ var getMarkType3 = (mark2) => mark2?.type?.name ?? mark2?.type ?? null, toRunPro
406922
407333
  };
406923
407334
  var init_helpers4 = __esm(() => {
406924
407335
  init_exporter();
406925
- init_constants2();
407336
+ init_constants();
406926
407337
  });
406927
407338
 
406928
407339
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/r/attributes/w-rsid-r.js
@@ -433864,7 +434275,35 @@ var init_documentCommentsImporter = __esm(() => {
433864
434275
  function isReplacementPair2(previous5, current) {
433865
434276
  return previous5.type !== current.type && previous5.author === current.author && previous5.date === current.date;
433866
434277
  }
433867
- function assignInternalId2(element3, idMap, context, insideTrackedChange) {
434278
+ function trackedChangeEntryFromElement2(element3) {
434279
+ return {
434280
+ type: element3.name,
434281
+ author: element3.attributes?.["w:author"] ?? "",
434282
+ date: element3.attributes?.["w:date"] ?? ""
434283
+ };
434284
+ }
434285
+ function findNextSiblingTrackedChange2(elements, startIndex) {
434286
+ if (!Array.isArray(elements))
434287
+ return null;
434288
+ for (let i5 = startIndex;i5 < elements.length; i5 += 1) {
434289
+ const element3 = elements[i5];
434290
+ if (TRACKED_CHANGE_NAMES2.has(element3?.name)) {
434291
+ return trackedChangeEntryFromElement2(element3);
434292
+ }
434293
+ if (!PAIRING_TRANSPARENT_NAMES2.has(element3?.name)) {
434294
+ return null;
434295
+ }
434296
+ }
434297
+ return null;
434298
+ }
434299
+ function isChildReplacementInsideDeletion2(beforePrevious, previous5, current, next2) {
434300
+ if (!isReplacementPair2(previous5, current))
434301
+ return false;
434302
+ const touchesDifferentAuthorDeletionBefore = beforePrevious?.type === "w:del" && beforePrevious.author !== previous5.author;
434303
+ const touchesDifferentAuthorDeletionAfter = next2?.type === "w:del" && next2.author !== previous5.author;
434304
+ return touchesDifferentAuthorDeletionBefore || touchesDifferentAuthorDeletionAfter;
434305
+ }
434306
+ function assignInternalId2(element3, idMap, context, insideTrackedChange, nextTrackedChange = null) {
433868
434307
  const wordId = String(element3.attributes?.["w:id"] ?? "");
433869
434308
  if (!wordId)
433870
434309
  return;
@@ -433874,35 +434313,37 @@ function assignInternalId2(element3, idMap, context, insideTrackedChange) {
433874
434313
  }
433875
434314
  return;
433876
434315
  }
433877
- const current = {
433878
- type: element3.name,
433879
- author: element3.attributes?.["w:author"] ?? "",
433880
- date: element3.attributes?.["w:date"] ?? ""
433881
- };
434316
+ const current = trackedChangeEntryFromElement2(element3);
433882
434317
  const shouldPair = context.replacements === "paired";
433883
- if (shouldPair && context.lastTrackedChange && isReplacementPair2(context.lastTrackedChange, current)) {
434318
+ const shouldKeepChildSides = context.lastTrackedChange && isChildReplacementInsideDeletion2(context.beforeLastTrackedChange, context.lastTrackedChange, current, nextTrackedChange);
434319
+ if (shouldPair && context.lastTrackedChange && !shouldKeepChildSides && isReplacementPair2(context.lastTrackedChange, current)) {
433884
434320
  if (!idMap.has(wordId)) {
433885
434321
  idMap.set(wordId, context.lastTrackedChange.internalId);
433886
434322
  }
433887
434323
  context.lastTrackedChange = null;
434324
+ context.beforeLastTrackedChange = null;
433888
434325
  } else {
433889
434326
  const internalId = idMap.get(wordId) ?? v42();
433890
434327
  idMap.set(wordId, internalId);
434328
+ context.beforeLastTrackedChange = context.lastTrackedChange;
433891
434329
  context.lastTrackedChange = { ...current, internalId };
433892
434330
  }
433893
434331
  }
433894
434332
  function walkElements2(elements, idMap, context, insideTrackedChange = false) {
433895
434333
  if (!Array.isArray(elements))
433896
434334
  return;
433897
- for (const element3 of elements) {
434335
+ for (let index3 = 0;index3 < elements.length; index3 += 1) {
434336
+ const element3 = elements[index3];
433898
434337
  if (TRACKED_CHANGE_NAMES2.has(element3.name)) {
433899
- assignInternalId2(element3, idMap, context, insideTrackedChange);
434338
+ const nextTrackedChange = findNextSiblingTrackedChange2(elements, index3 + 1);
434339
+ assignInternalId2(element3, idMap, context, insideTrackedChange, nextTrackedChange);
433900
434340
  if (element3.elements) {
433901
- walkElements2(element3.elements, idMap, { lastTrackedChange: null, replacements: context.replacements }, true);
434341
+ walkElements2(element3.elements, idMap, { beforeLastTrackedChange: null, lastTrackedChange: null, replacements: context.replacements }, true);
433902
434342
  }
433903
434343
  } else {
433904
434344
  if (!PAIRING_TRANSPARENT_NAMES2.has(element3.name)) {
433905
434345
  context.lastTrackedChange = null;
434346
+ context.beforeLastTrackedChange = null;
433906
434347
  }
433907
434348
  if (element3.elements) {
433908
434349
  walkElements2(element3.elements, idMap, context, insideTrackedChange);
@@ -433916,7 +434357,7 @@ function buildTrackedChangeIdMapForPart2(part, options = {}) {
433916
434357
  return new Map;
433917
434358
  const replacements = options.replacements === "independent" ? "independent" : "paired";
433918
434359
  const idMap = new Map;
433919
- walkElements2(root4.elements, idMap, { lastTrackedChange: null, replacements });
434360
+ walkElements2(root4.elements, idMap, { beforeLastTrackedChange: null, lastTrackedChange: null, replacements });
433920
434361
  return idMap;
433921
434362
  }
433922
434363
  function buildTrackedChangeIdMap2(docx, options = {}) {
@@ -438323,7 +438764,7 @@ var getTrackChanges2 = (state, id2 = null) => {
438323
438764
  return trackedChanges;
438324
438765
  };
438325
438766
  var init_getTrackChanges = __esm(() => {
438326
- init_constants2();
438767
+ init_constants();
438327
438768
  });
438328
438769
 
438329
438770
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-resolver.ts
@@ -438661,7 +439102,7 @@ function findMatchingChange2(editor, id2) {
438661
439102
  }
438662
439103
  var groupedCache2;
438663
439104
  var init_tracked_change_resolver = __esm(() => {
438664
- init_constants2();
439105
+ init_constants();
438665
439106
  init_getTrackChanges();
438666
439107
  init_resolve_story_runtime();
438667
439108
  init_story_key();
@@ -446379,7 +446820,7 @@ function resolveTextPoint3(editor, index3, point7) {
446379
446820
  const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, {
446380
446821
  start: point7.offset,
446381
446822
  end: point7.offset
446382
- });
446823
+ }, { textModel: "visible" });
446383
446824
  if (!resolved) {
446384
446825
  throw new DocumentApiAdapterError3("INVALID_TARGET", `Offset ${point7.offset} is out of range in block "${point7.blockId}".`, { field: "offset", value: point7.offset, blockId: point7.blockId });
446385
446826
  }
@@ -446452,6 +446893,7 @@ function findBlockByTypeAndId2(index3, nodeType, nodeId) {
446452
446893
  var init_selection_target_resolver = __esm(() => {
446453
446894
  init_index_cache();
446454
446895
  init_node_address_resolver();
446896
+ init_text_offset_resolver();
446455
446897
  init_errors4();
446456
446898
  });
446457
446899
 
@@ -446594,8 +447036,8 @@ function validateInsertionContext2(editor, index3, step3, stepIndex, anchorBlock
446594
447036
  });
446595
447037
  }
446596
447038
  }
446597
- function resolveAbsoluteRange3(editor, candidate, from4, to, stepId) {
446598
- const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: from4, end: to });
447039
+ function resolveAbsoluteRange3(editor, candidate, from4, to, stepId, options) {
447040
+ const resolved = resolveTextRangeInBlock2(candidate.node, candidate.pos, { start: from4, end: to }, options);
446599
447041
  if (!resolved) {
446600
447042
  throw planError2("INVALID_INPUT", `text offset [${from4}, ${to}) out of range in block`, stepId);
446601
447043
  }
@@ -446663,8 +447105,9 @@ function coalesceBlockRanges2(stepId, blockId, ranges) {
446663
447105
  return { from: from4, to };
446664
447106
  }
446665
447107
  function buildRangeTarget2(editor, step3, addr, candidate) {
446666
- const abs3 = resolveAbsoluteRange3(editor, candidate, addr.from, addr.to, step3.id);
446667
- const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange2(editor, candidate.pos, addr.from, addr.to) : undefined;
447108
+ const textOffsetOptions = { textModel: addr.textModel };
447109
+ const abs3 = resolveAbsoluteRange3(editor, candidate, addr.from, addr.to, step3.id, textOffsetOptions);
447110
+ const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange2(editor, candidate.pos, addr.from, addr.to, textOffsetOptions) : undefined;
446668
447111
  return {
446669
447112
  kind: "range",
446670
447113
  stepId: step3.id,
@@ -446679,7 +447122,7 @@ function buildRangeTarget2(editor, step3, addr, candidate) {
446679
447122
  capturedStyle
446680
447123
  };
446681
447124
  }
446682
- function buildSpanTarget2(editor, index3, step3, segments, matchId) {
447125
+ function buildSpanTarget2(editor, index3, step3, segments, matchId, textModel = "visible") {
446683
447126
  validateSegmentOrder2(editor, index3, segments, step3.id);
446684
447127
  const compiledSegments = [];
446685
447128
  const capturedStyles = [];
@@ -446689,7 +447132,8 @@ function buildSpanTarget2(editor, index3, step3, segments, matchId) {
446689
447132
  if (!candidate) {
446690
447133
  throw planError2("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step3.id);
446691
447134
  }
446692
- const abs3 = resolveAbsoluteRange3(editor, candidate, seg.from, seg.to, step3.id);
447135
+ const textOffsetOptions = { textModel };
447136
+ const abs3 = resolveAbsoluteRange3(editor, candidate, seg.from, seg.to, step3.id, textOffsetOptions);
446693
447137
  compiledSegments.push({
446694
447138
  blockId: seg.blockId,
446695
447139
  from: seg.from,
@@ -446697,10 +447141,10 @@ function buildSpanTarget2(editor, index3, step3, segments, matchId) {
446697
447141
  absFrom: abs3.absFrom,
446698
447142
  absTo: abs3.absTo
446699
447143
  });
446700
- const blockText = getBlockText2(editor, candidate);
447144
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446701
447145
  textParts.push(blockText.slice(seg.from, seg.to));
446702
447146
  if (step3.op === "text.rewrite" || step3.op === "format.apply") {
446703
- capturedStyles.push(captureRunsInRange2(editor, candidate.pos, seg.from, seg.to));
447147
+ capturedStyles.push(captureRunsInRange2(editor, candidate.pos, seg.from, seg.to, textOffsetOptions));
446704
447148
  }
446705
447149
  }
446706
447150
  return {
@@ -446745,13 +447189,15 @@ function validateSegmentOrder2(_editor, index3, segments, stepId) {
446745
447189
  }
446746
447190
  }
446747
447191
  function resolveTextSelector2(editor, index3, selector, within2, stepId, options) {
447192
+ const textModel = options?.textModel ?? "visible";
447193
+ const textOffsetOptions = { textModel };
446748
447194
  if (selector.type === "text") {
446749
447195
  const query3 = {
446750
447196
  select: selector,
446751
447197
  within: within2,
446752
447198
  includeNodes: false
446753
447199
  };
446754
- const result2 = executeTextSelector2(editor, index3, query3, []);
447200
+ const result2 = executeTextSelector2(editor, index3, query3, [], { searchModel: textModel });
446755
447201
  const addresses2 = [];
446756
447202
  if (result2.context) {
446757
447203
  for (const ctx2 of result2.context) {
@@ -446761,16 +447207,17 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446761
447207
  const candidate = index3.candidates.find((c) => c.nodeId === coalesced.blockId);
446762
447208
  if (!candidate)
446763
447209
  continue;
446764
- const blockText = getBlockText2(editor, candidate);
447210
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446765
447211
  const matchText = blockText.slice(coalesced.from, coalesced.to);
446766
- const captured = captureRunsInRange2(editor, candidate.pos, coalesced.from, coalesced.to);
447212
+ const captured = captureRunsInRange2(editor, candidate.pos, coalesced.from, coalesced.to, textOffsetOptions);
446767
447213
  addresses2.push({
446768
447214
  blockId: coalesced.blockId,
446769
447215
  from: coalesced.from,
446770
447216
  to: coalesced.to,
446771
447217
  text: matchText,
446772
447218
  marks: captured.runs.length > 0 ? captured.runs[0].marks : [],
446773
- blockPos: candidate.pos
447219
+ blockPos: candidate.pos,
447220
+ textModel
446774
447221
  });
446775
447222
  }
446776
447223
  }
@@ -446791,14 +447238,15 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446791
447238
  if (!candidate)
446792
447239
  continue;
446793
447240
  if (isTextBlockCandidate2(candidate)) {
446794
- const blockText = getBlockText2(editor, candidate);
447241
+ const blockText = getBlockText2(editor, candidate, textOffsetOptions);
446795
447242
  addresses.push({
446796
447243
  blockId: match2.nodeId,
446797
447244
  from: 0,
446798
447245
  to: blockText.length,
446799
447246
  text: blockText,
446800
447247
  marks: [],
446801
- blockPos: candidate.pos
447248
+ blockPos: candidate.pos,
447249
+ textModel
446802
447250
  });
446803
447251
  } else {
446804
447252
  addresses.push({
@@ -446807,13 +447255,17 @@ function resolveTextSelector2(editor, index3, selector, within2, stepId, options
446807
447255
  to: 0,
446808
447256
  text: "",
446809
447257
  marks: [],
446810
- blockPos: candidate.pos
447258
+ blockPos: candidate.pos,
447259
+ textModel
446811
447260
  });
446812
447261
  }
446813
447262
  }
446814
447263
  return { addresses };
446815
447264
  }
446816
- function getBlockText2(editor, candidate) {
447265
+ function getBlockText2(editor, candidate, options = { textModel: "visible" }) {
447266
+ if (candidate.node && candidate.node.childCount > 0) {
447267
+ return textContentInBlock2(candidate.node, options);
447268
+ }
446817
447269
  const blockStart = candidate.pos + 1;
446818
447270
  const blockEnd = candidate.end - 1;
446819
447271
  return editor.state.doc.textBetween(blockStart, blockEnd, `
@@ -446847,13 +447299,14 @@ function resolveV3TextRef2(editor, index3, step3, refData) {
446847
447299
  to: seg.to,
446848
447300
  text: matchText,
446849
447301
  marks: [],
446850
- blockPos: candidate.pos
447302
+ blockPos: candidate.pos,
447303
+ textModel: "visible"
446851
447304
  };
446852
447305
  const target = buildRangeTarget2(editor, step3, addr, candidate);
446853
447306
  target.matchId = refData.matchId;
446854
447307
  return [target];
446855
447308
  }
446856
- return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId)];
447309
+ return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId, "visible")];
446857
447310
  }
446858
447311
  function resolveV4TextRef2(editor, index3, step3, refData) {
446859
447312
  if (refData.scope === "node" && refData.node?.nodeId) {
@@ -446885,14 +447338,15 @@ function resolveV4TextRef2(editor, index3, step3, refData) {
446885
447338
  to: seg.to,
446886
447339
  text: matchText,
446887
447340
  marks: [],
446888
- blockPos: candidate.pos
447341
+ blockPos: candidate.pos,
447342
+ textModel: "visible"
446889
447343
  };
446890
447344
  const target = buildRangeTarget2(editor, step3, addr, candidate);
446891
447345
  if (refData.matchId)
446892
447346
  target.matchId = refData.matchId;
446893
447347
  return [target];
446894
447348
  }
446895
- return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId ?? `v4:${step3.id}`)];
447349
+ return [buildSpanTarget2(editor, index3, step3, segments, refData.matchId ?? `v4:${step3.id}`, "visible")];
446896
447350
  }
446897
447351
  function resolveTextRef2(editor, index3, step3, ref4) {
446898
447352
  const decoded = decodeRef2(ref4);
@@ -446922,7 +447376,8 @@ function resolveBlockRef2(editor, index3, step3, ref4) {
446922
447376
  to: blockText.length,
446923
447377
  text: blockText,
446924
447378
  marks: [],
446925
- blockPos: candidate.pos
447379
+ blockPos: candidate.pos,
447380
+ textModel: "visible"
446926
447381
  };
446927
447382
  return [buildRangeTarget2(editor, step3, addr, candidate)];
446928
447383
  }
@@ -446972,7 +447427,8 @@ function buildWholeBlockRangeTarget2(editor, step3, candidate) {
446972
447427
  to: blockText.length,
446973
447428
  text: blockText,
446974
447429
  marks: [],
446975
- blockPos: candidate.pos
447430
+ blockPos: candidate.pos,
447431
+ textModel: "visible"
446976
447432
  };
446977
447433
  return buildRangeTarget2(editor, step3, addr, candidate);
446978
447434
  }
@@ -447048,7 +447504,7 @@ function captureStyleAtAbsoluteRange2(editor, absFrom, absTo) {
447048
447504
  return;
447049
447505
  return { runs: allRuns, isUniform: checkUniformity2(allRuns) };
447050
447506
  }
447051
- function resolveStepTargets2(editor, index3, step3) {
447507
+ function resolveStepTargets2(editor, index3, step3, options = {}) {
447052
447508
  const where = step3.where;
447053
447509
  const refWhere = isRefWhere2(where) ? where : undefined;
447054
447510
  const selectWhere = isSelectWhere2(where) ? where : undefined;
@@ -447065,7 +447521,8 @@ function resolveStepTargets2(editor, index3, step3) {
447065
447521
  } else if (selectWhere) {
447066
447522
  const isStructuralOp = step3.op === "structural.insert" || step3.op === "structural.replace";
447067
447523
  const resolved = resolveTextSelector2(editor, index3, selectWhere.select, selectWhere.within, step3.id, {
447068
- allBlockTypes: isStructuralOp
447524
+ allBlockTypes: isStructuralOp,
447525
+ textModel: options.selectTextModel ?? "visible"
447069
447526
  });
447070
447527
  targets = resolved.addresses.map((addr) => {
447071
447528
  const candidate = index3.candidates.find((c) => c.nodeId === addr.blockId);
@@ -447348,7 +447805,7 @@ function assertSingleStoryKey2(steps) {
447348
447805
  }
447349
447806
  }
447350
447807
  }
447351
- function compilePlan2(editor, steps) {
447808
+ function compilePlan2(editor, steps, options = {}) {
447352
447809
  if (steps.length > MAX_PLAN_STEPS2) {
447353
447810
  throw planError2("INVALID_INPUT", `plan contains ${steps.length} steps, maximum is ${MAX_PLAN_STEPS2}`);
447354
447811
  }
@@ -447385,7 +447842,7 @@ function compilePlan2(editor, steps) {
447385
447842
  if (isCreateOp2(step3.op)) {
447386
447843
  validateCreateStepPosition2(step3);
447387
447844
  }
447388
- const targets = resolveStepTargets2(editor, index3, step3);
447845
+ const targets = resolveStepTargets2(editor, index3, step3, options);
447389
447846
  if (isCreateOp2(step3.op) && targets.length > 0) {
447390
447847
  const position5 = step3.args.position ?? "after";
447391
447848
  const anchorBlockId = resolveCreateAnchorFromTargets2(targets, position5, step3.id);
@@ -447412,6 +447869,7 @@ var init_compiler = __esm(() => {
447412
447869
  init_text_strategy();
447413
447870
  init_block_strategy();
447414
447871
  init_node_address_resolver();
447872
+ init_text_offset_resolver();
447415
447873
  init_selection_target_resolver();
447416
447874
  init_expand_delete_selection();
447417
447875
  VALID_CREATE_POSITIONS2 = ["before", "after"];
@@ -449597,7 +450055,9 @@ function executePlan2(editor, input2) {
449597
450055
  if (!input2.steps?.length) {
449598
450056
  throw planError2("INVALID_INPUT", "plan must contain at least one step");
449599
450057
  }
449600
- const compiled = compilePlan2(editor, input2.steps);
450058
+ const compiled = compilePlan2(editor, input2.steps, {
450059
+ selectTextModel: input2.changeMode === "tracked" ? "raw" : "visible"
450060
+ });
449601
450061
  return executeCompiledPlan2(editor, compiled, {
449602
450062
  changeMode: input2.changeMode ?? "direct",
449603
450063
  expectedRevision: input2.expectedRevision
@@ -449625,7 +450085,7 @@ var init_executor = __esm(() => {
449625
450085
  init_dist2();
449626
450086
  init_text_with_tabs();
449627
450087
  init_getMarksFromSelection();
449628
- init_constants2();
450088
+ init_constants();
449629
450089
  DEFAULT_INLINE_POLICY2 = {
449630
450090
  mode: "preserve",
449631
450091
  onNonUniform: "majority"
@@ -451870,7 +452330,7 @@ var init_plan_wrappers = __esm(() => {
451870
452330
  init_adapter_utils();
451871
452331
  init_text_mutation_resolution();
451872
452332
  init_mutation_helpers();
451873
- init_constants2();
452333
+ init_constants();
451874
452334
  init_markdownToPmContent();
451875
452335
  init_structural_write_engine();
451876
452336
  init_selection_target_resolver();
@@ -453261,6 +453721,7 @@ var init_track_changes_wrappers = __esm(() => {
453261
453721
  init_comment_target_resolver();
453262
453722
  init_plan_wrappers();
453263
453723
  init_adapter_utils();
453724
+ init_text_offset_resolver();
453264
453725
  init_revision_tracker();
453265
453726
  init_tracked_change_resolver();
453266
453727
  init_tracked_change_index();
@@ -454797,7 +455258,7 @@ var init_extract_adapter = __esm(() => {
454797
455258
  init_comments_wrappers();
454798
455259
  init_track_changes_wrappers();
454799
455260
  init_tracked_change_resolver();
454800
- init_constants2();
455261
+ init_constants();
454801
455262
  TRACK_MARK_TYPE_BY_NAME2 = {
454802
455263
  [TrackInsertMarkName2]: "insert",
454803
455264
  [TrackDeleteMarkName2]: "delete",
@@ -455052,7 +455513,7 @@ function getDocumentApiCapabilities2(editor) {
455052
455513
  var REQUIRED_COMMANDS2, VALID_CAPABILITY_REASON_CODES2, REQUIRED_HELPERS2, SCHEMA_NODE_GATES2, schemaGatedIds2, SUPPORTED_NON_UNIFORM_STRATEGIES2, SUPPORTED_SET_MARKS2, REGEX_MAX_PATTERN_LENGTH2 = 1024;
455053
455514
  var init_capabilities_adapter = __esm(() => {
455054
455515
  init_src();
455055
- init_constants2();
455516
+ init_constants();
455056
455517
  REQUIRED_COMMANDS2 = {
455057
455518
  "create.paragraph": ["insertParagraphAt"],
455058
455519
  "create.heading": ["insertHeadingAt"],
@@ -455596,7 +456057,7 @@ function collectTrackInsertRefsInRange2(editor, from4, to) {
455596
456057
  return Array.from(ids).map((id2) => ({ kind: "entity", entityType: "trackedChange", entityId: id2 }));
455597
456058
  }
455598
456059
  var init_tracked_change_refs = __esm(() => {
455599
- init_constants2();
456060
+ init_constants();
455600
456061
  init_tracked_change_resolver();
455601
456062
  });
455602
456063
 
@@ -456177,6 +456638,7 @@ var init_blocks_wrappers = __esm(() => {
456177
456638
  init_src();
456178
456639
  init_index_cache();
456179
456640
  init_node_address_resolver();
456641
+ init_text_offset_resolver();
456180
456642
  init_errors4();
456181
456643
  init_mutation_helpers();
456182
456644
  init_plan_wrappers();
@@ -459186,6 +459648,7 @@ function markTypesPresentEverywhere2(doc6, from4, to) {
459186
459648
  var COMMENT_MARK_NAME4 = "commentMark", TRACK_CHANGE_MARK_NAMES2;
459187
459649
  var init_selection_info_resolver = __esm(() => {
459188
459650
  init_dist5();
459651
+ init_text_offset_resolver();
459189
459652
  init_tracked_change_resolver();
459190
459653
  TRACK_CHANGE_MARK_NAMES2 = new Set(["trackInsert", "trackDelete", "trackFormat"]);
459191
459654
  });
@@ -464762,7 +465225,7 @@ var DEFAULT_SELECTION_STATE2, normalizeSelectionState2 = (state = {}) => ({
464762
465225
  }, isToolbarInput2 = (target) => {
464763
465226
  return !!target?.closest(".button-text-input") || target?.classList?.contains("button-text-input");
464764
465227
  }, isToolbarButton2 = (target) => {
464765
- return !!target?.closest(".toolbar-button") || target?.classList?.contains("toolbar-button");
465228
+ return !!target?.closest(".sd-toolbar-button") || !!target?.closest(".toolbar-button") || target?.classList?.contains("sd-toolbar-button") || target?.classList?.contains("toolbar-button");
464766
465229
  }, CustomSelection2;
464767
465230
  var init_custom_selection = __esm(() => {
464768
465231
  init_Extension();
@@ -474574,6 +475037,7 @@ var init_bookmark_resolver = __esm(() => {
474574
475037
  init_story_key();
474575
475038
  init_live_story_session_runtime_registry();
474576
475039
  init_note_entry_lookup();
475040
+ init_text_offset_resolver();
474577
475041
  });
474578
475042
 
474579
475043
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/bookmark-wrappers.ts
@@ -475890,6 +476354,7 @@ var init_anchored_metadata_wrappers = __esm(() => {
475890
476354
  init_index_cache();
475891
476355
  init_node_address_resolver();
475892
476356
  init_selection_target_resolver();
476357
+ init_text_offset_resolver();
475893
476358
  init_mutation_helpers();
475894
476359
  init_adapter_utils();
475895
476360
  init_content_controls2();
@@ -476584,6 +477049,7 @@ var init_permission_ranges_adapter = __esm(() => {
476584
477049
  init_revision_tracker();
476585
477050
  init_adapter_utils();
476586
477051
  init_selection_target_resolver();
477052
+ init_text_offset_resolver();
476587
477053
  init_permission_ranges2();
476588
477054
  });
476589
477055
 
@@ -486644,7 +487110,7 @@ import { createRequire as createRequire2 } from "node:module";
486644
487110
  async function main() {
486645
487111
  await server.connect(transport);
486646
487112
  }
486647
- var require2, version4, server, sessions, transport;
487113
+ var require2, version4, PRESETS_SUPPORTED, requestedPreset, server, sessions, transport;
486648
487114
  var init_server3 = __esm(() => {
486649
487115
  init_mcp();
486650
487116
  init_stdio2();
@@ -486652,6 +487118,12 @@ var init_server3 = __esm(() => {
486652
487118
  init_tools();
486653
487119
  require2 = createRequire2(import.meta.url);
486654
487120
  ({ version: version4 } = require2("../package.json"));
487121
+ PRESETS_SUPPORTED = new Set(["legacy"]);
487122
+ requestedPreset = process.env.MCP_PRESET ?? "legacy";
487123
+ if (!PRESETS_SUPPORTED.has(requestedPreset)) {
487124
+ console.error(`SuperDoc MCP: unknown preset "${requestedPreset}". Supported: ${[...PRESETS_SUPPORTED].join(", ")}.`);
487125
+ process.exit(2);
487126
+ }
486655
487127
  server = new McpServer({
486656
487128
  name: "superdoc",
486657
487129
  version: version4