@superdoc-dev/mcp 0.12.0-next.48 → 0.12.0-next.49

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 +979 -292
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
50479
50479
  emptyOptions2 = {};
50480
50480
  });
50481
50481
 
50482
- // ../../packages/superdoc/dist/chunks/SuperConverter-Ed3nFN54.es.js
50482
+ // ../../packages/superdoc/dist/chunks/SuperConverter-DlrS7cQT.es.js
50483
50483
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
50484
50484
  const fieldValue = extension$1.config[field];
50485
50485
  if (typeof fieldValue === "function")
@@ -54261,14 +54261,17 @@ function executeTrackChangesDecide(adapter, rawInput, options) {
54261
54261
  return adapter.rejectAll(input, revisionOptions);
54262
54262
  }
54263
54263
  const { id, story } = canonical.target;
54264
+ const side = canonical.target.side;
54264
54265
  if (canonical.decision === "accept")
54265
54266
  return adapter.accept({
54266
54267
  id,
54267
- ...story ? { story } : {}
54268
+ ...story ? { story } : {},
54269
+ ...side ? { side } : {}
54268
54270
  }, revisionOptions);
54269
54271
  return adapter.reject({
54270
54272
  id,
54271
- ...story ? { story } : {}
54273
+ ...story ? { story } : {},
54274
+ ...side ? { side } : {}
54272
54275
  }, revisionOptions);
54273
54276
  }
54274
54277
  function isValidLegacyPartialIdRangeTarget(input) {
@@ -54319,11 +54322,13 @@ function normalizeReviewDecideTarget(target) {
54319
54322
  });
54320
54323
  const story = readOptionalStory(target, "target.story", false);
54321
54324
  const moveRole = readOptionalMoveRole(target);
54325
+ const side = readOptionalReplacementSide(target);
54322
54326
  return {
54323
54327
  kind: "id",
54324
54328
  id,
54325
54329
  ...story ? { story } : {},
54326
- ...moveRole ? { moveRole } : {}
54330
+ ...moveRole ? { moveRole } : {},
54331
+ ...side ? { side } : {}
54327
54332
  };
54328
54333
  }
54329
54334
  if (kind === "range") {
@@ -54414,11 +54419,13 @@ function normalizeReviewDecideTarget(target) {
54414
54419
  if (typeof target.id === "string" && target.id.length > 0) {
54415
54420
  const story = readOptionalStory(target, "target.story", false);
54416
54421
  const moveRole = readOptionalMoveRole(target);
54422
+ const side = readOptionalReplacementSide(target);
54417
54423
  return {
54418
54424
  kind: "id",
54419
54425
  id: target.id,
54420
54426
  ...story ? { story } : {},
54421
- ...moveRole ? { moveRole } : {}
54427
+ ...moveRole ? { moveRole } : {},
54428
+ ...side ? { side } : {}
54422
54429
  };
54423
54430
  }
54424
54431
  }
@@ -54574,6 +54581,21 @@ function readOptionalMoveRole(target) {
54574
54581
  });
54575
54582
  return moveRole;
54576
54583
  }
54584
+ function readOptionalReplacementSide(target) {
54585
+ if (!("side" in target))
54586
+ return;
54587
+ const side = target.side;
54588
+ if (side === undefined || side === null)
54589
+ return;
54590
+ if (side === "inserted")
54591
+ return "inserted";
54592
+ if (side === "deleted")
54593
+ return "deleted";
54594
+ throw new DocumentApiValidationError("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', {
54595
+ field: "target.side",
54596
+ value: side
54597
+ });
54598
+ }
54577
54599
  function validateRangeTargetSide(side) {
54578
54600
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination")
54579
54601
  return;
@@ -62751,6 +62773,31 @@ function hasValidDrawingContent(drawingContent) {
62751
62773
  return false;
62752
62774
  return drawingChildren.some((child) => child && typeof child === "object" && (child.name === "wp:inline" || child.name === "wp:anchor"));
62753
62775
  }
62776
+ function resolvePprChangeWordId(params, change) {
62777
+ const idStr = String(change?.id ?? "");
62778
+ const allocator = params?.converter?.wordIdAllocator;
62779
+ if (allocator) {
62780
+ const partPath = params?.currentPartPath || "word/document.xml";
62781
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
62782
+ return String(allocator.allocate({
62783
+ partPath,
62784
+ sourceId,
62785
+ logicalId: idStr
62786
+ }));
62787
+ }
62788
+ return toDecimalWordId(change?.id);
62789
+ }
62790
+ function toDecimalWordId(id) {
62791
+ const str = String(id);
62792
+ if (/^\d+$/.test(str))
62793
+ return str;
62794
+ let hash2 = 2166136261;
62795
+ for (let i$1 = 0;i$1 < str.length; i$1++) {
62796
+ hash2 ^= str.charCodeAt(i$1);
62797
+ hash2 = Math.imul(hash2, 16777619);
62798
+ }
62799
+ return String(1e6 + (hash2 >>> 0) % 1e9);
62800
+ }
62754
62801
  function getSectPr(pPrNode) {
62755
62802
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
62756
62803
  return sectPr ? carbonCopy(sectPr) : undefined;
@@ -62920,6 +62967,8 @@ function generateParagraphProperties(params) {
62920
62967
  const { node: node2 } = params;
62921
62968
  const { attrs = {} } = node2;
62922
62969
  const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
62970
+ if (params?.isFinalDoc && paragraphProperties.change)
62971
+ delete paragraphProperties.change;
62923
62972
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
62924
62973
  delete paragraphProperties.runPropertiesInlineKeys;
62925
62974
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0)
@@ -62936,10 +62985,14 @@ function generateParagraphProperties(params) {
62936
62985
  wordIdAllocator: params?.converter?.wordIdAllocator || null,
62937
62986
  partPath: resolveExportPartPath$1(params)
62938
62987
  } : null;
62939
- let pPr = translator$129.decode({ node: {
62940
- ...node2,
62941
- attrs: { paragraphProperties }
62942
- } });
62988
+ let pPr = translator$129.decode({
62989
+ node: {
62990
+ ...node2,
62991
+ attrs: { paragraphProperties }
62992
+ },
62993
+ converter: params?.converter,
62994
+ currentPartPath: resolveExportPartPath$1(params)
62995
+ });
62943
62996
  if (!params?.isFinalDoc && paragraphSplitTrackFormatMark) {
62944
62997
  const insertionElement = createParagraphSplitInsertionElement(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
62945
62998
  if (insertionElement)
@@ -73646,11 +73699,24 @@ function getDefinitionForLevel(data, level) {
73646
73699
  return cachedLevels.get(parsedLevel);
73647
73700
  return data?.elements?.find((item) => Number(item.attributes?.["w:ilvl"]) === parsedLevel);
73648
73701
  }
73649
- function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr) {
73702
+ function updateNumberingProperties(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
73703
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
73650
73704
  const newProperties = {
73651
- ...paragraphNode.attrs.paragraphProperties || {},
73705
+ ...formerProperties,
73652
73706
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
73653
73707
  };
73708
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
73709
+ const former = { ...formerProperties };
73710
+ delete former.change;
73711
+ const user = editor?.options?.user || {};
73712
+ newProperties.change = {
73713
+ id: v4_default(),
73714
+ author: user.name || "",
73715
+ authorEmail: user.email || "",
73716
+ date: (/* @__PURE__ */ new Date()).toISOString(),
73717
+ paragraphProperties: former
73718
+ };
73719
+ }
73654
73720
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph")
73655
73721
  newProperties.styleId = null;
73656
73722
  if (newProperties.indent)
@@ -95679,6 +95745,28 @@ function groupTrackedChanges(editor) {
95679
95745
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
95680
95746
  });
95681
95747
  }
95748
+ const pprChanges = enumeratePprChanges(editor.state);
95749
+ for (const ppr of pprChanges) {
95750
+ const excerpt = normalizeExcerpt(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
95751
+ grouped.push({
95752
+ rawId: ppr.id,
95753
+ commandRawId: ppr.id,
95754
+ id: ppr.id,
95755
+ from: ppr.from,
95756
+ to: ppr.to,
95757
+ hasInsert: false,
95758
+ hasDelete: false,
95759
+ hasFormat: true,
95760
+ attrs: {
95761
+ id: ppr.id,
95762
+ author: ppr.author || undefined,
95763
+ authorEmail: ppr.authorEmail || undefined,
95764
+ authorImage: ppr.authorImage || undefined,
95765
+ date: ppr.date || undefined
95766
+ },
95767
+ excerpt
95768
+ });
95769
+ }
95682
95770
  grouped.sort((a, b) => {
95683
95771
  if (a.from !== b.from)
95684
95772
  return a.from - b.from;
@@ -96151,7 +96239,7 @@ function applyPagination(items, opts) {
96151
96239
  };
96152
96240
  }
96153
96241
  function resolveBlock(editor, nodeId) {
96154
- const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem"));
96242
+ const matches$1 = getBlockIndex(editor).candidates.filter((c$1) => c$1.nodeId === nodeId && (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading"));
96155
96243
  if (matches$1.length === 0)
96156
96244
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
96157
96245
  if (matches$1.length > 1)
@@ -96169,7 +96257,7 @@ function resolveBlocksInRange(editor, fromId, toId$1) {
96169
96257
  from: fromId,
96170
96258
  to: toId$1
96171
96259
  });
96172
- return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem") && c$1.pos >= from2.pos && c$1.pos <= to.pos);
96260
+ return getBlockIndex(editor).candidates.filter((c$1) => (c$1.nodeType === "paragraph" || c$1.nodeType === "listItem" || c$1.nodeType === "heading") && c$1.pos >= from2.pos && c$1.pos <= to.pos);
96173
96261
  }
96174
96262
  function getAbstractNumId(editor, numId) {
96175
96263
  const definitions = editor.converter?.numbering?.definitions;
@@ -96404,7 +96492,15 @@ function getListText(candidate) {
96404
96492
  }
96405
96493
  function projectListItemCandidate(editor, candidate) {
96406
96494
  const attrs = candidate.node.attrs ?? {};
96407
- const { numId, level } = getNumberingProperties(candidate.node);
96495
+ let { numId, level } = getNumberingProperties(candidate.node);
96496
+ if (numId == null)
96497
+ try {
96498
+ const effective = calculateResolvedParagraphProperties(editor, candidate.node, editor.state.doc.resolve(candidate.pos))?.numberingProperties;
96499
+ if (effective) {
96500
+ numId = toFiniteNumber(effective.numId);
96501
+ level = toFiniteNumber(effective.ilvl) ?? level ?? 0;
96502
+ }
96503
+ } catch {}
96408
96504
  const listRendering = getListRendering(attrs.listRendering);
96409
96505
  const path2 = listRendering?.path;
96410
96506
  const ordinal = getListOrdinalFromPath(path2);
@@ -96516,8 +96612,17 @@ function listListItems(editor, query) {
96516
96612
  }
96517
96613
  });
96518
96614
  }
96615
+ function hasNumberingMetadata(candidate) {
96616
+ const { numId } = getNumberingProperties(candidate.node);
96617
+ if (numId != null)
96618
+ return true;
96619
+ return getListRendering((candidate.node.attrs ?? {}).listRendering) != null;
96620
+ }
96519
96621
  function resolveListItem(editor, address) {
96520
- const matches$1 = getBlockIndex(editor).candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address.nodeId);
96622
+ const index2 = getBlockIndex(editor);
96623
+ let matches$1 = index2.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address.nodeId);
96624
+ if (matches$1.length === 0)
96625
+ matches$1 = index2.candidates.filter((candidate) => candidate.nodeId === address.nodeId && hasNumberingMetadata(candidate));
96521
96626
  if (matches$1.length === 0)
96522
96627
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "List item target was not found.", { target: address });
96523
96628
  if (matches$1.length > 1)
@@ -118918,7 +119023,34 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118918
119023
  "data-track-change-date": change.date || ""
118919
119024
  }));
118920
119025
  }
118921
- }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, 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.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
119026
+ }, NOTE_REFERENCE_NODE_TYPES, storeByEditor, liveSessionsByHost, cacheByHost, hostStoreSyncedKeys, BODY_LOCATOR, enumeratePprChanges = (state) => {
119027
+ const doc$2 = state?.doc;
119028
+ if (!doc$2)
119029
+ return [];
119030
+ const out = [];
119031
+ try {
119032
+ doc$2.descendants((node2, pos) => {
119033
+ if (node2.isText)
119034
+ return false;
119035
+ const change = node2?.attrs?.paragraphProperties?.change;
119036
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties)
119037
+ out.push({
119038
+ id: change.id,
119039
+ from: pos,
119040
+ to: pos + node2.nodeSize,
119041
+ author: change.author || "",
119042
+ authorEmail: change.authorEmail || "",
119043
+ authorImage: change.authorImage || "",
119044
+ date: change.date || "",
119045
+ formerProperties: change.paragraphProperties || {},
119046
+ subtype: "paragraph-format"
119047
+ });
119048
+ });
119049
+ } catch {
119050
+ return out;
119051
+ }
119052
+ return out;
119053
+ }, 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.43.1", SUPERDOC_DOCUMENT_ORIGIN_PROPERTY = "SuperdocDocumentOrigin", STORED_DOCUMENT_ORIGINS, collectRunDefaultProperties = (runProps, { allowOverrideTypeface = true, allowOverrideSize = true, themeResolver, state }) => {
118922
119054
  if (!runProps?.elements?.length || !state)
118923
119055
  return;
118924
119056
  const fontsNode = runProps.elements.find((el) => el.name === "w:rFonts");
@@ -118952,7 +119084,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118952
119084
  state.kern = kernNode.attributes["w:val"];
118953
119085
  }
118954
119086
  }, SuperConverter;
118955
- var init_SuperConverter_Ed3nFN54_es = __esm(() => {
119087
+ var init_SuperConverter_DlrS7cQT_es = __esm(() => {
118956
119088
  init_rolldown_runtime_Bg48TavK_es();
118957
119089
  init_jszip_C49i9kUs_es();
118958
119090
  init_xml_js_CqGKpaft_es();
@@ -123830,6 +123962,8 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
123830
123962
  ...params.node,
123831
123963
  attrs: change
123832
123964
  } });
123965
+ if (decodedAttrs["w:id"] != null)
123966
+ decodedAttrs["w:id"] = resolvePprChangeWordId(params, change);
123833
123967
  const hasParagraphProperties$1 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
123834
123968
  const paragraphProperties = hasParagraphProperties$1 ? change.paragraphProperties : undefined;
123835
123969
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator.decode({
@@ -147568,7 +147702,15 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
147568
147702
  }
147569
147703
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
147570
147704
  this.exportWarnings = [];
147571
- const exportableComments = comments.filter((c$1) => !c$1.trackedChange);
147705
+ const isSyntheticTrackedChangeRow = (c$1) => {
147706
+ const linkId = c$1.trackedChangeLink?.trackedChangeId;
147707
+ if (!c$1.trackedChange || !linkId)
147708
+ return false;
147709
+ const identity = c$1.commentId ?? c$1.id;
147710
+ return identity != null && String(identity) === String(linkId);
147711
+ };
147712
+ const hasCommentBody = (c$1) => Boolean(typeof c$1.commentText === "string" && c$1.commentText.length > 0 || c$1.commentJSON || Array.isArray(c$1.elements) && c$1.elements.length || typeof c$1.text === "string" && c$1.text.length > 0);
147713
+ const exportableComments = comments.filter((c$1) => !isSyntheticTrackedChangeRow(c$1) && !(c$1.trackedChange && !hasCommentBody(c$1)));
147572
147714
  const commentsWithParaIds = exportableComments.map((c$1) => prepareCommentParaIds(c$1));
147573
147715
  const commentDefinitions = commentsWithParaIds.map((c$1, index2) => getCommentDefinition(c$1, index2, commentsWithParaIds, editor));
147574
147716
  let statFieldCacheMap;
@@ -147958,7 +148100,7 @@ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
147958
148100
  };
147959
148101
  });
147960
148102
 
147961
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-PSeH6IV5.es.js
148103
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Bm-c7KZd.es.js
147962
148104
  function parseSizeUnit(val = "0") {
147963
148105
  const length = val.toString() || "0";
147964
148106
  const value = Number.parseFloat(length);
@@ -152391,7 +152533,25 @@ function executeTextDelete(_editor, tr, target, _step, mapping) {
152391
152533
  tr.delete(absFrom, absTo);
152392
152534
  return { changed: true };
152393
152535
  }
152394
- function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
152536
+ function withTrackedParagraphPropertyChange(editor, existing, nextParagraphProperties, changeMode) {
152537
+ if (changeMode !== "tracked")
152538
+ return nextParagraphProperties;
152539
+ if (existing?.change)
152540
+ return nextParagraphProperties;
152541
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
152542
+ const user = editor?.options?.user ?? {};
152543
+ return {
152544
+ ...nextParagraphProperties,
152545
+ change: {
152546
+ id: v4_default(),
152547
+ author: user.name || "",
152548
+ authorEmail: user.email || "",
152549
+ date: (/* @__PURE__ */ new Date()).toISOString(),
152550
+ paragraphProperties: formerProperties
152551
+ }
152552
+ };
152553
+ }
152554
+ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment, changeMode) {
152395
152555
  if (!alignment)
152396
152556
  return false;
152397
152557
  let changed = false;
@@ -152402,10 +152562,10 @@ function applyAlignmentToRange(editor, tr, absFrom, absTo, alignment) {
152402
152562
  const justification = mapAlignmentToJustificationForParagraph(alignment, calculateResolvedParagraphProperties(editor, node2, typeof tr.doc.resolve === "function" ? tr.doc.resolve(pos) : null)?.rightToLeft === true);
152403
152563
  if (existing?.justification === justification)
152404
152564
  return;
152405
- const updated = {
152565
+ const updated = withTrackedParagraphPropertyChange(editor, existing, {
152406
152566
  ...existing ?? {},
152407
152567
  justification
152408
- };
152568
+ }, changeMode);
152409
152569
  tr.setNodeMarkup(pos, undefined, {
152410
152570
  ...node2.attrs,
152411
152571
  paragraphProperties: updated
@@ -152430,7 +152590,7 @@ function expandToBlockBoundaries$1(doc3, from2, to) {
152430
152590
  to: expandedTo
152431
152591
  };
152432
152592
  }
152433
- function executeStyleApply2(editor, tr, target, step$1, mapping) {
152593
+ function executeStyleApply2(editor, tr, target, step$1, mapping, changeMode) {
152434
152594
  let absFrom = mapping.map(target.absFrom);
152435
152595
  let absTo = mapping.map(target.absTo);
152436
152596
  if (step$1.args.scope === "block") {
@@ -152442,7 +152602,7 @@ function executeStyleApply2(editor, tr, target, step$1, mapping) {
152442
152602
  if (step$1.args.inline)
152443
152603
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
152444
152604
  if (step$1.args.alignment)
152445
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
152605
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
152446
152606
  return { changed };
152447
152607
  }
152448
152608
  function validateMappedSpanContiguity(target, mapping, stepId) {
@@ -152513,7 +152673,7 @@ function executeSpanTextDelete(_editor, tr, target, step$1, mapping) {
152513
152673
  tr.delete(absFrom, absTo);
152514
152674
  return { changed: true };
152515
152675
  }
152516
- function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
152676
+ function executeSpanStyleApply(editor, tr, target, step$1, mapping, changeMode) {
152517
152677
  validateMappedSpanContiguity(target, mapping, step$1.id);
152518
152678
  const firstSeg = target.segments[0];
152519
152679
  const lastSeg = target.segments[target.segments.length - 1];
@@ -152528,7 +152688,7 @@ function executeSpanStyleApply(editor, tr, target, step$1, mapping) {
152528
152688
  if (step$1.args.inline)
152529
152689
  changed = applyInlinePatchToRange(editor, tr, absFrom, absTo, step$1.args.inline) || changed;
152530
152690
  if (step$1.args.alignment)
152531
- changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment) || changed;
152691
+ changed = applyAlignmentToRange(editor, tr, absFrom, absTo, step$1.args.alignment, changeMode) || changed;
152532
152692
  return { changed };
152533
152693
  }
152534
152694
  function getReplacementText(replacement) {
@@ -158761,9 +158921,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
158761
158921
  }
158762
158922
  };
158763
158923
  };
158764
- var init_create_headless_toolbar_PSeH6IV5_es = __esm(() => {
158924
+ var init_create_headless_toolbar_Bm_c7KZd_es = __esm(() => {
158765
158925
  init_rolldown_runtime_Bg48TavK_es();
158766
- init_SuperConverter_Ed3nFN54_es();
158926
+ init_SuperConverter_DlrS7cQT_es();
158767
158927
  init_jszip_C49i9kUs_es();
158768
158928
  init_uuid_B2wVPhPi_es();
158769
158929
  init_constants_D9qj59G2_es();
@@ -214377,7 +214537,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214377
214537
  init_remark_gfm_BUJjZJLy_es();
214378
214538
  });
214379
214539
 
214380
- // ../../packages/superdoc/dist/chunks/src-bMRzO9Kl.es.js
214540
+ // ../../packages/superdoc/dist/chunks/src-CVmBLxZV.es.js
214381
214541
  function deleteProps(obj, propOrProps) {
214382
214542
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214383
214543
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -232276,7 +232436,7 @@ function trackChangesGetWrapper(editor, input2) {
232276
232436
  imported: Boolean(toNonEmptyString(resolved.change.attrs.sourceId))
232277
232437
  };
232278
232438
  }
232279
- function decideSingle(hostEditor, decision, id2, story, options) {
232439
+ function decideSingle(hostEditor, decision, id2, story, options, side) {
232280
232440
  const resolved = resolveTrackedChangeInStory(hostEditor, {
232281
232441
  kind: "entity",
232282
232442
  entityType: "trackedChange",
@@ -232294,7 +232454,7 @@ function decideSingle(hostEditor, decision, id2, story, options) {
232294
232454
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${decision === "accept" ? "Accept" : "Reject"} tracked change command is not available on the story editor.`, { reason: "missing_command" });
232295
232455
  checkRevision(hostEditor, options?.expectedRevision);
232296
232456
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
232297
- if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId))).steps[0]?.effect !== "changed")
232457
+ if (executeDomainCommand(resolved.editor, () => Boolean(command$1(commandRawId, side ? { side } : undefined))).steps[0]?.effect !== "changed")
232298
232458
  return decisionFailureReceipt(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
232299
232459
  id: id2,
232300
232460
  story
@@ -232306,10 +232466,10 @@ function decideSingle(hostEditor, decision, id2, story, options) {
232306
232466
  return { success: true };
232307
232467
  }
232308
232468
  function trackChangesAcceptWrapper(editor, input2, options) {
232309
- return decideSingle(editor, "accept", input2.id, input2.story, options);
232469
+ return decideSingle(editor, "accept", input2.id, input2.story, options, input2.side);
232310
232470
  }
232311
232471
  function trackChangesRejectWrapper(editor, input2, options) {
232312
- return decideSingle(editor, "reject", input2.id, input2.story, options);
232472
+ return decideSingle(editor, "reject", input2.id, input2.story, options, input2.side);
232313
232473
  }
232314
232474
  function decideAll(editor, decision, input2, options) {
232315
232475
  const index2 = getTrackedChangeIndex(editor);
@@ -233375,6 +233535,7 @@ function replyToCommentHandler(editor, input2, options) {
233375
233535
  };
233376
233536
  if (trackedPayload && inheritedTrackedFields)
233377
233537
  emitCommentLifecycleUpdate(editor, "update", trackedPayload);
233538
+ incrementRevision(editor);
233378
233539
  return {
233379
233540
  success: true,
233380
233541
  id: replyId,
@@ -236070,6 +236231,13 @@ function extractBlockNumbering(node2) {
236070
236231
  function extractBlockFormatting(node2, styleCtx) {
236071
236232
  const pProps = node2.attrs.paragraphProperties;
236072
236233
  const styleId$1 = pProps?.styleId ?? null;
236234
+ const rawIndent = pProps?.indent;
236235
+ const indent2 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries([
236236
+ "left",
236237
+ "right",
236238
+ "firstLine",
236239
+ "hanging"
236240
+ ].filter((k$1) => typeof rawIndent[k$1] === "number" && rawIndent[k$1] !== 0).map((k$1) => [k$1, rawIndent[k$1]])) : undefined;
236073
236241
  let fontFamily;
236074
236242
  let fontSize;
236075
236243
  let bold;
@@ -236118,6 +236286,7 @@ function extractBlockFormatting(node2, styleCtx) {
236118
236286
  ...underline ? { underline } : {},
236119
236287
  ...color2 ? { color: color2 } : {},
236120
236288
  ...pProps?.justification ? { alignment: pProps.justification } : {},
236289
+ ...indent2 && Object.keys(indent2).length > 0 ? { indent: indent2 } : {},
236121
236290
  ...headingLevel ? { headingLevel } : {}
236122
236291
  };
236123
236292
  }
@@ -236205,6 +236374,7 @@ function blocksListWrapper(editor, input2) {
236205
236374
  }],
236206
236375
  blockIndex: offset$1 + i3
236207
236376
  }) : undefined;
236377
+ const listRendering = candidate.node.attrs?.listRendering;
236208
236378
  return {
236209
236379
  ordinal: offset$1 + i3,
236210
236380
  nodeId: candidate.nodeId,
@@ -236213,6 +236383,11 @@ function blocksListWrapper(editor, input2) {
236213
236383
  ...fullText !== undefined ? { text: fullText } : {},
236214
236384
  isEmpty: textLength === 0,
236215
236385
  ...extractBlockFormatting(candidate.node, styleCtx),
236386
+ ...listRendering ? { numbering: {
236387
+ marker: listRendering.markerText ?? null,
236388
+ path: listRendering.path ?? null,
236389
+ kind: listRendering.numberingType ?? null
236390
+ } } : {},
236216
236391
  ...numbering ? { paragraphNumbering: numbering } : {},
236217
236392
  ...ref$1 ? { ref: ref$1 } : {}
236218
236393
  };
@@ -237545,7 +237720,9 @@ function listsCreateWrapper(editor, input2, options) {
237545
237720
  };
237546
237721
  }
237547
237722
  function listsAttachWrapper(editor, input2, options) {
237548
- rejectTrackedMode("lists.attach", options);
237723
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
237724
+ if (trackChange)
237725
+ ensureTrackedCapability(editor, { operation: "lists.attach" });
237549
237726
  const attachTo = resolveListItem(editor, input2.attachTo);
237550
237727
  if (attachTo.numId == null)
237551
237728
  return toListsFailure$1("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", { attachTo: input2.attachTo });
@@ -237572,7 +237749,7 @@ function listsAttachWrapper(editor, input2, options) {
237572
237749
  updateNumberingProperties({
237573
237750
  numId,
237574
237751
  ilvl: level
237575
- }, block.node, block.pos, editor, tr);
237752
+ }, block.node, block.pos, editor, tr, { trackChange });
237576
237753
  dispatchEditorTransaction$1(editor, tr);
237577
237754
  clearIndexCache(editor);
237578
237755
  return true;
@@ -241915,11 +242092,17 @@ function tablesSetShadingAdapter(editor, input2, options) {
241915
242092
  color: "auto"
241916
242093
  };
241917
242094
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
241918
- tr.setNodeMarkup(resolved.pos, null, {
242095
+ const nextAttrs = {
241919
242096
  ...currentAttrs,
241920
242097
  [propsKey]: currentProps,
241921
242098
  ...syncAttrs
241922
- });
242099
+ };
242100
+ if (resolved.scope === "cell")
242101
+ if (normalizedColor === "auto")
242102
+ delete nextAttrs.background;
242103
+ else
242104
+ nextAttrs.background = { color: normalizedColor };
242105
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
241923
242106
  if (resolved.scope === "table")
241924
242107
  applyShadingToCells(tr, resolved.node, resolved.pos + 1, normalizedColor);
241925
242108
  applyDirectMutationMeta(tr);
@@ -241946,11 +242129,14 @@ function tablesClearShadingAdapter(editor, input2, options) {
241946
242129
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
241947
242130
  delete currentProps.shading;
241948
242131
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs(currentProps) : {};
241949
- tr.setNodeMarkup(resolved.pos, null, {
242132
+ const nextAttrs = {
241950
242133
  ...currentAttrs,
241951
242134
  [propsKey]: currentProps,
241952
242135
  ...syncAttrs
241953
- });
242136
+ };
242137
+ if (resolved.scope === "cell")
242138
+ delete nextAttrs.background;
242139
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
241954
242140
  if (resolved.scope === "table") {
241955
242141
  const tableNode = resolved.node;
241956
242142
  const tableStart = resolved.pos + 1;
@@ -242993,7 +243179,7 @@ function registerBuiltInExecutors() {
242993
243179
  registerStepExecutor("text.delete", { execute: (ctx$1, targets, step2) => executeTextStep(ctx$1, targets, step2, (e, tr, t, s2, m$1) => executeTextDelete(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanTextDelete(e, tr, t, s2, m$1)) });
242994
243180
  registerStepExecutor("format.apply", { execute: (ctx$1, targets, step2) => {
242995
243181
  ensureFormatStepCapabilities(ctx$1, step2);
242996
- return executeTextStep(ctx$1, targets, step2, (e, tr, t, s2, m$1) => executeStyleApply2(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1));
243182
+ return executeTextStep(ctx$1, targets, step2, (e, tr, t, s2, m$1) => executeStyleApply2(e, tr, t, s2, m$1, ctx$1.changeMode), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1, ctx$1.changeMode));
242997
243183
  } });
242998
243184
  registerStepExecutor("create.paragraph", { execute: (ctx$1, targets, step2) => executeCreateStep(ctx$1.editor, ctx$1.tr, step2, targets, ctx$1.mapping) });
242999
243185
  registerStepExecutor("create.heading", { execute: (ctx$1, targets, step2) => executeCreateStep(ctx$1.editor, ctx$1.tr, step2, targets, ctx$1.mapping) });
@@ -284694,11 +284880,12 @@ var Node$13 = class Node$14 {
284694
284880
  return buildGraphFromSpans({
284695
284881
  spans: enumerateTrackedMarkSpans(state),
284696
284882
  structuralChanges: enumerateStructuralRowChanges(state),
284883
+ pprChanges: enumeratePprChanges(state),
284697
284884
  doc: state?.doc ?? null,
284698
284885
  story,
284699
284886
  replacementsMode
284700
284887
  });
284701
- }, buildGraphFromSpans = ({ spans, structuralChanges = [], doc: doc$12, story, replacementsMode }) => {
284888
+ }, buildGraphFromSpans = ({ spans, structuralChanges = [], pprChanges = [], doc: doc$12, story, replacementsMode }) => {
284702
284889
  const mergedSegments = mergeAdjacentSpans(spans.map((span) => ({
284703
284890
  attrs: readTrackedAttrs(span.mark, span.mark.type.name),
284704
284891
  span
@@ -284776,6 +284963,22 @@ var Node$13 = class Node$14 {
284776
284963
  mergedSegments.push(...logical.segments);
284777
284964
  appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
284778
284965
  }
284966
+ for (const ppr of pprChanges) {
284967
+ const logical = buildPprLogicalChange({
284968
+ ppr,
284969
+ doc: doc$12,
284970
+ story
284971
+ });
284972
+ if (!logical)
284973
+ continue;
284974
+ const internalKey = `pprchange:${ppr.from}`;
284975
+ if (changes.has(internalKey))
284976
+ continue;
284977
+ changes.set(internalKey, logical);
284978
+ if (logical.id && logical.id !== internalKey && !changes.has(logical.id))
284979
+ changes.set(logical.id, logical);
284980
+ appendToMap(byRevisionGroupId, logical.revisionGroupId, logical.id);
284981
+ }
284779
284982
  const segments = mergedSegments.slice().sort((a2, b$1) => a2.from - b$1.from || a2.to - b$1.to);
284780
284983
  const graph = {
284781
284984
  changes,
@@ -284888,6 +285091,12 @@ var Node$13 = class Node$14 {
284888
285091
  type = CanonicalChangeType.Formatting;
284889
285092
  else
284890
285093
  type = "";
285094
+ if (type === CanonicalChangeType.Replacement && !(inserted.length && deleted.length)) {
285095
+ if (inserted.length)
285096
+ type = CanonicalChangeType.Insertion;
285097
+ else if (deleted.length)
285098
+ type = CanonicalChangeType.Deletion;
285099
+ }
284891
285100
  const subtype = subtypeFromChangeType(type) ?? "";
284892
285101
  const primary = segments[0]?.attrs ?? null;
284893
285102
  let replacement = null;
@@ -285024,6 +285233,90 @@ var Node$13 = class Node$14 {
285024
285233
  enumerable: false
285025
285234
  });
285026
285235
  return logical;
285236
+ }, buildPprLogicalChange = ({ ppr, doc: doc$12, story }) => {
285237
+ const from$1 = ppr.from;
285238
+ const to = ppr.to;
285239
+ if (!(from$1 < to))
285240
+ return null;
285241
+ const side = SegmentSide.Formatting;
285242
+ const attrs = {
285243
+ id: ppr.id,
285244
+ revisionGroupId: ppr.id,
285245
+ splitFromId: "",
285246
+ changeType: CanonicalChangeType.Formatting,
285247
+ replacementGroupId: "",
285248
+ replacementSideId: "",
285249
+ overlapParentId: "",
285250
+ sourceIds: {},
285251
+ sourceId: "",
285252
+ importedAuthor: "",
285253
+ origin: "",
285254
+ author: ppr.author,
285255
+ authorId: "",
285256
+ authorEmail: ppr.authorEmail,
285257
+ authorImage: ppr.authorImage,
285258
+ date: ppr.date,
285259
+ markType: "",
285260
+ side,
285261
+ subtype: ppr.subtype,
285262
+ explicitChangeType: CanonicalChangeType.Formatting,
285263
+ hasReviewMetadata: true
285264
+ };
285265
+ const segment = {
285266
+ segmentId: `${ppr.id}:pprchange:${from$1}:${to}:0`,
285267
+ changeId: ppr.id,
285268
+ markType: "",
285269
+ side,
285270
+ from: from$1,
285271
+ to,
285272
+ text: "",
285273
+ mark: null,
285274
+ markRuns: [],
285275
+ attrs,
285276
+ parentId: "",
285277
+ parentSide: "",
285278
+ overlapRole: "standalone",
285279
+ pprChange: true
285280
+ };
285281
+ if (doc$12)
285282
+ try {
285283
+ segment.text = doc$12.textBetween(from$1, to, " ", "");
285284
+ } catch {
285285
+ segment.text = "";
285286
+ }
285287
+ const segments = [segment];
285288
+ const logical = {
285289
+ id: ppr.id,
285290
+ type: CanonicalChangeType.Formatting,
285291
+ subtype: ppr.subtype,
285292
+ state: "open",
285293
+ segments,
285294
+ coverageSegments: [...segments],
285295
+ insertedSegments: [],
285296
+ deletedSegments: [],
285297
+ formattingSegments: [...segments],
285298
+ replacement: null,
285299
+ author: ppr.author,
285300
+ authorId: "",
285301
+ authorEmail: ppr.authorEmail,
285302
+ authorImage: ppr.authorImage,
285303
+ date: ppr.date,
285304
+ sourceIds: {},
285305
+ revisionGroupId: ppr.id,
285306
+ splitFromId: "",
285307
+ sourcePlatform: "",
285308
+ story,
285309
+ parent: null,
285310
+ children: [],
285311
+ before: [],
285312
+ after: [],
285313
+ excerpt: segment.text.length > 200 ? `${segment.text.slice(0, 200)}…` : segment.text
285314
+ };
285315
+ Object.defineProperty(logical, "pprChange", {
285316
+ value: ppr,
285317
+ enumerable: false
285318
+ });
285319
+ return logical;
285027
285320
  }, aggregateSourceIds = (segments) => {
285028
285321
  const out = {};
285029
285322
  const sorted = [...segments].sort((a2, b$1) => {
@@ -287738,6 +288031,10 @@ var Node$13 = class Node$14 {
287738
288031
  touchedChangeIds: applyResult.touchedChangeIds,
287739
288032
  diagnostics: plan.diagnostics
287740
288033
  };
288034
+ }, normalizeReplacementSide = (value) => {
288035
+ if (value === SegmentSide.Inserted || value === SegmentSide.Deleted)
288036
+ return value;
288037
+ return null;
287741
288038
  }, normalizeDecisionTarget = (target) => {
287742
288039
  if (!target || typeof target !== "object")
287743
288040
  return {
@@ -287751,11 +288048,18 @@ var Node$13 = class Node$14 {
287751
288048
  ok: false,
287752
288049
  failure: failure$3("INVALID_TARGET", 'target.kind = "id" requires a non-empty id.')
287753
288050
  };
288051
+ const side = normalizeReplacementSide(t.side);
288052
+ if (t.side != null && !side)
288053
+ return {
288054
+ ok: false,
288055
+ failure: failure$3("INVALID_TARGET", 'target.side must be "inserted" or "deleted" when provided.')
288056
+ };
287754
288057
  return {
287755
288058
  ok: true,
287756
288059
  value: {
287757
288060
  kind: "id",
287758
- id: t.id
288061
+ id: t.id,
288062
+ ...side ? { side } : {}
287759
288063
  }
287760
288064
  };
287761
288065
  }
@@ -287859,7 +288163,8 @@ var Node$13 = class Node$14 {
287859
288163
  ranges: change.segments.map((s2) => ({
287860
288164
  from: s2.from,
287861
288165
  to: s2.to
287862
- }))
288166
+ })),
288167
+ ...normalized.side ? { side: normalized.side } : {}
287863
288168
  }]
287864
288169
  };
287865
288170
  }
@@ -288102,7 +288407,7 @@ var Node$13 = class Node$14 {
288102
288407
  suppressedInsideTable.add(change.id);
288103
288408
  continue;
288104
288409
  }
288105
- if (isInsideStayingTable(change)) {
288410
+ if (!change.pprChange && isInsideStayingTable(change)) {
288106
288411
  const failureResult = planContainedInlineChild(change);
288107
288412
  if (failureResult)
288108
288413
  return {
@@ -288111,6 +288416,36 @@ var Node$13 = class Node$14 {
288111
288416
  };
288112
288417
  continue;
288113
288418
  }
288419
+ if (change.type === CanonicalChangeType.Replacement && selection.side) {
288420
+ touched.add(change.id);
288421
+ const sideResult = planReplacementSideDecision({
288422
+ ops,
288423
+ change,
288424
+ decision,
288425
+ side: selection.side,
288426
+ removedRanges,
288427
+ retired,
288428
+ resolvedRanges
288429
+ });
288430
+ if (!sideResult.ok)
288431
+ return {
288432
+ ok: false,
288433
+ failure: sideResult.failure
288434
+ };
288435
+ continue;
288436
+ }
288437
+ if (selection.side) {
288438
+ const standaloneSide = change.type === CanonicalChangeType.Insertion ? "inserted" : change.type === CanonicalChangeType.Deletion ? "deleted" : null;
288439
+ if (standaloneSide !== selection.side)
288440
+ return {
288441
+ ok: false,
288442
+ failure: failure$3("INVALID_TARGET", `target.side "${selection.side}" does not apply: this change is not a paired replacement${standaloneSide ? ` (its only side is "${standaloneSide}")` : ""}. The targeted side may have already been resolved.`, { details: {
288443
+ changeId: change.id,
288444
+ requestedSide: selection.side,
288445
+ currentSide: standaloneSide
288446
+ } })
288447
+ };
288448
+ }
288114
288449
  const isFull = selection.coverage === "full";
288115
288450
  if (!isFull) {
288116
288451
  if (change.type === CanonicalChangeType.Structural)
@@ -288133,14 +288468,26 @@ var Node$13 = class Node$14 {
288133
288468
  };
288134
288469
  }
288135
288470
  touched.add(change.id);
288136
- if (isFull)
288471
+ if (isFull && !change.pprChange)
288137
288472
  for (const segment of change.segments)
288138
288473
  resolvedRanges.push({
288139
288474
  from: segment.from,
288140
288475
  to: segment.to,
288141
288476
  cause: `${decision}:${change.id}`
288142
288477
  });
288143
- if (change.type === CanonicalChangeType.Structural) {
288478
+ if (change.pprChange) {
288479
+ const pprResult = planPprDecision({
288480
+ ops,
288481
+ change,
288482
+ decision,
288483
+ retired
288484
+ });
288485
+ if (!pprResult.ok)
288486
+ return {
288487
+ ok: false,
288488
+ failure: pprResult.failure
288489
+ };
288490
+ } else if (change.type === CanonicalChangeType.Structural) {
288144
288491
  const structuralResult = planStructuralDecision({
288145
288492
  ops,
288146
288493
  change,
@@ -288225,6 +288572,22 @@ var Node$13 = class Node$14 {
288225
288572
  continue;
288226
288573
  if (!isInsideStayingTable(change))
288227
288574
  continue;
288575
+ if (change.pprChange) {
288576
+ cascadedInsideStayingTable.add(change.id);
288577
+ touched.add(change.id);
288578
+ const pprResult = planPprDecision({
288579
+ ops,
288580
+ change,
288581
+ decision,
288582
+ retired
288583
+ });
288584
+ if (!pprResult.ok)
288585
+ return {
288586
+ ok: false,
288587
+ failure: pprResult.failure
288588
+ };
288589
+ continue;
288590
+ }
288228
288591
  const failureResult = planContainedInlineChild(change);
288229
288592
  if (failureResult)
288230
288593
  return {
@@ -288409,6 +288772,22 @@ var Node$13 = class Node$14 {
288409
288772
  });
288410
288773
  retired.add(change.id);
288411
288774
  return { ok: true };
288775
+ }, planPprDecision = ({ ops, change, decision, retired }) => {
288776
+ const ppr = change.pprChange;
288777
+ if (!ppr)
288778
+ return {
288779
+ ok: false,
288780
+ failure: failure$3("CAPABILITY_UNAVAILABLE", `change "${change.id}" is not a paragraph-property change.`)
288781
+ };
288782
+ ops.push({
288783
+ kind: "resolvePprChange",
288784
+ from: ppr.from,
288785
+ changeId: change.id,
288786
+ decision,
288787
+ formerProperties: ppr.formerProperties
288788
+ });
288789
+ retired.add(change.id);
288790
+ return { ok: true };
288412
288791
  }, planReplacementDecision = ({ ops, graph, change, decision, removedRanges, retired }) => {
288413
288792
  const inserted = change.insertedSegments;
288414
288793
  const deleted = change.deletedSegments;
@@ -288493,6 +288872,55 @@ var Node$13 = class Node$14 {
288493
288872
  }
288494
288873
  retired.add(change.id);
288495
288874
  return { ok: true };
288875
+ }, planReplacementSideDecision = ({ ops, change, decision, side, removedRanges, resolvedRanges }) => {
288876
+ const inserted = change.insertedSegments;
288877
+ const deleted = change.deletedSegments;
288878
+ if (!inserted.length || !deleted.length)
288879
+ return {
288880
+ ok: false,
288881
+ failure: failure$3("PRECONDITION_FAILED", `replacement "${change.id}" missing inserted or deleted side.`)
288882
+ };
288883
+ const segments = side === SegmentSide.Inserted ? inserted : deleted;
288884
+ for (const seg of segments)
288885
+ resolvedRanges.push({
288886
+ from: seg.from,
288887
+ to: seg.to,
288888
+ cause: `${decision}-replacement-${side}:${change.id}`
288889
+ });
288890
+ const removeContent = (seg, cause) => {
288891
+ ops.push({
288892
+ kind: "removeContent",
288893
+ from: seg.from,
288894
+ to: seg.to,
288895
+ changeId: change.id,
288896
+ side
288897
+ });
288898
+ removedRanges.push({
288899
+ from: seg.from,
288900
+ to: seg.to,
288901
+ cause: `${cause}:${change.id}`
288902
+ });
288903
+ };
288904
+ const dropMark = (seg) => pushRemoveMarkOpsForSegment({
288905
+ ops,
288906
+ segment: seg,
288907
+ changeId: change.id,
288908
+ side
288909
+ });
288910
+ if (side === SegmentSide.Deleted)
288911
+ if (decision === "accept")
288912
+ for (const seg of deleted)
288913
+ removeContent(seg, "accept-replacement-deleted-side");
288914
+ else
288915
+ for (const seg of deleted)
288916
+ dropMark(seg);
288917
+ else if (decision === "accept")
288918
+ for (const seg of inserted)
288919
+ dropMark(seg);
288920
+ else
288921
+ for (const seg of inserted)
288922
+ removeContent(seg, "reject-replacement-inserted-side");
288923
+ return { ok: true };
288496
288924
  }, getParentRestoreContext = ({ graph, change }) => {
288497
288925
  const explicit = getExplicitParentRestoreContext({
288498
288926
  graph,
@@ -288861,6 +289289,31 @@ var Node$13 = class Node$14 {
288861
289289
  });
288862
289290
  continue;
288863
289291
  }
289292
+ if (op.kind === "resolvePprChange") {
289293
+ const mappedFrom = tr.mapping.map(op.from, 1);
289294
+ const node2 = tr.doc.nodeAt(mappedFrom);
289295
+ const pp = node2?.attrs?.paragraphProperties;
289296
+ if (node2 && pp && pp.change)
289297
+ if (op.decision === "accept") {
289298
+ const kept = { ...pp };
289299
+ delete kept.change;
289300
+ tr.setNodeMarkup(mappedFrom, undefined, {
289301
+ ...node2.attrs,
289302
+ paragraphProperties: kept
289303
+ });
289304
+ } else {
289305
+ const former = { ...op.formerProperties || {} };
289306
+ const nextAttrs = {
289307
+ ...node2.attrs,
289308
+ paragraphProperties: former,
289309
+ numberingProperties: former.numberingProperties ?? null
289310
+ };
289311
+ if (!former.numberingProperties)
289312
+ nextAttrs.listRendering = null;
289313
+ tr.setNodeMarkup(mappedFrom, undefined, nextAttrs);
289314
+ }
289315
+ continue;
289316
+ }
288864
289317
  }
288865
289318
  for (const op of contentOps)
288866
289319
  tr.step(new ReplaceStep(op.from, op.to, Slice.empty));
@@ -315069,13 +315522,13 @@ menclose::after {
315069
315522
  return;
315070
315523
  console.log(...args$1);
315071
315524
  }, 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;
315072
- var init_src_bMRzO9Kl_es = __esm(() => {
315525
+ var init_src_CVmBLxZV_es = __esm(() => {
315073
315526
  init_rolldown_runtime_Bg48TavK_es();
315074
- init_SuperConverter_Ed3nFN54_es();
315527
+ init_SuperConverter_DlrS7cQT_es();
315075
315528
  init_jszip_C49i9kUs_es();
315076
315529
  init_xml_js_CqGKpaft_es();
315077
315530
  init_uuid_B2wVPhPi_es();
315078
- init_create_headless_toolbar_PSeH6IV5_es();
315531
+ init_create_headless_toolbar_Bm_c7KZd_es();
315079
315532
  init_constants_D9qj59G2_es();
315080
315533
  init_unified_BDuVPlMu_es();
315081
315534
  init_remark_gfm_BUJjZJLy_es();
@@ -316443,13 +316896,13 @@ var init_src_bMRzO9Kl_es = __esm(() => {
316443
316896
  },
316444
316897
  "lists.attach": {
316445
316898
  memberPath: "lists.attach",
316446
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
316899
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
316447
316900
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
316448
316901
  requiresDocumentContext: true,
316449
316902
  metadata: mutationOperation({
316450
316903
  idempotency: "conditional",
316451
316904
  supportsDryRun: true,
316452
- supportsTrackedMode: false,
316905
+ supportsTrackedMode: true,
316453
316906
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
316454
316907
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
316455
316908
  }),
@@ -339049,7 +339502,7 @@ function print() { __p += __j.call(arguments, '') }
339049
339502
  })
339050
339503
  });
339051
339504
  },
339052
- acceptTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
339505
+ acceptTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
339053
339506
  return dispatchReviewDecision({
339054
339507
  editor,
339055
339508
  state,
@@ -339057,7 +339510,8 @@ function print() { __p += __j.call(arguments, '') }
339057
339510
  decision: "accept",
339058
339511
  target: {
339059
339512
  kind: "id",
339060
- id: id2
339513
+ id: id2,
339514
+ ...options.side ? { side: options.side } : {}
339061
339515
  }
339062
339516
  }).applied;
339063
339517
  },
@@ -339070,7 +339524,7 @@ function print() { __p += __j.call(arguments, '') }
339070
339524
  target: { kind: "all" }
339071
339525
  }).applied;
339072
339526
  },
339073
- rejectTrackedChangeById: (id2) => ({ state, dispatch, editor }) => {
339527
+ rejectTrackedChangeById: (id2, options = {}) => ({ state, dispatch, editor }) => {
339074
339528
  return dispatchReviewDecision({
339075
339529
  editor,
339076
339530
  state,
@@ -339078,7 +339532,8 @@ function print() { __p += __j.call(arguments, '') }
339078
339532
  decision: "reject",
339079
339533
  target: {
339080
339534
  kind: "id",
339081
- id: id2
339535
+ id: id2,
339536
+ ...options.side ? { side: options.side } : {}
339082
339537
  }
339083
339538
  }).applied;
339084
339539
  },
@@ -358380,11 +358835,11 @@ function print() { __p += __j.call(arguments, '') }
358380
358835
  ]);
358381
358836
  });
358382
358837
 
358383
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DNNbMZCp.es.js
358838
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-D2qFX5i6.es.js
358384
358839
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, 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, FONT_SIZE_OPTIONS;
358385
- var init_create_super_doc_ui_DNNbMZCp_es = __esm(() => {
358386
- init_SuperConverter_Ed3nFN54_es();
358387
- init_create_headless_toolbar_PSeH6IV5_es();
358840
+ var init_create_super_doc_ui_D2qFX5i6_es = __esm(() => {
358841
+ init_SuperConverter_DlrS7cQT_es();
358842
+ init_create_headless_toolbar_Bm_c7KZd_es();
358388
358843
  DEFAULT_TEXT_ALIGN_OPTIONS = [
358389
358844
  {
358390
358845
  label: "Left",
@@ -358675,15 +359130,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
358675
359130
 
358676
359131
  // ../../packages/superdoc/dist/super-editor.es.js
358677
359132
  var init_super_editor_es = __esm(() => {
358678
- init_src_bMRzO9Kl_es();
358679
- init_SuperConverter_Ed3nFN54_es();
359133
+ init_src_CVmBLxZV_es();
359134
+ init_SuperConverter_DlrS7cQT_es();
358680
359135
  init_jszip_C49i9kUs_es();
358681
359136
  init_xml_js_CqGKpaft_es();
358682
- init_create_headless_toolbar_PSeH6IV5_es();
359137
+ init_create_headless_toolbar_Bm_c7KZd_es();
358683
359138
  init_constants_D9qj59G2_es();
358684
359139
  init_unified_BDuVPlMu_es();
358685
359140
  init_DocxZipper_BzS208BW_es();
358686
- init_create_super_doc_ui_DNNbMZCp_es();
359141
+ init_create_super_doc_ui_D2qFX5i6_es();
358687
359142
  init_ui_CGB3qmy3_es();
358688
359143
  init_eventemitter3_UwU_CLPU_es();
358689
359144
  init_errors_C_DoKMoN_es();
@@ -361910,13 +362365,13 @@ More content with **bold** and *italic*.`
361910
362365
  },
361911
362366
  "lists.attach": {
361912
362367
  memberPath: "lists.attach",
361913
- description: "Convert non-list paragraphs to list items under an existing list sequence.",
362368
+ description: 'Convert non-list paragraphs to list items under an existing list sequence. With changeMode:"tracked" the former (unnumbered) paragraph properties are recorded as a w:pPrChange so a reviewer can accept/reject the numbering.',
361914
362369
  expectedResult: "Returns a ListsMutateItemResult confirming attachment.",
361915
362370
  requiresDocumentContext: true,
361916
362371
  metadata: mutationOperation2({
361917
362372
  idempotency: "conditional",
361918
362373
  supportsDryRun: true,
361919
- supportsTrackedMode: false,
362374
+ supportsTrackedMode: true,
361920
362375
  possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
361921
362376
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
361922
362377
  }),
@@ -370001,6 +370456,27 @@ var init_schemas4 = __esm(() => {
370001
370456
  },
370002
370457
  additionalProperties: false
370003
370458
  },
370459
+ numbering: {
370460
+ type: "object",
370461
+ description: 'Computed numbering rendering (marker/path/kind) for numbered list items and numbered headings — e.g. the rendered clause label "2.3.". Absent for non-numbered blocks.',
370462
+ properties: {
370463
+ marker: { oneOf: [{ type: "string" }, { type: "null" }] },
370464
+ path: { oneOf: [{ type: "array", items: { type: "number" } }, { type: "null" }] },
370465
+ kind: { oneOf: [{ type: "string" }, { type: "null" }] }
370466
+ },
370467
+ additionalProperties: false
370468
+ },
370469
+ indent: {
370470
+ type: "object",
370471
+ description: "Direct paragraph indentation in twips (only non-zero fields present).",
370472
+ properties: {
370473
+ left: { type: "number" },
370474
+ right: { type: "number" },
370475
+ firstLine: { type: "number" },
370476
+ hanging: { type: "number" }
370477
+ },
370478
+ additionalProperties: false
370479
+ },
370004
370480
  ref: {
370005
370481
  type: "string",
370006
370482
  description: "Ref handle for this block. Pass directly to superdoc_format or superdoc_edit ref param. Only present for non-empty blocks."
@@ -371512,6 +371988,10 @@ var init_schemas4 = __esm(() => {
371512
371988
  moveRole: {
371513
371989
  enum: ["pair", "source", "destination"],
371514
371990
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
371991
+ },
371992
+ side: {
371993
+ enum: ["inserted", "deleted"],
371994
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half, leaving the other half as a standalone pending change."
371515
371995
  }
371516
371996
  }, ["kind", "id"]),
371517
371997
  objectSchema({
@@ -371548,6 +372028,10 @@ var init_schemas4 = __esm(() => {
371548
372028
  moveRole: {
371549
372029
  enum: ["pair", "source", "destination"],
371550
372030
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
372031
+ },
372032
+ side: {
372033
+ enum: ["inserted", "deleted"],
372034
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
371551
372035
  }
371552
372036
  }, ["id"]),
371553
372037
  objectSchema({
@@ -376633,10 +377117,11 @@ function executeTrackChangesDecide2(adapter, rawInput, options) {
376633
377117
  return adapter.rejectAll(input2, revisionOptions);
376634
377118
  }
376635
377119
  const { id: id2, story } = canonical.target;
377120
+ const side = canonical.target.side;
376636
377121
  if (canonical.decision === "accept") {
376637
- return adapter.accept({ id: id2, ...story ? { story } : {} }, revisionOptions);
377122
+ return adapter.accept({ id: id2, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
376638
377123
  }
376639
- return adapter.reject({ id: id2, ...story ? { story } : {} }, revisionOptions);
377124
+ return adapter.reject({ id: id2, ...story ? { story } : {}, ...side ? { side } : {} }, revisionOptions);
376640
377125
  }
376641
377126
  function isValidLegacyPartialIdRangeTarget2(input2) {
376642
377127
  if (typeof input2 !== "object" || input2 == null)
@@ -376682,11 +377167,13 @@ function normalizeReviewDecideTarget2(target) {
376682
377167
  }
376683
377168
  const story = readOptionalStory2(target, "target.story", false);
376684
377169
  const moveRole = readOptionalMoveRole2(target);
377170
+ const side = readOptionalReplacementSide2(target);
376685
377171
  return {
376686
377172
  kind: "id",
376687
377173
  id: id2,
376688
377174
  ...story ? { story } : {},
376689
- ...moveRole ? { moveRole } : {}
377175
+ ...moveRole ? { moveRole } : {},
377176
+ ...side ? { side } : {}
376690
377177
  };
376691
377178
  }
376692
377179
  if (kind === "range") {
@@ -376761,11 +377248,13 @@ function normalizeReviewDecideTarget2(target) {
376761
377248
  if (typeof target.id === "string" && target.id.length > 0) {
376762
377249
  const story = readOptionalStory2(target, "target.story", false);
376763
377250
  const moveRole = readOptionalMoveRole2(target);
377251
+ const side = readOptionalReplacementSide2(target);
376764
377252
  return {
376765
377253
  kind: "id",
376766
377254
  id: target.id,
376767
377255
  ...story ? { story } : {},
376768
- ...moveRole ? { moveRole } : {}
377256
+ ...moveRole ? { moveRole } : {},
377257
+ ...side ? { side } : {}
376769
377258
  };
376770
377259
  }
376771
377260
  }
@@ -376882,6 +377371,18 @@ function readOptionalMoveRole2(target) {
376882
377371
  }
376883
377372
  return moveRole;
376884
377373
  }
377374
+ function readOptionalReplacementSide2(target) {
377375
+ if (!("side" in target))
377376
+ return;
377377
+ const side = target.side;
377378
+ if (side === undefined || side === null)
377379
+ return;
377380
+ if (side === "inserted")
377381
+ return "inserted";
377382
+ if (side === "deleted")
377383
+ return "deleted";
377384
+ throw new DocumentApiValidationError3("INVALID_TARGET", 'trackChanges.decide id target.side must be "inserted" or "deleted" when provided.', { field: "target.side", value: side });
377385
+ }
376885
377386
  function validateRangeTargetSide2(side) {
376886
377387
  if (side === "insert" || side === "inserted" || side === "delete" || side === "deleted" || side === "source" || side === "destination") {
376887
377388
  return;
@@ -425871,6 +426372,27 @@ var init_pPr_base_translators = __esm(() => {
425871
426372
  });
425872
426373
 
425873
426374
  // ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/pPrChange/pPrChange-translator.js
426375
+ function resolvePprChangeWordId2(params3, change) {
426376
+ const idStr = String(change?.id ?? "");
426377
+ const allocator = params3?.converter?.wordIdAllocator;
426378
+ if (allocator) {
426379
+ const partPath = params3?.currentPartPath || "word/document.xml";
426380
+ const sourceId = /^\d+$/.test(idStr) ? idStr : undefined;
426381
+ return String(allocator.allocate({ partPath, sourceId, logicalId: idStr }));
426382
+ }
426383
+ return toDecimalWordId2(change?.id);
426384
+ }
426385
+ function toDecimalWordId2(id2) {
426386
+ const str = String(id2);
426387
+ if (/^\d+$/.test(str))
426388
+ return str;
426389
+ let hash5 = 2166136261;
426390
+ for (let i3 = 0;i3 < str.length; i3++) {
426391
+ hash5 ^= str.charCodeAt(i3);
426392
+ hash5 = Math.imul(hash5, 16777619);
426393
+ }
426394
+ return String(1e6 + (hash5 >>> 0) % 1e9);
426395
+ }
425874
426396
  function getSectPr2(pPrNode) {
425875
426397
  const sectPr = pPrNode?.elements?.find((el) => el.name === "w:sectPr");
425876
426398
  return sectPr ? carbonCopy2(sectPr) : undefined;
@@ -425915,6 +426437,9 @@ var init_pPrChange_translator = __esm(() => {
425915
426437
  const decodedAttrs = this.decodeAttributes({
425916
426438
  node: { ...params3.node, attrs: change }
425917
426439
  });
426440
+ if (decodedAttrs["w:id"] != null) {
426441
+ decodedAttrs["w:id"] = resolvePprChangeWordId2(params3, change);
426442
+ }
425918
426443
  const hasParagraphProperties2 = Object.prototype.hasOwnProperty.call(change, "paragraphProperties");
425919
426444
  const paragraphProperties = hasParagraphProperties2 ? change.paragraphProperties : undefined;
425920
426445
  let pPrNode = paragraphProperties && typeof paragraphProperties === "object" ? pPrTranslator2.decode({
@@ -427329,6 +427854,178 @@ var init_baseListDefinitions = __esm(() => {
427329
427854
  ]
427330
427855
  };
427331
427856
  });
427857
+
427858
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
427859
+ import { randomUUID } from "crypto";
427860
+ var native_default2;
427861
+ var init_native = __esm(() => {
427862
+ native_default2 = { randomUUID };
427863
+ });
427864
+
427865
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
427866
+ import { randomFillSync } from "crypto";
427867
+ function rng2() {
427868
+ if (poolPtr > rnds8Pool.length - 16) {
427869
+ randomFillSync(rnds8Pool);
427870
+ poolPtr = 0;
427871
+ }
427872
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
427873
+ }
427874
+ var rnds8Pool, poolPtr;
427875
+ var init_rng = __esm(() => {
427876
+ rnds8Pool = new Uint8Array(256);
427877
+ poolPtr = rnds8Pool.length;
427878
+ });
427879
+
427880
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/regex.js
427881
+ var regex_default2;
427882
+ var init_regex = __esm(() => {
427883
+ regex_default2 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
427884
+ });
427885
+
427886
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/validate.js
427887
+ function validate2(uuid3) {
427888
+ return typeof uuid3 === "string" && regex_default2.test(uuid3);
427889
+ }
427890
+ var validate_default2;
427891
+ var init_validate = __esm(() => {
427892
+ init_regex();
427893
+ validate_default2 = validate2;
427894
+ });
427895
+
427896
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
427897
+ function unsafeStringify2(arr, offset2 = 0) {
427898
+ return (byteToHex2[arr[offset2 + 0]] + byteToHex2[arr[offset2 + 1]] + byteToHex2[arr[offset2 + 2]] + byteToHex2[arr[offset2 + 3]] + "-" + byteToHex2[arr[offset2 + 4]] + byteToHex2[arr[offset2 + 5]] + "-" + byteToHex2[arr[offset2 + 6]] + byteToHex2[arr[offset2 + 7]] + "-" + byteToHex2[arr[offset2 + 8]] + byteToHex2[arr[offset2 + 9]] + "-" + byteToHex2[arr[offset2 + 10]] + byteToHex2[arr[offset2 + 11]] + byteToHex2[arr[offset2 + 12]] + byteToHex2[arr[offset2 + 13]] + byteToHex2[arr[offset2 + 14]] + byteToHex2[arr[offset2 + 15]]).toLowerCase();
427899
+ }
427900
+ var byteToHex2;
427901
+ var init_stringify = __esm(() => {
427902
+ byteToHex2 = [];
427903
+ for (let i3 = 0;i3 < 256; ++i3) {
427904
+ byteToHex2.push((i3 + 256).toString(16).slice(1));
427905
+ }
427906
+ });
427907
+
427908
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
427909
+ function v42(options, buf, offset2) {
427910
+ if (native_default2.randomUUID && !buf && !options) {
427911
+ return native_default2.randomUUID();
427912
+ }
427913
+ options = options || {};
427914
+ const rnds = options.random ?? options.rng?.() ?? rng2();
427915
+ if (rnds.length < 16) {
427916
+ throw new Error("Random bytes length must be >= 16");
427917
+ }
427918
+ rnds[6] = rnds[6] & 15 | 64;
427919
+ rnds[8] = rnds[8] & 63 | 128;
427920
+ if (buf) {
427921
+ offset2 = offset2 || 0;
427922
+ if (offset2 < 0 || offset2 + 16 > buf.length) {
427923
+ throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427924
+ }
427925
+ for (let i3 = 0;i3 < 16; ++i3) {
427926
+ buf[offset2 + i3] = rnds[i3];
427927
+ }
427928
+ return buf;
427929
+ }
427930
+ return unsafeStringify2(rnds);
427931
+ }
427932
+ var v4_default2;
427933
+ var init_v42 = __esm(() => {
427934
+ init_native();
427935
+ init_rng();
427936
+ init_stringify();
427937
+ v4_default2 = v42;
427938
+ });
427939
+
427940
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/sha1.js
427941
+ import { createHash } from "crypto";
427942
+ function sha12(bytes) {
427943
+ if (Array.isArray(bytes)) {
427944
+ bytes = Buffer.from(bytes);
427945
+ } else if (typeof bytes === "string") {
427946
+ bytes = Buffer.from(bytes, "utf8");
427947
+ }
427948
+ return createHash("sha1").update(bytes).digest();
427949
+ }
427950
+ var sha1_default2;
427951
+ var init_sha1 = __esm(() => {
427952
+ sha1_default2 = sha12;
427953
+ });
427954
+
427955
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/parse.js
427956
+ function parse9(uuid3) {
427957
+ if (!validate_default2(uuid3)) {
427958
+ throw TypeError("Invalid UUID");
427959
+ }
427960
+ let v;
427961
+ return Uint8Array.of((v = parseInt(uuid3.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid3.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
427962
+ }
427963
+ var parse_default2;
427964
+ var init_parse4 = __esm(() => {
427965
+ init_validate();
427966
+ parse_default2 = parse9;
427967
+ });
427968
+
427969
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v35.js
427970
+ function stringToBytes2(str) {
427971
+ str = unescape(encodeURIComponent(str));
427972
+ const bytes = new Uint8Array(str.length);
427973
+ for (let i3 = 0;i3 < str.length; ++i3) {
427974
+ bytes[i3] = str.charCodeAt(i3);
427975
+ }
427976
+ return bytes;
427977
+ }
427978
+ function v352(version3, hash5, value, namespace, buf, offset2) {
427979
+ const valueBytes = typeof value === "string" ? stringToBytes2(value) : value;
427980
+ const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
427981
+ if (typeof namespace === "string") {
427982
+ namespace = parse_default2(namespace);
427983
+ }
427984
+ if (namespace?.length !== 16) {
427985
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
427986
+ }
427987
+ let bytes = new Uint8Array(16 + valueBytes.length);
427988
+ bytes.set(namespaceBytes);
427989
+ bytes.set(valueBytes, namespaceBytes.length);
427990
+ bytes = hash5(bytes);
427991
+ bytes[6] = bytes[6] & 15 | version3;
427992
+ bytes[8] = bytes[8] & 63 | 128;
427993
+ if (buf) {
427994
+ offset2 = offset2 || 0;
427995
+ if (offset2 < 0 || offset2 + 16 > buf.length) {
427996
+ throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
427997
+ }
427998
+ for (let i3 = 0;i3 < 16; ++i3) {
427999
+ buf[offset2 + i3] = bytes[i3];
428000
+ }
428001
+ return buf;
428002
+ }
428003
+ return unsafeStringify2(bytes);
428004
+ }
428005
+ var DNS2 = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL3 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
428006
+ var init_v35 = __esm(() => {
428007
+ init_parse4();
428008
+ init_stringify();
428009
+ });
428010
+
428011
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v5.js
428012
+ function v52(value, namespace, buf, offset2) {
428013
+ return v352(80, sha1_default2, value, namespace, buf, offset2);
428014
+ }
428015
+ var v5_default2;
428016
+ var init_v5 = __esm(() => {
428017
+ init_sha1();
428018
+ init_v35();
428019
+ v52.DNS = DNS2;
428020
+ v52.URL = URL3;
428021
+ v5_default2 = v52;
428022
+ });
428023
+
428024
+ // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js
428025
+ var init_esm2 = __esm(() => {
428026
+ init_v42();
428027
+ init_v5();
428028
+ });
427332
428029
  // ../../packages/super-editor/src/editors/v1/core/helpers/getExtensionConfigField.ts
427333
428030
  function getExtensionConfigField2(extension2, field, context = { name: "" }) {
427334
428031
  const fieldValue = extension2.config[field];
@@ -428405,178 +429102,6 @@ var init_dist11 = __esm(() => {
428405
429102
  columnResizingPluginKey2 = new PluginKey2("tableColumnResizing");
428406
429103
  });
428407
429104
 
428408
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/native.js
428409
- import { randomUUID } from "crypto";
428410
- var native_default2;
428411
- var init_native = __esm(() => {
428412
- native_default2 = { randomUUID };
428413
- });
428414
-
428415
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/rng.js
428416
- import { randomFillSync } from "crypto";
428417
- function rng2() {
428418
- if (poolPtr > rnds8Pool.length - 16) {
428419
- randomFillSync(rnds8Pool);
428420
- poolPtr = 0;
428421
- }
428422
- return rnds8Pool.slice(poolPtr, poolPtr += 16);
428423
- }
428424
- var rnds8Pool, poolPtr;
428425
- var init_rng = __esm(() => {
428426
- rnds8Pool = new Uint8Array(256);
428427
- poolPtr = rnds8Pool.length;
428428
- });
428429
-
428430
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/regex.js
428431
- var regex_default2;
428432
- var init_regex = __esm(() => {
428433
- regex_default2 = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
428434
- });
428435
-
428436
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/validate.js
428437
- function validate2(uuid3) {
428438
- return typeof uuid3 === "string" && regex_default2.test(uuid3);
428439
- }
428440
- var validate_default2;
428441
- var init_validate = __esm(() => {
428442
- init_regex();
428443
- validate_default2 = validate2;
428444
- });
428445
-
428446
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/stringify.js
428447
- function unsafeStringify2(arr, offset2 = 0) {
428448
- return (byteToHex2[arr[offset2 + 0]] + byteToHex2[arr[offset2 + 1]] + byteToHex2[arr[offset2 + 2]] + byteToHex2[arr[offset2 + 3]] + "-" + byteToHex2[arr[offset2 + 4]] + byteToHex2[arr[offset2 + 5]] + "-" + byteToHex2[arr[offset2 + 6]] + byteToHex2[arr[offset2 + 7]] + "-" + byteToHex2[arr[offset2 + 8]] + byteToHex2[arr[offset2 + 9]] + "-" + byteToHex2[arr[offset2 + 10]] + byteToHex2[arr[offset2 + 11]] + byteToHex2[arr[offset2 + 12]] + byteToHex2[arr[offset2 + 13]] + byteToHex2[arr[offset2 + 14]] + byteToHex2[arr[offset2 + 15]]).toLowerCase();
428449
- }
428450
- var byteToHex2;
428451
- var init_stringify = __esm(() => {
428452
- byteToHex2 = [];
428453
- for (let i4 = 0;i4 < 256; ++i4) {
428454
- byteToHex2.push((i4 + 256).toString(16).slice(1));
428455
- }
428456
- });
428457
-
428458
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v4.js
428459
- function v42(options, buf, offset2) {
428460
- if (native_default2.randomUUID && !buf && !options) {
428461
- return native_default2.randomUUID();
428462
- }
428463
- options = options || {};
428464
- const rnds = options.random ?? options.rng?.() ?? rng2();
428465
- if (rnds.length < 16) {
428466
- throw new Error("Random bytes length must be >= 16");
428467
- }
428468
- rnds[6] = rnds[6] & 15 | 64;
428469
- rnds[8] = rnds[8] & 63 | 128;
428470
- if (buf) {
428471
- offset2 = offset2 || 0;
428472
- if (offset2 < 0 || offset2 + 16 > buf.length) {
428473
- throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
428474
- }
428475
- for (let i4 = 0;i4 < 16; ++i4) {
428476
- buf[offset2 + i4] = rnds[i4];
428477
- }
428478
- return buf;
428479
- }
428480
- return unsafeStringify2(rnds);
428481
- }
428482
- var v4_default2;
428483
- var init_v42 = __esm(() => {
428484
- init_native();
428485
- init_rng();
428486
- init_stringify();
428487
- v4_default2 = v42;
428488
- });
428489
-
428490
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/sha1.js
428491
- import { createHash } from "crypto";
428492
- function sha12(bytes) {
428493
- if (Array.isArray(bytes)) {
428494
- bytes = Buffer.from(bytes);
428495
- } else if (typeof bytes === "string") {
428496
- bytes = Buffer.from(bytes, "utf8");
428497
- }
428498
- return createHash("sha1").update(bytes).digest();
428499
- }
428500
- var sha1_default2;
428501
- var init_sha1 = __esm(() => {
428502
- sha1_default2 = sha12;
428503
- });
428504
-
428505
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/parse.js
428506
- function parse9(uuid3) {
428507
- if (!validate_default2(uuid3)) {
428508
- throw TypeError("Invalid UUID");
428509
- }
428510
- let v;
428511
- return Uint8Array.of((v = parseInt(uuid3.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid3.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid3.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
428512
- }
428513
- var parse_default2;
428514
- var init_parse4 = __esm(() => {
428515
- init_validate();
428516
- parse_default2 = parse9;
428517
- });
428518
-
428519
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v35.js
428520
- function stringToBytes2(str) {
428521
- str = unescape(encodeURIComponent(str));
428522
- const bytes = new Uint8Array(str.length);
428523
- for (let i4 = 0;i4 < str.length; ++i4) {
428524
- bytes[i4] = str.charCodeAt(i4);
428525
- }
428526
- return bytes;
428527
- }
428528
- function v352(version3, hash5, value, namespace, buf, offset2) {
428529
- const valueBytes = typeof value === "string" ? stringToBytes2(value) : value;
428530
- const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
428531
- if (typeof namespace === "string") {
428532
- namespace = parse_default2(namespace);
428533
- }
428534
- if (namespace?.length !== 16) {
428535
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
428536
- }
428537
- let bytes = new Uint8Array(16 + valueBytes.length);
428538
- bytes.set(namespaceBytes);
428539
- bytes.set(valueBytes, namespaceBytes.length);
428540
- bytes = hash5(bytes);
428541
- bytes[6] = bytes[6] & 15 | version3;
428542
- bytes[8] = bytes[8] & 63 | 128;
428543
- if (buf) {
428544
- offset2 = offset2 || 0;
428545
- if (offset2 < 0 || offset2 + 16 > buf.length) {
428546
- throw new RangeError(`UUID byte range ${offset2}:${offset2 + 15} is out of buffer bounds`);
428547
- }
428548
- for (let i4 = 0;i4 < 16; ++i4) {
428549
- buf[offset2 + i4] = bytes[i4];
428550
- }
428551
- return buf;
428552
- }
428553
- return unsafeStringify2(bytes);
428554
- }
428555
- var DNS2 = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL3 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
428556
- var init_v35 = __esm(() => {
428557
- init_parse4();
428558
- init_stringify();
428559
- });
428560
-
428561
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/v5.js
428562
- function v52(value, namespace, buf, offset2) {
428563
- return v352(80, sha1_default2, value, namespace, buf, offset2);
428564
- }
428565
- var v5_default2;
428566
- var init_v5 = __esm(() => {
428567
- init_sha1();
428568
- init_v35();
428569
- v52.DNS = DNS2;
428570
- v52.URL = URL3;
428571
- v5_default2 = v52;
428572
- });
428573
-
428574
- // ../../node_modules/.pnpm/uuid@11.1.1/node_modules/uuid/dist/esm/index.js
428575
- var init_esm2 = __esm(() => {
428576
- init_v42();
428577
- init_v5();
428578
- });
428579
-
428580
429105
  // ../../packages/super-editor/src/editors/v1/core/super-converter/exporter-docx-defs.js
428581
429106
  var DEFAULT_DOCX_DEFS2, DEFAULT_CUSTOM_XML2, COMMENT_REF2, DEFAULT_LINKED_STYLES2, COMMENTS_XML_DEF2, FOOTNOTES_XML_DEF2, COMMENTS_EXTENDED_XML_DEF, COMMENTS_EXTENSIBLE_XML_DEF, COMMENTS_IDS_XML_DEF, DOCUMENT_RELS_XML_DEF, PEOPLE_XML_DEF, COMMENTS_XML_DEFINITIONS2;
428582
429107
  var init_exporter_docx_defs = __esm(() => {
@@ -431541,6 +432066,9 @@ function generateParagraphProperties2(params3) {
431541
432066
  const { node: node4 } = params3;
431542
432067
  const { attrs = {} } = node4;
431543
432068
  const paragraphProperties = carbonCopy2(attrs.paragraphProperties || {});
432069
+ if (params3?.isFinalDoc && paragraphProperties.change) {
432070
+ delete paragraphProperties.change;
432071
+ }
431544
432072
  const inlineKeys = paragraphProperties.runPropertiesInlineKeys;
431545
432073
  delete paragraphProperties.runPropertiesInlineKeys;
431546
432074
  if (Array.isArray(inlineKeys) && inlineKeys.length === 0) {
@@ -431558,7 +432086,11 @@ function generateParagraphProperties2(params3) {
431558
432086
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
431559
432087
  partPath: resolveExportPartPath2(params3)
431560
432088
  } : null;
431561
- let pPr = translator108.decode({ node: { ...node4, attrs: { paragraphProperties } } });
432089
+ let pPr = translator108.decode({
432090
+ node: { ...node4, attrs: { paragraphProperties } },
432091
+ converter: params3?.converter,
432092
+ currentPartPath: resolveExportPartPath2(params3)
432093
+ });
431562
432094
  if (!params3?.isFinalDoc && paragraphSplitTrackFormatMark) {
431563
432095
  const insertionElement = createParagraphSplitInsertionElement2(paragraphSplitTrackFormatMark, paragraphSplitWordIdOptions);
431564
432096
  if (insertionElement) {
@@ -467541,6 +468073,38 @@ function upsertSimpleElement2(elements, tagName, value) {
467541
468073
  }
467542
468074
  var APP_XML_PATH2 = "docProps/app.xml", EP_NAMESPACE2 = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
467543
468075
 
468076
+ // ../../packages/super-editor/src/editors/v1/extensions/track-changes/trackChangesHelpers/pprChanges.js
468077
+ var enumeratePprChanges2 = (state) => {
468078
+ const doc6 = state?.doc;
468079
+ if (!doc6)
468080
+ return [];
468081
+ const out = [];
468082
+ try {
468083
+ doc6.descendants((node4, pos) => {
468084
+ if (node4.isText)
468085
+ return false;
468086
+ const change = node4?.attrs?.paragraphProperties?.change;
468087
+ if (change && typeof change.id === "string" && change.id && change.paragraphProperties) {
468088
+ out.push({
468089
+ id: change.id,
468090
+ from: pos,
468091
+ to: pos + node4.nodeSize,
468092
+ author: change.author || "",
468093
+ authorEmail: change.authorEmail || "",
468094
+ authorImage: change.authorImage || "",
468095
+ date: change.date || "",
468096
+ formerProperties: change.paragraphProperties || {},
468097
+ subtype: "paragraph-format"
468098
+ });
468099
+ }
468100
+ return;
468101
+ });
468102
+ } catch {
468103
+ return out;
468104
+ }
468105
+ return out;
468106
+ };
468107
+
467544
468108
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/tracked-change-type-utils.ts
467545
468109
  function projectInternalTrackChangeType2(type, structural) {
467546
468110
  if (type !== "structural")
@@ -467863,6 +468427,28 @@ function groupTrackedChanges2(editor) {
467863
468427
  wordRevisionIds: structural.sourceId ? structural.side === "insertion" ? { insert: structural.sourceId } : { delete: structural.sourceId } : undefined
467864
468428
  });
467865
468429
  }
468430
+ const pprChanges = enumeratePprChanges2(editor.state);
468431
+ for (const ppr of pprChanges) {
468432
+ const excerpt = normalizeExcerpt2(editor.state.doc.textBetween(ppr.from, ppr.to, " ", ""));
468433
+ grouped.push({
468434
+ rawId: ppr.id,
468435
+ commandRawId: ppr.id,
468436
+ id: ppr.id,
468437
+ from: ppr.from,
468438
+ to: ppr.to,
468439
+ hasInsert: false,
468440
+ hasDelete: false,
468441
+ hasFormat: true,
468442
+ attrs: {
468443
+ id: ppr.id,
468444
+ author: ppr.author || undefined,
468445
+ authorEmail: ppr.authorEmail || undefined,
468446
+ authorImage: ppr.authorImage || undefined,
468447
+ date: ppr.date || undefined
468448
+ },
468449
+ excerpt
468450
+ });
468451
+ }
467866
468452
  grouped.sort((a2, b2) => {
467867
468453
  if (a2.from !== b2.from)
467868
468454
  return a2.from - b2.from;
@@ -468003,10 +468589,38 @@ var init_content_controls2 = __esm(() => {
468003
468589
  init_sdt_properties_write();
468004
468590
  });
468005
468591
 
468592
+ // ../../packages/super-editor/src/editors/v1/extensions/paragraph/resolvedPropertiesCache.js
468593
+ function getResolvedParagraphProperties2(node4) {
468594
+ return resolvedParagraphPropertiesCache2.get(node4);
468595
+ }
468596
+ function calculateResolvedParagraphProperties2(editor, node4, $pos) {
468597
+ if (!editor.converter) {
468598
+ return node4.attrs.paragraphProperties || {};
468599
+ }
468600
+ const cached2 = getResolvedParagraphProperties2(node4);
468601
+ if (cached2) {
468602
+ return cached2;
468603
+ }
468604
+ const tableNode = findParentNodeClosestToPos2($pos, (node5) => node5.type.name === "table");
468605
+ const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
468606
+ const paragraphProperties = resolveParagraphProperties2({
468607
+ translatedNumbering: editor.converter.translatedNumbering,
468608
+ translatedLinkedStyles: editor.converter.translatedLinkedStyles
468609
+ }, node4.attrs.paragraphProperties || {}, tableStyleId);
468610
+ resolvedParagraphPropertiesCache2.set(node4, paragraphProperties);
468611
+ return paragraphProperties;
468612
+ }
468613
+ var resolvedParagraphPropertiesCache2;
468614
+ var init_resolvedPropertiesCache = __esm(() => {
468615
+ init_ooxml();
468616
+ init_helpers5();
468617
+ resolvedParagraphPropertiesCache2 = new WeakMap;
468618
+ });
468619
+
468006
468620
  // ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/list-sequence-helpers.ts
468007
468621
  function resolveBlock2(editor, nodeId) {
468008
468622
  const index3 = getBlockIndex2(editor);
468009
- const matches3 = index3.candidates.filter((c) => c.nodeId === nodeId && (c.nodeType === "paragraph" || c.nodeType === "listItem"));
468623
+ const matches3 = index3.candidates.filter((c) => c.nodeId === nodeId && (c.nodeType === "paragraph" || c.nodeType === "listItem" || c.nodeType === "heading"));
468010
468624
  if (matches3.length === 0) {
468011
468625
  throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "Block target was not found.", { nodeId });
468012
468626
  }
@@ -468028,7 +468642,7 @@ function resolveBlocksInRange2(editor, fromId, toId3) {
468028
468642
  });
468029
468643
  }
468030
468644
  const index3 = getBlockIndex2(editor);
468031
- return index3.candidates.filter((c) => (c.nodeType === "paragraph" || c.nodeType === "listItem") && c.pos >= from4.pos && c.pos <= to.pos);
468645
+ return index3.candidates.filter((c) => (c.nodeType === "paragraph" || c.nodeType === "listItem" || c.nodeType === "heading") && c.pos >= from4.pos && c.pos <= to.pos);
468032
468646
  }
468033
468647
  function getAbstractNumId2(editor, numId) {
468034
468648
  const converter = editor;
@@ -468256,7 +468870,17 @@ function getListText2(candidate) {
468256
468870
  }
468257
468871
  function projectListItemCandidate2(editor, candidate) {
468258
468872
  const attrs = candidate.node.attrs ?? {};
468259
- const { numId, level } = getNumberingProperties3(candidate.node);
468873
+ let { numId, level } = getNumberingProperties3(candidate.node);
468874
+ if (numId == null) {
468875
+ try {
468876
+ const resolved = calculateResolvedParagraphProperties2(editor, candidate.node, editor.state.doc.resolve(candidate.pos));
468877
+ const effective = resolved?.numberingProperties;
468878
+ if (effective) {
468879
+ numId = toFiniteNumber2(effective.numId);
468880
+ level = toFiniteNumber2(effective.ilvl) ?? level ?? 0;
468881
+ }
468882
+ } catch {}
468883
+ }
468260
468884
  const listRendering = getListRendering2(attrs.listRendering);
468261
468885
  const path3 = listRendering?.path;
468262
468886
  const ordinal = getListOrdinalFromPath2(path3);
@@ -468364,9 +468988,19 @@ function listListItems2(editor, query2) {
468364
468988
  page: { limit: query2?.limit ?? total, offset: safeOffset, returned: items.length }
468365
468989
  });
468366
468990
  }
468991
+ function hasNumberingMetadata2(candidate) {
468992
+ const { numId } = getNumberingProperties3(candidate.node);
468993
+ if (numId != null)
468994
+ return true;
468995
+ const attrs = candidate.node.attrs ?? {};
468996
+ return getListRendering2(attrs.listRendering) != null;
468997
+ }
468367
468998
  function resolveListItem2(editor, address2) {
468368
468999
  const index3 = getBlockIndex2(editor);
468369
- const matches3 = index3.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
469000
+ let matches3 = index3.candidates.filter((candidate) => candidate.nodeType === "listItem" && candidate.nodeId === address2.nodeId);
469001
+ if (matches3.length === 0) {
469002
+ matches3 = index3.candidates.filter((candidate) => candidate.nodeId === address2.nodeId && hasNumberingMetadata2(candidate));
469003
+ }
468370
469004
  if (matches3.length === 0) {
468371
469005
  throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", "List item target was not found.", {
468372
469006
  target: address2
@@ -468382,6 +469016,7 @@ function resolveListItem2(editor, address2) {
468382
469016
  }
468383
469017
  var init_list_item_resolver = __esm(() => {
468384
469018
  init_list_numbering_helpers();
469019
+ init_resolvedPropertiesCache();
468385
469020
  init_dist2();
468386
469021
  init_errors4();
468387
469022
  init_revision_tracker();
@@ -469917,7 +470552,15 @@ var init_SuperConverter = __esm(() => {
469917
470552
  }
469918
470553
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = [], editor, exportJsonOnly = false, fieldsHighlightColor, preserveSdtWrappers = false) {
469919
470554
  this.exportWarnings = [];
469920
- const exportableComments = comments.filter((c) => !c.trackedChange);
470555
+ const isSyntheticTrackedChangeRow = (c) => {
470556
+ const linkId = c.trackedChangeLink?.trackedChangeId;
470557
+ if (!c.trackedChange || !linkId)
470558
+ return false;
470559
+ const identity2 = c.commentId ?? c.id;
470560
+ return identity2 != null && String(identity2) === String(linkId);
470561
+ };
470562
+ const hasCommentBody = (c) => Boolean(typeof c.commentText === "string" && c.commentText.length > 0 || c.commentJSON || Array.isArray(c.elements) && c.elements.length || typeof c.text === "string" && c.text.length > 0);
470563
+ const exportableComments = comments.filter((c) => !isSyntheticTrackedChangeRow(c) && !(c.trackedChange && !hasCommentBody(c)));
469921
470564
  const commentsWithParaIds = exportableComments.map((c) => prepareCommentParaIds2(c));
469922
470565
  const commentDefinitions = commentsWithParaIds.map((c, index3) => getCommentDefinition2(c, index3, commentsWithParaIds, editor));
469923
470566
  let statFieldCacheMap;
@@ -470680,34 +471323,6 @@ var init_styles3 = __esm(() => {
470680
471323
  init_ooxml();
470681
471324
  });
470682
471325
 
470683
- // ../../packages/super-editor/src/editors/v1/extensions/paragraph/resolvedPropertiesCache.js
470684
- function getResolvedParagraphProperties2(node4) {
470685
- return resolvedParagraphPropertiesCache2.get(node4);
470686
- }
470687
- function calculateResolvedParagraphProperties2(editor, node4, $pos) {
470688
- if (!editor.converter) {
470689
- return node4.attrs.paragraphProperties || {};
470690
- }
470691
- const cached2 = getResolvedParagraphProperties2(node4);
470692
- if (cached2) {
470693
- return cached2;
470694
- }
470695
- const tableNode = findParentNodeClosestToPos2($pos, (node5) => node5.type.name === "table");
470696
- const tableStyleId = tableNode?.node.attrs.tableStyleId || null;
470697
- const paragraphProperties = resolveParagraphProperties2({
470698
- translatedNumbering: editor.converter.translatedNumbering,
470699
- translatedLinkedStyles: editor.converter.translatedLinkedStyles
470700
- }, node4.attrs.paragraphProperties || {}, tableStyleId);
470701
- resolvedParagraphPropertiesCache2.set(node4, paragraphProperties);
470702
- return paragraphProperties;
470703
- }
470704
- var resolvedParagraphPropertiesCache2;
470705
- var init_resolvedPropertiesCache = __esm(() => {
470706
- init_ooxml();
470707
- init_helpers5();
470708
- resolvedParagraphPropertiesCache2 = new WeakMap;
470709
- });
470710
-
470711
471326
  // ../../packages/super-editor/src/editors/v1/extensions/run/calculateInlineRunPropertiesPlugin.js
470712
471327
  function extractTableInfo2($pos, depth) {
470713
471328
  const rowNode = $pos.node(depth - 1);
@@ -474270,11 +474885,24 @@ var init_list_helpers2 = __esm(() => {
474270
474885
  });
474271
474886
 
474272
474887
  // ../../packages/super-editor/src/editors/v1/core/commands/changeListLevel.js
474273
- function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos, editor, tr) {
474888
+ function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos, editor, tr, options = {}) {
474889
+ const formerProperties = { ...paragraphNode.attrs.paragraphProperties || {} };
474274
474890
  const newProperties = {
474275
- ...paragraphNode.attrs.paragraphProperties || {},
474891
+ ...formerProperties,
474276
474892
  numberingProperties: newNumberingProperties ? { ...newNumberingProperties } : null
474277
474893
  };
474894
+ if (options.trackChange && newNumberingProperties && !formerProperties.change) {
474895
+ const former = { ...formerProperties };
474896
+ delete former.change;
474897
+ const user = editor?.options?.user || {};
474898
+ newProperties.change = {
474899
+ id: v4_default2(),
474900
+ author: user.name || "",
474901
+ authorEmail: user.email || "",
474902
+ date: new Date().toISOString(),
474903
+ paragraphProperties: former
474904
+ };
474905
+ }
474278
474906
  if (!newNumberingProperties && paragraphNode.attrs.paragraphProperties?.styleId === "ListParagraph") {
474279
474907
  newProperties.styleId = null;
474280
474908
  }
@@ -474292,6 +474920,7 @@ function updateNumberingProperties2(newNumberingProperties, paragraphNode, pos,
474292
474920
  tr.setNodeMarkup(pos, null, newAttrs);
474293
474921
  }
474294
474922
  var init_changeListLevel = __esm(() => {
474923
+ init_esm2();
474295
474924
  init_helpers5();
474296
474925
  init_list_helpers2();
474297
474926
  init_list_numbering_helpers();
@@ -478564,7 +479193,25 @@ function executeTextDelete2(_editor, tr, target, _step, mapping) {
478564
479193
  tr.delete(absFrom, absTo);
478565
479194
  return { changed: true };
478566
479195
  }
478567
- function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment) {
479196
+ function withTrackedParagraphPropertyChange2(editor, existing, nextParagraphProperties, changeMode) {
479197
+ if (changeMode !== "tracked")
479198
+ return nextParagraphProperties;
479199
+ if (existing?.change)
479200
+ return nextParagraphProperties;
479201
+ const { change: _existingChange, ...formerProperties } = existing ?? {};
479202
+ const user = editor?.options?.user ?? {};
479203
+ return {
479204
+ ...nextParagraphProperties,
479205
+ change: {
479206
+ id: v4_default2(),
479207
+ author: user.name || "",
479208
+ authorEmail: user.email || "",
479209
+ date: new Date().toISOString(),
479210
+ paragraphProperties: formerProperties
479211
+ }
479212
+ };
479213
+ }
479214
+ function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment, changeMode) {
478568
479215
  if (!alignment)
478569
479216
  return false;
478570
479217
  let changed = false;
@@ -478579,7 +479226,7 @@ function applyAlignmentToRange2(editor, tr, absFrom, absTo, alignment) {
478579
479226
  const currentJustification = existing?.justification;
478580
479227
  if (currentJustification === justification)
478581
479228
  return;
478582
- const updated = { ...existing ?? {}, justification };
479229
+ const updated = withTrackedParagraphPropertyChange2(editor, existing, { ...existing ?? {}, justification }, changeMode);
478583
479230
  tr.setNodeMarkup(pos, undefined, { ...node4.attrs, paragraphProperties: updated });
478584
479231
  changed = true;
478585
479232
  });
@@ -478598,7 +479245,7 @@ function expandToBlockBoundaries2(doc6, from4, to) {
478598
479245
  });
478599
479246
  return { from: expandedFrom, to: expandedTo };
478600
479247
  }
478601
- function executeStyleApply4(editor, tr, target, step3, mapping) {
479248
+ function executeStyleApply4(editor, tr, target, step3, mapping, changeMode) {
478602
479249
  let absFrom = mapping.map(target.absFrom);
478603
479250
  let absTo = mapping.map(target.absTo);
478604
479251
  if (step3.args.scope === "block") {
@@ -478611,7 +479258,7 @@ function executeStyleApply4(editor, tr, target, step3, mapping) {
478611
479258
  changed = applyInlinePatchToRange2(editor, tr, absFrom, absTo, step3.args.inline) || changed;
478612
479259
  }
478613
479260
  if (step3.args.alignment) {
478614
- changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment) || changed;
479261
+ changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment, changeMode) || changed;
478615
479262
  }
478616
479263
  return { changed };
478617
479264
  }
@@ -478690,7 +479337,7 @@ function executeSpanTextDelete2(_editor, tr, target, step3, mapping) {
478690
479337
  tr.delete(absFrom, absTo);
478691
479338
  return { changed: true };
478692
479339
  }
478693
- function executeSpanStyleApply2(editor, tr, target, step3, mapping) {
479340
+ function executeSpanStyleApply2(editor, tr, target, step3, mapping, changeMode) {
478694
479341
  validateMappedSpanContiguity2(target, mapping, step3.id);
478695
479342
  const firstSeg = target.segments[0];
478696
479343
  const lastSeg = target.segments[target.segments.length - 1];
@@ -478706,7 +479353,7 @@ function executeSpanStyleApply2(editor, tr, target, step3, mapping) {
478706
479353
  changed = applyInlinePatchToRange2(editor, tr, absFrom, absTo, step3.args.inline) || changed;
478707
479354
  }
478708
479355
  if (step3.args.alignment) {
478709
- changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment) || changed;
479356
+ changed = applyAlignmentToRange2(editor, tr, absFrom, absTo, step3.args.alignment, changeMode) || changed;
478710
479357
  }
478711
479358
  return { changed };
478712
479359
  }
@@ -479368,6 +480015,7 @@ var init_executor = __esm(() => {
479368
480015
  init_replacement_normalizer();
479369
480016
  init_word_diff();
479370
480017
  init_resolvedPropertiesCache();
480018
+ init_esm2();
479371
480019
  init_dist3();
479372
480020
  init_text_with_tabs();
479373
480021
  init_safe_regex();
@@ -482857,7 +483505,7 @@ function trackChangesGetWrapper2(editor, input2) {
482857
483505
  imported: Boolean(toNonEmptyString2(resolved.change.attrs.sourceId))
482858
483506
  };
482859
483507
  }
482860
- function decideSingle2(hostEditor, decision, id2, story, options) {
483508
+ function decideSingle2(hostEditor, decision, id2, story, options, side) {
482861
483509
  const resolved = resolveTrackedChangeInStory2(hostEditor, {
482862
483510
  kind: "entity",
482863
483511
  entityType: "trackedChange",
@@ -482874,7 +483522,7 @@ function decideSingle2(hostEditor, decision, id2, story, options) {
482874
483522
  }
482875
483523
  checkRevision2(hostEditor, options?.expectedRevision);
482876
483524
  const commandRawId = resolved.change.commandRawId ?? resolved.change.rawId;
482877
- const receipt2 = executeDomainCommand2(resolved.editor, () => Boolean(command2(commandRawId)));
483525
+ const receipt2 = executeDomainCommand2(resolved.editor, () => Boolean(command2(commandRawId, side ? { side } : undefined)));
482878
483526
  if (receipt2.steps[0]?.effect !== "changed") {
482879
483527
  return decisionFailureReceipt2(resolved.editor, `${decision === "accept" ? "Accept" : "Reject"} tracked change "${id2}" produced no change.`, {
482880
483528
  id: id2,
@@ -482889,10 +483537,10 @@ function decideSingle2(hostEditor, decision, id2, story, options) {
482889
483537
  return { success: true };
482890
483538
  }
482891
483539
  function trackChangesAcceptWrapper2(editor, input2, options) {
482892
- return decideSingle2(editor, "accept", input2.id, input2.story, options);
483540
+ return decideSingle2(editor, "accept", input2.id, input2.story, options, input2.side);
482893
483541
  }
482894
483542
  function trackChangesRejectWrapper2(editor, input2, options) {
482895
- return decideSingle2(editor, "reject", input2.id, input2.story, options);
483543
+ return decideSingle2(editor, "reject", input2.id, input2.story, options, input2.side);
482896
483544
  }
482897
483545
  function decideAll2(editor, decision, input2, options) {
482898
483546
  const index3 = getTrackedChangeIndex2(editor);
@@ -483972,6 +484620,7 @@ function replyToCommentHandler2(editor, input2, options) {
483972
484620
  if (trackedPayload && inheritedTrackedFields) {
483973
484621
  emitCommentLifecycleUpdate2(editor, "update", trackedPayload);
483974
484622
  }
484623
+ incrementRevision2(editor);
483975
484624
  return { success: true, id: replyId, inserted: [toCommentAddress2(replyId)] };
483976
484625
  }
483977
484626
  function moveCommentHandler2(editor, input2, options) {
@@ -492057,6 +492706,8 @@ function extractBlockNumbering2(node4) {
492057
492706
  function extractBlockFormatting2(node4, styleCtx) {
492058
492707
  const pProps = node4.attrs.paragraphProperties;
492059
492708
  const styleId3 = pProps?.styleId ?? null;
492709
+ const rawIndent = pProps?.indent;
492710
+ const indent3 = rawIndent && typeof rawIndent === "object" ? Object.fromEntries(["left", "right", "firstLine", "hanging"].filter((k2) => typeof rawIndent[k2] === "number" && rawIndent[k2] !== 0).map((k2) => [k2, rawIndent[k2]])) : undefined;
492060
492711
  let fontFamily;
492061
492712
  let fontSize;
492062
492713
  let bold;
@@ -492105,6 +492756,7 @@ function extractBlockFormatting2(node4, styleCtx) {
492105
492756
  ...underline ? { underline } : {},
492106
492757
  ...color3 ? { color: color3 } : {},
492107
492758
  ...pProps?.justification ? { alignment: pProps.justification } : {},
492759
+ ...indent3 && Object.keys(indent3).length > 0 ? { indent: indent3 } : {},
492108
492760
  ...headingLevel ? { headingLevel } : {}
492109
492761
  };
492110
492762
  }
@@ -492185,6 +492837,7 @@ function blocksListWrapper2(editor, input2) {
492185
492837
  segments: [{ blockId: candidate.nodeId, start: 0, end: textLength }],
492186
492838
  blockIndex: offset2 + i4
492187
492839
  }) : undefined;
492840
+ const listRendering = candidate.node.attrs?.listRendering;
492188
492841
  return {
492189
492842
  ordinal: offset2 + i4,
492190
492843
  nodeId: candidate.nodeId,
@@ -492193,6 +492846,13 @@ function blocksListWrapper2(editor, input2) {
492193
492846
  ...fullText !== undefined ? { text: fullText } : {},
492194
492847
  isEmpty: textLength === 0,
492195
492848
  ...extractBlockFormatting2(candidate.node, styleCtx),
492849
+ ...listRendering ? {
492850
+ numbering: {
492851
+ marker: listRendering.markerText ?? null,
492852
+ path: listRendering.path ?? null,
492853
+ kind: listRendering.numberingType ?? null
492854
+ }
492855
+ } : {},
492196
492856
  ...numbering ? { paragraphNumbering: numbering } : {},
492197
492857
  ...ref3 ? { ref: ref3 } : {}
492198
492858
  };
@@ -493554,7 +494214,9 @@ function listsCreateWrapper2(editor, input2, options) {
493554
494214
  };
493555
494215
  }
493556
494216
  function listsAttachWrapper2(editor, input2, options) {
493557
- rejectTrackedMode2("lists.attach", options);
494217
+ const trackChange = (options?.changeMode ?? "direct") === "tracked";
494218
+ if (trackChange)
494219
+ ensureTrackedCapability2(editor, { operation: "lists.attach" });
493558
494220
  const attachTo = resolveListItem2(editor, input2.attachTo);
493559
494221
  if (attachTo.numId == null) {
493560
494222
  return toListsFailure2("INVALID_TARGET", "attachTo target must be a list item with numbering metadata.", {
@@ -493579,7 +494241,7 @@ function listsAttachWrapper2(editor, input2, options) {
493579
494241
  const receipt2 = executeDomainCommand2(editor, () => {
493580
494242
  const { tr } = editor.state;
493581
494243
  for (const block of targets) {
493582
- updateNumberingProperties2({ numId, ilvl: level }, block.node, block.pos, editor, tr);
494244
+ updateNumberingProperties2({ numId, ilvl: level }, block.node, block.pos, editor, tr, { trackChange });
493583
494245
  }
493584
494246
  dispatchEditorTransaction3(editor, tr);
493585
494247
  clearIndexCache2(editor);
@@ -498226,7 +498888,14 @@ function tablesSetShadingAdapter2(editor, input2, options) {
498226
498888
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
498227
498889
  currentProps.shading = { fill: normalizedColor, val: "clear", color: "auto" };
498228
498890
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs2(currentProps) : {};
498229
- tr.setNodeMarkup(resolved.pos, null, { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs });
498891
+ const nextAttrs = { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs };
498892
+ if (resolved.scope === "cell") {
498893
+ if (normalizedColor === "auto")
498894
+ delete nextAttrs.background;
498895
+ else
498896
+ nextAttrs.background = { color: normalizedColor };
498897
+ }
498898
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
498230
498899
  if (resolved.scope === "table") {
498231
498900
  applyShadingToCells2(tr, resolved.node, resolved.pos + 1, normalizedColor);
498232
498901
  }
@@ -498257,7 +498926,11 @@ function tablesClearShadingAdapter2(editor, input2, options) {
498257
498926
  const currentProps = { ...currentAttrs[propsKey] ?? {} };
498258
498927
  delete currentProps.shading;
498259
498928
  const syncAttrs = resolved.scope === "table" ? syncExtractedTableAttrs2(currentProps) : {};
498260
- tr.setNodeMarkup(resolved.pos, null, { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs });
498929
+ const nextAttrs = { ...currentAttrs, [propsKey]: currentProps, ...syncAttrs };
498930
+ if (resolved.scope === "cell") {
498931
+ delete nextAttrs.background;
498932
+ }
498933
+ tr.setNodeMarkup(resolved.pos, null, nextAttrs);
498261
498934
  if (resolved.scope === "table") {
498262
498935
  const tableNode = resolved.node;
498263
498936
  const tableStart = resolved.pos + 1;
@@ -499379,7 +500052,7 @@ function registerBuiltInExecutors2() {
499379
500052
  registerStepExecutor2("format.apply", {
499380
500053
  execute: (ctx2, targets, step3) => {
499381
500054
  ensureFormatStepCapabilities2(ctx2, step3);
499382
- return executeTextStep2(ctx2, targets, step3, (e, tr, t, s2, m2) => executeStyleApply4(e, tr, t, s2, m2), (e, tr, t, s2, m2) => executeSpanStyleApply2(e, tr, t, s2, m2));
500055
+ return executeTextStep2(ctx2, targets, step3, (e, tr, t, s2, m2) => executeStyleApply4(e, tr, t, s2, m2, ctx2.changeMode), (e, tr, t, s2, m2) => executeSpanStyleApply2(e, tr, t, s2, m2, ctx2.changeMode));
499383
500056
  }
499384
500057
  });
499385
500058
  registerStepExecutor2("create.paragraph", {
@@ -521611,6 +522284,13 @@ EXAMPLES:
521611
522284
  "destination"
521612
522285
  ],
521613
522286
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
522287
+ },
522288
+ side: {
522289
+ enum: [
522290
+ "inserted",
522291
+ "deleted"
522292
+ ],
522293
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half, leaving the other half as a standalone pending change."
521614
522294
  }
521615
522295
  },
521616
522296
  additionalProperties: false,
@@ -521809,6 +522489,13 @@ EXAMPLES:
521809
522489
  "destination"
521810
522490
  ],
521811
522491
  description: "Optional move pairing assertion. 'pair' requires the resolved tracked change to be a paired move; 'source' / 'destination' further narrow to a specific half. When the assertion does not hold the decide adapter fails closed."
522492
+ },
522493
+ side: {
522494
+ enum: [
522495
+ "inserted",
522496
+ "deleted"
522497
+ ],
522498
+ description: "Optional replacement side. When the id resolves to a paired replacement, decides only the 'inserted' or 'deleted' half."
521812
522499
  }
521813
522500
  },
521814
522501
  additionalProperties: false,