@superdoc-dev/cli 0.8.0-next.20 → 0.8.0-next.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1479 -222
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -1365,7 +1365,26 @@ More content with **bold** and *italic*.`
1365
1365
  table: { toolName: "superdoc_table", description: "Table structure and cell operations" },
1366
1366
  list: {
1367
1367
  toolName: "superdoc_list",
1368
- description: "Create and manipulate bullet and numbered lists. " + 'To create a list: first create all paragraphs at the SAME location using superdoc_create (chain each using the previous nodeId as the "at" target). ' + 'Then call action "create" with mode:"fromParagraphs", a preset ("disc" for bullet, "decimal" for numbered), and a range target: {from:{kind:"block", nodeType:"paragraph", nodeId:"<first>"}, to:{kind:"block", nodeType:"paragraph", nodeId:"<last>"}}. ' + "The range converts ALL paragraphs between from and to into list items. Make sure no other content exists between them. " + 'Action "set_type" converts between bullet and ordered (target any item in the list, kind:"ordered" or "bullet"). ' + 'Action "insert" adds a new item before/after a target list item. ' + 'Actions "indent" and "outdent" change nesting level; "set_level" jumps to a specific level (0-8). ' + 'Action "detach" converts a list item back to a plain paragraph. ' + "Do NOT target paragraphs with indent/outdent/set_type; these actions require a listItem target.",
1368
+ description: "Create and manipulate bullet and numbered lists. " + 'Most actions require a list-item target: {kind:"block", nodeType:"listItem", nodeId:"<id>"}. ' + 'Exceptions: "create" and "attach" operate on paragraph targets (they turn paragraphs into list items). ' + `Find nodeIds via superdoc_get_content({action:"blocks"}) pick listItem blocks for most actions, paragraph blocks for create/attach.
1369
+ ` + `
1370
+ ` + `CREATE & CONVERT:
1371
+ ` + '• "create" — make a NEW list from paragraphs. Two modes: ' + 'mode:"empty" with at:{kind:"block", nodeType:"paragraph", nodeId} converts a single paragraph; ' + 'mode:"fromParagraphs" with target:{from:{...paragraph block address}, to:{...paragraph block address}} converts a range — ALL paragraphs between from and to become items, so make sure no other content sits between them. ' + 'Pass a preset ("disc"|"circle"|"square"|"dash" for bullets; "decimal"|"decimalParenthesis"|"lowerLetter"|"upperLetter"|"lowerRoman"|"upperRoman" for ordered) or a custom style. ' + `Use "create" to start a fresh list — NOT to extend an existing one (use "attach" for that).
1372
+ ` + `• "attach" — add paragraphs to an EXISTING list, inheriting its numbering definition. Pass target:{paragraph block address} (or {from, to} range of paragraphs) + attachTo:{kind:"block", nodeType:"listItem", nodeId:"<any item in destination list>"} + optional level:0..8. Use this to extend a list or as the second half of a merge workflow (see "join" below).
1373
+ ` + `• "set_type" — convert an existing list between ordered and bullet. Pass target:{listItem} + kind:"ordered" or "bullet". Adjacent compatible sequences are merged automatically to preserve continuous numbering.
1374
+ ` + `• "detach" — convert a list item back to a plain paragraph. Pass target:{listItem}.
1375
+ ` + `
1376
+ ` + `ITEMS & NESTING:
1377
+ ` + `• "insert" — add a new list item adjacent to an existing item in the same list. Pass target:{listItem} + position:"before"|"after" + optional text. Use this (NOT superdoc_create) to add items to an existing list.
1378
+ ` + `• "indent" / "outdent" — bump the target item's nesting level by one (0-8 range). Pass target:{listItem}.
1379
+ ` + `• "set_level" — jump the target item to an explicit level. Pass target:{listItem} + level:0..8.
1380
+ ` + `
1381
+ ` + `NUMBERING (ordered lists):
1382
+ ` + `• "set_value" — restart numbering at the target. Pass target:{listItem} + value:<number> (e.g. value:1 to start over) or value:null to clear a previous override. Mid-sequence targets are atomically split off into their own sequence.
1383
+ ` + `• "continue_previous" — make the target's sequence continue numbering from the nearest compatible previous sequence (same abstract definition). Pass target:{listItem of the sequence you want to renumber}. Fails with NO_COMPATIBLE_PREVIOUS or INCOMPATIBLE_DEFINITIONS if no matching prior sequence exists.
1384
+ ` + `
1385
+ ` + `SEQUENCE SHAPE (merge / split):
1386
+ ` + `• "merge" — merge the target's sequence with an adjacent one into one continuous list. Pass target:{listItem} + direction:"withPrevious" or "withNext". Absorbed items adopt the absorbing sequence's numbering definition, and empty paragraphs between the two sequences are removed so numbering flows continuously.
1387
+ ` + `• "split" — split the target's sequence at the target item into two independent lists. The target and everything after become a new sequence that restarts numbering at 1. Pass target:{listItem}; add restartNumbering:false to keep the count continuing instead of restarting.`,
1369
1388
  inputExamples: [
1370
1389
  {
1371
1390
  action: "create",
@@ -1383,7 +1402,15 @@ More content with **bold** and *italic*.`
1383
1402
  position: "after",
1384
1403
  text: "New list item"
1385
1404
  },
1386
- { action: "indent", target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" } }
1405
+ { action: "indent", target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" } },
1406
+ {
1407
+ action: "merge",
1408
+ target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" },
1409
+ direction: "withPrevious"
1410
+ },
1411
+ { action: "split", target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" } },
1412
+ { action: "set_value", target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" }, value: 1 },
1413
+ { action: "continue_previous", target: { kind: "block", nodeType: "listItem", nodeId: "<itemId>" } }
1387
1414
  ]
1388
1415
  },
1389
1416
  comment: {
@@ -2616,7 +2643,9 @@ More content with **bold** and *italic*.`
2616
2643
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2617
2644
  }),
2618
2645
  referenceDocPath: "lists/attach.mdx",
2619
- referenceGroup: "lists"
2646
+ referenceGroup: "lists",
2647
+ intentGroup: "list",
2648
+ intentAction: "attach"
2620
2649
  },
2621
2650
  "lists.detach": {
2622
2651
  memberPath: "lists.detach",
@@ -2716,6 +2745,40 @@ More content with **bold** and *italic*.`
2716
2745
  referenceDocPath: "lists/separate.mdx",
2717
2746
  referenceGroup: "lists"
2718
2747
  },
2748
+ "lists.merge": {
2749
+ memberPath: "lists.merge",
2750
+ description: 'Compound: merge two adjacent list sequences into one. Reassigns numId on the absorbed sequence (no strict abstractNumId check — absorbed items adopt the absorbing definition) and deletes empty paragraphs between the two sequences. Use this instead of lists.join for the user-facing "merge these lists" intent.',
2751
+ expectedResult: "Returns a ListsMergeResult with the merged listId, absorbedCount, and removedEmptyBlocks count.",
2752
+ requiresDocumentContext: true,
2753
+ metadata: mutationOperation({
2754
+ idempotency: "conditional",
2755
+ supportsDryRun: true,
2756
+ supportsTrackedMode: false,
2757
+ possibleFailureCodes: ["INVALID_TARGET", "NO_ADJACENT_SEQUENCE", "NO_OP"],
2758
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2759
+ }),
2760
+ referenceDocPath: "lists/merge.mdx",
2761
+ referenceGroup: "lists",
2762
+ intentGroup: "list",
2763
+ intentAction: "merge"
2764
+ },
2765
+ "lists.split": {
2766
+ memberPath: "lists.split",
2767
+ description: "Compound: split a list sequence at the target item into two independent sequences. Runs lists.separate then (by default) lists.setValue(1) so the new half starts numbering fresh at 1. Pass restartNumbering:false for raw separate semantics (new half continues the previous count).",
2768
+ expectedResult: "Returns a ListsSplitResult with the new listId, numId, and the restart value applied (or null).",
2769
+ requiresDocumentContext: true,
2770
+ metadata: mutationOperation({
2771
+ idempotency: "conditional",
2772
+ supportsDryRun: true,
2773
+ supportsTrackedMode: false,
2774
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
2775
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2776
+ }),
2777
+ referenceDocPath: "lists/split.mdx",
2778
+ referenceGroup: "lists",
2779
+ intentGroup: "list",
2780
+ intentAction: "split"
2781
+ },
2719
2782
  "lists.setLevel": {
2720
2783
  memberPath: "lists.setLevel",
2721
2784
  description: "Set the absolute nesting level (0..8) of a list item.",
@@ -2746,7 +2809,9 @@ More content with **bold** and *italic*.`
2746
2809
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2747
2810
  }),
2748
2811
  referenceDocPath: "lists/set-value.mdx",
2749
- referenceGroup: "lists"
2812
+ referenceGroup: "lists",
2813
+ intentGroup: "list",
2814
+ intentAction: "set_value"
2750
2815
  },
2751
2816
  "lists.continuePrevious": {
2752
2817
  memberPath: "lists.continuePrevious",
@@ -2761,7 +2826,9 @@ More content with **bold** and *italic*.`
2761
2826
  throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2762
2827
  }),
2763
2828
  referenceDocPath: "lists/continue-previous.mdx",
2764
- referenceGroup: "lists"
2829
+ referenceGroup: "lists",
2830
+ intentGroup: "list",
2831
+ intentAction: "continue_previous"
2765
2832
  },
2766
2833
  "lists.canContinuePrevious": {
2767
2834
  memberPath: "lists.canContinuePrevious",
@@ -3245,6 +3312,19 @@ More content with **bold** and *italic*.`
3245
3312
  referenceDocPath: "ranges/resolve.mdx",
3246
3313
  referenceGroup: "ranges"
3247
3314
  },
3315
+ "selection.current": {
3316
+ memberPath: "selection.current",
3317
+ description: "Read the editor's current selection as a portable SelectionInfo with a text-anchored TextTarget. Primitive for building custom comments UIs, floating toolbars, and other selection-driven components without reaching into ProseMirror internals.",
3318
+ expectedResult: "Returns a SelectionInfo with `empty`, `target` (TextTarget or null), `activeMarks`, and optionally `text` when `includeText: true`.",
3319
+ requiresDocumentContext: true,
3320
+ metadata: readOperation({
3321
+ idempotency: "idempotent",
3322
+ throws: ["INVALID_INPUT", "INVALID_CONTEXT"],
3323
+ deterministicTargetResolution: true
3324
+ }),
3325
+ referenceDocPath: "selection/current.mdx",
3326
+ referenceGroup: "selection"
3327
+ },
3248
3328
  "mutations.preview": {
3249
3329
  memberPath: "mutations.preview",
3250
3330
  description: "Dry-run a mutation plan, returning resolved targets without applying changes.",
@@ -9688,7 +9768,25 @@ var init_schemas = __esm(() => {
9688
9768
  description: "Block type: paragraph, heading, listItem, image, tableOfContents."
9689
9769
  },
9690
9770
  text: { type: "string", description: "Full plain text content of the block." },
9691
- headingLevel: { type: "integer", description: "Heading level (1–6). Only present for headings." },
9771
+ textSpans: {
9772
+ type: "array",
9773
+ description: "Block text broken into runs with tracked-change marks preserved per run. Present only when the block contains at least one tracked change. Concatenating span text yields `text`.",
9774
+ items: objectSchema({
9775
+ text: { type: "string", description: "Raw text of the run." },
9776
+ trackedChanges: {
9777
+ type: "array",
9778
+ description: "Tracked-change marks applied to this run.",
9779
+ items: objectSchema({
9780
+ entityId: {
9781
+ type: "string",
9782
+ description: "Tracked change entity ID matching an entry in trackedChanges[]."
9783
+ },
9784
+ type: { type: "string", enum: ["insert", "delete", "format"] }
9785
+ }, ["entityId", "type"])
9786
+ }
9787
+ }, ["text"])
9788
+ },
9789
+ headingLevel: { type: "integer", description: "Heading level (1-6). Only present for headings." },
9692
9790
  tableContext: objectSchema({
9693
9791
  tableOrdinal: {
9694
9792
  type: "integer",
@@ -9735,10 +9833,27 @@ var init_schemas = __esm(() => {
9735
9833
  items: objectSchema({
9736
9834
  entityId: {
9737
9835
  type: "string",
9738
- description: "Tracked change entity ID pass to scrollToElement() for navigation."
9836
+ description: "Tracked change entity ID. Pass to scrollToElement() for navigation."
9837
+ },
9838
+ type: {
9839
+ type: "string",
9840
+ enum: ["insert", "delete", "format"],
9841
+ description: "Aggregate type at the entity level. In paired replacement mode, a delete+insert pair shares one entity and this collapses to 'insert'; per-half type lives on block.textSpans[].trackedChanges[]."
9842
+ },
9843
+ blockIds: {
9844
+ type: "array",
9845
+ description: "Block IDs whose textSpans carry this change.",
9846
+ items: { type: "string" }
9847
+ },
9848
+ wordRevisionIds: objectSchema({
9849
+ insert: { type: "string", description: "Original OOXML w:id from a w:ins mark." },
9850
+ delete: { type: "string", description: "Original OOXML w:id from a w:del mark." },
9851
+ format: { type: "string", description: "Original OOXML w:id from a w:rPrChange mark." }
9852
+ }, []),
9853
+ excerpt: {
9854
+ type: "string",
9855
+ description: "Short text excerpt of the changed content. Omitted for paired replacements; read block.textSpans for the per-half text."
9739
9856
  },
9740
- type: { type: "string", enum: ["insert", "delete", "format"] },
9741
- excerpt: { type: "string", description: "Short text excerpt of the changed content." },
9742
9857
  author: { type: "string", description: "Change author name." },
9743
9858
  date: { type: "string", description: "Change date (ISO string)." }
9744
9859
  }, ["entityId", "type"])
@@ -10690,6 +10805,54 @@ var init_schemas = __esm(() => {
10690
10805
  ]),
10691
10806
  failure: listsFailureSchemaFor("lists.separate")
10692
10807
  },
10808
+ "lists.merge": {
10809
+ input: objectSchema({
10810
+ target: listItemAddressSchema,
10811
+ direction: { enum: ["withPrevious", "withNext"] }
10812
+ }, ["target", "direction"]),
10813
+ output: {
10814
+ oneOf: [
10815
+ objectSchema({
10816
+ success: { const: true },
10817
+ listId: { type: "string" },
10818
+ absorbedCount: { type: "integer" },
10819
+ removedEmptyBlocks: { type: "integer" }
10820
+ }, ["success", "listId", "absorbedCount", "removedEmptyBlocks"]),
10821
+ listsFailureSchemaFor("lists.merge")
10822
+ ]
10823
+ },
10824
+ success: objectSchema({
10825
+ success: { const: true },
10826
+ listId: { type: "string" },
10827
+ absorbedCount: { type: "integer" },
10828
+ removedEmptyBlocks: { type: "integer" }
10829
+ }, ["success", "listId", "absorbedCount", "removedEmptyBlocks"]),
10830
+ failure: listsFailureSchemaFor("lists.merge")
10831
+ },
10832
+ "lists.split": {
10833
+ input: objectSchema({
10834
+ target: listItemAddressSchema,
10835
+ restartNumbering: { type: "boolean" }
10836
+ }, ["target"]),
10837
+ output: {
10838
+ oneOf: [
10839
+ objectSchema({
10840
+ success: { const: true },
10841
+ listId: { type: "string" },
10842
+ numId: { type: "integer" },
10843
+ restartedAt: { type: ["integer", "null"] }
10844
+ }, ["success", "listId", "numId", "restartedAt"]),
10845
+ listsFailureSchemaFor("lists.split")
10846
+ ]
10847
+ },
10848
+ success: objectSchema({
10849
+ success: { const: true },
10850
+ listId: { type: "string" },
10851
+ numId: { type: "integer" },
10852
+ restartedAt: { type: ["integer", "null"] }
10853
+ }, ["success", "listId", "numId", "restartedAt"]),
10854
+ failure: listsFailureSchemaFor("lists.split")
10855
+ },
10693
10856
  "lists.setLevel": {
10694
10857
  input: objectSchema({
10695
10858
  target: listItemAddressSchema,
@@ -11058,8 +11221,8 @@ var init_schemas = __esm(() => {
11058
11221
  input: objectSchema({
11059
11222
  text: { type: "string", description: "Comment text content." },
11060
11223
  target: {
11061
- ...textAddressSchema,
11062
- description: "Text range to anchor the comment: {kind:'text', blockId:'...', range:{start:N, end:N}}."
11224
+ oneOf: [textAddressSchema, textTargetSchema],
11225
+ description: "Text range to anchor the comment. Accepts either a single-block TextAddress {kind:'text', blockId, range} or a multi-segment TextTarget {kind:'text', segments:[{blockId, range}, ...]} for selections that span blocks."
11063
11226
  },
11064
11227
  parentCommentId: {
11065
11228
  type: "string",
@@ -11391,6 +11554,17 @@ var init_schemas = __esm(() => {
11391
11554
  }, ["start", "end"]),
11392
11555
  output: resolveRangeOutputSchema
11393
11556
  },
11557
+ "selection.current": {
11558
+ input: objectSchema({
11559
+ includeText: { type: "boolean" }
11560
+ }, []),
11561
+ output: objectSchema({
11562
+ empty: { type: "boolean" },
11563
+ target: { oneOf: [textTargetSchema, { type: "null" }] },
11564
+ activeMarks: arraySchema({ type: "string" }),
11565
+ text: { type: "string" }
11566
+ }, ["empty", "target", "activeMarks"])
11567
+ },
11394
11568
  "mutations.preview": {
11395
11569
  input: mutationsInputSchema,
11396
11570
  output: objectSchema({
@@ -13260,6 +13434,11 @@ var init_reference_doc_map = __esm(() => {
13260
13434
  description: "Deterministic range construction from explicit document anchors.",
13261
13435
  pagePath: "ranges/index.mdx"
13262
13436
  },
13437
+ selection: {
13438
+ title: "Selection",
13439
+ description: "Read the editor's current selection as a portable, addressable target.",
13440
+ pagePath: "selection/index.mdx"
13441
+ },
13263
13442
  diff: {
13264
13443
  title: "Diff",
13265
13444
  description: "Snapshot-based document comparison and replay.",
@@ -13657,6 +13836,29 @@ var init_ranges = __esm(() => {
13657
13836
  init_resolve();
13658
13837
  init_scroll_into_view();
13659
13838
  });
13839
+
13840
+ // ../../packages/document-api/src/selection/selection.ts
13841
+ function validateSelectionCurrentInput(input) {
13842
+ if (input === undefined)
13843
+ return;
13844
+ if (!isRecord(input)) {
13845
+ throw new DocumentApiValidationError("INVALID_INPUT", "selection.current input must be a non-null object.");
13846
+ }
13847
+ assertNoUnknownFields(input, SELECTION_CURRENT_ALLOWED_KEYS, "selection.current");
13848
+ if (input.includeText !== undefined && typeof input.includeText !== "boolean") {
13849
+ throw new DocumentApiValidationError("INVALID_INPUT", `includeText must be a boolean, got ${typeof input.includeText}.`, { field: "includeText", value: input.includeText });
13850
+ }
13851
+ }
13852
+ function executeSelectionCurrent(adapter, input) {
13853
+ validateSelectionCurrentInput(input);
13854
+ return adapter.current(input ?? {});
13855
+ }
13856
+ var SELECTION_CURRENT_ALLOWED_KEYS;
13857
+ var init_selection = __esm(() => {
13858
+ init_errors2();
13859
+ init_validation_primitives();
13860
+ SELECTION_CURRENT_ALLOWED_KEYS = new Set(["includeText"]);
13861
+ });
13660
13862
  // ../../packages/document-api/src/markdown-to-fragment/markdown-to-fragment.ts
13661
13863
  function executeMarkdownToFragment(adapter, input) {
13662
13864
  return adapter.markdownToFragment(input);
@@ -13694,8 +13896,8 @@ function validateCreateCommentInput(input) {
13694
13896
  field: "target"
13695
13897
  });
13696
13898
  }
13697
- if (!isTextAddress(target)) {
13698
- throw new DocumentApiValidationError("INVALID_TARGET", "target must be a text address object.", {
13899
+ if (!isTextAddress(target) && !isTextTarget(target)) {
13900
+ throw new DocumentApiValidationError("INVALID_TARGET", "target must be a TextAddress or TextTarget object.", {
13699
13901
  field: "target",
13700
13902
  value: target
13701
13903
  });
@@ -15033,6 +15235,16 @@ function executeListsSeparate(adapter, input, options) {
15033
15235
  optionalBoolean(input.copyOverrides, "copyOverrides", "lists.separate");
15034
15236
  return adapter.separate(input, normalizeMutationOptions(options));
15035
15237
  }
15238
+ function executeListsMerge(adapter, input, options) {
15239
+ validateListItemTarget(input, "lists.merge");
15240
+ requireEnum(input.direction, "direction", VALID_JOIN_DIRECTIONS, "lists.merge");
15241
+ return adapter.merge(input, normalizeMutationOptions(options));
15242
+ }
15243
+ function executeListsSplit(adapter, input, options) {
15244
+ validateListItemTarget(input, "lists.split");
15245
+ optionalBoolean(input.restartNumbering, "restartNumbering", "lists.split");
15246
+ return adapter.split(input, normalizeMutationOptions(options));
15247
+ }
15036
15248
  function executeListsSetLevel(adapter, input, options) {
15037
15249
  validateListItemTarget(input, "lists.setLevel");
15038
15250
  requireLevel(input.level, "lists.setLevel");
@@ -15757,6 +15969,8 @@ function buildDispatchTable(api) {
15757
15969
  "lists.join": (input, options) => api.lists.join(input, options),
15758
15970
  "lists.canJoin": (input) => api.lists.canJoin(input),
15759
15971
  "lists.separate": (input, options) => api.lists.separate(input, options),
15972
+ "lists.merge": (input, options) => api.lists.merge(input, options),
15973
+ "lists.split": (input, options) => api.lists.split(input, options),
15760
15974
  "lists.setLevel": (input, options) => api.lists.setLevel(input, options),
15761
15975
  "lists.setValue": (input, options) => api.lists.setValue(input, options),
15762
15976
  "lists.continuePrevious": (input, options) => api.lists.continuePrevious(input, options),
@@ -15810,6 +16024,7 @@ function buildDispatchTable(api) {
15810
16024
  "trackChanges.decide": (input, options) => api.trackChanges.decide(input, options),
15811
16025
  "query.match": (input) => api.query.match(input),
15812
16026
  "ranges.resolve": (input) => api.ranges.resolve(input),
16027
+ "selection.current": (input) => api.selection.current(input),
15813
16028
  "mutations.preview": (input) => api.mutations.preview(input),
15814
16029
  "mutations.apply": (input) => api.mutations.apply(input),
15815
16030
  "capabilities.get": () => api.capabilities(),
@@ -18718,6 +18933,12 @@ function createDocumentApi(adapters) {
18718
18933
  separate(input, options) {
18719
18934
  return executeListsSeparate(adapters.lists, input, options);
18720
18935
  },
18936
+ merge(input, options) {
18937
+ return executeListsMerge(adapters.lists, input, options);
18938
+ },
18939
+ split(input, options) {
18940
+ return executeListsSplit(adapters.lists, input, options);
18941
+ },
18721
18942
  setLevel(input, options) {
18722
18943
  return executeListsSetLevel(adapters.lists, input, options);
18723
18944
  },
@@ -19478,6 +19699,22 @@ function createDocumentApi(adapters) {
19478
19699
  return executeScrollIntoView(adapters.ranges, input);
19479
19700
  }
19480
19701
  },
19702
+ selection: {
19703
+ current(input) {
19704
+ const adapter = adapters.selection;
19705
+ if (!adapter) {
19706
+ throw new DocumentApiValidationError("SELECTION_ADAPTER_UNAVAILABLE", "No selection adapter was registered. Pass `selection` in DocumentApiAdapters to call selection.current().");
19707
+ }
19708
+ return executeSelectionCurrent(adapter, input);
19709
+ },
19710
+ onChange(listener) {
19711
+ const adapter = adapters.selection;
19712
+ if (!adapter) {
19713
+ throw new DocumentApiValidationError("SELECTION_ADAPTER_UNAVAILABLE", "No selection adapter was registered. Pass `selection` in DocumentApiAdapters to call selection.onChange().");
19714
+ }
19715
+ return adapter.onChange(listener);
19716
+ }
19717
+ },
19481
19718
  mutations: {
19482
19719
  preview(input) {
19483
19720
  return adapters.mutations.preview(input);
@@ -19551,6 +19788,7 @@ var ADAPTER_GATED_PREFIXES;
19551
19788
  var init_src = __esm(() => {
19552
19789
  init_errors2();
19553
19790
  init_ranges();
19791
+ init_selection();
19554
19792
  init_comments();
19555
19793
  init_find();
19556
19794
  init_format();
@@ -19563,6 +19801,7 @@ var init_src = __esm(() => {
19563
19801
  init_delete();
19564
19802
  init_resolve();
19565
19803
  init_scroll_into_view();
19804
+ init_selection();
19566
19805
  init_insert();
19567
19806
  init_lists();
19568
19807
  init_replace();
@@ -57307,7 +57546,7 @@ var init_uuid_qzgm05fK_es = __esm(() => {
57307
57546
  v5_default = v35("v5", 80, sha1);
57308
57547
  });
57309
57548
 
57310
- // ../../packages/superdoc/dist/chunks/constants-CGhJRd87.es.js
57549
+ // ../../packages/superdoc/dist/chunks/constants-DrU4EASo.es.js
57311
57550
  function computeCrc32Hex(data) {
57312
57551
  let crc = 4294967295;
57313
57552
  for (let i2 = 0;i2 < data.length; i2++)
@@ -57406,10 +57645,18 @@ function pixelsToEmu(px) {
57406
57645
  px = parseFloat(px);
57407
57646
  return Math.round(px * 9525);
57408
57647
  }
57409
- function eighthPointsToPixels(eighthPoints) {
57648
+ function eighthPointsToPixels(eighthPoints, { clamp = false } = {}) {
57410
57649
  if (eighthPoints == null)
57411
57650
  return;
57412
- return parseFloat(eighthPoints) / 8 * 1.3333;
57651
+ const numeric = parseFloat(eighthPoints);
57652
+ if (!Number.isFinite(numeric))
57653
+ return;
57654
+ if (clamp && numeric <= 0)
57655
+ return 0;
57656
+ const pixels = numeric / EIGHTHS_PER_POINT * (96 / 72);
57657
+ if (!clamp)
57658
+ return pixels;
57659
+ return Math.min(MAX_BORDER_SIZE_PX, Math.max(MIN_BORDER_SIZE_PX, pixels));
57413
57660
  }
57414
57661
  function pointsToTwips(points) {
57415
57662
  if (points == null)
@@ -57543,7 +57790,7 @@ function convertSizeToCSS(value, type) {
57543
57790
  return null;
57544
57791
  }
57545
57792
  }
57546
- var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArrayBufferFromUrl = async (input) => {
57793
+ var import_lib, CRC32_TABLE, EIGHTHS_PER_POINT = 8, MIN_BORDER_SIZE_PX = 0.5, MAX_BORDER_SIZE_PX = 100, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArrayBufferFromUrl = async (input) => {
57547
57794
  if (input == null)
57548
57795
  return /* @__PURE__ */ new ArrayBuffer(0);
57549
57796
  if (input instanceof ArrayBuffer)
@@ -57704,7 +57951,7 @@ var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArray
57704
57951
  return "webp";
57705
57952
  return null;
57706
57953
  }, COMMENT_FILE_BASENAMES, DEFAULT_XML_DECLARATION, COMMENT_RELATIONSHIP_TYPES;
57707
- var init_constants_CGhJRd87_es = __esm(() => {
57954
+ var init_constants_DrU4EASo_es = __esm(() => {
57708
57955
  init_xml_js_CqGKpaft_es();
57709
57956
  import_lib = require_lib();
57710
57957
  CRC32_TABLE = new Uint32Array(256);
@@ -65610,7 +65857,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65610
65857
  emptyOptions2 = {};
65611
65858
  });
65612
65859
 
65613
- // ../../packages/superdoc/dist/chunks/SuperConverter-2Pu0hMB1.es.js
65860
+ // ../../packages/superdoc/dist/chunks/SuperConverter-lmyr0gmB.es.js
65614
65861
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65615
65862
  const fieldValue = extension$1.config[field];
65616
65863
  if (typeof fieldValue === "function")
@@ -68320,6 +68567,22 @@ async function executeScrollIntoView2(adapter, input) {
68320
68567
  validateScrollIntoViewInput2(input);
68321
68568
  return adapter.scrollIntoView(input);
68322
68569
  }
68570
+ function validateSelectionCurrentInput2(input) {
68571
+ if (input === undefined)
68572
+ return;
68573
+ if (!isRecord4(input))
68574
+ throw new DocumentApiValidationError2("INVALID_INPUT", "selection.current input must be a non-null object.");
68575
+ assertNoUnknownFields3(input, SELECTION_CURRENT_ALLOWED_KEYS2, "selection.current");
68576
+ if (input.includeText !== undefined && typeof input.includeText !== "boolean")
68577
+ throw new DocumentApiValidationError2("INVALID_INPUT", `includeText must be a boolean, got ${typeof input.includeText}.`, {
68578
+ field: "includeText",
68579
+ value: input.includeText
68580
+ });
68581
+ }
68582
+ function executeSelectionCurrent2(adapter, input) {
68583
+ validateSelectionCurrentInput2(input);
68584
+ return adapter.current(input ?? {});
68585
+ }
68323
68586
  function executeMarkdownToFragment2(adapter, input) {
68324
68587
  return adapter.markdownToFragment(input);
68325
68588
  }
@@ -68347,8 +68610,8 @@ function validateCreateCommentInput2(input) {
68347
68610
  }
68348
68611
  if (!hasTarget)
68349
68612
  throw new DocumentApiValidationError2("INVALID_TARGET", "comments.create requires a target for root comments.", { field: "target" });
68350
- if (!isTextAddress2(target))
68351
- throw new DocumentApiValidationError2("INVALID_TARGET", "target must be a text address object.", {
68613
+ if (!isTextAddress2(target) && !isTextTarget2(target))
68614
+ throw new DocumentApiValidationError2("INVALID_TARGET", "target must be a TextAddress or TextTarget object.", {
68352
68615
  field: "target",
68353
68616
  value: target
68354
68617
  });
@@ -69512,6 +69775,16 @@ function executeListsSeparate2(adapter, input, options) {
69512
69775
  optionalBoolean2(input.copyOverrides, "copyOverrides", "lists.separate");
69513
69776
  return adapter.separate(input, normalizeMutationOptions2(options));
69514
69777
  }
69778
+ function executeListsMerge2(adapter, input, options) {
69779
+ validateListItemTarget2(input, "lists.merge");
69780
+ requireEnum2(input.direction, "direction", VALID_JOIN_DIRECTIONS2, "lists.merge");
69781
+ return adapter.merge(input, normalizeMutationOptions2(options));
69782
+ }
69783
+ function executeListsSplit2(adapter, input, options) {
69784
+ validateListItemTarget2(input, "lists.split");
69785
+ optionalBoolean2(input.restartNumbering, "restartNumbering", "lists.split");
69786
+ return adapter.split(input, normalizeMutationOptions2(options));
69787
+ }
69515
69788
  function executeListsSetLevel2(adapter, input, options) {
69516
69789
  validateListItemTarget2(input, "lists.setLevel");
69517
69790
  requireLevel2(input.level, "lists.setLevel");
@@ -70136,6 +70409,8 @@ function buildDispatchTable2(api) {
70136
70409
  "lists.join": (input, options) => api.lists.join(input, options),
70137
70410
  "lists.canJoin": (input) => api.lists.canJoin(input),
70138
70411
  "lists.separate": (input, options) => api.lists.separate(input, options),
70412
+ "lists.merge": (input, options) => api.lists.merge(input, options),
70413
+ "lists.split": (input, options) => api.lists.split(input, options),
70139
70414
  "lists.setLevel": (input, options) => api.lists.setLevel(input, options),
70140
70415
  "lists.setValue": (input, options) => api.lists.setValue(input, options),
70141
70416
  "lists.continuePrevious": (input, options) => api.lists.continuePrevious(input, options),
@@ -70189,6 +70464,7 @@ function buildDispatchTable2(api) {
70189
70464
  "trackChanges.decide": (input, options) => api.trackChanges.decide(input, options),
70190
70465
  "query.match": (input) => api.query.match(input),
70191
70466
  "ranges.resolve": (input) => api.ranges.resolve(input),
70467
+ "selection.current": (input) => api.selection.current(input),
70192
70468
  "mutations.preview": (input) => api.mutations.preview(input),
70193
70469
  "mutations.apply": (input) => api.mutations.apply(input),
70194
70470
  "capabilities.get": () => api.capabilities(),
@@ -72746,6 +73022,12 @@ function createDocumentApi2(adapters) {
72746
73022
  separate(input, options) {
72747
73023
  return executeListsSeparate2(adapters.lists, input, options);
72748
73024
  },
73025
+ merge(input, options) {
73026
+ return executeListsMerge2(adapters.lists, input, options);
73027
+ },
73028
+ split(input, options) {
73029
+ return executeListsSplit2(adapters.lists, input, options);
73030
+ },
72749
73031
  setLevel(input, options) {
72750
73032
  return executeListsSetLevel2(adapters.lists, input, options);
72751
73033
  },
@@ -73504,6 +73786,20 @@ function createDocumentApi2(adapters) {
73504
73786
  return executeScrollIntoView2(adapters.ranges, input);
73505
73787
  }
73506
73788
  },
73789
+ selection: {
73790
+ current(input) {
73791
+ const adapter = adapters.selection;
73792
+ if (!adapter)
73793
+ throw new DocumentApiValidationError2("SELECTION_ADAPTER_UNAVAILABLE", "No selection adapter was registered. Pass `selection` in DocumentApiAdapters to call selection.current().");
73794
+ return executeSelectionCurrent2(adapter, input);
73795
+ },
73796
+ onChange(listener) {
73797
+ const adapter = adapters.selection;
73798
+ if (!adapter)
73799
+ throw new DocumentApiValidationError2("SELECTION_ADAPTER_UNAVAILABLE", "No selection adapter was registered. Pass `selection` in DocumentApiAdapters to call selection.onChange().");
73800
+ return adapter.onChange(listener);
73801
+ }
73802
+ },
73507
73803
  mutations: {
73508
73804
  preview(input) {
73509
73805
  return adapters.mutations.preview(input);
@@ -77261,15 +77557,15 @@ function getPresetColor(name) {
77261
77557
  function applyModifiersAndAlpha(color2, elements) {
77262
77558
  let alpha = null;
77263
77559
  (elements || []).forEach((mod) => {
77264
- if (mod.name === "a:shade")
77560
+ if (hasLocalName(mod, "shade"))
77265
77561
  color2 = applyColorModifier(color2, "shade", mod.attributes["val"]);
77266
- else if (mod.name === "a:tint")
77562
+ else if (hasLocalName(mod, "tint"))
77267
77563
  color2 = applyColorModifier(color2, "tint", mod.attributes["val"]);
77268
- else if (mod.name === "a:lumMod")
77564
+ else if (hasLocalName(mod, "lumMod"))
77269
77565
  color2 = applyColorModifier(color2, "lumMod", mod.attributes["val"]);
77270
- else if (mod.name === "a:lumOff")
77566
+ else if (hasLocalName(mod, "lumOff"))
77271
77567
  color2 = applyColorModifier(color2, "lumOff", mod.attributes["val"]);
77272
- else if (mod.name === "a:alpha")
77568
+ else if (hasLocalName(mod, "alpha"))
77273
77569
  alpha = parseInt(mod.attributes["val"]) / 1e5;
77274
77570
  });
77275
77571
  return {
@@ -77280,15 +77576,15 @@ function applyModifiersAndAlpha(color2, elements) {
77280
77576
  function extractColorFromElement(element) {
77281
77577
  if (!element?.elements)
77282
77578
  return null;
77283
- const schemeClr = element.elements.find((el) => el.name === "a:schemeClr");
77579
+ const schemeClr = findChildByLocalName(element.elements, "schemeClr");
77284
77580
  if (schemeClr) {
77285
77581
  const themeName = schemeClr.attributes?.["val"];
77286
77582
  return applyModifiersAndAlpha(getThemeColor(themeName), schemeClr.elements);
77287
77583
  }
77288
- const srgbClr = element.elements.find((el) => el.name === "a:srgbClr");
77584
+ const srgbClr = findChildByLocalName(element.elements, "srgbClr");
77289
77585
  if (srgbClr)
77290
77586
  return applyModifiersAndAlpha("#" + srgbClr.attributes?.["val"], srgbClr.elements);
77291
- const prstClr = element.elements.find((el) => el.name === "a:prstClr");
77587
+ const prstClr = findChildByLocalName(element.elements, "prstClr");
77292
77588
  if (prstClr) {
77293
77589
  const presetName = prstClr.attributes?.["val"];
77294
77590
  const baseColor = getPresetColor(presetName);
@@ -77347,7 +77643,7 @@ function applyColorModifier(hexColor, modifier, value) {
77347
77643
  return `#${toHex(newR)}${toHex(newG)}${toHex(newB)}`;
77348
77644
  }
77349
77645
  function extractStrokeWidth(spPr) {
77350
- const ln = spPr?.elements?.find((el) => el.name === "a:ln");
77646
+ const ln = findChildByLocalName(spPr?.elements, "ln");
77351
77647
  if (!ln)
77352
77648
  return 1;
77353
77649
  const w = ln.attributes?.["w"];
@@ -77359,11 +77655,11 @@ function extractStrokeWidth(spPr) {
77359
77655
  return emu * 72 / 914400;
77360
77656
  }
77361
77657
  function extractLineEnds(spPr) {
77362
- const ln = spPr?.elements?.find((el) => el.name === "a:ln");
77658
+ const ln = findChildByLocalName(spPr?.elements, "ln");
77363
77659
  if (!ln?.elements)
77364
77660
  return null;
77365
- const parseEnd = (name) => {
77366
- const end = ln.elements.find((el) => el.name === name);
77661
+ const parseEnd = (localName) => {
77662
+ const end = findChildByLocalName(ln.elements, localName);
77367
77663
  if (!end?.attributes)
77368
77664
  return null;
77369
77665
  const type = end.attributes?.["type"];
@@ -77375,21 +77671,21 @@ function extractLineEnds(spPr) {
77375
77671
  length: end.attributes?.["len"]
77376
77672
  };
77377
77673
  };
77378
- const head = parseEnd("a:headEnd");
77379
- const tail = parseEnd("a:tailEnd");
77380
- if (!head && !tail)
77674
+ const headConfig = parseEnd("headEnd");
77675
+ const tailConfig = parseEnd("tailEnd");
77676
+ if (!headConfig && !tailConfig)
77381
77677
  return null;
77382
77678
  return {
77383
- head: head ?? undefined,
77384
- tail: tail ?? undefined
77679
+ head: headConfig ?? undefined,
77680
+ tail: tailConfig ?? undefined
77385
77681
  };
77386
77682
  }
77387
77683
  function extractStrokeColor(spPr, style) {
77388
- const ln = spPr?.elements?.find((el) => el.name === "a:ln");
77684
+ const ln = findChildByLocalName(spPr?.elements, "ln");
77389
77685
  if (ln) {
77390
- if (ln.elements?.find((el) => el.name === "a:noFill"))
77686
+ if (findChildByLocalName(ln.elements, "noFill"))
77391
77687
  return null;
77392
- const solidFill = ln.elements?.find((el) => el.name === "a:solidFill");
77688
+ const solidFill = findChildByLocalName(ln.elements, "solidFill");
77393
77689
  if (solidFill) {
77394
77690
  const result = extractColorFromElement(solidFill);
77395
77691
  if (result)
@@ -77398,7 +77694,7 @@ function extractStrokeColor(spPr, style) {
77398
77694
  }
77399
77695
  if (!style)
77400
77696
  return null;
77401
- const lnRef = style.elements?.find((el) => el.name === "a:lnRef");
77697
+ const lnRef = findChildByLocalName(style.elements, "lnRef");
77402
77698
  if (!lnRef)
77403
77699
  return null;
77404
77700
  if (lnRef.attributes?.["idx"] === "0")
@@ -77409,9 +77705,9 @@ function extractStrokeColor(spPr, style) {
77409
77705
  return null;
77410
77706
  }
77411
77707
  function extractFillColor(spPr, style) {
77412
- if (spPr?.elements?.find((el) => el.name === "a:noFill"))
77708
+ if (findChildByLocalName(spPr?.elements, "noFill"))
77413
77709
  return null;
77414
- const solidFill = spPr?.elements?.find((el) => el.name === "a:solidFill");
77710
+ const solidFill = findChildByLocalName(spPr?.elements, "solidFill");
77415
77711
  if (solidFill) {
77416
77712
  const result = extractColorFromElement(solidFill);
77417
77713
  if (result) {
@@ -77424,14 +77720,14 @@ function extractFillColor(spPr, style) {
77424
77720
  return result.color;
77425
77721
  }
77426
77722
  }
77427
- const gradFill = spPr?.elements?.find((el) => el.name === "a:gradFill");
77723
+ const gradFill = findChildByLocalName(spPr?.elements, "gradFill");
77428
77724
  if (gradFill)
77429
77725
  return extractGradientFill(gradFill);
77430
- if (spPr?.elements?.find((el) => el.name === "a:blipFill"))
77726
+ if (findChildByLocalName(spPr?.elements, "blipFill"))
77431
77727
  return "#cccccc";
77432
77728
  if (!style)
77433
77729
  return null;
77434
- const fillRef = style.elements?.find((el) => el.name === "a:fillRef");
77730
+ const fillRef = findChildByLocalName(style.elements, "fillRef");
77435
77731
  if (!fillRef)
77436
77732
  return null;
77437
77733
  if (fillRef.attributes?.["idx"] === "0")
@@ -77449,13 +77745,13 @@ function extractFillColor(spPr, style) {
77449
77745
  return null;
77450
77746
  }
77451
77747
  function extractCustomGeometry(spPr) {
77452
- const custGeom = spPr?.elements?.find((el) => el.name === "a:custGeom");
77748
+ const custGeom = findChildByLocalName(spPr?.elements, "custGeom");
77453
77749
  if (!custGeom)
77454
77750
  return null;
77455
- const pathLst = custGeom.elements?.find((el) => el.name === "a:pathLst");
77751
+ const pathLst = findChildByLocalName(custGeom.elements, "pathLst");
77456
77752
  if (!pathLst?.elements)
77457
77753
  return null;
77458
- const paths = pathLst.elements.filter((el) => el.name === "a:path").map((pathEl) => {
77754
+ const paths = pathLst.elements.filter((el) => hasLocalName(el, "path")).map((pathEl) => {
77459
77755
  const w = parseInt(pathEl.attributes?.["w"] || "0", 10);
77460
77756
  const h = parseInt(pathEl.attributes?.["h"] || "0", 10);
77461
77757
  return {
@@ -77473,32 +77769,32 @@ function convertDrawingMLPathToSvg(pathEl) {
77473
77769
  return "";
77474
77770
  const parts = [];
77475
77771
  for (const cmd of pathEl.elements)
77476
- switch (cmd.name) {
77477
- case "a:moveTo": {
77478
- const pt = cmd.elements?.find((el) => el.name === "a:pt");
77772
+ switch (getLocalName$1(cmd.name)) {
77773
+ case "moveTo": {
77774
+ const pt = findChildByLocalName(cmd.elements, "pt");
77479
77775
  if (pt)
77480
77776
  parts.push(`M ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
77481
77777
  break;
77482
77778
  }
77483
- case "a:lnTo": {
77484
- const pt = cmd.elements?.find((el) => el.name === "a:pt");
77779
+ case "lnTo": {
77780
+ const pt = findChildByLocalName(cmd.elements, "pt");
77485
77781
  if (pt)
77486
77782
  parts.push(`L ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
77487
77783
  break;
77488
77784
  }
77489
- case "a:cubicBezTo": {
77490
- const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
77785
+ case "cubicBezTo": {
77786
+ const pts = filterChildrenByLocalName(cmd.elements, "pt") || [];
77491
77787
  if (pts.length === 3)
77492
77788
  parts.push(`C ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0} ${pts[2].attributes?.["x"] || 0} ${pts[2].attributes?.["y"] || 0}`);
77493
77789
  break;
77494
77790
  }
77495
- case "a:quadBezTo": {
77496
- const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
77791
+ case "quadBezTo": {
77792
+ const pts = filterChildrenByLocalName(cmd.elements, "pt") || [];
77497
77793
  if (pts.length === 2)
77498
77794
  parts.push(`Q ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0}`);
77499
77795
  break;
77500
77796
  }
77501
- case "a:close":
77797
+ case "close":
77502
77798
  parts.push("Z");
77503
77799
  break;
77504
77800
  default:
@@ -77512,16 +77808,16 @@ function extractGradientFill(gradFill) {
77512
77808
  stops: [],
77513
77809
  angle: 0
77514
77810
  };
77515
- const gsLst = gradFill.elements?.find((el) => el.name === "a:gsLst");
77811
+ const gsLst = findChildByLocalName(gradFill.elements, "gsLst");
77516
77812
  if (gsLst)
77517
- gradient.stops = (gsLst.elements?.filter((el) => el.name === "a:gs") || []).map((stop) => {
77813
+ gradient.stops = (filterChildrenByLocalName(gsLst.elements, "gs") || []).map((stop) => {
77518
77814
  const pos = parseInt(stop.attributes?.["pos"] || "0", 10) / 1e5;
77519
- const srgbClr = stop.elements?.find((el) => el.name === "a:srgbClr");
77815
+ const srgbClr = findChildByLocalName(stop.elements, "srgbClr");
77520
77816
  let color2 = "#000000";
77521
77817
  let alpha = 1;
77522
77818
  if (srgbClr) {
77523
77819
  color2 = "#" + srgbClr.attributes?.["val"];
77524
- const alphaEl = srgbClr.elements?.find((el) => el.name === "a:alpha");
77820
+ const alphaEl = findChildByLocalName(srgbClr.elements, "alpha");
77525
77821
  if (alphaEl)
77526
77822
  alpha = parseInt(alphaEl.attributes?.["val"] || "100000", 10) / 1e5;
77527
77823
  }
@@ -77531,10 +77827,10 @@ function extractGradientFill(gradFill) {
77531
77827
  alpha
77532
77828
  };
77533
77829
  });
77534
- const lin = gradFill.elements?.find((el) => el.name === "a:lin");
77830
+ const lin = findChildByLocalName(gradFill.elements, "lin");
77535
77831
  if (lin)
77536
77832
  gradient.angle = parseInt(lin.attributes?.["ang"] || "0", 10) / 60000;
77537
- const path2 = gradFill.elements?.find((el) => el.name === "a:path");
77833
+ const path2 = findChildByLocalName(gradFill.elements, "path");
77538
77834
  if (path2) {
77539
77835
  gradient.gradientType = "radial";
77540
77836
  gradient.path = path2.attributes?.["path"] || "circle";
@@ -78659,7 +78955,7 @@ function handleImageNode(node3, params3, isAnchor) {
78659
78955
  alignH,
78660
78956
  alignV
78661
78957
  };
78662
- const graphicData = node3.elements.find((el) => el.name === "a:graphic")?.elements.find((el) => el.name === "a:graphicData");
78958
+ const graphicData = findChildByLocalName(findChildByLocalName(node3.elements, "graphic")?.elements, "graphicData");
78663
78959
  const { uri } = graphicData?.attributes || {};
78664
78960
  if (!graphicData)
78665
78961
  return null;
@@ -78681,20 +78977,20 @@ function handleImageNode(node3, params3, isAnchor) {
78681
78977
  if (!picture || !picture.elements)
78682
78978
  return null;
78683
78979
  const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
78684
- const blip = blipFill?.elements.find((el) => el.name === "a:blip");
78980
+ const blip = findChildByLocalName(blipFill?.elements, "blip");
78685
78981
  if (!blip)
78686
78982
  return null;
78687
- const hasGrayscale = blip.elements?.some((el) => el.name === "a:grayscl");
78688
- const lumEl = blip.elements?.find((el) => el.name === "a:lum");
78983
+ const hasGrayscale = someChildHasLocalName(blip.elements, "grayscl");
78984
+ const lumEl = findChildByLocalName(blip.elements, "lum");
78689
78985
  const rawBright = Number(lumEl?.attributes?.bright);
78690
78986
  const rawContrast = Number(lumEl?.attributes?.contrast);
78691
78987
  const lum = Number.isFinite(rawBright) || Number.isFinite(rawContrast) ? {
78692
78988
  ...Number.isFinite(rawBright) ? { bright: rawBright } : {},
78693
78989
  ...Number.isFinite(rawContrast) ? { contrast: rawContrast } : {}
78694
78990
  } : undefined;
78695
- const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
78696
- const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
78697
- const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
78991
+ const stretch = findChildByLocalName(blipFill?.elements, "stretch");
78992
+ const fillRect = findChildByLocalName(stretch?.elements, "fillRect");
78993
+ const srcRect = findChildByLocalName(blipFill?.elements, "srcRect");
78698
78994
  const srcRectAttrs = srcRect?.attributes || {};
78699
78995
  const clipPath = buildClipPathFromSrcRect(srcRectAttrs);
78700
78996
  const srcRectHasNegativeValues = [
@@ -78711,7 +79007,7 @@ function handleImageNode(node3, params3, isAnchor) {
78711
79007
  const shouldFillClippedStretch = shouldStretch && !srcRectHasNegativeValues && Boolean(clipPath);
78712
79008
  const spPr = picture.elements.find((el) => el.name === "pic:spPr");
78713
79009
  if (spPr) {
78714
- const xfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
79010
+ const xfrm = findChildByLocalName(spPr.elements, "xfrm");
78715
79011
  if (xfrm?.attributes)
78716
79012
  transformData = {
78717
79013
  ...transformData,
@@ -78721,9 +79017,11 @@ function handleImageNode(node3, params3, isAnchor) {
78721
79017
  };
78722
79018
  }
78723
79019
  const nvPicPr = picture.elements.find((el) => el.name === "pic:nvPicPr");
78724
- const picLocks = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPicPr")?.elements?.find((el) => el.name === "a:picLocks");
79020
+ const cNvPicPr = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPicPr");
79021
+ const picLocks = findChildByLocalName(cNvPicPr?.elements, "picLocks");
78725
79022
  const lockAspectRatio = picLocks ? picLocks.attributes?.["noChangeAspect"] === "1" || picLocks.attributes?.["noChangeAspect"] === 1 : false;
78726
- const hlinkClick = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPr")?.elements?.find((el) => el.name === "a:hlinkClick") || docPr?.elements?.find((el) => el.name === "a:hlinkClick");
79023
+ const cNvPr = nvPicPr?.elements?.find((el) => el.name === "pic:cNvPr");
79024
+ const hlinkClick = findChildByLocalName(cNvPr?.elements, "hlinkClick") || findChildByLocalName(docPr?.elements, "hlinkClick");
78727
79025
  let hyperlink = null;
78728
79026
  if (hlinkClick?.attributes?.["r:id"]) {
78729
79027
  const hlinkRId = hlinkClick.attributes["r:id"];
@@ -78738,12 +79036,12 @@ function handleImageNode(node3, params3, isAnchor) {
78738
79036
  }
78739
79037
  }
78740
79038
  let decorative = false;
78741
- const docPrExtLst = docPr?.elements?.find((el) => el.name === "a:extLst");
79039
+ const docPrExtLst = findChildByLocalName(docPr?.elements, "extLst");
78742
79040
  if (docPrExtLst)
78743
79041
  for (const ext of docPrExtLst.elements || []) {
78744
- if (ext.name !== "a:ext")
79042
+ if (!hasLocalName(ext, "ext"))
78745
79043
  continue;
78746
- const decEl = ext.elements?.find((el) => el.name === "adec:decorative" || el.name === "a16:decorative");
79044
+ const decEl = findChildByLocalName(ext.elements, "decorative");
78747
79045
  if (decEl && (decEl.attributes?.["val"] === "1" || decEl.attributes?.["val"] === 1)) {
78748
79046
  decorative = true;
78749
79047
  break;
@@ -78988,7 +79286,7 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78988
79286
  const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
78989
79287
  if (!spPr)
78990
79288
  return null;
78991
- const shapeKind = spPr.elements?.find((el) => el.name === "a:prstGeom")?.attributes?.["prst"];
79289
+ const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
78992
79290
  schemaAttrs.kind = shapeKind;
78993
79291
  if (customGeometry)
78994
79292
  schemaAttrs.customGeometry = customGeometry;
@@ -78999,7 +79297,7 @@ function getVectorShape({ params: params3, node: node3, graphicData, size: size2
78999
79297
  }
79000
79298
  const width = size2?.width ?? DEFAULT_SHAPE_WIDTH;
79001
79299
  const height = size2?.height ?? DEFAULT_SHAPE_HEIGHT;
79002
- const xfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
79300
+ const xfrm = findChildByLocalName(spPr.elements, "xfrm");
79003
79301
  const rotation = xfrm?.attributes?.["rot"] ? rotToDegrees(xfrm.attributes["rot"]) : 0;
79004
79302
  const flipH = xfrm?.attributes?.["flipH"] === "1";
79005
79303
  const flipV = xfrm?.attributes?.["flipV"] === "1";
@@ -92067,7 +92365,7 @@ function fixZeroDrawingIds(merged, generated) {
92067
92365
  const docPr = merged.find((el) => el?.name === "wp:docPr");
92068
92366
  if (docPr?.attributes && !(Number(docPr.attributes.id) > 0))
92069
92367
  docPr.attributes.id = validId;
92070
- const cNvPr = merged.find((el) => el?.name === "a:graphic")?.elements?.find((el) => el?.name === "a:graphicData")?.elements?.find((el) => el?.name === "pic:pic")?.elements?.find((el) => el?.name === "pic:nvPicPr")?.elements?.find((el) => el?.name === "pic:cNvPr");
92368
+ const cNvPr = findChildByLocalName(findChildByLocalName(merged, "graphic")?.elements, "graphicData")?.elements?.find((el) => el?.name === "pic:pic")?.elements?.find((el) => el?.name === "pic:nvPicPr")?.elements?.find((el) => el?.name === "pic:cNvPr");
92071
92369
  if (cNvPr?.attributes && !(Number(cNvPr.attributes.id) > 0))
92072
92370
  cNvPr.attributes.id = validId;
92073
92371
  }
@@ -95818,7 +96116,8 @@ function createStoryEditor(parentEditor, content$2, options = {}) {
95818
96116
  collaborationProvider: null,
95819
96117
  isCommentsEnabled: false,
95820
96118
  fragment: null,
95821
- ...editorOptions
96119
+ ...editorOptions,
96120
+ telemetry: { enabled: false }
95822
96121
  });
95823
96122
  const inheritedPresentationEditor = parentEditor.presentationEditor ?? parentEditor._presentationEditor ?? null;
95824
96123
  if (inheritedPresentationEditor) {
@@ -96868,6 +97167,57 @@ function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFr
96868
97167
  return targetOffset <= segmentStart ? docFrom : docTo;
96869
97168
  return docFrom + (targetOffset - segmentStart);
96870
97169
  }
97170
+ function pmPositionToTextOffset(blockNode, blockPos, pmPos) {
97171
+ const contentStart = blockPos + 1;
97172
+ if (pmPos <= contentStart)
97173
+ return 0;
97174
+ let offset = 0;
97175
+ let done = false;
97176
+ const visit2 = (node3, docPos) => {
97177
+ if (done)
97178
+ return;
97179
+ if (node3.isText) {
97180
+ const text$2 = node3.text ?? "";
97181
+ if (pmPos >= docPos + text$2.length)
97182
+ offset += text$2.length;
97183
+ else {
97184
+ offset += Math.max(0, pmPos - docPos);
97185
+ done = true;
97186
+ }
97187
+ return;
97188
+ }
97189
+ if (node3.isLeaf) {
97190
+ if (pmPos >= docPos + node3.nodeSize)
97191
+ offset += 1;
97192
+ else
97193
+ done = true;
97194
+ return;
97195
+ }
97196
+ visitContent(node3, docPos + 1);
97197
+ };
97198
+ const visitContent = (node3, contentPos) => {
97199
+ let isFirst = true;
97200
+ let childOffset = 0;
97201
+ for (let i$1 = 0;i$1 < node3.childCount; i$1 += 1) {
97202
+ if (done)
97203
+ return;
97204
+ const child = node3.child(i$1);
97205
+ const childPos = contentPos + childOffset;
97206
+ if (child.isBlock && !isFirst)
97207
+ if (pmPos >= childPos + 1)
97208
+ offset += 1;
97209
+ else {
97210
+ done = true;
97211
+ return;
97212
+ }
97213
+ visit2(child, childPos);
97214
+ childOffset += child.nodeSize;
97215
+ isFirst = false;
97216
+ }
97217
+ };
97218
+ visitContent(blockNode, contentStart);
97219
+ return offset;
97220
+ }
96871
97221
  function computeTextContentLength(blockNode) {
96872
97222
  let length3 = 0;
96873
97223
  const walk = (node3) => {
@@ -103431,7 +103781,7 @@ var isRegExp = (value) => {
103431
103781
  tracked: false,
103432
103782
  carrier: runAttributeCarrier2(runPropertyKey ?? key),
103433
103783
  schema
103434
- }), 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, PROPERTY_VALIDATOR_MAP2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, 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_STORY2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, T_PROTECTION_READ2, T_PROTECTION_MUTATION2, T_PERM_RANGE_READ2, T_PERM_RANGE_MUTATION2, 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_DIRECTIONS2, ALIGNMENT_POLICIES2, 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, SET_DIRECTION_KEYS2, CLEAR_DIRECTION_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_REGISTRY2, 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, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStylesSchema2, documentDefaultsSchema2, 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, trackChangeWordRevisionIdsSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, 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, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES2, VALID_EDGE_NODE_TYPES2, VALID_DOCUMENT_EDGES2, VALID_REF_BOUNDARIES2, VALID_ANCHOR_KINDS2, RESOLVE_RANGE_ALLOWED_KEYS2, VALID_ENTITY_TYPES2, SCROLL_INTO_VIEW_ALLOWED_KEYS2, VALID_BLOCK_VALUES2, VALID_BEHAVIOR_VALUES2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, VALID_BEHAVIORS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, TEXT_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, LIST_KINDS2, LIST_INSERT_POSITIONS2, JOIN_DIRECTIONS2, MUTATION_SCOPES2, LEVEL_ALIGNMENTS2, TRAILING_CHARACTERS2, LIST_PRESET_IDS2, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS2, VALID_INSERT_POSITIONS2, VALID_JOIN_DIRECTIONS2, VALID_MUTATION_SCOPES2, VALID_LEVEL_ALIGNMENTS2, VALID_TRAILING_CHARACTERS2, VALID_LIST_PRESETS2, VALID_CONTINUITY_VALUES2, VALID_SEQUENCE_MODES2, VALID_LIST_CREATE_MODES2, TEXT_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, VALID_HEADING_LEVELS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, VALID_BLOCK_NODE_TYPES3, SNAPSHOT_VERSIONS2, PAYLOAD_VERSIONS2, VALID_STYLE_OPTION_FLAGS2, TABLE_BORDER_COLOR_PATTERN2, VALID_APPLY_TO_VALUES2, VALID_BORDER_EDGE_KEYS2, 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, VALID_TOC_UPDATE_MODES2, EDIT_ENTRY_PATCH_ALLOWED_KEYS2, PATCH_FIELDS2, CONTENT_CONTROL_TYPES2, LOCK_MODES2, CONTENT_CONTROL_APPEARANCES2, VALID_NODE_KINDS2, VALID_LOCK_MODES$1, VALID_CC_TYPES2, VALID_CC_APPEARANCES2, VALID_CONTENT_FORMATS2, VALID_RAW_PATCH_OPS2, VALID_SET_MODES2, VALID_CREATE_LOCATION_KINDS2, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$217) => ({
103784
+ }), 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, PROPERTY_VALIDATOR_MAP2, NONE_FAILURES2, NONE_THROWS2, T_NOT_FOUND2, T_NOT_FOUND_CAPABLE2, T_PLAN_ENGINE2, T_NOT_FOUND_COMMAND2, 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_STORY2, T_REF_READ_LIST2, T_REF_MUTATION2, T_REF_MUTATION_REMOVE2, T_REF_INSERT2, T_PROTECTION_READ2, T_PROTECTION_MUTATION2, T_PERM_RANGE_READ2, T_PERM_RANGE_MUTATION2, 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_DIRECTIONS2, ALIGNMENT_POLICIES2, 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, SET_DIRECTION_KEYS2, CLEAR_DIRECTION_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_REGISTRY2, 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, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, textSelectorSchema2, nodeSelectorSchema2, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStylesSchema2, documentDefaultsSchema2, 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, trackChangeWordRevisionIdsSchema2, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, 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, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, GROUP_METADATA2, STEP_OP_CATALOG_UNFROZEN2, PUBLIC_STEP_OP_CATALOG_UNFROZEN2, PUBLIC_MUTATION_STEP_OP_IDS2, PUBLIC_MUTATION_STEP_OP_SET2, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES2, VALID_EDGE_NODE_TYPES2, VALID_DOCUMENT_EDGES2, VALID_REF_BOUNDARIES2, VALID_ANCHOR_KINDS2, RESOLVE_RANGE_ALLOWED_KEYS2, VALID_ENTITY_TYPES2, SCROLL_INTO_VIEW_ALLOWED_KEYS2, VALID_BLOCK_VALUES2, VALID_BEHAVIOR_VALUES2, SELECTION_CURRENT_ALLOWED_KEYS2, CREATE_COMMENT_ALLOWED_KEYS2, PATCH_COMMENT_ALLOWED_KEYS2, STYLE_APPLY_INPUT_ALLOWED_KEYS2, INLINE_ALIAS_INPUT_ALLOWED_KEYS2, DELETE_INPUT_ALLOWED_KEYS2, VALID_BEHAVIORS2, CONTENT_KIND_SET2, INLINE_KIND_SET2, LEGACY_TOP_LEVEL_TYPES2, TEXT_INSERT_ALLOWED_KEYS2, STRUCTURAL_INSERT_ALLOWED_KEYS2, VALID_INSERT_TYPES2, LIST_KINDS2, LIST_INSERT_POSITIONS2, JOIN_DIRECTIONS2, MUTATION_SCOPES2, LEVEL_ALIGNMENTS2, TRAILING_CHARACTERS2, LIST_PRESET_IDS2, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS2, VALID_INSERT_POSITIONS2, VALID_JOIN_DIRECTIONS2, VALID_MUTATION_SCOPES2, VALID_LEVEL_ALIGNMENTS2, VALID_TRAILING_CHARACTERS2, VALID_LIST_PRESETS2, VALID_CONTINUITY_VALUES2, VALID_SEQUENCE_MODES2, VALID_LIST_CREATE_MODES2, TEXT_REPLACE_ALLOWED_KEYS2, STRUCTURAL_REPLACE_ALLOWED_KEYS2, VALID_HEADING_LEVELS2, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES2, REJECTED_DELETE_NODE_TYPES2, VALID_BLOCK_NODE_TYPES3, SNAPSHOT_VERSIONS2, PAYLOAD_VERSIONS2, VALID_STYLE_OPTION_FLAGS2, TABLE_BORDER_COLOR_PATTERN2, VALID_APPLY_TO_VALUES2, VALID_BORDER_EDGE_KEYS2, 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, VALID_TOC_UPDATE_MODES2, EDIT_ENTRY_PATCH_ALLOWED_KEYS2, PATCH_FIELDS2, CONTENT_CONTROL_TYPES2, LOCK_MODES2, CONTENT_CONTROL_APPEARANCES2, VALID_NODE_KINDS2, VALID_LOCK_MODES$1, VALID_CC_TYPES2, VALID_CC_APPEARANCES2, VALID_CONTENT_FORMATS2, VALID_RAW_PATCH_OPS2, VALID_SET_MODES2, VALID_CREATE_LOCATION_KINDS2, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES2, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$217) => ({
103435
103785
  handlerName,
103436
103786
  handler: (params3) => {
103437
103787
  const { nodes } = params3;
@@ -105659,6 +106009,27 @@ var isRegExp = (value) => {
105659
106009
  getState(state) {
105660
106010
  return state[this.key];
105661
106011
  }
106012
+ }, getLocalName$1 = (name) => {
106013
+ if (typeof name !== "string")
106014
+ return "";
106015
+ const parts = name.split(":");
106016
+ return parts.length ? parts[parts.length - 1] : name;
106017
+ }, hasLocalName = (node3, localName) => {
106018
+ if (!node3 || typeof node3 !== "object")
106019
+ return false;
106020
+ return getLocalName$1(node3.name) === localName;
106021
+ }, findChildByLocalName = (elements, localName) => {
106022
+ if (!Array.isArray(elements))
106023
+ return;
106024
+ return elements.find((el) => hasLocalName(el, localName));
106025
+ }, filterChildrenByLocalName = (elements, localName) => {
106026
+ if (!Array.isArray(elements))
106027
+ return [];
106028
+ return elements.filter((el) => hasLocalName(el, localName));
106029
+ }, someChildHasLocalName = (elements, localName) => {
106030
+ if (!Array.isArray(elements))
106031
+ return false;
106032
+ return elements.some((el) => hasLocalName(el, localName));
105662
106033
  }, SVGFilters = class {
105663
106034
  flood(filter, resultId, color2, opacity, _settings) {
105664
106035
  const floodElement = document.createElementNS("http://www.w3.org/2000/svg", "feFlood");
@@ -109587,7 +109958,7 @@ var isRegExp = (value) => {
109587
109958
  const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
109588
109959
  const textBoxContent = wsp.elements.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
109589
109960
  const spPr = wsp.elements.find((el) => el.name === "wps:spPr");
109590
- const shapeType = spPr?.elements.find((el) => el.name === "a:prstGeom")?.attributes["prst"];
109961
+ const shapeType = findChildByLocalName(spPr?.elements, "prstGeom")?.attributes["prst"];
109591
109962
  const custGeom = !shapeType ? extractCustomGeometry(spPr) : null;
109592
109963
  if (shapeType || custGeom) {
109593
109964
  const result = getVectorShape({
@@ -109618,13 +109989,13 @@ var isRegExp = (value) => {
109618
109989
  placeholder.attrs.hidden = true;
109619
109990
  return placeholder;
109620
109991
  }
109621
- const xfrm = wgp.elements.find((el) => el.name === "wpg:grpSpPr")?.elements?.find((el) => el.name === "a:xfrm");
109992
+ const xfrm = findChildByLocalName(wgp.elements.find((el) => el.name === "wpg:grpSpPr")?.elements, "xfrm");
109622
109993
  const groupTransform = {};
109623
109994
  if (xfrm) {
109624
- const off = xfrm.elements?.find((el) => el.name === "a:off");
109625
- const ext = xfrm.elements?.find((el) => el.name === "a:ext");
109626
- const chOff = xfrm.elements?.find((el) => el.name === "a:chOff");
109627
- const chExt = xfrm.elements?.find((el) => el.name === "a:chExt");
109995
+ const off = findChildByLocalName(xfrm.elements, "off");
109996
+ const ext = findChildByLocalName(xfrm.elements, "ext");
109997
+ const chOff = findChildByLocalName(xfrm.elements, "chOff");
109998
+ const chExt = findChildByLocalName(xfrm.elements, "chExt");
109628
109999
  if (off) {
109629
110000
  groupTransform.x = emuToPixels(off.attributes?.["x"] || 0);
109630
110001
  groupTransform.y = emuToPixels(off.attributes?.["y"] || 0);
@@ -109650,11 +110021,11 @@ var isRegExp = (value) => {
109650
110021
  const spPr = wsp.elements?.find((el) => el.name === "wps:spPr");
109651
110022
  if (!spPr)
109652
110023
  return null;
109653
- const shapeKind = spPr.elements?.find((el) => el.name === "a:prstGeom")?.attributes?.["prst"];
110024
+ const shapeKind = findChildByLocalName(spPr.elements, "prstGeom")?.attributes?.["prst"];
109654
110025
  const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
109655
- const shapeXfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
109656
- const shapeOff = shapeXfrm?.elements?.find((el) => el.name === "a:off");
109657
- const shapeExt = shapeXfrm?.elements?.find((el) => el.name === "a:ext");
110026
+ const shapeXfrm = findChildByLocalName(spPr.elements, "xfrm");
110027
+ const shapeOff = findChildByLocalName(shapeXfrm?.elements, "off");
110028
+ const shapeExt = findChildByLocalName(shapeXfrm?.elements, "ext");
109658
110029
  const rawX = shapeOff?.attributes?.["x"] ? parseFloat(shapeOff.attributes["x"]) : 0;
109659
110030
  const rawY = shapeOff?.attributes?.["y"] ? parseFloat(shapeOff.attributes["y"]) : 0;
109660
110031
  const rawWidth = shapeExt?.attributes?.["cx"] ? parseFloat(shapeExt.attributes["cx"]) : 914400;
@@ -109721,9 +110092,9 @@ var isRegExp = (value) => {
109721
110092
  const spPr = pic.elements?.find((el) => el.name === "pic:spPr");
109722
110093
  if (!spPr)
109723
110094
  return null;
109724
- const xfrm$1 = spPr.elements?.find((el) => el.name === "a:xfrm");
109725
- const off = xfrm$1?.elements?.find((el) => el.name === "a:off");
109726
- const ext = xfrm$1?.elements?.find((el) => el.name === "a:ext");
110095
+ const xfrm$1 = findChildByLocalName(spPr.elements, "xfrm");
110096
+ const off = findChildByLocalName(xfrm$1?.elements, "off");
110097
+ const ext = findChildByLocalName(xfrm$1?.elements, "ext");
109727
110098
  const rawX = off?.attributes?.["x"] ? parseFloat(off.attributes["x"]) : 0;
109728
110099
  const rawY = off?.attributes?.["y"] ? parseFloat(off.attributes["y"]) : 0;
109729
110100
  const rawWidth = ext?.attributes?.["cx"] ? parseFloat(ext.attributes["cx"]) : 914400;
@@ -109744,7 +110115,8 @@ var isRegExp = (value) => {
109744
110115
  width = emuToPixels(rawWidth);
109745
110116
  height = emuToPixels(rawHeight);
109746
110117
  }
109747
- const blip = pic.elements?.find((el) => el.name === "pic:blipFill")?.elements?.find((el) => el.name === "a:blip");
110118
+ const blipFill = pic.elements?.find((el) => el.name === "pic:blipFill");
110119
+ const blip = findChildByLocalName(blipFill?.elements, "blip");
109748
110120
  if (!blip)
109749
110121
  return null;
109750
110122
  const rEmbed = blip.attributes?.["r:embed"];
@@ -117890,12 +118262,12 @@ var isRegExp = (value) => {
117890
118262
  state.kern = kernNode.attributes["w:val"];
117891
118263
  }
117892
118264
  }, SuperConverter;
117893
- var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
118265
+ var init_SuperConverter_lmyr0gmB_es = __esm(() => {
117894
118266
  init_rolldown_runtime_Bg48TavK_es();
117895
118267
  init_jszip_C49i9kUs_es();
117896
118268
  init_xml_js_CqGKpaft_es();
117897
118269
  init_uuid_qzgm05fK_es();
117898
- init_constants_CGhJRd87_es();
118270
+ init_constants_DrU4EASo_es();
117899
118271
  init_dist_B8HfvhaK_es();
117900
118272
  init_unified_Dsuw2be5_es();
117901
118273
  init_lib_CYqLdG4z_es();
@@ -122071,7 +122443,9 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
122071
122443
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
122072
122444
  }),
122073
122445
  referenceDocPath: "lists/attach.mdx",
122074
- referenceGroup: "lists"
122446
+ referenceGroup: "lists",
122447
+ intentGroup: "list",
122448
+ intentAction: "attach"
122075
122449
  },
122076
122450
  "lists.detach": {
122077
122451
  memberPath: "lists.detach",
@@ -122183,6 +122557,44 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
122183
122557
  referenceDocPath: "lists/separate.mdx",
122184
122558
  referenceGroup: "lists"
122185
122559
  },
122560
+ "lists.merge": {
122561
+ memberPath: "lists.merge",
122562
+ description: 'Compound: merge two adjacent list sequences into one. Reassigns numId on the absorbed sequence (no strict abstractNumId check — absorbed items adopt the absorbing definition) and deletes empty paragraphs between the two sequences. Use this instead of lists.join for the user-facing "merge these lists" intent.',
122563
+ expectedResult: "Returns a ListsMergeResult with the merged listId, absorbedCount, and removedEmptyBlocks count.",
122564
+ requiresDocumentContext: true,
122565
+ metadata: mutationOperation2({
122566
+ idempotency: "conditional",
122567
+ supportsDryRun: true,
122568
+ supportsTrackedMode: false,
122569
+ possibleFailureCodes: [
122570
+ "INVALID_TARGET",
122571
+ "NO_ADJACENT_SEQUENCE",
122572
+ "NO_OP"
122573
+ ],
122574
+ throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
122575
+ }),
122576
+ referenceDocPath: "lists/merge.mdx",
122577
+ referenceGroup: "lists",
122578
+ intentGroup: "list",
122579
+ intentAction: "merge"
122580
+ },
122581
+ "lists.split": {
122582
+ memberPath: "lists.split",
122583
+ description: "Compound: split a list sequence at the target item into two independent sequences. Runs lists.separate then (by default) lists.setValue(1) so the new half starts numbering fresh at 1. Pass restartNumbering:false for raw separate semantics (new half continues the previous count).",
122584
+ expectedResult: "Returns a ListsSplitResult with the new listId, numId, and the restart value applied (or null).",
122585
+ requiresDocumentContext: true,
122586
+ metadata: mutationOperation2({
122587
+ idempotency: "conditional",
122588
+ supportsDryRun: true,
122589
+ supportsTrackedMode: false,
122590
+ possibleFailureCodes: ["INVALID_TARGET", "NO_OP"],
122591
+ throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
122592
+ }),
122593
+ referenceDocPath: "lists/split.mdx",
122594
+ referenceGroup: "lists",
122595
+ intentGroup: "list",
122596
+ intentAction: "split"
122597
+ },
122186
122598
  "lists.setLevel": {
122187
122599
  memberPath: "lists.setLevel",
122188
122600
  description: "Set the absolute nesting level (0..8) of a list item.",
@@ -122217,7 +122629,9 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
122217
122629
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
122218
122630
  }),
122219
122631
  referenceDocPath: "lists/set-value.mdx",
122220
- referenceGroup: "lists"
122632
+ referenceGroup: "lists",
122633
+ intentGroup: "list",
122634
+ intentAction: "set_value"
122221
122635
  },
122222
122636
  "lists.continuePrevious": {
122223
122637
  memberPath: "lists.continuePrevious",
@@ -122236,7 +122650,9 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
122236
122650
  throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
122237
122651
  }),
122238
122652
  referenceDocPath: "lists/continue-previous.mdx",
122239
- referenceGroup: "lists"
122653
+ referenceGroup: "lists",
122654
+ intentGroup: "list",
122655
+ intentAction: "continue_previous"
122240
122656
  },
122241
122657
  "lists.canContinuePrevious": {
122242
122658
  memberPath: "lists.canContinuePrevious",
@@ -122876,6 +123292,19 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
122876
123292
  referenceDocPath: "ranges/resolve.mdx",
122877
123293
  referenceGroup: "ranges"
122878
123294
  },
123295
+ "selection.current": {
123296
+ memberPath: "selection.current",
123297
+ description: "Read the editor's current selection as a portable SelectionInfo with a text-anchored TextTarget. Primitive for building custom comments UIs, floating toolbars, and other selection-driven components without reaching into ProseMirror internals.",
123298
+ expectedResult: "Returns a SelectionInfo with `empty`, `target` (TextTarget or null), `activeMarks`, and optionally `text` when `includeText: true`.",
123299
+ requiresDocumentContext: true,
123300
+ metadata: readOperation2({
123301
+ idempotency: "idempotent",
123302
+ throws: ["INVALID_INPUT", "INVALID_CONTEXT"],
123303
+ deterministicTargetResolution: true
123304
+ }),
123305
+ referenceDocPath: "selection/current.mdx",
123306
+ referenceGroup: "selection"
123307
+ },
122879
123308
  "mutations.preview": {
122880
123309
  memberPath: "mutations.preview",
122881
123310
  description: "Dry-run a mutation plan, returning resolved targets without applying changes.",
@@ -128948,9 +129377,37 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
128948
129377
  type: "string",
128949
129378
  description: "Full plain text content of the block."
128950
129379
  },
129380
+ textSpans: {
129381
+ type: "array",
129382
+ description: "Block text broken into runs with tracked-change marks preserved per run. Present only when the block contains at least one tracked change. Concatenating span text yields `text`.",
129383
+ items: objectSchema2({
129384
+ text: {
129385
+ type: "string",
129386
+ description: "Raw text of the run."
129387
+ },
129388
+ trackedChanges: {
129389
+ type: "array",
129390
+ description: "Tracked-change marks applied to this run.",
129391
+ items: objectSchema2({
129392
+ entityId: {
129393
+ type: "string",
129394
+ description: "Tracked change entity ID matching an entry in trackedChanges[]."
129395
+ },
129396
+ type: {
129397
+ type: "string",
129398
+ enum: [
129399
+ "insert",
129400
+ "delete",
129401
+ "format"
129402
+ ]
129403
+ }
129404
+ }, ["entityId", "type"])
129405
+ }
129406
+ }, ["text"])
129407
+ },
128951
129408
  headingLevel: {
128952
129409
  type: "integer",
128953
- description: "Heading level (16). Only present for headings."
129410
+ description: "Heading level (1-6). Only present for headings."
128954
129411
  },
128955
129412
  tableContext: objectSchema2({
128956
129413
  tableOrdinal: {
@@ -129032,7 +129489,7 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
129032
129489
  items: objectSchema2({
129033
129490
  entityId: {
129034
129491
  type: "string",
129035
- description: "Tracked change entity ID pass to scrollToElement() for navigation."
129492
+ description: "Tracked change entity ID. Pass to scrollToElement() for navigation."
129036
129493
  },
129037
129494
  type: {
129038
129495
  type: "string",
@@ -129040,11 +129497,31 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
129040
129497
  "insert",
129041
129498
  "delete",
129042
129499
  "format"
129043
- ]
129500
+ ],
129501
+ description: "Aggregate type at the entity level. In paired replacement mode, a delete+insert pair shares one entity and this collapses to 'insert'; per-half type lives on block.textSpans[].trackedChanges[]."
129044
129502
  },
129503
+ blockIds: {
129504
+ type: "array",
129505
+ description: "Block IDs whose textSpans carry this change.",
129506
+ items: { type: "string" }
129507
+ },
129508
+ wordRevisionIds: objectSchema2({
129509
+ insert: {
129510
+ type: "string",
129511
+ description: "Original OOXML w:id from a w:ins mark."
129512
+ },
129513
+ delete: {
129514
+ type: "string",
129515
+ description: "Original OOXML w:id from a w:del mark."
129516
+ },
129517
+ format: {
129518
+ type: "string",
129519
+ description: "Original OOXML w:id from a w:rPrChange mark."
129520
+ }
129521
+ }, []),
129045
129522
  excerpt: {
129046
129523
  type: "string",
129047
- description: "Short text excerpt of the changed content."
129524
+ description: "Short text excerpt of the changed content. Omitted for paired replacements; read block.textSpans for the per-half text."
129048
129525
  },
129049
129526
  author: {
129050
129527
  type: "string",
@@ -129772,6 +130249,52 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
129772
130249
  "listId",
129773
130250
  "numId"
129774
130251
  ]), listsFailureSchemaFor2("lists.separate"), objectSchema2({
130252
+ target: listItemAddressSchema2,
130253
+ direction: { enum: ["withPrevious", "withNext"] }
130254
+ }, ["target", "direction"]), objectSchema2({
130255
+ success: { const: true },
130256
+ listId: { type: "string" },
130257
+ absorbedCount: { type: "integer" },
130258
+ removedEmptyBlocks: { type: "integer" }
130259
+ }, [
130260
+ "success",
130261
+ "listId",
130262
+ "absorbedCount",
130263
+ "removedEmptyBlocks"
130264
+ ]), listsFailureSchemaFor2("lists.merge"), objectSchema2({
130265
+ success: { const: true },
130266
+ listId: { type: "string" },
130267
+ absorbedCount: { type: "integer" },
130268
+ removedEmptyBlocks: { type: "integer" }
130269
+ }, [
130270
+ "success",
130271
+ "listId",
130272
+ "absorbedCount",
130273
+ "removedEmptyBlocks"
130274
+ ]), listsFailureSchemaFor2("lists.merge"), objectSchema2({
130275
+ target: listItemAddressSchema2,
130276
+ restartNumbering: { type: "boolean" }
130277
+ }, ["target"]), objectSchema2({
130278
+ success: { const: true },
130279
+ listId: { type: "string" },
130280
+ numId: { type: "integer" },
130281
+ restartedAt: { type: ["integer", "null"] }
130282
+ }, [
130283
+ "success",
130284
+ "listId",
130285
+ "numId",
130286
+ "restartedAt"
130287
+ ]), listsFailureSchemaFor2("lists.split"), objectSchema2({
130288
+ success: { const: true },
130289
+ listId: { type: "string" },
130290
+ numId: { type: "integer" },
130291
+ restartedAt: { type: ["integer", "null"] }
130292
+ }, [
130293
+ "success",
130294
+ "listId",
130295
+ "numId",
130296
+ "restartedAt"
130297
+ ]), listsFailureSchemaFor2("lists.split"), objectSchema2({
129775
130298
  target: listItemAddressSchema2,
129776
130299
  level: {
129777
130300
  type: "integer",
@@ -130174,8 +130697,8 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
130174
130697
  description: "Comment text content."
130175
130698
  },
130176
130699
  target: {
130177
- ...textAddressSchema2,
130178
- description: "Text range to anchor the comment: {kind:'text', blockId:'...', range:{start:N, end:N}}."
130700
+ oneOf: [textAddressSchema2, textTargetSchema2],
130701
+ description: "Text range to anchor the comment. Accepts either a single-block TextAddress {kind:'text', blockId, range} or a multi-segment TextTarget {kind:'text', segments:[{blockId, range}, ...]} for selections that span blocks."
130179
130702
  },
130180
130703
  parentCommentId: {
130181
130704
  type: "string",
@@ -130623,6 +131146,19 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
130623
131146
  }, ["start", "end"]),
130624
131147
  output: resolveRangeOutputSchema
130625
131148
  },
131149
+ "selection.current": {
131150
+ input: objectSchema2({ includeText: { type: "boolean" } }, []),
131151
+ output: objectSchema2({
131152
+ empty: { type: "boolean" },
131153
+ target: { oneOf: [textTargetSchema2, { type: "null" }] },
131154
+ activeMarks: arraySchema2({ type: "string" }),
131155
+ text: { type: "string" }
131156
+ }, [
131157
+ "empty",
131158
+ "target",
131159
+ "activeMarks"
131160
+ ])
131161
+ },
130626
131162
  "mutations.preview": {
130627
131163
  input: mutationsInputSchema,
130628
131164
  output: objectSchema2({
@@ -132347,6 +132883,11 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
132347
132883
  description: "Deterministic range construction from explicit document anchors.",
132348
132884
  pagePath: "ranges/index.mdx"
132349
132885
  },
132886
+ selection: {
132887
+ title: "Selection",
132888
+ description: "Read the editor's current selection as a portable, addressable target.",
132889
+ pagePath: "selection/index.mdx"
132890
+ },
132350
132891
  diff: {
132351
132892
  title: "Diff",
132352
132893
  description: "Snapshot-based document comparison and replay.",
@@ -132461,6 +133002,7 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
132461
133002
  "nearest"
132462
133003
  ]);
132463
133004
  VALID_BEHAVIOR_VALUES2 = new Set(["auto", "smooth"]);
133005
+ SELECTION_CURRENT_ALLOWED_KEYS2 = new Set(["includeText"]);
132464
133006
  CREATE_COMMENT_ALLOWED_KEYS2 = new Set([
132465
133007
  "target",
132466
133008
  "text",
@@ -155319,7 +155861,7 @@ var init_SuperConverter_2Pu0hMB1_es = __esm(() => {
155319
155861
  };
155320
155862
  });
155321
155863
 
155322
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-sMwtuYL8.es.js
155864
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-CVKqElqj.es.js
155323
155865
  function parseSizeUnit(val = "0") {
155324
155866
  const length3 = val.toString() || "0";
155325
155867
  const value = Number.parseFloat(length3);
@@ -157941,9 +158483,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
157941
158483
  }
157942
158484
  };
157943
158485
  };
157944
- var init_create_headless_toolbar_sMwtuYL8_es = __esm(() => {
157945
- init_SuperConverter_2Pu0hMB1_es();
157946
- init_constants_CGhJRd87_es();
158486
+ var init_create_headless_toolbar_CVKqElqj_es = __esm(() => {
158487
+ init_SuperConverter_lmyr0gmB_es();
158488
+ init_constants_DrU4EASo_es();
157947
158489
  init_dist_B8HfvhaK_es();
157948
158490
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
157949
158491
  DOM_SIZE_UNITS = [
@@ -159389,7 +159931,7 @@ var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
159389
159931
  ]);
159390
159932
  });
159391
159933
 
159392
- // ../../packages/superdoc/dist/chunks/DocxZipper-BBjEXAFw.es.js
159934
+ // ../../packages/superdoc/dist/chunks/DocxZipper-CwFyjl1b.es.js
159393
159935
  function sniffEncoding(u8) {
159394
159936
  if (u8.length >= 2) {
159395
159937
  const b0 = u8[0], b1 = u8[1];
@@ -160040,11 +160582,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
160040
160582
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
160041
160583
  }
160042
160584
  }, DocxZipper_default;
160043
- var init_DocxZipper_BBjEXAFw_es = __esm(() => {
160585
+ var init_DocxZipper_CwFyjl1b_es = __esm(() => {
160044
160586
  init_rolldown_runtime_Bg48TavK_es();
160045
160587
  init_jszip_C49i9kUs_es();
160046
160588
  init_xml_js_CqGKpaft_es();
160047
- init_constants_CGhJRd87_es();
160589
+ init_constants_DrU4EASo_es();
160048
160590
  init_dist_B8HfvhaK_es();
160049
160591
  MANAGED_PACKAGE_PARTS = [
160050
160592
  {
@@ -206629,7 +207171,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
206629
207171
  init_remark_gfm_BhnWr3yf_es();
206630
207172
  });
206631
207173
 
206632
- // ../../packages/superdoc/dist/chunks/src-CjxSHf0p.es.js
207174
+ // ../../packages/superdoc/dist/chunks/src-BQTDR8tR.es.js
206633
207175
  function deleteProps(obj, propOrProps) {
206634
207176
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
206635
207177
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -210852,6 +211394,33 @@ function updateTableWrapper(tableWrapper, table2) {
210852
211394
  borderWidth = Math.ceil(Math.max(borderLeftMax, borderRightMax));
210853
211395
  tableWrapper.style.setProperty("--table-border-width", `${borderWidth || defaultBorderWidth}px`);
210854
211396
  }
211397
+ function cloneBorders(borders, sides) {
211398
+ if (!borders || typeof borders !== "object")
211399
+ return {};
211400
+ const source = borders;
211401
+ const keys$1 = Array.isArray(sides) ? sides : Object.keys(source);
211402
+ const clone = {};
211403
+ for (const side of keys$1) {
211404
+ const borderValue = source[side];
211405
+ if (!borderValue || typeof borderValue !== "object")
211406
+ continue;
211407
+ clone[side] = { ...borderValue };
211408
+ }
211409
+ return clone;
211410
+ }
211411
+ function mapBorderSizes(borders, sizeMapper) {
211412
+ if (!borders || typeof borders !== "object")
211413
+ return;
211414
+ if (typeof sizeMapper !== "function")
211415
+ return;
211416
+ for (const border of Object.values(borders)) {
211417
+ if (!border || typeof border !== "object")
211418
+ continue;
211419
+ const mapped = sizeMapper(border.size);
211420
+ if (typeof mapped === "number" && Number.isFinite(mapped))
211421
+ border.size = mapped;
211422
+ }
211423
+ }
210855
211424
  function resolvePreferredNewTableStyleIdFromEditor(editor) {
210856
211425
  const translatedLinkedStyles = readTranslatedLinkedStyles(editor);
210857
211426
  let settingsDefaultStyleId = null;
@@ -210865,10 +211434,12 @@ function resolvePreferredNewTableStyleIdFromEditor(editor) {
210865
211434
  }
210866
211435
  function normalizeNewTableAttrs(editor) {
210867
211436
  const resolved = resolvePreferredNewTableStyleIdFromEditor(editor);
210868
- if (resolved.source === "none")
211437
+ if (resolved.source === "none") {
211438
+ const fallbackPixelBorders = cloneBorders(TABLE_FALLBACK_BORDERS, TABLE_BORDER_SIDES);
211439
+ mapBorderSizes(fallbackPixelBorders, eighthPointsToPixels);
210869
211440
  return {
210870
211441
  tableStyleId: null,
210871
- borders: { ...TABLE_FALLBACK_BORDERS },
211442
+ borders: fallbackPixelBorders,
210872
211443
  tableProperties: {
210873
211444
  borders: { ...TABLE_FALLBACK_BORDERS },
210874
211445
  cellMargins: {
@@ -210891,6 +211462,7 @@ function normalizeNewTableAttrs(editor) {
210891
211462
  }
210892
211463
  }
210893
211464
  };
211465
+ }
210894
211466
  return {
210895
211467
  tableStyleId: resolved.styleId,
210896
211468
  tableProperties: {
@@ -222017,8 +222589,33 @@ function buildMatchBlocks(editor, textRanges, evaluatedRevision, matchId, storyK
222017
222589
  const to = Math.max(...ranges.map((r$1) => r$1.range.end));
222018
222590
  const sorted = [...ranges].sort((a2, b$1) => a2.range.start - b$1.range.start);
222019
222591
  for (let i4 = 0;i4 < sorted.length - 1; i4++)
222020
- if (sorted[i4].range.end < sorted[i4 + 1].range.start)
222021
- throw planError("INVALID_INPUT", `discontiguous text ranges in block ${blockId}: gap between ${sorted[i4].range.end} and ${sorted[i4 + 1].range.start}`);
222592
+ if (sorted[i4].range.end < sorted[i4 + 1].range.start) {
222593
+ const gapStart = sorted[i4].range.end;
222594
+ const gapEnd = sorted[i4 + 1].range.start;
222595
+ const coveringStart = Math.min(...sorted.map((r$1) => r$1.range.start));
222596
+ const coveringEnd = Math.max(...sorted.map((r$1) => r$1.range.end));
222597
+ throw planError("INVALID_INPUT", `discontiguous text ranges in block ${blockId}: gap between ${gapStart} and ${gapEnd}. Two or more edits target the same block with untouched text between them and cannot be coalesced safely. Fix by: (a) splitting the edits across separate superdoc_mutations batches — preferred, works in both direct and tracked change modes; or (b) combining the edits into a single text.rewrite covering offsets ${coveringStart}..${coveringEnd} — direct mode only, since in tracked mode the untouched middle would be recorded as deleted+reinserted.`, undefined, {
222598
+ blockId,
222599
+ gap: {
222600
+ start: gapStart,
222601
+ end: gapEnd
222602
+ },
222603
+ coveringRange: {
222604
+ start: coveringStart,
222605
+ end: coveringEnd
222606
+ },
222607
+ rangeCount: sorted.length,
222608
+ ranges: sorted.map((r$1) => ({
222609
+ start: r$1.range.start,
222610
+ end: r$1.range.end
222611
+ })),
222612
+ remediation: {
222613
+ preferred: "split-batches",
222614
+ optionA: "Split into separate superdoc_mutations batches (works in direct and tracked modes).",
222615
+ optionB: `Combine into one text.rewrite covering offsets ${coveringStart}..${coveringEnd} (direct mode only — pollutes tracked history).`
222616
+ }
222617
+ });
222618
+ }
222022
222619
  const blockStart = candidate.pos + 1;
222023
222620
  const blockEnd = candidate.end - 1;
222024
222621
  const blockText = doc$12.textBetween(blockStart, blockEnd, `
@@ -228423,6 +229020,26 @@ function toNotFoundError(input2) {
228423
229020
  function isSameTarget(left$1, right$1) {
228424
229021
  return left$1.blockId === right$1.blockId && left$1.range.start === right$1.range.start && left$1.range.end === right$1.range.end;
228425
229022
  }
229023
+ function isTextTargetShape(target) {
229024
+ if (!target || typeof target !== "object")
229025
+ return false;
229026
+ const t = target;
229027
+ if (t.kind !== "text")
229028
+ return false;
229029
+ if (!Array.isArray(t.segments) || t.segments.length === 0)
229030
+ return false;
229031
+ if (typeof t.blockId === "string" || t.range !== undefined && t.range !== null)
229032
+ return false;
229033
+ return true;
229034
+ }
229035
+ function targetToSegments(target) {
229036
+ if (isTextTargetShape(target))
229037
+ return [...target.segments];
229038
+ return [{
229039
+ blockId: target.blockId,
229040
+ range: target.range
229041
+ }];
229042
+ }
228426
229043
  function listCommentAnchorsSafe(editor) {
228427
229044
  try {
228428
229045
  return listCommentAnchors(editor);
@@ -228528,7 +229145,7 @@ function buildAnchoredText(editor, canonical) {
228528
229145
  }
228529
229146
  return parts.length > 0 ? normalizeExcerpt(parts.join(" ")) : undefined;
228530
229147
  }
228531
- function buildTextTarget(canonical) {
229148
+ function buildTextTarget$1(canonical) {
228532
229149
  if (canonical.length === 0)
228533
229150
  return;
228534
229151
  return {
@@ -228554,7 +229171,7 @@ function mergeAnchorData(editor, infosById, anchors) {
228554
229171
  const firstAnchor = sorted[0];
228555
229172
  const status = sorted.every((anchor) => anchor.status === "resolved") ? "resolved" : "open";
228556
229173
  const canonical = canonicalizeAnchors(sorted);
228557
- const target = buildTextTarget(canonical);
229174
+ const target = buildTextTarget$1(canonical);
228558
229175
  const anchoredText = buildAnchoredText(editor, canonical);
228559
229176
  const existing = infosById.get(commentId);
228560
229177
  if (existing) {
@@ -228629,17 +229246,62 @@ function buildCommentInfos(editor) {
228629
229246
  }
228630
229247
  function addCommentHandler(editor, input2, options) {
228631
229248
  requireEditorCommand(editor.commands?.addComment, "comments.create (addComment)");
228632
- if (input2.target.range.start === input2.target.range.end)
229249
+ const target = input2.target;
229250
+ if (!target)
228633
229251
  return {
228634
229252
  success: false,
228635
229253
  failure: {
228636
229254
  code: "INVALID_TARGET",
228637
- message: "Comment target range must be non-collapsed."
229255
+ message: "Comment target is required."
228638
229256
  }
228639
229257
  };
228640
- const resolved = resolveTextTarget(editor, input2.target);
228641
- if (!resolved)
228642
- throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Comment target could not be resolved.", { target: input2.target });
229258
+ const segments = targetToSegments(target);
229259
+ for (const seg of segments)
229260
+ if (seg.range.start === seg.range.end)
229261
+ return {
229262
+ success: false,
229263
+ failure: {
229264
+ code: "INVALID_TARGET",
229265
+ message: "Comment target range must be non-collapsed.",
229266
+ details: { target }
229267
+ }
229268
+ };
229269
+ const resolvedSegments = segments.map((seg) => resolveTextTarget(editor, {
229270
+ kind: "text",
229271
+ blockId: seg.blockId,
229272
+ range: seg.range
229273
+ }));
229274
+ if (resolvedSegments.some((r$1) => r$1 === null))
229275
+ throw new DocumentApiAdapterError("TARGET_NOT_FOUND", "Comment target could not be resolved.", { target });
229276
+ const docForGap = editor.state?.doc;
229277
+ for (let i4 = 1;i4 < resolvedSegments.length; i4 += 1) {
229278
+ const prev = resolvedSegments[i4 - 1];
229279
+ const curr = resolvedSegments[i4];
229280
+ if (prev.to > curr.from)
229281
+ return {
229282
+ success: false,
229283
+ failure: {
229284
+ code: "INVALID_TARGET",
229285
+ message: "Comment target segments must be in document order.",
229286
+ details: { target }
229287
+ }
229288
+ };
229289
+ if ((docForGap ? docForGap.textBetween(prev.to, curr.from, "", () => "\x01") : "").length > 0)
229290
+ return {
229291
+ success: false,
229292
+ failure: {
229293
+ code: "INVALID_TARGET",
229294
+ message: "Comment target segments must be contiguous — non-selected text or atoms between segments is not supported.",
229295
+ details: { target }
229296
+ }
229297
+ };
229298
+ }
229299
+ const firstResolved = resolvedSegments[0];
229300
+ const lastResolved = resolvedSegments[resolvedSegments.length - 1];
229301
+ const resolved = {
229302
+ from: firstResolved.from,
229303
+ to: lastResolved.to
229304
+ };
228643
229305
  if (resolved.from === resolved.to)
228644
229306
  return {
228645
229307
  success: false,
@@ -229421,7 +230083,79 @@ function indexCellsForTable(tableNode) {
229421
230083
  }
229422
230084
  return anchors;
229423
230085
  }
229424
- function buildBlock(node3, pos, nodeType, path2, tableContext) {
230086
+ function readSpanTrackedChanges(node3, canonicalIdByAlias) {
230087
+ const out = [];
230088
+ for (const mark2 of node3.marks) {
230089
+ const type = TRACK_MARK_TYPE_BY_NAME[mark2.type.name];
230090
+ if (!type)
230091
+ continue;
230092
+ const rawId = mark2.attrs?.id;
230093
+ if (typeof rawId !== "string" || rawId.length === 0)
230094
+ continue;
230095
+ const entityId = canonicalIdByAlias.get(rawId);
230096
+ if (!entityId)
230097
+ continue;
230098
+ out.push({
230099
+ entityId,
230100
+ type
230101
+ });
230102
+ }
230103
+ out.sort((a2, b$1) => {
230104
+ if (a2.entityId !== b$1.entityId)
230105
+ return a2.entityId < b$1.entityId ? -1 : 1;
230106
+ return a2.type < b$1.type ? -1 : a2.type > b$1.type ? 1 : 0;
230107
+ });
230108
+ return out;
230109
+ }
230110
+ function spanTrackedChangesEqual(a2, b$1) {
230111
+ if (a2.length !== b$1.length)
230112
+ return false;
230113
+ for (let i4 = 0;i4 < a2.length; i4++)
230114
+ if (a2[i4].entityId !== b$1[i4].entityId || a2[i4].type !== b$1[i4].type)
230115
+ return false;
230116
+ return true;
230117
+ }
230118
+ function recordEntityHit(index2, entityId, type, blockId) {
230119
+ let entry = index2.get(entityId);
230120
+ if (!entry) {
230121
+ entry = {
230122
+ blockIds: /* @__PURE__ */ new Set,
230123
+ types: /* @__PURE__ */ new Set
230124
+ };
230125
+ index2.set(entityId, entry);
230126
+ }
230127
+ entry.blockIds.add(blockId);
230128
+ entry.types.add(type);
230129
+ }
230130
+ function buildTextSpans(node3, blockId, canonicalIdByAlias, entityIndex) {
230131
+ if (canonicalIdByAlias.size === 0)
230132
+ return;
230133
+ const spans = [];
230134
+ let hasAnyTrackedChange = false;
230135
+ node3.descendants((child) => {
230136
+ if (!child.isText || typeof child.text !== "string" || child.text.length === 0)
230137
+ return true;
230138
+ const tracked = readSpanTrackedChanges(child, canonicalIdByAlias);
230139
+ if (tracked.length > 0) {
230140
+ hasAnyTrackedChange = true;
230141
+ for (const tc of tracked)
230142
+ recordEntityHit(entityIndex, tc.entityId, tc.type, blockId);
230143
+ }
230144
+ const last2 = spans.length > 0 ? spans[spans.length - 1] : undefined;
230145
+ const lastTracked = last2?.trackedChanges ?? [];
230146
+ if (last2 && spanTrackedChangesEqual(lastTracked, tracked)) {
230147
+ last2.text += child.text;
230148
+ return true;
230149
+ }
230150
+ const span = { text: child.text };
230151
+ if (tracked.length > 0)
230152
+ span.trackedChanges = tracked;
230153
+ spans.push(span);
230154
+ return true;
230155
+ });
230156
+ return hasAnyTrackedChange ? spans : undefined;
230157
+ }
230158
+ function buildBlock(node3, pos, nodeType, path2, canonicalIdByAlias, entityIndex, tableContext) {
229425
230159
  const nodeId = resolveBlockNodeId(node3, pos, nodeType, path2);
229426
230160
  if (!nodeId)
229427
230161
  return;
@@ -229432,13 +230166,16 @@ function buildBlock(node3, pos, nodeType, path2, tableContext) {
229432
230166
  type: nodeType,
229433
230167
  text: node3.textContent
229434
230168
  };
230169
+ const spans = buildTextSpans(node3, nodeId, canonicalIdByAlias, entityIndex);
230170
+ if (spans)
230171
+ block.textSpans = spans;
229435
230172
  if (headingLevel !== undefined)
229436
230173
  block.headingLevel = headingLevel;
229437
230174
  if (tableContext)
229438
230175
  block.tableContext = tableContext;
229439
230176
  return block;
229440
230177
  }
229441
- function collectContainerBlocks(container, contentStart, containerPath, ordinals, tableContext, nestedParent) {
230178
+ function collectContainerBlocks(container, contentStart, containerPath, ctx$1, tableContext, nestedParent) {
229442
230179
  const blocks2 = [];
229443
230180
  let childOffset = 0;
229444
230181
  for (let i4 = 0;i4 < container.childCount; i4++) {
@@ -229447,27 +230184,27 @@ function collectContainerBlocks(container, contentStart, containerPath, ordinals
229447
230184
  childOffset += child.nodeSize;
229448
230185
  const childPath = [...containerPath, i4];
229449
230186
  if (child.type.name === "table") {
229450
- blocks2.push(...collectTableExtractBlocks(child, childPos, childPath, ordinals, nestedParent));
230187
+ blocks2.push(...collectTableExtractBlocks(child, childPos, childPath, ctx$1, nestedParent));
229451
230188
  continue;
229452
230189
  }
229453
230190
  if (SDT_BLOCK_NODE_NAMES.has(child.type.name)) {
229454
- blocks2.push(...collectContainerBlocks(child, childPos + 1, childPath, ordinals, tableContext, nestedParent));
230191
+ blocks2.push(...collectContainerBlocks(child, childPos + 1, childPath, ctx$1, tableContext, nestedParent));
229455
230192
  continue;
229456
230193
  }
229457
230194
  const childType = mapBlockNodeType(child);
229458
230195
  if (childType && EMITTABLE_BLOCK_TYPES.has(childType)) {
229459
- const block = buildBlock(child, childPos, childType, childPath, tableContext);
230196
+ const block = buildBlock(child, childPos, childType, childPath, ctx$1.canonicalIdByAlias, ctx$1.entityIndex, tableContext);
229460
230197
  if (block)
229461
230198
  blocks2.push(block);
229462
230199
  continue;
229463
230200
  }
229464
230201
  if (!child.isLeaf && child.firstChild?.isBlock === true)
229465
- blocks2.push(...collectContainerBlocks(child, childPos + 1, childPath, ordinals, tableContext, nestedParent));
230202
+ blocks2.push(...collectContainerBlocks(child, childPos + 1, childPath, ctx$1, tableContext, nestedParent));
229466
230203
  }
229467
230204
  return blocks2;
229468
230205
  }
229469
- function collectTableExtractBlocks(tableNode, tablePos, tablePath, ordinals, parent) {
229470
- const tableOrdinal = ordinals.next++;
230206
+ function collectTableExtractBlocks(tableNode, tablePos, tablePath, ctx$1, parent) {
230207
+ const tableOrdinal = ctx$1.ordinals.next++;
229471
230208
  const anchors = indexCellsForTable(tableNode);
229472
230209
  const blocks2 = [];
229473
230210
  for (const anchor of anchors) {
@@ -229489,7 +230226,7 @@ function collectTableExtractBlocks(tableNode, tablePos, tablePath, ordinals, par
229489
230226
  tableContext.parentRowIndex = parent.rowIndex;
229490
230227
  tableContext.parentColumnIndex = parent.columnIndex;
229491
230228
  }
229492
- blocks2.push(...collectContainerBlocks(anchor.cellNode, cellContentStart, cellPath, ordinals, tableContext, {
230229
+ blocks2.push(...collectContainerBlocks(anchor.cellNode, cellContentStart, cellPath, ctx$1, tableContext, {
229493
230230
  tableOrdinal,
229494
230231
  rowIndex: anchor.gridRowIndex,
229495
230232
  columnIndex: anchor.gridColumnIndex
@@ -229498,7 +230235,15 @@ function collectTableExtractBlocks(tableNode, tablePos, tablePath, ordinals, par
229498
230235
  return blocks2;
229499
230236
  }
229500
230237
  function collectBlocks(editor) {
229501
- return collectContainerBlocks(editor.state.doc, 0, [], { next: 0 });
230238
+ const ctx$1 = {
230239
+ ordinals: { next: 0 },
230240
+ canonicalIdByAlias: buildTrackedChangeCanonicalIdMap(editor),
230241
+ entityIndex: /* @__PURE__ */ new Map
230242
+ };
230243
+ return {
230244
+ blocks: collectContainerBlocks(editor.state.doc, 0, [], ctx$1),
230245
+ entityIndex: ctx$1.entityIndex
230246
+ };
229502
230247
  }
229503
230248
  function collectComments(editor) {
229504
230249
  return createCommentsWrapper(editor).list({ includeResolved: true }).items.map((item) => {
@@ -229517,13 +230262,19 @@ function collectComments(editor) {
229517
230262
  return comment2;
229518
230263
  });
229519
230264
  }
229520
- function collectTrackedChanges$1(editor) {
230265
+ function collectTrackedChanges$1(editor, entityIndex) {
229521
230266
  return trackChangesListWrapper(editor).items.map((item) => {
229522
230267
  const tc = {
229523
230268
  entityId: item.address.entityId,
229524
230269
  type: item.type
229525
230270
  };
229526
- if (item.excerpt)
230271
+ const indexEntry = entityIndex.get(item.address.entityId);
230272
+ if (indexEntry && indexEntry.blockIds.size > 0)
230273
+ tc.blockIds = Array.from(indexEntry.blockIds);
230274
+ if (item.wordRevisionIds)
230275
+ tc.wordRevisionIds = item.wordRevisionIds;
230276
+ const isMultiTypeEntity = !!(indexEntry && indexEntry.types.size > 1);
230277
+ if (item.excerpt && !isMultiTypeEntity)
229527
230278
  tc.excerpt = item.excerpt;
229528
230279
  if (item.author)
229529
230280
  tc.author = item.author;
@@ -229533,10 +230284,11 @@ function collectTrackedChanges$1(editor) {
229533
230284
  });
229534
230285
  }
229535
230286
  function extractAdapter(editor, _input) {
230287
+ const { blocks: blocks2, entityIndex } = collectBlocks(editor);
229536
230288
  return {
229537
- blocks: collectBlocks(editor),
230289
+ blocks: blocks2,
229538
230290
  comments: collectComments(editor),
229539
- trackedChanges: collectTrackedChanges$1(editor),
230291
+ trackedChanges: collectTrackedChanges$1(editor, entityIndex),
229540
230292
  revision: getRevision(editor)
229541
230293
  };
229542
230294
  }
@@ -231501,6 +232253,9 @@ function resolveInsertedListItem(editor, sdBlockId) {
231501
232253
  });
231502
232254
  throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Inserted list item with sdBlockId "${sdBlockId}" could not be resolved after insertion.`);
231503
232255
  }
232256
+ function generateRuntimeParaId() {
232257
+ return v4_default().replace(/-/g, "").slice(0, 8).toUpperCase();
232258
+ }
231504
232259
  function withListTarget(editor, input2) {
231505
232260
  return resolveListItem(editor, input2.target);
231506
232261
  }
@@ -231588,6 +232343,7 @@ function listsInsertWrapper(editor, input2, options) {
231588
232343
  }
231589
232344
  };
231590
232345
  const createdId = v4_default();
232346
+ const createdParaId = generateRuntimeParaId();
231591
232347
  let created = null;
231592
232348
  if (executeDomainCommand(editor, () => {
231593
232349
  const didApply = insertListItemAt$1({
@@ -231595,6 +232351,7 @@ function listsInsertWrapper(editor, input2, options) {
231595
232351
  position: input2.position,
231596
232352
  text: input2.text ?? "",
231597
232353
  sdBlockId: createdId,
232354
+ paraId: createdParaId,
231598
232355
  tracked: mode === "tracked"
231599
232356
  });
231600
232357
  if (didApply) {
@@ -231616,11 +232373,11 @@ function listsInsertWrapper(editor, input2, options) {
231616
232373
  item: {
231617
232374
  kind: "block",
231618
232375
  nodeType: "listItem",
231619
- nodeId: createdId
232376
+ nodeId: createdParaId
231620
232377
  },
231621
232378
  insertionPoint: {
231622
232379
  kind: "text",
231623
- blockId: createdId,
232380
+ blockId: createdParaId,
231624
232381
  range: {
231625
232382
  start: 0,
231626
232383
  end: 0
@@ -231971,6 +232728,129 @@ function listsSeparateWrapper(editor, input2, options) {
231971
232728
  numId: newNumId
231972
232729
  };
231973
232730
  }
232731
+ function listsMergeWrapper(editor, input2, options) {
232732
+ rejectTrackedMode("lists.merge", options);
232733
+ const target = resolveListItem(editor, input2.target);
232734
+ if (target.numId == null)
232735
+ return toListsFailure$1("INVALID_TARGET", "Target must have numbering metadata.", { target: input2.target });
232736
+ const adjacent = findAdjacentSequence(editor, target, input2.direction);
232737
+ if (!adjacent)
232738
+ return toListsFailure$1("NO_ADJACENT_SEQUENCE", "No adjacent list sequence found in the given direction.", {
232739
+ target: input2.target,
232740
+ direction: input2.direction
232741
+ });
232742
+ const targetSequence = getContiguousSequence(editor, target);
232743
+ if (adjacent.numId === target.numId)
232744
+ return toListsFailure$1("NO_OP", "Target and adjacent items already belong to the same sequence.", { target: input2.target });
232745
+ let absorbingNumId;
232746
+ let absorbedItems;
232747
+ let anchorNodeId;
232748
+ let gapFromPos;
232749
+ let gapToPos;
232750
+ if (input2.direction === "withPrevious") {
232751
+ absorbingNumId = adjacent.numId;
232752
+ absorbedItems = targetSequence;
232753
+ anchorNodeId = adjacent.sequence[0]?.address.nodeId ?? target.address.nodeId;
232754
+ const lastOfAdjacent = adjacent.sequence[adjacent.sequence.length - 1];
232755
+ const firstOfTarget = targetSequence[0];
232756
+ gapFromPos = lastOfAdjacent.candidate.pos + lastOfAdjacent.candidate.node.nodeSize;
232757
+ gapToPos = firstOfTarget.candidate.pos;
232758
+ } else {
232759
+ absorbingNumId = target.numId;
232760
+ absorbedItems = adjacent.sequence;
232761
+ anchorNodeId = targetSequence[0]?.address.nodeId ?? target.address.nodeId;
232762
+ const lastOfTarget = targetSequence[targetSequence.length - 1];
232763
+ const firstOfAdjacent = adjacent.sequence[0];
232764
+ gapFromPos = lastOfTarget.candidate.pos + lastOfTarget.candidate.node.nodeSize;
232765
+ gapToPos = firstOfAdjacent.candidate.pos;
232766
+ }
232767
+ const gapEmptyParagraphs = [];
232768
+ if (gapFromPos < gapToPos)
232769
+ editor.state.doc.forEach((child, offset$1) => {
232770
+ if (child.type.name !== "paragraph")
232771
+ return;
232772
+ if (offset$1 < gapFromPos)
232773
+ return;
232774
+ if (offset$1 + child.nodeSize > gapToPos)
232775
+ return;
232776
+ if (child.childCount > 0)
232777
+ return;
232778
+ gapEmptyParagraphs.push({
232779
+ pos: offset$1,
232780
+ node: child
232781
+ });
232782
+ });
232783
+ const mergedListId = `${absorbingNumId}:${anchorNodeId}`;
232784
+ if (options?.dryRun)
232785
+ return {
232786
+ success: true,
232787
+ listId: mergedListId,
232788
+ absorbedCount: absorbedItems.length,
232789
+ removedEmptyBlocks: gapEmptyParagraphs.length
232790
+ };
232791
+ if (executeDomainCommand(editor, () => {
232792
+ const { tr } = editor.state;
232793
+ for (const item of absorbedItems) {
232794
+ const currentLevel = item.level ?? 0;
232795
+ updateNumberingProperties({
232796
+ numId: absorbingNumId,
232797
+ ilvl: currentLevel
232798
+ }, item.candidate.node, item.candidate.pos, editor, tr);
232799
+ }
232800
+ const sorted = [...gapEmptyParagraphs].sort((a2, b$1) => b$1.pos - a2.pos);
232801
+ for (const gap of sorted)
232802
+ tr.delete(gap.pos, gap.pos + gap.node.nodeSize);
232803
+ dispatchEditorTransaction$2(editor, tr);
232804
+ clearIndexCache(editor);
232805
+ return true;
232806
+ }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
232807
+ return toListsFailure$1("INVALID_TARGET", "List merge could not be applied.", {
232808
+ target: input2.target,
232809
+ direction: input2.direction
232810
+ });
232811
+ return {
232812
+ success: true,
232813
+ listId: mergedListId,
232814
+ absorbedCount: absorbedItems.length,
232815
+ removedEmptyBlocks: gapEmptyParagraphs.length
232816
+ };
232817
+ }
232818
+ function listsSplitWrapper(editor, input2, options) {
232819
+ rejectTrackedMode("lists.split", options);
232820
+ const separateResult = listsSeparateWrapper(editor, { target: input2.target }, options);
232821
+ if (!separateResult.success)
232822
+ return separateResult;
232823
+ if (!(input2.restartNumbering !== false))
232824
+ return {
232825
+ success: true,
232826
+ listId: separateResult.listId,
232827
+ numId: separateResult.numId,
232828
+ restartedAt: null
232829
+ };
232830
+ if (options?.dryRun)
232831
+ return {
232832
+ success: true,
232833
+ listId: separateResult.listId,
232834
+ numId: separateResult.numId,
232835
+ restartedAt: 1
232836
+ };
232837
+ const setValueOptions = options ? {
232838
+ ...options,
232839
+ expectedRevision: undefined
232840
+ } : options;
232841
+ const setValueResult = listsSetValueWrapper(editor, {
232842
+ target: input2.target,
232843
+ value: 1
232844
+ }, setValueOptions);
232845
+ if (!setValueResult.success)
232846
+ return setValueResult;
232847
+ return {
232848
+ success: true,
232849
+ listId: separateResult.listId,
232850
+ numId: separateResult.numId,
232851
+ restartedAt: 1
232852
+ };
232853
+ }
231974
232854
  function listsSetLevelWrapper(editor, input2, options) {
231975
232855
  rejectTrackedMode("lists.setLevel", options);
231976
232856
  return executeSetLevel(editor, resolveListItem(editor, input2.target), input2.level, options);
@@ -233277,6 +234157,151 @@ async function scrollRangeIntoView(editor, input2) {
233277
234157
  return { success: false };
233278
234158
  }
233279
234159
  }
234160
+ function resolveCurrentSelectionInfo(editor, input2) {
234161
+ const state = editor.state;
234162
+ if (!state)
234163
+ return {
234164
+ empty: true,
234165
+ target: null,
234166
+ activeMarks: []
234167
+ };
234168
+ const { from: from$1, to, empty: empty$1 } = state.selection;
234169
+ const segments = collectTextSegments(state.doc, from$1, to);
234170
+ const info = {
234171
+ empty: empty$1,
234172
+ target: segments && segments.length > 0 ? buildTextTarget(segments) : null,
234173
+ activeMarks: collectActiveMarks(state, from$1, to)
234174
+ };
234175
+ if (input2.includeText && !empty$1)
234176
+ info.text = state.doc.textBetween(from$1, to, " ");
234177
+ return info;
234178
+ }
234179
+ function buildTextTarget(segments) {
234180
+ return {
234181
+ kind: "text",
234182
+ segments
234183
+ };
234184
+ }
234185
+ function collectTextSegments(doc$12, from$1, to) {
234186
+ const segments = [];
234187
+ let abort = false;
234188
+ doc$12.nodesBetween(from$1, to, (node3, pos) => {
234189
+ if (abort)
234190
+ return false;
234191
+ if (!node3.isTextblock)
234192
+ return true;
234193
+ const blockId = readBlockId(node3);
234194
+ if (!blockId) {
234195
+ abort = true;
234196
+ return false;
234197
+ }
234198
+ const blockStart = pos + 1;
234199
+ const blockEnd = pos + node3.nodeSize - 1;
234200
+ const selStart = Math.max(from$1, blockStart);
234201
+ const selEnd = Math.min(to, blockEnd);
234202
+ const start$1 = pmPositionToTextOffset(node3, pos, selStart);
234203
+ const end$1 = Math.max(start$1, pmPositionToTextOffset(node3, pos, selEnd));
234204
+ segments.push({
234205
+ blockId,
234206
+ range: {
234207
+ start: start$1,
234208
+ end: end$1
234209
+ }
234210
+ });
234211
+ return false;
234212
+ });
234213
+ if (abort)
234214
+ return null;
234215
+ return segments;
234216
+ }
234217
+ function readBlockId(node3) {
234218
+ const attrs = node3.attrs ?? {};
234219
+ const id2 = attrs.sdBlockId ?? attrs.id ?? attrs.blockId;
234220
+ return typeof id2 === "string" && id2.length > 0 ? id2 : null;
234221
+ }
234222
+ function collectActiveMarks(state, from$1, to) {
234223
+ const names = /* @__PURE__ */ new Set;
234224
+ const stored = state.storedMarks;
234225
+ if (stored)
234226
+ for (const mark2 of stored)
234227
+ names.add(mark2.type.name);
234228
+ if (from$1 === to) {
234229
+ const marks = state.doc.resolve(from$1).marks();
234230
+ for (const mark2 of marks)
234231
+ names.add(mark2.type.name);
234232
+ } else {
234233
+ const common = markTypesPresentEverywhere(state.doc, from$1, to);
234234
+ for (const name of common)
234235
+ names.add(name);
234236
+ }
234237
+ return Array.from(names);
234238
+ }
234239
+ function subscribeToSelection(editor, listener) {
234240
+ let scheduled = false;
234241
+ let cancelled = false;
234242
+ let lastEmittedKey = null;
234243
+ const flush = () => {
234244
+ scheduled = false;
234245
+ if (cancelled)
234246
+ return;
234247
+ const info = resolveCurrentSelectionInfo(editor, {});
234248
+ const key2 = selectionInfoKey(info);
234249
+ if (key2 === lastEmittedKey)
234250
+ return;
234251
+ lastEmittedKey = key2;
234252
+ listener(info);
234253
+ };
234254
+ const schedule = () => {
234255
+ if (scheduled || cancelled)
234256
+ return;
234257
+ scheduled = true;
234258
+ queueMicrotask(flush);
234259
+ };
234260
+ editor.on("selectionUpdate", schedule);
234261
+ editor.on("transaction", schedule);
234262
+ return () => {
234263
+ cancelled = true;
234264
+ editor.off?.("selectionUpdate", schedule);
234265
+ editor.off?.("transaction", schedule);
234266
+ };
234267
+ }
234268
+ function selectionInfoKey(info) {
234269
+ const target = info.target;
234270
+ let targetKey;
234271
+ if (!target)
234272
+ targetKey = "null";
234273
+ else
234274
+ targetKey = target.segments.map((s2) => `${s2.blockId}:${s2.range.start}-${s2.range.end}`).join("|");
234275
+ const marks = [...info.activeMarks].sort().join(",");
234276
+ return `${info.empty ? "1" : "0"}:${targetKey}:${marks}`;
234277
+ }
234278
+ function markTypesPresentEverywhere(doc$12, from$1, to) {
234279
+ let common = null;
234280
+ let aborted = false;
234281
+ doc$12.nodesBetween(from$1, to, (node3, pos) => {
234282
+ if (aborted)
234283
+ return false;
234284
+ if (!node3.isText)
234285
+ return true;
234286
+ const start$1 = Math.max(pos, from$1);
234287
+ if (Math.min(pos + node3.nodeSize, to) <= start$1)
234288
+ return false;
234289
+ const names = /* @__PURE__ */ new Set;
234290
+ for (const m$1 of node3.marks)
234291
+ names.add(m$1.type.name);
234292
+ if (common === null)
234293
+ common = names;
234294
+ else {
234295
+ for (const name of common)
234296
+ if (!names.has(name))
234297
+ common.delete(name);
234298
+ if (common.size === 0)
234299
+ aborted = true;
234300
+ }
234301
+ return false;
234302
+ });
234303
+ return common ?? /* @__PURE__ */ new Set;
234304
+ }
233280
234305
  function resolveLocatorToCandidate(editor, locator, operationName) {
233281
234306
  const hasTarget = locator.target != null;
233282
234307
  const hasNodeId = locator.nodeId != null;
@@ -233508,7 +234533,7 @@ function syncExtractedTableAttrs(tp) {
233508
234533
  extracted.tableStyleId = tp.tableStyleId ?? null;
233509
234534
  extracted.justification = tp.justification ?? null;
233510
234535
  extracted.tableLayout = tp.tableLayout ?? null;
233511
- extracted.borders = tp.borders ?? null;
234536
+ extracted.borders = convertTableBordersToPixelUnits(tp.borders) ?? tp.borders ?? null;
233512
234537
  const indent2 = tp.tableIndent;
233513
234538
  if (indent2?.value != null)
233514
234539
  extracted.tableIndent = {
@@ -233552,6 +234577,13 @@ function syncExtractedTableAttrs(tp) {
233552
234577
  extracted.tableWidth = null;
233553
234578
  return extracted;
233554
234579
  }
234580
+ function convertTableBordersToPixelUnits(value) {
234581
+ const clone = cloneBorders(value);
234582
+ if (!clone || Object.keys(clone).length === 0)
234583
+ return;
234584
+ mapBorderSizes(clone, eighthPointsToPixels);
234585
+ return Object.keys(clone).length > 0 ? clone : undefined;
234586
+ }
233555
234587
  function normalizeGridWidth(width) {
233556
234588
  if (typeof width === "number" && Number.isFinite(width))
233557
234589
  return { col: Math.round(width) };
@@ -245856,6 +246888,8 @@ function assembleDocumentApiAdapters(editor) {
245856
246888
  join: (input2, options) => listsJoinWrapper(editor, input2, options),
245857
246889
  canJoin: (input2) => listsCanJoinWrapper(editor, input2),
245858
246890
  separate: (input2, options) => listsSeparateWrapper(editor, input2, options),
246891
+ merge: (input2, options) => listsMergeWrapper(editor, input2, options),
246892
+ split: (input2, options) => listsSplitWrapper(editor, input2, options),
245859
246893
  setLevel: (input2, options) => listsSetLevelWrapper(editor, input2, options),
245860
246894
  setValue: (input2, options) => listsSetValueWrapper(editor, input2, options),
245861
246895
  continuePrevious: (input2, options) => listsContinuePreviousWrapper(editor, input2, options),
@@ -246107,6 +247141,10 @@ function assembleDocumentApiAdapters(editor) {
246107
247141
  resolve: (input2) => resolveRange(editor, input2),
246108
247142
  scrollIntoView: (input2) => scrollRangeIntoView(editor, input2)
246109
247143
  },
247144
+ selection: {
247145
+ current: (input2) => resolveCurrentSelectionInfo(editor, input2),
247146
+ onChange: (listener) => subscribeToSelection(editor, listener)
247147
+ },
246110
247148
  query: { match: (input2) => queryMatchAdapter(editor, input2) },
246111
247149
  mutations: {
246112
247150
  preview: (input2) => previewPlan(editor, input2),
@@ -249509,7 +250547,7 @@ function getStableParagraphId(node3) {
249509
250547
  return null;
249510
250548
  return String(id2);
249511
250549
  }
249512
- function convertBorderSpec(ooxmlBorder) {
250550
+ function convertBorderSpec(ooxmlBorder, options) {
249513
250551
  if (!ooxmlBorder || typeof ooxmlBorder !== "object" || ooxmlBorder === null)
249514
250552
  return;
249515
250553
  const border = ooxmlBorder;
@@ -249529,17 +250567,25 @@ function convertBorderSpec(ooxmlBorder) {
249529
250567
  style: "none",
249530
250568
  width: 0
249531
250569
  };
249532
- const width = borderSizeToPx(sizeNumber);
249533
- if (width == null)
250570
+ if (!isFiniteNumber(sizeNumber))
249534
250571
  return;
250572
+ const numericSize = sizeNumber;
250573
+ if (numericSize <= 0)
250574
+ return {
250575
+ style: "none",
250576
+ width: 0
250577
+ };
249535
250578
  const normalizedColor = normalizeColorWithDefault(colorString);
250579
+ const width = resolveBorderWidth(numericSize, options?.unit ?? "px");
250580
+ if (width == null)
250581
+ return;
249536
250582
  return {
249537
250583
  style: val || "single",
249538
250584
  width,
249539
250585
  color: normalizedColor
249540
250586
  };
249541
250587
  }
249542
- function convertTableBorderValue(ooxmlBorder) {
250588
+ function convertTableBorderValue(ooxmlBorder, options) {
249543
250589
  if (!ooxmlBorder || typeof ooxmlBorder !== "object")
249544
250590
  return;
249545
250591
  const border = ooxmlBorder;
@@ -249548,10 +250594,15 @@ function convertTableBorderValue(ooxmlBorder) {
249548
250594
  const { val, size: size$1, color: color2 } = border;
249549
250595
  if (val === "nil" || val === "none" || size$1 === 0)
249550
250596
  return { none: true };
249551
- const width = borderSizeToPx(size$1);
249552
- if (width == null)
250597
+ if (!isFiniteNumber(size$1))
249553
250598
  return;
250599
+ const numericSize = size$1;
250600
+ if (numericSize <= 0)
250601
+ return { none: true };
249554
250602
  const normalizedColor = normalizeColorWithDefault(color2);
250603
+ const width = resolveBorderWidth(numericSize, options?.unit ?? "px");
250604
+ if (width == null)
250605
+ return;
249555
250606
  return {
249556
250607
  style: val || "single",
249557
250608
  width,
@@ -249573,7 +250624,7 @@ function isTableBorderValue(value) {
249573
250624
  return false;
249574
250625
  return (("style" in obj) || ("width" in obj) || ("color" in obj) || ("space" in obj)) && (!("style" in obj) || obj.style == null || isBorderStyle(obj.style));
249575
250626
  }
249576
- function extractTableBorders(bordersInput) {
250627
+ function extractTableBorders(bordersInput, options) {
249577
250628
  if (!bordersInput || typeof bordersInput !== "object")
249578
250629
  return;
249579
250630
  const sides = [
@@ -249592,7 +250643,7 @@ function extractTableBorders(bordersInput) {
249592
250643
  if (isTableBorderValue(raw))
249593
250644
  borders[side] = raw;
249594
250645
  else {
249595
- const converted = convertTableBorderValue(raw);
250646
+ const converted = convertTableBorderValue(raw, options);
249596
250647
  if (converted !== undefined)
249597
250648
  borders[side] = converted;
249598
250649
  }
@@ -251370,11 +252421,18 @@ function tableNodeToBlock(node3, { nextBlockId, positions, storyKey, trackedChan
251370
252421
  const tableAttrs = {};
251371
252422
  const getBorderSource = () => {
251372
252423
  if (node3.attrs?.borders && typeof node3.attrs.borders === "object" && node3.attrs.borders !== null && Object.keys(node3.attrs.borders).length > 0)
251373
- return node3.attrs.borders;
252424
+ return {
252425
+ borders: node3.attrs.borders,
252426
+ unit: "px"
252427
+ };
251374
252428
  if (hydratedTableStyle?.borders && typeof hydratedTableStyle.borders === "object" && hydratedTableStyle.borders !== null)
251375
- return hydratedTableStyle.borders;
252429
+ return {
252430
+ borders: hydratedTableStyle.borders,
252431
+ unit: "eighthPoints"
252432
+ };
251376
252433
  };
251377
- const tableBorders = extractTableBorders(getBorderSource());
252434
+ const borderSource = getBorderSource();
252435
+ const tableBorders = borderSource ? extractTableBorders(borderSource.borders, { unit: borderSource.unit }) : undefined;
251378
252436
  if (tableBorders)
251379
252437
  tableAttrs.borders = tableBorders;
251380
252438
  if (node3.attrs?.borderCollapse)
@@ -254202,7 +255260,11 @@ function computePhysicalAnchorY(block, fragmentHeight, pageHeight) {
254202
255260
  return offsetV;
254203
255261
  }
254204
255262
  function computeFooterBandOrigin(constraints) {
254205
- return (constraints.pageHeight ?? 0) - (constraints.margins?.bottom ?? 0);
255263
+ const pageHeight = constraints.pageHeight ?? 0;
255264
+ const footerDistance = constraints.margins?.footer;
255265
+ if (typeof footerDistance === "number" && Number.isFinite(footerDistance))
255266
+ return Math.max(0, pageHeight - Math.max(0, footerDistance));
255267
+ return Math.max(0, pageHeight - (constraints.margins?.bottom ?? 0));
254206
255268
  }
254207
255269
  function isAnchoredFragment(fragment2) {
254208
255270
  return (fragment2.kind === "image" || fragment2.kind === "drawing") && fragment2.isAnchored === true;
@@ -257374,6 +258436,8 @@ function computeConstraintsHash(constraints) {
257374
258436
  parts.push(`mb:${margins.bottom}`);
257375
258437
  if (margins.header !== undefined)
257376
258438
  parts.push(`mh:${margins.header}`);
258439
+ if (margins.footer !== undefined)
258440
+ parts.push(`mf:${margins.footer}`);
257377
258441
  }
257378
258442
  return parts.join("|");
257379
258443
  }
@@ -260239,9 +261303,13 @@ function getFirstTextPosition(doc$12) {
260239
261303
  if (!doc$12 || !doc$12.content)
260240
261304
  return 1;
260241
261305
  let validPos = 1;
261306
+ let found2 = false;
260242
261307
  doc$12.nodesBetween(0, doc$12.content.size, (node3, pos) => {
261308
+ if (found2)
261309
+ return false;
260243
261310
  if (node3.isTextblock) {
260244
261311
  validPos = pos + 1;
261312
+ found2 = true;
260245
261313
  return false;
260246
261314
  }
260247
261315
  return true;
@@ -260915,6 +261983,13 @@ function clickToPositionDom(domContainer, clientX, clientY) {
260915
261983
  log2("Using hit-chain line directly");
260916
261984
  return resolveLineAtX(hitChainLine, clientX);
260917
261985
  }
261986
+ if (fragmentEl.classList.contains(CLASS.tableFragment)) {
261987
+ const scopedContainer = findScopedLineContainer(hitChain, fragmentEl);
261988
+ if (scopedContainer) {
261989
+ log2("Resolving table click from scoped line container");
261990
+ return resolveFromLines(getLinesInPageFragment(scopedContainer, pageEl, fragmentEl), clientX, clientY);
261991
+ }
261992
+ }
260918
261993
  if (fragmentEl.classList.contains(CLASS.tableFragment)) {
260919
261994
  log2("Table fragment without line in hit chain — deferring to geometry");
260920
261995
  return null;
@@ -260963,7 +262038,9 @@ function readLayoutEpochFromDom(domContainer, clientX, clientY) {
260963
262038
  return latestEpoch;
260964
262039
  }
260965
262040
  function resolveFragment(fragmentEl, viewX, viewY) {
260966
- const lineEls = Array.from(fragmentEl.querySelectorAll(`.${CLASS.line}`));
262041
+ return resolveFromLines(Array.from(fragmentEl.querySelectorAll(`.${CLASS.line}`)), viewX, viewY);
262042
+ }
262043
+ function resolveFromLines(lineEls, viewX, viewY) {
260967
262044
  if (lineEls.length === 0) {
260968
262045
  log2("No lines in fragment");
260969
262046
  return null;
@@ -260984,6 +262061,13 @@ function resolveTextBoundaryWithinFragmentDom(fragmentEl, clientX, clientY) {
260984
262061
  return null;
260985
262062
  return resolveLineTextBoundaryAtX(lineEl, clientX);
260986
262063
  }
262064
+ function getLinesInPageFragment(containerEl, pageEl, fragmentEl) {
262065
+ return Array.from(containerEl.querySelectorAll(`.${CLASS.line}`)).filter((lineEl) => {
262066
+ if (lineEl.dataset.pmStart === undefined || lineEl.dataset.pmEnd === undefined)
262067
+ return false;
262068
+ return lineEl.closest(`.${CLASS.page}`) === pageEl && lineEl.closest(`.${CLASS.tableFragment}`) === fragmentEl;
262069
+ });
262070
+ }
260987
262071
  function resolveLineAtX(lineEl, viewX) {
260988
262072
  const { start: lineStart, end: lineEnd } = readPmRange(lineEl);
260989
262073
  if (!Number.isFinite(lineStart) || !Number.isFinite(lineEnd)) {
@@ -261087,12 +262171,19 @@ function resolveRightCaretBoundary(spanEls, targetIndex, spanStart, spanEnd) {
261087
262171
  function findLineAtY(lineEls, viewY) {
261088
262172
  if (lineEls.length === 0)
261089
262173
  return null;
262174
+ let nearest = lineEls[0];
262175
+ let minDistance = Infinity;
261090
262176
  for (const lineEl of lineEls) {
261091
262177
  const r$1 = lineEl.getBoundingClientRect();
261092
262178
  if (viewY >= r$1.top && viewY <= r$1.bottom)
261093
262179
  return lineEl;
262180
+ const distance2 = viewY < r$1.top ? r$1.top - viewY : Math.max(0, viewY - r$1.bottom);
262181
+ if (distance2 < minDistance) {
262182
+ minDistance = distance2;
262183
+ nearest = lineEl;
262184
+ }
261094
262185
  }
261095
- return lineEls[lineEls.length - 1];
262186
+ return nearest;
261096
262187
  }
261097
262188
  function findSpanAtX(spanEls, viewX) {
261098
262189
  if (spanEls.length === 0)
@@ -261113,6 +262204,19 @@ function findSpanAtX(spanEls, viewX) {
261113
262204
  }
261114
262205
  return nearest;
261115
262206
  }
262207
+ function findScopedLineContainer(hitChain, fragmentEl) {
262208
+ for (const el of hitChain) {
262209
+ if (!(el instanceof HTMLElement))
262210
+ continue;
262211
+ if (el === fragmentEl)
262212
+ break;
262213
+ if (!fragmentEl.contains(el))
262214
+ continue;
262215
+ if (el.querySelector(`.${CLASS.line}`))
262216
+ return el;
262217
+ }
262218
+ return null;
262219
+ }
261116
262220
  function mapCharIndexToPm(spanStart, spanEnd, rightCaretBoundary, textLength, charIndex) {
261117
262221
  if (!Number.isFinite(spanStart) || !Number.isFinite(spanEnd))
261118
262222
  return spanStart;
@@ -261922,6 +263026,29 @@ function isSameRenderedNoteTarget(left$1, right$1) {
261922
263026
  return false;
261923
263027
  return left$1.storyType === right$1.storyType && left$1.noteId === right$1.noteId;
261924
263028
  }
263029
+ function isOutsidePageBodyContent(layout, x, pageIndex, pageLocalY) {
263030
+ if (!Number.isFinite(x) || !Number.isFinite(pageIndex) || !Number.isFinite(pageLocalY))
263031
+ return false;
263032
+ const page = layout.pages[pageIndex];
263033
+ if (!page)
263034
+ return false;
263035
+ const pageWidth = page.size?.w ?? layout.pageSize.w;
263036
+ const pageHeight = page.size?.h ?? layout.pageSize.h;
263037
+ if (!Number.isFinite(pageWidth) || pageWidth <= 0 || !Number.isFinite(pageHeight) || pageHeight <= 0)
263038
+ return false;
263039
+ const margins = page.margins ?? null;
263040
+ const marginLeft = Number.isFinite(margins?.left) ? margins.left : DEFAULT_PAGE_MARGIN_PX;
263041
+ const marginRight = Number.isFinite(margins?.right) ? margins.right : DEFAULT_PAGE_MARGIN_PX;
263042
+ const marginTop = Number.isFinite(margins?.top) ? margins.top : DEFAULT_PAGE_MARGIN_PX;
263043
+ const marginBottom = Number.isFinite(margins?.bottom) ? margins.bottom : DEFAULT_PAGE_MARGIN_PX;
263044
+ const bodyLeft = Math.max(0, marginLeft);
263045
+ const bodyRight = Math.min(pageWidth, pageWidth - Math.max(0, marginRight));
263046
+ const bodyTop = Math.max(0, marginTop);
263047
+ const bodyBottom = Math.min(pageHeight, pageHeight - Math.max(0, marginBottom));
263048
+ if (bodyLeft >= bodyRight || bodyTop >= bodyBottom)
263049
+ return false;
263050
+ return x < bodyLeft || x > bodyRight || pageLocalY < bodyTop || pageLocalY > bodyBottom;
263051
+ }
261925
263052
  function getCommentHighlightThreadIds(target) {
261926
263053
  if (!(target instanceof Element))
261927
263054
  return [];
@@ -261936,7 +263063,7 @@ function isDirectSingleCommentHighlightHit(target) {
261936
263063
  function isDirectTrackedChangeHit(target) {
261937
263064
  if (!(target instanceof Element))
261938
263065
  return false;
261939
- return target.closest(TRACK_CHANGE_SELECTOR) != null;
263066
+ return target.closest(`${TRACK_CHANGE_SELECTOR}, ${PM_TRACK_CHANGE_SELECTOR}`) != null;
261940
263067
  }
261941
263068
  function resolveTrackChangeThreadId(target) {
261942
263069
  if (!(target instanceof Element))
@@ -270073,7 +271200,7 @@ var Node$13 = class Node$14 {
270073
271200
  if (handled && dispatch)
270074
271201
  dispatch(tr);
270075
271202
  return handled;
270076
- }, insertListItemAt = ({ pos, position: position4, text: text5 = "", sdBlockId, tracked }) => ({ state, dispatch }) => {
271203
+ }, insertListItemAt = ({ pos, position: position4, text: text5 = "", sdBlockId, paraId, tracked }) => ({ state, dispatch }) => {
270077
271204
  if (!Number.isInteger(pos) || pos < 0 || pos > state.doc.content.size)
270078
271205
  return false;
270079
271206
  if (position4 !== "before" && position4 !== "after")
@@ -270096,7 +271223,7 @@ var Node$13 = class Node$14 {
270096
271223
  const attrs = {
270097
271224
  ...targetNode.attrs ?? {},
270098
271225
  sdBlockId: sdBlockId ?? null,
270099
- paraId: null,
271226
+ paraId: paraId ?? null,
270100
271227
  textId: null,
270101
271228
  listRendering: null,
270102
271229
  paragraphProperties: newParagraphProperties,
@@ -272019,7 +273146,7 @@ var Node$13 = class Node$14 {
272019
273146
  return false;
272020
273147
  editor.commands.deleteTable();
272021
273148
  return true;
272022
- }, createTableBorders = (borderSpec = {}) => {
273149
+ }, TABLE_BORDER_SIDES, createTableBorders = (borderSpec = {}) => {
272023
273150
  borderSpec = {
272024
273151
  size: 0.66665,
272025
273152
  color: "#000000",
@@ -278051,7 +279178,7 @@ var Node$13 = class Node$14 {
278051
279178
  debugGlobal.__SD_DEBUG_STORY_INPUT_LOG__ = existingLog;
278052
279179
  }, isStorySurfaceEditor = (editor) => {
278053
279180
  const documentId = editor?.options?.documentId ?? "";
278054
- return documentId.startsWith("hf:") || documentId.startsWith("fn:") || documentId.startsWith("en:");
279181
+ return documentId.startsWith("hf:") || documentId.startsWith("fn:") || documentId.startsWith("en:") || editor?.options?.isHeaderOrFooter === true || editor?.options?.headerFooterType === "header" || editor?.options?.headerFooterType === "footer";
278055
279182
  }, recordStoryInputDebug = (view, event, editor, phase, extra = {}) => {
278056
279183
  if (!isStorySurfaceEditor(editor))
278057
279184
  return;
@@ -278094,6 +279221,12 @@ var Node$13 = class Node$14 {
278094
279221
  return false;
278095
279222
  }
278096
279223
  const tr = view.state.tr.insertText(event.data, selection.from, selection.to);
279224
+ const insertedTo = Math.max(0, Math.min(selection.from + event.data.length, tr.doc.content.size));
279225
+ try {
279226
+ tr.setSelection(TextSelection.create(tr.doc, insertedTo));
279227
+ } catch {
279228
+ tr.setSelection(Selection.near(tr.doc.resolve(insertedTo), 1));
279229
+ }
278097
279230
  tr.setMeta("inputType", "insertText");
278098
279231
  view.dispatch(tr);
278099
279232
  event.preventDefault();
@@ -279272,7 +280405,7 @@ var Node$13 = class Node$14 {
279272
280405
  listener(snapshot2);
279273
280406
  } catch {}
279274
280407
  }
279275
- }, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, 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, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "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", relsPartDescriptor, BatchHistoryAdapter = class {
280408
+ }, TRACK_MARK_TYPE_BY_NAME, EMITTABLE_BLOCK_TYPES, SDT_BLOCK_NODE_NAMES, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, 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, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, HEADING_PATTERN, OOXML_DEFAULT_FONT_SIZE_PT = 10, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, SYMBOL_FONT_NAMES, RFONTS_FAMILY_ATTRS, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, PRESET_KIND_MAP, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, _setValueDelegate, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES$1, POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART$1 = "word/settings.xml", WORD_DEFAULT_TBL_LOOK, FLAG_TO_OOXML_KEY, INVERTED_FLAGS, XML_KEY_TO_STYLE_OPTION, CLEARED_BORDER_OOXML, TABLE_MARGIN_KEY_GROUPS, TABLE_ADAPTER_DISPATCH, ROW_TARGETED_TABLE_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "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", relsPartDescriptor, BatchHistoryAdapter = class {
279276
280409
  #done = [];
279277
280410
  #redone = [];
279278
280411
  #listeners = /* @__PURE__ */ new Set;
@@ -283994,13 +285127,10 @@ menclose::after {
283994
285127
  misses: this.#misses
283995
285128
  };
283996
285129
  }
283997
- }, EIGHTHS_PER_POINT = 8, MIN_BORDER_SIZE_PX = 0.5, MAX_BORDER_SIZE_PX = 100, borderSizeToPx = (size$1) => {
283998
- if (!isFiniteNumber(size$1))
283999
- return;
284000
- if (size$1 <= 0)
284001
- return 0;
284002
- const pixelValue = size$1 / EIGHTHS_PER_POINT * PX_PER_PT$12;
284003
- return Math.min(MAX_BORDER_SIZE_PX, Math.max(MIN_BORDER_SIZE_PX, pixelValue));
285130
+ }, MIN_BORDER_SIZE_PX2 = 0.5, MAX_BORDER_SIZE_PX2 = 100, borderSizeToPx = (size$1) => eighthPointsToPixels(size$1, { clamp: true }), clampPixelBorderWidth = (width) => Math.min(MAX_BORDER_SIZE_PX2, Math.max(MIN_BORDER_SIZE_PX2, width)), resolveBorderWidth = (size$1, unit) => {
285131
+ if (unit === "eighthPoints")
285132
+ return borderSizeToPx(size$1);
285133
+ return clampPixelBorderWidth(size$1);
284004
285134
  }, normalizeColorWithDefault = (color2) => {
284005
285135
  if (!color2 || color2 === "auto")
284006
285136
  return "#000000";
@@ -285498,7 +286628,7 @@ menclose::after {
285498
286628
  if (padding)
285499
286629
  inlinePadding = normalizeCellPaddingTopBottom(padding);
285500
286630
  if (tableProps.borders && typeof tableProps.borders === "object")
285501
- inlineBorders = clonePlainObject(tableProps.borders);
286631
+ inlineBorders = normalizeTableBorders(tableProps.borders);
285502
286632
  if (typeof tableProps.justification === "string")
285503
286633
  hydration.justification = tableProps.justification;
285504
286634
  const tableWidth = normalizeTableWidth(tableProps.tableWidth);
@@ -285509,11 +286639,11 @@ menclose::after {
285509
286639
  if (styleId && context?.translatedLinkedStyles) {
285510
286640
  const resolved = resolveTableProperties(styleId, context.translatedLinkedStyles);
285511
286641
  if (resolved.borders) {
285512
- const styleBorders = clonePlainObject(resolved.borders);
285513
- hydration.borders = inlineBorders ? {
286642
+ const styleBorders = normalizeTableBorders(resolved.borders);
286643
+ hydration.borders = inlineBorders && styleBorders ? {
285514
286644
  ...styleBorders,
285515
286645
  ...inlineBorders
285516
- } : styleBorders;
286646
+ } : inlineBorders ?? styleBorders;
285517
286647
  } else if (inlineBorders)
285518
286648
  hydration.borders = inlineBorders;
285519
286649
  if (resolved.cellMargins) {
@@ -285544,7 +286674,34 @@ menclose::after {
285544
286674
  hydration.cellPadding = inlinePadding;
285545
286675
  }
285546
286676
  return Object.keys(hydration).length > 0 ? hydration : null;
285547
- }, clonePlainObject = (value) => ({ ...value }), convertCellMarginsToPx = (margins) => {
286677
+ }, normalizeTableBorders = (value) => {
286678
+ if (!value)
286679
+ return;
286680
+ const sides = [
286681
+ "top",
286682
+ "bottom",
286683
+ "left",
286684
+ "right",
286685
+ "insideH",
286686
+ "insideV"
286687
+ ];
286688
+ const result = {};
286689
+ for (const side of sides) {
286690
+ const border = value[side];
286691
+ if (!border || typeof border !== "object")
286692
+ continue;
286693
+ const converted = convertTableBorderValue(adjustBorderSize(border));
286694
+ if (converted)
286695
+ result[side] = converted;
286696
+ }
286697
+ return Object.keys(result).length > 0 ? result : undefined;
286698
+ }, adjustBorderSize = (border) => {
286699
+ const size$1 = typeof border.size === "number" ? borderSizeToPx(border.size) : undefined;
286700
+ return size$1 != null ? {
286701
+ ...border,
286702
+ size: size$1
286703
+ } : border;
286704
+ }, convertCellMarginsToPx = (margins) => {
285548
286705
  if (!margins || typeof margins !== "object")
285549
286706
  return;
285550
286707
  const spacing = {};
@@ -285602,7 +286759,16 @@ menclose::after {
285602
286759
  width: raw,
285603
286760
  type: measurement.type
285604
286761
  };
285605
- }, isTableRowNode = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", normalizeRowHeight = (rowProps) => {
286762
+ }, isTableRowNode = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", convertResolvedCellBorder = (value) => {
286763
+ if (!value || typeof value !== "object")
286764
+ return;
286765
+ const border = value;
286766
+ const size$1 = typeof border.size === "number" ? borderSizeToPx(border.size) : undefined;
286767
+ return convertBorderSpec(size$1 != null ? {
286768
+ ...border,
286769
+ size: size$1
286770
+ } : border);
286771
+ }, normalizeRowHeight = (rowProps) => {
285606
286772
  if (!rowProps || typeof rowProps !== "object")
285607
286773
  return;
285608
286774
  const rawRowHeight = rowProps.rowHeight;
@@ -285798,7 +286964,7 @@ menclose::after {
285798
286964
  "bottom",
285799
286965
  "left"
285800
286966
  ]) {
285801
- const spec = convertBorderSpec(resolvedTcProps.borders[side]);
286967
+ const spec = convertResolvedCellBorder(resolvedTcProps.borders[side]);
285802
286968
  if (spec)
285803
286969
  resolvedBorders[side] = spec;
285804
286970
  }
@@ -288563,6 +289729,7 @@ menclose::after {
288563
289729
  return m$1.height;
288564
289730
  return 0;
288565
289731
  };
289732
+ let nearestParagraphHit = null;
288566
289733
  for (let i4 = 0;i4 < cellBlocks.length && i4 < cellBlockMeasures.length; i4++) {
288567
289734
  const cellBlock = cellBlocks[i4];
288568
289735
  const cellBlockMeasure = cellBlockMeasures[i4];
@@ -288582,9 +289749,7 @@ menclose::after {
288582
289749
  const cellLocalY = localY - rowY - (padding.top ?? 0);
288583
289750
  const paragraphBlock = cellBlock;
288584
289751
  const paragraphMeasure = cellBlockMeasure;
288585
- const isWithinBlock = cellLocalY >= blockStartY && cellLocalY < blockEndY;
288586
- const isLastParagraph = i4 === Math.min(cellBlocks.length, cellBlockMeasures.length) - 1;
288587
- if (isWithinBlock || isLastParagraph) {
289752
+ if (cellLocalY >= blockStartY && cellLocalY < blockEndY) {
288588
289753
  const unclampedLocalY = cellLocalY - blockStartY;
288589
289754
  const localYWithinBlock = Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0)));
288590
289755
  return {
@@ -288601,9 +289766,35 @@ menclose::after {
288601
289766
  blockStartGlobal: blockStartGlobalLines
288602
289767
  };
288603
289768
  }
289769
+ const distanceToBlock = cellLocalY < blockStartY ? blockStartY - cellLocalY : Math.max(0, cellLocalY - blockEndY);
289770
+ if (!nearestParagraphHit || distanceToBlock < nearestParagraphHit.distance) {
289771
+ const unclampedLocalY = cellLocalY - blockStartY;
289772
+ nearestParagraphHit = {
289773
+ cellBlock: paragraphBlock,
289774
+ cellMeasure: paragraphMeasure,
289775
+ localX: Math.max(0, cellLocalX),
289776
+ localY: Math.max(0, Math.min(unclampedLocalY, Math.max(blockHeight, 0))),
289777
+ blockStartGlobal: blockStartGlobalLines,
289778
+ distance: distanceToBlock
289779
+ };
289780
+ }
288604
289781
  blockStartY = blockEndY;
288605
289782
  blockStartGlobalLines += paragraphMeasure.lines.length;
288606
289783
  }
289784
+ if (nearestParagraphHit)
289785
+ return {
289786
+ fragment: tableFragment,
289787
+ block: tableBlock,
289788
+ measure: tableMeasure,
289789
+ pageIndex: pageHit.pageIndex,
289790
+ cellRowIndex: rowIndex,
289791
+ cellColIndex: colIndex,
289792
+ cellBlock: nearestParagraphHit.cellBlock,
289793
+ cellMeasure: nearestParagraphHit.cellMeasure,
289794
+ localX: nearestParagraphHit.localX,
289795
+ localY: nearestParagraphHit.localY,
289796
+ blockStartGlobal: nearestParagraphHit.blockStartGlobal
289797
+ };
288607
289798
  }
288608
289799
  return null;
288609
289800
  }, logSelectionMapDebug = (payload) => {}, rangesOverlap = (startA, endA, startB, endB) => {
@@ -290351,7 +291542,7 @@ menclose::after {
290351
291542
  this.#onCursorsUpdate = null;
290352
291543
  this.#isSetup = false;
290353
291544
  }
290354
- }, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, COMMENT_HIGHLIGHT_SELECTOR = ".superdoc-comment-highlight", TRACK_CHANGE_SELECTOR = "[data-track-change-id]", PM_TRACK_CHANGE_SELECTOR = ".track-insert[data-id], .track-delete[data-id], .track-format[data-id]", VISIBLE_HEADER_FOOTER_SELECTOR = ".superdoc-page-header, .superdoc-page-footer", VISIBLE_BODY_CONTENT_SELECTOR = ".superdoc-line, .superdoc-fragment, [data-block-id]", COMMENT_THREAD_HIT_TOLERANCE_PX = 3, COMMENT_THREAD_HIT_SAMPLE_OFFSETS, clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
291545
+ }, SEMANTIC_FOOTNOTES_HEADING_BLOCK_ID = "__sd_semantic_footnotes_heading", SEMANTIC_FOOTNOTE_BLOCK_ID_PREFIX = "__sd_semantic_footnote", MULTI_CLICK_TIME_THRESHOLD_MS = 400, MULTI_CLICK_DISTANCE_THRESHOLD_PX = 5, AUTO_SCROLL_EDGE_PX = 32, AUTO_SCROLL_MAX_SPEED_PX = 24, SCROLL_DETECTION_TOLERANCE_PX = 1, DEFAULT_PAGE_MARGIN_PX = 72, COMMENT_HIGHLIGHT_SELECTOR = ".superdoc-comment-highlight", TRACK_CHANGE_SELECTOR = "[data-track-change-id]", PM_TRACK_CHANGE_SELECTOR = ".track-insert[data-id], .track-delete[data-id], .track-format[data-id]", VISIBLE_HEADER_FOOTER_SELECTOR = ".superdoc-page-header, .superdoc-page-footer", VISIBLE_BODY_CONTENT_SELECTOR = ".superdoc-line, .superdoc-fragment, [data-block-id]", COMMENT_THREAD_HIT_TOLERANCE_PX = 3, COMMENT_THREAD_HIT_SAMPLE_OFFSETS, clamp = (value, min$2, max$2) => Math.max(min$2, Math.min(max$2, value)), EditorInputManager = class {
290355
291546
  #deps = null;
290356
291547
  #callbacks = {};
290357
291548
  #isDragging = false;
@@ -290871,6 +292062,16 @@ menclose::after {
290871
292062
  #handlePointerDown(event) {
290872
292063
  if (!this.#deps)
290873
292064
  return;
292065
+ const bodyEditor = this.#deps.getEditor();
292066
+ bodyEditor.emit?.("pointerDown", {
292067
+ editor: bodyEditor,
292068
+ event
292069
+ });
292070
+ if (event.button === 2 || event.ctrlKey && navigator.platform.includes("Mac"))
292071
+ bodyEditor.emit?.("rightClick", {
292072
+ editor: bodyEditor,
292073
+ event
292074
+ });
290874
292075
  if (event.button !== 0)
290875
292076
  return;
290876
292077
  if (event.ctrlKey && navigator.platform.includes("Mac"))
@@ -290891,7 +292092,6 @@ menclose::after {
290891
292092
  this.#handleAnnotationClick(event, annotationEl);
290892
292093
  return;
290893
292094
  }
290894
- const bodyEditor = this.#deps.getEditor();
290895
292095
  const layoutState = this.#deps.getLayoutState();
290896
292096
  const clickedNoteTarget = this.#resolveRenderedNoteTargetAtPointer(target, event.clientX, event.clientY);
290897
292097
  const sessionMode = this.#deps.getHeaderFooterSession()?.session?.mode ?? "body";
@@ -290974,6 +292174,11 @@ menclose::after {
290974
292174
  return;
290975
292175
  }
290976
292176
  }
292177
+ if (!useActiveSurfaceHitTest && isOutsidePageBodyContent(layoutState.layout, x, normalizedPoint.pageIndex, normalizedPoint.pageLocalY)) {
292178
+ event.preventDefault();
292179
+ this.#focusEditor();
292180
+ return;
292181
+ }
290977
292182
  const { rawHit, hit } = this.#resolveSelectionPointerHit({
290978
292183
  layoutState,
290979
292184
  normalized: {
@@ -291029,10 +292234,10 @@ menclose::after {
291029
292234
  }
291030
292235
  }
291031
292236
  if (!rawHit) {
291032
- this.#focusEditorAtFirstPosition();
292237
+ this.#focusEditor();
291033
292238
  return;
291034
292239
  }
291035
- if (isNoteEditing && activeNoteTarget && parseRenderedNoteTarget$1(rawHit.blockId)?.noteId !== activeNoteTarget.noteId) {
292240
+ if (isNoteEditing && activeNoteTarget && !isSameRenderedNoteTarget(parseRenderedNoteTarget$1(rawHit.blockId), activeNoteTarget)) {
291036
292241
  this.#callbacks.exitActiveStorySession?.();
291037
292242
  this.#focusEditor();
291038
292243
  return;
@@ -291171,6 +292376,11 @@ menclose::after {
291171
292376
  #handlePointerUp(event) {
291172
292377
  if (!this.#deps)
291173
292378
  return;
292379
+ const editor = this.#deps.getEditor();
292380
+ editor.emit?.("pointerUp", {
292381
+ editor,
292382
+ event
292383
+ });
291174
292384
  this.#suppressFocusInFromDraggable = false;
291175
292385
  if (!this.#isDragging) {
291176
292386
  this.#stopAutoScroll();
@@ -291374,16 +292584,20 @@ menclose::after {
291374
292584
  #findStructuredContentBlockAtPos(doc$12, pos) {
291375
292585
  if (!Number.isFinite(pos))
291376
292586
  return null;
291377
- const $pos = doc$12.resolve(pos);
291378
- for (let depth = $pos.depth;depth > 0; depth--) {
291379
- const node3 = $pos.node(depth);
291380
- if (node3.type?.name === "structuredContentBlock")
291381
- return {
291382
- node: node3,
291383
- pos: $pos.before(depth),
291384
- start: $pos.start(depth),
291385
- end: $pos.end(depth)
291386
- };
292587
+ try {
292588
+ const $pos = doc$12.resolve(pos);
292589
+ for (let depth = $pos.depth;depth > 0; depth--) {
292590
+ const node3 = $pos.node(depth);
292591
+ if (node3.type?.name === "structuredContentBlock")
292592
+ return {
292593
+ node: node3,
292594
+ pos: $pos.before(depth),
292595
+ start: $pos.start(depth),
292596
+ end: $pos.end(depth)
292597
+ };
292598
+ }
292599
+ } catch {
292600
+ return null;
291387
292601
  }
291388
292602
  return null;
291389
292603
  }
@@ -291431,16 +292645,20 @@ menclose::after {
291431
292645
  #findStructuredContentInlineAtPos(doc$12, pos) {
291432
292646
  if (!Number.isFinite(pos))
291433
292647
  return null;
291434
- const $pos = doc$12.resolve(pos);
291435
- for (let depth = $pos.depth;depth > 0; depth--) {
291436
- const node3 = $pos.node(depth);
291437
- if (node3.type?.name === "structuredContent")
291438
- return {
291439
- node: node3,
291440
- pos: $pos.before(depth),
291441
- start: $pos.start(depth),
291442
- end: $pos.end(depth)
291443
- };
292648
+ try {
292649
+ const $pos = doc$12.resolve(pos);
292650
+ for (let depth = $pos.depth;depth > 0; depth--) {
292651
+ const node3 = $pos.node(depth);
292652
+ if (node3.type?.name === "structuredContent")
292653
+ return {
292654
+ node: node3,
292655
+ pos: $pos.before(depth),
292656
+ start: $pos.start(depth),
292657
+ end: $pos.end(depth)
292658
+ };
292659
+ }
292660
+ } catch {
292661
+ return null;
291444
292662
  }
291445
292663
  return null;
291446
292664
  }
@@ -291937,8 +293155,10 @@ menclose::after {
291937
293155
  if (!editorDom)
291938
293156
  return;
291939
293157
  const active = document.activeElement;
291940
- if (active === editorDom || !!active && editorDom.contains?.(active))
293158
+ if (active === editorDom || !!active && editorDom.contains?.(active)) {
293159
+ this.#focusEditorView(view);
291941
293160
  return;
293161
+ }
291942
293162
  if (active instanceof HTMLElement)
291943
293163
  active.blur();
291944
293164
  editorDom.focus();
@@ -294882,18 +296102,18 @@ menclose::after {
294882
296102
  return;
294883
296103
  console.log(...args$1);
294884
296104
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
294885
- var init_src_CjxSHf0p_es = __esm(() => {
296105
+ var init_src_BQTDR8tR_es = __esm(() => {
294886
296106
  init_rolldown_runtime_Bg48TavK_es();
294887
- init_SuperConverter_2Pu0hMB1_es();
296107
+ init_SuperConverter_lmyr0gmB_es();
294888
296108
  init_jszip_C49i9kUs_es();
294889
296109
  init_uuid_qzgm05fK_es();
294890
- init_create_headless_toolbar_sMwtuYL8_es();
294891
- init_constants_CGhJRd87_es();
296110
+ init_create_headless_toolbar_CVKqElqj_es();
296111
+ init_constants_DrU4EASo_es();
294892
296112
  init_dist_B8HfvhaK_es();
294893
296113
  init_unified_Dsuw2be5_es();
294894
296114
  init_remark_gfm_BhnWr3yf_es();
294895
296115
  init_remark_stringify_6MMJfY0k_es();
294896
- init_DocxZipper_BBjEXAFw_es();
296116
+ init_DocxZipper_CwFyjl1b_es();
294897
296117
  init__plugin_vue_export_helper_HmhZBO0u_es();
294898
296118
  init_eventemitter3_BdNugZrm_es();
294899
296119
  init_errors_CtyzHiH4_es();
@@ -298832,6 +300052,14 @@ ${err.toString()}`);
298832
300052
  } };
298833
300053
  }
298834
300054
  });
300055
+ TABLE_BORDER_SIDES = [
300056
+ "top",
300057
+ "bottom",
300058
+ "left",
300059
+ "right",
300060
+ "insideH",
300061
+ "insideV"
300062
+ ];
298835
300063
  TABLE_CELL_ROLES = new Set(["cell", "header_cell"]);
298836
300064
  TableBoundaryNavigationPluginKey = new PluginKey("tableBoundaryNavigation");
298837
300065
  Table = Node$13.create({
@@ -317534,6 +318762,11 @@ function print() { __p += __j.call(arguments, '') }
317534
318762
  "image"
317535
318763
  ]);
317536
318764
  indexByHost = /* @__PURE__ */ new WeakMap;
318765
+ TRACK_MARK_TYPE_BY_NAME = {
318766
+ [TrackInsertMarkName]: "insert",
318767
+ [TrackDeleteMarkName]: "delete",
318768
+ [TrackFormatMarkName]: "format"
318769
+ };
317537
318770
  EMITTABLE_BLOCK_TYPES = new Set([
317538
318771
  "paragraph",
317539
318772
  "heading",
@@ -318607,6 +319840,9 @@ function print() { __p += __j.call(arguments, '') }
318607
319840
  onCommentsLoaded: () => null,
318608
319841
  onCommentClicked: () => null,
318609
319842
  onCommentLocationsUpdate: () => null,
319843
+ onPointerDown: () => null,
319844
+ onPointerUp: () => null,
319845
+ onRightClick: () => null,
318610
319846
  onDocumentLocked: () => null,
318611
319847
  onFirstRender: () => null,
318612
319848
  onCollaborationReady: () => null,
@@ -318690,7 +319926,7 @@ function print() { __p += __j.call(arguments, '') }
318690
319926
  const { telemetry: telemetryConfig, licenseKey } = this.options;
318691
319927
  if (typeof process$12 !== "undefined" && (process$12.env?.VITEST || process$12.env.NODE_ENV === "test"))
318692
319928
  return;
318693
- if (this.options.mode === "text" || this.options.isHeaderOrFooter)
319929
+ if (this.options.mode === "text" || this.options.isHeaderOrFooter || this.options.isChildEditor)
318694
319930
  return;
318695
319931
  if (!telemetryConfig?.enabled)
318696
319932
  return;
@@ -318757,6 +319993,9 @@ function print() { __p += __j.call(arguments, '') }
318757
319993
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
318758
319994
  this.on("fonts-resolved", this.options.onFontsResolved);
318759
319995
  this.on("exception", this.options.onException);
319996
+ this.on("pointerDown", this.options.onPointerDown);
319997
+ this.on("pointerUp", this.options.onPointerUp);
319998
+ this.on("rightClick", this.options.onRightClick);
318760
319999
  }
318761
320000
  async#loadDocument(source, options) {
318762
320001
  try {
@@ -318963,6 +320202,9 @@ function print() { __p += __j.call(arguments, '') }
318963
320202
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
318964
320203
  this.on("fonts-resolved", this.options.onFontsResolved);
318965
320204
  this.on("exception", this.options.onException);
320205
+ this.on("pointerDown", this.options.onPointerDown);
320206
+ this.on("pointerUp", this.options.onPointerUp);
320207
+ this.on("rightClick", this.options.onRightClick);
318966
320208
  if (!shouldMountRenderer)
318967
320209
  this.#emitCreateAsync();
318968
320210
  this.initializeCollaborationData();
@@ -319008,6 +320250,9 @@ function print() { __p += __j.call(arguments, '') }
319008
320250
  this.on("commentClick", this.options.onCommentClicked);
319009
320251
  this.on("locked", this.options.onDocumentLocked);
319010
320252
  this.on("list-definitions-change", this.options.onListDefinitionsChange);
320253
+ this.on("pointerDown", this.options.onPointerDown);
320254
+ this.on("pointerUp", this.options.onPointerUp);
320255
+ this.on("rightClick", this.options.onRightClick);
319011
320256
  if (!shouldMountRenderer)
319012
320257
  this.#emitCreateAsync();
319013
320258
  }
@@ -322181,13 +323426,17 @@ function print() { __p += __j.call(arguments, '') }
322181
323426
  getDecorationAnchorPageOriginY(pageEl, page, kind, effectiveOffset, resolvedPage) {
322182
323427
  if (kind === "header")
322183
323428
  return effectiveOffset;
322184
- const bottomMargin = (resolvedPage?.margins ?? page.margins)?.bottom;
323429
+ const pageMargins = resolvedPage?.margins ?? page.margins;
323430
+ const styledPageHeight = Number.parseFloat(pageEl.style.height || "");
323431
+ const pageHeight = page.size?.h ?? this.currentLayout?.pageSize?.h ?? (Number.isFinite(styledPageHeight) ? styledPageHeight : pageEl.clientHeight);
323432
+ const footerDistance = pageMargins?.footer;
323433
+ if (typeof footerDistance === "number" && Number.isFinite(footerDistance))
323434
+ return Math.max(0, pageHeight - Math.max(0, footerDistance));
323435
+ const bottomMargin = pageMargins?.bottom;
322185
323436
  if (bottomMargin == null)
322186
323437
  return effectiveOffset;
322187
323438
  const footnoteReserve = resolvedPage?.footnoteReserved ?? page.footnoteReserved ?? 0;
322188
323439
  const adjustedBottomMargin = Math.max(0, bottomMargin - footnoteReserve);
322189
- const styledPageHeight = Number.parseFloat(pageEl.style.height || "");
322190
- const pageHeight = page.size?.h ?? this.currentLayout?.pageSize?.h ?? (Number.isFinite(styledPageHeight) ? styledPageHeight : pageEl.clientHeight);
322191
323440
  return Math.max(0, pageHeight - adjustedBottomMargin);
322192
323441
  }
322193
323442
  renderDecorationSection(pageEl, page, pageIndex, kind, resolvedPage) {
@@ -324704,6 +325953,7 @@ function print() { __p += __j.call(arguments, '') }
324704
325953
  geoSdtWrapper.style.top = "0px";
324705
325954
  geoSdtWrapper.style.height = `${line.lineHeight}px`;
324706
325955
  }
325956
+ this.syncInlineSdtWrapperTypography(geoSdtWrapper, runForSdt);
324707
325957
  elem.style.left = `${elemLeftPx - geoSdtWrapperLeft}px`;
324708
325958
  geoSdtMaxRight = Math.max(geoSdtMaxRight, elemLeftPx + elemWidthPx);
324709
325959
  this.expandSdtWrapperPmRange(geoSdtWrapper, runForSdt.pmStart, runForSdt.pmEnd);
@@ -324891,6 +326141,7 @@ function print() { __p += __j.call(arguments, '') }
324891
326141
  if (resolved && this.doc) {
324892
326142
  if (!currentInlineSdtWrapper) {
324893
326143
  currentInlineSdtWrapper = this.createInlineSdtWrapper(resolved.sdt);
326144
+ this.syncInlineSdtWrapperTypography(currentInlineSdtWrapper, run2);
324894
326145
  currentInlineSdtId = runSdtId;
324895
326146
  }
324896
326147
  this.expandSdtWrapperPmRange(currentInlineSdtWrapper, run2.pmStart, run2.pmEnd);
@@ -325112,6 +326363,11 @@ function print() { __p += __j.call(arguments, '') }
325112
326363
  wrapper.appendChild(labelEl);
325113
326364
  return wrapper;
325114
326365
  }
326366
+ syncInlineSdtWrapperTypography(wrapper, runForSizing) {
326367
+ const runFontSize = runForSizing && "fontSize" in runForSizing && typeof runForSizing.fontSize === "number" ? `${runForSizing.fontSize}px` : BROWSER_DEFAULT_FONT_SIZE;
326368
+ wrapper.style.fontSize = runFontSize;
326369
+ wrapper.style.lineHeight = "normal";
326370
+ }
325115
326371
  expandSdtWrapperPmRange(wrapper, pmStart, pmEnd) {
325116
326372
  if (pmStart != null) {
325117
326373
  const cur = wrapper.dataset.pmStart;
@@ -330122,7 +331378,8 @@ function print() { __p += __j.call(arguments, '') }
330122
331378
  right: marginRight,
330123
331379
  top: marginTop,
330124
331380
  bottom: marginBottom,
330125
- header: headerMargin
331381
+ header: headerMargin,
331382
+ ...margins.footer != null ? { footer: footerMargin } : {}
330126
331383
  },
330127
331384
  overflowBaseHeight
330128
331385
  };
@@ -331748,15 +333005,15 @@ var init_zipper_DbkgrypV_es = __esm(() => {
331748
333005
 
331749
333006
  // ../../packages/superdoc/dist/super-editor.es.js
331750
333007
  var init_super_editor_es = __esm(() => {
331751
- init_src_CjxSHf0p_es();
331752
- init_SuperConverter_2Pu0hMB1_es();
333008
+ init_src_BQTDR8tR_es();
333009
+ init_SuperConverter_lmyr0gmB_es();
331753
333010
  init_jszip_C49i9kUs_es();
331754
333011
  init_xml_js_CqGKpaft_es();
331755
- init_create_headless_toolbar_sMwtuYL8_es();
331756
- init_constants_CGhJRd87_es();
333012
+ init_create_headless_toolbar_CVKqElqj_es();
333013
+ init_constants_DrU4EASo_es();
331757
333014
  init_dist_B8HfvhaK_es();
331758
333015
  init_unified_Dsuw2be5_es();
331759
- init_DocxZipper_BBjEXAFw_es();
333016
+ init_DocxZipper_CwFyjl1b_es();
331760
333017
  init_eventemitter3_BdNugZrm_es();
331761
333018
  init_errors_CtyzHiH4_es();
331762
333019
  init_zipper_DbkgrypV_es();