@superdoc-dev/cli 0.3.0-next.26 → 0.3.0-next.28

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 +2264 -479
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -2218,15 +2218,15 @@ var init_operation_definitions = __esm(() => {
2218
2218
  },
2219
2219
  "lists.create": {
2220
2220
  memberPath: "lists.create",
2221
- description: "Create a new list from one or more paragraphs, or convert existing paragraphs into a new list.",
2221
+ description: 'Create a new list from one or more paragraphs. Supports optional preset or style for new sequences. When sequence.mode is "continuePrevious", preset and style are not allowed — the new items inherit formatting from the previous sequence.',
2222
2222
  expectedResult: "Returns a ListsCreateResult with the new listId and the first item address.",
2223
2223
  requiresDocumentContext: true,
2224
2224
  metadata: mutationOperation({
2225
2225
  idempotency: "non-idempotent",
2226
2226
  supportsDryRun: true,
2227
2227
  supportsTrackedMode: false,
2228
- possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE"],
2229
- throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2228
+ possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE", "INVALID_INPUT", "NO_COMPATIBLE_PREVIOUS"],
2229
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2230
2230
  }),
2231
2231
  referenceDocPath: "lists/create.mdx",
2232
2232
  referenceGroup: "lists",
@@ -2437,7 +2437,7 @@ var init_operation_definitions = __esm(() => {
2437
2437
  },
2438
2438
  "lists.applyTemplate": {
2439
2439
  memberPath: "lists.applyTemplate",
2440
- description: "Apply a captured ListTemplate to the target list, optionally filtered to specific levels.",
2440
+ description: "Advanced alias for lists.applyStyle. Apply a captured ListTemplate to the target list (abstract-scoped, no clone-on-write).",
2441
2441
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
2442
2442
  requiresDocumentContext: true,
2443
2443
  metadata: mutationOperation({
@@ -2484,7 +2484,7 @@ var init_operation_definitions = __esm(() => {
2484
2484
  },
2485
2485
  "lists.captureTemplate": {
2486
2486
  memberPath: "lists.captureTemplate",
2487
- description: "Capture the formatting of a list as a reusable ListTemplate.",
2487
+ description: "Advanced alias for lists.getStyle. Capture list formatting from the abstract definition only (does not merge lvlOverride formatting).",
2488
2488
  expectedResult: "Returns a ListsCaptureTemplateResult containing the captured template.",
2489
2489
  requiresDocumentContext: true,
2490
2490
  metadata: readOperation({
@@ -2497,7 +2497,7 @@ var init_operation_definitions = __esm(() => {
2497
2497
  },
2498
2498
  "lists.setLevelNumbering": {
2499
2499
  memberPath: "lists.setLevelNumbering",
2500
- description: "Set the numbering format, pattern, and optional start value for a specific list level.",
2500
+ description: "Advanced alias for lists.setLevelNumberStyle/setLevelText/setLevelStart. Set format, pattern, and start in one call (abstract-scoped, no clone-on-write).",
2501
2501
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the level already matches.",
2502
2502
  requiresDocumentContext: true,
2503
2503
  metadata: mutationOperation({
@@ -2622,6 +2622,109 @@ var init_operation_definitions = __esm(() => {
2622
2622
  referenceDocPath: "lists/clear-level-overrides.mdx",
2623
2623
  referenceGroup: "lists"
2624
2624
  },
2625
+ "lists.getStyle": {
2626
+ memberPath: "lists.getStyle",
2627
+ description: "Read the effective reusable style of a list, including instance-level overrides. Returns a ListStyle that can be applied to other lists via lists.applyStyle.",
2628
+ expectedResult: "Returns a ListsGetStyleResult containing the captured style.",
2629
+ requiresDocumentContext: true,
2630
+ metadata: readOperation({
2631
+ idempotency: "idempotent",
2632
+ throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT"],
2633
+ possibleFailureCodes: ["INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE"]
2634
+ }),
2635
+ referenceDocPath: "lists/get-style.mdx",
2636
+ referenceGroup: "lists"
2637
+ },
2638
+ "lists.applyStyle": {
2639
+ memberPath: "lists.applyStyle",
2640
+ description: "Apply a reusable list style to the target list. Sequence-local: if the abstract definition is shared with other lists, it is cloned first to avoid affecting them.",
2641
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
2642
+ requiresDocumentContext: true,
2643
+ metadata: mutationOperation({
2644
+ idempotency: "conditional",
2645
+ supportsDryRun: true,
2646
+ supportsTrackedMode: false,
2647
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE"],
2648
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2649
+ }),
2650
+ referenceDocPath: "lists/apply-style.mdx",
2651
+ referenceGroup: "lists"
2652
+ },
2653
+ "lists.restartAt": {
2654
+ memberPath: "lists.restartAt",
2655
+ description: "Restart numbering at the target list item with a specific value. If the item is mid-sequence, it is separated first.",
2656
+ expectedResult: "Returns a ListsMutateItemResult receipt.",
2657
+ requiresDocumentContext: true,
2658
+ metadata: mutationOperation({
2659
+ idempotency: "non-idempotent",
2660
+ supportsDryRun: true,
2661
+ supportsTrackedMode: false,
2662
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT"],
2663
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2664
+ }),
2665
+ referenceDocPath: "lists/restart-at.mdx",
2666
+ referenceGroup: "lists"
2667
+ },
2668
+ "lists.setLevelNumberStyle": {
2669
+ memberPath: "lists.setLevelNumberStyle",
2670
+ description: 'Set the numbering style (e.g. decimal, lowerLetter, upperRoman) for a specific list level. Rejects "bullet" — use setLevelBullet instead. Sequence-local: clones shared definitions.',
2671
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2672
+ requiresDocumentContext: true,
2673
+ metadata: mutationOperation({
2674
+ idempotency: "conditional",
2675
+ supportsDryRun: true,
2676
+ supportsTrackedMode: false,
2677
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2678
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2679
+ }),
2680
+ referenceDocPath: "lists/set-level-number-style.mdx",
2681
+ referenceGroup: "lists"
2682
+ },
2683
+ "lists.setLevelText": {
2684
+ memberPath: "lists.setLevelText",
2685
+ description: 'Set the level text pattern (e.g. "%1.", "(%1)") for a specific list level. Uses OOXML level-placeholder syntax. Sequence-local: clones shared definitions.',
2686
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2687
+ requiresDocumentContext: true,
2688
+ metadata: mutationOperation({
2689
+ idempotency: "conditional",
2690
+ supportsDryRun: true,
2691
+ supportsTrackedMode: false,
2692
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2693
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET"]
2694
+ }),
2695
+ referenceDocPath: "lists/set-level-text.mdx",
2696
+ referenceGroup: "lists"
2697
+ },
2698
+ "lists.setLevelStart": {
2699
+ memberPath: "lists.setLevelStart",
2700
+ description: "Set the start value for a specific list level. Rejects bullet levels and non-positive values. Sequence-local: clones shared definitions.",
2701
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
2702
+ requiresDocumentContext: true,
2703
+ metadata: mutationOperation({
2704
+ idempotency: "conditional",
2705
+ supportsDryRun: true,
2706
+ supportsTrackedMode: false,
2707
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2708
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2709
+ }),
2710
+ referenceDocPath: "lists/set-level-start.mdx",
2711
+ referenceGroup: "lists"
2712
+ },
2713
+ "lists.setLevelLayout": {
2714
+ memberPath: "lists.setLevelLayout",
2715
+ description: "Set the layout properties (alignment, indentation, trailing character, tab stop) for a specific list level. Accepts partial updates — omitted fields are left unchanged. Sequence-local: clones shared definitions.",
2716
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all values already match.",
2717
+ requiresDocumentContext: true,
2718
+ metadata: mutationOperation({
2719
+ idempotency: "conditional",
2720
+ supportsDryRun: true,
2721
+ supportsTrackedMode: false,
2722
+ possibleFailureCodes: ["NO_OP", "INVALID_TARGET", "INVALID_INPUT", "LEVEL_OUT_OF_RANGE", "LEVEL_NOT_FOUND"],
2723
+ throws: [...T_NOT_FOUND_CAPABLE, "INVALID_TARGET", "INVALID_INPUT"]
2724
+ }),
2725
+ referenceDocPath: "lists/set-level-layout.mdx",
2726
+ referenceGroup: "lists"
2727
+ },
2625
2728
  "comments.create": {
2626
2729
  memberPath: "comments.create",
2627
2730
  description: "Create a new comment thread (or reply when parentCommentId is given).",
@@ -9477,13 +9580,65 @@ var init_schemas = __esm(() => {
9477
9580
  at: ref("BlockAddress"),
9478
9581
  target: ref("BlockAddressOrRange"),
9479
9582
  kind: listKindSchema,
9480
- level: { type: "integer", minimum: 0, maximum: 8 }
9583
+ level: { type: "integer", minimum: 0, maximum: 8 },
9584
+ preset: {
9585
+ enum: [
9586
+ "decimal",
9587
+ "decimalParenthesis",
9588
+ "lowerLetter",
9589
+ "upperLetter",
9590
+ "lowerRoman",
9591
+ "upperRoman",
9592
+ "disc",
9593
+ "circle",
9594
+ "square",
9595
+ "dash"
9596
+ ]
9597
+ },
9598
+ style: objectSchema({
9599
+ version: { const: 1 },
9600
+ levels: arraySchema(objectSchema({
9601
+ level: { type: "integer", minimum: 0, maximum: 8 },
9602
+ numFmt: { type: "string" },
9603
+ lvlText: { type: "string" },
9604
+ start: { type: "integer" },
9605
+ alignment: { enum: ["left", "center", "right"] },
9606
+ indents: objectSchema({
9607
+ left: { type: "integer" },
9608
+ hanging: { type: "integer" },
9609
+ firstLine: { type: "integer" }
9610
+ }),
9611
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
9612
+ markerFont: { type: "string" },
9613
+ pictureBulletId: { type: "integer" },
9614
+ tabStopAt: { type: ["integer", "null"] }
9615
+ }, ["level"]))
9616
+ }, ["version", "levels"]),
9617
+ sequence: {
9618
+ oneOf: [
9619
+ objectSchema({ mode: { const: "new" }, startAt: { type: "integer", minimum: 1 } }, ["mode"]),
9620
+ objectSchema({ mode: { const: "continuePrevious" } }, ["mode"])
9621
+ ]
9622
+ }
9481
9623
  },
9482
- required: ["mode", "kind"],
9624
+ required: ["mode"],
9483
9625
  additionalProperties: false,
9484
- if: { properties: { mode: { const: "empty" } } },
9485
- then: { required: ["mode", "kind", "at"] },
9486
- else: { required: ["mode", "kind", "target"] }
9626
+ allOf: [
9627
+ {
9628
+ if: { properties: { mode: { const: "empty" } } },
9629
+ then: { required: ["mode", "at"] },
9630
+ else: { required: ["mode", "target"] }
9631
+ },
9632
+ {
9633
+ if: {
9634
+ properties: { sequence: { properties: { mode: { const: "continuePrevious" } }, required: ["mode"] } },
9635
+ required: ["sequence"]
9636
+ },
9637
+ then: {
9638
+ not: { anyOf: [{ required: ["preset"] }, { required: ["style"] }] }
9639
+ }
9640
+ }
9641
+ ]
9487
9642
  },
9488
9643
  output: {
9489
9644
  oneOf: [
@@ -9831,6 +9986,124 @@ var init_schemas = __esm(() => {
9831
9986
  success: listsMutateItemSuccessSchema,
9832
9987
  failure: listsFailureSchemaFor("lists.clearLevelOverrides")
9833
9988
  },
9989
+ "lists.getStyle": (() => {
9990
+ const listLevelTemplateSchema = objectSchema({
9991
+ level: { type: "integer", minimum: 0, maximum: 8 },
9992
+ numFmt: { type: "string" },
9993
+ lvlText: { type: "string" },
9994
+ start: { type: "integer" },
9995
+ alignment: { enum: ["left", "center", "right"] },
9996
+ indents: objectSchema({
9997
+ left: { type: "integer" },
9998
+ hanging: { type: "integer" },
9999
+ firstLine: { type: "integer" }
10000
+ }),
10001
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
10002
+ markerFont: { type: "string" },
10003
+ pictureBulletId: { type: "integer" },
10004
+ tabStopAt: { type: ["integer", "null"] }
10005
+ }, ["level"]);
10006
+ const styleSchema = objectSchema({
10007
+ version: { const: 1 },
10008
+ levels: arraySchema(listLevelTemplateSchema)
10009
+ }, ["version", "levels"]);
10010
+ const successSchema = objectSchema({
10011
+ success: { const: true },
10012
+ style: styleSchema
10013
+ }, ["success", "style"]);
10014
+ return {
10015
+ input: objectSchema({
10016
+ target: listItemAddressSchema,
10017
+ levels: arraySchema({ type: "integer", minimum: 0, maximum: 8 })
10018
+ }, ["target"]),
10019
+ output: { oneOf: [successSchema, listsFailureSchemaFor("lists.getStyle")] },
10020
+ success: successSchema,
10021
+ failure: listsFailureSchemaFor("lists.getStyle")
10022
+ };
10023
+ })(),
10024
+ "lists.applyStyle": {
10025
+ input: objectSchema({
10026
+ target: listItemAddressSchema,
10027
+ style: objectSchema({
10028
+ version: { const: 1 },
10029
+ levels: arraySchema(objectSchema({
10030
+ level: { type: "integer", minimum: 0, maximum: 8 },
10031
+ numFmt: { type: "string" },
10032
+ lvlText: { type: "string" },
10033
+ start: { type: "integer" },
10034
+ alignment: { enum: ["left", "center", "right"] },
10035
+ indents: objectSchema({
10036
+ left: { type: "integer" },
10037
+ hanging: { type: "integer" },
10038
+ firstLine: { type: "integer" }
10039
+ }),
10040
+ trailingCharacter: { enum: ["tab", "space", "nothing"] },
10041
+ markerFont: { type: "string" },
10042
+ pictureBulletId: { type: "integer" },
10043
+ tabStopAt: { type: ["integer", "null"] }
10044
+ }, ["level"]))
10045
+ }, ["version", "levels"]),
10046
+ levels: arraySchema({ type: "integer", minimum: 0, maximum: 8 })
10047
+ }, ["target", "style"]),
10048
+ output: listsMutateItemResultSchemaFor("lists.applyStyle"),
10049
+ success: listsMutateItemSuccessSchema,
10050
+ failure: listsFailureSchemaFor("lists.applyStyle")
10051
+ },
10052
+ "lists.restartAt": {
10053
+ input: objectSchema({
10054
+ target: listItemAddressSchema,
10055
+ startAt: { type: "integer", minimum: 1 }
10056
+ }, ["target", "startAt"]),
10057
+ output: listsMutateItemResultSchemaFor("lists.restartAt"),
10058
+ success: listsMutateItemSuccessSchema,
10059
+ failure: listsFailureSchemaFor("lists.restartAt")
10060
+ },
10061
+ "lists.setLevelNumberStyle": {
10062
+ input: objectSchema({
10063
+ target: listItemAddressSchema,
10064
+ level: { type: "integer", minimum: 0, maximum: 8 },
10065
+ numberStyle: { type: "string" }
10066
+ }, ["target", "level", "numberStyle"]),
10067
+ output: listsMutateItemResultSchemaFor("lists.setLevelNumberStyle"),
10068
+ success: listsMutateItemSuccessSchema,
10069
+ failure: listsFailureSchemaFor("lists.setLevelNumberStyle")
10070
+ },
10071
+ "lists.setLevelText": {
10072
+ input: objectSchema({
10073
+ target: listItemAddressSchema,
10074
+ level: { type: "integer", minimum: 0, maximum: 8 },
10075
+ text: { type: "string" }
10076
+ }, ["target", "level", "text"]),
10077
+ output: listsMutateItemResultSchemaFor("lists.setLevelText"),
10078
+ success: listsMutateItemSuccessSchema,
10079
+ failure: listsFailureSchemaFor("lists.setLevelText")
10080
+ },
10081
+ "lists.setLevelStart": {
10082
+ input: objectSchema({
10083
+ target: listItemAddressSchema,
10084
+ level: { type: "integer", minimum: 0, maximum: 8 },
10085
+ startAt: { type: "integer", minimum: 1 }
10086
+ }, ["target", "level", "startAt"]),
10087
+ output: listsMutateItemResultSchemaFor("lists.setLevelStart"),
10088
+ success: listsMutateItemSuccessSchema,
10089
+ failure: listsFailureSchemaFor("lists.setLevelStart")
10090
+ },
10091
+ "lists.setLevelLayout": {
10092
+ input: objectSchema({
10093
+ target: listItemAddressSchema,
10094
+ level: { type: "integer", minimum: 0, maximum: 8 },
10095
+ layout: objectSchema({
10096
+ alignment: { enum: ["left", "center", "right"] },
10097
+ alignedAt: { type: "integer" },
10098
+ textIndentAt: { type: "integer" },
10099
+ followCharacter: { enum: ["tab", "space", "nothing"] },
10100
+ tabStopAt: { type: ["integer", "null"] }
10101
+ })
10102
+ }, ["target", "level", "layout"]),
10103
+ output: listsMutateItemResultSchemaFor("lists.setLevelLayout"),
10104
+ success: listsMutateItemSuccessSchema,
10105
+ failure: listsFailureSchemaFor("lists.setLevelLayout")
10106
+ },
9834
10107
  "comments.create": {
9835
10108
  input: objectSchema({
9836
10109
  text: { type: "string" },
@@ -13212,6 +13485,34 @@ function executeListsSetType(adapter, input, options) {
13212
13485
  validateListTarget(input, "lists.setType");
13213
13486
  return adapter.setType(input, normalizeMutationOptions(options));
13214
13487
  }
13488
+ function executeListsGetStyle(adapter, input) {
13489
+ validateListTarget(input, "lists.getStyle");
13490
+ return adapter.getStyle(input);
13491
+ }
13492
+ function executeListsApplyStyle(adapter, input, options) {
13493
+ validateListTarget(input, "lists.applyStyle");
13494
+ return adapter.applyStyle(input, normalizeMutationOptions(options));
13495
+ }
13496
+ function executeListsRestartAt(adapter, input, options) {
13497
+ validateListTarget(input, "lists.restartAt");
13498
+ return adapter.restartAt(input, normalizeMutationOptions(options));
13499
+ }
13500
+ function executeListsSetLevelNumberStyle(adapter, input, options) {
13501
+ validateListTarget(input, "lists.setLevelNumberStyle");
13502
+ return adapter.setLevelNumberStyle(input, normalizeMutationOptions(options));
13503
+ }
13504
+ function executeListsSetLevelText(adapter, input, options) {
13505
+ validateListTarget(input, "lists.setLevelText");
13506
+ return adapter.setLevelText(input, normalizeMutationOptions(options));
13507
+ }
13508
+ function executeListsSetLevelStart(adapter, input, options) {
13509
+ validateListTarget(input, "lists.setLevelStart");
13510
+ return adapter.setLevelStart(input, normalizeMutationOptions(options));
13511
+ }
13512
+ function executeListsSetLevelLayout(adapter, input, options) {
13513
+ validateListTarget(input, "lists.setLevelLayout");
13514
+ return adapter.setLevelLayout(input, normalizeMutationOptions(options));
13515
+ }
13215
13516
  var init_lists = __esm(() => {
13216
13517
  init_errors2();
13217
13518
  });
@@ -13673,6 +13974,13 @@ function buildDispatchTable(api) {
13673
13974
  "lists.setLevelTrailingCharacter": (input, options) => api.lists.setLevelTrailingCharacter(input, options),
13674
13975
  "lists.setLevelMarkerFont": (input, options) => api.lists.setLevelMarkerFont(input, options),
13675
13976
  "lists.clearLevelOverrides": (input, options) => api.lists.clearLevelOverrides(input, options),
13977
+ "lists.getStyle": (input) => api.lists.getStyle(input),
13978
+ "lists.applyStyle": (input, options) => api.lists.applyStyle(input, options),
13979
+ "lists.restartAt": (input, options) => api.lists.restartAt(input, options),
13980
+ "lists.setLevelNumberStyle": (input, options) => api.lists.setLevelNumberStyle(input, options),
13981
+ "lists.setLevelText": (input, options) => api.lists.setLevelText(input, options),
13982
+ "lists.setLevelStart": (input, options) => api.lists.setLevelStart(input, options),
13983
+ "lists.setLevelLayout": (input, options) => api.lists.setLevelLayout(input, options),
13676
13984
  "sections.list": (input) => api.sections.list(input),
13677
13985
  "sections.get": (input) => api.sections.get(input),
13678
13986
  "sections.setBreakType": (input, options) => api.sections.setBreakType(input, options),
@@ -15944,6 +16252,27 @@ function createDocumentApi(adapters) {
15944
16252
  },
15945
16253
  setType(input, options) {
15946
16254
  return executeListsSetType(adapters.lists, input, options);
16255
+ },
16256
+ getStyle(input) {
16257
+ return executeListsGetStyle(adapters.lists, input);
16258
+ },
16259
+ applyStyle(input, options) {
16260
+ return executeListsApplyStyle(adapters.lists, input, options);
16261
+ },
16262
+ restartAt(input, options) {
16263
+ return executeListsRestartAt(adapters.lists, input, options);
16264
+ },
16265
+ setLevelNumberStyle(input, options) {
16266
+ return executeListsSetLevelNumberStyle(adapters.lists, input, options);
16267
+ },
16268
+ setLevelText(input, options) {
16269
+ return executeListsSetLevelText(adapters.lists, input, options);
16270
+ },
16271
+ setLevelStart(input, options) {
16272
+ return executeListsSetLevelStart(adapters.lists, input, options);
16273
+ },
16274
+ setLevelLayout(input, options) {
16275
+ return executeListsSetLevelLayout(adapters.lists, input, options);
15947
16276
  }
15948
16277
  },
15949
16278
  sections: {
@@ -39004,7 +39333,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
39004
39333
  emptyOptions2 = {};
39005
39334
  });
39006
39335
 
39007
- // ../../packages/superdoc/dist/chunks/SuperConverter-BcBeadrv.es.js
39336
+ // ../../packages/superdoc/dist/chunks/SuperConverter-hOU3ez7P.es.js
39008
39337
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
39009
39338
  const fieldValue = extension$1.config[field];
39010
39339
  if (typeof fieldValue === "function")
@@ -42390,6 +42719,34 @@ function executeListsSetType2(adapter, input, options) {
42390
42719
  validateListTarget2(input, "lists.setType");
42391
42720
  return adapter.setType(input, normalizeMutationOptions2(options));
42392
42721
  }
42722
+ function executeListsGetStyle2(adapter, input) {
42723
+ validateListTarget2(input, "lists.getStyle");
42724
+ return adapter.getStyle(input);
42725
+ }
42726
+ function executeListsApplyStyle2(adapter, input, options) {
42727
+ validateListTarget2(input, "lists.applyStyle");
42728
+ return adapter.applyStyle(input, normalizeMutationOptions2(options));
42729
+ }
42730
+ function executeListsRestartAt2(adapter, input, options) {
42731
+ validateListTarget2(input, "lists.restartAt");
42732
+ return adapter.restartAt(input, normalizeMutationOptions2(options));
42733
+ }
42734
+ function executeListsSetLevelNumberStyle2(adapter, input, options) {
42735
+ validateListTarget2(input, "lists.setLevelNumberStyle");
42736
+ return adapter.setLevelNumberStyle(input, normalizeMutationOptions2(options));
42737
+ }
42738
+ function executeListsSetLevelText2(adapter, input, options) {
42739
+ validateListTarget2(input, "lists.setLevelText");
42740
+ return adapter.setLevelText(input, normalizeMutationOptions2(options));
42741
+ }
42742
+ function executeListsSetLevelStart2(adapter, input, options) {
42743
+ validateListTarget2(input, "lists.setLevelStart");
42744
+ return adapter.setLevelStart(input, normalizeMutationOptions2(options));
42745
+ }
42746
+ function executeListsSetLevelLayout2(adapter, input, options) {
42747
+ validateListTarget2(input, "lists.setLevelLayout");
42748
+ return adapter.setLevelLayout(input, normalizeMutationOptions2(options));
42749
+ }
42393
42750
  function isStructuralReplaceInput2(input) {
42394
42751
  return "content" in input && input.content !== undefined;
42395
42752
  }
@@ -42760,6 +43117,13 @@ function buildDispatchTable2(api) {
42760
43117
  "lists.setLevelTrailingCharacter": (input, options) => api.lists.setLevelTrailingCharacter(input, options),
42761
43118
  "lists.setLevelMarkerFont": (input, options) => api.lists.setLevelMarkerFont(input, options),
42762
43119
  "lists.clearLevelOverrides": (input, options) => api.lists.clearLevelOverrides(input, options),
43120
+ "lists.getStyle": (input) => api.lists.getStyle(input),
43121
+ "lists.applyStyle": (input, options) => api.lists.applyStyle(input, options),
43122
+ "lists.restartAt": (input, options) => api.lists.restartAt(input, options),
43123
+ "lists.setLevelNumberStyle": (input, options) => api.lists.setLevelNumberStyle(input, options),
43124
+ "lists.setLevelText": (input, options) => api.lists.setLevelText(input, options),
43125
+ "lists.setLevelStart": (input, options) => api.lists.setLevelStart(input, options),
43126
+ "lists.setLevelLayout": (input, options) => api.lists.setLevelLayout(input, options),
42763
43127
  "sections.list": (input) => api.sections.list(input),
42764
43128
  "sections.get": (input) => api.sections.get(input),
42765
43129
  "sections.setBreakType": (input, options) => api.sections.setBreakType(input, options),
@@ -44775,6 +45139,27 @@ function createDocumentApi2(adapters) {
44775
45139
  },
44776
45140
  setType(input, options) {
44777
45141
  return executeListsSetType2(adapters.lists, input, options);
45142
+ },
45143
+ getStyle(input) {
45144
+ return executeListsGetStyle2(adapters.lists, input);
45145
+ },
45146
+ applyStyle(input, options) {
45147
+ return executeListsApplyStyle2(adapters.lists, input, options);
45148
+ },
45149
+ restartAt(input, options) {
45150
+ return executeListsRestartAt2(adapters.lists, input, options);
45151
+ },
45152
+ setLevelNumberStyle(input, options) {
45153
+ return executeListsSetLevelNumberStyle2(adapters.lists, input, options);
45154
+ },
45155
+ setLevelText(input, options) {
45156
+ return executeListsSetLevelText2(adapters.lists, input, options);
45157
+ },
45158
+ setLevelStart(input, options) {
45159
+ return executeListsSetLevelStart2(adapters.lists, input, options);
45160
+ },
45161
+ setLevelLayout(input, options) {
45162
+ return executeListsSetLevelLayout2(adapters.lists, input, options);
44778
45163
  }
44779
45164
  },
44780
45165
  sections: {
@@ -82488,7 +82873,7 @@ var isRegExp = (value) => {
82488
82873
  state.kern = kernNode.attributes["w:val"];
82489
82874
  }
82490
82875
  }, SuperConverter;
82491
- var init_SuperConverter_BcBeadrv_es = __esm(() => {
82876
+ var init_SuperConverter_hOU3ez7P_es = __esm(() => {
82492
82877
  init_rolldown_runtime_B2q5OVn9_es();
82493
82878
  init_jszip_ChlR43oI_es();
82494
82879
  init_xml_js_BtmJ6bNs_es();
@@ -86540,15 +86925,24 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86540
86925
  },
86541
86926
  "lists.create": {
86542
86927
  memberPath: "lists.create",
86543
- description: "Create a new list from one or more paragraphs, or convert existing paragraphs into a new list.",
86928
+ description: 'Create a new list from one or more paragraphs. Supports optional preset or style for new sequences. When sequence.mode is "continuePrevious", preset and style are not allowed — the new items inherit formatting from the previous sequence.',
86544
86929
  expectedResult: "Returns a ListsCreateResult with the new listId and the first item address.",
86545
86930
  requiresDocumentContext: true,
86546
86931
  metadata: mutationOperation2({
86547
86932
  idempotency: "non-idempotent",
86548
86933
  supportsDryRun: true,
86549
86934
  supportsTrackedMode: false,
86550
- possibleFailureCodes: ["INVALID_TARGET", "LEVEL_OUT_OF_RANGE"],
86551
- throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
86935
+ possibleFailureCodes: [
86936
+ "INVALID_TARGET",
86937
+ "LEVEL_OUT_OF_RANGE",
86938
+ "INVALID_INPUT",
86939
+ "NO_COMPATIBLE_PREVIOUS"
86940
+ ],
86941
+ throws: [
86942
+ ...T_NOT_FOUND_CAPABLE2,
86943
+ "INVALID_TARGET",
86944
+ "INVALID_INPUT"
86945
+ ]
86552
86946
  }),
86553
86947
  referenceDocPath: "lists/create.mdx",
86554
86948
  referenceGroup: "lists",
@@ -86783,7 +87177,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86783
87177
  },
86784
87178
  "lists.applyTemplate": {
86785
87179
  memberPath: "lists.applyTemplate",
86786
- description: "Apply a captured ListTemplate to the target list, optionally filtered to specific levels.",
87180
+ description: "Advanced alias for lists.applyStyle. Apply a captured ListTemplate to the target list (abstract-scoped, no clone-on-write).",
86787
87181
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
86788
87182
  requiresDocumentContext: true,
86789
87183
  metadata: mutationOperation2({
@@ -86856,7 +87250,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86856
87250
  },
86857
87251
  "lists.captureTemplate": {
86858
87252
  memberPath: "lists.captureTemplate",
86859
- description: "Capture the formatting of a list as a reusable ListTemplate.",
87253
+ description: "Advanced alias for lists.getStyle. Capture list formatting from the abstract definition only (does not merge lvlOverride formatting).",
86860
87254
  expectedResult: "Returns a ListsCaptureTemplateResult containing the captured template.",
86861
87255
  requiresDocumentContext: true,
86862
87256
  metadata: readOperation2({
@@ -86877,7 +87271,7 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
86877
87271
  },
86878
87272
  "lists.setLevelNumbering": {
86879
87273
  memberPath: "lists.setLevelNumbering",
86880
- description: "Set the numbering format, pattern, and optional start value for a specific list level.",
87274
+ description: "Advanced alias for lists.setLevelNumberStyle/setLevelText/setLevelStart. Set format, pattern, and start in one call (abstract-scoped, no clone-on-write).",
86881
87275
  expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the level already matches.",
86882
87276
  requiresDocumentContext: true,
86883
87277
  metadata: mutationOperation2({
@@ -87045,6 +87439,170 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
87045
87439
  referenceDocPath: "lists/clear-level-overrides.mdx",
87046
87440
  referenceGroup: "lists"
87047
87441
  },
87442
+ "lists.getStyle": {
87443
+ memberPath: "lists.getStyle",
87444
+ description: "Read the effective reusable style of a list, including instance-level overrides. Returns a ListStyle that can be applied to other lists via lists.applyStyle.",
87445
+ expectedResult: "Returns a ListsGetStyleResult containing the captured style.",
87446
+ requiresDocumentContext: true,
87447
+ metadata: readOperation2({
87448
+ idempotency: "idempotent",
87449
+ throws: [
87450
+ "TARGET_NOT_FOUND",
87451
+ "INVALID_TARGET",
87452
+ "INVALID_INPUT"
87453
+ ],
87454
+ possibleFailureCodes: [
87455
+ "INVALID_TARGET",
87456
+ "INVALID_INPUT",
87457
+ "LEVEL_OUT_OF_RANGE"
87458
+ ]
87459
+ }),
87460
+ referenceDocPath: "lists/get-style.mdx",
87461
+ referenceGroup: "lists"
87462
+ },
87463
+ "lists.applyStyle": {
87464
+ memberPath: "lists.applyStyle",
87465
+ description: "Apply a reusable list style to the target list. Sequence-local: if the abstract definition is shared with other lists, it is cloned first to avoid affecting them.",
87466
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all levels already match.",
87467
+ requiresDocumentContext: true,
87468
+ metadata: mutationOperation2({
87469
+ idempotency: "conditional",
87470
+ supportsDryRun: true,
87471
+ supportsTrackedMode: false,
87472
+ possibleFailureCodes: [
87473
+ "NO_OP",
87474
+ "INVALID_TARGET",
87475
+ "INVALID_INPUT",
87476
+ "LEVEL_OUT_OF_RANGE"
87477
+ ],
87478
+ throws: [
87479
+ ...T_NOT_FOUND_CAPABLE2,
87480
+ "INVALID_TARGET",
87481
+ "INVALID_INPUT"
87482
+ ]
87483
+ }),
87484
+ referenceDocPath: "lists/apply-style.mdx",
87485
+ referenceGroup: "lists"
87486
+ },
87487
+ "lists.restartAt": {
87488
+ memberPath: "lists.restartAt",
87489
+ description: "Restart numbering at the target list item with a specific value. If the item is mid-sequence, it is separated first.",
87490
+ expectedResult: "Returns a ListsMutateItemResult receipt.",
87491
+ requiresDocumentContext: true,
87492
+ metadata: mutationOperation2({
87493
+ idempotency: "non-idempotent",
87494
+ supportsDryRun: true,
87495
+ supportsTrackedMode: false,
87496
+ possibleFailureCodes: [
87497
+ "NO_OP",
87498
+ "INVALID_TARGET",
87499
+ "INVALID_INPUT"
87500
+ ],
87501
+ throws: [
87502
+ ...T_NOT_FOUND_CAPABLE2,
87503
+ "INVALID_TARGET",
87504
+ "INVALID_INPUT"
87505
+ ]
87506
+ }),
87507
+ referenceDocPath: "lists/restart-at.mdx",
87508
+ referenceGroup: "lists"
87509
+ },
87510
+ "lists.setLevelNumberStyle": {
87511
+ memberPath: "lists.setLevelNumberStyle",
87512
+ description: 'Set the numbering style (e.g. decimal, lowerLetter, upperRoman) for a specific list level. Rejects "bullet" — use setLevelBullet instead. Sequence-local: clones shared definitions.',
87513
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87514
+ requiresDocumentContext: true,
87515
+ metadata: mutationOperation2({
87516
+ idempotency: "conditional",
87517
+ supportsDryRun: true,
87518
+ supportsTrackedMode: false,
87519
+ possibleFailureCodes: [
87520
+ "NO_OP",
87521
+ "INVALID_TARGET",
87522
+ "INVALID_INPUT",
87523
+ "LEVEL_OUT_OF_RANGE",
87524
+ "LEVEL_NOT_FOUND"
87525
+ ],
87526
+ throws: [
87527
+ ...T_NOT_FOUND_CAPABLE2,
87528
+ "INVALID_TARGET",
87529
+ "INVALID_INPUT"
87530
+ ]
87531
+ }),
87532
+ referenceDocPath: "lists/set-level-number-style.mdx",
87533
+ referenceGroup: "lists"
87534
+ },
87535
+ "lists.setLevelText": {
87536
+ memberPath: "lists.setLevelText",
87537
+ description: 'Set the level text pattern (e.g. "%1.", "(%1)") for a specific list level. Uses OOXML level-placeholder syntax. Sequence-local: clones shared definitions.',
87538
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87539
+ requiresDocumentContext: true,
87540
+ metadata: mutationOperation2({
87541
+ idempotency: "conditional",
87542
+ supportsDryRun: true,
87543
+ supportsTrackedMode: false,
87544
+ possibleFailureCodes: [
87545
+ "NO_OP",
87546
+ "INVALID_TARGET",
87547
+ "INVALID_INPUT",
87548
+ "LEVEL_OUT_OF_RANGE",
87549
+ "LEVEL_NOT_FOUND"
87550
+ ],
87551
+ throws: [...T_NOT_FOUND_CAPABLE2, "INVALID_TARGET"]
87552
+ }),
87553
+ referenceDocPath: "lists/set-level-text.mdx",
87554
+ referenceGroup: "lists"
87555
+ },
87556
+ "lists.setLevelStart": {
87557
+ memberPath: "lists.setLevelStart",
87558
+ description: "Set the start value for a specific list level. Rejects bullet levels and non-positive values. Sequence-local: clones shared definitions.",
87559
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if the value already matches.",
87560
+ requiresDocumentContext: true,
87561
+ metadata: mutationOperation2({
87562
+ idempotency: "conditional",
87563
+ supportsDryRun: true,
87564
+ supportsTrackedMode: false,
87565
+ possibleFailureCodes: [
87566
+ "NO_OP",
87567
+ "INVALID_TARGET",
87568
+ "INVALID_INPUT",
87569
+ "LEVEL_OUT_OF_RANGE",
87570
+ "LEVEL_NOT_FOUND"
87571
+ ],
87572
+ throws: [
87573
+ ...T_NOT_FOUND_CAPABLE2,
87574
+ "INVALID_TARGET",
87575
+ "INVALID_INPUT"
87576
+ ]
87577
+ }),
87578
+ referenceDocPath: "lists/set-level-start.mdx",
87579
+ referenceGroup: "lists"
87580
+ },
87581
+ "lists.setLevelLayout": {
87582
+ memberPath: "lists.setLevelLayout",
87583
+ description: "Set the layout properties (alignment, indentation, trailing character, tab stop) for a specific list level. Accepts partial updates — omitted fields are left unchanged. Sequence-local: clones shared definitions.",
87584
+ expectedResult: "Returns a ListsMutateItemResult receipt; reports NO_OP if all values already match.",
87585
+ requiresDocumentContext: true,
87586
+ metadata: mutationOperation2({
87587
+ idempotency: "conditional",
87588
+ supportsDryRun: true,
87589
+ supportsTrackedMode: false,
87590
+ possibleFailureCodes: [
87591
+ "NO_OP",
87592
+ "INVALID_TARGET",
87593
+ "INVALID_INPUT",
87594
+ "LEVEL_OUT_OF_RANGE",
87595
+ "LEVEL_NOT_FOUND"
87596
+ ],
87597
+ throws: [
87598
+ ...T_NOT_FOUND_CAPABLE2,
87599
+ "INVALID_TARGET",
87600
+ "INVALID_INPUT"
87601
+ ]
87602
+ }),
87603
+ referenceDocPath: "lists/set-level-layout.mdx",
87604
+ referenceGroup: "lists"
87605
+ },
87048
87606
  "comments.create": {
87049
87607
  memberPath: "comments.create",
87050
87608
  description: "Create a new comment thread (or reply when parentCommentId is given).",
@@ -93318,6 +93876,42 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
93318
93876
  position: listInsertPositionSchema2,
93319
93877
  text: { type: "string" }
93320
93878
  }, ["target", "position"]), listsInsertResultSchemaFor2("lists.insert"), listsFailureSchemaFor2("lists.insert"), ref2("BlockAddress"), ref2("BlockAddressOrRange"), objectSchema2({
93879
+ version: { const: 1 },
93880
+ levels: arraySchema2(objectSchema2({
93881
+ level: {
93882
+ type: "integer",
93883
+ minimum: 0,
93884
+ maximum: 8
93885
+ },
93886
+ numFmt: { type: "string" },
93887
+ lvlText: { type: "string" },
93888
+ start: { type: "integer" },
93889
+ alignment: { enum: [
93890
+ "left",
93891
+ "center",
93892
+ "right"
93893
+ ] },
93894
+ indents: objectSchema2({
93895
+ left: { type: "integer" },
93896
+ hanging: { type: "integer" },
93897
+ firstLine: { type: "integer" }
93898
+ }),
93899
+ trailingCharacter: { enum: [
93900
+ "tab",
93901
+ "space",
93902
+ "nothing"
93903
+ ] },
93904
+ markerFont: { type: "string" },
93905
+ pictureBulletId: { type: "integer" },
93906
+ tabStopAt: { type: ["integer", "null"] }
93907
+ }, ["level"]))
93908
+ }, ["version", "levels"]), objectSchema2({
93909
+ mode: { const: "new" },
93910
+ startAt: {
93911
+ type: "integer",
93912
+ minimum: 1
93913
+ }
93914
+ }, ["mode"]), objectSchema2({ mode: { const: "continuePrevious" } }, ["mode"]), objectSchema2({
93321
93915
  success: { const: true },
93322
93916
  listId: { type: "string" },
93323
93917
  item: listItemAddressSchema2
@@ -93623,7 +94217,164 @@ var init_SuperConverter_BcBeadrv_es = __esm(() => {
93623
94217
  minimum: 0,
93624
94218
  maximum: 8
93625
94219
  }
93626
- }, ["target", "level"]), listsMutateItemResultSchemaFor2("lists.clearLevelOverrides"), listsFailureSchemaFor2("lists.clearLevelOverrides"), objectSchema2({
94220
+ }, ["target", "level"]), listsMutateItemResultSchemaFor2("lists.clearLevelOverrides"), listsFailureSchemaFor2("lists.clearLevelOverrides"), (() => {
94221
+ const successSchema = objectSchema2({
94222
+ success: { const: true },
94223
+ style: objectSchema2({
94224
+ version: { const: 1 },
94225
+ levels: arraySchema2(objectSchema2({
94226
+ level: {
94227
+ type: "integer",
94228
+ minimum: 0,
94229
+ maximum: 8
94230
+ },
94231
+ numFmt: { type: "string" },
94232
+ lvlText: { type: "string" },
94233
+ start: { type: "integer" },
94234
+ alignment: { enum: [
94235
+ "left",
94236
+ "center",
94237
+ "right"
94238
+ ] },
94239
+ indents: objectSchema2({
94240
+ left: { type: "integer" },
94241
+ hanging: { type: "integer" },
94242
+ firstLine: { type: "integer" }
94243
+ }),
94244
+ trailingCharacter: { enum: [
94245
+ "tab",
94246
+ "space",
94247
+ "nothing"
94248
+ ] },
94249
+ markerFont: { type: "string" },
94250
+ pictureBulletId: { type: "integer" },
94251
+ tabStopAt: { type: ["integer", "null"] }
94252
+ }, ["level"]))
94253
+ }, ["version", "levels"])
94254
+ }, ["success", "style"]);
94255
+ return {
94256
+ input: objectSchema2({
94257
+ target: listItemAddressSchema2,
94258
+ levels: arraySchema2({
94259
+ type: "integer",
94260
+ minimum: 0,
94261
+ maximum: 8
94262
+ })
94263
+ }, ["target"]),
94264
+ output: { oneOf: [successSchema, listsFailureSchemaFor2("lists.getStyle")] },
94265
+ success: successSchema,
94266
+ failure: listsFailureSchemaFor2("lists.getStyle")
94267
+ };
94268
+ })(), objectSchema2({
94269
+ target: listItemAddressSchema2,
94270
+ style: objectSchema2({
94271
+ version: { const: 1 },
94272
+ levels: arraySchema2(objectSchema2({
94273
+ level: {
94274
+ type: "integer",
94275
+ minimum: 0,
94276
+ maximum: 8
94277
+ },
94278
+ numFmt: { type: "string" },
94279
+ lvlText: { type: "string" },
94280
+ start: { type: "integer" },
94281
+ alignment: { enum: [
94282
+ "left",
94283
+ "center",
94284
+ "right"
94285
+ ] },
94286
+ indents: objectSchema2({
94287
+ left: { type: "integer" },
94288
+ hanging: { type: "integer" },
94289
+ firstLine: { type: "integer" }
94290
+ }),
94291
+ trailingCharacter: { enum: [
94292
+ "tab",
94293
+ "space",
94294
+ "nothing"
94295
+ ] },
94296
+ markerFont: { type: "string" },
94297
+ pictureBulletId: { type: "integer" },
94298
+ tabStopAt: { type: ["integer", "null"] }
94299
+ }, ["level"]))
94300
+ }, ["version", "levels"]),
94301
+ levels: arraySchema2({
94302
+ type: "integer",
94303
+ minimum: 0,
94304
+ maximum: 8
94305
+ })
94306
+ }, ["target", "style"]), listsMutateItemResultSchemaFor2("lists.applyStyle"), listsFailureSchemaFor2("lists.applyStyle"), objectSchema2({
94307
+ target: listItemAddressSchema2,
94308
+ startAt: {
94309
+ type: "integer",
94310
+ minimum: 1
94311
+ }
94312
+ }, ["target", "startAt"]), listsMutateItemResultSchemaFor2("lists.restartAt"), listsFailureSchemaFor2("lists.restartAt"), objectSchema2({
94313
+ target: listItemAddressSchema2,
94314
+ level: {
94315
+ type: "integer",
94316
+ minimum: 0,
94317
+ maximum: 8
94318
+ },
94319
+ numberStyle: { type: "string" }
94320
+ }, [
94321
+ "target",
94322
+ "level",
94323
+ "numberStyle"
94324
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelNumberStyle"), listsFailureSchemaFor2("lists.setLevelNumberStyle"), objectSchema2({
94325
+ target: listItemAddressSchema2,
94326
+ level: {
94327
+ type: "integer",
94328
+ minimum: 0,
94329
+ maximum: 8
94330
+ },
94331
+ text: { type: "string" }
94332
+ }, [
94333
+ "target",
94334
+ "level",
94335
+ "text"
94336
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelText"), listsFailureSchemaFor2("lists.setLevelText"), objectSchema2({
94337
+ target: listItemAddressSchema2,
94338
+ level: {
94339
+ type: "integer",
94340
+ minimum: 0,
94341
+ maximum: 8
94342
+ },
94343
+ startAt: {
94344
+ type: "integer",
94345
+ minimum: 1
94346
+ }
94347
+ }, [
94348
+ "target",
94349
+ "level",
94350
+ "startAt"
94351
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelStart"), listsFailureSchemaFor2("lists.setLevelStart"), objectSchema2({
94352
+ target: listItemAddressSchema2,
94353
+ level: {
94354
+ type: "integer",
94355
+ minimum: 0,
94356
+ maximum: 8
94357
+ },
94358
+ layout: objectSchema2({
94359
+ alignment: { enum: [
94360
+ "left",
94361
+ "center",
94362
+ "right"
94363
+ ] },
94364
+ alignedAt: { type: "integer" },
94365
+ textIndentAt: { type: "integer" },
94366
+ followCharacter: { enum: [
94367
+ "tab",
94368
+ "space",
94369
+ "nothing"
94370
+ ] },
94371
+ tabStopAt: { type: ["integer", "null"] }
94372
+ })
94373
+ }, [
94374
+ "target",
94375
+ "level",
94376
+ "layout"
94377
+ ]), listsMutateItemResultSchemaFor2("lists.setLevelLayout"), listsFailureSchemaFor2("lists.setLevelLayout"), objectSchema2({
93627
94378
  text: { type: "string" },
93628
94379
  target: textAddressSchema2,
93629
94380
  parentCommentId: { type: "string" }
@@ -144352,7 +145103,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
144352
145103
  init_remark_gfm_z_sDF4ss_es();
144353
145104
  });
144354
145105
 
144355
- // ../../packages/superdoc/dist/chunks/src-B0uLvfdR.es.js
145106
+ // ../../packages/superdoc/dist/chunks/src-D3r_lb_g.es.js
144356
145107
  function deleteProps(obj, propOrProps) {
144357
145108
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
144358
145109
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -144437,6 +145188,90 @@ function getSuperdocVersion() {
144437
145188
  return "unknown";
144438
145189
  }
144439
145190
  }
145191
+ function getPreservedSelection(state) {
145192
+ return CustomSelectionPluginKey.getState(state)?.preservedSelection ?? null;
145193
+ }
145194
+ function createSelectionTrackingBookmark(selection) {
145195
+ if (selection instanceof TextSelection2 && !selection.empty)
145196
+ return new InclusiveTextSelectionBookmark(selection.anchor, selection.head);
145197
+ return selection.getBookmark();
145198
+ }
145199
+ function createSelectionHandlePlugin() {
145200
+ return new Plugin({
145201
+ key: SelectionHandlePluginKey,
145202
+ state: {
145203
+ init() {
145204
+ return { entries: /* @__PURE__ */ new Map };
145205
+ },
145206
+ apply(tr, prev) {
145207
+ const meta2 = tr.getMeta(SelectionHandlePluginKey);
145208
+ let entries = prev.entries;
145209
+ if (tr.docChanged && entries.size > 0) {
145210
+ const next2 = /* @__PURE__ */ new Map;
145211
+ for (const [id2, entry] of entries)
145212
+ next2.set(id2, {
145213
+ ...entry,
145214
+ bookmark: entry.bookmark.map(tr.mapping)
145215
+ });
145216
+ entries = next2;
145217
+ }
145218
+ if (meta2?.action === "capture") {
145219
+ if (entries === prev.entries)
145220
+ entries = new Map(entries);
145221
+ entries.set(meta2.entry.id, meta2.entry);
145222
+ } else if (meta2?.action === "release") {
145223
+ if (entries.has(meta2.id)) {
145224
+ if (entries === prev.entries)
145225
+ entries = new Map(entries);
145226
+ entries.delete(meta2.id);
145227
+ }
145228
+ }
145229
+ return entries === prev.entries ? prev : { entries };
145230
+ }
145231
+ }
145232
+ });
145233
+ }
145234
+ function captureSelectionHandle(owner, selection, surface) {
145235
+ const id2 = nextHandleId++;
145236
+ const bookmark = createSelectionTrackingBookmark(selection);
145237
+ const wasNonEmpty = !selection.empty;
145238
+ const entry = {
145239
+ id: id2,
145240
+ bookmark,
145241
+ wasNonEmpty
145242
+ };
145243
+ const tr = owner.state.tr.setMeta(SelectionHandlePluginKey, {
145244
+ action: "capture",
145245
+ entry
145246
+ });
145247
+ owner.dispatch(tr);
145248
+ return {
145249
+ id: id2,
145250
+ surface,
145251
+ wasNonEmpty,
145252
+ _owner: owner
145253
+ };
145254
+ }
145255
+ function resolveHandleToSelection(handle3) {
145256
+ const { state } = handle3._owner;
145257
+ const pluginState = SelectionHandlePluginKey.getState(state);
145258
+ if (!pluginState)
145259
+ return null;
145260
+ const entry = pluginState.entries.get(handle3.id);
145261
+ if (!entry)
145262
+ return null;
145263
+ const resolved = entry.bookmark.resolve(state.doc);
145264
+ if (entry.wasNonEmpty && resolved.empty)
145265
+ return null;
145266
+ return resolved;
145267
+ }
145268
+ function releaseSelectionHandle(handle3) {
145269
+ const { state, dispatch } = handle3._owner;
145270
+ dispatch(state.tr.setMeta(SelectionHandlePluginKey, {
145271
+ action: "release",
145272
+ id: handle3.id
145273
+ }));
145274
+ }
144440
145275
  function getFocusMeta(tr) {
144441
145276
  return tr.getMeta(CustomSelectionPluginKey);
144442
145277
  }
@@ -144449,14 +145284,13 @@ function getFocusState(state) {
144449
145284
  function mapPreservedSelection(selection, tr) {
144450
145285
  if (!selection || !tr.docChanged)
144451
145286
  return selection;
144452
- if (typeof selection.from !== "number" || typeof selection.to !== "number")
144453
- return null;
144454
- const from$1 = tr.mapping.map(selection.from, -1);
144455
- const to = tr.mapping.map(selection.to, 1);
144456
- if (from$1 >= to)
145287
+ if (typeof selection.getBookmark !== "function")
144457
145288
  return null;
144458
145289
  try {
144459
- return TextSelection2.create(tr.doc, from$1, to);
145290
+ const resolved = createSelectionTrackingBookmark(selection).map(tr.mapping).resolve(tr.doc);
145291
+ if (!selection.empty && resolved.empty)
145292
+ return null;
145293
+ return resolved;
144460
145294
  } catch {
144461
145295
  return null;
144462
145296
  }
@@ -154693,7 +155527,7 @@ function validateInsertionContext(editor, index2, step3, stepIndex, anchorBlockI
154693
155527
  function isV3Ref(payload) {
154694
155528
  return typeof payload === "object" && payload !== null && "v" in payload && payload.v === 3;
154695
155529
  }
154696
- function resolveAbsoluteRange(editor, candidate, from$1, to, stepId) {
155530
+ function resolveAbsoluteRange$1(editor, candidate, from$1, to, stepId) {
154697
155531
  const resolved = resolveTextRangeInBlock(candidate.node, candidate.pos, {
154698
155532
  start: from$1,
154699
155533
  end: to
@@ -154781,7 +155615,7 @@ function coalesceBlockRanges(stepId, blockId, ranges) {
154781
155615
  };
154782
155616
  }
154783
155617
  function buildRangeTarget(editor, step3, addr, candidate) {
154784
- const abs$1 = resolveAbsoluteRange(editor, candidate, addr.from, addr.to, step3.id);
155618
+ const abs$1 = resolveAbsoluteRange$1(editor, candidate, addr.from, addr.to, step3.id);
154785
155619
  const capturedStyle = step3.op === "text.rewrite" || step3.op === "format.apply" ? captureRunsInRange(editor, candidate.pos, addr.from, addr.to) : undefined;
154786
155620
  return {
154787
155621
  kind: "range",
@@ -154806,7 +155640,7 @@ function buildSpanTarget(editor, index2, step3, segments, matchId) {
154806
155640
  const candidate = index2.candidates.find((c) => c.nodeId === seg.blockId);
154807
155641
  if (!candidate)
154808
155642
  throw planError("INVALID_INPUT", `block "${seg.blockId}" not found for span segment`, step3.id);
154809
- const abs$1 = resolveAbsoluteRange(editor, candidate, seg.from, seg.to, step3.id);
155643
+ const abs$1 = resolveAbsoluteRange$1(editor, candidate, seg.from, seg.to, step3.id);
154810
155644
  compiledSegments.push({
154811
155645
  blockId: seg.blockId,
154812
155646
  from: seg.from,
@@ -160360,6 +161194,745 @@ function blocksDeleteRangeWrapper(editor, input2, options) {
160360
161194
  dryRun: false
160361
161195
  };
160362
161196
  }
161197
+ function findLevelElement(abstract, ilvl) {
161198
+ const ilvlStr = String(ilvl);
161199
+ return abstract.elements?.find((el) => el.name === "w:lvl" && el.attributes?.["w:ilvl"] === ilvlStr);
161200
+ }
161201
+ function readChildAttr(parent, elementName) {
161202
+ return parent.elements?.find((el) => el.name === elementName)?.attributes?.["w:val"];
161203
+ }
161204
+ function setChildAttr(parent, elementName, value) {
161205
+ if (!parent.elements)
161206
+ parent.elements = [];
161207
+ const existing = parent.elements.find((el) => el.name === elementName);
161208
+ if (existing) {
161209
+ if (existing.attributes?.["w:val"] === value)
161210
+ return false;
161211
+ if (!existing.attributes)
161212
+ existing.attributes = {};
161213
+ existing.attributes["w:val"] = value;
161214
+ return true;
161215
+ }
161216
+ parent.elements.push({
161217
+ type: "element",
161218
+ name: elementName,
161219
+ attributes: { "w:val": value }
161220
+ });
161221
+ return true;
161222
+ }
161223
+ function findOrCreateChild(parent, elementName) {
161224
+ if (!parent.elements)
161225
+ parent.elements = [];
161226
+ let child = parent.elements.find((el) => el.name === elementName);
161227
+ if (!child) {
161228
+ child = {
161229
+ type: "element",
161230
+ name: elementName,
161231
+ elements: []
161232
+ };
161233
+ parent.elements.push(child);
161234
+ }
161235
+ if (!child.elements)
161236
+ child.elements = [];
161237
+ return child;
161238
+ }
161239
+ function resolveAbstractLevel(editor, abstractNumId, ilvl) {
161240
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161241
+ if (!abstract)
161242
+ return null;
161243
+ const lvlEl = findLevelElement(abstract, ilvl);
161244
+ if (!lvlEl)
161245
+ return null;
161246
+ return {
161247
+ abstract,
161248
+ lvlEl
161249
+ };
161250
+ }
161251
+ function hasLevel(editor, abstractNumId, ilvl) {
161252
+ return resolveAbstractLevel(editor, abstractNumId, ilvl) != null;
161253
+ }
161254
+ function readLevelProperties(lvlEl, ilvl) {
161255
+ const props = { level: ilvl };
161256
+ const numFmt = readChildAttr(lvlEl, "w:numFmt");
161257
+ if (numFmt != null)
161258
+ props.numFmt = numFmt;
161259
+ const lvlText = readChildAttr(lvlEl, "w:lvlText");
161260
+ if (lvlText != null)
161261
+ props.lvlText = lvlText;
161262
+ const startVal = readChildAttr(lvlEl, "w:start");
161263
+ if (startVal != null)
161264
+ props.start = Number(startVal);
161265
+ const alignment$1 = readChildAttr(lvlEl, "w:lvlJc");
161266
+ if (alignment$1 != null)
161267
+ props.alignment = alignment$1;
161268
+ const suff = readChildAttr(lvlEl, "w:suff");
161269
+ if (suff != null)
161270
+ props.trailingCharacter = suff;
161271
+ const picBulletId = readChildAttr(lvlEl, "w:lvlPicBulletId");
161272
+ if (picBulletId != null)
161273
+ props.pictureBulletId = Number(picBulletId);
161274
+ const pPr = lvlEl.elements?.find((el) => el.name === "w:pPr");
161275
+ const ind = pPr?.elements?.find((el) => el.name === "w:ind");
161276
+ if (ind?.attributes) {
161277
+ const indents = {};
161278
+ if (ind.attributes["w:left"] != null)
161279
+ indents.left = Number(ind.attributes["w:left"]);
161280
+ if (ind.attributes["w:hanging"] != null)
161281
+ indents.hanging = Number(ind.attributes["w:hanging"]);
161282
+ if (ind.attributes["w:firstLine"] != null)
161283
+ indents.firstLine = Number(ind.attributes["w:firstLine"]);
161284
+ if (Object.keys(indents).length > 0)
161285
+ props.indents = indents;
161286
+ }
161287
+ const tabStopVal = readLevelTabStop(pPr);
161288
+ if (tabStopVal != null)
161289
+ props.tabStopAt = tabStopVal;
161290
+ const rFonts = lvlEl.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rFonts");
161291
+ if (rFonts?.attributes?.["w:ascii"])
161292
+ props.markerFont = rFonts.attributes["w:ascii"];
161293
+ return props;
161294
+ }
161295
+ function readLevelTabStop(pPr) {
161296
+ if (!pPr?.elements)
161297
+ return;
161298
+ const tabs = pPr.elements.find((el) => el.name === "w:tabs");
161299
+ if (!tabs?.elements)
161300
+ return;
161301
+ const tab = tabs.elements.find((el) => el.name === "w:tab");
161302
+ if (!tab?.attributes?.["w:pos"])
161303
+ return;
161304
+ return Number(tab.attributes["w:pos"]);
161305
+ }
161306
+ function mutateLevelTabStop(lvlEl, value) {
161307
+ const pPr = findOrCreateChild(lvlEl, "w:pPr");
161308
+ if (value === null) {
161309
+ const tabsIdx = pPr.elements.findIndex((el) => el.name === "w:tabs");
161310
+ if (tabsIdx === -1)
161311
+ return false;
161312
+ pPr.elements.splice(tabsIdx, 1);
161313
+ return true;
161314
+ }
161315
+ const tabs = findOrCreateChild(pPr, "w:tabs");
161316
+ const existing = tabs.elements.find((el) => el.name === "w:tab");
161317
+ const posStr = String(value);
161318
+ if (existing) {
161319
+ if (existing.attributes?.["w:pos"] === posStr && existing.attributes?.["w:val"] === "num")
161320
+ return false;
161321
+ existing.attributes = {
161322
+ ...existing.attributes,
161323
+ "w:val": "num",
161324
+ "w:pos": posStr
161325
+ };
161326
+ return true;
161327
+ }
161328
+ tabs.elements.push({
161329
+ type: "element",
161330
+ name: "w:tab",
161331
+ attributes: {
161332
+ "w:val": "num",
161333
+ "w:pos": posStr
161334
+ }
161335
+ });
161336
+ return true;
161337
+ }
161338
+ function setLevelTabStop(editor, abstractNumId, ilvl, value) {
161339
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161340
+ if (!resolved)
161341
+ return false;
161342
+ return mutateLevelTabStop(resolved.lvlEl, value);
161343
+ }
161344
+ function clearPictureBulletId(lvlEl) {
161345
+ if (!lvlEl.elements)
161346
+ return false;
161347
+ const idx = lvlEl.elements.findIndex((el) => el.name === "w:lvlPicBulletId");
161348
+ if (idx === -1)
161349
+ return false;
161350
+ lvlEl.elements.splice(idx, 1);
161351
+ return true;
161352
+ }
161353
+ function mutateLevelNumberStyle(lvlEl, numFmt) {
161354
+ let changed = setChildAttr(lvlEl, "w:numFmt", numFmt);
161355
+ changed = clearPictureBulletId(lvlEl) || changed;
161356
+ return changed;
161357
+ }
161358
+ function setLevelNumberStyle(editor, abstractNumId, ilvl, numFmt) {
161359
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161360
+ if (!resolved)
161361
+ return false;
161362
+ return mutateLevelNumberStyle(resolved.lvlEl, numFmt);
161363
+ }
161364
+ function setLevelText(editor, abstractNumId, ilvl, text5) {
161365
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161366
+ if (!resolved)
161367
+ return false;
161368
+ return setChildAttr(resolved.lvlEl, "w:lvlText", text5);
161369
+ }
161370
+ function setLevelStart(editor, abstractNumId, ilvl, start$1) {
161371
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161372
+ if (!resolved)
161373
+ return false;
161374
+ return setChildAttr(resolved.lvlEl, "w:start", String(start$1));
161375
+ }
161376
+ function applyLevelPropertiesToElement(lvlEl, entry) {
161377
+ let changed = false;
161378
+ if (entry.numFmt != null || entry.lvlText != null) {
161379
+ const fmtParams = {};
161380
+ if (entry.numFmt != null)
161381
+ fmtParams.numFmt = entry.numFmt;
161382
+ if (entry.lvlText != null)
161383
+ fmtParams.lvlText = entry.lvlText;
161384
+ if (entry.start != null)
161385
+ fmtParams.start = entry.start;
161386
+ if (fmtParams.numFmt != null && fmtParams.lvlText != null)
161387
+ changed = mutateLevelNumberingFormat(lvlEl, fmtParams) || changed;
161388
+ else {
161389
+ if (fmtParams.numFmt != null)
161390
+ changed = setChildAttr(lvlEl, "w:numFmt", fmtParams.numFmt) || changed;
161391
+ if (fmtParams.lvlText != null)
161392
+ changed = setChildAttr(lvlEl, "w:lvlText", fmtParams.lvlText) || changed;
161393
+ if (fmtParams.start != null)
161394
+ changed = setChildAttr(lvlEl, "w:start", String(fmtParams.start)) || changed;
161395
+ }
161396
+ } else if (entry.start != null)
161397
+ changed = setChildAttr(lvlEl, "w:start", String(entry.start)) || changed;
161398
+ if (entry.alignment != null)
161399
+ changed = mutateLevelAlignment(lvlEl, entry.alignment) || changed;
161400
+ if (entry.indents != null)
161401
+ changed = mutateLevelIndents(lvlEl, entry.indents) || changed;
161402
+ if (entry.trailingCharacter != null)
161403
+ changed = mutateLevelTrailingCharacter(lvlEl, entry.trailingCharacter) || changed;
161404
+ if (entry.markerFont != null)
161405
+ changed = mutateLevelMarkerFont(lvlEl, entry.markerFont) || changed;
161406
+ if (entry.pictureBulletId != null)
161407
+ changed = mutateLevelPictureBulletId(lvlEl, entry.pictureBulletId) || changed;
161408
+ if (entry.tabStopAt !== undefined)
161409
+ changed = mutateLevelTabStop(lvlEl, entry.tabStopAt) || changed;
161410
+ return changed;
161411
+ }
161412
+ function mutateLevelNumberingFormat(lvlEl, { numFmt, lvlText, start: start$1 }) {
161413
+ let changed = false;
161414
+ changed = setChildAttr(lvlEl, "w:numFmt", numFmt) || changed;
161415
+ changed = setChildAttr(lvlEl, "w:lvlText", lvlText) || changed;
161416
+ if (start$1 != null)
161417
+ changed = setChildAttr(lvlEl, "w:start", String(start$1)) || changed;
161418
+ return changed;
161419
+ }
161420
+ function mutateLevelBulletMarker(lvlEl, markerText) {
161421
+ let changed = false;
161422
+ changed = setChildAttr(lvlEl, "w:numFmt", "bullet") || changed;
161423
+ changed = setChildAttr(lvlEl, "w:lvlText", markerText) || changed;
161424
+ return changed;
161425
+ }
161426
+ function mutateLevelPictureBulletId(lvlEl, pictureBulletId) {
161427
+ return setChildAttr(lvlEl, "w:lvlPicBulletId", String(pictureBulletId));
161428
+ }
161429
+ function mutateLevelAlignment(lvlEl, alignment$1) {
161430
+ return setChildAttr(lvlEl, "w:lvlJc", alignment$1);
161431
+ }
161432
+ function mutateLevelIndents(lvlEl, indents) {
161433
+ const ind = findOrCreateChild(findOrCreateChild(lvlEl, "w:pPr"), "w:ind");
161434
+ if (!ind.attributes)
161435
+ ind.attributes = {};
161436
+ let changed = false;
161437
+ if (indents.left != null) {
161438
+ const newVal = String(indents.left);
161439
+ if (ind.attributes["w:left"] !== newVal) {
161440
+ ind.attributes["w:left"] = newVal;
161441
+ changed = true;
161442
+ }
161443
+ }
161444
+ if (indents.hanging != null) {
161445
+ const newVal = String(indents.hanging);
161446
+ if (ind.attributes["w:hanging"] !== newVal) {
161447
+ ind.attributes["w:hanging"] = newVal;
161448
+ changed = true;
161449
+ }
161450
+ if (ind.attributes["w:firstLine"] != null) {
161451
+ delete ind.attributes["w:firstLine"];
161452
+ changed = true;
161453
+ }
161454
+ }
161455
+ if (indents.firstLine != null) {
161456
+ const newVal = String(indents.firstLine);
161457
+ if (ind.attributes["w:firstLine"] !== newVal) {
161458
+ ind.attributes["w:firstLine"] = newVal;
161459
+ changed = true;
161460
+ }
161461
+ if (ind.attributes["w:hanging"] != null) {
161462
+ delete ind.attributes["w:hanging"];
161463
+ changed = true;
161464
+ }
161465
+ }
161466
+ return changed;
161467
+ }
161468
+ function mutateLevelTrailingCharacter(lvlEl, trailingCharacter) {
161469
+ return setChildAttr(lvlEl, "w:suff", trailingCharacter);
161470
+ }
161471
+ function mutateLevelMarkerFont(lvlEl, fontFamily) {
161472
+ const rPr = findOrCreateChild(lvlEl, "w:rPr");
161473
+ const rFonts = rPr.elements.find((el) => el.name === "w:rFonts");
161474
+ if (rFonts) {
161475
+ const attrs = rFonts.attributes || {};
161476
+ if (attrs["w:ascii"] === fontFamily && attrs["w:hAnsi"] === fontFamily && attrs["w:eastAsia"] === fontFamily && attrs["w:cs"] === fontFamily)
161477
+ return false;
161478
+ rFonts.attributes = {
161479
+ ...rFonts.attributes,
161480
+ "w:ascii": fontFamily,
161481
+ "w:hAnsi": fontFamily,
161482
+ "w:eastAsia": fontFamily,
161483
+ "w:cs": fontFamily
161484
+ };
161485
+ return true;
161486
+ }
161487
+ rPr.elements.push({
161488
+ type: "element",
161489
+ name: "w:rFonts",
161490
+ attributes: {
161491
+ "w:ascii": fontFamily,
161492
+ "w:hAnsi": fontFamily,
161493
+ "w:eastAsia": fontFamily,
161494
+ "w:cs": fontFamily
161495
+ }
161496
+ });
161497
+ return true;
161498
+ }
161499
+ function setLevelNumberingFormat(editor, abstractNumId, ilvl, params$1) {
161500
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161501
+ if (!resolved)
161502
+ return false;
161503
+ return mutateLevelNumberingFormat(resolved.lvlEl, params$1);
161504
+ }
161505
+ function setLevelBulletMarker(editor, abstractNumId, ilvl, markerText) {
161506
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161507
+ if (!resolved)
161508
+ return false;
161509
+ return mutateLevelBulletMarker(resolved.lvlEl, markerText);
161510
+ }
161511
+ function setLevelPictureBulletId(editor, abstractNumId, ilvl, pictureBulletId) {
161512
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161513
+ if (!resolved)
161514
+ return false;
161515
+ return mutateLevelPictureBulletId(resolved.lvlEl, pictureBulletId);
161516
+ }
161517
+ function setLevelAlignment(editor, abstractNumId, ilvl, alignment$1) {
161518
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161519
+ if (!resolved)
161520
+ return false;
161521
+ return mutateLevelAlignment(resolved.lvlEl, alignment$1);
161522
+ }
161523
+ function setLevelIndents(editor, abstractNumId, ilvl, indents) {
161524
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161525
+ if (!resolved)
161526
+ return false;
161527
+ return mutateLevelIndents(resolved.lvlEl, indents);
161528
+ }
161529
+ function setLevelTrailingCharacter(editor, abstractNumId, ilvl, trailingCharacter) {
161530
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161531
+ if (!resolved)
161532
+ return false;
161533
+ return mutateLevelTrailingCharacter(resolved.lvlEl, trailingCharacter);
161534
+ }
161535
+ function setLevelMarkerFont(editor, abstractNumId, ilvl, fontFamily) {
161536
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161537
+ if (!resolved)
161538
+ return false;
161539
+ return mutateLevelMarkerFont(resolved.lvlEl, fontFamily);
161540
+ }
161541
+ function hasLevelOverride$1(editor, numId, ilvl) {
161542
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161543
+ if (!numDef?.elements)
161544
+ return false;
161545
+ const ilvlStr = String(ilvl);
161546
+ return numDef.elements.some((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161547
+ }
161548
+ function clearLevelOverride(editor, numId, ilvl) {
161549
+ if (!hasLevelOverride$1(editor, numId, ilvl))
161550
+ return false;
161551
+ removeLvlOverride(editor.converter.numbering, numId, ilvl);
161552
+ return true;
161553
+ }
161554
+ function materializeLevelFormattingOverride(editor, abstractNumId, numId, ilvl) {
161555
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161556
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161557
+ if (!resolved || !numDef?.elements)
161558
+ return false;
161559
+ const ilvlStr = String(ilvl);
161560
+ const overrideIndex = numDef.elements.findIndex((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161561
+ if (overrideIndex === -1)
161562
+ return false;
161563
+ const overrideEl = numDef.elements[overrideIndex];
161564
+ if (!overrideEl?.elements)
161565
+ return false;
161566
+ const lvlIndex = overrideEl.elements.findIndex((el) => el.name === "w:lvl");
161567
+ if (lvlIndex === -1)
161568
+ return false;
161569
+ const lvlEl = overrideEl.elements[lvlIndex];
161570
+ const props = readLevelProperties(lvlEl, ilvl);
161571
+ const abstractChanged = applyLevelPropertiesToElement(resolved.lvlEl, props);
161572
+ const lvlRestartElements = lvlEl.elements?.filter((el) => el.name === "w:lvlRestart").map((el) => deepCloneElement(el)) ?? [];
161573
+ overrideEl.elements.splice(lvlIndex, 1);
161574
+ if (lvlRestartElements.length > 0)
161575
+ overrideEl.elements.push({
161576
+ type: "element",
161577
+ name: "w:lvl",
161578
+ attributes: { "w:ilvl": ilvlStr },
161579
+ elements: lvlRestartElements
161580
+ });
161581
+ let overrideChanged = true;
161582
+ if (overrideEl.elements.length === 0)
161583
+ numDef.elements.splice(overrideIndex, 1);
161584
+ return abstractChanged || overrideChanged;
161585
+ }
161586
+ function captureTemplate(editor, abstractNumId, levels) {
161587
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161588
+ if (!abstract?.elements)
161589
+ return null;
161590
+ const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161591
+ const captured = [];
161592
+ for (const lvlEl of lvlElements) {
161593
+ const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161594
+ if (levels && !levels.includes(ilvl))
161595
+ continue;
161596
+ captured.push(readLevelProperties(lvlEl, ilvl));
161597
+ }
161598
+ captured.sort((a2, b$1) => a2.level - b$1.level);
161599
+ return {
161600
+ version: 1,
161601
+ levels: captured
161602
+ };
161603
+ }
161604
+ function applyTemplateToAbstract(editor, abstractNumId, template, levels) {
161605
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161606
+ if (!abstract?.elements)
161607
+ return {
161608
+ changed: false,
161609
+ error: "ABSTRACT_NOT_FOUND"
161610
+ };
161611
+ const templateByLevel = /* @__PURE__ */ new Map;
161612
+ for (const entry of template.levels)
161613
+ templateByLevel.set(entry.level, entry);
161614
+ const targetLevels = levels ?? template.levels.map((l) => l.level);
161615
+ for (const ilvl of targetLevels)
161616
+ if (!templateByLevel.has(ilvl))
161617
+ return {
161618
+ changed: false,
161619
+ error: "LEVEL_NOT_IN_TEMPLATE"
161620
+ };
161621
+ for (const ilvl of targetLevels)
161622
+ if (!findLevelElement(abstract, ilvl))
161623
+ return {
161624
+ changed: false,
161625
+ error: "LEVEL_NOT_IN_ABSTRACT"
161626
+ };
161627
+ let anyChanged = false;
161628
+ for (const ilvl of targetLevels) {
161629
+ const entry = templateByLevel.get(ilvl);
161630
+ anyChanged = applyLevelPropertiesToElement(findLevelElement(abstract, ilvl), entry) || anyChanged;
161631
+ }
161632
+ return { changed: anyChanged };
161633
+ }
161634
+ function buildOrderedPresetTemplate(config2) {
161635
+ const levels = [];
161636
+ for (let ilvl = 0;ilvl <= 8; ilvl++)
161637
+ levels.push({
161638
+ level: ilvl,
161639
+ numFmt: config2.numFmt,
161640
+ lvlText: `%${ilvl + 1}${config2.lvlTextSuffix}`,
161641
+ start: 1,
161642
+ alignment: "left",
161643
+ indents: {
161644
+ left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161645
+ hanging: HANGING_INDENT_TWIPS
161646
+ }
161647
+ });
161648
+ return {
161649
+ version: 1,
161650
+ levels
161651
+ };
161652
+ }
161653
+ function buildBulletPresetTemplate(config2) {
161654
+ const levels = [];
161655
+ for (let ilvl = 0;ilvl <= 8; ilvl++)
161656
+ levels.push({
161657
+ level: ilvl,
161658
+ numFmt: "bullet",
161659
+ lvlText: config2.markerText,
161660
+ start: 1,
161661
+ alignment: "left",
161662
+ markerFont: config2.fontFamily,
161663
+ indents: {
161664
+ left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161665
+ hanging: HANGING_INDENT_TWIPS
161666
+ }
161667
+ });
161668
+ return {
161669
+ version: 1,
161670
+ levels
161671
+ };
161672
+ }
161673
+ function getPresetTemplate(presetId) {
161674
+ return PRESET_TEMPLATES[presetId];
161675
+ }
161676
+ function mutateLevelLayout(lvlEl, layout) {
161677
+ let changed = false;
161678
+ if (layout.alignment != null)
161679
+ changed = mutateLevelAlignment(lvlEl, layout.alignment) || changed;
161680
+ if (layout.followCharacter != null)
161681
+ changed = mutateLevelTrailingCharacter(lvlEl, layout.followCharacter) || changed;
161682
+ if (layout.tabStopAt !== undefined)
161683
+ changed = mutateLevelTabStop(lvlEl, layout.tabStopAt) || changed;
161684
+ const hasAlignedAt = layout.alignedAt != null;
161685
+ const hasTextIndentAt = layout.textIndentAt != null;
161686
+ if (hasAlignedAt || hasTextIndentAt) {
161687
+ const ind = lvlEl.elements?.find((el) => el.name === "w:pPr")?.elements?.find((el) => el.name === "w:ind");
161688
+ const existingLeft = ind?.attributes?.["w:left"] != null ? Number(ind.attributes["w:left"]) : undefined;
161689
+ const existingHanging = ind?.attributes?.["w:hanging"] != null ? Number(ind.attributes["w:hanging"]) : undefined;
161690
+ const existingFirstLine = ind?.attributes?.["w:firstLine"] != null ? Number(ind.attributes["w:firstLine"]) : undefined;
161691
+ let existingAlignedAt;
161692
+ if (existingLeft != null)
161693
+ if (existingHanging != null)
161694
+ existingAlignedAt = existingLeft - existingHanging;
161695
+ else if (existingFirstLine != null)
161696
+ existingAlignedAt = existingLeft + existingFirstLine;
161697
+ else
161698
+ existingAlignedAt = existingLeft;
161699
+ let newLeft, newHanging;
161700
+ if (hasAlignedAt && hasTextIndentAt) {
161701
+ newLeft = layout.textIndentAt;
161702
+ newHanging = layout.textIndentAt - layout.alignedAt;
161703
+ } else if (hasTextIndentAt) {
161704
+ newLeft = layout.textIndentAt;
161705
+ newHanging = existingAlignedAt != null ? layout.textIndentAt - existingAlignedAt : 0;
161706
+ } else if (hasAlignedAt) {
161707
+ if (existingLeft == null)
161708
+ return {
161709
+ changed,
161710
+ error: "INVALID_INPUT"
161711
+ };
161712
+ newLeft = existingLeft;
161713
+ newHanging = existingLeft - layout.alignedAt;
161714
+ }
161715
+ if (newLeft != null)
161716
+ changed = mutateLevelIndents(lvlEl, {
161717
+ left: newLeft,
161718
+ hanging: newHanging ?? 0
161719
+ }) || changed;
161720
+ }
161721
+ return { changed };
161722
+ }
161723
+ function setLevelLayout(editor, abstractNumId, ilvl, layout) {
161724
+ const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161725
+ if (!resolved)
161726
+ return { changed: false };
161727
+ return mutateLevelLayout(resolved.lvlEl, layout);
161728
+ }
161729
+ function captureEffectiveStyle(editor, abstractNumId, numId, levels) {
161730
+ const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161731
+ if (!abstract?.elements)
161732
+ return null;
161733
+ const numDef = editor.converter.numbering?.definitions?.[numId];
161734
+ const overridesByLevel = buildOverrideMap(numDef);
161735
+ const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161736
+ const captured = [];
161737
+ for (const lvlEl of lvlElements) {
161738
+ const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161739
+ if (levels && !levels.includes(ilvl))
161740
+ continue;
161741
+ const baseProps = readLevelProperties(lvlEl, ilvl);
161742
+ const overrideLvl = overridesByLevel.get(ilvl);
161743
+ if (overrideLvl)
161744
+ mergeOverrideProps(baseProps, readLevelProperties(overrideLvl, ilvl));
161745
+ captured.push(baseProps);
161746
+ }
161747
+ captured.sort((a2, b$1) => a2.level - b$1.level);
161748
+ return {
161749
+ version: 1,
161750
+ levels: captured
161751
+ };
161752
+ }
161753
+ function buildOverrideMap(numDef) {
161754
+ const map$12 = /* @__PURE__ */ new Map;
161755
+ if (!numDef?.elements)
161756
+ return map$12;
161757
+ for (const el of numDef.elements) {
161758
+ if (el.name !== "w:lvlOverride")
161759
+ continue;
161760
+ const ilvl = Number(el.attributes?.["w:ilvl"]);
161761
+ const lvlChild = el.elements?.find((c) => c.name === "w:lvl");
161762
+ if (lvlChild)
161763
+ map$12.set(ilvl, lvlChild);
161764
+ }
161765
+ return map$12;
161766
+ }
161767
+ function mergeOverrideProps(base5, override) {
161768
+ if (override.numFmt != null)
161769
+ base5.numFmt = override.numFmt;
161770
+ if (override.lvlText != null)
161771
+ base5.lvlText = override.lvlText;
161772
+ if (override.start != null)
161773
+ base5.start = override.start;
161774
+ if (override.alignment != null)
161775
+ base5.alignment = override.alignment;
161776
+ if (override.indents != null)
161777
+ base5.indents = {
161778
+ ...base5.indents,
161779
+ ...override.indents
161780
+ };
161781
+ if (override.trailingCharacter != null)
161782
+ base5.trailingCharacter = override.trailingCharacter;
161783
+ if (override.markerFont != null)
161784
+ base5.markerFont = override.markerFont;
161785
+ if (override.pictureBulletId != null)
161786
+ base5.pictureBulletId = override.pictureBulletId;
161787
+ if (override.tabStopAt != null)
161788
+ base5.tabStopAt = override.tabStopAt;
161789
+ }
161790
+ function isAbstractShared(editor, abstractNumId, numId) {
161791
+ const definitions = editor.converter.numbering?.definitions;
161792
+ if (!definitions)
161793
+ return false;
161794
+ for (const [defNumId, numDef] of Object.entries(definitions)) {
161795
+ if (Number(defNumId) === numId)
161796
+ continue;
161797
+ if (!numDef?.elements)
161798
+ continue;
161799
+ const absEl = numDef.elements.find((el) => el.name === "w:abstractNumId");
161800
+ if (absEl && Number(absEl.attributes?.["w:val"]) === abstractNumId)
161801
+ return true;
161802
+ }
161803
+ return false;
161804
+ }
161805
+ function deepCloneElement(element3) {
161806
+ const clone = { ...element3 };
161807
+ if (element3.attributes)
161808
+ clone.attributes = { ...element3.attributes };
161809
+ if (element3.elements)
161810
+ clone.elements = element3.elements.map((child) => deepCloneElement(child));
161811
+ return clone;
161812
+ }
161813
+ function cloneAbstractDefinition(editor, originalAbstractNumId) {
161814
+ const numbering = editor.converter.numbering;
161815
+ const existingAbstractIds = Object.keys(numbering.abstracts).map(Number);
161816
+ const newAbstractNumId = existingAbstractIds.length > 0 ? Math.max(...existingAbstractIds) + 1 : 0;
161817
+ const original = numbering.abstracts[originalAbstractNumId];
161818
+ if (!original)
161819
+ throw new Error(`cloneAbstractDefinition: abstract ${originalAbstractNumId} not found.`);
161820
+ const cloned = deepCloneElement(original);
161821
+ cloned.attributes = {
161822
+ ...cloned.attributes,
161823
+ "w:abstractNumId": String(newAbstractNumId)
161824
+ };
161825
+ numbering.abstracts[newAbstractNumId] = cloned;
161826
+ return { newAbstractNumId };
161827
+ }
161828
+ function cloneAbstractIntoNum(editor, originalAbstractNumId, numId) {
161829
+ const numbering = editor.converter.numbering;
161830
+ const { newAbstractNumId } = cloneAbstractDefinition(editor, originalAbstractNumId);
161831
+ const numDef = numbering.definitions[numId];
161832
+ if (!numDef)
161833
+ throw new Error(`cloneAbstractIntoNum: num ${numId} not found.`);
161834
+ if (!numDef.elements)
161835
+ numDef.elements = [];
161836
+ const abstractNumIdEl = numDef.elements.find((el) => el.name === "w:abstractNumId");
161837
+ if (abstractNumIdEl)
161838
+ abstractNumIdEl.attributes = {
161839
+ ...abstractNumIdEl.attributes || {},
161840
+ "w:val": String(newAbstractNumId)
161841
+ };
161842
+ else
161843
+ numDef.elements.unshift({
161844
+ type: "element",
161845
+ name: "w:abstractNumId",
161846
+ attributes: { "w:val": String(newAbstractNumId) }
161847
+ });
161848
+ return { newAbstractNumId };
161849
+ }
161850
+ function copySequenceStateOverrides(editor, fromNumId, toNumId, levels) {
161851
+ if (fromNumId === toNumId)
161852
+ return false;
161853
+ const sourceNumDef = editor.converter.numbering?.definitions?.[fromNumId];
161854
+ const targetNumDef = editor.converter.numbering?.definitions?.[toNumId];
161855
+ if (!sourceNumDef?.elements || !targetNumDef)
161856
+ return false;
161857
+ if (!targetNumDef.elements)
161858
+ targetNumDef.elements = [];
161859
+ const levelSet = levels ? new Set(levels.map((level) => String(level))) : null;
161860
+ let changed = false;
161861
+ for (const sourceEl of sourceNumDef.elements) {
161862
+ if (sourceEl.name !== "w:lvlOverride")
161863
+ continue;
161864
+ const ilvl = sourceEl.attributes?.["w:ilvl"];
161865
+ if (ilvl == null)
161866
+ continue;
161867
+ if (levelSet && !levelSet.has(ilvl))
161868
+ continue;
161869
+ const nextElements = [];
161870
+ for (const child of sourceEl.elements ?? []) {
161871
+ if (child.name === "w:startOverride") {
161872
+ nextElements.push(deepCloneElement(child));
161873
+ continue;
161874
+ }
161875
+ if (child.name === "w:lvl") {
161876
+ const lvlRestartElements = child.elements?.filter((lvlChild) => lvlChild.name === "w:lvlRestart").map((lvlChild) => deepCloneElement(lvlChild)) ?? [];
161877
+ if (lvlRestartElements.length > 0)
161878
+ nextElements.push({
161879
+ type: "element",
161880
+ name: "w:lvl",
161881
+ attributes: {
161882
+ ...child.attributes || {},
161883
+ "w:ilvl": child.attributes?.["w:ilvl"] ?? ilvl
161884
+ },
161885
+ elements: lvlRestartElements
161886
+ });
161887
+ }
161888
+ }
161889
+ if (nextElements.length === 0)
161890
+ continue;
161891
+ const targetIndex = targetNumDef.elements.findIndex((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvl);
161892
+ const nextOverride = {
161893
+ type: "element",
161894
+ name: "w:lvlOverride",
161895
+ attributes: {
161896
+ ...sourceEl.attributes || {},
161897
+ "w:ilvl": ilvl
161898
+ },
161899
+ elements: nextElements
161900
+ };
161901
+ if (targetIndex === -1)
161902
+ targetNumDef.elements.push(nextOverride);
161903
+ else
161904
+ targetNumDef.elements[targetIndex] = nextOverride;
161905
+ changed = true;
161906
+ }
161907
+ return changed;
161908
+ }
161909
+ function cloneAbstractAndNum(editor, originalAbstractNumId, originalNumId) {
161910
+ const numbering = editor.converter.numbering;
161911
+ const { newAbstractNumId } = cloneAbstractDefinition(editor, originalAbstractNumId);
161912
+ const existingNumIds = Object.keys(numbering.definitions).map(Number);
161913
+ const newNumId = existingNumIds.length > 0 ? Math.max(...existingNumIds) + 1 : 1;
161914
+ const originalNumDef = numbering.definitions[originalNumId];
161915
+ const newElements = [{
161916
+ type: "element",
161917
+ name: "w:abstractNumId",
161918
+ attributes: { "w:val": String(newAbstractNumId) }
161919
+ }];
161920
+ if (originalNumDef?.elements) {
161921
+ for (const el of originalNumDef.elements)
161922
+ if (el.name === "w:lvlOverride")
161923
+ newElements.push(deepCloneElement(el));
161924
+ }
161925
+ numbering.definitions[newNumId] = {
161926
+ type: "element",
161927
+ name: "w:num",
161928
+ attributes: { "w:numId": String(newNumId) },
161929
+ elements: newElements
161930
+ };
161931
+ return {
161932
+ newAbstractNumId,
161933
+ newNumId
161934
+ };
161935
+ }
160363
161936
  function toListsFailure$1(code7, message, details) {
160364
161937
  return {
160365
161938
  success: false,
@@ -160381,6 +161954,9 @@ function dispatchEditorTransaction$2(editor, tr) {
160381
161954
  }
160382
161955
  throw new DocumentApiAdapterError("INTERNAL_ERROR", "Cannot apply list mutation because no transaction dispatcher is available.", { reason: "missing_dispatch" });
160383
161956
  }
161957
+ function getConverterNumbering$1(editor) {
161958
+ return editor.converter.numbering;
161959
+ }
160384
161960
  function executeDomainCommandWithRollback(editor, handler2, options) {
160385
161961
  let receipt2;
160386
161962
  compoundMutation({
@@ -160420,7 +161996,7 @@ function resolveInsertedListItem(editor, sdBlockId) {
160420
161996
  function withListTarget(editor, input2) {
160421
161997
  return resolveListItem(editor, input2.target);
160422
161998
  }
160423
- function hasLevelOverride$1(editor, numId, level) {
161999
+ function hasLevelOverride(editor, numId, level) {
160424
162000
  const definition3 = editor.converter?.numbering?.definitions?.[numId];
160425
162001
  const ilvl = String(level);
160426
162002
  return definition3?.elements?.some((element3) => element3.name === "w:lvlOverride" && element3.attributes?.["w:ilvl"] === ilvl) ?? false;
@@ -160570,6 +162146,33 @@ function listsOutdentWrapper(editor, input2, options) {
160570
162146
  return toListsFailure$1("NO_OP", "List item is already at level 0.", { target: input2.target });
160571
162147
  return executeSetLevel(editor, target, currentLevel - 1, options);
160572
162148
  }
162149
+ function resolveCreateKind(input2) {
162150
+ const raw = input2;
162151
+ if (raw.style != null && raw.preset != null)
162152
+ return { failure: toListsFailure$1("INVALID_INPUT", "Cannot provide both style and preset.", {}) };
162153
+ if (raw.preset != null) {
162154
+ const presetKind = PRESET_KIND_MAP[raw.preset];
162155
+ if (!presetKind)
162156
+ return { failure: toListsFailure$1("INVALID_INPUT", `Unknown preset: ${raw.preset}.`, { preset: raw.preset }) };
162157
+ if (raw.kind != null && raw.kind !== presetKind)
162158
+ return { failure: toListsFailure$1("INVALID_INPUT", `Preset kind (${presetKind}) conflicts with provided kind (${raw.kind}).`, {
162159
+ preset: raw.preset,
162160
+ kind: raw.kind
162161
+ }) };
162162
+ return { kind: presetKind };
162163
+ }
162164
+ if (raw.style != null) {
162165
+ if (raw.kind == null)
162166
+ return { failure: toListsFailure$1("INVALID_INPUT", "kind is required when style is provided.", {}) };
162167
+ return { kind: raw.kind };
162168
+ }
162169
+ if (raw.kind == null)
162170
+ return { failure: toListsFailure$1("INVALID_INPUT", "kind is required when neither preset nor style is provided.", {}) };
162171
+ return { kind: raw.kind };
162172
+ }
162173
+ function isListKind(value) {
162174
+ return value === "ordered" || value === "bullet";
162175
+ }
160573
162176
  function listsCreateWrapper(editor, input2, options) {
160574
162177
  rejectTrackedMode("lists.create", options);
160575
162178
  const raw = input2;
@@ -160580,53 +162183,24 @@ function listsCreateWrapper(editor, input2, options) {
160580
162183
  const level = input2.level ?? 0;
160581
162184
  if (level < 0 || level > 8)
160582
162185
  return toListsFailure$1("LEVEL_OUT_OF_RANGE", "Level must be between 0 and 8.", { level });
160583
- const listType = input2.kind === "ordered" ? "orderedList" : "bulletList";
160584
- if (input2.mode === "empty") {
160585
- const block = resolveBlock(editor, input2.at.nodeId);
160586
- if (block.nodeType === "listItem")
160587
- return toListsFailure$1("INVALID_TARGET", "Target paragraph is already a list item.", { target: input2.at });
160588
- if (options?.dryRun)
160589
- return {
160590
- success: true,
160591
- listId: "(dry-run)",
160592
- item: {
160593
- kind: "block",
160594
- nodeType: "listItem",
160595
- nodeId: "(dry-run)"
160596
- }
160597
- };
160598
- let numId$1;
160599
- if (executeDomainCommandWithRollback(editor, () => {
160600
- numId$1 = ListHelpers.getNewListId(editor);
160601
- ListHelpers.generateNewListDefinition({
160602
- numId: numId$1,
160603
- listType,
160604
- editor
160605
- });
160606
- const { tr } = editor.state;
160607
- updateNumberingProperties({
160608
- numId: numId$1,
160609
- ilvl: level
160610
- }, block.node, block.pos, editor, tr);
160611
- dispatchEditorTransaction$2(editor, tr);
160612
- clearIndexCache(editor);
160613
- return true;
160614
- }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
160615
- return toListsFailure$1("INVALID_TARGET", "List creation could not be applied.", { mode: input2.mode });
160616
- return {
160617
- success: true,
160618
- listId: `${numId$1}:${block.nodeId}`,
160619
- item: {
160620
- kind: "block",
160621
- nodeType: "listItem",
160622
- nodeId: block.nodeId
160623
- }
160624
- };
160625
- }
160626
- const targets = isBlockRange(input2.target) ? resolveBlocksInRange(editor, input2.target.from.nodeId, input2.target.to.nodeId) : [resolveBlock(editor, input2.target.nodeId)];
160627
- if (targets.length === 0)
160628
- return toListsFailure$1("INVALID_TARGET", "No paragraphs found in the specified range.", { target: input2.target });
160629
- const alreadyListItem = targets.find((t) => t.nodeType === "listItem");
162186
+ let styleTemplate;
162187
+ if (raw.style != null) {
162188
+ styleTemplate = raw.style;
162189
+ if (styleTemplate.version !== 1)
162190
+ return toListsFailure$1("INVALID_INPUT", "Unsupported style version.", { version: styleTemplate.version });
162191
+ } else if (raw.preset != null) {
162192
+ styleTemplate = LevelFormattingHelpers.getPresetTemplate(raw.preset);
162193
+ if (!styleTemplate)
162194
+ return toListsFailure$1("INVALID_INPUT", `Unknown preset: ${raw.preset}.`, { preset: raw.preset });
162195
+ }
162196
+ let blocks2;
162197
+ if (input2.mode === "empty")
162198
+ blocks2 = [resolveBlock(editor, input2.at.nodeId)];
162199
+ else
162200
+ blocks2 = isBlockRange(input2.target) ? resolveBlocksInRange(editor, input2.target.from.nodeId, input2.target.to.nodeId) : [resolveBlock(editor, input2.target.nodeId)];
162201
+ if (blocks2.length === 0)
162202
+ return toListsFailure$1("INVALID_TARGET", "No paragraphs found in the specified range.", {});
162203
+ const alreadyListItem = blocks2.find((t) => t.nodeType === "listItem");
160630
162204
  if (alreadyListItem)
160631
162205
  return toListsFailure$1("INVALID_TARGET", "One or more target paragraphs are already list items.", { nodeId: alreadyListItem.nodeId });
160632
162206
  if (options?.dryRun)
@@ -160636,35 +162210,92 @@ function listsCreateWrapper(editor, input2, options) {
160636
162210
  item: {
160637
162211
  kind: "block",
160638
162212
  nodeType: "listItem",
160639
- nodeId: targets[0].nodeId
160640
- }
160641
- };
162213
+ nodeId: blocks2[0].nodeId
162214
+ }
162215
+ };
162216
+ const sequenceInput = raw.sequence ?? { mode: "new" };
162217
+ const requestedKind = raw.kind;
162218
+ if (requestedKind != null && !isListKind(requestedKind))
162219
+ return toListsFailure$1("INVALID_INPUT", `Unknown list kind: ${String(requestedKind)}.`, { kind: requestedKind });
162220
+ let kind;
162221
+ let listType;
162222
+ if (sequenceInput.mode !== "continuePrevious") {
162223
+ const kindResult = resolveCreateKind(input2);
162224
+ if ("failure" in kindResult)
162225
+ return kindResult.failure;
162226
+ kind = kindResult.kind;
162227
+ listType = kind === "ordered" ? "orderedList" : "bulletList";
162228
+ } else
162229
+ kind = requestedKind;
162230
+ let continuePreviousNumId;
162231
+ if (sequenceInput.mode === "continuePrevious") {
162232
+ if (styleTemplate)
162233
+ return toListsFailure$1("INVALID_INPUT", 'preset/style cannot be combined with sequence.mode "continuePrevious". The new items inherit formatting from the previous sequence.', {});
162234
+ const allItems = getAllListItemProjections(editor);
162235
+ const firstBlockPos = blocks2[0].pos;
162236
+ for (let i4 = allItems.length - 1;i4 >= 0; i4--) {
162237
+ const item = allItems[i4];
162238
+ if (item.candidate.pos >= firstBlockPos)
162239
+ continue;
162240
+ if (item.numId == null)
162241
+ continue;
162242
+ if (kind != null && item.kind !== kind)
162243
+ continue;
162244
+ continuePreviousNumId = item.numId;
162245
+ break;
162246
+ }
162247
+ if (continuePreviousNumId == null)
162248
+ return toListsFailure$1("NO_COMPATIBLE_PREVIOUS", "No compatible previous list sequence found.", {});
162249
+ }
160642
162250
  let numId;
160643
162251
  if (executeDomainCommandWithRollback(editor, () => {
160644
- numId = ListHelpers.getNewListId(editor);
160645
- ListHelpers.generateNewListDefinition({
160646
- numId,
160647
- listType,
160648
- editor
160649
- });
160650
- const { tr } = editor.state;
160651
- for (const block of targets)
160652
- updateNumberingProperties({
162252
+ if (sequenceInput.mode === "continuePrevious") {
162253
+ numId = continuePreviousNumId;
162254
+ const { tr } = editor.state;
162255
+ for (const block of blocks2)
162256
+ updateNumberingProperties({
162257
+ numId,
162258
+ ilvl: level
162259
+ }, block.node, block.pos, editor, tr);
162260
+ dispatchEditorTransaction$2(editor, tr);
162261
+ clearIndexCache(editor);
162262
+ } else {
162263
+ numId = ListHelpers.getNewListId(editor);
162264
+ ListHelpers.generateNewListDefinition({
160653
162265
  numId,
160654
- ilvl: level
160655
- }, block.node, block.pos, editor, tr);
160656
- dispatchEditorTransaction$2(editor, tr);
160657
- clearIndexCache(editor);
162266
+ listType,
162267
+ editor
162268
+ });
162269
+ if (styleTemplate) {
162270
+ const abstractNumId = getAbstractNumId(editor, numId);
162271
+ if (abstractNumId != null) {
162272
+ LevelFormattingHelpers.applyTemplateToAbstract(editor, abstractNumId, styleTemplate, undefined);
162273
+ const numberingPart = getPart(editor, "word/numbering.xml");
162274
+ if (numberingPart)
162275
+ syncNumberingToXmlTree(numberingPart, getConverterNumbering$1(editor));
162276
+ }
162277
+ }
162278
+ const { tr } = editor.state;
162279
+ for (const block of blocks2)
162280
+ updateNumberingProperties({
162281
+ numId,
162282
+ ilvl: level
162283
+ }, block.node, block.pos, editor, tr);
162284
+ dispatchEditorTransaction$2(editor, tr);
162285
+ clearIndexCache(editor);
162286
+ if (sequenceInput.startAt != null)
162287
+ ListHelpers.setLvlOverride(editor, numId, level, { startOverride: sequenceInput.startAt });
162288
+ }
160658
162289
  return true;
160659
162290
  }, { expectedRevision: options?.expectedRevision }).steps[0]?.effect !== "changed")
160660
162291
  return toListsFailure$1("INVALID_TARGET", "List creation could not be applied.", { mode: input2.mode });
160661
162292
  return {
160662
162293
  success: true,
160663
- listId: `${numId}:${targets[0].nodeId}`,
162294
+ listId: `${numId}:${blocks2[0].nodeId}`,
160664
162295
  item: {
160665
162296
  kind: "block",
160666
162297
  nodeType: "listItem",
160667
- nodeId: targets[0].nodeId
162298
+ nodeId: blocks2[0].nodeId
160668
162299
  }
160669
162300
  };
160670
162301
  }
@@ -160848,7 +162479,7 @@ function listsSetValueWrapper(editor, input2, options) {
160848
162479
  item: target.address
160849
162480
  };
160850
162481
  if (input2.value === null) {
160851
- if (!hasLevelOverride$1(editor, target.numId, level))
162482
+ if (!hasLevelOverride(editor, target.numId, level))
160852
162483
  return toListsFailure$1("NO_OP", "No startOverride to remove.", { target: input2.target });
160853
162484
  if (executeDomainCommandWithRollback(editor, () => {
160854
162485
  ListHelpers.removeLvlOverride(editor, target.numId, level);
@@ -161001,362 +162632,6 @@ function listsConvertToTextWrapper(editor, input2, options) {
161001
162632
  }
161002
162633
  };
161003
162634
  }
161004
- function findLevelElement(abstract, ilvl) {
161005
- const ilvlStr = String(ilvl);
161006
- return abstract.elements?.find((el) => el.name === "w:lvl" && el.attributes?.["w:ilvl"] === ilvlStr);
161007
- }
161008
- function readChildAttr(parent, elementName) {
161009
- return parent.elements?.find((el) => el.name === elementName)?.attributes?.["w:val"];
161010
- }
161011
- function setChildAttr(parent, elementName, value) {
161012
- if (!parent.elements)
161013
- parent.elements = [];
161014
- const existing = parent.elements.find((el) => el.name === elementName);
161015
- if (existing) {
161016
- if (existing.attributes?.["w:val"] === value)
161017
- return false;
161018
- if (!existing.attributes)
161019
- existing.attributes = {};
161020
- existing.attributes["w:val"] = value;
161021
- return true;
161022
- }
161023
- parent.elements.push({
161024
- type: "element",
161025
- name: elementName,
161026
- attributes: { "w:val": value }
161027
- });
161028
- return true;
161029
- }
161030
- function findOrCreateChild(parent, elementName) {
161031
- if (!parent.elements)
161032
- parent.elements = [];
161033
- let child = parent.elements.find((el) => el.name === elementName);
161034
- if (!child) {
161035
- child = {
161036
- type: "element",
161037
- name: elementName,
161038
- elements: []
161039
- };
161040
- parent.elements.push(child);
161041
- }
161042
- if (!child.elements)
161043
- child.elements = [];
161044
- return child;
161045
- }
161046
- function resolveAbstractLevel(editor, abstractNumId, ilvl) {
161047
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161048
- if (!abstract)
161049
- return null;
161050
- const lvlEl = findLevelElement(abstract, ilvl);
161051
- if (!lvlEl)
161052
- return null;
161053
- return {
161054
- abstract,
161055
- lvlEl
161056
- };
161057
- }
161058
- function hasLevel(editor, abstractNumId, ilvl) {
161059
- return resolveAbstractLevel(editor, abstractNumId, ilvl) != null;
161060
- }
161061
- function readLevelProperties(lvlEl, ilvl) {
161062
- const props = { level: ilvl };
161063
- const numFmt = readChildAttr(lvlEl, "w:numFmt");
161064
- if (numFmt != null)
161065
- props.numFmt = numFmt;
161066
- const lvlText = readChildAttr(lvlEl, "w:lvlText");
161067
- if (lvlText != null)
161068
- props.lvlText = lvlText;
161069
- const startVal = readChildAttr(lvlEl, "w:start");
161070
- if (startVal != null)
161071
- props.start = Number(startVal);
161072
- const alignment$1 = readChildAttr(lvlEl, "w:lvlJc");
161073
- if (alignment$1 != null)
161074
- props.alignment = alignment$1;
161075
- const suff = readChildAttr(lvlEl, "w:suff");
161076
- if (suff != null)
161077
- props.trailingCharacter = suff;
161078
- const picBulletId = readChildAttr(lvlEl, "w:lvlPicBulletId");
161079
- if (picBulletId != null)
161080
- props.pictureBulletId = Number(picBulletId);
161081
- const ind = lvlEl.elements?.find((el) => el.name === "w:pPr")?.elements?.find((el) => el.name === "w:ind");
161082
- if (ind?.attributes) {
161083
- const indents = {};
161084
- if (ind.attributes["w:left"] != null)
161085
- indents.left = Number(ind.attributes["w:left"]);
161086
- if (ind.attributes["w:hanging"] != null)
161087
- indents.hanging = Number(ind.attributes["w:hanging"]);
161088
- if (ind.attributes["w:firstLine"] != null)
161089
- indents.firstLine = Number(ind.attributes["w:firstLine"]);
161090
- if (Object.keys(indents).length > 0)
161091
- props.indents = indents;
161092
- }
161093
- const rFonts = lvlEl.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rFonts");
161094
- if (rFonts?.attributes?.["w:ascii"])
161095
- props.markerFont = rFonts.attributes["w:ascii"];
161096
- return props;
161097
- }
161098
- function mutateLevelNumberingFormat(lvlEl, { numFmt, lvlText, start: start$1 }) {
161099
- let changed = false;
161100
- changed = setChildAttr(lvlEl, "w:numFmt", numFmt) || changed;
161101
- changed = setChildAttr(lvlEl, "w:lvlText", lvlText) || changed;
161102
- if (start$1 != null)
161103
- changed = setChildAttr(lvlEl, "w:start", String(start$1)) || changed;
161104
- return changed;
161105
- }
161106
- function mutateLevelBulletMarker(lvlEl, markerText) {
161107
- let changed = false;
161108
- changed = setChildAttr(lvlEl, "w:numFmt", "bullet") || changed;
161109
- changed = setChildAttr(lvlEl, "w:lvlText", markerText) || changed;
161110
- return changed;
161111
- }
161112
- function mutateLevelPictureBulletId(lvlEl, pictureBulletId) {
161113
- return setChildAttr(lvlEl, "w:lvlPicBulletId", String(pictureBulletId));
161114
- }
161115
- function mutateLevelAlignment(lvlEl, alignment$1) {
161116
- return setChildAttr(lvlEl, "w:lvlJc", alignment$1);
161117
- }
161118
- function mutateLevelIndents(lvlEl, indents) {
161119
- const ind = findOrCreateChild(findOrCreateChild(lvlEl, "w:pPr"), "w:ind");
161120
- if (!ind.attributes)
161121
- ind.attributes = {};
161122
- let changed = false;
161123
- if (indents.left != null) {
161124
- const newVal = String(indents.left);
161125
- if (ind.attributes["w:left"] !== newVal) {
161126
- ind.attributes["w:left"] = newVal;
161127
- changed = true;
161128
- }
161129
- }
161130
- if (indents.hanging != null) {
161131
- const newVal = String(indents.hanging);
161132
- if (ind.attributes["w:hanging"] !== newVal) {
161133
- ind.attributes["w:hanging"] = newVal;
161134
- changed = true;
161135
- }
161136
- if (ind.attributes["w:firstLine"] != null) {
161137
- delete ind.attributes["w:firstLine"];
161138
- changed = true;
161139
- }
161140
- }
161141
- if (indents.firstLine != null) {
161142
- const newVal = String(indents.firstLine);
161143
- if (ind.attributes["w:firstLine"] !== newVal) {
161144
- ind.attributes["w:firstLine"] = newVal;
161145
- changed = true;
161146
- }
161147
- if (ind.attributes["w:hanging"] != null) {
161148
- delete ind.attributes["w:hanging"];
161149
- changed = true;
161150
- }
161151
- }
161152
- return changed;
161153
- }
161154
- function mutateLevelTrailingCharacter(lvlEl, trailingCharacter) {
161155
- return setChildAttr(lvlEl, "w:suff", trailingCharacter);
161156
- }
161157
- function mutateLevelMarkerFont(lvlEl, fontFamily) {
161158
- const rPr = findOrCreateChild(lvlEl, "w:rPr");
161159
- const rFonts = rPr.elements.find((el) => el.name === "w:rFonts");
161160
- if (rFonts) {
161161
- const attrs = rFonts.attributes || {};
161162
- if (attrs["w:ascii"] === fontFamily && attrs["w:hAnsi"] === fontFamily && attrs["w:eastAsia"] === fontFamily && attrs["w:cs"] === fontFamily)
161163
- return false;
161164
- rFonts.attributes = {
161165
- ...rFonts.attributes,
161166
- "w:ascii": fontFamily,
161167
- "w:hAnsi": fontFamily,
161168
- "w:eastAsia": fontFamily,
161169
- "w:cs": fontFamily
161170
- };
161171
- return true;
161172
- }
161173
- rPr.elements.push({
161174
- type: "element",
161175
- name: "w:rFonts",
161176
- attributes: {
161177
- "w:ascii": fontFamily,
161178
- "w:hAnsi": fontFamily,
161179
- "w:eastAsia": fontFamily,
161180
- "w:cs": fontFamily
161181
- }
161182
- });
161183
- return true;
161184
- }
161185
- function setLevelNumberingFormat(editor, abstractNumId, ilvl, params$1) {
161186
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161187
- if (!resolved)
161188
- return false;
161189
- return mutateLevelNumberingFormat(resolved.lvlEl, params$1);
161190
- }
161191
- function setLevelBulletMarker(editor, abstractNumId, ilvl, markerText) {
161192
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161193
- if (!resolved)
161194
- return false;
161195
- return mutateLevelBulletMarker(resolved.lvlEl, markerText);
161196
- }
161197
- function setLevelPictureBulletId(editor, abstractNumId, ilvl, pictureBulletId) {
161198
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161199
- if (!resolved)
161200
- return false;
161201
- return mutateLevelPictureBulletId(resolved.lvlEl, pictureBulletId);
161202
- }
161203
- function setLevelAlignment(editor, abstractNumId, ilvl, alignment$1) {
161204
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161205
- if (!resolved)
161206
- return false;
161207
- return mutateLevelAlignment(resolved.lvlEl, alignment$1);
161208
- }
161209
- function setLevelIndents(editor, abstractNumId, ilvl, indents) {
161210
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161211
- if (!resolved)
161212
- return false;
161213
- return mutateLevelIndents(resolved.lvlEl, indents);
161214
- }
161215
- function setLevelTrailingCharacter(editor, abstractNumId, ilvl, trailingCharacter) {
161216
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161217
- if (!resolved)
161218
- return false;
161219
- return mutateLevelTrailingCharacter(resolved.lvlEl, trailingCharacter);
161220
- }
161221
- function setLevelMarkerFont(editor, abstractNumId, ilvl, fontFamily) {
161222
- const resolved = resolveAbstractLevel(editor, abstractNumId, ilvl);
161223
- if (!resolved)
161224
- return false;
161225
- return mutateLevelMarkerFont(resolved.lvlEl, fontFamily);
161226
- }
161227
- function hasLevelOverride(editor, numId, ilvl) {
161228
- const numDef = editor.converter.numbering?.definitions?.[numId];
161229
- if (!numDef?.elements)
161230
- return false;
161231
- const ilvlStr = String(ilvl);
161232
- return numDef.elements.some((el) => el.name === "w:lvlOverride" && el.attributes?.["w:ilvl"] === ilvlStr);
161233
- }
161234
- function clearLevelOverride(editor, numId, ilvl) {
161235
- if (!hasLevelOverride(editor, numId, ilvl))
161236
- return false;
161237
- removeLvlOverride(editor.converter.numbering, numId, ilvl);
161238
- return true;
161239
- }
161240
- function captureTemplate(editor, abstractNumId, levels) {
161241
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161242
- if (!abstract?.elements)
161243
- return null;
161244
- const lvlElements = abstract.elements.filter((el) => el.name === "w:lvl");
161245
- const captured = [];
161246
- for (const lvlEl of lvlElements) {
161247
- const ilvl = Number(lvlEl.attributes?.["w:ilvl"]);
161248
- if (levels && !levels.includes(ilvl))
161249
- continue;
161250
- captured.push(readLevelProperties(lvlEl, ilvl));
161251
- }
161252
- captured.sort((a2, b$1) => a2.level - b$1.level);
161253
- return {
161254
- version: 1,
161255
- levels: captured
161256
- };
161257
- }
161258
- function applyTemplateToAbstract(editor, abstractNumId, template, levels) {
161259
- const abstract = editor.converter.numbering?.abstracts?.[abstractNumId];
161260
- if (!abstract?.elements)
161261
- return {
161262
- changed: false,
161263
- error: "ABSTRACT_NOT_FOUND"
161264
- };
161265
- const templateByLevel = /* @__PURE__ */ new Map;
161266
- for (const entry of template.levels)
161267
- templateByLevel.set(entry.level, entry);
161268
- const targetLevels = levels ?? template.levels.map((l) => l.level);
161269
- for (const ilvl of targetLevels)
161270
- if (!templateByLevel.has(ilvl))
161271
- return {
161272
- changed: false,
161273
- error: "LEVEL_NOT_IN_TEMPLATE"
161274
- };
161275
- for (const ilvl of targetLevels)
161276
- if (!findLevelElement(abstract, ilvl))
161277
- return {
161278
- changed: false,
161279
- error: "LEVEL_NOT_IN_ABSTRACT"
161280
- };
161281
- let anyChanged = false;
161282
- for (const ilvl of targetLevels) {
161283
- const entry = templateByLevel.get(ilvl);
161284
- const lvlEl = findLevelElement(abstract, ilvl);
161285
- if (entry.numFmt != null || entry.lvlText != null) {
161286
- const fmtParams = {};
161287
- if (entry.numFmt != null)
161288
- fmtParams.numFmt = entry.numFmt;
161289
- if (entry.lvlText != null)
161290
- fmtParams.lvlText = entry.lvlText;
161291
- if (entry.start != null)
161292
- fmtParams.start = entry.start;
161293
- if (fmtParams.numFmt != null && fmtParams.lvlText != null)
161294
- anyChanged = mutateLevelNumberingFormat(lvlEl, fmtParams) || anyChanged;
161295
- else {
161296
- if (fmtParams.numFmt != null)
161297
- anyChanged = setChildAttr(lvlEl, "w:numFmt", fmtParams.numFmt) || anyChanged;
161298
- if (fmtParams.lvlText != null)
161299
- anyChanged = setChildAttr(lvlEl, "w:lvlText", fmtParams.lvlText) || anyChanged;
161300
- if (fmtParams.start != null)
161301
- anyChanged = setChildAttr(lvlEl, "w:start", String(fmtParams.start)) || anyChanged;
161302
- }
161303
- } else if (entry.start != null)
161304
- anyChanged = setChildAttr(lvlEl, "w:start", String(entry.start)) || anyChanged;
161305
- if (entry.alignment != null)
161306
- anyChanged = mutateLevelAlignment(lvlEl, entry.alignment) || anyChanged;
161307
- if (entry.indents != null)
161308
- anyChanged = mutateLevelIndents(lvlEl, entry.indents) || anyChanged;
161309
- if (entry.trailingCharacter != null)
161310
- anyChanged = mutateLevelTrailingCharacter(lvlEl, entry.trailingCharacter) || anyChanged;
161311
- if (entry.markerFont != null)
161312
- anyChanged = mutateLevelMarkerFont(lvlEl, entry.markerFont) || anyChanged;
161313
- if (entry.pictureBulletId != null)
161314
- anyChanged = mutateLevelPictureBulletId(lvlEl, entry.pictureBulletId) || anyChanged;
161315
- }
161316
- return { changed: anyChanged };
161317
- }
161318
- function buildOrderedPresetTemplate(config2) {
161319
- const levels = [];
161320
- for (let ilvl = 0;ilvl <= 8; ilvl++)
161321
- levels.push({
161322
- level: ilvl,
161323
- numFmt: config2.numFmt,
161324
- lvlText: `%${ilvl + 1}${config2.lvlTextSuffix}`,
161325
- start: 1,
161326
- alignment: "left",
161327
- indents: {
161328
- left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161329
- hanging: HANGING_INDENT_TWIPS
161330
- }
161331
- });
161332
- return {
161333
- version: 1,
161334
- levels
161335
- };
161336
- }
161337
- function buildBulletPresetTemplate(config2) {
161338
- const levels = [];
161339
- for (let ilvl = 0;ilvl <= 8; ilvl++)
161340
- levels.push({
161341
- level: ilvl,
161342
- numFmt: "bullet",
161343
- lvlText: config2.markerText,
161344
- start: 1,
161345
- alignment: "left",
161346
- markerFont: config2.fontFamily,
161347
- indents: {
161348
- left: INDENT_PER_LEVEL_TWIPS * (ilvl + 1),
161349
- hanging: HANGING_INDENT_TWIPS
161350
- }
161351
- });
161352
- return {
161353
- version: 1,
161354
- levels
161355
- };
161356
- }
161357
- function getPresetTemplate(presetId) {
161358
- return PRESET_TEMPLATES[presetId];
161359
- }
161360
162635
  function toListsFailure(code7, message, details) {
161361
162636
  return {
161362
162637
  success: false,
@@ -161386,13 +162661,13 @@ function validateLevelsArray(levels) {
161386
162661
  for (const lvl of levels)
161387
162662
  if (lvl < 0 || lvl > 8)
161388
162663
  return toListsFailure("LEVEL_OUT_OF_RANGE", "Each level must be between 0 and 8.", { level: lvl });
161389
- if (new Set(levels).size !== levels.length)
161390
- return toListsFailure("INVALID_INPUT", "levels must contain unique values.", { levels });
161391
- for (let i4 = 1;i4 < levels.length; i4++)
161392
- if (levels[i4] <= levels[i4 - 1])
161393
- return toListsFailure("INVALID_INPUT", "levels must be sorted in ascending order.", { levels });
161394
162664
  return null;
161395
162665
  }
162666
+ function normalizeLevels(levels) {
162667
+ if (!levels)
162668
+ return;
162669
+ return [...new Set(levels)].sort((a2, b$1) => a2 - b$1);
162670
+ }
161396
162671
  function preflightTemplateLevels(template, levels, target) {
161397
162672
  const templateLevelSet = new Set(template.levels.map((l) => l.level));
161398
162673
  const targetLevels = levels ?? template.levels.map((l) => l.level);
@@ -161751,6 +163026,303 @@ function listsSetLevelTrailingCharacterWrapper(editor, input2, options) {
161751
163026
  function listsSetLevelMarkerFontWrapper(editor, input2, options) {
161752
163027
  return executeSingleLevelMutation(editor, "lists.setLevelMarkerFont", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelMarkerFont(editor, abstractNumId, ilvl, input2.fontFamily));
161753
163028
  }
163029
+ function ensureSequenceLocalAbstract(editor, target, targetAbstractNumId, targetNumId) {
163030
+ if (!LevelFormattingHelpers.isAbstractShared(editor, targetAbstractNumId, targetNumId))
163031
+ return {
163032
+ abstractNumId: targetAbstractNumId,
163033
+ numId: targetNumId,
163034
+ sourceNumId: targetNumId,
163035
+ pendingRebind: null
163036
+ };
163037
+ const sequence = getContiguousSequence(editor, target);
163038
+ const sequenceNodeIds = new Set(sequence.map((item) => item.address.nodeId));
163039
+ const allItemsWithNumId = getAllListItemProjections(editor).filter((item) => item.numId === targetNumId);
163040
+ if (allItemsWithNumId.length === sequence.length && allItemsWithNumId.every((item) => sequenceNodeIds.has(item.address.nodeId))) {
163041
+ const { newAbstractNumId: newAbstractNumId$1 } = LevelFormattingHelpers.cloneAbstractIntoNum(editor, targetAbstractNumId, targetNumId);
163042
+ return {
163043
+ abstractNumId: newAbstractNumId$1,
163044
+ numId: targetNumId,
163045
+ sourceNumId: targetNumId,
163046
+ pendingRebind: null
163047
+ };
163048
+ }
163049
+ const { newAbstractNumId, newNumId } = LevelFormattingHelpers.cloneAbstractAndNum(editor, targetAbstractNumId, targetNumId);
163050
+ return {
163051
+ abstractNumId: newAbstractNumId,
163052
+ numId: newNumId,
163053
+ sourceNumId: targetNumId,
163054
+ pendingRebind: sequence
163055
+ };
163056
+ }
163057
+ function applyPendingRebind(editor, tr, local) {
163058
+ if (!local.pendingRebind)
163059
+ return;
163060
+ for (const item of local.pendingRebind)
163061
+ updateNumberingProperties({
163062
+ numId: local.numId,
163063
+ ilvl: item.level ?? 0
163064
+ }, item.candidate.node, item.candidate.pos, editor, tr);
163065
+ }
163066
+ function executeSequenceLocalLevelMutation(editor, operationId, target, level, options, mutate) {
163067
+ rejectTrackedMode(operationId, options);
163068
+ const levelError = validateLevel(level);
163069
+ if (levelError)
163070
+ return levelError;
163071
+ const targetResult = resolveTargetAbstract(editor, target);
163072
+ if (!targetResult.ok)
163073
+ return targetResult.failure;
163074
+ if (!LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, level))
163075
+ return toListsFailure("LEVEL_NOT_FOUND", `Level ${level} does not exist in the abstract definition.`, {
163076
+ target,
163077
+ level
163078
+ });
163079
+ if (options?.dryRun)
163080
+ return {
163081
+ success: true,
163082
+ item: targetResult.resolved.address
163083
+ };
163084
+ let noOp = false;
163085
+ const compound = compoundMutation({
163086
+ editor,
163087
+ source: operationId,
163088
+ affectedParts: [NUMBERING_PART],
163089
+ execute() {
163090
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, target), targetResult.abstractNumId, targetResult.numId);
163091
+ if (!mutatePart({
163092
+ editor,
163093
+ partId: NUMBERING_PART,
163094
+ operation: "mutate",
163095
+ source: operationId,
163096
+ expectedRevision: options?.expectedRevision,
163097
+ mutate({ part }) {
163098
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, level);
163099
+ if (!mutate(local.abstractNumId, level))
163100
+ return false;
163101
+ LevelFormattingHelpers.copySequenceStateOverrides(editor, local.sourceNumId, local.numId, [level]);
163102
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163103
+ return true;
163104
+ }
163105
+ }).changed) {
163106
+ noOp = true;
163107
+ return false;
163108
+ }
163109
+ const { tr } = editor.state;
163110
+ applyPendingRebind(editor, tr, local);
163111
+ dispatchEditorTransaction$1(editor, tr);
163112
+ if (local.pendingRebind)
163113
+ clearIndexCache(editor);
163114
+ return true;
163115
+ }
163116
+ });
163117
+ if (noOp)
163118
+ return toListsFailure("NO_OP", `${operationId}: values already match.`, { target });
163119
+ if (!compound.success)
163120
+ return toListsFailure("NO_OP", `${operationId}: mutation failed.`, { target });
163121
+ return {
163122
+ success: true,
163123
+ item: targetResult.resolved.address
163124
+ };
163125
+ }
163126
+ function listsGetStyleWrapper(editor, input2) {
163127
+ const levelsError = validateLevelsArray(input2.levels);
163128
+ if (levelsError)
163129
+ return levelsError;
163130
+ const normalized = normalizeLevels(input2.levels);
163131
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163132
+ if (!targetResult.ok)
163133
+ return targetResult.failure;
163134
+ const style2 = LevelFormattingHelpers.captureEffectiveStyle(editor, targetResult.abstractNumId, targetResult.numId, normalized);
163135
+ if (!style2)
163136
+ return toListsFailure("INVALID_TARGET", "Could not capture style from target.", { target: input2.target });
163137
+ return {
163138
+ success: true,
163139
+ style: style2
163140
+ };
163141
+ }
163142
+ function listsApplyStyleWrapper(editor, input2, options) {
163143
+ rejectTrackedMode("lists.applyStyle", options);
163144
+ if (input2.style.version !== 1)
163145
+ return toListsFailure("INVALID_INPUT", "Unsupported style version.", { version: input2.style.version });
163146
+ const levelsError = validateLevelsArray(input2.levels);
163147
+ if (levelsError)
163148
+ return levelsError;
163149
+ const normalized = normalizeLevels(input2.levels);
163150
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163151
+ if (!targetResult.ok)
163152
+ return targetResult.failure;
163153
+ const preflightError = preflightTemplateLevels(input2.style, normalized, input2.target);
163154
+ if (preflightError)
163155
+ return preflightError;
163156
+ if (options?.dryRun)
163157
+ return {
163158
+ success: true,
163159
+ item: targetResult.resolved.address
163160
+ };
163161
+ let applyError;
163162
+ let noOp = false;
163163
+ const compound = compoundMutation({
163164
+ editor,
163165
+ source: "lists.applyStyle",
163166
+ affectedParts: [NUMBERING_PART],
163167
+ execute() {
163168
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, input2.target), targetResult.abstractNumId, targetResult.numId);
163169
+ const result = mutatePart({
163170
+ editor,
163171
+ partId: NUMBERING_PART,
163172
+ operation: "mutate",
163173
+ source: "lists.applyStyle",
163174
+ expectedRevision: options?.expectedRevision,
163175
+ mutate({ part }) {
163176
+ const affectedLevels = normalized ?? input2.style.levels.map((l) => l.level);
163177
+ for (const ilvl of affectedLevels)
163178
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, ilvl);
163179
+ const applyResult = LevelFormattingHelpers.applyTemplateToAbstract(editor, local.abstractNumId, input2.style, normalized);
163180
+ if (applyResult.error) {
163181
+ applyError = applyResult.error;
163182
+ return false;
163183
+ }
163184
+ if (!applyResult.changed)
163185
+ return false;
163186
+ LevelFormattingHelpers.copySequenceStateOverrides(editor, local.sourceNumId, local.numId, affectedLevels);
163187
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163188
+ return true;
163189
+ }
163190
+ });
163191
+ if (applyError || !result.changed) {
163192
+ noOp = !applyError;
163193
+ return false;
163194
+ }
163195
+ const { tr } = editor.state;
163196
+ applyPendingRebind(editor, tr, local);
163197
+ dispatchEditorTransaction$1(editor, tr);
163198
+ if (local.pendingRebind)
163199
+ clearIndexCache(editor);
163200
+ return true;
163201
+ }
163202
+ });
163203
+ if (applyError)
163204
+ return toApplyTemplateError(applyError, input2.target);
163205
+ if (noOp)
163206
+ return toListsFailure("NO_OP", "All style levels already match.", { target: input2.target });
163207
+ if (!compound.success)
163208
+ return toListsFailure("NO_OP", "Style application failed.", { target: input2.target });
163209
+ return {
163210
+ success: true,
163211
+ item: targetResult.resolved.address
163212
+ };
163213
+ }
163214
+ function registerSetValueDelegate(fn) {
163215
+ _setValueDelegate = fn;
163216
+ }
163217
+ function listsRestartAtWrapper(editor, input2, options) {
163218
+ rejectTrackedMode("lists.restartAt", options);
163219
+ if (input2.startAt < 1 || !Number.isInteger(input2.startAt))
163220
+ return toListsFailure("INVALID_INPUT", "startAt must be a positive integer (>= 1).", { startAt: input2.startAt });
163221
+ const resolved = resolveListItem(editor, input2.target);
163222
+ if (resolved.numId == null)
163223
+ return toListsFailure("INVALID_TARGET", "Target must have numbering metadata.", { target: input2.target });
163224
+ if (resolved.kind === "bullet")
163225
+ return toListsFailure("INVALID_INPUT", "Cannot restart numbering on a bullet list.", { target: input2.target });
163226
+ if (!_setValueDelegate)
163227
+ return toListsFailure("INVALID_INPUT", "restartAt: internal delegate not registered.", { target: input2.target });
163228
+ return _setValueDelegate(editor, {
163229
+ target: input2.target,
163230
+ value: input2.startAt
163231
+ }, options);
163232
+ }
163233
+ function listsSetLevelNumberStyleWrapper(editor, input2, options) {
163234
+ if (input2.numberStyle === "bullet")
163235
+ return toListsFailure("INVALID_INPUT", "Use setLevelBullet or setLevelPictureBullet to set bullet format.", { numberStyle: input2.numberStyle });
163236
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelNumberStyle", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelNumberStyle(editor, abstractNumId, ilvl, input2.numberStyle));
163237
+ }
163238
+ function listsSetLevelTextWrapper(editor, input2, options) {
163239
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelText", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelText(editor, abstractNumId, ilvl, input2.text));
163240
+ }
163241
+ function listsSetLevelStartWrapper(editor, input2, options) {
163242
+ if (input2.startAt < 1 || !Number.isInteger(input2.startAt))
163243
+ return toListsFailure("INVALID_INPUT", "startAt must be a positive integer (>= 1).", { startAt: input2.startAt });
163244
+ if (!validateLevel(input2.level)) {
163245
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163246
+ if (targetResult.ok && LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, input2.level)) {
163247
+ const abstracts = getConverterNumbering(editor).abstracts;
163248
+ const lvlEl = LevelFormattingHelpers.findLevelElement(abstracts[targetResult.abstractNumId], input2.level);
163249
+ if (LevelFormattingHelpers.readLevelProperties(lvlEl, input2.level).numFmt === "bullet")
163250
+ return toListsFailure("INVALID_INPUT", "Cannot set start value on a bullet level.", {
163251
+ target: input2.target,
163252
+ level: input2.level
163253
+ });
163254
+ }
163255
+ }
163256
+ return executeSequenceLocalLevelMutation(editor, "lists.setLevelStart", input2.target, input2.level, options, (abstractNumId, ilvl) => LevelFormattingHelpers.setLevelStart(editor, abstractNumId, ilvl, input2.startAt));
163257
+ }
163258
+ function listsSetLevelLayoutWrapper(editor, input2, options) {
163259
+ rejectTrackedMode("lists.setLevelLayout", options);
163260
+ const levelError = validateLevel(input2.level);
163261
+ if (levelError)
163262
+ return levelError;
163263
+ const targetResult = resolveTargetAbstract(editor, input2.target);
163264
+ if (!targetResult.ok)
163265
+ return targetResult.failure;
163266
+ if (!LevelFormattingHelpers.hasLevel(editor, targetResult.abstractNumId, input2.level))
163267
+ return toListsFailure("LEVEL_NOT_FOUND", `Level ${input2.level} does not exist in the abstract definition.`, {
163268
+ target: input2.target,
163269
+ level: input2.level
163270
+ });
163271
+ if (options?.dryRun)
163272
+ return {
163273
+ success: true,
163274
+ item: targetResult.resolved.address
163275
+ };
163276
+ let noOp = false;
163277
+ let layoutError;
163278
+ const compound = compoundMutation({
163279
+ editor,
163280
+ source: "lists.setLevelLayout",
163281
+ affectedParts: [NUMBERING_PART],
163282
+ execute() {
163283
+ const local = ensureSequenceLocalAbstract(editor, resolveListItem(editor, input2.target), targetResult.abstractNumId, targetResult.numId);
163284
+ const result = mutatePart({
163285
+ editor,
163286
+ partId: NUMBERING_PART,
163287
+ operation: "mutate",
163288
+ source: "lists.setLevelLayout",
163289
+ expectedRevision: options?.expectedRevision,
163290
+ mutate({ part }) {
163291
+ LevelFormattingHelpers.materializeLevelFormattingOverride(editor, local.abstractNumId, local.numId, input2.level);
163292
+ const layoutResult = LevelFormattingHelpers.setLevelLayout(editor, local.abstractNumId, input2.level, input2.layout);
163293
+ if (layoutResult.error) {
163294
+ layoutError = layoutResult.error;
163295
+ return false;
163296
+ }
163297
+ if (!layoutResult.changed)
163298
+ return false;
163299
+ syncNumberingToXmlTree(part, getConverterNumbering(editor));
163300
+ return true;
163301
+ }
163302
+ });
163303
+ if (layoutError || !result.changed) {
163304
+ noOp = !layoutError;
163305
+ return false;
163306
+ }
163307
+ const { tr } = editor.state;
163308
+ applyPendingRebind(editor, tr, local);
163309
+ dispatchEditorTransaction$1(editor, tr);
163310
+ if (local.pendingRebind)
163311
+ clearIndexCache(editor);
163312
+ return true;
163313
+ }
163314
+ });
163315
+ if (layoutError)
163316
+ return toListsFailure("INVALID_INPUT", `Layout mutation failed: ${layoutError}.`, { target: input2.target });
163317
+ if (noOp)
163318
+ return toListsFailure("NO_OP", "lists.setLevelLayout: values already match.", { target: input2.target });
163319
+ if (!compound.success)
163320
+ return toListsFailure("NO_OP", "lists.setLevelLayout: mutation failed.", { target: input2.target });
163321
+ return {
163322
+ success: true,
163323
+ item: targetResult.resolved.address
163324
+ };
163325
+ }
161754
163326
  function listsClearLevelOverridesWrapper(editor, input2, options) {
161755
163327
  rejectTrackedMode("lists.clearLevelOverrides", options);
161756
163328
  const levelError = validateLevel(input2.level);
@@ -161926,7 +163498,7 @@ function resolveAnchor(editor, anchor, revision, index2) {
161926
163498
  }
161927
163499
  }
161928
163500
  function isEdgeNodeType(nodeType) {
161929
- return EDGE_NODE_TYPES.has(nodeType);
163501
+ return EDGE_NODE_TYPES$1.has(nodeType);
161930
163502
  }
161931
163503
  function computeTextOffset(editor, blockContentStart, absPos) {
161932
163504
  if (absPos <= blockContentStart)
@@ -162102,15 +163674,13 @@ function rangeContainsOnlyTextBlocks(index2, absFrom, absTo) {
162102
163674
  }
162103
163675
  return true;
162104
163676
  }
162105
- function resolveRange(editor, input2) {
163677
+ function resolveAbsoluteRange(editor, input2) {
162106
163678
  const revision = getRevision(editor);
162107
163679
  if (input2.expectedRevision !== undefined)
162108
163680
  checkRevision(editor, input2.expectedRevision);
162109
163681
  const index2 = getBlockIndex(editor);
162110
- const rawFrom = resolveAnchor(editor, input2.start, revision, index2);
162111
- const rawTo = resolveAnchor(editor, input2.end, revision, index2);
162112
- const absFrom = Math.min(rawFrom, rawTo);
162113
- const absTo = Math.max(rawFrom, rawTo);
163682
+ const absFrom = Math.min(input2.absFrom, input2.absTo);
163683
+ const absTo = Math.max(input2.absFrom, input2.absTo);
162114
163684
  const target = buildSelectionTarget(editor, index2, absFrom, absTo);
162115
163685
  const coversFullTarget = target.start.kind === "text" && target.end.kind === "text" && rangeContainsOnlyTextBlocks(index2, absFrom, absTo);
162116
163686
  return {
@@ -162124,6 +163694,16 @@ function resolveRange(editor, input2) {
162124
163694
  preview: buildPreview(editor, index2, absFrom, absTo)
162125
163695
  };
162126
163696
  }
163697
+ function resolveRange(editor, input2) {
163698
+ const revision = getRevision(editor);
163699
+ if (input2.expectedRevision !== undefined)
163700
+ checkRevision(editor, input2.expectedRevision);
163701
+ const index2 = getBlockIndex(editor);
163702
+ return resolveAbsoluteRange(editor, {
163703
+ absFrom: resolveAnchor(editor, input2.start, revision, index2),
163704
+ absTo: resolveAnchor(editor, input2.end, revision, index2)
163705
+ });
163706
+ }
162127
163707
  function resolveTableLocator(editor, locator, operationName) {
162128
163708
  const hasTarget = locator.target != null;
162129
163709
  const hasNodeId = locator.nodeId != null;
@@ -176574,6 +178154,7 @@ function assembleDocumentApiAdapters(editor) {
176574
178154
  registerPartDescriptor(relsPartDescriptor);
176575
178155
  registerPartDescriptor(numberingPartDescriptor);
176576
178156
  const ccAdapter = createContentControlsAdapter(editor);
178157
+ registerSetValueDelegate((ed, input2, options) => listsSetValueWrapper(ed, input2, options));
176577
178158
  return {
176578
178159
  get: { get: (input2) => getAdapter(editor, input2) },
176579
178160
  find: { find: (input2) => sdFindAdapter(editor, input2) },
@@ -176668,7 +178249,14 @@ function assembleDocumentApiAdapters(editor) {
176668
178249
  setLevelTrailingCharacter: (input2, options) => listsSetLevelTrailingCharacterWrapper(editor, input2, options),
176669
178250
  setLevelMarkerFont: (input2, options) => listsSetLevelMarkerFontWrapper(editor, input2, options),
176670
178251
  clearLevelOverrides: (input2, options) => listsClearLevelOverridesWrapper(editor, input2, options),
176671
- setType: (input2, options) => listsSetTypeWrapper(editor, input2, options)
178252
+ setType: (input2, options) => listsSetTypeWrapper(editor, input2, options),
178253
+ getStyle: (input2) => listsGetStyleWrapper(editor, input2),
178254
+ applyStyle: (input2, options) => listsApplyStyleWrapper(editor, input2, options),
178255
+ restartAt: (input2, options) => listsRestartAtWrapper(editor, input2, options),
178256
+ setLevelNumberStyle: (input2, options) => listsSetLevelNumberStyleWrapper(editor, input2, options),
178257
+ setLevelText: (input2, options) => listsSetLevelTextWrapper(editor, input2, options),
178258
+ setLevelStart: (input2, options) => listsSetLevelStartWrapper(editor, input2, options),
178259
+ setLevelLayout: (input2, options) => listsSetLevelLayoutWrapper(editor, input2, options)
176672
178260
  },
176673
178261
  sections: {
176674
178262
  list: (query2) => sectionsListAdapter(editor, query2),
@@ -176901,6 +178489,59 @@ function assembleDocumentApiAdapters(editor) {
176901
178489
  function getDocumentApiAdapters(editor) {
176902
178490
  return assembleDocumentApiAdapters(editor);
176903
178491
  }
178492
+ function selectCurrentPmSelection(editor) {
178493
+ return editor.state.selection;
178494
+ }
178495
+ function selectEffectivePmSelection(editor) {
178496
+ const liveSelection = editor.state.selection;
178497
+ if (!liveSelection.empty)
178498
+ return liveSelection;
178499
+ const preserved = getPreservedSelection(editor.state);
178500
+ if (preserved && !preserved.empty)
178501
+ return preserved;
178502
+ return liveSelection;
178503
+ }
178504
+ function classifyNodeSelection(editor, selection) {
178505
+ const node3 = selection.node;
178506
+ const mappedType = mapBlockNodeType(node3);
178507
+ if (mappedType && EDGE_NODE_TYPES.has(mappedType))
178508
+ return "block-edge";
178509
+ if (node3.isLeaf && node3.isInline) {
178510
+ if (editor.state.doc.resolve(selection.from).parent.inlineContent)
178511
+ return "inline-leaf";
178512
+ }
178513
+ return "reject";
178514
+ }
178515
+ function extractAbsoluteRange(editor, selection) {
178516
+ if ("$anchorCell" in selection)
178517
+ throw new DocumentApiAdapterError("INVALID_CONTEXT", "CellSelection cannot be converted to SelectionTarget. Use table-specific APIs for rectangular table selections.", { selectionType: selection.constructor.name });
178518
+ if (selection instanceof NodeSelection) {
178519
+ if (classifyNodeSelection(editor, selection) === "reject") {
178520
+ const displayType = mapBlockNodeType(selection.node) ?? selection.node.type.name;
178521
+ throw new DocumentApiAdapterError("INVALID_CONTEXT", `NodeSelection for node type "${displayType}" cannot be converted to SelectionTarget.`, {
178522
+ nodeType: displayType,
178523
+ pmNodeType: selection.node.type.name
178524
+ });
178525
+ }
178526
+ }
178527
+ return {
178528
+ absFrom: selection.from,
178529
+ absTo: selection.to
178530
+ };
178531
+ }
178532
+ function resolvePmSelectionToRange(editor, selection) {
178533
+ const { absFrom, absTo } = extractAbsoluteRange(editor, selection);
178534
+ return resolveAbsoluteRange(editor, {
178535
+ absFrom,
178536
+ absTo
178537
+ });
178538
+ }
178539
+ function resolveCurrentEditorSelectionRange(editor) {
178540
+ return resolvePmSelectionToRange(editor, selectCurrentPmSelection(editor));
178541
+ }
178542
+ function resolveEffectiveEditorSelectionRange(editor) {
178543
+ return resolvePmSelectionToRange(editor, selectEffectivePmSelection(editor));
178544
+ }
176904
178545
  function initPartsRuntime(editor) {
176905
178546
  registerPartDescriptor(stylesPartDescriptor);
176906
178547
  registerPartDescriptor(settingsPartDescriptor);
@@ -200586,7 +202227,19 @@ var Node$13 = class Node$14 {
200586
202227
  static create(config2) {
200587
202228
  return new Extension2(config2);
200588
202229
  }
200589
- }, isKeyboardInvocation = (event) => {
202230
+ }, CustomSelectionPluginKey, InclusiveTextSelectionBookmark = class InclusiveTextSelectionBookmark2 {
202231
+ constructor(anchor, head) {
202232
+ this.anchor = anchor;
202233
+ this.head = head;
202234
+ }
202235
+ map(mapping) {
202236
+ const isForward = this.anchor <= this.head;
202237
+ return new InclusiveTextSelectionBookmark2(mapping.map(this.anchor, isForward ? -1 : 1), mapping.map(this.head, isForward ? 1 : -1));
202238
+ }
202239
+ resolve(doc$12) {
202240
+ return TextSelection2.between(doc$12.resolve(this.anchor), doc$12.resolve(this.head));
202241
+ }
202242
+ }, nextHandleId = 1, SelectionHandlePluginKey, isKeyboardInvocation = (event) => {
200590
202243
  return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === undefined) && event.clientX === 0 && event.clientY === 0;
200591
202244
  }, prefersNativeMenu = (event) => {
200592
202245
  if (!event)
@@ -200599,7 +202252,7 @@ var Node$13 = class Node$14 {
200599
202252
  }, DEFAULT_SELECTION_STATE, normalizeSelectionState = (state = {}) => ({
200600
202253
  ...DEFAULT_SELECTION_STATE,
200601
202254
  ...state
200602
- }), CustomSelectionPluginKey, handleClickOutside = (event, editor) => {
202255
+ }), handleClickOutside = (event, editor) => {
200603
202256
  const editorElem = editor?.options?.element;
200604
202257
  if (!editorElem)
200605
202258
  return;
@@ -202848,7 +204501,7 @@ var Node$13 = class Node$14 {
202848
204501
  view.dispatch(tr);
202849
204502
  event.preventDefault();
202850
204503
  return true;
202851
- }, NAVIGATION_KEYS, Editable, EditorFocus, PositionTrackerExtension, global3, browser2, process3, cachedSetTimeout2, cachedClearTimeout2, queue3, draining2 = false, currentQueue2, queueIndex2 = -1, browserExports2, process$1$1, EventEmitter$1 = class {
204504
+ }, NAVIGATION_KEYS, Editable, EditorFocus, PositionTrackerExtension, SelectionHandleExtension, global3, browser2, process3, cachedSetTimeout2, cachedClearTimeout2, queue3, draining2 = false, currentQueue2, queueIndex2 = -1, browserExports2, process$1$1, EventEmitter$1 = class {
202852
204505
  #events = /* @__PURE__ */ new Map;
202853
204506
  on(name, fn) {
202854
204507
  const callbacks = this.#events.get(name);
@@ -206083,7 +207736,7 @@ var Node$13 = class Node$14 {
206083
207736
  return;
206084
207737
  const candidate = run2.pmEnd;
206085
207738
  return typeof candidate === "number" ? candidate : undefined;
206086
- }, engines_exports, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, CSS_NAMED_COLORS, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, DERIVED_ID_LENGTH = 24, groupedCache, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, EMPTY_RESOLUTION, CONTAINER_NODE_TYPES, VALID_EDGE_NODE_TYPES3, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, TEXT_STYLE_CHARACTER_STYLE_ATTR = "styleId", DIRECT_FORMATTING_MARK_NAMES, ALIGNMENT_TO_JUSTIFICATION, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, NUMBERING_PART = "word/numbering.xml", DEFAULT_PRESET_FOR_KIND, PREVIEW_TEXT_MAX_LENGTH = 2000, BLOCK_PREVIEW_MAX_LENGTH = 200, EDGE_NODE_TYPES, DOCX_HEX_ID_LENGTH = 8, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_OPS, TABLE_SCOPED_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, setNestedValue = (target, path2, value) => {
207739
+ }, engines_exports, DEFAULT_HEADER_FOOTER_MARGIN_PX = 0, LINK_MARK_NAME = "link", COMMENT_MARK_NAME, SUPPORTED_INLINE_TYPES, cacheByEditor, OBJECT_REPLACEMENT_CHAR = "", LINE_NUMBER_RESTART_VALUES, PAGE_NUMBER_FORMAT_VALUES, SECTION_ORIENTATION_VALUES, SECTION_VERTICAL_ALIGN_VALUES, readSectPrHeaderFooterRefs, PIXELS_PER_INCH$2 = 96, BULLET_FORMATS$1, LOCK_MODE_TO_SDT_LOCK, SDT_NODE_NAMES, SDT_BLOCK_NAME = "structuredContentBlock", VALID_CONTROL_TYPES, VALID_LOCK_MODES, VALID_APPEARANCES, SNIPPET_PADDING = 30, DUAL_KIND_TYPES, KNOWN_BLOCK_PM_NODE_TYPES, KNOWN_INLINE_PM_NODE_TYPES, MAX_PATTERN_LENGTH = 1024, TOGGLE_MARK_SPECS, CORE_MARK_NAMES, METADATA_MARK_NAMES, CSS_NAMED_COLORS, HEADING_STYLE_DEPTH, BULLET_FORMATS, MARK_PRIORITY, remarkProcessor, DEFAULT_UNFLATTEN_LISTS = true, DERIVED_ID_LENGTH = 24, groupedCache, FIELD_LIKE_SDT_TYPES, liveDocumentCountsCache, REQUIRED_COMMANDS, VALID_CAPABILITY_REASON_CODES, REQUIRED_HELPERS, SCHEMA_NODE_GATES, schemaGatedIds, SUPPORTED_NON_UNIFORM_STRATEGIES, SUPPORTED_SET_MARKS, REGEX_MAX_PATTERN_LENGTH = 1024, registry, VALID_CREATE_POSITIONS, REF_HANDLERS, STEP_INTERACTION_MATRIX, MATRIX_EXEMPT_OPS, DEFAULT_INLINE_POLICY, CORE_SET_MARK_KEYS, BOOLEAN_INLINE_MARK_KEYS, TEXT_STYLE_KEYS, PRESERVE_RUN_PROPERTIES_META_KEY = "sdPreserveRunPropertiesKeys", CONTENT_CAPABILITIES, INLINE_CAPABILITIES, SDT_LOCK_TO_LOCK_MODE, STUB_WHERE, EMPTY_RESOLUTION, CONTAINER_NODE_TYPES, VALID_EDGE_NODE_TYPES3, FALLBACK_STORE_KEY = "__documentApiComments", STYLES_PART = "word/styles.xml", PROPERTIES_KEY_BY_CHANNEL, XML_PATH_BY_CHANNEL2, UNDERLINE_API_TO_STORAGE, UNDERLINE_STORAGE_TO_API, HEX_SUBKEYS_BY_PROPERTY, PARAGRAPH_NODE_TYPES, TEXT_STYLE_CHARACTER_STYLE_ATTR = "styleId", DIRECT_FORMATTING_MARK_NAMES, ALIGNMENT_TO_JUSTIFICATION, SUPPORTED_DELETE_NODE_TYPES3, REJECTED_DELETE_NODE_TYPES3, TEXT_PREVIEW_MAX_LENGTH = 80, RANGE_DELETE_SAFE_NODE_TYPES, INDENT_PER_LEVEL_TWIPS = 720, HANGING_INDENT_TWIPS = 360, ORDERED_PRESET_CONFIG, BULLET_PRESET_CONFIG, PRESET_TEMPLATES, LevelFormattingHelpers, 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, DOCX_HEX_ID_LENGTH = 8, SETTINGS_PART_PATH = "word/settings.xml", POINTS_TO_PIXELS, POINTS_TO_TWIPS = 20, PIXELS_TO_TWIPS, DEFAULT_TABLE_GRID_WIDTH_TWIPS = 1500, SETTINGS_PART = "word/settings.xml", TABLE_ADAPTER_DISPATCH, ROW_OPS, TABLE_SCOPED_OPS, registered = false, STYLES_PART_ID = "word/styles.xml", stylesPartDescriptor, settingsPartDescriptor, RELS_PART_ID2 = "word/_rels/document.xml.rels", RELS_XMLNS$1 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", relsPartDescriptor, DOCUMENT_RELS_PATH$1 = "word/_rels/document.xml.rels", RELS_XMLNS2 = "http://schemas.openxmlformats.org/package/2006/relationships", HEADER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE$1 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", WORDPROCESSINGML_XMLNS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", OFFICE_DOCUMENT_RELS_XMLNS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships", RELATIONSHIP_ID_PATTERN, HEADER_FILE_PATTERN$1, FOOTER_FILE_PATTERN$1, HISTORY_UNSAFE_OPS, IGNORED_ATTRIBUTE_KEYS, TRACK_CHANGE_MARK_NAMES, TRACK_CHANGE_IGNORED_ATTRIBUTE_KEYS, VOLATILE_PARAGRAPH_ATTRS, VOLATILE_IMAGE_ORIGINAL_ATTR_KEYS, SIMILARITY_THRESHOLD = 0.65, MIN_LENGTH_FOR_SIMILARITY = 4, COMMENT_ATTRS_DIFF_IGNORED_KEYS, setNestedValue = (target, path2, value) => {
206087
207740
  if (!path2.includes(".")) {
206088
207741
  target[path2] = value;
206089
207742
  return;
@@ -206696,7 +208349,7 @@ var Node$13 = class Node$14 {
206696
208349
  candidate = String(parseInt(hex, 16));
206697
208350
  } while (!candidate || existingIds.has(candidate));
206698
208351
  return candidate;
206699
- }, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, SPECIAL_NOTE_TYPES, FOOTNOTES_PART_ID = "word/footnotes.xml", ENDNOTES_PART_ID = "word/endnotes.xml", FOOTNOTES_CONFIG, ENDNOTES_CONFIG, NOTES_XMLNS, footnotesPartDescriptor, endnotesPartDescriptor, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_TYPES, TOA_LEADER_REVERSE_MAP, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.20.0", PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
208352
+ }, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE2 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN, FOOTER_FILE_PATTERN, SPECIAL_NOTE_TYPES, FOOTNOTES_PART_ID = "word/footnotes.xml", ENDNOTES_PART_ID = "word/endnotes.xml", FOOTNOTES_CONFIG, ENDNOTES_CONFIG, NOTES_XMLNS, footnotesPartDescriptor, endnotesPartDescriptor, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, FIELD_NODE_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.20.0", PIXELS_PER_INCH$1 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, Editor, ContextMenuPluginKey, MENU_OFFSET_X = 0, MENU_OFFSET_Y = 28, CONTEXT_MENU_OFFSET_X = 10, CONTEXT_MENU_OFFSET_Y = 10, SLASH_COOLDOWN_MS = 5000, ContextMenu, SearchQuery = class {
206700
208353
  constructor(config2) {
206701
208354
  this.search = config2.search;
206702
208355
  this.caseSensitive = !!config2.caseSensitive;
@@ -218756,6 +220409,7 @@ var Node$13 = class Node$14 {
218756
220409
  mediaFiles: editor.storage.image.media,
218757
220410
  fonts: editor.options.fonts,
218758
220411
  isHeaderOrFooter: true,
220412
+ headerFooterType: type,
218759
220413
  isHeadless: editor.options.isHeadless,
218760
220414
  pagination: false,
218761
220415
  annotations: true,
@@ -225108,9 +226762,9 @@ var Node$13 = class Node$14 {
225108
226762
  return false;
225109
226763
  return Boolean(checker(attrs));
225110
226764
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
225111
- var init_src_B0uLvfdR_es = __esm(() => {
226765
+ var init_src_D3r_lb_g_es = __esm(() => {
225112
226766
  init_rolldown_runtime_B2q5OVn9_es();
225113
- init_SuperConverter_BcBeadrv_es();
226767
+ init_SuperConverter_hOU3ez7P_es();
225114
226768
  init_jszip_ChlR43oI_es();
225115
226769
  init_uuid_qzgm05fK_es();
225116
226770
  init_constants_ep1_Gwqi_es();
@@ -225662,13 +227316,14 @@ ${err.toString()}`);
225662
227316
  }
225663
227317
  }
225664
227318
  };
227319
+ CustomSelectionPluginKey = new PluginKey("CustomSelection");
227320
+ SelectionHandlePluginKey = new PluginKey("selectionHandle");
225665
227321
  DEFAULT_SELECTION_STATE = Object.freeze({
225666
227322
  focused: false,
225667
227323
  preservedSelection: null,
225668
227324
  showVisualSelection: false,
225669
227325
  skipFocusReset: false
225670
227326
  });
225671
- CustomSelectionPluginKey = new PluginKey("CustomSelection");
225672
227327
  CustomSelection = Extension.create({
225673
227328
  name: "customSelection",
225674
227329
  addPmPlugins() {
@@ -226214,6 +227869,12 @@ ${err.toString()}`);
226214
227869
  this.storage.tracker = null;
226215
227870
  }
226216
227871
  });
227872
+ SelectionHandleExtension = Extension.create({
227873
+ name: "selectionHandle",
227874
+ addPmPlugins() {
227875
+ return [createSelectionHandlePlugin()];
227876
+ }
227877
+ });
226217
227878
  global3 = globalThis || self;
226218
227879
  browser2 = { exports: {} };
226219
227880
  process3 = browser2.exports = {};
@@ -233087,18 +234748,41 @@ function print() { __p += __j.call(arguments, '') }
233087
234748
  setLevelIndents,
233088
234749
  setLevelTrailingCharacter,
233089
234750
  setLevelMarkerFont,
233090
- hasLevelOverride,
234751
+ setLevelTabStop,
234752
+ setLevelNumberStyle,
234753
+ setLevelText,
234754
+ setLevelStart,
234755
+ setLevelLayout,
234756
+ hasLevelOverride: hasLevelOverride$1,
233091
234757
  clearLevelOverride,
234758
+ materializeLevelFormattingOverride,
233092
234759
  captureTemplate,
233093
234760
  applyTemplateToAbstract,
234761
+ captureEffectiveStyle,
234762
+ isAbstractShared,
234763
+ cloneAbstractIntoNum,
234764
+ cloneAbstractAndNum,
234765
+ copySequenceStateOverrides,
233094
234766
  getPresetTemplate,
233095
234767
  PRESET_TEMPLATES
233096
234768
  };
234769
+ PRESET_KIND_MAP = {
234770
+ decimal: "ordered",
234771
+ decimalParenthesis: "ordered",
234772
+ lowerLetter: "ordered",
234773
+ upperLetter: "ordered",
234774
+ lowerRoman: "ordered",
234775
+ upperRoman: "ordered",
234776
+ disc: "bullet",
234777
+ circle: "bullet",
234778
+ square: "bullet",
234779
+ dash: "bullet"
234780
+ };
233097
234781
  DEFAULT_PRESET_FOR_KIND = {
233098
234782
  ordered: "decimal",
233099
234783
  bullet: "disc"
233100
234784
  };
233101
- EDGE_NODE_TYPES = new Set(SELECTION_EDGE_NODE_TYPES2);
234785
+ EDGE_NODE_TYPES$1 = new Set(SELECTION_EDGE_NODE_TYPES2);
233102
234786
  POINTS_TO_PIXELS = 96 / 72;
233103
234787
  PIXELS_TO_TWIPS = 1440 / 96;
233104
234788
  TABLE_ADAPTER_DISPATCH = {
@@ -233496,6 +235180,7 @@ function print() { __p += __j.call(arguments, '') }
233496
235180
  "-": "hyphen",
233497
235181
  _: "underscore"
233498
235182
  };
235183
+ EDGE_NODE_TYPES = new Set(SELECTION_EDGE_NODE_TYPES2);
233499
235184
  contentTypesPartDescriptor = {
233500
235185
  id: CONTENT_TYPES_PART_ID,
233501
235186
  ensurePart() {
@@ -234040,6 +235725,39 @@ function print() { __p += __j.call(arguments, '') }
234040
235725
  this.#documentApi = createDocumentApi2(getDocumentApiAdapters(this));
234041
235726
  return this.#documentApi;
234042
235727
  }
235728
+ #getDefaultSelectionHandleSurface() {
235729
+ const explicitType = this.options.headerFooterType;
235730
+ return explicitType === "header" || explicitType === "footer" ? explicitType : "body";
235731
+ }
235732
+ captureCurrentSelectionHandle(surface) {
235733
+ this.#assertState("ready", "saving");
235734
+ const selection = selectCurrentPmSelection(this);
235735
+ return captureSelectionHandle(this, selection, surface ?? this.#getDefaultSelectionHandleSurface());
235736
+ }
235737
+ captureEffectiveSelectionHandle(surface) {
235738
+ this.#assertState("ready", "saving");
235739
+ const selection = selectEffectivePmSelection(this);
235740
+ return captureSelectionHandle(this, selection, surface ?? this.#getDefaultSelectionHandleSurface());
235741
+ }
235742
+ resolveSelectionHandle(handle3) {
235743
+ this.#assertState("ready", "saving");
235744
+ const selection = resolveHandleToSelection(handle3);
235745
+ if (!selection)
235746
+ return null;
235747
+ return resolvePmSelectionToRange(handle3._owner, selection);
235748
+ }
235749
+ releaseSelectionHandle(handle3) {
235750
+ this.#assertState("ready", "saving");
235751
+ releaseSelectionHandle(handle3);
235752
+ }
235753
+ getCurrentSelectionRange() {
235754
+ this.#assertState("ready", "saving");
235755
+ return resolveCurrentEditorSelectionRange(this);
235756
+ }
235757
+ getEffectiveSelectionRange() {
235758
+ this.#assertState("ready", "saving");
235759
+ return resolveEffectiveEditorSelectionRange(this);
235760
+ }
234043
235761
  get helpers() {
234044
235762
  return this.extensionService.helpers;
234045
235763
  }
@@ -234268,7 +235986,8 @@ function print() { __p += __j.call(arguments, '') }
234268
235986
  Commands,
234269
235987
  EditorFocus,
234270
235988
  Keymap,
234271
- PositionTrackerExtension
235989
+ PositionTrackerExtension,
235990
+ SelectionHandleExtension
234272
235991
  ];
234273
235992
  const externalExtensions = this.options.externalExtensions || [];
234274
235993
  const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension2) => {
@@ -243455,6 +245174,61 @@ function print() { __p += __j.call(arguments, '') }
243455
245174
  return this.#editor;
243456
245175
  return activeHfEditor;
243457
245176
  }
245177
+ #resolveActiveSurface() {
245178
+ const mode = this.#headerFooterSession?.session?.mode ?? "body";
245179
+ if (mode === "header")
245180
+ return "header";
245181
+ if (mode === "footer")
245182
+ return "footer";
245183
+ return "body";
245184
+ }
245185
+ captureCurrentSelectionHandle() {
245186
+ const surface = this.#resolveActiveSurface();
245187
+ return this.getActiveEditor().captureCurrentSelectionHandle(surface);
245188
+ }
245189
+ captureEffectiveSelectionHandle() {
245190
+ const surface = this.#resolveActiveSurface();
245191
+ return this.getActiveEditor().captureEffectiveSelectionHandle(surface);
245192
+ }
245193
+ resolveSelectionHandle(handle3) {
245194
+ const ownerEditor = handle3._owner;
245195
+ const range = ownerEditor.resolveSelectionHandle(handle3);
245196
+ if (!range)
245197
+ return null;
245198
+ return {
245199
+ editor: ownerEditor,
245200
+ doc: ownerEditor.doc,
245201
+ surface: handle3.surface,
245202
+ range
245203
+ };
245204
+ }
245205
+ releaseSelectionHandle(handle3) {
245206
+ handle3._owner.releaseSelectionHandle(handle3);
245207
+ }
245208
+ getCurrentSelectionRange() {
245209
+ return this.getActiveEditor().getCurrentSelectionRange();
245210
+ }
245211
+ getEffectiveSelectionRange() {
245212
+ return this.getActiveEditor().getEffectiveSelectionRange();
245213
+ }
245214
+ getCurrentSelectionContext() {
245215
+ const activeEditor = this.getActiveEditor();
245216
+ return {
245217
+ editor: activeEditor,
245218
+ doc: activeEditor.doc,
245219
+ surface: this.#resolveActiveSurface(),
245220
+ range: activeEditor.getCurrentSelectionRange()
245221
+ };
245222
+ }
245223
+ getEffectiveSelectionContext() {
245224
+ const activeEditor = this.getActiveEditor();
245225
+ return {
245226
+ editor: activeEditor,
245227
+ doc: activeEditor.doc,
245228
+ surface: this.#resolveActiveSurface(),
245229
+ range: activeEditor.getEffectiveSelectionRange()
245230
+ };
245231
+ }
243458
245232
  undo() {
243459
245233
  const editor = this.getActiveEditor();
243460
245234
  if (editor?.commands?.undo)
@@ -258207,8 +259981,8 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
258207
259981
 
258208
259982
  // ../../packages/superdoc/dist/super-editor.es.js
258209
259983
  var init_super_editor_es = __esm(() => {
258210
- init_src_B0uLvfdR_es();
258211
- init_SuperConverter_BcBeadrv_es();
259984
+ init_src_D3r_lb_g_es();
259985
+ init_SuperConverter_hOU3ez7P_es();
258212
259986
  init_jszip_ChlR43oI_es();
258213
259987
  init_xml_js_BtmJ6bNs_es();
258214
259988
  init_constants_ep1_Gwqi_es();
@@ -315768,6 +317542,15 @@ function acceptsLegacyTextAddressTarget(operationId, param, value2) {
315768
317542
  const docApiId = toDocApiId(operationId);
315769
317543
  return docApiId === "replace" || docApiId === "delete" || docApiId?.startsWith("format.") === true;
315770
317544
  }
317545
+ function extractConstValues(variants) {
317546
+ const values2 = [];
317547
+ for (const variant of variants) {
317548
+ if (!("const" in variant))
317549
+ return [];
317550
+ values2.push(String(variant.const));
317551
+ }
317552
+ return values2;
317553
+ }
315771
317554
  function validateValueAgainstTypeSpec(value2, schema, path2) {
315772
317555
  if ("const" in schema) {
315773
317556
  if (value2 !== schema.const) {
@@ -315786,7 +317569,9 @@ function validateValueAgainstTypeSpec(value2, schema, path2) {
315786
317569
  errors2.push(error2 instanceof Error ? error2.message : String(error2));
315787
317570
  }
315788
317571
  }
315789
- throw new CliError("VALIDATION_ERROR", `${path2} must match one of the allowed schema variants.`, { errors: errors2 });
317572
+ const allowedValues = extractConstValues(variants);
317573
+ const message = allowedValues.length > 0 ? `${path2} must be one of: ${allowedValues.join(", ")}.` : `${path2} must match one of the allowed schema variants.`;
317574
+ throw new CliError("VALIDATION_ERROR", message, { errors: errors2 });
315790
317575
  }
315791
317576
  if (schema.type === "json")
315792
317577
  return;