@superdoc-dev/cli 0.2.0-next.122 → 0.2.0-next.124

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 (3) hide show
  1. package/README.md +128 -22
  2. package/dist/index.js +2222 -576
  3. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1306,7 +1306,7 @@ var init_operation_definitions = __esm(() => {
1306
1306
  },
1307
1307
  find: {
1308
1308
  memberPath: "find",
1309
- description: "Search the document for text or node matches using SDM/1 selectors.",
1309
+ description: "Search the document for text or node matches using SDM/1 selectors. Returns discovery-grade results — for mutation targeting, use query.match instead.",
1310
1310
  expectedResult: "Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }).",
1311
1311
  requiresDocumentContext: true,
1312
1312
  metadata: readOperation({
@@ -1406,7 +1406,7 @@ var init_operation_definitions = __esm(() => {
1406
1406
  },
1407
1407
  insert: {
1408
1408
  memberPath: "insert",
1409
- description: "Insert content at a target position, or at the end of the document when target is omitted. " + "Accepts two input shapes: legacy string-based (value + type) or structural SDFragment (content). " + "Supports text (default), markdown, and html content types via the `type` field in legacy mode. " + "Structural mode accepts an SDFragment with typed nodes (paragraphs, tables, images, etc.).",
1409
+ description: "Insert inline content at a text position within an existing block, or at the end of the document when target is omitted. " + "This is NOT for creating sibling blocks — use create.paragraph, create.heading, or lists.insert for that. " + "Accepts two input shapes: legacy string-based (value + type) or structural SDFragment (content). " + "Supports text (default), markdown, and html content types via the `type` field in legacy mode. " + "Structural mode accepts an SDFragment with typed nodes (paragraphs, tables, images, etc.).",
1410
1410
  expectedResult: "Returns a TextMutationReceipt with applied status; receipt reports NO_OP if the insertion point is invalid or content is empty.",
1411
1411
  requiresDocumentContext: true,
1412
1412
  metadata: mutationOperation({
@@ -1495,10 +1495,22 @@ var init_operation_definitions = __esm(() => {
1495
1495
  referenceDocPath: "delete.mdx",
1496
1496
  referenceGroup: "core"
1497
1497
  },
1498
+ "blocks.list": {
1499
+ memberPath: "blocks.list",
1500
+ description: "List top-level blocks in document order with IDs, types, and text previews. Supports pagination via offset/limit and optional nodeType filtering.",
1501
+ expectedResult: "Returns a BlocksListResult with total block count, an ordered array of block entries (ordinal, nodeId, nodeType, textPreview, isEmpty), and the current document revision.",
1502
+ requiresDocumentContext: true,
1503
+ metadata: readOperation({
1504
+ throws: ["INVALID_INPUT"]
1505
+ }),
1506
+ referenceDocPath: "blocks/list.mdx",
1507
+ referenceGroup: "blocks",
1508
+ essential: true
1509
+ },
1498
1510
  "blocks.delete": {
1499
1511
  memberPath: "blocks.delete",
1500
1512
  description: "Delete an entire block node (paragraph, heading, list item, table, image, or sdt) deterministically.",
1501
- expectedResult: "Returns a BlocksDeleteResult receipt confirming the block was removed from the document.",
1513
+ expectedResult: "Returns a BlocksDeleteResult receipt confirming the block was removed, including a deletedBlock summary with ordinal, nodeType, and textPreview.",
1502
1514
  requiresDocumentContext: true,
1503
1515
  metadata: mutationOperation({
1504
1516
  idempotency: "conditional",
@@ -1517,6 +1529,28 @@ var init_operation_definitions = __esm(() => {
1517
1529
  referenceDocPath: "blocks/delete.mdx",
1518
1530
  referenceGroup: "blocks"
1519
1531
  },
1532
+ "blocks.deleteRange": {
1533
+ memberPath: "blocks.deleteRange",
1534
+ description: "Delete a contiguous range of top-level blocks between two endpoints (inclusive). Both endpoints must be direct children of the document node. Supports dry-run preview.",
1535
+ expectedResult: "Returns a BlocksDeleteRangeResult with deletedCount, deletedBlocks array (each with ordinal, nodeId, nodeType, textPreview), before/after revision, and dryRun flag.",
1536
+ requiresDocumentContext: true,
1537
+ metadata: mutationOperation({
1538
+ idempotency: "conditional",
1539
+ supportsDryRun: true,
1540
+ supportsTrackedMode: false,
1541
+ possibleFailureCodes: NONE_FAILURES,
1542
+ throws: [
1543
+ "TARGET_NOT_FOUND",
1544
+ "AMBIGUOUS_TARGET",
1545
+ "INVALID_TARGET",
1546
+ "INVALID_INPUT",
1547
+ "CAPABILITY_UNAVAILABLE",
1548
+ "INTERNAL_ERROR"
1549
+ ]
1550
+ }),
1551
+ referenceDocPath: "blocks/delete-range.mdx",
1552
+ referenceGroup: "blocks"
1553
+ },
1520
1554
  "format.apply": {
1521
1555
  memberPath: "format.apply",
1522
1556
  description: "Apply inline run-property patch changes to the target range with explicit set/clear semantics.",
@@ -1551,7 +1585,7 @@ var init_operation_definitions = __esm(() => {
1551
1585
  },
1552
1586
  "create.paragraph": {
1553
1587
  memberPath: "create.paragraph",
1554
- description: "Create a new paragraph at the target position.",
1588
+ description: "Create a standalone paragraph at the target position. To add a list item, use lists.insert instead.",
1555
1589
  expectedResult: "Returns a CreateParagraphResult with the new paragraph block ID and address.",
1556
1590
  requiresDocumentContext: true,
1557
1591
  metadata: mutationOperation({
@@ -2185,7 +2219,7 @@ var init_operation_definitions = __esm(() => {
2185
2219
  },
2186
2220
  "lists.insert": {
2187
2221
  memberPath: "lists.insert",
2188
- description: "Insert a new list at the target position.",
2222
+ description: "Insert a new list item before or after an existing list item. The new item inherits the target list context.",
2189
2223
  expectedResult: "Returns a ListsInsertResult with the new list item address and block ID.",
2190
2224
  requiresDocumentContext: true,
2191
2225
  metadata: mutationOperation({
@@ -2702,7 +2736,7 @@ var init_operation_definitions = __esm(() => {
2702
2736
  },
2703
2737
  "query.match": {
2704
2738
  memberPath: "query.match",
2705
- description: "Deterministic selector-based search with cardinality contracts for mutation targeting.",
2739
+ description: "Deterministic selector-based search returning mutation-grade addresses and text ranges. Use this to discover targets before any mutation.",
2706
2740
  expectedResult: "Returns a QueryMatchOutput with the resolved target address and cardinality metadata.",
2707
2741
  requiresDocumentContext: true,
2708
2742
  metadata: readOperation({
@@ -3559,7 +3593,7 @@ var init_operation_definitions = __esm(() => {
3559
3593
  "history.undo": {
3560
3594
  memberPath: "history.undo",
3561
3595
  description: "Undo the most recent history-safe mutation in the active editor.",
3562
- expectedResult: "Returns a HistoryActionResult with noop flag and revision before/after; noop is true when the undo stack is empty.",
3596
+ expectedResult: "Returns a HistoryActionResult with noop flag, reason (EMPTY_UNDO_STACK | NO_EFFECT when noop), and revision before/after.",
3563
3597
  requiresDocumentContext: true,
3564
3598
  metadata: mutationOperation({
3565
3599
  idempotency: "non-idempotent",
@@ -3575,7 +3609,7 @@ var init_operation_definitions = __esm(() => {
3575
3609
  "history.redo": {
3576
3610
  memberPath: "history.redo",
3577
3611
  description: "Redo the most recently undone action in the active editor.",
3578
- expectedResult: "Returns a HistoryActionResult with noop flag and revision before/after; noop is true when the redo stack is empty.",
3612
+ expectedResult: "Returns a HistoryActionResult with noop flag, reason (EMPTY_REDO_STACK | NO_EFFECT when noop), and revision before/after.",
3579
3613
  requiresDocumentContext: true,
3580
3614
  metadata: mutationOperation({
3581
3615
  idempotency: "non-idempotent",
@@ -8622,20 +8656,85 @@ var init_schemas = __esm(() => {
8622
8656
  failure: textMutationFailureSchemaFor("format.apply")
8623
8657
  },
8624
8658
  ...formatInlineAliasOperationSchemas,
8659
+ "blocks.list": {
8660
+ input: objectSchema({
8661
+ offset: { type: "number", minimum: 0 },
8662
+ limit: { type: "number", minimum: 1 },
8663
+ nodeTypes: { type: "array", items: { enum: [...blockNodeTypeValues] } }
8664
+ }),
8665
+ output: objectSchema({
8666
+ total: { type: "number" },
8667
+ blocks: {
8668
+ type: "array",
8669
+ items: objectSchema({
8670
+ ordinal: { type: "number" },
8671
+ nodeId: { type: "string" },
8672
+ nodeType: { enum: [...blockNodeTypeValues] },
8673
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] },
8674
+ isEmpty: { type: "boolean" }
8675
+ }, ["ordinal", "nodeId", "nodeType", "textPreview", "isEmpty"])
8676
+ },
8677
+ revision: { type: "string" }
8678
+ }, ["total", "blocks", "revision"])
8679
+ },
8625
8680
  "blocks.delete": {
8626
8681
  input: objectSchema({
8627
8682
  target: deletableBlockNodeAddressSchema
8628
8683
  }, ["target"]),
8629
8684
  output: objectSchema({
8630
8685
  success: { const: true },
8631
- deleted: deletableBlockNodeAddressSchema
8686
+ deleted: deletableBlockNodeAddressSchema,
8687
+ deletedBlock: objectSchema({
8688
+ ordinal: { type: "number" },
8689
+ nodeId: { type: "string" },
8690
+ nodeType: { type: "string" },
8691
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
8692
+ })
8632
8693
  }, ["success", "deleted"]),
8633
8694
  success: objectSchema({
8634
8695
  success: { const: true },
8635
- deleted: deletableBlockNodeAddressSchema
8696
+ deleted: deletableBlockNodeAddressSchema,
8697
+ deletedBlock: objectSchema({
8698
+ ordinal: { type: "number" },
8699
+ nodeId: { type: "string" },
8700
+ nodeType: { type: "string" },
8701
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
8702
+ })
8636
8703
  }, ["success", "deleted"]),
8637
8704
  failure: preApplyFailureResultSchemaFor("blocks.delete")
8638
8705
  },
8706
+ "blocks.deleteRange": {
8707
+ input: objectSchema({
8708
+ start: blockNodeAddressSchema,
8709
+ end: blockNodeAddressSchema
8710
+ }, ["start", "end"]),
8711
+ output: objectSchema({
8712
+ success: { const: true },
8713
+ deletedCount: { type: "number" },
8714
+ deletedBlocks: {
8715
+ type: "array",
8716
+ items: objectSchema({
8717
+ ordinal: { type: "number" },
8718
+ nodeId: { type: "string" },
8719
+ nodeType: { type: "string" },
8720
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
8721
+ }, ["ordinal", "nodeId", "nodeType", "textPreview"])
8722
+ },
8723
+ revision: objectSchema({
8724
+ before: { type: "string" },
8725
+ after: { type: "string" }
8726
+ }, ["before", "after"]),
8727
+ dryRun: { type: "boolean" }
8728
+ }, ["success", "deletedCount", "deletedBlocks", "revision", "dryRun"]),
8729
+ success: objectSchema({
8730
+ success: { const: true },
8731
+ deletedCount: { type: "number" },
8732
+ deletedBlocks: { type: "array" },
8733
+ revision: objectSchema({ before: { type: "string" }, after: { type: "string" } }, ["before", "after"]),
8734
+ dryRun: { type: "boolean" }
8735
+ }, ["success", "deletedCount", "deletedBlocks", "revision", "dryRun"]),
8736
+ failure: preApplyFailureResultSchemaFor("blocks.deleteRange")
8737
+ },
8639
8738
  "styles.paragraph.setStyle": {
8640
8739
  input: objectSchema({ target: paragraphTargetSchema, styleId: { type: "string", minLength: 1 } }, [
8641
8740
  "target",
@@ -12940,6 +13039,35 @@ var init_create = __esm(() => {
12940
13039
  });
12941
13040
 
12942
13041
  // ../../packages/document-api/src/blocks/blocks.ts
13042
+ function validateBlocksListInput(input) {
13043
+ if (!input)
13044
+ return;
13045
+ if (input.offset != null && (typeof input.offset !== "number" || input.offset < 0)) {
13046
+ throw new DocumentApiValidationError("INVALID_INPUT", "blocks.list offset must be a non-negative number.", {
13047
+ fields: ["offset"]
13048
+ });
13049
+ }
13050
+ if (input.limit != null && (typeof input.limit !== "number" || input.limit < 1)) {
13051
+ throw new DocumentApiValidationError("INVALID_INPUT", "blocks.list limit must be a positive number.", {
13052
+ fields: ["limit"]
13053
+ });
13054
+ }
13055
+ if (input.nodeTypes != null) {
13056
+ if (!Array.isArray(input.nodeTypes) || input.nodeTypes.length === 0) {
13057
+ throw new DocumentApiValidationError("INVALID_INPUT", "blocks.list nodeTypes must be a non-empty array.", {
13058
+ fields: ["nodeTypes"]
13059
+ });
13060
+ }
13061
+ for (const nt of input.nodeTypes) {
13062
+ if (!VALID_BLOCK_NODE_TYPES.has(nt)) {
13063
+ throw new DocumentApiValidationError("INVALID_INPUT", `blocks.list nodeTypes contains unknown type "${nt}".`, {
13064
+ fields: ["nodeTypes"],
13065
+ nodeType: nt
13066
+ });
13067
+ }
13068
+ }
13069
+ }
13070
+ }
12943
13071
  function validateBlocksDeleteInput(input) {
12944
13072
  if (!input || typeof input !== "object") {
12945
13073
  throw new DocumentApiValidationError("INVALID_INPUT", "blocks.delete requires an input object.", {
@@ -12972,16 +13100,57 @@ function validateBlocksDeleteInput(input) {
12972
13100
  });
12973
13101
  }
12974
13102
  }
13103
+ function validateBlockNodeAddress(address2, label) {
13104
+ if (!address2 || typeof address2 !== "object") {
13105
+ throw new DocumentApiValidationError("INVALID_INPUT", `blocks.deleteRange requires a ${label} address.`, {
13106
+ fields: [label]
13107
+ });
13108
+ }
13109
+ const addr = address2;
13110
+ if (addr.kind !== "block") {
13111
+ throw new DocumentApiValidationError("INVALID_INPUT", `blocks.deleteRange ${label} must have kind "block".`, {
13112
+ fields: [`${label}.kind`]
13113
+ });
13114
+ }
13115
+ if (!addr.nodeId || typeof addr.nodeId !== "string") {
13116
+ throw new DocumentApiValidationError("INVALID_INPUT", `blocks.deleteRange ${label} requires a nodeId string.`, {
13117
+ fields: [`${label}.nodeId`]
13118
+ });
13119
+ }
13120
+ if (!addr.nodeType || typeof addr.nodeType !== "string") {
13121
+ throw new DocumentApiValidationError("INVALID_INPUT", `blocks.deleteRange ${label} requires a nodeType string.`, {
13122
+ fields: [`${label}.nodeType`]
13123
+ });
13124
+ }
13125
+ }
13126
+ function validateBlocksDeleteRangeInput(input) {
13127
+ if (!input || typeof input !== "object") {
13128
+ throw new DocumentApiValidationError("INVALID_INPUT", "blocks.deleteRange requires an input object.", {
13129
+ fields: ["input"]
13130
+ });
13131
+ }
13132
+ validateBlockNodeAddress(input.start, "start");
13133
+ validateBlockNodeAddress(input.end, "end");
13134
+ }
13135
+ function executeBlocksList(adapter, input) {
13136
+ validateBlocksListInput(input);
13137
+ return adapter.list(input);
13138
+ }
12975
13139
  function executeBlocksDelete(adapter, input, options) {
12976
13140
  validateBlocksDeleteInput(input);
12977
13141
  return adapter.delete(input, normalizeMutationOptions(options));
12978
13142
  }
12979
- var SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES;
13143
+ function executeBlocksDeleteRange(adapter, input, options) {
13144
+ validateBlocksDeleteRangeInput(input);
13145
+ return adapter.deleteRange(input, normalizeMutationOptions(options));
13146
+ }
13147
+ var SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES;
12980
13148
  var init_blocks = __esm(() => {
12981
13149
  init_base();
12982
13150
  init_errors2();
12983
13151
  SUPPORTED_DELETE_NODE_TYPES = new Set(DELETABLE_BLOCK_NODE_TYPES);
12984
13152
  REJECTED_DELETE_NODE_TYPES = new Set(["tableRow", "tableCell"]);
13153
+ VALID_BLOCK_NODE_TYPES = new Set(BLOCK_NODE_TYPES);
12985
13154
  });
12986
13155
 
12987
13156
  // ../../packages/document-api/src/track-changes/track-changes.ts
@@ -13051,7 +13220,9 @@ function buildDispatchTable(api) {
13051
13220
  insert: (input, options) => api.insert(input, options),
13052
13221
  replace: (input, options) => api.replace(input, options),
13053
13222
  delete: (input, options) => api.delete(input, options),
13223
+ "blocks.list": (input) => api.blocks.list(input),
13054
13224
  "blocks.delete": (input, options) => api.blocks.delete(input, options),
13225
+ "blocks.deleteRange": (input, options) => api.blocks.deleteRange(input, options),
13055
13226
  "format.apply": (input, options) => api.format.apply(input, options),
13056
13227
  ...formatInlineAliasDispatch,
13057
13228
  "styles.paragraph.setStyle": (input, options) => api.styles.paragraph.setStyle(input, options),
@@ -15147,8 +15318,14 @@ function createDocumentApi(adapters) {
15147
15318
  }
15148
15319
  },
15149
15320
  blocks: {
15321
+ list(input) {
15322
+ return executeBlocksList(adapters.blocks, input);
15323
+ },
15150
15324
  delete(input, options) {
15151
15325
  return executeBlocksDelete(adapters.blocks, input, options);
15326
+ },
15327
+ deleteRange(input, options) {
15328
+ return executeBlocksDeleteRange(adapters.blocks, input, options);
15152
15329
  }
15153
15330
  },
15154
15331
  create: {
@@ -16685,7 +16862,9 @@ var init_operation_hints = __esm(() => {
16685
16862
  insert: "inserted text",
16686
16863
  replace: "replaced text",
16687
16864
  delete: "deleted text",
16865
+ "blocks.list": "listed blocks",
16688
16866
  "blocks.delete": "deleted block",
16867
+ "blocks.deleteRange": "deleted block range",
16689
16868
  "format.apply": "applied style",
16690
16869
  ...buildFormatInlineAliasRecord("applied style"),
16691
16870
  ...buildParagraphRecord("updated paragraph formatting"),
@@ -16818,7 +16997,9 @@ var init_operation_hints = __esm(() => {
16818
16997
  insert: "mutationReceipt",
16819
16998
  replace: "mutationReceipt",
16820
16999
  delete: "mutationReceipt",
17000
+ "blocks.list": "plain",
16821
17001
  "blocks.delete": "plain",
17002
+ "blocks.deleteRange": "plain",
16822
17003
  "format.apply": "mutationReceipt",
16823
17004
  ...buildFormatInlineAliasRecord("mutationReceipt"),
16824
17005
  ...buildParagraphRecord("plain"),
@@ -16951,7 +17132,9 @@ var init_operation_hints = __esm(() => {
16951
17132
  insert: null,
16952
17133
  replace: null,
16953
17134
  delete: null,
17135
+ "blocks.list": "result",
16954
17136
  "blocks.delete": "result",
17137
+ "blocks.deleteRange": "result",
16955
17138
  "format.apply": null,
16956
17139
  ...buildFormatInlineAliasRecord(null),
16957
17140
  ...buildParagraphRecord("result"),
@@ -17100,7 +17283,9 @@ var init_operation_hints = __esm(() => {
17100
17283
  insert: "textMutation",
17101
17284
  replace: "textMutation",
17102
17285
  delete: "textMutation",
17286
+ "blocks.list": "blocks",
17103
17287
  "blocks.delete": "blocks",
17288
+ "blocks.deleteRange": "blocks",
17104
17289
  "format.apply": "textMutation",
17105
17290
  ...buildFormatInlineAliasRecord("textMutation"),
17106
17291
  ...buildParagraphRecord("textMutation"),
@@ -17230,10 +17415,11 @@ var init_cli_only_operation_definitions = __esm(() => {
17230
17415
  description: "Open a document and create a persistent editing session. Optionally override the document body with contentOverride + overrideType (markdown, html, or text).",
17231
17416
  requiresDocumentContext: false,
17232
17417
  intentName: "open_document",
17233
- sdkMetadata: { mutates: false, idempotency: "non-idempotent", supportsTrackedMode: false, supportsDryRun: false },
17418
+ sdkMetadata: { mutates: true, idempotency: "non-idempotent", supportsTrackedMode: false, supportsDryRun: false },
17234
17419
  outputSchema: {
17235
17420
  type: "object",
17236
17421
  properties: {
17422
+ active: { type: "boolean" },
17237
17423
  contextId: { type: "string" },
17238
17424
  sessionType: { type: "string" },
17239
17425
  document: {
@@ -17241,9 +17427,11 @@ var init_cli_only_operation_definitions = __esm(() => {
17241
17427
  properties: {
17242
17428
  path: { type: "string" },
17243
17429
  source: { type: "string" },
17430
+ byteLength: { type: "number" },
17244
17431
  revision: { type: "number" }
17245
17432
  }
17246
17433
  },
17434
+ dirty: { type: "boolean" },
17247
17435
  collaboration: {
17248
17436
  type: "object",
17249
17437
  properties: {
@@ -17258,9 +17446,11 @@ var init_cli_only_operation_definitions = __esm(() => {
17258
17446
  bootstrapApplied: { type: "boolean" },
17259
17447
  bootstrapSource: { type: "string" }
17260
17448
  }
17261
- }
17449
+ },
17450
+ openedAt: { type: "string" },
17451
+ updatedAt: { type: "string" }
17262
17452
  },
17263
- required: ["contextId", "sessionType"]
17453
+ required: ["active", "contextId", "sessionType"]
17264
17454
  }
17265
17455
  },
17266
17456
  save: {
@@ -17307,7 +17497,7 @@ var init_cli_only_operation_definitions = __esm(() => {
17307
17497
  description: "Close the active editing session and clean up resources.",
17308
17498
  requiresDocumentContext: false,
17309
17499
  intentName: "close_document",
17310
- sdkMetadata: { mutates: false, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17500
+ sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17311
17501
  outputSchema: {
17312
17502
  type: "object",
17313
17503
  properties: {
@@ -17338,19 +17528,35 @@ var init_cli_only_operation_definitions = __esm(() => {
17338
17528
  outputSchema: {
17339
17529
  type: "object",
17340
17530
  properties: {
17531
+ active: { type: "boolean" },
17341
17532
  contextId: { type: "string" },
17533
+ activeSessionId: { type: "string" },
17534
+ requestedSessionId: { type: "string" },
17535
+ projectRoot: { type: "string" },
17342
17536
  sessionType: { type: "string" },
17343
17537
  dirty: { type: "boolean" },
17344
- revision: { type: "number" },
17345
17538
  document: {
17346
17539
  type: "object",
17347
17540
  properties: {
17348
17541
  path: { type: "string" },
17349
- source: { type: "string" }
17542
+ source: { type: "string" },
17543
+ sourceByteLength: { oneOf: [{ type: "number" }, { type: "null" }] },
17544
+ byteLength: { type: "number" },
17545
+ revision: { type: "number" }
17350
17546
  }
17351
- }
17547
+ },
17548
+ collaboration: {
17549
+ type: "object",
17550
+ properties: {
17551
+ documentId: { type: "string" },
17552
+ url: { type: "string" }
17553
+ }
17554
+ },
17555
+ openedAt: { type: "string" },
17556
+ updatedAt: { type: "string" },
17557
+ lastSavedAt: { type: "string" }
17352
17558
  },
17353
- required: ["contextId"]
17559
+ required: ["active"]
17354
17560
  }
17355
17561
  },
17356
17562
  describe: {
@@ -17464,7 +17670,7 @@ var init_cli_only_operation_definitions = __esm(() => {
17464
17670
  description: "Close a specific editing session by ID.",
17465
17671
  requiresDocumentContext: false,
17466
17672
  intentName: "close_session",
17467
- sdkMetadata: { mutates: false, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17673
+ sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17468
17674
  outputSchema: {
17469
17675
  type: "object",
17470
17676
  properties: {
@@ -17492,7 +17698,7 @@ var init_cli_only_operation_definitions = __esm(() => {
17492
17698
  description: "Set the default session for subsequent commands.",
17493
17699
  requiresDocumentContext: false,
17494
17700
  intentName: "set_default_session",
17495
- sdkMetadata: { mutates: false, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17701
+ sdkMetadata: { mutates: true, idempotency: "conditional", supportsTrackedMode: false, supportsDryRun: false },
17496
17702
  outputSchema: {
17497
17703
  type: "object",
17498
17704
  properties: {
@@ -38237,7 +38443,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
38237
38443
  emptyOptions2 = {};
38238
38444
  });
38239
38445
 
38240
- // ../../packages/superdoc/dist/chunks/SuperConverter-BBGfKYpx.es.js
38446
+ // ../../packages/superdoc/dist/chunks/SuperConverter-Cw5CEerM.es.js
38241
38447
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
38242
38448
  const fieldValue = extension$1.config[field];
38243
38449
  if (typeof fieldValue === "function")
@@ -41780,6 +41986,24 @@ function executeCreateTableOfContents2(adapter, input, options) {
41780
41986
  validateTargetOnlyCreateLocation2(at, "create.tableOfContents");
41781
41987
  return adapter.tableOfContents(normalized, normalizeMutationOptions2(options));
41782
41988
  }
41989
+ function validateBlocksListInput2(input) {
41990
+ if (!input)
41991
+ return;
41992
+ if (input.offset != null && (typeof input.offset !== "number" || input.offset < 0))
41993
+ throw new DocumentApiValidationError2("INVALID_INPUT", "blocks.list offset must be a non-negative number.", { fields: ["offset"] });
41994
+ if (input.limit != null && (typeof input.limit !== "number" || input.limit < 1))
41995
+ throw new DocumentApiValidationError2("INVALID_INPUT", "blocks.list limit must be a positive number.", { fields: ["limit"] });
41996
+ if (input.nodeTypes != null) {
41997
+ if (!Array.isArray(input.nodeTypes) || input.nodeTypes.length === 0)
41998
+ throw new DocumentApiValidationError2("INVALID_INPUT", "blocks.list nodeTypes must be a non-empty array.", { fields: ["nodeTypes"] });
41999
+ for (const nt of input.nodeTypes)
42000
+ if (!VALID_BLOCK_NODE_TYPES2.has(nt))
42001
+ throw new DocumentApiValidationError2("INVALID_INPUT", `blocks.list nodeTypes contains unknown type "${nt}".`, {
42002
+ fields: ["nodeTypes"],
42003
+ nodeType: nt
42004
+ });
42005
+ }
42006
+ }
41783
42007
  function validateBlocksDeleteInput2(input) {
41784
42008
  if (!input || typeof input !== "object")
41785
42009
  throw new DocumentApiValidationError2("INVALID_INPUT", "blocks.delete requires an input object.", { fields: ["input"] });
@@ -41801,10 +42025,35 @@ function validateBlocksDeleteInput2(input) {
41801
42025
  nodeType
41802
42026
  });
41803
42027
  }
42028
+ function validateBlockNodeAddress2(address2, label) {
42029
+ if (!address2 || typeof address2 !== "object")
42030
+ throw new DocumentApiValidationError2("INVALID_INPUT", `blocks.deleteRange requires a ${label} address.`, { fields: [label] });
42031
+ const addr = address2;
42032
+ if (addr.kind !== "block")
42033
+ throw new DocumentApiValidationError2("INVALID_INPUT", `blocks.deleteRange ${label} must have kind "block".`, { fields: [`${label}.kind`] });
42034
+ if (!addr.nodeId || typeof addr.nodeId !== "string")
42035
+ throw new DocumentApiValidationError2("INVALID_INPUT", `blocks.deleteRange ${label} requires a nodeId string.`, { fields: [`${label}.nodeId`] });
42036
+ if (!addr.nodeType || typeof addr.nodeType !== "string")
42037
+ throw new DocumentApiValidationError2("INVALID_INPUT", `blocks.deleteRange ${label} requires a nodeType string.`, { fields: [`${label}.nodeType`] });
42038
+ }
42039
+ function validateBlocksDeleteRangeInput2(input) {
42040
+ if (!input || typeof input !== "object")
42041
+ throw new DocumentApiValidationError2("INVALID_INPUT", "blocks.deleteRange requires an input object.", { fields: ["input"] });
42042
+ validateBlockNodeAddress2(input.start, "start");
42043
+ validateBlockNodeAddress2(input.end, "end");
42044
+ }
42045
+ function executeBlocksList2(adapter, input) {
42046
+ validateBlocksListInput2(input);
42047
+ return adapter.list(input);
42048
+ }
41804
42049
  function executeBlocksDelete2(adapter, input, options) {
41805
42050
  validateBlocksDeleteInput2(input);
41806
42051
  return adapter.delete(input, normalizeMutationOptions2(options));
41807
42052
  }
42053
+ function executeBlocksDeleteRange2(adapter, input, options) {
42054
+ validateBlocksDeleteRangeInput2(input);
42055
+ return adapter.deleteRange(input, normalizeMutationOptions2(options));
42056
+ }
41808
42057
  function executeTrackChangesList2(adapter, input) {
41809
42058
  return adapter.list(input);
41810
42059
  }
@@ -41865,7 +42114,9 @@ function buildDispatchTable2(api) {
41865
42114
  insert: (input, options) => api.insert(input, options),
41866
42115
  replace: (input, options) => api.replace(input, options),
41867
42116
  delete: (input, options) => api.delete(input, options),
42117
+ "blocks.list": (input) => api.blocks.list(input),
41868
42118
  "blocks.delete": (input, options) => api.blocks.delete(input, options),
42119
+ "blocks.deleteRange": (input, options) => api.blocks.deleteRange(input, options),
41869
42120
  "format.apply": (input, options) => api.format.apply(input, options),
41870
42121
  ...formatInlineAliasDispatch,
41871
42122
  "styles.paragraph.setStyle": (input, options) => api.styles.paragraph.setStyle(input, options),
@@ -43678,9 +43929,17 @@ function createDocumentApi2(adapters) {
43678
43929
  return executeTrackChangesDecide2(adapters.trackChanges, input, options);
43679
43930
  }
43680
43931
  },
43681
- blocks: { delete(input, options) {
43682
- return executeBlocksDelete2(adapters.blocks, input, options);
43683
- } },
43932
+ blocks: {
43933
+ list(input) {
43934
+ return executeBlocksList2(adapters.blocks, input);
43935
+ },
43936
+ delete(input, options) {
43937
+ return executeBlocksDelete2(adapters.blocks, input, options);
43938
+ },
43939
+ deleteRange(input, options) {
43940
+ return executeBlocksDeleteRange2(adapters.blocks, input, options);
43941
+ }
43942
+ },
43684
43943
  create: {
43685
43944
  paragraph(input, options) {
43686
43945
  return executeCreateParagraph2(adapters.create, input, options);
@@ -58454,19 +58713,18 @@ function importCommentData({ docx, editor, converter }) {
58454
58713
  }
58455
58714
  return extendedComments;
58456
58715
  }
58457
- function importFootnoteData({ docx, editor, converter, nodeListHandler, numbering } = {}) {
58716
+ function importNoteEntries({ partXml, childElementName, filename, docx, editor, converter, nodeListHandler, numbering }) {
58458
58717
  const handler$1 = nodeListHandler || defaultNodeListHandler();
58459
- const footnotes = docx?.["word/footnotes.xml"];
58460
- if (!footnotes?.elements?.length)
58718
+ if (!partXml?.elements?.length)
58461
58719
  return [];
58462
- const root2 = footnotes.elements[0];
58463
- const footnoteElements = (Array.isArray(root2?.elements) ? root2.elements : []).filter((el) => el?.name === "w:footnote");
58464
- if (footnoteElements.length === 0)
58720
+ const root2 = partXml.elements[0];
58721
+ const noteElements = (Array.isArray(root2?.elements) ? root2.elements : []).filter((el) => el?.name === childElementName);
58722
+ if (noteElements.length === 0)
58465
58723
  return [];
58466
58724
  const results = [];
58467
58725
  const lists = {};
58468
58726
  const inlineDocumentFonts = [];
58469
- footnoteElements.forEach((el) => {
58727
+ noteElements.forEach((el) => {
58470
58728
  const idRaw = el?.attributes?.["w:id"];
58471
58729
  if (idRaw === undefined || idRaw === null)
58472
58730
  return;
@@ -58495,7 +58753,7 @@ function importFootnoteData({ docx, editor, converter, nodeListHandler, numberin
58495
58753
  numbering,
58496
58754
  lists,
58497
58755
  inlineDocumentFonts,
58498
- filename: "footnotes.xml",
58756
+ filename,
58499
58757
  path: [el]
58500
58758
  }));
58501
58759
  results.push({
@@ -58507,6 +58765,30 @@ function importFootnoteData({ docx, editor, converter, nodeListHandler, numberin
58507
58765
  });
58508
58766
  return results;
58509
58767
  }
58768
+ function importFootnoteData({ docx, editor, converter, nodeListHandler, numbering } = {}) {
58769
+ return importNoteEntries({
58770
+ partXml: docx?.["word/footnotes.xml"],
58771
+ childElementName: "w:footnote",
58772
+ filename: "footnotes.xml",
58773
+ docx,
58774
+ editor,
58775
+ converter,
58776
+ nodeListHandler,
58777
+ numbering
58778
+ });
58779
+ }
58780
+ function importEndnoteData({ docx, editor, converter, nodeListHandler, numbering } = {}) {
58781
+ return importNoteEntries({
58782
+ partXml: docx?.["word/endnotes.xml"],
58783
+ childElementName: "w:endnote",
58784
+ filename: "endnotes.xml",
58785
+ docx,
58786
+ editor,
58787
+ converter,
58788
+ nodeListHandler,
58789
+ numbering
58790
+ });
58791
+ }
58510
58792
  function toIdentityValue(value) {
58511
58793
  if (typeof value === "string" && value.length > 0)
58512
58794
  return value;
@@ -62698,7 +62980,7 @@ var isRegExp = (value) => {
62698
62980
  tracked: false,
62699
62981
  carrier: runAttributeCarrier2(runPropertyKey ?? key),
62700
62982
  schema
62701
- }), INLINE_PROPERTY_REGISTRY2, INLINE_PROPERTY_KEY_SET2, INLINE_PROPERTY_BY_KEY2, UNDERLINE_OBJECT_ALLOWED_KEYS2, SHADING_ALLOWED_KEYS2, BORDER_ALLOWED_KEYS2, FIT_TEXT_ALLOWED_KEYS2, LANG_ALLOWED_KEYS2, RFONTS_ALLOWED_KEYS2, EAST_ASIAN_LAYOUT_ALLOWED_KEYS2, STYLISTIC_SET_ALLOWED_KEYS2, VERT_ALIGN_VALUES2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_NOT_FOUND_COMMAND_TRACKED2, T_IMAGE_COMMAND2, T_CC_READ2, T_CC_MUTATION2, T_CC_TYPED2, T_CC_TYPED_READ2, T_CC_RAW2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, T_HEADER_FOOTER_MUTATION2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS2, OPERATION_DEFINITIONS2, OPERATION_IDS2, COMMAND_CATALOG3, PARAGRAPH_ALIGNMENTS2, TAB_STOP_ALIGNMENTS2, TAB_STOP_LEADERS2, BORDER_SIDES2, CLEAR_BORDER_SIDES2, LINE_RULES2, PARAGRAPH_BLOCK_TYPES2, SET_STYLE_KEYS2, CLEAR_STYLE_KEYS2, RESET_DIRECT_FORMATTING_KEYS2, SET_ALIGNMENT_KEYS2, CLEAR_ALIGNMENT_KEYS2, SET_INDENTATION_KEYS2, CLEAR_INDENTATION_KEYS2, SET_SPACING_KEYS2, CLEAR_SPACING_KEYS2, SET_KEEP_OPTIONS_KEYS2, SET_OUTLINE_LEVEL_KEYS2, SET_FLOW_OPTIONS_KEYS2, SET_TAB_STOP_KEYS2, CLEAR_TAB_STOP_KEYS2, CLEAR_ALL_TAB_STOPS_KEYS2, SET_BORDER_KEYS2, CLEAR_BORDER_KEYS2, SET_SHADING_KEYS2, CLEAR_SHADING_KEYS2, ST_ON_OFF_ON_VALUES2, ST_ON_OFF_OFF_VALUES2, ST_UNDERLINE_VALUES2, ST_UNDERLINE_VALUE_SET2, ST_VERTICAL_ALIGN_RUN2, ST_EM2, ST_TEXT_ALIGNMENT2, ST_TEXT_DIRECTION2, ST_TEXTBOX_TIGHT_WRAP2, ST_TEXT_TRANSFORM2, ST_JUSTIFICATION2, FONT_FAMILY_SCHEMA2, COLOR_SCHEMA2, SPACING_SCHEMA2, INDENT_SCHEMA2, UNDERLINE_SCHEMA2, BORDER_PROPERTIES_SCHEMA2, SHADING_SCHEMA2, LANG_SCHEMA2, EAST_ASIAN_LAYOUT_SCHEMA2, FIT_TEXT_SCHEMA2, NUMBERING_PROPERTIES_SCHEMA2, FRAME_PR_SCHEMA2, PARAGRAPH_BORDERS_SCHEMA2, TAB_STOP_SCHEMA2, PROPERTY_REGISTRY3, ALLOWED_KEYS_BY_CHANNEL2, PROPERTY_INDEX2, EXCLUDED_KEYS2, INPUT_ALLOWED_KEYS2, TARGET_ALLOWED_KEYS2, OPTIONS_ALLOWED_KEYS2, VALID_CHANNELS2, Z_ORDER_RELATIVE_HEIGHT_MAX2 = 4294967295, nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, rangeSchema2, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdSelectorSchema2, sdAddressSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, listKindSchema2, listInsertPositionSchema2, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, LEGACY_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, LEGACY_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, TABLE_LOCATOR_OPS2, ROW_LOCATOR_OPS2, COLUMN_LOCATOR_OPS2, MERGE_RANGE_LOCATOR_OPS2, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS3, HEADER_FOOTER_VARIANTS3, LINE_NUMBER_RESTARTS2, PAGE_NUMBER_FORMATS2, PAGE_BORDER_DISPLAYS2, PAGE_BORDER_OFFSET_FROM_VALUES2, PAGE_BORDER_Z_ORDER_VALUES2, VALID_WRAP_TYPES2, VALID_WRAP_SIDES2, VALID_IMAGE_SIZE_UNITS2, PATCH_FIELDS2, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$215) => ({
62983
+ }), INLINE_PROPERTY_REGISTRY2, INLINE_PROPERTY_KEY_SET2, INLINE_PROPERTY_BY_KEY2, UNDERLINE_OBJECT_ALLOWED_KEYS2, SHADING_ALLOWED_KEYS2, BORDER_ALLOWED_KEYS2, FIT_TEXT_ALLOWED_KEYS2, LANG_ALLOWED_KEYS2, RFONTS_ALLOWED_KEYS2, EAST_ASIAN_LAYOUT_ALLOWED_KEYS2, STYLISTIC_SET_ALLOWED_KEYS2, VERT_ALIGN_VALUES2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, T_NOT_FOUND_COMMAND_TRACKED2, T_IMAGE_COMMAND2, T_CC_READ2, T_CC_MUTATION2, T_CC_TYPED2, T_CC_TYPED_READ2, T_CC_RAW2, T_QUERY_MATCH2, T_SECTION_CREATE2, T_SECTION_READ2, T_PARAGRAPH_MUTATION2, T_SECTION_MUTATION2, T_SECTION_SETTINGS_MUTATION2, T_HEADER_FOOTER_MUTATION2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS2, OPERATION_DEFINITIONS2, OPERATION_IDS2, COMMAND_CATALOG3, PARAGRAPH_ALIGNMENTS2, TAB_STOP_ALIGNMENTS2, TAB_STOP_LEADERS2, BORDER_SIDES2, CLEAR_BORDER_SIDES2, LINE_RULES2, PARAGRAPH_BLOCK_TYPES2, SET_STYLE_KEYS2, CLEAR_STYLE_KEYS2, RESET_DIRECT_FORMATTING_KEYS2, SET_ALIGNMENT_KEYS2, CLEAR_ALIGNMENT_KEYS2, SET_INDENTATION_KEYS2, CLEAR_INDENTATION_KEYS2, SET_SPACING_KEYS2, CLEAR_SPACING_KEYS2, SET_KEEP_OPTIONS_KEYS2, SET_OUTLINE_LEVEL_KEYS2, SET_FLOW_OPTIONS_KEYS2, SET_TAB_STOP_KEYS2, CLEAR_TAB_STOP_KEYS2, CLEAR_ALL_TAB_STOPS_KEYS2, SET_BORDER_KEYS2, CLEAR_BORDER_KEYS2, SET_SHADING_KEYS2, CLEAR_SHADING_KEYS2, ST_ON_OFF_ON_VALUES2, ST_ON_OFF_OFF_VALUES2, ST_UNDERLINE_VALUES2, ST_UNDERLINE_VALUE_SET2, ST_VERTICAL_ALIGN_RUN2, ST_EM2, ST_TEXT_ALIGNMENT2, ST_TEXT_DIRECTION2, ST_TEXTBOX_TIGHT_WRAP2, ST_TEXT_TRANSFORM2, ST_JUSTIFICATION2, FONT_FAMILY_SCHEMA2, COLOR_SCHEMA2, SPACING_SCHEMA2, INDENT_SCHEMA2, UNDERLINE_SCHEMA2, BORDER_PROPERTIES_SCHEMA2, SHADING_SCHEMA2, LANG_SCHEMA2, EAST_ASIAN_LAYOUT_SCHEMA2, FIT_TEXT_SCHEMA2, NUMBERING_PROPERTIES_SCHEMA2, FRAME_PR_SCHEMA2, PARAGRAPH_BORDERS_SCHEMA2, TAB_STOP_SCHEMA2, PROPERTY_REGISTRY3, ALLOWED_KEYS_BY_CHANNEL2, PROPERTY_INDEX2, EXCLUDED_KEYS2, INPUT_ALLOWED_KEYS2, TARGET_ALLOWED_KEYS2, OPTIONS_ALLOWED_KEYS2, VALID_CHANNELS2, Z_ORDER_RELATIVE_HEIGHT_MAX2 = 4294967295, nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, rangeSchema2, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdSelectorSchema2, sdAddressSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, listKindSchema2, listInsertPositionSchema2, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, tableCreateLocationSchema2, formatInlineAliasOperationSchemas2, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureSchema2, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, LEGACY_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, LEGACY_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, VALID_BLOCK_NODE_TYPES2, TABLE_LOCATOR_OPS2, ROW_LOCATOR_OPS2, COLUMN_LOCATOR_OPS2, MERGE_RANGE_LOCATOR_OPS2, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT2 = 250, SECTION_BREAK_TYPES3, SECTION_ORIENTATIONS2, SECTION_VERTICAL_ALIGNS2, SECTION_DIRECTIONS2, HEADER_FOOTER_KINDS3, HEADER_FOOTER_VARIANTS3, LINE_NUMBER_RESTARTS2, PAGE_NUMBER_FORMATS2, PAGE_BORDER_DISPLAYS2, PAGE_BORDER_OFFSET_FROM_VALUES2, PAGE_BORDER_Z_ORDER_VALUES2, VALID_WRAP_TYPES2, VALID_WRAP_SIDES2, VALID_IMAGE_SIZE_UNITS2, PATCH_FIELDS2, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$215) => ({
62702
62984
  handlerName,
62703
62985
  handler: (params) => {
62704
62986
  const { nodes } = params;
@@ -73633,6 +73915,13 @@ var isRegExp = (value) => {
73633
73915
  editor,
73634
73916
  numbering
73635
73917
  });
73918
+ const endnotes = importEndnoteData({
73919
+ docx,
73920
+ nodeListHandler,
73921
+ converter,
73922
+ editor,
73923
+ numbering
73924
+ });
73636
73925
  const translatedLinkedStyles = translateStyleDefinitions(docx);
73637
73926
  const translatedNumbering = translateNumberingDefinitions(docx);
73638
73927
  const importDiagnosticsCollectionId = startCollection();
@@ -73668,6 +73957,7 @@ var isRegExp = (value) => {
73668
73957
  pageStyles: getDocumentStyles(node3, docx, converter, editor, numbering, translatedNumbering, translatedLinkedStyles),
73669
73958
  comments,
73670
73959
  footnotes,
73960
+ endnotes,
73671
73961
  inlineDocumentFonts,
73672
73962
  linkedStyles: getStyleDefinitions(docx, converter, editor),
73673
73963
  translatedLinkedStyles,
@@ -74570,7 +74860,7 @@ var isRegExp = (value) => {
74570
74860
  state.kern = kernNode.attributes["w:val"];
74571
74861
  }
74572
74862
  }, SuperConverter;
74573
- var init_SuperConverter_BBGfKYpx_es = __esm(() => {
74863
+ var init_SuperConverter_Cw5CEerM_es = __esm(() => {
74574
74864
  init_rolldown_runtime_B2q5OVn9_es();
74575
74865
  init_jszip_ChlR43oI_es();
74576
74866
  init_xml_js_DLE8mr0n_es();
@@ -77502,7 +77792,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
77502
77792
  },
77503
77793
  find: {
77504
77794
  memberPath: "find",
77505
- description: "Search the document for text or node matches using SDM/1 selectors.",
77795
+ description: "Search the document for text or node matches using SDM/1 selectors. Returns discovery-grade results — for mutation targeting, use query.match instead.",
77506
77796
  expectedResult: "Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }).",
77507
77797
  requiresDocumentContext: true,
77508
77798
  metadata: readOperation2({
@@ -77606,7 +77896,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
77606
77896
  },
77607
77897
  insert: {
77608
77898
  memberPath: "insert",
77609
- description: "Insert content at a target position, or at the end of the document when target is omitted. Accepts two input shapes: legacy string-based (value + type) or structural SDFragment (content). Supports text (default), markdown, and html content types via the `type` field in legacy mode. Structural mode accepts an SDFragment with typed nodes (paragraphs, tables, images, etc.).",
77899
+ description: "Insert inline content at a text position within an existing block, or at the end of the document when target is omitted. This is NOT for creating sibling blocks — use create.paragraph, create.heading, or lists.insert for that. Accepts two input shapes: legacy string-based (value + type) or structural SDFragment (content). Supports text (default), markdown, and html content types via the `type` field in legacy mode. Structural mode accepts an SDFragment with typed nodes (paragraphs, tables, images, etc.).",
77610
77900
  expectedResult: "Returns a TextMutationReceipt with applied status; receipt reports NO_OP if the insertion point is invalid or content is empty.",
77611
77901
  requiresDocumentContext: true,
77612
77902
  metadata: mutationOperation2({
@@ -77695,10 +77985,20 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
77695
77985
  referenceDocPath: "delete.mdx",
77696
77986
  referenceGroup: "core"
77697
77987
  },
77988
+ "blocks.list": {
77989
+ memberPath: "blocks.list",
77990
+ description: "List top-level blocks in document order with IDs, types, and text previews. Supports pagination via offset/limit and optional nodeType filtering.",
77991
+ expectedResult: "Returns a BlocksListResult with total block count, an ordered array of block entries (ordinal, nodeId, nodeType, textPreview, isEmpty), and the current document revision.",
77992
+ requiresDocumentContext: true,
77993
+ metadata: readOperation2({ throws: ["INVALID_INPUT"] }),
77994
+ referenceDocPath: "blocks/list.mdx",
77995
+ referenceGroup: "blocks",
77996
+ essential: true
77997
+ },
77698
77998
  "blocks.delete": {
77699
77999
  memberPath: "blocks.delete",
77700
78000
  description: "Delete an entire block node (paragraph, heading, list item, table, image, or sdt) deterministically.",
77701
- expectedResult: "Returns a BlocksDeleteResult receipt confirming the block was removed from the document.",
78001
+ expectedResult: "Returns a BlocksDeleteResult receipt confirming the block was removed, including a deletedBlock summary with ordinal, nodeType, and textPreview.",
77702
78002
  requiresDocumentContext: true,
77703
78003
  metadata: mutationOperation2({
77704
78004
  idempotency: "conditional",
@@ -77717,6 +78017,28 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
77717
78017
  referenceDocPath: "blocks/delete.mdx",
77718
78018
  referenceGroup: "blocks"
77719
78019
  },
78020
+ "blocks.deleteRange": {
78021
+ memberPath: "blocks.deleteRange",
78022
+ description: "Delete a contiguous range of top-level blocks between two endpoints (inclusive). Both endpoints must be direct children of the document node. Supports dry-run preview.",
78023
+ expectedResult: "Returns a BlocksDeleteRangeResult with deletedCount, deletedBlocks array (each with ordinal, nodeId, nodeType, textPreview), before/after revision, and dryRun flag.",
78024
+ requiresDocumentContext: true,
78025
+ metadata: mutationOperation2({
78026
+ idempotency: "conditional",
78027
+ supportsDryRun: true,
78028
+ supportsTrackedMode: false,
78029
+ possibleFailureCodes: NONE_FAILURES2,
78030
+ throws: [
78031
+ "TARGET_NOT_FOUND",
78032
+ "AMBIGUOUS_TARGET",
78033
+ "INVALID_TARGET",
78034
+ "INVALID_INPUT",
78035
+ "CAPABILITY_UNAVAILABLE",
78036
+ "INTERNAL_ERROR"
78037
+ ]
78038
+ }),
78039
+ referenceDocPath: "blocks/delete-range.mdx",
78040
+ referenceGroup: "blocks"
78041
+ },
77720
78042
  "format.apply": {
77721
78043
  memberPath: "format.apply",
77722
78044
  description: "Apply inline run-property patch changes to the target range with explicit set/clear semantics.",
@@ -77760,7 +78082,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
77760
78082
  },
77761
78083
  "create.paragraph": {
77762
78084
  memberPath: "create.paragraph",
77763
- description: "Create a new paragraph at the target position.",
78085
+ description: "Create a standalone paragraph at the target position. To add a list item, use lists.insert instead.",
77764
78086
  expectedResult: "Returns a CreateParagraphResult with the new paragraph block ID and address.",
77765
78087
  requiresDocumentContext: true,
77766
78088
  metadata: mutationOperation2({
@@ -78466,7 +78788,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
78466
78788
  },
78467
78789
  "lists.insert": {
78468
78790
  memberPath: "lists.insert",
78469
- description: "Insert a new list at the target position.",
78791
+ description: "Insert a new list item before or after an existing list item. The new item inherits the target list context.",
78470
78792
  expectedResult: "Returns a ListsInsertResult with the new list item address and block ID.",
78471
78793
  requiresDocumentContext: true,
78472
78794
  metadata: mutationOperation2({
@@ -79092,7 +79414,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
79092
79414
  },
79093
79415
  "query.match": {
79094
79416
  memberPath: "query.match",
79095
- description: "Deterministic selector-based search with cardinality contracts for mutation targeting.",
79417
+ description: "Deterministic selector-based search returning mutation-grade addresses and text ranges. Use this to discover targets before any mutation.",
79096
79418
  expectedResult: "Returns a QueryMatchOutput with the resolved target address and cardinality metadata.",
79097
79419
  requiresDocumentContext: true,
79098
79420
  metadata: readOperation2({
@@ -79983,7 +80305,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
79983
80305
  "history.undo": {
79984
80306
  memberPath: "history.undo",
79985
80307
  description: "Undo the most recent history-safe mutation in the active editor.",
79986
- expectedResult: "Returns a HistoryActionResult with noop flag and revision before/after; noop is true when the undo stack is empty.",
80308
+ expectedResult: "Returns a HistoryActionResult with noop flag, reason (EMPTY_UNDO_STACK | NO_EFFECT when noop), and revision before/after.",
79987
80309
  requiresDocumentContext: true,
79988
80310
  metadata: mutationOperation2({
79989
80311
  idempotency: "non-idempotent",
@@ -79999,7 +80321,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
79999
80321
  "history.redo": {
80000
80322
  memberPath: "history.redo",
80001
80323
  description: "Redo the most recently undone action in the active editor.",
80002
- expectedResult: "Returns a HistoryActionResult with noop flag and revision before/after; noop is true when the redo stack is empty.",
80324
+ expectedResult: "Returns a HistoryActionResult with noop flag, reason (EMPTY_REDO_STACK | NO_EFFECT when noop), and revision before/after.",
80003
80325
  requiresDocumentContext: true,
80004
80326
  metadata: mutationOperation2({
80005
80327
  idempotency: "non-idempotent",
@@ -84538,13 +84860,107 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
84538
84860
  }, ["target", "text"]), sdMutationResultSchemaFor2("replace"), sdMutationFailureSchemaFor2("replace"), objectSchema2({ target: textAddressSchema2 }, ["target"]), textMutationResultSchemaFor2("delete"), textMutationFailureSchemaFor2("delete"), objectSchema2({
84539
84861
  target: textAddressSchema2,
84540
84862
  inline: buildInlineRunPatchSchema2()
84541
- }, ["target", "inline"]), textMutationResultSchemaFor2("format.apply"), textMutationFailureSchemaFor2("format.apply"), { ...formatInlineAliasOperationSchemas2 }, objectSchema2({ target: deletableBlockNodeAddressSchema2 }, ["target"]), objectSchema2({
84863
+ }, ["target", "inline"]), textMutationResultSchemaFor2("format.apply"), textMutationFailureSchemaFor2("format.apply"), { ...formatInlineAliasOperationSchemas2 }, objectSchema2({
84864
+ offset: {
84865
+ type: "number",
84866
+ minimum: 0
84867
+ },
84868
+ limit: {
84869
+ type: "number",
84870
+ minimum: 1
84871
+ },
84872
+ nodeTypes: {
84873
+ type: "array",
84874
+ items: { enum: [...blockNodeTypeValues2] }
84875
+ }
84876
+ }), objectSchema2({
84877
+ total: { type: "number" },
84878
+ blocks: {
84879
+ type: "array",
84880
+ items: objectSchema2({
84881
+ ordinal: { type: "number" },
84882
+ nodeId: { type: "string" },
84883
+ nodeType: { enum: [...blockNodeTypeValues2] },
84884
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] },
84885
+ isEmpty: { type: "boolean" }
84886
+ }, [
84887
+ "ordinal",
84888
+ "nodeId",
84889
+ "nodeType",
84890
+ "textPreview",
84891
+ "isEmpty"
84892
+ ])
84893
+ },
84894
+ revision: { type: "string" }
84895
+ }, [
84896
+ "total",
84897
+ "blocks",
84898
+ "revision"
84899
+ ]), objectSchema2({ target: deletableBlockNodeAddressSchema2 }, ["target"]), objectSchema2({
84542
84900
  success: { const: true },
84543
- deleted: deletableBlockNodeAddressSchema2
84901
+ deleted: deletableBlockNodeAddressSchema2,
84902
+ deletedBlock: objectSchema2({
84903
+ ordinal: { type: "number" },
84904
+ nodeId: { type: "string" },
84905
+ nodeType: { type: "string" },
84906
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
84907
+ })
84544
84908
  }, ["success", "deleted"]), objectSchema2({
84545
84909
  success: { const: true },
84546
- deleted: deletableBlockNodeAddressSchema2
84910
+ deleted: deletableBlockNodeAddressSchema2,
84911
+ deletedBlock: objectSchema2({
84912
+ ordinal: { type: "number" },
84913
+ nodeId: { type: "string" },
84914
+ nodeType: { type: "string" },
84915
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
84916
+ })
84547
84917
  }, ["success", "deleted"]), preApplyFailureResultSchemaFor2("blocks.delete"), objectSchema2({
84918
+ start: blockNodeAddressSchema2,
84919
+ end: blockNodeAddressSchema2
84920
+ }, ["start", "end"]), objectSchema2({
84921
+ success: { const: true },
84922
+ deletedCount: { type: "number" },
84923
+ deletedBlocks: {
84924
+ type: "array",
84925
+ items: objectSchema2({
84926
+ ordinal: { type: "number" },
84927
+ nodeId: { type: "string" },
84928
+ nodeType: { type: "string" },
84929
+ textPreview: { oneOf: [{ type: "string" }, { type: "null" }] }
84930
+ }, [
84931
+ "ordinal",
84932
+ "nodeId",
84933
+ "nodeType",
84934
+ "textPreview"
84935
+ ])
84936
+ },
84937
+ revision: objectSchema2({
84938
+ before: { type: "string" },
84939
+ after: { type: "string" }
84940
+ }, ["before", "after"]),
84941
+ dryRun: { type: "boolean" }
84942
+ }, [
84943
+ "success",
84944
+ "deletedCount",
84945
+ "deletedBlocks",
84946
+ "revision",
84947
+ "dryRun"
84948
+ ]), objectSchema2({
84949
+ success: { const: true },
84950
+ deletedCount: { type: "number" },
84951
+ deletedBlocks: { type: "array" },
84952
+ revision: objectSchema2({
84953
+ before: { type: "string" },
84954
+ after: { type: "string" }
84955
+ }, ["before", "after"]),
84956
+ dryRun: { type: "boolean" }
84957
+ }, [
84958
+ "success",
84959
+ "deletedCount",
84960
+ "deletedBlocks",
84961
+ "revision",
84962
+ "dryRun"
84963
+ ]), preApplyFailureResultSchemaFor2("blocks.deleteRange"), objectSchema2({
84548
84964
  target: paragraphTargetSchema2,
84549
84965
  styleId: {
84550
84966
  type: "string",
@@ -87201,6 +87617,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
87201
87617
  ];
87202
87618
  SUPPORTED_DELETE_NODE_TYPES2 = new Set(DELETABLE_BLOCK_NODE_TYPES2);
87203
87619
  REJECTED_DELETE_NODE_TYPES2 = new Set(["tableRow", "tableCell"]);
87620
+ VALID_BLOCK_NODE_TYPES2 = new Set(BLOCK_NODE_TYPES2);
87204
87621
  TABLE_LOCATOR_OPS2 = new Set([
87205
87622
  "tables.delete",
87206
87623
  "tables.clearContents",
@@ -107945,6 +108362,7 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
107945
108362
  this.numbering = result.numbering;
107946
108363
  this.comments = result.comments;
107947
108364
  this.footnotes = result.footnotes;
108365
+ this.endnotes = result.endnotes ?? [];
107948
108366
  this.linkedStyles = result.linkedStyles;
107949
108367
  this.translatedLinkedStyles = result.translatedLinkedStyles;
107950
108368
  this.translatedNumbering = result.translatedNumbering;
@@ -108247,6 +108665,16 @@ var init_SuperConverter_BBGfKYpx_es = __esm(() => {
108247
108665
  content: [...schema]
108248
108666
  };
108249
108667
  }
108668
+ reimportNotePart(partId) {
108669
+ if (!this.convertedXml?.[partId])
108670
+ return [];
108671
+ return (partId === "word/endnotes.xml" ? importEndnoteData : importFootnoteData)({
108672
+ docx: this.convertedXml,
108673
+ editor: {},
108674
+ converter: this,
108675
+ numbering: this.numbering
108676
+ });
108677
+ }
108250
108678
  createDefaultHeader(variant = "default") {
108251
108679
  if (typeof variant !== "string")
108252
108680
  throw new TypeError(`variant must be a string, received ${typeof variant}`);
@@ -134644,7 +135072,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
134644
135072
  init_remark_gfm_z_sDF4ss_es();
134645
135073
  });
134646
135074
 
134647
- // ../../packages/superdoc/dist/chunks/src-BDv_tIia.es.js
135075
+ // ../../packages/superdoc/dist/chunks/src-BV6PERs7.es.js
134648
135076
  function deleteProps(obj, propOrProps) {
134649
135077
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
134650
135078
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -140516,7 +140944,7 @@ function createPartPublisher(editor, ydoc, options = {}) {
140516
140944
  destroy
140517
140945
  };
140518
140946
  }
140519
- function getConverter$10(editor) {
140947
+ function getConverter$12(editor) {
140520
140948
  return editor.converter;
140521
140949
  }
140522
140950
  function isHeaderPartId(partId) {
@@ -140551,7 +140979,7 @@ function ensureHeaderFooterDescriptor(partId, sectionId) {
140551
140979
  };
140552
140980
  },
140553
140981
  afterCommit(ctx$1) {
140554
- const converter = getConverter$10(ctx$1.editor);
140982
+ const converter = getConverter$12(ctx$1.editor);
140555
140983
  if (!converter)
140556
140984
  return;
140557
140985
  const resolvedSectionId = ctx$1.sectionId ?? sectionId;
@@ -140571,7 +140999,7 @@ function ensureHeaderFooterDescriptor(partId, sectionId) {
140571
140999
  refreshActiveSubEditors(converter, type, resolvedSectionId);
140572
141000
  },
140573
141001
  onDelete(ctx$1) {
140574
- const converter = getConverter$10(ctx$1.editor);
141002
+ const converter = getConverter$12(ctx$1.editor);
140575
141003
  if (!converter)
140576
141004
  return;
140577
141005
  const resolvedSectionId = ctx$1.sectionId ?? sectionId;
@@ -140618,11 +141046,11 @@ function registerHeaderFooterInvalidationHandler(partId) {
140618
141046
  } catch {}
140619
141047
  });
140620
141048
  }
140621
- function getConverter$9(editor) {
141049
+ function getConverter$11(editor) {
140622
141050
  return editor.converter;
140623
141051
  }
140624
141052
  function resolvePartIdFromSectionId(editor, sectionId) {
140625
- const relsRoot = getConverter$9(editor)?.convertedXml?.["word/_rels/document.xml.rels"]?.elements?.find((el) => el.name === "Relationships");
141053
+ const relsRoot = getConverter$11(editor)?.convertedXml?.["word/_rels/document.xml.rels"]?.elements?.find((el) => el.name === "Relationships");
140626
141054
  if (!relsRoot?.elements)
140627
141055
  return null;
140628
141056
  for (const el of relsRoot.elements) {
@@ -140664,14 +141092,14 @@ function resolveHeaderFooterRId(partId, relsData, editor) {
140664
141092
  return rId;
140665
141093
  }
140666
141094
  if (editor) {
140667
- const localRels = getConverter$9(editor)?.convertedXml?.["word/_rels/document.xml.rels"];
141095
+ const localRels = getConverter$11(editor)?.convertedXml?.["word/_rels/document.xml.rels"];
140668
141096
  if (localRels)
140669
141097
  return resolveRIdFromRelsData(localRels, partId);
140670
141098
  }
140671
141099
  return null;
140672
141100
  }
140673
141101
  function exportSubEditorToPart(mainEditor, subEditor, sectionId, type) {
140674
- const converter = getConverter$9(mainEditor);
141102
+ const converter = getConverter$11(mainEditor);
140675
141103
  if (!converter?.exportToXmlJson)
140676
141104
  return false;
140677
141105
  const partId = resolvePartIdFromSectionId(mainEditor, sectionId);
@@ -140734,7 +141162,7 @@ function exportSubEditorToPart(mainEditor, subEditor, sectionId, type) {
140734
141162
  }
140735
141163
  }
140736
141164
  function registerExistingHeaderFooterDescriptors(editor) {
140737
- const converter = getConverter$9(editor);
141165
+ const converter = getConverter$11(editor);
140738
141166
  if (!converter?.convertedXml)
140739
141167
  return;
140740
141168
  const relsRoot = converter.convertedXml["word/_rels/document.xml.rels"]?.elements?.find((el) => el.name === "Relationships");
@@ -143175,7 +143603,18 @@ function buildTextMutationResolution(input2) {
143175
143603
  };
143176
143604
  }
143177
143605
  function findTextBlockCandidates(index2, blockId) {
143178
- return index2.candidates.filter((candidate) => candidate.nodeId === blockId && isTextBlockCandidate(candidate));
143606
+ const primary = index2.candidates.filter((c) => c.nodeId === blockId && isTextBlockCandidate(c));
143607
+ if (primary.length > 0)
143608
+ return primary;
143609
+ try {
143610
+ const resolved = findBlockByNodeIdOnly(index2, blockId);
143611
+ if (isTextBlockCandidate(resolved))
143612
+ return [resolved];
143613
+ } catch (e) {
143614
+ if (e instanceof DocumentApiAdapterError && e.code === "AMBIGUOUS_TARGET")
143615
+ throw e;
143616
+ }
143617
+ return [];
143179
143618
  }
143180
143619
  function assertUnambiguous(matches2, blockId) {
143181
143620
  if (matches2.length > 1)
@@ -143875,11 +144314,11 @@ function pxToInches$1(value) {
143875
144314
  function buildSectionId(index2) {
143876
144315
  return `section-${index2}`;
143877
144316
  }
143878
- function getConverter$8(editor) {
144317
+ function getConverter$10(editor) {
143879
144318
  return editor.converter;
143880
144319
  }
143881
144320
  function getBodySectPrFromEditor(editor) {
143882
- const converter = getConverter$8(editor);
144321
+ const converter = getConverter$10(editor);
143883
144322
  if (isSectPrElement$1(converter?.bodySectPr))
143884
144323
  return cloneXmlElement(converter.bodySectPr);
143885
144324
  const docAttrs = editor.state.doc.attrs ?? {};
@@ -143928,7 +144367,7 @@ function resolveAnalysisDoc(editor, paragraphs) {
143928
144367
  return buildAnalysisDocFromParagraphs(paragraphs);
143929
144368
  }
143930
144369
  function getSettingsRoot(editor) {
143931
- const settingsPart = getConverter$8(editor)?.convertedXml?.["word/settings.xml"];
144370
+ const settingsPart = getConverter$10(editor)?.convertedXml?.["word/settings.xml"];
143932
144371
  if (!settingsPart)
143933
144372
  return null;
143934
144373
  if (settingsPart.name === "w:settings")
@@ -143938,7 +144377,7 @@ function getSettingsRoot(editor) {
143938
144377
  return settingsPart.elements.find((entry) => entry.name === "w:settings") ?? null;
143939
144378
  }
143940
144379
  function readOddEvenHeadersFlag(editor) {
143941
- const converter = getConverter$8(editor);
144380
+ const converter = getConverter$10(editor);
143942
144381
  if (converter?.pageStyles?.alternateHeaders != null)
143943
144382
  return converter.pageStyles.alternateHeaders === true;
143944
144383
  const settingsRoot = getSettingsRoot(editor);
@@ -148053,6 +148492,30 @@ function resolveBlockInsertionPos(editor, anchorBlockId, position4, stepId) {
148053
148492
  throw planError("TARGET_NOT_FOUND", `block "${anchorBlockId}" not found`, stepId);
148054
148493
  return position4 === "before" ? candidate.pos : candidate.end;
148055
148494
  }
148495
+ function resolveCreateAnchor(editor, target, position4, stepId) {
148496
+ const index2 = getBlockIndex(editor);
148497
+ let candidate;
148498
+ try {
148499
+ candidate = findBlockByNodeIdOnly(index2, target.nodeId);
148500
+ } catch (e) {
148501
+ if (e instanceof Error && "code" in e)
148502
+ throw planError(e.code, e.message, stepId, e.details);
148503
+ throw e;
148504
+ }
148505
+ if (target.nodeType && candidate.nodeType !== target.nodeType) {
148506
+ const remediation = candidate.nodeType === "listItem" ? "Use lists.insert to add an item to a list sequence." : `The block is a ${candidate.nodeType}, not a ${target.nodeType}.`;
148507
+ throw planError("INVALID_TARGET", `Expected ${target.nodeType}:${target.nodeId} but found ${candidate.nodeType}:${candidate.nodeId}.`, stepId, {
148508
+ requestedNodeType: target.nodeType,
148509
+ actualNodeType: candidate.nodeType,
148510
+ nodeId: target.nodeId,
148511
+ remediation
148512
+ });
148513
+ }
148514
+ return {
148515
+ pos: position4 === "before" ? candidate.pos : candidate.end,
148516
+ anchor: candidate
148517
+ };
148518
+ }
148056
148519
  function applyDirectMutationMeta(tr) {
148057
148520
  tr.setMeta("inputType", "programmatic");
148058
148521
  tr.setMeta("skipTrackChanges", true);
@@ -148983,11 +149446,11 @@ function executePlan(editor, input2) {
148983
149446
  expectedRevision: input2.expectedRevision
148984
149447
  });
148985
149448
  }
148986
- function getConverter$7(editor) {
149449
+ function getConverter$9(editor) {
148987
149450
  return editor.converter;
148988
149451
  }
148989
149452
  function takeSnapshot(editor, partIds) {
148990
- const converter = getConverter$7(editor);
149453
+ const converter = getConverter$9(editor);
148991
149454
  const partEntries = /* @__PURE__ */ new Map;
148992
149455
  if (converter?.convertedXml)
148993
149456
  for (const partId of partIds) {
@@ -149002,13 +149465,16 @@ function takeSnapshot(editor, partIds) {
149002
149465
  partEntries,
149003
149466
  numbering: converter?.numbering ? clonePart(converter.numbering) : undefined,
149004
149467
  translatedNumbering: converter?.translatedNumbering ? clonePart(converter.translatedNumbering) : undefined,
149468
+ footnotes: converter?.footnotes ? clonePart(converter.footnotes) : undefined,
149469
+ endnotes: converter?.endnotes ? clonePart(converter.endnotes) : undefined,
149470
+ footnoteProperties: converter?.footnoteProperties ? clonePart(converter.footnoteProperties) : undefined,
149005
149471
  revision: getRevision(editor),
149006
149472
  documentModified: converter?.documentModified ?? false,
149007
149473
  documentGuid: converter?.documentGuid ?? null
149008
149474
  };
149009
149475
  }
149010
149476
  function restoreFromSnapshot(editor, snapshot2) {
149011
- const converter = getConverter$7(editor);
149477
+ const converter = getConverter$9(editor);
149012
149478
  if (!converter)
149013
149479
  return;
149014
149480
  if (converter.convertedXml)
@@ -149023,6 +149489,12 @@ function restoreFromSnapshot(editor, snapshot2) {
149023
149489
  converter.numbering = snapshot2.numbering;
149024
149490
  if (snapshot2.translatedNumbering !== undefined)
149025
149491
  converter.translatedNumbering = snapshot2.translatedNumbering;
149492
+ if (snapshot2.footnotes !== undefined)
149493
+ converter.footnotes = snapshot2.footnotes;
149494
+ if (snapshot2.endnotes !== undefined)
149495
+ converter.endnotes = snapshot2.endnotes;
149496
+ if (snapshot2.footnoteProperties !== undefined)
149497
+ converter.footnoteProperties = snapshot2.footnoteProperties;
149026
149498
  converter.documentModified = snapshot2.documentModified;
149027
149499
  converter.documentGuid = snapshot2.documentGuid;
149028
149500
  restoreRevision(editor, snapshot2.revision);
@@ -152348,13 +152820,14 @@ function collectTrackInsertRefsInRange(editor, from$1, to) {
152348
152820
  entityId: id2
152349
152821
  }));
152350
152822
  }
152351
- function resolveCreateInsertPosition(editor, at, operationLabel) {
152823
+ function resolveCreateInsertPosition(editor, at) {
152352
152824
  const location$1 = at ?? { kind: "documentEnd" };
152353
152825
  if (location$1.kind === "documentStart")
152354
152826
  return 0;
152355
152827
  if (location$1.kind === "documentEnd")
152356
152828
  return editor.state.doc.content.size;
152357
- return resolveBlockInsertionPos(editor, location$1.target.nodeId, location$1.kind);
152829
+ const { pos } = resolveCreateAnchor(editor, location$1.target, location$1.kind);
152830
+ return pos;
152358
152831
  }
152359
152832
  function resolveCreatedBlock(editor, nodeType, blockId) {
152360
152833
  const index2 = getBlockIndex(editor);
@@ -152417,7 +152890,7 @@ function createParagraphWrapper(editor, input2, options) {
152417
152890
  const mode = options?.changeMode ?? "direct";
152418
152891
  if (mode === "tracked")
152419
152892
  ensureTrackedCapability(editor, { operation: "create.paragraph" });
152420
- const insertAt = resolveCreateInsertPosition(editor, input2.at, "paragraph");
152893
+ const insertAt = resolveCreateInsertPosition(editor, input2.at);
152421
152894
  if (options?.dryRun) {
152422
152895
  if (!editor.can().insertParagraphAt?.({
152423
152896
  pos: insertAt,
@@ -152449,6 +152922,7 @@ function createParagraphWrapper(editor, input2, options) {
152449
152922
  };
152450
152923
  }
152451
152924
  const paragraphId = v4_default();
152925
+ let canonicalId = paragraphId;
152452
152926
  let trackedChangeRefs;
152453
152927
  if (executeDomainCommand(editor, () => {
152454
152928
  const didApply = insertParagraphAt$1({
@@ -152461,6 +152935,7 @@ function createParagraphWrapper(editor, input2, options) {
152461
152935
  clearIndexCache(editor);
152462
152936
  try {
152463
152937
  const paragraph2 = resolveCreatedBlock(editor, "paragraph", paragraphId);
152938
+ canonicalId = paragraph2.nodeId;
152464
152939
  if (mode === "tracked")
152465
152940
  trackedChangeRefs = collectTrackInsertRefsInRange(editor, paragraph2.pos, paragraph2.end);
152466
152941
  } catch (e) {
@@ -152477,14 +152952,14 @@ function createParagraphWrapper(editor, input2, options) {
152477
152952
  message: "Paragraph creation could not be applied at the requested location."
152478
152953
  }
152479
152954
  };
152480
- return buildParagraphCreateSuccess(paragraphId, trackedChangeRefs);
152955
+ return buildParagraphCreateSuccess(canonicalId, trackedChangeRefs);
152481
152956
  }
152482
152957
  function createHeadingWrapper(editor, input2, options) {
152483
152958
  const insertHeadingAt$1 = requireEditorCommand(editor.commands?.insertHeadingAt, "create.heading");
152484
152959
  const mode = options?.changeMode ?? "direct";
152485
152960
  if (mode === "tracked")
152486
152961
  ensureTrackedCapability(editor, { operation: "create.heading" });
152487
- const insertAt = resolveCreateInsertPosition(editor, input2.at, "heading");
152962
+ const insertAt = resolveCreateInsertPosition(editor, input2.at);
152488
152963
  if (options?.dryRun) {
152489
152964
  if (!editor.can().insertHeadingAt?.({
152490
152965
  pos: insertAt,
@@ -152517,6 +152992,7 @@ function createHeadingWrapper(editor, input2, options) {
152517
152992
  };
152518
152993
  }
152519
152994
  const headingId = v4_default();
152995
+ let canonicalId = headingId;
152520
152996
  let trackedChangeRefs;
152521
152997
  if (executeDomainCommand(editor, () => {
152522
152998
  const didApply = insertHeadingAt$1({
@@ -152530,6 +153006,7 @@ function createHeadingWrapper(editor, input2, options) {
152530
153006
  clearIndexCache(editor);
152531
153007
  try {
152532
153008
  const heading3 = resolveCreatedBlock(editor, "heading", headingId);
153009
+ canonicalId = heading3.nodeId;
152533
153010
  if (mode === "tracked")
152534
153011
  trackedChangeRefs = collectTrackInsertRefsInRange(editor, heading3.pos, heading3.end);
152535
153012
  } catch (e) {
@@ -152546,13 +153023,23 @@ function createHeadingWrapper(editor, input2, options) {
152546
153023
  message: "Heading creation could not be applied at the requested location."
152547
153024
  }
152548
153025
  };
152549
- return buildHeadingCreateSuccess(headingId, trackedChangeRefs);
153026
+ return buildHeadingCreateSuccess(canonicalId, trackedChangeRefs);
152550
153027
  }
152551
- function validateTargetNodeType(nodeType) {
152552
- if (REJECTED_NODE_TYPES.has(nodeType))
152553
- throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, { nodeType });
152554
- if (!SUPPORTED_NODE_TYPES.has(nodeType))
152555
- throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, { nodeType });
153028
+ function extractTextPreview(node3) {
153029
+ if (!node3.isTextblock)
153030
+ return null;
153031
+ const text5 = node3.textContent;
153032
+ if (text5.length <= TEXT_PREVIEW_MAX_LENGTH)
153033
+ return text5;
153034
+ return text5.slice(0, TEXT_PREVIEW_MAX_LENGTH);
153035
+ }
153036
+ function toBlockSummary(candidate, ordinal) {
153037
+ return {
153038
+ ordinal,
153039
+ nodeId: candidate.nodeId,
153040
+ nodeType: candidate.nodeType,
153041
+ textPreview: extractTextPreview(candidate.node)
153042
+ };
152556
153043
  }
152557
153044
  function resolveSdBlockId(candidate) {
152558
153045
  const sdBlockId = candidate.node.attrs?.sdBlockId;
@@ -152560,6 +153047,12 @@ function resolveSdBlockId(candidate) {
152560
153047
  return sdBlockId;
152561
153048
  throw new DocumentApiAdapterError("INTERNAL_ERROR", "Resolved block candidate is missing sdBlockId attribute. This indicates a schema/extension invariant violation.", { attrs: candidate.node.attrs });
152562
153049
  }
153050
+ function validateDeleteTargetNodeType(nodeType) {
153051
+ if (REJECTED_DELETE_NODE_TYPES3.has(nodeType))
153052
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, { nodeType });
153053
+ if (!SUPPORTED_DELETE_NODE_TYPES3.has(nodeType))
153054
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, { nodeType });
153055
+ }
152563
153056
  function validateCommandLayerUniqueness(editor, sdBlockId) {
152564
153057
  const getBlockNodeById = editor.helpers?.blockNode?.getBlockNodeById;
152565
153058
  if (typeof getBlockNodeById !== "function")
@@ -152573,17 +153066,60 @@ function validateCommandLayerUniqueness(editor, sdBlockId) {
152573
153066
  count: matches2.length
152574
153067
  });
152575
153068
  }
153069
+ function collectTopLevelBlocks(editor) {
153070
+ const doc$2 = editor.state.doc;
153071
+ const results = [];
153072
+ let offset$1 = 0;
153073
+ for (let i$1 = 0;i$1 < doc$2.childCount; i$1++) {
153074
+ const child = doc$2.child(i$1);
153075
+ const nodeType = mapBlockNodeType(child);
153076
+ const pos = offset$1;
153077
+ if (nodeType) {
153078
+ const nodeId = resolveBlockNodeId(child, pos, nodeType);
153079
+ if (nodeId)
153080
+ results.push({
153081
+ node: child,
153082
+ pos,
153083
+ end: pos + child.nodeSize,
153084
+ nodeType,
153085
+ nodeId
153086
+ });
153087
+ }
153088
+ offset$1 += child.nodeSize;
153089
+ }
153090
+ return results;
153091
+ }
153092
+ function blocksListWrapper(editor, input2) {
153093
+ const topLevel = collectTopLevelBlocks(editor);
153094
+ const filtered = input2?.nodeTypes ? topLevel.filter((b$1) => input2.nodeTypes.includes(b$1.nodeType)) : topLevel;
153095
+ const total = filtered.length;
153096
+ const offset$1 = input2?.offset ?? 0;
153097
+ const limit = input2?.limit ?? total;
153098
+ return {
153099
+ total,
153100
+ blocks: filtered.slice(offset$1, offset$1 + limit).map((candidate, i$1) => ({
153101
+ ordinal: offset$1 + i$1,
153102
+ nodeId: candidate.nodeId,
153103
+ nodeType: candidate.nodeType,
153104
+ textPreview: extractTextPreview(candidate.node),
153105
+ isEmpty: candidate.node.textContent.length === 0
153106
+ })),
153107
+ revision: getRevision(editor)
153108
+ };
153109
+ }
152576
153110
  function blocksDeleteWrapper(editor, input2, options) {
152577
153111
  rejectTrackedMode("blocks.delete", options);
152578
153112
  const candidate = findBlockByIdStrict(getBlockIndex(editor), input2.target);
152579
- validateTargetNodeType(candidate.nodeType);
153113
+ validateDeleteTargetNodeType(candidate.nodeType);
153114
+ const deletedBlock = toBlockSummary(candidate, collectTopLevelBlocks(editor).findIndex((b$1) => b$1.nodeId === candidate.nodeId && b$1.nodeType === candidate.nodeType));
152580
153115
  const sdBlockId = resolveSdBlockId(candidate);
152581
153116
  const deleteBlockNodeById = requireEditorCommand(editor.commands?.deleteBlockNodeById, "blocks.delete");
152582
153117
  validateCommandLayerUniqueness(editor, sdBlockId);
152583
153118
  if (options?.dryRun)
152584
153119
  return {
152585
153120
  success: true,
152586
- deleted: input2.target
153121
+ deleted: input2.target,
153122
+ deletedBlock
152587
153123
  };
152588
153124
  if (executeDomainCommand(editor, () => {
152589
153125
  const didApply = deleteBlockNodeById(sdBlockId);
@@ -152597,7 +153133,116 @@ function blocksDeleteWrapper(editor, input2, options) {
152597
153133
  });
152598
153134
  return {
152599
153135
  success: true,
152600
- deleted: input2.target
153136
+ deleted: input2.target,
153137
+ deletedBlock
153138
+ };
153139
+ }
153140
+ function hasSectionBreak(candidate) {
153141
+ const pPr = candidate.node.attrs?.paragraphProperties;
153142
+ return pPr?.sectPr != null && typeof pPr.sectPr === "object";
153143
+ }
153144
+ function resolveTopLevelOrdinal(topLevel, candidate, label) {
153145
+ const idx = topLevel.findIndex((b$1) => b$1.nodeId === candidate.nodeId && b$1.nodeType === candidate.nodeType);
153146
+ if (idx !== -1)
153147
+ return idx;
153148
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.deleteRange ${label} resolved to a nested block (not a direct document child). Only top-level blocks are supported.`, {
153149
+ nodeId: candidate.nodeId,
153150
+ nodeType: candidate.nodeType
153151
+ });
153152
+ }
153153
+ function resolveRangeEndpoint(index2, address2, label) {
153154
+ const key$1 = `${address2.nodeType}:${address2.nodeId}`;
153155
+ if (index2.ambiguous.has(key$1))
153156
+ throw new DocumentApiAdapterError("AMBIGUOUS_TARGET", `Multiple blocks share key "${key$1}".`, { target: address2 });
153157
+ const candidate = index2.byId.get(key$1);
153158
+ if (candidate)
153159
+ return candidate;
153160
+ const mismatch = index2.candidates.find((c) => c.nodeId === address2.nodeId);
153161
+ if (mismatch)
153162
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.deleteRange ${label} expected ${address2.nodeType}:${address2.nodeId} but resolved to ${mismatch.nodeType}.`, {
153163
+ expected: address2.nodeType,
153164
+ actual: mismatch.nodeType,
153165
+ nodeId: address2.nodeId
153166
+ });
153167
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Block "${key$1}" was not found.`, { target: address2 });
153168
+ }
153169
+ function rejectUnmappedNodesInRange(doc$2, rangeBlocks) {
153170
+ if (rangeBlocks.length === 0)
153171
+ return;
153172
+ const rangeFrom = rangeBlocks[0].pos;
153173
+ const rangeTo = rangeBlocks[rangeBlocks.length - 1].end;
153174
+ const recognizedPositions = new Set(rangeBlocks.map((b$1) => b$1.pos));
153175
+ let offset$1 = 0;
153176
+ for (let i$1 = 0;i$1 < doc$2.childCount; i$1++) {
153177
+ const child = doc$2.child(i$1);
153178
+ const childEnd = offset$1 + child.nodeSize;
153179
+ if (childEnd > rangeFrom && offset$1 < rangeTo && !recognizedPositions.has(offset$1)) {
153180
+ if (!RANGE_DELETE_SAFE_NODE_TYPES.has(child.type.name))
153181
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.deleteRange cannot delete range: unrecognized node "${child.type.name}" at position ${offset$1} would be silently removed.`, {
153182
+ pmNodeType: child.type.name,
153183
+ pos: offset$1
153184
+ });
153185
+ }
153186
+ offset$1 = childEnd;
153187
+ }
153188
+ }
153189
+ function blocksDeleteRangeWrapper(editor, input2, options) {
153190
+ rejectTrackedMode("blocks.deleteRange", options);
153191
+ const topLevel = collectTopLevelBlocks(editor);
153192
+ const index2 = getBlockIndex(editor);
153193
+ const startCandidate = resolveRangeEndpoint(index2, input2.start, "start");
153194
+ const endCandidate = resolveRangeEndpoint(index2, input2.end, "end");
153195
+ const startOrdinal = resolveTopLevelOrdinal(topLevel, startCandidate, "start");
153196
+ const endOrdinal = resolveTopLevelOrdinal(topLevel, endCandidate, "end");
153197
+ if (startOrdinal > endOrdinal)
153198
+ throw new DocumentApiAdapterError("INVALID_INPUT", `blocks.deleteRange start ordinal (${startOrdinal}) is after end ordinal (${endOrdinal}). The start must precede or equal the end.`, {
153199
+ startOrdinal,
153200
+ endOrdinal
153201
+ });
153202
+ const rangeBlocks = topLevel.slice(startOrdinal, endOrdinal + 1);
153203
+ rejectUnmappedNodesInRange(editor.state.doc, rangeBlocks);
153204
+ for (const block of rangeBlocks)
153205
+ if (hasSectionBreak(block))
153206
+ throw new DocumentApiAdapterError("INVALID_TARGET", `blocks.deleteRange cannot delete a range that includes a section break (block "${block.nodeId}" at ordinal ${topLevel.indexOf(block)}).`, {
153207
+ nodeId: block.nodeId,
153208
+ nodeType: block.nodeType
153209
+ });
153210
+ const deletedBlocks = rangeBlocks.map((c, i$1) => toBlockSummary(c, startOrdinal + i$1));
153211
+ const revisionBefore = getRevision(editor);
153212
+ if (options?.dryRun)
153213
+ return {
153214
+ success: true,
153215
+ deletedCount: rangeBlocks.length,
153216
+ deletedBlocks,
153217
+ revision: {
153218
+ before: revisionBefore,
153219
+ after: revisionBefore
153220
+ },
153221
+ dryRun: true
153222
+ };
153223
+ const rangeFrom = rangeBlocks[0].pos;
153224
+ const rangeTo = rangeBlocks[rangeBlocks.length - 1].end;
153225
+ if (executeDomainCommand(editor, () => {
153226
+ const tr = editor.state.tr;
153227
+ tr.delete(rangeFrom, rangeTo);
153228
+ editor.dispatch(tr);
153229
+ clearIndexCache(editor);
153230
+ return true;
153231
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
153232
+ throw new DocumentApiAdapterError("INTERNAL_ERROR", "blocks.deleteRange command returned false despite passing all pre-apply checks.", {
153233
+ start: input2.start,
153234
+ end: input2.end
153235
+ });
153236
+ const revisionAfter = getRevision(editor);
153237
+ return {
153238
+ success: true,
153239
+ deletedCount: rangeBlocks.length,
153240
+ deletedBlocks,
153241
+ revision: {
153242
+ before: revisionBefore,
153243
+ after: revisionAfter
153244
+ },
153245
+ dryRun: false
152601
153246
  };
152602
153247
  }
152603
153248
  function resolveBlock(editor, nodeId) {
@@ -154683,11 +155328,11 @@ function assertRunTilingInvariant(runs2, blockRange, blockId) {
154683
155328
  if (runs2[i$1].range.end !== runs2[i$1 + 1].range.start)
154684
155329
  throw planError("INTERNAL_ERROR", `run-tiling: gap or overlap between runs[${i$1}] and runs[${i$1 + 1}] in block ${blockId}`);
154685
155330
  }
154686
- function getConverter$6(editor) {
155331
+ function getConverter$8(editor) {
154687
155332
  return editor.converter;
154688
155333
  }
154689
155334
  function readTranslatedLinkedStyles(editor) {
154690
- return getConverter$6(editor)?.translatedLinkedStyles ?? null;
155335
+ return getConverter$8(editor)?.translatedLinkedStyles ?? null;
154691
155336
  }
154692
155337
  function encodeV3Ref(payload) {
154693
155338
  return `text:${btoa(JSON.stringify(payload))}`;
@@ -158220,10 +158865,10 @@ function registerBuiltInExecutors() {
158220
158865
  };
158221
158866
  } });
158222
158867
  }
158223
- function getConverter$5(editor) {
158868
+ function getConverter$7(editor) {
158224
158869
  return editor.converter;
158225
158870
  }
158226
- function getConverter$4(editor) {
158871
+ function getConverter$6(editor) {
158227
158872
  return editor.converter;
158228
158873
  }
158229
158874
  function createEmptyHeaderFooterJson() {
@@ -158236,7 +158881,7 @@ function createEmptyHeaderFooterJson() {
158236
158881
  };
158237
158882
  }
158238
158883
  function syncHeaderFooterCaches(editor, part) {
158239
- const converter = getConverter$4(editor);
158884
+ const converter = getConverter$6(editor);
158240
158885
  if (!converter)
158241
158886
  return;
158242
158887
  const relsRoot = part?.elements?.find((el) => el.name === "Relationships");
@@ -158311,9 +158956,18 @@ function handleHeaderFooterInvalidation(editor, _event) {
158311
158956
  editor.view?.dispatch?.(tr);
158312
158957
  } catch {}
158313
158958
  }
158959
+ function handleNotesInvalidation(editor, _event) {
158960
+ try {
158961
+ const tr = editor.state.tr;
158962
+ tr.setMeta("forceUpdatePagination", true);
158963
+ editor.view?.dispatch?.(tr);
158964
+ } catch {}
158965
+ }
158314
158966
  function registerStaticInvalidationHandlers() {
158315
158967
  registerInvalidationHandler("word/numbering.xml", handleNumberingInvalidation);
158316
158968
  registerInvalidationHandler("word/_rels/document.xml.rels", handleRelationshipsInvalidation);
158969
+ registerInvalidationHandler("word/footnotes.xml", handleNotesInvalidation);
158970
+ registerInvalidationHandler("word/endnotes.xml", handleNotesInvalidation);
158317
158971
  }
158318
158972
  function registerHeaderFooterInvalidation(partId) {
158319
158973
  registerInvalidationHandler(partId, handleHeaderFooterInvalidation);
@@ -158578,7 +159232,7 @@ function resolveEffectiveRef(editor, sections, startSectionIndex, kind, variant)
158578
159232
  }
158579
159233
  return null;
158580
159234
  }
158581
- function getConverter$3(editor) {
159235
+ function getConverter$5(editor) {
158582
159236
  return editor.converter;
158583
159237
  }
158584
159238
  function setHeaderFooterRefMutation(sectPr, kind, variant, refId, converter, operationName, dryRun = false) {
@@ -158639,7 +159293,7 @@ function setLinkedToPreviousMutation(sectPr, projection, sections, kind, variant
158639
159293
  }
158640
159294
  };
158641
159295
  if (!dryRun && clearedRef) {
158642
- const converter$1 = getConverter$3(editor);
159296
+ const converter$1 = getConverter$5(editor);
158643
159297
  if (converter$1)
158644
159298
  reconcileVariantPointerOnClear(converter$1, kind, clearedRef);
158645
159299
  }
@@ -158676,12 +159330,12 @@ function setLinkedToPreviousMutation(sectPr, projection, sections, kind, variant
158676
159330
  };
158677
159331
  }
158678
159332
  setSectPrHeaderFooterRef(sectPr, kind, variant, explicitRefId);
158679
- const converter = getConverter$3(editor);
159333
+ const converter = getConverter$5(editor);
158680
159334
  if (converter)
158681
159335
  reconcileVariantPointerOnSet(converter, kind, variant, explicitRefId);
158682
159336
  }
158683
159337
  function createExplicitHeaderFooterReference(editor, input2) {
158684
- if (!getConverter$3(editor))
159338
+ if (!getConverter$5(editor))
158685
159339
  return null;
158686
159340
  try {
158687
159341
  const { refId } = createHeaderFooterPart(editor, {
@@ -158719,7 +159373,7 @@ function reconcileVariantPointerOnClear(converter, kind, clearedRefId) {
158719
159373
  if (variantIds[key$1] === clearedRefId)
158720
159374
  variantIds[key$1] = null;
158721
159375
  }
158722
- function getConverter$2(editor) {
159376
+ function getConverter$4(editor) {
158723
159377
  return editor.converter;
158724
159378
  }
158725
159379
  function toSectionFailure$1(code$1, message) {
@@ -158787,7 +159441,7 @@ function buildSectionMarginsForAttrs$1(sectPr) {
158787
159441
  };
158788
159442
  }
158789
159443
  function syncConverterBodySection$1(editor, sectPr) {
158790
- const converter = getConverter$2(editor);
159444
+ const converter = getConverter$4(editor);
158791
159445
  if (!converter)
158792
159446
  return;
158793
159447
  converter.bodySectPr = cloneXmlElement(sectPr);
@@ -158907,7 +159561,7 @@ function createSectionBreakNode(editor, breakParagraphId, input2) {
158907
159561
  return paragraphNode;
158908
159562
  }
158909
159563
  function updateGlobalTitlePageFlag(editor) {
158910
- const converter = getConverter$2(editor);
159564
+ const converter = getConverter$4(editor);
158911
159565
  if (!converter)
158912
159566
  return;
158913
159567
  const anyTitlePage = resolveSectionProjections(editor).some((entry) => entry.domain.titlePage === true);
@@ -158991,7 +159645,7 @@ function sectionsSetTitlePageAdapter(editor, input2, options) {
158991
159645
  }
158992
159646
  function sectionsSetOddEvenHeadersFootersAdapter(editor, input2, options) {
158993
159647
  rejectTrackedMode("sections.setOddEvenHeadersFooters", options);
158994
- const converter = getConverter$2(editor);
159648
+ const converter = getConverter$4(editor);
158995
159649
  if (!converter)
158996
159650
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "sections.setOddEvenHeadersFooters requires an active document converter.");
158997
159651
  return mutatePart({
@@ -159027,13 +159681,13 @@ function sectionsSetSectionDirectionAdapter(editor, input2, options) {
159027
159681
  }
159028
159682
  function sectionsSetHeaderFooterRefAdapter(editor, input2, options) {
159029
159683
  return sectionMutationBySectPr$1(editor, input2, options, "sections.setHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
159030
- const converter = getConverter$2(editor) ?? null;
159684
+ const converter = getConverter$4(editor) ?? null;
159031
159685
  return setHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, input2.refId, converter, "sections.setHeaderFooterRef", dryRun);
159032
159686
  });
159033
159687
  }
159034
159688
  function sectionsClearHeaderFooterRefAdapter(editor, input2, options) {
159035
159689
  return sectionMutationBySectPr$1(editor, input2, options, "sections.clearHeaderFooterRef", (sectPr, _projection, _sections, dryRun) => {
159036
- const converter = getConverter$2(editor) ?? null;
159690
+ const converter = getConverter$4(editor) ?? null;
159037
159691
  clearHeaderFooterRefMutation(sectPr, input2.kind, input2.variant, converter, dryRun);
159038
159692
  });
159039
159693
  }
@@ -159230,10 +159884,20 @@ function createHistoryAdapter(editor) {
159230
159884
  if (typeof editor.commands?.undo !== "function")
159231
159885
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "history.undo command is not available.", { reason: "missing_command" });
159232
159886
  const revBefore = getRevision(editor);
159887
+ if (getUndoDepth(editor) === 0)
159888
+ return {
159889
+ noop: true,
159890
+ reason: "EMPTY_UNDO_STACK",
159891
+ revision: {
159892
+ before: revBefore,
159893
+ after: revBefore
159894
+ }
159895
+ };
159233
159896
  const success = Boolean(editor.commands.undo());
159234
159897
  const revAfter = getRevision(editor);
159235
159898
  return {
159236
159899
  noop: !success,
159900
+ reason: success ? undefined : "NO_EFFECT",
159237
159901
  revision: {
159238
159902
  before: revBefore,
159239
159903
  after: revAfter
@@ -159244,10 +159908,20 @@ function createHistoryAdapter(editor) {
159244
159908
  if (typeof editor.commands?.redo !== "function")
159245
159909
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "history.redo command is not available.", { reason: "missing_command" });
159246
159910
  const revBefore = getRevision(editor);
159911
+ if (getRedoDepth(editor) === 0)
159912
+ return {
159913
+ noop: true,
159914
+ reason: "EMPTY_REDO_STACK",
159915
+ revision: {
159916
+ before: revBefore,
159917
+ after: revBefore
159918
+ }
159919
+ };
159247
159920
  const success = Boolean(editor.commands.redo());
159248
159921
  const revAfter = getRevision(editor);
159249
159922
  return {
159250
159923
  noop: !success,
159924
+ reason: success ? undefined : "NO_EFFECT",
159251
159925
  revision: {
159252
159926
  before: revBefore,
159253
159927
  after: revAfter
@@ -159623,7 +160297,7 @@ function dispatchEditorTransaction(editor, tr) {
159623
160297
  }
159624
160298
  throw new Error("No transaction dispatcher available.");
159625
160299
  }
159626
- function receiptApplied$10(receipt2) {
160300
+ function receiptApplied$9(receipt2) {
159627
160301
  return receipt2.steps[0]?.effect === "changed";
159628
160302
  }
159629
160303
  function isTocContentUnchanged(existingNode, newContent) {
@@ -159718,7 +160392,7 @@ function tocConfigureWrapper(editor, input2, options) {
159718
160392
  const shouldRefreshContent = !isTocContentUnchanged(resolved.node, nextContent);
159719
160393
  const command$1 = editor.commands?.setTableOfContentsInstructionById;
159720
160394
  const commandNodeId = resolved.commandNodeId ?? resolved.nodeId;
159721
- if (!receiptApplied$10(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
160395
+ if (!receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
159722
160396
  sdBlockId: commandNodeId,
159723
160397
  instruction,
159724
160398
  ...shouldRefreshContent ? { content: nextContent } : {},
@@ -159761,7 +160435,7 @@ function tocUpdateAll(editor, input2, options) {
159761
160435
  if (options?.dryRun)
159762
160436
  return tocSuccess(resolved.nodeId);
159763
160437
  const command$1 = editor.commands?.replaceTableOfContentsContentById;
159764
- return receiptApplied$10(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
160438
+ return receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
159765
160439
  sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
159766
160440
  content: content3
159767
160441
  }, options?.expectedRevision) : runTocAction(editor, () => {
@@ -159804,7 +160478,7 @@ function tocUpdatePageNumbers(editor, input2, options) {
159804
160478
  if (options?.dryRun)
159805
160479
  return tocSuccess(resolved.nodeId);
159806
160480
  const command$1 = editor.commands?.replaceTableOfContentsContentById;
159807
- return receiptApplied$10(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
160481
+ return receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
159808
160482
  sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
159809
160483
  content: updatedContent
159810
160484
  }, options?.expectedRevision) : runTocAction(editor, () => {
@@ -159871,7 +160545,7 @@ function tocRemoveWrapper(editor, input2, options) {
159871
160545
  if (options?.dryRun)
159872
160546
  return tocSuccess(resolved.nodeId);
159873
160547
  const command$1 = editor.commands?.deleteTableOfContentsById;
159874
- return receiptApplied$10(typeof command$1 === "function" ? runTocCommand(editor, command$1, { sdBlockId: resolved.commandNodeId ?? resolved.nodeId }, options?.expectedRevision) : runTocAction(editor, () => {
160548
+ return receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, { sdBlockId: resolved.commandNodeId ?? resolved.nodeId }, options?.expectedRevision) : runTocAction(editor, () => {
159875
160549
  try {
159876
160550
  const { tr } = editor.state;
159877
160551
  tr.delete(resolved.pos, resolved.pos + resolved.node.nodeSize);
@@ -159891,7 +160565,7 @@ function createTableOfContentsWrapper(editor, input2, options) {
159891
160565
  else if (at.kind === "documentEnd")
159892
160566
  pos = editor.state.doc.content.size;
159893
160567
  else
159894
- pos = resolveBlockInsertionPos(editor, at.target.nodeId, at.kind);
160568
+ pos = resolveCreateAnchor(editor, at.target, at.kind).pos;
159895
160569
  const config2 = input2.config ? applyTocPatchTyped(DEFAULT_TOC_CONFIG, input2.config) : DEFAULT_TOC_CONFIG;
159896
160570
  const instruction = serializeTocInstruction(config2);
159897
160571
  const content3 = materializeTocContent(editor.state.doc, withRightAlign(config2, input2.config?.rightAlignPageNumbers), editor);
@@ -159902,7 +160576,7 @@ function createTableOfContentsWrapper(editor, input2, options) {
159902
160576
  toc: buildTocAddress("(dry-run)")
159903
160577
  };
159904
160578
  const command$1 = editor.commands?.insertTableOfContentsAt;
159905
- if (!receiptApplied$10(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
160579
+ if (!receiptApplied$9(typeof command$1 === "function" ? runTocCommand(editor, command$1, {
159906
160580
  pos,
159907
160581
  instruction,
159908
160582
  sdBlockId,
@@ -160097,7 +160771,7 @@ function runEntryCommand(editor, command$1, args$1, expectedRevision) {
160097
160771
  const executeCommand = toEntryEditorCommand(command$1);
160098
160772
  return runEntryAction(editor, () => executeCommand(args$1), expectedRevision);
160099
160773
  }
160100
- function receiptApplied$9(receipt2) {
160774
+ function receiptApplied$8(receipt2) {
160101
160775
  return receipt2.steps[0]?.effect === "changed";
160102
160776
  }
160103
160777
  function tocListEntriesWrapper(editor, query2) {
@@ -160144,7 +160818,7 @@ function tocMarkEntryWrapper(editor, input2, options) {
160144
160818
  const pos = (input2.target.position ?? "end") === "start" ? paragraph2.pos + 1 : paragraph2.pos + paragraph2.node.nodeSize - 1;
160145
160819
  if (options?.dryRun)
160146
160820
  return entrySuccess$2("(dry-run)");
160147
- if (!receiptApplied$9(runEntryCommand(editor, command$1, {
160821
+ if (!receiptApplied$8(runEntryCommand(editor, command$1, {
160148
160822
  pos,
160149
160823
  instruction
160150
160824
  }, options?.expectedRevision)))
@@ -160166,7 +160840,7 @@ function tocUnmarkEntryWrapper(editor, input2, options) {
160166
160840
  const resolved = resolveTcEntryTarget(editor.state.doc, input2.target);
160167
160841
  if (options?.dryRun)
160168
160842
  return entrySuccess$2(resolved.nodeId);
160169
- return receiptApplied$9(runEntryCommand(editor, command$1, { pos: resolved.pos }, options?.expectedRevision)) ? entrySuccess$2(resolved.nodeId) : entryFailure$2("NO_OP", "TC entry removal produced no change.");
160843
+ return receiptApplied$8(runEntryCommand(editor, command$1, { pos: resolved.pos }, options?.expectedRevision)) ? entrySuccess$2(resolved.nodeId) : entryFailure$2("NO_OP", "TC entry removal produced no change.");
160170
160844
  }
160171
160845
  function tocEditEntryWrapper(editor, input2, options) {
160172
160846
  rejectTrackedMode("toc.editEntry", options);
@@ -160179,7 +160853,7 @@ function tocEditEntryWrapper(editor, input2, options) {
160179
160853
  return entryFailure$2("NO_OP", "Edit patch produced no change.");
160180
160854
  if (options?.dryRun)
160181
160855
  return entrySuccess$2(resolved.nodeId);
160182
- if (!receiptApplied$9(runEntryCommand(editor, command$1, {
160856
+ if (!receiptApplied$8(runEntryCommand(editor, command$1, {
160183
160857
  pos: resolved.pos,
160184
160858
  instruction: serializeTcInstruction(patched)
160185
160859
  }, options?.expectedRevision)))
@@ -160475,9 +161149,11 @@ function resolveImageInsertPosition(editor, location$1) {
160475
161149
  return editor.state.doc.content.size;
160476
161150
  case "before":
160477
161151
  case "after":
160478
- return resolveBlockInsertionPos(editor, location$1.target.nodeId, location$1.kind);
160479
- case "inParagraph":
160480
- return resolveBlockInsertionPos(editor, location$1.target.nodeId, "before") + 1 + (location$1.offset ?? 0);
161152
+ return resolveCreateAnchor(editor, location$1.target, location$1.kind).pos;
161153
+ case "inParagraph": {
161154
+ const { pos } = resolveCreateAnchor(editor, location$1.target, "before");
161155
+ return pos + 1 + (location$1.offset ?? 0);
161156
+ }
160481
161157
  default:
160482
161158
  throw new DocumentApiAdapterError("INVALID_TARGET", `Unknown image location kind: "${location$1.kind}".`);
160483
161159
  }
@@ -161512,7 +162188,7 @@ function hyperlinkFailure(code$1, message) {
161512
162188
  }
161513
162189
  };
161514
162190
  }
161515
- function receiptApplied$8(receipt2) {
162191
+ function receiptApplied$7(receipt2) {
161516
162192
  return receipt2.steps[0]?.effect === "changed";
161517
162193
  }
161518
162194
  function matchesListQuery(candidate, query2, editor) {
@@ -161611,7 +162287,7 @@ function hyperlinksWrapWrapper(editor, input2, options) {
161611
162287
  }
161612
162288
  });
161613
162289
  const spec = specFromInput(input2.link);
161614
- if (!receiptApplied$8(executeDomainCommand(editor, () => {
162290
+ if (!receiptApplied$7(executeDomainCommand(editor, () => {
161615
162291
  const result = wrapWithLink(editor, resolved.from, resolved.to, spec);
161616
162292
  if (result)
161617
162293
  clearIndexCache(editor);
@@ -161681,7 +162357,7 @@ function hyperlinksInsertWrapper(editor, input2, options) {
161681
162357
  }
161682
162358
  });
161683
162359
  const spec = specFromInput(input2.link);
161684
- if (!receiptApplied$8(executeDomainCommand(editor, () => {
162360
+ if (!receiptApplied$7(executeDomainCommand(editor, () => {
161685
162361
  if (structuralEnd) {
161686
162362
  insertParagraphAtEnd(editor, insertPos, input2.text);
161687
162363
  clearIndexCache(editor);
@@ -161742,7 +162418,7 @@ function hyperlinksPatchWrapper(editor, input2, options) {
161742
162418
  return hyperlinkFailure("NO_OP", "Patch produces no change — all values already match.");
161743
162419
  if (options?.dryRun)
161744
162420
  return hyperlinkSuccess(candidateToTarget(candidate));
161745
- if (!receiptApplied$8(executeDomainCommand(editor, () => {
162421
+ if (!receiptApplied$7(executeDomainCommand(editor, () => {
161746
162422
  const result = patchLinkMark(editor, resolvedRange.from, resolvedRange.to, existingMark, input2.patch);
161747
162423
  if (result)
161748
162424
  clearIndexCache(editor);
@@ -161761,7 +162437,7 @@ function hyperlinksRemoveWrapper(editor, input2, options) {
161761
162437
  const targetAddress = candidateToTarget(candidate);
161762
162438
  if (options?.dryRun)
161763
162439
  return hyperlinkSuccess(targetAddress);
161764
- if (!receiptApplied$8(executeDomainCommand(editor, () => {
162440
+ if (!receiptApplied$7(executeDomainCommand(editor, () => {
161765
162441
  const result = mode === "unwrap" ? unwrapLink(editor, resolvedRange.from, resolvedRange.to) : deleteLinkedText(editor, resolvedRange.from, resolvedRange.to);
161766
162442
  if (result)
161767
162443
  clearIndexCache(editor);
@@ -163059,7 +163735,7 @@ function buildSectionMarginsForAttrs(sectPr) {
163059
163735
  };
163060
163736
  }
163061
163737
  function syncConverterBodySection(editor, sectPr) {
163062
- const converter = getConverter$12(editor);
163738
+ const converter = getConverter$3(editor);
163063
163739
  if (!converter)
163064
163740
  return;
163065
163741
  converter.bodySectPr = cloneXmlElement(sectPr);
@@ -163097,7 +163773,7 @@ function syncConverterBodySection(editor, sectPr) {
163097
163773
  if (margins.gutter !== undefined)
163098
163774
  pageMargins.gutter = margins.gutter;
163099
163775
  }
163100
- function getConverter$12(editor) {
163776
+ function getConverter$3(editor) {
163101
163777
  return editor.converter;
163102
163778
  }
163103
163779
  function applySectPrToProjection(editor, projection, sectPr) {
@@ -163147,11 +163823,11 @@ function sectionMutationBySectPr(editor, input2, options, operationName, mutate)
163147
163823
  clearIndexCache(editor);
163148
163824
  return toSectionSuccess(projection.address);
163149
163825
  }
163150
- function getConverter2(editor) {
163826
+ function getConverter$2(editor) {
163151
163827
  return editor.converter;
163152
163828
  }
163153
163829
  function requireConverter(editor, operationName) {
163154
- const converter = getConverter2(editor);
163830
+ const converter = getConverter$2(editor);
163155
163831
  if (!converter)
163156
163832
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `${operationName} requires an active document converter.`);
163157
163833
  return converter;
@@ -163250,14 +163926,14 @@ function headerFootersResolveAdapter(editor, input2) {
163250
163926
  function headerFootersRefsSetAdapter(editor, input2, options) {
163251
163927
  const { section, headerFooterKind, variant } = input2.target;
163252
163928
  return sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.set", (sectPr, _projection, _sections, dryRun) => {
163253
- const converter = getConverter2(editor) ?? null;
163929
+ const converter = getConverter$2(editor) ?? null;
163254
163930
  return setHeaderFooterRefMutation(sectPr, headerFooterKind, variant, input2.refId, converter, "headerFooters.refs.set", dryRun);
163255
163931
  });
163256
163932
  }
163257
163933
  function headerFootersRefsClearAdapter(editor, input2, options) {
163258
163934
  const { section, headerFooterKind, variant } = input2.target;
163259
163935
  return sectionMutationBySectPr(editor, { target: section }, options, "headerFooters.refs.clear", (sectPr, _projection, _sections, dryRun) => {
163260
- clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter2(editor) ?? null, dryRun);
163936
+ clearHeaderFooterRefMutation(sectPr, headerFooterKind, variant, getConverter$2(editor) ?? null, dryRun);
163261
163937
  });
163262
163938
  }
163263
163939
  function headerFootersRefsSetLinkedToPreviousAdapter(editor, input2, options) {
@@ -163611,7 +164287,7 @@ function bookmarkFailure(code$1, message) {
163611
164287
  }
163612
164288
  };
163613
164289
  }
163614
- function receiptApplied$7(receipt2) {
164290
+ function receiptApplied$6(receipt2) {
163615
164291
  return receipt2.steps[0]?.effect === "changed";
163616
164292
  }
163617
164293
  function parseBookmarkId(raw) {
@@ -163671,7 +164347,7 @@ function bookmarksInsertWrapper(editor, input2, options) {
163671
164347
  if (!bookmarkStartType || !bookmarkEndType)
163672
164348
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "bookmarks.insert requires bookmarkStart and bookmarkEnd node types in the schema.");
163673
164349
  const resolved = resolveInlineInsertPosition(editor, input2.at, "bookmarks.insert");
163674
- if (!receiptApplied$7(executeDomainCommand(editor, () => {
164350
+ if (!receiptApplied$6(executeDomainCommand(editor, () => {
163675
164351
  const bookmarkId = allocateBookmarkId(editor.state.doc);
163676
164352
  const startAttrs = {
163677
164353
  name: input2.name,
@@ -163707,7 +164383,7 @@ function bookmarksRenameWrapper(editor, input2, options) {
163707
164383
  };
163708
164384
  if (options?.dryRun)
163709
164385
  return bookmarkSuccess(newAddress);
163710
- if (!receiptApplied$7(executeDomainCommand(editor, () => {
164386
+ if (!receiptApplied$6(executeDomainCommand(editor, () => {
163711
164387
  const { tr } = editor.state;
163712
164388
  tr.setNodeMarkup(resolved.pos, undefined, {
163713
164389
  ...resolved.node.attrs,
@@ -163730,7 +164406,7 @@ function bookmarksRemoveWrapper(editor, input2, options) {
163730
164406
  };
163731
164407
  if (options?.dryRun)
163732
164408
  return bookmarkSuccess(address2);
163733
- if (!receiptApplied$7(executeDomainCommand(editor, () => {
164409
+ if (!receiptApplied$6(executeDomainCommand(editor, () => {
163734
164410
  const { tr } = editor.state;
163735
164411
  if (resolved.endPos !== null && resolved.endPos > resolved.pos) {
163736
164412
  const endNode = tr.doc.nodeAt(resolved.endPos);
@@ -163747,6 +164423,22 @@ function bookmarksRemoveWrapper(editor, input2, options) {
163747
164423
  return bookmarkFailure("NO_OP", "Remove operation produced no change.");
163748
164424
  return bookmarkSuccess(address2);
163749
164425
  }
164426
+ function isSpecialEntry(entry) {
164427
+ return SPECIAL_NOTE_TYPES.has(entry.type ?? "");
164428
+ }
164429
+ function findNoteEntryById(entries, noteId) {
164430
+ if (!Array.isArray(entries))
164431
+ return;
164432
+ let fallback;
164433
+ for (const entry of entries) {
164434
+ if (String(entry.id ?? "") !== noteId)
164435
+ continue;
164436
+ if (!isSpecialEntry(entry))
164437
+ return entry;
164438
+ fallback ??= entry;
164439
+ }
164440
+ return fallback;
164441
+ }
163750
164442
  function getConverterStore(editor) {
163751
164443
  return editor.converter ?? {};
163752
164444
  }
@@ -163779,7 +164471,7 @@ function resolveCollectionContent(collection, noteId) {
163779
164471
  if (!collection)
163780
164472
  return "";
163781
164473
  if (Array.isArray(collection))
163782
- return extractTextFromContent(collection.find((entry) => String(entry?.id ?? "") === noteId)?.content);
164474
+ return extractTextFromContent(findNoteEntryById(collection, noteId)?.content);
163783
164475
  if (isLegacyFootnoteMap(collection))
163784
164476
  return collection[noteId]?.content ?? "";
163785
164477
  return "";
@@ -163857,28 +164549,221 @@ function buildFootnoteDiscoveryItem(editor, resolved, evaluatedRevision) {
163857
164549
  const handle3 = buildResolvedHandle2(resolved.noteId, "stable", "node");
163858
164550
  return buildDiscoveryItem2(`footnote:${resolved.noteId}:${evaluatedRevision}`, handle3, domain2);
163859
164551
  }
163860
- function executeOutOfBandMutation(editor, mutateFn, options) {
163861
- if (!options.dryRun)
163862
- if (editor.options?.collaborationProvider && editor.options?.ydoc)
163863
- try {
163864
- yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing();
163865
- } catch {}
163866
- else
163867
- try {
163868
- editor.view?.dispatch?.(closeHistory(editor.state.tr));
163869
- } catch {}
163870
- checkRevision(editor, options.expectedRevision);
163871
- const result = mutateFn(options.dryRun);
163872
- if (result.changed && !options.dryRun) {
163873
- const converter = editor.converter;
163874
- if (converter) {
163875
- converter.documentModified = true;
163876
- if (!converter.documentGuid && typeof converter.promoteToGuid === "function")
163877
- converter.promoteToGuid();
164552
+ function getConverter$13(editor) {
164553
+ return editor.converter;
164554
+ }
164555
+ function getRootElement(part) {
164556
+ return part?.elements?.[0];
164557
+ }
164558
+ function getNoteElements(part, childElementName) {
164559
+ const root3 = getRootElement(part);
164560
+ if (!root3?.elements)
164561
+ return [];
164562
+ return root3.elements.filter((el) => el.name === childElementName);
164563
+ }
164564
+ function textToNoteOoxmlParagraphs(text5) {
164565
+ return text5.split(/\r?\n/).map((line) => ({
164566
+ type: "element",
164567
+ name: "w:p",
164568
+ elements: line.length > 0 ? [{
164569
+ type: "element",
164570
+ name: "w:r",
164571
+ elements: [{
164572
+ type: "element",
164573
+ name: "w:t",
164574
+ attributes: { "xml:space": "preserve" },
164575
+ elements: [{
164576
+ type: "text",
164577
+ text: line
164578
+ }]
164579
+ }]
164580
+ }] : []
164581
+ }));
164582
+ }
164583
+ function ensureFootnoteRefRun(paragraphs, childElementName) {
164584
+ if (paragraphs.length === 0)
164585
+ return;
164586
+ const refName = childElementName === "w:footnote" ? "w:footnoteRef" : "w:endnoteRef";
164587
+ const styleName = childElementName === "w:footnote" ? "FootnoteReference" : "EndnoteReference";
164588
+ const firstParagraph = paragraphs[0];
164589
+ if (!firstParagraph.elements)
164590
+ firstParagraph.elements = [];
164591
+ const refRun = {
164592
+ type: "element",
164593
+ name: "w:r",
164594
+ elements: [{
164595
+ type: "element",
164596
+ name: "w:rPr",
164597
+ elements: [{
164598
+ type: "element",
164599
+ name: "w:rStyle",
164600
+ attributes: { "w:val": styleName }
164601
+ }, {
164602
+ type: "element",
164603
+ name: "w:vertAlign",
164604
+ attributes: { "w:val": "superscript" }
164605
+ }]
164606
+ }, {
164607
+ type: "element",
164608
+ name: refName,
164609
+ elements: []
164610
+ }]
164611
+ };
164612
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el?.name === "w:pPr");
164613
+ firstParagraph.elements.splice(pPrIndex >= 0 ? pPrIndex + 1 : 0, 0, refRun);
164614
+ }
164615
+ function addNoteElement(part, config2, noteId, text5) {
164616
+ const root3 = getRootElement(part);
164617
+ if (!root3)
164618
+ throw new Error(`addNoteElement: missing root element in ${config2.partId}`);
164619
+ if (!root3.elements)
164620
+ root3.elements = [];
164621
+ if (root3.elements.find((el) => el.name === config2.childElementName && el.attributes?.["w:id"] === noteId))
164622
+ throw new Error(`addNoteElement: note id "${noteId}" already exists in ${config2.partId}`);
164623
+ const paragraphs = textToNoteOoxmlParagraphs(text5);
164624
+ ensureFootnoteRefRun(paragraphs, config2.childElementName);
164625
+ const noteElement = {
164626
+ type: "element",
164627
+ name: config2.childElementName,
164628
+ attributes: { "w:id": noteId },
164629
+ elements: paragraphs
164630
+ };
164631
+ root3.elements.push(noteElement);
164632
+ return noteElement;
164633
+ }
164634
+ function updateNoteElement(part, config2, noteId, text5) {
164635
+ const target = getNoteElements(part, config2.childElementName).find((el) => el.attributes?.["w:id"] === noteId);
164636
+ if (!target)
164637
+ return false;
164638
+ const paragraphs = textToNoteOoxmlParagraphs(text5);
164639
+ ensureFootnoteRefRun(paragraphs, config2.childElementName);
164640
+ target.elements = paragraphs;
164641
+ return true;
164642
+ }
164643
+ function removeNoteElement(part, config2, noteId) {
164644
+ const root3 = getRootElement(part);
164645
+ if (!root3?.elements)
164646
+ return false;
164647
+ const index2 = root3.elements.findIndex((el) => el.name === config2.childElementName && el.attributes?.["w:id"] === noteId);
164648
+ if (index2 < 0)
164649
+ return false;
164650
+ root3.elements.splice(index2, 1);
164651
+ return true;
164652
+ }
164653
+ function rebuildDerivedCache(editor, config2, part) {
164654
+ const converter = getConverter$13(editor);
164655
+ if (!converter)
164656
+ return;
164657
+ if (typeof converter.reimportNotePart === "function")
164658
+ try {
164659
+ converter[config2.converterKey] = converter.reimportNotePart(config2.partId);
164660
+ return;
164661
+ } catch (err) {
164662
+ console.warn(`[parts] reimportNotePart failed for ${config2.partId}, using fallback:`, err);
163878
164663
  }
163879
- incrementRevision(editor);
163880
- }
163881
- return result.payload;
164664
+ const entries = getNoteElements(part, config2.childElementName).map((el) => ({
164665
+ id: String(el.attributes?.["w:id"] ?? ""),
164666
+ type: el.attributes?.["w:type"] ?? null,
164667
+ content: [],
164668
+ originalXml: structuredClone(el)
164669
+ }));
164670
+ converter[config2.converterKey] = entries;
164671
+ }
164672
+ function createInitialNotesPart(config2) {
164673
+ return {
164674
+ declaration: { attributes: {
164675
+ version: "1.0",
164676
+ encoding: "UTF-8",
164677
+ standalone: "yes"
164678
+ } },
164679
+ elements: [{
164680
+ type: "element",
164681
+ name: config2.rootElementName,
164682
+ attributes: { ...NOTES_XMLNS },
164683
+ elements: [{
164684
+ type: "element",
164685
+ name: config2.childElementName,
164686
+ attributes: {
164687
+ "w:type": "separator",
164688
+ "w:id": "-1"
164689
+ },
164690
+ elements: [{
164691
+ type: "element",
164692
+ name: "w:p",
164693
+ elements: [{
164694
+ type: "element",
164695
+ name: "w:r",
164696
+ elements: [{
164697
+ type: "element",
164698
+ name: "w:separator",
164699
+ elements: []
164700
+ }]
164701
+ }]
164702
+ }]
164703
+ }, {
164704
+ type: "element",
164705
+ name: config2.childElementName,
164706
+ attributes: {
164707
+ "w:type": "continuationSeparator",
164708
+ "w:id": "0"
164709
+ },
164710
+ elements: [{
164711
+ type: "element",
164712
+ name: "w:p",
164713
+ elements: [{
164714
+ type: "element",
164715
+ name: "w:r",
164716
+ elements: [{
164717
+ type: "element",
164718
+ name: "w:continuationSeparator",
164719
+ elements: []
164720
+ }]
164721
+ }]
164722
+ }]
164723
+ }]
164724
+ }]
164725
+ };
164726
+ }
164727
+ function createNotePartDescriptor(config2) {
164728
+ return {
164729
+ id: config2.partId,
164730
+ ensurePart() {
164731
+ return createInitialNotesPart(config2);
164732
+ },
164733
+ normalizePart(part) {
164734
+ const root3 = getRootElement(part);
164735
+ if (!root3?.elements)
164736
+ return;
164737
+ root3.elements.sort((a2, b$1) => {
164738
+ const aType = a2.attributes?.["w:type"];
164739
+ const bType = b$1.attributes?.["w:type"];
164740
+ const aIsSpecial = aType === "separator" || aType === "continuationSeparator";
164741
+ if (aIsSpecial !== (bType === "separator" || bType === "continuationSeparator"))
164742
+ return aIsSpecial ? -1 : 1;
164743
+ return Number(a2.attributes?.["w:id"] ?? 0) - Number(b$1.attributes?.["w:id"] ?? 0);
164744
+ });
164745
+ },
164746
+ afterCommit({ editor, part, source }) {
164747
+ rebuildDerivedCache(editor, config2, part);
164748
+ clearPartCacheStale(editor, config2.partId);
164749
+ editor.emit("notes-part-changed", {
164750
+ partId: config2.partId,
164751
+ source
164752
+ });
164753
+ }
164754
+ };
164755
+ }
164756
+ function getNotesConfig(type) {
164757
+ return type === "endnote" ? ENDNOTES_CONFIG : FOOTNOTES_CONFIG;
164758
+ }
164759
+ function bootstrapNotesPart(editor, type) {
164760
+ const converter = editor.converter;
164761
+ if (!converter?.convertedXml)
164762
+ return;
164763
+ const config2 = getNotesConfig(type);
164764
+ if (converter.convertedXml[config2.partId] !== undefined)
164765
+ return;
164766
+ converter.convertedXml[config2.partId] = createInitialNotesPart(config2);
163882
164767
  }
163883
164768
  function footnoteSuccess(address2) {
163884
164769
  return {
@@ -163898,39 +164783,11 @@ function footnoteFailure(code$1, message) {
163898
164783
  function configSuccess$1() {
163899
164784
  return { success: true };
163900
164785
  }
163901
- function receiptApplied$6(receipt2) {
163902
- return receipt2.steps[0]?.effect === "changed";
163903
- }
163904
- function isLegacyNoteMap(value) {
163905
- return value != null && typeof value === "object" && !Array.isArray(value);
163906
- }
163907
- function textToFootnoteContentNodes(text5) {
163908
- return text5.split(/\r?\n/).map((line) => ({
163909
- type: "paragraph",
163910
- content: line.length > 0 ? [{
163911
- type: "text",
163912
- text: line
163913
- }] : []
163914
- }));
163915
- }
163916
- function normalizeLegacyNoteMap(map$12) {
163917
- return Object.entries(map$12).map(([id2, value]) => ({
163918
- id: String(id2),
163919
- content: textToFootnoteContentNodes(value?.content ?? "")
163920
- }));
163921
- }
163922
- function ensureNoteEntries(converter, kind) {
163923
- const current = converter[kind];
163924
- if (Array.isArray(current))
163925
- return current;
163926
- if (isLegacyNoteMap(current)) {
163927
- const normalized = normalizeLegacyNoteMap(current);
163928
- converter[kind] = normalized;
163929
- return normalized;
163930
- }
163931
- const initialized = [];
163932
- converter[kind] = initialized;
163933
- return initialized;
164786
+ function getConverter2(editor) {
164787
+ const converter = editor.converter;
164788
+ if (!converter)
164789
+ throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "converter not available.");
164790
+ return converter;
163934
164791
  }
163935
164792
  function toNonNegativeInteger(value) {
163936
164793
  const num = Number(value);
@@ -163938,35 +164795,36 @@ function toNonNegativeInteger(value) {
163938
164795
  return null;
163939
164796
  return num;
163940
164797
  }
163941
- function allocateNextNoteId(editor, type, entries) {
163942
- let maxId = 0;
164798
+ function collectUsedNoteIds(editor, converter, type) {
164799
+ const used = /* @__PURE__ */ new Set;
164800
+ const config2 = getNotesConfig(type);
163943
164801
  for (const ref$1 of findAllFootnotes(editor.state.doc, type)) {
163944
164802
  const parsed = toNonNegativeInteger(ref$1.noteId);
163945
164803
  if (parsed != null)
163946
- maxId = Math.max(maxId, parsed);
163947
- }
163948
- for (const entry of entries) {
163949
- const parsed = toNonNegativeInteger(entry.id);
163950
- if (parsed != null)
163951
- maxId = Math.max(maxId, parsed);
163952
- }
163953
- return String(maxId + 1);
163954
- }
163955
- function upsertNoteEntry(entries, noteId, content3) {
163956
- const existing = entries.find((entry) => String(entry.id) === noteId);
163957
- if (existing) {
163958
- existing.content = textToFootnoteContentNodes(content3);
163959
- return;
163960
- }
163961
- entries.push({
163962
- id: noteId,
163963
- content: textToFootnoteContentNodes(content3)
163964
- });
163965
- }
163966
- function removeNoteEntry(entries, noteId) {
163967
- const index2 = entries.findIndex((entry) => String(entry.id) === noteId);
163968
- if (index2 >= 0)
163969
- entries.splice(index2, 1);
164804
+ used.add(parsed);
164805
+ }
164806
+ const ooxmlPart = converter.convertedXml?.[config2.partId];
164807
+ if (ooxmlPart)
164808
+ for (const el of getNoteElements(ooxmlPart, config2.childElementName)) {
164809
+ const parsed = toNonNegativeInteger(el.attributes?.["w:id"]);
164810
+ if (parsed != null)
164811
+ used.add(parsed);
164812
+ }
164813
+ const cache$2 = converter[config2.converterKey];
164814
+ if (Array.isArray(cache$2))
164815
+ for (const entry of cache$2) {
164816
+ const parsed = toNonNegativeInteger(entry.id);
164817
+ if (parsed != null)
164818
+ used.add(parsed);
164819
+ }
164820
+ return used;
164821
+ }
164822
+ function allocateNextNoteId(editor, converter, type) {
164823
+ const used = collectUsedNoteIds(editor, converter, type);
164824
+ let candidate = 1;
164825
+ while (used.has(candidate))
164826
+ candidate += 1;
164827
+ return String(candidate);
163970
164828
  }
163971
164829
  function footnotesListWrapper(editor, query2) {
163972
164830
  const doc$2 = editor.state.doc;
@@ -163988,11 +164846,10 @@ function footnotesGetWrapper(editor, input2) {
163988
164846
  }
163989
164847
  function footnotesInsertWrapper(editor, input2, options) {
163990
164848
  rejectTrackedMode("footnotes.insert", options);
163991
- const converter = editor.converter;
163992
- if (!converter)
163993
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "footnotes.insert: converter not available.");
163994
- const noteEntries = ensureNoteEntries(converter, input2.type === "endnote" ? "endnotes" : "footnotes");
163995
- const noteId = allocateNextNoteId(editor, input2.type, noteEntries);
164849
+ checkRevision(editor, options?.expectedRevision);
164850
+ const converter = getConverter2(editor);
164851
+ const notesConfig = getNotesConfig(input2.type);
164852
+ const noteId = allocateNextNoteId(editor, converter, input2.type);
163996
164853
  const address2 = {
163997
164854
  kind: "entity",
163998
164855
  entityType: "footnote",
@@ -164005,15 +164862,30 @@ function footnotesInsertWrapper(editor, input2, options) {
164005
164862
  if (!nodeType)
164006
164863
  throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", `footnotes.insert: node type "${nodeTypeName}" is not registered in the schema.`);
164007
164864
  const resolved = resolveInlineInsertPosition(editor, input2.at, "footnotes.insert");
164008
- if (!receiptApplied$6(executeDomainCommand(editor, () => {
164009
- const node3 = nodeType.create({ id: noteId });
164010
- const { tr } = editor.state;
164011
- tr.insert(resolved.from, node3);
164012
- editor.dispatch(tr);
164013
- upsertNoteEntry(noteEntries, noteId, input2.content);
164014
- clearIndexCache(editor);
164015
- return true;
164016
- }, { expectedRevision: options?.expectedRevision })))
164865
+ const { success } = compoundMutation({
164866
+ editor,
164867
+ source: `footnotes.insert:${input2.type}`,
164868
+ affectedParts: [notesConfig.partId],
164869
+ execute: () => {
164870
+ bootstrapNotesPart(editor, input2.type);
164871
+ mutatePart({
164872
+ editor,
164873
+ partId: notesConfig.partId,
164874
+ operation: "mutate",
164875
+ source: `footnotes.insert:${input2.type}`,
164876
+ mutate({ part }) {
164877
+ addNoteElement(part, notesConfig, noteId, input2.content);
164878
+ }
164879
+ });
164880
+ const node3 = nodeType.create({ id: noteId });
164881
+ const { tr } = editor.state;
164882
+ tr.insert(resolved.from, node3);
164883
+ editor.dispatch(tr);
164884
+ clearIndexCache(editor);
164885
+ return true;
164886
+ }
164887
+ });
164888
+ if (!success)
164017
164889
  return footnoteFailure("NO_OP", "Insert operation produced no change.");
164018
164890
  return footnoteSuccess(address2);
164019
164891
  }
@@ -164025,32 +164897,24 @@ function footnotesUpdateWrapper(editor, input2, options) {
164025
164897
  entityType: "footnote",
164026
164898
  noteId: resolved.noteId
164027
164899
  };
164028
- if (options?.dryRun)
164900
+ if (options?.dryRun || input2.patch.content === undefined)
164029
164901
  return footnoteSuccess(address2);
164030
- const converter = editor.converter;
164031
- if (!converter)
164032
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "footnotes.update: converter not available.");
164033
- const noteEntries = ensureNoteEntries(converter, resolved.type === "footnote" ? "footnotes" : "endnotes");
164034
- executeOutOfBandMutation(editor, (dryRun) => {
164035
- if (input2.patch.content === undefined)
164036
- return {
164037
- changed: false,
164038
- payload: undefined
164039
- };
164040
- if (!dryRun)
164041
- upsertNoteEntry(noteEntries, resolved.noteId, input2.patch.content);
164042
- return {
164043
- changed: true,
164044
- payload: undefined
164045
- };
164046
- }, {
164047
- dryRun: options?.dryRun ?? false,
164048
- expectedRevision: options?.expectedRevision
164902
+ const notesConfig = getNotesConfig(resolved.type);
164903
+ mutatePart({
164904
+ editor,
164905
+ partId: notesConfig.partId,
164906
+ operation: "mutate",
164907
+ source: `footnotes.update:${resolved.type}`,
164908
+ expectedRevision: options?.expectedRevision,
164909
+ mutate({ part }) {
164910
+ updateNoteElement(part, notesConfig, resolved.noteId, input2.patch.content);
164911
+ }
164049
164912
  });
164050
164913
  return footnoteSuccess(address2);
164051
164914
  }
164052
164915
  function footnotesRemoveWrapper(editor, input2, options) {
164053
164916
  rejectTrackedMode("footnotes.remove", options);
164917
+ checkRevision(editor, options?.expectedRevision);
164054
164918
  const resolved = resolveFootnoteTarget(editor.state.doc, input2.target);
164055
164919
  const address2 = {
164056
164920
  kind: "entity",
@@ -164059,63 +164923,102 @@ function footnotesRemoveWrapper(editor, input2, options) {
164059
164923
  };
164060
164924
  if (options?.dryRun)
164061
164925
  return footnoteSuccess(address2);
164062
- if (!receiptApplied$6(executeDomainCommand(editor, () => {
164063
- const { tr } = editor.state;
164064
- const node3 = tr.doc.nodeAt(resolved.pos);
164065
- if (node3) {
164926
+ const notesConfig = getNotesConfig(resolved.type);
164927
+ const { success } = compoundMutation({
164928
+ editor,
164929
+ source: `footnotes.remove:${resolved.type}`,
164930
+ affectedParts: [notesConfig.partId],
164931
+ execute: () => {
164932
+ const { tr } = editor.state;
164933
+ const node3 = tr.doc.nodeAt(resolved.pos);
164934
+ if (!node3)
164935
+ return false;
164066
164936
  tr.delete(resolved.pos, resolved.pos + node3.nodeSize);
164067
164937
  editor.dispatch(tr);
164068
- const converter = editor.converter;
164069
- if (converter) {
164070
- const noteEntries = ensureNoteEntries(converter, resolved.type === "footnote" ? "footnotes" : "endnotes");
164071
- if (!findAllFootnotes(editor.state.doc, resolved.type).some((f2) => f2.noteId === resolved.noteId))
164072
- removeNoteEntry(noteEntries, resolved.noteId);
164073
- }
164938
+ if (!findAllFootnotes(editor.state.doc, resolved.type).some((f2) => f2.noteId === resolved.noteId))
164939
+ mutatePart({
164940
+ editor,
164941
+ partId: notesConfig.partId,
164942
+ operation: "mutate",
164943
+ source: `footnotes.remove:${resolved.type}`,
164944
+ mutate({ part }) {
164945
+ removeNoteElement(part, notesConfig, resolved.noteId);
164946
+ }
164947
+ });
164074
164948
  clearIndexCache(editor);
164075
164949
  return true;
164076
164950
  }
164077
- return false;
164078
- }, { expectedRevision: options?.expectedRevision })))
164951
+ });
164952
+ if (!success)
164079
164953
  return footnoteFailure("NO_OP", "Remove operation produced no change.");
164080
164954
  return footnoteSuccess(address2);
164081
164955
  }
164082
164956
  function footnotesConfigureWrapper(editor, input2, options) {
164083
164957
  rejectTrackedMode("footnotes.configure", options);
164084
- const converter = editor.converter;
164085
- if (!converter)
164086
- throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "footnotes.configure: converter not available.");
164087
- executeOutOfBandMutation(editor, (dryRun) => {
164088
- if (dryRun)
164089
- return {
164090
- changed: true,
164091
- payload: undefined
164092
- };
164093
- if (!converter.footnoteProperties)
164094
- converter.footnoteProperties = { source: "settings" };
164095
- const props = converter.footnoteProperties;
164096
- if (input2.numbering) {
164097
- if (input2.numbering.format !== undefined)
164098
- props.numFmt = input2.numbering.format;
164099
- if (input2.numbering.start !== undefined)
164100
- props.numStart = String(input2.numbering.start);
164958
+ const prElementName = input2.type === "endnote" ? "w:endnotePr" : "w:footnotePr";
164959
+ mutatePart({
164960
+ editor,
164961
+ partId: "word/settings.xml",
164962
+ operation: "mutate",
164963
+ source: `footnotes.configure:${input2.type}`,
164964
+ dryRun: options?.dryRun,
164965
+ expectedRevision: options?.expectedRevision,
164966
+ mutate({ part }) {
164967
+ const root3 = part?.elements?.[0];
164968
+ if (!root3)
164969
+ return;
164970
+ if (!root3.elements)
164971
+ root3.elements = [];
164972
+ const elements = root3.elements;
164973
+ let prElement = elements.find((el) => el.name === prElementName);
164974
+ if (!prElement) {
164975
+ prElement = {
164976
+ type: "element",
164977
+ name: prElementName,
164978
+ elements: []
164979
+ };
164980
+ elements.push(prElement);
164981
+ }
164982
+ if (!prElement.elements)
164983
+ prElement.elements = [];
164984
+ if (!input2.numbering)
164985
+ return;
164986
+ const setOrRemoveChild = (name, value) => {
164987
+ if (value === undefined)
164988
+ return;
164989
+ const children = prElement.elements;
164990
+ const existing = children.findIndex((el) => el.name === name);
164991
+ const newEl = {
164992
+ type: "element",
164993
+ name,
164994
+ attributes: { "w:val": value }
164995
+ };
164996
+ if (existing >= 0)
164997
+ children[existing] = newEl;
164998
+ else
164999
+ children.push(newEl);
165000
+ };
165001
+ setOrRemoveChild("w:numFmt", input2.numbering.format);
165002
+ setOrRemoveChild("w:numStart", input2.numbering.start !== undefined ? String(input2.numbering.start) : undefined);
164101
165003
  if (input2.numbering.restartPolicy !== undefined)
164102
- props.numRestart = RESTART_POLICY_TO_OOXML[input2.numbering.restartPolicy] ?? input2.numbering.restartPolicy;
164103
- if (input2.numbering.position !== undefined)
164104
- props.pos = input2.numbering.position;
165004
+ setOrRemoveChild("w:numRestart", RESTART_POLICY_TO_OOXML[input2.numbering.restartPolicy] ?? input2.numbering.restartPolicy);
165005
+ setOrRemoveChild("w:pos", input2.numbering.position);
164105
165006
  }
164106
- props.noteType = input2.type;
164107
- if (input2.scope)
164108
- props.scope = input2.scope;
164109
- return {
164110
- changed: true,
164111
- payload: undefined
164112
- };
164113
- }, {
164114
- dryRun: options?.dryRun ?? false,
164115
- expectedRevision: options?.expectedRevision
164116
165007
  });
165008
+ if (!options?.dryRun && prElementName === "w:footnotePr")
165009
+ syncFootnotePropertiesCache(editor);
164117
165010
  return configSuccess$1();
164118
165011
  }
165012
+ function syncFootnotePropertiesCache(editor) {
165013
+ const converter = getConverter2(editor);
165014
+ if (!converter?.footnoteProperties || converter.footnoteProperties.source !== "settings")
165015
+ return;
165016
+ const prElement = (converter.convertedXml?.["word/settings.xml"]?.elements?.[0]?.elements ?? []).find((el) => el.name === "w:footnotePr");
165017
+ if (prElement)
165018
+ converter.footnoteProperties.originalXml = structuredClone(prElement);
165019
+ else
165020
+ converter.footnoteProperties = null;
165021
+ }
164119
165022
  function findAllCrossRefs(doc$2) {
164120
165023
  const results = [];
164121
165024
  doc$2.descendants((node3, pos) => {
@@ -165662,6 +166565,29 @@ function buildCitationAddress(doc$2, resolved) {
165662
166565
  }
165663
166566
  };
165664
166567
  }
166568
+ function executeOutOfBandMutation(editor, mutateFn, options) {
166569
+ if (!options.dryRun)
166570
+ if (editor.options?.collaborationProvider && editor.options?.ydoc)
166571
+ try {
166572
+ yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing();
166573
+ } catch {}
166574
+ else
166575
+ try {
166576
+ editor.view?.dispatch?.(closeHistory(editor.state.tr));
166577
+ } catch {}
166578
+ checkRevision(editor, options.expectedRevision);
166579
+ const result = mutateFn(options.dryRun);
166580
+ if (result.changed && !options.dryRun) {
166581
+ const converter = editor.converter;
166582
+ if (converter) {
166583
+ converter.documentModified = true;
166584
+ if (!converter.documentGuid && typeof converter.promoteToGuid === "function")
166585
+ converter.promoteToGuid();
166586
+ }
166587
+ incrementRevision(editor);
166588
+ }
166589
+ return result.payload;
166590
+ }
165665
166591
  function citationSuccess(address2) {
165666
166592
  return {
165667
166593
  success: true,
@@ -166667,7 +167593,11 @@ function assembleDocumentApiAdapters(editor) {
166667
167593
  acceptAll: (input2, options) => trackChangesAcceptAllWrapper(editor, input2, options),
166668
167594
  rejectAll: (input2, options) => trackChangesRejectAllWrapper(editor, input2, options)
166669
167595
  },
166670
- blocks: { delete: (input2, options) => blocksDeleteWrapper(editor, input2, options) },
167596
+ blocks: {
167597
+ list: (input2) => blocksListWrapper(editor, input2),
167598
+ delete: (input2, options) => blocksDeleteWrapper(editor, input2, options),
167599
+ deleteRange: (input2, options) => blocksDeleteRangeWrapper(editor, input2, options)
167600
+ },
166671
167601
  create: {
166672
167602
  paragraph: (input2, options) => createParagraphWrapper(editor, input2, options),
166673
167603
  heading: (input2, options) => createHeadingWrapper(editor, input2, options),
@@ -166943,6 +167873,8 @@ function initPartsRuntime(editor) {
166943
167873
  registerPartDescriptor(relsPartDescriptor);
166944
167874
  registerPartDescriptor(numberingPartDescriptor);
166945
167875
  registerPartDescriptor(contentTypesPartDescriptor);
167876
+ registerPartDescriptor(footnotesPartDescriptor);
167877
+ registerPartDescriptor(endnotesPartDescriptor);
166946
167878
  registerStaticInvalidationHandlers();
166947
167879
  initRevision(editor);
166948
167880
  trackRevisions(editor);
@@ -179198,7 +180130,7 @@ function buildFootnotesInput(editorState, converter, converterContext, themeColo
179198
180130
  return null;
179199
180131
  const blocksById = /* @__PURE__ */ new Map;
179200
180132
  idsInUse.forEach((id2) => {
179201
- const content3 = importedFootnotes.find((f2) => String(f2?.id) === id2)?.content;
180133
+ const content3 = findNoteEntryById(importedFootnotes, id2)?.content;
179202
180134
  if (!Array.isArray(content3) || content3.length === 0)
179203
180135
  return;
179204
180136
  try {
@@ -190707,14 +191639,7 @@ var Node$13 = class Node$14 {
190707
191639
  typeOver = true;
190708
191640
  }
190709
191641
  }
190710
- if (added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
190711
- for (let node3 of added)
190712
- if (node3.nodeName == "BR" && node3.parentNode) {
190713
- let after = node3.nextSibling;
190714
- if (after && after.nodeType == 1 && after.contentEditable == "false")
190715
- node3.parentNode.removeChild(node3);
190716
- }
190717
- } else if (gecko && added.length) {
191642
+ if (gecko && added.length) {
190718
191643
  let brs = added.filter((n) => n.nodeName == "BR");
190719
191644
  if (brs.length == 2) {
190720
191645
  let [a2, b$1] = brs;
@@ -190730,6 +191655,13 @@ var Node$13 = class Node$14 {
190730
191655
  br2.remove();
190731
191656
  }
190732
191657
  }
191658
+ } else if ((chrome || safari) && added.some((n) => n.nodeName == "BR") && (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46)) {
191659
+ for (let node3 of added)
191660
+ if (node3.nodeName == "BR" && node3.parentNode) {
191661
+ let after = node3.nextSibling;
191662
+ if (after && after.nodeType == 1 && after.contentEditable == "false")
191663
+ node3.parentNode.removeChild(node3);
191664
+ }
190733
191665
  }
190734
191666
  let readSel = null;
190735
191667
  if (from$1 < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
@@ -198134,7 +199066,7 @@ var Node$13 = class Node$14 {
198134
199066
  console.warn("Failed to initialize developer tools:", error);
198135
199067
  }
198136
199068
  }
198137
- }, BLANK_DOCX_DATA_URI = `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,UEsDBBQAAAAIA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AARABgAAAAAAAEAAACkgXcMAAB3b3JkL3NldHRpbmdzLnhtbFVUBQADMNDOEnV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQDbhWzDfQQAAJcdAAASABgAAAAAAAEAAACkge0QAAB3b3JkL251bWJlcmluZy54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAAAACEAvn52YlYBAADQAwAAFAAYAAAAAAABAAAApIG2FQAAd29yZC93ZWJTZXR0aW5ncy54bWxVVAUAAzDQzhJ1eAsAAQT1AQAABBQAAABQSwECHgMUAAAACAAAACEAP6/hZl8PAAANpgAADwAYAAAAAAABAAAApIFaFwAAd29yZC9zdHlsZXMueG1sVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsBAh4DCgAAAAAAk2RNWwAAAAAAAAAAAAAAAAsAGAAAAAAAAAAQAO1BAicAAHdvcmQvdGhlbWUvVVQFAAOGHO1odXgLAAEE9QEAAAQUAAAAUEsBAh4DFAAAAAgAAAAhAGeA/LSbBgAAzSAAABUAGAAAAAAAAQAAAKSBRycAAHdvcmQvdGhlbWUvdGhlbWUxLnhtbFVUBQADMNDOEnV4CwABBPUBAAAEFAAAAFBLAQIeAwoAAAAAAJNkTVsAAAAAAAAAAAAAAAALABgAAAAAAAAAEADtQTEuAAB3b3JkL19yZWxzL1VUBQADhhztaHV4CwABBPUBAAAEFAAAAFBLAQIeAxQAAAAIAAAAIQCzvosd/gAAALYDAAAcABgAAAAAAAEAAACkgXYuAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsFBgAAAAARABEAqQUAAMovAAAAAA==`, DocumentApiAdapterError, ALIAS_ELIGIBLE_TYPES, TAB_LEADER_TO_SEPARATOR, SEPARATOR_TO_TAB_LEADER, DEFAULT_TOC_CONFIG, SWITCH_PATTERN$1, SectionType, DEFAULT_PARAGRAPH_SECTION_TYPE, DEFAULT_BODY_SECTION_TYPE, TWIPS_PER_INCH$2 = 1440, PX_PER_INCH$2 = 96, DEFAULT_COLUMN_GAP_INCHES = 0.5, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, ALIGNMENT_TO_JUSTIFICATION, DERIVED_ID_LENGTH = 24, groupedCache, SUPPORTED_NODE_TYPES, REJECTED_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, CSS_NAMED_COLORS, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_OPS, TABLE_SCOPED_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, 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) => {
199069
+ }, BLANK_DOCX_DATA_URI = `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,UEsDBBQAAAAIAAAAIQAykW9XXgEAAKUFAAATABwAW0NvbnRlbnRfVHlwZXNdLnhtbFVUCQADMNDOEjDQzhJ1eAsAAQT1AQAABBQAAAC1lMtqwzAQRfeF/oPRNthKuiilxMmij2UbaPoBijRORPVCmrz+vuM4NaWkMeSxMcgz994zQsxwvLEmW0FM2ruSDYo+y8BJr7Sbl+xz+po/sCyhcEoY76BkW0hsPLq9GU63AVJGapdKtkAMj5wnuQArUuEDOKpUPlqBdIxzHoT8EnPgd/3+PZfeITjMsfZgo+EzVGJpMHvZ0O+GJIJJLHtqGuuskokQjJYCqc5XTv1JyfcJBSl3PWmhQ+pRA+MHE+rK/wF73TtdTdQKsomI+CYsdfG1j4orL5eWlMVxmwOcvqq0hFZfu4XoJaREd25N0Vas0K7XxeGWdgaRlJcHaa07IRJuDaTLEzS+3fGASIJrAOydOxHWMPu4GsUv806QinKnYmbg8hitdScE0hqA5js4m2NncyySOifRh0RrJZ4w9s/eqNU5DRwgoj7+6tpEsj57PqhXkgJ1IJvvluzoG1BLAwQKAAAAAACTZE1bAAAAAAAAAAAAAAAACQAcAGRvY1Byb3BzL1VUCQADhhztaIcc7Wh1eAsAAQT1AQAABBQAAABQSwMEFAAAAAgAAAAhACEYr1llAQAAxQIAABAAHABkb2NQcm9wcy9hcHAueG1sVVQJAAMw0M4SMNDOEnV4CwABBPUBAAAEFAAAAJ1STU/DMAy9I/Efqt63dBw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FBLAQIeAxQAAAAIAAAAIQCzvosd/gAAALYDAAAcABgAAAAAAAEAAACkgXYuAAB3b3JkL19yZWxzL2RvY3VtZW50LnhtbC5yZWxzVVQFAAMw0M4SdXgLAAEE9QEAAAQUAAAAUEsFBgAAAAARABEAqQUAAMovAAAAAA==`, DocumentApiAdapterError, ALIAS_ELIGIBLE_TYPES, TAB_LEADER_TO_SEPARATOR, SEPARATOR_TO_TAB_LEADER, DEFAULT_TOC_CONFIG, SWITCH_PATTERN$1, SectionType, DEFAULT_PARAGRAPH_SECTION_TYPE, DEFAULT_BODY_SECTION_TYPE, TWIPS_PER_INCH$2 = 1440, PX_PER_INCH$2 = 96, DEFAULT_COLUMN_GAP_INCHES = 0.5, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, ALIGNMENT_TO_JUSTIFICATION, DERIVED_ID_LENGTH = 24, groupedCache, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, CSS_NAMED_COLORS, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_OPS, TABLE_SCOPED_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, 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) => {
198138
199070
  let hash$3 = 0;
198139
199071
  for (let i$1 = 0;i$1 < str.length; i$1++) {
198140
199072
  const char = str.charCodeAt(i$1);
@@ -198613,7 +199545,7 @@ var Node$13 = class Node$14 {
198613
199545
  candidate = String(parseInt(hex, 16));
198614
199546
  } while (!candidate || existingIds.has(candidate));
198615
199547
  return candidate;
198616
- }, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_TYPES, TOA_LEADER_REVERSE_MAP, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
199548
+ }, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, SPECIAL_NOTE_TYPES, FOOTNOTES_PART_ID = "word/footnotes.xml", ENDNOTES_PART_ID = "word/endnotes.xml", FOOTNOTES_CONFIG, ENDNOTES_CONFIG, NOTES_XMLNS, footnotesPartDescriptor, endnotesPartDescriptor, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_TYPES, TOA_LEADER_REVERSE_MAP, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
198617
199549
  constructor(config2) {
198618
199550
  this.search = config2.search;
198619
199551
  this.caseSensitive = !!config2.caseSensitive;
@@ -216826,9 +217758,9 @@ var Node$13 = class Node$14 {
216826
217758
  return false;
216827
217759
  return Boolean(checker(attrs));
216828
217760
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
216829
- var init_src_BDv_tIia_es = __esm(() => {
217761
+ var init_src_BV6PERs7_es = __esm(() => {
216830
217762
  init_rolldown_runtime_B2q5OVn9_es();
216831
- init_SuperConverter_BBGfKYpx_es();
217763
+ init_SuperConverter_Cw5CEerM_es();
216832
217764
  init_jszip_ChlR43oI_es();
216833
217765
  init_uuid_qzgm05fK_es();
216834
217766
  init_constants_CMPtQbp7_es();
@@ -225380,8 +226312,9 @@ function print() { __p += __j.call(arguments, '') }
225380
226312
  justify: "both"
225381
226313
  };
225382
226314
  groupedCache = /* @__PURE__ */ new WeakMap;
225383
- SUPPORTED_NODE_TYPES = new Set(DELETABLE_BLOCK_NODE_TYPES2);
225384
- REJECTED_NODE_TYPES = new Set(["tableRow", "tableCell"]);
226315
+ SUPPORTED_DELETE_NODE_TYPES3 = new Set(DELETABLE_BLOCK_NODE_TYPES2);
226316
+ REJECTED_DELETE_NODE_TYPES3 = new Set(["tableRow", "tableCell"]);
226317
+ RANGE_DELETE_SAFE_NODE_TYPES = new Set(["passthroughBlock", "passthroughInline"]);
225385
226318
  ORDERED_PRESET_CONFIG = {
225386
226319
  decimal: {
225387
226320
  numFmt: "decimal",
@@ -225662,7 +226595,7 @@ function print() { __p += __j.call(arguments, '') }
225662
226595
  stylesPartDescriptor = {
225663
226596
  id: STYLES_PART_ID,
225664
226597
  ensurePart(editor) {
225665
- const converter = getConverter$5(editor);
226598
+ const converter = getConverter$7(editor);
225666
226599
  if (converter?.convertedXml[STYLES_PART_ID])
225667
226600
  return converter.convertedXml[STYLES_PART_ID];
225668
226601
  return {
@@ -225677,7 +226610,7 @@ function print() { __p += __j.call(arguments, '') }
225677
226610
  },
225678
226611
  afterCommit(ctx$1) {
225679
226612
  if (ctx$1.source.startsWith("collab:remote:")) {
225680
- const converter = getConverter$5(ctx$1.editor);
226613
+ const converter = getConverter$7(ctx$1.editor);
225681
226614
  if (converter)
225682
226615
  try {
225683
226616
  converter.translatedLinkedStyles = translateStyleDefinitions(converter.convertedXml);
@@ -225802,6 +226735,38 @@ function print() { __p += __j.call(arguments, '') }
225802
226735
  KIND_ORDER = ["header", "footer"];
225803
226736
  HEADER_FILE_PATTERN = /header(\d+)\.xml$/;
225804
226737
  FOOTER_FILE_PATTERN = /footer(\d+)\.xml$/;
226738
+ SPECIAL_NOTE_TYPES = new Set(["separator", "continuationSeparator"]);
226739
+ FOOTNOTES_CONFIG = {
226740
+ partId: FOOTNOTES_PART_ID,
226741
+ rootElementName: "w:footnotes",
226742
+ childElementName: "w:footnote",
226743
+ converterKey: "footnotes"
226744
+ };
226745
+ ENDNOTES_CONFIG = {
226746
+ partId: ENDNOTES_PART_ID,
226747
+ rootElementName: "w:endnotes",
226748
+ childElementName: "w:endnote",
226749
+ converterKey: "endnotes"
226750
+ };
226751
+ NOTES_XMLNS = {
226752
+ "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
226753
+ "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
226754
+ "xmlns:o": "urn:schemas-microsoft-com:office:office",
226755
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
226756
+ "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
226757
+ "xmlns:v": "urn:schemas-microsoft-com:vml",
226758
+ "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
226759
+ "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
226760
+ "xmlns:w10": "urn:schemas-microsoft-com:office:word",
226761
+ "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
226762
+ "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
226763
+ "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
226764
+ "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
226765
+ "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
226766
+ "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
226767
+ };
226768
+ footnotesPartDescriptor = createNotePartDescriptor(FOOTNOTES_CONFIG);
226769
+ endnotesPartDescriptor = createNotePartDescriptor(ENDNOTES_CONFIG);
225805
226770
  RESTART_POLICY_TO_OOXML = {
225806
226771
  continuous: "continuous",
225807
226772
  eachSection: "eachSect",
@@ -236980,6 +237945,16 @@ function print() { __p += __j.call(arguments, '') }
236980
237945
  event: "stylesDefaultsChanged",
236981
237946
  handler: handleStylesDefaultsChanged
236982
237947
  });
237948
+ const handleNotesPartChanged = () => {
237949
+ this.#pendingDocChange = true;
237950
+ this.#selectionSync.onLayoutStart();
237951
+ this.#scheduleRerender();
237952
+ };
237953
+ this.#editor.on("notes-part-changed", handleNotesPartChanged);
237954
+ this.#editorListeners.push({
237955
+ event: "notes-part-changed",
237956
+ handler: handleNotesPartChanged
237957
+ });
236983
237958
  const handleCollaborationReady = (payload) => {
236984
237959
  this.emit("collaborationReady", payload);
236985
237960
  if (this.#options.collaborationProvider?.awareness && this.#layoutOptions.presence?.enabled !== false)
@@ -250454,8 +251429,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
250454
251429
 
250455
251430
  // ../../packages/superdoc/dist/super-editor.es.js
250456
251431
  var init_super_editor_es = __esm(() => {
250457
- init_src_BDv_tIia_es();
250458
- init_SuperConverter_BBGfKYpx_es();
251432
+ init_src_BV6PERs7_es();
251433
+ init_SuperConverter_Cw5CEerM_es();
250459
251434
  init_jszip_ChlR43oI_es();
250460
251435
  init_xml_js_DLE8mr0n_es();
250461
251436
  init_constants_CMPtQbp7_es();
@@ -251904,7 +252879,18 @@ var OBJECT_REPLACEMENT_CHAR2 = "";
251904
252879
 
251905
252880
  // ../../packages/super-editor/src/document-api-adapters/helpers/adapter-utils.ts
251906
252881
  function findTextBlockCandidates2(index2, blockId) {
251907
- return index2.candidates.filter((candidate) => candidate.nodeId === blockId && isTextBlockCandidate2(candidate));
252882
+ const primary = index2.candidates.filter((c) => c.nodeId === blockId && isTextBlockCandidate2(c));
252883
+ if (primary.length > 0)
252884
+ return primary;
252885
+ try {
252886
+ const resolved = findBlockByNodeIdOnly2(index2, blockId);
252887
+ if (isTextBlockCandidate2(resolved))
252888
+ return [resolved];
252889
+ } catch (e) {
252890
+ if (e instanceof DocumentApiAdapterError3 && e.code === "AMBIGUOUS_TARGET")
252891
+ throw e;
252892
+ }
252893
+ return [];
251908
252894
  }
251909
252895
  function assertUnambiguous2(matches2, blockId) {
251910
252896
  if (matches2.length > 1) {
@@ -275878,7 +276864,7 @@ var init_awareness = __esm(() => {
275878
276864
  };
275879
276865
  });
275880
276866
 
275881
- // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/keys.js
276867
+ // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_bbc4954c3f565631ca331e4536595600/node_modules/y-prosemirror/src/plugins/keys.js
275882
276868
  var ySyncPluginKey2, yUndoPluginKey2, yCursorPluginKey2;
275883
276869
  var init_keys = __esm(() => {
275884
276870
  init_dist5();
@@ -275887,18 +276873,18 @@ var init_keys = __esm(() => {
275887
276873
  yCursorPluginKey2 = new PluginKey2("yjs-cursor");
275888
276874
  });
275889
276875
 
275890
- // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/cursor-plugin.js
276876
+ // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_bbc4954c3f565631ca331e4536595600/node_modules/y-prosemirror/src/plugins/cursor-plugin.js
275891
276877
  var init_cursor_plugin = __esm(() => {
275892
276878
  init_awareness();
275893
276879
  });
275894
276880
 
275895
- // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/plugins/undo-plugin.js
276881
+ // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_bbc4954c3f565631ca331e4536595600/node_modules/y-prosemirror/src/plugins/undo-plugin.js
275896
276882
  var defaultProtectedNodes2;
275897
276883
  var init_undo_plugin = __esm(() => {
275898
276884
  defaultProtectedNodes2 = new Set(["paragraph"]);
275899
276885
  });
275900
276886
 
275901
- // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_4cc29e23e769b0d152b4b8d1fb5406d2/node_modules/y-prosemirror/src/y-prosemirror.js
276887
+ // ../../node_modules/.pnpm/y-prosemirror@1.3.7_prosemirror-model@1.25.4_prosemirror-state@1.4.4_prosemirror-view@1_bbc4954c3f565631ca331e4536595600/node_modules/y-prosemirror/src/y-prosemirror.js
275902
276888
  var init_y_prosemirror = __esm(() => {
275903
276889
  init_cursor_plugin();
275904
276890
  init_undo_plugin();
@@ -307891,20 +308877,28 @@ var init_documentCommentsImporter = __esm(() => {
307891
308877
  });
307892
308878
 
307893
308879
  // ../../packages/super-editor/src/core/super-converter/v2/importer/documentFootnotesImporter.js
307894
- function importFootnoteData2({ docx, editor, converter, nodeListHandler, numbering } = {}) {
308880
+ function importNoteEntries2({
308881
+ partXml,
308882
+ childElementName,
308883
+ filename,
308884
+ docx,
308885
+ editor,
308886
+ converter,
308887
+ nodeListHandler,
308888
+ numbering
308889
+ }) {
307895
308890
  const handler3 = nodeListHandler || defaultNodeListHandler2();
307896
- const footnotes = docx?.["word/footnotes.xml"];
307897
- if (!footnotes?.elements?.length)
308891
+ if (!partXml?.elements?.length)
307898
308892
  return [];
307899
- const root4 = footnotes.elements[0];
308893
+ const root4 = partXml.elements[0];
307900
308894
  const elements = Array.isArray(root4?.elements) ? root4.elements : [];
307901
- const footnoteElements = elements.filter((el) => el?.name === "w:footnote");
307902
- if (footnoteElements.length === 0)
308895
+ const noteElements = elements.filter((el) => el?.name === childElementName);
308896
+ if (noteElements.length === 0)
307903
308897
  return [];
307904
308898
  const results = [];
307905
308899
  const lists = {};
307906
308900
  const inlineDocumentFonts = [];
307907
- footnoteElements.forEach((el) => {
308901
+ noteElements.forEach((el) => {
307908
308902
  const idRaw = el?.attributes?.["w:id"];
307909
308903
  if (idRaw === undefined || idRaw === null)
307910
308904
  return;
@@ -307933,7 +308927,7 @@ function importFootnoteData2({ docx, editor, converter, nodeListHandler, numberi
307933
308927
  numbering,
307934
308928
  lists,
307935
308929
  inlineDocumentFonts,
307936
- filename: "footnotes.xml",
308930
+ filename,
307937
308931
  path: [el]
307938
308932
  });
307939
308933
  const stripped = stripFootnoteMarkerNodes2(converted);
@@ -307946,6 +308940,30 @@ function importFootnoteData2({ docx, editor, converter, nodeListHandler, numberi
307946
308940
  });
307947
308941
  return results;
307948
308942
  }
308943
+ function importFootnoteData2({ docx, editor, converter, nodeListHandler, numbering } = {}) {
308944
+ return importNoteEntries2({
308945
+ partXml: docx?.["word/footnotes.xml"],
308946
+ childElementName: "w:footnote",
308947
+ filename: "footnotes.xml",
308948
+ docx,
308949
+ editor,
308950
+ converter,
308951
+ nodeListHandler,
308952
+ numbering
308953
+ });
308954
+ }
308955
+ function importEndnoteData2({ docx, editor, converter, nodeListHandler, numbering } = {}) {
308956
+ return importNoteEntries2({
308957
+ partXml: docx?.["word/endnotes.xml"],
308958
+ childElementName: "w:endnote",
308959
+ filename: "endnotes.xml",
308960
+ docx,
308961
+ editor,
308962
+ converter,
308963
+ nodeListHandler,
308964
+ numbering
308965
+ });
308966
+ }
307949
308967
  var stripFootnoteMarkerNodes2 = (nodes) => {
307950
308968
  if (!Array.isArray(nodes) || nodes.length === 0)
307951
308969
  return nodes;
@@ -309069,6 +310087,7 @@ var detectDocumentOrigin2 = (docx) => {
309069
310087
  const numbering = getNumberingDefinitions2(docx);
309070
310088
  const comments = importCommentData2({ docx, nodeListHandler, converter, editor });
309071
310089
  const footnotes = importFootnoteData2({ docx, nodeListHandler, converter, editor, numbering });
310090
+ const endnotes = importEndnoteData2({ docx, nodeListHandler, converter, editor, numbering });
309072
310091
  const translatedLinkedStyles = translateStyleDefinitions2(docx);
309073
310092
  const translatedNumbering = translateNumberingDefinitions2(docx);
309074
310093
  const importDiagnosticsCollectionId = startCollection2();
@@ -309105,6 +310124,7 @@ var detectDocumentOrigin2 = (docx) => {
309105
310124
  pageStyles: getDocumentStyles2(node4, docx, converter, editor, numbering, translatedNumbering, translatedLinkedStyles),
309106
310125
  comments,
309107
310126
  footnotes,
310127
+ endnotes,
309108
310128
  inlineDocumentFonts,
309109
310129
  linkedStyles: getStyleDefinitions2(docx, converter, editor),
309110
310130
  translatedLinkedStyles,
@@ -312173,6 +313193,7 @@ var init_SuperConverter = __esm(() => {
312173
313193
  init_exporter_docx_defs();
312174
313194
  init_commentsExporter();
312175
313195
  init_footnotesExporter();
313196
+ init_documentFootnotesImporter();
312176
313197
  init_docx_helpers2();
312177
313198
  init_relationship_helpers();
312178
313199
  init_constants2();
@@ -312800,6 +313821,7 @@ var init_SuperConverter = __esm(() => {
312800
313821
  this.numbering = result.numbering;
312801
313822
  this.comments = result.comments;
312802
313823
  this.footnotes = result.footnotes;
313824
+ this.endnotes = result.endnotes ?? [];
312803
313825
  this.linkedStyles = result.linkedStyles;
312804
313826
  this.translatedLinkedStyles = result.translatedLinkedStyles;
312805
313827
  this.translatedNumbering = result.translatedNumbering;
@@ -313136,6 +314158,17 @@ var init_SuperConverter = __esm(() => {
313136
314158
  schema = normalizeDuplicateBlockIdentitiesInContent2(schema);
313137
314159
  return { type: "doc", content: [...schema] };
313138
314160
  }
314161
+ reimportNotePart(partId) {
314162
+ if (!this.convertedXml?.[partId])
314163
+ return [];
314164
+ const importFn = partId === "word/endnotes.xml" ? importEndnoteData2 : importFootnoteData2;
314165
+ return importFn({
314166
+ docx: this.convertedXml,
314167
+ editor: {},
314168
+ converter: this,
314169
+ numbering: this.numbering
314170
+ });
314171
+ }
313139
314172
  createDefaultHeader(variant = "default") {
313140
314173
  if (typeof variant !== "string") {
313141
314174
  throw new TypeError(`variant must be a string, received ${typeof variant}`);
@@ -319404,8 +320437,32 @@ function resolveBlockInsertionPos2(editor, anchorBlockId, position5, stepId) {
319404
320437
  }
319405
320438
  return position5 === "before" ? candidate.pos : candidate.end;
319406
320439
  }
320440
+ function resolveCreateAnchor2(editor, target, position5, stepId) {
320441
+ const index3 = getBlockIndex2(editor);
320442
+ let candidate;
320443
+ try {
320444
+ candidate = findBlockByNodeIdOnly2(index3, target.nodeId);
320445
+ } catch (e) {
320446
+ if (e instanceof Error && "code" in e) {
320447
+ throw planError2(e.code, e.message, stepId, e.details);
320448
+ }
320449
+ throw e;
320450
+ }
320451
+ if (target.nodeType && candidate.nodeType !== target.nodeType) {
320452
+ const remediation = candidate.nodeType === "listItem" ? "Use lists.insert to add an item to a list sequence." : `The block is a ${candidate.nodeType}, not a ${target.nodeType}.`;
320453
+ throw planError2("INVALID_TARGET", `Expected ${target.nodeType}:${target.nodeId} but found ${candidate.nodeType}:${candidate.nodeId}.`, stepId, {
320454
+ requestedNodeType: target.nodeType,
320455
+ actualNodeType: candidate.nodeType,
320456
+ nodeId: target.nodeId,
320457
+ remediation
320458
+ });
320459
+ }
320460
+ const pos = position5 === "before" ? candidate.pos : candidate.end;
320461
+ return { pos, anchor: candidate };
320462
+ }
319407
320463
  var init_create_insertion = __esm(() => {
319408
320464
  init_index_cache();
320465
+ init_node_address_resolver();
319409
320466
  init_errors4();
319410
320467
  });
319411
320468
 
@@ -320411,6 +321468,9 @@ function takeSnapshot2(editor, partIds) {
320411
321468
  partEntries,
320412
321469
  numbering: converter?.numbering ? clonePart2(converter.numbering) : undefined,
320413
321470
  translatedNumbering: converter?.translatedNumbering ? clonePart2(converter.translatedNumbering) : undefined,
321471
+ footnotes: converter?.footnotes ? clonePart2(converter.footnotes) : undefined,
321472
+ endnotes: converter?.endnotes ? clonePart2(converter.endnotes) : undefined,
321473
+ footnoteProperties: converter?.footnoteProperties ? clonePart2(converter.footnoteProperties) : undefined,
320414
321474
  revision: getRevision2(editor),
320415
321475
  documentModified: converter?.documentModified ?? false,
320416
321476
  documentGuid: converter?.documentGuid ?? null
@@ -320434,6 +321494,12 @@ function restoreFromSnapshot2(editor, snapshot2) {
320434
321494
  converter.numbering = snapshot2.numbering;
320435
321495
  if (snapshot2.translatedNumbering !== undefined)
320436
321496
  converter.translatedNumbering = snapshot2.translatedNumbering;
321497
+ if (snapshot2.footnotes !== undefined)
321498
+ converter.footnotes = snapshot2.footnotes;
321499
+ if (snapshot2.endnotes !== undefined)
321500
+ converter.endnotes = snapshot2.endnotes;
321501
+ if (snapshot2.footnoteProperties !== undefined)
321502
+ converter.footnoteProperties = snapshot2.footnoteProperties;
320437
321503
  converter.documentModified = snapshot2.documentModified;
320438
321504
  converter.documentGuid = snapshot2.documentGuid;
320439
321505
  restoreRevision2(editor, snapshot2.revision);
@@ -323987,13 +325053,14 @@ var init_tracked_change_refs = __esm(() => {
323987
325053
  });
323988
325054
 
323989
325055
  // ../../packages/super-editor/src/document-api-adapters/plan-engine/create-wrappers.ts
323990
- function resolveCreateInsertPosition2(editor, at, operationLabel) {
325056
+ function resolveCreateInsertPosition2(editor, at) {
323991
325057
  const location3 = at ?? { kind: "documentEnd" };
323992
325058
  if (location3.kind === "documentStart")
323993
325059
  return 0;
323994
325060
  if (location3.kind === "documentEnd")
323995
325061
  return editor.state.doc.content.size;
323996
- return resolveBlockInsertionPos2(editor, location3.target.nodeId, location3.kind);
325062
+ const { pos } = resolveCreateAnchor2(editor, location3.target, location3.kind);
325063
+ return pos;
323997
325064
  }
323998
325065
  function resolveCreatedBlock2(editor, nodeType, blockId) {
323999
325066
  const index3 = getBlockIndex2(editor);
@@ -324053,7 +325120,7 @@ function createParagraphWrapper2(editor, input2, options) {
324053
325120
  if (mode === "tracked") {
324054
325121
  ensureTrackedCapability2(editor, { operation: "create.paragraph" });
324055
325122
  }
324056
- const insertAt = resolveCreateInsertPosition2(editor, input2.at, "paragraph");
325123
+ const insertAt = resolveCreateInsertPosition2(editor, input2.at);
324057
325124
  if (options?.dryRun) {
324058
325125
  const canInsert = editor.can().insertParagraphAt?.({
324059
325126
  pos: insertAt,
@@ -324084,6 +325151,7 @@ function createParagraphWrapper2(editor, input2, options) {
324084
325151
  };
324085
325152
  }
324086
325153
  const paragraphId = v42();
325154
+ let canonicalId = paragraphId;
324087
325155
  let trackedChangeRefs;
324088
325156
  const receipt2 = executeDomainCommand2(editor, () => {
324089
325157
  const didApply = insertParagraphAt2({
@@ -324096,6 +325164,7 @@ function createParagraphWrapper2(editor, input2, options) {
324096
325164
  clearIndexCache2(editor);
324097
325165
  try {
324098
325166
  const paragraph3 = resolveCreatedBlock2(editor, "paragraph", paragraphId);
325167
+ canonicalId = paragraph3.nodeId;
324099
325168
  if (mode === "tracked") {
324100
325169
  trackedChangeRefs = collectTrackInsertRefsInRange2(editor, paragraph3.pos, paragraph3.end);
324101
325170
  }
@@ -324115,7 +325184,7 @@ function createParagraphWrapper2(editor, input2, options) {
324115
325184
  }
324116
325185
  };
324117
325186
  }
324118
- return buildParagraphCreateSuccess2(paragraphId, trackedChangeRefs);
325187
+ return buildParagraphCreateSuccess2(canonicalId, trackedChangeRefs);
324119
325188
  }
324120
325189
  function createHeadingWrapper2(editor, input2, options) {
324121
325190
  const insertHeadingAt2 = requireEditorCommand2(editor.commands?.insertHeadingAt, "create.heading");
@@ -324123,7 +325192,7 @@ function createHeadingWrapper2(editor, input2, options) {
324123
325192
  if (mode === "tracked") {
324124
325193
  ensureTrackedCapability2(editor, { operation: "create.heading" });
324125
325194
  }
324126
- const insertAt = resolveCreateInsertPosition2(editor, input2.at, "heading");
325195
+ const insertAt = resolveCreateInsertPosition2(editor, input2.at);
324127
325196
  if (options?.dryRun) {
324128
325197
  const canInsert = editor.can().insertHeadingAt?.({
324129
325198
  pos: insertAt,
@@ -324155,6 +325224,7 @@ function createHeadingWrapper2(editor, input2, options) {
324155
325224
  };
324156
325225
  }
324157
325226
  const headingId = v42();
325227
+ let canonicalId = headingId;
324158
325228
  let trackedChangeRefs;
324159
325229
  const receipt2 = executeDomainCommand2(editor, () => {
324160
325230
  const didApply = insertHeadingAt2({
@@ -324168,6 +325238,7 @@ function createHeadingWrapper2(editor, input2, options) {
324168
325238
  clearIndexCache2(editor);
324169
325239
  try {
324170
325240
  const heading4 = resolveCreatedBlock2(editor, "heading", headingId);
325241
+ canonicalId = heading4.nodeId;
324171
325242
  if (mode === "tracked") {
324172
325243
  trackedChangeRefs = collectTrackInsertRefsInRange2(editor, heading4.pos, heading4.end);
324173
325244
  }
@@ -324187,7 +325258,7 @@ function createHeadingWrapper2(editor, input2, options) {
324187
325258
  }
324188
325259
  };
324189
325260
  }
324190
- return buildHeadingCreateSuccess2(headingId, trackedChangeRefs);
325261
+ return buildHeadingCreateSuccess2(canonicalId, trackedChangeRefs);
324191
325262
  }
324192
325263
  var init_create_wrappers = __esm(() => {
324193
325264
  init_wrapper();
@@ -324200,15 +325271,21 @@ var init_create_wrappers = __esm(() => {
324200
325271
  });
324201
325272
 
324202
325273
  // ../../packages/super-editor/src/document-api-adapters/plan-engine/blocks-wrappers.ts
324203
- function validateTargetNodeType2(nodeType) {
324204
- if (REJECTED_NODE_TYPES2.has(nodeType)) {
324205
- throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, { nodeType });
324206
- }
324207
- if (!SUPPORTED_NODE_TYPES2.has(nodeType)) {
324208
- throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, {
324209
- nodeType
324210
- });
324211
- }
325274
+ function extractTextPreview2(node4) {
325275
+ if (!node4.isTextblock)
325276
+ return null;
325277
+ const text9 = node4.textContent;
325278
+ if (text9.length <= TEXT_PREVIEW_MAX_LENGTH2)
325279
+ return text9;
325280
+ return text9.slice(0, TEXT_PREVIEW_MAX_LENGTH2);
325281
+ }
325282
+ function toBlockSummary2(candidate, ordinal) {
325283
+ return {
325284
+ ordinal,
325285
+ nodeId: candidate.nodeId,
325286
+ nodeType: candidate.nodeType,
325287
+ textPreview: extractTextPreview2(candidate.node)
325288
+ };
324212
325289
  }
324213
325290
  function resolveSdBlockId2(candidate) {
324214
325291
  const sdBlockId = candidate.node.attrs?.sdBlockId;
@@ -324216,6 +325293,16 @@ function resolveSdBlockId2(candidate) {
324216
325293
  return sdBlockId;
324217
325294
  throw new DocumentApiAdapterError3("INTERNAL_ERROR", "Resolved block candidate is missing sdBlockId attribute. This indicates a schema/extension invariant violation.", { attrs: candidate.node.attrs });
324218
325295
  }
325296
+ function validateDeleteTargetNodeType2(nodeType) {
325297
+ if (REJECTED_DELETE_NODE_TYPES4.has(nodeType)) {
325298
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets. Table row/column operations are out of scope.`, { nodeType });
325299
+ }
325300
+ if (!SUPPORTED_DELETE_NODE_TYPES4.has(nodeType)) {
325301
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.delete does not support "${nodeType}" targets.`, {
325302
+ nodeType
325303
+ });
325304
+ }
325305
+ }
324219
325306
  function validateCommandLayerUniqueness2(editor, sdBlockId) {
324220
325307
  const getBlockNodeById = editor.helpers?.blockNode?.getBlockNodeById;
324221
325308
  if (typeof getBlockNodeById !== "function") {
@@ -324229,30 +325316,163 @@ function validateCommandLayerUniqueness2(editor, sdBlockId) {
324229
325316
  throw new DocumentApiAdapterError3("AMBIGUOUS_TARGET", `Multiple blocks share sdBlockId "${sdBlockId}" at the command layer.`, { sdBlockId, count: matches3.length });
324230
325317
  }
324231
325318
  }
325319
+ function collectTopLevelBlocks2(editor) {
325320
+ const doc4 = editor.state.doc;
325321
+ const results = [];
325322
+ let offset2 = 0;
325323
+ for (let i4 = 0;i4 < doc4.childCount; i4++) {
325324
+ const child = doc4.child(i4);
325325
+ const nodeType = mapBlockNodeType2(child);
325326
+ const pos = offset2;
325327
+ if (nodeType) {
325328
+ const nodeId = resolveBlockNodeId2(child, pos, nodeType);
325329
+ if (nodeId) {
325330
+ results.push({ node: child, pos, end: pos + child.nodeSize, nodeType, nodeId });
325331
+ }
325332
+ }
325333
+ offset2 += child.nodeSize;
325334
+ }
325335
+ return results;
325336
+ }
325337
+ function blocksListWrapper2(editor, input2) {
325338
+ const topLevel = collectTopLevelBlocks2(editor);
325339
+ const filtered = input2?.nodeTypes ? topLevel.filter((b2) => input2.nodeTypes.includes(b2.nodeType)) : topLevel;
325340
+ const total = filtered.length;
325341
+ const offset2 = input2?.offset ?? 0;
325342
+ const limit = input2?.limit ?? total;
325343
+ const paged = filtered.slice(offset2, offset2 + limit);
325344
+ const blocks2 = paged.map((candidate, i4) => ({
325345
+ ordinal: offset2 + i4,
325346
+ nodeId: candidate.nodeId,
325347
+ nodeType: candidate.nodeType,
325348
+ textPreview: extractTextPreview2(candidate.node),
325349
+ isEmpty: candidate.node.textContent.length === 0
325350
+ }));
325351
+ return { total, blocks: blocks2, revision: getRevision2(editor) };
325352
+ }
324232
325353
  function blocksDeleteWrapper2(editor, input2, options) {
324233
325354
  rejectTrackedMode2("blocks.delete", options);
324234
325355
  const index3 = getBlockIndex2(editor);
324235
325356
  const candidate = findBlockByIdStrict2(index3, input2.target);
324236
- validateTargetNodeType2(candidate.nodeType);
325357
+ validateDeleteTargetNodeType2(candidate.nodeType);
325358
+ const topLevel = collectTopLevelBlocks2(editor);
325359
+ const candidateOrdinal = topLevel.findIndex((b2) => b2.nodeId === candidate.nodeId && b2.nodeType === candidate.nodeType);
325360
+ const deletedBlock = toBlockSummary2(candidate, candidateOrdinal);
324237
325361
  const sdBlockId = resolveSdBlockId2(candidate);
324238
325362
  const deleteBlockNodeById = requireEditorCommand2(editor.commands?.deleteBlockNodeById, "blocks.delete");
324239
325363
  validateCommandLayerUniqueness2(editor, sdBlockId);
324240
325364
  if (options?.dryRun) {
324241
- return { success: true, deleted: input2.target };
325365
+ return { success: true, deleted: input2.target, deletedBlock };
324242
325366
  }
324243
325367
  const receipt2 = executeDomainCommand2(editor, () => {
324244
325368
  const didApply = deleteBlockNodeById(sdBlockId);
324245
- if (didApply) {
325369
+ if (didApply)
324246
325370
  clearIndexCache2(editor);
324247
- }
324248
325371
  return didApply;
324249
325372
  }, { expectedRevision: options?.expectedRevision });
324250
325373
  if (receipt2.steps[0]?.effect !== "changed") {
324251
325374
  throw new DocumentApiAdapterError3("INTERNAL_ERROR", "blocks.delete command returned false despite passing all pre-apply checks. This is an internal invariant violation.", { sdBlockId, target: input2.target });
324252
325375
  }
324253
- return { success: true, deleted: input2.target };
325376
+ return { success: true, deleted: input2.target, deletedBlock };
325377
+ }
325378
+ function hasSectionBreak2(candidate) {
325379
+ const attrs = candidate.node.attrs;
325380
+ const pPr = attrs?.paragraphProperties;
325381
+ return pPr?.sectPr != null && typeof pPr.sectPr === "object";
325382
+ }
325383
+ function resolveTopLevelOrdinal2(topLevel, candidate, label) {
325384
+ const idx = topLevel.findIndex((b2) => b2.nodeId === candidate.nodeId && b2.nodeType === candidate.nodeType);
325385
+ if (idx !== -1)
325386
+ return idx;
325387
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.deleteRange ${label} resolved to a nested block (not a direct document child). Only top-level blocks are supported.`, { nodeId: candidate.nodeId, nodeType: candidate.nodeType });
325388
+ }
325389
+ function resolveRangeEndpoint2(index3, address2, label) {
325390
+ const key2 = `${address2.nodeType}:${address2.nodeId}`;
325391
+ if (index3.ambiguous.has(key2)) {
325392
+ throw new DocumentApiAdapterError3("AMBIGUOUS_TARGET", `Multiple blocks share key "${key2}".`, {
325393
+ target: address2
325394
+ });
325395
+ }
325396
+ const candidate = index3.byId.get(key2);
325397
+ if (candidate)
325398
+ return candidate;
325399
+ const mismatch = index3.candidates.find((c) => c.nodeId === address2.nodeId);
325400
+ if (mismatch) {
325401
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.deleteRange ${label} expected ${address2.nodeType}:${address2.nodeId} but resolved to ${mismatch.nodeType}.`, { expected: address2.nodeType, actual: mismatch.nodeType, nodeId: address2.nodeId });
325402
+ }
325403
+ throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", `Block "${key2}" was not found.`, {
325404
+ target: address2
325405
+ });
325406
+ }
325407
+ function rejectUnmappedNodesInRange2(doc4, rangeBlocks) {
325408
+ if (rangeBlocks.length === 0)
325409
+ return;
325410
+ const rangeFrom = rangeBlocks[0].pos;
325411
+ const rangeTo = rangeBlocks[rangeBlocks.length - 1].end;
325412
+ const recognizedPositions = new Set(rangeBlocks.map((b2) => b2.pos));
325413
+ let offset2 = 0;
325414
+ for (let i4 = 0;i4 < doc4.childCount; i4++) {
325415
+ const child = doc4.child(i4);
325416
+ const childEnd = offset2 + child.nodeSize;
325417
+ if (childEnd > rangeFrom && offset2 < rangeTo && !recognizedPositions.has(offset2)) {
325418
+ if (!RANGE_DELETE_SAFE_NODE_TYPES2.has(child.type.name)) {
325419
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.deleteRange cannot delete range: unrecognized node "${child.type.name}" at position ${offset2} would be silently removed.`, { pmNodeType: child.type.name, pos: offset2 });
325420
+ }
325421
+ }
325422
+ offset2 = childEnd;
325423
+ }
324254
325424
  }
324255
- var SUPPORTED_NODE_TYPES2, REJECTED_NODE_TYPES2;
325425
+ function blocksDeleteRangeWrapper2(editor, input2, options) {
325426
+ rejectTrackedMode2("blocks.deleteRange", options);
325427
+ const topLevel = collectTopLevelBlocks2(editor);
325428
+ const index3 = getBlockIndex2(editor);
325429
+ const startCandidate = resolveRangeEndpoint2(index3, input2.start, "start");
325430
+ const endCandidate = resolveRangeEndpoint2(index3, input2.end, "end");
325431
+ const startOrdinal = resolveTopLevelOrdinal2(topLevel, startCandidate, "start");
325432
+ const endOrdinal = resolveTopLevelOrdinal2(topLevel, endCandidate, "end");
325433
+ if (startOrdinal > endOrdinal) {
325434
+ throw new DocumentApiAdapterError3("INVALID_INPUT", `blocks.deleteRange start ordinal (${startOrdinal}) is after end ordinal (${endOrdinal}). The start must precede or equal the end.`, { startOrdinal, endOrdinal });
325435
+ }
325436
+ const rangeBlocks = topLevel.slice(startOrdinal, endOrdinal + 1);
325437
+ rejectUnmappedNodesInRange2(editor.state.doc, rangeBlocks);
325438
+ for (const block of rangeBlocks) {
325439
+ if (hasSectionBreak2(block)) {
325440
+ throw new DocumentApiAdapterError3("INVALID_TARGET", `blocks.deleteRange cannot delete a range that includes a section break (block "${block.nodeId}" at ordinal ${topLevel.indexOf(block)}).`, { nodeId: block.nodeId, nodeType: block.nodeType });
325441
+ }
325442
+ }
325443
+ const deletedBlocks = rangeBlocks.map((c, i4) => toBlockSummary2(c, startOrdinal + i4));
325444
+ const revisionBefore = getRevision2(editor);
325445
+ if (options?.dryRun) {
325446
+ return {
325447
+ success: true,
325448
+ deletedCount: rangeBlocks.length,
325449
+ deletedBlocks,
325450
+ revision: { before: revisionBefore, after: revisionBefore },
325451
+ dryRun: true
325452
+ };
325453
+ }
325454
+ const rangeFrom = rangeBlocks[0].pos;
325455
+ const rangeTo = rangeBlocks[rangeBlocks.length - 1].end;
325456
+ const receipt2 = executeDomainCommand2(editor, () => {
325457
+ const tr = editor.state.tr;
325458
+ tr.delete(rangeFrom, rangeTo);
325459
+ editor.dispatch(tr);
325460
+ clearIndexCache2(editor);
325461
+ return true;
325462
+ }, { expectedRevision: options?.expectedRevision });
325463
+ if (receipt2.steps[0]?.effect !== "changed") {
325464
+ throw new DocumentApiAdapterError3("INTERNAL_ERROR", "blocks.deleteRange command returned false despite passing all pre-apply checks.", { start: input2.start, end: input2.end });
325465
+ }
325466
+ const revisionAfter = getRevision2(editor);
325467
+ return {
325468
+ success: true,
325469
+ deletedCount: rangeBlocks.length,
325470
+ deletedBlocks,
325471
+ revision: { before: revisionBefore, after: revisionAfter },
325472
+ dryRun: false
325473
+ };
325474
+ }
325475
+ var SUPPORTED_DELETE_NODE_TYPES4, REJECTED_DELETE_NODE_TYPES4, TEXT_PREVIEW_MAX_LENGTH2 = 80, RANGE_DELETE_SAFE_NODE_TYPES2;
324256
325476
  var init_blocks_wrappers = __esm(() => {
324257
325477
  init_src();
324258
325478
  init_index_cache();
@@ -324260,8 +325480,10 @@ var init_blocks_wrappers = __esm(() => {
324260
325480
  init_errors3();
324261
325481
  init_mutation_helpers();
324262
325482
  init_plan_wrappers();
324263
- SUPPORTED_NODE_TYPES2 = new Set(DELETABLE_BLOCK_NODE_TYPES);
324264
- REJECTED_NODE_TYPES2 = new Set(["tableRow", "tableCell"]);
325483
+ init_revision_tracker();
325484
+ SUPPORTED_DELETE_NODE_TYPES4 = new Set(DELETABLE_BLOCK_NODE_TYPES);
325485
+ REJECTED_DELETE_NODE_TYPES4 = new Set(["tableRow", "tableCell"]);
325486
+ RANGE_DELETE_SAFE_NODE_TYPES2 = new Set(["passthroughBlock", "passthroughInline"]);
324265
325487
  });
324266
325488
 
324267
325489
  // ../../packages/super-editor/src/document-api-adapters/helpers/list-sequence-helpers.ts
@@ -332198,10 +333420,15 @@ function createHistoryAdapter2(editor) {
332198
333420
  });
332199
333421
  }
332200
333422
  const revBefore = getRevision2(editor);
333423
+ const depth = getUndoDepth2(editor);
333424
+ if (depth === 0) {
333425
+ return { noop: true, reason: "EMPTY_UNDO_STACK", revision: { before: revBefore, after: revBefore } };
333426
+ }
332201
333427
  const success = Boolean(editor.commands.undo());
332202
333428
  const revAfter = getRevision2(editor);
332203
333429
  return {
332204
333430
  noop: !success,
333431
+ reason: success ? undefined : "NO_EFFECT",
332205
333432
  revision: { before: revBefore, after: revAfter }
332206
333433
  };
332207
333434
  },
@@ -332212,10 +333439,15 @@ function createHistoryAdapter2(editor) {
332212
333439
  });
332213
333440
  }
332214
333441
  const revBefore = getRevision2(editor);
333442
+ const depth = getRedoDepth2(editor);
333443
+ if (depth === 0) {
333444
+ return { noop: true, reason: "EMPTY_REDO_STACK", revision: { before: revBefore, after: revBefore } };
333445
+ }
332215
333446
  const success = Boolean(editor.commands.redo());
332216
333447
  const revAfter = getRevision2(editor);
332217
333448
  return {
332218
333449
  noop: !success,
333450
+ reason: success ? undefined : "NO_EFFECT",
332219
333451
  revision: { before: revBefore, after: revAfter }
332220
333452
  };
332221
333453
  }
@@ -332876,7 +334108,7 @@ function createTableOfContentsWrapper2(editor, input2, options) {
332876
334108
  } else if (at.kind === "documentEnd") {
332877
334109
  pos = editor.state.doc.content.size;
332878
334110
  } else {
332879
- pos = resolveBlockInsertionPos2(editor, at.target.nodeId, at.kind);
334111
+ pos = resolveCreateAnchor2(editor, at.target, at.kind).pos;
332880
334112
  }
332881
334113
  const config41 = input2.config ? applyTocPatchTyped2(DEFAULT_TOC_CONFIG2, input2.config) : DEFAULT_TOC_CONFIG2;
332882
334114
  const instruction = serializeTocInstruction2(config41);
@@ -333368,9 +334600,9 @@ function resolveImageInsertPosition2(editor, location3) {
333368
334600
  return editor.state.doc.content.size;
333369
334601
  case "before":
333370
334602
  case "after":
333371
- return resolveBlockInsertionPos2(editor, location3.target.nodeId, location3.kind);
334603
+ return resolveCreateAnchor2(editor, location3.target, location3.kind).pos;
333372
334604
  case "inParagraph": {
333373
- const pos = resolveBlockInsertionPos2(editor, location3.target.nodeId, "before");
334605
+ const { pos } = resolveCreateAnchor2(editor, location3.target, "before");
333374
334606
  return pos + 1 + (location3.offset ?? 0);
333375
334607
  }
333376
334608
  default: {
@@ -336678,6 +337910,28 @@ var init_bookmark_wrappers = __esm(() => {
336678
337910
  init_errors3();
336679
337911
  });
336680
337912
 
337913
+ // ../../packages/super-editor/src/document-api-adapters/helpers/note-entry-lookup.ts
337914
+ function isSpecialEntry2(entry) {
337915
+ return SPECIAL_NOTE_TYPES2.has(entry.type ?? "");
337916
+ }
337917
+ function findNoteEntryById2(entries, noteId) {
337918
+ if (!Array.isArray(entries))
337919
+ return;
337920
+ let fallback;
337921
+ for (const entry of entries) {
337922
+ if (String(entry.id ?? "") !== noteId)
337923
+ continue;
337924
+ if (!isSpecialEntry2(entry))
337925
+ return entry;
337926
+ fallback ??= entry;
337927
+ }
337928
+ return fallback;
337929
+ }
337930
+ var SPECIAL_NOTE_TYPES2;
337931
+ var init_note_entry_lookup = __esm(() => {
337932
+ SPECIAL_NOTE_TYPES2 = new Set(["separator", "continuationSeparator"]);
337933
+ });
337934
+
336681
337935
  // ../../packages/super-editor/src/document-api-adapters/helpers/footnote-resolver.ts
336682
337936
  function getConverterStore2(editor) {
336683
337937
  return editor.converter ?? {};
@@ -336711,7 +337965,7 @@ function resolveCollectionContent2(collection, noteId) {
336711
337965
  if (!collection)
336712
337966
  return "";
336713
337967
  if (Array.isArray(collection)) {
336714
- const match2 = collection.find((entry) => String(entry?.id ?? "") === noteId);
337968
+ const match2 = findNoteEntryById2(collection, noteId);
336715
337969
  return extractTextFromContent2(match2?.content);
336716
337970
  }
336717
337971
  if (isLegacyFootnoteMap2(collection)) {
@@ -336783,39 +338037,257 @@ function buildFootnoteDiscoveryItem2(editor, resolved, evaluatedRevision) {
336783
338037
  var init_footnote_resolver = __esm(() => {
336784
338038
  init_src();
336785
338039
  init_errors3();
338040
+ init_note_entry_lookup();
336786
338041
  });
336787
338042
 
336788
- // ../../packages/super-editor/src/document-api-adapters/out-of-band-mutation.ts
336789
- function executeOutOfBandMutation2(editor, mutateFn, options) {
336790
- if (!options.dryRun) {
336791
- if (editor.options?.collaborationProvider && editor.options?.ydoc) {
336792
- try {
336793
- yUndoPluginKey2.getState(editor.state)?.undoManager?.stopCapturing();
336794
- } catch {}
336795
- } else {
336796
- try {
336797
- editor.view?.dispatch?.(closeHistory2(editor.state.tr));
336798
- } catch {}
338043
+ // ../../packages/super-editor/src/core/parts/adapters/notes-part-descriptor.ts
338044
+ function getConverter14(editor) {
338045
+ return editor.converter;
338046
+ }
338047
+ function getRootElement2(part) {
338048
+ return part?.elements?.[0];
338049
+ }
338050
+ function getNoteElements2(part, childElementName) {
338051
+ const root4 = getRootElement2(part);
338052
+ if (!root4?.elements)
338053
+ return [];
338054
+ return root4.elements.filter((el) => el.name === childElementName);
338055
+ }
338056
+ function textToNoteOoxmlParagraphs2(text9) {
338057
+ return text9.split(/\r?\n/).map((line) => ({
338058
+ type: "element",
338059
+ name: "w:p",
338060
+ elements: line.length > 0 ? [
338061
+ {
338062
+ type: "element",
338063
+ name: "w:r",
338064
+ elements: [
338065
+ {
338066
+ type: "element",
338067
+ name: "w:t",
338068
+ attributes: { "xml:space": "preserve" },
338069
+ elements: [{ type: "text", text: line }]
338070
+ }
338071
+ ]
338072
+ }
338073
+ ] : []
338074
+ }));
338075
+ }
338076
+ function ensureFootnoteRefRun2(paragraphs, childElementName) {
338077
+ if (paragraphs.length === 0)
338078
+ return;
338079
+ const refName = childElementName === "w:footnote" ? "w:footnoteRef" : "w:endnoteRef";
338080
+ const styleName = childElementName === "w:footnote" ? "FootnoteReference" : "EndnoteReference";
338081
+ const firstParagraph = paragraphs[0];
338082
+ if (!firstParagraph.elements)
338083
+ firstParagraph.elements = [];
338084
+ const refRun = {
338085
+ type: "element",
338086
+ name: "w:r",
338087
+ elements: [
338088
+ {
338089
+ type: "element",
338090
+ name: "w:rPr",
338091
+ elements: [
338092
+ { type: "element", name: "w:rStyle", attributes: { "w:val": styleName } },
338093
+ { type: "element", name: "w:vertAlign", attributes: { "w:val": "superscript" } }
338094
+ ]
338095
+ },
338096
+ { type: "element", name: refName, elements: [] }
338097
+ ]
338098
+ };
338099
+ const pPrIndex = firstParagraph.elements.findIndex((el) => el?.name === "w:pPr");
338100
+ firstParagraph.elements.splice(pPrIndex >= 0 ? pPrIndex + 1 : 0, 0, refRun);
338101
+ }
338102
+ function addNoteElement2(part, config41, noteId, text9) {
338103
+ const root4 = getRootElement2(part);
338104
+ if (!root4)
338105
+ throw new Error(`addNoteElement: missing root element in ${config41.partId}`);
338106
+ if (!root4.elements)
338107
+ root4.elements = [];
338108
+ const duplicate = root4.elements.find((el) => el.name === config41.childElementName && el.attributes?.["w:id"] === noteId);
338109
+ if (duplicate) {
338110
+ throw new Error(`addNoteElement: note id "${noteId}" already exists in ${config41.partId}`);
338111
+ }
338112
+ const paragraphs = textToNoteOoxmlParagraphs2(text9);
338113
+ ensureFootnoteRefRun2(paragraphs, config41.childElementName);
338114
+ const noteElement = {
338115
+ type: "element",
338116
+ name: config41.childElementName,
338117
+ attributes: { "w:id": noteId },
338118
+ elements: paragraphs
338119
+ };
338120
+ root4.elements.push(noteElement);
338121
+ return noteElement;
338122
+ }
338123
+ function updateNoteElement2(part, config41, noteId, text9) {
338124
+ const notes = getNoteElements2(part, config41.childElementName);
338125
+ const target = notes.find((el) => el.attributes?.["w:id"] === noteId);
338126
+ if (!target)
338127
+ return false;
338128
+ const paragraphs = textToNoteOoxmlParagraphs2(text9);
338129
+ ensureFootnoteRefRun2(paragraphs, config41.childElementName);
338130
+ target.elements = paragraphs;
338131
+ return true;
338132
+ }
338133
+ function removeNoteElement2(part, config41, noteId) {
338134
+ const root4 = getRootElement2(part);
338135
+ if (!root4?.elements)
338136
+ return false;
338137
+ const index3 = root4.elements.findIndex((el) => el.name === config41.childElementName && el.attributes?.["w:id"] === noteId);
338138
+ if (index3 < 0)
338139
+ return false;
338140
+ root4.elements.splice(index3, 1);
338141
+ return true;
338142
+ }
338143
+ function rebuildDerivedCache2(editor, config41, part) {
338144
+ const converter = getConverter14(editor);
338145
+ if (!converter)
338146
+ return;
338147
+ if (typeof converter.reimportNotePart === "function") {
338148
+ try {
338149
+ converter[config41.converterKey] = converter.reimportNotePart(config41.partId);
338150
+ return;
338151
+ } catch (err) {
338152
+ console.warn(`[parts] reimportNotePart failed for ${config41.partId}, using fallback:`, err);
336799
338153
  }
336800
338154
  }
336801
- checkRevision2(editor, options.expectedRevision);
336802
- const result = mutateFn(options.dryRun);
336803
- if (result.changed && !options.dryRun) {
336804
- const converter = editor.converter;
336805
- if (converter) {
336806
- converter.documentModified = true;
336807
- if (!converter.documentGuid && typeof converter.promoteToGuid === "function") {
336808
- converter.promoteToGuid();
338155
+ const notes = getNoteElements2(part, config41.childElementName);
338156
+ const entries = notes.map((el) => ({
338157
+ id: String(el.attributes?.["w:id"] ?? ""),
338158
+ type: el.attributes?.["w:type"] ?? null,
338159
+ content: [],
338160
+ originalXml: structuredClone(el)
338161
+ }));
338162
+ converter[config41.converterKey] = entries;
338163
+ }
338164
+ function createInitialNotesPart2(config41) {
338165
+ return {
338166
+ declaration: {
338167
+ attributes: { version: "1.0", encoding: "UTF-8", standalone: "yes" }
338168
+ },
338169
+ elements: [
338170
+ {
338171
+ type: "element",
338172
+ name: config41.rootElementName,
338173
+ attributes: { ...NOTES_XMLNS2 },
338174
+ elements: [
338175
+ {
338176
+ type: "element",
338177
+ name: config41.childElementName,
338178
+ attributes: { "w:type": "separator", "w:id": "-1" },
338179
+ elements: [
338180
+ {
338181
+ type: "element",
338182
+ name: "w:p",
338183
+ elements: [
338184
+ {
338185
+ type: "element",
338186
+ name: "w:r",
338187
+ elements: [{ type: "element", name: "w:separator", elements: [] }]
338188
+ }
338189
+ ]
338190
+ }
338191
+ ]
338192
+ },
338193
+ {
338194
+ type: "element",
338195
+ name: config41.childElementName,
338196
+ attributes: { "w:type": "continuationSeparator", "w:id": "0" },
338197
+ elements: [
338198
+ {
338199
+ type: "element",
338200
+ name: "w:p",
338201
+ elements: [
338202
+ {
338203
+ type: "element",
338204
+ name: "w:r",
338205
+ elements: [{ type: "element", name: "w:continuationSeparator", elements: [] }]
338206
+ }
338207
+ ]
338208
+ }
338209
+ ]
338210
+ }
338211
+ ]
336809
338212
  }
338213
+ ]
338214
+ };
338215
+ }
338216
+ function createNotePartDescriptor2(config41) {
338217
+ return {
338218
+ id: config41.partId,
338219
+ ensurePart() {
338220
+ return createInitialNotesPart2(config41);
338221
+ },
338222
+ normalizePart(part) {
338223
+ const root4 = getRootElement2(part);
338224
+ if (!root4?.elements)
338225
+ return;
338226
+ root4.elements.sort((a2, b2) => {
338227
+ const aType = a2.attributes?.["w:type"];
338228
+ const bType = b2.attributes?.["w:type"];
338229
+ const aIsSpecial = aType === "separator" || aType === "continuationSeparator";
338230
+ const bIsSpecial = bType === "separator" || bType === "continuationSeparator";
338231
+ if (aIsSpecial !== bIsSpecial)
338232
+ return aIsSpecial ? -1 : 1;
338233
+ const aId = Number(a2.attributes?.["w:id"] ?? 0);
338234
+ const bId = Number(b2.attributes?.["w:id"] ?? 0);
338235
+ return aId - bId;
338236
+ });
338237
+ },
338238
+ afterCommit({ editor, part, source }) {
338239
+ rebuildDerivedCache2(editor, config41, part);
338240
+ clearPartCacheStale2(editor, config41.partId);
338241
+ editor.emit("notes-part-changed", { partId: config41.partId, source });
336810
338242
  }
336811
- incrementRevision2(editor);
336812
- }
336813
- return result.payload;
338243
+ };
336814
338244
  }
336815
- var init_out_of_band_mutation = __esm(() => {
336816
- init_dist7();
336817
- init_y_prosemirror();
336818
- init_revision_tracker();
338245
+ function getNotesConfig2(type) {
338246
+ return type === "endnote" ? ENDNOTES_CONFIG2 : FOOTNOTES_CONFIG2;
338247
+ }
338248
+ function bootstrapNotesPart2(editor, type) {
338249
+ const converter = editor.converter;
338250
+ if (!converter?.convertedXml)
338251
+ return;
338252
+ const config41 = getNotesConfig2(type);
338253
+ if (converter.convertedXml[config41.partId] !== undefined)
338254
+ return;
338255
+ converter.convertedXml[config41.partId] = createInitialNotesPart2(config41);
338256
+ }
338257
+ var FOOTNOTES_PART_ID2 = "word/footnotes.xml", ENDNOTES_PART_ID2 = "word/endnotes.xml", FOOTNOTES_CONFIG2, ENDNOTES_CONFIG2, NOTES_XMLNS2, footnotesPartDescriptor2, endnotesPartDescriptor2;
338258
+ var init_notes_part_descriptor = __esm(() => {
338259
+ init_cache_staleness();
338260
+ FOOTNOTES_CONFIG2 = {
338261
+ partId: FOOTNOTES_PART_ID2,
338262
+ rootElementName: "w:footnotes",
338263
+ childElementName: "w:footnote",
338264
+ converterKey: "footnotes"
338265
+ };
338266
+ ENDNOTES_CONFIG2 = {
338267
+ partId: ENDNOTES_PART_ID2,
338268
+ rootElementName: "w:endnotes",
338269
+ childElementName: "w:endnote",
338270
+ converterKey: "endnotes"
338271
+ };
338272
+ NOTES_XMLNS2 = {
338273
+ "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
338274
+ "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
338275
+ "xmlns:o": "urn:schemas-microsoft-com:office:office",
338276
+ "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
338277
+ "xmlns:m": "http://schemas.openxmlformats.org/officeDocument/2006/math",
338278
+ "xmlns:v": "urn:schemas-microsoft-com:vml",
338279
+ "xmlns:wp14": "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",
338280
+ "xmlns:wp": "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",
338281
+ "xmlns:w10": "urn:schemas-microsoft-com:office:word",
338282
+ "xmlns:w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
338283
+ "xmlns:w14": "http://schemas.microsoft.com/office/word/2010/wordml",
338284
+ "xmlns:wpg": "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",
338285
+ "xmlns:wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
338286
+ "xmlns:wne": "http://schemas.microsoft.com/office/word/2006/wordml",
338287
+ "xmlns:wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape"
338288
+ };
338289
+ footnotesPartDescriptor2 = createNotePartDescriptor2(FOOTNOTES_CONFIG2);
338290
+ endnotesPartDescriptor2 = createNotePartDescriptor2(ENDNOTES_CONFIG2);
336819
338291
  });
336820
338292
 
336821
338293
  // ../../packages/super-editor/src/document-api-adapters/plan-engine/footnote-wrappers.ts
@@ -336828,37 +338300,12 @@ function footnoteFailure2(code10, message) {
336828
338300
  function configSuccess2() {
336829
338301
  return { success: true };
336830
338302
  }
336831
- function receiptApplied6(receipt2) {
336832
- return receipt2.steps[0]?.effect === "changed";
336833
- }
336834
- function isLegacyNoteMap2(value) {
336835
- return value != null && typeof value === "object" && !Array.isArray(value);
336836
- }
336837
- function textToFootnoteContentNodes2(text9) {
336838
- const lines = text9.split(/\r?\n/);
336839
- return lines.map((line) => ({
336840
- type: "paragraph",
336841
- content: line.length > 0 ? [{ type: "text", text: line }] : []
336842
- }));
336843
- }
336844
- function normalizeLegacyNoteMap2(map10) {
336845
- return Object.entries(map10).map(([id2, value]) => ({
336846
- id: String(id2),
336847
- content: textToFootnoteContentNodes2(value?.content ?? "")
336848
- }));
336849
- }
336850
- function ensureNoteEntries2(converter, kind) {
336851
- const current = converter[kind];
336852
- if (Array.isArray(current))
336853
- return current;
336854
- if (isLegacyNoteMap2(current)) {
336855
- const normalized = normalizeLegacyNoteMap2(current);
336856
- converter[kind] = normalized;
336857
- return normalized;
338303
+ function getConverter15(editor) {
338304
+ const converter = editor.converter;
338305
+ if (!converter) {
338306
+ throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "converter not available.");
336858
338307
  }
336859
- const initialized = [];
336860
- converter[kind] = initialized;
336861
- return initialized;
338308
+ return converter;
336862
338309
  }
336863
338310
  function toNonNegativeInteger2(value) {
336864
338311
  const num = Number(value);
@@ -336866,35 +338313,38 @@ function toNonNegativeInteger2(value) {
336866
338313
  return null;
336867
338314
  return num;
336868
338315
  }
336869
- function allocateNextNoteId2(editor, type, entries) {
336870
- let maxId = 0;
338316
+ function collectUsedNoteIds2(editor, converter, type) {
338317
+ const used = new Set;
338318
+ const config41 = getNotesConfig2(type);
336871
338319
  for (const ref4 of findAllFootnotes2(editor.state.doc, type)) {
336872
338320
  const parsed = toNonNegativeInteger2(ref4.noteId);
336873
338321
  if (parsed != null)
336874
- maxId = Math.max(maxId, parsed);
338322
+ used.add(parsed);
336875
338323
  }
336876
- for (const entry of entries) {
336877
- const parsed = toNonNegativeInteger2(entry.id);
336878
- if (parsed != null)
336879
- maxId = Math.max(maxId, parsed);
338324
+ const ooxmlPart = converter.convertedXml?.[config41.partId];
338325
+ if (ooxmlPart) {
338326
+ for (const el of getNoteElements2(ooxmlPart, config41.childElementName)) {
338327
+ const parsed = toNonNegativeInteger2(el.attributes?.["w:id"]);
338328
+ if (parsed != null)
338329
+ used.add(parsed);
338330
+ }
336880
338331
  }
336881
- return String(maxId + 1);
336882
- }
336883
- function upsertNoteEntry2(entries, noteId, content5) {
336884
- const existing = entries.find((entry) => String(entry.id) === noteId);
336885
- if (existing) {
336886
- existing.content = textToFootnoteContentNodes2(content5);
336887
- return;
338332
+ const cache2 = converter[config41.converterKey];
338333
+ if (Array.isArray(cache2)) {
338334
+ for (const entry of cache2) {
338335
+ const parsed = toNonNegativeInteger2(entry.id);
338336
+ if (parsed != null)
338337
+ used.add(parsed);
338338
+ }
336888
338339
  }
336889
- entries.push({
336890
- id: noteId,
336891
- content: textToFootnoteContentNodes2(content5)
336892
- });
338340
+ return used;
336893
338341
  }
336894
- function removeNoteEntry2(entries, noteId) {
336895
- const index3 = entries.findIndex((entry) => String(entry.id) === noteId);
336896
- if (index3 >= 0)
336897
- entries.splice(index3, 1);
338342
+ function allocateNextNoteId2(editor, converter, type) {
338343
+ const used = collectUsedNoteIds2(editor, converter, type);
338344
+ let candidate = 1;
338345
+ while (used.has(candidate))
338346
+ candidate += 1;
338347
+ return String(candidate);
336898
338348
  }
336899
338349
  function footnotesListWrapper2(editor, query2) {
336900
338350
  const doc4 = editor.state.doc;
@@ -336916,13 +338366,10 @@ function footnotesGetWrapper2(editor, input2) {
336916
338366
  }
336917
338367
  function footnotesInsertWrapper2(editor, input2, options) {
336918
338368
  rejectTrackedMode2("footnotes.insert", options);
336919
- const converter = editor.converter;
336920
- if (!converter) {
336921
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "footnotes.insert: converter not available.");
336922
- }
336923
- const noteStoreKey = input2.type === "endnote" ? "endnotes" : "footnotes";
336924
- const noteEntries = ensureNoteEntries2(converter, noteStoreKey);
336925
- const noteId = allocateNextNoteId2(editor, input2.type, noteEntries);
338369
+ checkRevision2(editor, options?.expectedRevision);
338370
+ const converter = getConverter15(editor);
338371
+ const notesConfig = getNotesConfig2(input2.type);
338372
+ const noteId = allocateNextNoteId2(editor, converter, input2.type);
336926
338373
  const address2 = { kind: "entity", entityType: "footnote", noteId };
336927
338374
  if (options?.dryRun) {
336928
338375
  return footnoteSuccess2(address2);
@@ -336933,16 +338380,30 @@ function footnotesInsertWrapper2(editor, input2, options) {
336933
338380
  throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", `footnotes.insert: node type "${nodeTypeName}" is not registered in the schema.`);
336934
338381
  }
336935
338382
  const resolved = resolveInlineInsertPosition2(editor, input2.at, "footnotes.insert");
336936
- const receipt2 = executeDomainCommand2(editor, () => {
336937
- const node4 = nodeType.create({ id: noteId });
336938
- const { tr } = editor.state;
336939
- tr.insert(resolved.from, node4);
336940
- editor.dispatch(tr);
336941
- upsertNoteEntry2(noteEntries, noteId, input2.content);
336942
- clearIndexCache2(editor);
336943
- return true;
336944
- }, { expectedRevision: options?.expectedRevision });
336945
- if (!receiptApplied6(receipt2)) {
338383
+ const { success } = compoundMutation2({
338384
+ editor,
338385
+ source: `footnotes.insert:${input2.type}`,
338386
+ affectedParts: [notesConfig.partId],
338387
+ execute: () => {
338388
+ bootstrapNotesPart2(editor, input2.type);
338389
+ mutatePart2({
338390
+ editor,
338391
+ partId: notesConfig.partId,
338392
+ operation: "mutate",
338393
+ source: `footnotes.insert:${input2.type}`,
338394
+ mutate({ part }) {
338395
+ addNoteElement2(part, notesConfig, noteId, input2.content);
338396
+ }
338397
+ });
338398
+ const node4 = nodeType.create({ id: noteId });
338399
+ const { tr } = editor.state;
338400
+ tr.insert(resolved.from, node4);
338401
+ editor.dispatch(tr);
338402
+ clearIndexCache2(editor);
338403
+ return true;
338404
+ }
338405
+ });
338406
+ if (!success) {
336946
338407
  return footnoteFailure2("NO_OP", "Insert operation produced no change.");
336947
338408
  }
336948
338409
  return footnoteSuccess2(address2);
@@ -336951,100 +338412,140 @@ function footnotesUpdateWrapper2(editor, input2, options) {
336951
338412
  rejectTrackedMode2("footnotes.update", options);
336952
338413
  const resolved = resolveFootnoteTarget2(editor.state.doc, input2.target);
336953
338414
  const address2 = { kind: "entity", entityType: "footnote", noteId: resolved.noteId };
336954
- if (options?.dryRun) {
338415
+ if (options?.dryRun || input2.patch.content === undefined) {
336955
338416
  return footnoteSuccess2(address2);
336956
338417
  }
336957
- const converter = editor.converter;
336958
- if (!converter) {
336959
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "footnotes.update: converter not available.");
336960
- }
336961
- const noteStoreKey = resolved.type === "footnote" ? "footnotes" : "endnotes";
336962
- const noteEntries = ensureNoteEntries2(converter, noteStoreKey);
336963
- executeOutOfBandMutation2(editor, (dryRun) => {
336964
- if (input2.patch.content === undefined) {
336965
- return { changed: false, payload: undefined };
336966
- }
336967
- if (!dryRun) {
336968
- upsertNoteEntry2(noteEntries, resolved.noteId, input2.patch.content);
338418
+ const notesConfig = getNotesConfig2(resolved.type);
338419
+ mutatePart2({
338420
+ editor,
338421
+ partId: notesConfig.partId,
338422
+ operation: "mutate",
338423
+ source: `footnotes.update:${resolved.type}`,
338424
+ expectedRevision: options?.expectedRevision,
338425
+ mutate({ part }) {
338426
+ updateNoteElement2(part, notesConfig, resolved.noteId, input2.patch.content);
336969
338427
  }
336970
- return { changed: true, payload: undefined };
336971
- }, { dryRun: options?.dryRun ?? false, expectedRevision: options?.expectedRevision });
338428
+ });
336972
338429
  return footnoteSuccess2(address2);
336973
338430
  }
336974
338431
  function footnotesRemoveWrapper2(editor, input2, options) {
336975
338432
  rejectTrackedMode2("footnotes.remove", options);
338433
+ checkRevision2(editor, options?.expectedRevision);
336976
338434
  const resolved = resolveFootnoteTarget2(editor.state.doc, input2.target);
336977
338435
  const address2 = { kind: "entity", entityType: "footnote", noteId: resolved.noteId };
336978
338436
  if (options?.dryRun) {
336979
338437
  return footnoteSuccess2(address2);
336980
338438
  }
336981
- const receipt2 = executeDomainCommand2(editor, () => {
336982
- const { tr } = editor.state;
336983
- const node4 = tr.doc.nodeAt(resolved.pos);
336984
- if (node4) {
338439
+ const notesConfig = getNotesConfig2(resolved.type);
338440
+ const { success } = compoundMutation2({
338441
+ editor,
338442
+ source: `footnotes.remove:${resolved.type}`,
338443
+ affectedParts: [notesConfig.partId],
338444
+ execute: () => {
338445
+ const { tr } = editor.state;
338446
+ const node4 = tr.doc.nodeAt(resolved.pos);
338447
+ if (!node4)
338448
+ return false;
336985
338449
  tr.delete(resolved.pos, resolved.pos + node4.nodeSize);
336986
338450
  editor.dispatch(tr);
336987
- const converter = editor.converter;
336988
- if (converter) {
336989
- const noteStoreKey = resolved.type === "footnote" ? "footnotes" : "endnotes";
336990
- const noteEntries = ensureNoteEntries2(converter, noteStoreKey);
336991
- const stillReferenced = findAllFootnotes2(editor.state.doc, resolved.type).some((f2) => f2.noteId === resolved.noteId);
336992
- if (!stillReferenced) {
336993
- removeNoteEntry2(noteEntries, resolved.noteId);
336994
- }
338451
+ const stillReferenced = findAllFootnotes2(editor.state.doc, resolved.type).some((f2) => f2.noteId === resolved.noteId);
338452
+ if (!stillReferenced) {
338453
+ mutatePart2({
338454
+ editor,
338455
+ partId: notesConfig.partId,
338456
+ operation: "mutate",
338457
+ source: `footnotes.remove:${resolved.type}`,
338458
+ mutate({ part }) {
338459
+ removeNoteElement2(part, notesConfig, resolved.noteId);
338460
+ }
338461
+ });
336995
338462
  }
336996
338463
  clearIndexCache2(editor);
336997
338464
  return true;
336998
338465
  }
336999
- return false;
337000
- }, { expectedRevision: options?.expectedRevision });
337001
- if (!receiptApplied6(receipt2)) {
338466
+ });
338467
+ if (!success) {
337002
338468
  return footnoteFailure2("NO_OP", "Remove operation produced no change.");
337003
338469
  }
337004
338470
  return footnoteSuccess2(address2);
337005
338471
  }
337006
338472
  function footnotesConfigureWrapper2(editor, input2, options) {
337007
338473
  rejectTrackedMode2("footnotes.configure", options);
337008
- const converter = editor.converter;
337009
- if (!converter) {
337010
- throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "footnotes.configure: converter not available.");
337011
- }
337012
- executeOutOfBandMutation2(editor, (dryRun) => {
337013
- if (dryRun)
337014
- return { changed: true, payload: undefined };
337015
- if (!converter.footnoteProperties) {
337016
- converter.footnoteProperties = { source: "settings" };
337017
- }
337018
- const props = converter.footnoteProperties;
337019
- if (input2.numbering) {
337020
- if (input2.numbering.format !== undefined)
337021
- props.numFmt = input2.numbering.format;
337022
- if (input2.numbering.start !== undefined)
337023
- props.numStart = String(input2.numbering.start);
338474
+ const prElementName = input2.type === "endnote" ? "w:endnotePr" : "w:footnotePr";
338475
+ mutatePart2({
338476
+ editor,
338477
+ partId: "word/settings.xml",
338478
+ operation: "mutate",
338479
+ source: `footnotes.configure:${input2.type}`,
338480
+ dryRun: options?.dryRun,
338481
+ expectedRevision: options?.expectedRevision,
338482
+ mutate({ part }) {
338483
+ const root4 = part?.elements?.[0];
338484
+ if (!root4)
338485
+ return;
338486
+ if (!root4.elements)
338487
+ root4.elements = [];
338488
+ const elements = root4.elements;
338489
+ let prElement = elements.find((el) => el.name === prElementName);
338490
+ if (!prElement) {
338491
+ prElement = { type: "element", name: prElementName, elements: [] };
338492
+ elements.push(prElement);
338493
+ }
338494
+ if (!prElement.elements)
338495
+ prElement.elements = [];
338496
+ if (!input2.numbering)
338497
+ return;
338498
+ const setOrRemoveChild = (name, value) => {
338499
+ if (value === undefined)
338500
+ return;
338501
+ const children = prElement.elements;
338502
+ const existing = children.findIndex((el) => el.name === name);
338503
+ const newEl = { type: "element", name, attributes: { "w:val": value } };
338504
+ if (existing >= 0) {
338505
+ children[existing] = newEl;
338506
+ } else {
338507
+ children.push(newEl);
338508
+ }
338509
+ };
338510
+ setOrRemoveChild("w:numFmt", input2.numbering.format);
338511
+ setOrRemoveChild("w:numStart", input2.numbering.start !== undefined ? String(input2.numbering.start) : undefined);
337024
338512
  if (input2.numbering.restartPolicy !== undefined) {
337025
- props.numRestart = RESTART_POLICY_TO_OOXML2[input2.numbering.restartPolicy] ?? input2.numbering.restartPolicy;
338513
+ setOrRemoveChild("w:numRestart", RESTART_POLICY_TO_OOXML2[input2.numbering.restartPolicy] ?? input2.numbering.restartPolicy);
337026
338514
  }
337027
- if (input2.numbering.position !== undefined)
337028
- props.pos = input2.numbering.position;
338515
+ setOrRemoveChild("w:pos", input2.numbering.position);
337029
338516
  }
337030
- props.noteType = input2.type;
337031
- if (input2.scope)
337032
- props.scope = input2.scope;
337033
- return { changed: true, payload: undefined };
337034
- }, { dryRun: options?.dryRun ?? false, expectedRevision: options?.expectedRevision });
338517
+ });
338518
+ if (!options?.dryRun && prElementName === "w:footnotePr") {
338519
+ syncFootnotePropertiesCache2(editor);
338520
+ }
337035
338521
  return configSuccess2();
337036
338522
  }
338523
+ function syncFootnotePropertiesCache2(editor) {
338524
+ const converter = getConverter15(editor);
338525
+ if (!converter?.footnoteProperties || converter.footnoteProperties.source !== "settings")
338526
+ return;
338527
+ const settingsPart = converter.convertedXml?.["word/settings.xml"];
338528
+ const settingsRoot = settingsPart?.elements?.[0];
338529
+ const elements = settingsRoot?.elements ?? [];
338530
+ const prElement = elements.find((el) => el.name === "w:footnotePr");
338531
+ if (prElement) {
338532
+ converter.footnoteProperties.originalXml = structuredClone(prElement);
338533
+ } else {
338534
+ converter.footnoteProperties = null;
338535
+ }
338536
+ }
337037
338537
  var RESTART_POLICY_TO_OOXML2;
337038
338538
  var init_footnote_wrappers = __esm(() => {
337039
338539
  init_src();
337040
338540
  init_footnote_resolver();
337041
338541
  init_adapter_utils();
337042
338542
  init_revision_tracker();
337043
- init_plan_wrappers();
337044
338543
  init_mutation_helpers();
337045
338544
  init_index_cache();
337046
- init_out_of_band_mutation();
337047
338545
  init_errors3();
338546
+ init_mutate_part();
338547
+ init_compound_mutation();
338548
+ init_notes_part_descriptor();
337048
338549
  RESTART_POLICY_TO_OOXML2 = {
337049
338550
  continuous: "continuous",
337050
338551
  eachSection: "eachSect",
@@ -337173,7 +338674,7 @@ function crossRefSuccess2(address2) {
337173
338674
  function crossRefFailure2(code10, message) {
337174
338675
  return { success: false, failure: { code: code10, message } };
337175
338676
  }
337176
- function receiptApplied7(receipt2) {
338677
+ function receiptApplied6(receipt2) {
337177
338678
  return receipt2.steps[0]?.effect === "changed";
337178
338679
  }
337179
338680
  function crossRefsListWrapper2(editor, query2) {
@@ -337224,7 +338725,7 @@ function crossRefsInsertWrapper2(editor, input2, options) {
337224
338725
  clearIndexCache2(editor);
337225
338726
  return true;
337226
338727
  }, { expectedRevision: options?.expectedRevision });
337227
- if (!receiptApplied7(receipt2))
338728
+ if (!receiptApplied6(receipt2))
337228
338729
  return crossRefFailure2("NO_OP", "Insert produced no change.");
337229
338730
  return crossRefSuccess2(computeInlineAddress2(editor.state.doc, resolved.from));
337230
338731
  }
@@ -337249,7 +338750,7 @@ function crossRefsRemoveWrapper2(editor, input2, options) {
337249
338750
  clearIndexCache2(editor);
337250
338751
  return true;
337251
338752
  }, { expectedRevision: options?.expectedRevision });
337252
- if (!receiptApplied7(receipt2))
338753
+ if (!receiptApplied6(receipt2))
337253
338754
  return crossRefFailure2("NO_OP", "Remove produced no change.");
337254
338755
  return crossRefSuccess2(address2);
337255
338756
  }
@@ -337538,7 +339039,7 @@ function entrySuccess3(address2) {
337538
339039
  function entryFailure3(code10, message) {
337539
339040
  return { success: false, failure: { code: code10, message } };
337540
339041
  }
337541
- function receiptApplied8(receipt2) {
339042
+ function receiptApplied7(receipt2) {
337542
339043
  return receipt2.steps[0]?.effect === "changed";
337543
339044
  }
337544
339045
  function indexListWrapper2(editor, query2) {
@@ -337579,7 +339080,7 @@ function indexInsertWrapper2(editor, input2, options) {
337579
339080
  clearIndexCache2(editor);
337580
339081
  return true;
337581
339082
  }, { expectedRevision: options?.expectedRevision });
337582
- if (!receiptApplied8(receipt2))
339083
+ if (!receiptApplied7(receipt2))
337583
339084
  return indexFailure2("NO_OP", "Insert produced no change.");
337584
339085
  const insertedNode = editor.state.doc.nodeAt(pos);
337585
339086
  const resolvedNodeId = insertedNode?.attrs?.sdBlockId ?? `index-${pos}`;
@@ -337611,7 +339112,7 @@ function indexConfigureWrapper2(editor, input2, options) {
337611
339112
  clearIndexCache2(editor);
337612
339113
  return true;
337613
339114
  }, { expectedRevision: options?.expectedRevision });
337614
- if (!receiptApplied8(receipt2))
339115
+ if (!receiptApplied7(receipt2))
337615
339116
  return indexFailure2("NO_OP", "Configure produced no change.");
337616
339117
  return indexSuccess2(address2);
337617
339118
  }
@@ -337636,7 +339137,7 @@ function indexRemoveWrapper2(editor, input2, options) {
337636
339137
  clearIndexCache2(editor);
337637
339138
  return true;
337638
339139
  }, { expectedRevision: options?.expectedRevision });
337639
- if (!receiptApplied8(receipt2))
339140
+ if (!receiptApplied7(receipt2))
337640
339141
  return indexFailure2("NO_OP", "Remove produced no change.");
337641
339142
  return indexSuccess2(address2);
337642
339143
  }
@@ -337691,7 +339192,7 @@ function indexEntriesInsertWrapper2(editor, input2, options) {
337691
339192
  clearIndexCache2(editor);
337692
339193
  return true;
337693
339194
  }, { expectedRevision: options?.expectedRevision });
337694
- if (!receiptApplied8(receipt2))
339195
+ if (!receiptApplied7(receipt2))
337695
339196
  return entryFailure3("NO_OP", "Insert produced no change.");
337696
339197
  const insertedAddress = resolveInsertedIndexEntryAddress2(editor.state.doc, resolved.from, instruction);
337697
339198
  return entrySuccess3(insertedAddress);
@@ -337728,7 +339229,7 @@ function indexEntriesUpdateWrapper2(editor, input2, options) {
337728
339229
  clearIndexCache2(editor);
337729
339230
  return true;
337730
339231
  }, { expectedRevision: options?.expectedRevision });
337731
- if (!receiptApplied8(receipt2))
339232
+ if (!receiptApplied7(receipt2))
337732
339233
  return entryFailure3("NO_OP", "Update produced no change.");
337733
339234
  return entrySuccess3(address2);
337734
339235
  }
@@ -337745,7 +339246,7 @@ function indexEntriesRemoveWrapper2(editor, input2, options) {
337745
339246
  clearIndexCache2(editor);
337746
339247
  return true;
337747
339248
  }, { expectedRevision: options?.expectedRevision });
337748
- if (!receiptApplied8(receipt2))
339249
+ if (!receiptApplied7(receipt2))
337749
339250
  return entryFailure3("NO_OP", "Remove produced no change.");
337750
339251
  return entrySuccess3(address2);
337751
339252
  }
@@ -338021,7 +339522,7 @@ function configSuccess3() {
338021
339522
  function configFailure2(code10, message) {
338022
339523
  return { success: false, failure: { code: code10, message } };
338023
339524
  }
338024
- function receiptApplied9(receipt2) {
339525
+ function receiptApplied8(receipt2) {
338025
339526
  return receipt2.steps[0]?.effect === "changed";
338026
339527
  }
338027
339528
  function buildCaptionParagraphAttrs2(nodeId) {
@@ -338080,7 +339581,7 @@ function captionsInsertWrapper2(editor, input2, options) {
338080
339581
  clearIndexCache2(editor);
338081
339582
  return true;
338082
339583
  }, { expectedRevision: options?.expectedRevision });
338083
- if (!receiptApplied9(receipt2))
339584
+ if (!receiptApplied8(receipt2))
338084
339585
  return captionFailure2("NO_OP", "Insert produced no change.");
338085
339586
  return captionSuccess2(address2);
338086
339587
  }
@@ -338115,7 +339616,7 @@ function captionsUpdateWrapper2(editor, input2, options) {
338115
339616
  clearIndexCache2(editor);
338116
339617
  return true;
338117
339618
  }, { expectedRevision: options?.expectedRevision });
338118
- if (!receiptApplied9(receipt2))
339619
+ if (!receiptApplied8(receipt2))
338119
339620
  return captionFailure2("NO_OP", "Update produced no change.");
338120
339621
  return captionSuccess2(address2);
338121
339622
  }
@@ -338132,7 +339633,7 @@ function captionsRemoveWrapper2(editor, input2, options) {
338132
339633
  clearIndexCache2(editor);
338133
339634
  return true;
338134
339635
  }, { expectedRevision: options?.expectedRevision });
338135
- if (!receiptApplied9(receipt2))
339636
+ if (!receiptApplied8(receipt2))
338136
339637
  return captionFailure2("NO_OP", "Remove produced no change.");
338137
339638
  return captionSuccess2(address2);
338138
339639
  }
@@ -338164,7 +339665,7 @@ function captionsConfigureWrapper2(editor, input2, options) {
338164
339665
  clearIndexCache2(editor);
338165
339666
  return true;
338166
339667
  }, { expectedRevision: options?.expectedRevision });
338167
- if (!receiptApplied9(receipt2))
339668
+ if (!receiptApplied8(receipt2))
338168
339669
  return configFailure2("NO_OP", "Configure produced no change.");
338169
339670
  return configSuccess3();
338170
339671
  }
@@ -338296,7 +339797,7 @@ function fieldSuccess2(address2) {
338296
339797
  function fieldFailure2(code10, message) {
338297
339798
  return { success: false, failure: { code: code10, message } };
338298
339799
  }
338299
- function receiptApplied10(receipt2) {
339800
+ function receiptApplied9(receipt2) {
338300
339801
  return receipt2.steps[0]?.effect === "changed";
338301
339802
  }
338302
339803
  function fieldsListWrapper2(editor, query2) {
@@ -338350,7 +339851,7 @@ function fieldsInsertWrapper2(editor, input2, options) {
338350
339851
  clearIndexCache2(editor);
338351
339852
  return true;
338352
339853
  }, { expectedRevision: options?.expectedRevision });
338353
- if (!receiptApplied10(receipt2))
339854
+ if (!receiptApplied9(receipt2))
338354
339855
  return fieldFailure2("NO_OP", "Insert produced no change.");
338355
339856
  return fieldSuccess2(computeFieldAddress2(editor.state.doc, resolved.from));
338356
339857
  }
@@ -338378,7 +339879,7 @@ function fieldsRebuildWrapper2(editor, input2, options) {
338378
339879
  clearIndexCache2(editor);
338379
339880
  return true;
338380
339881
  }, { expectedRevision: options?.expectedRevision });
338381
- if (!receiptApplied10(receipt2))
339882
+ if (!receiptApplied9(receipt2))
338382
339883
  return fieldFailure2("NO_OP", "Rebuild produced no change.");
338383
339884
  return fieldSuccess2(address2);
338384
339885
  }
@@ -338406,7 +339907,7 @@ function fieldsRemoveWrapper2(editor, input2, options) {
338406
339907
  clearIndexCache2(editor);
338407
339908
  return true;
338408
339909
  }, { expectedRevision: options?.expectedRevision });
338409
- if (!receiptApplied10(receipt2))
339910
+ if (!receiptApplied9(receipt2))
338410
339911
  return fieldFailure2("NO_OP", "Remove produced no change.");
338411
339912
  return fieldSuccess2(address2);
338412
339913
  }
@@ -338581,6 +340082,39 @@ var init_citation_resolver = __esm(() => {
338581
340082
  init_errors3();
338582
340083
  });
338583
340084
 
340085
+ // ../../packages/super-editor/src/document-api-adapters/out-of-band-mutation.ts
340086
+ function executeOutOfBandMutation2(editor, mutateFn, options) {
340087
+ if (!options.dryRun) {
340088
+ if (editor.options?.collaborationProvider && editor.options?.ydoc) {
340089
+ try {
340090
+ yUndoPluginKey2.getState(editor.state)?.undoManager?.stopCapturing();
340091
+ } catch {}
340092
+ } else {
340093
+ try {
340094
+ editor.view?.dispatch?.(closeHistory2(editor.state.tr));
340095
+ } catch {}
340096
+ }
340097
+ }
340098
+ checkRevision2(editor, options.expectedRevision);
340099
+ const result = mutateFn(options.dryRun);
340100
+ if (result.changed && !options.dryRun) {
340101
+ const converter = editor.converter;
340102
+ if (converter) {
340103
+ converter.documentModified = true;
340104
+ if (!converter.documentGuid && typeof converter.promoteToGuid === "function") {
340105
+ converter.promoteToGuid();
340106
+ }
340107
+ }
340108
+ incrementRevision2(editor);
340109
+ }
340110
+ return result.payload;
340111
+ }
340112
+ var init_out_of_band_mutation = __esm(() => {
340113
+ init_dist7();
340114
+ init_y_prosemirror();
340115
+ init_revision_tracker();
340116
+ });
340117
+
338584
340118
  // ../../packages/super-editor/src/document-api-adapters/plan-engine/citation-wrappers.ts
338585
340119
  function citationSuccess2(address2) {
338586
340120
  return { success: true, citation: address2 };
@@ -338600,7 +340134,7 @@ function bibSuccess2(address2) {
338600
340134
  function bibFailure2(code10, message) {
338601
340135
  return { success: false, failure: { code: code10, message } };
338602
340136
  }
338603
- function receiptApplied11(receipt2) {
340137
+ function receiptApplied10(receipt2) {
338604
340138
  return receipt2.steps[0]?.effect === "changed";
338605
340139
  }
338606
340140
  function citationsListWrapper2(editor, query2) {
@@ -338648,7 +340182,7 @@ function citationsInsertWrapper2(editor, input2, options) {
338648
340182
  clearIndexCache2(editor);
338649
340183
  return true;
338650
340184
  }, { expectedRevision: options?.expectedRevision });
338651
- if (!receiptApplied11(receipt2))
340185
+ if (!receiptApplied10(receipt2))
338652
340186
  return citationFailure2("NO_OP", "Insert produced no change.");
338653
340187
  const insertedAddress = resolveInsertedCitationAddress2(editor.state.doc, resolved.from, input2.sourceIds);
338654
340188
  return citationSuccess2(insertedAddress);
@@ -338672,7 +340206,7 @@ function citationsUpdateWrapper2(editor, input2, options) {
338672
340206
  clearIndexCache2(editor);
338673
340207
  return true;
338674
340208
  }, { expectedRevision: options?.expectedRevision });
338675
- if (!receiptApplied11(receipt2))
340209
+ if (!receiptApplied10(receipt2))
338676
340210
  return citationFailure2("NO_OP", "Update produced no change.");
338677
340211
  return citationSuccess2(address2);
338678
340212
  }
@@ -338689,7 +340223,7 @@ function citationsRemoveWrapper2(editor, input2, options) {
338689
340223
  clearIndexCache2(editor);
338690
340224
  return true;
338691
340225
  }, { expectedRevision: options?.expectedRevision });
338692
- if (!receiptApplied11(receipt2))
340226
+ if (!receiptApplied10(receipt2))
338693
340227
  return citationFailure2("NO_OP", "Remove produced no change.");
338694
340228
  return citationSuccess2(address2);
338695
340229
  }
@@ -338798,7 +340332,7 @@ function bibliographyInsertWrapper2(editor, input2, options) {
338798
340332
  clearIndexCache2(editor);
338799
340333
  return true;
338800
340334
  }, { expectedRevision: options?.expectedRevision });
338801
- if (!receiptApplied11(receipt2))
340335
+ if (!receiptApplied10(receipt2))
338802
340336
  return bibFailure2("NO_OP", "Insert produced no change.");
338803
340337
  return bibSuccess2(address2);
338804
340338
  }
@@ -338830,7 +340364,7 @@ function bibliographyConfigureWrapper2(editor, input2, options) {
338830
340364
  clearIndexCache2(editor);
338831
340365
  return true;
338832
340366
  }, { expectedRevision: options?.expectedRevision });
338833
- if (!receiptApplied11(receipt2))
340367
+ if (!receiptApplied10(receipt2))
338834
340368
  return bibFailure2("NO_OP", "Configure produced no change.");
338835
340369
  return bibSuccess2(address2);
338836
340370
  }
@@ -338855,7 +340389,7 @@ function bibliographyRemoveWrapper2(editor, input2, options) {
338855
340389
  clearIndexCache2(editor);
338856
340390
  return true;
338857
340391
  }, { expectedRevision: options?.expectedRevision });
338858
- if (!receiptApplied11(receipt2))
340392
+ if (!receiptApplied10(receipt2))
338859
340393
  return bibFailure2("NO_OP", "Remove produced no change.");
338860
340394
  return bibSuccess2(address2);
338861
340395
  }
@@ -339118,7 +340652,7 @@ function entrySuccess4(address2) {
339118
340652
  function entryFailure4(code10, message) {
339119
340653
  return { success: false, failure: { code: code10, message } };
339120
340654
  }
339121
- function receiptApplied12(receipt2) {
340655
+ function receiptApplied11(receipt2) {
339122
340656
  return receipt2.steps[0]?.effect === "changed";
339123
340657
  }
339124
340658
  function authoritiesListWrapper2(editor, query2) {
@@ -339166,7 +340700,7 @@ function authoritiesInsertWrapper2(editor, input2, options) {
339166
340700
  clearIndexCache2(editor);
339167
340701
  return true;
339168
340702
  }, { expectedRevision: options?.expectedRevision });
339169
- if (!receiptApplied12(receipt2))
340703
+ if (!receiptApplied11(receipt2))
339170
340704
  return toaFailure2("NO_OP", "Insert produced no change.");
339171
340705
  const insertedNode = editor.state.doc.nodeAt(pos);
339172
340706
  const resolvedNodeId = insertedNode?.attrs?.sdBlockId ?? `toa-${pos}`;
@@ -339202,7 +340736,7 @@ function authoritiesConfigureWrapper2(editor, input2, options) {
339202
340736
  clearIndexCache2(editor);
339203
340737
  return true;
339204
340738
  }, { expectedRevision: options?.expectedRevision });
339205
- if (!receiptApplied12(receipt2))
340739
+ if (!receiptApplied11(receipt2))
339206
340740
  return toaFailure2("NO_OP", "Configure produced no change.");
339207
340741
  return toaSuccess2(address2);
339208
340742
  }
@@ -339227,7 +340761,7 @@ function authoritiesRemoveWrapper2(editor, input2, options) {
339227
340761
  clearIndexCache2(editor);
339228
340762
  return true;
339229
340763
  }, { expectedRevision: options?.expectedRevision });
339230
- if (!receiptApplied12(receipt2))
340764
+ if (!receiptApplied11(receipt2))
339231
340765
  return toaFailure2("NO_OP", "Remove produced no change.");
339232
340766
  return toaSuccess2(address2);
339233
340767
  }
@@ -339279,7 +340813,7 @@ function authorityEntriesInsertWrapper2(editor, input2, options) {
339279
340813
  clearIndexCache2(editor);
339280
340814
  return true;
339281
340815
  }, { expectedRevision: options?.expectedRevision });
339282
- if (!receiptApplied12(receipt2))
340816
+ if (!receiptApplied11(receipt2))
339283
340817
  return entryFailure4("NO_OP", "Insert produced no change.");
339284
340818
  return entrySuccess4(computeInlineEntryAddress3(editor.state.doc, resolved.from));
339285
340819
  }
@@ -339308,7 +340842,7 @@ function authorityEntriesUpdateWrapper2(editor, input2, options) {
339308
340842
  clearIndexCache2(editor);
339309
340843
  return true;
339310
340844
  }, { expectedRevision: options?.expectedRevision });
339311
- if (!receiptApplied12(receipt2))
340845
+ if (!receiptApplied11(receipt2))
339312
340846
  return entryFailure4("NO_OP", "Update produced no change.");
339313
340847
  return entrySuccess4(address2);
339314
340848
  }
@@ -339325,7 +340859,7 @@ function authorityEntriesRemoveWrapper2(editor, input2, options) {
339325
340859
  clearIndexCache2(editor);
339326
340860
  return true;
339327
340861
  }, { expectedRevision: options?.expectedRevision });
339328
- if (!receiptApplied12(receipt2))
340862
+ if (!receiptApplied11(receipt2))
339329
340863
  return entryFailure4("NO_OP", "Remove produced no change.");
339330
340864
  return entrySuccess4(address2);
339331
340865
  }
@@ -339504,7 +341038,9 @@ function assembleDocumentApiAdapters2(editor) {
339504
341038
  rejectAll: (input2, options) => trackChangesRejectAllWrapper2(editor, input2, options)
339505
341039
  },
339506
341040
  blocks: {
339507
- delete: (input2, options) => blocksDeleteWrapper2(editor, input2, options)
341041
+ list: (input2) => blocksListWrapper2(editor, input2),
341042
+ delete: (input2, options) => blocksDeleteWrapper2(editor, input2, options),
341043
+ deleteRange: (input2, options) => blocksDeleteRangeWrapper2(editor, input2, options)
339508
341044
  },
339509
341045
  create: {
339510
341046
  paragraph: (input2, options) => createParagraphWrapper2(editor, input2, options),
@@ -393686,7 +395222,7 @@ function mapListsError(operationId, error2, code10) {
393686
395222
  return new CliError("TARGET_NOT_FOUND", message, { operationId, details });
393687
395223
  }
393688
395224
  if (code10 === "INVALID_TARGET") {
393689
- return new CliError("INVALID_ARGUMENT", message, { operationId, details });
395225
+ return new CliError("INVALID_TARGET", message, { operationId, details });
393690
395226
  }
393691
395227
  if (code10 === "TRACK_CHANGE_COMMAND_UNAVAILABLE" || code10 === "CAPABILITY_UNAVAILABLE") {
393692
395228
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", message, { operationId, details });
@@ -393761,9 +395297,12 @@ function mapCreateError(operationId, error2, code10) {
393761
395297
  if (code10 === "TARGET_NOT_FOUND") {
393762
395298
  return new CliError("TARGET_NOT_FOUND", message, { operationId, details });
393763
395299
  }
393764
- if (code10 === "AMBIGUOUS_TARGET" || code10 === "INVALID_TARGET") {
395300
+ if (code10 === "AMBIGUOUS_TARGET") {
393765
395301
  return new CliError("INVALID_ARGUMENT", message, { operationId, details });
393766
395302
  }
395303
+ if (code10 === "INVALID_TARGET") {
395304
+ return new CliError("INVALID_TARGET", message, { operationId, details });
395305
+ }
393767
395306
  if (code10 === "TRACK_CHANGE_COMMAND_UNAVAILABLE") {
393768
395307
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", message, { operationId, details });
393769
395308
  }
@@ -393897,7 +395436,7 @@ function mapFailedReceipt(operationId, result2) {
393897
395436
  }
393898
395437
  if (family === "lists") {
393899
395438
  if (failureCode === "INVALID_TARGET") {
393900
- return new CliError("INVALID_ARGUMENT", failureMessage, { operationId, failure });
395439
+ return new CliError("INVALID_TARGET", failureMessage, { operationId, failure });
393901
395440
  }
393902
395441
  if (failureCode === "CAPABILITY_UNAVAILABLE") {
393903
395442
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", failureMessage, { operationId, failure });
@@ -393924,7 +395463,7 @@ function mapFailedReceipt(operationId, result2) {
393924
395463
  return new CliError("TRACK_CHANGE_COMMAND_UNAVAILABLE", failureMessage, { operationId, failure });
393925
395464
  }
393926
395465
  if (failureCode === "INVALID_TARGET") {
393927
- return new CliError("INVALID_ARGUMENT", failureMessage, { operationId, failure });
395466
+ return new CliError("INVALID_TARGET", failureMessage, { operationId, failure });
393928
395467
  }
393929
395468
  return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure });
393930
395469
  }
@@ -394161,41 +395700,18 @@ function validateCreateParagraphLocation(value2, path3) {
394161
395700
  return { kind: kind2 };
394162
395701
  }
394163
395702
  if (kind2 === "before" || kind2 === "after") {
394164
- const hasTarget = obj.target != null;
394165
- const hasNodeId = obj.nodeId != null;
394166
- if (hasTarget === hasNodeId) {
394167
- throw new CliError("VALIDATION_ERROR", `${path3} must include exactly one of target or nodeId.`);
395703
+ if (obj.nodeId != null) {
395704
+ throw new CliError("VALIDATION_ERROR", `${path3}: bare "nodeId" shorthand is not supported. Use "target" with an explicit { kind: "block", nodeType, nodeId }.`);
394168
395705
  }
394169
- if (hasTarget) {
394170
- expectOnlyKeys(obj, ["kind", "target"], path3);
394171
- const target3 = validateNodeAddress(obj.target, `${path3}.target`);
394172
- if (target3.kind !== "block") {
394173
- throw new CliError("VALIDATION_ERROR", `${path3}.target.kind must be "block".`);
394174
- }
394175
- if (kind2 === "before") {
394176
- return {
394177
- kind: "before",
394178
- target: target3
394179
- };
394180
- }
394181
- return {
394182
- kind: "after",
394183
- target: target3
394184
- };
395706
+ expectOnlyKeys(obj, ["kind", "target"], path3);
395707
+ if (obj.target == null) {
395708
+ throw new CliError("VALIDATION_ERROR", `${path3} must include a "target" BlockNodeAddress.`);
394185
395709
  }
394186
- expectOnlyKeys(obj, ["kind", "nodeId"], path3);
394187
- const nodeId = expectString(obj.nodeId, `${path3}.nodeId`);
394188
- const target2 = { kind: "block", nodeType: "paragraph", nodeId };
394189
- if (kind2 === "before") {
394190
- return {
394191
- kind: "before",
394192
- target: target2
394193
- };
395710
+ const target2 = validateNodeAddress(obj.target, `${path3}.target`);
395711
+ if (target2.kind !== "block") {
395712
+ throw new CliError("VALIDATION_ERROR", `${path3}.target.kind must be "block".`);
394194
395713
  }
394195
- return {
394196
- kind: "after",
394197
- target: target2
394198
- };
395714
+ return { kind: kind2, target: target2 };
394199
395715
  }
394200
395716
  throw new CliError("VALIDATION_ERROR", `${path3}.kind must be one of: documentStart, documentEnd, before, after.`);
394201
395717
  }
@@ -395507,7 +397023,7 @@ var init_helper_commands = __esm(() => {
395507
397023
  description: "Apply strikethrough formatting to a text range.",
395508
397024
  category: "format",
395509
397025
  mutates: true,
395510
- examples: ["superdoc format strikethrough --blockId p1 --start 0 --end 5"]
397026
+ examples: ["superdoc format strikethrough --block-id p1 --start 0 --end 5"]
395511
397027
  },
395512
397028
  {
395513
397029
  tokens: ["track-changes", "accept"],
@@ -395556,9 +397072,7 @@ var init_helper_commands = __esm(() => {
395556
397072
  description: "Add a new comment thread anchored to a text range.",
395557
397073
  category: "comments",
395558
397074
  mutates: true,
395559
- examples: [
395560
- `superdoc comments add --target '{"kind":"text","blockId":"p1","range":{"start":0,"end":5}}' --text "Review this"`
395561
- ]
397075
+ examples: ['superdoc comments add --block-id p1 --start 0 --end 5 --text "Review this"']
395562
397076
  },
395563
397077
  {
395564
397078
  tokens: ["comments", "reply"],
@@ -395586,7 +397100,7 @@ var init_helper_commands = __esm(() => {
395586
397100
  category: "comments",
395587
397101
  mutates: true,
395588
397102
  examples: [
395589
- `superdoc comments move --id c1 --target '{"kind":"text","blockId":"p2","range":{"start":0,"end":5}}'`
397103
+ `superdoc comments move --id c1 --target-json '{"kind":"text","blockId":"p2","range":{"start":0,"end":5}}'`
395590
397104
  ]
395591
397105
  },
395592
397106
  {
@@ -395619,6 +397133,111 @@ var init_helper_commands = __esm(() => {
395619
397133
  ];
395620
397134
  });
395621
397135
 
397136
+ // src/cli/command-examples.ts
397137
+ var DOC_COMMAND_EXAMPLES;
397138
+ var init_command_examples = __esm(() => {
397139
+ DOC_COMMAND_EXAMPLES = {
397140
+ find: [
397141
+ 'superdoc find --type text --pattern "quarterly revenue" --limit 5',
397142
+ `superdoc find --select-json '{"type":"node","nodeType":"heading"}'`
397143
+ ],
397144
+ "query.match": [
397145
+ `superdoc query match --select-json '{"type":"text","pattern":"Introduction"}' --require exactlyOne`,
397146
+ `superdoc query match --select-json '{"type":"node","nodeType":"paragraph"}' --require any --limit 3`
397147
+ ],
397148
+ getNode: [`superdoc get-node --address-json '{"kind":"block","nodeType":"paragraph","nodeId":"abc123"}'`],
397149
+ getNodeById: ["superdoc get-node-by-id --id abc123"],
397150
+ getText: ["superdoc get-text"],
397151
+ info: ["superdoc info"],
397152
+ insert: [
397153
+ 'superdoc insert --value "Hello, world!"',
397154
+ 'superdoc insert --block-id abc123 --value "Appended text"',
397155
+ 'superdoc insert --type markdown --value "## New Section"'
397156
+ ],
397157
+ replace: [
397158
+ 'superdoc replace --block-id abc123 --start 0 --end 5 --text "Updated"',
397159
+ 'superdoc replace --block-id abc123 --start 0 --end 5 --text "Updated" --dry-run',
397160
+ 'superdoc replace --block-id abc123 --start 0 --end 5 --text "Updated" --expected-revision 3'
397161
+ ],
397162
+ delete: [
397163
+ "superdoc delete --block-id abc123 --start 0 --end 10",
397164
+ "superdoc delete --block-id abc123 --start 0 --end 10 --dry-run"
397165
+ ],
397166
+ "blocks.list": [
397167
+ "superdoc blocks list",
397168
+ "superdoc blocks list --limit 20",
397169
+ "superdoc blocks list --offset 10 --limit 10",
397170
+ `superdoc blocks list --node-types-json '["paragraph","heading"]'`
397171
+ ],
397172
+ "blocks.delete": [
397173
+ "superdoc blocks delete --node-type paragraph --node-id abc123",
397174
+ "superdoc blocks delete --node-type paragraph --node-id abc123 --dry-run"
397175
+ ],
397176
+ "blocks.deleteRange": [
397177
+ `superdoc blocks delete-range --start-json '{"kind":"block","nodeType":"paragraph","nodeId":"abc123"}' --end-json '{"kind":"block","nodeType":"paragraph","nodeId":"def456"}'`,
397178
+ `superdoc blocks delete-range --start-json '{"kind":"block","nodeType":"paragraph","nodeId":"abc123"}' --end-json '{"kind":"block","nodeType":"paragraph","nodeId":"def456"}' --dry-run`
397179
+ ],
397180
+ "create.paragraph": [
397181
+ 'superdoc create paragraph --text "A new paragraph."',
397182
+ 'superdoc create paragraph --at document-end --text "Last paragraph."',
397183
+ `superdoc create paragraph --at-json '{"kind":"after","target":{"kind":"block","nodeType":"paragraph","nodeId":"abc123"}}'`
397184
+ ],
397185
+ "create.heading": [
397186
+ `superdoc create heading --input-json '{"level":2,"text":"Section Title"}'`,
397187
+ `superdoc create heading --input-json '{"level":1,"text":"Document Title","at":{"kind":"documentStart"}}'`
397188
+ ],
397189
+ "create.image": ['superdoc create image --src "https://example.com/photo.png" --alt "Photo caption"'],
397190
+ "lists.list": ["superdoc lists list", "superdoc lists list --kind ordered"],
397191
+ "lists.get": [`superdoc lists get --address-json '{"kind":"block","nodeType":"listItem","nodeId":"li1"}'`],
397192
+ "lists.insert": [
397193
+ 'superdoc lists insert --node-id abc123 --position after --text "New list item"',
397194
+ "superdoc lists insert --node-id abc123 --position before"
397195
+ ],
397196
+ "lists.indent": ["superdoc lists indent --node-id abc123"],
397197
+ "lists.outdent": ["superdoc lists outdent --node-id abc123"],
397198
+ "lists.create": [
397199
+ `superdoc lists create --input-json '{"mode":"empty","at":{"kind":"block","nodeType":"paragraph","nodeId":"abc123"},"kind":"ordered"}'`
397200
+ ],
397201
+ "lists.attach": [
397202
+ `superdoc lists attach --input-json '{"target":{"kind":"block","nodeType":"listItem","nodeId":"abc123"},"direction":"above"}'`
397203
+ ],
397204
+ "lists.detach": ["superdoc lists detach --node-id abc123"],
397205
+ "lists.join": [
397206
+ `superdoc lists join --input-json '{"target":{"kind":"block","nodeType":"listItem","nodeId":"abc123"},"direction":"above"}'`
397207
+ ],
397208
+ "lists.separate": ["superdoc lists separate --node-id abc123"],
397209
+ "lists.setLevel": ["superdoc lists set-level --node-id abc123 --level 2"],
397210
+ "lists.setValue": ["superdoc lists set-value --node-id abc123 --value-json 5"],
397211
+ "lists.convertToText": ["superdoc lists convert-to-text --node-id abc123"],
397212
+ "lists.setType": [
397213
+ `superdoc lists set-type --target-json '{"kind":"block","nodeType":"listItem","nodeId":"abc123"}' --kind bullet`
397214
+ ],
397215
+ "format.apply": [`superdoc format apply --block-id abc123 --start 0 --end 10 --inline-json '{"bold":true}'`],
397216
+ "comments.create": ['superdoc comments create --block-id abc123 --start 0 --end 5 --text "Review this section"'],
397217
+ "comments.list": ["superdoc comments list"],
397218
+ "comments.get": ["superdoc comments get --id comment-123"],
397219
+ "comments.patch": ['superdoc comments patch --id comment-123 --text "Updated wording."'],
397220
+ "comments.delete": ["superdoc comments delete --id comment-123"],
397221
+ "trackChanges.list": ["superdoc track-changes list"],
397222
+ "trackChanges.get": ["superdoc track-changes get --id tc-123"],
397223
+ "trackChanges.decide": [`superdoc track-changes decide --decision accept --target-json '{"id":"tc-123"}'`],
397224
+ "history.get": ["superdoc history get"],
397225
+ "history.undo": ["superdoc history undo"],
397226
+ "history.redo": ["superdoc history redo"],
397227
+ "mutations.apply": [
397228
+ `superdoc mutations apply --atomic true --change-mode direct --steps-json '[{"id":"s1","op":"text.rewrite","where":{"by":"select","select":{"type":"text","pattern":"old"},"require":"first"},"args":{"replacement":{"text":"new"}}}]'`
397229
+ ],
397230
+ "mutations.preview": [
397231
+ `superdoc mutations preview --atomic true --change-mode direct --steps-json '[{"id":"s1","op":"text.rewrite","where":{"by":"select","select":{"type":"text","pattern":"old"},"require":"first"},"args":{"replacement":{"text":"new"}}}]'`
397232
+ ],
397233
+ "create.tableOfContents": [
397234
+ "superdoc create table-of-contents",
397235
+ `superdoc create table-of-contents --at-json '{"kind":"documentStart"}'`
397236
+ ],
397237
+ "capabilities.get": ["superdoc capabilities"]
397238
+ };
397239
+ });
397240
+
395622
397241
  // src/cli/commands.ts
395623
397242
  function buildDocBackedSpec(docApiId, cliOpId) {
395624
397243
  const tokens = cliCommandTokens(cliOpId);
@@ -395634,7 +397253,7 @@ function buildDocBackedSpec(docApiId, cliOpId) {
395634
397253
  requiresDocumentContext: cliRequiresDocumentContext(cliOpId),
395635
397254
  alias: false,
395636
397255
  canonicalKey: key3,
395637
- examples: []
397256
+ examples: DOC_COMMAND_EXAMPLES[docApiId] ?? []
395638
397257
  };
395639
397258
  }
395640
397259
  function buildCliOnlySpec(cliOnlyOp, cliOpId) {
@@ -395670,6 +397289,13 @@ function buildAllSpecs() {
395670
397289
  }
395671
397290
  function buildHelpText() {
395672
397291
  const lines = ["Usage: superdoc <command> [options]", ""];
397292
+ lines.push("Common tasks:");
397293
+ lines.push(" Find mutation target → query match");
397294
+ lines.push(" Insert between list items → lists insert");
397295
+ lines.push(" Create a paragraph → create paragraph");
397296
+ lines.push(" Insert inline text → insert");
397297
+ lines.push(" Batch formatting changes → mutations apply");
397298
+ lines.push("");
395673
397299
  const categories = new Map;
395674
397300
  for (const spec of CLI_COMMAND_SPECS) {
395675
397301
  if (spec.alias)
@@ -395711,6 +397337,7 @@ var init_commands = __esm(() => {
395711
397337
  init_src();
395712
397338
  init_operation_set();
395713
397339
  init_helper_commands();
397340
+ init_command_examples();
395714
397341
  init_operation_set();
395715
397342
  CLI_ONLY_OVERRIDES = {
395716
397343
  open: { mutates: true, examples: ["superdoc open my-doc.docx", "superdoc open my-doc.docx --session my-session"] },
@@ -396004,8 +397631,7 @@ var init_operation_params = __esm(() => {
396004
397631
  name: "dryRun",
396005
397632
  kind: "flag",
396006
397633
  flag: "dry-run",
396007
- type: "boolean",
396008
- agentVisible: false
397634
+ type: "boolean"
396009
397635
  };
396010
397636
  CHANGE_MODE_PARAM = {
396011
397637
  name: "changeMode",
@@ -396018,8 +397644,7 @@ var init_operation_params = __esm(() => {
396018
397644
  name: "expectedRevision",
396019
397645
  kind: "flag",
396020
397646
  flag: "expected-revision",
396021
- type: "number",
396022
- agentVisible: false
397647
+ type: "number"
396023
397648
  };
396024
397649
  USER_NAME_PARAM = {
396025
397650
  name: "userName",
@@ -396033,7 +397658,7 @@ var init_operation_params = __esm(() => {
396033
397658
  flag: "user-email",
396034
397659
  type: "string"
396035
397660
  };
396036
- AGENT_HIDDEN_PARAM_NAMES = new Set(["out", "expectedRevision", "dryRun"]);
397661
+ AGENT_HIDDEN_PARAM_NAMES = new Set(["out"]);
396037
397662
  OPERATION_CONSTRAINTS = {
396038
397663
  "doc.find": {
396039
397664
  requiresOneOf: [["type", "query"]],
@@ -396165,10 +397790,19 @@ var init_operation_params = __esm(() => {
396165
397790
  { name: "input", kind: "jsonFlag", flag: "input-json", type: "json" },
396166
397791
  ...LIST_TARGET_FLAT_PARAMS
396167
397792
  ],
397793
+ "doc.blocks.list": [
397794
+ { name: "offset", kind: "flag", flag: "offset", type: "number" },
397795
+ { name: "limit", kind: "flag", flag: "limit", type: "number" },
397796
+ { name: "nodeTypes", kind: "jsonFlag", flag: "node-types-json", type: "json" }
397797
+ ],
396168
397798
  "doc.blocks.delete": [
396169
397799
  { name: "nodeType", kind: "flag", flag: "node-type", type: "string" },
396170
397800
  { name: "nodeId", kind: "flag", flag: "node-id", type: "string" }
396171
397801
  ],
397802
+ "doc.blocks.deleteRange": [
397803
+ { name: "start", kind: "jsonFlag", flag: "start-json", type: "json" },
397804
+ { name: "end", kind: "jsonFlag", flag: "end-json", type: "json" }
397805
+ ],
396172
397806
  "doc.create.paragraph": [{ name: "input", kind: "jsonFlag", flag: "input-json", type: "json" }],
396173
397807
  "doc.create.heading": [{ name: "input", kind: "jsonFlag", flag: "input-json", type: "json" }]
396174
397808
  };
@@ -396684,6 +398318,7 @@ var init_introspection_dispatch = __esm(() => {
396684
398318
  document: {
396685
398319
  path: metadata.sourcePath,
396686
398320
  source: metadata.source,
398321
+ sourceByteLength: metadata.sourceSnapshot?.size ?? null,
396687
398322
  byteLength: byteLength3,
396688
398323
  revision: metadata.revision
396689
398324
  },
@@ -396698,6 +398333,9 @@ var init_introspection_dispatch = __esm(() => {
396698
398333
  `Context: ${metadata.contextId}`,
396699
398334
  `Default: ${activeSessionId ?? "<none>"}`,
396700
398335
  `Document: ${metadata.sourcePath ?? "<stdin>"}`,
398336
+ `Source: ${metadata.source}`,
398337
+ metadata.sourceSnapshot ? `Source size: ${metadata.sourceSnapshot.size} bytes` : undefined,
398338
+ `Working size: ${byteLength3} bytes`,
396701
398339
  `Session Type: ${metadata.sessionType}`,
396702
398340
  metadata.collaboration ? `Collab Doc ID: ${metadata.collaboration.documentId}` : undefined,
396703
398341
  `Revision: ${metadata.revision}`,
@@ -396763,13 +398401,19 @@ function ensureBlockTarget(value2, path3) {
396763
398401
  async function buildFlatInput(parsed, commandName) {
396764
398402
  const text9 = getStringOption(parsed, "text");
396765
398403
  const at = parseAtFlag(getStringOption(parsed, "at"), commandName);
398404
+ const atJson = await resolveJsonInput(parsed, "at");
396766
398405
  const beforePayload = await resolveJsonInput(parsed, "before-address");
396767
398406
  const afterPayload = await resolveJsonInput(parsed, "after-address");
396768
- if (beforePayload != null && afterPayload != null) {
396769
- throw new CliError("INVALID_ARGUMENT", `${commandName}: use only one of --before-address-json or --after-address-json.`);
398407
+ const locationForms = [at, atJson, beforePayload, afterPayload].filter((v) => v != null);
398408
+ if (locationForms.length > 1) {
398409
+ throw new CliError("INVALID_ARGUMENT", `${commandName}: use only one of --at, --at-json, --before-address-json, or --after-address-json.`);
396770
398410
  }
396771
- if (at && (beforePayload != null || afterPayload != null)) {
396772
- throw new CliError("INVALID_ARGUMENT", `${commandName}: --at cannot be combined with --before-address-json/--after-address-json.`);
398411
+ if (atJson != null) {
398412
+ const validated = validateCreateParagraphInput({ at: atJson, text: text9 }, "input");
398413
+ if (!validated.at) {
398414
+ throw new CliError("VALIDATION_ERROR", `${commandName}: --at-json produced an empty location. Provide a valid location object.`);
398415
+ }
398416
+ return validated;
396773
398417
  }
396774
398418
  if (beforePayload != null) {
396775
398419
  return {
@@ -396797,7 +398441,7 @@ async function buildFlatInput(parsed, commandName) {
396797
398441
  async function resolveCreateParagraphInput(parsed, commandName) {
396798
398442
  const inputJson = await resolveJsonInput(parsed, "input");
396799
398443
  const inputProvided = inputJson !== undefined;
396800
- const hasFlatFlags = getStringOption(parsed, "text") != null || getStringOption(parsed, "at") != null || getStringOption(parsed, "before-address-json") != null || getStringOption(parsed, "before-address-file") != null || getStringOption(parsed, "after-address-json") != null || getStringOption(parsed, "after-address-file") != null;
398444
+ const hasFlatFlags = getStringOption(parsed, "text") != null || getStringOption(parsed, "at") != null || getStringOption(parsed, "at-json") != null || getStringOption(parsed, "at-file") != null || getStringOption(parsed, "before-address-json") != null || getStringOption(parsed, "before-address-file") != null || getStringOption(parsed, "after-address-json") != null || getStringOption(parsed, "after-address-file") != null;
396801
398445
  if (inputProvided && hasFlatFlags) {
396802
398446
  throw new CliError("INVALID_ARGUMENT", `${commandName}: --input-json/--input-file cannot be combined with flat create flags.`);
396803
398447
  }
@@ -397354,6 +398998,8 @@ async function parseWrapperOperationInput(operationId, tokens, commandName, opti
397354
398998
  { name: "input-file", type: "string" },
397355
398999
  { name: "text", type: "string" },
397356
399000
  { name: "at", type: "string" },
399001
+ { name: "at-json", type: "string" },
399002
+ { name: "at-file", type: "string" },
397357
399003
  { name: "before-address-json", type: "string" },
397358
399004
  { name: "before-address-file", type: "string" },
397359
399005
  { name: "after-address-json", type: "string" },
@@ -397609,7 +399255,7 @@ async function runOpen(tokens, context) {
397609
399255
  document: {
397610
399256
  path: metadata.sourcePath,
397611
399257
  source: metadata.source,
397612
- byteLength: output.byteLength,
399258
+ byteLength: opened.meta.byteLength,
397613
399259
  revision: metadata.revision
397614
399260
  },
397615
399261
  dirty: metadata.dirty,