@harbour-enterprises/superdoc 0.21.0 → 0.22.0-next.1

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 (43) hide show
  1. package/dist/chunks/{PdfViewer-OZDJ7gwT.cjs → PdfViewer-B3KmcDup.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-D3zo7tPo.es.js → PdfViewer-BpwMPbUj.es.js} +1 -1
  3. package/dist/chunks/{index-CfYf4T_z.cjs → index-BOf6E2I4.cjs} +5 -4
  4. package/dist/chunks/{index-MzW5BVNd.es.js → index-Cw4YywoD.es.js} +5 -4
  5. package/dist/chunks/{super-editor.es-U-GVCd_F.cjs → super-editor.es-DHDx2fsy.cjs} +1181 -766
  6. package/dist/chunks/{super-editor.es-Bntob7Wd.es.js → super-editor.es-vfoWxyZL.es.js} +1181 -766
  7. package/dist/core/types/index.d.ts +8 -0
  8. package/dist/core/types/index.d.ts.map +1 -1
  9. package/dist/style.css +32 -27
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-3xnF_NHq.js → converter-BcqEfCTg.js} +775 -645
  12. package/dist/super-editor/chunks/{docx-zipper-CZdELYi-.js → docx-zipper-DZ9ph0iQ.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-BqYH4kDD.js → editor-BC2sSIVa.js} +19 -3
  14. package/dist/super-editor/chunks/{toolbar-TkaE2kKM.js → toolbar-DNTo5DDf.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/src/components/slash-menu/contextmenu-helpers.d.ts +1 -0
  20. package/dist/super-editor/src/components/slash-menu/menuItems.d.ts +5 -1
  21. package/dist/super-editor/src/components/slash-menu/tests/testHelpers.d.ts +466 -0
  22. package/dist/super-editor/src/components/slash-menu/utils.d.ts +9 -2
  23. package/dist/super-editor/src/core/commands/__tests__/schemaWithLists.d.ts +2 -0
  24. package/dist/super-editor/src/core/commands/__tests__/testHelpers.d.ts +4 -0
  25. package/dist/super-editor/src/core/commands/__tests__/testSchema.d.ts +2 -0
  26. package/dist/super-editor/src/core/commands/tests/commandTestUtils.d.ts +7 -0
  27. package/dist/super-editor/src/core/commands/tests/test-schema.d.ts +2 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/alternate-content-translator.d.ts +6 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/mc/altermateContent/index.d.ts +1 -0
  30. package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +1 -0
  31. package/dist/super-editor/src/tests/helpers/helpers.d.ts +1 -0
  32. package/dist/super-editor/style.css +5 -0
  33. package/dist/super-editor/super-editor.es.js +461 -153
  34. package/dist/super-editor/toolbar.es.js +2 -2
  35. package/dist/super-editor.cjs +1 -1
  36. package/dist/super-editor.es.js +1 -1
  37. package/dist/superdoc.cjs +2 -2
  38. package/dist/superdoc.es.js +2 -2
  39. package/dist/superdoc.umd.js +1184 -768
  40. package/dist/superdoc.umd.js.map +1 -1
  41. package/package.json +1 -1
  42. package/dist/super-editor/src/extensions/run-item/index.d.ts +0 -1
  43. package/dist/super-editor/src/extensions/run-item/run-item.d.ts +0 -26
@@ -24333,37 +24333,37 @@ const _NodeTranslator = class _NodeTranslator2 {
24333
24333
  };
24334
24334
  __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
24335
24335
  let NodeTranslator = _NodeTranslator;
24336
- const encode$17 = (attributes) => {
24336
+ const encode$18 = (attributes) => {
24337
24337
  return attributes["w:type"];
24338
24338
  };
24339
- const decode$_ = (attrs) => {
24339
+ const decode$$ = (attrs) => {
24340
24340
  const { lineBreakType } = attrs;
24341
24341
  return lineBreakType;
24342
24342
  };
24343
24343
  const attrConfig$F = Object.freeze({
24344
24344
  xmlName: "w:type",
24345
24345
  sdName: "lineBreakType",
24346
- encode: encode$17,
24347
- decode: decode$_
24346
+ encode: encode$18,
24347
+ decode: decode$$
24348
24348
  });
24349
- const encode$16 = (attributes) => {
24349
+ const encode$17 = (attributes) => {
24350
24350
  const xmlAttrValue = attributes["w:clear"];
24351
24351
  return xmlAttrValue;
24352
24352
  };
24353
- const decode$Z = (attrs) => {
24353
+ const decode$_ = (attrs) => {
24354
24354
  const { clear } = attrs;
24355
24355
  return clear;
24356
24356
  };
24357
24357
  const attrConfig$E = Object.freeze({
24358
24358
  xmlName: "w:clear",
24359
24359
  sdName: "clear",
24360
- encode: encode$16,
24361
- decode: decode$Z
24360
+ encode: encode$17,
24361
+ decode: decode$_
24362
24362
  });
24363
- const validXmlAttributes$l = [attrConfig$F, attrConfig$E];
24364
- const XML_NODE_NAME$t = "w:br";
24365
- const SD_NODE_NAME$c = "lineBreak";
24366
- const encode$15 = (_2, encodedAttrs) => {
24363
+ const validXmlAttributes$m = [attrConfig$F, attrConfig$E];
24364
+ const XML_NODE_NAME$u = "w:br";
24365
+ const SD_NODE_NAME$d = "lineBreak";
24366
+ const encode$16 = (_2, encodedAttrs) => {
24367
24367
  const isPageBreak = encodedAttrs?.lineBreakType === "page";
24368
24368
  const translated = {
24369
24369
  type: isPageBreak ? "hardBreak" : "lineBreak"
@@ -24373,7 +24373,7 @@ const encode$15 = (_2, encodedAttrs) => {
24373
24373
  }
24374
24374
  return translated;
24375
24375
  };
24376
- const decode$Y = (params2, decodedAttrs) => {
24376
+ const decode$Z = (params2, decodedAttrs) => {
24377
24377
  const { node } = params2;
24378
24378
  if (!node) return;
24379
24379
  const wBreak = { name: "w:br" };
@@ -24390,39 +24390,39 @@ const decode$Y = (params2, decodedAttrs) => {
24390
24390
  };
24391
24391
  return translated;
24392
24392
  };
24393
- const config$r = {
24394
- xmlName: XML_NODE_NAME$t,
24395
- sdNodeOrKeyName: SD_NODE_NAME$c,
24393
+ const config$s = {
24394
+ xmlName: XML_NODE_NAME$u,
24395
+ sdNodeOrKeyName: SD_NODE_NAME$d,
24396
24396
  type: NodeTranslator.translatorTypes.NODE,
24397
- encode: encode$15,
24398
- decode: decode$Y,
24399
- attributes: validXmlAttributes$l
24397
+ encode: encode$16,
24398
+ decode: decode$Z,
24399
+ attributes: validXmlAttributes$m
24400
24400
  };
24401
- const translator$15 = NodeTranslator.from(config$r);
24402
- const encode$14 = (attributes) => attributes?.["w:val"];
24403
- const decode$X = (attrs) => attrs?.highlight;
24401
+ const translator$16 = NodeTranslator.from(config$s);
24402
+ const encode$15 = (attributes) => attributes?.["w:val"];
24403
+ const decode$Y = (attrs) => attrs?.highlight;
24404
24404
  const attrConfig$D = Object.freeze({
24405
24405
  xmlName: "w:val",
24406
24406
  sdName: "highlight",
24407
- encode: encode$14,
24408
- decode: decode$X
24407
+ encode: encode$15,
24408
+ decode: decode$Y
24409
24409
  });
24410
- const validXmlAttributes$k = [attrConfig$D];
24411
- const XML_NODE_NAME$s = "w:highlight";
24410
+ const validXmlAttributes$l = [attrConfig$D];
24411
+ const XML_NODE_NAME$t = "w:highlight";
24412
24412
  const SD_ATTR_KEY$f = "highlight";
24413
24413
  const DISABLED_TOKENS = /* @__PURE__ */ new Set(["transparent", "none", "inherit"]);
24414
- const encode$13 = (params2, encodedAttrs = {}) => {
24414
+ const encode$14 = (params2, encodedAttrs = {}) => {
24415
24415
  const { nodes } = params2;
24416
24416
  const node = nodes?.[0];
24417
24417
  const value = encodedAttrs.highlight ?? node?.attributes?.["w:val"];
24418
24418
  return {
24419
24419
  type: "attr",
24420
- xmlName: XML_NODE_NAME$s,
24420
+ xmlName: XML_NODE_NAME$t,
24421
24421
  sdNodeOrKeyName: SD_ATTR_KEY$f,
24422
24422
  attributes: { "w:val": value ?? null }
24423
24423
  };
24424
24424
  };
24425
- const decode$W = (params2) => {
24425
+ const decode$X = (params2) => {
24426
24426
  const attrs = params2?.node?.attrs || {};
24427
24427
  const highlightValue = attrs.highlight ?? attrs.color ?? null;
24428
24428
  if (!highlightValue) return void 0;
@@ -24430,14 +24430,14 @@ const decode$W = (params2) => {
24430
24430
  if (!normalizedValue) return void 0;
24431
24431
  if (DISABLED_TOKENS.has(normalizedValue)) {
24432
24432
  return {
24433
- name: XML_NODE_NAME$s,
24433
+ name: XML_NODE_NAME$t,
24434
24434
  attributes: { "w:val": "none" }
24435
24435
  };
24436
24436
  }
24437
24437
  const keyword = getDocxHighlightKeywordFromHex(highlightValue);
24438
24438
  if (keyword) {
24439
24439
  return {
24440
- name: XML_NODE_NAME$s,
24440
+ name: XML_NODE_NAME$t,
24441
24441
  attributes: { "w:val": keyword }
24442
24442
  };
24443
24443
  }
@@ -24452,63 +24452,63 @@ const decode$W = (params2) => {
24452
24452
  }
24453
24453
  };
24454
24454
  };
24455
- const config$q = {
24456
- xmlName: XML_NODE_NAME$s,
24455
+ const config$r = {
24456
+ xmlName: XML_NODE_NAME$t,
24457
24457
  sdNodeOrKeyName: SD_ATTR_KEY$f,
24458
24458
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
24459
- encode: encode$13,
24460
- decode: decode$W,
24461
- attributes: validXmlAttributes$k
24459
+ encode: encode$14,
24460
+ decode: decode$X,
24461
+ attributes: validXmlAttributes$l
24462
24462
  };
24463
- const translator$14 = NodeTranslator.from(config$q);
24464
- const encode$12 = (attributes) => {
24463
+ const translator$15 = NodeTranslator.from(config$r);
24464
+ const encode$13 = (attributes) => {
24465
24465
  return attributes["w:val"];
24466
24466
  };
24467
- const decode$V = (attrs) => {
24467
+ const decode$W = (attrs) => {
24468
24468
  const { tabSize } = attrs || {};
24469
24469
  return tabSize;
24470
24470
  };
24471
24471
  const attrConfig$C = Object.freeze({
24472
24472
  xmlName: "w:val",
24473
24473
  sdName: "tabSize",
24474
- encode: encode$12,
24475
- decode: decode$V
24474
+ encode: encode$13,
24475
+ decode: decode$W
24476
24476
  });
24477
- const encode$11 = (attributes) => {
24477
+ const encode$12 = (attributes) => {
24478
24478
  return attributes["w:leader"];
24479
24479
  };
24480
- const decode$U = (attrs) => {
24480
+ const decode$V = (attrs) => {
24481
24481
  const { leader } = attrs || {};
24482
24482
  return leader;
24483
24483
  };
24484
24484
  const attrConfig$B = Object.freeze({
24485
24485
  xmlName: "w:leader",
24486
24486
  sdName: "leader",
24487
- encode: encode$11,
24488
- decode: decode$U
24487
+ encode: encode$12,
24488
+ decode: decode$V
24489
24489
  });
24490
- const encode$10 = (attributes) => {
24490
+ const encode$11 = (attributes) => {
24491
24491
  return attributes["w:pos"];
24492
24492
  };
24493
- const decode$T = (attrs) => {
24493
+ const decode$U = (attrs) => {
24494
24494
  const { pos } = attrs || {};
24495
24495
  return pos;
24496
24496
  };
24497
24497
  const attrConfig$A = Object.freeze({
24498
24498
  xmlName: "w:pos",
24499
24499
  sdName: "pos",
24500
- encode: encode$10,
24501
- decode: decode$T
24500
+ encode: encode$11,
24501
+ decode: decode$U
24502
24502
  });
24503
- const validXmlAttributes$j = [attrConfig$C, attrConfig$A, attrConfig$B];
24504
- const XML_NODE_NAME$r = "w:tab";
24505
- const SD_NODE_NAME$b = "tab";
24506
- const encode$$ = (_2, encodedAttrs = {}) => {
24503
+ const validXmlAttributes$k = [attrConfig$C, attrConfig$A, attrConfig$B];
24504
+ const XML_NODE_NAME$s = "w:tab";
24505
+ const SD_NODE_NAME$c = "tab";
24506
+ const encode$10 = (_2, encodedAttrs = {}) => {
24507
24507
  const translated = { type: "tab" };
24508
24508
  if (encodedAttrs) translated.attrs = { ...encodedAttrs };
24509
24509
  return translated;
24510
24510
  };
24511
- const decode$S = (params2, decodedAttrs = {}) => {
24511
+ const decode$T = (params2, decodedAttrs = {}) => {
24512
24512
  const { node } = params2 || {};
24513
24513
  if (!node) return;
24514
24514
  const wTab = { name: "w:tab" };
@@ -24524,15 +24524,15 @@ const decode$S = (params2, decodedAttrs = {}) => {
24524
24524
  }
24525
24525
  return translated;
24526
24526
  };
24527
- const config$p = {
24528
- xmlName: XML_NODE_NAME$r,
24529
- sdNodeOrKeyName: SD_NODE_NAME$b,
24527
+ const config$q = {
24528
+ xmlName: XML_NODE_NAME$s,
24529
+ sdNodeOrKeyName: SD_NODE_NAME$c,
24530
24530
  type: NodeTranslator.translatorTypes.NODE,
24531
- encode: encode$$,
24532
- decode: decode$S,
24533
- attributes: validXmlAttributes$j
24531
+ encode: encode$10,
24532
+ decode: decode$T,
24533
+ attributes: validXmlAttributes$k
24534
24534
  };
24535
- const translator$13 = NodeTranslator.from(config$p);
24535
+ const translator$14 = NodeTranslator.from(config$q);
24536
24536
  const mergeTextNodes = (nodes) => {
24537
24537
  if (!nodes || !Array.isArray(nodes)) {
24538
24538
  return nodes;
@@ -25147,91 +25147,91 @@ const handleParagraphNode$1 = (params2) => {
25147
25147
  }
25148
25148
  return schemaNode;
25149
25149
  };
25150
- const encode$_ = (attributes) => {
25150
+ const encode$$ = (attributes) => {
25151
25151
  return attributes["w:rsidDel"];
25152
25152
  };
25153
- const decode$R = (attrs) => {
25153
+ const decode$S = (attrs) => {
25154
25154
  return attrs.rsidDel;
25155
25155
  };
25156
25156
  const attrConfig$z = Object.freeze({
25157
25157
  xmlName: "w:rsidDel",
25158
25158
  sdName: "rsidDel",
25159
- encode: encode$_,
25160
- decode: decode$R
25159
+ encode: encode$$,
25160
+ decode: decode$S
25161
25161
  });
25162
- const encode$Z = (attributes) => {
25162
+ const encode$_ = (attributes) => {
25163
25163
  return attributes["w:rsidP"];
25164
25164
  };
25165
- const decode$Q = (attrs) => {
25165
+ const decode$R = (attrs) => {
25166
25166
  return attrs.rsidP;
25167
25167
  };
25168
25168
  const attrConfig$y = Object.freeze({
25169
25169
  xmlName: "w:rsidP",
25170
25170
  sdName: "rsidP",
25171
- encode: encode$Z,
25172
- decode: decode$Q
25171
+ encode: encode$_,
25172
+ decode: decode$R
25173
25173
  });
25174
- const encode$Y = (attributes) => {
25174
+ const encode$Z = (attributes) => {
25175
25175
  return attributes["w:rsidR"];
25176
25176
  };
25177
- const decode$P = (attrs) => {
25177
+ const decode$Q = (attrs) => {
25178
25178
  return attrs.rsidR;
25179
25179
  };
25180
25180
  const attrConfig$x = Object.freeze({
25181
25181
  xmlName: "w:rsidR",
25182
25182
  sdName: "rsidR",
25183
- encode: encode$Y,
25184
- decode: decode$P
25183
+ encode: encode$Z,
25184
+ decode: decode$Q
25185
25185
  });
25186
- const encode$X = (attributes) => {
25186
+ const encode$Y = (attributes) => {
25187
25187
  return attributes["w:rsidRPr"];
25188
25188
  };
25189
- const decode$O = (attrs) => {
25189
+ const decode$P = (attrs) => {
25190
25190
  return attrs.rsidRPr;
25191
25191
  };
25192
25192
  const attrConfig$w = Object.freeze({
25193
25193
  xmlName: "w:rsidRPr",
25194
25194
  sdName: "rsidRPr",
25195
- encode: encode$X,
25196
- decode: decode$O
25195
+ encode: encode$Y,
25196
+ decode: decode$P
25197
25197
  });
25198
- const encode$W = (attributes) => {
25198
+ const encode$X = (attributes) => {
25199
25199
  return attributes["w:rsidRDefault"];
25200
25200
  };
25201
- const decode$N = (attrs) => {
25201
+ const decode$O = (attrs) => {
25202
25202
  return attrs.rsidRDefault;
25203
25203
  };
25204
25204
  const attrConfig$v = Object.freeze({
25205
25205
  xmlName: "w:rsidRDefault",
25206
25206
  sdName: "rsidRDefault",
25207
- encode: encode$W,
25208
- decode: decode$N
25207
+ encode: encode$X,
25208
+ decode: decode$O
25209
25209
  });
25210
- const encode$V = (attributes) => {
25210
+ const encode$W = (attributes) => {
25211
25211
  return attributes["w14:paraId"];
25212
25212
  };
25213
- const decode$M = (attrs) => {
25213
+ const decode$N = (attrs) => {
25214
25214
  return attrs.paraId;
25215
25215
  };
25216
25216
  const attrConfig$u = Object.freeze({
25217
25217
  xmlName: "w14:paraId",
25218
25218
  sdName: "paraId",
25219
- encode: encode$V,
25220
- decode: decode$M
25219
+ encode: encode$W,
25220
+ decode: decode$N
25221
25221
  });
25222
- const encode$U = (attributes) => {
25222
+ const encode$V = (attributes) => {
25223
25223
  return attributes["w14:textId"];
25224
25224
  };
25225
- const decode$L = (attrs) => {
25225
+ const decode$M = (attrs) => {
25226
25226
  return attrs.textId;
25227
25227
  };
25228
25228
  const attrConfig$t = Object.freeze({
25229
25229
  xmlName: "w14:textId",
25230
25230
  sdName: "textId",
25231
- encode: encode$U,
25232
- decode: decode$L
25231
+ encode: encode$V,
25232
+ decode: decode$M
25233
25233
  });
25234
- const validXmlAttributes$i = [
25234
+ const validXmlAttributes$j = [
25235
25235
  attrConfig$u,
25236
25236
  attrConfig$t,
25237
25237
  attrConfig$x,
@@ -25240,9 +25240,9 @@ const validXmlAttributes$i = [
25240
25240
  attrConfig$w,
25241
25241
  attrConfig$z
25242
25242
  ];
25243
- const XML_NODE_NAME$q = "w:p";
25244
- const SD_NODE_NAME$a = "paragraph";
25245
- const encode$T = (params2, encodedAttrs = {}) => {
25243
+ const XML_NODE_NAME$r = "w:p";
25244
+ const SD_NODE_NAME$b = "paragraph";
25245
+ const encode$U = (params2, encodedAttrs = {}) => {
25246
25246
  const node = handleParagraphNode$1(params2);
25247
25247
  if (!node) return void 0;
25248
25248
  if (encodedAttrs && Object.keys(encodedAttrs).length) {
@@ -25250,7 +25250,7 @@ const encode$T = (params2, encodedAttrs = {}) => {
25250
25250
  }
25251
25251
  return node;
25252
25252
  };
25253
- const decode$K = (params2, decodedAttrs = {}) => {
25253
+ const decode$L = (params2, decodedAttrs = {}) => {
25254
25254
  const translated = translateParagraphNode(params2);
25255
25255
  if (!translated) return void 0;
25256
25256
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
@@ -25258,16 +25258,16 @@ const decode$K = (params2, decodedAttrs = {}) => {
25258
25258
  }
25259
25259
  return translated;
25260
25260
  };
25261
- const config$o = {
25262
- xmlName: XML_NODE_NAME$q,
25263
- sdNodeOrKeyName: SD_NODE_NAME$a,
25261
+ const config$p = {
25262
+ xmlName: XML_NODE_NAME$r,
25263
+ sdNodeOrKeyName: SD_NODE_NAME$b,
25264
25264
  type: NodeTranslator.translatorTypes.NODE,
25265
- encode: encode$T,
25266
- decode: decode$K,
25267
- attributes: validXmlAttributes$i
25265
+ encode: encode$U,
25266
+ decode: decode$L,
25267
+ attributes: validXmlAttributes$j
25268
25268
  };
25269
- const translator$12 = NodeTranslator.from(config$o);
25270
- const encode$S = (attributes) => {
25269
+ const translator$13 = NodeTranslator.from(config$p);
25270
+ const encode$T = (attributes) => {
25271
25271
  const raw = attributes?.["w:val"];
25272
25272
  if (raw === void 0 || raw === null) return void 0;
25273
25273
  if (typeof raw === "boolean") return raw;
@@ -25277,20 +25277,20 @@ const encode$S = (attributes) => {
25277
25277
  if (val === "1" || val === "true" || val === "on") return true;
25278
25278
  return void 0;
25279
25279
  };
25280
- const decode$J = (runProps) => {
25280
+ const decode$K = (runProps) => {
25281
25281
  if (runProps?.bold === false) return "0";
25282
25282
  return void 0;
25283
25283
  };
25284
25284
  const attrConfig$s = Object.freeze({
25285
25285
  xmlName: "w:val",
25286
25286
  sdName: "bold",
25287
- encode: encode$S,
25288
- decode: decode$J
25287
+ encode: encode$T,
25288
+ decode: decode$K
25289
25289
  });
25290
- const validXmlAttributes$h = [attrConfig$s];
25291
- const XML_NODE_NAME$p = "w:b";
25290
+ const validXmlAttributes$i = [attrConfig$s];
25291
+ const XML_NODE_NAME$q = "w:b";
25292
25292
  const SD_ATTR_KEY$e = "bold";
25293
- const encode$R = (params2, encodedAttrs = {}) => {
25293
+ const encode$S = (params2, encodedAttrs = {}) => {
25294
25294
  const { nodes } = params2;
25295
25295
  const node = nodes[0];
25296
25296
  if (!node) return void 0;
@@ -25302,85 +25302,85 @@ const encode$R = (params2, encodedAttrs = {}) => {
25302
25302
  else attributes = node.attributes || {};
25303
25303
  return {
25304
25304
  type: "attr",
25305
- xmlName: XML_NODE_NAME$p,
25305
+ xmlName: XML_NODE_NAME$q,
25306
25306
  sdNodeOrKeyName: SD_ATTR_KEY$e,
25307
25307
  attributes
25308
25308
  };
25309
25309
  };
25310
- const config$n = {
25311
- xmlName: XML_NODE_NAME$p,
25310
+ const config$o = {
25311
+ xmlName: XML_NODE_NAME$q,
25312
25312
  sdNodeOrKeyName: SD_ATTR_KEY$e,
25313
25313
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25314
- encode: encode$R,
25315
- attributes: validXmlAttributes$h
25314
+ encode: encode$S,
25315
+ attributes: validXmlAttributes$i
25316
25316
  };
25317
- const translator$11 = NodeTranslator.from(config$n);
25318
- const XML_NODE_NAME$o = "w:i";
25317
+ const translator$12 = NodeTranslator.from(config$o);
25318
+ const XML_NODE_NAME$p = "w:i";
25319
25319
  const SD_ATTR_KEY$d = "italic";
25320
- const encode$Q = (params2) => {
25320
+ const encode$R = (params2) => {
25321
25321
  const { nodes } = params2;
25322
25322
  const node = nodes?.[0];
25323
25323
  if (!node) return void 0;
25324
25324
  return {
25325
25325
  type: "attr",
25326
- xmlName: XML_NODE_NAME$o,
25326
+ xmlName: XML_NODE_NAME$p,
25327
25327
  sdNodeOrKeyName: SD_ATTR_KEY$d,
25328
25328
  attributes: {
25329
25329
  "w:val": node.attributes?.["w:val"] ?? null
25330
25330
  }
25331
25331
  };
25332
25332
  };
25333
- const config$m = {
25334
- xmlName: XML_NODE_NAME$o,
25333
+ const config$n = {
25334
+ xmlName: XML_NODE_NAME$p,
25335
25335
  sdNodeOrKeyName: SD_ATTR_KEY$d,
25336
25336
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25337
- encode: encode$Q
25337
+ encode: encode$R
25338
25338
  };
25339
- const translator$10 = NodeTranslator.from(config$m);
25340
- const encode$P = (attributes) => attributes?.["w:val"];
25341
- const decode$I = (attrs) => attrs?.underline;
25339
+ const translator$11 = NodeTranslator.from(config$n);
25340
+ const encode$Q = (attributes) => attributes?.["w:val"];
25341
+ const decode$J = (attrs) => attrs?.underline;
25342
25342
  const attrConfig$r = Object.freeze({
25343
25343
  xmlName: "w:val",
25344
25344
  sdName: "underline",
25345
- encode: encode$P,
25346
- decode: decode$I
25345
+ encode: encode$Q,
25346
+ decode: decode$J
25347
25347
  });
25348
- const encode$O = (attributes) => attributes?.["w:color"];
25349
- const decode$H = (attrs) => attrs?.color;
25348
+ const encode$P = (attributes) => attributes?.["w:color"];
25349
+ const decode$I = (attrs) => attrs?.color;
25350
25350
  const attrConfig$q = Object.freeze({
25351
25351
  xmlName: "w:color",
25352
25352
  sdName: "color",
25353
- encode: encode$O,
25354
- decode: decode$H
25353
+ encode: encode$P,
25354
+ decode: decode$I
25355
25355
  });
25356
- const encode$N = (attributes) => attributes?.["w:themeColor"];
25357
- const decode$G = (attrs) => attrs?.themeColor;
25356
+ const encode$O = (attributes) => attributes?.["w:themeColor"];
25357
+ const decode$H = (attrs) => attrs?.themeColor;
25358
25358
  const attrConfig$p = Object.freeze({
25359
25359
  xmlName: "w:themeColor",
25360
25360
  sdName: "themeColor",
25361
- encode: encode$N,
25362
- decode: decode$G
25361
+ encode: encode$O,
25362
+ decode: decode$H
25363
25363
  });
25364
- const encode$M = (attributes) => attributes?.["w:themeTint"];
25365
- const decode$F = (attrs) => attrs?.themeTint;
25364
+ const encode$N = (attributes) => attributes?.["w:themeTint"];
25365
+ const decode$G = (attrs) => attrs?.themeTint;
25366
25366
  const attrConfig$o = Object.freeze({
25367
25367
  xmlName: "w:themeTint",
25368
25368
  sdName: "themeTint",
25369
- encode: encode$M,
25370
- decode: decode$F
25369
+ encode: encode$N,
25370
+ decode: decode$G
25371
25371
  });
25372
- const encode$L = (attributes) => attributes?.["w:themeShade"];
25373
- const decode$E = (attrs) => attrs?.themeShade;
25372
+ const encode$M = (attributes) => attributes?.["w:themeShade"];
25373
+ const decode$F = (attrs) => attrs?.themeShade;
25374
25374
  const attrConfig$n = Object.freeze({
25375
25375
  xmlName: "w:themeShade",
25376
25376
  sdName: "themeShade",
25377
- encode: encode$L,
25378
- decode: decode$E
25377
+ encode: encode$M,
25378
+ decode: decode$F
25379
25379
  });
25380
- const validXmlAttributes$g = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25381
- const XML_NODE_NAME$n = "w:u";
25380
+ const validXmlAttributes$h = [attrConfig$r, attrConfig$q, attrConfig$p, attrConfig$o, attrConfig$n];
25381
+ const XML_NODE_NAME$o = "w:u";
25382
25382
  const SD_ATTR_KEY$c = "underline";
25383
- const encode$K = (params2, encodedAttrs = {}) => {
25383
+ const encode$L = (params2, encodedAttrs = {}) => {
25384
25384
  const { nodes } = params2;
25385
25385
  const node = nodes?.[0];
25386
25386
  const sourceAttrs = node?.attributes || {};
@@ -25396,12 +25396,12 @@ const encode$K = (params2, encodedAttrs = {}) => {
25396
25396
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25397
25397
  return {
25398
25398
  type: "attr",
25399
- xmlName: XML_NODE_NAME$n,
25399
+ xmlName: XML_NODE_NAME$o,
25400
25400
  sdNodeOrKeyName: SD_ATTR_KEY$c,
25401
25401
  attributes
25402
25402
  };
25403
25403
  };
25404
- const decode$D = (params2) => {
25404
+ const decode$E = (params2) => {
25405
25405
  const attrs = params2?.node?.attrs || {};
25406
25406
  const underlineType = attrs.underlineType ?? attrs.underline ?? null;
25407
25407
  const color = attrs.underlineColor ?? attrs.color ?? null;
@@ -25419,20 +25419,20 @@ const decode$D = (params2) => {
25419
25419
  if (themeTint) attributes["w:themeTint"] = themeTint;
25420
25420
  if (themeShade) attributes["w:themeShade"] = themeShade;
25421
25421
  return {
25422
- name: XML_NODE_NAME$n,
25422
+ name: XML_NODE_NAME$o,
25423
25423
  attributes
25424
25424
  };
25425
25425
  };
25426
- const config$l = {
25427
- xmlName: XML_NODE_NAME$n,
25426
+ const config$m = {
25427
+ xmlName: XML_NODE_NAME$o,
25428
25428
  sdNodeOrKeyName: SD_ATTR_KEY$c,
25429
25429
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25430
- encode: encode$K,
25431
- decode: decode$D,
25432
- attributes: validXmlAttributes$g
25430
+ encode: encode$L,
25431
+ decode: decode$E,
25432
+ attributes: validXmlAttributes$h
25433
25433
  };
25434
- const translator$$ = NodeTranslator.from(config$l);
25435
- const encode$J = (attributes) => {
25434
+ const translator$10 = NodeTranslator.from(config$m);
25435
+ const encode$K = (attributes) => {
25436
25436
  const raw = attributes?.["w:val"];
25437
25437
  if (raw === void 0 || raw === null) return void 0;
25438
25438
  if (typeof raw === "boolean") return raw;
@@ -25442,20 +25442,20 @@ const encode$J = (attributes) => {
25442
25442
  if (val === "1" || val === "true" || val === "on") return true;
25443
25443
  return void 0;
25444
25444
  };
25445
- const decode$C = (attrs) => {
25445
+ const decode$D = (attrs) => {
25446
25446
  if (attrs?.strike === false) return "0";
25447
25447
  return void 0;
25448
25448
  };
25449
25449
  const attrConfig$m = Object.freeze({
25450
25450
  xmlName: "w:val",
25451
25451
  sdName: "strike",
25452
- encode: encode$J,
25453
- decode: decode$C
25452
+ encode: encode$K,
25453
+ decode: decode$D
25454
25454
  });
25455
- const validXmlAttributes$f = [attrConfig$m];
25456
- const XML_NODE_NAME$m = "w:strike";
25455
+ const validXmlAttributes$g = [attrConfig$m];
25456
+ const XML_NODE_NAME$n = "w:strike";
25457
25457
  const SD_ATTR_KEY$b = "strike";
25458
- const encode$I = (params2, encodedAttrs = {}) => {
25458
+ const encode$J = (params2, encodedAttrs = {}) => {
25459
25459
  const { nodes } = params2;
25460
25460
  const node = nodes?.[0];
25461
25461
  if (!node) return void 0;
@@ -25468,55 +25468,55 @@ const encode$I = (params2, encodedAttrs = {}) => {
25468
25468
  else if (val === true && attributes["w:val"] === void 0) delete attributes["w:val"];
25469
25469
  return {
25470
25470
  type: "attr",
25471
- xmlName: XML_NODE_NAME$m,
25471
+ xmlName: XML_NODE_NAME$n,
25472
25472
  sdNodeOrKeyName: SD_ATTR_KEY$b,
25473
25473
  attributes
25474
25474
  };
25475
25475
  };
25476
- const config$k = {
25477
- xmlName: XML_NODE_NAME$m,
25476
+ const config$l = {
25477
+ xmlName: XML_NODE_NAME$n,
25478
25478
  sdNodeOrKeyName: SD_ATTR_KEY$b,
25479
25479
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25480
- encode: encode$I,
25481
- attributes: validXmlAttributes$f
25480
+ encode: encode$J,
25481
+ attributes: validXmlAttributes$g
25482
25482
  };
25483
- const translator$_ = NodeTranslator.from(config$k);
25484
- const encode$H = (attributes) => attributes?.["w:val"];
25485
- const decode$B = (attrs) => attrs?.color;
25483
+ const translator$$ = NodeTranslator.from(config$l);
25484
+ const encode$I = (attributes) => attributes?.["w:val"];
25485
+ const decode$C = (attrs) => attrs?.color;
25486
25486
  const attrConfig$l = Object.freeze({
25487
25487
  xmlName: "w:val",
25488
25488
  sdName: "color",
25489
- encode: encode$H,
25490
- decode: decode$B
25489
+ encode: encode$I,
25490
+ decode: decode$C
25491
25491
  });
25492
- const encode$G = (attributes) => attributes?.["w:themeColor"];
25493
- const decode$A = (attrs) => attrs?.themeColor;
25492
+ const encode$H = (attributes) => attributes?.["w:themeColor"];
25493
+ const decode$B = (attrs) => attrs?.themeColor;
25494
25494
  const attrConfig$k = Object.freeze({
25495
25495
  xmlName: "w:themeColor",
25496
25496
  sdName: "themeColor",
25497
- encode: encode$G,
25498
- decode: decode$A
25497
+ encode: encode$H,
25498
+ decode: decode$B
25499
25499
  });
25500
- const encode$F = (attributes) => attributes?.["w:themeTint"];
25501
- const decode$z = (attrs) => attrs?.themeTint;
25500
+ const encode$G = (attributes) => attributes?.["w:themeTint"];
25501
+ const decode$A = (attrs) => attrs?.themeTint;
25502
25502
  const attrConfig$j = Object.freeze({
25503
25503
  xmlName: "w:themeTint",
25504
25504
  sdName: "themeTint",
25505
- encode: encode$F,
25506
- decode: decode$z
25505
+ encode: encode$G,
25506
+ decode: decode$A
25507
25507
  });
25508
- const encode$E = (attributes) => attributes?.["w:themeShade"];
25509
- const decode$y = (attrs) => attrs?.themeShade;
25508
+ const encode$F = (attributes) => attributes?.["w:themeShade"];
25509
+ const decode$z = (attrs) => attrs?.themeShade;
25510
25510
  const attrConfig$i = Object.freeze({
25511
25511
  xmlName: "w:themeShade",
25512
25512
  sdName: "themeShade",
25513
- encode: encode$E,
25514
- decode: decode$y
25513
+ encode: encode$F,
25514
+ decode: decode$z
25515
25515
  });
25516
- const validXmlAttributes$e = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25517
- const XML_NODE_NAME$l = "w:color";
25516
+ const validXmlAttributes$f = [attrConfig$l, attrConfig$k, attrConfig$j, attrConfig$i];
25517
+ const XML_NODE_NAME$m = "w:color";
25518
25518
  const SD_ATTR_KEY$a = "color";
25519
- const encode$D = (params2, encodedAttrs = {}) => {
25519
+ const encode$E = (params2, encodedAttrs = {}) => {
25520
25520
  const { nodes } = params2;
25521
25521
  const node = nodes?.[0];
25522
25522
  const sourceAttrs = node?.attributes || {};
@@ -25531,63 +25531,63 @@ const encode$D = (params2, encodedAttrs = {}) => {
25531
25531
  if (themeShade !== void 0 && themeShade !== null) attributes["w:themeShade"] = themeShade;
25532
25532
  return {
25533
25533
  type: "attr",
25534
- xmlName: XML_NODE_NAME$l,
25534
+ xmlName: XML_NODE_NAME$m,
25535
25535
  sdNodeOrKeyName: SD_ATTR_KEY$a,
25536
25536
  attributes
25537
25537
  };
25538
25538
  };
25539
- const config$j = {
25540
- xmlName: XML_NODE_NAME$l,
25539
+ const config$k = {
25540
+ xmlName: XML_NODE_NAME$m,
25541
25541
  sdNodeOrKeyName: SD_ATTR_KEY$a,
25542
25542
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25543
- encode: encode$D,
25544
- attributes: validXmlAttributes$e
25543
+ encode: encode$E,
25544
+ attributes: validXmlAttributes$f
25545
25545
  };
25546
- const translator$Z = NodeTranslator.from(config$j);
25547
- const encode$C = (attributes) => attributes?.["w:eastAsia"];
25548
- const decode$x = (attrs) => attrs?.eastAsia;
25546
+ const translator$_ = NodeTranslator.from(config$k);
25547
+ const encode$D = (attributes) => attributes?.["w:eastAsia"];
25548
+ const decode$y = (attrs) => attrs?.eastAsia;
25549
25549
  const attrConfig$h = Object.freeze({
25550
25550
  xmlName: "w:eastAsia",
25551
25551
  sdName: "eastAsia",
25552
- encode: encode$C,
25553
- decode: decode$x
25552
+ encode: encode$D,
25553
+ decode: decode$y
25554
25554
  });
25555
- const encode$B = (attributes) => attributes?.["w:ascii"];
25556
- const decode$w = (attrs) => attrs?.ascii;
25555
+ const encode$C = (attributes) => attributes?.["w:ascii"];
25556
+ const decode$x = (attrs) => attrs?.ascii;
25557
25557
  const attrConfig$g = Object.freeze({
25558
25558
  xmlName: "w:ascii",
25559
25559
  sdName: "ascii",
25560
- encode: encode$B,
25561
- decode: decode$w
25560
+ encode: encode$C,
25561
+ decode: decode$x
25562
25562
  });
25563
- const encode$A = (attributes) => attributes?.["w:hAnsi"];
25564
- const decode$v = (attrs) => attrs?.hAnsi;
25563
+ const encode$B = (attributes) => attributes?.["w:hAnsi"];
25564
+ const decode$w = (attrs) => attrs?.hAnsi;
25565
25565
  const attrConfig$f = Object.freeze({
25566
25566
  xmlName: "w:hAnsi",
25567
25567
  sdName: "hAnsi",
25568
- encode: encode$A,
25569
- decode: decode$v
25568
+ encode: encode$B,
25569
+ decode: decode$w
25570
25570
  });
25571
- const encode$z = (attributes) => attributes?.["w:cs"];
25572
- const decode$u = (attrs) => attrs?.cs;
25571
+ const encode$A = (attributes) => attributes?.["w:cs"];
25572
+ const decode$v = (attrs) => attrs?.cs;
25573
25573
  const attrConfig$e = Object.freeze({
25574
25574
  xmlName: "w:cs",
25575
25575
  sdName: "cs",
25576
- encode: encode$z,
25577
- decode: decode$u
25576
+ encode: encode$A,
25577
+ decode: decode$v
25578
25578
  });
25579
- const encode$y = (attributes) => attributes?.["w:val"];
25580
- const decode$t = (attrs) => attrs?.value;
25579
+ const encode$z = (attributes) => attributes?.["w:val"];
25580
+ const decode$u = (attrs) => attrs?.value;
25581
25581
  const attrConfig$d = Object.freeze({
25582
25582
  xmlName: "w:val",
25583
25583
  sdName: "value",
25584
- encode: encode$y,
25585
- decode: decode$t
25584
+ encode: encode$z,
25585
+ decode: decode$u
25586
25586
  });
25587
- const validXmlAttributes$d = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25588
- const XML_NODE_NAME$k = "w:rFonts";
25587
+ const validXmlAttributes$e = [attrConfig$h, attrConfig$g, attrConfig$f, attrConfig$e, attrConfig$d];
25588
+ const XML_NODE_NAME$l = "w:rFonts";
25589
25589
  const SD_ATTR_KEY$9 = "fontFamily";
25590
- const encode$x = (params2, encodedAttrs = {}) => {
25590
+ const encode$y = (params2, encodedAttrs = {}) => {
25591
25591
  const { nodes } = params2;
25592
25592
  const node = nodes?.[0];
25593
25593
  const sourceAttrs = node?.attributes || {};
@@ -25613,120 +25613,120 @@ const encode$x = (params2, encodedAttrs = {}) => {
25613
25613
  if (attributes["w:val"] === void 0) delete attributes["w:val"];
25614
25614
  return {
25615
25615
  type: "attr",
25616
- xmlName: XML_NODE_NAME$k,
25616
+ xmlName: XML_NODE_NAME$l,
25617
25617
  sdNodeOrKeyName: SD_ATTR_KEY$9,
25618
25618
  attributes
25619
25619
  };
25620
25620
  };
25621
- const config$i = {
25622
- xmlName: XML_NODE_NAME$k,
25621
+ const config$j = {
25622
+ xmlName: XML_NODE_NAME$l,
25623
25623
  sdNodeOrKeyName: SD_ATTR_KEY$9,
25624
25624
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25625
- encode: encode$x,
25626
- attributes: validXmlAttributes$d
25625
+ encode: encode$y,
25626
+ attributes: validXmlAttributes$e
25627
25627
  };
25628
- const translator$Y = NodeTranslator.from(config$i);
25629
- const encode$w = (attributes) => attributes?.["w:val"];
25630
- const decode$s = (attrs) => attrs?.styleId;
25628
+ const translator$Z = NodeTranslator.from(config$j);
25629
+ const encode$x = (attributes) => attributes?.["w:val"];
25630
+ const decode$t = (attrs) => attrs?.styleId;
25631
25631
  const attrConfig$c = Object.freeze({
25632
25632
  xmlName: "w:val",
25633
25633
  sdName: "styleId",
25634
- encode: encode$w,
25635
- decode: decode$s
25634
+ encode: encode$x,
25635
+ decode: decode$t
25636
25636
  });
25637
- const validXmlAttributes$c = [attrConfig$c];
25638
- const XML_NODE_NAME$j = "w:rStyle";
25637
+ const validXmlAttributes$d = [attrConfig$c];
25638
+ const XML_NODE_NAME$k = "w:rStyle";
25639
25639
  const SD_ATTR_KEY$8 = "styleId";
25640
- const encode$v = (params2, encodedAttrs = {}) => {
25640
+ const encode$w = (params2, encodedAttrs = {}) => {
25641
25641
  const { nodes } = params2;
25642
25642
  const node = nodes?.[0];
25643
25643
  const value = encodedAttrs.styleId ?? node?.attributes?.["w:val"];
25644
25644
  return {
25645
25645
  type: "attr",
25646
- xmlName: XML_NODE_NAME$j,
25646
+ xmlName: XML_NODE_NAME$k,
25647
25647
  sdNodeOrKeyName: SD_ATTR_KEY$8,
25648
25648
  attributes: { "w:val": value ?? null }
25649
25649
  };
25650
25650
  };
25651
- const config$h = {
25652
- xmlName: XML_NODE_NAME$j,
25651
+ const config$i = {
25652
+ xmlName: XML_NODE_NAME$k,
25653
25653
  sdNodeOrKeyName: SD_ATTR_KEY$8,
25654
25654
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25655
- encode: encode$v,
25656
- attributes: validXmlAttributes$c
25655
+ encode: encode$w,
25656
+ attributes: validXmlAttributes$d
25657
25657
  };
25658
- const translator$X = NodeTranslator.from(config$h);
25659
- const encode$u = (attributes) => attributes?.["w:val"];
25660
- const decode$r = (attrs) => attrs?.fontSize;
25658
+ const translator$Y = NodeTranslator.from(config$i);
25659
+ const encode$v = (attributes) => attributes?.["w:val"];
25660
+ const decode$s = (attrs) => attrs?.fontSize;
25661
25661
  const attrConfig$b = Object.freeze({
25662
25662
  xmlName: "w:val",
25663
25663
  sdName: "fontSize",
25664
- encode: encode$u,
25665
- decode: decode$r
25664
+ encode: encode$v,
25665
+ decode: decode$s
25666
25666
  });
25667
- const validXmlAttributes$b = [attrConfig$b];
25668
- const XML_NODE_NAME$i = "w:sz";
25667
+ const validXmlAttributes$c = [attrConfig$b];
25668
+ const XML_NODE_NAME$j = "w:sz";
25669
25669
  const SD_ATTR_KEY$7 = "fontSize";
25670
- const encode$t = (params2, encodedAttrs = {}) => {
25670
+ const encode$u = (params2, encodedAttrs = {}) => {
25671
25671
  const { nodes } = params2;
25672
25672
  const node = nodes?.[0];
25673
25673
  const value = encodedAttrs.fontSize ?? node?.attributes?.["w:val"];
25674
25674
  return {
25675
25675
  type: "attr",
25676
- xmlName: XML_NODE_NAME$i,
25676
+ xmlName: XML_NODE_NAME$j,
25677
25677
  sdNodeOrKeyName: SD_ATTR_KEY$7,
25678
25678
  attributes: { "w:val": value ?? null }
25679
25679
  };
25680
25680
  };
25681
- const config$g = {
25682
- xmlName: XML_NODE_NAME$i,
25681
+ const config$h = {
25682
+ xmlName: XML_NODE_NAME$j,
25683
25683
  sdNodeOrKeyName: SD_ATTR_KEY$7,
25684
25684
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25685
- encode: encode$t,
25686
- attributes: validXmlAttributes$b
25685
+ encode: encode$u,
25686
+ attributes: validXmlAttributes$c
25687
25687
  };
25688
- const translator$W = NodeTranslator.from(config$g);
25689
- const encode$s = (attributes) => attributes?.["w:val"];
25690
- const decode$q = (attrs) => attrs?.fontSizeCs;
25688
+ const translator$X = NodeTranslator.from(config$h);
25689
+ const encode$t = (attributes) => attributes?.["w:val"];
25690
+ const decode$r = (attrs) => attrs?.fontSizeCs;
25691
25691
  const attrConfig$a = Object.freeze({
25692
25692
  xmlName: "w:val",
25693
25693
  sdName: "fontSizeCs",
25694
- encode: encode$s,
25695
- decode: decode$q
25694
+ encode: encode$t,
25695
+ decode: decode$r
25696
25696
  });
25697
- const validXmlAttributes$a = [attrConfig$a];
25698
- const XML_NODE_NAME$h = "w:szCs";
25697
+ const validXmlAttributes$b = [attrConfig$a];
25698
+ const XML_NODE_NAME$i = "w:szCs";
25699
25699
  const SD_ATTR_KEY$6 = "fontSizeCs";
25700
- const encode$r = (params2, encodedAttrs = {}) => {
25700
+ const encode$s = (params2, encodedAttrs = {}) => {
25701
25701
  const { nodes } = params2;
25702
25702
  const node = nodes?.[0];
25703
25703
  const value = encodedAttrs.fontSizeCs ?? node?.attributes?.["w:val"];
25704
25704
  return {
25705
25705
  type: "attr",
25706
- xmlName: XML_NODE_NAME$h,
25706
+ xmlName: XML_NODE_NAME$i,
25707
25707
  sdNodeOrKeyName: SD_ATTR_KEY$6,
25708
25708
  attributes: { "w:val": value ?? null }
25709
25709
  };
25710
25710
  };
25711
- const config$f = {
25712
- xmlName: XML_NODE_NAME$h,
25711
+ const config$g = {
25712
+ xmlName: XML_NODE_NAME$i,
25713
25713
  sdNodeOrKeyName: SD_ATTR_KEY$6,
25714
25714
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25715
- encode: encode$r,
25716
- attributes: validXmlAttributes$a
25715
+ encode: encode$s,
25716
+ attributes: validXmlAttributes$b
25717
25717
  };
25718
- const translator$V = NodeTranslator.from(config$f);
25718
+ const translator$W = NodeTranslator.from(config$g);
25719
25719
  const runPropertyTranslators = Object.freeze({
25720
- "w:b": translator$11,
25721
- "w:i": translator$10,
25722
- "w:u": translator$$,
25723
- "w:strike": translator$_,
25724
- "w:color": translator$Z,
25725
- "w:highlight": translator$14,
25726
- "w:rFonts": translator$Y,
25727
- "w:rStyle": translator$X,
25728
- "w:sz": translator$W,
25729
- "w:szCs": translator$V
25720
+ "w:b": translator$12,
25721
+ "w:i": translator$11,
25722
+ "w:u": translator$10,
25723
+ "w:strike": translator$$,
25724
+ "w:color": translator$_,
25725
+ "w:highlight": translator$15,
25726
+ "w:rFonts": translator$Z,
25727
+ "w:rStyle": translator$Y,
25728
+ "w:sz": translator$X,
25729
+ "w:szCs": translator$W
25730
25730
  });
25731
25731
  const rawRunPropertyXmlNames = Object.freeze(["w:lang", "w:shd"]);
25732
25732
  const RAW_CHILD_NAME_SET = new Set(rawRunPropertyXmlNames);
@@ -25740,9 +25740,9 @@ const toRunPropertyEntry = (candidate) => {
25740
25740
  attributes: { ...candidate.attributes || {} }
25741
25741
  };
25742
25742
  };
25743
- const XML_NODE_NAME$g = "w:rPr";
25743
+ const XML_NODE_NAME$h = "w:rPr";
25744
25744
  const SD_ATTR_KEY$5 = "runProperties";
25745
- const encode$q = (params2) => {
25745
+ const encode$r = (params2) => {
25746
25746
  const { nodes } = params2;
25747
25747
  const node = nodes?.[0] || {};
25748
25748
  const contents = Array.isArray(node.elements) ? node.elements : [];
@@ -25776,16 +25776,16 @@ const encode$q = (params2) => {
25776
25776
  attributes: runPropsArray
25777
25777
  };
25778
25778
  };
25779
- const config$e = {
25780
- xmlName: XML_NODE_NAME$g,
25779
+ const config$f = {
25780
+ xmlName: XML_NODE_NAME$h,
25781
25781
  sdNodeOrKeyName: SD_ATTR_KEY$5,
25782
25782
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
25783
- encode: encode$q
25783
+ encode: encode$r
25784
25784
  };
25785
- const translator$U = NodeTranslator.from(config$e);
25785
+ const translator$V = NodeTranslator.from(config$f);
25786
25786
  const EAST_ASIAN_CHARACTER_REGEX = /[\u1100-\u11FF\u2E80-\u2EFF\u2F00-\u2FDF\u3040-\u30FF\u3100-\u312F\u3130-\u318F\u31A0-\u31BF\u3400-\u4DBF\u4E00-\u9FFF\uA960-\uA97F\uAC00-\uD7AF\uF900-\uFAFF\uFF00-\uFFEF]/u;
25787
25787
  const containsEastAsianCharacters = (text) => EAST_ASIAN_CHARACTER_REGEX.test(text);
25788
- const collectRunProperties = (params2, rPrNode, translator2 = translator$U) => {
25788
+ const collectRunProperties = (params2, rPrNode, translator2 = translator$V) => {
25789
25789
  if (!rPrNode) return { entries: [], hadRPr: false, styleChangeMarks: [] };
25790
25790
  const result = translator2.encode({ ...params2, nodes: [rPrNode] }) || {};
25791
25791
  let entries = [];
@@ -26247,46 +26247,46 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
26247
26247
  }
26248
26248
  return runs;
26249
26249
  };
26250
- const encode$p = (attributes) => {
26250
+ const encode$q = (attributes) => {
26251
26251
  return attributes["w:rsidR"];
26252
26252
  };
26253
- const decode$p = (attrs) => {
26253
+ const decode$q = (attrs) => {
26254
26254
  return attrs.rsidR;
26255
26255
  };
26256
26256
  const attrConfig$9 = Object.freeze({
26257
26257
  xmlName: "w:rsidR",
26258
26258
  sdName: "rsidR",
26259
- encode: encode$p,
26260
- decode: decode$p
26259
+ encode: encode$q,
26260
+ decode: decode$q
26261
26261
  });
26262
- const encode$o = (attributes) => {
26262
+ const encode$p = (attributes) => {
26263
26263
  return attributes["w:rsidRPr"];
26264
26264
  };
26265
- const decode$o = (attrs) => {
26265
+ const decode$p = (attrs) => {
26266
26266
  return attrs.rsidRPr;
26267
26267
  };
26268
26268
  const attrConfig$8 = Object.freeze({
26269
26269
  xmlName: "w:rsidRPr",
26270
26270
  sdName: "rsidRPr",
26271
- encode: encode$o,
26272
- decode: decode$o
26271
+ encode: encode$p,
26272
+ decode: decode$p
26273
26273
  });
26274
- const encode$n = (attributes) => {
26274
+ const encode$o = (attributes) => {
26275
26275
  return attributes["w:rsidDel"];
26276
26276
  };
26277
- const decode$n = (attrs) => {
26277
+ const decode$o = (attrs) => {
26278
26278
  return attrs.rsidDel;
26279
26279
  };
26280
26280
  const attrConfig$7 = Object.freeze({
26281
26281
  xmlName: "w:rsidDel",
26282
26282
  sdName: "rsidDel",
26283
- encode: encode$n,
26284
- decode: decode$n
26283
+ encode: encode$o,
26284
+ decode: decode$o
26285
26285
  });
26286
- const validXmlAttributes$9 = [attrConfig$9, attrConfig$8, attrConfig$7];
26287
- const XML_NODE_NAME$f = "w:r";
26286
+ const validXmlAttributes$a = [attrConfig$9, attrConfig$8, attrConfig$7];
26287
+ const XML_NODE_NAME$g = "w:r";
26288
26288
  const SD_KEY_NAME = "run";
26289
- const encode$m = (params2, encodedAttrs = {}) => {
26289
+ const encode$n = (params2, encodedAttrs = {}) => {
26290
26290
  const { nodes = [], nodeListHandler } = params2 || {};
26291
26291
  const runNode = nodes[0];
26292
26292
  if (!runNode) return void 0;
@@ -26334,7 +26334,7 @@ const encode$m = (params2, encodedAttrs = {}) => {
26334
26334
  }
26335
26335
  return runNodeResult;
26336
26336
  };
26337
- const decode$m = (params2, decodedAttrs = {}) => {
26337
+ const decode$n = (params2, decodedAttrs = {}) => {
26338
26338
  const { node } = params2 || {};
26339
26339
  if (!node) return void 0;
26340
26340
  const { runNode: runNodeForExport, trackingMarksByType } = prepareRunTrackingContext(node);
@@ -26391,7 +26391,7 @@ const decode$m = (params2, decodedAttrs = {}) => {
26391
26391
  runs.push(trackedClone);
26392
26392
  return;
26393
26393
  }
26394
- const runWrapper = { name: XML_NODE_NAME$f, elements: [] };
26394
+ const runWrapper = { name: XML_NODE_NAME$g, elements: [] };
26395
26395
  applyBaseRunProps(runWrapper);
26396
26396
  if (!Array.isArray(runWrapper.elements)) runWrapper.elements = [];
26397
26397
  runWrapper.elements.push(cloneXmlNode(child));
@@ -26399,7 +26399,7 @@ const decode$m = (params2, decodedAttrs = {}) => {
26399
26399
  });
26400
26400
  const trackedRuns = ensureTrackedWrapper(runs, trackingMarksByType);
26401
26401
  if (!trackedRuns.length) {
26402
- const emptyRun = { name: XML_NODE_NAME$f, elements: [] };
26402
+ const emptyRun = { name: XML_NODE_NAME$g, elements: [] };
26403
26403
  applyBaseRunProps(emptyRun);
26404
26404
  trackedRuns.push(emptyRun);
26405
26405
  }
@@ -26413,15 +26413,15 @@ const decode$m = (params2, decodedAttrs = {}) => {
26413
26413
  }
26414
26414
  return trackedRuns;
26415
26415
  };
26416
- const config$d = {
26417
- xmlName: XML_NODE_NAME$f,
26416
+ const config$e = {
26417
+ xmlName: XML_NODE_NAME$g,
26418
26418
  sdNodeOrKeyName: SD_KEY_NAME,
26419
26419
  type: NodeTranslator.translatorTypes.NODE,
26420
- encode: encode$m,
26421
- decode: decode$m,
26422
- attributes: validXmlAttributes$9
26420
+ encode: encode$n,
26421
+ decode: decode$n,
26422
+ attributes: validXmlAttributes$a
26423
26423
  };
26424
- const translator$T = NodeTranslator.from(config$d);
26424
+ const translator$U = NodeTranslator.from(config$e);
26425
26425
  const generateV2HandlerEntity = (handlerName, translator2) => ({
26426
26426
  handlerName,
26427
26427
  handler: (params2) => {
@@ -26595,13 +26595,13 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26595
26595
  }
26596
26596
  return table;
26597
26597
  }
26598
- const translator$S = NodeTranslator.from({
26598
+ const translator$T = NodeTranslator.from({
26599
26599
  xmlName: "w:cantSplit",
26600
26600
  sdNodeOrKeyName: "cantSplit",
26601
26601
  encode: ({ nodes }) => ["1", "true"].includes(nodes[0].attributes?.["w:val"] ?? "1"),
26602
26602
  decode: ({ node }) => node.attrs?.cantSplit ? { attributes: {} } : void 0
26603
26603
  });
26604
- const translator$R = NodeTranslator.from({
26604
+ const translator$S = NodeTranslator.from({
26605
26605
  xmlName: "w:cnfStyle",
26606
26606
  sdNodeOrKeyName: "cnfStyle",
26607
26607
  attributes: [
@@ -26627,8 +26627,8 @@ const translator$R = NodeTranslator.from({
26627
26627
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26628
26628
  }
26629
26629
  });
26630
- const translator$Q = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26631
- const translator$P = NodeTranslator.from(
26630
+ const translator$R = NodeTranslator.from(createSingleAttrPropertyHandler("w:divId"));
26631
+ const translator$Q = NodeTranslator.from(
26632
26632
  createSingleAttrPropertyHandler(
26633
26633
  "w:gridAfter",
26634
26634
  null,
@@ -26637,7 +26637,7 @@ const translator$P = NodeTranslator.from(
26637
26637
  (v2) => integerToString(v2)
26638
26638
  )
26639
26639
  );
26640
- const translator$O = NodeTranslator.from(
26640
+ const translator$P = NodeTranslator.from(
26641
26641
  createSingleAttrPropertyHandler(
26642
26642
  "w:gridBefore",
26643
26643
  null,
@@ -26646,21 +26646,21 @@ const translator$O = NodeTranslator.from(
26646
26646
  (v2) => integerToString(v2)
26647
26647
  )
26648
26648
  );
26649
- const translator$N = NodeTranslator.from({
26649
+ const translator$O = NodeTranslator.from({
26650
26650
  xmlName: "w:hidden",
26651
26651
  sdNodeOrKeyName: "hidden",
26652
26652
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26653
26653
  decode: ({ node }) => node.attrs.hidden ? { attributes: {} } : void 0
26654
26654
  });
26655
- const translator$M = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26656
- const translator$L = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26657
- const translator$K = NodeTranslator.from({
26655
+ const translator$N = NodeTranslator.from(createSingleAttrPropertyHandler("w:jc", "justification"));
26656
+ const translator$M = NodeTranslator.from(createMeasurementPropertyHandler("w:tblCellSpacing", "tableCellSpacing"));
26657
+ const translator$L = NodeTranslator.from({
26658
26658
  xmlName: "w:tblHeader",
26659
26659
  sdNodeOrKeyName: "repeatHeader",
26660
26660
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26661
26661
  decode: ({ node }) => node.attrs.repeatHeader ? { attributes: {} } : void 0
26662
26662
  });
26663
- const translator$J = NodeTranslator.from({
26663
+ const translator$K = NodeTranslator.from({
26664
26664
  xmlName: "w:trHeight",
26665
26665
  sdNodeOrKeyName: "rowHeight",
26666
26666
  encode: ({ nodes }) => {
@@ -26687,11 +26687,11 @@ const translator$J = NodeTranslator.from({
26687
26687
  return Object.keys(heightAttrs).length > 0 ? { attributes: heightAttrs } : void 0;
26688
26688
  }
26689
26689
  });
26690
- const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26691
- const translator$H = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26692
- const XML_NODE_NAME$e = "w:trPr";
26690
+ const translator$J = NodeTranslator.from(createMeasurementPropertyHandler("w:wAfter"));
26691
+ const translator$I = NodeTranslator.from(createMeasurementPropertyHandler("w:wBefore"));
26692
+ const XML_NODE_NAME$f = "w:trPr";
26693
26693
  const SD_ATTR_KEY$4 = "tableRowProperties";
26694
- const encode$l = (params2) => {
26694
+ const encode$m = (params2) => {
26695
26695
  const { nodes } = params2;
26696
26696
  const node = nodes[0];
26697
26697
  let attributes = {
@@ -26705,12 +26705,12 @@ const encode$l = (params2) => {
26705
26705
  };
26706
26706
  return {
26707
26707
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26708
- xmlName: XML_NODE_NAME$e,
26708
+ xmlName: XML_NODE_NAME$f,
26709
26709
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26710
26710
  attributes
26711
26711
  };
26712
26712
  };
26713
- const decode$l = (params2) => {
26713
+ const decode$m = (params2) => {
26714
26714
  const { tableRowProperties = {} } = params2.node.attrs || {};
26715
26715
  const elements = decodeProperties(propertyTranslatorsBySdName$2, tableRowProperties);
26716
26716
  const newNode = {
@@ -26722,6 +26722,7 @@ const decode$l = (params2) => {
26722
26722
  return newNode;
26723
26723
  };
26724
26724
  const propertyTranslators$3 = [
26725
+ translator$T,
26725
26726
  translator$S,
26726
26727
  translator$R,
26727
26728
  translator$Q,
@@ -26732,8 +26733,7 @@ const propertyTranslators$3 = [
26732
26733
  translator$L,
26733
26734
  translator$K,
26734
26735
  translator$J,
26735
- translator$I,
26736
- translator$H
26736
+ translator$I
26737
26737
  ];
26738
26738
  const propertyTranslatorsByXmlName$2 = {};
26739
26739
  propertyTranslators$3.forEach((translator2) => {
@@ -26743,25 +26743,25 @@ const propertyTranslatorsBySdName$2 = {};
26743
26743
  propertyTranslators$3.forEach((translator2) => {
26744
26744
  propertyTranslatorsBySdName$2[translator2.sdNodeOrKeyName] = translator2;
26745
26745
  });
26746
- const config$c = {
26747
- xmlName: XML_NODE_NAME$e,
26746
+ const config$d = {
26747
+ xmlName: XML_NODE_NAME$f,
26748
26748
  sdNodeOrKeyName: SD_ATTR_KEY$4,
26749
26749
  type: NodeTranslator.translatorTypes.ATTRIBUTE,
26750
- encode: encode$l,
26751
- decode: decode$l
26750
+ encode: encode$m,
26751
+ decode: decode$m
26752
26752
  };
26753
- const translator$G = NodeTranslator.from(config$c);
26754
- const XML_NODE_NAME$d = "w:tr";
26755
- const SD_NODE_NAME$9 = "tableRow";
26756
- const validXmlAttributes$8 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26753
+ const translator$H = NodeTranslator.from(config$d);
26754
+ const XML_NODE_NAME$e = "w:tr";
26755
+ const SD_NODE_NAME$a = "tableRow";
26756
+ const validXmlAttributes$9 = ["w:rsidDel", "w:rsidR", "w:rsidRPr", "w:rsidTr", "w14:paraId", "w14:textId"].map(
26757
26757
  (xmlName) => createAttributeHandler(xmlName)
26758
26758
  );
26759
- const encode$k = (params2, encodedAttrs) => {
26759
+ const encode$l = (params2, encodedAttrs) => {
26760
26760
  const { row } = params2.extraParams;
26761
26761
  let tableRowProperties = {};
26762
26762
  const tPr = row.elements.find((el) => el.name === "w:trPr");
26763
26763
  if (tPr) {
26764
- ({ attributes: tableRowProperties } = translator$G.encode({
26764
+ ({ attributes: tableRowProperties } = translator$H.encode({
26765
26765
  ...params2,
26766
26766
  nodes: [tPr]
26767
26767
  }));
@@ -26774,7 +26774,7 @@ const encode$k = (params2, encodedAttrs) => {
26774
26774
  let currentColumnIndex = 0;
26775
26775
  const content = cellNodes?.map((n) => {
26776
26776
  let columnWidth = gridColumnWidths?.[currentColumnIndex] || null;
26777
- const result = translator$7.encode({
26777
+ const result = translator$8.encode({
26778
26778
  ...params2,
26779
26779
  extraParams: {
26780
26780
  ...params2.extraParams,
@@ -26796,7 +26796,7 @@ const encode$k = (params2, encodedAttrs) => {
26796
26796
  };
26797
26797
  return newNode;
26798
26798
  };
26799
- const decode$k = (params2, decodedAttrs) => {
26799
+ const decode$l = (params2, decodedAttrs) => {
26800
26800
  const { node } = params2;
26801
26801
  const elements = translateChildNodes(params2);
26802
26802
  if (node.attrs?.tableRowProperties) {
@@ -26808,7 +26808,7 @@ const decode$k = (params2, decodedAttrs) => {
26808
26808
  }
26809
26809
  }
26810
26810
  tableRowProperties["cantSplit"] = node.attrs["cantSplit"];
26811
- const trPr = translator$G.decode({
26811
+ const trPr = translator$H.decode({
26812
26812
  ...params2,
26813
26813
  node: { ...node, attrs: { ...node.attrs, tableRowProperties } }
26814
26814
  });
@@ -26820,22 +26820,22 @@ const decode$k = (params2, decodedAttrs) => {
26820
26820
  elements
26821
26821
  };
26822
26822
  };
26823
- const config$b = {
26824
- xmlName: XML_NODE_NAME$d,
26825
- sdNodeOrKeyName: SD_NODE_NAME$9,
26823
+ const config$c = {
26824
+ xmlName: XML_NODE_NAME$e,
26825
+ sdNodeOrKeyName: SD_NODE_NAME$a,
26826
26826
  type: NodeTranslator.translatorTypes.NODE,
26827
- encode: encode$k,
26828
- decode: decode$k,
26829
- attributes: validXmlAttributes$8
26827
+ encode: encode$l,
26828
+ decode: decode$l,
26829
+ attributes: validXmlAttributes$9
26830
26830
  };
26831
- const translator$F = NodeTranslator.from(config$b);
26832
- const translator$E = NodeTranslator.from({
26831
+ const translator$G = NodeTranslator.from(config$c);
26832
+ const translator$F = NodeTranslator.from({
26833
26833
  xmlName: "w:bidiVisual",
26834
26834
  sdNodeOrKeyName: "rightToLeft",
26835
26835
  encode: ({ nodes }) => parseBoolean(nodes[0].attributes?.["w:val"] ?? "1"),
26836
26836
  decode: ({ node }) => node.attrs.rightToLeft ? { attributes: {} } : void 0
26837
26837
  });
26838
- const translator$D = NodeTranslator.from({
26838
+ const translator$E = NodeTranslator.from({
26839
26839
  xmlName: "w:shd",
26840
26840
  sdNodeOrKeyName: "shading",
26841
26841
  attributes: [
@@ -26857,11 +26857,11 @@ const translator$D = NodeTranslator.from({
26857
26857
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26858
26858
  }
26859
26859
  });
26860
- const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26861
- const translator$B = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26862
- const translator$A = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26863
- const translator$z = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26864
- const translator$y = NodeTranslator.from({
26860
+ const translator$D = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblCaption", "caption"));
26861
+ const translator$C = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblDescription", "description"));
26862
+ const translator$B = NodeTranslator.from(createMeasurementPropertyHandler("w:tblInd", "tableIndent"));
26863
+ const translator$A = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblLayout", "tableLayout", "w:type"));
26864
+ const translator$z = NodeTranslator.from({
26865
26865
  xmlName: "w:tblLook",
26866
26866
  sdNodeOrKeyName: "tblLook",
26867
26867
  attributes: ["w:firstColumn", "w:firstRow", "w:lastColumn", "w:lastRow", "w:noHBand", "w:noVBand"].map((attr) => createAttributeHandler(attr, null, parseBoolean, booleanToString)).concat([createAttributeHandler("w:val")]),
@@ -26873,16 +26873,16 @@ const translator$y = NodeTranslator.from({
26873
26873
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26874
26874
  }
26875
26875
  });
26876
- const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26877
- const translator$w = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26878
- const translator$v = NodeTranslator.from(
26876
+ const translator$y = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblOverlap", "overlap"));
26877
+ const translator$x = NodeTranslator.from(createSingleAttrPropertyHandler("w:tblStyle", "tableStyleId"));
26878
+ const translator$w = NodeTranslator.from(
26879
26879
  createSingleAttrPropertyHandler("w:tblStyleColBandSize", "tableStyleColBandSize")
26880
26880
  );
26881
- const translator$u = NodeTranslator.from(
26881
+ const translator$v = NodeTranslator.from(
26882
26882
  createSingleAttrPropertyHandler("w:tblStyleRowBandSize", "tableStyleRowBandSize")
26883
26883
  );
26884
- const translator$t = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26885
- const translator$s = NodeTranslator.from({
26884
+ const translator$u = NodeTranslator.from(createMeasurementPropertyHandler("w:tblW", "tableWidth"));
26885
+ const translator$t = NodeTranslator.from({
26886
26886
  xmlName: "w:tblpPr",
26887
26887
  sdNodeOrKeyName: "floatingTableProperties",
26888
26888
  attributes: ["w:leftFromText", "w:rightFromText", "w:topFromText", "w:bottomFromText", "w:tblpX", "w:tblpY"].map((attr) => createAttributeHandler(attr, null, parseInteger, integerToString)).concat(["w:horzAnchor", "w:vertAnchor", "w:tblpXSpec", "w:tblpYSpec"].map((attr) => createAttributeHandler(attr))),
@@ -26894,29 +26894,29 @@ const translator$s = NodeTranslator.from({
26894
26894
  return Object.keys(decodedAttrs).length > 0 ? { attributes: decodedAttrs } : void 0;
26895
26895
  }
26896
26896
  });
26897
- const translator$r = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26898
- const translator$q = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26899
- const translator$p = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26900
- const translator$o = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26901
- const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26902
- const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26903
- const translator$l = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26904
- const translator$k = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26905
- const translator$j = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26906
- const translator$i = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
26907
- const translator$h = NodeTranslator.from(createBorderPropertyHandler("w:start"));
26908
- const translator$g = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
26909
- const translator$f = NodeTranslator.from(createBorderPropertyHandler("w:top"));
26910
- const translator$e = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
26911
- const XML_NODE_NAME$c = "w:tblBorders";
26897
+ const translator$s = NodeTranslator.from(createBorderPropertyHandler("w:bottom"));
26898
+ const translator$r = NodeTranslator.from(createMeasurementPropertyHandler("w:bottom", "marginBottom"));
26899
+ const translator$q = NodeTranslator.from(createBorderPropertyHandler("w:end"));
26900
+ const translator$p = NodeTranslator.from(createMeasurementPropertyHandler("w:end", "marginEnd"));
26901
+ const translator$o = NodeTranslator.from(createBorderPropertyHandler("w:insideH"));
26902
+ const translator$n = NodeTranslator.from(createBorderPropertyHandler("w:insideV"));
26903
+ const translator$m = NodeTranslator.from(createBorderPropertyHandler("w:left"));
26904
+ const translator$l = NodeTranslator.from(createMeasurementPropertyHandler("w:left", "marginLeft"));
26905
+ const translator$k = NodeTranslator.from(createBorderPropertyHandler("w:right"));
26906
+ const translator$j = NodeTranslator.from(createMeasurementPropertyHandler("w:right", "marginRight"));
26907
+ const translator$i = NodeTranslator.from(createBorderPropertyHandler("w:start"));
26908
+ const translator$h = NodeTranslator.from(createMeasurementPropertyHandler("w:start", "marginStart"));
26909
+ const translator$g = NodeTranslator.from(createBorderPropertyHandler("w:top"));
26910
+ const translator$f = NodeTranslator.from(createMeasurementPropertyHandler("w:top", "marginTop"));
26911
+ const XML_NODE_NAME$d = "w:tblBorders";
26912
26912
  const SD_ATTR_KEY$3 = "borders";
26913
- const encode$j = (params2) => {
26913
+ const encode$k = (params2) => {
26914
26914
  const { nodes } = params2;
26915
26915
  const node = nodes[0];
26916
26916
  const attributes = encodeProperties(node, tblBordersTranslatorsByXmlName);
26917
26917
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26918
26918
  };
26919
- const decode$j = (params2) => {
26919
+ const decode$k = (params2) => {
26920
26920
  const { borders = {} } = params2.node.attrs || {};
26921
26921
  const elements = decodeProperties(tblBordersTranslatorsBySdName, borders);
26922
26922
  const newNode = {
@@ -26928,14 +26928,14 @@ const decode$j = (params2) => {
26928
26928
  return newNode;
26929
26929
  };
26930
26930
  const propertyTranslators$2 = [
26931
- translator$r,
26932
- translator$p,
26931
+ translator$s,
26932
+ translator$q,
26933
+ translator$o,
26933
26934
  translator$n,
26934
26935
  translator$m,
26935
- translator$l,
26936
- translator$j,
26937
- translator$h,
26938
- translator$f
26936
+ translator$k,
26937
+ translator$i,
26938
+ translator$g
26939
26939
  ];
26940
26940
  const tblBordersTranslatorsByXmlName = {};
26941
26941
  const tblBordersTranslatorsBySdName = {};
@@ -26943,27 +26943,27 @@ propertyTranslators$2.forEach((translator2) => {
26943
26943
  tblBordersTranslatorsByXmlName[translator2.xmlName] = translator2;
26944
26944
  tblBordersTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
26945
26945
  });
26946
- const translator$d = NodeTranslator.from({
26947
- xmlName: XML_NODE_NAME$c,
26946
+ const translator$e = NodeTranslator.from({
26947
+ xmlName: XML_NODE_NAME$d,
26948
26948
  sdNodeOrKeyName: SD_ATTR_KEY$3,
26949
26949
  type: NodeTranslator.translatorTypes.NODE,
26950
26950
  attributes: [],
26951
- encode: encode$j,
26952
- decode: decode$j
26951
+ encode: encode$k,
26952
+ decode: decode$k
26953
26953
  });
26954
- const XML_NODE_NAME$b = "w:tblCellMar";
26954
+ const XML_NODE_NAME$c = "w:tblCellMar";
26955
26955
  const SD_ATTR_KEY$2 = "cellMargins";
26956
- const encode$i = (params2) => {
26956
+ const encode$j = (params2) => {
26957
26957
  const { nodes } = params2;
26958
26958
  const node = nodes[0];
26959
26959
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName$1);
26960
26960
  return Object.keys(attributes).length > 0 ? attributes : void 0;
26961
26961
  };
26962
- const decode$i = (params2) => {
26962
+ const decode$j = (params2) => {
26963
26963
  const { cellMargins = {} } = params2.node.attrs || {};
26964
26964
  const elements = decodeProperties(propertyTranslatorsBySdName$1, cellMargins);
26965
26965
  const newNode = {
26966
- name: XML_NODE_NAME$b,
26966
+ name: XML_NODE_NAME$c,
26967
26967
  type: "element",
26968
26968
  attributes: {},
26969
26969
  elements
@@ -26971,12 +26971,12 @@ const decode$i = (params2) => {
26971
26971
  return newNode;
26972
26972
  };
26973
26973
  const propertyTranslators$1 = [
26974
- translator$q,
26975
- translator$o,
26976
- translator$k,
26977
- translator$i,
26978
- translator$g,
26979
- translator$e
26974
+ translator$r,
26975
+ translator$p,
26976
+ translator$l,
26977
+ translator$j,
26978
+ translator$h,
26979
+ translator$f
26980
26980
  ];
26981
26981
  const propertyTranslatorsByXmlName$1 = {};
26982
26982
  const propertyTranslatorsBySdName$1 = {};
@@ -26984,27 +26984,27 @@ propertyTranslators$1.forEach((translator2) => {
26984
26984
  propertyTranslatorsByXmlName$1[translator2.xmlName] = translator2;
26985
26985
  propertyTranslatorsBySdName$1[translator2.sdNodeOrKeyName] = translator2;
26986
26986
  });
26987
- const translator$c = NodeTranslator.from({
26988
- xmlName: XML_NODE_NAME$b,
26987
+ const translator$d = NodeTranslator.from({
26988
+ xmlName: XML_NODE_NAME$c,
26989
26989
  sdNodeOrKeyName: SD_ATTR_KEY$2,
26990
26990
  type: NodeTranslator.translatorTypes.NODE,
26991
26991
  attributes: [],
26992
- encode: encode$i,
26993
- decode: decode$i
26992
+ encode: encode$j,
26993
+ decode: decode$j
26994
26994
  });
26995
- const XML_NODE_NAME$a = "w:tblPr";
26995
+ const XML_NODE_NAME$b = "w:tblPr";
26996
26996
  const SD_ATTR_KEY$1 = "tableProperties";
26997
- const encode$h = (params2) => {
26997
+ const encode$i = (params2) => {
26998
26998
  const { nodes } = params2;
26999
26999
  const node = nodes[0];
27000
27000
  const attributes = encodeProperties(node, propertyTranslatorsByXmlName);
27001
27001
  return {
27002
- xmlName: XML_NODE_NAME$a,
27002
+ xmlName: XML_NODE_NAME$b,
27003
27003
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27004
27004
  attributes
27005
27005
  };
27006
27006
  };
27007
- const decode$h = (params2) => {
27007
+ const decode$i = (params2) => {
27008
27008
  const { tableProperties = {} } = params2.node.attrs || {};
27009
27009
  const elements = decodeProperties(propertyTranslatorsBySdName, tableProperties);
27010
27010
  const newNode = {
@@ -27016,11 +27016,12 @@ const decode$h = (params2) => {
27016
27016
  return newNode;
27017
27017
  };
27018
27018
  const propertyTranslators = [
27019
+ translator$F,
27020
+ translator$N,
27019
27021
  translator$E,
27020
- translator$M,
27021
27022
  translator$D,
27023
+ translator$M,
27022
27024
  translator$C,
27023
- translator$L,
27024
27025
  translator$B,
27025
27026
  translator$A,
27026
27027
  translator$z,
@@ -27030,9 +27031,8 @@ const propertyTranslators = [
27030
27031
  translator$v,
27031
27032
  translator$u,
27032
27033
  translator$t,
27033
- translator$s,
27034
- translator$d,
27035
- translator$c
27034
+ translator$e,
27035
+ translator$d
27036
27036
  ];
27037
27037
  const propertyTranslatorsByXmlName = {};
27038
27038
  const propertyTranslatorsBySdName = {};
@@ -27040,14 +27040,14 @@ propertyTranslators.forEach((translator2) => {
27040
27040
  propertyTranslatorsByXmlName[translator2.xmlName] = translator2;
27041
27041
  propertyTranslatorsBySdName[translator2.sdNodeOrKeyName] = translator2;
27042
27042
  });
27043
- const config$a = {
27044
- xmlName: XML_NODE_NAME$a,
27043
+ const config$b = {
27044
+ xmlName: XML_NODE_NAME$b,
27045
27045
  sdNodeOrKeyName: SD_ATTR_KEY$1,
27046
- encode: encode$h,
27047
- decode: decode$h
27046
+ encode: encode$i,
27047
+ decode: decode$i
27048
27048
  };
27049
- const translator$b = NodeTranslator.from(config$a);
27050
- const translator$a = NodeTranslator.from(
27049
+ const translator$c = NodeTranslator.from(config$b);
27050
+ const translator$b = NodeTranslator.from(
27051
27051
  createSingleAttrPropertyHandler("w:gridCol", "col", "w:w", parseInteger, integerToString)
27052
27052
  );
27053
27053
  const DEFAULT_COLUMN_WIDTH_PX = 100;
@@ -27097,20 +27097,20 @@ const resolveFallbackColumnWidthTwips = (params2, totalColumns, cellMinWidthTwip
27097
27097
  }
27098
27098
  return Math.max(fallbackWidthTwips, cellMinWidthTwips);
27099
27099
  };
27100
- const XML_NODE_NAME$9 = "w:tblGrid";
27100
+ const XML_NODE_NAME$a = "w:tblGrid";
27101
27101
  const SD_ATTR_KEY = "grid";
27102
27102
  const cellMinWidth = pixelsToTwips(10);
27103
- const encode$g = (params2) => {
27103
+ const encode$h = (params2) => {
27104
27104
  const { nodes } = params2;
27105
27105
  const node = nodes[0];
27106
- const attributes = encodeProperties(node, { [translator$a.xmlName]: translator$a }, true);
27106
+ const attributes = encodeProperties(node, { [translator$b.xmlName]: translator$b }, true);
27107
27107
  return {
27108
- xmlName: XML_NODE_NAME$9,
27108
+ xmlName: XML_NODE_NAME$a,
27109
27109
  sdNodeOrKeyName: SD_ATTR_KEY,
27110
27110
  attributes
27111
27111
  };
27112
27112
  };
27113
- const decode$g = (params2) => {
27113
+ const decode$h = (params2) => {
27114
27114
  const { grid: rawGrid } = params2.node.attrs || {};
27115
27115
  const grid = Array.isArray(rawGrid) ? rawGrid : [];
27116
27116
  const { firstRow = {} } = params2.extraParams || {};
@@ -27129,10 +27129,10 @@ const decode$g = (params2) => {
27129
27129
  numericWidth = fallbackColumnWidthTwips;
27130
27130
  }
27131
27131
  numericWidth = Math.max(numericWidth, cellMinWidth);
27132
- const decoded = translator$a.decode({
27132
+ const decoded = translator$b.decode({
27133
27133
  node: { type: (
27134
27134
  /** @type {string} */
27135
- translator$a.sdNodeOrKeyName
27135
+ translator$b.sdNodeOrKeyName
27136
27136
  ), attrs: { col: numericWidth } }
27137
27137
  });
27138
27138
  if (decoded) elements.push(decoded);
@@ -27167,32 +27167,32 @@ const decode$g = (params2) => {
27167
27167
  columnIndex++;
27168
27168
  }
27169
27169
  const newNode = {
27170
- name: XML_NODE_NAME$9,
27170
+ name: XML_NODE_NAME$a,
27171
27171
  attributes: {},
27172
27172
  elements
27173
27173
  };
27174
27174
  return newNode;
27175
27175
  };
27176
- const config$9 = {
27177
- xmlName: XML_NODE_NAME$9,
27176
+ const config$a = {
27177
+ xmlName: XML_NODE_NAME$a,
27178
27178
  sdNodeOrKeyName: SD_ATTR_KEY,
27179
- encode: encode$g,
27180
- decode: decode$g
27179
+ encode: encode$h,
27180
+ decode: decode$h
27181
27181
  };
27182
- const translator$9 = NodeTranslator.from(config$9);
27183
- const XML_NODE_NAME$8 = "w:tbl";
27184
- const SD_NODE_NAME$8 = "table";
27185
- const encode$f = (params2, encodedAttrs) => {
27182
+ const translator$a = NodeTranslator.from(config$a);
27183
+ const XML_NODE_NAME$9 = "w:tbl";
27184
+ const SD_NODE_NAME$9 = "table";
27185
+ const encode$g = (params2, encodedAttrs) => {
27186
27186
  const { nodes } = params2;
27187
27187
  const node = nodes[0];
27188
27188
  const tblPr = node.elements.find((el) => el.name === "w:tblPr");
27189
27189
  if (tblPr) {
27190
- const encodedProperties = translator$b.encode({ ...params2, nodes: [tblPr] });
27190
+ const encodedProperties = translator$c.encode({ ...params2, nodes: [tblPr] });
27191
27191
  encodedAttrs["tableProperties"] = encodedProperties?.attributes || {};
27192
27192
  }
27193
27193
  const tblGrid = node.elements.find((el) => el.name === "w:tblGrid");
27194
27194
  if (tblGrid) {
27195
- encodedAttrs["grid"] = translator$9.encode({ ...params2, nodes: [tblGrid] }).attributes;
27195
+ encodedAttrs["grid"] = translator$a.encode({ ...params2, nodes: [tblGrid] }).attributes;
27196
27196
  }
27197
27197
  [
27198
27198
  "tableStyleId",
@@ -27233,7 +27233,7 @@ const encode$f = (params2, encodedAttrs) => {
27233
27233
  const columnWidths = (encodedAttrs["grid"] ?? []).map((item) => twipsToPixels(item.col));
27234
27234
  const content = [];
27235
27235
  rows.forEach((row) => {
27236
- const result = translator$F.encode({
27236
+ const result = translator$G.encode({
27237
27237
  ...params2,
27238
27238
  nodes: [row],
27239
27239
  extraParams: {
@@ -27252,13 +27252,13 @@ const encode$f = (params2, encodedAttrs) => {
27252
27252
  attrs: encodedAttrs
27253
27253
  };
27254
27254
  };
27255
- const decode$f = (params2, decodedAttrs) => {
27255
+ const decode$g = (params2, decodedAttrs) => {
27256
27256
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
27257
27257
  const { node } = params2;
27258
27258
  const elements = translateChildNodes(params2);
27259
27259
  const firstRow = node.content?.find((n) => n.type === "tableRow");
27260
27260
  const properties = node.attrs.grid;
27261
- const element = translator$9.decode({
27261
+ const element = translator$a.decode({
27262
27262
  ...params2,
27263
27263
  node: { ...node, attrs: { ...node.attrs, grid: properties } },
27264
27264
  extraParams: {
@@ -27268,7 +27268,7 @@ const decode$f = (params2, decodedAttrs) => {
27268
27268
  if (element) elements.unshift(element);
27269
27269
  if (node.attrs?.tableProperties) {
27270
27270
  const properties2 = { ...node.attrs.tableProperties };
27271
- const element2 = translator$b.decode({
27271
+ const element2 = translator$c.decode({
27272
27272
  ...params2,
27273
27273
  node: { ...node, attrs: { ...node.attrs, tableProperties: properties2 } }
27274
27274
  });
@@ -27334,7 +27334,7 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27334
27334
  if (baseTblPr && baseTblPr.elements) {
27335
27335
  tblPr.elements.push(...baseTblPr.elements);
27336
27336
  }
27337
- const tableProperties = translator$b.encode({ ...params2, nodes: [tblPr] }).attributes;
27337
+ const tableProperties = translator$c.encode({ ...params2, nodes: [tblPr] }).attributes;
27338
27338
  const { borders, rowBorders } = _processTableBorders(tableProperties.borders || {});
27339
27339
  if (borders) stylesToReturn.borders = borders;
27340
27340
  if (rowBorders) stylesToReturn.rowBorders = rowBorders;
@@ -27351,16 +27351,16 @@ function _getReferencedTableStyles(tableStyleReference, params2) {
27351
27351
  }
27352
27352
  return stylesToReturn;
27353
27353
  }
27354
- const config$8 = {
27355
- xmlName: XML_NODE_NAME$8,
27356
- sdNodeOrKeyName: SD_NODE_NAME$8,
27354
+ const config$9 = {
27355
+ xmlName: XML_NODE_NAME$9,
27356
+ sdNodeOrKeyName: SD_NODE_NAME$9,
27357
27357
  type: NodeTranslator.translatorTypes.NODE,
27358
- encode: encode$f,
27359
- decode: decode$f,
27358
+ encode: encode$g,
27359
+ decode: decode$g,
27360
27360
  attributes: []
27361
27361
  };
27362
- const translator$8 = NodeTranslator.from(config$8);
27363
- const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$8);
27362
+ const translator$9 = NodeTranslator.from(config$9);
27363
+ const tableNodeHandlerEntity = generateV2HandlerEntity("tableNodeHandler", translator$9);
27364
27364
  function getReferencedTableStyles(tblStyleTag, docx) {
27365
27365
  if (!tblStyleTag) return null;
27366
27366
  const stylesToReturn = {};
@@ -27722,10 +27722,10 @@ function generateCellMargins(cellMargins) {
27722
27722
  if (left2 != null) elements.push({ name: "w:left", attributes: { "w:w": pixelsToTwips(left2) } });
27723
27723
  return elements;
27724
27724
  }
27725
- const XML_NODE_NAME$7 = "w:tc";
27726
- const SD_NODE_NAME$7 = "tableCell";
27727
- const validXmlAttributes$7 = [];
27728
- function encode$e(params2, encodedAttrs) {
27725
+ const XML_NODE_NAME$8 = "w:tc";
27726
+ const SD_NODE_NAME$8 = "tableCell";
27727
+ const validXmlAttributes$8 = [];
27728
+ function encode$f(params2, encodedAttrs) {
27729
27729
  const {
27730
27730
  node,
27731
27731
  table,
@@ -27752,31 +27752,31 @@ function encode$e(params2, encodedAttrs) {
27752
27752
  }
27753
27753
  return schemaNode;
27754
27754
  }
27755
- function decode$e(params2, decodedAttrs) {
27755
+ function decode$f(params2, decodedAttrs) {
27756
27756
  const translated = translateTableCell(params2);
27757
27757
  if (decodedAttrs && Object.keys(decodedAttrs).length) {
27758
27758
  translated.attributes = { ...translated.attributes || {}, ...decodedAttrs };
27759
27759
  }
27760
27760
  return translated;
27761
27761
  }
27762
- const config$7 = {
27763
- xmlName: XML_NODE_NAME$7,
27764
- sdNodeOrKeyName: SD_NODE_NAME$7,
27762
+ const config$8 = {
27763
+ xmlName: XML_NODE_NAME$8,
27764
+ sdNodeOrKeyName: SD_NODE_NAME$8,
27765
27765
  type: NodeTranslator.translatorTypes.NODE,
27766
- encode: encode$e,
27767
- decode: decode$e,
27768
- attributes: validXmlAttributes$7
27766
+ encode: encode$f,
27767
+ decode: decode$f,
27768
+ attributes: validXmlAttributes$8
27769
27769
  };
27770
- const translator$7 = NodeTranslator.from(config$7);
27771
- const XML_NODE_NAME$6 = "w:hyperlink";
27772
- const SD_NODE_NAME$6 = "link";
27770
+ const translator$8 = NodeTranslator.from(config$8);
27771
+ const XML_NODE_NAME$7 = "w:hyperlink";
27772
+ const SD_NODE_NAME$7 = "link";
27773
27773
  const _createAttributeHandler = (xmlName, sdName) => ({
27774
27774
  xmlName,
27775
27775
  sdName,
27776
27776
  encode: (attributes) => attributes[xmlName],
27777
27777
  decode: (attributes) => attributes[sdName]
27778
27778
  });
27779
- const validXmlAttributes$6 = [
27779
+ const validXmlAttributes$7 = [
27780
27780
  _createAttributeHandler("w:anchor", "anchor"),
27781
27781
  _createAttributeHandler("w:docLocation", "docLocation"),
27782
27782
  {
@@ -27789,7 +27789,7 @@ const validXmlAttributes$6 = [
27789
27789
  _createAttributeHandler("r:id", "rId"),
27790
27790
  _createAttributeHandler("w:tgtFrame", "target")
27791
27791
  ];
27792
- const encode$d = (params2, encodedAttrs) => {
27792
+ const encode$e = (params2, encodedAttrs) => {
27793
27793
  const { nodes, docx, nodeListHandler } = params2;
27794
27794
  const node = nodes[0];
27795
27795
  let href = _resolveHref(docx, encodedAttrs);
@@ -27855,7 +27855,7 @@ const _resolveHref = (docx, encodedAttrs) => {
27855
27855
  }
27856
27856
  return href;
27857
27857
  };
27858
- function decode$d(params2) {
27858
+ function decode$e(params2) {
27859
27859
  const { node } = params2;
27860
27860
  const linkMark = node.marks.find((m2) => m2.type === "link");
27861
27861
  const linkAttrs = this.decodeAttributes({ ...params2, node: linkMark });
@@ -27899,15 +27899,15 @@ function _addNewLinkRelationship(params2, link, rId) {
27899
27899
  });
27900
27900
  return rId;
27901
27901
  }
27902
- const config$6 = {
27903
- xmlName: XML_NODE_NAME$6,
27904
- sdNodeOrKeyName: SD_NODE_NAME$6,
27902
+ const config$7 = {
27903
+ xmlName: XML_NODE_NAME$7,
27904
+ sdNodeOrKeyName: SD_NODE_NAME$7,
27905
27905
  type: NodeTranslator.translatorTypes.NODE,
27906
- encode: encode$d,
27907
- decode: decode$d,
27908
- attributes: validXmlAttributes$6
27906
+ encode: encode$e,
27907
+ decode: decode$e,
27908
+ attributes: validXmlAttributes$7
27909
27909
  };
27910
- const translator$6 = NodeTranslator.from(config$6);
27910
+ const translator$7 = NodeTranslator.from(config$7);
27911
27911
  function parseTagValueJSON(json) {
27912
27912
  if (typeof json !== "string") {
27913
27913
  return {};
@@ -28702,32 +28702,32 @@ function translateAnchorNode(params2) {
28702
28702
  elements: [...anchorElements, ...elementsWithWrap]
28703
28703
  };
28704
28704
  }
28705
- const XML_NODE_NAME$5 = "wp:anchor";
28706
- const SD_NODE_NAME$5 = ["image"];
28707
- const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28708
- function encode$c(params2) {
28705
+ const XML_NODE_NAME$6 = "wp:anchor";
28706
+ const SD_NODE_NAME$6 = ["image"];
28707
+ const validXmlAttributes$6 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28708
+ function encode$d(params2) {
28709
28709
  const { node } = params2.extraParams;
28710
28710
  if (!node || !node.type) {
28711
28711
  return null;
28712
28712
  }
28713
28713
  return handleAnchorNode(params2);
28714
28714
  }
28715
- function decode$c(params2) {
28715
+ function decode$d(params2) {
28716
28716
  const { node } = params2;
28717
28717
  if (!node || !node.type) {
28718
28718
  return null;
28719
28719
  }
28720
28720
  return translateAnchorNode(params2);
28721
28721
  }
28722
- const config$5 = {
28723
- xmlName: XML_NODE_NAME$5,
28724
- sdNodeOrKeyName: SD_NODE_NAME$5,
28722
+ const config$6 = {
28723
+ xmlName: XML_NODE_NAME$6,
28724
+ sdNodeOrKeyName: SD_NODE_NAME$6,
28725
28725
  type: NodeTranslator.translatorTypes.NODE,
28726
- encode: encode$c,
28727
- decode: decode$c,
28728
- attributes: validXmlAttributes$5
28726
+ encode: encode$d,
28727
+ decode: decode$d,
28728
+ attributes: validXmlAttributes$6
28729
28729
  };
28730
- const translator$5 = NodeTranslator.from(config$5);
28730
+ const translator$6 = NodeTranslator.from(config$6);
28731
28731
  function handleInlineNode(params2) {
28732
28732
  const { node } = params2.extraParams;
28733
28733
  if (node.name !== "wp:inline") {
@@ -28743,41 +28743,41 @@ function translateInlineNode(params2) {
28743
28743
  elements: nodeElements.elements
28744
28744
  };
28745
28745
  }
28746
- const XML_NODE_NAME$4 = "wp:inline";
28747
- const SD_NODE_NAME$4 = ["image"];
28748
- const validXmlAttributes$4 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28749
- function encode$b(params2) {
28746
+ const XML_NODE_NAME$5 = "wp:inline";
28747
+ const SD_NODE_NAME$5 = ["image"];
28748
+ const validXmlAttributes$5 = ["distT", "distB", "distL", "distR"].map((xmlName) => createAttributeHandler(xmlName));
28749
+ function encode$c(params2) {
28750
28750
  const { node } = params2.extraParams;
28751
28751
  if (!node || !node.type) {
28752
28752
  return null;
28753
28753
  }
28754
28754
  return handleInlineNode(params2);
28755
28755
  }
28756
- function decode$b(params2) {
28756
+ function decode$c(params2) {
28757
28757
  const { node } = params2;
28758
28758
  if (!node || !node.type) {
28759
28759
  return null;
28760
28760
  }
28761
28761
  return translateInlineNode(params2);
28762
28762
  }
28763
- const config$4 = {
28764
- xmlName: XML_NODE_NAME$4,
28765
- sdNodeOrKeyName: SD_NODE_NAME$4,
28763
+ const config$5 = {
28764
+ xmlName: XML_NODE_NAME$5,
28765
+ sdNodeOrKeyName: SD_NODE_NAME$5,
28766
28766
  type: NodeTranslator.translatorTypes.NODE,
28767
- encode: encode$b,
28768
- decode: decode$b,
28769
- attributes: validXmlAttributes$4
28767
+ encode: encode$c,
28768
+ decode: decode$c,
28769
+ attributes: validXmlAttributes$5
28770
28770
  };
28771
- const translator$4 = NodeTranslator.from(config$4);
28772
- const XML_NODE_NAME$3 = "w:drawing";
28773
- const SD_NODE_NAME$3 = [];
28774
- const validXmlAttributes$3 = [];
28775
- function encode$a(params2) {
28771
+ const translator$5 = NodeTranslator.from(config$5);
28772
+ const XML_NODE_NAME$4 = "w:drawing";
28773
+ const SD_NODE_NAME$4 = [];
28774
+ const validXmlAttributes$4 = [];
28775
+ function encode$b(params2) {
28776
28776
  const nodes = params2.nodes;
28777
28777
  const node = nodes[0];
28778
28778
  const translatorByChildName = {
28779
- "wp:anchor": translator$5,
28780
- "wp:inline": translator$4
28779
+ "wp:anchor": translator$6,
28780
+ "wp:inline": translator$5
28781
28781
  };
28782
28782
  return node.elements.reduce((acc, child) => {
28783
28783
  if (acc) return acc;
@@ -28786,12 +28786,12 @@ function encode$a(params2) {
28786
28786
  return translator2.encode({ ...params2, extraParams: { node: child } }) || acc;
28787
28787
  }, null);
28788
28788
  }
28789
- function decode$a(params2) {
28789
+ function decode$b(params2) {
28790
28790
  const { node } = params2;
28791
28791
  if (!node || !node.type) {
28792
28792
  return null;
28793
28793
  }
28794
- const childTranslator = node.attrs.isAnchor ? translator$5 : translator$4;
28794
+ const childTranslator = node.attrs.isAnchor ? translator$6 : translator$5;
28795
28795
  const resultNode = childTranslator.decode(params2);
28796
28796
  return wrapTextInRun(
28797
28797
  {
@@ -28801,15 +28801,15 @@ function decode$a(params2) {
28801
28801
  []
28802
28802
  );
28803
28803
  }
28804
- const config$3 = {
28805
- xmlName: XML_NODE_NAME$3,
28806
- sdNodeOrKeyName: SD_NODE_NAME$3,
28804
+ const config$4 = {
28805
+ xmlName: XML_NODE_NAME$4,
28806
+ sdNodeOrKeyName: SD_NODE_NAME$4,
28807
28807
  type: NodeTranslator.translatorTypes.NODE,
28808
- encode: encode$a,
28809
- decode: decode$a,
28810
- attributes: validXmlAttributes$3
28808
+ encode: encode$b,
28809
+ decode: decode$b,
28810
+ attributes: validXmlAttributes$4
28811
28811
  };
28812
- const translator$3 = NodeTranslator.from(config$3);
28812
+ const translator$4 = NodeTranslator.from(config$4);
28813
28813
  class CommandService {
28814
28814
  /**
28815
28815
  * @param {import('./commands/types/index.js').CommandServiceOptions} props
@@ -30147,7 +30147,7 @@ function prepareTextAnnotation(params2) {
30147
30147
  return getTextNodeForExport(attrs.displayLabel, [...marks, ...marksFromAttrs], params2);
30148
30148
  }
30149
30149
  function prepareImageAnnotation(params2, imageSize) {
30150
- return translator$3.decode({
30150
+ return translator$4.decode({
30151
30151
  ...params2,
30152
30152
  imageSize
30153
30153
  });
@@ -30384,10 +30384,10 @@ function translateStructuredContent(params2) {
30384
30384
  };
30385
30385
  return result;
30386
30386
  }
30387
- const XML_NODE_NAME$2 = "w:sdt";
30388
- const SD_NODE_NAME$2 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30389
- const validXmlAttributes$2 = [];
30390
- function encode$9(params2) {
30387
+ const XML_NODE_NAME$3 = "w:sdt";
30388
+ const SD_NODE_NAME$3 = ["fieldAnnotation", "structuredContent", "structuredContentBlock", "documentSection"];
30389
+ const validXmlAttributes$3 = [];
30390
+ function encode$a(params2) {
30391
30391
  const nodes = params2.nodes;
30392
30392
  const node = nodes[0];
30393
30393
  const { type: sdtType, handler: handler2 } = sdtNodeTypeStrategy(node);
@@ -30397,7 +30397,7 @@ function encode$9(params2) {
30397
30397
  const result = handler2(params2);
30398
30398
  return result;
30399
30399
  }
30400
- function decode$9(params2) {
30400
+ function decode$a(params2) {
30401
30401
  const { node } = params2;
30402
30402
  if (!node || !node.type) {
30403
30403
  return null;
@@ -30413,85 +30413,85 @@ function decode$9(params2) {
30413
30413
  const result = decoder();
30414
30414
  return result;
30415
30415
  }
30416
- const config$2 = {
30417
- xmlName: XML_NODE_NAME$2,
30418
- sdNodeOrKeyName: SD_NODE_NAME$2,
30416
+ const config$3 = {
30417
+ xmlName: XML_NODE_NAME$3,
30418
+ sdNodeOrKeyName: SD_NODE_NAME$3,
30419
30419
  type: NodeTranslator.translatorTypes.NODE,
30420
- encode: encode$9,
30421
- decode: decode$9,
30422
- attributes: validXmlAttributes$2
30420
+ encode: encode$a,
30421
+ decode: decode$a,
30422
+ attributes: validXmlAttributes$3
30423
30423
  };
30424
- const translator$2 = NodeTranslator.from(config$2);
30425
- const encode$8 = (attributes) => {
30424
+ const translator$3 = NodeTranslator.from(config$3);
30425
+ const encode$9 = (attributes) => {
30426
30426
  return attributes["w:id"];
30427
30427
  };
30428
- const decode$8 = (attrs) => {
30428
+ const decode$9 = (attrs) => {
30429
30429
  return attrs.id;
30430
30430
  };
30431
30431
  const attrConfig$6 = Object.freeze({
30432
30432
  xmlName: "w:id",
30433
30433
  sdName: "id",
30434
- encode: encode$8,
30435
- decode: decode$8
30434
+ encode: encode$9,
30435
+ decode: decode$9
30436
30436
  });
30437
- const encode$7 = (attributes) => {
30437
+ const encode$8 = (attributes) => {
30438
30438
  return attributes["w:name"];
30439
30439
  };
30440
- const decode$7 = (attrs) => {
30440
+ const decode$8 = (attrs) => {
30441
30441
  return attrs.name;
30442
30442
  };
30443
30443
  const attrConfig$5 = Object.freeze({
30444
30444
  xmlName: "w:name",
30445
30445
  sdName: "name",
30446
- encode: encode$7,
30447
- decode: decode$7
30446
+ encode: encode$8,
30447
+ decode: decode$8
30448
30448
  });
30449
- const encode$6 = (attributes) => {
30449
+ const encode$7 = (attributes) => {
30450
30450
  return attributes["w:colFirst"];
30451
30451
  };
30452
- const decode$6 = (attrs) => {
30452
+ const decode$7 = (attrs) => {
30453
30453
  return attrs.colFirst;
30454
30454
  };
30455
30455
  const attrConfig$4 = Object.freeze({
30456
30456
  xmlName: "w:colFirst",
30457
30457
  sdName: "colFirst",
30458
- encode: encode$6,
30459
- decode: decode$6
30458
+ encode: encode$7,
30459
+ decode: decode$7
30460
30460
  });
30461
- const encode$5 = (attributes) => {
30461
+ const encode$6 = (attributes) => {
30462
30462
  return attributes["w:colLast"];
30463
30463
  };
30464
- const decode$5 = (attrs) => {
30464
+ const decode$6 = (attrs) => {
30465
30465
  return attrs.colLast;
30466
30466
  };
30467
30467
  const attrConfig$3 = Object.freeze({
30468
30468
  xmlName: "w:colLast",
30469
30469
  sdName: "colLast",
30470
- encode: encode$5,
30471
- decode: decode$5
30470
+ encode: encode$6,
30471
+ decode: decode$6
30472
30472
  });
30473
- const encode$4 = (attributes) => {
30473
+ const encode$5 = (attributes) => {
30474
30474
  return attributes["w:displacedByCustomXml"];
30475
30475
  };
30476
- const decode$4 = (attrs) => {
30476
+ const decode$5 = (attrs) => {
30477
30477
  return attrs.displacedByCustomXml;
30478
30478
  };
30479
30479
  const attrConfig$2 = Object.freeze({
30480
30480
  xmlName: "w:displacedByCustomXml",
30481
30481
  sdName: "displacedByCustomXml",
30482
- encode: encode$4,
30483
- decode: decode$4
30482
+ encode: encode$5,
30483
+ decode: decode$5
30484
30484
  });
30485
- const validXmlAttributes$1 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30486
- const XML_NODE_NAME$1 = "w:bookmarkStart";
30487
- const SD_NODE_NAME$1 = "bookmarkStart";
30488
- const encode$3 = (params2, encodedAttrs = {}) => {
30485
+ const validXmlAttributes$2 = [attrConfig$6, attrConfig$5, attrConfig$4, attrConfig$3, attrConfig$2];
30486
+ const XML_NODE_NAME$2 = "w:bookmarkStart";
30487
+ const SD_NODE_NAME$2 = "bookmarkStart";
30488
+ const encode$4 = (params2, encodedAttrs = {}) => {
30489
30489
  return {
30490
30490
  type: "bookmarkStart",
30491
30491
  attrs: encodedAttrs
30492
30492
  };
30493
30493
  };
30494
- const decode$3 = (params2, decodedAttrs = {}) => {
30494
+ const decode$4 = (params2, decodedAttrs = {}) => {
30495
30495
  const result = {
30496
30496
  name: "w:bookmarkStart",
30497
30497
  elements: []
@@ -30501,49 +30501,49 @@ const decode$3 = (params2, decodedAttrs = {}) => {
30501
30501
  }
30502
30502
  return result;
30503
30503
  };
30504
- const config$1 = {
30505
- xmlName: XML_NODE_NAME$1,
30506
- sdNodeOrKeyName: SD_NODE_NAME$1,
30504
+ const config$2 = {
30505
+ xmlName: XML_NODE_NAME$2,
30506
+ sdNodeOrKeyName: SD_NODE_NAME$2,
30507
30507
  type: NodeTranslator.translatorTypes.NODE,
30508
- encode: encode$3,
30509
- decode: decode$3,
30510
- attributes: validXmlAttributes$1
30508
+ encode: encode$4,
30509
+ decode: decode$4,
30510
+ attributes: validXmlAttributes$2
30511
30511
  };
30512
- const translator$1 = NodeTranslator.from(config$1);
30513
- const encode$2 = (attributes) => {
30512
+ const translator$2 = NodeTranslator.from(config$2);
30513
+ const encode$3 = (attributes) => {
30514
30514
  return attributes["w:id"];
30515
30515
  };
30516
- const decode$2 = (attrs) => {
30516
+ const decode$3 = (attrs) => {
30517
30517
  return attrs.id;
30518
30518
  };
30519
30519
  const attrConfig$1 = Object.freeze({
30520
30520
  xmlName: "w:id",
30521
30521
  sdName: "id",
30522
- encode: encode$2,
30523
- decode: decode$2
30522
+ encode: encode$3,
30523
+ decode: decode$3
30524
30524
  });
30525
- const encode$1 = (attributes) => {
30525
+ const encode$2 = (attributes) => {
30526
30526
  return attributes["w:displacedByCustomXml"];
30527
30527
  };
30528
- const decode$1 = (attrs) => {
30528
+ const decode$2 = (attrs) => {
30529
30529
  return attrs.displacedByCustomXml;
30530
30530
  };
30531
30531
  const attrConfig = Object.freeze({
30532
30532
  xmlName: "w:displacedByCustomXml",
30533
30533
  sdName: "displacedByCustomXml",
30534
- encode: encode$1,
30535
- decode: decode$1
30534
+ encode: encode$2,
30535
+ decode: decode$2
30536
30536
  });
30537
- const validXmlAttributes = [attrConfig$1, attrConfig];
30538
- const XML_NODE_NAME = "w:bookmarkEnd";
30539
- const SD_NODE_NAME = "bookmarkEnd";
30540
- const encode$18 = (params2, encodedAttrs = {}) => {
30537
+ const validXmlAttributes$1 = [attrConfig$1, attrConfig];
30538
+ const XML_NODE_NAME$1 = "w:bookmarkEnd";
30539
+ const SD_NODE_NAME$1 = "bookmarkEnd";
30540
+ const encode$1 = (params2, encodedAttrs = {}) => {
30541
30541
  return {
30542
30542
  type: "bookmarkEnd",
30543
30543
  attrs: encodedAttrs
30544
30544
  };
30545
30545
  };
30546
- const decode = (params2, decodedAttrs = {}) => {
30546
+ const decode$1 = (params2, decodedAttrs = {}) => {
30547
30547
  const result = {
30548
30548
  name: "w:bookmarkEnd",
30549
30549
  elements: []
@@ -30553,11 +30553,60 @@ const decode = (params2, decodedAttrs = {}) => {
30553
30553
  }
30554
30554
  return result;
30555
30555
  };
30556
+ const config$1 = {
30557
+ xmlName: XML_NODE_NAME$1,
30558
+ sdNodeOrKeyName: SD_NODE_NAME$1,
30559
+ type: NodeTranslator.translatorTypes.NODE,
30560
+ encode: encode$1,
30561
+ decode: decode$1,
30562
+ attributes: validXmlAttributes$1
30563
+ };
30564
+ const translator$1 = NodeTranslator.from(config$1);
30565
+ const XML_NODE_NAME = "mc:AlternateContent";
30566
+ const SD_NODE_NAME = [];
30567
+ const validXmlAttributes = [];
30568
+ function encode$19(params2) {
30569
+ const { nodeListHandler } = params2;
30570
+ const { node } = params2.extraParams;
30571
+ if (!node || !node.type) {
30572
+ return null;
30573
+ }
30574
+ const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
30575
+ const wpsNode = node.elements.find(
30576
+ (el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
30577
+ );
30578
+ if (!wpsNode) {
30579
+ return null;
30580
+ }
30581
+ const contents = wpsNode.elements;
30582
+ return nodeListHandler.handler({
30583
+ ...params2,
30584
+ nodes: contents,
30585
+ path: [...params2.path || [], wpsNode]
30586
+ });
30587
+ }
30588
+ function decode(params2) {
30589
+ const { node } = params2;
30590
+ const { drawingContent } = node.attrs;
30591
+ const drawing = {
30592
+ name: "w:drawing",
30593
+ elements: [...drawingContent ? [...drawingContent.elements || []] : []]
30594
+ };
30595
+ const choice = {
30596
+ name: "mc:Choice",
30597
+ attributes: { Requires: "wps" },
30598
+ elements: [drawing]
30599
+ };
30600
+ return {
30601
+ name: "mc:AlternateContent",
30602
+ elements: [choice]
30603
+ };
30604
+ }
30556
30605
  const config = {
30557
30606
  xmlName: XML_NODE_NAME,
30558
30607
  sdNodeOrKeyName: SD_NODE_NAME,
30559
30608
  type: NodeTranslator.translatorTypes.NODE,
30560
- encode: encode$18,
30609
+ encode: encode$19,
30561
30610
  decode,
30562
30611
  attributes: validXmlAttributes
30563
30612
  };
@@ -30576,30 +30625,30 @@ function exportSchemaToJson(params2) {
30576
30625
  doc: translateDocumentNode,
30577
30626
  body: translateBodyNode,
30578
30627
  heading: translateHeadingNode,
30579
- paragraph: translator$12,
30580
- run: translator$T,
30628
+ paragraph: translator$13,
30629
+ run: translator$U,
30581
30630
  text: translateTextNode,
30582
30631
  bulletList: translateList,
30583
30632
  orderedList: translateList,
30584
- lineBreak: translator$15,
30585
- table: translator$8,
30586
- tableRow: translator$F,
30587
- tableCell: translator$7,
30588
- bookmarkStart: translator$1,
30589
- bookmarkEnd: translator,
30590
- fieldAnnotation: translator$2,
30591
- tab: translator$13,
30592
- image: translator$3,
30593
- hardBreak: translator$15,
30633
+ lineBreak: translator$16,
30634
+ table: translator$9,
30635
+ tableRow: translator$G,
30636
+ tableCell: translator$8,
30637
+ bookmarkStart: translator$2,
30638
+ bookmarkEnd: translator$1,
30639
+ fieldAnnotation: translator$3,
30640
+ tab: translator$14,
30641
+ image: translator$4,
30642
+ hardBreak: translator$16,
30594
30643
  commentRangeStart: () => translateCommentNode(params2, "Start"),
30595
30644
  commentRangeEnd: () => translateCommentNode(params2, "End"),
30596
30645
  commentReference: () => null,
30597
30646
  shapeContainer: translateShapeContainer,
30598
30647
  shapeTextbox: translateShapeTextbox,
30599
30648
  contentBlock: translateContentBlock,
30600
- structuredContent: translator$2,
30601
- structuredContentBlock: translator$2,
30602
- documentSection: translator$2,
30649
+ structuredContent: translator$3,
30650
+ structuredContentBlock: translator$3,
30651
+ documentSection: translator$3,
30603
30652
  "page-number": translatePageNumberNode,
30604
30653
  "total-page-number": translateTotalPageNumberNode
30605
30654
  };
@@ -30938,7 +30987,7 @@ function translateTextNode(params2) {
30938
30987
  const isTrackedNode = node.marks?.some((m2) => trackedMarks.includes(m2.type));
30939
30988
  if (isTrackedNode) return translateTrackedNode(params2);
30940
30989
  const isLinkNode = node.marks?.some((m2) => m2.type === "link");
30941
- if (isLinkNode) return translator$6.decode(params2);
30990
+ if (isLinkNode) return translator$7.decode(params2);
30942
30991
  const { text, marks = [] } = node;
30943
30992
  return getTextNodeForExport(text, marks, params2);
30944
30993
  }
@@ -31244,7 +31293,7 @@ function translateMark(mark) {
31244
31293
  markElement.type = "element";
31245
31294
  break;
31246
31295
  case "underline": {
31247
- const translated = translator$$.decode({
31296
+ const translated = translator$10.decode({
31248
31297
  node: {
31249
31298
  attrs: {
31250
31299
  underlineType: attrs.underlineType ?? attrs.underline ?? null,
@@ -31308,7 +31357,7 @@ function translateMark(mark) {
31308
31357
  break;
31309
31358
  case "highlight": {
31310
31359
  const highlightValue = attrs.color ?? attrs.highlight ?? null;
31311
- const translated = translator$14.decode({ node: { attrs: { highlight: highlightValue } } });
31360
+ const translated = translator$15.decode({ node: { attrs: { highlight: highlightValue } } });
31312
31361
  return translated || {};
31313
31362
  }
31314
31363
  }
@@ -31364,23 +31413,11 @@ function translateShapeTextbox(params2) {
31364
31413
  }
31365
31414
  function translateContentBlock(params2) {
31366
31415
  const { node } = params2;
31367
- const { drawingContent, vmlAttributes, horizontalRule } = node.attrs;
31416
+ const { vmlAttributes, horizontalRule } = node.attrs;
31368
31417
  if (vmlAttributes || horizontalRule) {
31369
31418
  return translateVRectContentBlock(params2);
31370
31419
  }
31371
- const drawing = {
31372
- name: "w:drawing",
31373
- elements: [...drawingContent ? [...drawingContent.elements || []] : []]
31374
- };
31375
- const choice = {
31376
- name: "mc:Choice",
31377
- attributes: { Requires: "wps" },
31378
- elements: [drawing]
31379
- };
31380
- const alternateContent = {
31381
- name: "mc:AlternateContent",
31382
- elements: [choice]
31383
- };
31420
+ const alternateContent = translator.decode(params2);
31384
31421
  return wrapTextInRun(alternateContent);
31385
31422
  }
31386
31423
  function translateVRectContentBlock(params2) {
@@ -31584,7 +31621,7 @@ const handleDrawingNode = (params2) => {
31584
31621
  if (mainNode.name === "w:drawing") node = mainNode;
31585
31622
  else node = mainNode.elements.find((el) => el.name === "w:drawing");
31586
31623
  if (!node) return { nodes: [], consumed: 0 };
31587
- const schemaNode = translator$3.encode(params2);
31624
+ const schemaNode = translator$4.encode(params2);
31588
31625
  const newNodes = schemaNode ? [schemaNode] : [];
31589
31626
  return { nodes: newNodes, consumed: 1 };
31590
31627
  };
@@ -31686,8 +31723,8 @@ const trackChangeNodeHandlerEntity = {
31686
31723
  handlerName: "trackChangeNodeHandler",
31687
31724
  handler: handleTrackChangeNode
31688
31725
  };
31689
- const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$6);
31690
- const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$T);
31726
+ const hyperlinkNodeHandlerEntity = generateV2HandlerEntity("hyperlinkNodeHandler", translator$7);
31727
+ const runNodeHandlerEntity = generateV2HandlerEntity("runNodeHandler", translator$U);
31691
31728
  const handleTextNode = (params2) => {
31692
31729
  const { nodes, insideTrackChange } = params2;
31693
31730
  if (nodes.length === 0 || !(nodes[0].name === "w:t" || insideTrackChange && nodes[0].name === "w:delText")) {
@@ -31728,7 +31765,7 @@ const handleParagraphNode = (params2) => {
31728
31765
  if (nodes.length === 0 || nodes[0].name !== "w:p") {
31729
31766
  return { nodes: [], consumed: 0 };
31730
31767
  }
31731
- const schemaNode = translator$12.encode(params2);
31768
+ const schemaNode = translator$13.encode(params2);
31732
31769
  const newNodes = schemaNode ? [schemaNode] : [];
31733
31770
  return { nodes: newNodes, consumed: 1 };
31734
31771
  };
@@ -31741,7 +31778,7 @@ const handleSdtNode = (params2) => {
31741
31778
  if (nodes.length === 0 || nodes[0].name !== "w:sdt") {
31742
31779
  return { nodes: [], consumed: 0 };
31743
31780
  }
31744
- const result = translator$2.encode(params2);
31781
+ const result = translator$3.encode(params2);
31745
31782
  if (!result) {
31746
31783
  return { nodes: [], consumed: 0 };
31747
31784
  }
@@ -31831,7 +31868,7 @@ const handler = (params2) => {
31831
31868
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
31832
31869
  return { nodes: [], consumed: 0 };
31833
31870
  }
31834
- const result = translator$15.encode(params2);
31871
+ const result = translator$16.encode(params2);
31835
31872
  if (!result) return { nodes: [], consumed: 0 };
31836
31873
  return {
31837
31874
  nodes: [result],
@@ -31903,7 +31940,7 @@ const handleBookmarkStartNode = (params2) => {
31903
31940
  if (isCustomMarkBookmark(nodes[0], params2.editor)) {
31904
31941
  return handleBookmarkNode(params2);
31905
31942
  }
31906
- const node = translator$1.encode(params2);
31943
+ const node = translator$2.encode(params2);
31907
31944
  if (!node) return { nodes: [], consumed: 0 };
31908
31945
  return { nodes: [node], consumed: 1 };
31909
31946
  };
@@ -31935,7 +31972,7 @@ const handleBookmarkEndNode = (params2) => {
31935
31972
  if (!nodes.length || nodes[0].name !== "w:bookmarkEnd") {
31936
31973
  return { nodes: [], consumed: 0 };
31937
31974
  }
31938
- const node = translator.encode(params2);
31975
+ const node = translator$1.encode(params2);
31939
31976
  if (!node) return { nodes: [], consumed: 0 };
31940
31977
  return { nodes: [node], consumed: 1 };
31941
31978
  };
@@ -31943,32 +31980,86 @@ const bookmarkEndNodeHandlerEntity = {
31943
31980
  handlerName: "w:bookmarkEndTranslator",
31944
31981
  handler: handleBookmarkEndNode
31945
31982
  };
31983
+ const ALTERNATE_CONTENT_NODE = "mc:AlternateContent";
31984
+ const SUPPORTED_REQUIRES = /* @__PURE__ */ new Set([
31985
+ "wps",
31986
+ "wp14",
31987
+ "w14",
31988
+ "w15",
31989
+ "w16",
31990
+ "w16cex",
31991
+ "w16cid",
31992
+ "w16du",
31993
+ "w16sdtdh",
31994
+ "w16sdtfl",
31995
+ "w16se"
31996
+ ]);
31997
+ const skipHandlerResponse = { nodes: [], consumed: 0 };
31998
+ const isAlternateContentNode = (node) => node?.name === ALTERNATE_CONTENT_NODE;
31999
+ const isSupportedChoice = (choice) => {
32000
+ if (!choice?.attributes) return false;
32001
+ const requires = choice.attributes.Requires || choice.attributes.requires;
32002
+ if (!requires) return false;
32003
+ return requires.split(/\s+/).filter(Boolean).some((namespace2) => SUPPORTED_REQUIRES.has(namespace2));
32004
+ };
32005
+ const resolveAlternateContentElements = (alternateContent) => {
32006
+ if (!alternateContent?.elements?.length) return null;
32007
+ const choices = alternateContent.elements.filter((el) => el.name === "mc:Choice");
32008
+ const fallback = alternateContent.elements.find((el) => el.name === "mc:Fallback");
32009
+ const supportedChoice = choices.find(isSupportedChoice);
32010
+ const selectedElements = supportedChoice?.elements || fallback?.elements || choices[0]?.elements;
32011
+ if (!selectedElements) return null;
32012
+ return carbonCopy(selectedElements);
32013
+ };
32014
+ const buildNodeWithoutAlternateContent = (node) => {
32015
+ const { elements } = node || {};
32016
+ if (!elements?.length) return null;
32017
+ let replaced = false;
32018
+ const updatedElements = [];
32019
+ elements.forEach((element) => {
32020
+ if (isAlternateContentNode(element)) {
32021
+ const resolved = resolveAlternateContentElements(element);
32022
+ if (resolved) {
32023
+ updatedElements.push(...resolved);
32024
+ replaced = true;
32025
+ return;
32026
+ }
32027
+ updatedElements.push(carbonCopy(element));
32028
+ return;
32029
+ }
32030
+ updatedElements.push(carbonCopy(element));
32031
+ });
32032
+ if (!replaced) return null;
32033
+ const clone = carbonCopy(node);
32034
+ clone.elements = updatedElements;
32035
+ return clone;
32036
+ };
31946
32037
  const handleAlternateChoice = (params2) => {
31947
- const skipHandlerResponse = { nodes: [], consumed: 0 };
31948
32038
  const { nodes, nodeListHandler } = params2;
31949
- if (nodes.length === 0 || nodes[0].name !== "w:p") {
32039
+ if (!nodes?.length) {
31950
32040
  return skipHandlerResponse;
31951
32041
  }
31952
- const mainNode = nodes[0];
31953
- const node = mainNode?.elements?.find((el) => el.name === "w:r");
31954
- const hasAltChoice = node?.elements?.some((el) => el.name === "mc:AlternateContent");
31955
- if (!hasAltChoice) {
31956
- return skipHandlerResponse;
32042
+ const [currentNode] = nodes;
32043
+ if (isAlternateContentNode(currentNode)) {
32044
+ const resolvedElements = resolveAlternateContentElements(currentNode);
32045
+ if (!resolvedElements) {
32046
+ return skipHandlerResponse;
32047
+ }
32048
+ const result2 = nodeListHandler.handler({
32049
+ ...params2,
32050
+ nodes: resolvedElements,
32051
+ path: [...params2.path || [], currentNode]
32052
+ });
32053
+ return { nodes: result2, consumed: 1 };
31957
32054
  }
31958
- const altChoiceNode = node.elements.find((el) => el.name === "mc:AlternateContent");
31959
- node.elements.findIndex((el) => el.name === "mc:AlternateContent");
31960
- const allowedNamespaces = ["wps", "wp14", "w14", "w15"];
31961
- const wpsNode = altChoiceNode.elements.find(
31962
- (el) => el.name === "mc:Choice" && allowedNamespaces.includes(el.attributes["Requires"])
31963
- );
31964
- if (!wpsNode) {
32055
+ const sanitizedNode = buildNodeWithoutAlternateContent(currentNode);
32056
+ if (!sanitizedNode) {
31965
32057
  return skipHandlerResponse;
31966
32058
  }
31967
- const contents = wpsNode.elements;
31968
32059
  const result = nodeListHandler.handler({
31969
32060
  ...params2,
31970
- nodes: contents,
31971
- path: [...params2.path || [], wpsNode]
32061
+ nodes: [sanitizedNode],
32062
+ path: [...params2.path || [], sanitizedNode]
31972
32063
  });
31973
32064
  return { nodes: result, consumed: 1 };
31974
32065
  };
@@ -32574,7 +32665,7 @@ const handleTabNode = (params2) => {
32574
32665
  if (!nodes.length || nodes[0].name !== "w:tab") {
32575
32666
  return { nodes: [], consumed: 0 };
32576
32667
  }
32577
- const node = translator$13.encode(params2);
32668
+ const node = translator$14.encode(params2);
32578
32669
  return { nodes: [node], consumed: 1 };
32579
32670
  };
32580
32671
  const tabNodeEntityHandler = {
@@ -33138,7 +33229,7 @@ const _SuperConverter = class _SuperConverter2 {
33138
33229
  return;
33139
33230
  }
33140
33231
  }
33141
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.20.2") {
33232
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.21.0") {
33142
33233
  const customLocation = "docProps/custom.xml";
33143
33234
  if (!docx[customLocation]) {
33144
33235
  docx[customLocation] = generateCustomXml();
@@ -33631,7 +33722,7 @@ function storeSuperdocVersion(docx) {
33631
33722
  function generateCustomXml() {
33632
33723
  return DEFAULT_CUSTOM_XML;
33633
33724
  }
33634
- function generateSuperdocVersion(pid = 2, version2 = "0.20.2") {
33725
+ function generateSuperdocVersion(pid = 2, version2 = "0.21.0") {
33635
33726
  return {
33636
33727
  type: "element",
33637
33728
  name: "property",
@@ -50699,6 +50790,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
50699
50790
  element.style.isolation = "isolate";
50700
50791
  proseMirror.style.outline = "none";
50701
50792
  proseMirror.style.border = "none";
50793
+ element.style.backgroundColor = "#fff";
50794
+ proseMirror.style.backgroundColor = "#fff";
50702
50795
  const { typeface, fontSizePt, fontFamilyCss } = this.converter.getDocumentDefaultStyles() ?? {};
50703
50796
  const resolvedFontFamily = fontFamilyCss || typeface;
50704
50797
  if (resolvedFontFamily) {
@@ -51021,7 +51114,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
51021
51114
  * @returns {Object | void} Migration results
51022
51115
  */
51023
51116
  processCollaborationMigrations() {
51024
- console.debug("[checkVersionMigrations] Current editor version", "0.20.2");
51117
+ console.debug("[checkVersionMigrations] Current editor version", "0.21.0");
51025
51118
  if (!this.options.ydoc) return;
51026
51119
  const metaMap = this.options.ydoc.getMap("meta");
51027
51120
  let docVersion = metaMap.get("version");
@@ -53499,6 +53592,14 @@ const intToJapaneseCounting = (num) => {
53499
53592
  return result;
53500
53593
  };
53501
53594
  const CustomSelectionPluginKey = new PluginKey("CustomSelection");
53595
+ const shouldAllowNativeContextMenu = (event) => {
53596
+ if (!event) return false;
53597
+ if (event.ctrlKey || event.metaKey) {
53598
+ return true;
53599
+ }
53600
+ const isKeyboardInvocation = event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === void 0) && event.clientX === 0 && event.clientY === 0;
53601
+ return Boolean(isKeyboardInvocation);
53602
+ };
53502
53603
  const handleClickOutside = (event, editor) => {
53503
53604
  const editorElem = editor?.options?.element;
53504
53605
  if (!editorElem) return;
@@ -53560,6 +53661,9 @@ const CustomSelection = Extension.create({
53560
53661
  props: {
53561
53662
  handleDOMEvents: {
53562
53663
  contextmenu: (view, event) => {
53664
+ if (shouldAllowNativeContextMenu(event)) {
53665
+ return false;
53666
+ }
53563
53667
  event.preventDefault();
53564
53668
  const { selection } = view.state;
53565
53669
  if (!selection.empty) {
@@ -53578,6 +53682,9 @@ const CustomSelection = Extension.create({
53578
53682
  },
53579
53683
  mousedown: (view, event) => {
53580
53684
  if (event.button === 2) {
53685
+ if (shouldAllowNativeContextMenu(event)) {
53686
+ return false;
53687
+ }
53581
53688
  event.preventDefault();
53582
53689
  const { selection: selection2 } = view.state;
53583
53690
  if (!selection2.empty) {
@@ -83569,6 +83676,115 @@ runCommandWithArgumentOnly_fn = function({ item, argument, noArgumentCallback =
83569
83676
  this.updateToolbarState();
83570
83677
  }
83571
83678
  };
83679
+ const onMarginClickCursorChange = (event, editor) => {
83680
+ const y2 = event.clientY;
83681
+ const x = event.clientX;
83682
+ const { view } = editor;
83683
+ const editorRect = view.dom.getBoundingClientRect();
83684
+ let coords = {
83685
+ left: 0,
83686
+ top: y2
83687
+ };
83688
+ let isRightMargin = false;
83689
+ if (x > editorRect.right) {
83690
+ coords.left = editorRect.left + editorRect.width - 1;
83691
+ isRightMargin = true;
83692
+ } else if (x < editorRect.left) {
83693
+ coords.left = editorRect.left;
83694
+ }
83695
+ const pos = view.posAtCoords(coords)?.pos;
83696
+ if (pos) {
83697
+ let cursorPos = pos;
83698
+ if (isRightMargin) {
83699
+ const $pos = view.state.doc.resolve(pos);
83700
+ const charOffset = $pos.textOffset;
83701
+ const node = view.state.doc.nodeAt(pos);
83702
+ const text = node?.text;
83703
+ const charAtPos = text?.charAt(charOffset);
83704
+ cursorPos = node?.isText && charAtPos !== " " ? pos - 1 : pos;
83705
+ }
83706
+ const transaction = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, cursorPos));
83707
+ view.dispatch(transaction);
83708
+ view.focus();
83709
+ }
83710
+ };
83711
+ const checkNodeSpecificClicks = (editor, event, popoverControls) => {
83712
+ if (!editor) return;
83713
+ if (selectionHasNodeOrMark(editor.view.state, "link", { requireEnds: true })) {
83714
+ popoverControls.component = LinkInput;
83715
+ popoverControls.position = {
83716
+ left: `${event.clientX - editor.element.getBoundingClientRect().left}px`,
83717
+ top: `${event.clientY - editor.element.getBoundingClientRect().top + 15}px`
83718
+ };
83719
+ popoverControls.props = {
83720
+ showInput: true
83721
+ };
83722
+ popoverControls.visible = true;
83723
+ }
83724
+ };
83725
+ function selectionHasNodeOrMark(state2, name, options = {}) {
83726
+ const { requireEnds = false } = options;
83727
+ const $from = state2.selection.$from;
83728
+ const $to = state2.selection.$to;
83729
+ if (requireEnds) {
83730
+ for (let d2 = $from.depth; d2 > 0; d2--) {
83731
+ if ($from.node(d2).type.name === name) {
83732
+ return true;
83733
+ }
83734
+ }
83735
+ for (let d2 = $to.depth; d2 > 0; d2--) {
83736
+ if ($to.node(d2).type.name === name) {
83737
+ return true;
83738
+ }
83739
+ }
83740
+ } else {
83741
+ for (let d2 = $from.depth; d2 > 0; d2--) {
83742
+ if ($from.node(d2).type.name === name) {
83743
+ return true;
83744
+ }
83745
+ }
83746
+ }
83747
+ const markType = state2.schema.marks[name];
83748
+ if (markType) {
83749
+ const { from: from2, to, empty: empty2 } = state2.selection;
83750
+ if (requireEnds) {
83751
+ const fromMarks = markType.isInSet($from.marks());
83752
+ const toMarks = markType.isInSet($to.marks());
83753
+ if (fromMarks || toMarks) {
83754
+ return true;
83755
+ }
83756
+ if (empty2 && markType.isInSet(state2.storedMarks || $from.marks())) {
83757
+ return true;
83758
+ }
83759
+ } else {
83760
+ if (empty2) {
83761
+ if (markType.isInSet(state2.storedMarks || $from.marks())) {
83762
+ return true;
83763
+ }
83764
+ } else {
83765
+ let hasMark = false;
83766
+ state2.doc.nodesBetween(from2, to, (node) => {
83767
+ if (markType.isInSet(node.marks)) {
83768
+ hasMark = true;
83769
+ return false;
83770
+ }
83771
+ });
83772
+ if (hasMark) return true;
83773
+ }
83774
+ }
83775
+ }
83776
+ return false;
83777
+ }
83778
+ function moveCursorToMouseEvent(event, editor) {
83779
+ const { view } = editor;
83780
+ const coords = { left: event.clientX, top: event.clientY };
83781
+ const pos = view.posAtCoords(coords)?.pos;
83782
+ if (typeof pos === "number") {
83783
+ const tr = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, pos));
83784
+ view.dispatch(tr);
83785
+ view.focus();
83786
+ }
83787
+ }
83572
83788
  const ICONS = {
83573
83789
  addRowBefore: plusIconSvg,
83574
83790
  addRowAfter: plusIconSvg,
@@ -83768,6 +83984,30 @@ const getPropsByItemId = (itemId, props) => {
83768
83984
  return baseProps;
83769
83985
  }
83770
83986
  };
83987
+ function normalizeClipboardContent(rawClipboardContent) {
83988
+ if (!rawClipboardContent) {
83989
+ return {
83990
+ html: null,
83991
+ text: null,
83992
+ hasContent: false,
83993
+ raw: null
83994
+ };
83995
+ }
83996
+ const html = typeof rawClipboardContent.html === "string" ? rawClipboardContent.html : null;
83997
+ const text = typeof rawClipboardContent.text === "string" ? rawClipboardContent.text : null;
83998
+ const hasHtml = !!html && html.trim().length > 0;
83999
+ const hasText = !!text && text.length > 0;
84000
+ const isObject2 = typeof rawClipboardContent === "object" && rawClipboardContent !== null;
84001
+ const fragmentSize = typeof rawClipboardContent.size === "number" ? rawClipboardContent.size : null;
84002
+ const nestedSize = isObject2 && rawClipboardContent.content && typeof rawClipboardContent.content.size === "number" ? rawClipboardContent.content.size : null;
84003
+ const hasFragmentContent = (fragmentSize ?? nestedSize ?? 0) > 0;
84004
+ return {
84005
+ html,
84006
+ text,
84007
+ hasContent: hasHtml || hasText || hasFragmentContent,
84008
+ raw: rawClipboardContent
84009
+ };
84010
+ }
83771
84011
  async function getEditorContext(editor, event) {
83772
84012
  const { view } = editor;
83773
84013
  const { state: state2 } = view;
@@ -83783,125 +84023,154 @@ async function getEditorContext(editor, event) {
83783
84023
  pos = from2;
83784
84024
  node = state2.doc.nodeAt(pos);
83785
84025
  }
83786
- const clipboardContent = await readFromClipboard(state2);
84026
+ const rawClipboardContent = await readFromClipboard(state2);
84027
+ const clipboardContent = normalizeClipboardContent(rawClipboardContent);
84028
+ const structureFromResolvedPos = pos !== null ? getStructureFromResolvedPos(state2, pos) : null;
84029
+ const isInTable2 = structureFromResolvedPos?.isInTable ?? selectionHasNodeOrMark(state2, "table", { requireEnds: true });
84030
+ const isInList = structureFromResolvedPos?.isInList ?? (selectionHasNodeOrMark(state2, "bulletList", { requireEnds: false }) || selectionHasNodeOrMark(state2, "orderedList", { requireEnds: false }));
84031
+ const isInSectionNode = structureFromResolvedPos?.isInSectionNode ?? selectionHasNodeOrMark(state2, "documentSection", { requireEnds: true });
84032
+ const currentNodeType = node?.type?.name || null;
84033
+ const activeMarks = [];
84034
+ if (event && pos !== null) {
84035
+ const $pos = state2.doc.resolve(pos);
84036
+ if ($pos.marks && typeof $pos.marks === "function") {
84037
+ $pos.marks().forEach((mark) => activeMarks.push(mark.type.name));
84038
+ }
84039
+ if (node && node.marks) {
84040
+ node.marks.forEach((mark) => activeMarks.push(mark.type.name));
84041
+ }
84042
+ } else {
84043
+ state2.storedMarks?.forEach((mark) => activeMarks.push(mark.type.name));
84044
+ state2.selection.$head.marks().forEach((mark) => activeMarks.push(mark.type.name));
84045
+ }
84046
+ const isTrackedChange = activeMarks.includes("trackInsert") || activeMarks.includes("trackDelete");
84047
+ let trackedChangeId = null;
84048
+ if (isTrackedChange && event && pos !== null) {
84049
+ const $pos = state2.doc.resolve(pos);
84050
+ const marksAtPos = $pos.marks();
84051
+ const trackedMark = marksAtPos.find((mark) => mark.type.name === "trackInsert" || mark.type.name === "trackDelete");
84052
+ if (trackedMark) {
84053
+ trackedChangeId = trackedMark.attrs.id;
84054
+ }
84055
+ }
84056
+ const cursorCoords = pos ? view.coordsAtPos(pos) : null;
84057
+ const cursorPosition = cursorCoords ? {
84058
+ x: cursorCoords.left,
84059
+ y: cursorCoords.top
84060
+ } : null;
83787
84061
  return {
83788
- editor,
84062
+ // Selection info
83789
84063
  selectedText,
84064
+ hasSelection: !empty2,
84065
+ selectionStart: from2,
84066
+ selectionEnd: to,
84067
+ // Document structure
84068
+ isInTable: isInTable2,
84069
+ isInList,
84070
+ isInSectionNode,
84071
+ currentNodeType,
84072
+ activeMarks,
84073
+ // Document state
84074
+ isTrackedChange,
84075
+ trackedChangeId,
84076
+ documentMode: editor.options?.documentMode || "editing",
84077
+ canUndo: computeCanUndo(editor, state2),
84078
+ canRedo: computeCanRedo(editor, state2),
84079
+ isEditable: editor.isEditable,
84080
+ // Clipboard
84081
+ clipboardContent,
84082
+ // Position and trigger info
84083
+ cursorPosition,
83790
84084
  pos,
83791
84085
  node,
83792
84086
  event,
83793
- clipboardContent
84087
+ // Editor reference for advanced use cases
84088
+ editor
83794
84089
  };
83795
84090
  }
83796
- const onMarginClickCursorChange = (event, editor) => {
83797
- const y2 = event.clientY;
83798
- const x = event.clientX;
83799
- const { view } = editor;
83800
- const editorRect = view.dom.getBoundingClientRect();
83801
- let coords = {
83802
- left: 0,
83803
- top: y2
83804
- };
83805
- let isRightMargin = false;
83806
- if (x > editorRect.right) {
83807
- coords.left = editorRect.left + editorRect.width - 1;
83808
- isRightMargin = true;
83809
- } else if (x < editorRect.left) {
83810
- coords.left = editorRect.left;
84091
+ function computeCanUndo(editor, state2) {
84092
+ if (typeof editor?.can === "function") {
84093
+ try {
84094
+ const can = editor.can();
84095
+ if (can && typeof can.undo === "function") {
84096
+ return !!can.undo();
84097
+ }
84098
+ } catch (error) {
84099
+ console.warn("[SlashMenu] Unable to determine undo availability via editor.can():", error);
84100
+ }
83811
84101
  }
83812
- const pos = view.posAtCoords(coords)?.pos;
83813
- if (pos) {
83814
- let cursorPos = pos;
83815
- if (isRightMargin) {
83816
- const $pos = view.state.doc.resolve(pos);
83817
- const charOffset = $pos.textOffset;
83818
- const node = view.state.doc.nodeAt(pos);
83819
- const text = node?.text;
83820
- const charAtPos = text?.charAt(charOffset);
83821
- cursorPos = node?.isText && charAtPos !== " " ? pos - 1 : pos;
84102
+ if (isCollaborationEnabled(editor)) {
84103
+ try {
84104
+ const undoManager = yUndoPluginKey.getState(state2)?.undoManager;
84105
+ return !!undoManager && undoManager.undoStack.length > 0;
84106
+ } catch (error) {
84107
+ console.warn("[SlashMenu] Unable to determine undo availability via y-prosemirror:", error);
83822
84108
  }
83823
- const transaction = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, cursorPos));
83824
- view.dispatch(transaction);
83825
- view.focus();
83826
84109
  }
83827
- };
83828
- const checkNodeSpecificClicks = (editor, event, popoverControls) => {
83829
- if (!editor) return;
83830
- if (selectionHasNodeOrMark(editor.view.state, "link", { requireEnds: true })) {
83831
- popoverControls.component = LinkInput;
83832
- popoverControls.position = {
83833
- left: `${event.clientX - editor.element.getBoundingClientRect().left}px`,
83834
- top: `${event.clientY - editor.element.getBoundingClientRect().top + 15}px`
83835
- };
83836
- popoverControls.props = {
83837
- showInput: true
83838
- };
83839
- popoverControls.visible = true;
84110
+ try {
84111
+ return undoDepth(state2) > 0;
84112
+ } catch (error) {
84113
+ console.warn("[SlashMenu] Unable to determine undo availability via history plugin:", error);
84114
+ return false;
83840
84115
  }
83841
- };
83842
- function selectionHasNodeOrMark(state2, name, options = {}) {
83843
- const { requireEnds = false } = options;
83844
- const $from = state2.selection.$from;
83845
- const $to = state2.selection.$to;
83846
- if (requireEnds) {
83847
- for (let d2 = $from.depth; d2 > 0; d2--) {
83848
- if ($from.node(d2).type.name === name) {
83849
- return true;
83850
- }
83851
- }
83852
- for (let d2 = $to.depth; d2 > 0; d2--) {
83853
- if ($to.node(d2).type.name === name) {
83854
- return true;
83855
- }
83856
- }
83857
- } else {
83858
- for (let d2 = $from.depth; d2 > 0; d2--) {
83859
- if ($from.node(d2).type.name === name) {
83860
- return true;
84116
+ }
84117
+ function computeCanRedo(editor, state2) {
84118
+ if (typeof editor?.can === "function") {
84119
+ try {
84120
+ const can = editor.can();
84121
+ if (can && typeof can.redo === "function") {
84122
+ return !!can.redo();
83861
84123
  }
84124
+ } catch (error) {
84125
+ console.warn("[SlashMenu] Unable to determine redo availability via editor.can():", error);
83862
84126
  }
83863
84127
  }
83864
- const markType = state2.schema.marks[name];
83865
- if (markType) {
83866
- const { from: from2, to, empty: empty2 } = state2.selection;
83867
- if (requireEnds) {
83868
- const fromMarks = markType.isInSet($from.marks());
83869
- const toMarks = markType.isInSet($to.marks());
83870
- if (fromMarks || toMarks) {
83871
- return true;
83872
- }
83873
- if (empty2 && markType.isInSet(state2.storedMarks || $from.marks())) {
83874
- return true;
83875
- }
83876
- } else {
83877
- if (empty2) {
83878
- if (markType.isInSet(state2.storedMarks || $from.marks())) {
83879
- return true;
83880
- }
83881
- } else {
83882
- let hasMark = false;
83883
- state2.doc.nodesBetween(from2, to, (node) => {
83884
- if (markType.isInSet(node.marks)) {
83885
- hasMark = true;
83886
- return false;
83887
- }
83888
- });
83889
- if (hasMark) return true;
83890
- }
84128
+ if (isCollaborationEnabled(editor)) {
84129
+ try {
84130
+ const undoManager = yUndoPluginKey.getState(state2)?.undoManager;
84131
+ return !!undoManager && undoManager.redoStack.length > 0;
84132
+ } catch (error) {
84133
+ console.warn("[SlashMenu] Unable to determine redo availability via y-prosemirror:", error);
83891
84134
  }
83892
84135
  }
83893
- return false;
84136
+ try {
84137
+ return redoDepth(state2) > 0;
84138
+ } catch (error) {
84139
+ console.warn("[SlashMenu] Unable to determine redo availability via history plugin:", error);
84140
+ return false;
84141
+ }
83894
84142
  }
83895
- function moveCursorToMouseEvent(event, editor) {
83896
- const { view } = editor;
83897
- const coords = { left: event.clientX, top: event.clientY };
83898
- const pos = view.posAtCoords(coords)?.pos;
83899
- if (typeof pos === "number") {
83900
- const tr = view.state.tr.setSelection(TextSelection$1.create(view.state.doc, pos));
83901
- view.dispatch(tr);
83902
- view.focus();
84143
+ function isCollaborationEnabled(editor) {
84144
+ return Boolean(editor?.options?.collaborationProvider && editor?.options?.ydoc);
84145
+ }
84146
+ function getStructureFromResolvedPos(state2, pos) {
84147
+ try {
84148
+ const $pos = state2.doc.resolve(pos);
84149
+ const ancestors = /* @__PURE__ */ new Set();
84150
+ for (let depth = $pos.depth; depth > 0; depth--) {
84151
+ ancestors.add($pos.node(depth).type.name);
84152
+ }
84153
+ const isInList = ancestors.has("bulletList") || ancestors.has("orderedList");
84154
+ const isInTable2 = ancestors.has("table") || ancestors.has("tableRow") || ancestors.has("tableCell") || ancestors.has("tableHeader");
84155
+ const isInSectionNode = ancestors.has("documentSection");
84156
+ return {
84157
+ isInTable: isInTable2,
84158
+ isInList,
84159
+ isInSectionNode
84160
+ };
84161
+ } catch (error) {
84162
+ console.warn("[SlashMenu] Unable to resolve position for structural context:", error);
84163
+ return null;
83903
84164
  }
83904
84165
  }
84166
+ const shouldBypassContextMenu = (event) => {
84167
+ if (!event) return false;
84168
+ if (event.ctrlKey || event.metaKey) {
84169
+ return true;
84170
+ }
84171
+ const isKeyboardInvocation = event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === void 0) && event.clientX === 0 && event.clientY === 0;
84172
+ return Boolean(isKeyboardInvocation);
84173
+ };
83905
84174
  const isModuleEnabled = (editorOptions, moduleName) => {
83906
84175
  switch (moduleName) {
83907
84176
  case "ai":
@@ -83913,8 +84182,52 @@ const isModuleEnabled = (editorOptions, moduleName) => {
83913
84182
  return true;
83914
84183
  }
83915
84184
  };
84185
+ function applyCustomMenuConfiguration(defaultSections, context) {
84186
+ const { editor } = context;
84187
+ const slashMenuConfig = editor.options?.slashMenuConfig;
84188
+ if (!slashMenuConfig) {
84189
+ return defaultSections;
84190
+ }
84191
+ let sections = [];
84192
+ if (slashMenuConfig.includeDefaultItems !== false) {
84193
+ sections = [...defaultSections];
84194
+ }
84195
+ if (slashMenuConfig.customItems && Array.isArray(slashMenuConfig.customItems)) {
84196
+ sections = [...sections, ...slashMenuConfig.customItems];
84197
+ }
84198
+ if (typeof slashMenuConfig.menuProvider === "function") {
84199
+ try {
84200
+ sections = slashMenuConfig.menuProvider(context, sections) || sections;
84201
+ } catch (error) {
84202
+ console.warn("[SlashMenu] Error in custom menuProvider:", error);
84203
+ }
84204
+ }
84205
+ return sections;
84206
+ }
84207
+ function filterCustomItems(sections, context) {
84208
+ return sections.map((section) => {
84209
+ const filteredItems = section.items.filter((item) => {
84210
+ if (typeof item.showWhen === "function") {
84211
+ try {
84212
+ return item.showWhen(context);
84213
+ } catch (error) {
84214
+ console.warn(`[SlashMenu] Error in showWhen for item ${item.id}:`, error);
84215
+ return false;
84216
+ }
84217
+ }
84218
+ return true;
84219
+ });
84220
+ return {
84221
+ ...section,
84222
+ items: filteredItems
84223
+ };
84224
+ }).filter((section) => section.items.length > 0);
84225
+ }
83916
84226
  function getItems(context) {
83917
84227
  const { editor, selectedText, trigger: trigger2, clipboardContent } = context;
84228
+ const clipboardHasContent = Boolean(
84229
+ clipboardContent?.hasContent || clipboardContent?.html || clipboardContent?.text || typeof clipboardContent?.size === "number" && clipboardContent.size > 0 || clipboardContent && typeof clipboardContent?.content?.size === "number" && clipboardContent.content.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw.size === "number" && clipboardContent.raw.size > 0 || clipboardContent?.raw && typeof clipboardContent.raw?.content?.size === "number" && clipboardContent.raw.content.size > 0
84230
+ );
83918
84231
  const isInTable2 = selectionHasNodeOrMark(editor.view.state, "table", { requireEnds: true });
83919
84232
  const isInSectionNode = selectionHasNodeOrMark(editor.view.state, "documentSection", { requireEnds: true });
83920
84233
  const sections = [
@@ -84051,12 +84364,13 @@ function getItems(context) {
84051
84364
  ]
84052
84365
  }
84053
84366
  ];
84054
- const filteredSections = sections.map((section) => {
84367
+ let allSections = applyCustomMenuConfiguration(sections, context);
84368
+ const filteredSections = allSections.map((section) => {
84055
84369
  const filteredItems = section.items.filter((item) => {
84056
84370
  if (item.requiresModule && !isModuleEnabled(editor?.options, item.requiresModule)) return false;
84057
84371
  if (item.requiresSelection && !selectedText) return false;
84058
84372
  if (!item.allowedTriggers.includes(trigger2)) return false;
84059
- if (item.requiresClipboard && !clipboardContent) return false;
84373
+ if (item.requiresClipboard && !clipboardHasContent) return false;
84060
84374
  if (item.requiresTableParent && !isInTable2 || item.id === "insert-table" && isInTable2) return false;
84061
84375
  if (item.requiresSectionParent && !isInSectionNode) return false;
84062
84376
  return true;
@@ -84066,7 +84380,8 @@ function getItems(context) {
84066
84380
  items: filteredItems
84067
84381
  };
84068
84382
  }).filter((section) => section.items.length > 0);
84069
- return filteredSections;
84383
+ const finalSections = filterCustomItems(filteredSections, context);
84384
+ return finalSections;
84070
84385
  }
84071
84386
  const _hoisted_1$3 = { class: "slash-menu-items" };
84072
84387
  const _hoisted_2$1 = {
@@ -84101,6 +84416,7 @@ const _sfc_main$4 = {
84101
84416
  const menuRef = vue.ref(null);
84102
84417
  const sections = vue.ref([]);
84103
84418
  const selectedId = vue.ref(null);
84419
+ const currentContext = vue.ref(null);
84104
84420
  const handleEditorUpdate = () => {
84105
84421
  if (!props.editor?.isEditable && isOpen.value) {
84106
84422
  closeMenu({ restoreCursor: false });
@@ -84146,6 +84462,44 @@ const _sfc_main$4 = {
84146
84462
  selectedId.value = newItems[0].id;
84147
84463
  }
84148
84464
  });
84465
+ const customItemRefs = /* @__PURE__ */ new Map();
84466
+ const setCustomItemRef = (el, item) => {
84467
+ if (el && item.render) {
84468
+ customItemRefs.set(item.id, { element: el, item });
84469
+ vue.nextTick(() => {
84470
+ renderCustomItem(item.id);
84471
+ });
84472
+ }
84473
+ };
84474
+ const renderCustomItem = async (itemId) => {
84475
+ const refData = customItemRefs.get(itemId);
84476
+ if (!refData || refData.element.hasCustomContent) return;
84477
+ const { element, item } = refData;
84478
+ try {
84479
+ if (!currentContext.value) {
84480
+ currentContext.value = await getEditorContext(props.editor);
84481
+ }
84482
+ const context = currentContext.value;
84483
+ const customElement = item.render(context);
84484
+ if (customElement instanceof HTMLElement) {
84485
+ element.innerHTML = "";
84486
+ element.appendChild(customElement);
84487
+ element.hasCustomContent = true;
84488
+ }
84489
+ } catch (error) {
84490
+ console.warn(`[SlashMenu] Error rendering custom item ${itemId}:`, error);
84491
+ element.innerHTML = `<span>${item.label || "Custom Item"}</span>`;
84492
+ element.hasCustomContent = true;
84493
+ }
84494
+ };
84495
+ const cleanupCustomItems = () => {
84496
+ customItemRefs.forEach((refData) => {
84497
+ if (refData.element) {
84498
+ refData.element.hasCustomContent = false;
84499
+ }
84500
+ });
84501
+ customItemRefs.clear();
84502
+ };
84149
84503
  const handleGlobalKeyDown = (event) => {
84150
84504
  if (event.key === "Escape") {
84151
84505
  event.preventDefault();
@@ -84191,27 +84545,27 @@ const _sfc_main$4 = {
84191
84545
  };
84192
84546
  const handleRightClick = async (event) => {
84193
84547
  const readOnly = !props.editor?.isEditable;
84194
- const isHoldingCtrl = event.ctrlKey;
84195
- if (readOnly || isHoldingCtrl) {
84548
+ if (readOnly || shouldBypassContextMenu(event)) {
84196
84549
  return;
84197
84550
  }
84198
84551
  event.preventDefault();
84552
+ const context = await getEditorContext(props.editor, event);
84553
+ currentContext.value = context;
84554
+ sections.value = getItems({ ...context, trigger: "click" });
84555
+ selectedId.value = flattenedItems.value[0]?.id || null;
84556
+ searchQuery.value = "";
84199
84557
  props.editor.view.dispatch(
84200
84558
  props.editor.view.state.tr.setMeta(SlashMenuPluginKey, {
84201
84559
  type: "open",
84202
- pos: props.editor.view.state.selection.from,
84560
+ pos: context?.pos ?? props.editor.view.state.selection.from,
84203
84561
  clientX: event.clientX,
84204
84562
  clientY: event.clientY
84205
84563
  })
84206
84564
  );
84207
- searchQuery.value = "";
84208
- const context = await getEditorContext(props.editor, event);
84209
- sections.value = getItems({ ...context, trigger: "click" });
84210
- selectedId.value = flattenedItems.value[0]?.id || null;
84211
84565
  };
84212
84566
  const executeCommand = async (item) => {
84213
84567
  if (props.editor) {
84214
- item.action ? await item.action(props.editor) : null;
84568
+ item.action ? await item.action(props.editor, currentContext.value) : null;
84215
84569
  if (item.component) {
84216
84570
  menuRef.value;
84217
84571
  const componentProps = getPropsByItemId(item.id, props);
@@ -84229,7 +84583,7 @@ const _sfc_main$4 = {
84229
84583
  const closeMenu = (options = { restoreCursor: true }) => {
84230
84584
  if (props.editor?.view) {
84231
84585
  const pluginState = SlashMenuPluginKey.getState(props.editor.view.state);
84232
- const { anchorPos } = pluginState;
84586
+ const anchorPos = pluginState?.anchorPos;
84233
84587
  props.editor.view.dispatch(
84234
84588
  props.editor.view.state.tr.setMeta(SlashMenuPluginKey, {
84235
84589
  type: "close"
@@ -84242,6 +84596,8 @@ const _sfc_main$4 = {
84242
84596
  props.editor.view.dispatch(tr);
84243
84597
  props.editor.view.focus();
84244
84598
  }
84599
+ cleanupCustomItems();
84600
+ currentContext.value = null;
84245
84601
  isOpen.value = false;
84246
84602
  searchQuery.value = "";
84247
84603
  sections.value = [];
@@ -84258,19 +84614,29 @@ const _sfc_main$4 = {
84258
84614
  isOpen.value = true;
84259
84615
  menuPosition.value = event.menuPosition;
84260
84616
  searchQuery.value = "";
84261
- const context = await getEditorContext(props.editor);
84262
- sections.value = getItems({ ...context, trigger: "slash" });
84263
- selectedId.value = flattenedItems.value[0]?.id || null;
84617
+ if (!currentContext.value) {
84618
+ const context = await getEditorContext(props.editor);
84619
+ currentContext.value = context;
84620
+ sections.value = getItems({ ...context, trigger: "slash" });
84621
+ selectedId.value = flattenedItems.value[0]?.id || null;
84622
+ } else if (sections.value.length === 0) {
84623
+ const trigger2 = currentContext.value.event?.type === "contextmenu" ? "click" : "slash";
84624
+ sections.value = getItems({ ...currentContext.value, trigger: trigger2 });
84625
+ selectedId.value = flattenedItems.value[0]?.id || null;
84626
+ }
84264
84627
  });
84265
84628
  props.editor.view.dom.addEventListener("contextmenu", handleRightClick);
84266
84629
  props.editor.on("slashMenu:close", () => {
84630
+ cleanupCustomItems();
84267
84631
  isOpen.value = false;
84268
84632
  searchQuery.value = "";
84633
+ currentContext.value = null;
84269
84634
  });
84270
84635
  });
84271
84636
  vue.onBeforeUnmount(() => {
84272
84637
  document.removeEventListener("keydown", handleGlobalKeyDown);
84273
84638
  document.removeEventListener("mousedown", handleGlobalOutsideClick);
84639
+ cleanupCustomItems();
84274
84640
  if (props.editor) {
84275
84641
  try {
84276
84642
  props.editor.off("slashMenu:open");
@@ -84317,12 +84683,19 @@ const _sfc_main$4 = {
84317
84683
  class: vue.normalizeClass(["slash-menu-item", { "is-selected": item.id === selectedId.value }]),
84318
84684
  onClick: ($event) => executeCommand(item)
84319
84685
  }, [
84320
- item.icon ? (vue.openBlock(), vue.createElementBlock("span", {
84686
+ item.render ? (vue.openBlock(), vue.createElementBlock("div", {
84321
84687
  key: 0,
84322
- class: "slash-menu-item-icon",
84323
- innerHTML: item.icon
84324
- }, null, 8, _hoisted_4)) : vue.createCommentVNode("", true),
84325
- vue.createBaseVNode("span", null, vue.toDisplayString(item.label), 1)
84688
+ ref_for: true,
84689
+ ref: (el) => setCustomItemRef(el, item),
84690
+ class: "slash-menu-custom-item"
84691
+ }, null, 512)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
84692
+ item.icon ? (vue.openBlock(), vue.createElementBlock("span", {
84693
+ key: 0,
84694
+ class: "slash-menu-item-icon",
84695
+ innerHTML: item.icon
84696
+ }, null, 8, _hoisted_4)) : vue.createCommentVNode("", true),
84697
+ vue.createBaseVNode("span", null, vue.toDisplayString(item.label), 1)
84698
+ ], 64))
84326
84699
  ], 10, _hoisted_3$1);
84327
84700
  }), 128))
84328
84701
  ], 64);
@@ -85017,34 +85390,76 @@ const _sfc_main = {
85017
85390
  }
85018
85391
  };
85019
85392
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
85393
+ const additionalHandlers = Object.freeze({
85394
+ "mc:AlternateContent": translator,
85395
+ "w:b": translator$12,
85396
+ "w:bidiVisual": translator$F,
85397
+ "w:bookmarkEnd": translator$1,
85398
+ "w:bookmarkStart": translator$2,
85399
+ "w:bottom": translator$s,
85400
+ "w:br": translator$16,
85401
+ "w:cantSplit": translator$T,
85402
+ "w:cnfStyle": translator$S,
85403
+ "w:color": translator$_,
85404
+ "w:divId": translator$R,
85405
+ "w:drawing": translator$4,
85406
+ "w:end": translator$q,
85407
+ "w:gridAfter": translator$Q,
85408
+ "w:gridBefore": translator$P,
85409
+ "w:gridCol": translator$b,
85410
+ "w:hidden": translator$O,
85411
+ "w:highlight": translator$15,
85412
+ "w:hyperlink": translator$7,
85413
+ "w:i": translator$11,
85414
+ "w:insideH": translator$o,
85415
+ "w:insideV": translator$n,
85416
+ "w:jc": translator$N,
85417
+ "w:left": translator$m,
85418
+ "w:p": translator$13,
85419
+ "w:r": translator$U,
85420
+ "w:rFonts": translator$Z,
85421
+ "w:rPr": translator$V,
85422
+ "w:rStyle": translator$Y,
85423
+ "w:right": translator$k,
85424
+ "w:sdt": translator$3,
85425
+ "w:shd": translator$E,
85426
+ "w:start": translator$i,
85427
+ "w:strike": translator$$,
85428
+ "w:sz": translator$X,
85429
+ "w:szCs": translator$W,
85430
+ "w:tab": translator$14,
85431
+ "w:tbl": translator$9,
85432
+ "w:tblBorders": translator$e,
85433
+ "w:tblCaption": translator$D,
85434
+ "w:tblCellMar": translator$d,
85435
+ "w:tblCellSpacing": translator$M,
85436
+ "w:tblDescription": translator$C,
85437
+ "w:tblGrid": translator$a,
85438
+ "w:tblHeader": translator$L,
85439
+ "w:tblInd": translator$B,
85440
+ "w:tblLayout": translator$A,
85441
+ "w:tblLook": translator$z,
85442
+ "w:tblOverlap": translator$y,
85443
+ "w:tblPr": translator$c,
85444
+ "w:tblStyle": translator$x,
85445
+ "w:tblStyleColBandSize": translator$w,
85446
+ "w:tblStyleRowBandSize": translator$v,
85447
+ "w:tblW": translator$u,
85448
+ "w:tblpPr": translator$t,
85449
+ "w:tc": translator$8,
85450
+ "w:top": translator$g,
85451
+ "w:tr": translator$G,
85452
+ "w:trHeight": translator$K,
85453
+ "w:trPr": translator$H,
85454
+ "w:u": translator$10,
85455
+ "w:wAfter": translator$J,
85456
+ "w:wBefore": translator$I,
85457
+ "wp:anchor": translator$6,
85458
+ "wp:inline": translator$5
85459
+ });
85020
85460
  const baseHandlers = {
85021
85461
  ...runPropertyTranslators,
85022
- "w:br": translator$15,
85023
- "w:cantSplit": translator$S,
85024
- "w:cnfStyle": translator$R,
85025
- "w:divId": translator$Q,
85026
- "w:gridAfter": translator$P,
85027
- "w:gridBefore": translator$O,
85028
- "w:hidden": translator$N,
85029
- "w:hyperlink": translator$6,
85030
- "w:jc": translator$M,
85031
- "w:p": translator$12,
85032
- "w:r": translator$T,
85033
- "w:rPr": translator$U,
85034
- "w:sdt": translator$2,
85035
- "w:tab": translator$13,
85036
- "w:tblCellSpacing": translator$L,
85037
- "w:tblHeader": translator$K,
85038
- "w:tc": translator$7,
85039
- "w:tr": translator$F,
85040
- "w:trHeight": translator$J,
85041
- "w:trPr": translator$G,
85042
- "w:wAfter": translator$I,
85043
- "w:wBefore": translator$H,
85044
- "wp:anchor": translator$5,
85045
- "wp:inline": translator$4,
85046
- "w:bookmarkStart": translator$1,
85047
- "w:bookmarkEnd": translator
85462
+ ...additionalHandlers
85048
85463
  };
85049
85464
  const registeredHandlers = Object.freeze(baseHandlers);
85050
85465
  const Extensions = {