@superdoc-dev/cli 0.3.0-next.16 → 0.3.0-next.18

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 +605 -135
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -118581,7 +118581,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
118581
118581
  eol = /\r?\n|\r/g;
118582
118582
  });
118583
118583
 
118584
- // ../../packages/superdoc/dist/chunks/DocxZipper-DcuMk8AE.es.js
118584
+ // ../../packages/superdoc/dist/chunks/DocxZipper-GK7co0eu.es.js
118585
118585
  function getLens2(b64) {
118586
118586
  var len$1 = b64.length;
118587
118587
  if (len$1 % 4 > 0)
@@ -118712,13 +118712,13 @@ function partExistsInPackage(zipPath, baseFiles, updatedDocs) {
118712
118712
  }
118713
118713
  function parseXml(xmlString) {
118714
118714
  try {
118715
- return import_lib$12.xml2js(xmlString, { compact: false });
118715
+ return import_lib$2.xml2js(xmlString, { compact: false });
118716
118716
  } catch {
118717
118717
  return null;
118718
118718
  }
118719
118719
  }
118720
118720
  function serializeXml(jsObject) {
118721
- return import_lib$12.js2xml(jsObject, { spaces: 0 });
118721
+ return import_lib$2.js2xml(jsObject, { spaces: 0 });
118722
118722
  }
118723
118723
  function findRootElement(parsed, tagName) {
118724
118724
  return parsed?.elements?.find((el) => {
@@ -118742,7 +118742,7 @@ function createEmptyRels() {
118742
118742
  }]
118743
118743
  };
118744
118744
  }
118745
- function findMaxRId(relsRoot) {
118745
+ function findMaxRId$1(relsRoot) {
118746
118746
  let max = 0;
118747
118747
  for (const el of relsRoot.elements || []) {
118748
118748
  const id = el.attributes?.Id;
@@ -118824,7 +118824,7 @@ function reconcileRootRels(relsRoot, presentParts) {
118824
118824
  });
118825
118825
  }
118826
118826
  const indicesToRemove = /* @__PURE__ */ new Set;
118827
- let maxRId = findMaxRId(relsRoot);
118827
+ let maxRId = findMaxRId$1(relsRoot);
118828
118828
  for (const [relType, entry] of managedByType) {
118829
118829
  const isPresent = presentParts.has(entry.zipPath);
118830
118830
  const existing = existingRels.get(relType) || [];
@@ -118891,7 +118891,53 @@ function syncPackageMetadata({ baseFiles, updatedDocs }) {
118891
118891
  relsXml: serializeXml(relsParsed)
118892
118892
  };
118893
118893
  }
118894
- var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", buffer2, base64Js2, lookup2, revLookup2, Arr2, code5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i3, len2, ieee7542, Buffer3, isXmlLike = (name) => /\.xml$|\.rels$/i.test(name), MANAGED_PACKAGE_PARTS, import_lib$12, RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/package/2006/relationships", import_lib3, import_jszip_min, IMAGE_EXTS, MIME_TYPE_FOR_EXT, CUSTOM_XML_ITEM_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml", FONT_CONTENT_TYPES, DocxZipper = class {
118894
+ function findMaxRId(elements) {
118895
+ let max = 0;
118896
+ for (const el of elements) {
118897
+ const match = el.attributes?.Id?.match(/^rId(\d+)$/);
118898
+ if (match)
118899
+ max = Math.max(max, Number(match[1]));
118900
+ }
118901
+ return max;
118902
+ }
118903
+ function reconcileDocumentRelationships(relsXml, fileExists) {
118904
+ if (!relsXml)
118905
+ return relsXml;
118906
+ let parsed;
118907
+ try {
118908
+ parsed = import_lib$12.xml2js(relsXml, { compact: false });
118909
+ } catch {
118910
+ return relsXml;
118911
+ }
118912
+ const relsTag = parsed?.elements?.find((el) => el.name === "Relationships");
118913
+ if (!relsTag)
118914
+ return relsXml;
118915
+ if (!relsTag.elements)
118916
+ relsTag.elements = [];
118917
+ let changed = false;
118918
+ let maxId = findMaxRId(relsTag.elements);
118919
+ for (const entry of MANAGED_DOCUMENT_PARTS) {
118920
+ if (!fileExists(entry.zipPath))
118921
+ continue;
118922
+ if (relsTag.elements.some((el) => el.attributes?.Type === entry.relationshipType))
118923
+ continue;
118924
+ maxId++;
118925
+ relsTag.elements.push({
118926
+ type: "element",
118927
+ name: "Relationship",
118928
+ attributes: {
118929
+ Id: `rId${maxId}`,
118930
+ Type: entry.relationshipType,
118931
+ Target: entry.relTarget
118932
+ }
118933
+ });
118934
+ changed = true;
118935
+ }
118936
+ if (!changed)
118937
+ return relsXml;
118938
+ return import_lib$12.js2xml(parsed, { spaces: 0 });
118939
+ }
118940
+ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", buffer2, base64Js2, lookup2, revLookup2, Arr2, code5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i3, len2, ieee7542, Buffer3, isXmlLike = (name) => /\.xml$|\.rels$/i.test(name), MANAGED_PACKAGE_PARTS, import_lib$2, RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/package/2006/relationships", import_lib$12, MANAGED_DOCUMENT_PARTS, import_lib3, import_jszip_min, IMAGE_EXTS, MIME_TYPE_FOR_EXT, CUSTOM_XML_ITEM_PROPS_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.customXmlProperties+xml", FONT_CONTENT_TYPES, DocxZipper = class {
118895
118941
  constructor(params = {}) {
118896
118942
  this.debug = params.debug || false;
118897
118943
  this.zip = new import_jszip_min.default;
@@ -119035,6 +119081,9 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
119035
119081
  if (!hasFootnotes)
119036
119082
  typesString += footnotesDef;
119037
119083
  }
119084
+ for (const entry of MANAGED_DOCUMENT_PARTS)
119085
+ if (hasFile(entry.zipPath) && !hasPartOverride(`/${entry.zipPath}`))
119086
+ typesString += `<Override PartName="/${entry.zipPath}" ContentType="${entry.contentType}" />`;
119038
119087
  const partNames = new Set(additionalPartNames);
119039
119088
  if (docx?.files)
119040
119089
  if (fromJson && Array.isArray(docx.files))
@@ -119112,6 +119161,14 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
119112
119161
  const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${name.includes("header") ? "header" : "footer"}+xml"/>`;
119113
119162
  updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
119114
119163
  });
119164
+ if (relationshipsXml) {
119165
+ const reconciledRels = reconcileDocumentRelationships(relationshipsXml, hasFile);
119166
+ if (reconciledRels !== relationshipsXml)
119167
+ if (fromJson)
119168
+ updatedDocs["word/_rels/document.xml.rels"] = reconciledRels;
119169
+ else
119170
+ docx.file("word/_rels/document.xml.rels", reconciledRels);
119171
+ }
119115
119172
  if (fromJson)
119116
119173
  return updatedContentTypesXml;
119117
119174
  docx.file(contentTypesPath, updatedContentTypesXml);
@@ -119219,7 +119276,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
119219
119276
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
119220
119277
  }
119221
119278
  }, DocxZipper_default;
119222
- var init_DocxZipper_DcuMk8AE_es = __esm(() => {
119279
+ var init_DocxZipper_GK7co0eu_es = __esm(() => {
119223
119280
  init_rolldown_runtime_B2q5OVn9_es();
119224
119281
  init_jszip_ChlR43oI_es();
119225
119282
  init_xml_js_BtmJ6bNs_es();
@@ -120860,7 +120917,14 @@ var init_DocxZipper_DcuMk8AE_es = __esm(() => {
120860
120917
  relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"
120861
120918
  }
120862
120919
  ];
120920
+ import_lib$2 = /* @__PURE__ */ __toESM2(require_lib(), 1);
120863
120921
  import_lib$12 = /* @__PURE__ */ __toESM2(require_lib(), 1);
120922
+ MANAGED_DOCUMENT_PARTS = [{
120923
+ zipPath: "word/numbering.xml",
120924
+ contentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
120925
+ relationshipType: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",
120926
+ relTarget: "numbering.xml"
120927
+ }];
120864
120928
  import_lib3 = /* @__PURE__ */ __toESM2(require_lib(), 1);
120865
120929
  import_jszip_min = /* @__PURE__ */ __toESM2(require_jszip_min(), 1);
120866
120930
  IMAGE_EXTS = new Set([
@@ -144322,7 +144386,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
144322
144386
  init_remark_gfm_z_sDF4ss_es();
144323
144387
  });
144324
144388
 
144325
- // ../../packages/superdoc/dist/chunks/src-Bdp40qhn.es.js
144389
+ // ../../packages/superdoc/dist/chunks/src-B23kCZxx.es.js
144326
144390
  function deleteProps(obj, propOrProps) {
144327
144391
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
144328
144392
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -151880,15 +151944,6 @@ function requireEditorCommand(command$1, operationName) {
151880
151944
  return command$1;
151881
151945
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${operationName} command is not available.`, { reason: "missing_command" });
151882
151946
  }
151883
- function requireSchemaMark(editor, markName, operationName) {
151884
- const mark2 = editor.schema?.marks?.[markName];
151885
- if (mark2)
151886
- return mark2;
151887
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${operationName} requires the "${markName}" mark.`, {
151888
- reason: "missing_mark",
151889
- markName
151890
- });
151891
- }
151892
151947
  function ensureTrackedCapability(editor, config2) {
151893
151948
  if (typeof editor.commands?.insertTrackedChange !== "function")
151894
151949
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${config2.operation} requires the insertTrackedChange command.`, { reason: "missing_command" });
@@ -154274,7 +154329,16 @@ function isInlinePropertyAvailable(editor, property) {
154274
154329
  if (property.storage === "mark") {
154275
154330
  if (property.carrier.storage !== "mark")
154276
154331
  return false;
154277
- return hasMarkCapability(editor, property.carrier.markName === "textStyle" ? "textStyle" : property.carrier.markName);
154332
+ const markName = property.carrier.markName;
154333
+ if (!hasMarkCapability(editor, markName))
154334
+ return false;
154335
+ if (markName === "textStyle" && property.carrier.textStyleAttr) {
154336
+ const textStyleMark = editor.schema.marks.textStyle;
154337
+ const markAttrs = textStyleMark?.spec?.attrs ?? textStyleMark?.attrs;
154338
+ if (!markAttrs || !Object.prototype.hasOwnProperty.call(markAttrs, property.carrier.textStyleAttr))
154339
+ return false;
154340
+ }
154341
+ return true;
154278
154342
  }
154279
154343
  return Boolean(editor.schema?.nodes?.run);
154280
154344
  }
@@ -157290,6 +157354,82 @@ function collectBlockIds(fragment2) {
157290
157354
  }
157291
157355
  return ids;
157292
157356
  }
157357
+ function getSchemaMarks(editor) {
157358
+ return editor.schema?.marks ?? editor.state.schema?.marks ?? {};
157359
+ }
157360
+ function getSchemaNodes(editor) {
157361
+ return editor.state.schema?.nodes ?? editor.schema?.nodes ?? {};
157362
+ }
157363
+ function getMarkAttrs(markType) {
157364
+ if (!markType || typeof markType !== "object")
157365
+ return;
157366
+ const specAttrs = markType.spec?.attrs;
157367
+ if (specAttrs && typeof specAttrs === "object")
157368
+ return specAttrs;
157369
+ const attrs = markType.attrs;
157370
+ if (attrs && typeof attrs === "object")
157371
+ return attrs;
157372
+ }
157373
+ function getInlinePropertyCapabilityIssue(editor, keys$1, operationName = "format.apply") {
157374
+ const schemaMarks = getSchemaMarks(editor);
157375
+ const requiredTextStyleAttrs = /* @__PURE__ */ new Set;
157376
+ let requiresRunNode = false;
157377
+ for (const key$1 of keys$1) {
157378
+ const entry = INLINE_PROPERTY_BY_KEY2[key$1];
157379
+ if (!entry)
157380
+ continue;
157381
+ if (entry.storage === "mark") {
157382
+ const carrier = entry.carrier;
157383
+ if (carrier.storage !== "mark")
157384
+ continue;
157385
+ if (!schemaMarks[carrier.markName])
157386
+ return {
157387
+ code: "CAPABILITY_UNAVAILABLE",
157388
+ message: `${operationName} requires the "${carrier.markName}" mark.`,
157389
+ details: {
157390
+ reason: "missing_mark",
157391
+ markName: carrier.markName
157392
+ }
157393
+ };
157394
+ if (carrier.markName === "textStyle" && carrier.textStyleAttr)
157395
+ requiredTextStyleAttrs.add(carrier.textStyleAttr);
157396
+ continue;
157397
+ }
157398
+ requiresRunNode = true;
157399
+ }
157400
+ if (requiredTextStyleAttrs.size > 0) {
157401
+ const markAttrs = getMarkAttrs(schemaMarks.textStyle);
157402
+ for (const attr of requiredTextStyleAttrs)
157403
+ if (!markAttrs || !Object.prototype.hasOwnProperty.call(markAttrs, attr))
157404
+ return {
157405
+ code: "CAPABILITY_UNAVAILABLE",
157406
+ message: `${operationName} requires the "${attr}" attribute on the textStyle mark.`,
157407
+ details: {
157408
+ reason: "missing_mark_attribute",
157409
+ markName: "textStyle",
157410
+ attribute: attr
157411
+ }
157412
+ };
157413
+ }
157414
+ if (requiresRunNode && !getSchemaNodes(editor).run)
157415
+ return {
157416
+ code: "CAPABILITY_UNAVAILABLE",
157417
+ message: `${operationName} requires a run node in the schema.`
157418
+ };
157419
+ }
157420
+ function getTrackedInlinePropertySupportIssue(keys$1, operationName = "format.apply") {
157421
+ const unsupportedTrackedKeys = keys$1.filter((key$1) => INLINE_PROPERTY_BY_KEY2[key$1]?.tracked === false);
157422
+ if (unsupportedTrackedKeys.length === 0)
157423
+ return;
157424
+ return {
157425
+ code: "CAPABILITY_UNAVAILABLE",
157426
+ message: `${operationName} tracked mode is not available for: ${unsupportedTrackedKeys.join(", ")}`,
157427
+ details: {
157428
+ keys: unsupportedTrackedKeys,
157429
+ changeMode: "tracked"
157430
+ }
157431
+ };
157432
+ }
157293
157433
  function editorHasDom(editor) {
157294
157434
  const opts = editor.options;
157295
157435
  return !!(opts?.document ?? opts?.mockDocument ?? (typeof document !== "undefined" ? document : null));
@@ -157473,38 +157613,16 @@ function writeWrapper(editor, request, options) {
157473
157613
  }), resolved.resolution);
157474
157614
  }
157475
157615
  function ensureInlinePropertyCapabilities(editor, keys$1) {
157476
- let requiresTextStyle = false;
157477
- let requiresRunNode = false;
157478
- for (const key$1 of keys$1) {
157479
- const entry = INLINE_PROPERTY_BY_KEY2[key$1];
157480
- if (!entry)
157481
- continue;
157482
- if (entry.storage === "mark") {
157483
- const carrier = entry.carrier;
157484
- if (carrier.storage !== "mark")
157485
- continue;
157486
- if (carrier.markName === "textStyle") {
157487
- requiresTextStyle = true;
157488
- continue;
157489
- }
157490
- requireSchemaMark(editor, carrier.markName, "format.apply");
157491
- continue;
157492
- }
157493
- requiresRunNode = true;
157494
- }
157495
- if (requiresTextStyle)
157496
- requireSchemaMark(editor, "textStyle", "format.apply");
157497
- if (requiresRunNode && !editor.state.schema.nodes.run)
157498
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "format.apply requires a run node in the schema.");
157616
+ const issue = getInlinePropertyCapabilityIssue(editor, keys$1);
157617
+ if (!issue)
157618
+ return;
157619
+ throw new DocumentApiAdapterError(issue.code, issue.message, issue.details);
157499
157620
  }
157500
157621
  function ensureTrackedInlinePropertySupport(keys$1) {
157501
- const unsupportedTrackedKeys = keys$1.filter((key$1) => INLINE_PROPERTY_BY_KEY2[key$1]?.tracked === false);
157502
- if (unsupportedTrackedKeys.length === 0)
157622
+ const issue = getTrackedInlinePropertySupportIssue(keys$1);
157623
+ if (!issue)
157503
157624
  return;
157504
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `format.apply tracked mode is not available for: ${unsupportedTrackedKeys.join(", ")}`, {
157505
- keys: unsupportedTrackedKeys,
157506
- changeMode: "tracked"
157507
- });
157625
+ throw new DocumentApiAdapterError(issue.code, issue.message, issue.details);
157508
157626
  }
157509
157627
  function buildSelectionWhere(request) {
157510
157628
  if (request.target)
@@ -164964,6 +165082,17 @@ function executeTextStep(ctx$1, targets, step3, rangeExecutor, spanExecutor) {
164964
165082
  data
164965
165083
  };
164966
165084
  }
165085
+ function ensureFormatStepCapabilities(ctx$1, step3) {
165086
+ const inlineKeys = Object.keys(step3.args.inline);
165087
+ const capabilityIssue = getInlinePropertyCapabilityIssue(ctx$1.editor, inlineKeys, step3.op);
165088
+ if (capabilityIssue)
165089
+ throw planError(capabilityIssue.code, capabilityIssue.message, step3.id, capabilityIssue.details);
165090
+ if (ctx$1.changeMode !== "tracked")
165091
+ return;
165092
+ const trackedIssue = getTrackedInlinePropertySupportIssue(inlineKeys, step3.op);
165093
+ if (trackedIssue)
165094
+ throw planError(trackedIssue.code, trackedIssue.message, step3.id, trackedIssue.details);
165095
+ }
164967
165096
  function buildTableInput(op, blockId, args$1) {
164968
165097
  const { target: _target, nodeId: _n, tableTarget: _tableTarget, tableNodeId: _t$1, ...safeArgs } = args$1;
164969
165098
  if (TABLE_SCOPED_OPS.has(op)) {
@@ -164989,7 +165118,10 @@ function registerBuiltInExecutors() {
164989
165118
  registerStepExecutor("text.rewrite", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeTextRewrite(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanTextRewrite(e, tr, t, s2, m$1)) });
164990
165119
  registerStepExecutor("text.insert", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeTextInsert(e, tr, t, s2, m$1)) });
164991
165120
  registerStepExecutor("text.delete", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (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)) });
164992
- registerStepExecutor("format.apply", { execute: (ctx$1, targets, step3) => executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1)) });
165121
+ registerStepExecutor("format.apply", { execute: (ctx$1, targets, step3) => {
165122
+ ensureFormatStepCapabilities(ctx$1, step3);
165123
+ return executeTextStep(ctx$1, targets, step3, (e, tr, t, s2, m$1) => executeStyleApply3(e, tr, t, s2, m$1), (e, tr, t, s2, m$1) => executeSpanStyleApply(e, tr, t, s2, m$1));
165124
+ } });
164993
165125
  registerStepExecutor("create.paragraph", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
164994
165126
  registerStepExecutor("create.heading", { execute: (ctx$1, targets, step3) => executeCreateStep(ctx$1.editor, ctx$1.tr, step3, targets, ctx$1.mapping) });
164995
165127
  registerStepExecutor("domain.command", { execute(ctx$1, _targets, step3) {
@@ -168758,6 +168890,130 @@ function applyTcPatch(existing, patch3) {
168758
168890
  function areTcConfigsEqual(a2, b$1) {
168759
168891
  return serializeTcInstruction(a2) === serializeTcInstruction(b$1);
168760
168892
  }
168893
+ function generateTocBookmarkName(blockId) {
168894
+ return `${TOC_BOOKMARK_PREFIX}${encodeBlockId(blockId)}`;
168895
+ }
168896
+ function encodeBlockId(input2) {
168897
+ let result = "";
168898
+ for (let i4 = 0;i4 < input2.length; i4++) {
168899
+ const ch = input2[i4];
168900
+ if (ch === "_")
168901
+ result += "__";
168902
+ else if (ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9")
168903
+ result += ch;
168904
+ else
168905
+ result += `_${ch.charCodeAt(0).toString(16).padStart(2, "0")}`;
168906
+ }
168907
+ return result;
168908
+ }
168909
+ function syncTocBookmarks(editor, sources) {
168910
+ const { schema, doc: doc$12 } = editor.state;
168911
+ if (!schema.nodes.bookmarkStart || !schema.nodes.bookmarkEnd)
168912
+ return;
168913
+ const needed = deduplicateByBlockId(sources);
168914
+ const existing = collectExistingTocBookmarkNames(doc$12);
168915
+ const missing = needed.filter((t) => !existing.has(t.bookmarkName));
168916
+ if (missing.length === 0)
168917
+ return;
168918
+ const insertions = resolveInsertionTargets(missing, buildBlockIdPositionMap(doc$12), doc$12);
168919
+ if (insertions.length === 0)
168920
+ return;
168921
+ const { tr } = editor.state;
168922
+ let nextId = findMaxBookmarkId(doc$12) + 1;
168923
+ for (const { bookmarkName, contentStart, contentEnd } of insertions) {
168924
+ const bookmarkId = String(nextId++);
168925
+ const endNode = schema.nodes.bookmarkEnd.create({ id: bookmarkId });
168926
+ const startNode = schema.nodes.bookmarkStart.create({
168927
+ name: bookmarkName,
168928
+ id: bookmarkId
168929
+ });
168930
+ tr.insert(tr.mapping.map(contentStart), startNode);
168931
+ tr.insert(tr.mapping.map(contentEnd), endNode);
168932
+ }
168933
+ if (tr.docChanged)
168934
+ dispatchTransaction$2(editor, tr);
168935
+ }
168936
+ function deduplicateByBlockId(sources) {
168937
+ const seenBlockIds = /* @__PURE__ */ new Set;
168938
+ const claimedNames = /* @__PURE__ */ new Map;
168939
+ const targets = [];
168940
+ for (const { sdBlockId } of sources) {
168941
+ if (seenBlockIds.has(sdBlockId))
168942
+ continue;
168943
+ seenBlockIds.add(sdBlockId);
168944
+ const bookmarkName = generateTocBookmarkName(sdBlockId);
168945
+ const existingOwner = claimedNames.get(bookmarkName);
168946
+ if (existingOwner !== undefined && existingOwner !== sdBlockId)
168947
+ continue;
168948
+ claimedNames.set(bookmarkName, sdBlockId);
168949
+ targets.push({
168950
+ blockId: sdBlockId,
168951
+ bookmarkName
168952
+ });
168953
+ }
168954
+ return targets;
168955
+ }
168956
+ function collectExistingTocBookmarkNames(doc$12) {
168957
+ const names = /* @__PURE__ */ new Set;
168958
+ doc$12.descendants((node3) => {
168959
+ if (node3.type.name === "bookmarkStart") {
168960
+ const name = node3.attrs?.name;
168961
+ if (name?.startsWith(TOC_BOOKMARK_PREFIX))
168962
+ names.add(name);
168963
+ }
168964
+ return true;
168965
+ });
168966
+ return names;
168967
+ }
168968
+ function buildBlockIdPositionMap(doc$12) {
168969
+ const map$12 = /* @__PURE__ */ new Map;
168970
+ doc$12.descendants((node3, pos) => {
168971
+ if (node3.type.name === "paragraph") {
168972
+ const id2 = node3.attrs?.sdBlockId ?? node3.attrs?.paraId;
168973
+ if (id2 && !map$12.has(id2))
168974
+ map$12.set(id2, pos);
168975
+ }
168976
+ return true;
168977
+ });
168978
+ return map$12;
168979
+ }
168980
+ function resolveInsertionTargets(missing, positions, doc$12) {
168981
+ const result = [];
168982
+ for (const { blockId, bookmarkName } of missing) {
168983
+ const pos = positions.get(blockId);
168984
+ if (pos === undefined)
168985
+ continue;
168986
+ const node3 = doc$12.nodeAt(pos);
168987
+ if (!node3 || node3.type.name !== "paragraph")
168988
+ continue;
168989
+ result.push({
168990
+ bookmarkName,
168991
+ contentStart: pos + 1,
168992
+ contentEnd: pos + node3.nodeSize - 1
168993
+ });
168994
+ }
168995
+ result.sort((a2, b$1) => b$1.contentStart - a2.contentStart);
168996
+ return result;
168997
+ }
168998
+ function findMaxBookmarkId(doc$12) {
168999
+ let maxId = -1;
169000
+ doc$12.descendants((node3) => {
169001
+ if (node3.type.name !== "bookmarkStart" && node3.type.name !== "bookmarkEnd")
169002
+ return true;
169003
+ const raw = node3.attrs?.id;
169004
+ const id2 = typeof raw === "string" ? parseInt(raw, 10) : typeof raw === "number" ? raw : NaN;
169005
+ if (!isNaN(id2) && id2 > maxId)
169006
+ maxId = id2;
169007
+ return true;
169008
+ });
169009
+ return maxId;
169010
+ }
169011
+ function dispatchTransaction$2(editor, tr) {
169012
+ if (typeof editor.dispatch === "function")
169013
+ editor.dispatch(tr);
169014
+ else if (typeof editor.view?.dispatch === "function")
169015
+ editor.view.dispatch(tr);
169016
+ }
168761
169017
  function collectTocSources(doc$12, config2) {
168762
169018
  const sources = [];
168763
169019
  const { outlineLevels, useAppliedOutlineLevel, tcFieldIdentifier, tcFieldLevels } = config2.source;
@@ -168848,7 +169104,7 @@ function buildEntryParagraph(source, config2) {
168848
169104
  textNode.marks = [{
168849
169105
  type: "link",
168850
169106
  attrs: {
168851
- anchor: source.sdBlockId,
169107
+ anchor: generateTocBookmarkName(source.sdBlockId),
168852
169108
  rId: null,
168853
169109
  history: true
168854
169110
  }
@@ -169047,8 +169303,12 @@ function sanitizeTocContentForSchema(content3, editor) {
169047
169303
  });
169048
169304
  }
169049
169305
  function materializeTocContent(doc$12, config2, editor) {
169050
- const entryParagraphs = buildTocEntryParagraphs(collectTocSources(doc$12, config2), config2);
169051
- return sanitizeTocContentForSchema(entryParagraphs.length > 0 ? entryParagraphs : NO_ENTRIES_PLACEHOLDER, editor);
169306
+ const sources = collectTocSources(doc$12, config2);
169307
+ const entryParagraphs = buildTocEntryParagraphs(sources, config2);
169308
+ return {
169309
+ content: sanitizeTocContentForSchema(entryParagraphs.length > 0 ? entryParagraphs : NO_ENTRIES_PLACEHOLDER, editor),
169310
+ sources
169311
+ };
169052
169312
  }
169053
169313
  function tocConfigureWrapper(editor, input2, options) {
169054
169314
  rejectTrackedMode("toc.configure", options);
@@ -169058,7 +169318,7 @@ function tocConfigureWrapper(editor, input2, options) {
169058
169318
  const instruction = serializeTocInstruction(patched);
169059
169319
  const rightAlignChanged = input2.patch.rightAlignPageNumbers !== undefined && input2.patch.rightAlignPageNumbers !== resolved.node.attrs?.rightAlignPageNumbers;
169060
169320
  const effectiveRightAlign = input2.patch.rightAlignPageNumbers ?? resolved.node.attrs?.rightAlignPageNumbers;
169061
- const nextContent = materializeTocContent(editor.state.doc, withRightAlign(patched, effectiveRightAlign), editor);
169321
+ const { content: nextContent, sources } = materializeTocContent(editor.state.doc, withRightAlign(patched, effectiveRightAlign), editor);
169062
169322
  if (areTocConfigsEqual(currentConfig, patched) && !rightAlignChanged)
169063
169323
  return tocFailure("NO_OP", "Configuration patch produced no change.");
169064
169324
  if (options?.dryRun)
@@ -169091,6 +169351,7 @@ function tocConfigureWrapper(editor, input2, options) {
169091
169351
  }
169092
169352
  }, options?.expectedRevision)))
169093
169353
  return tocFailure("NO_OP", "Configuration change could not be applied.");
169354
+ syncTocBookmarks(editor, sources);
169094
169355
  return tocSuccess(resolvePostMutationTocId(editor.state.doc, commandNodeId));
169095
169356
  }
169096
169357
  function tocUpdateWrapper(editor, input2, options) {
@@ -169103,13 +169364,13 @@ function tocUpdateAll(editor, input2, options) {
169103
169364
  const resolved = resolveTocTarget(editor.state.doc, input2.target);
169104
169365
  const config2 = parseTocInstruction(resolved.node.attrs?.instruction ?? "");
169105
169366
  const rightAlign = resolved.node.attrs?.rightAlignPageNumbers;
169106
- const content3 = materializeTocContent(editor.state.doc, withRightAlign(config2, rightAlign), editor);
169367
+ const { content: content3, sources } = materializeTocContent(editor.state.doc, withRightAlign(config2, rightAlign), editor);
169107
169368
  if (isTocContentUnchanged(resolved.node, content3))
169108
169369
  return tocFailure("NO_OP", "TOC update produced no change.");
169109
169370
  if (options?.dryRun)
169110
169371
  return tocSuccess(resolved.nodeId);
169111
169372
  const command$1 = editor.commands?.replaceTableOfContentsContentById;
169112
- return receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
169373
+ if (!receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
169113
169374
  sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
169114
169375
  content: content3
169115
169376
  }, options?.expectedRevision) : runTocAction(editor, () => {
@@ -169123,7 +169384,10 @@ function tocUpdateAll(editor, input2, options) {
169123
169384
  } catch {
169124
169385
  return false;
169125
169386
  }
169126
- }, options?.expectedRevision)) ? tocSuccess(resolved.nodeId) : tocFailure("NO_OP", "TOC update produced no change.");
169387
+ }, options?.expectedRevision)))
169388
+ return tocFailure("NO_OP", "TOC update produced no change.");
169389
+ syncTocBookmarks(editor, sources);
169390
+ return tocSuccess(resolved.nodeId);
169127
169391
  }
169128
169392
  function getPageMap(editor) {
169129
169393
  const storage = editor.storage;
@@ -169242,7 +169506,7 @@ function createTableOfContentsWrapper(editor, input2, options) {
169242
169506
  pos = resolveCreateAnchor(editor, at.target, at.kind).pos;
169243
169507
  const config2 = input2.config ? applyTocPatchTyped(DEFAULT_TOC_CONFIG, input2.config) : DEFAULT_TOC_CONFIG;
169244
169508
  const instruction = serializeTocInstruction(config2);
169245
- const content3 = materializeTocContent(editor.state.doc, withRightAlign(config2, input2.config?.rightAlignPageNumbers), editor);
169509
+ const { content: content3, sources } = materializeTocContent(editor.state.doc, withRightAlign(config2, input2.config?.rightAlignPageNumbers), editor);
169246
169510
  const sdBlockId = v4_default();
169247
169511
  if (options?.dryRun)
169248
169512
  return {
@@ -169286,6 +169550,7 @@ function createTableOfContentsWrapper(editor, input2, options) {
169286
169550
  message: "Table of contents could not be inserted at the requested location."
169287
169551
  }
169288
169552
  };
169553
+ syncTocBookmarks(editor, sources);
169289
169554
  return {
169290
169555
  success: true,
169291
169556
  toc: buildTocAddress(resolvePostMutationTocId(editor.state.doc, sdBlockId))
@@ -200841,15 +201106,15 @@ var Node$13 = class Node$14 {
200841
201106
  return false;
200842
201107
  if ($from.parent.type.name !== "run")
200843
201108
  return false;
200844
- let dispatchTransaction$2 = null;
201109
+ let dispatchTransaction$3 = null;
200845
201110
  if (view?.dispatch)
200846
- dispatchTransaction$2 = view.dispatch.bind(view);
201111
+ dispatchTransaction$3 = view.dispatch.bind(view);
200847
201112
  else if (editor?.dispatch)
200848
- dispatchTransaction$2 = editor.dispatch.bind(editor);
200849
- if (!dispatchTransaction$2)
201113
+ dispatchTransaction$3 = editor.dispatch.bind(editor);
201114
+ if (!dispatchTransaction$3)
200850
201115
  return false;
200851
201116
  const handled = splitBlockPatch(state, (transaction) => {
200852
- dispatchTransaction$2(transaction);
201117
+ dispatchTransaction$3(transaction);
200853
201118
  }, editor);
200854
201119
  if (handled)
200855
201120
  tr.setMeta("preventDispatch", true);
@@ -205512,11 +205777,11 @@ var Node$13 = class Node$14 {
205512
205777
  this.eventListenerCleanups = [];
205513
205778
  this.resizeTimeoutId = null;
205514
205779
  }
205515
- attach({ element: element3, state, editorProps = {}, dispatchTransaction: dispatchTransaction$2, handleClick: handleClick$1 }) {
205780
+ attach({ element: element3, state, editorProps = {}, dispatchTransaction: dispatchTransaction$3, handleClick: handleClick$1 }) {
205516
205781
  this.view?.destroy();
205517
205782
  this.view = new EditorView(element3, {
205518
205783
  ...editorProps && typeof editorProps === "object" ? editorProps : {},
205519
- dispatchTransaction: dispatchTransaction$2,
205784
+ dispatchTransaction: dispatchTransaction$3,
205520
205785
  state,
205521
205786
  handleClick: handleClick$1
205522
205787
  });
@@ -205891,7 +206156,7 @@ var Node$13 = class Node$14 {
205891
206156
  type: mark2.type.name,
205892
206157
  attrs: mark2.attrs ?? {}
205893
206158
  }));
205894
- }, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, SNAPSHOT_VERSION3 = "sd-diff-snapshot/v1", PAYLOAD_VERSION3 = "sd-diff-payload/v1", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, DEFAULT_MIME_TYPE = "application/octet-stream", simpleHash2 = (str) => {
206159
+ }, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, SNAPSHOT_VERSION3 = "sd-diff-snapshot/v1", PAYLOAD_VERSION3 = "sd-diff-payload/v1", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, DEFAULT_MIME_TYPE = "application/octet-stream", simpleHash2 = (str) => {
205895
206160
  let hash$3 = 0;
205896
206161
  for (let i4 = 0;i4 < str.length; i4++) {
205897
206162
  const char = str.charCodeAt(i4);
@@ -224782,7 +225047,7 @@ var Node$13 = class Node$14 {
224782
225047
  return false;
224783
225048
  return Boolean(checker(attrs));
224784
225049
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
224785
- var init_src_Bdp40qhn_es = __esm(() => {
225050
+ var init_src_B23kCZxx_es = __esm(() => {
224786
225051
  init_rolldown_runtime_B2q5OVn9_es();
224787
225052
  init_SuperConverter_hvBoS9gB_es();
224788
225053
  init_jszip_ChlR43oI_es();
@@ -224791,7 +225056,7 @@ var init_src_Bdp40qhn_es = __esm(() => {
224791
225056
  init_unified_BRHLwnjP_es();
224792
225057
  init_remark_gfm_z_sDF4ss_es();
224793
225058
  init_remark_stringify_D8vxv_XI_es();
224794
- init_DocxZipper_DcuMk8AE_es();
225059
+ init_DocxZipper_GK7co0eu_es();
224795
225060
  init_vue_DQHWm9lq_es();
224796
225061
  init__plugin_vue_export_helper_HmhZBO0u_es();
224797
225062
  init_eventemitter3_DGBTyUUP_es();
@@ -257870,13 +258135,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
257870
258135
 
257871
258136
  // ../../packages/superdoc/dist/super-editor.es.js
257872
258137
  var init_super_editor_es = __esm(() => {
257873
- init_src_Bdp40qhn_es();
258138
+ init_src_B23kCZxx_es();
257874
258139
  init_SuperConverter_hvBoS9gB_es();
257875
258140
  init_jszip_ChlR43oI_es();
257876
258141
  init_xml_js_BtmJ6bNs_es();
257877
258142
  init_constants_ep1_Gwqi_es();
257878
258143
  init_unified_BRHLwnjP_es();
257879
- init_DocxZipper_DcuMk8AE_es();
258144
+ init_DocxZipper_GK7co0eu_es();
257880
258145
  init_vue_DQHWm9lq_es();
257881
258146
  init_eventemitter3_DGBTyUUP_es();
257882
258147
  init_zipper_DqXT7uTa_es();
@@ -267052,15 +267317,6 @@ function requireEditorCommand2(command2, operationName) {
267052
267317
  reason: "missing_command"
267053
267318
  });
267054
267319
  }
267055
- function requireSchemaMark2(editor, markName, operationName) {
267056
- const mark2 = editor.schema?.marks?.[markName];
267057
- if (mark2)
267058
- return mark2;
267059
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `${operationName} requires the "${markName}" mark.`, {
267060
- reason: "missing_mark",
267061
- markName
267062
- });
267063
- }
267064
267320
  function ensureTrackedCapability2(editor, config2) {
267065
267321
  if (typeof editor.commands?.insertTrackedChange !== "function") {
267066
267322
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `${config2.operation} requires the insertTrackedChange command.`, { reason: "missing_command" });
@@ -328662,8 +328918,16 @@ function isInlinePropertyAvailable2(editor, property) {
328662
328918
  if (property.storage === "mark") {
328663
328919
  if (property.carrier.storage !== "mark")
328664
328920
  return false;
328665
- const markName = property.carrier.markName === "textStyle" ? "textStyle" : property.carrier.markName;
328666
- return hasMarkCapability2(editor, markName);
328921
+ const markName = property.carrier.markName;
328922
+ if (!hasMarkCapability2(editor, markName))
328923
+ return false;
328924
+ if (markName === "textStyle" && property.carrier.textStyleAttr) {
328925
+ const textStyleMark = editor.schema.marks.textStyle;
328926
+ const markAttrs = textStyleMark?.spec?.attrs ?? textStyleMark?.attrs;
328927
+ if (!markAttrs || !Object.prototype.hasOwnProperty.call(markAttrs, property.carrier.textStyleAttr))
328928
+ return false;
328929
+ }
328930
+ return true;
328667
328931
  }
328668
328932
  return Boolean(editor.schema?.nodes?.run);
328669
328933
  }
@@ -332195,6 +332459,84 @@ var init_structural_write_engine = __esm(() => {
332195
332459
  init_nesting_guard();
332196
332460
  });
332197
332461
 
332462
+ // ../../packages/super-editor/src/document-api-adapters/plan-engine/inline-property-guards.ts
332463
+ function getSchemaMarks2(editor) {
332464
+ return editor.schema?.marks ?? editor.state.schema?.marks ?? {};
332465
+ }
332466
+ function getSchemaNodes2(editor) {
332467
+ return editor.state.schema?.nodes ?? editor.schema?.nodes ?? {};
332468
+ }
332469
+ function getMarkAttrs2(markType) {
332470
+ if (!markType || typeof markType !== "object")
332471
+ return;
332472
+ const specAttrs = markType.spec?.attrs;
332473
+ if (specAttrs && typeof specAttrs === "object")
332474
+ return specAttrs;
332475
+ const attrs = markType.attrs;
332476
+ if (attrs && typeof attrs === "object")
332477
+ return attrs;
332478
+ return;
332479
+ }
332480
+ function getInlinePropertyCapabilityIssue2(editor, keys7, operationName = "format.apply") {
332481
+ const schemaMarks = getSchemaMarks2(editor);
332482
+ const requiredTextStyleAttrs = new Set;
332483
+ let requiresRunNode = false;
332484
+ for (const key2 of keys7) {
332485
+ const entry = INLINE_PROPERTY_BY_KEY[key2];
332486
+ if (!entry)
332487
+ continue;
332488
+ if (entry.storage === "mark") {
332489
+ const carrier = entry.carrier;
332490
+ if (carrier.storage !== "mark")
332491
+ continue;
332492
+ if (!schemaMarks[carrier.markName]) {
332493
+ return {
332494
+ code: "CAPABILITY_UNAVAILABLE",
332495
+ message: `${operationName} requires the "${carrier.markName}" mark.`,
332496
+ details: { reason: "missing_mark", markName: carrier.markName }
332497
+ };
332498
+ }
332499
+ if (carrier.markName === "textStyle" && carrier.textStyleAttr) {
332500
+ requiredTextStyleAttrs.add(carrier.textStyleAttr);
332501
+ }
332502
+ continue;
332503
+ }
332504
+ requiresRunNode = true;
332505
+ }
332506
+ if (requiredTextStyleAttrs.size > 0) {
332507
+ const markAttrs = getMarkAttrs2(schemaMarks.textStyle);
332508
+ for (const attr of requiredTextStyleAttrs) {
332509
+ if (!markAttrs || !Object.prototype.hasOwnProperty.call(markAttrs, attr)) {
332510
+ return {
332511
+ code: "CAPABILITY_UNAVAILABLE",
332512
+ message: `${operationName} requires the "${attr}" attribute on the textStyle mark.`,
332513
+ details: { reason: "missing_mark_attribute", markName: "textStyle", attribute: attr }
332514
+ };
332515
+ }
332516
+ }
332517
+ }
332518
+ if (requiresRunNode && !getSchemaNodes2(editor).run) {
332519
+ return {
332520
+ code: "CAPABILITY_UNAVAILABLE",
332521
+ message: `${operationName} requires a run node in the schema.`
332522
+ };
332523
+ }
332524
+ return;
332525
+ }
332526
+ function getTrackedInlinePropertySupportIssue2(keys7, operationName = "format.apply") {
332527
+ const unsupportedTrackedKeys = keys7.filter((key2) => INLINE_PROPERTY_BY_KEY[key2]?.tracked === false);
332528
+ if (unsupportedTrackedKeys.length === 0)
332529
+ return;
332530
+ return {
332531
+ code: "CAPABILITY_UNAVAILABLE",
332532
+ message: `${operationName} tracked mode is not available for: ${unsupportedTrackedKeys.join(", ")}`,
332533
+ details: { keys: unsupportedTrackedKeys, changeMode: "tracked" }
332534
+ };
332535
+ }
332536
+ var init_inline_property_guards = __esm(() => {
332537
+ init_src();
332538
+ });
332539
+
332198
332540
  // ../../packages/super-editor/src/document-api-adapters/plan-engine/plan-wrappers.ts
332199
332541
  function editorHasDom2(editor) {
332200
332542
  const opts = editor.options;
@@ -332372,37 +332714,16 @@ function writeWrapper2(editor, request, options) {
332372
332714
  return mapPlanReceiptToTextReceipt2(receipt2, resolved.resolution);
332373
332715
  }
332374
332716
  function ensureInlinePropertyCapabilities2(editor, keys7) {
332375
- let requiresTextStyle = false;
332376
- let requiresRunNode = false;
332377
- for (const key2 of keys7) {
332378
- const entry = INLINE_PROPERTY_BY_KEY[key2];
332379
- if (!entry)
332380
- continue;
332381
- if (entry.storage === "mark") {
332382
- const carrier = entry.carrier;
332383
- if (carrier.storage !== "mark")
332384
- continue;
332385
- if (carrier.markName === "textStyle") {
332386
- requiresTextStyle = true;
332387
- continue;
332388
- }
332389
- requireSchemaMark2(editor, carrier.markName, "format.apply");
332390
- continue;
332391
- }
332392
- requiresRunNode = true;
332393
- }
332394
- if (requiresTextStyle) {
332395
- requireSchemaMark2(editor, "textStyle", "format.apply");
332396
- }
332397
- if (requiresRunNode && !editor.state.schema.nodes.run) {
332398
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "format.apply requires a run node in the schema.");
332399
- }
332717
+ const issue = getInlinePropertyCapabilityIssue2(editor, keys7);
332718
+ if (!issue)
332719
+ return;
332720
+ throw new DocumentApiAdapterError3(issue.code, issue.message, issue.details);
332400
332721
  }
332401
332722
  function ensureTrackedInlinePropertySupport2(keys7) {
332402
- const unsupportedTrackedKeys = keys7.filter((key2) => INLINE_PROPERTY_BY_KEY[key2]?.tracked === false);
332403
- if (unsupportedTrackedKeys.length === 0)
332723
+ const issue = getTrackedInlinePropertySupportIssue2(keys7);
332724
+ if (!issue)
332404
332725
  return;
332405
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `format.apply tracked mode is not available for: ${unsupportedTrackedKeys.join(", ")}`, { keys: unsupportedTrackedKeys, changeMode: "tracked" });
332726
+ throw new DocumentApiAdapterError3(issue.code, issue.message, issue.details);
332406
332727
  }
332407
332728
  function buildSelectionWhere2(request) {
332408
332729
  if (request.target) {
@@ -333100,6 +333421,7 @@ var init_plan_wrappers = __esm(() => {
333100
333421
  init_selection_target_resolver();
333101
333422
  init_index_cache();
333102
333423
  init_node_address_resolver();
333424
+ init_inline_property_guards();
333103
333425
  STUB_WHERE2 = {
333104
333426
  by: "select",
333105
333427
  select: { type: "text", pattern: "", mode: "exact" },
@@ -339905,6 +340227,19 @@ function executeTextStep2(ctx2, targets, step3, rangeExecutor, spanExecutor) {
339905
340227
  };
339906
340228
  return { stepId: step3.id, op: step3.op, effect: effect2, matchCount: targets.length, data };
339907
340229
  }
340230
+ function ensureFormatStepCapabilities2(ctx2, step3) {
340231
+ const inlineKeys = Object.keys(step3.args.inline);
340232
+ const capabilityIssue = getInlinePropertyCapabilityIssue2(ctx2.editor, inlineKeys, step3.op);
340233
+ if (capabilityIssue) {
340234
+ throw planError2(capabilityIssue.code, capabilityIssue.message, step3.id, capabilityIssue.details);
340235
+ }
340236
+ if (ctx2.changeMode !== "tracked")
340237
+ return;
340238
+ const trackedIssue = getTrackedInlinePropertySupportIssue2(inlineKeys, step3.op);
340239
+ if (trackedIssue) {
340240
+ throw planError2(trackedIssue.code, trackedIssue.message, step3.id, trackedIssue.details);
340241
+ }
340242
+ }
339908
340243
  function buildTableInput2(op, blockId, args3) {
339909
340244
  const { target: _target, nodeId: _n, tableTarget: _tableTarget, tableNodeId: _t2, ...safeArgs } = args3;
339910
340245
  if (TABLE_SCOPED_OPS2.has(op)) {
@@ -339929,7 +340264,10 @@ function registerBuiltInExecutors2() {
339929
340264
  execute: (ctx2, targets, step3) => executeTextStep2(ctx2, targets, step3, (e, tr, t, s2, m2) => executeTextDelete2(e, tr, t, s2, m2), (e, tr, t, s2, m2) => executeSpanTextDelete2(e, tr, t, s2, m2))
339930
340265
  });
339931
340266
  registerStepExecutor2("format.apply", {
339932
- execute: (ctx2, targets, step3) => 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))
340267
+ execute: (ctx2, targets, step3) => {
340268
+ ensureFormatStepCapabilities2(ctx2, step3);
340269
+ 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));
340270
+ }
339933
340271
  });
339934
340272
  registerStepExecutor2("create.paragraph", {
339935
340273
  execute: (ctx2, targets, step3) => executeCreateStep2(ctx2.editor, ctx2.tr, step3, targets, ctx2.mapping)
@@ -340156,6 +340494,7 @@ var TABLE_ADAPTER_DISPATCH2, ROW_OPS2, TABLE_SCOPED_OPS2, registered2 = false;
340156
340494
  var init_register_executors = __esm(() => {
340157
340495
  init_executor_registry();
340158
340496
  init_errors4();
340497
+ init_inline_property_guards();
340159
340498
  init_executor();
340160
340499
  init_structural_write_engine();
340161
340500
  init_tables_adapter();
@@ -344584,6 +344923,131 @@ var init_tc_switches = __esm(() => {
344584
344923
  SWITCH_PATTERN3 = /\\([a-z])(?:\s*(?:"([^"]*)"|([^\s\\]+)))?/gi;
344585
344924
  });
344586
344925
 
344926
+ // ../../packages/super-editor/src/document-api-adapters/helpers/toc-bookmark-sync.ts
344927
+ function generateTocBookmarkName2(blockId) {
344928
+ return `${TOC_BOOKMARK_PREFIX2}${encodeBlockId2(blockId)}`;
344929
+ }
344930
+ function encodeBlockId2(input2) {
344931
+ let result = "";
344932
+ for (let i5 = 0;i5 < input2.length; i5++) {
344933
+ const ch = input2[i5];
344934
+ if (ch === "_") {
344935
+ result += "__";
344936
+ } else if (ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z" || ch >= "0" && ch <= "9") {
344937
+ result += ch;
344938
+ } else {
344939
+ result += `_${ch.charCodeAt(0).toString(16).padStart(2, "0")}`;
344940
+ }
344941
+ }
344942
+ return result;
344943
+ }
344944
+ function syncTocBookmarks2(editor, sources) {
344945
+ const { schema, doc: doc4 } = editor.state;
344946
+ if (!schema.nodes.bookmarkStart || !schema.nodes.bookmarkEnd)
344947
+ return;
344948
+ const needed = deduplicateByBlockId2(sources);
344949
+ const existing = collectExistingTocBookmarkNames2(doc4);
344950
+ const missing = needed.filter((t) => !existing.has(t.bookmarkName));
344951
+ if (missing.length === 0)
344952
+ return;
344953
+ const paragraphPositions = buildBlockIdPositionMap2(doc4);
344954
+ const insertions = resolveInsertionTargets2(missing, paragraphPositions, doc4);
344955
+ if (insertions.length === 0)
344956
+ return;
344957
+ const { tr } = editor.state;
344958
+ let nextId = findMaxBookmarkId2(doc4) + 1;
344959
+ for (const { bookmarkName, contentStart, contentEnd } of insertions) {
344960
+ const bookmarkId = String(nextId++);
344961
+ const endNode = schema.nodes.bookmarkEnd.create({ id: bookmarkId });
344962
+ const startNode = schema.nodes.bookmarkStart.create({ name: bookmarkName, id: bookmarkId });
344963
+ tr.insert(tr.mapping.map(contentStart), startNode);
344964
+ tr.insert(tr.mapping.map(contentEnd), endNode);
344965
+ }
344966
+ if (tr.docChanged) {
344967
+ dispatchTransaction2(editor, tr);
344968
+ }
344969
+ }
344970
+ function deduplicateByBlockId2(sources) {
344971
+ const seenBlockIds = new Set;
344972
+ const claimedNames = new Map;
344973
+ const targets = [];
344974
+ for (const { sdBlockId } of sources) {
344975
+ if (seenBlockIds.has(sdBlockId))
344976
+ continue;
344977
+ seenBlockIds.add(sdBlockId);
344978
+ const bookmarkName = generateTocBookmarkName2(sdBlockId);
344979
+ const existingOwner = claimedNames.get(bookmarkName);
344980
+ if (existingOwner !== undefined && existingOwner !== sdBlockId)
344981
+ continue;
344982
+ claimedNames.set(bookmarkName, sdBlockId);
344983
+ targets.push({ blockId: sdBlockId, bookmarkName });
344984
+ }
344985
+ return targets;
344986
+ }
344987
+ function collectExistingTocBookmarkNames2(doc4) {
344988
+ const names = new Set;
344989
+ doc4.descendants((node4) => {
344990
+ if (node4.type.name === "bookmarkStart") {
344991
+ const name = node4.attrs?.name;
344992
+ if (name?.startsWith(TOC_BOOKMARK_PREFIX2))
344993
+ names.add(name);
344994
+ }
344995
+ return true;
344996
+ });
344997
+ return names;
344998
+ }
344999
+ function buildBlockIdPositionMap2(doc4) {
345000
+ const map10 = new Map;
345001
+ doc4.descendants((node4, pos) => {
345002
+ if (node4.type.name === "paragraph") {
345003
+ const id2 = node4.attrs?.sdBlockId ?? node4.attrs?.paraId;
345004
+ if (id2 && !map10.has(id2))
345005
+ map10.set(id2, pos);
345006
+ }
345007
+ return true;
345008
+ });
345009
+ return map10;
345010
+ }
345011
+ function resolveInsertionTargets2(missing, positions, doc4) {
345012
+ const result = [];
345013
+ for (const { blockId, bookmarkName } of missing) {
345014
+ const pos = positions.get(blockId);
345015
+ if (pos === undefined)
345016
+ continue;
345017
+ const node4 = doc4.nodeAt(pos);
345018
+ if (!node4 || node4.type.name !== "paragraph")
345019
+ continue;
345020
+ result.push({
345021
+ bookmarkName,
345022
+ contentStart: pos + 1,
345023
+ contentEnd: pos + node4.nodeSize - 1
345024
+ });
345025
+ }
345026
+ result.sort((a2, b2) => b2.contentStart - a2.contentStart);
345027
+ return result;
345028
+ }
345029
+ function findMaxBookmarkId2(doc4) {
345030
+ let maxId = -1;
345031
+ doc4.descendants((node4) => {
345032
+ if (node4.type.name !== "bookmarkStart" && node4.type.name !== "bookmarkEnd")
345033
+ return true;
345034
+ const raw = node4.attrs?.id;
345035
+ const id2 = typeof raw === "string" ? parseInt(raw, 10) : typeof raw === "number" ? raw : NaN;
345036
+ if (!isNaN(id2) && id2 > maxId)
345037
+ maxId = id2;
345038
+ return true;
345039
+ });
345040
+ return maxId;
345041
+ }
345042
+ function dispatchTransaction2(editor, tr) {
345043
+ if (typeof editor.dispatch === "function") {
345044
+ editor.dispatch(tr);
345045
+ } else if (typeof editor.view?.dispatch === "function") {
345046
+ editor.view.dispatch(tr);
345047
+ }
345048
+ }
345049
+ var TOC_BOOKMARK_PREFIX2 = "_Toc";
345050
+
344587
345051
  // ../../packages/super-editor/src/document-api-adapters/helpers/toc-entry-builder.ts
344588
345052
  function collectTocSources2(doc4, config41) {
344589
345053
  const sources = [];
@@ -344669,7 +345133,7 @@ function buildEntryParagraph2(source, config41) {
344669
345133
  {
344670
345134
  type: "link",
344671
345135
  attrs: {
344672
- anchor: source.sdBlockId,
345136
+ anchor: generateTocBookmarkName2(source.sdBlockId),
344673
345137
  rId: null,
344674
345138
  history: true
344675
345139
  }
@@ -344861,7 +345325,7 @@ function materializeTocContent2(doc4, config41, editor) {
344861
345325
  const sources = collectTocSources2(doc4, config41);
344862
345326
  const entryParagraphs = buildTocEntryParagraphs2(sources, config41);
344863
345327
  const content5 = entryParagraphs.length > 0 ? entryParagraphs : NO_ENTRIES_PLACEHOLDER2;
344864
- return sanitizeTocContentForSchema2(content5, editor);
345328
+ return { content: sanitizeTocContentForSchema2(content5, editor), sources };
344865
345329
  }
344866
345330
  function tocConfigureWrapper2(editor, input2, options) {
344867
345331
  rejectTrackedMode2("toc.configure", options);
@@ -344871,7 +345335,7 @@ function tocConfigureWrapper2(editor, input2, options) {
344871
345335
  const instruction = serializeTocInstruction2(patched);
344872
345336
  const rightAlignChanged = input2.patch.rightAlignPageNumbers !== undefined && input2.patch.rightAlignPageNumbers !== resolved.node.attrs?.rightAlignPageNumbers;
344873
345337
  const effectiveRightAlign = input2.patch.rightAlignPageNumbers ?? resolved.node.attrs?.rightAlignPageNumbers;
344874
- const nextContent = materializeTocContent2(editor.state.doc, withRightAlign2(patched, effectiveRightAlign), editor);
345338
+ const { content: nextContent, sources } = materializeTocContent2(editor.state.doc, withRightAlign2(patched, effectiveRightAlign), editor);
344875
345339
  if (areTocConfigsEqual2(currentConfig, patched) && !rightAlignChanged) {
344876
345340
  return tocFailure2("NO_OP", "Configuration patch produced no change.");
344877
345341
  }
@@ -344908,6 +345372,7 @@ function tocConfigureWrapper2(editor, input2, options) {
344908
345372
  if (!receiptApplied2(receipt2)) {
344909
345373
  return tocFailure2("NO_OP", "Configuration change could not be applied.");
344910
345374
  }
345375
+ syncTocBookmarks2(editor, sources);
344911
345376
  const postMutationId = resolvePostMutationTocId2(editor.state.doc, commandNodeId);
344912
345377
  return tocSuccess2(postMutationId);
344913
345378
  }
@@ -344923,7 +345388,7 @@ function tocUpdateAll2(editor, input2, options) {
344923
345388
  const resolved = resolveTocTarget2(editor.state.doc, input2.target);
344924
345389
  const config41 = parseTocInstruction2(resolved.node.attrs?.instruction ?? "");
344925
345390
  const rightAlign = resolved.node.attrs?.rightAlignPageNumbers;
344926
- const content5 = materializeTocContent2(editor.state.doc, withRightAlign2(config41, rightAlign), editor);
345391
+ const { content: content5, sources } = materializeTocContent2(editor.state.doc, withRightAlign2(config41, rightAlign), editor);
344927
345392
  if (isTocContentUnchanged2(resolved.node, content5)) {
344928
345393
  return tocFailure2("NO_OP", "TOC update produced no change.");
344929
345394
  }
@@ -344946,7 +345411,11 @@ function tocUpdateAll2(editor, input2, options) {
344946
345411
  return false;
344947
345412
  }
344948
345413
  }, options?.expectedRevision);
344949
- return receiptApplied2(receipt2) ? tocSuccess2(resolved.nodeId) : tocFailure2("NO_OP", "TOC update produced no change.");
345414
+ if (!receiptApplied2(receipt2)) {
345415
+ return tocFailure2("NO_OP", "TOC update produced no change.");
345416
+ }
345417
+ syncTocBookmarks2(editor, sources);
345418
+ return tocSuccess2(resolved.nodeId);
344950
345419
  }
344951
345420
  function getPageMap2(editor) {
344952
345421
  const storage = editor.storage;
@@ -345070,7 +345539,7 @@ function createTableOfContentsWrapper2(editor, input2, options) {
345070
345539
  }
345071
345540
  const config41 = input2.config ? applyTocPatchTyped2(DEFAULT_TOC_CONFIG2, input2.config) : DEFAULT_TOC_CONFIG2;
345072
345541
  const instruction = serializeTocInstruction2(config41);
345073
- const content5 = materializeTocContent2(editor.state.doc, withRightAlign2(config41, input2.config?.rightAlignPageNumbers), editor);
345542
+ const { content: content5, sources } = materializeTocContent2(editor.state.doc, withRightAlign2(config41, input2.config?.rightAlignPageNumbers), editor);
345074
345543
  const sdBlockId = v42();
345075
345544
  if (options?.dryRun) {
345076
345545
  return { success: true, toc: buildTocAddress2("(dry-run)") };
@@ -345116,6 +345585,7 @@ function createTableOfContentsWrapper2(editor, input2, options) {
345116
345585
  }
345117
345586
  };
345118
345587
  }
345588
+ syncTocBookmarks2(editor, sources);
345119
345589
  const postMutationId = resolvePostMutationTocId2(editor.state.doc, sdBlockId);
345120
345590
  return { success: true, toc: buildTocAddress2(postMutationId) };
345121
345591
  }
@@ -346416,13 +346886,13 @@ function getLinkMarkType2(editor) {
346416
346886
  }
346417
346887
  return markType;
346418
346888
  }
346419
- function dispatchTransaction2(editor, tr) {
346889
+ function dispatchTransaction3(editor, tr) {
346420
346890
  editor.dispatch(tr);
346421
346891
  }
346422
346892
  function dispatchIfChanged2(editor, tr) {
346423
346893
  if (!tr.docChanged)
346424
346894
  return false;
346425
- dispatchTransaction2(editor, tr);
346895
+ dispatchTransaction3(editor, tr);
346426
346896
  return true;
346427
346897
  }
346428
346898
  function createRelationshipId2(editor, href) {
@@ -346468,7 +346938,7 @@ function wrapWithLink2(editor, from4, to, spec) {
346468
346938
  const tr = editor.state.tr;
346469
346939
  tr.addMark(from4, to, linkMarkType.create(attrs));
346470
346940
  applyDirectMutationMeta2(tr);
346471
- dispatchTransaction2(editor, tr);
346941
+ dispatchTransaction3(editor, tr);
346472
346942
  return true;
346473
346943
  }
346474
346944
  function insertLinkedText2(editor, pos, text9, spec) {
@@ -346479,7 +346949,7 @@ function insertLinkedText2(editor, pos, text9, spec) {
346479
346949
  tr.insertText(text9, pos);
346480
346950
  tr.addMark(pos, pos + text9.length, mark2);
346481
346951
  applyDirectMutationMeta2(tr);
346482
- dispatchTransaction2(editor, tr);
346952
+ dispatchTransaction3(editor, tr);
346483
346953
  return true;
346484
346954
  }
346485
346955
  function patchLinkMark2(editor, from4, to, existingMark, patch3) {
@@ -346529,7 +346999,7 @@ function deleteLinkedText2(editor, from4, to) {
346529
346999
  const tr = editor.state.tr;
346530
347000
  tr.delete(from4, to);
346531
347001
  applyDirectMutationMeta2(tr);
346532
- dispatchTransaction2(editor, tr);
347002
+ dispatchTransaction3(editor, tr);
346533
347003
  return true;
346534
347004
  }
346535
347005
  var init_hyperlink_mutation_helper = __esm(() => {
@@ -347001,7 +347471,7 @@ function executeSdtMutation2(editor, target, options, handler3) {
347001
347471
  }
347002
347472
  return buildMutationSuccess2(target, updatedRef);
347003
347473
  }
347004
- function dispatchTransaction3(editor, tr) {
347474
+ function dispatchTransaction4(editor, tr) {
347005
347475
  if (editor.view?.dispatch) {
347006
347476
  editor.view.dispatch(tr);
347007
347477
  return;
@@ -347086,7 +347556,7 @@ function replaceSdtTextContent2(editor, target, text9) {
347086
347556
  const updatedNode2 = resolved.node.type.create({ ...resolved.node.attrs }, null, resolved.node.marks);
347087
347557
  const { tr: tr2 } = editor.state;
347088
347558
  tr2.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode2);
347089
- dispatchTransaction3(editor, tr2);
347559
+ dispatchTransaction4(editor, tr2);
347090
347560
  return true;
347091
347561
  }
347092
347562
  const paragraph4 = buildEmptyBlockContent2(editor, resolved.node);
@@ -347095,7 +347565,7 @@ function replaceSdtTextContent2(editor, target, text9) {
347095
347565
  const updatedNode = resolved.node.type.create({ ...resolved.node.attrs }, updatedParagraph, resolved.node.marks);
347096
347566
  const { tr } = editor.state;
347097
347567
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, updatedNode);
347098
- dispatchTransaction3(editor, tr);
347568
+ dispatchTransaction4(editor, tr);
347099
347569
  return true;
347100
347570
  }
347101
347571
  function listWrapper2(editor, query2) {
@@ -347189,7 +347659,7 @@ function wrapWrapper2(editor, input2, options) {
347189
347659
  const wrapperNode = nodeType.create({ id: id2, tag: input2.tag, alias: input2.alias, lockMode: input2.lockMode ?? "unlocked" }, resolved.node);
347190
347660
  const { tr } = editor.state;
347191
347661
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, wrapperNode);
347192
- dispatchTransaction3(editor, tr);
347662
+ dispatchTransaction4(editor, tr);
347193
347663
  return wrapperTarget;
347194
347664
  });
347195
347665
  }
@@ -347201,7 +347671,7 @@ function unwrapWrapper2(editor, input2, options) {
347201
347671
  const resolved = resolveSdtByTarget2(editor.state.doc, input2.target);
347202
347672
  const { tr } = editor.state;
347203
347673
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, resolved.node.content);
347204
- dispatchTransaction3(editor, tr);
347674
+ dispatchTransaction4(editor, tr);
347205
347675
  return true;
347206
347676
  });
347207
347677
  }
@@ -347228,7 +347698,7 @@ function copyWrapper2(editor, input2, options) {
347228
347698
  const { tr } = editor.state;
347229
347699
  const insertPos = dest.pos + dest.node.nodeSize;
347230
347700
  tr.insert(insertPos, cloned);
347231
- dispatchTransaction3(editor, tr);
347701
+ dispatchTransaction4(editor, tr);
347232
347702
  return { kind: source.kind, nodeType: "sdt", nodeId: newId };
347233
347703
  });
347234
347704
  }
@@ -347243,7 +347713,7 @@ function moveWrapper2(editor, input2, options) {
347243
347713
  const destAfterDelete = resolveSdtByTarget2(tr.doc, input2.destination);
347244
347714
  const insertPos = destAfterDelete.pos + destAfterDelete.node.nodeSize;
347245
347715
  tr.insert(insertPos, source.node);
347246
- dispatchTransaction3(editor, tr);
347716
+ dispatchTransaction4(editor, tr);
347247
347717
  return true;
347248
347718
  });
347249
347719
  }
@@ -347519,7 +347989,7 @@ function insertBeforeWrapper2(editor, input2, options) {
347519
347989
  const textNode = editor.schema.text(input2.content);
347520
347990
  const { tr } = editor.state;
347521
347991
  tr.insert(resolved.pos, textNode);
347522
- dispatchTransaction3(editor, tr);
347992
+ dispatchTransaction4(editor, tr);
347523
347993
  return true;
347524
347994
  });
347525
347995
  }
@@ -347532,7 +348002,7 @@ function insertAfterWrapper2(editor, input2, options) {
347532
348002
  const textNode = editor.schema.text(input2.content);
347533
348003
  const { tr } = editor.state;
347534
348004
  tr.insert(insertPos, textNode);
347535
- dispatchTransaction3(editor, tr);
348005
+ dispatchTransaction4(editor, tr);
347536
348006
  return true;
347537
348007
  });
347538
348008
  }
@@ -347920,7 +348390,7 @@ function repeatingSectionInsertItemBeforeWrapper2(editor, input2, options) {
347920
348390
  const newItem = nodeType.create({ id: generateSdtId2(), controlType: "repeatingSectionItem", type: "repeatingSectionItem" }, paragraph4);
347921
348391
  const { tr } = editor.state;
347922
348392
  tr.insert(insertPos, newItem);
347923
- dispatchTransaction3(editor, tr);
348393
+ dispatchTransaction4(editor, tr);
347924
348394
  return true;
347925
348395
  });
347926
348396
  }
@@ -347942,7 +348412,7 @@ function repeatingSectionInsertItemAfterWrapper2(editor, input2, options) {
347942
348412
  const newItem = nodeType.create({ id: generateSdtId2(), controlType: "repeatingSectionItem", type: "repeatingSectionItem" }, paragraph4);
347943
348413
  const { tr } = editor.state;
347944
348414
  tr.insert(insertPos, newItem);
347945
- dispatchTransaction3(editor, tr);
348415
+ dispatchTransaction4(editor, tr);
347946
348416
  return true;
347947
348417
  });
347948
348418
  }
@@ -347962,7 +348432,7 @@ function repeatingSectionCloneItemWrapper2(editor, input2, options) {
347962
348432
  const insertPos = sourceItem.pos + sourceItem.node.nodeSize;
347963
348433
  const { tr } = editor.state;
347964
348434
  tr.insert(insertPos, cloned);
347965
- dispatchTransaction3(editor, tr);
348435
+ dispatchTransaction4(editor, tr);
347966
348436
  return true;
347967
348437
  });
347968
348438
  }
@@ -347980,7 +348450,7 @@ function repeatingSectionDeleteItemWrapper2(editor, input2, options) {
347980
348450
  const item = items[input2.index];
347981
348451
  const { tr } = editor.state;
347982
348452
  tr.delete(item.pos, item.pos + item.node.nodeSize);
347983
- dispatchTransaction3(editor, tr);
348453
+ dispatchTransaction4(editor, tr);
347984
348454
  return true;
347985
348455
  });
347986
348456
  }
@@ -348005,7 +348475,7 @@ function groupWrapWrapper2(editor, input2, options) {
348005
348475
  const groupNode = groupNodeType.create({ id: groupId, controlType: "group", type: "group" }, resolved.node);
348006
348476
  const { tr } = editor.state;
348007
348477
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, groupNode);
348008
- dispatchTransaction3(editor, tr);
348478
+ dispatchTransaction4(editor, tr);
348009
348479
  return { kind: "block", nodeType: "sdt", nodeId: groupId };
348010
348480
  });
348011
348481
  }
@@ -348018,7 +348488,7 @@ function groupUngroupWrapper2(editor, input2, options) {
348018
348488
  const resolved = resolveSdtByTarget2(editor.state.doc, input2.target);
348019
348489
  const { tr } = editor.state;
348020
348490
  tr.replaceWith(resolved.pos, resolved.pos + resolved.node.nodeSize, resolved.node.content);
348021
- dispatchTransaction3(editor, tr);
348491
+ dispatchTransaction4(editor, tr);
348022
348492
  return true;
348023
348493
  });
348024
348494
  }
@@ -348073,7 +348543,7 @@ function createWrapper2(editor, input2, options) {
348073
348543
  const insertPos = ref4.pos + ref4.node.nodeSize;
348074
348544
  const { tr } = editor.state;
348075
348545
  tr.insert(insertPos, newNode);
348076
- dispatchTransaction3(editor, tr);
348546
+ dispatchTransaction4(editor, tr);
348077
348547
  return true;
348078
348548
  }
348079
348549
  if (contentText !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.3.0-next.16",
3
+ "version": "0.3.0-next.18",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -21,8 +21,8 @@
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "@superdoc/pm-adapter": "0.0.0",
25
24
  "@superdoc/super-editor": "0.0.1",
25
+ "@superdoc/pm-adapter": "0.0.0",
26
26
  "superdoc": "1.19.0"
27
27
  },
28
28
  "module": "src/index.ts",
@@ -30,11 +30,11 @@
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.16",
34
- "@superdoc-dev/cli-linux-x64": "0.3.0-next.16",
35
- "@superdoc-dev/cli-linux-arm64": "0.3.0-next.16",
36
- "@superdoc-dev/cli-windows-x64": "0.3.0-next.16",
37
- "@superdoc-dev/cli-darwin-x64": "0.3.0-next.16"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.3.0-next.18",
34
+ "@superdoc-dev/cli-darwin-x64": "0.3.0-next.18",
35
+ "@superdoc-dev/cli-linux-x64": "0.3.0-next.18",
36
+ "@superdoc-dev/cli-linux-arm64": "0.3.0-next.18",
37
+ "@superdoc-dev/cli-windows-x64": "0.3.0-next.18"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",